@samitouri / QOSamiQemu / commits / 4b5309cd1f

target/arm/tcg/cpu-v7m.c: add cortex-m85 model

Add Arm Cortex-M85 CPU. This is quite similar to the existing Cortex-M85. ID register values are based on the r1p1 TRM: https://developer.arm.com/documentation/101924/0101/ In hardware, PACBTI support can be configured in or out; as QEMU does not yet implement it, we report it as not present in ID_ISAR5. Reviewed-by: Owen Giles <owen.giles@hpe.com> Reviewed-by: Robert Elliott <elliott@hpe.com> Signed-off-by: Simon Xu <simonxhy0404@gmail.com> Message-Id: <20260805153005.9989-2-simonxhy0404@gmail.com> [PMM: tweaked commit message, expanded comment about PACBTI] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Simon Xu committed Aug 17, 2026 at 19:26 UTC 4b5309cd1f20eab1dd243dafb6b0b1b1f80dc1f6
1 file changed +47
target/arm/tcg/cpu-v7m.c
+47
@@ -237,6 +237,51 @@ static void cortex_m55_initfn(Object *obj)
237 cpu->ctr = 0x8303c003;
238 }
239
240 +static void cortex_m85_initfn(Object *obj)
241 +{
242 + ARMCPU *cpu = ARM_CPU(obj);
243 + ARMISARegisters *isar = &cpu->isar;
244 +
245 + set_feature(&cpu->env, ARM_FEATURE_V8);
246 + set_feature(&cpu->env, ARM_FEATURE_V8_1M);
247 + set_feature(&cpu->env, ARM_FEATURE_M);
248 + set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
249 + set_feature(&cpu->env, ARM_FEATURE_M_SECURITY);
250 + set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
251 + cpu->midr = 0x411fd231; /* r1p1 */
252 + cpu->revidr = 0;
253 + cpu->pmsav7_dregion = 16;
254 + cpu->sau_sregion = 8;
255 + /* These are the MVFR* values for the FPU + full MVE configuration */
256 + cpu->isar.mvfr0 = 0x10110221;
257 + cpu->isar.mvfr1 = 0x12100211;
258 + cpu->isar.mvfr2 = 0x00000040;
259 + SET_IDREG(isar, ID_PFR0, 0x20000030);
260 + SET_IDREG(isar, ID_PFR1, 0x00000230);
261 + SET_IDREG(isar, ID_DFR0, 0x10200000);
262 + SET_IDREG(isar, ID_AFR0, 0x00000000);
263 + SET_IDREG(isar, ID_MMFR0, 0x00111040);
264 + SET_IDREG(isar, ID_MMFR1, 0x00000000);
265 + SET_IDREG(isar, ID_MMFR2, 0x01000000);
266 + SET_IDREG(isar, ID_MMFR3, 0x00000011);
267 + SET_IDREG(isar, ID_ISAR0, 0x01103110);
268 + SET_IDREG(isar, ID_ISAR1, 0x02212000);
269 + SET_IDREG(isar, ID_ISAR2, 0x20232232);
270 + SET_IDREG(isar, ID_ISAR3, 0x01111131);
271 + SET_IDREG(isar, ID_ISAR4, 0x01310132);
272 + /*
273 + * Real Cortex-M85 CPUs can be configured with or without PACBTI.
274 + * If PACBTI is present then ID_ISAR5[23:20] read as 0b0100,
275 + * indicating that QARMA3 is used. QEMU does not yet implement
276 + * PACBTI emulation for M-profile, so we report as a "no-PACBTI"
277 + * CPU for now.
278 + */
279 + SET_IDREG(isar, ID_ISAR5, 0x00000000);
280 + SET_IDREG(isar, ID_ISAR6, 0x00000000);
281 + SET_IDREG(isar, CLIDR, 0x00000000); /* caches not implemented */
282 + cpu->ctr = 0x8303c003;
283 +}
284 +
285 static const TCGCPUOps arm_v7m_tcg_ops = {
286 /* ARM processors have a weak memory model */
287 .guest_default_memory_order = 0,
@@ -290,6 +335,8 @@ static const ARMCPUInfo arm_v7m_cpus[] = {
335 .class_init = arm_v7m_class_init },
336 { .name = "cortex-m55", .initfn = cortex_m55_initfn,
337 .class_init = arm_v7m_class_init },
338 + { .name = "cortex-m85", .initfn = cortex_m85_initfn,
339 + .class_init = arm_v7m_class_init },
340 };
341
342 static void arm_v7m_cpu_register_types(void)