All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/4] tpm_crb: Add command and response buffer chunking support
@ 2026-03-24  7:17 Arun Menon
  2026-03-24  7:18 ` [RFC 1/4] tpm_crb: Add definition of TPM CRB chunking fields Arun Menon
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Arun Menon @ 2026-03-24  7:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-integrity, Jason Gunthorpe, Jarkko Sakkinen, Peter Huewe,
	Arun Menon

The new version of TCG TPM v185 (currently under review [1]) supports
sending data/commands in chunks for the CRB (Command Response Buffer)
interface. This is in line with the initiative to support PQC algorithms.

This series implements the logic to send and receive larger TPM
cmd/rsp between the linux guest and the TPM backend in chunks.
Currently, the TPM CRB driver is limited by the physical size of the
MMIO window. When userspace attempts to send a payload that exceeds this
size, the driver rejects it.

This series introduces chunking support. The driver now checks the CRB
interface capability for CRB_INTF_CAP_CRB_CHUNK. If supported by the
backend, the driver will slice oversized commands into MMIO-sized
chunks, signalling the backend via CRB_START_NEXT_CHUNK, and finalizing
with CRB_START_INVOKE. Responses are also read back in a similar chunked
manner.

If the backend does not support chunking, the driver retains its legacy
behaviour and enforces the standard size limits.

This feature also requires the QEMU to interpret the data in chunks and
forward it to the TPM backend and subsequently dispatch the TPM response
in chunks back to the linux guest. This is implemented in [2]

[1] https://trustedcomputinggroup.org/wp-content/uploads/PC-Client-Specific-Platform-TPM-Profile-for-TPM-2p0-v1p07_rc1_121225.pdf
[2] https://lore.kernel.org/qemu-devel/20260319135316.37412-1-armenon@redhat.com/

Arun Menon (4):
  tpm_crb: Add definition of TPM CRB chunking fields
  tpm_crb: Add new wrapper function to invoke start method
  tpm_crb: Implement command and response chunking logic
  tpm: Increase TPM_BUFSIZE to 64kB for chunking support

 drivers/char/tpm/tpm.h     |   2 +-
 drivers/char/tpm/tpm_crb.c | 194 ++++++++++++++++++++++++++-----------
 2 files changed, 137 insertions(+), 59 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [RFC 4/4] tpm: Increase TPM_BUFSIZE to 64kB for chunking support
@ 2026-03-28  0:35 kernel test robot
  0 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2026-03-28  0:35 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260324071803.324774-5-armenon@redhat.com>
References: <20260324071803.324774-5-armenon@redhat.com>
TO: Arun Menon <armenon@redhat.com>

Hi Arun,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:

[auto build test WARNING on char-misc/char-misc-testing]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arun-Menon/tpm_crb-Add-definition-of-TPM-CRB-chunking-fields/20260326-015436
base:   char-misc/char-misc-testing
patch link:    https://lore.kernel.org/r/20260324071803.324774-5-armenon%40redhat.com
patch subject: [RFC 4/4] tpm: Increase TPM_BUFSIZE to 64kB for chunking support
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: openrisc-randconfig-r072-20260328 (https://download.01.org/0day-ci/archive/20260328/202603280809.fCfcehTj-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 12.5.0
smatch: v0.5.0-9004-gb810ac53

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202603280809.fCfcehTj-lkp@intel.com/

smatch warnings:
drivers/char/tpm/tpm_tis_i2c.c:235 tpm_tis_i2c_write_bytes() warn: impossible condition '(len > 65536 - 1) => (0-u16max > u16max)'

vim +235 drivers/char/tpm/tpm_tis_i2c.c

bbc23a07b0728c Alexander Steffen  2022-06-08  224  
bbc23a07b0728c Alexander Steffen  2022-06-08  225  static int tpm_tis_i2c_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
bbc23a07b0728c Alexander Steffen  2022-06-08  226  				   const u8 *value,
bbc23a07b0728c Alexander Steffen  2022-06-08  227  				   enum tpm_tis_io_mode io_mode)
bbc23a07b0728c Alexander Steffen  2022-06-08  228  {
bbc23a07b0728c Alexander Steffen  2022-06-08  229  	struct tpm_tis_i2c_phy *phy = to_tpm_tis_i2c_phy(data);
bbc23a07b0728c Alexander Steffen  2022-06-08  230  	struct i2c_msg msg = { .addr = phy->i2c_client->addr };
bbc23a07b0728c Alexander Steffen  2022-06-08  231  	u8 reg = tpm_tis_i2c_address_to_register(addr);
bbc23a07b0728c Alexander Steffen  2022-06-08  232  	int ret;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  233  	u16 wrote = 0;
bbc23a07b0728c Alexander Steffen  2022-06-08  234  
bbc23a07b0728c Alexander Steffen  2022-06-08 @235  	if (len > TPM_BUFSIZE - 1)
bbc23a07b0728c Alexander Steffen  2022-06-08  236  		return -EIO;
bbc23a07b0728c Alexander Steffen  2022-06-08  237  
bbc23a07b0728c Alexander Steffen  2022-06-08  238  	phy->io_buf[0] = reg;
bbc23a07b0728c Alexander Steffen  2022-06-08  239  	msg.buf = phy->io_buf;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  240  	while (wrote < len) {
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  241  		/* write register and data in one go */
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  242  		msg.len = sizeof(reg) + len - wrote;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  243  		if (msg.len > I2C_SMBUS_BLOCK_MAX)
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  244  			msg.len = I2C_SMBUS_BLOCK_MAX;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  245  
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  246  		memcpy(phy->io_buf + sizeof(reg), value + wrote,
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  247  		       msg.len - sizeof(reg));
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  248  
bbc23a07b0728c Alexander Steffen  2022-06-08  249  		ret = tpm_tis_i2c_retry_transfer_until_ack(data, &msg);
bbc23a07b0728c Alexander Steffen  2022-06-08  250  		if (ret < 0)
bbc23a07b0728c Alexander Steffen  2022-06-08  251  			return ret;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  252  		wrote += msg.len - sizeof(reg);
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  253  	}
bbc23a07b0728c Alexander Steffen  2022-06-08  254  
bbc23a07b0728c Alexander Steffen  2022-06-08  255  	return 0;
bbc23a07b0728c Alexander Steffen  2022-06-08  256  }
bbc23a07b0728c Alexander Steffen  2022-06-08  257  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-04-27 10:28 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24  7:17 [RFC 0/4] tpm_crb: Add command and response buffer chunking support Arun Menon
2026-03-24  7:18 ` [RFC 1/4] tpm_crb: Add definition of TPM CRB chunking fields Arun Menon
2026-03-24  7:18 ` [RFC 2/4] tpm_crb: Add new wrapper function to invoke start method Arun Menon
2026-03-24 10:42   ` Jarkko Sakkinen
2026-03-24 12:43     ` Arun Menon
2026-04-08  8:36       ` Jarkko Sakkinen
2026-04-23 10:48         ` Arun Menon
2026-03-24  7:18 ` [RFC 3/4] tpm_crb: Implement command and response chunking logic Arun Menon
2026-03-24 10:45   ` Jarkko Sakkinen
2026-03-24 12:46     ` Arun Menon
2026-03-24  7:18 ` [RFC 4/4] tpm: Increase TPM_BUFSIZE to 64kB for chunking support Arun Menon
2026-03-24 10:41 ` [RFC 0/4] tpm_crb: Add command and response buffer " Jarkko Sakkinen
2026-03-24 12:41   ` Arun Menon
2026-04-08  8:34     ` Jarkko Sakkinen
2026-04-23 10:43       ` Arun Menon
2026-04-23 12:50         ` Jarkko Sakkinen
2026-04-24 20:54         ` Stefan Berger
2026-04-25 14:21           ` Jarkko Sakkinen
2026-04-27 10:28           ` Arun Menon
  -- strict thread matches above, loose matches on Subject: below --
2026-03-28  0:35 [RFC 4/4] tpm: Increase TPM_BUFSIZE to 64kB for " kernel test robot

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.