Enable new KVM capabilities to handle PSCI calls in QEMU rather than KVM. This work is part of the larger vCPU hot-add prototype for arm64, which can be found at [1]. I rebased Salil's work [2], with small changes to hide unavailable CPUs in ACPI. These four patches move PSCI to userspace so we can differentiate nonexistent from unavailable CPUs (See patch 4, associated to Linux patch "arm64: psci: Ignore NOT_PRESENT CPUs").
My testing commands are roughly:
qemu-system-aarch64 -cpu host -enable-kvm -M virt -M 'gic-version=3' -bios QEMU_EFI.fd -smp 'cpus=2,maxcpus=4' -m 1G -kernel ... device_add host-arm-cpu,id=core2,core-id=2 # QEMU monitor echo 1 > /sys/devices/system/cpu/cpu2/online # Guest device_del core2
[1] https://jpbrucker.net/git/qemu/log/?h=cpuhp/devel https://jpbrucker.net/git/linux/log/?h=cpuhp/devel [2] https://lore.kernel.org/qemu-devel/20200613213629.21984-1-salil.mehta@huawei...
Jean-Philippe Brucker (4): target/arm/kvm: Write CPU state back to KVM on reset target/arm: Support PSCI CPU_SUSPEND for KVM target/arm/kvm: Handle PSCI calls target/arm/arm-powerctl: Handle unplugged CPUs
target/arm/arm-powerctl.h | 1 + target/arm/cpu.h | 3 ++ target/arm/internals.h | 2 +- target/arm/arm-powerctl.c | 44 ++++++++++++++++++----- target/arm/kvm.c | 75 +++++++++++++++++++++++++++++++++++---- target/arm/kvm64.c | 5 ++- target/arm/psci.c | 14 +++++--- 7 files changed, 120 insertions(+), 24 deletions(-)