]> git.proxmox.com Git - mirror_qemu.git/commit
target/arm: Do all "ARM_FEATURE_X implies Y" checks in post_init
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 24 Jul 2023 17:43:33 +0000 (18:43 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 31 Aug 2023 10:05:04 +0000 (11:05 +0100)
commitb8f7959f28c4f36496bc0a694fa28bf5078152c5
tree2c6eed0075e902c991841ad3c8a5bcb248c58857
parent5ec008a2bd7e928d41d2a158120223311742d860
target/arm: Do all "ARM_FEATURE_X implies Y" checks in post_init

Where architecturally one ARM_FEATURE_X flag implies another
ARM_FEATURE_Y, we allow the CPU init function to only set X, and then
set Y for it.  Currently we do this in two places -- we set a few
flags in arm_cpu_post_init() because we need them to decide which
properties to create on the CPU object, and then we do the rest in
arm_cpu_realizefn().  However, this is fragile, because it's easy to
add a new property and not notice that this means that an X-implies-Y
check now has to move from realize to post-init.

As a specific example, the pmsav7-dregion property is conditional
on ARM_FEATURE_PMSA && ARM_FEATURE_V7, which means it won't appear
on the Cortex-M33 and -M55, because they set ARM_FEATURE_V8 and
rely on V8-implies-V7, which doesn't happen until the realizefn.

Move all of these X-implies-Y checks into a new function, which
we call at the top of arm_cpu_post_init(), so the feature bits
are available at that point.

This does now give us the reverse issue, that if there's a feature
bit which is enabled or disabled by the setting of a property then
then X-implies-Y features that are dependent on that property need to
be in realize, not in this new function.  But the only one of those
is the "EL3 implies VBAR" which is already in the right place, so
putting things this way round seems better to me.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230724174335.2150499-2-peter.maydell@linaro.org
target/arm/cpu.c