fastmodel: Use getCurrentInstCount for totalInsts().

This had been using a custom totalInsts method on the iris
ThreadContext, but since that's equivalent to what the totalInsts
method does only through a different mechanism, we can
drop that and use getCurrentInstCount instead.

Change-Id: I058fec13e81f28285281e136635d53a2e849cb47
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22112
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/src/arch/arm/fastmodel/iris/arm/thread_context.cc b/src/arch/arm/fastmodel/iris/arm/thread_context.cc
index 270adca..b8e98ed 100644
--- a/src/arch/arm/fastmodel/iris/arm/thread_context.cc
+++ b/src/arch/arm/fastmodel/iris/arm/thread_context.cc
@@ -105,14 +105,6 @@
     return pcState().nextInstAddr();
 }
 
-Counter
-ArmThreadContext::totalInsts()
-{
-    iris::ResourceReadResult result;
-    call().resource_read(_instId, result, icountRscId);
-    return result.data.at(0);
-}
-
 uint64_t
 ArmThreadContext::readIntReg(RegIndex reg_idx) const
 {
diff --git a/src/arch/arm/fastmodel/iris/arm/thread_context.hh b/src/arch/arm/fastmodel/iris/arm/thread_context.hh
index c747eba..f5be14d 100644
--- a/src/arch/arm/fastmodel/iris/arm/thread_context.hh
+++ b/src/arch/arm/fastmodel/iris/arm/thread_context.hh
@@ -62,8 +62,6 @@
     ResourceIds intReg32Ids;
     ResourceIds intReg64Ids;
 
-    Counter totalInsts() override;
-
     void setIntReg(RegIndex reg_idx, RegVal val) override;
     RegVal readIntReg(RegIndex reg_idx) const override;
     TheISA::ISA *
diff --git a/src/arch/arm/fastmodel/iris/cpu.cc b/src/arch/arm/fastmodel/iris/cpu.cc
index 246fe0c..63cd731 100644
--- a/src/arch/arm/fastmodel/iris/cpu.cc
+++ b/src/arch/arm/fastmodel/iris/cpu.cc
@@ -82,10 +82,8 @@
 BaseCPU::totalInsts() const
 {
     Counter count = 0;
-    for (auto *tc: threadContexts) {
-        auto *itc = dynamic_cast<Iris::ThreadContext *>(tc);
-        count += itc->totalInsts();
-    }
+    for (auto *tc: threadContexts)
+        count += tc->getCurrentInstCount();
     return count;
 }
 
diff --git a/src/arch/arm/fastmodel/iris/thread_context.hh b/src/arch/arm/fastmodel/iris/thread_context.hh
index da96661..73470c5 100644
--- a/src/arch/arm/fastmodel/iris/thread_context.hh
+++ b/src/arch/arm/fastmodel/iris/thread_context.hh
@@ -102,12 +102,6 @@
     void descheduleInstCountEvent(Event *event) override {}
     Tick getCurrentInstCount() override;
 
-    virtual Counter
-    totalInsts()
-    {
-        panic("%s not implemented.", __FUNCTION__);
-    }
-
     ::BaseCPU *getCpuPtr() override { return _cpu; }
     int cpuId() const override { return _cpu->cpuId(); }
     uint32_t socketId() const override { return _cpu->socketId(); }