diff mbox series

[RFC,V4,19/33] target/arm: Force ARM vCPU *present* status ACPI *persistent*

Message ID 20241009031815.250096-20-salil.mehta@huawei.com (mailing list archive)
State New
Headers show
Series Support of Virtual CPU Hotplug for ARMv8 Arch | expand

Commit Message

Salil Mehta Oct. 9, 2024, 3:18 a.m. UTC
The ARM CPU architecture does not permit changes to CPU presence after the
kernel has booted. This is an immutable requirement from ARM and represents a
strict architectural constraint [1][2].

The ACPI update [3] reinforces this by specifying that the `_STA.Present` bit
in the ACPI specification cannot be modified once the system has booted.
Consequently, the firmware, ACPI, and QEMU must provide the guest kernel with a
persistent view of the vCPUs, even when they are not present in the QOM
(i.e., when they are unplugged or have yet to be plugged into the QOM after the
kernel has booted).

References:
[1] 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
[2] KVMForum 2020 Presentation: Challenges in Supporting Virtual CPU Hotplug on
    SoC Based Systems (like ARM64)
    Link: https://kvmforum2020.sched.com/event/eE4m
[3] Check comment 5 in the bugzilla entry
    Link: https://bugzilla.tianocore.org/show_bug.cgi?id=4481#c5

Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 target/arm/cpu64.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index 2a517fdb9f..a84f312ae2 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -794,6 +794,13 @@  static void aarch64_cpu_initfn(Object *obj)
      */
     cs->disabled = true;
     cs->thread_id = 0;
+    /*
+     * To provide the guest with a persistent view of vCPU presence, ACPI may
+     * need to simulate the presence of vCPUs even when they are not present in
+     * the QOM or are in a disabled state. This flag is utilized during the
+     * initialization of ACPI hotplug state and during vCPU hot-unplug events.
+     */
+    cs->acpi_persistent = true;
 }
 
 static void aarch64_cpu_finalizefn(Object *obj)