qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* From ce9a42483c23c32cee233f648101a160b6604b45 Mon Sep 17 00:00:00 2001
@ 2025-03-06 16:39 Peter Maydell
  2025-03-06 16:39 ` [PATCH 01/10] target/arm: Move A32_BANKED_REG_{GET, SET} macros to cpregs.h Peter Maydell
                   ` (10 more replies)
  0 siblings, 11 replies; 26+ messages in thread
From: Peter Maydell @ 2025-03-06 16:39 UTC (permalink / raw)
  To: qemu-arm, qemu-devel

Newer Arm CPUs need not implement AArch32 at all exception levels
(and Armv9 forbids implementing AArch32 at any EL except EL0).
All our current CPU models implement both AArch32 and AArch64
at every exception levels, so we currently get away with failing
to enforce that the guest isn't trying to do an exception return
to AArch32 when the target EL doesn't support AArch32.

This patchset adds the missing checks:
 * SCR_EL3.RW has an effective value of 1 if EL2 is AArch64-only
 * HCR_EL2.RW is RAO/WI if EL1 is AArch64-only
 * return to AArch32 when no EL supports AArch32 is an illegal
   exception return

To do this it needs to start off with some cleanup. This is
because we need to add a cpu_isar_feature() check to
arm_el_is_aa64(), but we don't want to include cpu-features.h
in cpu.h. arm_el_is_aa64() is really an internal part of the
CPU implementation, so we can move it to internals.h; this
means also moving some other functions in cpu.h that are
defined as inline functions and which call arm_el_is_aa64().
Removing some unused macros from linux-user allows us to
avoid having linux-user include internals.h.

(No doubt there are other functions that could be moved out
of cpu.h, but I stuck to only the ones that I actually needed
to move.)

thanks
-- PMM

Peter Maydell (10):
  target/arm: Move A32_BANKED_REG_{GET,SET} macros to cpregs.h
  target/arm: Un-inline access_secure_reg()
  linux-user/aarch64: Remove unused get/put_user macros
  linux-user/arm: Remove unused get_put_user macros
  target/arm: Move arm_cpu_data_is_big_endian() etc to internals.h
  target/arm: Move arm_current_el() and arm_el_is_aa64() to internals.h
  target/arm: SCR_EL3.RW should be treated as 1 if EL2 doesn't support
    AArch32
  target/arm: HCR_EL2.RW should be RAO/WI if EL1 doesn't support AArch32
  target/arm: Add cpu local variable to exception_return helper
  target/arm: Forbid return to AArch32 when CPU is AArch64-only

 target/arm/cpregs.h           |  28 +++++++
 target/arm/cpu.h              | 153 +---------------------------------
 target/arm/internals.h        | 133 +++++++++++++++++++++++++++++
 hw/intc/arm_gicv3_cpuif.c     |   1 +
 linux-user/aarch64/cpu_loop.c |  48 -----------
 linux-user/arm/cpu_loop.c     |  43 +---------
 target/arm/arch_dump.c        |   1 +
 target/arm/helper.c           |  16 +++-
 target/arm/tcg/helper-a64.c   |  12 ++-
 target/arm/tcg/hflags.c       |   9 ++
 10 files changed, 202 insertions(+), 242 deletions(-)

-- 
2.43.0



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

end of thread, other threads:[~2025-03-13 16:20 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 16:39 From ce9a42483c23c32cee233f648101a160b6604b45 Mon Sep 17 00:00:00 2001 Peter Maydell
2025-03-06 16:39 ` [PATCH 01/10] target/arm: Move A32_BANKED_REG_{GET, SET} macros to cpregs.h Peter Maydell
2025-03-06 22:09   ` Richard Henderson
2025-03-06 16:39 ` [PATCH 02/10] target/arm: Un-inline access_secure_reg() Peter Maydell
2025-03-06 22:09   ` Richard Henderson
2025-03-06 16:39 ` [PATCH 03/10] linux-user/aarch64: Remove unused get/put_user macros Peter Maydell
2025-03-06 22:09   ` Richard Henderson
2025-03-06 16:39 ` [PATCH 04/10] linux-user/arm: Remove unused get_put_user macros Peter Maydell
2025-03-06 22:09   ` Richard Henderson
2025-03-06 16:39 ` [PATCH 05/10] target/arm: Move arm_cpu_data_is_big_endian() etc to internals.h Peter Maydell
2025-03-06 22:12   ` Richard Henderson
2025-03-07  9:37     ` Peter Maydell
2025-03-06 16:39 ` [PATCH 06/10] target/arm: Move arm_current_el() and arm_el_is_aa64() " Peter Maydell
2025-03-06 22:40   ` Richard Henderson
2025-03-06 16:39 ` [PATCH 07/10] target/arm: SCR_EL3.RW should be treated as 1 if EL2 doesn't support AArch32 Peter Maydell
2025-03-06 17:12   ` Peter Maydell
2025-03-06 22:53   ` Richard Henderson
2025-03-07  9:39     ` Peter Maydell
2025-03-06 16:39 ` [PATCH 08/10] target/arm: HCR_EL2.RW should be RAO/WI if EL1 " Peter Maydell
2025-03-06 23:01   ` Richard Henderson
2025-03-06 16:39 ` [PATCH 09/10] target/arm: Add cpu local variable to exception_return helper Peter Maydell
2025-03-06 23:02   ` Richard Henderson
2025-03-06 16:39 ` [PATCH 10/10] target/arm: Forbid return to AArch32 when CPU is AArch64-only Peter Maydell
2025-03-06 23:16   ` Richard Henderson
2025-03-13 16:19   ` Peter Maydell
2025-03-06 16:41 ` [PATCH 00/10] target/arm: Forbid exception returns to unimplemented AArch32 ELs Peter Maydell

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