[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZbrGbLLvdwRfMun5@google.com>
Date: Wed, 31 Jan 2024 14:15:08 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Ashish Kalra <Ashish.Kalra@....com>
Cc: pbonzini@...hat.com, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
thomas.lendacky@....com, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
joro@...tes.org
Subject: Re: [PATCH v3] x86/sev: Add support for allowing zero SEV ASIDs.
On Thu, Jan 04, 2024, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@....com>
>
> Some BIOSes allow the end user to set the minimum SEV ASID value
> (CPUID 0x8000001F_EDX) to be greater than the maximum number of
> encrypted guests, or maximum SEV ASID value (CPUID 0x8000001F_ECX)
> in order to dedicate all the SEV ASIDs to SEV-ES or SEV-SNP.
>
> The SEV support, as coded, does not handle the case where the minimum
> SEV ASID value can be greater than the maximum SEV ASID value.
> As a result, the following confusing message is issued:
>
> [ 30.715724] kvm_amd: SEV enabled (ASIDs 1007 - 1006)
>
> Fix the support to properly handle this case.
>
> Fixes: 916391a2d1dc ("KVM: SVM: Add support for SEV-ES capability in KVM")
> Suggested-by: Sean Christopherson <seanjc@...gle.com>
> Signed-off-by: Ashish Kalra <ashish.kalra@....com>
> Cc: stable@...r.kernel.org
> ---
> arch/x86/kvm/svm/sev.c | 40 ++++++++++++++++++++++++----------------
This should be ~3 patches:
1. Convert ASID variables/params to unsigned integers.
2. Return -EINVAL instead of -EBUSY
3. The actual fix here
E.g if #2 breaks userspace (extremely unlikely) then bisection should point at
exactly that, not at a commit with a whole pile of unrelated things going on.
I'll send a v4, #1 should also be accompanied by a cleanup of sev_asid_new() to
not multiplex the ASID with the return code. It can simply set sev->asid directly,
which as a bonus makes sev_asid_new() and sev_asid_free() more symmetric.
Powered by blists - more mailing lists