Jan Beulich
2008-Nov-19 11:34 UTC
[Xen-devel] [PATCH] support CPUID hypervisor feature bit
See http://lkml.org/lkml/2008/10/1/246 for more context. Signed-off-by: Jan Beulich <jbeulich@novell.com> Index: 2008-10-27/xen/arch/x86/domain.c ==================================================================--- 2008-10-27.orig/xen/arch/x86/domain.c 2008-11-11 16:24:48.000000000 +0100 +++ 2008-10-27/xen/arch/x86/domain.c 2008-11-19 10:22:34.000000000 +0100 @@ -1888,6 +1888,8 @@ void domain_cpuid( cpuid_input_t *cpuid; int i; + *eax = *ebx = *ecx = *edx = 0; + for ( i = 0; i < MAX_CPUID_INPUT; i++ ) { cpuid = &d->arch.cpuids[i]; @@ -1900,11 +1902,12 @@ void domain_cpuid( *ebx = cpuid->ebx; *ecx = cpuid->ecx; *edx = cpuid->edx; - return; + break; } } - *eax = *ebx = *ecx = *edx = 0; + if ( input == 1 ) + *ecx |= 1U << (X86_FEATURE_HYPERVISOR % 32); } void vcpu_kick(struct vcpu *v) Index: 2008-10-27/xen/arch/x86/traps.c ==================================================================--- 2008-10-27.orig/xen/arch/x86/traps.c 2008-10-27 11:14:44.000000000 +0100 +++ 2008-10-27/xen/arch/x86/traps.c 2008-11-19 10:16:27.000000000 +0100 @@ -754,6 +754,7 @@ static void pv_cpuid(struct cpu_user_reg __clear_bit(X86_FEATURE_XTPR % 32, &c); __clear_bit(X86_FEATURE_PDCM % 32, &c); __clear_bit(X86_FEATURE_DCA % 32, &c); + __set_bit(X86_FEATURE_HYPERVISOR % 32, &c); break; case 0x80000001: /* Modify Feature Information. */ Index: 2008-10-27/xen/include/asm-x86/cpufeature.h ==================================================================--- 2008-10-27.orig/xen/include/asm-x86/cpufeature.h 2008-05-07 12:21:37.000000000 +0200 +++ 2008-10-27/xen/include/asm-x86/cpufeature.h 2008-11-19 10:15:13.000000000 +0100 @@ -94,6 +94,7 @@ #define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */ #define X86_FEATURE_X2APIC (4*32+21) /* Extended xAPIC */ #define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */ +#define X86_FEATURE_HYPERVISOR (4*32+31) /* running under some hypervisor */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ #define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel