Currently we have a class hierarchy for Arm CPUs where
all the 32-bit CPUs (including M-profile) inherit directly
from TYPE_ARM_CPU, but the 64-bit CPUs inherit from
TYPE_AARCH64_CPU, which is a subclass of TYPE_ARM_CPU.
This subclass does essentially two things:
* it sets up fields and methods for the gdbstub so that
the gdbstub presents an AArch64 CPU to gdb rather than
an AArch32 one
* it defines the 'aarch64' CPU property which you can use
with KVM to disable AArch64 and create a 32-bit VM
(with "-cpu host,aarch64=off")
This is a bit weird, because the 32-bit CPU you create with
KVM and aarch64=off is still a subclass of TYPE_AARCH64_CPU.
It also still presents gdb with an AArch64 CPU, so you
effectively can't use the gdbstub with this kind of VM.
This patchseries removes TYPE_AARCH64_CPU so that all CPUs,
both AArch32 and AArch64, directly inherit from TYPE_ARM_CPU.
This lets us fix the bug with gdbstub and "aarch64=off".
Most of the gdbstub related CPUClass fields are already methods,
so we can make the existing TYPE_ARM_CPU ones redirect to
the AArch64 functions if ARM_FEATURE_AARCH64 is set. The
odd-one-out is gdb_core_xml_file, so we have to add a new
optional method gdb_get_core_xml_file to allow us to select
the right XML file at runtime. (We could, like gdb_arch_name,
simply replace the existing static string field with the
method for all targets, but at least for this patchset I
didn't want to get into that complexity.)
We make the 'aarch64' property be an object property defined
if the ARM_FEATURE_AARCH64 is set rather than a class property;
this brings it into line with our other CPU properties.
Once we've done that and removed a check on TYPE_AARCH64_CPU
in the KVM code that hasn't been needed since we removed
32-bit Arm host KVM support, we can remove TYPE_AARCH64_CPU
entirely.
(The rationale here is that I think we should be able to
enable 'aarch64=off' for TCG CPUs too, so this will become
less of an odd KVM-specific corner case, and this seemed
worth cleaning up.)
thanks
-- PMM
Peter Maydell (9):
core/cpu.h: gdb_arch_name string should not be freed
gdbstub: Allow gdb_core_xml_file to be set at runtime
target/arm: Handle AArch64 in TYPE_ARM_CPU gdb_arch_name
target/arm: Handle gdb_core_xml_file in TYPE_ARM_CPU
target/arm: Handle AArch64 gdb read/write regs in TYPE_ARM_CPU
target/arm: Present AArch64 gdbstub based on ARM_FEATURE_AARCH64
target/arm: Move aarch64 CPU property code to TYPE_ARM_CPU
target/arm/kvm: don't check TYPE_AARCH64_CPU
target/arm: Remove TYPE_AARCH64_CPU
include/hw/core/cpu.h | 8 +++-
target/arm/cpu-qom.h | 5 ---
target/arm/cpu.h | 4 --
target/arm/internals.h | 7 ++-
gdbstub/gdbstub.c | 23 ++++++++--
target/arm/cpu.c | 55 ++++++++++++++++++++++-
target/arm/cpu64.c | 94 +---------------------------------------
target/arm/gdbstub.c | 12 +++++
target/arm/kvm.c | 3 +-
target/arm/tcg/cpu-v7m.c | 1 -
target/arm/tcg/cpu64.c | 2 +-
11 files changed, 101 insertions(+), 113 deletions(-)
--
2.43.0