From: Tom Lendacky <thomas.lendacky@amd.com>
To: "Kalra, Ashish" <ashish.kalra@amd.com>,
seanjc@google.com, pbonzini@redhat.com, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, hpa@zytor.com, john.allen@amd.com,
herbert@gondor.apana.org.au
Cc: michael.roth@amd.com, dionnaglaze@google.com, nikunj@amd.com,
ardb@kernel.org, kevinloughlin@google.com,
Neeraj.Upadhyay@amd.com, aik@amd.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-coco@lists.linux.dev
Subject: Re: [PATCH v6 1/8] crypto: ccp: Abort doing SEV INIT if SNP INIT fails
Date: Fri, 7 Mar 2025 15:29:45 -0600 [thread overview]
Message-ID: <8d1884d7-f0a4-07b0-c674-584f9c724f89@amd.com> (raw)
In-Reply-To: <151f5519-c827-4c55-b0e0-9fb3101f35d4@amd.com>
On 3/7/25 15:06, Kalra, Ashish wrote:
> On 3/7/2025 2:57 PM, Tom Lendacky wrote:
>> On 3/7/25 14:54, Tom Lendacky wrote:
>>> On 3/6/25 17:09, Ashish Kalra wrote:
>>>> From: Ashish Kalra <ashish.kalra@amd.com>
>>>>
>>>> If SNP host support (SYSCFG.SNPEn) is set, then RMP table must be
>>>
>>> s/RMP/the RMP/
>>>
>>>> initialized up before calling SEV INIT.
>>>
>>> s/up//
>>>
>>>>
>>>> In other words, if SNP_INIT(_EX) is not issued or fails then
>>>> SEV INIT will fail once SNP host support (SYSCFG.SNPEn) is enabled.
>>>
>>> s/once/if/
>>>
>>>>
>>>> Fixes: 1ca5614b84eed ("crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP")
>>>> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
>>>> ---
>>>> drivers/crypto/ccp/sev-dev.c | 7 ++-----
>>>> 1 file changed, 2 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
>>>> index 2e87ca0e292a..a0e3de94704e 100644
>>>> --- a/drivers/crypto/ccp/sev-dev.c
>>>> +++ b/drivers/crypto/ccp/sev-dev.c
>>>> @@ -1112,7 +1112,7 @@ static int __sev_snp_init_locked(int *error)
>>>> if (!sev_version_greater_or_equal(SNP_MIN_API_MAJOR, SNP_MIN_API_MINOR)) {
>>>> dev_dbg(sev->dev, "SEV-SNP support requires firmware version >= %d:%d\n",
>>>> SNP_MIN_API_MAJOR, SNP_MIN_API_MINOR);
>>>> - return 0;
>>>> + return -EOPNOTSUPP;
>>>> }
>>>>
>>>> /* SNP_INIT requires MSR_VM_HSAVE_PA to be cleared on all CPUs. */
>>>> @@ -1325,12 +1325,9 @@ static int _sev_platform_init_locked(struct sev_platform_init_args *args)
>>>> */
>>>> rc = __sev_snp_init_locked(&args->error);
>>>> if (rc && rc != -ENODEV) {
>>>
>>> Can we get ride of this extra -ENODEV check? It can only be returned
>>> because of the same check that is made earlier in this function so it
>>> doesn't really serve any purpose from what I can tell.
>>>
>>> Just make this "if (rc) {"
>>
>> My bad... -ENODEV is returned if cc_platform_has(CC_ATTR_HOST_SEV_SNP) is
>> false, never mind.
>
> Yes, that's what i was going to reply with ... we want to continue with
> SEV INIT if SNP host support is not enabled.
Although we could get rid of that awkward if statement by doing...
if (cc_platform_has(CC_ATTR_HOST_SEV_SNP)) {
rc = __sev_snp_init_locked(&args->error);
if (rc) {
dev_err(sev->dev, ...
return rc;
}
}
And deleting the cc_platform_has() check from __sev_snp_init_locked().
Thanks,
Tom
>
> Thanks,
> Ashish
>
>>
>> Thanks,
>> Tom
>>
>>>
>>> Thanks,
>>> Tom
>>>
>>>> - /*
>>>> - * Don't abort the probe if SNP INIT failed,
>>>> - * continue to initialize the legacy SEV firmware.
>>>> - */
>>>> dev_err(sev->dev, "SEV-SNP: failed to INIT rc %d, error %#x\n",
>>>> rc, args->error);
>>>> + return rc;
>>>> }
>>>>
>>>> /* Defer legacy SEV/SEV-ES support if allowed by caller/module. */
>
next prev parent reply other threads:[~2025-03-07 21:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 23:09 [PATCH v6 0/8] Move initializing SEV/SNP functionality to KVM Ashish Kalra
2025-03-06 23:09 ` [PATCH v6 1/8] crypto: ccp: Abort doing SEV INIT if SNP INIT fails Ashish Kalra
2025-03-07 20:54 ` Tom Lendacky
2025-03-07 20:57 ` Tom Lendacky
2025-03-07 21:06 ` Kalra, Ashish
2025-03-07 21:29 ` Tom Lendacky [this message]
2025-03-07 21:39 ` Kalra, Ashish
2025-03-07 21:43 ` Tom Lendacky
2025-03-06 23:09 ` [PATCH v6 2/8] crypto: ccp: Move dev_info/err messages for SEV/SNP init and shutdown Ashish Kalra
2025-03-06 23:10 ` [PATCH v6 3/8] crypto: ccp: Ensure implicit SEV/SNP init and shutdown in ioctls Ashish Kalra
2025-03-07 21:30 ` Tom Lendacky
2025-03-06 23:10 ` [PATCH v6 4/8] crypto: ccp: Reset TMR size at SNP Shutdown Ashish Kalra
2025-03-06 23:10 ` [PATCH v6 5/8] crypto: ccp: Register SNP panic notifier only if SNP is enabled Ashish Kalra
2025-03-06 23:10 ` [PATCH v6 6/8] crypto: ccp: Add new SEV/SNP platform shutdown API Ashish Kalra
2025-03-06 23:11 ` [PATCH v6 7/8] KVM: SVM: Add support to initialize SEV/SNP functionality in KVM Ashish Kalra
2025-03-12 13:34 ` Kalra, Ashish
2025-03-06 23:11 ` [PATCH v6 8/8] crypto: ccp: Move SEV/SNP Platform initialization to KVM Ashish Kalra
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=8d1884d7-f0a4-07b0-c674-584f9c724f89@amd.com \
--to=thomas.lendacky@amd.com \
--cc=Neeraj.Upadhyay@amd.com \
--cc=aik@amd.com \
--cc=ardb@kernel.org \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dionnaglaze@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=john.allen@amd.com \
--cc=kevinloughlin@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®