lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250410135118.133240-5-sgarzare@redhat.com>
Date: Thu, 10 Apr 2025 15:51:16 +0200
From: Stefano Garzarella <sgarzare@...hat.com>
To: Borislav Petkov <bp@...en8.de>,
	Jarkko Sakkinen <jarkko@...nel.org>
Cc: Joerg Roedel <jroedel@...e.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Dionna Glaze <dionnaglaze@...gle.com>,
	Ingo Molnar <mingo@...hat.com>,
	linux-kernel@...r.kernel.org,
	Dov Murik <dovmurik@...ux.ibm.com>,
	linux-integrity@...r.kernel.org,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Claudio Carvalho <cclaudio@...ux.ibm.com>,
	Tom Lendacky <thomas.lendacky@....com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Huewe <peterhuewe@....de>,
	Jason Gunthorpe <jgg@...pe.ca>,
	x86@...nel.org,
	James Bottomley <James.Bottomley@...senPartnership.com>,
	linux-coco@...ts.linux.dev,
	Stefano Garzarella <sgarzare@...hat.com>
Subject: [PATCH v7 4/4] x86/sev: register tpm-svsm platform device

From: Stefano Garzarella <sgarzare@...hat.com>

SNP platform can provide a vTPM device emulated by SVSM.

The "tpm-svsm" device can be handled by the platform driver added
by the previous commit in drivers/char/tpm/tpm_svsm.c

Register the platform device only when SVSM is available and it
supports vTPM commands as checked by snp_svsm_vtpm_probe().

Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
Reviewed-by: Jarkko Sakkinen <jarkko@...nel.org>
Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>
---
v7:
- added Jarkko's R-b
- call snp_svsm_vtpm_probe() before registering the device [Borislav]
- s/device/devices in pr_info [Tom]
- updated commit description
v6:
- added Tom's R-b
v4:
- explained better why we register it anyway in the commit message
---
 arch/x86/coco/sev/core.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index 3bc5b47e7304..54272c9777cf 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -2688,6 +2688,11 @@ static struct platform_device sev_guest_device = {
 	.id		= -1,
 };
 
+static struct platform_device tpm_svsm_device = {
+	.name		= "tpm-svsm",
+	.id		= -1,
+};
+
 static int __init snp_init_platform_device(void)
 {
 	if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
@@ -2696,7 +2701,11 @@ static int __init snp_init_platform_device(void)
 	if (platform_device_register(&sev_guest_device))
 		return -ENODEV;
 
-	pr_info("SNP guest platform device initialized.\n");
+	if (snp_svsm_vtpm_probe() &&
+	    platform_device_register(&tpm_svsm_device))
+		return -ENODEV;
+
+	pr_info("SNP guest platform devices initialized.\n");
 	return 0;
 }
 device_initcall(snp_init_platform_device);
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