Re: [RFC PATCH v2 2/6] x86/sev: add SVSM vTPM probe/send_command functions

2025-03-11 Thread Borislav Petkov
On Mon, Mar 10, 2025 at 08:27:37AM -0500, Tom Lendacky wrote: > I don't think anything needs to be checked or printed. Yes. > If you want to do anything, just issue a pr_info() with the features value > (and maybe the platform_cmds value, too). Issuing a pr_warn() here would be > like issuing a p

[PATCH v3 4/4] x86/sev: register tpm-svsm platform device

2025-03-11 Thread Stefano Garzarella
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 The driver will call snp_svsm_vtpm_probe() to check if SVSM is present and if it's support the vTPM protocol. Signed-of

[PATCH v3 3/4] tpm: add SNP SVSM vTPM driver

2025-03-11 Thread Stefano Garzarella
Add driver for the vTPM defined by the AMD SVSM spec [1]. The specification defines a protocol that a SEV-SNP guest OS can use to discover and talk to a vTPM emulated by the Secure VM Service Module (SVSM) in the guest context, but at a more privileged level (VMPL0). The new tpm-svsm platform dri

[PATCH v3 2/4] svsm: add header with SVSM_VTPM_CMD helpers

2025-03-11 Thread Stefano Garzarella
Helpers for the SVSM_VTPM_CMD calls used by the vTPM protocol defined by the AMD SVSM spec [1]. The vTPM protocol follows the Official TPM 2.0 Reference Implementation (originally by Microsoft, now part of the TCG) simulator protocol. [1] "Secure VM Service Module for SEV-SNP Guests" Publicat

[PATCH v3 0/4] Enlightened vTPM support for SVSM on SEV-SNP

2025-03-11 Thread Stefano Garzarella
AMD SEV-SNP defined a new mechanism for adding privileged levels (VMPLs) in the context of a Confidential VM. These levels can be used to run the guest OS at a lower privilege level than a Secure VM Service Module (SVSM). In this way SVSM can be used to emulate those devices (such as TPM) that cann

[PATCH] tpm: eventlog: Declare mapping_size __maybe_unused

2025-03-11 Thread WangYuli
Given that when CONFIG_EFI is not enabled, do_mapping is inherently false. Thus, the mapping_size variable is set but remains unused, resulting in a compilation warning. Simply annotating it with __maybe_unused will resolve this compilation warning. [ Fix follow errors with clang-19 when W=1e: ]

Re: [PATCH v2] tpm, tpm_tis: Fix timeout handling when waiting for TPM status

2025-03-11 Thread Jarkko Sakkinen
On Mon, Mar 10, 2025 at 12:22:08PM +, Jonathan McDowell wrote: > The change to only use interrupts to handle supported status changes > introduced an issue when it is necessary to poll for the status. Rather > than checking for the status after sleeping the code now sleeps after > the check. Th

Build error on -next due to tpm_crb.c changes? (was: Re: [PATCH v6 0/5] Add support for the TPM FF-A start method)

2025-03-11 Thread Thorsten Leemhuis
On 05.03.25 18:36, Stuart Yoder wrote: > Firmware Framework for Arm A-profile (FF-A) is a messaging framework > for Arm-based systems, and in the context of the TPM CRB driver is used > to signal 'start' to a CRB-based TPM service which is hosted in an > FF-A secure partition running in TrustZone.

Re: Build error on -next due to tpm_crb.c changes?

2025-03-11 Thread Thorsten Leemhuis
On 11.03.25 16:53, Stuart Yoder wrote: > On 3/11/25 10:21 AM, Thorsten Leemhuis wrote: >> On 05.03.25 18:36, Stuart Yoder wrote: > [...] > So, it should not be possible on one had have > CONFIG_TCG_ARM_CRB_FFA being true when building tpm_crb.c > and false resulting in the tpm_crb_ffa.o not being >

[PATCH v3 1/4] x86/sev: add SVSM vTPM probe/send_command functions

2025-03-11 Thread Stefano Garzarella
Add two new functions to probe and send commands to the SVSM vTPM. They leverage the two calls defined by the AMD SVSM specification [1] for the vTPM protocol: SVSM_VTPM_QUERY and SVSM_VTPM_CMD. Expose these functions to be used by other modules such as a tpm driver. [1] "Secure VM Service Module

