x86: support CPUID hypervisor feature bit
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 19 Nov 2008 16:10:39 +0000 (16:10 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 19 Nov 2008 16:10:39 +0000 (16:10 +0000)
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/libxc/xc_cpufeature.h
tools/libxc/xc_cpuid_x86.c
xen/arch/x86/traps.c
xen/include/asm-x86/cpufeature.h

index 6cd442cfe697c43a3dd9abec5d51a0eb12384cc9..047a6c9fc797d1d960ece597da45a3f8dca9a4f1 100644 (file)
@@ -83,6 +83,7 @@
 #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 */
+#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) */
index 6a8e7594c80e6b8463909b2a6c4cc3419ef140e1..d75fe2b013aea796039d106b2aa0e4fe2e24e56d 100644 (file)
@@ -194,6 +194,8 @@ static void xc_cpuid_hvm_policy(
                     bitmaskof(X86_FEATURE_SSE4_2) |
                     bitmaskof(X86_FEATURE_POPCNT));
 
+        regs[2] |= bitmaskof(X86_FEATURE_HYPERVISOR);
+
         regs[3] &= (bitmaskof(X86_FEATURE_FPU) |
                     bitmaskof(X86_FEATURE_VME) |
                     bitmaskof(X86_FEATURE_DE) |
@@ -309,6 +311,7 @@ static void xc_cpuid_pv_policy(
         clear_bit(X86_FEATURE_XTPR, regs[2]);
         clear_bit(X86_FEATURE_PDCM, regs[2]);
         clear_bit(X86_FEATURE_DCA, regs[2]);
+        set_bit(X86_FEATURE_HYPERVISOR, regs[2]);
         break;
     case 0x80000001:
         if ( !guest_64bit )
index d6e77549ddcb6bc0d7dcfa6aacbc826006609bfd..a315ea1c8e201c3881352318cb749ffc24833b90 100644 (file)
@@ -755,6 +755,7 @@ static void pv_cpuid(struct cpu_user_regs *regs)
         __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 18f6aff015b85b8524cff1437deedda4dc9aa8be..481236c833b8a7b38ab1e37f2ab69877e5e364e8 100644 (file)
@@ -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) */