All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Arun Menon <armenon@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org,
	Jason Gunthorpe <jgg@ziepe.ca>, Peter Huewe <peterhuewe@gmx.de>
Subject: Re: [PATCH v3 4/6] tpm: tis_i2c: Use local 4KB buffer to limit memory usage
Date: Fri, 22 May 2026 02:23:46 +0300	[thread overview]
Message-ID: <ag-UAtiWtBiuM9cB@kernel.org> (raw)
In-Reply-To: <20260518151724.730443-5-armenon@redhat.com>

On Mon, May 18, 2026 at 08:47:22PM +0530, Arun Menon wrote:
> From: Arun Menon <armenon@redhat.com>
> 
> The global increase of TPM_BUFSIZE to 8KB is necessary to support
> Post-Quantum Cryptography (PQC) payloads. However, applying this increase
> to the tpm_tis_i2c driver is unnecessary and wasteful due to physical
> transport limitations as pointed out in [1]
> 
> This commit introduces a local buffer limit that is used in the i2c
> driver.
> 
> [1] https://sashiko.dev/#/patchset/20260324071803.324774-1-armenon%40redhat.com?patch=8319
> 
> Signed-off-by: Arun Menon <armenon@redhat.com>
> ---
>  drivers/char/tpm/tpm_tis_i2c.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_i2c.c b/drivers/char/tpm/tpm_tis_i2c.c
> index 6cd07dd34507..db19d459ea1e 100644
> --- a/drivers/char/tpm/tpm_tis_i2c.c
> +++ b/drivers/char/tpm/tpm_tis_i2c.c
> @@ -54,6 +54,8 @@
>  #define TPM_INTF_CAPABILITY_ZERO 0x0FFFF000
>  #define TPM_I2C_INTERFACE_CAPABILITY_ZERO 0x80000000
>  
> +#define TPM_I2C_BUFSIZE 4096
> +
>  struct tpm_tis_i2c_phy {
>  	struct tpm_tis_data priv;
>  	struct i2c_client *i2c_client;
> @@ -232,7 +234,7 @@ static int tpm_tis_i2c_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
>  	int ret;
>  	u16 wrote = 0;
>  
> -	if (len > TPM_BUFSIZE - 1)
> +	if (len > TPM_I2C_BUFSIZE - 1)
>  		return -EIO;
>  
>  	phy->io_buf[0] = reg;
> @@ -339,7 +341,7 @@ static int tpm_tis_i2c_probe(struct i2c_client *dev)
>  	if (!phy)
>  		return -ENOMEM;
>  
> -	phy->io_buf = devm_kzalloc(&dev->dev, TPM_BUFSIZE, GFP_KERNEL);
> +	phy->io_buf = devm_kzalloc(&dev->dev, TPM_I2C_BUFSIZE, GFP_KERNEL);
>  	if (!phy->io_buf)
>  		return -ENOMEM;
>  
> -- 
> 2.54.0
> 


Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

  reply	other threads:[~2026-05-21 23:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18 15:17 [PATCH v3 0/6] tpm_crb: Add command and response buffer chunking support Arun Menon
2026-05-18 15:17 ` [PATCH v3 1/6] tpm_crb: Add register definitions of TPM CRB chunking fields Arun Menon
2026-05-18 15:17 ` [PATCH v3 2/6] tpm_crb: Split start method into a separate header Arun Menon
2026-05-21 23:17   ` Jarkko Sakkinen
2026-05-18 15:17 ` [PATCH v3 3/6] tpm_crb: Add start_cmd parameter to tpm_crb_start wrapper Arun Menon
2026-05-21 22:43   ` Jarkko Sakkinen
2026-05-18 15:17 ` [PATCH v3 4/6] tpm: tis_i2c: Use local 4KB buffer to limit memory usage Arun Menon
2026-05-21 23:23   ` Jarkko Sakkinen [this message]
2026-05-18 15:17 ` [PATCH v3 5/6] tpm: Increase TPM_BUFSIZE to 8kB for chunking support Arun Menon
2026-05-18 15:17 ` [PATCH v3 6/6] tpm_crb: Implement command and response chunking logic Arun Menon
2026-05-21 23:28   ` Jarkko Sakkinen
2026-05-21 21:53 ` [PATCH v3 0/6] tpm_crb: Add command and response buffer chunking support Jarkko Sakkinen

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=ag-UAtiWtBiuM9cB@kernel.org \
    --to=jarkko@kernel.org \
    --cc=armenon@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.