All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/10] hw/tpm: CRB chunking capability to handle PQC
@ 2026-04-14  8:29 Arun Menon
  2026-04-14  8:29 ` [PATCH v4 01/10] hw/tpm: Add TPM CRB chunking fields Arun Menon
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Arun Menon @ 2026-04-14  8:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Yanan Wang, Ani Sinha, Michael S. Tsirkin,
	Philippe Mathieu-Daudé, Stefan Berger, Paolo Bonzini,
	Marcel Apfelbaum, Zhao Liu, marcandre.lureau, Igor Mammedov,
	Laurent Vivier, Fabiano Rosas, Arun Menon

The move to Post Quantum Cryptography (PQC) changes how we manage
memory buffers. Unlike classic crypto algorithms like RSA or ECC which
used small keys and signatures, PQC algorithms require larger buffers.

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 data from the
linux guest to the TPM backend in chunks, thereby allowing the
guest to send larger data buffers. We introduce 2 new control registers
called nextChunk and crbRspRetry that will control the START. We also
add the CRB Interface Identifier called CapCRBChunk that is set to 1
indicating that the device supports chunking. The default maximum
chunk/buffer size is 3968 (4096 - 128) bytes.

During a send operation, the guest driver places data in the CRB buffer
and signals nextChunk for each segment until the final chunk is reached.
Upon receiving the START signal, QEMU appends the final chunk to its
internal buffer and dispatches the complete command to the TPM backend.

For responses, the backend's output is buffered. The guest consumes the
first chunk once the START bit is cleared. Subsequent chunks are
retrieved by the guest toggling the nextChunk bit, which advances the
internal buffer offset and populates the CRB data window.

For this to work, the linux guest tpm driver will also have to
a) probe if CRB chunking is supported
b) send data in chunks if the command length exceeds the chunk size.
c) receive data in chunks by sending a nextChunk signal and accumulate.
These patches are posted upstream:
https://lore.kernel.org/lkml/20260324181244.17741-1-armenon@redhat.com/

Dependencies:
This series has a hard dependency on the following patches currently on
the mailing list. They must be applied first for this series to function
correctly:
1. [PATCH 1/2] migration/vmstate: Add VMState support for GByteArray
   Link: https://lore.kernel.org/all/20260406115247.4879-2-armenon@redhat.com/
2. [PATCH for-11.1] hw: add compat machines for 11.1
   Link: https://lore.kernel.org/all/20260331140347.653404-1-cohuck@redhat.com/

[1] https://trustedcomputinggroup.org/wp-content/uploads/PC-Client-Specific-Platform-TPM-Profile-for-TPM-2p0-v1p07_rc1_121225.pdf

v4
--
- Add migration blocker to prevent data loss and new hw_compat property
  called cap_chunk. The chunking feature is now only visible to machine
  type 11.1 and higher.
- Rename invoke to Start, to comply with the TCG TPM specification.
- Use g_clear_pointer for safety.

v3
--
Patches 1-6
- Fix the issue with subsequent nextChunk signal from the guest while
  the TPM backend is not done processing the previous request.
- Add tpm_crb_unrealize() to clear buffers
- Update hw_compat to 11.1.
- Use newly introduced GByteArray VMStateInfo for migration.
Patches 7-10
- Add Stefan Berger's patches for swtpm profile support, TPM TIS
  migration support with extended buffer and related tests.
  NOTE: I have removed the "WIP" prefix and the "TODO" regarding dynamic
  allocation from Stefan's final patch, as the static 8192-byte limit is
  sufficient for the current requirements and passes all local testing.

v2
--
- Add the VM migration support.
- Increase the TIS TPM interface max buffer size to 8192.

Based-on: <20260331140347.653404-1-cohuck@redhat.com>
Based-on: <20260406115247.4879-2-armenon@redhat.com>

Arun Menon (6):
  hw/tpm: Add TPM CRB chunking fields
  hw/tpm: Refactor CRB_CTRL_START register access
  hw/tpm: Add internal buffer state for chunking
  hw/tpm: Implement TPM CRB chunking logic
  test/qtest: Add test for tpm crb chunking
  hw/tpm: Add support for VM migration with TPM CRB chunking

Stefan Berger (4):
  qtests: Enable starting swtpm with a given profile
  tests: Use ML-DSA-87 operations to caused large TPM transfers with CRB
  tpm: Extend TPM TIS buffer size to 8192 bytes
  tests: Use ML-DSA-87 operations to caused large TPM transfers with TIS

 hw/core/machine.c                |   5 +-
 hw/tpm/tpm_crb.c                 | 237 ++++++++++++++++++++++++++++---
 hw/tpm/tpm_tis.h                 |   2 +
 hw/tpm/tpm_tis_common.c          |  23 +++
 hw/tpm/tpm_tis_i2c.c             |  24 +++-
 hw/tpm/tpm_tis_isa.c             |  24 +++-
 hw/tpm/tpm_tis_sysbus.c          |  24 +++-
 include/hw/acpi/tpm.h            |   5 +-
 tests/qtest/tpm-crb-swtpm-test.c |  11 ++
 tests/qtest/tpm-tests.c          | 102 ++++++++++++-
 tests/qtest/tpm-tests.h          |   4 +
 tests/qtest/tpm-tis-swtpm-test.c |  11 ++
 tests/qtest/tpm-util.c           | 156 +++++++++++++++++---
 tests/qtest/tpm-util.h           |  10 +-
 14 files changed, 591 insertions(+), 47 deletions(-)

-- 
2.53.0



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

end of thread, other threads:[~2026-04-20 11:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14  8:29 [PATCH v4 00/10] hw/tpm: CRB chunking capability to handle PQC Arun Menon
2026-04-14  8:29 ` [PATCH v4 01/10] hw/tpm: Add TPM CRB chunking fields Arun Menon
2026-04-17 10:05   ` Marc-André Lureau
2026-04-17 14:34     ` Stefan Berger
2026-04-17 14:51       ` Marc-André Lureau
2026-04-20 11:50         ` Arun Menon
2026-04-14  8:29 ` [PATCH v4 02/10] hw/tpm: Refactor CRB_CTRL_START register access Arun Menon
2026-04-14  8:29 ` [PATCH v4 03/10] hw/tpm: Add internal buffer state for chunking Arun Menon
2026-04-14  8:29 ` [PATCH v4 04/10] hw/tpm: Implement TPM CRB chunking logic Arun Menon
2026-04-14  8:29 ` [PATCH v4 05/10] test/qtest: Add test for tpm crb chunking Arun Menon
2026-04-14  8:29 ` [PATCH v4 06/10] hw/tpm: Add support for VM migration with TPM CRB chunking Arun Menon
2026-04-14  8:29 ` [PATCH v4 07/10] qtests: Enable starting swtpm with a given profile Arun Menon
2026-04-14  8:29 ` [PATCH v4 08/10] tests: Use ML-DSA-87 operations to caused large TPM transfers with CRB Arun Menon
2026-04-14  8:29 ` [PATCH v4 09/10] tpm: Extend TPM TIS buffer size to 8192 bytes Arun Menon
2026-04-14  8:29 ` [PATCH v4 10/10] tests: Use ML-DSA-87 operations to caused large TPM transfers with TIS Arun Menon

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.