From: Jarkko Sakkinen <jarkko@profian.com>
To: Brijesh Singh <brijesh.singh@amd.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
John Allen <john.allen@amd.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>
Cc: Harald Hoyer <harald@profian.com>, Tom Dohrmann <erbse.13@gmx.de>,
Ashish Kalra <ashish.kalra@amd.com>,
Michael Roth <michael.roth@amd.com>,
Jarkko Sakkinen <jarkko@profian.com>,
linux-crypto@vger.kernel.org (open list:AMD CRYPTOGRAPHIC
COPROCESSOR (CCP) DRIVER - SE...),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH RFC 7/8] crypto: ccp: Prevent a spurious SEV_CMD_SNP_INIT triggered by sev_guest_init()
Date: Fri, 27 Jan 2023 02:52:36 +0000 [thread overview]
Message-ID: <20230127025237.269680-8-jarkko@profian.com> (raw)
In-Reply-To: <20230127025237.269680-1-jarkko@profian.com>
Move the firmware version check from sev_pci_init() to sev_snp_init().
Signed-off-by: Jarkko Sakkinen <jarkko@profian.com>
---
drivers/crypto/ccp/sev-dev.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 6c4fdcaed72b..50e73df966ec 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -1381,6 +1381,12 @@ static int __sev_snp_init_locked(int *error)
if (sev->snp_initialized)
return 0;
+ 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;
+ }
+
/*
* The SNP_INIT requires the MSR_VM_HSAVE_PA must be set to 0h
* across all cores.
@@ -2313,25 +2319,19 @@ void sev_pci_init(void)
}
}
+ rc = sev_snp_init(&error, true);
+ if (rc)
+ /*
+ * 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 error %#x\n", error);
+
/*
* If boot CPU supports SNP, then first attempt to initialize
* the SNP firmware.
*/
if (cpu_feature_enabled(X86_FEATURE_SEV_SNP)) {
- if (!sev_version_greater_or_equal(SNP_MIN_API_MAJOR, SNP_MIN_API_MINOR)) {
- dev_err(sev->dev, "SEV-SNP support requires firmware version >= %d:%d\n",
- SNP_MIN_API_MAJOR, SNP_MIN_API_MINOR);
- } else {
- rc = sev_snp_init(&error, true);
- if (rc) {
- /*
- * 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 error %#x\n", error);
- }
- }
-
/*
* Allocate the intermediate buffers used for the legacy command handling.
*/
--
2.38.1
next parent reply other threads:[~2023-01-27 2:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230127025237.269680-1-jarkko@profian.com>
2023-01-27 2:52 ` Jarkko Sakkinen [this message]
2023-01-27 2:52 ` [PATCH RFC 8/8] crypto: ccp: Move __sev_snp_init_locked() call inside __sev_platform_init_locked() Jarkko Sakkinen
2023-01-27 2:56 ` Jarkko Sakkinen
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=20230127025237.269680-8-jarkko@profian.com \
--to=jarkko@profian.com \
--cc=ashish.kalra@amd.com \
--cc=brijesh.singh@amd.com \
--cc=davem@davemloft.net \
--cc=erbse.13@gmx.de \
--cc=harald@profian.com \
--cc=herbert@gondor.apana.org.au \
--cc=john.allen@amd.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=thomas.lendacky@amd.com \
/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;
as well as URLs for NNTP newsgroup(s).