Skip to contentSkip to conversation

Fixes CPUs AML & acpi-bios-tables to be x86 backward compatible

PATCH In review Salil Mehta 2 participants 5 messages Nov 9, 2024 – Nov 11, 2024

lore
Share & tools
lore
#0 lore raw

v2 cover Fixes CPUs AML & acpi-bios-tables to be x86 backward compatible

Fixes the the CPUs AML code and its corresponding golden masters ACPI tables files for backward compatability of live migration on x86 platforms i.e. when newer Qemu is migrated to older Qemu without CPRS Bit present in the register block. This also reverts the ACPI ABI change introduced for checking the presence of vCPUs dynamically (feedback from Igor Mammedov)

Fixes [PULL 60/65], [PULL 61/65]:
Message-ID: <bf1ecc8dad6061914730a2a2d57af6b37c3a4f8d.1730754238.git.mst@redhat.com>
Message-ID: <4d62d15b11909e9af121577e707b88f2e4524371.1730754238.git.mst@redhat.com>

Salil Mehta (3):
qtest: allow ACPI DSDT Table changes
Fix: CPUs presence logic in _STA for x86 backward compatability tests/qtest/bios-tables-test: Fix DSDT golden masters for x86/{pc,q35}

 hw/acpi/cpu.c                                 |  49 +++++++-----------
 include/hw/acpi/cpu.h                         |   1 +
 include/hw/core/cpu.h                         |   1 -
 tests/data/acpi/x86/pc/DSDT                   | Bin 8561 -> 8528 bytes
 tests/data/acpi/x86/pc/DSDT.acpierst          | Bin 8472 -> 8439 bytes
 tests/data/acpi/x86/pc/DSDT.acpihmat          | Bin 9886 -> 9853 bytes
 tests/data/acpi/x86/pc/DSDT.bridge            | Bin 15432 -> 15399 bytes
 tests/data/acpi/x86/pc/DSDT.cphp              | Bin 9025 -> 8992 bytes
 tests/data/acpi/x86/pc/DSDT.dimmpxm           | Bin 10215 -> 10182 bytes
 tests/data/acpi/x86/pc/DSDT.hpbridge          | Bin 8512 -> 8479 bytes
 tests/data/acpi/x86/pc/DSDT.hpbrroot          | Bin 5068 -> 5035 bytes
 tests/data/acpi/x86/pc/DSDT.ipmikcs           | Bin 8633 -> 8600 bytes
 tests/data/acpi/x86/pc/DSDT.memhp             | Bin 9920 -> 9887 bytes
 tests/data/acpi/x86/pc/DSDT.nohpet            | Bin 8419 -> 8386 bytes
 tests/data/acpi/x86/pc/DSDT.numamem           | Bin 8567 -> 8534 bytes
 tests/data/acpi/x86/pc/DSDT.roothp            | Bin 12354 -> 12321 bytes
 tests/data/acpi/x86/q35/DSDT                  | Bin 8389 -> 8356 bytes
 tests/data/acpi/x86/q35/DSDT.acpierst         | Bin 8406 -> 8373 bytes
 tests/data/acpi/x86/q35/DSDT.acpihmat         | Bin 9714 -> 9681 bytes
 .../acpi/x86/q35/DSDT.acpihmat-noinitiator    | Bin 8668 -> 8635 bytes
 tests/data/acpi/x86/q35/DSDT.applesmc         | Bin 8435 -> 8402 bytes
 tests/data/acpi/x86/q35/DSDT.bridge           | Bin 12002 -> 11969 bytes
 tests/data/acpi/x86/q35/DSDT.core-count       | Bin 12947 -> 12914 bytes
 tests/data/acpi/x86/q35/DSDT.core-count2      | Bin 33804 -> 33771 bytes
 tests/data/acpi/x86/q35/DSDT.cphp             | Bin 8853 -> 8820 bytes
 tests/data/acpi/x86/q35/DSDT.cxl              | Bin 13182 -> 13149 bytes
 tests/data/acpi/x86/q35/DSDT.dimmpxm          | Bin 10043 -> 10010 bytes
 tests/data/acpi/x86/q35/DSDT.ipmibt           | Bin 8464 -> 8431 bytes
 tests/data/acpi/x86/q35/DSDT.ipmismbus        | Bin 8477 -> 8444 bytes
 tests/data/acpi/x86/q35/DSDT.ivrs             | Bin 8406 -> 8373 bytes
 tests/data/acpi/x86/q35/DSDT.memhp            | Bin 9748 -> 9715 bytes
 tests/data/acpi/x86/q35/DSDT.mmio64           | Bin 9519 -> 9486 bytes
 tests/data/acpi/x86/q35/DSDT.multi-bridge     | Bin 13242 -> 13209 bytes
 tests/data/acpi/x86/q35/DSDT.noacpihp         | Bin 8269 -> 8236 bytes
 tests/data/acpi/x86/q35/DSDT.nohpet           | Bin 8247 -> 8214 bytes
 tests/data/acpi/x86/q35/DSDT.numamem          | Bin 8395 -> 8362 bytes
 tests/data/acpi/x86/q35/DSDT.pvpanic-isa      | Bin 8490 -> 8457 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count     | Bin 12947 -> 12914 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count2    | Bin 33804 -> 33771 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm12        | Bin 8995 -> 8962 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm2         | Bin 9021 -> 8988 bytes
 tests/data/acpi/x86/q35/DSDT.type4-count      | Bin 18623 -> 18590 bytes
 tests/data/acpi/x86/q35/DSDT.viot             | Bin 14649 -> 14616 bytes
 tests/data/acpi/x86/q35/DSDT.xapic            | Bin 35752 -> 35719 bytes
 44 files changed, 19 insertions(+), 32 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/3 qtest: allow ACPI DSDT Table changes