[RFC PATCH 3/3] tpm/tpm_svsm: use send_recv() op

2025-03-11 Thread Stefano Garzarella
This driver does not support interrupts, and receiving the response is synchronous with sending the command. Let's simplify the driver by implementing the new send_recv() op. Signed-off-by: Stefano Garzarella --- Note: this is based on "[PATCH v3 0/4] Enlightened vTPM support for SVSM on SEV-SNP

Re: [PATCH v2] tpm, tpm_tis: Workaround failed command reception on Infineon devices

2025-03-11 Thread Jarkko Sakkinen
On Mon, Mar 10, 2025 at 12:19:55PM +, Jonathan McDowell wrote: > From: Jonathan McDowell > > Some Infineon devices have a issue where the status register will get > stuck with a quick REQUEST_USE / COMMAND_READY sequence. This is not > simply a matter of requiring a longer timeout; the work a

Re: [PATCH v3 1/4] x86/sev: add SVSM vTPM probe/send_command functions

2025-03-11 Thread Jarkko Sakkinen
On Tue, Mar 11, 2025 at 10:42:22AM +0100, Stefano Garzarella wrote: > Add two new functions to probe and send commands to the SVSM vTPM. > They leverage the two calls defined by the AMD SVSM specification [1] > for the vTPM protocol: SVSM_VTPM_QUERY and SVSM_VTPM_CMD. > > Expose these functions to

[RFC PATCH 0/3] tpm: add send_recv() op and use it in tpm_ftpm_tee and tpm_svsm drivers

2025-03-11 Thread Stefano Garzarella
This series is a follow-up to the discussion we had about whether or not to add send_recv() op in tpm_class_ops[1]. Some devices do not support interrupts and provide a single operation to send the command and receive the response on the same buffer. In order to simplify these drivers and avoid te

[RFC PATCH 1/3] tpm: add send_recv() op in tpm_class_ops

2025-03-11 Thread Stefano Garzarella
Some devices do not support interrupts and provide a single operation to send the command and receive the response on the same buffer. To support this scenario, a driver could set TPM_CHIP_FLAG_IRQ in the chip's flags to get recv() to be called immediately after send() in tpm_try_transmit(), or it

Re: [PATCH v3 2/4] svsm: add header with SVSM_VTPM_CMD helpers

2025-03-11 Thread Jarkko Sakkinen
On Tue, Mar 11, 2025 at 10:42:23AM +0100, Stefano Garzarella wrote: > Helpers for the SVSM_VTPM_CMD calls used by the vTPM protocol defined by > the AMD SVSM spec [1]. > > The vTPM protocol follows the Official TPM 2.0 Reference Implementation > (originally by Microsoft, now part of the TCG) simul

[PATCH] MAINTAINERS: Add include/linux/tpm*.h to TPM maintainers

2025-03-11 Thread WangYuli
As of now, within include/linux, there are three header files pertaining to the TPM driver: tpm.h, tpm_eventlg.h and tpm_command.h. Upon investigation when attempting code modifications, it has become evident that these files are currently without a maintainer. In light of their intrinsic relatio

Re: [RFC PATCH] IMA: Remove evm_overlay.sh

2025-03-11 Thread Mimi Zohar
On Fri, 2025-03-07 at 11:24 +0100, Petr Vorel wrote: > Hi Mimi, Ignaz, > > > Proof of concept, it was never fixed in the kernel. > > Instead we should have some basic EVM tests. > > gently ping. Is evm_overlay.sh test useful for you? > Otherwise I'll delete it. Requiring the "ima_policy=appraise

[PATCH] tpm: Clarify "auth session active" message

2025-03-11 Thread Andrew Sayers
Without context, the obvious reading of "auth session is active" is "auth session successfully activated". In fact, this message means "redundant extra attempt to activate auth session". Signed-off-by: Andrew Sayers --- drivers/char/tpm/tpm2-sessions.c | 2 +- 1 file changed, 1 insertion(+), 1

Re: Build error on -next due to tpm_crb.c changes?

2025-03-11 Thread Stuart Yoder
On 3/11/25 10:21 AM, Thorsten Leemhuis wrote: On 05.03.25 18:36, Stuart Yoder wrote: Firmware Framework for Arm A-profile (FF-A) is a messaging framework for Arm-based systems, and in the context of the TPM CRB driver is used to signal 'start' to a CRB-based TPM service which is hosted in an

