x86/mm: build map_domain_gfn() just once It doesn't depend on GUEST_PAGING_LEVELS. Signed-off-by: Jan Beulich --- TBD: To ensure no dependency on GUEST_PAGING_LEVELS, would it perhaps be better to move the function to a file compiled just once? --- a/xen/arch/x86/mm/guest_walk.c +++ b/xen/arch/x86/mm/guest_walk.c @@ -87,8 +87,11 @@ static uint32_t set_ad_bits(void *guest_ return 0; } -/* If the map is non-NULL, we leave this function having - * acquired an extra ref on mfn_to_page(*mfn) */ +#if GUEST_PAGING_LEVELS == CONFIG_PAGING_LEVELS +/* + * If the map is non-NULL, we leave this function having + * acquired an extra ref on mfn_to_page(*mfn). + */ void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn, mfn_t *mfn, p2m_type_t *p2mt, p2m_query_t q, uint32_t *rc) { @@ -125,7 +128,7 @@ void *map_domain_gfn(struct p2m_domain * map = map_domain_page(*mfn); return map; } - +#endif /* Walk the guest pagetables, after the manner of a hardware walker. */ /* Because the walk is essentially random, it can cause a deadlock --- a/xen/include/asm-x86/guest_pt.h +++ b/xen/include/asm-x86/guest_pt.h @@ -305,7 +305,6 @@ guest_walk_to_page_order(walk_t *gw) #define GPT_RENAME2(_n, _l) _n ## _ ## _l ## _levels #define GPT_RENAME(_n, _l) GPT_RENAME2(_n, _l) #define guest_walk_tables GPT_RENAME(guest_walk_tables, GUEST_PAGING_LEVELS) -#define map_domain_gfn GPT_RENAME(map_domain_gfn, GUEST_PAGING_LEVELS) void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn, mfn_t *mfn, p2m_type_t *p2mt, p2m_query_t q, uint32_t *rc);