From: Stefano Garzarella <sgarzare@redhat.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Naveen N Rao <naveen@kernel.org>,
Sumit Garg <sumit.garg@kernel.org>,
linux-integrity@vger.kernel.org, Peter Huewe <peterhuewe@gmx.de>,
Jens Wiklander <jens.wiklander@linaro.org>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Nicholas Piggin <npiggin@gmail.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
Michael Ellerman <mpe@ellerman.id.au>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Stefano Garzarella <sgarzare@redhat.com>
Subject: [PATCH v6 0/4] tpm: add support for sync send() and use it in ftpm and svsm drivers
Date: Fri, 20 Jun 2025 15:08:06 +0200 [thread overview]
Message-ID: <20250620130810.99069-1-sgarzare@redhat.com> (raw)
The content of this version is the same of v5, but rebased on current
linux-tpmdd/next (`git range-diff` on v5 is empty) after the merge
window since tpm-svsm patches were merged with another tree, so we
agreed on postpone this series, see
https://lore.kernel.org/linux-integrity/aDCb-wkHGoLQ-IGg@kernel.org/
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]. Much boilerplate code has
already been removed by Jarkko with commit 980a573621ea ("tpm: Make
chip->{status,cancel,req_canceled} opt"). With this series we try to
avoid also the temporary buffers needed between send() and recv() for
devices that do not support interrupts and provide a single operation
to send the command and receive the response on the same buffer like
tpm_ftpm_tee.
The biggest advantage for this approach is with tpm_ftpm_tee where we
remove the local buffer and extra memory copies. For tpm_svsm it does
not change much since we continue to use the pre-allocated buffer,
to avoid making an allocation for each command.
Introduce a new flag (TPM_CHIP_FLAG_SYNC) to support synchronous send().
If that flag is set by the driver, tpm_try_transmit() will use the send()
callback to send the command and receive the response on the same buffer
synchronously. In that case send() return the number of bytes of the
response on success, or -errno on failure.
Thanks,
Stefano
Changelog
- v5 -> v6
- rebased on linux-tpmdd/next - commit e271ed52b344 ("Merge tag
'pm-6.16-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm")
- v4 -> v5: https://lore.kernel.org/linux-integrity/20250514134630.137621-1-sgarzare@redhat.com/
- changed order and parameter names to match tpm_try_transmit() [Jarkko]
- rebased on next-20250514
- v3 -> v4: https://lore.kernel.org/linux-integrity/20250509085713.76851-1-sgarzare@redhat.com/
- reworked commit descriptions [Jarkko]
- added Jarkko's R-b on patch 2
- added Sumit's R-b on patch 3
- rebased on next-20250508
- v2 -> v3: https://lore.kernel.org/linux-integrity/20250414145653.239081-1-sgarzare@redhat.com/
- fixed comment style [Jarkko]
- renamend `out_send_sync` label to `out_sync` [Jarkko]
- v1 -> v2: https://lore.kernel.org/linux-integrity/20250408083208.43512-1-sgarzare@redhat.com/
- changed title since we removed send_recv() op
- implemented TPM_CHIP_FLAG_SYNC idea [Jarkko]
- removed Jens' T-b
- RFC -> v1: https://lore.kernel.org/linux-integrity/20250320152433.144083-1-sgarzare@redhat.com/
- added Jens' T-b on ftpm driver
- removed last patch since [2] is not yet merged and will require a new version
- RFC: https://lore.kernel.org/linux-integrity/20250311100130.42169-1-sgarzare@redhat.com/
[1] https://lore.kernel.org/linux-integrity/Z8sfiDEhsG6RATiQ@kernel.org/
[2] https://lore.kernel.org/linux-integrity/20250410135118.133240-1-sgarzare@redhat.com/
Stefano Garzarella (4):
tpm: add bufsiz parameter in the .send callback
tpm: support devices with synchronous send()
tpm/tpm_ftpm_tee: support TPM_CHIP_FLAG_SYNC
tpm/tpm_svsm: support TPM_CHIP_FLAG_SYNC
drivers/char/tpm/tpm_ftpm_tee.h | 4 --
include/linux/tpm.h | 4 +-
drivers/char/tpm/st33zp24/st33zp24.c | 2 +-
drivers/char/tpm/tpm-interface.c | 22 ++++++++--
drivers/char/tpm/tpm_atmel.c | 3 +-
drivers/char/tpm/tpm_crb.c | 2 +-
drivers/char/tpm/tpm_ftpm_tee.c | 66 +++++++++-------------------
drivers/char/tpm/tpm_i2c_atmel.c | 3 +-
drivers/char/tpm/tpm_i2c_infineon.c | 3 +-
drivers/char/tpm/tpm_i2c_nuvoton.c | 3 +-
drivers/char/tpm/tpm_ibmvtpm.c | 6 ++-
drivers/char/tpm/tpm_infineon.c | 3 +-
drivers/char/tpm/tpm_nsc.c | 3 +-
drivers/char/tpm/tpm_svsm.c | 28 +++++-------
drivers/char/tpm/tpm_tis_core.c | 3 +-
drivers/char/tpm/tpm_tis_i2c_cr50.c | 6 ++-
drivers/char/tpm/tpm_vtpm_proxy.c | 4 +-
drivers/char/tpm/xen-tpmfront.c | 3 +-
18 files changed, 83 insertions(+), 85 deletions(-)
--
2.49.0
next reply other threads:[~2025-06-20 13:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 13:08 Stefano Garzarella [this message]
2025-06-20 13:08 ` [PATCH v6 1/4] tpm: add bufsiz parameter in the .send callback Stefano Garzarella
2025-06-25 12:00 ` Jarkko Sakkinen
2025-06-20 13:08 ` [PATCH v6 2/4] tpm: support devices with synchronous send() Stefano Garzarella
2025-06-20 13:08 ` [PATCH v6 3/4] tpm/tpm_ftpm_tee: support TPM_CHIP_FLAG_SYNC Stefano Garzarella
2025-06-25 12:01 ` Jarkko Sakkinen
2025-06-20 13:08 ` [PATCH v6 4/4] tpm/tpm_svsm: " Stefano Garzarella
2025-06-25 12:02 ` Jarkko Sakkinen
2025-06-25 15:08 ` Jarkko Sakkinen
2025-06-25 16:42 ` Stefano Garzarella
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=20250620130810.99069-1-sgarzare@redhat.com \
--to=sgarzare@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alexandre.belloni@bootlin.com \
--cc=christophe.leroy@csgroup.eu \
--cc=claudiu.beznea@tuxon.dev \
--cc=jarkko@kernel.org \
--cc=jens.wiklander@linaro.org \
--cc=jgg@ziepe.ca \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=npiggin@gmail.com \
--cc=peterhuewe@gmx.de \
--cc=sumit.garg@kernel.org \
/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).