All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
@ 2021-07-12 15:09 Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 1/9] tests: Rename TestState to TPMTestState Stefan Berger
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 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

v3:
  - Define enum TPMVersion for when CONFIG_TPM is not defined
    affected patches 2 and 6

v2:
  - Proper handling of renaming of files holding expected ACPI data


Stefan Berger (9):
  tests: Rename TestState to TPMTestState
  tests: Add tpm_version field to TPMTestState and fill it
  tests: acpi: Prepare for renaming of TPM2 related ACPI files
  tests: Add suffix 'tpm2' or 'tpm12' to ACPI table files
  tests: acpi: tpm2: Add the renamed ACPI files and drop old ones
  tests: 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                         |  18 ++++++++++---
 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, 55 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] 22+ messages in thread

* [PATCH v3 1/9] tests: Rename TestState to TPMTestState
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
@ 2021-07-12 15:09 ` Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 2/9] tests: Add tpm_version field to TPMTestState and fill it Stefan Berger
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau
  Cc: Igor Mammedov, Stefan Berger, philmd, Stefan Berger

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;
-- 
2.31.1



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

* [PATCH v3 2/9] tests: Add tpm_version field to TPMTestState and fill it
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 1/9] tests: Rename TestState to TPMTestState Stefan Berger
@ 2021-07-12 15:09 ` Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 3/9] tests: acpi: Prepare for renaming of TPM2 related ACPI files Stefan Berger
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau; +Cc: Stefan Berger, philmd, Stefan Berger

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

---
v3:
 - Added enum TPMVersion for when CONFIG_TPM is not defined
---
 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             |  8 ++++++++
 tests/qtest/tpm-tis-device-test.c |  1 +
 tests/qtest/tpm-tis-test.c        |  1 +
 6 files changed, 24 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..610519883a 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;
@@ -26,6 +27,12 @@ struct tpm_hdr {
     char buffer[];
 } QEMU_PACKED;
 
+#ifndef CONFIG_TPM
+enum TPMVersion {
+    TPM_VERSION_2_0 = 2,
+};
+#endif
+
 typedef struct TPMTestState {
     GMutex data_mutex;
     GCond data_cond;
@@ -34,6 +41,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 related	[flat|nested] 22+ messages in thread

* [PATCH v3 3/9] tests: acpi: Prepare for renaming of TPM2 related ACPI files
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 1/9] tests: Rename TestState to TPMTestState Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 2/9] tests: Add tpm_version field to TPMTestState and fill it Stefan Berger
@ 2021-07-12 15:09 ` Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 4/9] tests: Add suffix 'tpm2' or 'tpm12' to ACPI table files Stefan Berger
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 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>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/data/acpi/q35/DSDT.tis.tpm2           | 0
 tests/data/acpi/q35/TPM2.tis.tpm2           | 0
 tests/qtest/bios-tables-test-allowed-diff.h | 2 ++
 3 files changed, 2 insertions(+)
 create mode 100644 tests/data/acpi/q35/DSDT.tis.tpm2
 create mode 100644 tests/data/acpi/q35/TPM2.tis.tpm2

diff --git a/tests/data/acpi/q35/DSDT.tis.tpm2 b/tests/data/acpi/q35/DSDT.tis.tpm2
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/q35/TPM2.tis.tpm2 b/tests/data/acpi/q35/TPM2.tis.tpm2
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..b301b8fa06 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.tpm2",
+"tests/data/acpi/q35/TPM2.tis.tpm2",
-- 
2.31.1



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

* [PATCH v3 4/9] tests: Add suffix 'tpm2' or 'tpm12' to ACPI table files
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (2 preceding siblings ...)
  2021-07-12 15:09 ` [PATCH v3 3/9] tests: acpi: Prepare for renaming of TPM2 related ACPI files Stefan Berger
@ 2021-07-12 15:09 ` Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 5/9] tests: acpi: tpm2: Add the renamed ACPI files and drop old ones Stefan Berger
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 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>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/qtest/bios-tables-test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 related	[flat|nested] 22+ messages in thread

* [PATCH v3 5/9] tests: acpi: tpm2: Add the renamed ACPI files and drop old ones
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (3 preceding siblings ...)
  2021-07-12 15:09 ` [PATCH v3 4/9] tests: Add suffix 'tpm2' or 'tpm12' to ACPI table files Stefan Berger
@ 2021-07-12 15:09 ` Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 6/9] tests: tpm: Create TPM 1.2 response in TPM emulator Stefan Berger
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 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>
Acked-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/data/acpi/q35/DSDT.tis                | Bin 8465 -> 0 bytes
 tests/data/acpi/q35/DSDT.tis.tpm2           | Bin 0 -> 8465 bytes
 tests/data/acpi/q35/TPM2.tis                | Bin 76 -> 0 bytes
 tests/data/acpi/q35/TPM2.tis.tpm2           | Bin 0 -> 76 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   2 --
 5 files changed, 2 deletions(-)
 delete mode 100644 tests/data/acpi/q35/DSDT.tis
 delete mode 100644 tests/data/acpi/q35/TPM2.tis

diff --git a/tests/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79lp06D1dO_3f
z*YaYS`}hC*`!gq>{PX(Y%&#5ucZ)$k-Mh*L*`yU48gPND#vrr&=ql?!(z|NKu-bl&
z;Sor+gj+a#eaphU-oS`Ll)o84UaN^^;~xVY?;pXUctq_tsS<;ss^&`nq23jAB%4<a
zM*B^Itm51gX0>mEpBPv%fUjD~h{lEk1lXSh&kT^Sk_3A8&>Hbo%geQ51a_!6rE01c
zb%_?pG^Cc}=+x9Z9q@hz*|@>*6z2ae@UM3G)WTnPtM8two&VzBcYcOvJPl*qi1!yT
Mh>{=D$sDl%17maSY5)KL

literal 0
HcmV?d00001

diff --git a/tests/data/acpi/q35/TPM2.tis b/tests/data/acpi/q35/TPM2.tis
deleted file mode 100644
index fe0f05987be40f1c1742ae189df7821adc522fc0..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 76
wcmWFu@HO&bU|?Vob@F%i2v%^42yj*a0!E-1hz+8V0UI(0%m%6W&kkY&0CHRh0RR91

diff --git a/tests/data/acpi/q35/TPM2.tis.tpm2 b/tests/data/acpi/q35/TPM2.tis.tpm2
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..fe0f05987be40f1c1742ae189df7821adc522fc0 100644
GIT binary patch
literal 76
wcmWFu@HO&bU|?Vob@F%i2v%^42yj*a0!E-1hz+8V0UI(0%m%6W&kkY&0CHRh0RR91

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 b301b8fa06..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.tpm2",
-"tests/data/acpi/q35/TPM2.tis.tpm2",
-- 
2.31.1



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

* [PATCH v3 6/9] tests: tpm: Create TPM 1.2 response in TPM emulator
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (4 preceding siblings ...)
  2021-07-12 15:09 ` [PATCH v3 5/9] tests: acpi: tpm2: Add the renamed ACPI files and drop old ones Stefan Berger
@ 2021-07-12 15:09 ` Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 7/9] tests: acpi: prepare for new TPM 1.2 related tables Stefan Berger
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 UTC (permalink / raw)
  To: qemu-devel, marcandre.lureau; +Cc: Stefan Berger, philmd, Stefan Berger

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

---
v3:
  - Added TPM_VERSION_1_2 enum for when CONFIG_TPM is not defined
---
 tests/qtest/tpm-emu.c | 5 +++++
 tests/qtest/tpm-emu.h | 4 ++++
 2 files changed, 9 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 610519883a..fcb5d7a1d6 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"
@@ -29,6 +32,7 @@ struct tpm_hdr {
 
 #ifndef CONFIG_TPM
 enum TPMVersion {
+    TPM_VERSION_1_2 = 1,
     TPM_VERSION_2_0 = 2,
 };
 #endif
-- 
2.31.1



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

* [PATCH v3 7/9] tests: acpi: prepare for new TPM 1.2 related tables
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (5 preceding siblings ...)
  2021-07-12 15:09 ` [PATCH v3 6/9] tests: tpm: Create TPM 1.2 response in TPM emulator Stefan Berger
@ 2021-07-12 15:09 ` Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 8/9] tests: acpi: Add test cases for TPM 1.2 with TCPA table Stefan Berger
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 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>
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",
-- 
2.31.1



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

* [PATCH v3 8/9] tests: acpi: Add test cases for TPM 1.2 with TCPA table
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (6 preceding siblings ...)
  2021-07-12 15:09 ` [PATCH v3 7/9] tests: acpi: prepare for new TPM 1.2 related tables Stefan Berger
@ 2021-07-12 15:09 ` Stefan Berger
  2021-07-12 15:09 ` [PATCH v3 9/9] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs Stefan Berger
  2021-07-12 15:29 ` [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Philippe Mathieu-Daudé
  9 siblings, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 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>
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);
-- 
2.31.1



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

* [PATCH v3 9/9] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (7 preceding siblings ...)
  2021-07-12 15:09 ` [PATCH v3 8/9] tests: acpi: Add test cases for TPM 1.2 with TCPA table Stefan Berger
@ 2021-07-12 15:09 ` Stefan Berger
  2021-07-12 15:29 ` [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Philippe Mathieu-Daudé
  9 siblings, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:09 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>
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%q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C`QkTzJ?y64<;xP^9(2Mhkb#Nm6+L7c)u5M%!lOM&7zz1t3l^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",
-- 
2.31.1



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
                   ` (8 preceding siblings ...)
  2021-07-12 15:09 ` [PATCH v3 9/9] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs Stefan Berger
@ 2021-07-12 15:29 ` Philippe Mathieu-Daudé
  2021-07-12 15:47   ` Stefan Berger
  9 siblings, 1 reply; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-12 15:29 UTC (permalink / raw)
  To: Stefan Berger, qemu-devel, marcandre.lureau; +Cc: Paolo Bonzini, Thomas Huth

Hi Stefan,

On 7/12/21 5:09 PM, Stefan Berger wrote:
> This series of patches adds test case for TPM 1.2 ACPI tables.
> 
>   Stefan
> 
> v3:
>   - Define enum TPMVersion for when CONFIG_TPM is not defined
>     affected patches 2 and 6

I think in 11fb99e6f48..e542b71805d we missed an extra patch
for qtests. Probably (untested):

-- >8 --
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index ee7347b7275..eeaa0d7302b 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -60,10 +60,14 @@
   (config_all_devices.has_key('CONFIG_USB_UHCI') and
                     \
    config_all_devices.has_key('CONFIG_USB_EHCI') ?
['usb-hcd-ehci-test'] : []) +            \
   (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ?
['usb-hcd-xhci-test'] : []) +        \
-  (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] :
[]) +                  \
-  (config_all_devices.has_key('CONFIG_TPM_CRB') ?
['tpm-crb-swtpm-test'] : []) +            \
-  (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test']
: []) +              \
-  (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ?
['tpm-tis-swtpm-test'] : []) +        \
+  (config_host.has_key('CONFIG_TPM') and \
+   config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] :
[]) +                  \
+  (config_host.has_key('CONFIG_TPM') and \
+   config_all_devices.has_key('CONFIG_TPM_CRB') ?
['tpm-crb-swtpm-test'] : []) +            \
+  (config_host.has_key('CONFIG_TPM') and \
+   config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test']
: []) +              \
+  (config_host.has_key('CONFIG_TPM') and \
+   config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ?
['tpm-tis-swtpm-test'] : []) +        \
   (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['rtl8139-test']
: []) +              \
   (config_all_devices.has_key('CONFIG_E1000E_PCI_EXPRESS') ?
['fuzz-e1000e-test'] : []) +   \
   (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] :
[]) +                 \
---

Cc'ing Paolo/Thomas because there surely exists a clever way to do it...



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-12 15:29 ` [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Philippe Mathieu-Daudé
@ 2021-07-12 15:47   ` Stefan Berger
  2021-07-12 16:26     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 15:47 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Stefan Berger, qemu-devel, marcandre.lureau
  Cc: Paolo Bonzini, Thomas Huth


On 7/12/21 11:29 AM, Philippe Mathieu-Daudé wrote:
> Hi Stefan,
>
> On 7/12/21 5:09 PM, Stefan Berger wrote:
>> This series of patches adds test case for TPM 1.2 ACPI tables.
>>
>>    Stefan
>>
>> v3:
>>    - Define enum TPMVersion for when CONFIG_TPM is not defined
>>      affected patches 2 and 6
> I think in 11fb99e6f48..e542b71805d we missed an extra patch
> for qtests. Probably (untested):

Shouldn't we have seen test compilation errors already?

I didn't go down this route for the build system (as you show below) 
because in this series we are testing ACPI tables and I introduce the 
reference to enum TPMVersion here, which wasn't needed before. The 
alternative may be to go into 8/9 and eliminate all TPM code if 
CONFIG_TPM is not set. The introduction of the enum now passes the tests 
with --enable-tpm and --disable-tpm.

Otherwise the BIOS test are skipped due to this here:


static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
                               uint64_t base, enum TPMVersion tpm_version)
{
#ifdef CONFIG_TPM
[...]

#else
     g_test_skip("TPM disabled");
#endif
}

So I didn't want to clutter this code with more #ifdef CONFIG_TPM but 
maybe that would be the right solution.

     Stefan

>
> -- >8 --
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index ee7347b7275..eeaa0d7302b 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -60,10 +60,14 @@
>     (config_all_devices.has_key('CONFIG_USB_UHCI') and
>                       \
>      config_all_devices.has_key('CONFIG_USB_EHCI') ?
> ['usb-hcd-ehci-test'] : []) +            \
>     (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ?
> ['usb-hcd-xhci-test'] : []) +        \
> -  (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] :
> []) +                  \
> -  (config_all_devices.has_key('CONFIG_TPM_CRB') ?
> ['tpm-crb-swtpm-test'] : []) +            \
> -  (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test']
> : []) +              \
> -  (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ?
> ['tpm-tis-swtpm-test'] : []) +        \
> +  (config_host.has_key('CONFIG_TPM') and \
> +   config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] :
> []) +                  \
> +  (config_host.has_key('CONFIG_TPM') and \
> +   config_all_devices.has_key('CONFIG_TPM_CRB') ?
> ['tpm-crb-swtpm-test'] : []) +            \
> +  (config_host.has_key('CONFIG_TPM') and \
> +   config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test']
> : []) +              \
> +  (config_host.has_key('CONFIG_TPM') and \
> +   config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ?
> ['tpm-tis-swtpm-test'] : []) +        \
>     (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['rtl8139-test']
> : []) +              \
>     (config_all_devices.has_key('CONFIG_E1000E_PCI_EXPRESS') ?
> ['fuzz-e1000e-test'] : []) +   \
>     (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] :
> []) +                 \
> ---
>
> Cc'ing Paolo/Thomas because there surely exists a clever way to do it...
>


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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-12 15:47   ` Stefan Berger
@ 2021-07-12 16:26     ` Philippe Mathieu-Daudé
  2021-07-12 18:10       ` Stefan Berger
  2021-07-14 14:43       ` Markus Armbruster
  0 siblings, 2 replies; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-12 16:26 UTC (permalink / raw)
  To: Stefan Berger, Stefan Berger, qemu-devel, marcandre.lureau
  Cc: Paolo Bonzini, Thomas Huth, Markus Armbruster

+Markus

On 7/12/21 5:47 PM, Stefan Berger wrote:
> 
> On 7/12/21 11:29 AM, Philippe Mathieu-Daudé wrote:
>> Hi Stefan,
>>
>> On 7/12/21 5:09 PM, Stefan Berger wrote:
>>> This series of patches adds test case for TPM 1.2 ACPI tables.
>>>
>>>    Stefan
>>>
>>> v3:
>>>    - Define enum TPMVersion for when CONFIG_TPM is not defined
>>>      affected patches 2 and 6
>> I think in 11fb99e6f48..e542b71805d we missed an extra patch
>> for qtests. Probably (untested):
> 
> Shouldn't we have seen test compilation errors already?
> 
> I didn't go down this route for the build system (as you show below)
> because in this series we are testing ACPI tables and I introduce the
> reference to enum TPMVersion here, which wasn't needed before. The
> alternative may be to go into 8/9 and eliminate all TPM code if
> CONFIG_TPM is not set. The introduction of the enum now passes the tests
> with --enable-tpm and --disable-tpm.
> 
> Otherwise the BIOS test are skipped due to this here:
> 
> 
> static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>                               uint64_t base, enum TPMVersion tpm_version)
> {
> #ifdef CONFIG_TPM
> [...]
> 
> #else
>     g_test_skip("TPM disabled");
> #endif
> }
> 
> So I didn't want to clutter this code with more #ifdef CONFIG_TPM but
> maybe that would be the right solution.

IMO the "right" solution is to check via QMP if TMP is supported
or not. This is now doable since commit caff255a546 ("tpm: Return
QMP error when TPM is disabled in build").

Long term we'd like to decouple the tests/ build from the various
QEMU configurations, and build the tests once.

>> -- >8 --
>> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
>> index ee7347b7275..eeaa0d7302b 100644
>> --- a/tests/qtest/meson.build
>> +++ b/tests/qtest/meson.build
>> @@ -60,10 +60,14 @@
>>     (config_all_devices.has_key('CONFIG_USB_UHCI') and
>>                       \
>>      config_all_devices.has_key('CONFIG_USB_EHCI') ?
>> ['usb-hcd-ehci-test'] : []) +            \
>>     (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ?
>> ['usb-hcd-xhci-test'] : []) +        \
>> -  (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] :
>> []) +                  \
>> -  (config_all_devices.has_key('CONFIG_TPM_CRB') ?
>> ['tpm-crb-swtpm-test'] : []) +            \
>> -  (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test']
>> : []) +              \
>> -  (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ?
>> ['tpm-tis-swtpm-test'] : []) +        \
>> +  (config_host.has_key('CONFIG_TPM') and \
>> +   config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] :
>> []) +                  \
>> +  (config_host.has_key('CONFIG_TPM') and \
>> +   config_all_devices.has_key('CONFIG_TPM_CRB') ?
>> ['tpm-crb-swtpm-test'] : []) +            \
>> +  (config_host.has_key('CONFIG_TPM') and \
>> +   config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test']
>> : []) +              \
>> +  (config_host.has_key('CONFIG_TPM') and \
>> +   config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ?
>> ['tpm-tis-swtpm-test'] : []) +        \
>>     (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['rtl8139-test']
>> : []) +              \
>>     (config_all_devices.has_key('CONFIG_E1000E_PCI_EXPRESS') ?
>> ['fuzz-e1000e-test'] : []) +   \
>>     (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] :
>> []) +                 \
>> ---
>>
>> Cc'ing Paolo/Thomas because there surely exists a clever way to do it...
>>
> 



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-12 16:26     ` Philippe Mathieu-Daudé
@ 2021-07-12 18:10       ` Stefan Berger
  2021-07-14 14:43       ` Markus Armbruster
  1 sibling, 0 replies; 22+ messages in thread
From: Stefan Berger @ 2021-07-12 18:10 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Stefan Berger, qemu-devel, marcandre.lureau
  Cc: Paolo Bonzini, Thomas Huth, Markus Armbruster


On 7/12/21 12:26 PM, Philippe Mathieu-Daudé wrote:
> +Markus
>
> On 7/12/21 5:47 PM, Stefan Berger wrote:
>> On 7/12/21 11:29 AM, Philippe Mathieu-Daudé wrote:
>>> Hi Stefan,
>>>
>>> On 7/12/21 5:09 PM, Stefan Berger wrote:
>>>> This series of patches adds test case for TPM 1.2 ACPI tables.
>>>>
>>>>     Stefan
>>>>
>>>> v3:
>>>>     - Define enum TPMVersion for when CONFIG_TPM is not defined
>>>>       affected patches 2 and 6
>>> I think in 11fb99e6f48..e542b71805d we missed an extra patch
>>> for qtests. Probably (untested):
>> Shouldn't we have seen test compilation errors already?
>>
>> I didn't go down this route for the build system (as you show below)
>> because in this series we are testing ACPI tables and I introduce the
>> reference to enum TPMVersion here, which wasn't needed before. The
>> alternative may be to go into 8/9 and eliminate all TPM code if
>> CONFIG_TPM is not set. The introduction of the enum now passes the tests
>> with --enable-tpm and --disable-tpm.
>>
>> Otherwise the BIOS test are skipped due to this here:
>>
>>
>> static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>>                                uint64_t base, enum TPMVersion tpm_version)
>> {
>> #ifdef CONFIG_TPM
>> [...]
>>
>> #else
>>      g_test_skip("TPM disabled");
>> #endif
>> }
>>
>> So I didn't want to clutter this code with more #ifdef CONFIG_TPM but
>> maybe that would be the right solution.
> IMO the "right" solution is to check via QMP if TMP is supported
> or not. This is now doable since commit caff255a546 ("tpm: Return
> QMP error when TPM is disabled in build").

That above g_test_skip() could be moved to the top of the function and 
be preceded by a QMP check for whether TPM is supported.




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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-12 16:26     ` Philippe Mathieu-Daudé
  2021-07-12 18:10       ` Stefan Berger
@ 2021-07-14 14:43       ` Markus Armbruster
  2021-07-14 20:16         ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 22+ messages in thread
From: Markus Armbruster @ 2021-07-14 14:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Thomas Huth, Stefan Berger, qemu-devel, Paolo Bonzini,
	marcandre.lureau, Stefan Berger

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> +Markus
>
> On 7/12/21 5:47 PM, Stefan Berger wrote:
>> 
>> On 7/12/21 11:29 AM, Philippe Mathieu-Daudé wrote:
>>> Hi Stefan,
>>>
>>> On 7/12/21 5:09 PM, Stefan Berger wrote:
>>>> This series of patches adds test case for TPM 1.2 ACPI tables.
>>>>
>>>>    Stefan
>>>>
>>>> v3:
>>>>    - Define enum TPMVersion for when CONFIG_TPM is not defined
>>>>      affected patches 2 and 6
>>> I think in 11fb99e6f48..e542b71805d we missed an extra patch
>>> for qtests. Probably (untested):
>> 
>> Shouldn't we have seen test compilation errors already?
>> 
>> I didn't go down this route for the build system (as you show below)
>> because in this series we are testing ACPI tables and I introduce the
>> reference to enum TPMVersion here, which wasn't needed before. The
>> alternative may be to go into 8/9 and eliminate all TPM code if
>> CONFIG_TPM is not set. The introduction of the enum now passes the tests
>> with --enable-tpm and --disable-tpm.
>> 
>> Otherwise the BIOS test are skipped due to this here:
>> 
>> 
>> static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>>                               uint64_t base, enum TPMVersion tpm_version)
>> {
>> #ifdef CONFIG_TPM
>> [...]
>> 
>> #else
>>     g_test_skip("TPM disabled");
>> #endif
>> }
>> 
>> So I didn't want to clutter this code with more #ifdef CONFIG_TPM but
>> maybe that would be the right solution.
>
> IMO the "right" solution is to check via QMP if TMP is supported
> or not. This is now doable since commit caff255a546 ("tpm: Return
> QMP error when TPM is disabled in build").
>
> Long term we'd like to decouple the tests/ build from the various
> QEMU configurations, and build the tests once.

This argument applies only to macros from target-specific headers like
$TARGET-config-target.h, not to macros from config-host.h.  #ifdef
CONFIG_TPM should be fine, shouldn't it?



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-14 14:43       ` Markus Armbruster
@ 2021-07-14 20:16         ` Philippe Mathieu-Daudé
  2021-07-15  5:49           ` Markus Armbruster
  0 siblings, 1 reply; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-14 20:16 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Thomas Huth, Stefan Berger, qemu-devel, Paolo Bonzini,
	marcandre.lureau, Stefan Berger

On 7/14/21 4:43 PM, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> 
>> +Markus
>>
>> On 7/12/21 5:47 PM, Stefan Berger wrote:
>>>
>>> On 7/12/21 11:29 AM, Philippe Mathieu-Daudé wrote:
>>>> Hi Stefan,
>>>>
>>>> On 7/12/21 5:09 PM, Stefan Berger wrote:
>>>>> This series of patches adds test case for TPM 1.2 ACPI tables.
>>>>>
>>>>>    Stefan
>>>>>
>>>>> v3:
>>>>>    - Define enum TPMVersion for when CONFIG_TPM is not defined
>>>>>      affected patches 2 and 6
>>>> I think in 11fb99e6f48..e542b71805d we missed an extra patch
>>>> for qtests. Probably (untested):
>>>
>>> Shouldn't we have seen test compilation errors already?
>>>
>>> I didn't go down this route for the build system (as you show below)
>>> because in this series we are testing ACPI tables and I introduce the
>>> reference to enum TPMVersion here, which wasn't needed before. The
>>> alternative may be to go into 8/9 and eliminate all TPM code if
>>> CONFIG_TPM is not set. The introduction of the enum now passes the tests
>>> with --enable-tpm and --disable-tpm.
>>>
>>> Otherwise the BIOS test are skipped due to this here:
>>>
>>>
>>> static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>>>                               uint64_t base, enum TPMVersion tpm_version)
>>> {
>>> #ifdef CONFIG_TPM
>>> [...]
>>>
>>> #else
>>>     g_test_skip("TPM disabled");
>>> #endif
>>> }
>>>
>>> So I didn't want to clutter this code with more #ifdef CONFIG_TPM but
>>> maybe that would be the right solution.
>>
>> IMO the "right" solution is to check via QMP if TMP is supported
>> or not. This is now doable since commit caff255a546 ("tpm: Return
>> QMP error when TPM is disabled in build").
>>
>> Long term we'd like to decouple the tests/ build from the various
>> QEMU configurations, and build the tests once.
> 
> This argument applies only to macros from target-specific headers like
> $TARGET-config-target.h, not to macros from config-host.h.  #ifdef
> CONFIG_TPM should be fine, shouldn't it?

Some definitions depend on the host (OS, libraries installed, ...),
others depend on the --enable/--disable ./configure options.

IMO it would be nice if we could get qtests independent of the latter.

I suppose config-host.h holds both kinds.



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-14 20:16         ` Philippe Mathieu-Daudé
@ 2021-07-15  5:49           ` Markus Armbruster
  2021-07-19 13:38             ` Igor Mammedov
  0 siblings, 1 reply; 22+ messages in thread
From: Markus Armbruster @ 2021-07-15  5:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Thomas Huth, Stefan Berger, qemu-devel, Paolo Bonzini,
	marcandre.lureau, Stefan Berger

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> On 7/14/21 4:43 PM, Markus Armbruster wrote:
>> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
>> 
>>> +Markus

[...]

>>> IMO the "right" solution is to check via QMP if TMP is supported
>>> or not. This is now doable since commit caff255a546 ("tpm: Return
>>> QMP error when TPM is disabled in build").
>>>
>>> Long term we'd like to decouple the tests/ build from the various
>>> QEMU configurations, and build the tests once.
>> 
>> This argument applies only to macros from target-specific headers like
>> $TARGET-config-target.h, not to macros from config-host.h.  #ifdef
>> CONFIG_TPM should be fine, shouldn't it?
>
> Some definitions depend on the host (OS, libraries installed, ...),
> others depend on the --enable/--disable ./configure options.
>
> IMO it would be nice if we could get qtests independent of the latter.

Why?

> I suppose config-host.h holds both kinds.

Yes.



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-15  5:49           ` Markus Armbruster
@ 2021-07-19 13:38             ` Igor Mammedov
  2021-07-19 13:50               ` Markus Armbruster
  0 siblings, 1 reply; 22+ messages in thread
From: Igor Mammedov @ 2021-07-19 13:38 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Thomas Huth, Stefan Berger, qemu-devel, marcandre.lureau,
	Paolo Bonzini, Philippe Mathieu-Daudé,
	Stefan Berger

On Thu, 15 Jul 2021 07:49:13 +0200
Markus Armbruster <armbru@redhat.com> wrote:

> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> 
> > On 7/14/21 4:43 PM, Markus Armbruster wrote:  
> >> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> >>   
> >>> +Markus  
> 
> [...]
> 
> >>> IMO the "right" solution is to check via QMP if TMP is supported
> >>> or not. This is now doable since commit caff255a546 ("tpm: Return
> >>> QMP error when TPM is disabled in build").
> >>>
> >>> Long term we'd like to decouple the tests/ build from the various
> >>> QEMU configurations, and build the tests once.  
> >> 
> >> This argument applies only to macros from target-specific headers like
> >> $TARGET-config-target.h, not to macros from config-host.h.  #ifdef
> >> CONFIG_TPM should be fine, shouldn't it?  
> >
> > Some definitions depend on the host (OS, libraries installed, ...),
> > others depend on the --enable/--disable ./configure options.
> >
> > IMO it would be nice if we could get qtests independent of the latter.  
> 
> Why?

In another mail-thread Philippe mentioned that there is desire
to use qtest out of tree to test other QEMU binaries.

However, just probing for features at runtime aren't going
to help with the goal as tests are tailored for the latest
CLI/QMP/ABI. To make it work we would have practically
introduce versioned tests.

So I wonder why one external acceptance-tests suite is not
sufficient, that we would want to hijack relatively simple
internal qtest at expense of increased resources needed to
run/write unit tests.

> > I suppose config-host.h holds both kinds.  
> 
> Yes.
> 
> 



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-19 13:38             ` Igor Mammedov
@ 2021-07-19 13:50               ` Markus Armbruster
  2021-07-19 13:56                 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 22+ messages in thread
From: Markus Armbruster @ 2021-07-19 13:50 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: Thomas Huth, Stefan Berger, qemu-devel, marcandre.lureau,
	Paolo Bonzini, Philippe Mathieu-Daudé,
	Stefan Berger

Igor Mammedov <imammedo@redhat.com> writes:

> On Thu, 15 Jul 2021 07:49:13 +0200
> Markus Armbruster <armbru@redhat.com> wrote:
>
>> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
>> 
>> > On 7/14/21 4:43 PM, Markus Armbruster wrote:  
>> >> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
>> >>   
>> >>> +Markus  
>> 
>> [...]
>> 
>> >>> IMO the "right" solution is to check via QMP if TMP is supported
>> >>> or not. This is now doable since commit caff255a546 ("tpm: Return
>> >>> QMP error when TPM is disabled in build").
>> >>>
>> >>> Long term we'd like to decouple the tests/ build from the various
>> >>> QEMU configurations, and build the tests once.  
>> >> 
>> >> This argument applies only to macros from target-specific headers like
>> >> $TARGET-config-target.h, not to macros from config-host.h.  #ifdef
>> >> CONFIG_TPM should be fine, shouldn't it?  
>> >
>> > Some definitions depend on the host (OS, libraries installed, ...),
>> > others depend on the --enable/--disable ./configure options.
>> >
>> > IMO it would be nice if we could get qtests independent of the latter.  
>> 
>> Why?
>
> In another mail-thread Philippe mentioned that there is desire
> to use qtest out of tree to test other QEMU binaries.
>
> However, just probing for features at runtime aren't going
> to help with the goal as tests are tailored for the latest
> CLI/QMP/ABI. To make it work we would have practically
> introduce versioned tests.
>
> So I wonder why one external acceptance-tests suite is not
> sufficient, that we would want to hijack relatively simple
> internal qtest at expense of increased resources needed to
> run/write unit tests.

Yes.  qtest was not designed for use with anything but HEAD, and I doubt
we can make it fit such uses at reasonable expense.

>
>> > I suppose config-host.h holds both kinds.  
>> 
>> Yes.
>> 
>> 



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-19 13:50               ` Markus Armbruster
@ 2021-07-19 13:56                 ` Philippe Mathieu-Daudé
  2021-07-19 14:44                   ` Igor Mammedov
  0 siblings, 1 reply; 22+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-19 13:56 UTC (permalink / raw)
  To: Markus Armbruster, Thomas Huth
  Cc: Stefan Berger, QEMU Developers, Marc-André Lureau,
	Paolo Bonzini, Igor Mammedov, Stefan Berger

On Mon, Jul 19, 2021 at 3:50 PM Markus Armbruster <armbru@redhat.com> wrote:
> Igor Mammedov <imammedo@redhat.com> writes:
> > On Thu, 15 Jul 2021 07:49:13 +0200
> > Markus Armbruster <armbru@redhat.com> wrote:
> >> Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> >> >>> IMO the "right" solution is to check via QMP if TMP is supported
> >> >>> or not. This is now doable since commit caff255a546 ("tpm: Return
> >> >>> QMP error when TPM is disabled in build").
> >> >>>
> >> >>> Long term we'd like to decouple the tests/ build from the various
> >> >>> QEMU configurations, and build the tests once.
> >> >>
> >> >> This argument applies only to macros from target-specific headers like
> >> >> $TARGET-config-target.h, not to macros from config-host.h.  #ifdef
> >> >> CONFIG_TPM should be fine, shouldn't it?
> >> >
> >> > Some definitions depend on the host (OS, libraries installed, ...),
> >> > others depend on the --enable/--disable ./configure options.
> >> >
> >> > IMO it would be nice if we could get qtests independent of the latter.
> >>
> >> Why?
> >
> > In another mail-thread Philippe mentioned that there is desire
> > to use qtest out of tree to test other QEMU binaries.
> >
> > However, just probing for features at runtime aren't going
> > to help with the goal as tests are tailored for the latest
> > CLI/QMP/ABI. To make it work we would have practically
> > introduce versioned tests.
> >
> > So I wonder why one external acceptance-tests suite is not
> > sufficient, that we would want to hijack relatively simple
> > internal qtest at expense of increased resources needed to
> > run/write unit tests.
>
> Yes.  qtest was not designed for use with anything but HEAD, and I doubt
> we can make it fit such uses at reasonable expense.

One HEAD but multiple configurations...

If you want to simplify human time, can we simply run qtests once per
arch/OS but with all features enabled? Otherwise skip qtests?



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-19 13:56                 ` Philippe Mathieu-Daudé
@ 2021-07-19 14:44                   ` Igor Mammedov
  2021-07-19 15:13                     ` Markus Armbruster
  0 siblings, 1 reply; 22+ messages in thread
From: Igor Mammedov @ 2021-07-19 14:44 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Thomas Huth, Stefan Berger, QEMU Developers, Markus Armbruster,
	Marc-André Lureau, Paolo Bonzini, Stefan Berger

On Mon, 19 Jul 2021 15:56:16 +0200
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> On Mon, Jul 19, 2021 at 3:50 PM Markus Armbruster <armbru@redhat.com> wrote:
> > Igor Mammedov <imammedo@redhat.com> writes:  
> > > On Thu, 15 Jul 2021 07:49:13 +0200
> > > Markus Armbruster <armbru@redhat.com> wrote:  
> > >> Philippe Mathieu-Daudé <philmd@redhat.com> writes:  
> 
> > >> >>> IMO the "right" solution is to check via QMP if TMP is supported
> > >> >>> or not. This is now doable since commit caff255a546 ("tpm: Return
> > >> >>> QMP error when TPM is disabled in build").
> > >> >>>
> > >> >>> Long term we'd like to decouple the tests/ build from the various
> > >> >>> QEMU configurations, and build the tests once.  
> > >> >>
> > >> >> This argument applies only to macros from target-specific headers like
> > >> >> $TARGET-config-target.h, not to macros from config-host.h.  #ifdef
> > >> >> CONFIG_TPM should be fine, shouldn't it?  
> > >> >
> > >> > Some definitions depend on the host (OS, libraries installed, ...),
> > >> > others depend on the --enable/--disable ./configure options.
> > >> >
> > >> > IMO it would be nice if we could get qtests independent of the latter.  
> > >>
> > >> Why?  
> > >
> > > In another mail-thread Philippe mentioned that there is desire
> > > to use qtest out of tree to test other QEMU binaries.
> > >
> > > However, just probing for features at runtime aren't going
> > > to help with the goal as tests are tailored for the latest
> > > CLI/QMP/ABI. To make it work we would have practically
> > > introduce versioned tests.
> > >
> > > So I wonder why one external acceptance-tests suite is not
> > > sufficient, that we would want to hijack relatively simple
> > > internal qtest at expense of increased resources needed to
> > > run/write unit tests.  
> >
> > Yes.  qtest was not designed for use with anything but HEAD, and I doubt
> > we can make it fit such uses at reasonable expense.  
> 
> One HEAD but multiple configurations...

Even assuming reconfigure won't cause world rebuild,
It will be a win only if number of configuration probes
is small.
However it doesn't scale for large numbers and it might be
faster to rebuild affected tests in the end. (worst case: #probes * #targets)
I wonder if we can do probing once & cache it somewhere to avoid ^^^.


> If you want to simplify human time, can we simply run qtests once per
> arch/OS but with all features enabled? Otherwise skip qtests?
> 



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

* Re: [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables
  2021-07-19 14:44                   ` Igor Mammedov
@ 2021-07-19 15:13                     ` Markus Armbruster
  0 siblings, 0 replies; 22+ messages in thread
From: Markus Armbruster @ 2021-07-19 15:13 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: Thomas Huth, Stefan Berger, QEMU Developers,
	Marc-André Lureau, Paolo Bonzini,
	Philippe Mathieu-Daudé,
	Stefan Berger

Igor Mammedov <imammedo@redhat.com> writes:

> On Mon, 19 Jul 2021 15:56:16 +0200
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
>> On Mon, Jul 19, 2021 at 3:50 PM Markus Armbruster <armbru@redhat.com> wrote:
>> > Igor Mammedov <imammedo@redhat.com> writes:  
>> > > On Thu, 15 Jul 2021 07:49:13 +0200
>> > > Markus Armbruster <armbru@redhat.com> wrote:  
>> > >> Philippe Mathieu-Daudé <philmd@redhat.com> writes:  
>> 
>> > >> >>> IMO the "right" solution is to check via QMP if TMP is supported
>> > >> >>> or not. This is now doable since commit caff255a546 ("tpm: Return
>> > >> >>> QMP error when TPM is disabled in build").
>> > >> >>>
>> > >> >>> Long term we'd like to decouple the tests/ build from the various
>> > >> >>> QEMU configurations, and build the tests once.  
>> > >> >>
>> > >> >> This argument applies only to macros from target-specific headers like
>> > >> >> $TARGET-config-target.h, not to macros from config-host.h.  #ifdef
>> > >> >> CONFIG_TPM should be fine, shouldn't it?  
>> > >> >
>> > >> > Some definitions depend on the host (OS, libraries installed, ...),
>> > >> > others depend on the --enable/--disable ./configure options.
>> > >> >
>> > >> > IMO it would be nice if we could get qtests independent of the latter.  
>> > >>
>> > >> Why?  
>> > >
>> > > In another mail-thread Philippe mentioned that there is desire
>> > > to use qtest out of tree to test other QEMU binaries.
>> > >
>> > > However, just probing for features at runtime aren't going
>> > > to help with the goal as tests are tailored for the latest
>> > > CLI/QMP/ABI. To make it work we would have practically
>> > > introduce versioned tests.
>> > >
>> > > So I wonder why one external acceptance-tests suite is not
>> > > sufficient, that we would want to hijack relatively simple
>> > > internal qtest at expense of increased resources needed to
>> > > run/write unit tests.  
>> >
>> > Yes.  qtest was not designed for use with anything but HEAD, and I doubt
>> > we can make it fit such uses at reasonable expense.  
>> 
>> One HEAD but multiple configurations...
>
> Even assuming reconfigure won't cause world rebuild,
> It will be a win only if number of configuration probes
> is small.
> However it doesn't scale for large numbers and it might be
> faster to rebuild affected tests in the end. (worst case: #probes * #targets)
> I wonder if we can do probing once & cache it somewhere to avoid ^^^.

As far as I can tell, the time to compile these tests is dwarved several
times over by the time to run them.  In other words, most of the waste
to optimize out hides in the test programs, not in compiling them.

>> If you want to simplify human time, can we simply run qtests once per
>> arch/OS but with all features enabled? Otherwise skip qtests?

How build configuration and tests interact is poorly understood.  We
instead use brute force: run all the tests for all configurations,
always.  To do better without sacrificing coverage, we need to
understand better.  Sadly, I don't see that happening.



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

end of thread, other threads:[~2021-07-19 15:15 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 15:09 [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Stefan Berger
2021-07-12 15:09 ` [PATCH v3 1/9] tests: Rename TestState to TPMTestState Stefan Berger
2021-07-12 15:09 ` [PATCH v3 2/9] tests: Add tpm_version field to TPMTestState and fill it Stefan Berger
2021-07-12 15:09 ` [PATCH v3 3/9] tests: acpi: Prepare for renaming of TPM2 related ACPI files Stefan Berger
2021-07-12 15:09 ` [PATCH v3 4/9] tests: Add suffix 'tpm2' or 'tpm12' to ACPI table files Stefan Berger
2021-07-12 15:09 ` [PATCH v3 5/9] tests: acpi: tpm2: Add the renamed ACPI files and drop old ones Stefan Berger
2021-07-12 15:09 ` [PATCH v3 6/9] tests: tpm: Create TPM 1.2 response in TPM emulator Stefan Berger
2021-07-12 15:09 ` [PATCH v3 7/9] tests: acpi: prepare for new TPM 1.2 related tables Stefan Berger
2021-07-12 15:09 ` [PATCH v3 8/9] tests: acpi: Add test cases for TPM 1.2 with TCPA table Stefan Berger
2021-07-12 15:09 ` [PATCH v3 9/9] tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs Stefan Berger
2021-07-12 15:29 ` [PATCH v3 0/9] tests: Add test cases for TPM 1.2 ACPI tables Philippe Mathieu-Daudé
2021-07-12 15:47   ` Stefan Berger
2021-07-12 16:26     ` Philippe Mathieu-Daudé
2021-07-12 18:10       ` Stefan Berger
2021-07-14 14:43       ` Markus Armbruster
2021-07-14 20:16         ` Philippe Mathieu-Daudé
2021-07-15  5:49           ` Markus Armbruster
2021-07-19 13:38             ` Igor Mammedov
2021-07-19 13:50               ` Markus Armbruster
2021-07-19 13:56                 ` Philippe Mathieu-Daudé
2021-07-19 14:44                   ` Igor Mammedov
2021-07-19 15:13                     ` Markus Armbruster

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.