mirror of https://github.com/proxmox/mirror_qemu
target/arm: Extend arm_pamax to more than aarch64
Move the code from hw/arm/virt.c that is supposed to handle v7 into the one function. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reported-by: He Zhe <zhe.he@windriver.com> Message-id: 20220619001541.131672-2-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>master
parent
d61d1b8600
commit
22536b1324
|
@ -2010,15 +2010,7 @@ static void machvirt_init(MachineState *machine)
|
||||||
cpuobj = object_new(possible_cpus->cpus[0].type);
|
cpuobj = object_new(possible_cpus->cpus[0].type);
|
||||||
armcpu = ARM_CPU(cpuobj);
|
armcpu = ARM_CPU(cpuobj);
|
||||||
|
|
||||||
if (object_property_get_bool(cpuobj, "aarch64", NULL)) {
|
|
||||||
pa_bits = arm_pamax(armcpu);
|
pa_bits = arm_pamax(armcpu);
|
||||||
} else if (arm_feature(&armcpu->env, ARM_FEATURE_LPAE)) {
|
|
||||||
/* v7 with LPAE */
|
|
||||||
pa_bits = 40;
|
|
||||||
} else {
|
|
||||||
/* Anything else */
|
|
||||||
pa_bits = 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
object_unref(cpuobj);
|
object_unref(cpuobj);
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ static const uint8_t pamax_map[] = {
|
||||||
/* The cpu-specific constant value of PAMax; also used by hw/arm/virt. */
|
/* The cpu-specific constant value of PAMax; also used by hw/arm/virt. */
|
||||||
unsigned int arm_pamax(ARMCPU *cpu)
|
unsigned int arm_pamax(ARMCPU *cpu)
|
||||||
{
|
{
|
||||||
|
if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
|
||||||
unsigned int parange =
|
unsigned int parange =
|
||||||
FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE);
|
FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE);
|
||||||
|
|
||||||
|
@ -46,6 +47,13 @@ unsigned int arm_pamax(ARMCPU *cpu)
|
||||||
assert(parange < ARRAY_SIZE(pamax_map));
|
assert(parange < ARRAY_SIZE(pamax_map));
|
||||||
return pamax_map[parange];
|
return pamax_map[parange];
|
||||||
}
|
}
|
||||||
|
if (arm_feature(&cpu->env, ARM_FEATURE_LPAE)) {
|
||||||
|
/* v7 with LPAE */
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
/* Anything else */
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a possible stage1+2 MMU index into the appropriate stage 1 MMU index
|
* Convert a possible stage1+2 MMU index into the appropriate stage 1 MMU index
|
||||||
|
|
Loading…
Reference in New Issue