WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] support CPUID hypervisor feature bit

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] support CPUID hypervisor feature bit
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Wed, 19 Nov 2008 11:34:16 +0000
Delivery-date: Wed, 19 Nov 2008 03:34:03 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
See http://lkml.org/lkml/2008/10/1/246 for more context.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] support CPUID hypervisor feature bit, Jan Beulich <=