x86: clean up building in mm/hap/
PATCH 1/1 x86: clean up building in mm/hap/
Building 4-level guest walks is unnecessary for x86-32, and with this no longer being built the fallback code used here isn't necessary anymore either.
Additonally the mechanism to determine the value of GUEST_PAGING_LEVELS to be passed to the compiler can be much simplified given that we're using a pattern rule here.
xen/arch/x86/mm/hap/Makefile +2 -5
@@ -1,12 +1,9 @@ obj-y += hap.o obj-y += guest_walk_2level.o obj-y += guest_walk_3level.o -obj-y += guest_walk_4level.o +obj-$(x86_64) += guest_walk_4level.o obj-y += p2m-ept.o obj-y += nested_hap.o -guest_levels = $(subst level,,$(filter %level,$(subst ., ,$(subst _, ,$(1))))) -guest_walk_defns = -DGUEST_PAGING_LEVELS=$(call guest_levels,$(1)) - guest_walk_%level.o: guest_walk.c Makefile - $(CC) $(CFLAGS) $(call guest_walk_defns,$(@F)) -c $< -o $@ + $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
xen/arch/x86/mm/hap/guest_walk.c +3 -23
@@ -32,7 +32,9 @@#define _hap_p2m_ga_to_gfn (levels) hap_p2m_ga_to_gfn_##levels##_levels#define hap_p2m_ga_to_gfn (levels) _hap_p2m_ga_to_gfn(levels) -#if GUEST_PAGING_LEVELS <=CONFIG_PAGING_LEVELS +#if GUEST_PAGING_LEVELS >CONFIG_PAGING_LEVELS +#error GUEST_PAGING_LEVELS must not exceed CONFIG_PAGING_LEVELS +#endif #include <asm/guest_pt.h> #include <asm/p2m.h>
@@ -119,28 +121,6 @@ unsigned long hap_p2m_ga_to_gfn(GUEST_PAreturn INVALID_GFN ; } -#else - -unsigned long hap_gva_to_gfn (GUEST_PAGING_LEVELS )( -struct vcpu *v,struct p2m_domain *p2m,unsigned long gva,uint32_t *pfec) -{ -gdprintk (XENLOG_ERR , -"Guest paging level is greater than host paging level!\n" ); -domain_crash (v->domain); -return INVALID_GFN ; -} - -unsigned long hap_p2m_ga_to_gfn (GUEST_PAGING_LEVELS )( -struct vcpu *v,struct p2m_domain *p2m,unsigned long cr3, -paddr_t ga,uint32_t *pfec) -{ -gdprintk (XENLOG_ERR , -"Guest paging level is greater than host paging level!\n" ); -domain_crash (v->domain); -return INVALID_GFN ; -} -#endif -/* * Local variables:
Building 4-level guest walks is unnecessary for x86-32, and with this no longer being built the fallback code used here isn't necessary anymore either.
Additonally the mechanism to determine the value of GUEST_PAGING_LEVELS to be passed to the compiler can be much simplified given that we're using a pattern rule here.
xen/arch/x86/mm/hap/Makefile +2 -5
@@ -1,12 +1,9 @@ obj-y += hap.o obj-y += guest_walk_2level.o obj-y += guest_walk_3level.o -obj-y += guest_walk_4level.o +obj-$(x86_64) += guest_walk_4level.o obj-y += p2m-ept.o obj-y += nested_hap.o -guest_levels = $(subst level,,$(filter %level,$(subst ., ,$(subst _, ,$(1))))) -guest_walk_defns = -DGUEST_PAGING_LEVELS=$(call guest_levels,$(1)) - guest_walk_%level.o: guest_walk.c Makefile - $(CC) $(CFLAGS) $(call guest_walk_defns,$(@F)) -c $< -o $@ + $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
xen/arch/x86/mm/hap/guest_walk.c +3 -23
@@ -32,7 +32,9 @@#define _hap_p2m_ga_to_gfn (levels) hap_p2m_ga_to_gfn_##levels##_levels#define hap_p2m_ga_to_gfn (levels) _hap_p2m_ga_to_gfn(levels) -#if GUEST_PAGING_LEVELS <=CONFIG_PAGING_LEVELS +#if GUEST_PAGING_LEVELS >CONFIG_PAGING_LEVELS +#error GUEST_PAGING_LEVELS must not exceed CONFIG_PAGING_LEVELS +#endif #include <asm/guest_pt.h> #include <asm/p2m.h>
@@ -119,28 +121,6 @@ unsigned long hap_p2m_ga_to_gfn(GUEST_PAreturn INVALID_GFN ; } -#else - -unsigned long hap_gva_to_gfn (GUEST_PAGING_LEVELS )( -struct vcpu *v,struct p2m_domain *p2m,unsigned long gva,uint32_t *pfec) -{ -gdprintk (XENLOG_ERR , -"Guest paging level is greater than host paging level!\n" ); -domain_crash (v->domain); -return INVALID_GFN ; -} - -unsigned long hap_p2m_ga_to_gfn (GUEST_PAGING_LEVELS )( -struct vcpu *v,struct p2m_domain *p2m,unsigned long cr3, -paddr_t ga,uint32_t *pfec) -{ -gdprintk (XENLOG_ERR , -"Guest paging level is greater than host paging level!\n" ); -domain_crash (v->domain); -return INVALID_GFN ; -} -#endif -/* * Local variables:
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel