[RFC 0/4] tpm_crb: Add command and response buffer chunking support

Arun Menon posted 4 patches 1 week, 3 days ago
There is a newer version of this series
drivers/char/tpm/tpm.h     |   2 +-
drivers/char/tpm/tpm_crb.c | 194 ++++++++++++++++++++++++++-----------
2 files changed, 137 insertions(+), 59 deletions(-)
[RFC 0/4] tpm_crb: Add command and response buffer chunking support
Posted by Arun Menon 1 week, 3 days ago
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
Re: [RFC 0/4] tpm_crb: Add command and response buffer chunking support
Posted by Jarkko Sakkinen 1 week, 2 days ago
On Tue, Mar 24, 2026 at 12:47:59PM +0530, Arun Menon wrote:
> 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
> 

When QEMU has the feature available?

BR, Jarkko
Re: [RFC 0/4] tpm_crb: Add command and response buffer chunking support
Posted by Arun Menon 1 week, 2 days ago
Hi Jarkko,

On Tue, Mar 24, 2026 at 12:41:26PM +0200, Jarkko Sakkinen wrote:
> On Tue, Mar 24, 2026 at 12:47:59PM +0530, Arun Menon wrote:
> > 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
> > 
> 
> When QEMU has the feature available?

The QEMU patches are in review at the moment,
here is the link: https://lore.kernel.org/qemu-devel/20260319135316.37412-1-armenon@redhat.com/
Hoping to have them merged soon.

> 
> BR, Jarkko
> 

Regards,
Arun Menon