All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4
@ 2022-07-31 16:21 Julia Suvorova
  2022-07-31 16:21 ` [PATCH v2 1/5] " Julia Suvorova
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Julia Suvorova @ 2022-07-31 16:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Igor Mammedov, Ani Sinha, Julia Suvorova

The SMBIOS 3.0 specification provides the ability to reflect over
255 cores. The 64-bit entry point has been used for a while, but
structure type 4 has not been updated before, so the dmidecode output
looked like this (-smp 280):

    Handle 0x0400, DMI type 4, 42 bytes
    Processor Information
    ...
        Core Count: 24
        Core Enabled: 24
        Thread Count: 1
    ...

Big update in the bios-tables-test as it couldn't work with SMBIOS 3.0.

v2:
    * generate tables type 4 of different sizes based on the
      selected smbios version
    * use SmbiosEntryPoint* types instead of creating new constants
    * refactor smbios_cpu_test [Igor, Ani]
    * clarify signature check [Igor]
    * add comments with specifications and clarification of the structure loop [Ani]

Julia Suvorova (5):
  hw/smbios: add core_count2 to smbios table type 4
  bios-tables-test: teach test to use smbios 3.0 tables
  tests/acpi: allow changes for core_count2 test
  bios-tables-test: add test for number of cores > 255
  tests/acpi: update tables for new core count test

 hw/smbios/smbios_build.h             |   9 +-
 include/hw/firmware/smbios.h         |  11 ++
 hw/smbios/smbios.c                   |  18 +++-
 tests/qtest/bios-tables-test.c       | 148 ++++++++++++++++++++-------
 tests/data/acpi/q35/APIC.core-count2 | Bin 0 -> 2478 bytes
 tests/data/acpi/q35/DSDT.core-count2 | Bin 0 -> 32414 bytes
 tests/data/acpi/q35/FACP.core-count2 | Bin 0 -> 244 bytes
 7 files changed, 144 insertions(+), 42 deletions(-)
 create mode 100644 tests/data/acpi/q35/APIC.core-count2
 create mode 100644 tests/data/acpi/q35/DSDT.core-count2
 create mode 100644 tests/data/acpi/q35/FACP.core-count2

-- 
2.35.3



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

* [PATCH v2 1/5] hw/smbios: add core_count2 to smbios table type 4
  2022-07-31 16:21 [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Julia Suvorova
@ 2022-07-31 16:21 ` Julia Suvorova
  2022-08-24 16:00   ` Igor Mammedov
  2022-07-31 16:21 ` [PATCH v2 2/5] bios-tables-test: teach test to use smbios 3.0 tables Julia Suvorova
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Julia Suvorova @ 2022-07-31 16:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Igor Mammedov, Ani Sinha, Julia Suvorova

In order to use the increased number of cpus, we need to bring smbios
tables in line with the SMBIOS 3.0 specification. This allows us to
introduce core_count2 which acts as a duplicate of core_count if we have
fewer cores than 256, and contains the actual core number per socket if
we have more.

core_enabled2 and thread_count2 fields work the same way.

Signed-off-by: Julia Suvorova <jusual@redhat.com>
---
 hw/smbios/smbios_build.h     |  9 +++++++--
 include/hw/firmware/smbios.h | 11 +++++++++++
 hw/smbios/smbios.c           | 18 +++++++++++++++---
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/hw/smbios/smbios_build.h b/hw/smbios/smbios_build.h
index 56b5a1e3f3..351660024e 100644
--- a/hw/smbios/smbios_build.h
+++ b/hw/smbios/smbios_build.h
@@ -27,6 +27,11 @@ extern unsigned smbios_table_max;
 extern unsigned smbios_table_cnt;
 
 #define SMBIOS_BUILD_TABLE_PRE(tbl_type, tbl_handle, tbl_required)        \
+        SMBIOS_BUILD_TABLE_PRE_SIZE(tbl_type, tbl_handle, tbl_required,   \
+                                    sizeof(struct smbios_type_##tbl_type))\
+
+#define SMBIOS_BUILD_TABLE_PRE_SIZE(tbl_type, tbl_handle,                 \
+                                    tbl_required, tbl_len)                \
     struct smbios_type_##tbl_type *t;                                     \
     size_t t_off; /* table offset into smbios_tables */                   \
     int str_index = 0;                                                    \
@@ -39,12 +44,12 @@ extern unsigned smbios_table_cnt;
         /* use offset of table t within smbios_tables */                  \
         /* (pointer must be updated after each realloc) */                \
         t_off = smbios_tables_len;                                        \
-        smbios_tables_len += sizeof(*t);                                  \
+        smbios_tables_len += tbl_len;                                     \
         smbios_tables = g_realloc(smbios_tables, smbios_tables_len);      \
         t = (struct smbios_type_##tbl_type *)(smbios_tables + t_off);     \
                                                                           \
         t->header.type = tbl_type;                                        \
-        t->header.length = sizeof(*t);                                    \
+        t->header.length = tbl_len;                                       \
         t->header.handle = cpu_to_le16(tbl_handle);                       \
     } while (0)
 
diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
index 4b7ad77a44..56f7bf0fea 100644
--- a/include/hw/firmware/smbios.h
+++ b/include/hw/firmware/smbios.h
@@ -18,6 +18,8 @@
 
 
 #define SMBIOS_MAX_TYPE 127
+#define offsetofend(TYPE, MEMBER) \
+       (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))
 
 /* memory area description, used by type 19 table */
 struct smbios_phys_mem_area {
@@ -187,8 +189,17 @@ struct smbios_type_4 {
     uint8_t thread_count;
     uint16_t processor_characteristics;
     uint16_t processor_family2;
+    /* SMBIOS spec 3.0.0, Table 21 */
+    uint16_t core_count2;
+    uint16_t core_enabled2;
+    uint16_t thread_count2;
 } QEMU_PACKED;
 
+typedef enum smbios_type_4_len_ver {
+    SMBIOS_TYPE_4_LEN_V28 = offsetofend(struct smbios_type_4, processor_family2),
+    SMBIOS_TYPE_4_LEN_V30 = offsetofend(struct smbios_type_4, thread_count2),
+} smbios_type_4_len_ver;
+
 /* SMBIOS type 11 - OEM strings */
 struct smbios_type_11 {
     struct smbios_structure_header header;
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 60349ee402..657093e5f6 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -681,8 +681,13 @@ static void smbios_build_type_3_table(void)
 static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
 {
     char sock_str[128];
+    size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
 
-    SMBIOS_BUILD_TABLE_PRE(4, T4_BASE + instance, true); /* required */
+    if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
+        tbl_len = SMBIOS_TYPE_4_LEN_V30;
+    }
+
+    SMBIOS_BUILD_TABLE_PRE_SIZE(4, T4_BASE + instance, true, tbl_len); /* required */
 
     snprintf(sock_str, sizeof(sock_str), "%s%2x", type4.sock_pfx, instance);
     SMBIOS_TABLE_SET_STR(4, socket_designation_str, sock_str);
@@ -709,8 +714,15 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     SMBIOS_TABLE_SET_STR(4, serial_number_str, type4.serial);
     SMBIOS_TABLE_SET_STR(4, asset_tag_number_str, type4.asset);
     SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
-    t->core_count = t->core_enabled = ms->smp.cores;
-    t->thread_count = ms->smp.threads;
+
+    t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
+    t->core_enabled = t->core_count;
+
+    t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
+
+    t->thread_count = (ms->smp.threads > 255) ? 0xFF : ms->smp.threads;
+    t->thread_count2 = cpu_to_le16(ms->smp.threads);
+
     t->processor_characteristics = cpu_to_le16(0x02); /* Unknown */
     t->processor_family2 = cpu_to_le16(0x01); /* Other */
 
-- 
2.35.3



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

* [PATCH v2 2/5] bios-tables-test: teach test to use smbios 3.0 tables
  2022-07-31 16:21 [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Julia Suvorova
  2022-07-31 16:21 ` [PATCH v2 1/5] " Julia Suvorova
@ 2022-07-31 16:21 ` Julia Suvorova
  2022-08-25  7:37   ` Igor Mammedov
  2022-07-31 16:21 ` [PATCH v2 3/5] tests/acpi: allow changes for core_count2 test Julia Suvorova
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Julia Suvorova @ 2022-07-31 16:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Igor Mammedov, Ani Sinha, Julia Suvorova

Introduce the 64-bit entry point. Since we no longer have a total
number of structures, stop checking for the new ones at the EOF
structure (type 127).

Signed-off-by: Julia Suvorova <jusual@redhat.com>
---
 tests/qtest/bios-tables-test.c | 95 +++++++++++++++++++++++++---------
 1 file changed, 71 insertions(+), 24 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 359916c228..e352d5249f 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -88,8 +88,8 @@ typedef struct {
     uint64_t rsdp_addr;
     uint8_t rsdp_table[36 /* ACPI 2.0+ RSDP size */];
     GArray *tables;
-    uint32_t smbios_ep_addr;
-    struct smbios_21_entry_point smbios_ep_table;
+    uint64_t smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE__MAX];
+    SmbiosEntryPoint smbios_ep_table;
     uint16_t smbios_cpu_max_speed;
     uint16_t smbios_cpu_curr_speed;
     uint8_t *required_struct_types;
@@ -533,10 +533,9 @@ static void test_acpi_asl(test_data *data)
     free_test_data(&exp_data);
 }
 
-static bool smbios_ep_table_ok(test_data *data)
+static bool smbios_ep2_table_ok(test_data *data, uint32_t addr)
 {
-    struct smbios_21_entry_point *ep_table = &data->smbios_ep_table;
-    uint32_t addr = data->smbios_ep_addr;
+    struct smbios_21_entry_point *ep_table = &data->smbios_ep_table.ep21;
 
     qtest_memread(data->qts, addr, ep_table, sizeof(*ep_table));
     if (memcmp(ep_table->anchor_string, "_SM_", 4)) {
@@ -559,13 +558,29 @@ static bool smbios_ep_table_ok(test_data *data)
     return true;
 }
 
-static void test_smbios_entry_point(test_data *data)
+static bool smbios_ep3_table_ok(test_data *data, uint64_t addr)
+{
+    struct smbios_30_entry_point *ep_table = &data->smbios_ep_table.ep30;
+
+    qtest_memread(data->qts, addr, ep_table, sizeof(*ep_table));
+    if (memcmp(ep_table->anchor_string, "_SM3_", 5)) {
+        return false;
+    }
+
+    if (acpi_calc_checksum((uint8_t *)ep_table, sizeof *ep_table)) {
+        return false;
+    }
+
+    return true;
+}
+
+static SmbiosEntryPointType test_smbios_entry_point(test_data *data)
 {
     uint32_t off;
 
     /* find smbios entry point structure */
     for (off = 0xf0000; off < 0x100000; off += 0x10) {
-        uint8_t sig[] = "_SM_";
+        uint8_t sig[] = "_SM_", sig3[] = "_SM3_";
         int i;
 
         for (i = 0; i < sizeof sig - 1; ++i) {
@@ -574,14 +589,30 @@ static void test_smbios_entry_point(test_data *data)
 
         if (!memcmp(sig, "_SM_", sizeof sig)) {
             /* signature match, but is this a valid entry point? */
-            data->smbios_ep_addr = off;
-            if (smbios_ep_table_ok(data)) {
+            if (smbios_ep2_table_ok(data, off)) {
+                data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_32] = off;
+            }
+        }
+
+        for (i = 0; i < sizeof sig3 - 1; ++i) {
+            sig3[i] = qtest_readb(data->qts, off + i);
+        }
+
+        if (!memcmp(sig3, "_SM3_", sizeof sig3)) {
+            if (smbios_ep3_table_ok(data, off)) {
+                data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_64] = off;
+                /* found 64-bit entry point, no need to look for 32-bit one */
                 break;
             }
         }
     }
 
-    g_assert_cmphex(off, <, 0x100000);
+    /* found at least one entry point */
+    g_assert_true(data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_32] ||
+                  data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_64]);
+
+    return data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_64] ?
+           SMBIOS_ENTRY_POINT_TYPE_64 : SMBIOS_ENTRY_POINT_TYPE_32;
 }
 
 static inline bool smbios_single_instance(uint8_t type)
@@ -625,16 +656,23 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr)
     return true;
 }
 
-static void test_smbios_structs(test_data *data)
+static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
 {
     DECLARE_BITMAP(struct_bitmap, SMBIOS_MAX_TYPE+1) = { 0 };
-    struct smbios_21_entry_point *ep_table = &data->smbios_ep_table;
-    uint32_t addr = le32_to_cpu(ep_table->structure_table_address);
-    int i, len, max_len = 0;
+
+    SmbiosEntryPoint *ep_table = &data->smbios_ep_table;
+    int i = 0, len, max_len = 0;
     uint8_t type, prv, crt;
+    uint64_t addr;
+
+    if (ep_type == SMBIOS_ENTRY_POINT_TYPE_32) {
+        addr = le32_to_cpu(ep_table->ep21.structure_table_address);
+    } else {
+        addr = le64_to_cpu(ep_table->ep30.structure_table_address);
+    }
 
     /* walk the smbios tables */
-    for (i = 0; i < le16_to_cpu(ep_table->number_of_structures); i++) {
+    do {
 
         /* grab type and formatted area length from struct header */
         type = qtest_readb(data->qts, addr);
@@ -660,19 +698,28 @@ static void test_smbios_structs(test_data *data)
         }
 
         /* keep track of max. struct size */
-        if (max_len < len) {
+        if (ep_type == SMBIOS_ENTRY_POINT_TYPE_32 && max_len < len) {
             max_len = len;
-            g_assert_cmpuint(max_len, <=, ep_table->max_structure_size);
+            g_assert_cmpuint(max_len, <=, ep_table->ep21.max_structure_size);
         }
 
         /* start of next structure */
         addr += len;
-    }
 
-    /* total table length and max struct size must match entry point values */
-    g_assert_cmpuint(le16_to_cpu(ep_table->structure_table_length), ==,
-                     addr - le32_to_cpu(ep_table->structure_table_address));
-    g_assert_cmpuint(le16_to_cpu(ep_table->max_structure_size), ==, max_len);
+    /*
+     * Until all structures have been scanned (ep21)
+     * or an EOF structure is found (ep30)
+     */
+    } while (ep_type == SMBIOS_ENTRY_POINT_TYPE_32 ?
+                ++i < le16_to_cpu(ep_table->ep21.number_of_structures) :
+                type != 127);
+
+    if (ep_type == SMBIOS_ENTRY_POINT_TYPE_32) {
+        /* total table length and max struct size must match entry point values */
+        g_assert_cmpuint(le16_to_cpu(ep_table->ep21.structure_table_length), ==,
+                         addr - le32_to_cpu(ep_table->ep21.structure_table_address));
+        g_assert_cmpuint(le16_to_cpu(ep_table->ep21.max_structure_size), ==, max_len);
+    }
 
     /* required struct types must all be present */
     for (i = 0; i < data->required_struct_types_len; i++) {
@@ -756,8 +803,8 @@ static void test_acpi_one(const char *params, test_data *data)
      * https://bugs.launchpad.net/qemu/+bug/1821884
      */
     if (!use_uefi) {
-        test_smbios_entry_point(data);
-        test_smbios_structs(data);
+        SmbiosEntryPointType ep_type = test_smbios_entry_point(data);
+        test_smbios_structs(data, ep_type);
     }
 
     qtest_quit(data->qts);
-- 
2.35.3



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

* [PATCH v2 3/5] tests/acpi: allow changes for core_count2 test
  2022-07-31 16:21 [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Julia Suvorova
  2022-07-31 16:21 ` [PATCH v2 1/5] " Julia Suvorova
  2022-07-31 16:21 ` [PATCH v2 2/5] bios-tables-test: teach test to use smbios 3.0 tables Julia Suvorova
@ 2022-07-31 16:21 ` Julia Suvorova
  2022-07-31 16:21 ` [PATCH v2 4/5] bios-tables-test: add test for number of cores > 255 Julia Suvorova
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Julia Suvorova @ 2022-07-31 16:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Igor Mammedov, Ani Sinha, Julia Suvorova

Signed-off-by: Julia Suvorova <jusual@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 3 +++
 tests/data/acpi/q35/APIC.core-count2        | 0
 tests/data/acpi/q35/DSDT.core-count2        | 0
 tests/data/acpi/q35/FACP.core-count2        | 0
 4 files changed, 3 insertions(+)
 create mode 100644 tests/data/acpi/q35/APIC.core-count2
 create mode 100644 tests/data/acpi/q35/DSDT.core-count2
 create mode 100644 tests/data/acpi/q35/FACP.core-count2

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..e81dc67a2e 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,4 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/APIC.core-count2",
+"tests/data/acpi/q35/DSDT.core-count2",
+"tests/data/acpi/q35/FACP.core-count2",
diff --git a/tests/data/acpi/q35/APIC.core-count2 b/tests/data/acpi/q35/APIC.core-count2
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/q35/DSDT.core-count2 b/tests/data/acpi/q35/DSDT.core-count2
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/q35/FACP.core-count2 b/tests/data/acpi/q35/FACP.core-count2
new file mode 100644
index 0000000000..e69de29bb2
-- 
2.35.3



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

* [PATCH v2 4/5] bios-tables-test: add test for number of cores > 255
  2022-07-31 16:21 [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Julia Suvorova
                   ` (2 preceding siblings ...)
  2022-07-31 16:21 ` [PATCH v2 3/5] tests/acpi: allow changes for core_count2 test Julia Suvorova
@ 2022-07-31 16:21 ` Julia Suvorova
  2022-08-25  7:57   ` Igor Mammedov
  2022-07-31 16:21 ` [PATCH v2 5/5] tests/acpi: update tables for new core count test Julia Suvorova
  2022-08-12  9:46 ` [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Michael S. Tsirkin
  5 siblings, 1 reply; 10+ messages in thread
From: Julia Suvorova @ 2022-07-31 16:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Igor Mammedov, Ani Sinha, Julia Suvorova

The new test is run with a large number of cpus and checks if the
core_count field in smbios_cpu_test (structure type 4) is correct.

Choose q35 as it allows to run with -smp > 255.

Signed-off-by: Julia Suvorova <jusual@redhat.com>
---
 tests/qtest/bios-tables-test.c | 53 +++++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index e352d5249f..cebfa430ac 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -92,6 +92,8 @@ typedef struct {
     SmbiosEntryPoint smbios_ep_table;
     uint16_t smbios_cpu_max_speed;
     uint16_t smbios_cpu_curr_speed;
+    uint8_t smbios_core_count;
+    uint16_t smbios_core_count2;
     uint8_t *required_struct_types;
     int required_struct_types_len;
     QTestState *qts;
@@ -631,29 +633,38 @@ static inline bool smbios_single_instance(uint8_t type)
     }
 }
 
-static bool smbios_cpu_test(test_data *data, uint32_t addr)
+static void smbios_cpu_test(test_data *data, uint32_t addr)
 {
-    uint16_t expect_speed[2];
-    uint16_t real;
+    uint8_t core_count, expected_core_count = data->smbios_core_count;
+    uint16_t speed, core_count2, expected_core_count2 = data->smbios_core_count2;
+    uint16_t expected_speed[2];
     int offset[2];
     int i;
 
     /* Check CPU speed for backward compatibility */
     offset[0] = offsetof(struct smbios_type_4, max_speed);
     offset[1] = offsetof(struct smbios_type_4, current_speed);
-    expect_speed[0] = data->smbios_cpu_max_speed ? : 2000;
-    expect_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
+    expected_speed[0] = data->smbios_cpu_max_speed ? : 2000;
+    expected_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
 
     for (i = 0; i < 2; i++) {
-        real = qtest_readw(data->qts, addr + offset[i]);
-        if (real != expect_speed[i]) {
-            fprintf(stderr, "Unexpected SMBIOS CPU speed: real %u expect %u\n",
-                    real, expect_speed[i]);
-            return false;
-        }
+        speed = qtest_readw(data->qts, addr + offset[i]);
+        g_assert_cmpuint(speed, ==, expected_speed[i]);
     }
 
-    return true;
+    core_count = qtest_readb(data->qts,
+                             addr + offsetof(struct smbios_type_4, core_count));
+    core_count2 = qtest_readw(data->qts,
+                              addr + offsetof(struct smbios_type_4, core_count2));
+
+    if (expected_core_count) {
+        g_assert_cmpuint(core_count, ==, expected_core_count);
+    }
+
+    /* Core Count has reached its limit, checking Core Count 2 */
+    if (expected_core_count == 0xFF && expected_core_count2) {
+        g_assert_cmpuint(core_count2, ==, expected_core_count2);
+    }
 }
 
 static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
@@ -686,7 +697,7 @@ static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
         set_bit(type, struct_bitmap);
 
         if (type == 4) {
-            g_assert(smbios_cpu_test(data, addr));
+            smbios_cpu_test(data, addr);
         }
 
         /* seek to end of unformatted string area of this struct ("\0\0") */
@@ -903,6 +914,21 @@ static void test_acpi_q35_tcg(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_tcg_core_count2(void)
+{
+    test_data data = {
+        .machine = MACHINE_Q35,
+        .variant = ".core-count2",
+        .required_struct_types = base_required_struct_types,
+        .required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
+        .smbios_core_count = 0xFF,
+        .smbios_core_count2 = 275,
+    };
+
+    test_acpi_one("-machine smbios-entry-point-type=64 -smp 275", &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg_bridge(void)
 {
     test_data data;
@@ -1822,6 +1848,7 @@ int main(int argc, char *argv[])
         qtest_add_func("acpi/piix4/pci-hotplug/off",
                        test_acpi_piix4_no_acpi_pci_hotplug);
         qtest_add_func("acpi/q35", test_acpi_q35_tcg);
+        qtest_add_func("acpi/q35/core-count2", test_acpi_q35_tcg_core_count2);
         qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
         qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge);
         qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
-- 
2.35.3



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

* [PATCH v2 5/5] tests/acpi: update tables for new core count test
  2022-07-31 16:21 [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Julia Suvorova
                   ` (3 preceding siblings ...)
  2022-07-31 16:21 ` [PATCH v2 4/5] bios-tables-test: add test for number of cores > 255 Julia Suvorova
@ 2022-07-31 16:21 ` Julia Suvorova
  2022-08-12  9:46 ` [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Michael S. Tsirkin
  5 siblings, 0 replies; 10+ messages in thread
From: Julia Suvorova @ 2022-07-31 16:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Igor Mammedov, Ani Sinha, Julia Suvorova

Changes in the tables (for 275 cores):
FACP:
+                 Use APIC Cluster Model (V4) : 1

APIC:
+[02Ch 0044   1]                Subtable Type : 00 [Processor Local APIC]
+[02Dh 0045   1]                       Length : 08
+[02Eh 0046   1]                 Processor ID : 00
+[02Fh 0047   1]                Local Apic ID : 00
+[030h 0048   4]        Flags (decoded below) : 00000001
+                           Processor Enabled : 1
...
+
+[81Ch 2076   1]                Subtable Type : 00 [Processor Local APIC]
+[81Dh 2077   1]                       Length : 08
+[81Eh 2078   1]                 Processor ID : FE
+[81Fh 2079   1]                Local Apic ID : FE
+[820h 2080   4]        Flags (decoded below) : 00000001
+                           Processor Enabled : 1
+                      Runtime Online Capable : 0
+
+[824h 2084   1]                Subtable Type : 09 [Processor Local x2APIC]
+[825h 2085   1]                       Length : 10
+[826h 2086   2]                     Reserved : 0000
+[828h 2088   4]          Processor x2Apic ID : 000000FF
+[82Ch 2092   4]        Flags (decoded below) : 00000001
+                           Processor Enabled : 1
+[830h 2096   4]                Processor UID : 000000FF
...

DSDT:
+            Processor (C001, 0x01, 0x00000000, 0x00)
+            {
+                Method (_STA, 0, Serialized)  // _STA: Status
+                {
+                    Return (CSTA (One))
+                }
+
+                Name (_MAT, Buffer (0x08)  // _MAT: Multiple APIC Table Entry
+                {
+                     0x00, 0x08, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00   // ........
+                })
+                Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
+                {
+                    CEJ0 (One)
+                }
+
+                Method (_OST, 3, Serialized)  // _OST: OSPM Status Indication
+                {
+                    COST (One, Arg0, Arg1, Arg2)
+                }
+            }
...
+            Processor (C0FE, 0xFE, 0x00000000, 0x00)
+            {
+                Method (_STA, 0, Serialized)  // _STA: Status
+                {
+                    Return (CSTA (0xFE))
+                }
+
+                Name (_MAT, Buffer (0x08)  // _MAT: Multiple APIC Table Entry
+                {
+                     0x00, 0x08, 0xFE, 0xFE, 0x01, 0x00, 0x00, 0x00   // ........
+                })
+                Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
+                {
+                    CEJ0 (0xFE)
+                }
+
+                Method (_OST, 3, Serialized)  // _OST: OSPM Status Indication
+                {
+                    COST (0xFE, Arg0, Arg1, Arg2)
+                }
+            }
+
+            Device (C0FF)
+            {
+                Name (_HID, "ACPI0007" /* Processor Device */)  // _HID: Hardware ID
+                Name (_UID, 0xFF)  // _UID: Unique ID
+                Method (_STA, 0, Serialized)  // _STA: Status
+                {
+                    Return (CSTA (0xFF))
+                }
+
+                Name (_MAT, Buffer (0x10)  // _MAT: Multiple APIC Table Entry
+                {
+                    /* 0000 */  0x09, 0x10, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,  // ........
+                    /* 0008 */  0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00   // ........
+                })
+                Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
+                {
+                    CEJ0 (0xFF)
+                }
+
+                Method (_OST, 3, Serialized)  // _OST: OSPM Status Indication
+                {
+                    COST (0xFF, Arg0, Arg1, Arg2)
+                }
+            }
+
...

Signed-off-by: Julia Suvorova <jusual@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h |   3 ---
 tests/data/acpi/q35/APIC.core-count2        | Bin 0 -> 2478 bytes
 tests/data/acpi/q35/DSDT.core-count2        | Bin 0 -> 32414 bytes
 tests/data/acpi/q35/FACP.core-count2        | Bin 0 -> 244 bytes
 4 files changed, 3 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index e81dc67a2e..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,4 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/APIC.core-count2",
-"tests/data/acpi/q35/DSDT.core-count2",
-"tests/data/acpi/q35/FACP.core-count2",
diff --git a/tests/data/acpi/q35/APIC.core-count2 b/tests/data/acpi/q35/APIC.core-count2
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a255082ef5bc39f0d92d3e372b91f09dd6d0d9a1 100644
GIT binary patch
literal 2478
zcmXZeWl$AS7=Youz=a#M-K}6ZwgLuNAQ;$~*xjvQcY@uCVs{~Sf`WpLVt2Rbe!ORA
z_B`J^b9R56*&pj2=<ge2)-*$cPk^sqaDJbVK;QiOWzaNDW>M2p(=#;b`y@>U1KQZ2
ztu5Nwq0xx;_UPb%CKH;?XtAKxijI!x<b=-7=;DH|uIT25?(Uc=6K2kgS+Zc(te7nu
zX3vf}a$wG!m@60N&W(BUVBWl#FCTI)nyEkmx?n*pR0s<f#v(<qXi+Ry3_U#1(-Vsq
z#}Xy5WJxSl3QL#9GG(xASu9r$%a_Lr6|iDOtW*grS4J-{tWpK5R>f-7uzGc@Q3Gq%
z#9Fnmc5SRv2fe+~#|M4+PE2*{()H?L{rcFT0s8r&zdtr?h>aRy<Hp#e2{vtt0Rb2o
zh|QW|P!I+OWAo<Nq6M~WiLF{;NC>uWjcwXs+qT%Q9ky?e9Xepgju;w>ojPIX&e)|3
zcI}GYx?%V37#4;-dSK6<*sB-z?u~u=VBfyjuOIgBj{^qaz=1eu5Dp%ULx$kcp*U<9
z4j+yqM&QViIBFD*9*twh;MlP^ZXAvuj}s=~#ECd*5{8FkL<CNrj8mrI)Tuaa8cv^%
zGiKn-nK)|}&Yq2P=HT49IBy=#pN|U`;KGHtXb~=6j7yeaWF$sK;nJnJY#A<Jjw@E+
z%9Xfk6|P>5Yu4b}wYY8_u3wKEHsHpMxM>q^-i%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775ad8c2e48c5391..31fa5dd19c213034eef4eeefa6a04e61dadd8a2a 100644
GIT binary patch
literal 244
zcmZ>BbPo8!z`($~*~#D8BUr&HBEVSz2pEB4AU24G0Y(N+hD|^Y6El!tgNU*~X%LSC
z$X0-fGcm9T0LA|E|L2FOWMD92VqjR>!otAF!NBm72O<iWged~jj0!*k$y^{03>bk1
YBHITON2VDSAnpK(F*YFF1LDH~0O^Si0RR91

literal 0
HcmV?d00001

-- 
2.35.3



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

* Re: [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4
  2022-07-31 16:21 [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Julia Suvorova
                   ` (4 preceding siblings ...)
  2022-07-31 16:21 ` [PATCH v2 5/5] tests/acpi: update tables for new core count test Julia Suvorova
@ 2022-08-12  9:46 ` Michael S. Tsirkin
  5 siblings, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2022-08-12  9:46 UTC (permalink / raw)
  To: Julia Suvorova; +Cc: qemu-devel, Igor Mammedov, Ani Sinha

On Sun, Jul 31, 2022 at 06:21:36PM +0200, Julia Suvorova wrote:
> The SMBIOS 3.0 specification provides the ability to reflect over
> 255 cores. The 64-bit entry point has been used for a while, but
> structure type 4 has not been updated before, so the dmidecode output
> looked like this (-smp 280):
> 
>     Handle 0x0400, DMI type 4, 42 bytes
>     Processor Information
>     ...
>         Core Count: 24
>         Core Enabled: 24
>         Thread Count: 1
>     ...
> 
> Big update in the bios-tables-test as it couldn't work with SMBIOS 3.0.

Looks good to me. I tagged this but just to help make sure it's
not lost pls ping me after the release.

> v2:
>     * generate tables type 4 of different sizes based on the
>       selected smbios version
>     * use SmbiosEntryPoint* types instead of creating new constants
>     * refactor smbios_cpu_test [Igor, Ani]
>     * clarify signature check [Igor]
>     * add comments with specifications and clarification of the structure loop [Ani]
> 
> Julia Suvorova (5):
>   hw/smbios: add core_count2 to smbios table type 4
>   bios-tables-test: teach test to use smbios 3.0 tables
>   tests/acpi: allow changes for core_count2 test
>   bios-tables-test: add test for number of cores > 255
>   tests/acpi: update tables for new core count test
> 
>  hw/smbios/smbios_build.h             |   9 +-
>  include/hw/firmware/smbios.h         |  11 ++
>  hw/smbios/smbios.c                   |  18 +++-
>  tests/qtest/bios-tables-test.c       | 148 ++++++++++++++++++++-------
>  tests/data/acpi/q35/APIC.core-count2 | Bin 0 -> 2478 bytes
>  tests/data/acpi/q35/DSDT.core-count2 | Bin 0 -> 32414 bytes
>  tests/data/acpi/q35/FACP.core-count2 | Bin 0 -> 244 bytes
>  7 files changed, 144 insertions(+), 42 deletions(-)
>  create mode 100644 tests/data/acpi/q35/APIC.core-count2
>  create mode 100644 tests/data/acpi/q35/DSDT.core-count2
>  create mode 100644 tests/data/acpi/q35/FACP.core-count2
> 
> -- 
> 2.35.3



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

* Re: [PATCH v2 1/5] hw/smbios: add core_count2 to smbios table type 4
  2022-07-31 16:21 ` [PATCH v2 1/5] " Julia Suvorova
@ 2022-08-24 16:00   ` Igor Mammedov
  0 siblings, 0 replies; 10+ messages in thread
From: Igor Mammedov @ 2022-08-24 16:00 UTC (permalink / raw)
  To: Julia Suvorova; +Cc: qemu-devel, Michael S. Tsirkin, Ani Sinha

On Sun, 31 Jul 2022 18:21:37 +0200
Julia Suvorova <jusual@redhat.com> wrote:

> In order to use the increased number of cpus, we need to bring smbios
> tables in line with the SMBIOS 3.0 specification. This allows us to
> introduce core_count2 which acts as a duplicate of core_count if we have
> fewer cores than 256, and contains the actual core number per socket if
> we have more.
> 
> core_enabled2 and thread_count2 fields work the same way.
> 
> Signed-off-by: Julia Suvorova <jusual@redhat.com>

I'd fix up checkpatch warnings but otherwise looks good to me

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

> ---
>  hw/smbios/smbios_build.h     |  9 +++++++--
>  include/hw/firmware/smbios.h | 11 +++++++++++
>  hw/smbios/smbios.c           | 18 +++++++++++++++---
>  3 files changed, 33 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/smbios/smbios_build.h b/hw/smbios/smbios_build.h
> index 56b5a1e3f3..351660024e 100644
> --- a/hw/smbios/smbios_build.h
> +++ b/hw/smbios/smbios_build.h
> @@ -27,6 +27,11 @@ extern unsigned smbios_table_max;
>  extern unsigned smbios_table_cnt;
>  
>  #define SMBIOS_BUILD_TABLE_PRE(tbl_type, tbl_handle, tbl_required)        \
> +        SMBIOS_BUILD_TABLE_PRE_SIZE(tbl_type, tbl_handle, tbl_required,   \
> +                                    sizeof(struct smbios_type_##tbl_type))\
> +
> +#define SMBIOS_BUILD_TABLE_PRE_SIZE(tbl_type, tbl_handle,                 \
> +                                    tbl_required, tbl_len)                \
>      struct smbios_type_##tbl_type *t;                                     \
>      size_t t_off; /* table offset into smbios_tables */                   \
>      int str_index = 0;                                                    \
> @@ -39,12 +44,12 @@ extern unsigned smbios_table_cnt;
>          /* use offset of table t within smbios_tables */                  \
>          /* (pointer must be updated after each realloc) */                \
>          t_off = smbios_tables_len;                                        \
> -        smbios_tables_len += sizeof(*t);                                  \
> +        smbios_tables_len += tbl_len;                                     \
>          smbios_tables = g_realloc(smbios_tables, smbios_tables_len);      \
>          t = (struct smbios_type_##tbl_type *)(smbios_tables + t_off);     \
>                                                                            \
>          t->header.type = tbl_type;                                        \
> -        t->header.length = sizeof(*t);                                    \
> +        t->header.length = tbl_len;                                       \
>          t->header.handle = cpu_to_le16(tbl_handle);                       \
>      } while (0)
>  
> diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
> index 4b7ad77a44..56f7bf0fea 100644
> --- a/include/hw/firmware/smbios.h
> +++ b/include/hw/firmware/smbios.h
> @@ -18,6 +18,8 @@
>  
>  
>  #define SMBIOS_MAX_TYPE 127
> +#define offsetofend(TYPE, MEMBER) \
> +       (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))
>  
>  /* memory area description, used by type 19 table */
>  struct smbios_phys_mem_area {
> @@ -187,8 +189,17 @@ struct smbios_type_4 {
>      uint8_t thread_count;
>      uint16_t processor_characteristics;
>      uint16_t processor_family2;
> +    /* SMBIOS spec 3.0.0, Table 21 */
> +    uint16_t core_count2;
> +    uint16_t core_enabled2;
> +    uint16_t thread_count2;
>  } QEMU_PACKED;
>  
> +typedef enum smbios_type_4_len_ver {
> +    SMBIOS_TYPE_4_LEN_V28 = offsetofend(struct smbios_type_4, processor_family2),
> +    SMBIOS_TYPE_4_LEN_V30 = offsetofend(struct smbios_type_4, thread_count2),
> +} smbios_type_4_len_ver;
> +
>  /* SMBIOS type 11 - OEM strings */
>  struct smbios_type_11 {
>      struct smbios_structure_header header;
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index 60349ee402..657093e5f6 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -681,8 +681,13 @@ static void smbios_build_type_3_table(void)
>  static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
>  {
>      char sock_str[128];
> +    size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
>  
> -    SMBIOS_BUILD_TABLE_PRE(4, T4_BASE + instance, true); /* required */
> +    if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
> +        tbl_len = SMBIOS_TYPE_4_LEN_V30;
> +    }
> +
> +    SMBIOS_BUILD_TABLE_PRE_SIZE(4, T4_BASE + instance, true, tbl_len); /* required */
>  
>      snprintf(sock_str, sizeof(sock_str), "%s%2x", type4.sock_pfx, instance);
>      SMBIOS_TABLE_SET_STR(4, socket_designation_str, sock_str);
> @@ -709,8 +714,15 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
>      SMBIOS_TABLE_SET_STR(4, serial_number_str, type4.serial);
>      SMBIOS_TABLE_SET_STR(4, asset_tag_number_str, type4.asset);
>      SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
> -    t->core_count = t->core_enabled = ms->smp.cores;
> -    t->thread_count = ms->smp.threads;
> +
> +    t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
> +    t->core_enabled = t->core_count;
> +
> +    t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
> +
> +    t->thread_count = (ms->smp.threads > 255) ? 0xFF : ms->smp.threads;
> +    t->thread_count2 = cpu_to_le16(ms->smp.threads);
> +
>      t->processor_characteristics = cpu_to_le16(0x02); /* Unknown */
>      t->processor_family2 = cpu_to_le16(0x01); /* Other */
>  



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

* Re: [PATCH v2 2/5] bios-tables-test: teach test to use smbios 3.0 tables
  2022-07-31 16:21 ` [PATCH v2 2/5] bios-tables-test: teach test to use smbios 3.0 tables Julia Suvorova
@ 2022-08-25  7:37   ` Igor Mammedov
  0 siblings, 0 replies; 10+ messages in thread
From: Igor Mammedov @ 2022-08-25  7:37 UTC (permalink / raw)
  To: Julia Suvorova; +Cc: qemu-devel, Michael S. Tsirkin, Ani Sinha

On Sun, 31 Jul 2022 18:21:38 +0200
Julia Suvorova <jusual@redhat.com> wrote:

> Introduce the 64-bit entry point. Since we no longer have a total
> number of structures, stop checking for the new ones at the EOF
> structure (type 127).

needs fixing checkpatch warnings

other than that

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

> Signed-off-by: Julia Suvorova <jusual@redhat.com>
> ---
>  tests/qtest/bios-tables-test.c | 95 +++++++++++++++++++++++++---------
>  1 file changed, 71 insertions(+), 24 deletions(-)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 359916c228..e352d5249f 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -88,8 +88,8 @@ typedef struct {
>      uint64_t rsdp_addr;
>      uint8_t rsdp_table[36 /* ACPI 2.0+ RSDP size */];
>      GArray *tables;
> -    uint32_t smbios_ep_addr;
> -    struct smbios_21_entry_point smbios_ep_table;
> +    uint64_t smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE__MAX];
> +    SmbiosEntryPoint smbios_ep_table;
>      uint16_t smbios_cpu_max_speed;
>      uint16_t smbios_cpu_curr_speed;
>      uint8_t *required_struct_types;
> @@ -533,10 +533,9 @@ static void test_acpi_asl(test_data *data)
>      free_test_data(&exp_data);
>  }
>  
> -static bool smbios_ep_table_ok(test_data *data)
> +static bool smbios_ep2_table_ok(test_data *data, uint32_t addr)
>  {
> -    struct smbios_21_entry_point *ep_table = &data->smbios_ep_table;
> -    uint32_t addr = data->smbios_ep_addr;
> +    struct smbios_21_entry_point *ep_table = &data->smbios_ep_table.ep21;
>  
>      qtest_memread(data->qts, addr, ep_table, sizeof(*ep_table));
>      if (memcmp(ep_table->anchor_string, "_SM_", 4)) {
> @@ -559,13 +558,29 @@ static bool smbios_ep_table_ok(test_data *data)
>      return true;
>  }
>  
> -static void test_smbios_entry_point(test_data *data)
> +static bool smbios_ep3_table_ok(test_data *data, uint64_t addr)
> +{
> +    struct smbios_30_entry_point *ep_table = &data->smbios_ep_table.ep30;
> +
> +    qtest_memread(data->qts, addr, ep_table, sizeof(*ep_table));
> +    if (memcmp(ep_table->anchor_string, "_SM3_", 5)) {
> +        return false;
> +    }
> +
> +    if (acpi_calc_checksum((uint8_t *)ep_table, sizeof *ep_table)) {
> +        return false;
> +    }
> +
> +    return true;
> +}
> +
> +static SmbiosEntryPointType test_smbios_entry_point(test_data *data)
>  {
>      uint32_t off;
>  
>      /* find smbios entry point structure */
>      for (off = 0xf0000; off < 0x100000; off += 0x10) {
> -        uint8_t sig[] = "_SM_";
> +        uint8_t sig[] = "_SM_", sig3[] = "_SM3_";
>          int i;
>  
>          for (i = 0; i < sizeof sig - 1; ++i) {
> @@ -574,14 +589,30 @@ static void test_smbios_entry_point(test_data *data)
>  
>          if (!memcmp(sig, "_SM_", sizeof sig)) {
>              /* signature match, but is this a valid entry point? */
> -            data->smbios_ep_addr = off;
> -            if (smbios_ep_table_ok(data)) {
> +            if (smbios_ep2_table_ok(data, off)) {
> +                data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_32] = off;
> +            }
> +        }
> +
> +        for (i = 0; i < sizeof sig3 - 1; ++i) {
> +            sig3[i] = qtest_readb(data->qts, off + i);
> +        }
> +
> +        if (!memcmp(sig3, "_SM3_", sizeof sig3)) {
> +            if (smbios_ep3_table_ok(data, off)) {
> +                data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_64] = off;
> +                /* found 64-bit entry point, no need to look for 32-bit one */
>                  break;
>              }
>          }
>      }
>  
> -    g_assert_cmphex(off, <, 0x100000);
> +    /* found at least one entry point */
> +    g_assert_true(data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_32] ||
> +                  data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_64]);
> +
> +    return data->smbios_ep_addr[SMBIOS_ENTRY_POINT_TYPE_64] ?
> +           SMBIOS_ENTRY_POINT_TYPE_64 : SMBIOS_ENTRY_POINT_TYPE_32;
>  }
>  
>  static inline bool smbios_single_instance(uint8_t type)
> @@ -625,16 +656,23 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr)
>      return true;
>  }
>  
> -static void test_smbios_structs(test_data *data)
> +static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
>  {
>      DECLARE_BITMAP(struct_bitmap, SMBIOS_MAX_TYPE+1) = { 0 };
> -    struct smbios_21_entry_point *ep_table = &data->smbios_ep_table;
> -    uint32_t addr = le32_to_cpu(ep_table->structure_table_address);
> -    int i, len, max_len = 0;
> +
> +    SmbiosEntryPoint *ep_table = &data->smbios_ep_table;
> +    int i = 0, len, max_len = 0;
>      uint8_t type, prv, crt;
> +    uint64_t addr;
> +
> +    if (ep_type == SMBIOS_ENTRY_POINT_TYPE_32) {
> +        addr = le32_to_cpu(ep_table->ep21.structure_table_address);
> +    } else {
> +        addr = le64_to_cpu(ep_table->ep30.structure_table_address);
> +    }
>  
>      /* walk the smbios tables */
> -    for (i = 0; i < le16_to_cpu(ep_table->number_of_structures); i++) {
> +    do {
>  
>          /* grab type and formatted area length from struct header */
>          type = qtest_readb(data->qts, addr);
> @@ -660,19 +698,28 @@ static void test_smbios_structs(test_data *data)
>          }
>  
>          /* keep track of max. struct size */
> -        if (max_len < len) {
> +        if (ep_type == SMBIOS_ENTRY_POINT_TYPE_32 && max_len < len) {
>              max_len = len;
> -            g_assert_cmpuint(max_len, <=, ep_table->max_structure_size);
> +            g_assert_cmpuint(max_len, <=, ep_table->ep21.max_structure_size);
>          }
>  
>          /* start of next structure */
>          addr += len;
> -    }
>  
> -    /* total table length and max struct size must match entry point values */
> -    g_assert_cmpuint(le16_to_cpu(ep_table->structure_table_length), ==,
> -                     addr - le32_to_cpu(ep_table->structure_table_address));
> -    g_assert_cmpuint(le16_to_cpu(ep_table->max_structure_size), ==, max_len);
> +    /*
> +     * Until all structures have been scanned (ep21)
> +     * or an EOF structure is found (ep30)
> +     */
> +    } while (ep_type == SMBIOS_ENTRY_POINT_TYPE_32 ?
> +                ++i < le16_to_cpu(ep_table->ep21.number_of_structures) :
> +                type != 127);
> +
> +    if (ep_type == SMBIOS_ENTRY_POINT_TYPE_32) {
> +        /* total table length and max struct size must match entry point values */
> +        g_assert_cmpuint(le16_to_cpu(ep_table->ep21.structure_table_length), ==,
> +                         addr - le32_to_cpu(ep_table->ep21.structure_table_address));
> +        g_assert_cmpuint(le16_to_cpu(ep_table->ep21.max_structure_size), ==, max_len);
> +    }
>  
>      /* required struct types must all be present */
>      for (i = 0; i < data->required_struct_types_len; i++) {
> @@ -756,8 +803,8 @@ static void test_acpi_one(const char *params, test_data *data)
>       * https://bugs.launchpad.net/qemu/+bug/1821884
>       */
>      if (!use_uefi) {
> -        test_smbios_entry_point(data);
> -        test_smbios_structs(data);
> +        SmbiosEntryPointType ep_type = test_smbios_entry_point(data);
> +        test_smbios_structs(data, ep_type);
>      }
>  
>      qtest_quit(data->qts);



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

* Re: [PATCH v2 4/5] bios-tables-test: add test for number of cores > 255
  2022-07-31 16:21 ` [PATCH v2 4/5] bios-tables-test: add test for number of cores > 255 Julia Suvorova
@ 2022-08-25  7:57   ` Igor Mammedov
  0 siblings, 0 replies; 10+ messages in thread
From: Igor Mammedov @ 2022-08-25  7:57 UTC (permalink / raw)
  To: Julia Suvorova; +Cc: qemu-devel, Michael S. Tsirkin, Ani Sinha

On Sun, 31 Jul 2022 18:21:40 +0200
Julia Suvorova <jusual@redhat.com> wrote:

> The new test is run with a large number of cpus and checks if the
> core_count field in smbios_cpu_test (structure type 4) is correct.
> 
> Choose q35 as it allows to run with -smp > 255.
> 
> Signed-off-by: Julia Suvorova <jusual@redhat.com>

pls, run checkpatch on patches and fix up whatever it complains about
before posting

> ---
>  tests/qtest/bios-tables-test.c | 53 +++++++++++++++++++++++++---------
>  1 file changed, 40 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index e352d5249f..cebfa430ac 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -92,6 +92,8 @@ typedef struct {
>      SmbiosEntryPoint smbios_ep_table;
>      uint16_t smbios_cpu_max_speed;
>      uint16_t smbios_cpu_curr_speed;
> +    uint8_t smbios_core_count;
> +    uint16_t smbios_core_count2;
>      uint8_t *required_struct_types;
>      int required_struct_types_len;
>      QTestState *qts;
> @@ -631,29 +633,38 @@ static inline bool smbios_single_instance(uint8_t type)
>      }
>  }
>  
> -static bool smbios_cpu_test(test_data *data, uint32_t addr)
> +static void smbios_cpu_test(test_data *data, uint32_t addr)
>  {
> -    uint16_t expect_speed[2];
> -    uint16_t real;
> +    uint8_t core_count, expected_core_count = data->smbios_core_count;
> +    uint16_t speed, core_count2, expected_core_count2 = data->smbios_core_count2;
> +    uint16_t expected_speed[2];
>      int offset[2];
>      int i;
>  
>      /* Check CPU speed for backward compatibility */
>      offset[0] = offsetof(struct smbios_type_4, max_speed);
>      offset[1] = offsetof(struct smbios_type_4, current_speed);
> -    expect_speed[0] = data->smbios_cpu_max_speed ? : 2000;
> -    expect_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
> +    expected_speed[0] = data->smbios_cpu_max_speed ? : 2000;
> +    expected_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
>  
>      for (i = 0; i < 2; i++) {
> -        real = qtest_readw(data->qts, addr + offset[i]);
> -        if (real != expect_speed[i]) {
> -            fprintf(stderr, "Unexpected SMBIOS CPU speed: real %u expect %u\n",
> -                    real, expect_speed[i]);
> -            return false;
> -        }
> +        speed = qtest_readw(data->qts, addr + offset[i]);
> +        g_assert_cmpuint(speed, ==, expected_speed[i]);
>      }
>  
> -    return true;
> +    core_count = qtest_readb(data->qts,
> +                             addr + offsetof(struct smbios_type_4, core_count));
> +    core_count2 = qtest_readw(data->qts,
> +                              addr + offsetof(struct smbios_type_4, core_count2));

it doesn't really matter here, that we read bogus core_count2 in case of v2 tables,
but to be cleaner I'd move reads above below respective 'if's 

> +    if (expected_core_count) {
> +        g_assert_cmpuint(core_count, ==, expected_core_count);
> +    }
> +
> +    /* Core Count has reached its limit, checking Core Count 2 */
> +    if (expected_core_count == 0xFF && expected_core_count2) {
> +        g_assert_cmpuint(core_count2, ==, expected_core_count2);
> +    }
>  }
>  
>  static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
> @@ -686,7 +697,7 @@ static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
>          set_bit(type, struct_bitmap);
>  
>          if (type == 4) {
> -            g_assert(smbios_cpu_test(data, addr));
> +            smbios_cpu_test(data, addr);
>          }
>  
>          /* seek to end of unformatted string area of this struct ("\0\0") */
> @@ -903,6 +914,21 @@ static void test_acpi_q35_tcg(void)
>      free_test_data(&data);
>  }
>  
> +static void test_acpi_q35_tcg_core_count2(void)
> +{
> +    test_data data = {
> +        .machine = MACHINE_Q35,
> +        .variant = ".core-count2",
> +        .required_struct_types = base_required_struct_types,
> +        .required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
> +        .smbios_core_count = 0xFF,
> +        .smbios_core_count2 = 275,
> +    };
> +
> +    test_acpi_one("-machine smbios-entry-point-type=64 -smp 275", &data);
> +    free_test_data(&data);
> +}
> +
>  static void test_acpi_q35_tcg_bridge(void)
>  {
>      test_data data;
> @@ -1822,6 +1848,7 @@ int main(int argc, char *argv[])
>          qtest_add_func("acpi/piix4/pci-hotplug/off",
>                         test_acpi_piix4_no_acpi_pci_hotplug);
>          qtest_add_func("acpi/q35", test_acpi_q35_tcg);
> +        qtest_add_func("acpi/q35/core-count2", test_acpi_q35_tcg_core_count2);

shouldn't we have a test for #cpus < 256 as well?

>          qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
>          qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge);
>          qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);



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

end of thread, other threads:[~2022-08-25  8:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-31 16:21 [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Julia Suvorova
2022-07-31 16:21 ` [PATCH v2 1/5] " Julia Suvorova
2022-08-24 16:00   ` Igor Mammedov
2022-07-31 16:21 ` [PATCH v2 2/5] bios-tables-test: teach test to use smbios 3.0 tables Julia Suvorova
2022-08-25  7:37   ` Igor Mammedov
2022-07-31 16:21 ` [PATCH v2 3/5] tests/acpi: allow changes for core_count2 test Julia Suvorova
2022-07-31 16:21 ` [PATCH v2 4/5] bios-tables-test: add test for number of cores > 255 Julia Suvorova
2022-08-25  7:57   ` Igor Mammedov
2022-07-31 16:21 ` [PATCH v2 5/5] tests/acpi: update tables for new core count test Julia Suvorova
2022-08-12  9:46 ` [PATCH v2 0/5] hw/smbios: add core_count2 to smbios table type 4 Michael S. Tsirkin

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.