Re: [RFC PATCH v2 5/6] tpm: add SNP SVSM vTPM driver

2025-02-28 Thread Jason Gunthorpe
On Fri, Feb 28, 2025 at 06:07:19PM +0100, Stefano Garzarella wrote: > +/* > + * tpm_svsm_remove() lives in .exit.text. For drivers registered via > + * module_platform_driver_probe() this is ok because they cannot get unbound > + * at runtime. So mark the driver struct with __refdata to prevent mod

Re: [RFC PATCH v2 0/6] Enlightened vTPM support for SVSM on SEV-SNP

2025-02-28 Thread Jason Gunthorpe
On Fri, Feb 28, 2025 at 06:07:14PM +0100, Stefano Garzarella wrote: > I put RFC back in because we haven't yet decided if this is the best > approach to support SVSM vTPM, but I really like to receive feedbacks > especially from the maintainer/reviewers of the TPM subsystem, to see if > this approa

[PATCH v2 0/2] ima: minimize open-writers and ToMToU violations

2025-02-28 Thread Mimi Zohar
Each time a file in policy, that is already opened for write, is opened for read, an open-writers integrity violation audit message is emitted and a violation record is added to the IMA measurement list. Similarly each time a file in policy, that is already opened for read, is opened for write, a

[PATCH v2 1/2] ima: limit the number of open-writers integrity violations

2025-02-28 Thread Mimi Zohar
Each time a file in policy, that is already opened for write, is opened for read, an open-writers integrity violation audit message is emitted and a violation record is added to the IMA measurement list. This occurs even if an open-writers violation has already been recorded. Limit the number of o

[PATCH v2 2/2] ima: limit the number of ToMToU integrity violations

2025-02-28 Thread Mimi Zohar
Each time a file in policy, that is already opened for read, is opened for write, a Time-of-Measure-Time-of-Use (ToMToU) integrity violation audit message is emitted and a violation record is added to the IMA measurement list. This occurs even if a ToMToU violation has already been recorded. Limi

[RFC PATCH v2 3/6] tpm: add send_recv() ops in tpm_class_ops

2025-02-28 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(). Inst

Re: [RFC PATCH v2 5/6] tpm: add SNP SVSM vTPM driver

2025-02-28 Thread Jarkko Sakkinen
On Fri, Feb 28, 2025 at 06:07:19PM +0100, Stefano Garzarella wrote: > 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 c

Re: [RFC PATCH v2 3/6] tpm: add send_recv() ops in tpm_class_ops

2025-02-28 Thread Jarkko Sakkinen
On Fri, Feb 28, 2025 at 06:07:17PM +0100, Stefano Garzarella wrote: > + int (*send_recv)(struct tpm_chip *chip, u8 *buf, size_t buf_len, > + size_t to_send); Please describe the meaning and purpose of to_send. BR, Jarkko

Re: TPM operation times out (very rarely)

2025-02-28 Thread Jarkko Sakkinen
On Mon, Feb 24, 2025 at 01:56:56PM +0100, Michal Suchánek wrote: > On Wed, Feb 19, 2025 at 10:29:45PM +, Jonathan McDowell wrote: > > On Wed, Jan 29, 2025 at 04:27:15PM +0100, Michal Suchánek wrote: > > > Hello, > > > > > > there is a problem report that booting a specific type of system about

Re: [RFC PATCH v2 4/6] tpm: add interface to interact with devices based on TCG Simulator

2025-02-28 Thread Jarkko Sakkinen
On Fri, Feb 28, 2025 at 06:07:18PM +0100, Stefano Garzarella wrote: > This is primarily designed to support an enlightened driver for the The commit message is half-way cut. I.e. it lacks the explanation of "this". > AMD SVSM based vTPM, but it could be used by any TPM driver which > communicate

[RFC PATCH v2 0/6] Enlightened vTPM support for SVSM on SEV-SNP

2025-02-28 Thread Stefano Garzarella
I put RFC back in because we haven't yet decided if this is the best approach to support SVSM vTPM, but I really like to receive feedbacks especially from the maintainer/reviewers of the TPM subsystem, to see if this approach is acceptable. Also James, Claudio, I left some questions for you in pat

[RFC PATCH v2 1/6] x86/sev: add SVSM call macros for the vTPM protocol

2025-02-28 Thread Stefano Garzarella
Add macros for SVSM_VTPM_QUERY and SVSM_VTPM_CMD calls as defined in the "Secure VM Service Module for SEV-SNP Guests" Publication # 58019 Revision: 1.00 Link: https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/58019.pdf Signed-off-by: Stefano Garzarella --- arc

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

2025-02-28 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 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. Co-developed-by: James Bottomley

[RFC PATCH v2 6/6] x86/sev: register tpm-svsm platform device

2025-02-28 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

[RFC PATCH v2 4/6] tpm: add interface to interact with devices based on TCG Simulator

2025-02-28 Thread Stefano Garzarella
This is primarily designed to support an enlightened driver for the AMD SVSM based vTPM, but it could be used by any TPM driver which communicates with a TPM device implemented through the TCG TPM reference implementation (https://github.com/TrustedComputingGroup/TPM) Co-developed-by: James Bottom

[RFC PATCH v2 5/6] tpm: add SNP SVSM vTPM driver

2025-02-28 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

Re: [RFC PATCH v2 5/6] tpm: add SNP SVSM vTPM driver

2025-02-28 Thread Dionna Amalie Glaze
On Fri, Feb 28, 2025 at 5:51 PM Jarkko Sakkinen wrote: > > On Fri, Feb 28, 2025 at 06:07:19PM +0100, Stefano Garzarella wrote: > > 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 vT

Re: [PATCH] tpm: ftpm_tee: remove incorrect of_match_ptr annotation

2025-02-28 Thread Jarkko Sakkinen
On Tue, Feb 25, 2025 at 05:37:15PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > Building with W=1 shows a warning about of_ftpm_tee_ids being unused when > CONFIG_OF is disabled: > > drivers/char/tpm/tpm_ftpm_tee.c:356:34: error: unused variable > 'of_ftpm_tee_ids' [-Werror,-Wunus