target/arm: Disable has_el2 and has_el3 for user-only

In arm_cpu_reset, we configure many system registers so that user-only
behaves as it should with a minimum of ifdefs.  However, we do not set
all of the system registers as required for a cpu with EL2 and EL3.

Disabling EL2 and EL3 mean that we will not look at those registers,
which means that we don't have to worry about configuring them.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200229012811.24129-4-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
master
Richard Henderson 2020-03-05 16:09:17 +00:00 committed by Peter Maydell
parent e0a38bb35a
commit 45ca3a1408
1 changed files with 4 additions and 2 deletions

View File

@ -1103,11 +1103,13 @@ static Property arm_cpu_reset_hivecs_property =
static Property arm_cpu_rvbar_property = static Property arm_cpu_rvbar_property =
DEFINE_PROP_UINT64("rvbar", ARMCPU, rvbar, 0); DEFINE_PROP_UINT64("rvbar", ARMCPU, rvbar, 0);
#ifndef CONFIG_USER_ONLY
static Property arm_cpu_has_el2_property = static Property arm_cpu_has_el2_property =
DEFINE_PROP_BOOL("has_el2", ARMCPU, has_el2, true); DEFINE_PROP_BOOL("has_el2", ARMCPU, has_el2, true);
static Property arm_cpu_has_el3_property = static Property arm_cpu_has_el3_property =
DEFINE_PROP_BOOL("has_el3", ARMCPU, has_el3, true); DEFINE_PROP_BOOL("has_el3", ARMCPU, has_el3, true);
#endif
static Property arm_cpu_cfgend_property = static Property arm_cpu_cfgend_property =
DEFINE_PROP_BOOL("cfgend", ARMCPU, cfgend, false); DEFINE_PROP_BOOL("cfgend", ARMCPU, cfgend, false);
@ -1222,25 +1224,25 @@ void arm_cpu_post_init(Object *obj)
qdev_property_add_static(DEVICE(obj), &arm_cpu_rvbar_property); qdev_property_add_static(DEVICE(obj), &arm_cpu_rvbar_property);
} }
#ifndef CONFIG_USER_ONLY
if (arm_feature(&cpu->env, ARM_FEATURE_EL3)) { if (arm_feature(&cpu->env, ARM_FEATURE_EL3)) {
/* Add the has_el3 state CPU property only if EL3 is allowed. This will /* Add the has_el3 state CPU property only if EL3 is allowed. This will
* prevent "has_el3" from existing on CPUs which cannot support EL3. * prevent "has_el3" from existing on CPUs which cannot support EL3.
*/ */
qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el3_property); qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el3_property);
#ifndef CONFIG_USER_ONLY
object_property_add_link(obj, "secure-memory", object_property_add_link(obj, "secure-memory",
TYPE_MEMORY_REGION, TYPE_MEMORY_REGION,
(Object **)&cpu->secure_memory, (Object **)&cpu->secure_memory,
qdev_prop_allow_set_link_before_realize, qdev_prop_allow_set_link_before_realize,
OBJ_PROP_LINK_STRONG, OBJ_PROP_LINK_STRONG,
&error_abort); &error_abort);
#endif
} }
if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) { if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) {
qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el2_property); qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el2_property);
} }
#endif
if (arm_feature(&cpu->env, ARM_FEATURE_PMU)) { if (arm_feature(&cpu->env, ARM_FEATURE_PMU)) {
cpu->has_pmu = true; cpu->has_pmu = true;