mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-01-02 04:30:32 -07:00
It doesn't make sense to read the value of MDCR_EL2 on a non-A-profile
CPU, and in fact if you try to do it we will assert:
#6 0x00007ffff4b95e96 in __GI___assert_fail
(assertion=0x5555565a8c70 "!arm_feature(env, ARM_FEATURE_M)", file=0x5555565a6e5c "../../target/arm/helper.c", line=12600, function=0x5555565a9560 <__PRETTY_FUNCTION__.0> "arm_security_space_below_el3") at ./assert/assert.c:101
#7 0x0000555555ebf412 in arm_security_space_below_el3 (env=0x555557bc8190) at ../../target/arm/helper.c:12600
#8 0x0000555555ea6f89 in arm_is_el2_enabled (env=0x555557bc8190) at ../../target/arm/cpu.h:2595
#9 0x0000555555ea942f in arm_mdcr_el2_eff (env=0x555557bc8190) at ../../target/arm/internals.h:1512
We might call pmu_counter_enabled() on an M-profile CPU (for example
from the migration pre/post hooks in machine.c); this should always
return false because these CPUs don't set ARM_FEATURE_PMU.
Avoid the assertion by not calling arm_mdcr_el2_eff() before we
have done the early return for "PMU not present".
This fixes an assertion failure if you try to do a loadvm or
savevm for an M-profile board.
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2155
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20240208153346.970021-1-peter.maydell@linaro.org
(cherry picked from commit
|
||
|---|---|---|
| .. | ||
| hvf | ||
| tcg | ||
| arch_dump.c | ||
| arm-powerctl.c | ||
| arm-powerctl.h | ||
| arm-qmp-cmds.c | ||
| common-semi-target.h | ||
| cortex-regs.c | ||
| cpregs.h | ||
| cpu-features.h | ||
| cpu-param.h | ||
| cpu-qom.h | ||
| cpu.c | ||
| cpu.h | ||
| cpu64.c | ||
| debug_helper.c | ||
| gdbstub.c | ||
| gdbstub64.c | ||
| helper.c | ||
| helper.h | ||
| hvf_arm.h | ||
| hyp_gdbstub.c | ||
| idau.h | ||
| internals.h | ||
| Kconfig | ||
| kvm-consts.h | ||
| kvm-stub.c | ||
| kvm.c | ||
| kvm64.c | ||
| kvm_arm.h | ||
| machine.c | ||
| meson.build | ||
| op_addsub.h | ||
| ptw.c | ||
| syndrome.h | ||
| tcg-stubs.c | ||
| trace-events | ||
| trace.h | ||
| vfp_helper.c | ||