All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] tests: Add test cases for TPM 1.2 ACPI tables
@ 2021-06-30 15:37 Stefan Berger
  2021-06-30 15:37 ` [PATCH 1/7] tests: Rename TestState to TPMTestState Stefan Berger
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: Stefan Berger @ 2021-06-30 15:37 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau; +Cc: philmd, Stefan Berger

This series of patches adds test case for TPM 1.2 ACPI tables.

  Stefan

Stefan Berger (7):
  tests: Rename TestState to TPMTestState
  tests: Add tpm_version field to TPMTestState and fill it
  tests: Add suffix tpm2 or tpm12 to ACPI table files
  test: tpm: Create TPM 1.2 response in TPM emulator
  tests: acpi: prepare for new TPM 1.2 related tables
  tests: acpi: Add test cases for TPM 1.2 with TCPA table
  tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs

 tests/data/acpi/q35/DSDT.tis.tpm12            | Bin 0 -> 8465 bytes
 .../data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} | Bin
 tests/data/acpi/q35/TCPA.tis.tpm12            | Bin 0 -> 50 bytes
 .../data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} | Bin
 tests/qtest/bios-tables-test.c                |  20 ++++++++++-----
 tests/qtest/tpm-crb-test.c                    |   5 ++--
 tests/qtest/tpm-emu.c                         |  24 +++++++++++++-----
 tests/qtest/tpm-emu.h                         |  11 +++++---
 tests/qtest/tpm-tis-device-test.c             |   3 ++-
 tests/qtest/tpm-tis-test.c                    |   3 ++-
 tests/qtest/tpm-tis-util.c                    |   2 +-
 11 files changed, 48 insertions(+), 20 deletions(-)
 create mode 100644 tests/data/acpi/q35/DSDT.tis.tpm12
 rename tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} (100%)
 create mode 100644 tests/data/acpi/q35/TCPA.tis.tpm12
 rename tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} (100%)

-- 
2.31.1



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

* [PATCH 1/7] tests: Rename TestState to TPMTestState
  2021-06-30 15:37 [PATCH 0/7] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
@ 2021-06-30 15:37 ` Stefan Berger
  2021-07-08 14:23   ` Igor Mammedov
  2021-06-30 15:37 ` [PATCH 2/7] tests: Add tpm_version field to TPMTestState and fill it Stefan Berger
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Stefan Berger @ 2021-06-30 15:37 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau; +Cc: Stefan Berger, philmd, Stefan Berger

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/qtest/bios-tables-test.c    | 2 +-
 tests/qtest/tpm-crb-test.c        | 4 ++--
 tests/qtest/tpm-emu.c             | 6 +++---
 tests/qtest/tpm-emu.h             | 6 +++---
 tests/qtest/tpm-tis-device-test.c | 2 +-
 tests/qtest/tpm-tis-test.c        | 2 +-
 tests/qtest/tpm-tis-util.c        | 2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 51d3a4e239..a622f91a37 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1098,7 +1098,7 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
     gchar *tmp_dir_name = g_strdup_printf("qemu-test_acpi_%s_tcg_%s.XXXXXX",
                                           machine, tpm_if);
     char *tmp_path = g_dir_make_tmp(tmp_dir_name, NULL);
-    TestState test;
+    TPMTestState test;
     test_data data;
     GThread *thread;
     char *args, *variant = g_strdup_printf(".%s", tpm_if);
diff --git a/tests/qtest/tpm-crb-test.c b/tests/qtest/tpm-crb-test.c
index ed533900d1..50936f1482 100644
--- a/tests/qtest/tpm-crb-test.c
+++ b/tests/qtest/tpm-crb-test.c
@@ -26,7 +26,7 @@ uint64_t tpm_tis_base_addr = TPM_TIS_ADDR_BASE;
 
 static void tpm_crb_test(const void *data)
 {
-    const TestState *s = data;
+    const TPMTestState *s = data;
     uint32_t intfid = readl(TPM_CRB_ADDR_BASE + A_CRB_INTF_ID);
     uint32_t csize = readl(TPM_CRB_ADDR_BASE + A_CRB_CTRL_CMD_SIZE);
     uint64_t caddr = readq(TPM_CRB_ADDR_BASE + A_CRB_CTRL_CMD_LADDR);
@@ -145,7 +145,7 @@ int main(int argc, char **argv)
     int ret;
     char *args, *tmp_path = g_dir_make_tmp("qemu-tpm-crb-test.XXXXXX", NULL);
     GThread *thread;
-    TestState test;
+    TPMTestState test;
 
     module_call_init(MODULE_INIT_QOM);
     g_test_init(&argc, &argv, NULL);
diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c
index 2e8eb7b94f..b9cddcc240 100644
--- a/tests/qtest/tpm-emu.c
+++ b/tests/qtest/tpm-emu.c
@@ -18,7 +18,7 @@
 #include "qapi/error.h"
 #include "tpm-emu.h"
 
-void tpm_emu_test_wait_cond(TestState *s)
+void tpm_emu_test_wait_cond(TPMTestState *s)
 {
     gint64 end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
 
@@ -36,7 +36,7 @@ void tpm_emu_test_wait_cond(TestState *s)
 
 static void *tpm_emu_tpm_thread(void *data)
 {
-    TestState *s = data;
+    TPMTestState *s = data;
     QIOChannel *ioc = s->tpm_ioc;
 
     s->tpm_msg = g_new(struct tpm_hdr, 1);
@@ -71,7 +71,7 @@ static void *tpm_emu_tpm_thread(void *data)
 
 void *tpm_emu_ctrl_thread(void *data)
 {
-    TestState *s = data;
+    TPMTestState *s = data;
     QIOChannelSocket *lioc = qio_channel_socket_new();
     QIOChannel *ioc;
 
diff --git a/tests/qtest/tpm-emu.h b/tests/qtest/tpm-emu.h
index 73f3bed0c4..b066ad63fb 100644
--- a/tests/qtest/tpm-emu.h
+++ b/tests/qtest/tpm-emu.h
@@ -26,7 +26,7 @@ struct tpm_hdr {
     char buffer[];
 } QEMU_PACKED;
 
-typedef struct TestState {
+typedef struct TPMTestState {
     GMutex data_mutex;
     GCond data_cond;
     bool data_cond_signal;
@@ -34,9 +34,9 @@ typedef struct TestState {
     QIOChannel *tpm_ioc;
     GThread *emu_tpm_thread;
     struct tpm_hdr *tpm_msg;
-} TestState;
+} TPMTestState;
 
-void tpm_emu_test_wait_cond(TestState *s);
+void tpm_emu_test_wait_cond(TPMTestState *s);
 void *tpm_emu_ctrl_thread(void *data);
 
 #endif /* TESTS_TPM_EMU_H */
diff --git a/tests/qtest/tpm-tis-device-test.c b/tests/qtest/tpm-tis-device-test.c
index 63ed36440f..d36ae20243 100644
--- a/tests/qtest/tpm-tis-device-test.c
+++ b/tests/qtest/tpm-tis-device-test.c
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
 {
     char *tmp_path = g_dir_make_tmp("qemu-tpm-tis-device-test.XXXXXX", NULL);
     GThread *thread;
-    TestState test;
+    TPMTestState test;
     char *args;
     int ret;
 
diff --git a/tests/qtest/tpm-tis-test.c b/tests/qtest/tpm-tis-test.c
index 79ffbc943e..6fee4779ea 100644
--- a/tests/qtest/tpm-tis-test.c
+++ b/tests/qtest/tpm-tis-test.c
@@ -29,7 +29,7 @@ int main(int argc, char **argv)
     int ret;
     char *args, *tmp_path = g_dir_make_tmp("qemu-tpm-tis-test.XXXXXX", NULL);
     GThread *thread;
-    TestState test;
+    TPMTestState test;
 
     module_call_init(MODULE_INIT_QOM);
     g_test_init(&argc, &argv, NULL);
diff --git a/tests/qtest/tpm-tis-util.c b/tests/qtest/tpm-tis-util.c
index 9aff503fd8..939893bf01 100644
--- a/tests/qtest/tpm-tis-util.c
+++ b/tests/qtest/tpm-tis-util.c
@@ -373,7 +373,7 @@ void tpm_tis_test_check_access_reg_release(const void *data)
  */
 void tpm_tis_test_check_transmit(const void *data)
 {
-    const TestState *s = data;
+    const TPMTestState *s = data;
     uint8_t access;
     uint32_t sts;
     uint16_t bcount;
-- 
2.31.1



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

* [PATCH 2/7] tests: Add tpm_version field to TPMTestState and fill it
  2021-06-30 15:37 [PATCH 0/7] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
  2021-06-30 15:37 ` [PATCH 1/7] tests: Rename TestState to TPMTestState Stefan Berger
@ 2021-06-30 15:37 ` Stefan Berger
  2021-07-08 14:24   ` Igor Mammedov
  2021-06-30 15:37 ` [PATCH 3/7] tests: Add suffix tpm2 or tpm12 to ACPI table files Stefan Berger
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Stefan Berger @ 2021-06-30 15:37 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau; +Cc: Stefan Berger, philmd, Stefan Berger

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/qtest/bios-tables-test.c    |  5 +++--
 tests/qtest/tpm-crb-test.c        |  1 +
 tests/qtest/tpm-emu.c             | 13 ++++++++++---
 tests/qtest/tpm-emu.h             |  2 ++
 tests/qtest/tpm-tis-device-test.c |  1 +
 tests/qtest/tpm-tis-test.c        |  1 +
 6 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index a622f91a37..93c9d306b5 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1092,7 +1092,7 @@ static void test_acpi_piix4_tcg_numamem(void)
 uint64_t tpm_tis_base_addr;
 
 static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
-                              uint64_t base)
+                              uint64_t base, enum TPMVersion tpm_version)
 {
 #ifdef CONFIG_TPM
     gchar *tmp_dir_name = g_strdup_printf("qemu-test_acpi_%s_tcg_%s.XXXXXX",
@@ -1113,6 +1113,7 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
     g_mutex_init(&test.data_mutex);
     g_cond_init(&test.data_cond);
     test.data_cond_signal = false;
+    test.tpm_version = tpm_version;
 
     thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test);
     tpm_emu_test_wait_cond(&test);
@@ -1145,7 +1146,7 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
 
 static void test_acpi_q35_tcg_tpm_tis(void)
 {
-    test_acpi_tcg_tpm("q35", "tis", 0xFED40000);
+    test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_2_0);
 }
 
 static void test_acpi_tcg_dimm_pxm(const char *machine)
diff --git a/tests/qtest/tpm-crb-test.c b/tests/qtest/tpm-crb-test.c
index 50936f1482..7b94453390 100644
--- a/tests/qtest/tpm-crb-test.c
+++ b/tests/qtest/tpm-crb-test.c
@@ -156,6 +156,7 @@ int main(int argc, char **argv)
     g_mutex_init(&test.data_mutex);
     g_cond_init(&test.data_cond);
     test.data_cond_signal = false;
+    test.tpm_version = TPM_VERSION_2_0;
 
     thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test);
     tpm_emu_test_wait_cond(&test);
diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c
index b9cddcc240..8baf49eafd 100644
--- a/tests/qtest/tpm-emu.c
+++ b/tests/qtest/tpm-emu.c
@@ -56,9 +56,16 @@ static void *tpm_emu_tpm_thread(void *data)
         s->tpm_msg->code = be32_to_cpu(s->tpm_msg->code);
 
         /* reply error */
-        s->tpm_msg->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS);
-        s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr));
-        s->tpm_msg->code = cpu_to_be32(TPM_RC_FAILURE);
+        switch (s->tpm_version) {
+        case TPM_VERSION_2_0:
+            s->tpm_msg->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS);
+            s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr));
+            s->tpm_msg->code = cpu_to_be32(TPM_RC_FAILURE);
+            break;
+        default:
+            g_debug("unsupport TPM version %u", s->tpm_version);
+            g_assert_not_reached();
+        }
         qio_channel_write(ioc, (char *)s->tpm_msg, be32_to_cpu(s->tpm_msg->len),
                           &error_abort);
     }
diff --git a/tests/qtest/tpm-emu.h b/tests/qtest/tpm-emu.h
index b066ad63fb..f7b1e3c6ab 100644
--- a/tests/qtest/tpm-emu.h
+++ b/tests/qtest/tpm-emu.h
@@ -18,6 +18,7 @@
 
 #include "qemu/sockets.h"
 #include "io/channel.h"
+#include "sysemu/tpm.h"
 
 struct tpm_hdr {
     uint16_t tag;
@@ -34,6 +35,7 @@ typedef struct TPMTestState {
     QIOChannel *tpm_ioc;
     GThread *emu_tpm_thread;
     struct tpm_hdr *tpm_msg;
+    enum TPMVersion tpm_version;
 } TPMTestState;
 
 void tpm_emu_test_wait_cond(TPMTestState *s);
diff --git a/tests/qtest/tpm-tis-device-test.c b/tests/qtest/tpm-tis-device-test.c
index d36ae20243..3ddefb51ec 100644
--- a/tests/qtest/tpm-tis-device-test.c
+++ b/tests/qtest/tpm-tis-device-test.c
@@ -46,6 +46,7 @@ int main(int argc, char **argv)
     g_mutex_init(&test.data_mutex);
     g_cond_init(&test.data_cond);
     test.data_cond_signal = false;
+    test.tpm_version = TPM_VERSION_2_0;
 
     thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test);
     tpm_emu_test_wait_cond(&test);
diff --git a/tests/qtest/tpm-tis-test.c b/tests/qtest/tpm-tis-test.c
index 6fee4779ea..a4a25ba745 100644
--- a/tests/qtest/tpm-tis-test.c
+++ b/tests/qtest/tpm-tis-test.c
@@ -40,6 +40,7 @@ int main(int argc, char **argv)
     g_mutex_init(&test.data_mutex);
     g_cond_init(&test.data_cond);
     test.data_cond_signal = false;
+    test.tpm_version = TPM_VERSION_2_0;
 
     thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test);
     tpm_emu_test_wait_cond(&test);
-- 
2.31.1



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

* [PATCH 3/7] tests: Add suffix tpm2 or tpm12 to ACPI table files
  2021-06-30 15:37 [PATCH 0/7] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
  2021-06-30 15:37 ` [PATCH 1/7] tests: Rename TestState to TPMTestState Stefan Berger
  2021-06-30 15:37 ` [PATCH 2/7] tests: Add tpm_version field to TPMTestState and fill it Stefan Berger
@ 2021-06-30 15:37 ` Stefan Berger
  2021-07-08 13:59   ` Igor Mammedov
  2021-06-30 15:37 ` [PATCH 4/7] test: tpm: Create TPM 1.2 response in TPM emulator Stefan Berger
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Stefan Berger @ 2021-06-30 15:37 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau; +Cc: Stefan Berger, philmd, Stefan Berger

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} | Bin
 tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} | Bin
 tests/qtest/bios-tables-test.c                  |   3 ++-
 3 files changed, 2 insertions(+), 1 deletion(-)
 rename tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} (100%)
 rename tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} (100%)

diff --git a/tests/data/acpi/q35/DSDT.tis b/tests/data/acpi/q35/DSDT.tis.tpm2
similarity index 100%
rename from tests/data/acpi/q35/DSDT.tis
rename to tests/data/acpi/q35/DSDT.tis.tpm2
diff --git a/tests/data/acpi/q35/TPM2.tis b/tests/data/acpi/q35/TPM2.tis.tpm2
similarity index 100%
rename from tests/data/acpi/q35/TPM2.tis
rename to tests/data/acpi/q35/TPM2.tis.tpm2
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 93c9d306b5..4ccbe56158 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1101,7 +1101,8 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
     TPMTestState test;
     test_data data;
     GThread *thread;
-    char *args, *variant = g_strdup_printf(".%s", tpm_if);
+    const char *suffix = tpm_version == TPM_VERSION_2_0 ? "tpm2" : "tpm12";
+    char *args, *variant = g_strdup_printf(".%s.%s", tpm_if, suffix);
 
     tpm_tis_base_addr = base;
 
-- 
2.31.1



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

* [PATCH 4/7] test: tpm: Create TPM 1.2 response in TPM emulator
  2021-06-30 15:37 [PATCH 0/7] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (2 preceding siblings ...)
  2021-06-30 15:37 ` [PATCH 3/7] tests: Add suffix tpm2 or tpm12 to ACPI table files Stefan Berger
@ 2021-06-30 15:37 ` Stefan Berger
  2021-07-08 15:19   ` Igor Mammedov
  2021-06-30 15:37 ` [PATCH 5/7] tests: acpi: prepare for new TPM 1.2 related tables Stefan Berger
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Stefan Berger @ 2021-06-30 15:37 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau; +Cc: Stefan Berger, philmd, Stefan Berger

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/qtest/tpm-emu.c | 5 +++++
 tests/qtest/tpm-emu.h | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c
index 8baf49eafd..32c704194b 100644
--- a/tests/qtest/tpm-emu.c
+++ b/tests/qtest/tpm-emu.c
@@ -62,6 +62,11 @@ static void *tpm_emu_tpm_thread(void *data)
             s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr));
             s->tpm_msg->code = cpu_to_be32(TPM_RC_FAILURE);
             break;
+        case TPM_VERSION_1_2:
+            s->tpm_msg->tag = cpu_to_be16(TPM_TAG_RSP_COMMAND);
+            s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr));
+            s->tpm_msg->code = cpu_to_be32(TPM_FAIL);
+            break;
         default:
             g_debug("unsupport TPM version %u", s->tpm_version);
             g_assert_not_reached();
diff --git a/tests/qtest/tpm-emu.h b/tests/qtest/tpm-emu.h
index f7b1e3c6ab..b5354ea101 100644
--- a/tests/qtest/tpm-emu.h
+++ b/tests/qtest/tpm-emu.h
@@ -16,6 +16,9 @@
 #define TPM_RC_FAILURE 0x101
 #define TPM2_ST_NO_SESSIONS 0x8001
 
+#define TPM_FAIL 9
+#define TPM_TAG_RSP_COMMAND 0xc4
+
 #include "qemu/sockets.h"
 #include "io/channel.h"
 #include "sysemu/tpm.h"
-- 
2.31.1



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

* [PATCH 5/7] tests: acpi: prepare for new TPM 1.2 related tables
  2021-06-30 15:37 [PATCH 0/7] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (3 preceding siblings ...)
  2021-06-30 15:37 ` [PATCH 4/7] test: tpm: Create TPM 1.2 response in TPM emulator Stefan Berger
@ 2021-06-30 15:37 ` Stefan Berger
  2021-07-08 14:25   ` Igor Mammedov
  2021-06-30 15:37 ` [PATCH 6/7] tests: acpi: Add test cases for TPM 1.2 with TCPA table Stefan Berger
  2021-06-30 15:37 ` [PATCH 7/7] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs Stefan Berger
  6 siblings, 1 reply; 18+ messages in thread
From: Stefan Berger @ 2021-06-30 15:37 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau
  Cc: Igor Mammedov, Stefan Berger, Michael S . Tsirkin, philmd, Stefan Berger

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/data/acpi/q35/DSDT.tis.tpm12          | 0
 tests/data/acpi/q35/TCPA.tis.tpm12          | 0
 tests/qtest/bios-tables-test-allowed-diff.h | 2 ++
 3 files changed, 2 insertions(+)
 create mode 100644 tests/data/acpi/q35/DSDT.tis.tpm12
 create mode 100644 tests/data/acpi/q35/TCPA.tis.tpm12

diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/q35/DSDT.tis.tpm12
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/q35/TCPA.tis.tpm12 b/tests/data/acpi/q35/TCPA.tis.tpm12
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..fb093b32b9 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,3 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.tis.tpm12",
+"tests/data/acpi/q35/TCPA.tis.tpm12",
-- 
2.31.1



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

* [PATCH 6/7] tests: acpi: Add test cases for TPM 1.2 with TCPA table
  2021-06-30 15:37 [PATCH 0/7] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (4 preceding siblings ...)
  2021-06-30 15:37 ` [PATCH 5/7] tests: acpi: prepare for new TPM 1.2 related tables Stefan Berger
@ 2021-06-30 15:37 ` Stefan Berger
  2021-07-08 14:24   ` Igor Mammedov
  2021-06-30 15:37 ` [PATCH 7/7] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs Stefan Berger
  6 siblings, 1 reply; 18+ messages in thread
From: Stefan Berger @ 2021-06-30 15:37 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau
  Cc: Igor Mammedov, Stefan Berger, Michael S . Tsirkin, philmd, Stefan Berger

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/qtest/bios-tables-test.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 4ccbe56158..ddfd2d2b2a 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1145,11 +1145,16 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
 #endif
 }
 
-static void test_acpi_q35_tcg_tpm_tis(void)
+static void test_acpi_q35_tcg_tpm2_tis(void)
 {
     test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_2_0);
 }
 
+static void test_acpi_q35_tcg_tpm12_tis(void)
+{
+    test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_1_2);
+}
+
 static void test_acpi_tcg_dimm_pxm(const char *machine)
 {
     test_data data;
@@ -1518,7 +1523,8 @@ int main(int argc, char *argv[])
             return ret;
         }
         qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
-        qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
+        qtest_add_func("acpi/q35/tpm2-tis", test_acpi_q35_tcg_tpm2_tis);
+        qtest_add_func("acpi/q35/tpm12-tis", test_acpi_q35_tcg_tpm12_tis);
         qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
         qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
         qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
-- 
2.31.1



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

