From: Arun Menon <armenon@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jarkko Sakkinen <jarkko@kernel.org>,
Jason Gunthorpe <jgg@ziepe.ca>, Peter Huewe <peterhuewe@gmx.de>,
linux-integrity@vger.kernel.org, Arun Menon <armenon@redhat.com>
Subject: [PATCH v5 4/7] tpm: tis_i2c: Use local 4KB buffer to limit memory usage
Date: Thu, 29 Oct 2026 23:45:38 +0530 [thread overview]
Message-ID: <20261029181541.99505-5-armenon@redhat.com> (raw)
In-Reply-To: <20261029181541.99505-1-armenon@redhat.com>
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>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
---
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 cde0b093ed58..4667eef15ff1 100644
--- a/drivers/char/tpm/tpm_tis_i2c.c
+++ b/drivers/char/tpm/tpm_tis_i2c.c
@@ -55,6 +55,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;
@@ -233,7 +235,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;
@@ -341,7 +343,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.56.0
next prev parent reply other threads:[~2026-10-29 18:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 18:15 [PATCH v5 0/7] tpm_crb: Add command and response buffer chunking support Arun Menon
2026-10-29 18:15 ` [PATCH v5 1/7] tpm_crb: Add register definitions of TPM CRB chunking fields Arun Menon
2026-10-29 18:15 ` [PATCH v5 2/7] tpm_crb: Split start method into a separate header Arun Menon
2026-10-29 18:15 ` [PATCH v5 3/7] tpm_crb: Add start_cmd parameter to tpm_crb_start wrapper Arun Menon
2026-10-29 18:15 ` Arun Menon [this message]
2026-10-29 18:15 ` [PATCH v5 5/7] tpm: Increase TPM_BUFSIZE to 8KB for chunking support Arun Menon
2026-10-29 18:55 ` Jarkko Sakkinen
2026-10-29 18:15 ` [PATCH v5 6/7] tpm_crb: Factor crb_send()/crb_recv() bodies into helpers Arun Menon
2026-10-29 19:27 ` Jarkko Sakkinen
2026-10-29 18:15 ` [PATCH v5 7/7] tpm_crb: Implement command and response chunking logic Arun Menon
2026-10-29 19:28 ` Jarkko Sakkinen
2026-10-29 23:30 ` [PATCH v5 0/7] 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=20261029181541.99505-5-armenon@redhat.com \
--to=armenon@redhat.com \
--cc=jarkko@kernel.org \
--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.