diff mbox series

[v2,5/5] crypto: ccp: Move message about TSME being enabled later in init

Message ID 20240528210712.1268-6-mario.limonciello@amd.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series Enable PSP security attributes on more SoCs | expand

Commit Message

Mario Limonciello May 28, 2024, 9:07 p.m. UTC
Some of the security attributes data is now populated from an HSTI
command on some processors, so show the message after it has been
populated.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v1->v2:
 * Move code from patch 4
---
 drivers/crypto/ccp/hsti.c    | 15 +++++++++++++++
 drivers/crypto/ccp/psp-dev.c |  8 --------
 2 files changed, 15 insertions(+), 8 deletions(-)

Comments

Tom Lendacky May 29, 2024, 3:22 p.m. UTC | #1
On 5/28/24 16:07, Mario Limonciello wrote:
> Some of the security attributes data is now populated from an HSTI
> command on some processors, so show the message after it has been
> populated.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
> v1->v2:
>   * Move code from patch 4
> ---
>   drivers/crypto/ccp/hsti.c    | 15 +++++++++++++++
>   drivers/crypto/ccp/psp-dev.c |  8 --------
>   2 files changed, 15 insertions(+), 8 deletions(-)
>
diff mbox series

Patch

diff --git a/drivers/crypto/ccp/hsti.c b/drivers/crypto/ccp/hsti.c
index 8b99bbd4efe2..1b39a4fb55c0 100644
--- a/drivers/crypto/ccp/hsti.c
+++ b/drivers/crypto/ccp/hsti.c
@@ -119,5 +119,20 @@  int psp_init_hsti(struct psp_device *psp)
 			return ret;
 	}
 
+	/*
+	 * At this stage, if security information hasn't been populated by
+	 * either the PSP or by the driver through the platform command,
+	 * then there is nothing more to do.
+	 */
+	if (!psp->capability.security_reporting)
+		return 0;
+
+	if (psp->capability.tsme_status) {
+		if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT))
+			dev_notice(psp->dev, "psp: Both TSME and SME are active, SME is unnecessary when TSME is active.\n");
+		else
+			dev_notice(psp->dev, "psp: TSME enabled\n");
+	}
+
 	return 0;
 }
diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 0a01ad134609..1c5a7189631e 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -157,14 +157,6 @@  static unsigned int psp_get_capability(struct psp_device *psp)
 	}
 	psp->capability.raw = val;
 
-	/* Detect TSME and/or SME status */
-	if (psp->capability.security_reporting && psp->capability.tsme_status) {
-		if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT))
-			dev_notice(psp->dev, "psp: Both TSME and SME are active, SME is unnecessary when TSME is active.\n");
-		else
-			dev_notice(psp->dev, "psp: TSME enabled\n");
-	}
-
 	return 0;
 }