From: Jack Wang <jinpu.wang@ionos.com>
To: gregkh@linuxfoundation.org, sashal@kernel.org, stable@vger.kernel.org
Cc: dmitrii.omelchenko@cloud.ionos.com,
Ashish Kalra <ashish.kalra@amd.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Jack Wang <jinpu.wang@cloud.ionos.com>
Subject: [stable-6.12 4/4] crypto: ccp - Abort doing SEV INIT if SNP INIT fails
Date: Fri, 14 Aug 2026 12:02:57 +0200 [thread overview]
Message-ID: <20260814100652.225499-5-jinpu.wang@ionos.com> (raw)
In-Reply-To: <20260814100652.225499-1-jinpu.wang@ionos.com>
From: Ashish Kalra <ashish.kalra@amd.com>
commit 6131e119f5799bec55535530fa2fc44f5c7be1f1 upstream.
If SNP host support (SYSCFG.SNPEn) is set, then the RMP table must
be initialized before calling SEV INIT.
In other words, if SNP_INIT(_EX) is not issued or fails then
SEV INIT will fail if SNP host support (SYSCFG.SNPEn) is enabled.
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.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 6e08378eb5fa..d6a0773d6da8 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -1118,7 +1118,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. */
@@ -1357,12 +1357,9 @@ static int _sev_platform_init_locked(struct sev_platform_init_args *args)
rc = __sev_snp_init_locked(&args->error);
if (rc && rc != -ENODEV) {
- /*
- * 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. */
--
2.43.0
next prev parent reply other threads:[~2026-08-14 10:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 10:02 [PATCH 6.12.y 0/4] crypto: ccp, KVM: SVM - missing SEV/SNP platform-init dependency + 2 bugfixes Jack Wang
2026-08-14 10:02 ` [stable-6.12 1/4] crypto: ccp - Add new SEV/SNP platform shutdown API Jack Wang
2026-08-14 10:02 ` [stable-6.12 2/4] KVM: SVM: Add support to initialize SEV/SNP functionality in KVM Jack Wang
2026-08-14 14:40 ` Sean Christopherson
2026-08-14 10:02 ` [stable-6.12 3/4] crypto: ccp - Fix checks for SNP_VLEK_LOAD input buffer length Jack Wang
2026-08-14 10:02 ` Jack Wang [this message]
2026-08-15 2:33 ` [PATCH 6.12.y 0/4] crypto: ccp, KVM: SVM - missing SEV/SNP platform-init dependency + 2 bugfixes Sasha Levin
2026-08-17 4:51 ` Jinpu Wang
2026-08-17 5:00 ` Greg KH
2026-08-17 5:22 ` Jinpu Wang
2026-08-17 5:34 ` Greg KH
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=20260814100652.225499-5-jinpu.wang@ionos.com \
--to=jinpu.wang@ionos.com \
--cc=ashish.kalra@amd.com \
--cc=dmitrii.omelchenko@cloud.ionos.com \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=jinpu.wang@cloud.ionos.com \
--cc=sashal@kernel.org \
--cc=stable@vger.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