Fix broken cpu hotplug after migration
cover Fix broken cpu hotplug after migration
1st 4 patches are fixing regression and getting rid of not needed changes that were merged out of context (ARM CPU hotplug) without proper review, by simply reverting offendining patches to keep history clean as patches not 9.2 material to begin with.
The rest [5-7/7] are not tested RFC (not for merging to 9.2) for how problem could be dealt with and could be adopted/changed for the future ARM CPU hotplug series.
Igor Mammedov (6):
Revert "hw/acpi: Update ACPI _STA method with QOM vCPU ACPI Hotplug
states"
Revert "hw/acpi: Make CPUs ACPI presence conditional during vCPU
hot-unplug"
tests/acpi: update expected blobs
acpi: cpuhp: add option to AML genrator to opt-in to always present
vCPUs
acpi: cpuhp: use 'realized' status of vCPU to check if CPU is enabled
acpi: cpuhp: preserve always present vCPUs on unplug
Salil Mehta (1):
qtest: allow ACPI DSDT Table changes
include/hw/acpi/cpu.h | 5 +- include/hw/core/cpu.h | 2 - hw/acpi/acpi-cpu-hotplug-stub.c | 3 +- hw/acpi/cpu.c | 72 +++++------------- hw/acpi/cpu_hotplug.c | 2 +- hw/acpi/generic_event_device.c | 2 +- tests/data/acpi/x86/pc/DSDT | Bin 8560 -> 8526 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 8471 -> 8437 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 9885 -> 9851 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 15431 -> 15397 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 9024 -> 8990 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 10214 -> 10180 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 8511 -> 8477 bytes tests/data/acpi/x86/pc/DSDT.hpbrroot | Bin 5067 -> 5033 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 8632 -> 8598 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 9919 -> 9885 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 8418 -> 8384 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 8566 -> 8532 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 12353 -> 12319 bytes tests/data/acpi/x86/q35/DSDT | Bin 8389 -> 8355 bytes tests/data/acpi/x86/q35/DSDT.acpierst | Bin 8406 -> 8372 bytes tests/data/acpi/x86/q35/DSDT.acpihmat | Bin 9714 -> 9680 bytes .../acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8668 -> 8634 bytes tests/data/acpi/x86/q35/DSDT.applesmc | Bin 8435 -> 8401 bytes tests/data/acpi/x86/q35/DSDT.bridge | Bin 12002 -> 11968 bytes tests/data/acpi/x86/q35/DSDT.core-count | Bin 12947 -> 12913 bytes tests/data/acpi/x86/q35/DSDT.core-count2 | Bin 33804 -> 33770 bytes tests/data/acpi/x86/q35/DSDT.cphp | Bin 8853 -> 8819 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 13180 -> 13146 bytes tests/data/acpi/x86/q35/DSDT.dimmpxm | Bin 10043 -> 10009 bytes tests/data/acpi/x86/q35/DSDT.ipmibt | Bin 8464 -> 8430 bytes tests/data/acpi/x86/q35/DSDT.ipmismbus | Bin 8477 -> 8443 bytes tests/data/acpi/x86/q35/DSDT.ivrs | Bin 8406 -> 8372 bytes tests/data/acpi/x86/q35/DSDT.memhp | Bin 9748 -> 9714 bytes tests/data/acpi/x86/q35/DSDT.mmio64 | Bin 9519 -> 9485 bytes tests/data/acpi/x86/q35/DSDT.multi-bridge | Bin 13242 -> 13208 bytes tests/data/acpi/x86/q35/DSDT.noacpihp | Bin 8269 -> 8235 bytes tests/data/acpi/x86/q35/DSDT.nohpet | Bin 8247 -> 8213 bytes tests/data/acpi/x86/q35/DSDT.numamem | Bin 8395 -> 8361 bytes tests/data/acpi/x86/q35/DSDT.pvpanic-isa | Bin 8490 -> 8456 bytes tests/data/acpi/x86/q35/DSDT.thread-count | Bin 12947 -> 12913 bytes tests/data/acpi/x86/q35/DSDT.thread-count2 | Bin 33804 -> 33770 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm12 | Bin 8995 -> 8961 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm2 | Bin 9021 -> 8987 bytes tests/data/acpi/x86/q35/DSDT.type4-count | Bin 18623 -> 18589 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 14646 -> 14612 bytes tests/data/acpi/x86/q35/DSDT.xapic | Bin 35752 -> 35718 bytes 47 files changed, 29 insertions(+), 57 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/7 qtest: allow ACPI DSDT Table changes
From: Salil Mehta <[email protected]>
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
@@ -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.43.0
PATCH 2/7 Revert "hw/acpi: Update ACPI `_STA` method with QOM vCPU ACPI Hotplug states"
In reply to Igor MammedovThis reverts commit bf1ecc8dad6061914730a2a2d57af6b37c3a4f8d which broke cpu hotplug in x86 after migration to older QEMU
--- include/hw/core/cpu.h | 1 - hw/acpi/cpu.c | 38 ++++---------------------------------- 2 files changed, 4 insertions(+), 35 deletions(-)
include/hw/core/cpu.h +0 -1
@@ -159,7 +159,6 @@ struct CPUClass {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);int (*gdb_read_register)(CPUState *cpu,GByteArray *buf,int reg);
hw/acpi/cpu.c +4 -34
@@ -50,18 +50,6 @@ void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list) } } -static bool check_cpu_enabled_status (DeviceState *dev) -{ -CPUClass *k = dev ?CPU_GET_CLASS (dev) :NULL ; -CPUState *cpu =CPU (dev); - -if (cpu && (!k->cpu_enabled_status || k->cpu_enabled_status (cpu))) { -return true; - } - -return false; -} -static uint64_t cpu_hotplug_rd (void *opaque,hwaddr addr,unsigned size) {uint64_t val =0 ;
@@ -75,11 +63,10 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size) cdev = &cpu_st->devs[cpu_st->selector];switch (addr) {case ACPI_CPU_FLAGS_OFFSET_RW :/* pack and return is_* fields */ - val |=check_cpu_enabled_status (DEVICE (cdev->cpu)) ?1 :0 ; + val |= cdev->cpu ?1 :0 ; 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 :
@@ -362,7 +349,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 +409,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 +439,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 );
@@ -484,26 +467,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, {Aml *idx =aml_arg (0 );Aml *sta =aml_local (0 ); -Aml *ifctx2; -Aml *else_ctx;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)); + 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); +aml_append (ifctx,aml_store (aml_int (0xF ), sta)); }aml_append (method, ifctx);aml_append (method,aml_release (ctrl_lock));
Signature · 1 line
2.43.0
PATCH 3/7 Revert "hw/acpi: Make CPUs ACPI `presence` conditional during vCPU hot-unplug"
In reply to Igor MammedovThis reverts commit 2d6cfbaf174b91dfa9a50065f7494634afb39c23.
The patch is supposed to be part of ARM CPU hotplug series and has not value on its own without it. The series however is still in RFC stage and outside of scope 9.2 release.
On top of that it introduces not needed callback that pokes directly into CPU state without any need for that. Instead properties and AML generator option should be used to configure static platform depended vCPU presence state.
Drop the patch so that corrected version could be posted along with ARM CPU hotplug series and properly reviewed in relevant context. That also helps us to keep history cleaner with new patch being against original code vs a string of fixups on top of current mess.
--- include/hw/core/cpu.h | 1 - hw/acpi/cpu.c | 15 +-------------- 2 files changed, 1 insertion(+), 15 deletions(-)
include/hw/core/cpu.h +0 -1
@@ -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);void (*set_pc)(CPUState *cpu,vaddr value);vaddr (*get_pc)(CPUState *cpu);int (*gdb_read_register)(CPUState *cpu,GByteArray *buf,int reg);
hw/acpi/cpu.c +1 -14
@@ -233,17 +233,6 @@ 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) -{ -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)); -} -static AcpiCpuStatus *get_cpu_status (CPUHotplugState *cpu_st,DeviceState *dev) {CPUClass *k =CPU_GET_CLASS (dev);
@@ -300,9 +289,7 @@ void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,return ; } -if (!should_remain_acpi_present (dev)) { - cdev->cpu =NULL ; - } + cdev->cpu =NULL ; }static const VMStateDescription vmstate_cpuhp_sts = {
Signature · 1 line
2.43.0
PATCH 4/7 tests/acpi: update expected blobs
In reply to Igor MammedovExpected AML return to the state before
bf1ecc8dad606 (w/acpi: Update ACPI _STA method with QOM vCPU ACPI Hotplug states)
droping not needed CPRS and _STA logic that broke cpu hotplug
@@ -2887,7 +2887,6 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001)
CRMV, 1,
CEJ0, 1,
CEJF, 1,
- CPRS, 1,
Offset (0x05),
CCMD, 8
}
@@ -2922,16 +2921,9 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001)
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))
{
- If ((\_SB.PCI0.PRES.CPEN == One))
- {
- Local0 = 0x0F
- }
- Else
- {
- Local0 = 0x0D
- }
+ Local0 = 0x0F
}
--- tests/qtest/bios-tables-test-allowed-diff.h | 41 ------------------ tests/data/acpi/x86/pc/DSDT | Bin 8560 -> 8526 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 8471 -> 8437 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 9885 -> 9851 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 15431 -> 15397 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 9024 -> 8990 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 10214 -> 10180 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 8511 -> 8477 bytes tests/data/acpi/x86/pc/DSDT.hpbrroot | Bin 5067 -> 5033 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 8632 -> 8598 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 9919 -> 9885 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 8418 -> 8384 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 8566 -> 8532 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 12353 -> 12319 bytes tests/data/acpi/x86/q35/DSDT | Bin 8389 -> 8355 bytes tests/data/acpi/x86/q35/DSDT.acpierst | Bin 8406 -> 8372 bytes tests/data/acpi/x86/q35/DSDT.acpihmat | Bin 9714 -> 9680 bytes .../acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8668 -> 8634 bytes tests/data/acpi/x86/q35/DSDT.applesmc | Bin 8435 -> 8401 bytes tests/data/acpi/x86/q35/DSDT.bridge | Bin 12002 -> 11968 bytes tests/data/acpi/x86/q35/DSDT.core-count | Bin 12947 -> 12913 bytes tests/data/acpi/x86/q35/DSDT.core-count2 | Bin 33804 -> 33770 bytes tests/data/acpi/x86/q35/DSDT.cphp | Bin 8853 -> 8819 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 13180 -> 13146 bytes tests/data/acpi/x86/q35/DSDT.dimmpxm | Bin 10043 -> 10009 bytes tests/data/acpi/x86/q35/DSDT.ipmibt | Bin 8464 -> 8430 bytes tests/data/acpi/x86/q35/DSDT.ipmismbus | Bin 8477 -> 8443 bytes tests/data/acpi/x86/q35/DSDT.ivrs | Bin 8406 -> 8372 bytes tests/data/acpi/x86/q35/DSDT.memhp | Bin 9748 -> 9714 bytes tests/data/acpi/x86/q35/DSDT.mmio64 | Bin 9519 -> 9485 bytes tests/data/acpi/x86/q35/DSDT.multi-bridge | Bin 13242 -> 13208 bytes tests/data/acpi/x86/q35/DSDT.noacpihp | Bin 8269 -> 8235 bytes tests/data/acpi/x86/q35/DSDT.nohpet | Bin 8247 -> 8213 bytes tests/data/acpi/x86/q35/DSDT.numamem | Bin 8395 -> 8361 bytes tests/data/acpi/x86/q35/DSDT.pvpanic-isa | Bin 8490 -> 8456 bytes tests/data/acpi/x86/q35/DSDT.thread-count | Bin 12947 -> 12913 bytes tests/data/acpi/x86/q35/DSDT.thread-count2 | Bin 33804 -> 33770 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm12 | Bin 8995 -> 8961 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm2 | Bin 9021 -> 8987 bytes tests/data/acpi/x86/q35/DSDT.type4-count | Bin 18623 -> 18589 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 14646 -> 14612 bytes tests/data/acpi/x86/q35/DSDT.xapic | Bin 35752 -> 35718 bytes 42 files changed, 41 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -41
@@ -1,42 +1 @@/* 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",
tests/data/acpi/x86/pc/DSDT binary +0 -0
tests/data/acpi/x86/pc/DSDT.acpierst binary +0 -0
tests/data/acpi/x86/pc/DSDT.acpihmat binary +0 -0
tests/data/acpi/x86/pc/DSDT.bridge binary +0 -0
tests/data/acpi/x86/pc/DSDT.cphp binary +0 -0
tests/data/acpi/x86/pc/DSDT.dimmpxm binary +0 -0
tests/data/acpi/x86/pc/DSDT.hpbridge binary +0 -0
tests/data/acpi/x86/pc/DSDT.hpbrroot binary +0 -0
tests/data/acpi/x86/pc/DSDT.ipmikcs binary +0 -0
tests/data/acpi/x86/pc/DSDT.memhp binary +0 -0
tests/data/acpi/x86/pc/DSDT.nohpet binary +0 -0
tests/data/acpi/x86/pc/DSDT.numamem binary +0 -0
tests/data/acpi/x86/pc/DSDT.roothp binary +0 -0
tests/data/acpi/x86/q35/DSDT binary +0 -0
tests/data/acpi/x86/q35/DSDT.acpierst binary +0 -0
tests/data/acpi/x86/q35/DSDT.acpihmat binary +0 -0
tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator binary +0 -0
tests/data/acpi/x86/q35/DSDT.applesmc binary +0 -0
tests/data/acpi/x86/q35/DSDT.bridge binary +0 -0
tests/data/acpi/x86/q35/DSDT.core-count binary +0 -0
tests/data/acpi/x86/q35/DSDT.core-count2 binary +0 -0
tests/data/acpi/x86/q35/DSDT.cphp binary +0 -0
tests/data/acpi/x86/q35/DSDT.cxl binary +0 -0
tests/data/acpi/x86/q35/DSDT.dimmpxm binary +0 -0
tests/data/acpi/x86/q35/DSDT.ipmibt binary +0 -0
tests/data/acpi/x86/q35/DSDT.ipmismbus binary +0 -0
tests/data/acpi/x86/q35/DSDT.ivrs binary +0 -0
tests/data/acpi/x86/q35/DSDT.memhp binary +0 -0
tests/data/acpi/x86/q35/DSDT.mmio64 binary +0 -0
tests/data/acpi/x86/q35/DSDT.multi-bridge binary +0 -0
tests/data/acpi/x86/q35/DSDT.noacpihp binary +0 -0
tests/data/acpi/x86/q35/DSDT.nohpet binary +0 -0
tests/data/acpi/x86/q35/DSDT.numamem binary +0 -0
tests/data/acpi/x86/q35/DSDT.pvpanic-isa binary +0 -0
tests/data/acpi/x86/q35/DSDT.thread-count binary +0 -0
tests/data/acpi/x86/q35/DSDT.thread-count2 binary +0 -0
tests/data/acpi/x86/q35/DSDT.tis.tpm12 binary +0 -0
tests/data/acpi/x86/q35/DSDT.tis.tpm2 binary +0 -0
tests/data/acpi/x86/q35/DSDT.type4-count binary +0 -0
tests/data/acpi/x86/q35/DSDT.viot binary +0 -0
tests/data/acpi/x86/q35/DSDT.xapic binary +0 -0
Signature · 1 line
2.43.0
RFC 5/7 DO NOT MERGE: acpi: cpuhp: add option to AML genrator to opt-in to always present vCPUs
In reply to Igor MammedovLooking at [1] what 'present' bit would do, it's no necessary as it's statically defined for VM instance. So instead of introducing new ABI in cpuhp flags register, add CPUHotplugFeatures::always_present_cpus config option, that when set change _STA default return value to always present but not enabled. And the interpose 'enabled' check on top of it, which would set 'enabled' bit in return value if vCPU is enabled.
Platforms that need the feature can opt in by setting
CPUHotplugFeatures::always_present_cpus = true
for other plaforms _STA will revert to the behavior before [1]
1)
bf1ecc8dad606 (w/acpi: Update ACPI _STA method with QOM vCPU ACPI Hotplug states)
--- include/hw/acpi/cpu.h | 1 + hw/acpi/cpu.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
include/hw/acpi/cpu.h +1 -0
@@ -56,6 +56,7 @@ typedef struct CPUHotplugFeatures {bool acpi_1_compatible;bool has_legacy_cphp;bool fw_unplugs_cpu; +bool always_present_cpus;const char *smi_path; } CPUHotplugFeatures;
hw/acpi/cpu.c +7 -2
@@ -452,15 +452,20 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, method =aml_method (CPU_STS_METHOD ,1 ,AML_SERIALIZED ); { +/* +* For always present CPUs set all bits except of 'enabled' +* ACPI 1.0b: chapter '6.3.5 _STA' +*/ +uint8_t default_sta = opts.always_present_cpus ?0xd :0 ;Aml *idx =aml_arg (0 ); -Aml *sta =aml_local (0 ); +Aml *sta =aml_local (default_sta);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_enabled, one)); { -aml_append (ifctx,aml_store (aml_int (0xF ), sta)); +aml_append (ifctx,aml_or (aml_int (0xF ), sta, sta)); }aml_append (method, ifctx);aml_append (method,aml_release (ctrl_lock));
Signature · 1 line
2.43.0
RFC 6/7 DO NOT MERGE: acpi: cpuhp: use 'realized' status of vCPU to check if CPU is enabled
In reply to Igor Mammedovit still correct for x86 and other users, and can serve us as simpler to
[1] cpu_enabled_status() callback that does the same in a roundabout way.
It's still an RFC, and probably there we should add another property 'enabled' instead of abusing 'realized' and/or handle enabled state using hotplug handlers chain. i.e. in plug handler store enabled state AcpiCpuStatus and clear it in unplug handler instead of asking cpu from MMIO handler directly.
1) bf1ecc8dad606 (w/acpi: Update ACPI _STA method with QOM vCPU ACPI Hotplug states)
--- hw/acpi/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/acpi/cpu.c +3 -1
@@ -63,7 +63,9 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size) cdev = &cpu_st->devs[cpu_st->selector];switch (addr) {case ACPI_CPU_FLAGS_OFFSET_RW :/* pack and return is_* fields */ - val |= cdev->cpu ?1 :0 ; + val |= cdev->cpu ?object_property_get_bool (OBJECT (cdev->cpu), +"realized" ,NULL ) + :0 ; val |= cdev->is_inserting ?2 :0 ; val |= cdev->is_removing ?4 :0 ; val |= cdev->fw_remove ?16 :0 ;
Signature · 1 line
2.43.0
RFC 7/7 DO NOT MERGE: acpi: cpuhp: preserve always present vCPUs on unplug
In reply to Igor Mammedovdo not drop reference to always present vCPU and also avoid destroying it (unparent) on unplug.
Based-on: 2d6cfbaf174 (hw/acpi: Make CPUs ACPI presence conditional during vCPU hot-unplug)
--- include/hw/acpi/cpu.h | 4 +++- hw/acpi/acpi-cpu-hotplug-stub.c | 3 ++- hw/acpi/cpu.c | 10 ++++++++-- hw/acpi/cpu_hotplug.c | 2 +- hw/acpi/generic_event_device.c | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-)
include/hw/acpi/cpu.h +3 -1
@@ -36,6 +36,7 @@ typedef struct CPUHotplugState {uint32_t selector;uint8_t command;uint32_t dev_count; +bool always_present_cpus;AcpiCpuStatus *devs; } CPUHotplugState;
@@ -50,7 +51,8 @@ void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);void cpu_hotplug_hw_init (MemoryRegion *as,Object *owner, -CPUHotplugState *state,hwaddr base_addr); +CPUHotplugState *state,hwaddr base_addr, +bool always_present_cpus); typedef struct CPUHotplugFeatures { bool acpi_1_compatible;
hw/acpi/acpi-cpu-hotplug-stub.c +2 -1
@@ -20,7 +20,8 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, }void cpu_hotplug_hw_init (MemoryRegion *as,Object *owner, -CPUHotplugState *state,hwaddr base_addr) +CPUHotplugState *state,hwaddr base_addr, +bool always_present_cpus) {return ; }
hw/acpi/cpu.c +8 -2
@@ -145,7 +145,6 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data, dev =DEVICE (cdev->cpu); hotplug_ctrl =qdev_get_hotplug_handler (dev);hotplug_handler_unplug (hotplug_ctrl, dev,NULL ); -object_unparent (OBJECT (dev)); cdev->fw_remove = false; }else if (data &16 ) {if (!cdev->cpu || cdev->cpu == first_cpu) {
@@ -215,7 +214,8 @@ static const MemoryRegionOps cpu_hotplug_ops = { };void cpu_hotplug_hw_init (MemoryRegion *as,Object *owner, -CPUHotplugState *state,hwaddr base_addr) +CPUHotplugState *state,hwaddr base_addr, +bool always_present_cpus) {MachineState *machine =MACHINE (qdev_get_machine ());MachineClass *mc =MACHINE_GET_CLASS (machine);
@@ -226,6 +226,7 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, id_list = mc->possible_cpu_arch_ids (machine); state->dev_count = id_list->len; state->devs =g_new0 (typeof (*state->devs), state->dev_count); + state->always_present_cpus = always_present_cpus;for (i =0 ; i < id_list->len; i++) { state->devs[i].cpu =CPU (id_list->cpus[i].cpu); state->devs[i].arch_id = id_list->cpus[i].arch_id;
@@ -286,12 +287,17 @@ void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st, {AcpiCpuStatus *cdev; +if (cpu_st->always_present_cpus) { +return ; + } + cdev =get_cpu_status (cpu_st, dev);if (!cdev) {return ; } cdev->cpu =NULL ; +object_unparent (OBJECT (dev)); }static const VMStateDescription vmstate_cpuhp_sts = {
hw/acpi/cpu_hotplug.c +1 -1
@@ -115,7 +115,7 @@ void acpi_switch_to_modern_cphp(AcpiCpuHotplug *gpe_cpu,MemoryRegion *parent =pci_address_space_io (PCI_DEVICE (gpe_cpu->device));memory_region_del_subregion (parent, &gpe_cpu->io); -cpu_hotplug_hw_init (parent, gpe_cpu->device, cpuhp_state, io_port); +cpu_hotplug_hw_init (parent, gpe_cpu->device, cpuhp_state, io_port, false); } void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
hw/acpi/generic_event_device.c +1 -1
@@ -427,7 +427,7 @@ static void acpi_ged_realize(DeviceState *dev, Error **errp) ACPI_CPU_HOTPLUG_REG_LEN);sysbus_init_mmio (sbd, &s->container_cpuhp);cpu_hotplug_hw_init (&s->container_cpuhp,OBJECT (dev), - &s->cpuhp_state,0 ); + &s->cpuhp_state,0 , false);break ; } ged_events--;
Signature · 1 line
2.43.0
Quoted 9 lines · On Tue, 12 Nov 2024 18:02:51 +0100 Igor Mammedov <[email protected]> wrote:
1st 4 patches are fixing regression and getting rid of not needed changes that were merged out of context (ARM CPU hotplug) without proper review, by simply reverting offendining patches to keep history clean as patches not 9.2 material to begin with.
The rest [5-7/7] are not tested RFC (not for merging to 9.2) for how problem could be dealt with and could be adopted/changed for the future ARM CPU hotplug series.
Quoted 5 lines
Igor Mammedov (6):
Revert "hw/acpi: Update ACPI_STAmethod with QOM vCPU ACPI Hotplug
states"
Revert "hw/acpi: Make CPUs ACPIpresenceconditional during vCPU
hot-unplug"
ping
Michael,
are you going to pick it up for 9.2?
Quoted 58 lines
tests/acpi: update expected blobs
acpi: cpuhp: add option to AML genrator to opt-in to always present
vCPUs
acpi: cpuhp: use 'realized' status of vCPU to check if CPU is enabled
acpi: cpuhp: preserve always present vCPUs on unplugSalil Mehta (1):
qtest: allow ACPI DSDT Table changesinclude/hw/acpi/cpu.h | 5 +- include/hw/core/cpu.h | 2 - hw/acpi/acpi-cpu-hotplug-stub.c | 3 +- hw/acpi/cpu.c | 72 +++++------------- hw/acpi/cpu_hotplug.c | 2 +- hw/acpi/generic_event_device.c | 2 +- tests/data/acpi/x86/pc/DSDT | Bin 8560 -> 8526 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 8471 -> 8437 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 9885 -> 9851 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 15431 -> 15397 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 9024 -> 8990 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 10214 -> 10180 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 8511 -> 8477 bytes tests/data/acpi/x86/pc/DSDT.hpbrroot | Bin 5067 -> 5033 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 8632 -> 8598 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 9919 -> 9885 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 8418 -> 8384 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 8566 -> 8532 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 12353 -> 12319 bytes tests/data/acpi/x86/q35/DSDT | Bin 8389 -> 8355 bytes tests/data/acpi/x86/q35/DSDT.acpierst | Bin 8406 -> 8372 bytes tests/data/acpi/x86/q35/DSDT.acpihmat | Bin 9714 -> 9680 bytes .../acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8668 -> 8634 bytes tests/data/acpi/x86/q35/DSDT.applesmc | Bin 8435 -> 8401 bytes tests/data/acpi/x86/q35/DSDT.bridge | Bin 12002 -> 11968 bytes tests/data/acpi/x86/q35/DSDT.core-count | Bin 12947 -> 12913 bytes tests/data/acpi/x86/q35/DSDT.core-count2 | Bin 33804 -> 33770 bytes tests/data/acpi/x86/q35/DSDT.cphp | Bin 8853 -> 8819 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 13180 -> 13146 bytes tests/data/acpi/x86/q35/DSDT.dimmpxm | Bin 10043 -> 10009 bytes tests/data/acpi/x86/q35/DSDT.ipmibt | Bin 8464 -> 8430 bytes tests/data/acpi/x86/q35/DSDT.ipmismbus | Bin 8477 -> 8443 bytes tests/data/acpi/x86/q35/DSDT.ivrs | Bin 8406 -> 8372 bytes tests/data/acpi/x86/q35/DSDT.memhp | Bin 9748 -> 9714 bytes tests/data/acpi/x86/q35/DSDT.mmio64 | Bin 9519 -> 9485 bytes tests/data/acpi/x86/q35/DSDT.multi-bridge | Bin 13242 -> 13208 bytes tests/data/acpi/x86/q35/DSDT.noacpihp | Bin 8269 -> 8235 bytes tests/data/acpi/x86/q35/DSDT.nohpet | Bin 8247 -> 8213 bytes tests/data/acpi/x86/q35/DSDT.numamem | Bin 8395 -> 8361 bytes tests/data/acpi/x86/q35/DSDT.pvpanic-isa | Bin 8490 -> 8456 bytes tests/data/acpi/x86/q35/DSDT.thread-count | Bin 12947 -> 12913 bytes tests/data/acpi/x86/q35/DSDT.thread-count2 | Bin 33804 -> 33770 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm12 | Bin 8995 -> 8961 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm2 | Bin 9021 -> 8987 bytes tests/data/acpi/x86/q35/DSDT.type4-count | Bin 18623 -> 18589 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 14646 -> 14612 bytes tests/data/acpi/x86/q35/DSDT.xapic | Bin 35752 -> 35718 bytes 47 files changed, 29 insertions(+), 57 deletions(-)
Quoted 18 lines · Igor Mammedov
Quoted 9 lines · On Tue, 12 Nov 2024 18:02:51 +0100 Igor Mammedov <[email protected]> wrote:
1st 4 patches are fixing regression and getting rid of not needed changes that were merged out of context (ARM CPU hotplug) without proper review, by simply reverting offendining patches to keep history clean as patches not 9.2 material to begin with.
The rest [5-7/7] are not tested RFC (not for merging to 9.2) for how problem could be dealt with and could be adopted/changed for the future ARM CPU hotplug series.
Quoted 5 lines
Igor Mammedov (6):
Revert "hw/acpi: Update ACPI_STAmethod with QOM vCPU ACPI Hotplug
states"
Revert "hw/acpi: Make CPUs ACPIpresenceconditional during vCPU
hot-unplug"
Quoted 4 lines
ping
Michael,
are you going to pick it up for 9.2?
yes, I am testing a pull as we speak.
Quoted 59 lines
Quoted 59 lines
tests/acpi: update expected blobs
acpi: cpuhp: add option to AML genrator to opt-in to always present
vCPUs
acpi: cpuhp: use 'realized' status of vCPU to check if CPU is enabled
acpi: cpuhp: preserve always present vCPUs on unplugSalil Mehta (1):
qtest: allow ACPI DSDT Table changesinclude/hw/acpi/cpu.h | 5 +- include/hw/core/cpu.h | 2 - hw/acpi/acpi-cpu-hotplug-stub.c | 3 +- hw/acpi/cpu.c | 72 +++++------------- hw/acpi/cpu_hotplug.c | 2 +- hw/acpi/generic_event_device.c | 2 +- tests/data/acpi/x86/pc/DSDT | Bin 8560 -> 8526 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 8471 -> 8437 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 9885 -> 9851 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 15431 -> 15397 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 9024 -> 8990 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 10214 -> 10180 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 8511 -> 8477 bytes tests/data/acpi/x86/pc/DSDT.hpbrroot | Bin 5067 -> 5033 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 8632 -> 8598 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 9919 -> 9885 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 8418 -> 8384 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 8566 -> 8532 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 12353 -> 12319 bytes tests/data/acpi/x86/q35/DSDT | Bin 8389 -> 8355 bytes tests/data/acpi/x86/q35/DSDT.acpierst | Bin 8406 -> 8372 bytes tests/data/acpi/x86/q35/DSDT.acpihmat | Bin 9714 -> 9680 bytes .../acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8668 -> 8634 bytes tests/data/acpi/x86/q35/DSDT.applesmc | Bin 8435 -> 8401 bytes tests/data/acpi/x86/q35/DSDT.bridge | Bin 12002 -> 11968 bytes tests/data/acpi/x86/q35/DSDT.core-count | Bin 12947 -> 12913 bytes tests/data/acpi/x86/q35/DSDT.core-count2 | Bin 33804 -> 33770 bytes tests/data/acpi/x86/q35/DSDT.cphp | Bin 8853 -> 8819 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 13180 -> 13146 bytes tests/data/acpi/x86/q35/DSDT.dimmpxm | Bin 10043 -> 10009 bytes tests/data/acpi/x86/q35/DSDT.ipmibt | Bin 8464 -> 8430 bytes tests/data/acpi/x86/q35/DSDT.ipmismbus | Bin 8477 -> 8443 bytes tests/data/acpi/x86/q35/DSDT.ivrs | Bin 8406 -> 8372 bytes tests/data/acpi/x86/q35/DSDT.memhp | Bin 9748 -> 9714 bytes tests/data/acpi/x86/q35/DSDT.mmio64 | Bin 9519 -> 9485 bytes tests/data/acpi/x86/q35/DSDT.multi-bridge | Bin 13242 -> 13208 bytes tests/data/acpi/x86/q35/DSDT.noacpihp | Bin 8269 -> 8235 bytes tests/data/acpi/x86/q35/DSDT.nohpet | Bin 8247 -> 8213 bytes tests/data/acpi/x86/q35/DSDT.numamem | Bin 8395 -> 8361 bytes tests/data/acpi/x86/q35/DSDT.pvpanic-isa | Bin 8490 -> 8456 bytes tests/data/acpi/x86/q35/DSDT.thread-count | Bin 12947 -> 12913 bytes tests/data/acpi/x86/q35/DSDT.thread-count2 | Bin 33804 -> 33770 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm12 | Bin 8995 -> 8961 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm2 | Bin 9021 -> 8987 bytes tests/data/acpi/x86/q35/DSDT.type4-count | Bin 18623 -> 18589 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 14646 -> 14612 bytes tests/data/acpi/x86/q35/DSDT.xapic | Bin 35752 -> 35718 bytes 47 files changed, 29 insertions(+), 57 deletions(-)