Skip to contentSkip to conversation

Don't expose hypervisor bit when running nested SVM

PATCH In review Alexander Graf 2 participants 3 messages Jun 17, 2009 – Jun 22, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't expose hypervisor bit when running nested SVM

Hyper-V refuses to run in hypervisor mode when it finds the hypervisor bit set, because it assumes it's running as a guest.

While the perfect way of not setting the hypervisor would be an option to the -cpu parameter, this is reasonable sane for now. Let's deal with the -cpu way when we get to -cpu host.

---
 target-i386/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/helper.c +1 -1
index 2c5af3c..7da0e24 100644
@@ -1513,7 +1513,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
#1 lore raw
Quoted 8 lines · Alexander Graf

Hyper-V refuses to run in hypervisor mode when it finds the hypervisor bit set, because it assumes it's running as a guest.

While the perfect way of not setting the hypervisor would be an option to the -cpu parameter, this is reasonable sane for now. Let's deal with the -cpu way when we get to -cpu host.

There's infrastructure in helper.c to make -cpu blah,-hypervisor fairly trivial, no?

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 4 lines · Avi Kivity
Quoted 3 lines · Alexander Graf

Hyper-V refuses to run in hypervisor mode when it finds the hypervisor bit set, because it assumes it's running as a guest.

Quoted 8 lines
Quoted 6 lines

While the perfect way of not setting the hypervisor would be an option to the -cpu parameter, this is reasonable sane for now. Let's deal with the -cpu
way when we get to -cpu host.

There's infrastructure in helper.c to make -cpu blah,-hypervisor fairly trivial, no?

Yes. I merely wanted to get something upstream for LinuxTag so people can try it out :-).

Alex