Re: [PATCH v6 0/5] Add support for the TPM FF-A start method

2025-03-11 Thread Sudeep Holla
On Mon, Mar 10, 2025 at 01:19:37PM +0200, Jarkko Sakkinen wrote: > On Wed, Mar 05, 2025 at 11:36:06AM -0600, Stuart Yoder wrote: > > Firmware Framework for Arm A-profile (FF-A) is a messaging framework > > for Arm-based systems, and in the context of the TPM CRB driver is used > > to signal 'start'

Re: [PATCH v2] tpm, tpm_tis: Workaround failed command reception on Infineon devices

2025-03-11 Thread Paul Menzel
Dear Jonathan, Some nits, should you resend. Feel free to ignore. The verb *work around* is spelled with a space. Am 10.03.25 um 13:19 schrieb Jonathan McDowell: From: Jonathan McDowell Some Infineon devices have a issue where the status register will get stuck with a quick REQUEST_USE / C

Re: [PATCH] tpm, tpm_tis: Fix timeout handling when waiting for TPM status

2025-03-11 Thread Jarkko Sakkinen
On Wed, Mar 05, 2025 at 09:45:15AM +, Jonathan McDowell wrote: > From: Jonathan McDowell > > The change to only use interrupts to handle supported status changes, > then switch to polling for the rest, inverted the status test and sleep > such that we can end up sleeping beyond our timeout an

Re: Build error on -next due to tpm_crb.c changes?

2025-03-11 Thread Sudeep Holla
On Tue, Mar 11, 2025 at 01:25:50PM -0500, Stuart Yoder wrote: > > > On 3/11/25 11:51 AM, Thorsten Leemhuis wrote: > > On 11.03.25 16:53, Stuart Yoder wrote: > > > On 3/11/25 10:21 AM, Thorsten Leemhuis wrote: > > > > On 05.03.25 18:36, Stuart Yoder wrote: > > > [...] > > > So, it should not be po

[PATCH v2] tpm, tpm_tis: Fix timeout handling when waiting for TPM status

2025-03-11 Thread Jonathan McDowell
The change to only use interrupts to handle supported status changes introduced an issue when it is necessary to poll for the status. Rather than checking for the status after sleeping the code now sleeps after the check. This means a correct, but slower, status change on the part of the TPM can b

Re: [PATCH v6 0/5] Add support for the TPM FF-A start method

2025-03-11 Thread Jarkko Sakkinen
On Wed, Mar 05, 2025 at 11:36:06AM -0600, Stuart Yoder wrote: > Firmware Framework for Arm A-profile (FF-A) is a messaging framework > for Arm-based systems, and in the context of the TPM CRB driver is used > to signal 'start' to a CRB-based TPM service which is hosted in an > FF-A secure partition

Re: [RFC PATCH v2 2/6] x86/sev: add SVSM vTPM probe/send_command functions

2025-03-11 Thread Tom Lendacky
On 3/10/25 08:51, Borislav Petkov wrote: > On Mon, Mar 10, 2025 at 08:27:37AM -0500, Tom Lendacky wrote: >> I don't think anything needs to be checked or printed. > > Yes. > >> If you want to do anything, just issue a pr_info() with the features value >> (and maybe the platform_cmds value, too).

Re: Build error on -next due to tpm_crb.c changes?

2025-03-11 Thread Stuart Yoder
On 3/11/25 11:51 AM, Thorsten Leemhuis wrote: On 11.03.25 16:53, Stuart Yoder wrote: On 3/11/25 10:21 AM, Thorsten Leemhuis wrote: On 05.03.25 18:36, Stuart Yoder wrote: [...] So, it should not be possible on one had have CONFIG_TCG_ARM_CRB_FFA being true when building tpm_crb.c and false r

Re: Build error on -next due to tpm_crb.c changes? (was: Re: [PATCH v6 0/5] Add support for the TPM FF-A start method)

2025-03-11 Thread Jarkko Sakkinen
On Tue, Mar 11, 2025 at 04:21:38PM +0100, Thorsten Leemhuis wrote: > On 05.03.25 18:36, Stuart Yoder wrote: > > Firmware Framework for Arm A-profile (FF-A) is a messaging framework > > for Arm-based systems, and in the context of the TPM CRB driver is used > > to signal 'start' to a CRB-based TPM s

