Currently when using KVM on Arm, the normal thing is to use either the 'host' or 'max' CPU types, both of which give the guest the same CPU as the host. We also for legacy reasons allow 'cortex-a53' and 'cortex-a57' CPU types, which will only work when the host CPU is exactly that matching CPU. This is because the original idea of the KVM ABI was that userspace would request a particular CPU type by setting the target field in the KVM_ARM_VCPU_INIT ioctl to an appropriate KVM_ARM_TARGET_* constant. However, it quickly became clear that this was a bad idea, and now everything uses KVM_ARM_TARGET_GENERIC_V8; the tiny number of existing CPU-specific target values behave identically to GENERIC_V8 except that they will only work if the host CPU matches them.
Future support for "show the KVM guest a CPU type that's not identical to the host" is going to work by telling it different ID register values. Real Cortex-A53 and A57 CPUs are now all over a decade old and not in widespread use. Deprecate the ability to use '-cpu cortex-a53' and '-cpu cortex-a57' with KVM, to get rid of this odd legacy corner and open up the opportunity in future to support named CPU types via ID register settings if we want that. For any situation where the cortex-a53 and cortex-a57 CPU types currently work with KVM, '-cpu host' or '-cpu max' will have identical behaviour. (Though note that if you are using "KVM, but fall back to TCG" then the fallback under TCG will be different.) Signed-off-by: Peter Maydell <[email protected]> --- Personally I doubt anybody is actually using these named CPU types... --- docs/about/deprecated.rst | 13 +++++++++++++ target/arm/kvm.c | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index ccbc4219497..153fe118151 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -234,6 +234,19 @@ in the QEMU object model anymore. ``Sun-UltraSparc-IIIi+`` and but for consistency these will get removed in a future release, too. Use ``Sun-UltraSparc-IIIi-plus`` and ``Sun-UltraSparc-IV-plus`` instead. +``cortex-a53`` and ``cortex-a57`` CPU names with KVM on Arm (since 11.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +QEMU currently allows the CPU name to be set to ``cortex-a53`` or +``cortex-a57`` when using KVM; this is identical to using ``host`` or +``max``, but it will only work when the host CPU is a Cortex-A53 or +Cortex-A57. These CPUs are now over 10 years old, and the ability to +use the named CPU type like this is part of a legacy corner of the KVM +API, which doesn't work with any other host CPU types. Using these CPU +names with KVM enabled is deprecated; use ``host`` or ``max`` instead, +which will have identical behaviour on the hosts where using +``cortex-a53`` or ``cortex-a57`` works. + System emulator machines ------------------------ diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 3d905f8565d..de09d63d2e3 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -2015,6 +2015,13 @@ int kvm_arch_init_vcpu(CPUState *cs) return -EINVAL; } + if (cpu->kvm_target == QEMU_KVM_ARM_TARGET_CORTEX_A53 || + cpu->kvm_target == QEMU_KVM_ARM_TARGET_CORTEX_A57) { + warn_report_once("Using the cortex-a53 and cortex-a57 CPU types " + "with KVM is deprecated. Use the max or host CPU " + "types instead."); + } + qemu_add_vm_change_state_handler(kvm_arm_vm_state_change, cpu); /* Determine init features for this CPU */ -- 2.43.0
