[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 17/26] hw/intc/arm_gicv3_its: Convert int ID check to num_intids
From: |
Peter Maydell |
Subject: |
[PATCH 17/26] hw/intc/arm_gicv3_its: Convert int ID check to num_intids convention |
Date: |
Sat, 11 Dec 2021 19:11:26 +0000 |
The bounds check on the number of interrupt IDs is correct, but
doesn't match our convention; change the variable name, initialize it
to the 2^n value rather than (2^n)-1, and use >= instead of > in the
comparison.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/intc/arm_gicv3_its.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c
index 8561392fdbe..e6b380f663c 100644
--- a/hw/intc/arm_gicv3_its.c
+++ b/hw/intc/arm_gicv3_its.c
@@ -336,7 +336,7 @@ static bool process_mapti(GICv3ITSState *s, uint64_t value,
uint32_t offset,
AddressSpace *as = &s->gicv3->dma_as;
uint32_t devid, eventid;
uint32_t pIntid = 0;
- uint32_t num_eventids, max_Intid;
+ uint32_t num_eventids, num_intids;
bool dte_valid;
MemTxResult res = MEMTX_OK;
uint16_t icid = 0;
@@ -377,11 +377,11 @@ static bool process_mapti(GICv3ITSState *s, uint64_t
value, uint32_t offset,
}
dte_valid = FIELD_EX64(dte, DTE, VALID);
num_eventids = 1ULL << (FIELD_EX64(dte, DTE, SIZE) + 1);
- max_Intid = (1ULL << (GICD_TYPER_IDBITS + 1)) - 1;
+ num_intids = 1ULL << (GICD_TYPER_IDBITS + 1);
if ((devid >= s->dt.num_ids) || (icid >= s->ct.num_ids)
|| !dte_valid || (eventid >= num_eventids) ||
- (((pIntid < GICV3_LPI_INTID_START) || (pIntid > max_Intid)) &&
+ (((pIntid < GICV3_LPI_INTID_START) || (pIntid >= num_intids)) &&
(pIntid != INTID_SPURIOUS))) {
qemu_log_mask(LOG_GUEST_ERROR,
"%s: invalid command attributes "
--
2.25.1
- Re: [PATCH 07/26] hw/intc/arm_gicv3_its: Correct setting of TableDesc entry_sz, (continued)
- [PATCH 09/26] hw/intc/arm_gicv3_its: Correct handling of MAPI, Peter Maydell, 2021/12/11
- [PATCH 14/26] hw/intc/arm_gicv3_its: Fix various off-by-one errors, Peter Maydell, 2021/12/11
- [PATCH 12/26] hw/intc/arm_gicv3_its: Correct comment about CTE RDBase field size, Peter Maydell, 2021/12/11
- [PATCH 17/26] hw/intc/arm_gicv3_its: Convert int ID check to num_intids convention,
Peter Maydell <=
- [PATCH 23/26] hw/intc/arm_gicv3_its: Fix return codes in process_mapti(), Peter Maydell, 2021/12/11
- [PATCH 21/26] hw/intc/arm_gicv3_its: Fix return codes in process_its_cmd(), Peter Maydell, 2021/12/11
- [PATCH 22/26] hw/intc/arm_gicv3_its: Refactor process_its_cmd() to reduce nesting, Peter Maydell, 2021/12/11