From: Sean Christopherson <seanjc@google.com>
To: Ashish Kalra <ashish.kalra@amd.com>
Cc: "Pratik R. Sampat" <prsampat@amd.com>,
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, 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: Mon, 5 May 2025 17:56:55 -0700 [thread overview]
Message-ID: <aBleV3TlvA1QwcSZ@google.com> (raw)
In-Reply-To: <34890707-201a-44f9-afb3-b065ae71b246@amd.com>
On Mon, May 05, 2025, Ashish Kalra wrote:
> On 5/5/2025 6:15 PM, Sean Christopherson wrote:
> > @@ -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)
> > --
> >
> > Ashish, what am I missing?
> >
>
> As far as setting sev*_enabled is concerned, i believe they are more specific
> to SNP/SEV/SEV-ES being enabled in the system, which is separate from
> SEV_INIT/SNP_INIT (SNP_INIT success indicates that RMP been initialized, SNP
> has to be already enabled via MSR_SYSCFG before SNP_INIT is called), though
> SEV_INIT/SNP_INIT may fail but SEV/SNP support will still be enabled on the
> system.
No, if SNP_INIT fails and has zero chance of succeeding, then SNP is *NOT*
supported *by KVM*. The platform may be configured to support SNP, but that
matters not at all if KVM can't actually use the functionality.
> Additionally as SEV_INIT/SNP_INIT during sev_platform_init() have failed, so
> any SEV/SEV-ES/SNP VM launch will fail as the firmware will return invalid
> platform state as INITs have failed.
Yeah, and that's *awful* behavior for KVM. Imagine if KVM did that for every
feature, i.e. enumerated hardware support irrespective of KVM support.
The API is KVM_GET_SUPPORTED_CPUID, not KVM_GET_MOSTLY_SUPPORTED_CPUID.
> >From my understanding, sev*_enabled indicates the user support to
> >enable/disable support for SEV/SEV-ES/SEV-SNP,
Yes, and they're also used to reflect and enumerate KVM support:
if (sev_enabled) {
kvm_cpu_cap_set(X86_FEATURE_SEV);
kvm_caps.supported_vm_types |= BIT(KVM_X86_SEV_VM);
}
if (sev_es_enabled) {
kvm_cpu_cap_set(X86_FEATURE_SEV_ES);
kvm_caps.supported_vm_types |= BIT(KVM_X86_SEV_ES_VM);
}
if (sev_snp_enabled) {
kvm_cpu_cap_set(X86_FEATURE_SEV_SNP);
kvm_caps.supported_vm_types |= BIT(KVM_X86_SNP_VM);
}
> as the sev*_enabled are the KVM module parameters, while sev*_supported
> indicates if platform has that support enabled.
sev*_supported are completely irrelevant. They are function local scratch variables
that exist so that KVM doesn't clobber userspace's inputs while computing what is
fully supported and enabled.
> And before the SEV/SNP init support was moved to KVM from CCP module, doing
> SEV/SNP INIT could fail but that still had KVM detecting SEV/SNP support
> enabled, so this moving SEV/SNP init stuff to KVM module from CCP driver is
> consistent with the previous behavior.
And one of my driving motivations for getting the initialization into KVM was to
fix that previous behavior.
next prev parent reply other threads:[~2025-05-06 0:56 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 [this message]
2025-05-06 17:06 ` Kalra, Ashish
2025-05-06 2:05 ` Pratik R. Sampat
2025-05-06 13:46 ` Sean Christopherson
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=aBleV3TlvA1QwcSZ@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.