From: "Jan Beulich" Subject: [PATCH] support CPUID hypervisor feature bit Date: Wed, 19 Nov 2008 11:34:16 +0000 Message-ID: <492407C8.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org See http://lkml.org/lkml/2008/10/1/246 for more context. Signed-off-by: Jan Beulich Index: 2008-10-27/xen/arch/x86/domain.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 2008-10-27.orig/xen/arch/x86/domain.c 2008-11-11 16:24:48.0000000= 00 +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; =20 + *eax =3D *ebx =3D *ecx =3D *edx =3D 0; + for ( i =3D 0; i < MAX_CPUID_INPUT; i++ ) { cpuid =3D &d->arch.cpuids[i]; @@ -1900,11 +1902,12 @@ void domain_cpuid( *ebx =3D cpuid->ebx; *ecx =3D cpuid->ecx; *edx =3D cpuid->edx; - return; + break; } } =20 - *eax =3D *ebx =3D *ecx =3D *edx =3D 0; + if ( input =3D=3D 1 ) + *ecx |=3D 1U << (X86_FEATURE_HYPERVISOR % 32); } =20 void vcpu_kick(struct vcpu *v) Index: 2008-10-27/xen/arch/x86/traps.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 2008-10-27.orig/xen/arch/x86/traps.c 2008-10-27 11:14:44.0000000= 00 +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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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.0000000= 00 +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 = */ =20 /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 = */ #define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore = insn) */