From: Andrew Cooper Date: Mon, 18 Jan 2016 10:48:44 +0000 (+0000) Subject: Rename CONFIG_ENV_{pv,hvm} to CONFIG_{PV,HVM} X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=fb943e08cead4396d059a784e0064fd286d39ffc;p=people%2Froyger%2Fxen-test-framework.git Rename CONFIG_ENV_{pv,hvm} to CONFIG_{PV,HVM} to avoid them being easily confused with the environment-specific defined. Additionally, reduce the usage of the environment-specific defines to an absolute minimum, to avoid latent issues when introducing new environments. Signed-off-by: Andrew Cooper --- diff --git a/arch/x86/desc.c b/arch/x86/desc.c index ec49b47..86fc980 100644 --- a/arch/x86/desc.c +++ b/arch/x86/desc.c @@ -22,7 +22,7 @@ desc_ptr gdt_ptr = .base = (unsigned long)&gdt, }; -#if defined(CONFIG_ENV_hvm) +#if defined(CONFIG_HVM) gate_desc idt[256] = { }; diff --git a/arch/x86/entry_32.S b/arch/x86/entry_32.S index b36eee8..9f2fd51 100644 --- a/arch/x86/entry_32.S +++ b/arch/x86/entry_32.S @@ -24,7 +24,7 @@ containing the entry vector. */ .macro env_IRET /* Environment specific version of `iret`. */ -#if defined(CONFIG_ENV_pv) +#if defined(CONFIG_PV) jmp HYPERCALL_iret /* PV guests use the 'iret' hypercall. */ @@ -99,7 +99,7 @@ ENTRY(exec_user) /* void (*fn)(void) */ addl $4, (%esp) /* ESP */ pushf /* EFLAGS */ -#if defined(CONFIG_ENV_pv) /* PV guests see the real interrupt flag. Clobber it. */ +#if defined(CONFIG_PV) /* PV guests see the real interrupt flag. Clobber it. */ andl $~X86_EFLAGS_IF, (%esp) #endif diff --git a/arch/x86/entry_64.S b/arch/x86/entry_64.S index 2fe5760..d8f13e7 100644 --- a/arch/x86/entry_64.S +++ b/arch/x86/entry_64.S @@ -29,7 +29,7 @@ metadata. Currently just the entry vector. */ .macro env_ADJUST_FRAME /* Environment specific exception entry. */ -#if defined(CONFIG_ENV_pv64) +#if defined(CONFIG_PV) /* Restore results of Xen SYSRET'ing to this point. */ pop %rcx pop %r11 @@ -37,7 +37,7 @@ metadata. Currently just the entry vector. .endm .macro env_IRETQ /* Environment specific version of `iretq`. */ -#if defined(CONFIG_ENV_pv64) +#if defined(CONFIG_PV) push $0 /* Indicate that this isn't a SYSRET'able */ jmp HYPERCALL_iret /* situation, and use the 'iret' hypercall. */ @@ -112,7 +112,7 @@ ENTRY(exec_user) /* void (*fn)(void) */ addq $8, (%rsp) /* RSP */ pushf /* RFLAGS */ -#if defined(CONFIG_ENV_pv) /* PV guests see the real interrupt flag. Clobber it. */ +#if defined(CONFIG_PV) /* PV guests see the real interrupt flag. Clobber it. */ andq $~X86_EFLAGS_IF, (%rsp) #endif diff --git a/arch/x86/setup.c b/arch/x86/setup.c index a039aa1..4d092b9 100644 --- a/arch/x86/setup.c +++ b/arch/x86/setup.c @@ -16,20 +16,24 @@ uint8_t boot_stack[2 * PAGE_SIZE] __aligned(PAGE_SIZE); const char *environment_description = -#if defined(CONFIG_ENV_pv32) - "PV 32bit" -#elif defined(CONFIG_ENV_pv64) - "PV 64bit" -#elif defined(CONFIG_ENV_hvm32) - "HVM 32bit" -#elif defined(CONFIG_ENV_hvm64) - "HVM 64bit" +#if defined(CONFIG_PV) + "PV" +#elif defined(CONFIG_HVM) + "HVM" #else -# error Bad Environment +# error Bad Guest Type +#endif + +#if defined(__x86_64__) + " 64bit" +#elif defined(__i386__) + " 32bit" +#else +# error Bad Width #endif ; -#ifdef CONFIG_ENV_pv +#ifdef CONFIG_PV /* Filled in by head_pv.S */ start_info_t *start_info = NULL; #endif @@ -42,7 +46,7 @@ start_info_t *start_info = NULL; */ static void init_hypercalls(void) { -#ifdef CONFIG_ENV_hvm +#ifdef CONFIG_HVM uint32_t eax, ebx, ecx, edx, base; bool found = false; @@ -67,7 +71,7 @@ static void init_hypercalls(void) cpuid(base + 2, &eax, &ebx, &ecx, &edx); wrmsr(ebx, (unsigned long)&hypercall_page); barrier(); -#endif +#endif /* CONFIG_HVM */ /* * Confirm that the `ret` poision has been overwritten with a real @@ -83,10 +87,10 @@ static void setup_pv_console(void) xencons_interface_t *cons_ring; evtchn_port_t cons_evtchn; -#if defined(CONFIG_ENV_pv) +#if defined(CONFIG_PV) cons_ring = mfn_to_virt(start_info->console.domU.mfn); cons_evtchn = start_info->console.domU.evtchn; -#elif defined(CONFIG_ENV_hvm) +#elif defined(CONFIG_HVM) { uint64_t raw_pfn, raw_evtchn; @@ -102,7 +106,7 @@ static void setup_pv_console(void) init_pv_console(cons_ring, cons_evtchn); } -#if defined(CONFIG_ENV_hvm) +#if defined(CONFIG_HVM) static void qemu_console_write(const char *buf, size_t len) { asm volatile("rep; outsb" @@ -118,7 +122,7 @@ static void xen_console_write(const char *buf, size_t len) void arch_setup(void) { -#if defined(CONFIG_ENV_hvm) +#if defined(CONFIG_HVM) register_console_callback(qemu_console_write); #endif diff --git a/include/arch/x86/config.h b/include/arch/x86/config.h index b0eb933..2d970fd 100644 --- a/include/arch/x86/config.h +++ b/include/arch/x86/config.h @@ -2,9 +2,9 @@ #define XTF_X86_CONFIG_H #if defined(CONFIG_ENV_pv64) || defined(CONFIG_ENV_pv32) -# define CONFIG_ENV_pv +# define CONFIG_PV #elif defined(CONFIG_ENV_hvm64) || defined(CONFIG_ENV_hvm32) -# define CONFIG_ENV_hvm +# define CONFIG_HVM #endif #endif /* XTF_X86_CONFIG_H */ diff --git a/include/arch/x86/desc.h b/include/arch/x86/desc.h index f8e6235..81a969d 100644 --- a/include/arch/x86/desc.h +++ b/include/arch/x86/desc.h @@ -218,7 +218,7 @@ typedef struct hw_tss32 hw_tss; extern user_desc gdt[NR_GDT_ENTRIES]; extern desc_ptr gdt_ptr; -#if defined(CONFIG_ENV_hvm) +#if defined(CONFIG_HVM) extern gate_desc idt[256]; extern desc_ptr idt_ptr; diff --git a/include/arch/x86/mm.h b/include/arch/x86/mm.h index 59c941e..dfdab21 100644 --- a/include/arch/x86/mm.h +++ b/include/arch/x86/mm.h @@ -24,7 +24,7 @@ static inline void *pfn_to_virt(unsigned long pfn) return (void *)(pfn << PAGE_SHIFT); } -#if defined(CONFIG_ENV_pv) +#if defined(CONFIG_PV) #define m2p ((unsigned long *)MACH2PHYS_VIRT_START) @@ -40,7 +40,7 @@ static inline void *maddr_to_virt(uint64_t maddr) #undef m2p -#endif /* CONFIG_ENV_pv */ +#endif /* CONFIG_PV */ #endif /* XTF_X86_MM_H */ diff --git a/include/arch/x86/segment.h b/include/arch/x86/segment.h index 444c903..7ac52f9 100644 --- a/include/arch/x86/segment.h +++ b/include/arch/x86/segment.h @@ -30,27 +30,35 @@ #define NR_GDT_ENTRIES 9 -#if defined(CONFIG_ENV_hvm64) +/* + * HVM guests use the GDT directly. + */ +#if defined(CONFIG_HVM) + +#ifdef __x86_64__ #define __KERN_CS (GDTE_CS64_DPL0 * 8) #define __KERN_DS (0) #define __USER_CS (GDTE_CS64_DPL3 * 8 + 3) #define __USER_DS (GDTE_DS32_DPL3 * 8 + 3) -#elif defined(CONFIG_ENV_hvm32) +#else /* __x86_64__ */ #define __KERN_CS (GDTE_CS32_DPL0 * 8) #define __KERN_DS (GDTE_DS32_DPL0 * 8) #define __USER_CS (GDTE_CS32_DPL3 * 8 + 3) #define __USER_DS (GDTE_DS32_DPL3 * 8 + 3) -#endif +#endif /* __x86_64__ */ + +#endif /* CONFIG_HVM */ /* * PV guests by default use the Xen ABI-provided selectors. */ -#if defined(CONFIG_ENV_pv64) +#if defined(CONFIG_PV) +#ifdef __x86_64__ /* * 64bit PV guest kernels run in cpl3, but exception frames generated by Xen * report cpl0 when interrupting kernel mode. Trim the kernel selectors down @@ -67,14 +75,16 @@ #define __USER_CS FLAT_RING3_CS64 #define __USER_DS FLAT_RING3_SS64 -#elif defined(CONFIG_ENV_pv32) +#else /* __x86_64__ */ #define __KERN_CS FLAT_RING1_CS #define __KERN_DS FLAT_RING1_DS #define __USER_CS FLAT_RING3_CS #define __USER_DS FLAT_RING3_DS -#endif +#endif /* __x86_64__ */ + +#endif /* CONFIG_PV */ #endif /* XTF_X86_SEGMENT_H */ diff --git a/include/arch/x86/traps.h b/include/arch/x86/traps.h index f2d0450..600aa76 100644 --- a/include/arch/x86/traps.h +++ b/include/arch/x86/traps.h @@ -18,7 +18,7 @@ void __noreturn arch_crash_hard(void); extern uint8_t boot_stack[2 * PAGE_SIZE]; -#if defined(CONFIG_ENV_pv) +#if defined(CONFIG_PV) #include extern struct start_info *start_info;