Skip to contentSkip to conversation

Add external-module-compat header for MSR_VM_IGNNE

PATCH New Alexander Graf 2 participants 5 messages May 15, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add external-module-compat header for MSR_VM_IGNNE

This patch adds a compat definition for MSR_VM_IGNNE

---
 kvm/kernel/x86/external-module-compat.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
kvm/kernel/x86/external-module-compat.h +5 -0
index 8f9aae0..da42d7b 100644
@@ -30,6 +30,11 @@
 #define MSR_VM_CR                       0xc0010114
 #endif
 
+#ifndef MSR_VM_IGNNE
+#define MSR_VM_IGNNE                    0xc0010115
+#endif
+
+
 #ifndef MSR_VM_HSAVE_PA
 #define MSR_VM_HSAVE_PA                 0xc0010117
 #endif
Signature · 1 line
1.6.0.2
#1 lore raw

PATCH 1/1 Don't try to mess with CPUID when running nested SVM

When using nested SVM we usually want the guest to see the exact CPUID values we gave it and not some mangled ones.

Hyper-V for example doesn't even start when the "hypervisor present" bit is set.

---
 target-i386/helper.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
target-i386/helper.c +2 -2
index 24fcea8..5f56698 100644
@@ -1496,7 +1496,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
          * isn't supported in compatibility mode on Intel.  so advertise the
          * actuall cpu, and say goodbye to migration between different vendors
          * is you use compatibility mode. */
-        if (kvm_enabled())
+        if (kvm_enabled() && !kvm_nested)
             host_cpuid(0, 0, NULL, ebx, ecx, edx);
         break;
     case 1:
@@ -1506,7 +1506,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         *edx = env->cpuid_features;
 
         /* "Hypervisor present" bit required for Microsoft SVVP */
-        if (kvm_enabled())
+        if (kvm_enabled() && !kvm_nested)
             *ecx |= (1 << 31);
         break;
     case 2:
Signature · 1 line
1.6.0.2
#2 lore raw

Re: [PATCH] Don't try to mess with CPUID when running nested SVM

Quoted 3 lines · Alexander Graf

When using nested SVM we usually want the guest to see the exact CPUID values we gave it and not some mangled ones.

That would triggered by -cpu host, not nesting.

target-i386/helper.c void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, · line 1512

Quoted 9 lines
target-i386/helper.c +1 -1
@@ -1506,7 +1506,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         *edx = env->cpuid_features;
 
         /* "Hypervisor present" bit required for Microsoft SVVP */
-        if (kvm_enabled())
+        if (kvm_enabled() && !kvm_nested)
             *ecx |= (1 << 31);
         break;
 

-cpu host,-hypervisor

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#3 lore raw

Re: [PATCH] Don't try to mess with CPUID when running nested SVM

Quoted 6 lines · Avi Kivity
Quoted 3 lines · Alexander Graf

When using nested SVM we usually want the guest to see the exact CPUID values we gave it and not some mangled ones.

That would triggered by -cpu host, not nesting.

Oh we have -cpu host already? If so, we don't need that hackery of course :-)

Quoted 11 lines

target-i386/helper.c void cpu_x86_cpuid(CPUX86State *env, uint32_t · line 1512

Quoted 9 lines
target-i386/helper.c +1 -1
@@ -1506,7 +1506,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t  
 index, uint32_t count,
        *edx = env->cpuid_features;
         /* "Hypervisor present" bit required for Microsoft SVVP */
-        if (kvm_enabled())
+        if (kvm_enabled() && !kvm_nested)
            *ecx |= (1 << 31);
        break;
 

-cpu host,-hypervisor

hm - treating the hypervisor bit like any other cpuid bit sounds like a good idea. I'm wondering though which way should be preferred. I usually don't want to have the hypervisor bit set - but maybe I'm the minority.

Alex

#4 lore raw

Re: [PATCH] Don't try to mess with CPUID when running nested SVM

Quoted 7 lines · Alexander Graf
Quoted 5 lines
Quoted 3 lines

When using nested SVM we usually want the guest to see the exact CPUID values we gave it and not some mangled ones.

That would triggered by -cpu host, not nesting.

Oh we have -cpu host already?

No, we don't :)

Quoted 2 lines

hm - treating the hypervisor bit like any other cpuid bit sounds like a good idea. I'm wondering though which way should be preferred. I usually don't want to have the hypervisor bit set - but maybe I'm the minority.

Windows requires the hypervisor bit to set in order to pass some testing program.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.