qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] target/arm: Remove TYPE_AARCH64_CPU class
@ 2025-04-29 13:21 Peter Maydell
  2025-04-29 13:21 ` [PATCH v2 1/7] target/microblaze: Use 'obj' in DEVICE() casts in mb_cpu_initfn() Peter Maydell
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Peter Maydell @ 2025-04-29 13:21 UTC (permalink / raw)
  To: qemu-arm, qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E . Iglesias

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".

In this version I fix the bug that Philippe found where we
were calling arm_gdbstub_is_aarch64() too early, before the
object had been created and the "is it AArch64 or not?"
question resolved. This is basically moving the gdb_init_cpu()
call into cpu_exec_realizefn(), but we need to do a little
adjustment of microblaze for that to work.

Version 2 of the patchset:
 * patches 1-5 from v1 are already upstream
 * new patches 1-3 here delay the call to gdb_init_cpu()
   so that it is done only after the CPU object is at least
   inited and we definitely know the final value of the
   'aarch64' property
 * patches 4-7 are the old 6-9 and have been reviewed

thanks
-- PMM

Peter Maydell (7):
  target/microblaze: Use 'obj' in DEVICE() casts in mb_cpu_initfn()
  target/microblaze: Delay gdb_register_coprocessor() to realize
  hw/core/cpu-common: Don't init gdbstub until cpu_exec_realizefn()
  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

 target/arm/cpu-qom.h    |  5 ---
 target/arm/cpu.h        |  4 --
 target/arm/internals.h  |  3 +-
 hw/core/cpu-common.c    |  3 +-
 target/arm/cpu.c        | 36 ++++++++++++++++++
 target/arm/cpu64.c      | 82 +----------------------------------------
 target/arm/kvm.c        |  3 +-
 target/arm/tcg/cpu64.c  |  2 +-
 target/microblaze/cpu.c | 22 +++++------
 9 files changed, 52 insertions(+), 108 deletions(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2025-05-01 19:40 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 13:21 [PATCH v2 0/7] target/arm: Remove TYPE_AARCH64_CPU class Peter Maydell
2025-04-29 13:21 ` [PATCH v2 1/7] target/microblaze: Use 'obj' in DEVICE() casts in mb_cpu_initfn() Peter Maydell
2025-04-29 14:59   ` Philippe Mathieu-Daudé
2025-04-29 15:59   ` Edgar E. Iglesias
2025-04-30 17:19   ` Richard Henderson
2025-04-29 13:21 ` [PATCH v2 2/7] target/microblaze: Delay gdb_register_coprocessor() to realize Peter Maydell
2025-04-29 16:00   ` Edgar E. Iglesias
2025-04-30 17:19   ` Richard Henderson
2025-05-01 19:40   ` Philippe Mathieu-Daudé
2025-04-29 13:21 ` [PATCH v2 3/7] hw/core/cpu-common: Don't init gdbstub until cpu_exec_realizefn() Peter Maydell
2025-04-29 16:03   ` Edgar E. Iglesias
2025-04-30 17:19   ` Richard Henderson
2025-05-01 13:09   ` Alex Bennée
2025-05-01 19:39   ` Philippe Mathieu-Daudé
2025-04-29 13:21 ` [PATCH v2 4/7] target/arm: Present AArch64 gdbstub based on ARM_FEATURE_AARCH64 Peter Maydell
2025-04-30 17:19   ` Richard Henderson
2025-04-29 13:21 ` [PATCH v2 5/7] target/arm: Move aarch64 CPU property code to TYPE_ARM_CPU Peter Maydell
2025-04-30 17:21   ` Richard Henderson
2025-04-29 13:21 ` [PATCH v2 6/7] target/arm/kvm: don't check TYPE_AARCH64_CPU Peter Maydell
2025-04-30 17:21   ` Richard Henderson
2025-04-29 13:22 ` [PATCH v2 7/7] target/arm: Remove TYPE_AARCH64_CPU Peter Maydell
2025-04-30 17:21   ` Richard Henderson

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).