dev-arm: Take into account PPI enable bit
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 5 Sep 2018 13:43:09 +0000 (14:43 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Fri, 28 Sep 2018 10:13:27 +0000 (10:13 +0000)
When checking for PPIs to send to the cpu in the PL390 GIC we
were forwarding any pending PPI regardless of their masking
in the distributor.

Change-Id: I2e294abeca733cca95cd0deeb9659c7d3d9d8734
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12624
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/dev/arm/gic_v2.cc

index 6eaf065259bb7240555c68768007e812c76abc29..fe5e1eac844a770f095613022a5c0fd938d14f69 100644 (file)
@@ -742,11 +742,18 @@ GicV2::updateIntState(int hint)
 
         // Check PPIs
         if (cpuPpiPending[cpu]) {
-        for (int ppi = 0; ppi < PPI_MAX; ppi++) {
-            if (cpuPpiPending[cpu] & (1 << ppi))
-                if (highest_pri > getIntPriority(cpu, SGI_MAX + ppi)) {
-                    highest_pri = getIntPriority(cpu, SGI_MAX + ppi);
-                    highest_int = SGI_MAX + ppi;
+            for (int ppi_idx = 0, int_num = SGI_MAX;
+                 int_num < PPI_MAX + SGI_MAX;
+                 ppi_idx++, int_num++) {
+
+                const bool ppi_pending = bits(cpuPpiPending[cpu], ppi_idx);
+                const bool ppi_enabled = bits(getIntEnabled(cpu, 0), int_num);
+                const bool higher_priority =
+                    highest_pri > getIntPriority(cpu, int_num);
+
+                if (ppi_pending && ppi_enabled && higher_priority) {
+                    highest_pri = getIntPriority(cpu, int_num);
+                    highest_int = int_num;
                 }
             }
         }