* [PATCH 7/7] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs
  2021-06-30 15:37 [PATCH 0/7] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (5 preceding siblings ...)
  2021-06-30 15:37 ` [PATCH 6/7] tests: acpi: Add test cases for TPM 1.2 with TCPA table Stefan Berger
@ 2021-06-30 15:37 ` Stefan Berger
  2021-07-08 14:26   ` Igor Mammedov
  6 siblings, 1 reply; 18+ messages in thread
From: Stefan Berger @ 2021-06-30 15:37 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau
  Cc: Igor Mammedov, Stefan Berger, Michael S . Tsirkin, philmd, Stefan Berger

The TCPA.tis.tpm12 file contains the following:

[000h 0000   4]                    Signature : "TCPA"    [Trusted Computing Platform Alliance table]
[004h 0004   4]                 Table Length : 00000032
[008h 0008   1]                     Revision : 02
[009h 0009   1]                     Checksum : 32
[00Ah 0010   6]                       Oem ID : "BOCHS "
[010h 0016   8]                 Oem Table ID : "BXPC    "
[018h 0024   4]                 Oem Revision : 00000001
[01Ch 0028   4]              Asl Compiler ID : "BXPC"
[020h 0032   4]        Asl Compiler Revision : 00000001

[024h 0036   2]               Platform Class : 0000
[026h 0038   4]         Min Event Log Length : 00010000
[02Ah 0042   8]            Event Log Address : 0000000007FF0000

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/data/acpi/q35/DSDT.tis.tpm12          | Bin 0 -> 8465 bytes
 tests/data/acpi/q35/TCPA.tis.tpm12          | Bin 0 -> 50 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   2 --
 3 files changed, 2 deletions(-)

diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/q35/DSDT.tis.tpm12
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4178162b0b20b2a4a391daa73264963c28a99a3a 100644
GIT binary patch
literal 8465
zcmb7KOKcm*8J^)oS}vE;lA`5jBGz#qX#<Cn@<NNGA(ziulvX5dH=zrzET@(20$C&x
zkkkkuD?s8HXpw|<&`SX(V2a+_L+=fG?jZ*Q2~hOVYk^)`6ft@*`~5Q<Wrn1HScm2Q
zv)?!W|II$W-5HfyrFQxojPY1;!>hG&#UJ}#4u706M*H;Z)?=4gXRlPOc6l-q<DHvH
zv5!sB%05;qp0D!X>;xYM!E5gXd@E#^KX&h2-U{Ek6<lTn+PxgwHto3Oxo)f2?d*HD
z@742Gw^lDXh0kou>Uwf7YIO^xCbPQd>m`<5o9%A2yx8sQ%qv}7?ytvtJLv`6?KJ+j
z`sLE8=RdsoTH(`YKmY0N>vjx)75rNGT@7gy+z9NYpznUryUO1rx;VDnU-+OW4$C%|
zj)VcV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j(U@ABpKWx)Ej>kW2p~^@7`xVJvXtg8iQQ9
zt}50n3y>?Hb=0ms<m6IYQd+Wj$mM2oGn`g0AH4)hYqgu1iE(s}{U^E^D`rP*%%mZD
zl8#U%?hn2i#?JoP%0*9_PinK=IFEC=LTD@*>RH^l8>dI9TYL19SYLboQModiY~}NE
zWfC&J+sZ#91B^IlaKzSfi4DZgirQJFozDKonX~lW)Akz&>wFGY2`RC$B&v_oUfcIq
zumZbz_rCpN=jIs^`hI=g!p6_}ep75VX|Iu6!#39;&MI?W1cz3@DdLTd3m2^HO53lj
zC;EvG?(ASr2{jRPnZ4pL|L*-AHbO6Rv{tNv*rM8%OpL}8d#jl^o$ze=Shv(_IQ?o?
zE_46xe}8}W<WqlIADsE6YyEby)lc@Wu|Ya+M}{0OaE%XA%V$?v|FPaRJA&2r>kN-T
zswLRM;Tu~v=Jf_V3{d`N$Vdv7jeiJmw0{JP;vu!)qDnYJRgIPYBfYEWNHwo=M*9td
ztm51gX0>mD9~;;afUnu{kj6#;B-oz>&kT^S90z*#&>HboE6TMa1a_%7t!k<kb;%aU
z<VwqNbZVKM4n#kLbd)nZg~fjh{Hq;2z3|uF%6q4(7e4>@-JjqYPs14H(f$GkQSk#h
HnFIEJ<TmVT

literal 0
HcmV?d00001

diff --git a/tests/data/acpi/q35/TCPA.tis.tpm12 b/tests/data/acpi/q35/TCPA.tis.tpm12
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a56961b413e7715b3d60f9836d1c8f2f4c7347cb 100644
GIT binary patch
literal 50
qcmWG>4sbMLU|?V}a`Jcf2v%^42yj*a0!E-1hz+7a07U<12eAOxRtEt9

literal 0
HcmV?d00001

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index fb093b32b9..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,3 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.tis.tpm12",
-"tests/data/acpi/q35/TCPA.tis.tpm12",
-- 
2.31.1



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

* Re: [PATCH 3/7] tests: Add suffix tpm2 or tpm12 to ACPI table files
  2021-06-30 15:37 ` [PATCH 3/7] tests: Add suffix tpm2 or tpm12 to ACPI table files Stefan Berger
@ 2021-07-08 13:59   ` Igor Mammedov
  2021-07-08 14:17     ` Stefan Berger
  0 siblings, 1 reply; 18+ messages in thread
From: Igor Mammedov @ 2021-07-08 13:59 UTC (permalink / raw)
  To: Stefan Berger; +Cc: marcandre.lureau, mst, philmd, qemu-devel, Stefan Berger

On Wed, 30 Jun 2021 11:37:19 -0400
Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:

> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> ---
>  tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} | Bin
>  tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} | Bin
>  tests/qtest/bios-tables-test.c                  |   3 ++-
>  3 files changed, 2 insertions(+), 1 deletion(-)
>  rename tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} (100%)
>  rename tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} (100%)

it fails checkpatch which falsely detects it as adding new files

ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis.tpm2 and tests/qtest/bios-tables-test.c found

ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis.tpm2 and tests/qtest/bios-tables-test.c found

looks like checkpatch needs to be fixed to handle testcase variant renaming.


> diff --git a/tests/data/acpi/q35/DSDT.tis b/tests/data/acpi/q35/DSDT.tis.tpm2
> similarity index 100%
> rename from tests/data/acpi/q35/DSDT.tis
> rename to tests/data/acpi/q35/DSDT.tis.tpm2
> diff --git a/tests/data/acpi/q35/TPM2.tis b/tests/data/acpi/q35/TPM2.tis.tpm2
> similarity index 100%
> rename from tests/data/acpi/q35/TPM2.tis
> rename to tests/data/acpi/q35/TPM2.tis.tpm2
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 93c9d306b5..4ccbe56158 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -1101,7 +1101,8 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>      TPMTestState test;
>      test_data data;
>      GThread *thread;
> -    char *args, *variant = g_strdup_printf(".%s", tpm_if);
> +    const char *suffix = tpm_version == TPM_VERSION_2_0 ? "tpm2" : "tpm12";
> +    char *args, *variant = g_strdup_printf(".%s.%s", tpm_if, suffix);
>  
>      tpm_tis_base_addr = base;
>  



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

* Re: [PATCH 3/7] tests: Add suffix tpm2 or tpm12 to ACPI table files
  2021-07-08 13:59   ` Igor Mammedov
@ 2021-07-08 14:17     ` Stefan Berger
  2021-07-08 15:18       ` Igor Mammedov
  2021-07-08 15:27       ` Michael S. Tsirkin
  0 siblings, 2 replies; 18+ messages in thread
From: Stefan Berger @ 2021-07-08 14:17 UTC (permalink / raw)
  To: Igor Mammedov, Stefan Berger; +Cc: marcandre.lureau, philmd, qemu-devel, mst


