x86/hvm: miscellaneous CPUID handling changes
PATCH 1/1 x86/hvm: miscellaneous CPUID handling changes
- use __clear_bit() rather than clear_bit()
- use switch statements instead of long series of if-s
- eliminate pointless casts
(Applies cleanly only on top of the previously sent SVM/EFER patch.)
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/hvm/hvm.c +16 -15
@@ -614,37 +614,38 @@ void hvm_cpuid(unsigned int input, unsig { if ( !cpuid_hypervisor_leaves(input, eax, ebx, ecx, edx) ) { + struct vcpu *v = current; + cpuid(input, eax, ebx, ecx, edx); -if ( input ==0x00000001 ) + switch ( input ) { -struct vcpu *v = current; - -clear_bit (X86_FEATURE_MWAIT &31 , ecx); + case 0x00000001: + __clear_bit(X86_FEATURE_MWAIT & 31, ecx); if ( vlapic_hw_disabled(vcpu_vlapic(v)) ) -clear_bit (X86_FEATURE_APIC &31 , edx); + __clear_bit(X86_FEATURE_APIC & 31, edx); #if CONFIG_PAGING_LEVELS >= 3 if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_PAE_ENABLED] ) #endif -clear_bit (X86_FEATURE_PAE &31 , edx); -clear_bit (X86_FEATURE_PSE36 &31 , edx); - } -else if ( input ==0x80000001 ) - { + __clear_bit(X86_FEATURE_PAE & 31, edx); + __clear_bit(X86_FEATURE_PSE36 & 31, edx); + break; + + case 0x80000001: #if CONFIG_PAGING_LEVELS >= 3 -struct vcpu *v = current; if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_PAE_ENABLED] ) #endif -clear_bit (X86_FEATURE_NX &31 , edx); + __clear_bit(X86_FEATURE_NX & 31, edx); #ifdef __i386__ /* Mask feature for Intel ia32e or AMD long mode. */ -clear_bit (X86_FEATURE_LAHF_LM &31 , ecx); + __clear_bit(X86_FEATURE_LAHF_LM & 31, ecx); -clear_bit (X86_FEATURE_LM &31 , edx); -clear_bit (X86_FEATURE_SYSCALL &31 , edx); + __clear_bit(X86_FEATURE_LM & 31, edx); + __clear_bit(X86_FEATURE_SYSCALL & 31, edx); #endif + break; } } }
xen/arch/x86/hvm/svm/svm.c +29 -22
87 lines not on this page · raw message
xen/arch/x86/hvm/vmx/vmx.c +40 -31
92 lines not on this page · raw message
xen/include/asm-x86/cpufeature.h +15 -0
@@ -80,9 +80,15 @@#define X86_FEATURE_VMXE (4*32+ 5)/* Virtual Machine Extensions */ #define X86_FEATURE_EST (4*32+ 7)/* Enhanced SpeedStep */ #define X86_FEATURE_TM2 (4*32+ 8)/* Thermal Monitor 2 */ +#define X86_FEATURE_SSSE3 (4*32+ 9)/* Supplemental Streaming SIMD Extensions-3 */ #define X86_FEATURE_CID (4*32+10)/* Context ID */ #define X86_FEATURE_CX16 (4*32+13)/* CMPXCHG16B */ #define X86_FEATURE_XTPR (4*32+14)/* Send Task Priority Messages */ +#define X86_FEATURE_PDCM (4*32+15)/* Perf/Debug Capability MSR */ +#define X86_FEATURE_DCA (4*32+18)/* Direct Cache Access */ +#define X86_FEATURE_SSE4_1 (4*32+19)/* Streaming SIMD Extensions 4.1 */ +#define X86_FEATURE_SSE4_2 (4*32+20)/* Streaming SIMD Extensions 4.2 */ +#define X86_FEATURE_POPCNT (4*32+23)/* POPCNT instruction */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ #define X86_FEATURE_XSTORE (5*32+ 2)/* on-CPU RNG present (xstore insn) */
@@ -94,6 +100,15 @@#define X86_FEATURE_LAHF_LM (6*32+ 0)/* LAHF/SAHF in long mode */ #define X86_FEATURE_CMP_LEGACY (6*32+ 1)/* If yes HyperThreading not valid */ #define X86_FEATURE_SVME (6*32+ 2)/* Secure Virtual Machine */ +#define X86_FEATURE_EXTAPICSPACE (6*32+ 3)/* Extended APIC space */ +#define X86_FEATURE_ALTMOVCR (6*32+ 4)/* LOCK MOV CR accesses CR+8 */ +#define X86_FEATURE_ABM (6*32+ 5)/* Advanced Bit Manipulation */ +#define X86_FEATURE_SSE4A (6*32+ 6)/* AMD Streaming SIMD Extensions-4a */ +#define X86_FEATURE_MISALIGNSSE (6*32+ 7)/* Misaligned SSE Access */ +#define X86_FEATURE_3DNOWPF (6*32+ 8)/* 3DNow! Prefetch */ +#define X86_FEATURE_OSVW (6*32+ 9)/* OS Visible Workaround */ +#define X86_FEATURE_SKINIT (6*32+ 12)/* SKINIT, STGI/CLGI, DEV */ +#define X86_FEATURE_WDT (6*32+ 13)/* Watchdog Timer */ #define cpu_has (c, bit) test_bit(bit, (c)->x86_capability)#define boot_cpu_has (bit) test_bit(bit, boot_cpu_data.x86_capability)