list changed files in tests/qtest/bios-tables-test-allowed-diff.h

Message-ID: <[email protected]>

---
 tests/qtest/bios-tables-test-allowed-diff.h | 41 +++++++++++++++++++++
 1 file changed, 41 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +41 -0
index dfb8523c8b..512d40665d 100644
@@ -1 +1,42 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/x86/pc/DSDT",
+"tests/data/acpi/x86/pc/DSDT.acpierst",
+"tests/data/acpi/x86/pc/DSDT.acpihmat",
+"tests/data/acpi/x86/pc/DSDT.bridge",
+"tests/data/acpi/x86/pc/DSDT.cphp",
+"tests/data/acpi/x86/pc/DSDT.dimmpxm",
+"tests/data/acpi/x86/pc/DSDT.hpbridge",
+"tests/data/acpi/x86/pc/DSDT.hpbrroot",
+"tests/data/acpi/x86/pc/DSDT.ipmikcs",
+"tests/data/acpi/x86/pc/DSDT.memhp",
+"tests/data/acpi/x86/pc/DSDT.nohpet",
+"tests/data/acpi/x86/pc/DSDT.numamem",
+"tests/data/acpi/x86/pc/DSDT.roothp",
+"tests/data/acpi/x86/q35/DSDT",
+"tests/data/acpi/x86/q35/DSDT.acpierst",
+"tests/data/acpi/x86/q35/DSDT.acpihmat",
+"tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator",
+"tests/data/acpi/x86/q35/DSDT.applesmc",
+"tests/data/acpi/x86/q35/DSDT.bridge",
+"tests/data/acpi/x86/q35/DSDT.core-count",
+"tests/data/acpi/x86/q35/DSDT.core-count2",
+"tests/data/acpi/x86/q35/DSDT.cphp",
+"tests/data/acpi/x86/q35/DSDT.cxl",
+"tests/data/acpi/x86/q35/DSDT.dimmpxm",
+"tests/data/acpi/x86/q35/DSDT.ipmibt",
+"tests/data/acpi/x86/q35/DSDT.ipmismbus",
+"tests/data/acpi/x86/q35/DSDT.ivrs",
+"tests/data/acpi/x86/q35/DSDT.memhp",
+"tests/data/acpi/x86/q35/DSDT.mmio64",
+"tests/data/acpi/x86/q35/DSDT.multi-bridge",
+"tests/data/acpi/x86/q35/DSDT.noacpihp",
+"tests/data/acpi/x86/q35/DSDT.nohpet",
+"tests/data/acpi/x86/q35/DSDT.numamem",
+"tests/data/acpi/x86/q35/DSDT.pvpanic-isa",
+"tests/data/acpi/x86/q35/DSDT.thread-count",
+"tests/data/acpi/x86/q35/DSDT.thread-count2",
+"tests/data/acpi/x86/q35/DSDT.tis.tpm12",
+"tests/data/acpi/x86/q35/DSDT.tis.tpm2",
+"tests/data/acpi/x86/q35/DSDT.type4-count",
+"tests/data/acpi/x86/q35/DSDT.viot",
+"tests/data/acpi/x86/q35/DSDT.xapic",
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/3 Fix: CPUs presence logic in _STA for x86 backward compatability

In reply to Salil Mehta

Checking is_present first can break x86 migration from new Qemu version to old Qemu. This is because CPRS Bit is not defined in the older Qemu register block and will always be 0 resulting in check always failing. Remove CPU_PRESENT Bit to preserve older ABI.