On 7/8/21 9:59 AM, Igor Mammedov wrote:
> On Wed, 30 Jun 2021 11:37:19 -0400
> Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:
>
>> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
>> ---
>>   tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} | Bin
>>   tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} | Bin
>>   tests/qtest/bios-tables-test.c                  |   3 ++-
>>   3 files changed, 2 insertions(+), 1 deletion(-)
>>   rename tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} (100%)
>>   rename tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} (100%)
> it fails checkpatch which falsely detects it as adding new files
>
> ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis.tpm2 and tests/qtest/bios-tables-test.c found
>
> ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis.tpm2 and tests/qtest/bios-tables-test.c found
>
> looks like checkpatch needs to be fixed to handle testcase variant renaming.

Is this a show stopper for upstreaming it?



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

* Re: [PATCH 1/7] tests: Rename TestState to TPMTestState
  2021-06-30 15:37 ` [PATCH 1/7] tests: Rename TestState to TPMTestState Stefan Berger
@ 2021-07-08 14:23   ` Igor Mammedov
  0 siblings, 0 replies; 18+ messages in thread
From: Igor Mammedov @ 2021-07-08 14:23 UTC (permalink / raw)
  To: Stefan Berger; +Cc: marcandre.lureau, philmd, qemu-devel, Stefan Berger

On Wed, 30 Jun 2021 11:37:17 -0400
Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:

> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  tests/qtest/bios-tables-test.c    | 2 +-
>  tests/qtest/tpm-crb-test.c        | 4 ++--
>  tests/qtest/tpm-emu.c             | 6 +++---
>  tests/qtest/tpm-emu.h             | 6 +++---
>  tests/qtest/tpm-tis-device-test.c | 2 +-
>  tests/qtest/tpm-tis-test.c        | 2 +-
>  tests/qtest/tpm-tis-util.c        | 2 +-
>  7 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 51d3a4e239..a622f91a37 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -1098,7 +1098,7 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>      gchar *tmp_dir_name = g_strdup_printf("qemu-test_acpi_%s_tcg_%s.XXXXXX",
>                                            machine, tpm_if);
>      char *tmp_path = g_dir_make_tmp(tmp_dir_name, NULL);
> -    TestState test;
> +    TPMTestState test;
>      test_data data;
>      GThread *thread;
>      char *args, *variant = g_strdup_printf(".%s", tpm_if);
> diff --git a/tests/qtest/tpm-crb-test.c b/tests/qtest/tpm-crb-test.c
> index ed533900d1..50936f1482 100644
> --- a/tests/qtest/tpm-crb-test.c
> +++ b/tests/qtest/tpm-crb-test.c
> @@ -26,7 +26,7 @@ uint64_t tpm_tis_base_addr = TPM_TIS_ADDR_BASE;
>  
>  static void tpm_crb_test(const void *data)
>  {
> -    const TestState *s = data;
> +    const TPMTestState *s = data;
>      uint32_t intfid = readl(TPM_CRB_ADDR_BASE + A_CRB_INTF_ID);
>      uint32_t csize = readl(TPM_CRB_ADDR_BASE + A_CRB_CTRL_CMD_SIZE);
>      uint64_t caddr = readq(TPM_CRB_ADDR_BASE + A_CRB_CTRL_CMD_LADDR);
> @@ -145,7 +145,7 @@ int main(int argc, char **argv)
>      int ret;
>      char *args, *tmp_path = g_dir_make_tmp("qemu-tpm-crb-test.XXXXXX", NULL);
>      GThread *thread;
> -    TestState test;
> +    TPMTestState test;
>  
>      module_call_init(MODULE_INIT_QOM);
>      g_test_init(&argc, &argv, NULL);
> diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c
> index 2e8eb7b94f..b9cddcc240 100644
> --- a/tests/qtest/tpm-emu.c
> +++ b/tests/qtest/tpm-emu.c
> @@ -18,7 +18,7 @@
>  #include "qapi/error.h"
>  #include "tpm-emu.h"
>  
> -void tpm_emu_test_wait_cond(TestState *s)
> +void tpm_emu_test_wait_cond(TPMTestState *s)
>  {
>      gint64 end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
>  
> @@ -36,7 +36,7 @@ void tpm_emu_test_wait_cond(TestState *s)
>  
>  static void *tpm_emu_tpm_thread(void *data)
>  {
> -    TestState *s = data;
> +    TPMTestState *s = data;
>      QIOChannel *ioc = s->tpm_ioc;
>  
>      s->tpm_msg = g_new(struct tpm_hdr, 1);
> @@ -71,7 +71,7 @@ static void *tpm_emu_tpm_thread(void *data)
>  
>  void *tpm_emu_ctrl_thread(void *data)
>  {
> -    TestState *s = data;
> +    TPMTestState *s = data;
>      QIOChannelSocket *lioc = qio_channel_socket_new();
>      QIOChannel *ioc;
>  
> diff --git a/tests/qtest/tpm-emu.h b/tests/qtest/tpm-emu.h
> index 73f3bed0c4..b066ad63fb 100644
> --- a/tests/qtest/tpm-emu.h
> +++ b/tests/qtest/tpm-emu.h
> @@ -26,7 +26,7 @@ struct tpm_hdr {
>      char buffer[];
>  } QEMU_PACKED;
>  
> -typedef struct TestState {
> +typedef struct TPMTestState {
>      GMutex data_mutex;
>      GCond data_cond;
>      bool data_cond_signal;
> @@ -34,9 +34,9 @@ typedef struct TestState {
>      QIOChannel *tpm_ioc;
>      GThread *emu_tpm_thread;
>      struct tpm_hdr *tpm_msg;
> -} TestState;
> +} TPMTestState;
>  
> -void tpm_emu_test_wait_cond(TestState *s);
> +void tpm_emu_test_wait_cond(TPMTestState *s);
>  void *tpm_emu_ctrl_thread(void *data);
>  
>  #endif /* TESTS_TPM_EMU_H */
> diff --git a/tests/qtest/tpm-tis-device-test.c b/tests/qtest/tpm-tis-device-test.c
> index 63ed36440f..d36ae20243 100644
> --- a/tests/qtest/tpm-tis-device-test.c
> +++ b/tests/qtest/tpm-tis-device-test.c
> @@ -33,7 +33,7 @@ int main(int argc, char **argv)
>  {
>      char *tmp_path = g_dir_make_tmp("qemu-tpm-tis-device-test.XXXXXX", NULL);
>      GThread *thread;
> -    TestState test;
> +    TPMTestState test;
>      char *args;
>      int ret;
>  
> diff --git a/tests/qtest/tpm-tis-test.c b/tests/qtest/tpm-tis-test.c
> index 79ffbc943e..6fee4779ea 100644
> --- a/tests/qtest/tpm-tis-test.c
> +++ b/tests/qtest/tpm-tis-test.c
> @@ -29,7 +29,7 @@ int main(int argc, char **argv)
>      int ret;
>      char *args, *tmp_path = g_dir_make_tmp("qemu-tpm-tis-test.XXXXXX", NULL);
>      GThread *thread;
> -    TestState test;
> +    TPMTestState test;
>  
>      module_call_init(MODULE_INIT_QOM);
>      g_test_init(&argc, &argv, NULL);
> diff --git a/tests/qtest/tpm-tis-util.c b/tests/qtest/tpm-tis-util.c
> index 9aff503fd8..939893bf01 100644
> --- a/tests/qtest/tpm-tis-util.c
> +++ b/tests/qtest/tpm-tis-util.c
> @@ -373,7 +373,7 @@ void tpm_tis_test_check_access_reg_release(const void *data)
>   */
>  void tpm_tis_test_check_transmit(const void *data)
>  {
> -    const TestState *s = data;
> +    const TPMTestState *s = data;
>      uint8_t access;
>      uint32_t sts;
>      uint16_t bcount;



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

* Re: [PATCH 2/7] tests: Add tpm_version field to TPMTestState and fill it
  2021-06-30 15:37 ` [PATCH 2/7] tests: Add tpm_version field to TPMTestState and fill it Stefan Berger
@ 2021-07-08 14:24   ` Igor Mammedov
  0 siblings, 0 replies; 18+ messages in thread
From: Igor Mammedov @ 2021-07-08 14:24 UTC (permalink / raw)
  To: Stefan Berger; +Cc: marcandre.lureau, philmd, qemu-devel, Stefan Berger

On Wed, 30 Jun 2021 11:37:18 -0400
Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:

> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  tests/qtest/bios-tables-test.c    |  5 +++--
>  tests/qtest/tpm-crb-test.c        |  1 +
>  tests/qtest/tpm-emu.c             | 13 ++++++++++---
>  tests/qtest/tpm-emu.h             |  2 ++
>  tests/qtest/tpm-tis-device-test.c |  1 +
>  tests/qtest/tpm-tis-test.c        |  1 +
>  6 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index a622f91a37..93c9d306b5 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -1092,7 +1092,7 @@ static void test_acpi_piix4_tcg_numamem(void)
>  uint64_t tpm_tis_base_addr;
>  
>  static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
> -                              uint64_t base)
> +                              uint64_t base, enum TPMVersion tpm_version)
>  {
>  #ifdef CONFIG_TPM
>      gchar *tmp_dir_name = g_strdup_printf("qemu-test_acpi_%s_tcg_%s.XXXXXX",
> @@ -1113,6 +1113,7 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>      g_mutex_init(&test.data_mutex);
>      g_cond_init(&test.data_cond);
>      test.data_cond_signal = false;
> +    test.tpm_version = tpm_version;
>  
>      thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test);
>      tpm_emu_test_wait_cond(&test);
> @@ -1145,7 +1146,7 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>  
>  static void test_acpi_q35_tcg_tpm_tis(void)
>  {
> -    test_acpi_tcg_tpm("q35", "tis", 0xFED40000);
> +    test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_2_0);
>  }
>  
>  static void test_acpi_tcg_dimm_pxm(const char *machine)
> diff --git a/tests/qtest/tpm-crb-test.c b/tests/qtest/tpm-crb-test.c
> index 50936f1482..7b94453390 100644
> --- a/tests/qtest/tpm-crb-test.c
> +++ b/tests/qtest/tpm-crb-test.c
> @@ -156,6 +156,7 @@ int main(int argc, char **argv)
>      g_mutex_init(&test.data_mutex);
>      g_cond_init(&test.data_cond);
>      test.data_cond_signal = false;
> +    test.tpm_version = TPM_VERSION_2_0;
>  
>      thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test);
>      tpm_emu_test_wait_cond(&test);
> diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c
> index b9cddcc240..8baf49eafd 100644
> --- a/tests/qtest/tpm-emu.c
> +++ b/tests/qtest/tpm-emu.c
> @@ -56,9 +56,16 @@ static void *tpm_emu_tpm_thread(void *data)
>          s->tpm_msg->code = be32_to_cpu(s->tpm_msg->code);
>  
>          /* reply error */
> -        s->tpm_msg->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS);
> -        s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr));
> -        s->tpm_msg->code = cpu_to_be32(TPM_RC_FAILURE);
> +        switch (s->tpm_version) {
> +        case TPM_VERSION_2_0:
> +            s->tpm_msg->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS);
> +            s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr));
> +            s->tpm_msg->code = cpu_to_be32(TPM_RC_FAILURE);
> +            break;
> +        default:
> +            g_debug("unsupport TPM version %u", s->tpm_version);
> +            g_assert_not_reached();
> +        }
>          qio_channel_write(ioc, (char *)s->tpm_msg, be32_to_cpu(s->tpm_msg->len),
>                            &error_abort);
>      }
> diff --git a/tests/qtest/tpm-emu.h b/tests/qtest/tpm-emu.h
> index b066ad63fb..f7b1e3c6ab 100644
> --- a/tests/qtest/tpm-emu.h
> +++ b/tests/qtest/tpm-emu.h
> @@ -18,6 +18,7 @@
>  
>  #include "qemu/sockets.h"
>  #include "io/channel.h"
> +#include "sysemu/tpm.h"
>  
>  struct tpm_hdr {
>      uint16_t tag;
> @@ -34,6 +35,7 @@ typedef struct TPMTestState {
>      QIOChannel *tpm_ioc;
>      GThread *emu_tpm_thread;
>      struct tpm_hdr *tpm_msg;
> +    enum TPMVersion tpm_version;
>  } TPMTestState;
>  
>  void tpm_emu_test_wait_cond(TPMTestState *s);
> diff --git a/tests/qtest/tpm-tis-device-test.c b/tests/qtest/tpm-tis-device-test.c
> index d36ae20243..3ddefb51ec 100644
> --- a/tests/qtest/tpm-tis-device-test.c
> +++ b/tests/qtest/tpm-tis-device-test.c
> @@ -46,6 +46,7 @@ int main(int argc, char **argv)
>      g_mutex_init(&test.data_mutex);
>      g_cond_init(&test.data_cond);
>      test.data_cond_signal = false;
> +    test.tpm_version = TPM_VERSION_2_0;
>  
>      thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test);
>      tpm_emu_test_wait_cond(&test);
> diff --git a/tests/qtest/tpm-tis-test.c b/tests/qtest/tpm-tis-test.c
> index 6fee4779ea..a4a25ba745 100644
> --- a/tests/qtest/tpm-tis-test.c
> +++ b/tests/qtest/tpm-tis-test.c
> @@ -40,6 +40,7 @@ int main(int argc, char **argv)
>      g_mutex_init(&test.data_mutex);
>      g_cond_init(&test.data_cond);
>      test.data_cond_signal = false;
> +    test.tpm_version = TPM_VERSION_2_0;
>  
>      thread = g_thread_new(NULL, tpm_emu_ctrl_thread, &test);
>      tpm_emu_test_wait_cond(&test);



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

