hw/intc/arm_gicv3_cpuif: Handle CPUs that don't specify GICv3 parameters
commit272f75e89088c968c861fef516a4ebc70846dcd5
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 12 May 2022 15:14:52 +0000 (12 16:14 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 19 May 2022 15:19:02 +0000 (19 16:19 +0100)
treeaebe964a171ba3ac1df69e6fb64210db21e44294
parent3d52472f81f0e0684fcab238ab816faeee6b8bcd
hw/intc/arm_gicv3_cpuif: Handle CPUs that don't specify GICv3 parameters

We allow a GICv3 to be connected to any CPU, but we don't do anything
to handle the case where the CPU type doesn't in hardware have a
GICv3 CPU interface and so the various GIC configuration fields
(gic_num_lrs, vprebits, vpribits) are not specified.

The current behaviour is that we will add the EL1 CPU interface
registers, but will not put in the EL2 CPU interface registers, even
if the CPU has EL2, which will leave the GIC in a broken state and
probably result in the guest crashing as it tries to set it up.  This
only affects the virt board when using the cortex-a15 or cortex-a7
CPU types (both 32-bit) with -machine gic-version=3 (or 'max')
and -machine virtualization=on.

Instead of failing to set up the EL2 registers, if the CPU doesn't
define the GIC configuration set it to a reasonable default, matching
the standard configuration for most Arm CPUs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220512151457.3899052-2-peter.maydell@linaro.org
hw/intc/arm_gicv3_cpuif.c