On 15/08/19 19:14, Eduardo Habkost wrote:
> On Thu, Aug 15, 2019 at 09:41:23AM +0200, Paolo Bonzini wrote:
>> Even though it is preferrable to use SPEC_CTRL (represented by
>> X86_FEATURE_AMD_SSBD) instead of VIRT_SPEC, VIRT_SPEC is always
>> supported anyway because otherwise it would be impossible to
>> migrate from old to new CPUs.  Make this apparent in the
>> result of KVM_GET_SUPPORTED_CPUID as well.
>>
>> Cc: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
>> Reported-by: Eduardo Habkost <ehabk...@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
>> ---
>>  arch/x86/kvm/cpuid.c | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
>> index 145ec050d45d..5865bc73bbb5 100644
>> --- a/arch/x86/kvm/cpuid.c
>> +++ b/arch/x86/kvm/cpuid.c
>> @@ -747,11 +747,13 @@ static inline int __do_cpuid_func(struct 
>> kvm_cpuid_entry2 *entry, u32 function,
>>              entry->ebx &= kvm_cpuid_8000_0008_ebx_x86_features;
>>              cpuid_mask(&entry->ebx, CPUID_8000_0008_EBX);
>>              /*
>> -             * The preference is to use SPEC CTRL MSR instead of the
>> -             * VIRT_SPEC MSR.
>> +             * VIRT_SPEC is only implemented for AMD processors,
>> +             * but the host could set AMD_SSBD if it wanted even
>> +             * for Intel processors.
>>               */
>> -            if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) &&
>> -                !boot_cpu_has(X86_FEATURE_AMD_SSBD))
>> +            if ((boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) ||
>> +                 boot_cpu_has(X86_FEATURE_AMD_SSBD)) &&
>> +                boot_cpu_has(X86_FEATURE_SVM))
> 
> Would it be desirable to move this code to
> svm_set_supported_cpuid(), or is there a reason for keeping this
> in cpuid.c?

Yes, of course.  Forgot about it.

Paolo

Reply via email to