Re: Build error on -next due to tpm_crb.c changes?

2025-03-11 Thread Jarkko Sakkinen
On Tue, Mar 11, 2025 at 05:51:17PM +0100, Thorsten Leemhuis wrote: > On 11.03.25 16:53, Stuart Yoder wrote: > > On 3/11/25 10:21 AM, Thorsten Leemhuis wrote: > >> On 05.03.25 18:36, Stuart Yoder wrote: > > [...] > > So, it should not be possible on one had have > > CONFIG_TCG_ARM_CRB_FFA being true

Re: [PATCH v6 0/5] Add support for the TPM FF-A start method

2025-03-11 Thread Jarkko Sakkinen
On Tue, Mar 11, 2025 at 03:28:25PM +, Sudeep Holla wrote: > On Mon, Mar 10, 2025 at 01:19:37PM +0200, Jarkko Sakkinen wrote: > > On Wed, Mar 05, 2025 at 11:36:06AM -0600, Stuart Yoder wrote: > > > Firmware Framework for Arm A-profile (FF-A) is a messaging framework > > > for Arm-based systems,

[RFC PATCH 2/3] tpm/tpm_ftpm_tee: use send_recv() op

2025-03-11 Thread Stefano Garzarella
This driver does not support interrupts, and receiving the response is synchronous with sending the command. It used an internal buffer to cache the response when .send() is called, and then return it when .recv() is called. Let's simplify the driver by implementing the new send_recv() op, so tha

Re: [PATCH] MAINTAINERS: Add include/linux/tpm*.h to TPM maintainers

2025-03-11 Thread WangYuli
Hi Jarkko, On 2025/3/12 14:23, Jarkko Sakkinen wrote: "Subnames" are separated with space, not with camel case. It's just a matter of regional cultural differences. In my country, we don't have the concept of "Subname" in names. We only have "Surname" and "Given name", and our convention is

Re: [PATCH] tpm: eventlog: Declare mapping_size __maybe_unused

2025-03-11 Thread Jarkko Sakkinen
On Tue, Mar 11, 2025 at 08:01:15PM +0800, WangYuli wrote: > Given that when CONFIG_EFI is not enabled, do_mapping is inherently > false. Thus, the mapping_size variable is set but remains unused, > resulting in a compilation warning. > > Simply annotating it with __maybe_unused will resolve this c

Re: [PATCH] tpm: eventlog: Declare mapping_size __maybe_unused

2025-03-11 Thread Jarkko Sakkinen
On Tue, Mar 11, 2025 at 08:01:15PM +0800, WangYuli wrote: > Given that when CONFIG_EFI is not enabled, do_mapping is inherently > false. Thus, the mapping_size variable is set but remains unused, > resulting in a compilation warning. > > Simply annotating it with __maybe_unused will resolve this c

Re: [PATCH] MAINTAINERS: Add include/linux/tpm*.h to TPM maintainers

2025-03-11 Thread Jarkko Sakkinen
On Tue, Mar 11, 2025 at 09:14:40PM +0800, WangYuli wrote: > As of now, within include/linux, there are three header files > pertaining to the TPM driver: tpm.h, tpm_eventlg.h and tpm_command.h. > > Upon investigation when attempting code modifications, it has become > evident that these files are

Re: [PATCH] tpm: eventlog: Declare mapping_size __maybe_unused

2025-03-11 Thread WangYuli
Hi Jarkko, On 2025/3/12 14:20, Jarkko Sakkinen wrote: Why do we care clang-19 with W=1e? 1. the kernel, being a software endeavor predicated on robustness, should not normally countenance build failures stemming from toolchain and compilation setups that are implicitly project-approved. 2.

Re: Build error on -next due to tpm_crb.c changes?

2025-03-11 Thread Stuart Yoder
On 3/11/25 11:51 AM, Thorsten Leemhuis wrote: On 11.03.25 16:53, Stuart Yoder wrote: On 3/11/25 10:21 AM, Thorsten Leemhuis wrote: On 05.03.25 18:36, Stuart Yoder wrote: [...] So, it should not be possible on one had have CONFIG_TCG_ARM_CRB_FFA being true when building tpm_crb.c and false r