diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2022-04-08 15:15:49 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2022-04-22 14:44:53 +0100 |
commit | f31985a77a4a0052219a08bc08b9092daa74eb1e (patch) | |
tree | 07510d6f33b3ba83dcddb0624ef4db33c58ab041 /include/hw/arm/virt.h | |
parent | 5a389a9aec382c5093c6c143a5a6ed7809eadc12 (diff) | |
download | qemu-f31985a77a4a0052219a08bc08b9092daa74eb1e.zip qemu-f31985a77a4a0052219a08bc08b9092daa74eb1e.tar.gz qemu-f31985a77a4a0052219a08bc08b9092daa74eb1e.tar.bz2 |
hw/arm/virt: Abstract out calculation of redistributor region capacity
In several places in virt.c we calculate the number of redistributors that
fit in a region of our memory map, which is the size of the region
divided by the size of a single redistributor frame. For GICv4, the
redistributor frame is a different size from that for GICv3. Abstract
out the calculation of redistributor region capacity so that we have
one place we need to change to handle GICv4 rather than several.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220408141550.1271295-41-peter.maydell@linaro.org
Diffstat (limited to 'include/hw/arm/virt.h')
-rw-r--r-- | include/hw/arm/virt.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 7e76ee2..360463e 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -185,11 +185,16 @@ OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass, VIRT_MACHINE) void virt_acpi_setup(VirtMachineState *vms); bool virt_is_acpi_enabled(VirtMachineState *vms); +/* Return number of redistributors that fit in the specified region */ +static uint32_t virt_redist_capacity(VirtMachineState *vms, int region) +{ + return vms->memmap[region].size / GICV3_REDIST_SIZE; +} + /* Return the number of used redistributor regions */ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms) { - uint32_t redist0_capacity = - vms->memmap[VIRT_GIC_REDIST].size / GICV3_REDIST_SIZE; + uint32_t redist0_capacity = virt_redist_capacity(vms, VIRT_GIC_REDIST); assert(vms->gic_version == VIRT_GIC_VERSION_3); |