diff mbox

[4/4] dont trim the guest's hypervisor CPUID bit in KVM if the guest requests it

Message ID 1245840276-12702-4-git-send-email-andre.przywara@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andre Przywara June 24, 2009, 10:44 a.m. UTC
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
---
 arch/x86/kvm/x86.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Avi Kivity June 24, 2009, 11:28 a.m. UTC | #1
On 06/24/2009 01:44 PM, Andre Przywara wrote:
> Signed-off-by: Andre Przywara<andre.przywara@amd.com>
> ---
>   arch/x86/kvm/x86.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index e6e61ee..6ad0f93 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1415,7 +1415,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
>   		0 /* Reserved */ | F(CX16) | 0 /* xTPR Update, PDCM */ |
>   		0 /* Reserved, DCA */ | F(XMM4_1) |
>   		F(XMM4_2) | 0 /* x2APIC */ | F(MOVBE) | F(POPCNT) |
> -		0 /* Reserved, XSAVE, OSXSAVE */;
> +		0 /* Reserved, XSAVE, OSXSAVE */ | F(HYPERVISOR);
>    

I think this should be handled in qemu, since it isn't really a cpu bit.
Andre Przywara June 24, 2009, 12:28 p.m. UTC | #2
Avi Kivity wrote:
> On 06/24/2009 01:44 PM, Andre Przywara wrote:
>> Signed-off-by: Andre Przywara<andre.przywara@amd.com>
>> ---
>>   arch/x86/kvm/x86.c |    2 +-
>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index e6e61ee..6ad0f93 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -1415,7 +1415,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 
>> *entry, u32 function,
>>           0 /* Reserved */ | F(CX16) | 0 /* xTPR Update, PDCM */ |
>>           0 /* Reserved, DCA */ | F(XMM4_1) |
>>           F(XMM4_2) | 0 /* x2APIC */ | F(MOVBE) | F(POPCNT) |
>> -        0 /* Reserved, XSAVE, OSXSAVE */;
>> +        0 /* Reserved, XSAVE, OSXSAVE */ | F(HYPERVISOR);
>>    
> 
> I think this should be handled in qemu, since it isn't really a cpu bit.

But this would require to make an exception for turning this bit on 
again after it has been trimmed.
I just made (QEMU) patches for make this trimming really work (and 
removing all the hacked bits), so I would like to not spoil this again 
by introducing another excecption. After all this is more a list of what 
KVM does _not_ support (should we make this a negative one? gets ugly 
with the reserved bits), so I would like to leave it here.
I will send out the patches to qemu-devel when I found the last bug.

Regards,
Andre.
Andre Przywara June 24, 2009, 1:28 p.m. UTC | #3
Andre Przywara wrote:
> Avi Kivity wrote:
>>> --- a/arch/x86/kvm/x86.c
>>> +++ b/arch/x86/kvm/x86.c
>>> @@ -1415,7 +1415,7 @@ static void do_cpuid_ent(struct 
>>> -        0 /* Reserved, XSAVE, OSXSAVE */;
>>> +        0 /* Reserved, XSAVE, OSXSAVE */ | F(HYPERVISOR);
>>
>> I think this should be handled in qemu, since it isn't really a cpu bit.
> 
> But this would require to make an exception for turning this bit on 
> again after it has been trimmed.
> I just made (QEMU) patches for make this trimming really work (and 
> removing all the hacked bits), so I would like to not spoil this again 
> by introducing another exception.
I kind of tricked myself here. Since the hypervisor bit is (well, 
mostly) not set in the host, it will always be removed from the guest. 
So we need an exception for this anyway.
So please drop this patch, I will come up with some QEMU solution for this.

Regards,
Andre.

> After all this is more a list of what 
> KVM does _not_ support (should we make this a negative one? gets ugly 
> with the reserved bits), so I would like to leave it here.
> I will send out the patches to qemu-devel when I found the last bug.
>
diff mbox

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e6e61ee..6ad0f93 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1415,7 +1415,7 @@  static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 		0 /* Reserved */ | F(CX16) | 0 /* xTPR Update, PDCM */ |
 		0 /* Reserved, DCA */ | F(XMM4_1) |
 		F(XMM4_2) | 0 /* x2APIC */ | F(MOVBE) | F(POPCNT) |
-		0 /* Reserved, XSAVE, OSXSAVE */;
+		0 /* Reserved, XSAVE, OSXSAVE */ | F(HYPERVISOR);
 	/* cpuid 0x80000001.ecx */
 	const u32 kvm_supported_word6_x86_features =
 		F(LAHF_LM) | F(CMP_LEGACY) | F(SVM) | 0 /* ExtApicSpace */ |