Skip to contentSkip to conversation

Nested Virtualization: cpuid

PATCH In review Christoph Egger 1 participant 1 message Jun 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 8/15 Nested Virtualization: cpuid

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

# HG changeset patch
# User cegger
# Date 1275382029 -7200
Pass cpuid feature bits to guest

xen/arch/x86/hvm/hvm.c +26 -0
diff -r 06a332fd936d -r c3ca485ecfbe xen/arch/x86/hvm/hvm.c
@@ -2021,12 +2021,38 @@ void hvm_cpuid(unsigned int input, unsig
             }
         }
         break;
+    case 0x80000000:
+        if ( !nestedhvm_enabled(v->domain) )
+            break;
+        if (*eax < 0x8000000a)
+            *eax = 0x8000000a;
+        break;
     case 0x80000001:
         /* We expose RDTSCP feature to guest only when
            tsc_mode == TSC_MODE_DEFAULT and host_tsc_is_safe() returns 1 */
         if ( v->domain->arch.tsc_mode != TSC_MODE_DEFAULT ||
              !host_tsc_is_safe() )
             *edx &= ~bitmaskof(X86_FEATURE_RDTSCP);
+
+        /* Don't expose SVM feature bit when host does not run with
+         * nested paging enabled. This check is needed as long as
+         * we don't support shadow-on-shadow.
+         */
+        if ( !paging_mode_hap(v->domain) )
+            *ecx &= ~bitmaskof(X86_FEATURE_SVME);
+
+        /* Don't expose SVM feature bit when nestedhvm is disabled. */
+        if ( !nestedhvm_enabled(v->domain) )
+            *ecx &= ~bitmaskof(X86_FEATURE_SVME);
+        break;
+    case 0x8000000a:
+        /* Don't expose SVM feature bits when nestedhvm is disabled. */
+        if ( !nestedhvm_enabled(v->domain) ) {
+            *eax = *ebx = *ecx = *edx = 0;
+            break;
+        }
+
+        hvm_nestedhvm_vcpu_features(v, eax, ebx, ecx, edx);
         break;
     }
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel