hw/smbios: add core_count2 to smbios table type 4
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.
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
include/hw/firmware/smbios.h | 3 + hw/smbios/smbios.c | 11 ++- tests/qtest/bios-tables-test.c | 136 +++++++++++++++++++++------ tests/data/acpi/q35/APIC.core-count2 | Bin 0 -> 2478 bytes tests/data/acpi/q35/DSDT.core-count2 | Bin 0 -> 32429 bytes tests/data/acpi/q35/FACP.core-count2 | Bin 0 -> 244 bytes 6 files changed, 121 insertions(+), 29 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.35.1
PATCH 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.
--- include/hw/firmware/smbios.h | 3 +++ hw/smbios/smbios.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
include/hw/firmware/smbios.h +3 -0
@@ -187,6 +187,9 @@ struct smbios_type_4 {uint8_t thread_count;uint16_t processor_characteristics;uint16_t processor_family2; +uint16_t core_count2; +uint16_t core_enabled2; +uint16_t thread_count2; }QEMU_PACKED ;/* SMBIOS type 11 - OEM strings */
hw/smbios/smbios.c +9 -2
@@ -709,8 +709,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 */
Signature · 1 line
2.35.1
Quoted 9 lines · 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_count2which acts as a duplicate ofcore_countif we have fewer cores than 256, and contains the actual core number per socket if we have more.
core_enabled2andthread_count2fields work the same way.Signed-off-by Julia Suvorova <[email protected]>
Other than the comment below,
Quoted 10 lines
--- include/hw/firmware/smbios.h | 3 +++ hw/smbios/smbios.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)include/hw/firmware/smbios.h +0
-0
include/hw/firmware/smbios.h struct smbios_type_4 { · line 192
Quoted 6 lines
include/hw/firmware/smbios.h +3
-0@@ -187,6 +187,9 @@ struct smbios_type_4 {uint8_t thread_count;uint16_t processor_characteristics;uint16_t processor_family2; +uint16_t core_count2; +uint16_t core_enabled2; +uint16_t thread_count2;
I would add a comment along the lines of
/* section 7.5, table 21 smbios spec version 3.0.0 */
Quoted 29 lines
include/hw/firmware/smbios.h +0
-0}QEMU_PACKED ;/* SMBIOS type 11 - OEM strings */ hw/smbios/smbios.c +9
-3@@ -709,8 +709,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.1
Quoted 23 lines · Ani Sinha
Quoted 9 lines · 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_count2which acts as a duplicate ofcore_countif we have fewer cores than 256, and contains the actual core number per socket if we have more.
core_enabled2andthread_count2fields work the same way.Signed-off-by Julia Suvorova <[email protected]>Other than the comment below,
Reviewed-by Ani Sinha <[email protected]>Quoted 5 lines
--- include/hw/firmware/smbios.h | 3 +++ hw/smbios/smbios.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
Quoted 14 lines
include/hw/firmware/smbios.h struct smbios_type_4 { · line 192
Quoted 11 lines
include/hw/firmware/smbios.h +3
-0@@ -187,6 +187,9 @@ struct smbios_type_4 {uint8_t thread_count;uint16_t processor_characteristics;uint16_t processor_family2; +uint16_t core_count2; +uint16_t core_enabled2; +uint16_t thread_count2;I would add a comment along the lines of
/* section 7.5, table 21 smbios spec version 3.0.0 */
Ok
Quoted 30 lines
Quoted 29 lines
include/hw/firmware/smbios.h +0
-0}QEMU_PACKED ;/* SMBIOS type 11 - OEM strings */ hw/smbios/smbios.c +9
-3@@ -709,8 +709,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.1
Igor Mammedov
Reviewed-byQuoted 39 lines · On Tue, 31 May 2022 14:40:15 +0200 Julia Suvorova <[email protected]> wrote:
Quoted 23 lines · Ani Sinha
Quoted 9 lines · 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_count2which acts as a duplicate ofcore_countif we have fewer cores than 256, and contains the actual core number per socket if we have more.
core_enabled2andthread_count2fields work the same way.Signed-off-by Julia Suvorova <[email protected]>Other than the comment below,
Reviewed-by Ani Sinha <[email protected]>Quoted 5 lines
--- include/hw/firmware/smbios.h | 3 +++ hw/smbios/smbios.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)Quoted 14 lines
include/hw/firmware/smbios.h struct smbios_type_4 { · line 192
Quoted 11 lines
include/hw/firmware/smbios.h +3
-0@@ -187,6 +187,9 @@ struct smbios_type_4 {uint8_t thread_count;uint16_t processor_characteristics;uint16_t processor_family2; +uint16_t core_count2; +uint16_t core_enabled2; +uint16_t thread_count2;I would add a comment along the lines of
/* section 7.5, table 21 smbios spec version 3.0.0 */
Quoted 1 line
Ok
With Ani's comment fixed
Quoted 32 lines
Quoted 31 lines
Quoted 30 lines
include/hw/firmware/smbios.h +0
-0}QEMU_PACKED ;/* SMBIOS type 11 - OEM strings */ hw/smbios/smbios.c +9
-3@@ -709,8 +709,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.1
Quoted 27 lines · On Thu, 2 Jun 2022 16:31:25 +0200 Igor Mammedov <[email protected]> wrote:
Quoted 24 lines · On Tue, 31 May 2022 14:40:15 +0200 Julia Suvorova <[email protected]> wrote:
Quoted 23 lines · Ani Sinha
Quoted 9 lines · 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_count2which acts as a duplicate ofcore_countif we have fewer cores than 256, and contains the actual core number per socket if we have more.
core_enabled2andthread_count2fields work the same way.Signed-off-by Julia Suvorova <[email protected]>Other than the comment below,
Reviewed-by Ani Sinha <[email protected]>Quoted 5 lines
--- include/hw/firmware/smbios.h | 3 +++ hw/smbios/smbios.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
include/hw/firmware/smbios.h struct smbios_type_4 { · line 192
Quoted 11 lines
include/hw/firmware/smbios.h +3
-0@@ -187,6 +187,9 @@ struct smbios_type_4 {uint8_t thread_count;uint16_t processor_characteristics;uint16_t processor_family2; +uint16_t core_count2; +uint16_t core_enabled2; +uint16_t thread_count2;
on the other hand,
is it ok unconditionally extend type 4 and use v3 structure if qemu was started with v2 smbios?
Quoted 43 lines
Quoted 5 lines
Quoted 3 lines
I would add a comment along the lines of
/* section 7.5, table 21 smbios spec version 3.0.0 */Ok
With Ani's comment fixed
Reviewed-by Igor Mammedov <[email protected]>Quoted 32 lines
Quoted 31 lines
Quoted 30 lines
include/hw/firmware/smbios.h +0
-0}QEMU_PACKED ;/* SMBIOS type 11 - OEM strings */ hw/smbios/smbios.c +9
-3@@ -709,8 +709,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.1
Quoted 31 lines · Igor Mammedov
Quoted 27 lines · On Thu, 2 Jun 2022 16:31:25 +0200 Igor Mammedov <[email protected]> wrote:
Quoted 24 lines · On Tue, 31 May 2022 14:40:15 +0200 Julia Suvorova <[email protected]> wrote:
Quoted 23 lines · Ani Sinha
Quoted 9 lines · 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_count2which acts as a duplicate ofcore_countif we have fewer cores than 256, and contains the actual core number per socket if we have more.
core_enabled2andthread_count2fields work the same way.Signed-off-by Julia Suvorova <[email protected]>Other than the comment below,
Reviewed-by Ani Sinha <[email protected]>Quoted 5 lines
--- include/hw/firmware/smbios.h | 3 +++ hw/smbios/smbios.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
Quoted 15 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
include/hw/firmware/smbios.h struct smbios_type_4 { · line 192
Quoted 11 lines
include/hw/firmware/smbios.h +3
-0@@ -187,6 +187,9 @@ struct smbios_type_4 {uint8_t thread_count;uint16_t processor_characteristics;uint16_t processor_family2; +uint16_t core_count2; +uint16_t core_enabled2; +uint16_t thread_count2;on the other hand,
is it ok unconditionally extend type 4 and use v3 structure if qemu was started with v2 smbios?
We have a flag for the entry point type, not the smbios version per se. Additional fields added to structures were not previously tracked (for instance, processor_family2 is v2.6 and status is v2.0). AFAIU it can affect only the total table length and the maximum structure size (word). But if you like, I can raise an error (warning) if someone tries to start a vm with cpus > 255 and smbios v2.
Best regards, Julia Suvorova.
Quoted 44 lines
Quoted 43 lines
Quoted 5 lines
Quoted 3 lines
I would add a comment along the lines of
/* section 7.5, table 21 smbios spec version 3.0.0 */Ok
With Ani's comment fixed
Reviewed-by Igor Mammedov <[email protected]>Quoted 32 lines
Quoted 31 lines
Quoted 30 lines
include/hw/firmware/smbios.h +0
-0}QEMU_PACKED ;/* SMBIOS type 11 - OEM strings */ hw/smbios/smbios.c +9
-3@@ -709,8 +709,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.1
Quoted 48 lines · On Mon, 6 Jun 2022 13:11:36 +0200 Julia Suvorova <[email protected]> wrote:
Quoted 31 lines · Igor Mammedov
Quoted 27 lines · On Thu, 2 Jun 2022 16:31:25 +0200 Igor Mammedov <[email protected]> wrote:
Quoted 24 lines · On Tue, 31 May 2022 14:40:15 +0200 Julia Suvorova <[email protected]> wrote:
Quoted 23 lines · Ani Sinha
Quoted 9 lines · 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_count2which acts as a duplicate ofcore_countif we have fewer cores than 256, and contains the actual core number per socket if we have more.
core_enabled2andthread_count2fields work the same way.Signed-off-by Julia Suvorova <[email protected]>Other than the comment below,
Reviewed-by Ani Sinha <[email protected]>Quoted 5 lines
--- include/hw/firmware/smbios.h | 3 +++ hw/smbios/smbios.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)Quoted 15 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
include/hw/firmware/smbios.h struct smbios_type_4 { · line 192
Quoted 11 lines
include/hw/firmware/smbios.h +3
-0@@ -187,6 +187,9 @@ struct smbios_type_4 {uint8_t thread_count;uint16_t processor_characteristics;uint16_t processor_family2; +uint16_t core_count2; +uint16_t core_enabled2; +uint16_t thread_count2;on the other hand,
is it ok unconditionally extend type 4 and use v3 structure if qemu was started with v2 smbios?
Quoted 3 lines
We have a flag for the entry point type, not the smbios version per se. Additional fields added to structures were not previously tracked (for instance,
processor_family2is v2.6 and status is v2.0). AFAIU it
that's a bug, unless there is a very good reason to keep doing that, I'd not do that.
Quoted 1 line
can affect only the total table length and the maximum structure size
table length is fixed depending on used version,
so if we follow it, we should set length and use part of structure correctly if old version is specified (i.e.
1. old structure + v30 structure,
2. copy only a relevant part of v30 structure and fixup length when v2 version is asked for
though, I'd prefer #1
Quoted 2 lines
(word). But if you like, I can raise an error (warning) if someone tries to start a vm with cpus > 255 and smbios v2.
it's a separate thing, I'd error out
(it will break users that use v2 with too may CPUs but then they should fix their configuration to use v3)
Quoted 47 lines
Best regards, Julia Suvorova.
Quoted 44 lines
Quoted 43 lines
Quoted 5 lines
Quoted 3 lines
I would add a comment along the lines of
/* section 7.5, table 21 smbios spec version 3.0.0 */Ok
With Ani's comment fixed
Reviewed-by Igor Mammedov <[email protected]>Quoted 32 lines
Quoted 31 lines
Quoted 30 lines
include/hw/firmware/smbios.h +0
-0}QEMU_PACKED ;/* SMBIOS type 11 - OEM strings */ hw/smbios/smbios.c +9
-3@@ -709,8 +709,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.1
PATCH 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).
--- tests/qtest/bios-tables-test.c | 101 ++++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 26 deletions(-)
tests/qtest/bios-tables-test.c +75 -26
@@ -75,6 +75,14 @@#define OEM_TEST_ARGS "-machine x-oem-id=" OEM_ID ",x-oem-table-id=" \ OEM_TABLE_ID +#define SMBIOS_VER21 0 +#define SMBIOS_VER30 1 + +typedef struct { +struct smbios_21_entry_point ep21; +struct smbios_30_entry_point ep30; +}smbios_entry_point ; + typedef struct { bool tcg_only; const char *machine;
@@ -88,8 +96,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[2 ]; +smbios_entry_point smbios_ep_table;uint16_t smbios_cpu_max_speed;uint16_t smbios_cpu_curr_speed;uint8_t *required_struct_types;
@@ -533,10 +541,10 @@ 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) { -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; +uint32_t addr = data->smbios_ep_addr[SMBIOS_VER21 ];qtest_memread (data->qts, addr, ep_table,sizeof (*ep_table));if (memcmp (ep_table->anchor_string,"_SM_" ,4 )) {
@@ -559,29 +567,59 @@ 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) +{ +struct smbios_30_entry_point *ep_table = &data->smbios_ep_table.ep30; +uint64_t addr = data->smbios_ep_addr[SMBIOS_VER30 ]; + +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 int test_smbios_entry_point (test_data *data) {uint32_t off; +bool found_ep2 = false, found_ep3 = false;/* find smbios entry point structure */ for (off =0xf0000 ; off <0x100000 ; off +=0x10 ) { -uint8_t sig[] ="_SM_" ; +uint8_t sig[] ="_SM3_" ;int i;for (i =0 ; i <sizeof sig -1 ; ++i) { sig[i] =qtest_readb (data->qts, off + i); } -if (!memcmp (sig,"_SM_" ,sizeof sig)) { +if (!found_ep2 && !memcmp (sig,"_SM_" ,sizeof sig -2 )) {/* signature match, but is this a valid entry point? */ - data->smbios_ep_addr = off; -if (smbios_ep_table_ok (data)) { -break ; + data->smbios_ep_addr[SMBIOS_VER21 ] = off; +if (smbios_ep2_table_ok (data)) { + found_ep2 = true; + } + }else if (!found_ep3 && !memcmp (sig,"_SM3_" ,sizeof sig -1 )) { + data->smbios_ep_addr[SMBIOS_VER30 ] = off; +if (smbios_ep3_table_ok (data)) { + found_ep3 = true; } } + +if (found_ep2 || found_ep3) { +break ; + } } - g_assert_cmphex(off, <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER21], <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER30], <, 0x100000); + +return found_ep3 ?SMBIOS_VER30 :SMBIOS_VER21 ; }static inline bool smbios_single_instance (uint8_t type)
@@ -625,16 +663,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,int ver) { 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 ; + +smbios_entry_point *ep_table = &data->smbios_ep_table; +int i =0 , len, max_len =0 ;uint8_t type, prv, crt; +uint64_t addr; + +if (ver ==SMBIOS_VER21 ) { + 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 +705,23 @@ static void test_smbios_structs(test_data *data) }/* keep track of max. struct size */ -if (max_len < len) { +if (ver ==SMBIOS_VER21 && 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); + }while (ver ==SMBIOS_VER21 ? + (++i <le16_to_cpu (ep_table->ep21.number_of_structures)) : (type !=127 )); + +if (ver ==SMBIOS_VER21 ) { +/* 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 +805,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); +int ver =test_smbios_entry_point (data); +test_smbios_structs (data, ver); }qtest_quit (data->qts);
Signature · 1 line
2.35.1
Re: [PATCH 2/5] bios-tables-test: teach test to use smbios 3.0 tables
Quoted 161 lines · 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 <[email protected]>--- tests/qtest/bios-tables-test.c | 101 ++++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 26 deletions(-)tests/qtest/bios-tables-test.c +64
-19@@ -75,6 +75,14 @@#define OEM_TEST_ARGS "-machine x-oem-id=" OEM_ID ",x-oem-table-id=" \ OEM_TABLE_ID +#define SMBIOS_VER21 0 +#define SMBIOS_VER30 1 + +typedef struct { +struct smbios_21_entry_point ep21; +struct smbios_30_entry_point ep30; +}smbios_entry_point ; + typedef struct { bool tcg_only; const char *machine;@@ -88,8 +96,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[2 ]; +smbios_entry_point smbios_ep_table;uint16_t smbios_cpu_max_speed;uint16_t smbios_cpu_curr_speed;uint8_t *required_struct_types;@@ -533,10 +541,10 @@ 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) { -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; +uint32_t addr = data->smbios_ep_addr[SMBIOS_VER21 ];qtest_memread (data->qts, addr, ep_table,sizeof (*ep_table));if (memcmp (ep_table->anchor_string,"_SM_" ,4 )) {@@ -559,29 +567,59 @@ 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) +{ +struct smbios_30_entry_point *ep_table = &data->smbios_ep_table.ep30; +uint64_t addr = data->smbios_ep_addr[SMBIOS_VER30 ]; + +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 int test_smbios_entry_point (test_data *data) {uint32_t off; +bool found_ep2 = false, found_ep3 = false;/* find smbios entry point structure */ for (off =0xf0000 ; off <0x100000 ; off +=0x10 ) { -uint8_t sig[] ="_SM_" ; +uint8_t sig[] ="_SM3_" ;int i;for (i =0 ; i <sizeof sig -1 ; ++i) { sig[i] =qtest_readb (data->qts, off + i); } -if (!memcmp (sig,"_SM_" ,sizeof sig)) { +if (!found_ep2 && !memcmp (sig,"_SM_" ,sizeof sig -2 )) {/* signature match, but is this a valid entry point? */ - data->smbios_ep_addr = off; -if (smbios_ep_table_ok (data)) { -break ; + data->smbios_ep_addr[SMBIOS_VER21 ] = off; +if (smbios_ep2_table_ok (data)) { + found_ep2 = true; + } + }else if (!found_ep3 && !memcmp (sig,"_SM3_" ,sizeof sig -1 )) { + data->smbios_ep_addr[SMBIOS_VER30 ] = off; +if (smbios_ep3_table_ok (data)) { + found_ep3 = true; } } + +if (found_ep2 || found_ep3) { +break ; + } } - g_assert_cmphex(off, <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER21], <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER30], <, 0x100000); + +return found_ep3 ?SMBIOS_VER30 :SMBIOS_VER21 ; }static inline bool smbios_single_instance (uint8_t type)@@ -625,16 +663,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,int ver) { 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 ; + +smbios_entry_point *ep_table = &data->smbios_ep_table; +int i =0 , len, max_len =0 ;uint8_t type, prv, crt; +uint64_t addr; + +if (ver ==SMBIOS_VER21 ) { + 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 +705,23 @@ static void test_smbios_structs(test_data *data) }/* keep track of max. struct size */ -if (max_len < len) { +if (ver ==SMBIOS_VER21 && 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); }
tests/qtest/bios-tables-test.c static void test_smbios_structs(test_data *data) · line 717
Quoted 10 lines
tests/qtest/bios-tables-test.c +2
-5/* 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); + }while (ver ==SMBIOS_VER21 ? + (++i <le16_to_cpu (ep_table->ep21.number_of_structures)) : (type !=127 ));
This is quite an unreadable way to specify the loop condition. I wonder if there is a better way to structure this.
Secondly, instead of hardcoding 127 why do we not say (type < SMBIOS_MAX_TYPE) ?
Quoted 24 lines
tests/qtest/bios-tables-test.c +9
-3+ +if (ver ==SMBIOS_VER21 ) { +/* 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 +805,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); +int ver =test_smbios_entry_point (data); +test_smbios_structs (data, ver); }qtest_quit (data->qts); --2.35.1
Re: [PATCH 2/5] bios-tables-test: teach test to use smbios 3.0 tables
Quoted 167 lines · Ani Sinha
Quoted 165 lines · 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 <[email protected]>--- tests/qtest/bios-tables-test.c | 101 ++++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 26 deletions(-)tests/qtest/bios-tables-test.c +64
-20@@ -75,6 +75,14 @@#define OEM_TEST_ARGS "-machine x-oem-id=" OEM_ID ",x-oem-table-id=" \ OEM_TABLE_ID +#define SMBIOS_VER21 0 +#define SMBIOS_VER30 1 + +typedef struct { +struct smbios_21_entry_point ep21; +struct smbios_30_entry_point ep30; +}smbios_entry_point ; + typedef struct { bool tcg_only; const char *machine;@@ -88,8 +96,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[2 ]; +smbios_entry_point smbios_ep_table;uint16_t smbios_cpu_max_speed;uint16_t smbios_cpu_curr_speed;uint8_t *required_struct_types;@@ -533,10 +541,10 @@ 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) { -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; +uint32_t addr = data->smbios_ep_addr[SMBIOS_VER21 ];qtest_memread (data->qts, addr, ep_table,sizeof (*ep_table));if (memcmp (ep_table->anchor_string,"_SM_" ,4 )) {@@ -559,29 +567,59 @@ 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) +{ +struct smbios_30_entry_point *ep_table = &data->smbios_ep_table.ep30; +uint64_t addr = data->smbios_ep_addr[SMBIOS_VER30 ]; + +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 int test_smbios_entry_point (test_data *data) {uint32_t off; +bool found_ep2 = false, found_ep3 = false;/* find smbios entry point structure */ for (off =0xf0000 ; off <0x100000 ; off +=0x10 ) { -uint8_t sig[] ="_SM_" ; +uint8_t sig[] ="_SM3_" ;int i;for (i =0 ; i <sizeof sig -1 ; ++i) { sig[i] =qtest_readb (data->qts, off + i); } -if (!memcmp (sig,"_SM_" ,sizeof sig)) { +if (!found_ep2 && !memcmp (sig,"_SM_" ,sizeof sig -2 )) {/* signature match, but is this a valid entry point? */ - data->smbios_ep_addr = off; -if (smbios_ep_table_ok (data)) { -break ; + data->smbios_ep_addr[SMBIOS_VER21 ] = off; +if (smbios_ep2_table_ok (data)) { + found_ep2 = true; + } + }else if (!found_ep3 && !memcmp (sig,"_SM3_" ,sizeof sig -1 )) { + data->smbios_ep_addr[SMBIOS_VER30 ] = off; +if (smbios_ep3_table_ok (data)) { + found_ep3 = true; } } + +if (found_ep2 || found_ep3) { +break ; + } } - g_assert_cmphex(off, <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER21], <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER30], <, 0x100000); + +return found_ep3 ?SMBIOS_VER30 :SMBIOS_VER21 ; }static inline bool smbios_single_instance (uint8_t type)@@ -625,16 +663,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,int ver) { 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 ; + +smbios_entry_point *ep_table = &data->smbios_ep_table; +int i =0 , len, max_len =0 ;uint8_t type, prv, crt; +uint64_t addr; + +if (ver ==SMBIOS_VER21 ) { + 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 +705,23 @@ static void test_smbios_structs(test_data *data) }/* keep track of max. struct size */ -if (max_len < len) { +if (ver ==SMBIOS_VER21 && 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; - }
Quoted 10 lines
tests/qtest/bios-tables-test.c static void test_smbios_structs(test_data *data) · line 717
Quoted 6 lines
tests/qtest/bios-tables-test.c +2
-4-/* 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); + }while (ver ==SMBIOS_VER21 ? + (++i <le16_to_cpu (ep_table->ep21.number_of_structures)) : (type !=127 ));This is quite an unreadable way to specify the loop condition. I wonder if there is a better way to structure this.
Secondly, instead of hardcoding 127 why do we not say (type <SMBIOS_MAX_TYPE) ?
Here we are looking for a special structure type 127. There can be up to 256 structure types, and they can be placed before the final structure.
But it seems like we need to change SMBIOS_MAX_TYPE in the test.
Quoted 25 lines
Quoted 24 lines
tests/qtest/bios-tables-test.c +9
-3+ +if (ver ==SMBIOS_VER21 ) { +/* 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 +805,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); +int ver =test_smbios_entry_point (data); +test_smbios_structs (data, ver); }qtest_quit (data->qts); --2.35.1
Re: [PATCH 2/5] bios-tables-test: teach test to use smbios 3.0 tables
In reply to Julia SuvorovaQuoted 74 lines · On Fri, 27 May 2022 18:56:48 +0200 Julia Suvorova <[email protected]> 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).
Signed-off-by Julia Suvorova <[email protected]>--- tests/qtest/bios-tables-test.c | 101 ++++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 26 deletions(-)tests/qtest/bios-tables-test.c +29
-6@@ -75,6 +75,14 @@#define OEM_TEST_ARGS "-machine x-oem-id=" OEM_ID ",x-oem-table-id=" \ OEM_TABLE_ID +#define SMBIOS_VER21 0 +#define SMBIOS_VER30 1 + +typedef struct { +struct smbios_21_entry_point ep21; +struct smbios_30_entry_point ep30; +}smbios_entry_point ; + typedef struct { bool tcg_only; const char *machine;@@ -88,8 +96,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[2 ]; +smbios_entry_point smbios_ep_table;uint16_t smbios_cpu_max_speed;uint16_t smbios_cpu_curr_speed;uint8_t *required_struct_types;@@ -533,10 +541,10 @@ 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) { -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; +uint32_t addr = data->smbios_ep_addr[SMBIOS_VER21 ];qtest_memread (data->qts, addr, ep_table,sizeof (*ep_table));if (memcmp (ep_table->anchor_string,"_SM_" ,4 )) {@@ -559,29 +567,59 @@ 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) +{ +struct smbios_30_entry_point *ep_table = &data->smbios_ep_table.ep30; +uint64_t addr = data->smbios_ep_addr[SMBIOS_VER30 ]; + +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; +}
tests/qtest/bios-tables-test.c static bool smbios_ep_table_ok(test_data *data) · line 594
Quoted 10 lines
tests/qtest/bios-tables-test.c +4
-1+ +static int test_smbios_entry_point (test_data *data) {uint32_t off; +bool found_ep2 = false, found_ep3 = false;/* find smbios entry point structure */ for (off =0xf0000 ; off <0x100000 ; off +=0x10 ) { -uint8_t sig[] ="_SM_" ; +uint8_t sig[] ="_SM3_" ;
well I'd just add a separate sig3
tests/qtest/bios-tables-test.c static bool smbios_ep_table_ok(test_data *data) · line 601
Quoted 8 lines
tests/qtest/bios-tables-test.c +1
-1int i;for (i =0 ; i <sizeof sig -1 ; ++i) { sig[i] =qtest_readb (data->qts, off + i); } -if (!memcmp (sig,"_SM_" ,sizeof sig)) { +if (!found_ep2 && !memcmp (sig,"_SM_" ,sizeof sig -2 )) {
keep original v2 code and just add similar chunk for v3,
drop found_foo locals,
that should make it easier to read/follow
(i.e. less conditions to think about and no magic fiddling with the length of signature)
Quoted 15 lines
tests/qtest/bios-tables-test.c +9
-3/* signature match, but is this a valid entry point? */ - data->smbios_ep_addr = off; -if (smbios_ep_table_ok (data)) { -break ; + data->smbios_ep_addr[SMBIOS_VER21 ] = off; +if (smbios_ep2_table_ok (data)) { + found_ep2 = true; + } + }else if (!found_ep3 && !memcmp (sig,"_SM3_" ,sizeof sig -1 )) { + data->smbios_ep_addr[SMBIOS_VER30 ] = off; +if (smbios_ep3_table_ok (data)) { + found_ep3 = true; } } +
tests/qtest/bios-tables-test.c static bool smbios_ep_table_ok(test_data *data) · line 622
Quoted 10 lines
tests/qtest/bios-tables-test.c +7
-1+if (found_ep2 || found_ep3) { +break ; + } } - g_assert_cmphex(off, <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER21], <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER30], <, 0x100000); + +return found_ep3 ?SMBIOS_VER30 :SMBIOS_VER21 ;
and use content of data->smbios_ep_addr[] to return found version
Quoted 74 lines
tests/qtest/bios-tables-test.c +25
-14}static inline bool smbios_single_instance (uint8_t type)@@ -625,16 +663,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,int ver) { 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 ; + +smbios_entry_point *ep_table = &data->smbios_ep_table; +int i =0 , len, max_len =0 ;uint8_t type, prv, crt; +uint64_t addr; + +if (ver ==SMBIOS_VER21 ) { + 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 +705,23 @@ static void test_smbios_structs(test_data *data) }/* keep track of max. struct size */ -if (max_len < len) { +if (ver ==SMBIOS_VER21 && 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); + }while (ver ==SMBIOS_VER21 ? + (++i <le16_to_cpu (ep_table->ep21.number_of_structures)) : (type !=127 )); + +if (ver ==SMBIOS_VER21 ) { +/* 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 +805,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); +int ver =test_smbios_entry_point (data); +test_smbios_structs (data, ver); }qtest_quit (data->qts);
Re: [PATCH 2/5] bios-tables-test: teach test to use smbios 3.0 tables
Quoted 84 lines · Igor Mammedov
Quoted 80 lines · On Fri, 27 May 2022 18:56:48 +0200 Julia Suvorova <[email protected]> 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).
Signed-off-by Julia Suvorova <[email protected]>--- tests/qtest/bios-tables-test.c | 101 ++++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 26 deletions(-)tests/qtest/bios-tables-test.c +32
-6@@ -75,6 +75,14 @@#define OEM_TEST_ARGS "-machine x-oem-id=" OEM_ID ",x-oem-table-id=" \ OEM_TABLE_ID +#define SMBIOS_VER21 0 +#define SMBIOS_VER30 1 + +typedef struct { +struct smbios_21_entry_point ep21; +struct smbios_30_entry_point ep30; +}smbios_entry_point ; + typedef struct { bool tcg_only; const char *machine;@@ -88,8 +96,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[2 ]; +smbios_entry_point smbios_ep_table;uint16_t smbios_cpu_max_speed;uint16_t smbios_cpu_curr_speed;uint8_t *required_struct_types;@@ -533,10 +541,10 @@ 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) { -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; +uint32_t addr = data->smbios_ep_addr[SMBIOS_VER21 ];qtest_memread (data->qts, addr, ep_table,sizeof (*ep_table));if (memcmp (ep_table->anchor_string,"_SM_" ,4 )) {@@ -559,29 +567,59 @@ 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) +{ +struct smbios_30_entry_point *ep_table = &data->smbios_ep_table.ep30; +uint64_t addr = data->smbios_ep_addr[SMBIOS_VER30 ]; + +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 int test_smbios_entry_point (test_data *data) {uint32_t off; +bool found_ep2 = false, found_ep3 = false;
Quoted 6 lines
tests/qtest/bios-tables-test.c static bool smbios_ep_table_ok(test_data *data) · line 594
Quoted 4 lines
tests/qtest/bios-tables-test.c +1
-1/* find smbios entry point structure */ for (off =0xf0000 ; off <0x100000 ; off +=0x10 ) { -uint8_t sig[] ="_SM_" ; +uint8_t sig[] ="_SM3_" ;well I'd just add a separate sig3
Ok
Quoted 6 lines
Quoted 6 lines
tests/qtest/bios-tables-test.c +0
-0int i;for (i =0 ; i <sizeof sig -1 ; ++i) { sig[i] =qtest_readb (data->qts, off + i); }
Quoted 7 lines
tests/qtest/bios-tables-test.c static bool smbios_ep_table_ok(test_data *data) · line 601
Quoted 2 lines
tests/qtest/bios-tables-test.c +1
-1-if (!memcmp (sig,"_SM_" ,sizeof sig)) { +if (!found_ep2 && !memcmp (sig,"_SM_" ,sizeof sig -2 )) {keep original v2 code and just add similar chunk for v3,
dropfound_foolocals,
that should make it easier to read/follow
(i.e. less conditions to think about and no magic fiddling with the length of signature)
The idea was to reuse existing code, but since it doesn't improve things much, it makes sense to repeat it.
Quoted 20 lines
Quoted 20 lines
tests/qtest/bios-tables-test.c +12
-3/* signature match, but is this a valid entry point? */ - data->smbios_ep_addr = off; -if (smbios_ep_table_ok (data)) { -break ; + data->smbios_ep_addr[SMBIOS_VER21 ] = off; +if (smbios_ep2_table_ok (data)) { + found_ep2 = true; + } + }else if (!found_ep3 && !memcmp (sig,"_SM3_" ,sizeof sig -1 )) { + data->smbios_ep_addr[SMBIOS_VER30 ] = off; +if (smbios_ep3_table_ok (data)) { + found_ep3 = true; } } + +if (found_ep2 || found_ep3) { +break ; + } }
Quoted 7 lines
tests/qtest/bios-tables-test.c static bool smbios_ep_table_ok(test_data *data) · line 622
Quoted 5 lines
tests/qtest/bios-tables-test.c +4
-1- g_assert_cmphex(off, <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER21], <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER30], <, 0x100000); + +return found_ep3 ?SMBIOS_VER30 :SMBIOS_VER21 ;and use content of data->smbios_ep_addr[] to return found version
You mean check if it's initialized?
Quoted 75 lines
Quoted 74 lines
tests/qtest/bios-tables-test.c +25
-14}static inline bool smbios_single_instance (uint8_t type)@@ -625,16 +663,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,int ver) { 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 ; + +smbios_entry_point *ep_table = &data->smbios_ep_table; +int i =0 , len, max_len =0 ;uint8_t type, prv, crt; +uint64_t addr; + +if (ver ==SMBIOS_VER21 ) { + 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 +705,23 @@ static void test_smbios_structs(test_data *data) }/* keep track of max. struct size */ -if (max_len < len) { +if (ver ==SMBIOS_VER21 && 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); + }while (ver ==SMBIOS_VER21 ? + (++i <le16_to_cpu (ep_table->ep21.number_of_structures)) : (type !=127 )); + +if (ver ==SMBIOS_VER21 ) { +/* 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 +805,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); +int ver =test_smbios_entry_point (data); +test_smbios_structs (data, ver); }qtest_quit (data->qts);
Re: [PATCH 2/5] bios-tables-test: teach test to use smbios 3.0 tables
Quoted 139 lines · On Mon, 6 Jun 2022 12:52:00 +0200 Julia Suvorova <[email protected]> wrote:
Quoted 84 lines · Igor Mammedov
Quoted 80 lines · On Fri, 27 May 2022 18:56:48 +0200 Julia Suvorova <[email protected]> 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).
Signed-off-by Julia Suvorova <[email protected]>--- tests/qtest/bios-tables-test.c | 101 ++++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 26 deletions(-)tests/qtest/bios-tables-test.c +32
-6@@ -75,6 +75,14 @@#define OEM_TEST_ARGS "-machine x-oem-id=" OEM_ID ",x-oem-table-id=" \ OEM_TABLE_ID +#define SMBIOS_VER21 0 +#define SMBIOS_VER30 1 + +typedef struct { +struct smbios_21_entry_point ep21; +struct smbios_30_entry_point ep30; +}smbios_entry_point ; + typedef struct { bool tcg_only; const char *machine;@@ -88,8 +96,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[2 ]; +smbios_entry_point smbios_ep_table;uint16_t smbios_cpu_max_speed;uint16_t smbios_cpu_curr_speed;uint8_t *required_struct_types;@@ -533,10 +541,10 @@ 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) { -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; +uint32_t addr = data->smbios_ep_addr[SMBIOS_VER21 ];qtest_memread (data->qts, addr, ep_table,sizeof (*ep_table));if (memcmp (ep_table->anchor_string,"_SM_" ,4 )) {@@ -559,29 +567,59 @@ 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) +{ +struct smbios_30_entry_point *ep_table = &data->smbios_ep_table.ep30; +uint64_t addr = data->smbios_ep_addr[SMBIOS_VER30 ]; + +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 int test_smbios_entry_point (test_data *data) {uint32_t off; +bool found_ep2 = false, found_ep3 = false;Quoted 6 lines
tests/qtest/bios-tables-test.c static bool smbios_ep_table_ok(test_data *data) · line 594
Quoted 4 lines
tests/qtest/bios-tables-test.c +1
-1/* find smbios entry point structure */ for (off =0xf0000 ; off <0x100000 ; off +=0x10 ) { -uint8_t sig[] ="_SM_" ; +uint8_t sig[] ="_SM3_" ;well I'd just add a separate sig3
Ok
Quoted 6 lines
Quoted 6 lines
tests/qtest/bios-tables-test.c +0
-0int i;for (i =0 ; i <sizeof sig -1 ; ++i) { sig[i] =qtest_readb (data->qts, off + i); }Quoted 7 lines
tests/qtest/bios-tables-test.c static bool smbios_ep_table_ok(test_data *data) · line 601
Quoted 2 lines
tests/qtest/bios-tables-test.c +1
-1-if (!memcmp (sig,"_SM_" ,sizeof sig)) { +if (!found_ep2 && !memcmp (sig,"_SM_" ,sizeof sig -2 )) {keep original v2 code and just add similar chunk for v3,
dropfound_foolocals,
that should make it easier to read/follow
(i.e. less conditions to think about and no magic fiddling with the length of signature)The idea was to reuse existing code, but since it doesn't improve things much, it makes sense to repeat it.
Quoted 20 lines
Quoted 20 lines
tests/qtest/bios-tables-test.c +12
-3/* signature match, but is this a valid entry point? */ - data->smbios_ep_addr = off; -if (smbios_ep_table_ok (data)) { -break ; + data->smbios_ep_addr[SMBIOS_VER21 ] = off; +if (smbios_ep2_table_ok (data)) { + found_ep2 = true; + } + }else if (!found_ep3 && !memcmp (sig,"_SM3_" ,sizeof sig -1 )) { + data->smbios_ep_addr[SMBIOS_VER30 ] = off; +if (smbios_ep3_table_ok (data)) { + found_ep3 = true; } } + +if (found_ep2 || found_ep3) { +break ; + } }Quoted 7 lines
tests/qtest/bios-tables-test.c static bool smbios_ep_table_ok(test_data *data) · line 622
Quoted 5 lines
tests/qtest/bios-tables-test.c +4
-1- g_assert_cmphex(off, <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER21], <, 0x100000); + g_assert_cmphex(data->smbios_ep_addr[SMBIOS_VER30], <, 0x100000); + +return found_ep3 ?SMBIOS_VER30 :SMBIOS_VER21 ;and use content of data->smbios_ep_addr[] to return found version
Quoted 1 line
You mean check if it's initialized?
yep, it's zeroed out initially and you can check if it's set to something else after detection phase
Quoted 77 lines
Quoted 76 lines
Quoted 75 lines
tests/qtest/bios-tables-test.c +25
-14}static inline bool smbios_single_instance (uint8_t type)@@ -625,16 +663,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,int ver) { 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 ; + +smbios_entry_point *ep_table = &data->smbios_ep_table; +int i =0 , len, max_len =0 ;uint8_t type, prv, crt; +uint64_t addr; + +if (ver ==SMBIOS_VER21 ) { + 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 +705,23 @@ static void test_smbios_structs(test_data *data) }/* keep track of max. struct size */ -if (max_len < len) { +if (ver ==SMBIOS_VER21 && 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); + }while (ver ==SMBIOS_VER21 ? + (++i <le16_to_cpu (ep_table->ep21.number_of_structures)) : (type !=127 )); + +if (ver ==SMBIOS_VER21 ) { +/* 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 +805,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); +int ver =test_smbios_entry_point (data); +test_smbios_structs (data, ver); }qtest_quit (data->qts);
PATCH 3/5 tests/acpi: allow changes for core_count2 test
In reply to Julia Suvorova--- 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
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",
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
Signature · 1 line
2.35.1
Re: [PATCH 3/5] tests/acpi: allow changes for core_count2 test
Quoted 1 line · Julia Suvorova
Signed-off-by Julia Suvorova <[email protected]>
Quoted 32 lines
--- 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-count2tests/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",tests/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
-1--2.35.1
PATCH 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.
--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
tests/qtest/bios-tables-test.c +34 -1
@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;
@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count; +uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;uint16_t expect_speed[2 ]; -uint16_t real;int offset[2 ];int i;
@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } } + real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) { +fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false; + } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }
@@ -905,6 +922,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;
@@ -1787,6 +1819,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);
Signature · 1 line
2.35.1
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
Quoted 24 lines · Julia Suvorova
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]>--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +2
-0@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;
tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 644
Quoted 7 lines
tests/qtest/bios-tables-test.c +2
-1@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count; +uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;uint16_t expect_speed[2 ]; -uint16_t real;
while you are at it, I suggest renaming this to real_speed or some such so that its better redeable.
tests/qtest/bios-tables-test.c static bool smbios_cpu_test(test_data *data, uint32_t addr) · line 669
Quoted 11 lines
tests/qtest/bios-tables-test.c +4
-0int offset[2 ];int i;@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } } + real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) {
I think better to say if ((expect_cc < 256) && (real_cc != expect_cc))
Quoted 36 lines
tests/qtest/bios-tables-test.c +25
-0+fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false; + } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;
tests/qtest/bios-tables-test.c int main(int argc, char *argv[]) · line 1822
Quoted 4 lines
tests/qtest/bios-tables-test.c +1
-0@@ -1787,6 +1819,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);
How about checking thread count as well in the same test or in a different test?
Quoted 7 lines
tests/qtest/bios-tables-test.c +0
-1qtest_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.1
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
Quoted 30 lines · Ani Sinha
Quoted 25 lines · Julia Suvorova
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]>--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +2
-0@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)
Quoted 9 lines
tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 644
Quoted 6 lines
tests/qtest/bios-tables-test.c +2
-1static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count; +uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;uint16_t expect_speed[2 ]; -uint16_t real;while you are at it, I suggest renaming this to
real_speedor some such so that its better redeable.
Ok
Quoted 7 lines
Quoted 7 lines
tests/qtest/bios-tables-test.c +0
-0int offset[2 ];int i;@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } }
Quoted 6 lines
tests/qtest/bios-tables-test.c static bool smbios_cpu_test(test_data *data, uint32_t addr) · line 669
Quoted 4 lines
tests/qtest/bios-tables-test.c +4
-0+ real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) {I think better to say if ((
expect_cc< 256) && (real_cc!=expect_cc))
The check is not whether it fits into the field, but whether the field is initialized.
Quoted 35 lines
Quoted 35 lines
tests/qtest/bios-tables-test.c +25
-0+fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false; + } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;
Quoted 8 lines
tests/qtest/bios-tables-test.c int main(int argc, char *argv[]) · line 1822
Quoted 5 lines
tests/qtest/bios-tables-test.c +1
-0@@ -1787,6 +1819,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);How about checking thread count as well in the same test or in a different test?
Maybe a different test.
Best regards, Julia Suvorova.
Quoted 8 lines
Quoted 7 lines
tests/qtest/bios-tables-test.c +0
-1qtest_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.1
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
Quoted 58 lines · Julia Suvorova
Quoted 30 lines · Ani Sinha
Quoted 25 lines · Julia Suvorova
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]>--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +2
-0@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)Quoted 9 lines
tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 644
Quoted 6 lines
tests/qtest/bios-tables-test.c +2
-1static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count; +uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;uint16_t expect_speed[2 ]; -uint16_t real;while you are at it, I suggest renaming this to
real_speedor some such so that its better redeable.Ok
Quoted 7 lines
Quoted 7 lines
tests/qtest/bios-tables-test.c +0
-0int offset[2 ];int i;@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } }Quoted 6 lines
tests/qtest/bios-tables-test.c static bool smbios_cpu_test(test_data *data, uint32_t addr) · line 669
Quoted 4 lines
tests/qtest/bios-tables-test.c +4
-0+ real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) {I think better to say if ((
expect_cc< 256) && (real_cc!=expect_cc))
Quoted 2 lines
The check is not whether it fits into the field, but whether the field is initialized.
yes so the real_cc will contain the actual value of core count only when the core count value is less than 256. This value should be the same as the expect_cc (the cc value we pass). Is this not what is being tested?
Quoted 58 lines
Quoted 36 lines
Quoted 36 lines
tests/qtest/bios-tables-test.c +25
-0+fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false; + } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;Quoted 8 lines
tests/qtest/bios-tables-test.c int main(int argc, char *argv[]) · line 1822
Quoted 5 lines
tests/qtest/bios-tables-test.c +1
-0@@ -1787,6 +1819,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);How about checking thread count as well in the same test or in a different test?
Maybe a different test.
Best regards, Julia Suvorova.
Quoted 8 lines
Quoted 7 lines
tests/qtest/bios-tables-test.c +0
-1qtest_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.1
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
Quoted 60 lines · Ani Sinha
Quoted 58 lines · Julia Suvorova
Quoted 30 lines · Ani Sinha
Quoted 25 lines · Julia Suvorova
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]>--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +2
-0@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)Quoted 9 lines
tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 644
Quoted 6 lines
tests/qtest/bios-tables-test.c +2
-1static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count; +uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;uint16_t expect_speed[2 ]; -uint16_t real;while you are at it, I suggest renaming this to
real_speedor some such so that its better redeable.Ok
Quoted 13 lines
tests/qtest/bios-tables-test.c static bool smbios_cpu_test(test_data *data, uint32_t addr) · line 669
Quoted 11 lines
tests/qtest/bios-tables-test.c +4
-0int offset[2 ];int i;@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } } + real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) {I think better to say if ((
expect_cc< 256) && (real_cc!=expect_cc))
Quoted 7 lines
Quoted 2 lines
The check is not whether it fits into the field, but whether the field is initialized.
yes so the
real_ccwill contain the actual value of core count only when the core count value is less than 256. This value should be the same as theexpect_cc(the cc value we pass). Is this not what is being tested?
The real_cc should always be equal to expect_cc (which is 0xFF with -smp 275). So if the core count is less than 256, this checks for the actual core counter, and if it's over, it checks if real_cc is equal to 0xFF, which eliminates several unnecessary comparisons. If we didn't initialize expect_cc in the test, the value is undefined, and we shouldn't check anything.
Best regards, Julia Suvorova.
Quoted 59 lines
Quoted 58 lines
Quoted 36 lines
Quoted 36 lines
tests/qtest/bios-tables-test.c +25
-0+fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false; + } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;Quoted 8 lines
tests/qtest/bios-tables-test.c int main(int argc, char *argv[]) · line 1822
Quoted 5 lines
tests/qtest/bios-tables-test.c +1
-0@@ -1787,6 +1819,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);How about checking thread count as well in the same test or in a different test?
Maybe a different test.
Best regards, Julia Suvorova.
Quoted 8 lines
Quoted 7 lines
tests/qtest/bios-tables-test.c +0
-1qtest_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.1
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
Quoted 70 lines · Julia Suvorova
Quoted 60 lines · Ani Sinha
Quoted 58 lines · Julia Suvorova
Quoted 30 lines · Ani Sinha
Quoted 25 lines · Julia Suvorova
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]>--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +2
-0@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)Quoted 9 lines
tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 644
Quoted 6 lines
tests/qtest/bios-tables-test.c +2
-1static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count; +uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;uint16_t expect_speed[2 ]; -uint16_t real;while you are at it, I suggest renaming this to
real_speedor some such so that its better redeable.Ok
Quoted 13 lines
tests/qtest/bios-tables-test.c static bool smbios_cpu_test(test_data *data, uint32_t addr) · line 669
Quoted 11 lines
tests/qtest/bios-tables-test.c +4
-0int offset[2 ];int i;@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } } + real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) {I think better to say if ((
expect_cc< 256) && (real_cc!=expect_cc))Quoted 7 lines
Quoted 2 lines
The check is not whether it fits into the field, but whether the field is initialized.
yes so the
real_ccwill contain the actual value of core count only when the core count value is less than 256. This value should be the same as theexpect_cc(the cc value we pass). Is this not what is being tested?
Quoted 6 lines
The
real_ccshould always be equal toexpect_cc(which is0xFFwith -smp 275). So if the core count is less than 256, this checks for the actual core counter, and if it's over, it checks ifreal_ccis equal to0xFF, which eliminates several unnecessary comparisons. If we didn't initializeexpect_ccin the test, the value is undefined, and we shouldn't check anything.
I have convinced myself that the logic is correct. You are right in that real_cc should always be equal to expect_cc when expect_cc is set (either to actual core count or to 0xff when number of cores > 255).
Quoted 63 lines
Best regards, Julia Suvorova.
Quoted 59 lines
Quoted 58 lines
Quoted 36 lines
Quoted 36 lines
tests/qtest/bios-tables-test.c +25
-0+fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false; + } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;Quoted 8 lines
tests/qtest/bios-tables-test.c int main(int argc, char *argv[]) · line 1822
Quoted 5 lines
tests/qtest/bios-tables-test.c +1
-0@@ -1787,6 +1819,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);How about checking thread count as well in the same test or in a different test?
Maybe a different test.
Best regards, Julia Suvorova.
Quoted 8 lines
Quoted 7 lines
tests/qtest/bios-tables-test.c +0
-1qtest_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.1
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
In reply to Julia SuvorovaQuoted 7 lines · Julia Suvorova
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]>
Quoted 82 lines
--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +34
-2@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count; +uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;uint16_t expect_speed[2 ]; -uint16_t real;int offset[2 ];int i;@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } } + real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) { +fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false; + } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;@@ -1787,6 +1819,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.1
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
In reply to Julia SuvorovaQuoted 24 lines · On Fri, 27 May 2022 18:56:50 +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]>--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +2
-0@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;
tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 645
Quoted 4 lines
tests/qtest/bios-tables-test.c +1
-0@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count;
%s/expect/expected/
also I'd s/real_cc/core_count/
tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 646
Quoted 1 line
tests/qtest/bios-tables-test.c +1
-0+uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;
ditto
Quoted 6 lines
tests/qtest/bios-tables-test.c +0
-1uint16_t expect_speed[2 ]; -uint16_t real;int offset[2 ];int i;
tests/qtest/bios-tables-test.c static bool smbios_cpu_test(test_data *data, uint32_t addr) · line 672
Quoted 10 lines
tests/qtest/bios-tables-test.c +7
-0@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } } + real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) { +fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false;
since you are rewriting it anyways, how about
if (expect_cc) {
g_assert_cmpuint(...)
}
instead of printing/propagating error
Quoted 40 lines
tests/qtest/bios-tables-test.c +23
-0+ } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;@@ -1787,6 +1819,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);
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
Quoted 29 lines · Igor Mammedov
Quoted 25 lines · On Fri, 27 May 2022 18:56:50 +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]>--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +2
-0@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)
Quoted 6 lines
tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 645
Quoted 3 lines
tests/qtest/bios-tables-test.c +1
-0static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count;%s/expect/expected/
also I'd s/real_cc/core_count/
If you are going to go that path, I would suggest real_core_count and exp_core_count.
Quoted 69 lines
tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 646
Quoted 2 lines
tests/qtest/bios-tables-test.c +1
-0+uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;ditto
Quoted 6 lines
tests/qtest/bios-tables-test.c +0
-1uint16_t expect_speed[2 ]; -uint16_t real;int offset[2 ];int i;tests/qtest/bios-tables-test.c static bool smbios_cpu_test(test_data *data, uint32_t addr) · line 672
Quoted 10 lines
tests/qtest/bios-tables-test.c +7
-0@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } } + real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) { +fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false;since you are rewriting it anyways, how about
if (expect_cc) {
g_assert_cmpuint(...)
}instead of printing/propagating error
Quoted 40 lines
tests/qtest/bios-tables-test.c +23
-0+ } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;@@ -1787,6 +1819,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);
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
In reply to Igor MammedovQuoted 61 lines · Igor Mammedov
Quoted 24 lines · On Fri, 27 May 2022 18:56:50 +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]>--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +2
-0@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 645
Quoted 4 lines
tests/qtest/bios-tables-test.c +1
-0@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count;%s/expect/expected/
also I'd s/real_cc/core_count/tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 646
Quoted 1 line
tests/qtest/bios-tables-test.c +1
-0+uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;ditto
Quoted 6 lines
tests/qtest/bios-tables-test.c +0
-1uint16_t expect_speed[2 ]; -uint16_t real;int offset[2 ];int i;tests/qtest/bios-tables-test.c static bool smbios_cpu_test(test_data *data, uint32_t addr) · line 672
Quoted 10 lines
tests/qtest/bios-tables-test.c +7
-0@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } } + real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) { +fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false;since you are rewriting it anyways, how about
if (expect_cc) {
g_assert_cmpuint(...)
}
Quoted 1 line
instead of printing/propagating error
That works. But I still need to return something, unless you want to change the original code too.
Best regards, Julia Suvorova.
Quoted 41 lines
Quoted 40 lines
tests/qtest/bios-tables-test.c +23
-0+ } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;@@ -1787,6 +1819,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);
Re: [PATCH 4/5] bios-tables-test: add test for number of cores > 255
Quoted 62 lines · On Mon, 6 Jun 2022 13:38:57 +0200 Julia Suvorova <[email protected]> wrote:
Quoted 61 lines · Igor Mammedov
Quoted 24 lines · On Fri, 27 May 2022 18:56:50 +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]>--- tests/qtest/bios-tables-test.c | 35 +++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)tests/qtest/bios-tables-test.c +2
-0@@ -100,6 +100,8 @@ typedef struct {smbios_entry_point 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;tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 645
Quoted 4 lines
tests/qtest/bios-tables-test.c +1
-0@@ -640,8 +642,9 @@ static inline bool smbios_single_instance(uint8_t type)static bool smbios_cpu_test (test_data *data,uint32_t addr) { +uint8_t real_cc, expect_cc = data->smbios_core_count;%s/expect/expected/
also I'd s/real_cc/core_count/tests/qtest/bios-tables-test.c static inline bool smbios_single_instance(uint8_t type) · line 646
Quoted 1 line
tests/qtest/bios-tables-test.c +1
-0+uint16_t real, real_cc2, expect_cc2 = data->smbios_core_count2;ditto
Quoted 6 lines
tests/qtest/bios-tables-test.c +0
-1uint16_t expect_speed[2 ]; -uint16_t real;int offset[2 ];int i;tests/qtest/bios-tables-test.c static bool smbios_cpu_test(test_data *data, uint32_t addr) · line 672
Quoted 10 lines
tests/qtest/bios-tables-test.c +7
-0@@ -660,6 +663,20 @@ static bool smbios_cpu_test(test_data *data, uint32_t addr) } } + real_cc =qtest_readb (data->qts, addr + offsetof(struct smbios_type_4 , core_count)); + real_cc2 =qtest_readw (data->qts, addr + offsetof(struct smbios_type_4 , core_count2)); + +if (expect_cc && (real_cc != expect_cc)) { +fprintf (stderr,"Unexpected SMBIOS CPU count: real %u expect %u\n" , + real_cc, expect_cc); +return false;since you are rewriting it anyways, how about
if (expect_cc) {
g_assert_cmpuint(...)
}
Quoted 4 lines
Quoted 1 line
instead of printing/propagating error
That works. But I still need to return something, unless you want to change the original code too.
just change it, as it makes code simpler (maybe a separate patch that should go before this one)
Quoted 45 lines
Best regards, Julia Suvorova.
Quoted 41 lines
Quoted 40 lines
tests/qtest/bios-tables-test.c +23
-0+ } +if ((expect_cc ==0xFF ) && (real_cc2 != expect_cc2)) { +fprintf (stderr,"Unexpected SMBIOS CPU count2: real %u expect %u\n" , + real_cc2, expect_cc2); +return false; + } +return true; }@@ -905,6 +922,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;@@ -1787,6 +1819,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);
PATCH 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 (C000, 0x00, 0x00000000, 0x00)
+ {
+ Method (_STA, 0, Serialized) // _STA: Status
+ {
+ Return (CSTA (Zero))
+ }
+
+ Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry
+ {
+ 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 // ........
+ })
+ Method (_OST, 3, Serialized) // _OST: OSPM Status Indication
+ {+ COST (Zero, 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 (0x0101, Arg0, Arg1, Arg2)
+ }
+ }
...
--- 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 -> 32429 bytes tests/data/acpi/q35/FACP.core-count2 | Bin 0 -> 244 bytes 4 files changed, 3 deletions(-)
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",
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
Signature · 1 line
2.35.1