lkml.org 
[lkml]   [2021]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 02/15] KVM: x86: Emulate RDPID only if RDTSCP is supported
From
Date
On 05/05/21 05:51, Reiji Watanabe wrote:
>> --- a/arch/x86/kvm/cpuid.c
>> +++ b/arch/x86/kvm/cpuid.c
>> @@ -637,7 +637,8 @@ static int __do_cpuid_func_emulated(struct kvm_cpuid_array *array, u32 func)
>> case 7:
>> entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
>> entry->eax = 0;
>> - entry->ecx = F(RDPID);
>> + if (kvm_cpu_cap_has(X86_FEATURE_RDTSCP))
>> + entry->ecx = F(RDPID);
>> ++array->nent;
>> default:
>> break;
> I'm wondering if entry->ecx should be set to F(RDPID) here
> even if the CPU supports RDPID natively.
> (i.e. kvm_cpu_cap_has(X86_FEATURE_RDPID) is true)
>
> The document "Documentation/virt/kvm/api.rst" says:
> ---
> 4.88 KVM_GET_EMULATED_CPUID
> ---------------------------
> <...>
> Userspace can use the information returned by this ioctl to query
> which features are emulated by kvm instead of being present natively.
> ---

Setting it always is consistent with the treatment of MOVBE above.
Either way is okay but it should be done for both bits.

Paolo

\
 
 \ /
  Last update: 2021-05-05 10:02    [W:1.734 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site