[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/61] hw/intc/arm_gicv3_its: Factor out "is intid a valid LPI ID?
From: |
Peter Maydell |
Subject: |
[PULL 06/61] hw/intc/arm_gicv3_its: Factor out "is intid a valid LPI ID?" |
Date: |
Fri, 22 Apr 2022 11:03:37 +0100 |
In process_mapti() we check interrupt IDs to see whether they are
in the valid LPI range. Factor this out into its own utility
function, as we're going to want it elsewhere too for GICv4.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220408141550.1271295-7-peter.maydell@linaro.org
---
hw/intc/arm_gicv3_its.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c
index f8467b61ec5..a2462098445 100644
--- a/hw/intc/arm_gicv3_its.c
+++ b/hw/intc/arm_gicv3_its.c
@@ -79,6 +79,12 @@ typedef enum ItsCmdResult {
CMD_CONTINUE = 1,
} ItsCmdResult;
+static inline bool intid_in_lpi_range(uint32_t id)
+{
+ return id >= GICV3_LPI_INTID_START &&
+ id < (1 << (GICD_TYPER_IDBITS + 1));
+}
+
static uint64_t baser_base_addr(uint64_t value, uint32_t page_sz)
{
uint64_t result = 0;
@@ -410,7 +416,6 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const
uint64_t *cmdpkt,
uint32_t devid, eventid;
uint32_t pIntid = 0;
uint64_t num_eventids;
- uint32_t num_intids;
uint16_t icid = 0;
DTEntry dte;
ITEntry ite;
@@ -438,7 +443,6 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const
uint64_t *cmdpkt,
return CMD_STALL;
}
num_eventids = 1ULL << (dte.size + 1);
- num_intids = 1ULL << (GICD_TYPER_IDBITS + 1);
if (icid >= s->ct.num_entries) {
qemu_log_mask(LOG_GUEST_ERROR,
@@ -460,7 +464,7 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const
uint64_t *cmdpkt,
return CMD_CONTINUE;
}
- if (pIntid < GICV3_LPI_INTID_START || pIntid >= num_intids) {
+ if (!intid_in_lpi_range(pIntid)) {
qemu_log_mask(LOG_GUEST_ERROR,
"%s: invalid interrupt ID 0x%x\n", __func__, pIntid);
return CMD_CONTINUE;
--
2.25.1
- [PULL 00/61] target-arm queue, Peter Maydell, 2022/04/22
- [PULL 01/61] hw/intc/arm_gicv3_its: Add missing blank line, Peter Maydell, 2022/04/22
- [PULL 04/61] hw/intc/arm_gicv3: Report correct PIDR0 values for ID registers, Peter Maydell, 2022/04/22
- [PULL 07/61] hw/intc/arm_gicv3_its: Implement GITS_BASER2 for GICv4, Peter Maydell, 2022/04/22
- [PULL 12/61] hw/intc/arm_gicv3_its: Factor out CTE lookup sequence, Peter Maydell, 2022/04/22
- [PULL 10/61] hw/intc/arm_gicv3_its: Distinguish success and error cases of CMD_CONTINUE, Peter Maydell, 2022/04/22
- [PULL 05/61] target/arm/cpu.c: ignore VIRQ and VFIQ if no EL2, Peter Maydell, 2022/04/22
- [PULL 06/61] hw/intc/arm_gicv3_its: Factor out "is intid a valid LPI ID?",
Peter Maydell <=
- [PULL 09/61] hw/intc/arm_gicv3_its: Implement VMAPP, Peter Maydell, 2022/04/22
- [PULL 17/61] hw/intc/arm_gicv3_its: Implement VSYNC, Peter Maydell, 2022/04/22
- [PULL 15/61] hw/intc/arm_gicv3: Keep pointers to every connected ITS, Peter Maydell, 2022/04/22
- [PULL 03/61] hw/intc/arm_gicv3: Insist that redist region capacity matches CPU count, Peter Maydell, 2022/04/22
- [PULL 02/61] hw/intc/arm_gicv3: Sanity-check num-cpu property, Peter Maydell, 2022/04/22
- [PULL 08/61] hw/intc/arm_gicv3_its: Implement VMAPI and VMAPTI, Peter Maydell, 2022/04/22
- [PULL 11/61] hw/intc/arm_gicv3_its: Factor out "find ITE given devid, eventid", Peter Maydell, 2022/04/22
- [PULL 13/61] hw/intc/arm_gicv3_its: Split out process_its_cmd() physical interrupt code, Peter Maydell, 2022/04/22
- [PULL 19/61] hw/intc/arm_gicv3_its: Implement INV for virtual interrupts, Peter Maydell, 2022/04/22
- [PULL 14/61] hw/intc/arm_gicv3_its: Handle virtual interrupts in process_its_cmd(), Peter Maydell, 2022/04/22