From 109b310ac3c6d7bdf02181147f43da97d38215fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= Date: Thu, 3 Feb 2022 18:30:54 -0500 Subject: [PATCH 1/5] rootfs-configs.yaml: Add python3 unittest to selftest for tpm2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tpm2 kselftest requires python3 unittest. Add it to the rootfs so we can run the test. Signed-off-by: Nícolas F. R. A. Prado --- config/core/rootfs-configs.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/core/rootfs-configs.yaml b/config/core/rootfs-configs.yaml index f52576d5b5..637fb52ec6 100644 --- a/config/core/rootfs-configs.yaml +++ b/config/core/rootfs-configs.yaml @@ -159,6 +159,8 @@ rootfs_configs: - perl-modules-5.32 - procps - publicsuffix + - python3-minimal + - python3-unittest2 - wget - xz-utils From bc4429f037d5ed0279ff3788f2b295d1410d8f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= Date: Fri, 4 Feb 2022 11:30:24 -0500 Subject: [PATCH 2/5] build-configs.yaml: Enable AMD pinctrl to get TPM working on grunt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per grunt's SSDT1 ACPI table, the TPM device requires a GPIO IRQ to be configured, whose controller has HID AMD0030. The driver that matches it is pinctrl-amd. Enable the AMD pinctrl driver so the TPM probes in grunt and can be used in the tpm2 kselftest. Signed-off-by: Nícolas F. R. A. Prado --- config/core/build-configs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/core/build-configs.yaml b/config/core/build-configs.yaml index bed702d566..5d3fbfcdde 100644 --- a/config/core/build-configs.yaml +++ b/config/core/build-configs.yaml @@ -268,6 +268,7 @@ fragments: - 'CONFIG_TCG_TIS_I2C_CR50=y' - 'CONFIG_SPI=y' - 'CONFIG_SPI_PXA2XX=y' + - 'CONFIG_PINCTRL_AMD=y' x86_kvm_guest: path: "kernel/configs/kvm_guest.config" From 88c30621ac035180c13bfce9f17aa2ae43f93ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= Date: Fri, 4 Feb 2022 12:09:44 -0500 Subject: [PATCH 3/5] test-configs.yaml: Add kselftest-tpm2 test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the tpm2 collection to kselftest. It tests TPM devices that support the TPM 2.0 specification. Signed-off-by: Nícolas F. R. A. Prado --- config/core/test-configs.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/core/test-configs.yaml b/config/core/test-configs.yaml index 4667c3892e..239936509c 100644 --- a/config/core/test-configs.yaml +++ b/config/core/test-configs.yaml @@ -293,6 +293,12 @@ test_plans: job_timeout: '10' kselftest_collections: "seccomp" + kselftest-tpm2: + <<: *kselftest + params: + job_timeout: '10' + kselftest_collections: "tpm2" + kselftest-vm: <<: *kselftest params: From 53520de6ff96b163a6e5a2bf91c67b4992c3eb60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= Date: Fri, 4 Feb 2022 12:11:09 -0500 Subject: [PATCH 4/5] test-configs.yaml: Enable kselftest-tpm2 on grunt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit grunt has a cr50 TPM chip that is accessible through an i2c bus. By running this test, we're checking that the tpm_tis_i2c_cr50 driver interfaces correctly with the TPM chip. Signed-off-by: Nícolas F. R. A. Prado --- config/core/test-configs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/core/test-configs.yaml b/config/core/test-configs.yaml index 239936509c..4f80bbdcd4 100644 --- a/config/core/test-configs.yaml +++ b/config/core/test-configs.yaml @@ -1975,6 +1975,7 @@ test_configs: - kselftest-lkdtm - kselftest-rtc - kselftest-seccomp + - kselftest-tpm2 - kselftest-vm - ltp-crypto - ltp-fcntl-locktests From e669253c463bbd6b793e2ea2deb2b2c9f38d06d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= Date: Fri, 25 Feb 2022 11:36:35 -0500 Subject: [PATCH 5/5] rootfs-configs.yaml: Add tpm2-tools to kselftest-bullseye MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tpm2 kselftest currently throws TPM_RC_LOCKOUT errors. A workaround for the issue is to patch the kselftest to run tpm2_clear before running the tests. tpm2_clear is part of the tpm2-tools, so install this package in order to be able to work around those errors. Signed-off-by: Nícolas F. R. A. Prado --- config/core/rootfs-configs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/core/rootfs-configs.yaml b/config/core/rootfs-configs.yaml index 637fb52ec6..2a684a3698 100644 --- a/config/core/rootfs-configs.yaml +++ b/config/core/rootfs-configs.yaml @@ -161,6 +161,7 @@ rootfs_configs: - publicsuffix - python3-minimal - python3-unittest2 + - tpm2-tools - wget - xz-utils