From: Giacomo Travaglini Date: Tue, 23 Apr 2019 15:08:14 +0000 (+0100) Subject: dev-arm: Fix Bitwise operation in GICv3 X-Git-Tag: v19.0.0.0~902 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9de1f75f16ecde72856965844ed4bbeb62c33224;p=gem5.git dev-arm: Fix Bitwise operation in GICv3 GICv3 LPI code is wrongly using the xor operator (^) in order to evaluate powers of two. Change-Id: Ib1131fd5940d334967a3741f8fd15d86625be356 Signed-off-by: Giacomo Travaglini Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18589 Maintainer: Andreas Sandberg Tested-by: kokoro --- diff --git a/src/dev/arm/gic_v3_redistributor.cc b/src/dev/arm/gic_v3_redistributor.cc index eb5767a16..348cd9627 100644 --- a/src/dev/arm/gic_v3_redistributor.cc +++ b/src/dev/arm/gic_v3_redistributor.cc @@ -675,7 +675,7 @@ Gicv3Redistributor::write(Addr addr, uint64_t data, size_t size, lpiIDBits = 0xf; } - uint32_t largest_lpi_id = 2 ^ (lpiIDBits + 1); + uint32_t largest_lpi_id = 1 << (lpiIDBits + 1); uint32_t number_lpis = largest_lpi_id - SMALLEST_LPI_ID + 1; lpiConfigurationTable.resize(number_lpis); break; @@ -699,7 +699,7 @@ Gicv3Redistributor::write(Addr addr, uint64_t data, size_t size, case GICR_INVLPIR: { // Redistributor Invalidate LPI Register uint32_t lpi_id = data & 0xffffffff; - uint32_t largest_lpi_id = 2 ^ (lpiIDBits + 1); + uint32_t largest_lpi_id = 1 << (lpiIDBits + 1); if (lpi_id > largest_lpi_id) { return; @@ -830,7 +830,7 @@ Gicv3Redistributor::update() } // Check LPIs - uint32_t largest_lpi_id = 2 ^ (lpiIDBits + 1); + 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, @@ -881,7 +881,7 @@ Gicv3Redistributor::setClrLPI(uint64_t data, bool set) } uint32_t lpi_id = data & 0xffffffff; - uint32_t largest_lpi_id = 2 ^ (lpiIDBits + 1); + uint32_t largest_lpi_id = 1 << (lpiIDBits + 1); if (lpi_id > largest_lpi_id) { // Writes to GICR_SETLPIR or GICR_CLRLPIR have not effect if