[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191001221646.GN4084@habkost.net>
Date: Tue, 1 Oct 2019 19:16:46 -0300
From: Eduardo Habkost <ehabkost@...hat.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Jim Mattson <jmattson@...gle.com>, konrad.wilk@...cle.com
Subject: Re: [PATCH 2/3] KVM: x86: always expose VIRT_SSBD to guests
On Wed, Aug 21, 2019 at 10:26:41AM +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.
>
> While at it, reuse X86_FEATURE_* constants for the SVM leaf too.
>
> However, we need to hide the bit on Intel processors, so move
> the setting to svm_set_supported_cpuid.
>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> Reported-by: Eduardo Habkost <ehabkost@...hat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> ---
[...]
> @@ -5944,6 +5944,11 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
> if (nested)
> entry->ecx |= (1 << 2); /* Set SVM bit */
> break;
> + case 0x80000008:
> + if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) ||
> + boot_cpu_has(X86_FEATURE_AMD_SSBD))
> + entry->ebx |= F(VIRT_SSBD);
> + break;
Wasn't the old code at arch/x86/kvm/cpuid.c:__do_cpuid_func()
supposed to be deleted?
/*
* The preference is to use SPEC CTRL MSR instead of the
* VIRT_SPEC MSR.
*/
if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) &&
!boot_cpu_has(X86_FEATURE_AMD_SSBD))
entry->ebx |= F(VIRT_SSBD);
--
Eduardo
Powered by blists - more mailing lists