Skip to content

vTPM for aarch64

Eric Auger qemu-arm qemu-devel 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest10 patches 5 repliesIn review
  2. v410 patches 7 repliesSuperseded
  3. v310 patches 11 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 RFC6 patches23 repliesSuperseded
v1 RFC2 patches6 repliesSuperseded

Changes in v5 from the cover letter

- Fix osx make check error in
[PATCH v4 06/10] hw/arm/virt: vTPM support
(put TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node)
outside of CONFIG_LINUX)
Tested with make vm-build-openbsd

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10tpm: rename TPM_TIS into TPM_TIS_ISAhw/i386/acpi-build.c hw/tpm/tpm_tis.c include/sysemu/tpm.h+8 -80 replies
2/10tpm: Use TPMState as a common structhw/tpm/tpm_tis.c+91 -550 replies
3/10tpm: Separate tpm_tis common functions from isa codehw/tpm/Makefile.objs hw/tpm/tpm_tis.h hw/tpm/tpm_tis_common.c +1 more+271 -2010 replies
4/10tpm: Separate TPM_TIS and TPM_TIS_ISA configsdefault-configs/i386-softmmu.mak hw/i386/Kconfig hw/tpm/Kconfig +2 more+12 -60 replies
5/10tpm: Add the SysBus TPM TIS devicehw/tpm/Kconfig hw/tpm/Makefile.objs hw/tpm/tpm_tis_sysbus.c +1 more+166 -00 replies
6/10hw/arm/virt: vTPM supporthw/arm/Kconfig hw/arm/sysbus-fdt.c hw/arm/virt.c+41 -00 replies
7/10docs/specs/tpm: Document TPM_TIS sysbus device for ARMdocs/specs/tpm.rst+24 -10 replies
8/10test: tpm: pass optional machine options to swtpm test functionstests/qtest/tpm-crb-swtpm-test.c tests/qtest/tpm-tests.c tests/qtest/tpm-tests.h +3 more+23 -130 replies
9/10test: tpm-tis: Get prepared to share tests between ISA and sysbus devicestests/qtest/Makefile.include tests/qtest/tpm-crb-swtpm-test.c tests/qtest/tpm-crb-test.c +6 more+493 -4150 replies
10/10test: tpm-tis: Add Sysbus TPM-TIS device testtests/qtest/Makefile.include tests/qtest/tpm-tis-device-swtpm-test.c tests/qtest/tpm-tis-device-test.c+168 -04 replies

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchStefan BergerArd BiesheuvelPhilippe Mathieu-Daudé
1/10R-b T-b A-b R-b
2/10R-b T-b A-b
3/10R-b T-b A-b
4/10T-b A-b R-b
5/10R-b T-b A-b
6/10R-b T-b A-b
7/10R-b
8/10R-b
9/10R-b
10/10R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [PATCH v5 00/10] vTPM for aarch64

This series adds the capability to instantiate an MMIO TPM TIS in ARM virt. It is candidate to qemu 5.0.

The existing TPM TIS code is reshuffled into a generic part, the ISA device and the sysbus device. The sysbus TPM-TIS device gets dynamically instantiated in machvirt on the platform bus.

ACPI boot is not yet supported on ARM. Note that the UEFI firmware is itself a consumer of the DT description, so we need the DT related changes regardless of whether the VM boots in DT or ACPI mode.

Related qtests are reshuffled to allow the reuse of existing tests for both the ISA and the sysbus devices: Adaption consists in changing the qemu command line (change in the device name and provide explicit machine options) and adapt to the relocation of the TPM-TIS device in the memory map.

The series was tested with the swtpm/libtpms emulator. Automatic guest LUKS volume unlocking (tpm2) was successful. Thanks to Ard for supporting me when setting up the test environment.

Best Regards

Eric

Testing:

mkdir /tmp/tpm
swtpm socket \
--tpm2 \
-t -d \
--tpmstate dir=/tmp/tpm \
--ctrl type=unixio,path=/tmp/swtpm-sock

qemu command line must be augmented with the following options:

-chardev socket,id=chrtpm,path=/tmp/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm \
-device tpm-tis-device,tpmdev=tpm0 \

