From: Sean Christopherson <seanjc@google.com>
To: "Pratik R. Sampat" <prsampat@amd.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
pbonzini@redhat.com, thomas.lendacky@amd.com,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, shuah@kernel.org,
pgonda@google.com, ashish.kalra@amd.com, nikunj@amd.com,
pankaj.gupta@amd.com, michael.roth@amd.com, sraithal@amd.com
Subject: Re: [PATCH v8 00/10] Basic SEV-SNP Selftests
Date: Tue, 6 May 2025 06:46:47 -0700 [thread overview]
Message-ID: <aBoSx-rAmajPZq07@google.com> (raw)
In-Reply-To: <09ee8a01-9938-4ae7-bdbc-4754b7314e73@amd.com>
On Mon, May 05, 2025, Pratik R. Sampat wrote:
> On 5/5/2025 6:15 PM, Sean Christopherson wrote:
> > On Mon, May 05, 2025, Pratik R. Sampat wrote:
> > Argh, now I remember the issue. But _sev_platform_init_locked() returns '0' if
> > psp_init_on_probe is true, and I don't see how deferring __sev_snp_init_locked()
> > will magically make it succeed the second time around.
> >
> > So shouldn't the KVM code be this?
> >
> > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> > index e0f446922a6e..dd04f979357d 100644
> > --- a/arch/x86/kvm/svm/sev.c
> > +++ b/arch/x86/kvm/svm/sev.c
> > @@ -3038,6 +3038,14 @@ void __init sev_hardware_setup(void)
> > sev_snp_supported = sev_snp_enabled && cc_platform_has(CC_ATTR_HOST_SEV_SNP);
> >
> > out:
> > + if (sev_enabled) {
> > + init_args.probe = true;
> > + if (sev_platform_init(&init_args))
> > + sev_supported = sev_es_supported = sev_snp_supported = false;
> > + else
> > + sev_snp_supported &= sev_is_snp_initialized();
> > + }
> > +
> > if (boot_cpu_has(X86_FEATURE_SEV))
> > pr_info("SEV %s (ASIDs %u - %u)\n",
> > sev_supported ? min_sev_asid <= max_sev_asid ? "enabled" :
> > @@ -3067,12 +3075,6 @@ void __init sev_hardware_setup(void)
> >
> > if (!sev_enabled)
> > return;
> > -
> > - /*
> > - * Do both SNP and SEV initialization at KVM module load.
> > - */
> > - init_args.probe = true;
> > - sev_platform_init(&init_args);
> > }
> >
> > void sev_hardware_unsetup(void)
> > --
> >
>
> I agree with this approach. One thing maybe to consider further is to also call
> into SEV_platform_status() to check for init so that SEV/SEV-ES is not
> penalized and disabled for SNP's failures. Another approach could be to break
> up the SEV and SNP init setup so that we can spare a couple of platform calls
> in the process?
Nah, SNP initialization failure should be a rare occurence, I don't want to make
the "normal" flow more complex just to handle something that should never happen
in practice.
prev parent reply other threads:[~2025-05-06 13:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 22:59 [PATCH v8 00/10] Basic SEV-SNP Selftests Pratik R. Sampat
2025-03-05 22:59 ` [PATCH v8 01/10] KVM: SEV: Disable SEV-SNP support on initialization failure Pratik R. Sampat
2025-03-05 22:59 ` [PATCH v8 02/10] KVM: selftests: SEV-SNP test for KVM_SEV_INIT2 Pratik R. Sampat
2025-03-05 22:59 ` [PATCH v8 03/10] KVM: selftests: Add vmgexit helper Pratik R. Sampat
2025-03-06 4:38 ` Gupta, Pankaj
2025-03-05 22:59 ` [PATCH v8 04/10] KVM: selftests: Add SMT control state helper Pratik R. Sampat
2025-03-05 22:59 ` [PATCH v8 05/10] KVM: selftests: Replace assert() with TEST_ASSERT_EQ() Pratik R. Sampat
2025-03-05 22:59 ` [PATCH v8 06/10] KVM: selftests: Introduce SEV VM type check Pratik R. Sampat
2025-03-05 22:59 ` [PATCH v8 07/10] KVM: selftests: Add library support for interacting with SNP Pratik R. Sampat
2025-03-05 22:59 ` [PATCH v8 08/10] KVM: selftests: Force GUEST_MEMFD flag for SNP VM type Pratik R. Sampat
2025-03-05 22:59 ` [PATCH v8 09/10] KVM: selftests: Abstractions for SEV to decouple policy from type Pratik R. Sampat
2025-03-05 23:00 ` [PATCH v8 10/10] KVM: selftests: Add a basic SEV-SNP smoke test Pratik R. Sampat
2025-04-03 18:35 ` [PATCH v8 00/10] Basic SEV-SNP Selftests Pratik R. Sampat
2025-05-02 21:50 ` Sean Christopherson
2025-05-05 15:10 ` Pratik R. Sampat
2025-05-05 23:15 ` Sean Christopherson
2025-05-05 23:36 ` Kalra, Ashish
2025-05-06 0:56 ` Sean Christopherson
2025-05-06 17:06 ` Kalra, Ashish
2025-05-06 2:05 ` Pratik R. Sampat
2025-05-06 13:46 ` 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=aBoSx-rAmajPZq07@google.com \
--to=seanjc@google.com \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=pankaj.gupta@amd.com \
--cc=pbonzini@redhat.com \
--cc=pgonda@google.com \
--cc=prsampat@amd.com \
--cc=shuah@kernel.org \
--cc=sraithal@amd.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.