- If ((\_SB.PCI0.PRES.CPEN == One))
- {
- Local0 = 0x0F
+ If ((\_SB.PCI0.PRES.CPRS == One))
+ {
+ If ((\_SB.PCI0.PRES.CPEN == One))
+ {
+ Local0 = 0x0F

+                    }
+                    Else
+                    {
+                        Local0 = 0x0D
+                    }
                 }

Message-ID: <[email protected]>

---
 hw/acpi/cpu.c         | 49 ++++++++++++++++---------------------------
 include/hw/acpi/cpu.h |  1 +
 include/hw/core/cpu.h |  1 -
 3 files changed, 19 insertions(+), 32 deletions(-)
hw/acpi/cpu.c +18 -31
index 23443f09a5..7b0badd08a 100644
@@ -23,6 +23,8 @@ enum {
     CPHP_CMD_MAX
 };
 
+static bool always_present_cpus;
+
 static ACPIOSTInfo *acpi_cpu_device_status(int idx, AcpiCpuStatus *cdev)
 {
     ACPIOSTInfo *info = g_new0(ACPIOSTInfo, 1);
@@ -79,7 +81,6 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size)
         val |= cdev->is_inserting ? 2 : 0;
         val |= cdev->is_removing  ? 4 : 0;
         val |= cdev->fw_remove  ? 16 : 0;
-        val |= cdev->cpu ? 32 : 0;
         trace_cpuhp_acpi_read_flags(cpu_st->selector, val);
         break;
     case ACPI_CPU_CMD_DATA_OFFSET_RW:
@@ -246,15 +247,9 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
     memory_region_add_subregion(as, base_addr, &state->ctrl_reg);
 }
 
-static bool should_remain_acpi_present(DeviceState *dev)
+static inline bool should_remain_acpi_present(DeviceState *dev)
 {
-    CPUClass *k = CPU_GET_CLASS(dev);
-    /*
-     * A system may contain CPUs that are always present on one die, NUMA node,
-     * or socket, yet may be non-present on another simultaneously. Check from
-     * architecture specific code.
-     */
-    return k->cpu_persistent_status && k->cpu_persistent_status(CPU(dev));
+    return always_present_cpus;
 }
 
 static AcpiCpuStatus *get_cpu_status(CPUHotplugState *cpu_st, DeviceState *dev)