* Re: [PATCH 6/7] tests: acpi: Add test cases for TPM 1.2 with TCPA table
  2021-06-30 15:37 ` [PATCH 6/7] tests: acpi: Add test cases for TPM 1.2 with TCPA table Stefan Berger
@ 2021-07-08 14:24   ` Igor Mammedov
  0 siblings, 0 replies; 18+ messages in thread
From: Igor Mammedov @ 2021-07-08 14:24 UTC (permalink / raw)
  To: Stefan Berger
  Cc: marcandre.lureau, Stefan Berger, philmd, qemu-devel, Michael S . Tsirkin

On Wed, 30 Jun 2021 11:37:22 -0400
Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:

> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  tests/qtest/bios-tables-test.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 4ccbe56158..ddfd2d2b2a 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -1145,11 +1145,16 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>  #endif
>  }
>  
> -static void test_acpi_q35_tcg_tpm_tis(void)
> +static void test_acpi_q35_tcg_tpm2_tis(void)
>  {
>      test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_2_0);
>  }
>  
> +static void test_acpi_q35_tcg_tpm12_tis(void)
> +{
> +    test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_1_2);
> +}
> +
>  static void test_acpi_tcg_dimm_pxm(const char *machine)
>  {
>      test_data data;
> @@ -1518,7 +1523,8 @@ int main(int argc, char *argv[])
>              return ret;
>          }
>          qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
> -        qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
> +        qtest_add_func("acpi/q35/tpm2-tis", test_acpi_q35_tcg_tpm2_tis);
> +        qtest_add_func("acpi/q35/tpm12-tis", test_acpi_q35_tcg_tpm12_tis);
>          qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
>          qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
>          qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);



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

* Re: [PATCH 5/7] tests: acpi: prepare for new TPM 1.2 related tables
  2021-06-30 15:37 ` [PATCH 5/7] tests: acpi: prepare for new TPM 1.2 related tables Stefan Berger
@ 2021-07-08 14:25   ` Igor Mammedov
  0 siblings, 0 replies; 18+ messages in thread
From: Igor Mammedov @ 2021-07-08 14:25 UTC (permalink / raw)
  To: Stefan Berger
  Cc: marcandre.lureau, Stefan Berger, philmd, qemu-devel, Michael S . Tsirkin

On Wed, 30 Jun 2021 11:37:21 -0400
Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:

> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Acked-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  tests/data/acpi/q35/DSDT.tis.tpm12          | 0
>  tests/data/acpi/q35/TCPA.tis.tpm12          | 0
>  tests/qtest/bios-tables-test-allowed-diff.h | 2 ++
>  3 files changed, 2 insertions(+)
>  create mode 100644 tests/data/acpi/q35/DSDT.tis.tpm12
>  create mode 100644 tests/data/acpi/q35/TCPA.tis.tpm12
> 
> diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/q35/DSDT.tis.tpm12
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/tests/data/acpi/q35/TCPA.tis.tpm12 b/tests/data/acpi/q35/TCPA.tis.tpm12
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
> index dfb8523c8b..fb093b32b9 100644
> --- a/tests/qtest/bios-tables-test-allowed-diff.h
> +++ b/tests/qtest/bios-tables-test-allowed-diff.h
> @@ -1 +1,3 @@
>  /* List of comma-separated changed AML files to ignore */
> +"tests/data/acpi/q35/DSDT.tis.tpm12",
> +"tests/data/acpi/q35/TCPA.tis.tpm12",



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

* Re: [PATCH 7/7] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs
  2021-06-30 15:37 ` [PATCH 7/7] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs Stefan Berger
@ 2021-07-08 14:26   ` Igor Mammedov
  0 siblings, 0 replies; 18+ messages in thread
From: Igor Mammedov @ 2021-07-08 14:26 UTC (permalink / raw)
  To: Stefan Berger
  Cc: marcandre.lureau, Stefan Berger, philmd, qemu-devel, Michael S . Tsirkin

On Wed, 30 Jun 2021 11:37:23 -0400
Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:

> The TCPA.tis.tpm12 file contains the following:
> 
> [000h 0000   4]                    Signature : "TCPA"    [Trusted Computing Platform Alliance table]
> [004h 0004   4]                 Table Length : 00000032
> [008h 0008   1]                     Revision : 02
> [009h 0009   1]                     Checksum : 32
> [00Ah 0010   6]                       Oem ID : "BOCHS "
> [010h 0016   8]                 Oem Table ID : "BXPC    "
> [018h 0024   4]                 Oem Revision : 00000001
> [01Ch 0028   4]              Asl Compiler ID : "BXPC"
> [020h 0032   4]        Asl Compiler Revision : 00000001
> 
> [024h 0036   2]               Platform Class : 0000
> [026h 0038   4]         Min Event Log Length : 00010000
> [02Ah 0042   8]            Event Log Address : 0000000007FF0000
> 
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Acked-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  tests/data/acpi/q35/DSDT.tis.tpm12          | Bin 0 -> 8465 bytes
>  tests/data/acpi/q35/TCPA.tis.tpm12          | Bin 0 -> 50 bytes
>  tests/qtest/bios-tables-test-allowed-diff.h |   2 --
>  3 files changed, 2 deletions(-)
> 
> diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/q35/DSDT.tis.tpm12
> index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4178162b0b20b2a4a391daa73264963c28a99a3a 100644
> GIT binary patch
> literal 8465
> zcmb7KOKcm*8J^)oS}vE;lA`5jBGz#qX#<Cn@<NNGA(ziulvX5dH=zrzET@(20$C&x
> zkkkkuD?s8HXpw|<&`SX(V2a+_L+=fG?jZ*Q2~hOVYk^)`6ft@*`~5Q<Wrn1HScm2Q
> zv)?!W|II$W-5HfyrFQxojPY1;!>hG&#UJ}#4u706M*H;Z)?=4gXRlPOc6l-q<DHvH
> zv5!sB%05;qp0D!X>;xYM!E5gXd@E#^KX&h2-U{Ek6<lTn+PxgwHto3Oxo)f2?d*HD  
> z@742Gw^lDXh0kou>Uwf7YIO^xCbPQd>m`<5o9%A2yx8sQ%qv}7?ytvtJLv`6?KJ+j  
> z`sLE8=RdsoTH(`YKmY0N>vjx)75rNGT@7gy+z9NYpznUryUO1rx;VDnU-+OW4$C%|  
> zj)VcVeB{U`>S}p#y|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z1t3l^lnRk5oRnB
> zT396fgFM21Zyfm)tB3dHkx!qy{XHx!j(U@ABpKWx)Ej>kW2p~^@7`xVJvXtg8iQQ9
> zt}50n3y>?Hb=0ms<m6IYQd+Wj$mM2oGn`g0AH4)hYqgu1iE(s}{U^E^D`rP*%%mZD  
> zl8#U%?hn2i#?JoP%0*9_PinK=IFEC=LTD@*>RH^l8>dI9TYL19SYLboQModiY~}NE  
> zWfC&J+sZ#91B^IlaKzSfi4DZgirQJFozDKonX~lW)Akz&>wFGY2`RC$B&v_oUfcIq  
> zumZbz_rCpN=jIs^`hI=g!p6_}ep75VX|Iu6!#39;&MI?W1cz3@DdLTd3m2^HO53lj
> zC;EvG?(ASr2{jRPnZ4pL|L*-AHbO6Rv{tNv*rM8%OpL}8d#jl^o$ze=Shv(_IQ?o?
> zE_46xe}8}W<WqlIADsE6YyEby)lc@Wu|Ya+M}{0OaE%XA%V$?v|FPaRJA&2r>kN-T
> zswLRM;Tu~v=Jf_V3{d`N$Vdv7jeiJmw0{JP;vu!)qDnYJRgIPYBfYEWNHwo=M*9td
> ztm51gX0>mD9~;;afUnu{kj6#;B-oz>&kT^S90z*#&>HboE6TMa1a_%7t!k<kb;%aU  
> z<VwqNbZVKM4n#kLbd)nZg~fjh{Hq;2z3|uF%6q4(7e4>@-JjqYPs14H(f$GkQSk#h
> HnFIEJ<TmVT
> 
> literal 0
> HcmV?d00001
> 
> diff --git a/tests/data/acpi/q35/TCPA.tis.tpm12 b/tests/data/acpi/q35/TCPA.tis.tpm12
> index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a56961b413e7715b3d60f9836d1c8f2f4c7347cb 100644
> GIT binary patch
> literal 50
> qcmWG>4sbMLU|?V}a`Jcf2v%^42yj*a0!E-1hz+7a07U<12eAOxRtEt9  
> 
> literal 0
> HcmV?d00001
> 
> diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
> index fb093b32b9..dfb8523c8b 100644
> --- a/tests/qtest/bios-tables-test-allowed-diff.h
> +++ b/tests/qtest/bios-tables-test-allowed-diff.h
> @@ -1,3 +1 @@
>  /* List of comma-separated changed AML files to ignore */
> -"tests/data/acpi/q35/DSDT.tis.tpm12",
> -"tests/data/acpi/q35/TCPA.tis.tpm12",



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

* Re: [PATCH 3/7] tests: Add suffix tpm2 or tpm12 to ACPI table files
  2021-07-08 14:17     ` Stefan Berger
@ 2021-07-08 15:18       ` Igor Mammedov
  2021-07-08 15:27       ` Michael S. Tsirkin
  1 sibling, 0 replies; 18+ messages in thread
From: Igor Mammedov @ 2021-07-08 15:18 UTC (permalink / raw)
  To: Stefan Berger
  Cc: Peter Maydell, mst, Stefan Berger, qemu-devel, marcandre.lureau, philmd

On Thu, 8 Jul 2021 10:17:51 -0400
Stefan Berger <stefanb@linux.ibm.com> wrote:

> On 7/8/21 9:59 AM, Igor Mammedov wrote:
> > On Wed, 30 Jun 2021 11:37:19 -0400
> > Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:
> >  
> >> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> >> ---
> >>   tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} | Bin
> >>   tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} | Bin
> >>   tests/qtest/bios-tables-test.c                  |   3 ++-
> >>   3 files changed, 2 insertions(+), 1 deletion(-)
> >>   rename tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} (100%)
> >>   rename tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} (100%)  
> > it fails checkpatch which falsely detects it as adding new files
> >
> > ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis.tpm2 and tests/qtest/bios-tables-test.c found
> >
> > ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis.tpm2 and tests/qtest/bios-tables-test.c found
> >
> > looks like checkpatch needs to be fixed to handle testcase variant renaming.  
> 
> Is this a show stopper for upstreaming it?
patch itself looks fine to me but I'm not sure if it's possible CCing Michael/Peter.



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

* Re: [PATCH 4/7] test: tpm: Create TPM 1.2 response in TPM emulator
  2021-06-30 15:37 ` [PATCH 4/7] test: tpm: Create TPM 1.2 response in TPM emulator Stefan Berger
@ 2021-07-08 15:19   ` Igor Mammedov
  0 siblings, 0 replies; 18+ messages in thread
From: Igor Mammedov @ 2021-07-08 15:19 UTC (permalink / raw)
  To: Stefan Berger; +Cc: marcandre.lureau, philmd, qemu-devel, Stefan Berger

On Wed, 30 Jun 2021 11:37:20 -0400
Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:

> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Acked-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  tests/qtest/tpm-emu.c | 5 +++++
>  tests/qtest/tpm-emu.h | 3 +++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c
> index 8baf49eafd..32c704194b 100644
> --- a/tests/qtest/tpm-emu.c
> +++ b/tests/qtest/tpm-emu.c
> @@ -62,6 +62,11 @@ static void *tpm_emu_tpm_thread(void *data)
>              s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr));
>              s->tpm_msg->code = cpu_to_be32(TPM_RC_FAILURE);
>              break;
> +        case TPM_VERSION_1_2:
> +            s->tpm_msg->tag = cpu_to_be16(TPM_TAG_RSP_COMMAND);
> +            s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr));
> +            s->tpm_msg->code = cpu_to_be32(TPM_FAIL);
> +            break;
>          default:
>              g_debug("unsupport TPM version %u", s->tpm_version);
>              g_assert_not_reached();
> diff --git a/tests/qtest/tpm-emu.h b/tests/qtest/tpm-emu.h
> index f7b1e3c6ab..b5354ea101 100644
> --- a/tests/qtest/tpm-emu.h
> +++ b/tests/qtest/tpm-emu.h
> @@ -16,6 +16,9 @@
>  #define TPM_RC_FAILURE 0x101
>  #define TPM2_ST_NO_SESSIONS 0x8001
>  
> +#define TPM_FAIL 9
> +#define TPM_TAG_RSP_COMMAND 0xc4
> +
>  #include "qemu/sockets.h"
>  #include "io/channel.h"
>  #include "sysemu/tpm.h"



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

* Re: [PATCH 3/7] tests: Add suffix tpm2 or tpm12 to ACPI table files
  2021-07-08 14:17     ` Stefan Berger
  2021-07-08 15:18       ` Igor Mammedov
@ 2021-07-08 15:27       ` Michael S. Tsirkin
  1 sibling, 0 replies; 18+ messages in thread
From: Michael S. Tsirkin @ 2021-07-08 15:27 UTC (permalink / raw)
  To: Stefan Berger
  Cc: Igor Mammedov, philmd, qemu-devel, marcandre.lureau, Stefan Berger

On Thu, Jul 08, 2021 at 10:17:51AM -0400, Stefan Berger wrote:
> 
> On 7/8/21 9:59 AM, Igor Mammedov wrote:
> > On Wed, 30 Jun 2021 11:37:19 -0400
> > Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:
> > 
> > > Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> > > ---
> > >   tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} | Bin
> > >   tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} | Bin
> > >   tests/qtest/bios-tables-test.c                  |   3 ++-
> > >   3 files changed, 2 insertions(+), 1 deletion(-)
> > >   rename tests/data/acpi/q35/{DSDT.tis => DSDT.tis.tpm2} (100%)
> > >   rename tests/data/acpi/q35/{TPM2.tis => TPM2.tis.tpm2} (100%)
> > it fails checkpatch which falsely detects it as adding new files
> > 
> > ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis.tpm2 and tests/qtest/bios-tables-test.c found
> > 
> > ERROR: Do not add expected files together with tests, follow instructions in tests/qtest/bios-tables-test.c: both tests/data/acpi/q35/TPM2.tis.tpm2 and tests/qtest/bios-tables-test.c found
> > 
> > looks like checkpatch needs to be fixed to handle testcase variant renaming.
> 
> Is this a show stopper for upstreaming it?

It is. The message is wrong (we can teach checkpatch to say
do not add or rename) but the point is correct: don't touch
binary files and code in the same patch because such binary change
patches can't be cherry-picked rebased etc.

So pls follow the usual rules:
- allow diff
- change code
- change expected binary
- disallow diff

-- 
MST



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

end of thread, other threads:[~2021-07-08 16:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 15:37 [PATCH 0/7] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
2021-06-30 15:37 ` [PATCH 1/7] tests: Rename TestState to TPMTestState Stefan Berger
2021-07-08 14:23   ` Igor Mammedov
2021-06-30 15:37 ` [PATCH 2/7] tests: Add tpm_version field to TPMTestState and fill it Stefan Berger
2021-07-08 14:24   ` Igor Mammedov
2021-06-30 15:37 ` [PATCH 3/7] tests: Add suffix tpm2 or tpm12 to ACPI table files Stefan Berger
2021-07-08 13:59   ` Igor Mammedov
2021-07-08 14:17     ` Stefan Berger
2021-07-08 15:18       ` Igor Mammedov
2021-07-08 15:27       ` Michael S. Tsirkin
2021-06-30 15:37 ` [PATCH 4/7] test: tpm: Create TPM 1.2 response in TPM emulator Stefan Berger
2021-07-08 15:19   ` Igor Mammedov
2021-06-30 15:37 ` [PATCH 5/7] tests: acpi: prepare for new TPM 1.2 related tables Stefan Berger
2021-07-08 14:25   ` Igor Mammedov
2021-06-30 15:37 ` [PATCH 6/7] tests: acpi: Add test cases for TPM 1.2 with TCPA table Stefan Berger
2021-07-08 14:24   ` Igor Mammedov
2021-06-30 15:37 ` [PATCH 7/7] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs Stefan Berger
2021-07-08 14:26   ` Igor Mammedov

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.