From: Jarkko Sakkinen <jarkko@kernel.org>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org,
Peter Huewe <peterhuewe@gmx.de>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
James Bottomley <James.Bottomley@hansenpartnership.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Naveen N Rao <naveen@kernel.org>,
Jens Wiklander <jens.wiklander@linaro.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
linux-integrity@vger.kernel.org,
Michael Ellerman <mpe@ellerman.id.au>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Nicholas Piggin <npiggin@gmail.com>,
Sumit Garg <sumit.garg@kernel.org>
Subject: Re: [PATCH v4 1/4] tpm: add buf_size parameter in the .send callback
Date: Sat, 10 May 2025 10:44:38 +0300 [thread overview]
Message-ID: <aB8D5syofPSqjzns@kernel.org> (raw)
In-Reply-To: <20250509085713.76851-2-sgarzare@redhat.com>
On Fri, May 09, 2025 at 10:57:10AM +0200, Stefano Garzarella wrote:
> From: Stefano Garzarella <sgarzare@redhat.com>
>
> Add a new `buf_size` parameter to the `.send` callback in `tpm_class_ops`.
> This parameter will allow drivers to differentiate between the actual
> command length to send and the total buffer size. Currently `buf_now` is
> not used, but it will be used to implement devices with synchronous send()
> to send the command and receive the response on the same buffer.
>
> Also rename the previous parameter `len` to `cmd_len` in the declaration
> to make it clear that it contains the length in bytes of the command
> stored in the buffer. The semantics don't change and it can be used as
> before by drivers. This is an optimization since the drivers could get it
> from the header, but let's avoid duplicating code.
>
> While we are here, resolve a checkpatch warning:
> WARNING: Unnecessary space before function pointer arguments
> #66: FILE: include/linux/tpm.h:90:
> + int (*send) (struct tpm_chip *chip, u8 *buf, size_t cmd_len,
>
> Suggested-by: Jarkko Sakkinen <jarkko@kernel.org>
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
> v4:
> - rework the commit description [Jarkko]
> ---
> include/linux/tpm.h | 3 ++-
> drivers/char/tpm/st33zp24/st33zp24.c | 2 +-
> drivers/char/tpm/tpm-interface.c | 2 +-
> drivers/char/tpm/tpm_atmel.c | 3 ++-
> drivers/char/tpm/tpm_crb.c | 2 +-
> drivers/char/tpm/tpm_ftpm_tee.c | 4 +++-
> 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 | 3 ++-
> 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 ++-
> 17 files changed, 37 insertions(+), 19 deletions(-)
>
> diff --git a/include/linux/tpm.h b/include/linux/tpm.h
> index 9ac9768cc8f7..7ac390ec89ce 100644
> --- a/include/linux/tpm.h
> +++ b/include/linux/tpm.h
> @@ -87,7 +87,8 @@ struct tpm_class_ops {
> const u8 req_complete_val;
> bool (*req_canceled)(struct tpm_chip *chip, u8 status);
> int (*recv) (struct tpm_chip *chip, u8 *buf, size_t len);
> - int (*send) (struct tpm_chip *chip, u8 *buf, size_t len);
> + int (*send)(struct tpm_chip *chip, u8 *buf, size_t cmd_len,
> + size_t buf_size);
I'm sorry but now that I look at this, just for the sake of consistency:
int (*send)(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
size_t cmd_len);
I.e. match the order and parameter names from tpm_try_transmit().
BR, Jarkko
next prev parent reply other threads:[~2025-05-10 7:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 8:57 [PATCH v4 0/4] tpm: add support for sync send() and use it in ftpm and svsm drivers Stefano Garzarella
2025-05-09 8:57 ` [PATCH v4 1/4] tpm: add buf_size parameter in the .send callback Stefano Garzarella
2025-05-10 7:44 ` Jarkko Sakkinen [this message]
2025-05-13 14:02 ` Stefano Garzarella
2025-05-09 8:57 ` [PATCH v4 2/4] tpm: support devices with synchronous send() Stefano Garzarella
2025-05-09 8:57 ` [PATCH v4 3/4] tpm/tpm_ftpm_tee: support TPM_CHIP_FLAG_SYNC Stefano Garzarella
2025-05-09 8:57 ` [PATCH v4 4/4] tpm/tpm_svsm: " 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=aB8D5syofPSqjzns@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=alexandre.belloni@bootlin.com \
--cc=christophe.leroy@csgroup.eu \
--cc=claudiu.beznea@tuxon.dev \
--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=sgarzare@redhat.com \
--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).