From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH for-10.1 0/9] target/arm: Remove TYPE_AARCH64_CPU class
Date: Mon, 17 Mar 2025 14:28:10 +0000 [thread overview]
Message-ID: <20250317142819.900029-1-peter.maydell@linaro.org> (raw)
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
next reply other threads:[~2025-03-17 14:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 14:28 Peter Maydell [this message]
2025-03-17 14:28 ` [PATCH for-10.1 1/9] core/cpu.h: gdb_arch_name string should not be freed Peter Maydell
2025-03-17 14:58 ` Alex Bennée
2025-03-17 15:35 ` [PATCH for-10.0 " Philippe Mathieu-Daudé
2025-03-17 14:28 ` [PATCH for-10.1 2/9] gdbstub: Allow gdb_core_xml_file to be set at runtime Peter Maydell
2025-03-17 14:59 ` Alex Bennée
2025-03-17 14:28 ` [PATCH for-10.1 3/9] target/arm: Handle AArch64 in TYPE_ARM_CPU gdb_arch_name Peter Maydell
2025-03-17 15:00 ` Alex Bennée
2025-03-17 15:45 ` Philippe Mathieu-Daudé
2025-03-17 14:28 ` [PATCH for-10.1 4/9] target/arm: Handle gdb_core_xml_file in TYPE_ARM_CPU Peter Maydell
2025-04-25 10:40 ` Philippe Mathieu-Daudé
2025-03-17 14:28 ` [PATCH for-10.1 5/9] target/arm: Handle AArch64 gdb read/write regs " Peter Maydell
2025-03-17 15:41 ` Philippe Mathieu-Daudé
2025-03-17 14:28 ` [PATCH for-10.1 6/9] target/arm: Present AArch64 gdbstub based on ARM_FEATURE_AARCH64 Peter Maydell
2025-03-17 15:40 ` Philippe Mathieu-Daudé
2025-03-17 15:45 ` Philippe Mathieu-Daudé
2025-04-25 14:42 ` Philippe Mathieu-Daudé
2025-04-29 10:25 ` Peter Maydell
2025-03-17 14:28 ` [PATCH for-10.1 7/9] target/arm: Move aarch64 CPU property code to TYPE_ARM_CPU Peter Maydell
2025-03-17 15:37 ` Philippe Mathieu-Daudé
2025-03-17 14:28 ` [PATCH for-10.1 8/9] target/arm/kvm: don't check TYPE_AARCH64_CPU Peter Maydell
2025-03-17 15:38 ` Philippe Mathieu-Daudé
2025-03-17 14:28 ` [PATCH for-10.1 9/9] target/arm: Remove TYPE_AARCH64_CPU Peter Maydell
2025-03-17 15:39 ` Philippe Mathieu-Daudé
2025-04-25 10:41 ` [PATCH for-10.1 0/9] target/arm: Remove TYPE_AARCH64_CPU class Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250317142819.900029-1-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).