From: Andrew Cooper Date: Tue, 8 Aug 2017 14:51:01 +0000 (+0100) Subject: Provide non-PV compatability for mfn related functions X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=91d560b73b67c88a7b80a6ebde0c41b1048cbb24;p=people%2Fandrewcoop%2Fxen-test-framework.git Provide non-PV compatability for mfn related functions Similar to non-paged compatability. This allows for extra #ifdef'ary removal from setup.c Signed-off-by: Andrew Cooper --- diff --git a/arch/x86/include/arch/mm.h b/arch/x86/include/arch/mm.h index 1f4ceb2..a17183e 100644 --- a/arch/x86/include/arch/mm.h +++ b/arch/x86/include/arch/mm.h @@ -72,6 +72,14 @@ static inline unsigned long virt_to_mfn(const void *va) #undef m2p +#else /* CONFIG_PV */ + +/* Enough compatibility to compile in HVM environments. */ +extern void *mfn_to_virt(unsigned long mfn); +extern void *maddr_to_virt(uint64_t maddr); +extern unsigned long pfn_to_mfn(unsigned long pfn); +extern unsigned long virt_to_mfn(const void *va); + #endif /* CONFIG_PV */ static inline void *gfn_to_virt(unsigned long gfn) diff --git a/arch/x86/setup.c b/arch/x86/setup.c index be8e5c3..ab1d060 100644 --- a/arch/x86/setup.c +++ b/arch/x86/setup.c @@ -152,10 +152,12 @@ static void setup_pv_console(void) xencons_interface_t *cons_ring; evtchn_port_t cons_evtchn; -#if defined(CONFIG_PV) - cons_ring = mfn_to_virt(start_info->console.domU.mfn); - cons_evtchn = start_info->console.domU.evtchn; -#elif defined(CONFIG_HVM) + if ( IS_DEFINED(CONFIG_PV) ) + { + cons_ring = mfn_to_virt(start_info->console.domU.mfn); + cons_evtchn = start_info->console.domU.evtchn; + } + else /* HVM */ { uint64_t raw_pfn, raw_evtchn; @@ -166,7 +168,6 @@ static void setup_pv_console(void) cons_ring = pfn_to_virt(raw_pfn); cons_evtchn = raw_evtchn; } -#endif init_pv_console(cons_ring, cons_evtchn); }