* [PATCH v4 0/6] target/arm: Introduce cpu types max-v8 and max-v9
@ 2026-08-27 4:15 Richard Henderson
2026-08-27 4:15 ` [PATCH v4 1/6] target/arm: Move -cpu max stuff out of cpu32.c Richard Henderson
` (5 more replies)
0 siblings, 6 replies; 15+ messages in thread
From: Richard Henderson @ 2026-08-27 4:15 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, pierrick.bouvier, philmd
This is something that we've talked about for quite some time,
having separate "max" cpu types for Armv{8,9}, because Armv9
prohibits some deprecated Armv8 features. Retaining all features
simultaneously has the potential to cause confusion.
Pierrick, patch 2 replaces the one you posted using ifdefs.
Changes for v4:
- Adjust for single-binary.
Changes for v3:
- Several patches merged.
- max-v8 is also present for qemu-{system-}arm.
r~
Richard Henderson (6):
target/arm: Move -cpu max stuff out of cpu32.c
target/arm: Build cpu32.c once in system mode
target/arm: Rename and adjust aarch32_max_v8_tcg_initfn
target/arm: Introduce cpu types max-v8 and max-v9
target/arm: Use -cpu max-v8 with aarch64=off
target/arm: Separate cpu types max-v8 and max-v9
target/arm/internals.h | 5 +-
hw/arm/sbsa-ref.c | 2 +
hw/arm/virt.c | 2 +
target/arm/cpu-max.c | 4 +-
target/arm/tcg/cpu-max-v8.c | 130 ++++++++++++++
target/arm/tcg/cpu32.c | 116 -------------
target/arm/tcg/cpu64.c | 159 ++++++++++++------
target/arm/tcg/stubs32.c | 7 +-
tests/qtest/arm-cpu-features.c | 4 +-
docs/system/arm/emulation.rst | 13 +-
target/arm/tcg/meson.build | 11 +-
.../aarch64/test_virt_aarch64_off.py | 4 +-
12 files changed, 273 insertions(+), 184 deletions(-)
create mode 100644 target/arm/tcg/cpu-max-v8.c
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 1/6] target/arm: Move -cpu max stuff out of cpu32.c
2026-08-27 4:15 [PATCH v4 0/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
@ 2026-08-27 4:15 ` Richard Henderson
2026-08-27 22:50 ` Pierrick Bouvier
2026-08-28 9:43 ` Philippe Mathieu-Daudé
2026-08-27 4:15 ` [PATCH v4 2/6] target/arm: Build cpu32.c once in system mode Richard Henderson
` (4 subsequent siblings)
5 siblings, 2 replies; 15+ messages in thread
From: Richard Henderson @ 2026-08-27 4:15 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, pierrick.bouvier, philmd
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/tcg/cpu-max-v8.c | 117 ++++++++++++++++++++++++++++++++++++
target/arm/tcg/cpu32.c | 111 ----------------------------------
target/arm/tcg/meson.build | 1 +
3 files changed, 118 insertions(+), 111 deletions(-)
create mode 100644 target/arm/tcg/cpu-max-v8.c
diff --git a/target/arm/tcg/cpu-max-v8.c b/target/arm/tcg/cpu-max-v8.c
new file mode 100644
index 00000000000..5c0ba28edf8
--- /dev/null
+++ b/target/arm/tcg/cpu-max-v8.c
@@ -0,0 +1,117 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "internals.h"
+
+
+/* Share AArch32 -cpu max features with AArch64. */
+void aa32_max_features(ARMCPU *cpu)
+{
+ uint32_t t;
+ ARMISARegisters *isar = &cpu->isar;
+
+ /* Add additional features supported by QEMU */
+ t = GET_IDREG(isar, ID_ISAR5);
+ t = FIELD_DP32(t, ID_ISAR5, AES, 2); /* FEAT_PMULL */
+ t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); /* FEAT_SHA1 */
+ t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); /* FEAT_SHA256 */
+ t = FIELD_DP32(t, ID_ISAR5, CRC32, 1);
+ t = FIELD_DP32(t, ID_ISAR5, RDM, 1); /* FEAT_RDM */
+ t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); /* FEAT_FCMA */
+ SET_IDREG(isar, ID_ISAR5, t);
+
+ t = GET_IDREG(isar, ID_ISAR6);
+ t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); /* FEAT_JSCVT */
+ t = FIELD_DP32(t, ID_ISAR6, DP, 1); /* Feat_DotProd */
+ t = FIELD_DP32(t, ID_ISAR6, FHM, 1); /* FEAT_FHM */
+ t = FIELD_DP32(t, ID_ISAR6, SB, 1); /* FEAT_SB */
+ t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); /* FEAT_SPECRES */
+ t = FIELD_DP32(t, ID_ISAR6, BF16, 1); /* FEAT_AA32BF16 */
+ t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); /* FEAT_AA32I8MM */
+ SET_IDREG(isar, ID_ISAR6, t);
+
+ t = cpu->isar.mvfr1;
+ t = FIELD_DP32(t, MVFR1, FPHP, 3); /* FEAT_FP16 */
+ t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* FEAT_FP16 */
+ cpu->isar.mvfr1 = t;
+
+ t = cpu->isar.mvfr2;
+ t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */
+ t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */
+ cpu->isar.mvfr2 = t;
+
+ FIELD_DP32_IDREG(isar, ID_MMFR3, PAN, 2); /* FEAT_PAN2 */
+
+ t = GET_IDREG(isar, ID_MMFR4);
+ t = FIELD_DP32(t, ID_MMFR4, HPDS, 2); /* FEAT_HPDS2 */
+ t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
+ t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* FEAT_TTCNP */
+ t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* FEAT_XNX */
+ t = FIELD_DP32(t, ID_MMFR4, EVT, 2); /* FEAT_EVT2 */
+ SET_IDREG(isar, ID_MMFR4, t);
+
+ FIELD_DP32_IDREG(isar, ID_MMFR5, ETS, 2); /* FEAT_ETS2 */
+
+ t = GET_IDREG(isar, ID_PFR0);
+ t = FIELD_DP32(t, ID_PFR0, CSV2, 2); /* FEAT_CSV2 */
+ t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */
+ t = FIELD_DP32(t, ID_PFR0, RAS, 1); /* FEAT_RAS */
+ SET_IDREG(isar, ID_PFR0, t);
+
+ t = GET_IDREG(isar, ID_PFR2);
+ t = FIELD_DP32(t, ID_PFR2, CSV3, 1); /* FEAT_CSV3 */
+ t = FIELD_DP32(t, ID_PFR2, SSBS, 1); /* FEAT_SSBS */
+ SET_IDREG(isar, ID_PFR2, t);
+
+ t = GET_IDREG(isar, ID_DFR0);
+ t = FIELD_DP32(t, ID_DFR0, COPDBG, 10); /* FEAT_Debugv8p8 */
+ t = FIELD_DP32(t, ID_DFR0, COPSDBG, 10); /* FEAT_Debugv8p8 */
+ t = FIELD_DP32(t, ID_DFR0, PERFMON, 6); /* FEAT_PMUv3p5 */
+ SET_IDREG(isar, ID_DFR0, t);
+
+ /* Debug ID registers. */
+
+ /* Bit[15] is RES1, Bit[13] and Bits[11:0] are RES0. */
+ t = 0x00008000;
+ t = FIELD_DP32(t, DBGDIDR, SE_IMP, 1);
+ t = FIELD_DP32(t, DBGDIDR, NSUHD_IMP, 1);
+ t = FIELD_DP32(t, DBGDIDR, VERSION, 10); /* FEAT_Debugv8p8 */
+ t = FIELD_DP32(t, DBGDIDR, CTX_CMPS, 1);
+ t = FIELD_DP32(t, DBGDIDR, BRPS, 5);
+ t = FIELD_DP32(t, DBGDIDR, WRPS, 3);
+ cpu->isar.dbgdidr = t;
+
+ t = 0;
+ t = FIELD_DP32(t, DBGDEVID, PCSAMPLE, 3);
+ t = FIELD_DP32(t, DBGDEVID, WPADDRMASK, 1);
+ t = FIELD_DP32(t, DBGDEVID, BPADDRMASK, 15);
+ t = FIELD_DP32(t, DBGDEVID, VECTORCATCH, 0);
+ t = FIELD_DP32(t, DBGDEVID, VIRTEXTNS, 1);
+ t = FIELD_DP32(t, DBGDEVID, DOUBLELOCK, 1);
+ t = FIELD_DP32(t, DBGDEVID, AUXREGS, 0);
+ t = FIELD_DP32(t, DBGDEVID, CIDMASK, 0);
+ cpu->isar.dbgdevid = t;
+
+ /* Bits[31:4] are RES0. */
+ t = 0;
+ t = FIELD_DP32(t, DBGDEVID1, PCSROFFSET, 2);
+ cpu->isar.dbgdevid1 = t;
+
+ FIELD_DP32_IDREG(isar, ID_DFR1, HPMN0, 1); /* FEAT_HPMN0 */
+}
+
+void aarch32_max_tcg_init(ARMCPU *cpu)
+{
+ aarch64_aa32_a57_init(cpu, false);
+ aa32_max_features(cpu);
+#ifdef CONFIG_USER_ONLY
+ /*
+ * Break with true ARMv8 and add back old-style VFP short-vector
+ * support. Only do this for user-mode, where -cpu max is the default,
+ * so that older v6 and v7 programs are more likely to work without
+ * adjustment.
+ */
+ cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1);
+#endif
+}
diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c
index bc07e33877a..34436ad6ec4 100644
--- a/target/arm/tcg/cpu32.c
+++ b/target/arm/tcg/cpu32.c
@@ -758,114 +758,3 @@ static void arm_tcg_cpu_register_types(void)
type_init(arm_tcg_cpu_register_types)
#endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */
-
-/* Share AArch32 -cpu max features with AArch64. */
-void aa32_max_features(ARMCPU *cpu)
-{
- uint32_t t;
- ARMISARegisters *isar = &cpu->isar;
-
- /* Add additional features supported by QEMU */
- t = GET_IDREG(isar, ID_ISAR5);
- t = FIELD_DP32(t, ID_ISAR5, AES, 2); /* FEAT_PMULL */
- t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); /* FEAT_SHA1 */
- t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); /* FEAT_SHA256 */
- t = FIELD_DP32(t, ID_ISAR5, CRC32, 1);
- t = FIELD_DP32(t, ID_ISAR5, RDM, 1); /* FEAT_RDM */
- t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); /* FEAT_FCMA */
- SET_IDREG(isar, ID_ISAR5, t);
-
- t = GET_IDREG(isar, ID_ISAR6);
- t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); /* FEAT_JSCVT */
- t = FIELD_DP32(t, ID_ISAR6, DP, 1); /* Feat_DotProd */
- t = FIELD_DP32(t, ID_ISAR6, FHM, 1); /* FEAT_FHM */
- t = FIELD_DP32(t, ID_ISAR6, SB, 1); /* FEAT_SB */
- t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); /* FEAT_SPECRES */
- t = FIELD_DP32(t, ID_ISAR6, BF16, 1); /* FEAT_AA32BF16 */
- t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); /* FEAT_AA32I8MM */
- SET_IDREG(isar, ID_ISAR6, t);
-
- t = cpu->isar.mvfr1;
- t = FIELD_DP32(t, MVFR1, FPHP, 3); /* FEAT_FP16 */
- t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* FEAT_FP16 */
- cpu->isar.mvfr1 = t;
-
- t = cpu->isar.mvfr2;
- t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */
- t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */
- cpu->isar.mvfr2 = t;
-
- FIELD_DP32_IDREG(isar, ID_MMFR3, PAN, 2); /* FEAT_PAN2 */
-
- t = GET_IDREG(isar, ID_MMFR4);
- t = FIELD_DP32(t, ID_MMFR4, HPDS, 2); /* FEAT_HPDS2 */
- t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
- t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* FEAT_TTCNP */
- t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* FEAT_XNX */
- t = FIELD_DP32(t, ID_MMFR4, EVT, 2); /* FEAT_EVT2 */
- SET_IDREG(isar, ID_MMFR4, t);
-
- FIELD_DP32_IDREG(isar, ID_MMFR5, ETS, 2); /* FEAT_ETS2 */
-
- t = GET_IDREG(isar, ID_PFR0);
- t = FIELD_DP32(t, ID_PFR0, CSV2, 2); /* FEAT_CSV2 */
- t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */
- t = FIELD_DP32(t, ID_PFR0, RAS, 1); /* FEAT_RAS */
- SET_IDREG(isar, ID_PFR0, t);
-
- t = GET_IDREG(isar, ID_PFR2);
- t = FIELD_DP32(t, ID_PFR2, CSV3, 1); /* FEAT_CSV3 */
- t = FIELD_DP32(t, ID_PFR2, SSBS, 1); /* FEAT_SSBS */
- SET_IDREG(isar, ID_PFR2, t);
-
- t = GET_IDREG(isar, ID_DFR0);
- t = FIELD_DP32(t, ID_DFR0, COPDBG, 10); /* FEAT_Debugv8p8 */
- t = FIELD_DP32(t, ID_DFR0, COPSDBG, 10); /* FEAT_Debugv8p8 */
- t = FIELD_DP32(t, ID_DFR0, PERFMON, 6); /* FEAT_PMUv3p5 */
- SET_IDREG(isar, ID_DFR0, t);
-
- /* Debug ID registers. */
-
- /* Bit[15] is RES1, Bit[13] and Bits[11:0] are RES0. */
- t = 0x00008000;
- t = FIELD_DP32(t, DBGDIDR, SE_IMP, 1);
- t = FIELD_DP32(t, DBGDIDR, NSUHD_IMP, 1);
- t = FIELD_DP32(t, DBGDIDR, VERSION, 10); /* FEAT_Debugv8p8 */
- t = FIELD_DP32(t, DBGDIDR, CTX_CMPS, 1);
- t = FIELD_DP32(t, DBGDIDR, BRPS, 5);
- t = FIELD_DP32(t, DBGDIDR, WRPS, 3);
- cpu->isar.dbgdidr = t;
-
- t = 0;
- t = FIELD_DP32(t, DBGDEVID, PCSAMPLE, 3);
- t = FIELD_DP32(t, DBGDEVID, WPADDRMASK, 1);
- t = FIELD_DP32(t, DBGDEVID, BPADDRMASK, 15);
- t = FIELD_DP32(t, DBGDEVID, VECTORCATCH, 0);
- t = FIELD_DP32(t, DBGDEVID, VIRTEXTNS, 1);
- t = FIELD_DP32(t, DBGDEVID, DOUBLELOCK, 1);
- t = FIELD_DP32(t, DBGDEVID, AUXREGS, 0);
- t = FIELD_DP32(t, DBGDEVID, CIDMASK, 0);
- cpu->isar.dbgdevid = t;
-
- /* Bits[31:4] are RES0. */
- t = 0;
- t = FIELD_DP32(t, DBGDEVID1, PCSROFFSET, 2);
- cpu->isar.dbgdevid1 = t;
-
- FIELD_DP32_IDREG(isar, ID_DFR1, HPMN0, 1); /* FEAT_HPMN0 */
-}
-
-void aarch32_max_tcg_init(ARMCPU *cpu)
-{
- aarch64_aa32_a57_init(cpu, false);
- aa32_max_features(cpu);
-#ifdef CONFIG_USER_ONLY
- /*
- * Break with true ARMv8 and add back old-style VFP short-vector
- * support. Only do this for user-mode, where -cpu max is the default,
- * so that older v6 and v7 programs are more likely to work without
- * adjustment.
- */
- cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1);
-#endif
-}
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
index cbfac0036e7..35e70b004d9 100644
--- a/target/arm/tcg/meson.build
+++ b/target/arm/tcg/meson.build
@@ -65,6 +65,7 @@ arm_common_user_system_ss.add(
translate32_d,
vfp_d,
files(
+ 'cpu-max-v8.c',
'debug.c',
'gengvec.c',
'hflags.c',
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 2/6] target/arm: Build cpu32.c once in system mode
2026-08-27 4:15 [PATCH v4 0/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
2026-08-27 4:15 ` [PATCH v4 1/6] target/arm: Move -cpu max stuff out of cpu32.c Richard Henderson
@ 2026-08-27 4:15 ` Richard Henderson
2026-08-27 16:37 ` Pierrick Bouvier
2026-08-28 7:28 ` Philippe Mathieu-Daudé
2026-08-27 4:15 ` [PATCH v4 3/6] target/arm: Rename and adjust aarch32_max_v8_tcg_initfn Richard Henderson
` (3 subsequent siblings)
5 siblings, 2 replies; 15+ messages in thread
From: Richard Henderson @ 2026-08-27 4:15 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, pierrick.bouvier, philmd
"Move" the ifdef to meson.build rules.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/tcg/cpu32.c | 5 -----
target/arm/tcg/meson.build | 10 +++++-----
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c
index 34436ad6ec4..2d642ef8787 100644
--- a/target/arm/tcg/cpu32.c
+++ b/target/arm/tcg/cpu32.c
@@ -19,9 +19,6 @@
#include "cpregs.h"
-/* CPU models. These are not needed for the AArch64 linux-user build. */
-#if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
-
static void arm926_initfn(Object *obj)
{
ARMCPU *cpu = ARM_CPU(obj);
@@ -756,5 +753,3 @@ static void arm_tcg_cpu_register_types(void)
}
type_init(arm_tcg_cpu_register_types)
-
-#endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
index 35e70b004d9..a3e9d55e853 100644
--- a/target/arm/tcg/meson.build
+++ b/target/arm/tcg/meson.build
@@ -30,10 +30,6 @@ translate32_d = [
arm_ss.add(when: 'TARGET_AARCH64', if_true: gen_a64)
arm_stubs_ss.add(files('stubs32.c'))
-arm_ss.add(files(
- 'cpu32.c',
-))
-
arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
'gengvec64.c',
'translate-a64.c',
@@ -49,7 +45,10 @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
))
arm_common_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c'))
-arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files('cpu-v7m.c'))
+arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files(
+ 'cpu-v7m.c',
+ 'cpu32.c',
+))
arm_common_ss.add(zlib)
arm_common_ss.add(files(
@@ -86,6 +85,7 @@ arm_common_user_system_ss.add(when: 'TARGET_AARCH64', if_true: files(
))
arm_common_system_ss.add(files(
+ 'cpu32.c',
'cpregs-at.c',
'gicv5-cpuif.c',
'psci.c',
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 3/6] target/arm: Rename and adjust aarch32_max_v8_tcg_initfn
2026-08-27 4:15 [PATCH v4 0/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
2026-08-27 4:15 ` [PATCH v4 1/6] target/arm: Move -cpu max stuff out of cpu32.c Richard Henderson
2026-08-27 4:15 ` [PATCH v4 2/6] target/arm: Build cpu32.c once in system mode Richard Henderson
@ 2026-08-27 4:15 ` Richard Henderson
2026-08-27 4:15 ` [PATCH v4 4/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
` (2 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Richard Henderson @ 2026-08-27 4:15 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, pierrick.bouvier, philmd
Rename from aarch32_max_tcg_init and take an Object pointer,
in preparation from being used with TypeInit.
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/internals.h | 2 +-
target/arm/cpu-max.c | 2 +-
target/arm/tcg/cpu-max-v8.c | 4 +++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/target/arm/internals.h b/target/arm/internals.h
index f6b4e173a54..fc7d5ad6f2c 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -1838,7 +1838,7 @@ uint32_t *arm_v7m_get_sp_ptr(CPUARMState *env, bool secure,
bool el_is_in_host(CPUARMState *env, int el);
void aa32_max_features(ARMCPU *cpu);
-void aarch32_max_tcg_init(ARMCPU *cpu);
+void aarch32_max_v8_tcg_initfn(Object *obj);
int exception_target_el(CPUARMState *env);
bool arm_singlestep_active(CPUARMState *env);
bool arm_generate_debug_exceptions(CPUARMState *env);
diff --git a/target/arm/cpu-max.c b/target/arm/cpu-max.c
index 4df52bcb08e..9ed45c8764f 100644
--- a/target/arm/cpu-max.c
+++ b/target/arm/cpu-max.c
@@ -108,7 +108,7 @@ static void cpu_max_initfn(Object *obj)
if (tcg_enabled()) {
if (!aarch64_enabled) {
- aarch32_max_tcg_init(cpu);
+ aarch32_max_v8_tcg_initfn(obj);
} else {
aarch64_max_tcg_initfn(obj);
}
diff --git a/target/arm/tcg/cpu-max-v8.c b/target/arm/tcg/cpu-max-v8.c
index 5c0ba28edf8..5a9845d88f3 100644
--- a/target/arm/tcg/cpu-max-v8.c
+++ b/target/arm/tcg/cpu-max-v8.c
@@ -101,8 +101,10 @@ void aa32_max_features(ARMCPU *cpu)
FIELD_DP32_IDREG(isar, ID_DFR1, HPMN0, 1); /* FEAT_HPMN0 */
}
-void aarch32_max_tcg_init(ARMCPU *cpu)
+void aarch32_max_v8_tcg_initfn(Object *obj)
{
+ ARMCPU *cpu = ARM_CPU(obj);
+
aarch64_aa32_a57_init(cpu, false);
aa32_max_features(cpu);
#ifdef CONFIG_USER_ONLY
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 4/6] target/arm: Introduce cpu types max-v8 and max-v9
2026-08-27 4:15 [PATCH v4 0/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
` (2 preceding siblings ...)
2026-08-27 4:15 ` [PATCH v4 3/6] target/arm: Rename and adjust aarch32_max_v8_tcg_initfn Richard Henderson
@ 2026-08-27 4:15 ` Richard Henderson
2026-08-27 15:37 ` Peter Maydell
2026-08-28 7:30 ` Philippe Mathieu-Daudé
2026-08-27 4:15 ` [PATCH v4 5/6] target/arm: Use -cpu max-v8 with aarch64=off Richard Henderson
2026-08-27 4:15 ` [PATCH v4 6/6] target/arm: Separate cpu types max-v8 and max-v9 Richard Henderson
5 siblings, 2 replies; 15+ messages in thread
From: Richard Henderson @ 2026-08-27 4:15 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, pierrick.bouvier, philmd
Introduce the names and allow them with the virt and sbsa-ref
machine types. So far, the cpu types both exactly match "max".
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/arm/sbsa-ref.c | 2 ++
hw/arm/virt.c | 2 ++
target/arm/tcg/cpu-max-v8.c | 11 +++++++++++
target/arm/tcg/cpu64.c | 1 +
4 files changed, 16 insertions(+)
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index 484b90053e8..56d08f605c8 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -913,6 +913,8 @@ static void sbsa_ref_class_init(ObjectClass *oc, const void *data)
ARM_CPU_TYPE_NAME("neoverse-v1"),
ARM_CPU_TYPE_NAME("neoverse-n2"),
ARM_CPU_TYPE_NAME("max"),
+ ARM_CPU_TYPE_NAME("max-v8"),
+ ARM_CPU_TYPE_NAME("max-v9"),
NULL,
};
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e7a56e37f73..d738b95c726 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -4132,6 +4132,7 @@ static GPtrArray *virt_get_valid_cpu_types(const MachineState *ms)
if (tcg_enabled()) {
g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a7")));
g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a15")));
+ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("max-v8")));
}
if (tcg_enabled() && target_aarch64()) {
g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a35")));
@@ -4143,6 +4144,7 @@ static GPtrArray *virt_get_valid_cpu_types(const MachineState *ms)
g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("neoverse-n1")));
g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("neoverse-v1")));
g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("neoverse-n2")));
+ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("max-v9")));
}
if (target_aarch64()) {
g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a53")));
diff --git a/target/arm/tcg/cpu-max-v8.c b/target/arm/tcg/cpu-max-v8.c
index 5a9845d88f3..55f8c341423 100644
--- a/target/arm/tcg/cpu-max-v8.c
+++ b/target/arm/tcg/cpu-max-v8.c
@@ -2,6 +2,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
+#include "qemu/target-info.h"
#include "internals.h"
@@ -117,3 +118,13 @@ void aarch32_max_v8_tcg_initfn(Object *obj)
cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1);
#endif
}
+
+static void cpu_max_v8_register_type(void)
+{
+ static const ARMCPUInfo max_v8[2] = {
+ { .name = "max-v8", .initfn = aarch32_max_v8_tcg_initfn },
+ { .name = "max-v8", .initfn = aarch64_max_tcg_initfn }
+ };
+ arm_cpu_register(&max_v8[target_aarch64()]);
+}
+type_init(cpu_max_v8_register_type)
diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c
index b38c61ba623..d44a8221c8b 100644
--- a/target/arm/tcg/cpu64.c
+++ b/target/arm/tcg/cpu64.c
@@ -1488,6 +1488,7 @@ static const ARMCPUInfo aarch64_cpus[] = {
{ .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn },
{ .name = "neoverse-v1", .initfn = aarch64_neoverse_v1_initfn },
{ .name = "neoverse-n2", .initfn = aarch64_neoverse_n2_initfn },
+ { .name = "max-v9", .initfn = aarch64_max_tcg_initfn },
};
static void aarch64_cpu_register_types(void)
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 5/6] target/arm: Use -cpu max-v8 with aarch64=off
2026-08-27 4:15 [PATCH v4 0/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
` (3 preceding siblings ...)
2026-08-27 4:15 ` [PATCH v4 4/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
@ 2026-08-27 4:15 ` Richard Henderson
2026-08-27 4:15 ` [PATCH v4 6/6] target/arm: Separate cpu types max-v8 and max-v9 Richard Henderson
5 siblings, 0 replies; 15+ messages in thread
From: Richard Henderson @ 2026-08-27 4:15 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, pierrick.bouvier, philmd
Armv9 does not support privileged aarch32 execution, so
aarch64 cannot be disabled. These tests must use Armv8.
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tests/qtest/arm-cpu-features.c | 4 ++--
tests/functional/aarch64/test_virt_aarch64_off.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
index cb4d01fd46a..7348fb8d28b 100644
--- a/tests/qtest/arm-cpu-features.c
+++ b/tests/qtest/arm-cpu-features.c
@@ -493,8 +493,8 @@ static void test_query_cpu_model_expansion(const void *data)
sve_tests_default(qts, "max");
pauth_tests_default(qts, "max");
- /* TCG allows us to turn off AArch64 on the 'max' CPU type */
- assert_set_feature(qts, "max", "aarch64", false);
+ /* TCG allows us to turn off AArch64 on the 'max-v8' CPU type */
+ assert_set_feature(qts, "max-v8", "aarch64", false);
}
qtest_quit(qts);
diff --git a/tests/functional/aarch64/test_virt_aarch64_off.py b/tests/functional/aarch64/test_virt_aarch64_off.py
index 13d8b73b0d7..73c9a4109c0 100755
--- a/tests/functional/aarch64/test_virt_aarch64_off.py
+++ b/tests/functional/aarch64/test_virt_aarch64_off.py
@@ -18,9 +18,9 @@ class ArmVirtMachine(LinuxKernelTest):
def test_arm_virt(self):
self.set_machine('virt')
# KVM aarch64=off requires a host CPU that supports it, so
- # restrict the test to TCG only
+ # restrict the test to TCG ARMv8.
self.require_accelerator('tcg')
- self.vm.add_args('-cpu', 'max,aarch64=off')
+ self.vm.add_args('-cpu', 'max-v8,aarch64=off')
kernel_path = self.ASSET_KERNEL.fetch()
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 6/6] target/arm: Separate cpu types max-v8 and max-v9
2026-08-27 4:15 [PATCH v4 0/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
` (4 preceding siblings ...)
2026-08-27 4:15 ` [PATCH v4 5/6] target/arm: Use -cpu max-v8 with aarch64=off Richard Henderson
@ 2026-08-27 4:15 ` Richard Henderson
2026-08-27 15:36 ` Peter Maydell
2026-08-28 7:33 ` Philippe Mathieu-Daudé
5 siblings, 2 replies; 15+ messages in thread
From: Richard Henderson @ 2026-08-27 4:15 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, pierrick.bouvier, philmd
Do not include v9-only features in "max-v8".
Do not include the prohibited v8 features in "max-v9".
In aarch64 tcg mode, define "max" as "max-v9".
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/internals.h | 3 +-
target/arm/cpu-max.c | 2 +-
target/arm/tcg/cpu-max-v8.c | 2 +-
target/arm/tcg/cpu64.c | 160 ++++++++++++++++++++++------------
target/arm/tcg/stubs32.c | 7 +-
docs/system/arm/emulation.rst | 13 ++-
6 files changed, 128 insertions(+), 59 deletions(-)
diff --git a/target/arm/internals.h b/target/arm/internals.h
index fc7d5ad6f2c..1775835ad50 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -1809,7 +1809,8 @@ void aarch64_cpu_sve_finalize(ARMCPU *cpu, Error **errp);
void aarch64_cpu_sme_finalize(ARMCPU *cpu, Error **errp);
void aarch64_cpu_pauth_finalize(ARMCPU *cpu, Error **errp);
void aarch64_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp);
-void aarch64_max_tcg_initfn(Object *obj);
+void aarch64_max_v8_tcg_initfn(Object *obj);
+void aarch64_max_v9_tcg_initfn(Object *obj);
void aarch64_add_pauth_properties(Object *obj);
void aarch64_add_sve_properties(Object *obj);
void aarch64_add_sme_properties(Object *obj);
diff --git a/target/arm/cpu-max.c b/target/arm/cpu-max.c
index 9ed45c8764f..739500a04fc 100644
--- a/target/arm/cpu-max.c
+++ b/target/arm/cpu-max.c
@@ -110,7 +110,7 @@ static void cpu_max_initfn(Object *obj)
if (!aarch64_enabled) {
aarch32_max_v8_tcg_initfn(obj);
} else {
- aarch64_max_tcg_initfn(obj);
+ aarch64_max_v9_tcg_initfn(obj);
}
return;
}
diff --git a/target/arm/tcg/cpu-max-v8.c b/target/arm/tcg/cpu-max-v8.c
index 55f8c341423..65f851f2006 100644
--- a/target/arm/tcg/cpu-max-v8.c
+++ b/target/arm/tcg/cpu-max-v8.c
@@ -123,7 +123,7 @@ static void cpu_max_v8_register_type(void)
{
static const ARMCPUInfo max_v8[2] = {
{ .name = "max-v8", .initfn = aarch32_max_v8_tcg_initfn },
- { .name = "max-v8", .initfn = aarch64_max_tcg_initfn }
+ { .name = "max-v8", .initfn = aarch64_max_v8_tcg_initfn },
};
arm_cpu_register(&max_v8[target_aarch64()]);
}
diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c
index d44a8221c8b..251c4b3cf60 100644
--- a/target/arm/tcg/cpu64.c
+++ b/target/arm/tcg/cpu64.c
@@ -1166,11 +1166,10 @@ static void aarch64_neoverse_n2_initfn(Object *obj)
}
/*
- * -cpu max: a CPU with as many features enabled as our emulation supports.
- * The version of '-cpu max' for qemu-system-arm is defined in cpu32.c;
- * this only needs to handle 64 bits.
+ * -cpu max-v8: an ARMv8 CPU with as many features enabled as
+ * our emulation supports.
*/
-void aarch64_max_tcg_initfn(Object *obj)
+void aarch64_max_v8_tcg_initfn(Object *obj)
{
ARMCPU *cpu = ARM_CPU(obj);
ARMISARegisters *isar = &cpu->isar;
@@ -1244,7 +1243,7 @@ void aarch64_max_tcg_initfn(Object *obj)
t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); /* v8.0: FEAT_SHA1 */
t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* v8.1: FEAT_SHA512 */
t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1); /* v8.0: FEAT_CRC32 */
- t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 3); /* v9.3: FEAT_LSE128 */
+ t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); /* v8.0: FEAT_LSE */
t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); /* v8.0: FEAT_RDM */
t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); /* v8.1: FEAT_SHA3 */
t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); /* v8.1: FEAT_SM3 */
@@ -1277,16 +1276,10 @@ void aarch64_max_tcg_initfn(Object *obj)
t = FIELD_DP64(t, ID_AA64ISAR2, MOPS, 1); /* v8.7: FEAT_MOPS */
t = FIELD_DP64(t, ID_AA64ISAR2, BC, 1); /* v8.7: FEAT_HBC */
t = FIELD_DP64(t, ID_AA64ISAR2, WFXT, 2); /* v8.6: FEAT_WFxT */
- t = FIELD_DP64(t, ID_AA64ISAR2, CSSC, 2); /* v9.3: FEAT_CMPBR */
- t = FIELD_DP64(t, ID_AA64ISAR2, LUT, 1); /* v9.2: FEAT_LUT */
+ t = FIELD_DP64(t, ID_AA64ISAR2, CSSC, 1); /* v8.7: FEAT_CSSC */
t = FIELD_DP64(t, ID_AA64ISAR2, ATS1A, 1); /* v8.8: FEAT_ATS1A */
SET_IDREG(isar, ID_AA64ISAR2, t);
- t = GET_IDREG(isar, ID_AA64ISAR3);
- t = FIELD_DP64(t, ID_AA64ISAR3, FAMINMAX, 1); /* v9.2: FEAT_FAMINMAX */
- t = FIELD_DP64(t, ID_AA64ISAR3, FPRCVT, 1); /* v9.5: FEAT_FPRCVT */
- SET_IDREG(isar, ID_AA64ISAR3, t);
-
t = GET_IDREG(isar, ID_AA64PFR0);
t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); /* v8.2: FEAT_FP16 */
t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); /* v8.2: FEAT_FP16 */
@@ -1308,17 +1301,14 @@ void aarch64_max_tcg_initfn(Object *obj)
*/
t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* v8.5: FEAT_MTE3 */
t = FIELD_DP64(t, ID_AA64PFR1, RAS_FRAC, 0); /* v8.3: FEAT_DoubleFault */
- t = FIELD_DP64(t, ID_AA64PFR1, SME, 2); /* v9.2: FEAT_SME2 */
t = FIELD_DP64(t, ID_AA64PFR1, RNDR_TRAP, 1); /* v8.4: FEAT_RNG_TRAP */
t = FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* v8.0: FEAT_CSV2_3 */
t = FIELD_DP64(t, ID_AA64PFR1, NMI, 1); /* v8.7: FEAT_NMI */
- t = FIELD_DP64(t, ID_AA64PFR1, GCS, 1); /* v9.3: FEAT_GCS */
/* v8.7: FEAT_MTE_NO_ADDRESS_TAGS + FEAT_MTE_CANONICAL_TAGS */
t = FIELD_DP64(t, ID_AA64PFR1, MTEX, 1);
SET_IDREG(isar, ID_AA64PFR1, t);
t = GET_IDREG(isar, ID_AA64PFR2);
- t = FIELD_DP64(t, ID_AA64PFR2, FPMR, 1); /* v9.2: FEAT_FPMR */
t = FIELD_DP64(t, ID_AA64PFR2, MTEFAR, 1); /* v8.7: FEAT_MTE_TAGGED_FAR */
t = FIELD_DP64(t, ID_AA64PFR2, MTESTOREONLY, 1); /* v8.7: FEAT_MTE_STORE_ONLY */
t = FIELD_DP64(t, ID_AA64PFR2, MTEPERM, 1); /* v8.7: FEAT_MTE_PERM */
@@ -1368,25 +1358,14 @@ void aarch64_max_tcg_initfn(Object *obj)
t = GET_IDREG(isar, ID_AA64MMFR3);
t = FIELD_DP64(t, ID_AA64MMFR3, TCRX, 1); /* v8.0: FEAT_TCR2 */
t = FIELD_DP64(t, ID_AA64MMFR3, SCTLRX, 1); /* v8.0: FEAT_SCTLR2 */
- t = FIELD_DP64(t, ID_AA64MMFR3, MEC, 1); /* v9.2: FEAT_MEC */
t = FIELD_DP64(t, ID_AA64MMFR3, SPEC_FPACC, 1); /* v8.2: FEAT_FPACC_SPEC */
t = FIELD_DP64(t, ID_AA64MMFR3, S1PIE, 1); /* v8.8: FEAT_S1PIE */
t = FIELD_DP64(t, ID_AA64MMFR3, S2PIE, 1); /* v8.8: FEAT_S2PIE */
t = FIELD_DP64(t, ID_AA64MMFR3, AIE, 1); /* v8.8: FEAT_AIE */
SET_IDREG(isar, ID_AA64MMFR3, t);
- t = GET_IDREG(isar, ID_AA64MMFR4);
- t = FIELD_DP64(t, ID_AA64MMFR4, ASID2, 1); /* v9.4: FEAT_ASID2 */
- SET_IDREG(isar, ID_AA64MMFR4, t);
-
t = GET_IDREG(isar, ID_AA64ZFR0);
- t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 2); /* v9.2: FEAT_SVE2p1 */
- t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* v9.0: FEAT_SVE_PMULL128 */
- t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); /* v9.0: FEAT_SVE_BitPerm */
t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 2); /* v8.2: FEAT_EBF16 */
- t = FIELD_DP64(t, ID_AA64ZFR0, B16B16, 1); /* v9.2: FEAT_SVE_B16B16 */
- t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); /* v9.0: FEAT_SVE_SHA3 */
- t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); /* v9.0: FEAT_SVE_SM4 */
t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); /* v8.1: FEAT_I8MM */
t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); /* v8.2: FEAT_F32MM */
t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); /* v8.2: FEAT_F64MM */
@@ -1398,6 +1377,106 @@ void aarch64_max_tcg_initfn(Object *obj)
t = FIELD_DP64(t, ID_AA64DFR0, HPMN0, 1); /* v8.5: FEAT_HPMN0 */
SET_IDREG(isar, ID_AA64DFR0, t);
+ /* Replicate the same data to the 32-bit id registers. */
+ aa32_max_features(cpu);
+
+#ifdef CONFIG_USER_ONLY
+ /*
+ * For usermode -cpu max we can use a larger and more efficient DCZ
+ * blocksize since we don't have to follow what the hardware does.
+ */
+ cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
+ set_dczid_bs(cpu, 7); /* 512 bytes */
+#endif
+
+ /* v8.2: FEAT_SVE */
+ cpu->sve_vq.supported = MAKE_64BIT_MASK(0, ARM_MAX_VQ);
+ aarch64_add_sve_properties(OBJECT(cpu));
+ object_property_add(OBJECT(cpu), "sve-max-vq", "uint32",
+ cpu_max_get_sve_max_vq, cpu_max_set_sve_max_vq,
+ NULL, NULL);
+
+ /* v8.2: FEAT_PAuth2 */
+ aarch64_add_pauth_properties(OBJECT(cpu));
+
+ /* v8.4: FEAT_MTE2 */
+ cpu->gm_blocksize = 6; /* 256 bytes */
+
+ /* v8.6: FEAT_LPA2 */
+ qdev_property_add_static(DEVICE(cpu), &arm_cpu_lpa2_property);
+}
+
+/*
+ * -cpu max-v9: an ARMv9 CPU with as many features enabled as
+ * our emulation supports.
+ */
+void aarch64_max_v9_tcg_initfn(Object *obj)
+{
+ ARMCPU *cpu = ARM_CPU(obj);
+ ARMISARegisters *isar = &cpu->isar;
+ uint64_t t;
+
+ /* Armv9.0 is based on a minimum of Armv8.5. */
+ aarch64_max_v8_tcg_initfn(obj);
+
+ /*
+ * Armv9.0 does not support AArch32 except at EL0,
+ * therefore indicate EL1 through EL3 are AArch64-only.
+ */
+ t = GET_IDREG(isar, ID_AA64PFR0);
+ t = FIELD_DP64(t, ID_AA64PFR0, EL1, 1);
+ t = FIELD_DP64(t, ID_AA64PFR0, EL2, 1);
+ t = FIELD_DP64(t, ID_AA64PFR0, EL3, 1);
+ SET_IDREG(isar, ID_AA64PFR0, t);
+
+ /* v9.0 prohibits FEAT_DoubleLock. */
+ FIELD_DP64_IDREG(isar, ID_AA64DFR0, DOUBLELOCK, -1);
+ FIELD_DP64_IDREG(isar, ID_AA64PFR0, RAS, 1);
+ isar->dbgdevid = FIELD_DP32(isar->dbgdevid, DBGDEVID, DOUBLELOCK, 0);
+
+ /*
+ * Below, note the revision from which the feature is OPTIONAL.
+ */
+ t = GET_IDREG(isar, ID_AA64ISAR0);
+ t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 3); /* v9.3: FEAT_LSE128 */
+ SET_IDREG(isar, ID_AA64ISAR0, t);
+
+ t = GET_IDREG(isar, ID_AA64ISAR2);
+ t = FIELD_DP64(t, ID_AA64ISAR2, CSSC, 2); /* v9.3: FEAT_CMPBR */
+ t = FIELD_DP64(t, ID_AA64ISAR2, LUT, 1); /* v9.2: FEAT_LUT */
+ SET_IDREG(isar, ID_AA64ISAR2, t);
+
+ t = GET_IDREG(isar, ID_AA64ISAR3);
+ t = FIELD_DP64(t, ID_AA64ISAR3, FAMINMAX, 1); /* v9.2: FEAT_FAMINMAX */
+ t = FIELD_DP64(t, ID_AA64ISAR3, FPRCVT, 1); /* v9.5: FEAT_FPRCVT */
+ SET_IDREG(isar, ID_AA64ISAR3, t);
+
+ t = GET_IDREG(isar, ID_AA64PFR1);
+ t = FIELD_DP64(t, ID_AA64PFR1, SME, 2); /* v9.2: FEAT_SME2 */
+ t = FIELD_DP64(t, ID_AA64PFR1, GCS, 1); /* v9.3: FEAT_GCS */
+ SET_IDREG(isar, ID_AA64PFR1, t);
+
+ t = GET_IDREG(isar, ID_AA64PFR2);
+ t = FIELD_DP64(t, ID_AA64PFR2, FPMR, 1); /* v9.2: FEAT_FPMR */
+ SET_IDREG(isar, ID_AA64PFR2, t);
+
+ t = GET_IDREG(isar, ID_AA64MMFR3);
+ t = FIELD_DP64(t, ID_AA64MMFR3, MEC, 1); /* v9.2: FEAT_MEC */
+ SET_IDREG(isar, ID_AA64MMFR3, t);
+
+ t = GET_IDREG(isar, ID_AA64MMFR4);
+ t = FIELD_DP64(t, ID_AA64MMFR4, ASID2, 1); /* v9.4: FEAT_ASID2 */
+ SET_IDREG(isar, ID_AA64MMFR4, t);
+
+ t = GET_IDREG(isar, ID_AA64ZFR0);
+ t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 2); /* v9.2: FEAT_SVE2p1 */
+ t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* v9.0: FEAT_SVE_PMULL128 */
+ t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); /* v9.0: FEAT_SVE_BitPerm */
+ t = FIELD_DP64(t, ID_AA64ZFR0, B16B16, 1); /* v9.2: FEAT_SVE_B16B16 */
+ t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); /* v9.0: FEAT_SVE_SHA3 */
+ t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); /* v9.0: FEAT_SVE_SM4 */
+ SET_IDREG(isar, ID_AA64ZFR0, t);
+
t = GET_IDREG(isar, ID_AA64SMFR0);
t = FIELD_DP64(t, ID_AA64SMFR0, SMOP4, 1); /* v9.4: FEAT_SME_MOP4 */
t = FIELD_DP64(t, ID_AA64SMFR0, STMOP, 1); /* v9.4: FEAT_SME_TMOP */
@@ -1434,43 +1513,16 @@ void aarch64_max_tcg_initfn(Object *obj)
t = FIELD_DP64(t, ID_AA64FPFR0, F8CVT, 1); /* v9.2: FEAT_FP8 */
SET_IDREG(isar, ID_AA64FPFR0, t);
- /* Replicate the same data to the 32-bit id registers. */
- aa32_max_features(cpu);
-
-#ifdef CONFIG_USER_ONLY
- /*
- * For usermode -cpu max we can use a larger and more efficient DCZ
- * blocksize since we don't have to follow what the hardware does.
- */
- cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
- set_dczid_bs(cpu, 7); /* 512 bytes */
-#endif
-
- /* v8.4: FEAT_MTE2 */
- cpu->gm_blocksize = 6; /* 256 bytes */
-
- /* v8.2: FEAT_SVE */
- cpu->sve_vq.supported = MAKE_64BIT_MASK(0, ARM_MAX_VQ);
- aarch64_add_sve_properties(obj);
- object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_max_vq,
- cpu_max_set_sve_max_vq, NULL, NULL);
-
/* v9.2: FEAT_SME */
cpu->sme_vq.supported = SVE_VQ_POW2_MAP;
aarch64_add_sme_properties(obj);
- /* v8.2: FEAT_PAuth2 */
- aarch64_add_pauth_properties(obj);
-
/* v9.1: FEAT_RME */
object_property_add_bool(obj, "x-rme", cpu_arm_get_rme, cpu_arm_set_rme);
/* v9.4: FEAT_RME_GPC2 */
object_property_add(obj, "x-l0gptsz", "uint32", cpu_max_get_l0gptsz,
cpu_max_set_l0gptsz, NULL, NULL);
-
- /* v8.6: FEAT_LPA2 */
- qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property);
}
static const ARMCPUInfo aarch64_cpus[] = {
@@ -1488,7 +1540,7 @@ static const ARMCPUInfo aarch64_cpus[] = {
{ .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn },
{ .name = "neoverse-v1", .initfn = aarch64_neoverse_v1_initfn },
{ .name = "neoverse-n2", .initfn = aarch64_neoverse_n2_initfn },
- { .name = "max-v9", .initfn = aarch64_max_tcg_initfn },
+ { .name = "max-v9", .initfn = aarch64_max_v9_tcg_initfn },
};
static void aarch64_cpu_register_types(void)
diff --git a/target/arm/tcg/stubs32.c b/target/arm/tcg/stubs32.c
index 78f819ef6ff..af0911a24c3 100644
--- a/target/arm/tcg/stubs32.c
+++ b/target/arm/tcg/stubs32.c
@@ -28,7 +28,12 @@ void aarch64_host_initfn(Object *obj)
g_assert_not_reached();
}
-void aarch64_max_tcg_initfn(Object *obj)
+void aarch64_max_v8_tcg_initfn(Object *obj)
+{
+ g_assert_not_reached();
+}
+
+void aarch64_max_v9_tcg_initfn(Object *obj)
{
g_assert_not_reached();
}
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
index cc42db9e0b7..ff02435975b 100644
--- a/docs/system/arm/emulation.rst
+++ b/docs/system/arm/emulation.rst
@@ -230,7 +230,18 @@ to the `Arm Architecture Reference Manual for A-profile architecture
When a specific named CPU is being emulated, only those features which
are present in hardware for that CPU are emulated. (If a feature is
not in the list above then it is not supported, even if the real
-hardware should have it.) The ``max`` CPU enables all features.
+hardware should have it.)
+
+The ``max-v8`` CPU enables all of the listed Armv8-A architecture
+extensions but none of the Armv9-A architecture extensions.
+
+The ``max-v9`` CPU enables all of the listed extensions except for
+those that are prohibited by the Armv9-A architecture: FEAT_AA32EL1,
+FEAT_AA32EL2, FEAT_AA32EL3, and FEAT_DoubleLock.
+
+The ``max`` CPU is an alias for ``max-v9`` under AArch64 TCG emulation,
+an alias for ``max-v8`` under AArch32 TCG emulation, or an alias
+for ``host`` under hardware virtualization.
R-profile CPU architecture support
==================================
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v4 6/6] target/arm: Separate cpu types max-v8 and max-v9
2026-08-27 4:15 ` [PATCH v4 6/6] target/arm: Separate cpu types max-v8 and max-v9 Richard Henderson
@ 2026-08-27 15:36 ` Peter Maydell
2026-08-28 7:33 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2026-08-27 15:36 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel, qemu-arm, pierrick.bouvier, philmd
On Thu, 27 Aug 2026 at 05:17, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Do not include v9-only features in "max-v8".
> Do not include the prohibited v8 features in "max-v9".
> In aarch64 tcg mode, define "max" as "max-v9".
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 4/6] target/arm: Introduce cpu types max-v8 and max-v9
2026-08-27 4:15 ` [PATCH v4 4/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
@ 2026-08-27 15:37 ` Peter Maydell
2026-08-28 7:30 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2026-08-27 15:37 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel, qemu-arm, pierrick.bouvier, philmd
On Thu, 27 Aug 2026 at 05:17, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Introduce the names and allow them with the virt and sbsa-ref
> machine types. So far, the cpu types both exactly match "max".
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 2/6] target/arm: Build cpu32.c once in system mode
2026-08-27 4:15 ` [PATCH v4 2/6] target/arm: Build cpu32.c once in system mode Richard Henderson
@ 2026-08-27 16:37 ` Pierrick Bouvier
2026-08-28 7:28 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 15+ messages in thread
From: Pierrick Bouvier @ 2026-08-27 16:37 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: qemu-arm, philmd
On 8/26/2026 9:15 PM, Richard Henderson wrote:
> "Move" the ifdef to meson.build rules.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/tcg/cpu32.c | 5 -----
> target/arm/tcg/meson.build | 10 +++++-----
> 2 files changed, 5 insertions(+), 10 deletions(-)
>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 1/6] target/arm: Move -cpu max stuff out of cpu32.c
2026-08-27 4:15 ` [PATCH v4 1/6] target/arm: Move -cpu max stuff out of cpu32.c Richard Henderson
@ 2026-08-27 22:50 ` Pierrick Bouvier
2026-08-28 9:43 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 15+ messages in thread
From: Pierrick Bouvier @ 2026-08-27 22:50 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: qemu-arm, philmd
On 8/26/2026 9:15 PM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/tcg/cpu-max-v8.c | 117 ++++++++++++++++++++++++++++++++++++
> target/arm/tcg/cpu32.c | 111 ----------------------------------
> target/arm/tcg/meson.build | 1 +
> 3 files changed, 118 insertions(+), 111 deletions(-)
> create mode 100644 target/arm/tcg/cpu-max-v8.c
>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 2/6] target/arm: Build cpu32.c once in system mode
2026-08-27 4:15 ` [PATCH v4 2/6] target/arm: Build cpu32.c once in system mode Richard Henderson
2026-08-27 16:37 ` Pierrick Bouvier
@ 2026-08-28 7:28 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-28 7:28 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: qemu-arm, pierrick.bouvier
On 27/8/26 06:15, Richard Henderson wrote:
> "Move" the ifdef to meson.build rules.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/tcg/cpu32.c | 5 -----
> target/arm/tcg/meson.build | 10 +++++-----
> 2 files changed, 5 insertions(+), 10 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 4/6] target/arm: Introduce cpu types max-v8 and max-v9
2026-08-27 4:15 ` [PATCH v4 4/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
2026-08-27 15:37 ` Peter Maydell
@ 2026-08-28 7:30 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-28 7:30 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: qemu-arm, pierrick.bouvier
On 27/8/26 06:15, Richard Henderson wrote:
> Introduce the names and allow them with the virt and sbsa-ref
> machine types. So far, the cpu types both exactly match "max".
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> hw/arm/sbsa-ref.c | 2 ++
> hw/arm/virt.c | 2 ++
> target/arm/tcg/cpu-max-v8.c | 11 +++++++++++
> target/arm/tcg/cpu64.c | 1 +
> 4 files changed, 16 insertions(+)
> +static void cpu_max_v8_register_type(void)
> +{
> + static const ARMCPUInfo max_v8[2] = {
> + { .name = "max-v8", .initfn = aarch32_max_v8_tcg_initfn },
> + { .name = "max-v8", .initfn = aarch64_max_tcg_initfn }
> + };
> + arm_cpu_register(&max_v8[target_aarch64()]);
> +}
:)
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 6/6] target/arm: Separate cpu types max-v8 and max-v9
2026-08-27 4:15 ` [PATCH v4 6/6] target/arm: Separate cpu types max-v8 and max-v9 Richard Henderson
2026-08-27 15:36 ` Peter Maydell
@ 2026-08-28 7:33 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-28 7:33 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: qemu-arm, pierrick.bouvier
On 27/8/26 06:15, Richard Henderson wrote:
> Do not include v9-only features in "max-v8".
> Do not include the prohibited v8 features in "max-v9".
> In aarch64 tcg mode, define "max" as "max-v9".
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/internals.h | 3 +-
> target/arm/cpu-max.c | 2 +-
> target/arm/tcg/cpu-max-v8.c | 2 +-
> target/arm/tcg/cpu64.c | 160 ++++++++++++++++++++++------------
> target/arm/tcg/stubs32.c | 7 +-
> docs/system/arm/emulation.rst | 13 ++-
> 6 files changed, 128 insertions(+), 59 deletions(-)
Thank you for the help with this! LGTM:
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 1/6] target/arm: Move -cpu max stuff out of cpu32.c
2026-08-27 4:15 ` [PATCH v4 1/6] target/arm: Move -cpu max stuff out of cpu32.c Richard Henderson
2026-08-27 22:50 ` Pierrick Bouvier
@ 2026-08-28 9:43 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-28 9:43 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: qemu-arm, pierrick.bouvier
On 27/8/26 06:15, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/tcg/cpu-max-v8.c | 117 ++++++++++++++++++++++++++++++++++++
> target/arm/tcg/cpu32.c | 111 ----------------------------------
> target/arm/tcg/meson.build | 1 +
> 3 files changed, 118 insertions(+), 111 deletions(-)
> create mode 100644 target/arm/tcg/cpu-max-v8.c
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-08-28 9:44 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27 4:15 [PATCH v4 0/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
2026-08-27 4:15 ` [PATCH v4 1/6] target/arm: Move -cpu max stuff out of cpu32.c Richard Henderson
2026-08-27 22:50 ` Pierrick Bouvier
2026-08-28 9:43 ` Philippe Mathieu-Daudé
2026-08-27 4:15 ` [PATCH v4 2/6] target/arm: Build cpu32.c once in system mode Richard Henderson
2026-08-27 16:37 ` Pierrick Bouvier
2026-08-28 7:28 ` Philippe Mathieu-Daudé
2026-08-27 4:15 ` [PATCH v4 3/6] target/arm: Rename and adjust aarch32_max_v8_tcg_initfn Richard Henderson
2026-08-27 4:15 ` [PATCH v4 4/6] target/arm: Introduce cpu types max-v8 and max-v9 Richard Henderson
2026-08-27 15:37 ` Peter Maydell
2026-08-28 7:30 ` Philippe Mathieu-Daudé
2026-08-27 4:15 ` [PATCH v4 5/6] target/arm: Use -cpu max-v8 with aarch64=off Richard Henderson
2026-08-27 4:15 ` [PATCH v4 6/6] target/arm: Separate cpu types max-v8 and max-v9 Richard Henderson
2026-08-27 15:36 ` Peter Maydell
2026-08-28 7:33 ` Philippe Mathieu-Daudé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.