References:
[1] libtpms: https://github.com/stefanberger/libtpms/wiki
[2] swtpm: https://github.com/stefanberger/swtpm/wiki

This series can be found at:
https://github.com/eauger/qemu/tree/v4.2.0-tpm-patch-v5

History:

v4 -> v5:
- Fix osx make check error in
[PATCH v4 06/10] hw/arm/virt: vTPM support
(put TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node)
outside of CONFIG_LINUX)
Tested with make vm-build-openbsd

v3 -> v4:
- collect additional R-b's
- add 'Not used but needed for linking' mention related to tpm_tis_base_addr in CRB test files
- fix comment style

RFCv2 -> PATCH v3:
- Updated the doc for ARM
- Adapted existing tests for ARM
- use qemu_fdt_setprop_string in add_tpm_tis_fdt_node
- Collected R-b's
- Comments not taken into account:
- I have kept the tpm-tis-device name for now despite Stefan's suggestion to rename it into tpm-tis-sysbus. This is not frozen though
- Common state still is not a QOM object (no double inheritence)

RFC v1 -> RFC v2:
- restructure the existing code with common, ISA and sysbus part.
- both ARM and x86 integration were tested.

Eric Auger (10):
tpm: rename TPM_TIS into TPM_TIS_ISA
tpm: Use TPMState as a common struct
tpm: Separate tpm_tis common functions from isa code
tpm: Separate TPM_TIS and TPM_TIS_ISA configs
tpm: Add the SysBus TPM TIS device
hw/arm/virt: vTPM support
docs/specs/tpm: Document TPM_TIS sysbus device for ARM
test: tpm: pass optional machine options to swtpm test functions
test: tpm-tis: Get prepared to share tests between ISA and sysbus
devices
test: tpm-tis: Add Sysbus TPM-TIS device test

 docs/specs/tpm.rst                      |  25 +-
 default-configs/i386-softmmu.mak        |   2 +-
 hw/tpm/tpm_tis.h                        |  91 +++++
 include/sysemu/tpm.h                    |   7 +-
 tests/qtest/tpm-tests.h                 |   5 +-
 tests/qtest/tpm-tis-util.h              |  23 ++
 tests/qtest/tpm-util.h                  |   8 +-
 hw/arm/sysbus-fdt.c                     |  33 ++
 hw/arm/virt.c                           |   7 +
 hw/i386/acpi-build.c                    |   6 +-
 hw/tpm/{tpm_tis.c => tpm_tis_common.c}  | 181 +---------
 hw/tpm/tpm_tis_isa.c                    | 170 +++++++++
 hw/tpm/tpm_tis_sysbus.c                 | 159 +++++++++
 tests/qtest/tpm-crb-swtpm-test.c        |   9 +-
 tests/qtest/tpm-crb-test.c              |   3 +
 tests/qtest/tpm-tests.c                 |  10 +-
 tests/qtest/tpm-tis-device-swtpm-test.c |  76 ++++
 tests/qtest/tpm-tis-device-test.c       |  87 +++++
 tests/qtest/tpm-tis-swtpm-test.c        |   8 +-
 tests/qtest/tpm-tis-test.c              | 414 +---------------------
 tests/qtest/tpm-tis-util.c              | 451 ++++++++++++++++++++++++
 tests/qtest/tpm-util.c                  |  11 +-
 hw/arm/Kconfig                          |   1 +
 hw/i386/Kconfig                         |   2 +-
 hw/tpm/Kconfig                          |  12 +-
 hw/tpm/Makefile.objs                    |   4 +-
 tests/qtest/Makefile.include            |  11 +-
 27 files changed, 1207 insertions(+), 609 deletions(-)
 create mode 100644 hw/tpm/tpm_tis.h
 create mode 100644 tests/qtest/tpm-tis-util.h
 rename hw/tpm/{tpm_tis.c => tpm_tis_common.c} (85%)
 create mode 100644 hw/tpm/tpm_tis_isa.c
 create mode 100644 hw/tpm/tpm_tis_sysbus.c
 create mode 100644 tests/qtest/tpm-tis-device-swtpm-test.c
 create mode 100644 tests/qtest/tpm-tis-device-test.c
 create mode 100644 tests/qtest/tpm-tis-util.c
Signature · 1 line
2.20.1