dev-arm: Create postFiq events for GICv2
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 11 Sep 2018 12:21:03 +0000 (13:21 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 1 Oct 2018 08:28:51 +0000 (08:28 +0000)
GICv2 is signaling IRQs only to the CPU. This patch is adding the
capability of scheduling FIQs.

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

src/dev/arm/gic_v2.cc
src/dev/arm/gic_v2.hh

index 01358b732e18f37f9fa82b399dbbc2cc8be43194..7bbc89e7498e061417e79d49c31272e1fb0202ae 100644 (file)
@@ -88,6 +88,9 @@ GicV2::GicV2(const Params *p)
         postIntEvent[x] =
             new EventFunctionWrapper([this, x]{ postDelayedInt(x); },
                                      "Post Interrupt to CPU");
+        postFiqEvent[x] =
+            new EventFunctionWrapper([this, x]{ postDelayedFiq(x); },
+                                     "Post FIQ to CPU");
     }
     DPRINTF(Interrupt, "cpuEnabled[0]=%d cpuEnabled[1]=%d\n", cpuEnabled(0),
             cpuEnabled(1));
@@ -97,8 +100,10 @@ GicV2::GicV2(const Params *p)
 
 GicV2::~GicV2()
 {
-    for (int x = 0; x < CPU_MAX; x++)
+    for (int x = 0; x < CPU_MAX; x++) {
         delete postIntEvent[x];
+        delete postFiqEvent[x];
+    }
 }
 
 Tick
@@ -915,6 +920,25 @@ GicV2::postDelayedInt(uint32_t cpu)
         signalDrainDone();
 }
 
+void
+GicV2::postFiq(uint32_t cpu, Tick when)
+{
+    if (!(postFiqEvent[cpu]->scheduled())) {
+        ++pendingDelayedInterrupts;
+        eventq->schedule(postFiqEvent[cpu], when);
+    }
+}
+
+void
+GicV2::postDelayedFiq(uint32_t cpu)
+{
+    platform->intrctrl->post(cpu, ArmISA::INT_FIQ, 0);
+    --pendingDelayedInterrupts;
+    assert(pendingDelayedInterrupts >= 0);
+    if (pendingDelayedInterrupts == 0)
+        signalDrainDone();
+}
+
 DrainState
 GicV2::drain()
 {
index 4ca2f38e25f97868e899805ff91ffdb26ff5d9dd..4f30b00e6177e35202bd70c8d93116beea7c5f00 100644 (file)
@@ -397,13 +397,16 @@ class GicV2 : public BaseGic, public BaseGicRegisters
      * Post an interrupt to a CPU with a delay
      */
     void postInt(uint32_t cpu, Tick when);
+    void postFiq(uint32_t cpu, Tick when);
 
     /**
      * Deliver a delayed interrupt to the target CPU
      */
     void postDelayedInt(uint32_t cpu);
+    void postDelayedFiq(uint32_t cpu);
 
     EventFunctionWrapper *postIntEvent[CPU_MAX];
+    EventFunctionWrapper *postFiqEvent[CPU_MAX];
     int pendingDelayedInterrupts;
 
   public: