hw/smbios: add core_count2 to smbios table type 4
v3 cover hw/smbios: add core_count2 to smbios table type 4
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.
v3:
* rebase on fresh master
* crop lines to 80 characters [Igor]
* add conditions for cc2 field check in the test [Igor]
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.c | 19 +++- hw/smbios/smbios_build.h | 9 +- include/hw/firmware/smbios.h | 12 ++ 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 tests/qtest/bios-tables-test.c | 158 ++++++++++++++++++++------- 7 files changed, 156 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
Signature · 1 line
2.37.3
PATCH v3 1/5 hw/smbios: add core_count2 to smbios table type 4
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.
Message-Id: <[email protected]>
--- hw/smbios/smbios.c | 19 ++++++++++++++++--- hw/smbios/smbios_build.h | 9 +++++++-- include/hw/firmware/smbios.h | 12 ++++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-)
hw/smbios/smbios.c +16 -3
@@ -681,8 +681,14 @@ 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 +715,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 */
hw/smbios/smbios_build.h +7 -2
@@ -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 )
include/hw/firmware/smbios.h +12 -0
@@ -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,18 @@ 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;
Signature · 1 line
2.37.3
PATCH v3 2/5 bios-tables-test: teach test to use smbios 3.0 tables
In reply to Julia SuvorovaIntroduce 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).
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test.c | 100 +++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 24 deletions(-)
tests/qtest/bios-tables-test.c +76 -24
@@ -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,33 @@ 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 +808,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);
Signature · 1 line
2.37.3
PATCH v3 3/5 tests/acpi: allow changes for core_count2 test
In reply to Julia SuvorovaMessage-Id: <[email protected]>
--- tests/data/acpi/q35/APIC.core-count2 | 0 tests/data/acpi/q35/DSDT.core-count2 | 0 tests/data/acpi/q35/FACP.core-count2 | 0 tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ 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
tests/data/acpi/q35/APIC.core-count2 new file +0 -0
tests/data/acpi/q35/DSDT.core-count2 new file +0 -0
tests/data/acpi/q35/FACP.core-count2 new file +0 -0
tests/qtest/bios-tables-test-allowed-diff.h +3 -0
@@ -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",
Signature · 1 line
2.37.3
Re: [PATCH v3 3/5] tests/acpi: allow changes for core_count2 test
Quoted 2 lines · On Tue, 11 Oct 2022 13:17:29 +0200 Julia Suvorova <[email protected]> wrote:
Signed-off-by Julia Suvorova <[email protected]>Message-Id: <[email protected]>
Quoted 28 lines
--- tests/data/acpi/q35/APIC.core-count2 | 0 tests/data/acpi/q35/DSDT.core-count2 | 0 tests/data/acpi/q35/FACP.core-count2 | 0 tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ 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-count2tests/data/acpi/q35/APIC.core-count2 new file +0
-0tests/data/acpi/q35/DSDT.core-count2 new file +0
-0tests/data/acpi/q35/FACP.core-count2 new file +0
-0tests/qtest/bios-tables-test-allowed-diff.h +3
-0@@ -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",
PATCH v3 4/5 bios-tables-test: add test for number of cores > 255
In reply to Julia SuvorovaThe 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.
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-)
tests/qtest/bios-tables-test.c +45 -13
@@ -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,42 @@ 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, +SmbiosEntryPointType ep_type) { -uint16_t expect_speed[2 ]; -uint16_t real; +uint8_t core_count, expected_core_count = data->smbios_core_count; +uint16_t speed, expected_speed[2 ]; +uint16_t core_count2, expected_core_count2 = data->smbios_core_count2;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)); + +if (expected_core_count) { + g_assert_cmpuint(core_count, ==, expected_core_count); + } + +if (ep_type ==SMBIOS_ENTRY_POINT_TYPE_64 ) { + core_count2 =qtest_readw (data->qts, + addr + offsetof(struct smbios_type_4 , core_count2)); + +/* 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 +701,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, ep_type); }/* seek to end of unformatted string area of this struct ("\0\0") */
@@ -908,6 +923,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;
@@ -1859,6 +1889,8 @@ int main(int argc, char *argv[])qtest_add_func ("acpi/q35/tpm12-tis" , test_acpi_q35_tcg_tpm12_tis); } +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);
Signature · 1 line
2.37.3
Re: [PATCH v3 4/5] bios-tables-test: add test for number of cores > 255
Quoted 7 lines · On Tue, 11 Oct 2022 13:17:30 +0200 Julia Suvorova <[email protected]> wrote:
The new test is run with a large number of cpus and checks if the
core_countfield insmbios_cpu_test(structure type 4) is correct.Choose q35 as it allows to run with -smp > 255.
Signed-off-by Julia Suvorova <[email protected]>Message-Id: <[email protected]>
Quoted 112 lines
--- tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-)tests/qtest/bios-tables-test.c +45
-13@@ -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,42 @@ 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, +SmbiosEntryPointType ep_type) { -uint16_t expect_speed[2 ]; -uint16_t real; +uint8_t core_count, expected_core_count = data->smbios_core_count; +uint16_t speed, expected_speed[2 ]; +uint16_t core_count2, expected_core_count2 = data->smbios_core_count2;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)); + +if (expected_core_count) { + g_assert_cmpuint(core_count, ==, expected_core_count); + } + +if (ep_type ==SMBIOS_ENTRY_POINT_TYPE_64 ) { + core_count2 =qtest_readw (data->qts, + addr + offsetof(struct smbios_type_4 , core_count2)); + +/* 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 +701,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, ep_type); }/* seek to end of unformatted string area of this struct ("\0\0") */ @@ -908,6 +923,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;@@ -1859,6 +1889,8 @@ int main(int argc, char *argv[])qtest_add_func ("acpi/q35/tpm12-tis" , test_acpi_q35_tcg_tpm12_tis); } +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);
PATCH v3 5/5 tests/acpi: update tables for new core count test
In reply to Julia SuvorovaChanges 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)
+ }
+ }
+
...
Message-Id: <[email protected]>
--- 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 tests/qtest/bios-tables-test-allowed-diff.h | 3 --- 4 files changed, 3 deletions(-)
tests/data/acpi/q35/APIC.core-count2 binary +0 -0
tests/data/acpi/q35/DSDT.core-count2 binary +0 -0
tests/data/acpi/q35/FACP.core-count2 binary +0 -0
tests/qtest/bios-tables-test-allowed-diff.h +0 -3
@@ -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",
Signature · 1 line
2.37.3
Re: [PATCH v3 5/5] tests/acpi: update tables for new core count test
Quoted 102 lines · Julia Suvorova
Changes in the tables (for 275 cores):
FACP:
+ Use APIC Cluster Model (V4) : 1APIC:
+[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(quoted diff) +17
-0+ 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 : 000000FFDSDT:
(quoted diff) +68
-0+ 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) + } + } +
Quoted 2 lines
Signed-off-by Julia Suvorova <[email protected]>Message-Id: <[email protected]>
I had to rebase pushed last update to my tree. Could you pls disassemble and verify it's correct? Thanks!
Signature · 1 line
MST
Re: [PATCH v3 5/5] tests/acpi: update tables for new core count test
Quoted 103 lines · On Thu, 27 Oct 2022 02:11:23 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 102 lines · Julia Suvorova
Changes in the tables (for 275 cores):
FACP:
+ Use APIC Cluster Model (V4) : 1APIC:
+[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(quoted diff) +17
-0+ 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 : 000000FFDSDT:
(quoted diff) +68
-0+ 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) + } + } +
Quoted 7 lines
Quoted 2 lines
Signed-off-by Julia Suvorova <[email protected]>Message-Id: <[email protected]>
I had to rebase pushed last update to my tree. Could you pls disassemble and verify it's correct? Thanks!
new lobs look correct,
though I'd mention in commit log relevant FACP bits:
+ Use APIC Cluster Model (V4) : 1