arch-arm: Create helper for sending events (SEV)
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 19 Sep 2019 13:43:36 +0000 (14:43 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 2 Oct 2019 15:55:06 +0000 (15:55 +0000)
Events can be generated by devices, so we need an interface devices
can use to notify events to PEs.

Change-Id: I330575e7d116388d5f9260ef4400b0feaa861f3e
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/+/21301
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/isa/insts/misc.isa
src/arch/arm/utility.cc
src/arch/arm/utility.hh

index 92a6b53f1620ee6754b9cfc952fb4e581eae146d..ecf09aab5dd451b6d7e8294bd832095f3af566d0 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode:c++ -*-
 
-// Copyright (c) 2010-2013,2017-2018 ARM Limited
+// Copyright (c) 2010-2013,2017-2019 ARM Limited
 // All rights reserved
 //
 // The license below extends only to copyright in the software and shall
@@ -784,11 +784,9 @@ let {{
         ThreadContext *oc = sys->getThreadContext(x);
         if (oc == xc->tcBase())
             continue;
+
         // Wake CPU with interrupt if they were sleeping
-        if (oc->readMiscReg(MISCREG_SEV_MAILBOX) == 0) {
-            // Post Interrupt and wake cpu if needed
-            oc->getCpuPtr()->postInterrupt(oc->threadId(), INT_SEV, 0);
-        }
+        sendEvent(oc);
     }
     '''
     sevIop = InstObjParams("sev", "SevInst", "PredOp", \
index 924024d0e8fe65fdd88ac8b55ee8774e6c480a2c..d68850c5f618b5d448e0aab9089791e2904d3c28 100644 (file)
@@ -192,6 +192,15 @@ copyRegs(ThreadContext *src, ThreadContext *dest)
     dynamic_cast<TLB *>(dest->getDTBPtr())->invalidateMiscReg();
 }
 
+void
+sendEvent(ThreadContext *tc)
+{
+    if (tc->readMiscReg(MISCREG_SEV_MAILBOX) == 0) {
+        // Post Interrupt and wake cpu if needed
+        tc->getCpuPtr()->postInterrupt(tc->threadId(), INT_SEV, 0);
+    }
+}
+
 bool
 inSecureState(ThreadContext *tc)
 {
index 3a1506114c40ee8decb82628ece9ea9d0dde9480..96f6843c311ed7890fc229716d3450e1bc4382a7 100644 (file)
@@ -117,6 +117,10 @@ copyMiscRegs(ThreadContext *src, ThreadContext *dest)
 
 void initCPU(ThreadContext *tc, int cpuId);
 
+/** Send an event (SEV) to a specific PE if there isn't
+ * already a pending event */
+void sendEvent(ThreadContext *tc);
+
 static inline bool
 inUserMode(CPSR cpsr)
 {