@@ -362,7 +357,6 @@ const VMStateDescription vmstate_cpu_hotplug = {
 #define CPU_REMOVE_EVENT  "CRMV"
 #define CPU_EJECT_EVENT   "CEJ0"
 #define CPU_FW_EJECT_EVENT "CEJF"
-#define CPU_PRESENT       "CPRS"
 
 void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
                     build_madt_cpu_fn build_madt_cpu, hwaddr base_addr,
@@ -423,9 +417,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         aml_append(field, aml_named_field(CPU_EJECT_EVENT, 1));
         /* tell firmware to do device eject, write only */
         aml_append(field, aml_named_field(CPU_FW_EJECT_EVENT, 1));
-        /* 1 if present, read only */
-        aml_append(field, aml_named_field(CPU_PRESENT, 1));
-        aml_append(field, aml_reserved_field(2));
+        aml_append(field, aml_reserved_field(3));
         aml_append(field, aml_named_field(CPU_COMMAND, 8));
         aml_append(cpu_ctrl_dev, field);
 
@@ -455,7 +447,6 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         Aml *ctrl_lock = aml_name("%s.%s", cphp_res_path, CPU_LOCK);
         Aml *cpu_selector = aml_name("%s.%s", cphp_res_path, CPU_SELECTOR);
         Aml *is_enabled = aml_name("%s.%s", cphp_res_path, CPU_ENABLED);
-        Aml *is_present = aml_name("%s.%s", cphp_res_path, CPU_PRESENT);
         Aml *cpu_cmd = aml_name("%s.%s", cphp_res_path, CPU_COMMAND);
         Aml *cpu_data = aml_name("%s.%s", cphp_res_path, CPU_DATA);
         Aml *ins_evt = aml_name("%s.%s", cphp_res_path, CPU_INSERT_EVENT);
@@ -482,28 +473,24 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
 
         method = aml_method(CPU_STS_METHOD, 1, AML_SERIALIZED);
         {
-            Aml *idx = aml_arg(0);
+            Aml *default_sta = aml_int(opts.always_present_cpus ? 0xD : 0);
             Aml *sta = aml_local(0);
-            Aml *ifctx2;
-            Aml *else_ctx;
+            Aml *idx = aml_arg(0);
+
+            always_present_cpus = opts.always_present_cpus;
 
             aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
             aml_append(method, aml_store(idx, cpu_selector));
-            aml_append(method, aml_store(zero, sta));
-            ifctx = aml_if(aml_equal(is_present, one));
+            /*
+             * Default case:
+             * _STA(0xD) = cpu is present and disabled OR
+             * _STA(0x0) = cpu is not present (and hence disabled)
+             */
+            aml_append(method, aml_store(default_sta, sta));
+            ifctx = aml_if(aml_equal(is_enabled, one));
             {
-                ifctx2 = aml_if(aml_equal(is_enabled, one));
-                {
-                    /* cpu is present and enabled */
-                    aml_append(ifctx2, aml_store(aml_int(0xF), sta));
-                }
-                aml_append(ifctx, ifctx2);
-                else_ctx = aml_else();
-                {
-                    /* cpu is present but disabled */
-                    aml_append(else_ctx, aml_store(aml_int(0xD), sta));
-                }
-                aml_append(ifctx, else_ctx);
+                /* _STA(0xF) = cpu is present and enabled */
+                aml_append(ifctx, aml_or(aml_int(0xF), sta, sta));
             }
             aml_append(method, ifctx);
             aml_append(method, aml_release(ctrl_lock));
include/hw/acpi/cpu.h +1 -0
index 32654dc274..4a3e591120 100644
@@ -55,6 +55,7 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
 typedef struct CPUHotplugFeatures {
     bool acpi_1_compatible;
     bool has_legacy_cphp;
+    bool always_present_cpus;
     bool fw_unplugs_cpu;
     const char *smi_path;
 } CPUHotplugFeatures;
include/hw/core/cpu.h +0 -1
index db8a6fbc6e..e936b67675 100644
@@ -158,7 +158,6 @@ struct CPUClass {
     void (*dump_state)(CPUState *cpu, FILE *, int flags);
     void (*query_cpu_fast)(CPUState *cpu, CpuInfoFast *value);
     int64_t (*get_arch_id)(CPUState *cpu);
-    bool (*cpu_persistent_status)(CPUState *cpu);
     bool (*cpu_enabled_status)(CPUState *cpu);
     void (*set_pc)(CPUState *cpu, vaddr value);
     vaddr (*get_pc)(CPUState *cpu);
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH V2 2/3] Fix: CPUs presence logic in _STA for x86 backward compatability

Quoted 20 lines · On Sat, 9 Nov 2024 00:07:27 +0000 Salil Mehta <[email protected]> wrote:

Checking is_present first can break x86 migration from new Qemu version to old Qemu. This is because CPRS Bit is not defined in the older Qemu register block and will always be 0 resulting in check always failing. Remove CPU_PRESENT Bit to preserve older ABI.

(quoted diff) +10 -3
-                If ((\_SB.PCI0.PRES.CPEN == One))
-                {
-                    Local0 = 0x0F
+                If ((\_SB.PCI0.PRES.CPRS == One))
+                {
+                    If ((\_SB.PCI0.PRES.CPEN == One))
+                    {
+                        Local0 = 0x0F
+                    }
+                    Else
+                    {
+                        Local0 = 0x0D
+                    }
                 }
Quoted 3 lines

Message-ID: <[email protected]>

AML parts looks fine modulo global nit.

My recommendation is to revert both patches for 9.2,
as that would fix the broken hotplug and return code to original state. And then repost them (amended) as part of ARM cpuhp series to have cleaner history instead of spaghetti of fixups/refactoring commits.

See other comments below.

Quoted 33 lines
---
 hw/acpi/cpu.c         | 49 ++++++++++++++++---------------------------
 include/hw/acpi/cpu.h |  1 +
 include/hw/core/cpu.h |  1 -
 3 files changed, 19 insertions(+), 32 deletions(-)
hw/acpi/cpu.c +3 -2
index 23443f09a5..7b0badd08a 100644
@@ -23,6 +23,8 @@ enum {
     CPHP_CMD_MAX
 };
 
+static bool always_present_cpus;
+
 static ACPIOSTInfo *acpi_cpu_device_status(int idx, AcpiCpuStatus *cdev)
 {
     ACPIOSTInfo *info = g_new0(ACPIOSTInfo, 1);
@@ -79,7 +81,6 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size)
         val |= cdev->is_inserting ? 2 : 0;
         val |= cdev->is_removing  ? 4 : 0;
         val |= cdev->fw_remove  ? 16 : 0;
-        val |= cdev->cpu ? 32 : 0;
         trace_cpuhp_acpi_read_flags(cpu_st->selector, val);
         break;
     case ACPI_CPU_CMD_DATA_OFFSET_RW:
@@ -246,15 +247,9 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
     memory_region_add_subregion(as, base_addr, &state->ctrl_reg);
 }
 
-static bool should_remain_acpi_present(DeviceState *dev)
+static inline bool should_remain_acpi_present(DeviceState *dev)

hw/acpi/cpu.c void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, · line 253

Quoted 10 lines
hw/acpi/cpu.c +1 -7
 {
-    CPUClass *k = CPU_GET_CLASS(dev);
-    /*
-     * A system may contain CPUs that are always present on one die, NUMA node,
-     * or socket, yet may be non-present on another simultaneously. Check from
-     * architecture specific code.
-     */
-    return k->cpu_persistent_status && k->cpu_persistent_status(CPU(dev));
+    return always_present_cpus;
 }

instead of using global, we should pass parameter to

void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
CPUHotplugState *state, hwaddr base_addr, bool always_present_cpus)
^^^^

and store it in 'CPUHotplugState *state::always_present_cpus',
Then caller would supply it to the function depending on configuration
(a new property in GED to opt-in in the feature, and hardcoded 'false' for x86 call sites)

Also this does leave around cpu_enabled_status() callback, instead of adding callbacks we should just use
object_property_get_bool(OBJECT(cdev->cpu), 'realized')
to do the same (i.e. what v6 was hiding behind callbacks).

That is still correct for x86, it might be different for ARM, like a dedicated property 'enabled' depending on where discussion leads us, but that is the topic for discussion with ARM cpuhp patches.

The point is, it's stray arm cpuhp patch and not needed in 9.2. It's better to have 2d6cfbaf1 and bf1ecc8dad6 reverted for 9.2 and then ARM cpuhp will bring them back to the clean 9.1 codebase, instead of having a mess of not necessary right now broken patches + fixups to bring them to desired state.

Quoted 30 lines
hw/acpi/cpu.c +1 -5
 static AcpiCpuStatus *get_cpu_status(CPUHotplugState *cpu_st, DeviceState *dev)
@@ -362,7 +357,6 @@ const VMStateDescription vmstate_cpu_hotplug = {
 #define CPU_REMOVE_EVENT  "CRMV"
 #define CPU_EJECT_EVENT   "CEJ0"
 #define CPU_FW_EJECT_EVENT "CEJF"
-#define CPU_PRESENT       "CPRS"
 
 void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
                     build_madt_cpu_fn build_madt_cpu, hwaddr base_addr,
@@ -423,9 +417,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         aml_append(field, aml_named_field(CPU_EJECT_EVENT, 1));
         /* tell firmware to do device eject, write only */
         aml_append(field, aml_named_field(CPU_FW_EJECT_EVENT, 1));
-        /* 1 if present, read only */
-        aml_append(field, aml_named_field(CPU_PRESENT, 1));
-        aml_append(field, aml_reserved_field(2));
+        aml_append(field, aml_reserved_field(3));
         aml_append(field, aml_named_field(CPU_COMMAND, 8));
         aml_append(cpu_ctrl_dev, field);
 
@@ -455,7 +447,6 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         Aml *ctrl_lock = aml_name("%s.%s", cphp_res_path, CPU_LOCK);
         Aml *cpu_selector = aml_name("%s.%s", cphp_res_path, CPU_SELECTOR);
         Aml *is_enabled = aml_name("%s.%s", cphp_res_path, CPU_ENABLED);
-        Aml *is_present = aml_name("%s.%s", cphp_res_path, CPU_PRESENT);
         Aml *cpu_cmd = aml_name("%s.%s", cphp_res_path, CPU_COMMAND);
         Aml *cpu_data = aml_name("%s.%s", cphp_res_path, CPU_DATA);
         Aml *ins_evt = aml_name("%s.%s", cphp_res_path, CPU_INSERT_EVENT);
@@ -482,28 +473,24 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
 

hw/acpi/cpu.c void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, · line 480

Quoted 10 lines
hw/acpi/cpu.c +4 -3
         method = aml_method(CPU_STS_METHOD, 1, AML_SERIALIZED);
         {
-            Aml *idx = aml_arg(0);
+            Aml *default_sta = aml_int(opts.always_present_cpus ? 0xD : 0);
             Aml *sta = aml_local(0);
-            Aml *ifctx2;
-            Aml *else_ctx;
+            Aml *idx = aml_arg(0);
+
+            always_present_cpus = opts.always_present_cpus;

opts argument is meant to configure AML generator, so I'd rather not overload it with ACPI device configuration and introduction of a global var.

Quoted 54 lines
hw/acpi/cpu.c +9 -14
             aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
             aml_append(method, aml_store(idx, cpu_selector));
-            aml_append(method, aml_store(zero, sta));
-            ifctx = aml_if(aml_equal(is_present, one));
+            /*
+             * Default case:
+             * _STA(0xD) = cpu is present and disabled OR
+             * _STA(0x0) = cpu is not present (and hence disabled)
+             */
+            aml_append(method, aml_store(default_sta, sta));
+            ifctx = aml_if(aml_equal(is_enabled, one));
             {
-                ifctx2 = aml_if(aml_equal(is_enabled, one));
-                {
-                    /* cpu is present and enabled */
-                    aml_append(ifctx2, aml_store(aml_int(0xF), sta));
-                }
-                aml_append(ifctx, ifctx2);
-                else_ctx = aml_else();
-                {
-                    /* cpu is present but disabled */
-                    aml_append(else_ctx, aml_store(aml_int(0xD), sta));
-                }
-                aml_append(ifctx, else_ctx);
+                /* _STA(0xF) = cpu is present and enabled */
+                aml_append(ifctx, aml_or(aml_int(0xF), sta, sta));
             }
             aml_append(method, ifctx);
             aml_append(method, aml_release(ctrl_lock));
include/hw/acpi/cpu.h +1 -0
index 32654dc274..4a3e591120 100644
@@ -55,6 +55,7 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
 typedef struct CPUHotplugFeatures {
     bool acpi_1_compatible;
     bool has_legacy_cphp;
+    bool always_present_cpus;
     bool fw_unplugs_cpu;
     const char *smi_path;
 } CPUHotplugFeatures;
include/hw/core/cpu.h +0 -1
index db8a6fbc6e..e936b67675 100644
@@ -158,7 +158,6 @@ struct CPUClass {
     void (*dump_state)(CPUState *cpu, FILE *, int flags);
     void (*query_cpu_fast)(CPUState *cpu, CpuInfoFast *value);
     int64_t (*get_arch_id)(CPUState *cpu);
-    bool (*cpu_persistent_status)(CPUState *cpu);
     bool (*cpu_enabled_status)(CPUState *cpu);
     void (*set_pc)(CPUState *cpu, vaddr value);
     vaddr (*get_pc)(CPUState *cpu);
#4 lore raw

PATCH v2 3/3 tests/qtest/bios-tables-test: Fix DSDT golden masters for x86/{pc,q35}

In reply to Salil Mehta

Update the DSDT golden master files for the x86/pc and x86/q35 platforms to address recent changes in the architecture-agnostic CPU AML code, which impacted the backward compatibility of the migration feature on the x86 platform. Additionally, initialize CPU's presence statically within the CPU AML to avoid the need for extending the ACPI ABI for dynamic CPU presence checks.

The following is a diff of the changes in the .dsl file generated with IASL:

* Disassembling to symbolic ASL+ operators
*
- * Disassembly of tests/data/acpi/x86/pc/DSDT, Fri Nov 8 23:03:54 2024
+ * Disassembly of /tmp/aml-FONNW2, Fri Nov 8 23:03:54 2024 *
* Original Table Header:

  *     Signature        "DSDT"
- *     Length           0x00002171 (8561)
+ *     Length           0x00002150 (8528)
  *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
- *     Checksum         0xAA
+ *     Checksum         0xF6
  *     OEM ID           "BOCHS "
  *     OEM Table ID     "BXPC    "
  *     OEM Revision     0x00000001 (1)
@@ -1480,7 +1480,6 @@
                 CRMV,   1,
                 CEJ0,   1,
                 CEJF,   1,
-                CPRS,   1,
                 Offset (0x05),
                 CCMD,   8
             }
@@ -1515,16 +1514,9 @@
                 Acquire (\_SB.PCI0.PRES.CPLK, 0xFFFF)
                 \_SB.PCI0.PRES.CSEL = Arg0
                 Local0 = Zero

- If ((\_SB.PCI0.PRES.CPRS == One))
- {
- If ((\_SB.PCI0.PRES.CPEN == One))
- {
- Local0 = 0x0F

-                    }
-                    Else
-                    {

- Local0 = 0x0D
- }
+ If ((\_SB.PCI0.PRES.CPEN == One))
+ {
+ Local0 |= 0x0F

                 }

                 Release (\_SB.PCI0.PRES.CPLK)

Message-ID: <[email protected]>

---
 tests/data/acpi/x86/pc/DSDT                   | Bin 8561 -> 8528 bytes
 tests/data/acpi/x86/pc/DSDT.acpierst          | Bin 8472 -> 8439 bytes
 tests/data/acpi/x86/pc/DSDT.acpihmat          | Bin 9886 -> 9853 bytes
 tests/data/acpi/x86/pc/DSDT.bridge            | Bin 15432 -> 15399 bytes
 tests/data/acpi/x86/pc/DSDT.cphp              | Bin 9025 -> 8992 bytes
 tests/data/acpi/x86/pc/DSDT.dimmpxm           | Bin 10215 -> 10182 bytes
 tests/data/acpi/x86/pc/DSDT.hpbridge          | Bin 8512 -> 8479 bytes
 tests/data/acpi/x86/pc/DSDT.hpbrroot          | Bin 5068 -> 5035 bytes
 tests/data/acpi/x86/pc/DSDT.ipmikcs           | Bin 8633 -> 8600 bytes
 tests/data/acpi/x86/pc/DSDT.memhp             | Bin 9920 -> 9887 bytes
 tests/data/acpi/x86/pc/DSDT.nohpet            | Bin 8419 -> 8386 bytes
 tests/data/acpi/x86/pc/DSDT.numamem           | Bin 8567 -> 8534 bytes
 tests/data/acpi/x86/pc/DSDT.roothp            | Bin 12354 -> 12321 bytes
 tests/data/acpi/x86/q35/DSDT                  | Bin 8389 -> 8356 bytes
 tests/data/acpi/x86/q35/DSDT.acpierst         | Bin 8406 -> 8373 bytes
 tests/data/acpi/x86/q35/DSDT.acpihmat         | Bin 9714 -> 9681 bytes
 .../acpi/x86/q35/DSDT.acpihmat-noinitiator    | Bin 8668 -> 8635 bytes
 tests/data/acpi/x86/q35/DSDT.applesmc         | Bin 8435 -> 8402 bytes
 tests/data/acpi/x86/q35/DSDT.bridge           | Bin 12002 -> 11969 bytes
 tests/data/acpi/x86/q35/DSDT.core-count       | Bin 12947 -> 12914 bytes
 tests/data/acpi/x86/q35/DSDT.core-count2      | Bin 33804 -> 33771 bytes
 tests/data/acpi/x86/q35/DSDT.cphp             | Bin 8853 -> 8820 bytes
 tests/data/acpi/x86/q35/DSDT.cxl              | Bin 13182 -> 13149 bytes
 tests/data/acpi/x86/q35/DSDT.dimmpxm          | Bin 10043 -> 10010 bytes
 tests/data/acpi/x86/q35/DSDT.ipmibt           | Bin 8464 -> 8431 bytes
 tests/data/acpi/x86/q35/DSDT.ipmismbus        | Bin 8477 -> 8444 bytes
 tests/data/acpi/x86/q35/DSDT.ivrs             | Bin 8406 -> 8373 bytes
 tests/data/acpi/x86/q35/DSDT.memhp            | Bin 9748 -> 9715 bytes
 tests/data/acpi/x86/q35/DSDT.mmio64           | Bin 9519 -> 9486 bytes
 tests/data/acpi/x86/q35/DSDT.multi-bridge     | Bin 13242 -> 13209 bytes
 tests/data/acpi/x86/q35/DSDT.noacpihp         | Bin 8269 -> 8236 bytes
 tests/data/acpi/x86/q35/DSDT.nohpet           | Bin 8247 -> 8214 bytes
 tests/data/acpi/x86/q35/DSDT.numamem          | Bin 8395 -> 8362 bytes
 tests/data/acpi/x86/q35/DSDT.pvpanic-isa      | Bin 8490 -> 8457 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count     | Bin 12947 -> 12914 bytes
 tests/data/acpi/x86/q35/DSDT.thread-count2    | Bin 33804 -> 33771 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm12        | Bin 8995 -> 8962 bytes
 tests/data/acpi/x86/q35/DSDT.tis.tpm2         | Bin 9021 -> 8988 bytes
 tests/data/acpi/x86/q35/DSDT.type4-count      | Bin 18623 -> 18590 bytes
 tests/data/acpi/x86/q35/DSDT.viot             | Bin 14649 -> 14616 bytes
 tests/data/acpi/x86/q35/DSDT.xapic            | Bin 35752 -> 35719 bytes
 tests/qtest/bios-tables-test-allowed-diff.h   |  41 ------------------
 42 files changed, 41 deletions(-)
tests/data/acpi/x86/pc/DSDT binary +0 -0
index 46c8ffda011e71ce0a0ee707d320f13e9afd74f8..330c37242582c766fbb25cb75cd826df1675a319 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.acpierst binary +0 -0
index 8332df33f33ddaa4241752dcc2cf83ebd1cccd80..850a1ac380d0c2e0155aa23bcd2551912aebff60 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.acpihmat binary +0 -0
index bf093f6d8290a10a0823299238d5196d19b8e77d..09f486a880e6637c23c1467232e0c8ef9615bbf8 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.bridge binary +0 -0
index c0bf671621348f698d2535cfd734dc05a9c7256a..af1957c0e4b12ae16692cb0093b404ca83239893 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.cphp binary +0 -0
index e72a2df567d28b08b17051dd5612fb77abaf6e20..f3507e8b63a30951c70ff5b6e1aa2b6403d128d5 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.dimmpxm binary +0 -0
index 17a53d9ef714c973c934fdbd2021b2c03fa08a87..be083ea5ebe9557b2d042e97428396f8ac286508 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.hpbridge binary +0 -0
index 26f5a1875162459daaa285fef8b6c63678f7726a..13f776e0d60f46a6e645198e88a7eda0212b4542 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.hpbrroot binary +0 -0
index e0c7c2a56d5d8afb5f78134c9b175d6153dca776..0bc4bbbdfcf8ed7a8c8c7d1ddfcf7edfd2d9a606 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.ipmikcs binary +0 -0
index 119bd256adfb443922cf988e4f4ac3278a1d55ba..717c10930385122e8c4347d335374e4b5697e385 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.memhp binary +0 -0
index 9ca8a6e2f7898ccd304de44a34bd318a209917e9..a72efd5d8f858046cff0b80320d880dfb3014af8 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.nohpet binary +0 -0
index 6127a2c9ac43e961e7e8ca01673117382c20bedb..ae7d4a1d025cf410233caa81c301f45cf4c62166 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.numamem binary +0 -0
index 18c815efa890503f5e0ca94665239f58fe283735..ca4c630447f5be2b39b4648fb0397dcdf06cd8df 100644
GIT binary patch
tests/data/acpi/x86/pc/DSDT.roothp binary +0 -0
index 8256503220c11cbb902c6967fccba87e711bcd5a..9ff5a97046ba8b03686b75e48b90ed04dadcbe3c 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT binary +0 -0
index b0bbff7686c9a56129bfa3408e62f142cc482713..eea903a3d69d03b4ce0d205d2a1bb9ff5bc80409 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.acpierst binary +0 -0
index f91cbe55fcfeea319babf7c9a0c6a6ccdc3320d1..352876acc29d55469a37e7322d50807df28411b7 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.acpihmat binary +0 -0
index 0949fb9d67c70dc882e50501ece421114ad8080b..4e28f56048dcdf161bc3468d500943b3d2ac5bde 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator binary +0 -0
index 0fa4daa35cf95f93ba8c15f478460fe4e14e6d9e..0641e4973d5d38ff5fce3416003bd4b11f75443e 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.applesmc binary +0 -0
index a5d032b7d96113c9393036b2ba831adb6d584142..9481b249904ae522df2eb0eb41b4eb0c73a76997 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.bridge binary +0 -0
index 3464f552974672bde25eb15f1c93c309c57ef5cb..0333d99920f40258e7733b423f82457303c04065 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.core-count binary +0 -0
index 08f5d5f54bcb61235b98fc85bb814046dd038c13..d65f1600252216d00815ed31b6af47ed44256f8b 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.core-count2 binary +0 -0
index d29a7108f82110ce9f9b4e006501215d41c5420a..345a6f47eb9330498f69d312c980e1147ad0ed42 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.cphp binary +0 -0
index 7fd59bf6702c04a622f05ae356a2ea37312ab403..e31b0e38d0b53bad9e2eb92cdaf1f7e95bf37538 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.cxl binary +0 -0
index 92769c630dc362c781c4e9a83d6f8be306121c5a..33eaaf264614645c0cf21ac2780657b8dc91a357 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.dimmpxm binary +0 -0
index 1db0bf454a203006f866e6752d06422ae675cbd3..02f7ce30fe8f4564046c39884aec3a0c5ce1e78b 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.ipmibt binary +0 -0
index 25f43ae8efb55364a739e6b5e3cb4e71e61862b0..5405acbb56542be6842296aa66ecca4aed3b721c 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.ipmismbus binary +0 -0
index 32bcd25bda9e9d2775790385f8da6a11e9d5cb46..3b34a1909040bc0ab986e27461b5e1dfe913f700 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.ivrs binary +0 -0
index f91cbe55fcfeea319babf7c9a0c6a6ccdc3320d1..352876acc29d55469a37e7322d50807df28411b7 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.memhp binary +0 -0
index be90eb71d8dda8fe54c79ffffe103986ee06ae3a..2978ecc86ad9e1fb745618f01a9ec4cdb809de28 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.mmio64 binary +0 -0
index 01f276a6aff38a1d4f58640a9e6d120fc9a04b61..c81653972d5ca73c06f1af056d3e4a1c40fc4b78 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.multi-bridge binary +0 -0
index 1bd2ee8d2ebd3c9e0ed89a86478691f2e06f2590..f22f49a9baef29ff2dd49ad0db3fa4d7ec76c8a3 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.noacpihp binary +0 -0
index 45cc2bcffa42d73db110afd5075556dcfe5d9936..e506092a554df06d5d384be14ee831603d07516f 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.nohpet binary +0 -0
index f110504b9c813aa07802fc17d2869596a2eeca6f..1215e1c682b00fe739bb9d46d7967b93d442c13a 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.numamem binary +0 -0
index 6090958f39875f5806e72e23f32cb4b3ae840627..2ae96986366a2ec3cd30f329484dfaad0cde1ef1 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.pvpanic-isa binary +0 -0
index 7a8e568315a43f1fa98068d8e78995c98064fb91..08032ce5d117bbf233242dba9be3911a54092689 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.thread-count binary +0 -0
index 08f5d5f54bcb61235b98fc85bb814046dd038c13..d65f1600252216d00815ed31b6af47ed44256f8b 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.thread-count2 binary +0 -0
index d29a7108f82110ce9f9b4e006501215d41c5420a..345a6f47eb9330498f69d312c980e1147ad0ed42 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.tis.tpm12 binary +0 -0
index 29a416f0508655d2bfde01fff4d25ad7f89581d9..3d3c3d88619e15ae944261df473aa247a1b8f72f 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.tis.tpm2 binary +0 -0
index 59288f02c43cf2efc1555599131fde05dbbaa1cd..f3d0175fec6e53a41f78065498ba1bbf63ddc80a 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.type4-count binary +0 -0
index eaca76e8e61eb62f75dbdf093e803eea34330deb..30630c2befcb909205694d0dae19a8ca304cc047 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.viot binary +0 -0
index 71379a48ddebf7e1f5e853fcbbb6befd561cb8e4..ec4e3201ca754393735896c66704d6c9246ea650 100644
GIT binary patch
tests/data/acpi/x86/q35/DSDT.xapic binary +0 -0
index 9059812b5892ba7ac5c9bd312fd9f45a4f59f105..da4c47ab5a15b4d7818209317d6e7680f014b099 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -41

42 lines not on this page · raw message

Signature · 1 line
2.34.1