dev-arm: Fix GICv3 LPI loop
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 23 Apr 2019 16:38:54 +0000 (17:38 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 2 May 2019 12:44:13 +0000 (12:44 +0000)
Loop was mistakenly increasing the upper bound of the iteration rather
than the index variable itself.

Change-Id: I0a5a7bc189bc0954a8a6d9581032c2ed902030da
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18590
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/dev/arm/gic_v3_redistributor.cc

index 348cd9627660ba47101fa28f77a476d49dca33e1..3039e1e55ec6b631b34b3912555ee7ea0e038fc2 100644 (file)
@@ -830,14 +830,14 @@ Gicv3Redistributor::update()
     }
 
     // Check LPIs
-    uint32_t largest_lpi_id = 1 << (lpiIDBits + 1);
+    const uint32_t largest_lpi_id = 1 << (lpiIDBits + 1);
     char lpi_pending_table[largest_lpi_id / 8];
     ThreadContext * tc = gic->getSystem()->getThreadContext(cpuId);
     tc->getVirtProxy().readBlob(lpiPendingTablePtr,
                                 (uint8_t *) lpi_pending_table,
                                 sizeof(lpi_pending_table));
     for (int lpi_id = SMALLEST_LPI_ID; lpi_id < largest_lpi_id;
-         largest_lpi_id++) {
+         lpi_id++) {
         uint32_t lpi_pending_entry_byte = lpi_id / 8;
         uint8_t lpi_pending_entry_bit_position = lpi_id % 8;
         bool lpi_is_pending = lpi_pending_table[lpi_pending_entry_byte] &