diff mbox

Don't expose hypervisor bit when running nested SVM

Message ID 1245276660-11259-1-git-send-email-agraf@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Graf June 17, 2009, 10:11 p.m. UTC
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.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-i386/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Avi Kivity June 22, 2009, 8:46 a.m. UTC | #1
On 06/18/2009 01:11 AM, Alexander Graf wrote:
> 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?
Alexander Graf June 22, 2009, 9:39 a.m. UTC | #2
On 22.06.2009, at 10:46, Avi Kivity wrote:

> On 06/18/2009 01:11 AM, Alexander Graf wrote:
>> 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?

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

Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/target-i386/helper.c b/target-i386/helper.c
index 2c5af3c..7da0e24 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -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: