Message ID | 20211105190517.233079-1-ilias.apalodimas@linaro.org |
---|---|
Headers | show |
Series | TPM cleanups and MMIO driver | expand |
On 11/5/21 20:05, Ilias Apalodimas wrote: > Hi! > This is the update for [1]. > > Changes since v4: > - renamed struct udevice *udev -> struct udevice *dev > - added comments on struct tpm_tis_phy_ops > - removed duplicate defines from tpm2_tis_spi driver (now in tpm_tis.h) > - moved API function description for the .c to the .h file > - added Reviewed-by tags from Simon and Heinrich > Changes since v3: > - Coverted SPI TPM to use the API as well > - moved some log_info to log_debug > - Added documentation on how to run QEMU and enabled TPM by default o > arm qemu builds > Changes since v2: > - Add myself as a maintainer on TPM drivers > Changes since v1: > - split off the tis core code into a different file > I am running qemu_arm64_defconfig puls CONFIG_CMD_TPM=y with this series applied: swtpm socket \ --tpmstate dir=/tmp/mytpm1 \ --ctrl type=unixio,path=/tmp/mytpm1/swtpm-sock (swtpm version 6.1, libtpms version 0.8.2-1ubuntu1) qemu-system-aarch64 -machine virt -m 1G -smp cores=2 -bios u-boot.bin -cpu cortex-a53 -nographic -gdb tcp::1234 -netdev user,id=eth0,tftp=tftp -device e1000,netdev=eth0 -device virtio-rng-pci -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0 => tpm2 info tpm_tis@0 v2.0: VendorID 0x1014, DeviceID 0x0001, RevisionID 0x01 [closed] => bootefi hello Found 0 disks No EFI system partition Cannot install EFI_TCG2_PROTOCOL tpm2_get_capability(dev, TPM2_CAP_PCRS, 0, response, 1); returns 10. Why does the the TPM emulation fail? Best regards Heinrich > Ilias Apalodimas (6): > tpm2: Introduce TIS tpm core > tpm2: Add a TPMv2 MMIO TIS driver > tpm: Use the new API on tpm2 spi driver > configs: Enable tpmv2 mmio on qemu for arm/arm64 > doc: qemu: Add instructions for swtpm usage > MAINTAINERS: Add entry for TPM drivers > > [1] https://lore.kernel.org/u-boot/20211103150910.69732-1-ilias.apalodimas@linaro.org/ > > Ilias Apalodimas (6): > tpm2: Introduce TIS tpm core > tpm2: Add a TPMv2 MMIO TIS driver > tpm: Use the new API on tpm2 spi driver > configs: Enable tpmv2 mmio on qemu for arm/arm64 > doc: qemu: Add instructions for swtpm usage > MAINTAINERS: Add entry for TPM drivers > > MAINTAINERS | 5 + > configs/qemu_arm64_defconfig | 2 + > configs/qemu_arm_defconfig | 2 + > doc/board/emulation/qemu-arm.rst | 25 ++ > drivers/tpm/Kconfig | 9 + > drivers/tpm/Makefile | 3 +- > drivers/tpm/tpm2_tis_core.c | 463 +++++++++++++++++++++++++++++++ > drivers/tpm/tpm2_tis_mmio.c | 152 ++++++++++ > drivers/tpm/tpm2_tis_spi.c | 447 +++-------------------------- > drivers/tpm/tpm_tis.h | 128 +++++++++ > include/tpm-v2.h | 1 + > 11 files changed, 820 insertions(+), 417 deletions(-) > create mode 100644 drivers/tpm/tpm2_tis_core.c > create mode 100644 drivers/tpm/tpm2_tis_mmio.c >
Hi Heinrich, On Sun, 7 Nov 2021 at 12:54, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote: > > > > On 11/5/21 20:05, Ilias Apalodimas wrote: > > Hi! > > This is the update for [1]. > > > > Changes since v4: > > - renamed struct udevice *udev -> struct udevice *dev > > - added comments on struct tpm_tis_phy_ops > > - removed duplicate defines from tpm2_tis_spi driver (now in tpm_tis.h) > > - moved API function description for the .c to the .h file > > - added Reviewed-by tags from Simon and Heinrich > > Changes since v3: > > - Coverted SPI TPM to use the API as well > > - moved some log_info to log_debug > > - Added documentation on how to run QEMU and enabled TPM by default o > > arm qemu builds > > Changes since v2: > > - Add myself as a maintainer on TPM drivers > > Changes since v1: > > - split off the tis core code into a different file > > > > I am running qemu_arm64_defconfig puls CONFIG_CMD_TPM=y with this series > applied: > > swtpm socket \ > --tpmstate dir=/tmp/mytpm1 \ > --ctrl type=unixio,path=/tmp/mytpm1/swtpm-sock > > (swtpm version 6.1, libtpms version 0.8.2-1ubuntu1) > > qemu-system-aarch64 -machine virt -m 1G -smp cores=2 -bios u-boot.bin > -cpu cortex-a53 -nographic -gdb tcp::1234 -netdev user,id=eth0,tftp=tftp > -device e1000,netdev=eth0 -device virtio-rng-pci -chardev > socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock -tpmdev > emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0 > > => tpm2 info > tpm_tis@0 v2.0: VendorID 0x1014, DeviceID 0x0001, RevisionID 0x01 [closed] > > => bootefi hello > Found 0 disks > No EFI system partition > Cannot install EFI_TCG2_PROTOCOL > > tpm2_get_capability(dev, TPM2_CAP_PCRS, 0, response, 1); > returns 10. > > Why does the the TPM emulation fail? The TPM subsystem doesn't automatically enable the device properly. It's on my TODO list. Try issuing 'tpm2 init && tpm2 startup TPM2_SU_CLEAR' before any TPM commands. Thanks /Ilias > > Best regards > > Heinrich > > > Ilias Apalodimas (6): > > tpm2: Introduce TIS tpm core > > tpm2: Add a TPMv2 MMIO TIS driver > > tpm: Use the new API on tpm2 spi driver > > configs: Enable tpmv2 mmio on qemu for arm/arm64 > > doc: qemu: Add instructions for swtpm usage > > MAINTAINERS: Add entry for TPM drivers > > > > [1] https://lore.kernel.org/u-boot/20211103150910.69732-1-ilias.apalodimas@linaro.org/ > > > > Ilias Apalodimas (6): > > tpm2: Introduce TIS tpm core > > tpm2: Add a TPMv2 MMIO TIS driver > > tpm: Use the new API on tpm2 spi driver > > configs: Enable tpmv2 mmio on qemu for arm/arm64 > > doc: qemu: Add instructions for swtpm usage > > MAINTAINERS: Add entry for TPM drivers > > > > MAINTAINERS | 5 + > > configs/qemu_arm64_defconfig | 2 + > > configs/qemu_arm_defconfig | 2 + > > doc/board/emulation/qemu-arm.rst | 25 ++ > > drivers/tpm/Kconfig | 9 + > > drivers/tpm/Makefile | 3 +- > > drivers/tpm/tpm2_tis_core.c | 463 +++++++++++++++++++++++++++++++ > > drivers/tpm/tpm2_tis_mmio.c | 152 ++++++++++ > > drivers/tpm/tpm2_tis_spi.c | 447 +++-------------------------- > > drivers/tpm/tpm_tis.h | 128 +++++++++ > > include/tpm-v2.h | 1 + > > 11 files changed, 820 insertions(+), 417 deletions(-) > > create mode 100644 drivers/tpm/tpm2_tis_core.c > > create mode 100644 drivers/tpm/tpm2_tis_mmio.c > >
Building snow_defconfig fails: AR drivers/watchdog/built-in.o drivers/tpm/tpm_tis_infineon.c:53: warning: "TPM_ACCESS" redefined 53 | #define TPM_ACCESS(l) (0x0000 | ((l) << 4)) | In file included from drivers/tpm/tpm_tis_infineon.c:34: drivers/tpm/tpm_tis.h:75: note: this is the location of the previous definition 75 | #define TPM_ACCESS(l) (0x0000 | ((l) << 12)) | drivers/tpm/tpm_tis_infineon.c:54: warning: "TPM_STS" redefined 54 | #define TPM_STS(l) (0x0001 | ((l) << 4)) | In file included from drivers/tpm/tpm_tis_infineon.c:34: drivers/tpm/tpm_tis.h:77: note: this is the location of the previous definition 77 | #define TPM_STS(l) (0x0018 | ((l) << 12)) | drivers/tpm/tpm_tis_infineon.c:55: warning: "TPM_DATA_FIFO" redefined 55 | #define TPM_DATA_FIFO(l) (0x0005 | ((l) << 4)) | In file included from drivers/tpm/tpm_tis_infineon.c:34: drivers/tpm/tpm_tis.h:78: note: this is the location of the previous definition 78 | #define TPM_DATA_FIFO(l) (0x0024 | ((l) << 12)) | drivers/tpm/tpm_tis_infineon.c:56: warning: "TPM_DID_VID" redefined 56 | #define TPM_DID_VID(l) (0x0006 | ((l) << 4)) | In file included from drivers/tpm/tpm_tis_infineon.c:34: drivers/tpm/tpm_tis.h:79: note: this is the location of the previous definition 79 | #define TPM_DID_VID(l) (0x0f00 | ((l) << 12)) | drivers/tpm/tpm_tis_infineon.c:586:12: error: static declaration of ‘tpm_tis_get_desc’ follows non-static declaration 586 | static int tpm_tis_get_desc(struct udevice *dev, char *buf, int size) | ^~~~~~~~~~~~~~~~ In file included from drivers/tpm/tpm_tis_infineon.c:34: drivers/tpm/tpm_tis.h:245:5: note: previous declaration of ‘tpm_tis_get_desc’ with type ‘int(struct udevice *, char *, int)’ 245 | int tpm_tis_get_desc(struct udevice *udev, char *buf, int size); | ^~~~~~~~~~~~~~~~ make[2]: *** [scripts/Makefile.build:254: drivers/tpm/tpm_tis_infineon.o] Error 1 make[1]: *** [scripts/Makefile.build:394: drivers/tpm] Error 2 make: *** [Makefile:1808: drivers] Error 2 Best regards Heinrich