[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2836ee9-6261-a86a-b821-c9e3f75b9273@oracle.com>
Date: Thu, 20 Jan 2022 14:32:50 +0000
From: Liam Merwick <liam.merwick@...cle.com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Tom Lendacky <thomas.lendacky@....com>,
Brijesh Singh <brijesh.singh@....com>,
Liam Merwick <liam.merwick@...cle.com>
Subject: Re: [PATCH 4/9] KVM: SVM: Explicitly require DECODEASSISTS to enable
SEV support
On 20/01/2022 01:07, Sean Christopherson wrote:
> Add a sanity check on DECODEASSIST being support if SEV is supported, as
"DECODEASSISTS being supported" or "DECODEASSISTS support"
> KVM cannot read guest private memory and thus relies on the CPU to
> provide the instruction byte stream on #NPF for emulation. The intent of
> the check is to document the dependency, it should never fail in practice
> as producing hardware that supports SEV but not DECODEASSISTS would be
> non-sensical.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Reviewed-by: Liam Merwick <liam.merwick@...cle.com>
> ---
> arch/x86/kvm/svm/sev.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 6a22798eaaee..17b53457d866 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -2100,8 +2100,13 @@ void __init sev_hardware_setup(void)
> if (!sev_enabled || !npt_enabled)
> goto out;
>
> - /* Does the CPU support SEV? */
> - if (!boot_cpu_has(X86_FEATURE_SEV))
> + /*
> + * SEV must obviously be supported in hardware. Sanity check that the
> + * CPU supports decode assists, which is mandatory for SEV guests to
> + * support instruction emulation.
> + */
> + if (!boot_cpu_has(X86_FEATURE_SEV) ||
> + WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_DECODEASSISTS)))
> goto out;
>
> /* Retrieve SEV CPUID information */
Powered by blists - more mailing lists