Arch agnostic ACPI changes to support vCPU Hotplug (on Archs like ARM)
v2 cover Arch agnostic ACPI changes to support vCPU Hotplug (on Archs like ARM)
Change Log
==========
Patch V1 -> V2:
1. Addressed Igor Mammedov's (Redhat) raised issues:
- Removed ACPICPUstatus::is_present State and its handling in the ACPI APUs AML code and now all QOM vCPUs are present.
- Dropped the concept of acpi_persistent because now QOM vCPUs states and the ACPI vCPU states are consistent.
- QOM vCPU objects are always present now (accompanying RFC V6)
- Added .needed() hook to the GED VMSD toconditionally migrate the ACPI CPU hotplug state at the source VM.
2. Addressed Zhao Liu's (Intel) reported x86 DSDT Table bios-acpi-test failure
3. Incorporated Gustavo Romero's comments and added his Tag to [Patches 1,2,4]
4. Addressed Gavin Shan's comment to reduce the inline code comments wherever possible.
Brief Recall
============
With the advent of multi-core SoCs, the concept of CPU-level hotplugging has become less distinct, often functioning as a power on/off event rather than a full hotplug operation. However, hotplug support at the die/NUMA/socket level remains meaningful and is architecture-specific. Virtual CPU hotplug can be supported regardless of architectural support for physical CPU hotplug, as it serves resource management needs—such as dynamically scaling VM compute capacity based on demand or SLAs, optimizing boot times, or reducing memory footprint. Although, its desing must be scalable and must co-exist with future die/NUMA/socket level hotplug features.
Motivation for this patch-set
=============================
In architectures that support vCPU hotplug, firmware or the VMM/QEMU typically reflects vCPU status changes to the OS via the ACPI _STA.Present bit. However, certain CPU architectures prohibit [1] modifications to CPU presence after kernel boot. This restriction [2][3] could be due to closely integrated per-CPU components—like interrupt controllers or other features— that may not support reconfiguration post-boot and are often in an always-on power domain. Consequently, specifications for these architectures require all CPUs to remain present i.e._STA.Present=True, once the system is initialized.
To be able to support vCPU Hotplug feature, as a workaround to the above limitation, ACPI method _STA.Enabled Bit could be used to reflect the plugged and unplugged states of the QOM vCPUs.
This patch set introduces the following changes:
1. Explicit ACPICPUstatus::is_enabled State: Adds an is_enabled state, initialized during machine setup and updated during CPU hotplug and hot-unplug events.
2. Support for Migrating ACPI CPU State: Facilitates the migration of the ACPI CPU state. (This needs reconsideration as per Igor. Last patch can be dropped if this affects the acceptability of other patches of this patch-set)
3. Updates the Qtest bios-acpi-test
This patch set is designed to work independently and is meant to ensures compatibility with existing hotplug support across different architectures. This patch-set has been tested alongside ARM-specific vCPU hotplug changes (included in the upcoming RFC V6 [4]), and hot(un)plug functionalities performed as expected which concerns this patch-set. Please have a look.
Thank you!
Repository of this patch-set
============================
(*) Latest Architecture Agnostic ACPI changes patch-set:
https://github.com/salil-mehta/qemu.git virt-cpuhp-armv8/rfc-v6.arch.agnostic.acpi.v2
(*) Works with upcoming ARM architecture specific patch-set RFC V6 [4]
References
==========
[1] Check comment 5 in the bugzilla entry
Link: https://bugzilla.tianocore.org/show_bug.cgi?id=4481#c5
[2] KVMForum 2023 Presentation: Challenges Revisited in Supporting Virt CPU Hotplug on architectures that don’t Support CPU Hotplug (like ARM64)
a. Kernel Link: https://kvm-forum.qemu.org/2023/KVM-forum-cpu-hotplug_7OJ1YyJ.pdf
b. Qemu Link: https://kvm-forum.qemu.org/2023/Challenges_Revisited_in_Supporting_Virt_CPU_Hotplug_-__ii0iNb3.pdf
[3] KVMForum 2020 Presentation: Challenges in Supporting Virtual CPU Hotplug on
SoC Based Systems (like ARM64)
[4] Upcoming RFC V6, Support of Virtual CPU Hotplug for ARMv8 Arch
Salil Mehta (6):
hw/acpi: Introduce is_enabled state in ACPI CPU Hotplug Status hw/acpi: Update ACPI CPU Hotplug state during vCPU hot(un)plug
qtest: allow ACPI DSDT Table changes
hw/acpi: Update CPUs AML's is_enabled state in ACPI _STA method tests/qtest/bios-tables-test: Update DSDT golden masters for
x86/{pc,q35}hw/acpi: Update GED with vCPU Hotplug VMSD for migration
hw/acpi/cpu.c | 22 ++++++++++++++++-- hw/acpi/generic_event_device.c | 19 +++++++++++++++ include/hw/acpi/cpu.h | 2 +- tests/data/acpi/x86/pc/DSDT | Bin 8527 -> 8533 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 8438 -> 8444 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 9852 -> 9858 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 15398 -> 15404 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 8991 -> 8997 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 10181 -> 10187 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 8478 -> 8484 bytes tests/data/acpi/x86/pc/DSDT.hpbrroot | Bin 5034 -> 5040 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 8599 -> 8605 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 9886 -> 9892 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 8385 -> 8391 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 8533 -> 8539 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 12320 -> 12326 bytes tests/data/acpi/x86/q35/DSDT | Bin 8355 -> 8361 bytes tests/data/acpi/x86/q35/DSDT.acpierst | Bin 8372 -> 8378 bytes tests/data/acpi/x86/q35/DSDT.acpihmat | Bin 9680 -> 9686 bytes .../acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8634 -> 8640 bytes tests/data/acpi/x86/q35/DSDT.applesmc | Bin 8401 -> 8407 bytes tests/data/acpi/x86/q35/DSDT.bridge | Bin 11968 -> 11974 bytes tests/data/acpi/x86/q35/DSDT.core-count | Bin 12913 -> 12919 bytes tests/data/acpi/x86/q35/DSDT.core-count2 | Bin 33770 -> 33776 bytes tests/data/acpi/x86/q35/DSDT.cphp | Bin 8819 -> 8825 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 13148 -> 13154 bytes tests/data/acpi/x86/q35/DSDT.dimmpxm | Bin 10009 -> 10015 bytes tests/data/acpi/x86/q35/DSDT.ipmibt | Bin 8430 -> 8436 bytes tests/data/acpi/x86/q35/DSDT.ipmismbus | Bin 8443 -> 8449 bytes tests/data/acpi/x86/q35/DSDT.ivrs | Bin 8372 -> 8378 bytes tests/data/acpi/x86/q35/DSDT.memhp | Bin 9714 -> 9720 bytes tests/data/acpi/x86/q35/DSDT.mmio64 | Bin 9485 -> 9491 bytes tests/data/acpi/x86/q35/DSDT.multi-bridge | Bin 13208 -> 13214 bytes tests/data/acpi/x86/q35/DSDT.noacpihp | Bin 8235 -> 8241 bytes tests/data/acpi/x86/q35/DSDT.nohpet | Bin 8213 -> 8219 bytes tests/data/acpi/x86/q35/DSDT.numamem | Bin 8361 -> 8367 bytes tests/data/acpi/x86/q35/DSDT.pvpanic-isa | Bin 8456 -> 8462 bytes tests/data/acpi/x86/q35/DSDT.thread-count | Bin 12913 -> 12919 bytes tests/data/acpi/x86/q35/DSDT.thread-count2 | Bin 33770 -> 33776 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm12 | Bin 8961 -> 8967 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm2 | Bin 8987 -> 8993 bytes tests/data/acpi/x86/q35/DSDT.type4-count | Bin 18589 -> 18595 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 14615 -> 14621 bytes tests/data/acpi/x86/q35/DSDT.xapic | Bin 35718 -> 35724 bytes 44 files changed, 40 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/6 hw/acpi: Introduce `is_enabled` state in ACPI CPU Hotplug Status
On most architectures, during vCPU hot-plug and hot-unplug actions, firmware or the VMM/QEMU can convey vCPU status to the OS by toggling the ACPI method _STA.Present Bit. However, certain CPU architecture specifications prohibit [1] modifications to CPU's presence after the kernel has booted.
This limitation [2][3] arises because many per-CPU components, such as interrupt controllers that are closely integrated with CPUs, or other per-CPU features, may not support reconfiguration once the kernel is initialized. These components often cannot be powered down as they might belong to an always-on power domain. Consequently, specifications require all CPUs to remain _STA.Present after system initialization.
To address this issue from an ACPI perspective, an is_enabled state has been introduced in the AcpiCpuStatus. This state reflects whether a vCPU has been hot-plugged or hot-unplugged in QEMU, thus indicating its availability to the guest kernel. The guest can evaluate this status by calling the ACPI _STA method and checking the _STA.Enabled bit after QEMU signals the hot-plug event via GED.
References:
[1] Check comment 5 in the bugzilla entry
Link: https://bugzilla.tianocore.org/show_bug.cgi?id=4481#c5
[2] KVMForum 2023 Presentation: Challenges Revisited in Supporting Virt CPU Hotplug on architectures that don’t Support CPU Hotplug (like ARM64)
a. Kernel Link: https://kvm-forum.qemu.org/2023/KVM-forum-cpu-hotplug_7OJ1YyJ.pdf
b. Qemu Link: https://kvm-forum.qemu.org/2023/Challenges_Revisited_in_Supporting_Virt_CPU_Hotplug_-__ii0iNb3.pdf
[3] KVMForum 2020 Presentation: Challenges in Supporting Virtual CPU Hotplug on
SoC Based Systems (like ARM64)
--- hw/acpi/cpu.c | 9 ++++++++- include/hw/acpi/cpu.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-)
hw/acpi/cpu.c +8 -1
@@ -225,7 +225,14 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, state->dev_count = id_list->len; state->devs =g_new0 (typeof (*state->devs), state->dev_count);for (i =0 ; i < id_list->len; i++) { - state->devs[i].cpu =CPU (id_list->cpus[i].cpu); +struct CPUState *cpu =CPU (id_list->cpus[i].cpu); + + state->devs[i].cpu = cpu; +if (cpu &&DEVICE (cpu)->realized) { + state->devs[i].is_enabled = true; + }else { + state->devs[i].is_enabled = false; + } state->devs[i].arch_id = id_list->cpus[i].arch_id; } memory_region_init_io(&state->ctrl_reg, owner, &cpu_hotplug_ops, state,
include/hw/acpi/cpu.h +1 -1
@@ -26,6 +26,7 @@ typedef struct AcpiCpuStatus {uint64_t arch_id;bool is_inserting;bool is_removing; +bool is_enabled;bool fw_remove;uint32_t ost_event;uint32_t ost_status;
@@ -74,5 +75,4 @@ extern const VMStateDescription vmstate_cpu_hotplug;#define VMSTATE_CPU_HOTPLUG (cpuhp, state) \ VMSTATE_STRUCT(cpuhp, state, 1, \ vmstate_cpu_hotplug, CPUHotplugState) -#endif
Signature · 1 line
2.34.1
PATCH v2 2/6 hw/acpi: Update ACPI CPU Hotplug state during vCPU hot(un)plug
In reply to Salil MehtaUpdate the is_enabled state in AcpiCpuStatus when vCPUs are hot-plugged or hot-unplugged.
--- hw/acpi/cpu.c | 2 ++ 1 file changed, 2 insertions(+)
hw/acpi/cpu.c +2 -0
@@ -265,6 +265,7 @@ void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, } cdev->cpu =CPU (dev); + cdev->is_enabled = true;if (dev->hotplugged) { cdev->is_inserting = true;acpi_send_event (DEVICE (hotplug_dev),ACPI_CPU_HOTPLUG_STATUS );
@@ -296,6 +297,7 @@ void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,return ; } + cdev->is_enabled = false; cdev->cpu =NULL ; }
Signature · 1 line
2.34.1
PATCH v2 3/6 qtest: allow ACPI DSDT Table changes
In reply to Salil Mehtalist changed files in tests/qtest/bios-tables-test-allowed-diff.h
--- 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.34.1
PATCH v2 4/6 hw/acpi: Update CPUs AML's `is_enabled` state in ACPI _STA method
In reply to Salil MehtaUpdate the CPUs AML code to reflect the ACPI CPU Hotplug is_enabled state in the _STA.Enabled Bit when the ACPI _STA method is evaluated by the Guest Kernel during initialization, as well as when vCPUs are hot-plugged or hot-unplugged.
--- hw/acpi/cpu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
hw/acpi/cpu.c +9 -1
@@ -63,7 +63,7 @@ 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->is_enabled ?1 :0 ; val |= cdev->is_inserting ?2 :0 ; val |= cdev->is_removing ?4 :0 ; val |= cdev->fw_remove ?16 :0 ;
@@ -463,15 +463,23 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, {Aml *idx =aml_arg (0 );Aml *sta =aml_local (0 ); +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_enabled, one)); { +/* cpu is present and enabled */ aml_append (ifctx,aml_store (aml_int (0xF ), sta)); }aml_append (method, ifctx); + else_ctx =aml_else (); + { +/* cpu is present but disabled */ +aml_append (else_ctx,aml_store (aml_int (0xD ), sta)); + } +aml_append (method, else_ctx);aml_append (method,aml_release (ctrl_lock));aml_append (method,aml_return (sta)); }
Signature · 1 line
2.34.1
PATCH v2 5/6 tests/qtest/bios-tables-test: Update DSDT golden masters for x86/{pc,q35}
In reply to Salil MehtaUpdate DSDT golden master files for x86/pc and x86/q35 platforms to accommodate changes made in the architecture-agnostic CPU AML. These updates notify the guest OS of vCPU hot-plug and hot-unplug status using the ACPI _STA.Enabled bit.
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, Wed Oct 30 11:24:52 2024
+ * Disassembly of /tmp/aml-2A3EW2, Wed Oct 30 11:24:52 2024 *
* Original Table Header:
* Signature "DSDT"
- * Length 0x0000214F (8527)
+ * Length 0x00002155 (8533)
* Revision 0x01 **** 32-bit table (V1), no 64-bit math support
- * Checksum 0x59
+ * Checksum 0xD2
* OEM ID "BOCHS "
* OEM Table ID "BXPC "
* OEM Revision 0x00000001 (1)
@@ -1517,6 +1517,10 @@
If ((\_SB.PCI0.PRES.CPEN == One))
{
Local0 = 0x0F
+ }
+ Else
+ {
+ Local0 = 0x0D
}
Release (\_SB.PCI0.PRES.CPLK)--- tests/data/acpi/x86/pc/DSDT | Bin 8527 -> 8533 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 8438 -> 8444 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 9852 -> 9858 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 15398 -> 15404 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 8991 -> 8997 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 10181 -> 10187 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 8478 -> 8484 bytes tests/data/acpi/x86/pc/DSDT.hpbrroot | Bin 5034 -> 5040 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 8599 -> 8605 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 9886 -> 9892 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 8385 -> 8391 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 8533 -> 8539 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 12320 -> 12326 bytes tests/data/acpi/x86/q35/DSDT | Bin 8355 -> 8361 bytes tests/data/acpi/x86/q35/DSDT.acpierst | Bin 8372 -> 8378 bytes tests/data/acpi/x86/q35/DSDT.acpihmat | Bin 9680 -> 9686 bytes .../acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8634 -> 8640 bytes tests/data/acpi/x86/q35/DSDT.applesmc | Bin 8401 -> 8407 bytes tests/data/acpi/x86/q35/DSDT.bridge | Bin 11968 -> 11974 bytes tests/data/acpi/x86/q35/DSDT.core-count | Bin 12913 -> 12919 bytes tests/data/acpi/x86/q35/DSDT.core-count2 | Bin 33770 -> 33776 bytes tests/data/acpi/x86/q35/DSDT.cphp | Bin 8819 -> 8825 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 13148 -> 13154 bytes tests/data/acpi/x86/q35/DSDT.dimmpxm | Bin 10009 -> 10015 bytes tests/data/acpi/x86/q35/DSDT.ipmibt | Bin 8430 -> 8436 bytes tests/data/acpi/x86/q35/DSDT.ipmismbus | Bin 8443 -> 8449 bytes tests/data/acpi/x86/q35/DSDT.ivrs | Bin 8372 -> 8378 bytes tests/data/acpi/x86/q35/DSDT.memhp | Bin 9714 -> 9720 bytes tests/data/acpi/x86/q35/DSDT.mmio64 | Bin 9485 -> 9491 bytes tests/data/acpi/x86/q35/DSDT.multi-bridge | Bin 13208 -> 13214 bytes tests/data/acpi/x86/q35/DSDT.noacpihp | Bin 8235 -> 8241 bytes tests/data/acpi/x86/q35/DSDT.nohpet | Bin 8213 -> 8219 bytes tests/data/acpi/x86/q35/DSDT.numamem | Bin 8361 -> 8367 bytes tests/data/acpi/x86/q35/DSDT.pvpanic-isa | Bin 8456 -> 8462 bytes tests/data/acpi/x86/q35/DSDT.thread-count | Bin 12913 -> 12919 bytes tests/data/acpi/x86/q35/DSDT.thread-count2 | Bin 33770 -> 33776 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm12 | Bin 8961 -> 8967 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm2 | Bin 8987 -> 8993 bytes tests/data/acpi/x86/q35/DSDT.type4-count | Bin 18589 -> 18595 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 14615 -> 14621 bytes tests/data/acpi/x86/q35/DSDT.xapic | Bin 35718 -> 35724 bytes tests/qtest/bios-tables-test-allowed-diff.h | 41 ------------------ 42 files changed, 41 deletions(-)
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
tests/qtest/bios-tables-test-allowed-diff.h +0 -41
42 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 6/6 hw/acpi: Update GED with vCPU Hotplug VMSD for migration
In reply to Salil MehtaThe ACPI CPU hotplug state is_enabled must be migrated along with other vCPU hotplug states to the destination VM. Update the GED's VM State Description (VMSD) table subsection to include the CPU Hotplug VM State Description (VMSD).
Question: How to stop is_enabled state being migrated in case of x86?
Excerpt of GED VMSD State Dump at Source:
"acpi-ged (16)": {
"ged_state": {
"sel": "0x00000000"
},
[...]
"acpi-ged/cpuhp": {
"cpuhp_state": {
"selector": "0x00000005",
"command": "0x00",
"devs": [
{
"is_inserting": false,
"is_removing": false,
"is_enabled": true,
"ost_event": "0x00000000",
"ost_status": "0x00000000"
},
[...]
{
"is_inserting": false,
"is_removing": false,
"is_enabled": false,
"ost_event": "0x00000000",
"ost_status": "0x00000000"
}
]
}
}
},--- hw/acpi/cpu.c | 1 + hw/acpi/generic_event_device.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)
hw/acpi/cpu.c +1 -0
@@ -308,6 +308,7 @@ static const VMStateDescription vmstate_cpuhp_sts = { .fields = (const VMStateField[]) {VMSTATE_BOOL (is_inserting, AcpiCpuStatus),VMSTATE_BOOL (is_removing, AcpiCpuStatus), +VMSTATE_BOOL (is_enabled, AcpiCpuStatus),VMSTATE_UINT32 (ost_event, AcpiCpuStatus),VMSTATE_UINT32 (ost_status, AcpiCpuStatus),VMSTATE_END_OF_LIST ()
hw/acpi/generic_event_device.c +19 -0
@@ -331,6 +331,24 @@ static const VMStateDescription vmstate_memhp_state = { } }; +static bool cpuhp_needed (void *opaque) +{ +MachineClass *mc =MACHINE_GET_CLASS (qdev_get_machine ()); + +return mc->has_hotpluggable_cpus; +} + +static const VMStateDescription vmstate_cpuhp_state = { + .name ="acpi-ged/cpuhp" , + .version_id =1 , + .minimum_version_id =1 , + .needed = cpuhp_needed, + .fields = (VMStateField []) { +VMSTATE_CPU_HOTPLUG (cpuhp_state, AcpiGedState), +VMSTATE_END_OF_LIST () + } +}; +static const VMStateDescription vmstate_ged_state = { .name ="acpi-ged-state" , .version_id =1 ,
@@ -379,6 +397,7 @@ static const VMStateDescription vmstate_acpi_ged = { }, .subsections = (const VMStateDescription * const []) { &vmstate_memhp_state, + &vmstate_cpuhp_state, &vmstate_ghes_state,NULL }
Signature · 1 line
2.34.1
Hello,
Please ignore this patch-set as there was some issue w.r.t x86. Details are in the V3 patch-set sent for review today. V3 has fixed almost all of the issues identified by Igor in the V1 patch-set in relation to x86.
Please have a look at the below V3 patch-set:
[PATCH V3 0/5] Arch agnostic ACPI changes to support vCPU Hotplug (on Archs like ARM)
https://lore.kernel.org/qemu-devel/[email protected]/#t
Sorry for any inconvenience above might have caused.
Best regards
Salil.
Quoted 186 lines
-----Original Message-----
From: Salil Mehta <[email protected]>
Sent: Thursday, October 31, 2024 8:05 PM
To: [email protected]; [email protected]; [email protected]
Cc: Salil Mehta <[email protected]>; [email protected]; jean- [email protected]; Jonathan Cameron <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; zhukeqian <[email protected]>; wangxiongfeng (C) <[email protected]>; wangyanan (Y) <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Linuxarm <[email protected]>; [email protected]
Subject: [PATCH V2 0/6] Arch agnostic ACPI changes to support vCPU Hotplug (on Archs like ARM)Change Log
==========Patch V1 -> V2:
1. Addressed Igor Mammedov's (Redhat) raised issues:
- RemovedACPICPUstatus::is_presentState and its handling in the ACPI APUs AML code and now all QOM vCPUs are present.
- Dropped the concept ofacpi_persistentbecause now QOM vCPUs states and the ACPI vCPU states are consistent.
- QOM vCPU objects are always present now (accompanying RFC V6)
- Added .needed() hook to the GED VMSD toconditionally migrate the ACPI CPU hotplug state at the source VM.
2. Addressed Zhao Liu's (Intel) reported x86 DSDT Table bios-acpi-test failure
3. Incorporated Gustavo Romero's comments and added his Tag to [Patches 1,2,4] 4. Addressed Gavin Shan's comment to reduce the inline code comments
wherever possible.Brief Recall
============
With the advent of multi-core SoCs, the concept of CPU-level hotplugging has become less distinct, often functioning as a power on/off event rather than a full hotplug operation. However, hotplug support at the die/NUMA/socket level remains meaningful and is architecture-specific. Virtual CPU hotplug can be supported regardless of architectural support for physical CPU hotplug, as it serves resource management needs—such as dynamically scaling VM compute capacity based on demand or SLAs, optimizing boot times, or reducing memory footprint. Although, its desing must be scalable and must co-exist with future die/NUMA/socket level hotplug features.Motivation for this patch-set
=============================
In architectures that support vCPU hotplug, firmware or the VMM/QEMU typically reflects vCPU status changes to the OS via the ACPI_STA.Presentbit. However, certain CPU architectures prohibit [1] modifications to CPU presence after kernel boot. This restriction [2][3] could be due to closely integrated per-CPU components—like interrupt controllers or other features— that may not support reconfiguration post-boot and are often in analways-onpower domain. Consequently, specifications for these architectures require all CPUs to remain present i.e._STA.Present=True, once the system is initialized.To be able to support vCPU Hotplug feature, as a workaround to the above limitation, ACPI method
_STA.EnabledBit could be used to reflect the plugged and unplugged states of the QOM vCPUs.This patch set introduces the following changes:
1. Explicit
ACPICPUstatus::is_enabledState: Adds anis_enabledstate, initialized during machine setup and updated during CPU hotplug and hot-unplug events.2. Support for Migrating ACPI CPU State: Facilitates the migration of the ACPI CPU state. (This needs reconsideration as per Igor. Last patch can be dropped if this affects the acceptability of other patches of this patch-set)
3. Updates the Qtest bios-acpi-test
This patch set is designed to work independently and is meant to ensures compatibility with existing hotplug support across different architectures. This patch-set has been tested alongside ARM-specific vCPU hotplug changes (included in the upcoming RFC V6 [4]), and hot(un)plug functionalities performed as expected which concerns this patch-set. Please have a look.
Thank you!
Repository of this patch-set
============================
(*) Latest Architecture Agnostic ACPI changes patch-set:
https://github.com/salil-mehta/qemu.git virt-cpuhp-armv8/rfc-
v6.arch.agnostic.acpi.v2armv8/rfc-v6.arch.agnostic.acpi.v2
(*) Works with upcoming ARM architecture specific patch-set RFC V6 [4]References
==========
[1] Check comment 5 in the bugzilla entryLink: https://bugzilla.tianocore.org/show_bug.cgi?id=4481#c5[2] KVMForum 2023 Presentation: Challenges Revisited in Supporting Virt CPU Hotplug on
architectures that don’t Support CPU Hotplug (like ARM64) a. Kernel Link: https://kvm-forum.qemu.org/2023/KVM-forum-cpu-
hotplug_7OJ1YyJ.pdf
b. Qemu Link: https://kvm-
forum.qemu.org/2023/Challenges_Revisited_in_Supporting_Virt_CPU_Hot plug_-__ii0iNb3.pdf
[3] KVMForum 2020 Presentation: Challenges in Supporting Virtual CPU Hotplug on
SoC Based Systems (like ARM64)[4] Upcoming RFC V6, Support of Virtual CPU Hotplug for ARMv8 Arch
armv8/rfc-v6-rc4
Salil Mehta (6):
hw/acpi: Introduceis_enabledstate in ACPI CPU Hotplug Status hw/acpi: Update ACPI CPU Hotplug state during vCPU hot(un)plug
qtest: allow ACPI DSDT Table changes
hw/acpi: Update CPUs AML'sis_enabledstate in ACPI_STAmethod tests/qtest/bios-tables-test: Update DSDT golden masters forx86/{pc,q35}hw/acpi: Update GED with vCPU Hotplug VMSD for migration
hw/acpi/cpu.c | 22 ++++++++++++++++-- hw/acpi/generic_event_device.c | 19 +++++++++++++++ include/hw/acpi/cpu.h | 2 +- tests/data/acpi/x86/pc/DSDT | Bin 8527 -> 8533 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 8438 -> 8444 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 9852 -> 9858 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 15398 -> 15404 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 8991 -> 8997 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 10181 -> 10187 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 8478 -> 8484 bytes tests/data/acpi/x86/pc/DSDT.hpbrroot | Bin 5034 -> 5040 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 8599 -> 8605 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 9886 -> 9892 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 8385 -> 8391 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 8533 -> 8539 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 12320 -> 12326 bytes tests/data/acpi/x86/q35/DSDT | Bin 8355 -> 8361 bytes tests/data/acpi/x86/q35/DSDT.acpierst | Bin 8372 -> 8378 bytes tests/data/acpi/x86/q35/DSDT.acpihmat | Bin 9680 -> 9686 bytes .../acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8634 -> 8640 bytes tests/data/acpi/x86/q35/DSDT.applesmc | Bin 8401 -> 8407 bytes tests/data/acpi/x86/q35/DSDT.bridge | Bin 11968 -> 11974 bytes tests/data/acpi/x86/q35/DSDT.core-count | Bin 12913 -> 12919 bytes tests/data/acpi/x86/q35/DSDT.core-count2 | Bin 33770 -> 33776 bytes tests/data/acpi/x86/q35/DSDT.cphp | Bin 8819 -> 8825 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 13148 -> 13154 bytes tests/data/acpi/x86/q35/DSDT.dimmpxm | Bin 10009 -> 10015 bytes tests/data/acpi/x86/q35/DSDT.ipmibt | Bin 8430 -> 8436 bytes tests/data/acpi/x86/q35/DSDT.ipmismbus | Bin 8443 -> 8449 bytes tests/data/acpi/x86/q35/DSDT.ivrs | Bin 8372 -> 8378 bytes tests/data/acpi/x86/q35/DSDT.memhp | Bin 9714 -> 9720 bytes tests/data/acpi/x86/q35/DSDT.mmio64 | Bin 9485 -> 9491 bytes tests/data/acpi/x86/q35/DSDT.multi-bridge | Bin 13208 -> 13214 bytes tests/data/acpi/x86/q35/DSDT.noacpihp | Bin 8235 -> 8241 bytes tests/data/acpi/x86/q35/DSDT.nohpet | Bin 8213 -> 8219 bytes tests/data/acpi/x86/q35/DSDT.numamem | Bin 8361 -> 8367 bytes tests/data/acpi/x86/q35/DSDT.pvpanic-isa | Bin 8456 -> 8462 bytes tests/data/acpi/x86/q35/DSDT.thread-count | Bin 12913 -> 12919 bytes tests/data/acpi/x86/q35/DSDT.thread-count2 | Bin 33770 -> 33776 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm12 | Bin 8961 -> 8967 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm2 | Bin 8987 -> 8993 bytes tests/data/acpi/x86/q35/DSDT.type4-count | Bin 18589 -> 18595 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 14615 -> 14621 bytes tests/data/acpi/x86/q35/DSDT.xapic | Bin 35718 -> 35724 bytes 44 files changed, 40 insertions(+), 3 deletions(-)--
2.34.1