All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Ashish Kalra <Ashish.Kalra@amd.com>
Cc: pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de,  dave.hansen@linux.intel.com, x86@kernel.org,
	hpa@zytor.com,  thomas.lendacky@amd.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org,  joro@8bytes.org
Subject: Re: [PATCH v3] x86/sev: Add support for allowing zero SEV ASIDs.
Date: Wed, 31 Jan 2024 14:15:08 -0800	[thread overview]
Message-ID: <ZbrGbLLvdwRfMun5@google.com> (raw)
In-Reply-To: <20240104190520.62510-1-Ashish.Kalra@amd.com>

On Thu, Jan 04, 2024, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@amd.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@google.com>
> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
> Cc: stable@vger.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.

      parent reply	other threads:[~2024-01-31 22:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 19:05 [PATCH v3] x86/sev: Add support for allowing zero SEV ASIDs Ashish Kalra
2024-01-11 20:34 ` Tom Lendacky
2024-01-31 22:15 ` Sean Christopherson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZbrGbLLvdwRfMun5@google.com \
    --to=seanjc@google.com \
    --cc=Ashish.Kalra@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.