Skip to content

Commit 3d4ebdb

Browse files
vittyvkjgross1
authored andcommitted
x86/xen: create stubs for HVM-only builds in page.h
__pfn_to_mfn() is only used from PV code (mmu_pv.c, p2m.c) and from page.h where all functions calling it check for xen_feature(XENFEAT_auto_translated_physmap) first so we can replace it with any stub to make build happy. set_foreign_p2m_mapping()/clear_foreign_p2m_mapping() are used from grant-table.c but only if !xen_feature(XENFEAT_auto_translated_physmap). Signed-off-by: Vitaly Kuznetsov <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent c504b2f commit 3d4ebdb

File tree

1 file changed

+25
-0
lines changed
  • arch/x86/include/asm/xen

1 file changed

+25
-0
lines changed

arch/x86/include/asm/xen/page.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,30 @@ extern bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn);
5252
extern unsigned long __init set_phys_range_identity(unsigned long pfn_s,
5353
unsigned long pfn_e);
5454

55+
#ifdef CONFIG_XEN_PV
5556
extern int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
5657
struct gnttab_map_grant_ref *kmap_ops,
5758
struct page **pages, unsigned int count);
5859
extern int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
5960
struct gnttab_unmap_grant_ref *kunmap_ops,
6061
struct page **pages, unsigned int count);
62+
#else
63+
static inline int
64+
set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
65+
struct gnttab_map_grant_ref *kmap_ops,
66+
struct page **pages, unsigned int count)
67+
{
68+
return 0;
69+
}
70+
71+
static inline int
72+
clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
73+
struct gnttab_unmap_grant_ref *kunmap_ops,
74+
struct page **pages, unsigned int count)
75+
{
76+
return 0;
77+
}
78+
#endif
6179

6280
/*
6381
* Helper functions to write or read unsigned long values to/from
@@ -73,6 +91,7 @@ static inline int xen_safe_read_ulong(unsigned long *addr, unsigned long *val)
7391
return __get_user(*val, (unsigned long __user *)addr);
7492
}
7593

94+
#ifdef CONFIG_XEN_PV
7695
/*
7796
* When to use pfn_to_mfn(), __pfn_to_mfn() or get_phys_to_machine():
7897
* - pfn_to_mfn() returns either INVALID_P2M_ENTRY or the mfn. No indicator
@@ -99,6 +118,12 @@ static inline unsigned long __pfn_to_mfn(unsigned long pfn)
99118

100119
return mfn;
101120
}
121+
#else
122+
static inline unsigned long __pfn_to_mfn(unsigned long pfn)
123+
{
124+
return pfn;
125+
}
126+
#endif
102127

103128
static inline unsigned long pfn_to_mfn(unsigned long pfn)
104129
{

0 commit comments

Comments
 (0)