public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add external-module-compat header for MSR_VM_IGNNE
@ 2009-05-15  9:01 Alexander Graf
  2009-05-15  9:01 ` [PATCH] Don't try to mess with CPUID when running nested SVM Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2009-05-15  9:01 UTC (permalink / raw)
  To: kvm; +Cc: joerg.roedel

This patch adds a compat definition for MSR_VM_IGNNE

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 kvm/kernel/x86/external-module-compat.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kvm/kernel/x86/external-module-compat.h b/kvm/kernel/x86/external-module-compat.h
index 8f9aae0..da42d7b 100644
--- a/kvm/kernel/x86/external-module-compat.h
+++ b/kvm/kernel/x86/external-module-compat.h
@@ -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
-- 
1.6.0.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] Don't try to mess with CPUID when running nested SVM
  2009-05-15  9:01 [PATCH] Add external-module-compat header for MSR_VM_IGNNE Alexander Graf
@ 2009-05-15  9:01 ` Alexander Graf
  2009-05-15 11:09   ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2009-05-15  9:01 UTC (permalink / raw)
  To: kvm; +Cc: joerg.roedel

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.

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

diff --git a/target-i386/helper.c b/target-i386/helper.c
index 24fcea8..5f56698 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -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:
-- 
1.6.0.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Don't try to mess with CPUID when running nested SVM
  2009-05-15  9:01 ` [PATCH] Don't try to mess with CPUID when running nested SVM Alexander Graf
@ 2009-05-15 11:09   ` Avi Kivity
  2009-05-15 11:15     ` Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2009-05-15 11:09 UTC (permalink / raw)
  To: Alexander Graf; +Cc: kvm, joerg.roedel

Alexander Graf wrote:
> 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.

> @@ -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

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Don't try to mess with CPUID when running nested SVM
  2009-05-15 11:09   ` Avi Kivity
@ 2009-05-15 11:15     ` Alexander Graf
  2009-05-15 11:19       ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2009-05-15 11:15 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, joerg.roedel


On 15.05.2009, at 13:09, Avi Kivity wrote:

> Alexander Graf wrote:
>> 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 :-)

>> @@ -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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Don't try to mess with CPUID when running nested SVM
  2009-05-15 11:15     ` Alexander Graf
@ 2009-05-15 11:19       ` Avi Kivity
  0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2009-05-15 11:19 UTC (permalink / raw)
  To: Alexander Graf; +Cc: kvm, joerg.roedel

Alexander Graf wrote:
>>> 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 :)

> 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.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-05-15 11:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15  9:01 [PATCH] Add external-module-compat header for MSR_VM_IGNNE Alexander Graf
2009-05-15  9:01 ` [PATCH] Don't try to mess with CPUID when running nested SVM Alexander Graf
2009-05-15 11:09   ` Avi Kivity
2009-05-15 11:15     ` Alexander Graf
2009-05-15 11:19       ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox