kvm: cpuid: Expose leaves 0x80000005 and 0x80000006 to the guest
diff mbox series

Message ID 20191022213349.54734-1-jmattson@google.com
State New
Headers show
Series
  • kvm: cpuid: Expose leaves 0x80000005 and 0x80000006 to the guest
Related show

Commit Message

Jim Mattson Oct. 22, 2019, 9:33 p.m. UTC
Leaf 0x80000005 is "L1 Cache and TLB Information." Leaf 0x80000006 is
"L2 Cache and TLB and L3 Cache Information." Include these leaves in
the array returned by KVM_GET_SUPPORTED_CPUID.

Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/cpuid.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jim Mattson Nov. 4, 2019, 8:49 p.m. UTC | #1
On Tue, Oct 22, 2019 at 2:33 PM Jim Mattson <jmattson@google.com> wrote:
>
> Leaf 0x80000005 is "L1 Cache and TLB Information." Leaf 0x80000006 is
> "L2 Cache and TLB and L3 Cache Information." Include these leaves in
> the array returned by KVM_GET_SUPPORTED_CPUID.
>
> Signed-off-by: Jim Mattson <jmattson@google.com>
> ---
>  arch/x86/kvm/cpuid.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 9c5029cf6f3f..1b40d8277b84 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -730,6 +730,9 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function,
>                 entry->ecx &= kvm_cpuid_8000_0001_ecx_x86_features;
>                 cpuid_mask(&entry->ecx, CPUID_8000_0001_ECX);
>                 break;
> +       case 0x80000005:
> +       case 0x80000006:
> +               break;
>         case 0x80000007: /* Advanced power management */
>                 /* invariant TSC is CPUID.80000007H:EDX[8] */
>                 entry->edx &= (1 << 8);
> --
> 2.23.0.866.gb869b98d4c-goog
>
Ping.
Krish Sadhukhan Nov. 5, 2019, 2:02 a.m. UTC | #2
On 11/04/2019 12:49 PM, Jim Mattson wrote:
> On Tue, Oct 22, 2019 at 2:33 PM Jim Mattson <jmattson@google.com> wrote:
>> Leaf 0x80000005 is "L1 Cache and TLB Information." Leaf 0x80000006 is
>> "L2 Cache and TLB and L3 Cache Information." Include these leaves in
>> the array returned by KVM_GET_SUPPORTED_CPUID.
>>
>> Signed-off-by: Jim Mattson <jmattson@google.com>
>> ---
>>   arch/x86/kvm/cpuid.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
>> index 9c5029cf6f3f..1b40d8277b84 100644
>> --- a/arch/x86/kvm/cpuid.c
>> +++ b/arch/x86/kvm/cpuid.c
>> @@ -730,6 +730,9 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function,
>>                  entry->ecx &= kvm_cpuid_8000_0001_ecx_x86_features;
>>                  cpuid_mask(&entry->ecx, CPUID_8000_0001_ECX);
>>                  break;
>> +       case 0x80000005:
>> +       case 0x80000006:
>> +               break;
>>          case 0x80000007: /* Advanced power management */
>>                  /* invariant TSC is CPUID.80000007H:EDX[8] */
>>                  entry->edx &= (1 << 8);
>> --
>> 2.23.0.866.gb869b98d4c-goog
>>
> Ping.

Just curious about where we are actually setting the information for 
these two leaves. I don't see it either in __do_cpuid_func() or in 
kvm_x86_ops->set_supported_cpuid().
Paolo Bonzini Nov. 5, 2019, 10:39 a.m. UTC | #3
On 05/11/19 03:02, Krish Sadhukhan wrote:
>>>
>>> +       case 0x80000005:
>>> +       case 0x80000006:
>>> +               break;
>>>          case 0x80000007: /* Advanced power management */
>>>                  /* invariant TSC is CPUID.80000007H:EDX[8] */
>>>                  entry->edx &= (1 << 8);
>>> -- 
>>> 2.23.0.866.gb869b98d4c-goog
>>>
>> Ping.
> 
> Just curious about where we are actually setting the information for
> these two leaves. I don't see it either in __do_cpuid_func() or in
> kvm_x86_ops->set_supported_cpuid().

do_cpuid_1_ent simply passes down the host information.

Patch queued, thanks.

Paolo

Patch
diff mbox series

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 9c5029cf6f3f..1b40d8277b84 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -730,6 +730,9 @@  static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function,
 		entry->ecx &= kvm_cpuid_8000_0001_ecx_x86_features;
 		cpuid_mask(&entry->ecx, CPUID_8000_0001_ECX);
 		break;
+	case 0x80000005:
+	case 0x80000006:
+		break;
 	case 0x80000007: /* Advanced power management */
 		/* invariant TSC is CPUID.80000007H:EDX[8] */
 		entry->edx &= (1 << 8);