Giacomo Travaglini has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/26809 )

Change subject: cpu: IntrControl, clear all and check helpers
......................................................................

cpu: IntrControl, clear all and check helpers

This patch extends the IntrControl to provided additional member
functions for (1) clearing all pending interrupts in a PE and (2)
checking for any pending interrupt in a PE. These are intended to
be used from interrupt management related peripherals.

Change-Id: I06b553872ed469e7449b872a0716865773ace154
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26809
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Maintainer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/cpu/intr_control.cc
M src/cpu/intr_control.hh
2 files changed, 22 insertions(+), 6 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved
  Giacomo Travaglini: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/cpu/intr_control.cc b/src/cpu/intr_control.cc
index 071b9d5..9274b37 100644
--- a/src/cpu/intr_control.cc
+++ b/src/cpu/intr_control.cc
@@ -47,18 +47,32 @@
 IntrControl::post(int cpu_id, int int_num, int index)
 {
     DPRINTF(IntrControl, "post  %d:%d (cpu %d)\n", int_num, index, cpu_id);
-    std::vector<ThreadContext *> &tcvec = sys->threadContexts;
-    BaseCPU *cpu = tcvec[cpu_id]->getCpuPtr();
-    cpu->postInterrupt(tcvec[cpu_id]->threadId(), int_num, index);
+    ThreadContext *tc = sys->getThreadContext(cpu_id);
+    tc->getCpuPtr()->postInterrupt(tc->threadId(), int_num, index);
 }

 void
 IntrControl::clear(int cpu_id, int int_num, int index)
 {
     DPRINTF(IntrControl, "clear %d:%d (cpu %d)\n", int_num, index, cpu_id);
-    std::vector<ThreadContext *> &tcvec = sys->threadContexts;
-    BaseCPU *cpu = tcvec[cpu_id]->getCpuPtr();
-    cpu->clearInterrupt(tcvec[cpu_id]->threadId(), int_num, index);
+    ThreadContext *tc = sys->getThreadContext(cpu_id);
+    tc->getCpuPtr()->clearInterrupt(tc->threadId(), int_num, index);
+}
+
+void
+IntrControl::clearAll(int cpu_id)
+{
+ DPRINTF(IntrControl, "Clear all pending interrupts for CPU %d\n", cpu_id);
+    ThreadContext *tc = sys->getThreadContext(cpu_id);
+    tc->getCpuPtr()->clearInterrupts(tc->threadId());
+}
+
+bool
+IntrControl::havePosted(int cpu_id) const
+{
+    DPRINTF(IntrControl, "Check pending interrupts for CPU %d\n", cpu_id);
+    ThreadContext *tc = sys->getThreadContext(cpu_id);
+    return tc->getCpuPtr()->checkInterrupts(tc);
 }

 IntrControl *
diff --git a/src/cpu/intr_control.hh b/src/cpu/intr_control.hh
index b7ff2a8..a6f025e 100644
--- a/src/cpu/intr_control.hh
+++ b/src/cpu/intr_control.hh
@@ -45,6 +45,8 @@

     void clear(int cpu_id, int int_num, int index);
     void post(int cpu_id, int int_num, int index);
+    void clearAll(int cpu_id);
+    bool havePosted(int cpu_id) const;

     void
     clear(int int_num, int index = 0)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/26809
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I06b553872ed469e7449b872a0716865773ace154
Gerrit-Change-Number: 26809
Gerrit-PatchSet: 2
Gerrit-Owner: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to