Hello everyone, We refer to the implementation of ARM CPU Hot-Plug to add GED-based CPU Hot-Plug support to Loongarch.
The first 4 patches are changes to the QEMU common code, including adding GED support for CPU Hot-Plug, updating the ACPI table creation process, and adding qdev_disconnect_gpio_out_named and cpu_address_space_destroy interfaces to release resources when CPU un-plug. The last four patches are Loongarch architecture-related, and the modifications include the definition of the hook function related to the CPU Hot-(UN)Plug, the allocation and release of CPU resources when CPU Hot-(UN)Plug, the creation process of updating the ACPI table, and finally the custom switch for the CPU Hot-Plug. xianglai li (8): Update ACPI GED framework to support vcpu hot-(un)plug Update CPUs AML with cpu-(ctrl)dev change Introduced a new function to disconnect GPIO connections Introduce the CPU address space destruction function Adds basic CPU hot-(un)plug support for Loongarch Add support of *unrealize* for loongarch cpu Update the ACPI table for the Loongarch CPU Turn on CPU hot-(un)plug customization for loongarch .../devices/loongarch64-softmmu/default.mak | 1 + hw/acpi/acpi-cpu-hotplug-stub.c | 15 + hw/acpi/cpu.c | 37 +- hw/acpi/generic_event_device.c | 33 ++ hw/core/gpio.c | 4 +- hw/i386/acpi-build.c | 2 +- hw/loongarch/acpi-build.c | 35 +- hw/loongarch/generic_event_device_loongarch.c | 36 ++ hw/loongarch/meson.build | 2 +- hw/loongarch/virt.c | 381 +++++++++++++++++- include/exec/cpu-common.h | 8 + include/hw/acpi/cpu.h | 5 +- include/hw/acpi/cpu_hotplug.h | 10 + include/hw/acpi/generic_event_device.h | 6 + include/hw/core/cpu.h | 1 + include/hw/loongarch/virt.h | 11 +- include/hw/qdev-core.h | 2 + softmmu/physmem.c | 24 ++ target/loongarch/cpu.c | 33 ++ target/loongarch/cpu.h | 5 + 20 files changed, 615 insertions(+), 36 deletions(-) create mode 100644 hw/loongarch/generic_event_device_loongarch.c -- 2.39.1