dev-arm: pending SMMU transl update on constructor/destructor
authorAdrian Herrera <adrian.herrera@arm.com>
Tue, 18 Jun 2019 11:22:15 +0000 (12:22 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 26 Jun 2019 11:58:55 +0000 (11:58 +0000)
Change-Id: I6f61651123aab129cfbe5a88aa6355cd21544a5e
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19308
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/dev/arm/smmu_v3_slaveifc.cc
src/dev/arm/smmu_v3_transl.cc
src/dev/arm/smmu_v3_transl.hh

index 72c319d078a15e1a9ec2ed12d58d4df8d5221ec4..48b11411590b7f6a6f93e8a3b7e7a0a913397d81 100644 (file)
@@ -157,7 +157,6 @@ SMMUv3SlaveInterface::recvTimingReq(PacketPtr pkt)
         return false;
     }
 
-    xlateSlotsRemaining--;
     if (pkt->isWrite())
         wrBufSlotsRemaining -= nbeats;
 
@@ -203,8 +202,6 @@ SMMUv3SlaveInterface::atsSlaveRecvTimingReq(PacketPtr pkt)
         return false;
     }
 
-    xlateSlotsRemaining--;
-
     std::string proc_name = csprintf("%s.atsport", name());
     const bool ats_request = true;
     SMMUTranslationProcess *proc =
index 4a3efc6d83ce3424460779953866dfbb033921b7..6e0dacb88a712e672816b9b47379302d2ad78aeb 100644 (file)
@@ -78,6 +78,24 @@ SMMUTranslRequest::prefetch(Addr addr, uint32_t sid, uint32_t ssid)
     return req;
 }
 
+SMMUTranslationProcess::SMMUTranslationProcess(const std::string &name,
+    SMMUv3 &_smmu, SMMUv3SlaveInterface &_ifc)
+  :
+    SMMUProcess(name, _smmu),
+    ifc(_ifc)
+{
+    // Decrease number of pending translation slots on the slave interface
+    assert(ifc.xlateSlotsRemaining > 0);
+    ifc.xlateSlotsRemaining--;
+    reinit();
+}
+
+SMMUTranslationProcess::~SMMUTranslationProcess()
+{
+    // Increase number of pending translation slots on the slave interface
+    ifc.xlateSlotsRemaining++;
+}
+
 void
 SMMUTranslationProcess::beginTransaction(const SMMUTranslRequest &req)
 {
@@ -1173,8 +1191,6 @@ SMMUTranslationProcess::issuePrefetch(Addr addr)
     if (!ifc.prefetchEnable || ifc.xlateSlotsRemaining == 0)
         return;
 
-    ifc.xlateSlotsRemaining--;
-
     std::string proc_name = csprintf("%sprf", name());
     SMMUTranslationProcess *proc =
         new SMMUTranslationProcess(proc_name, smmu, ifc);
@@ -1201,7 +1217,6 @@ SMMUTranslationProcess::completeTransaction(Yield &yield,
 
 
     smmu.translationTimeDist.sample(curTick() - recvTick);
-    ifc.xlateSlotsRemaining++;
     if (!request.isAtsRequest && request.isWrite)
         ifc.wrBufSlotsRemaining +=
             (request.size + (ifc.portWidth-1)) / ifc.portWidth;
@@ -1249,8 +1264,6 @@ SMMUTranslationProcess::completeTransaction(Yield &yield,
 void
 SMMUTranslationProcess::completePrefetch(Yield &yield)
 {
-    ifc.xlateSlotsRemaining++;
-
     SMMUAction a;
     a.type = ACTION_TERMINATE;
     a.pkt = NULL;
index ac0dc77778636aadcf76a1fb2e76ea59a40cb9e2..6a69460dea5e41af0a1bec9a9cb0a8cba98428be 100644 (file)
@@ -173,15 +173,9 @@ class SMMUTranslationProcess : public SMMUProcess
 
   public:
     SMMUTranslationProcess(const std::string &name, SMMUv3 &_smmu,
-        SMMUv3SlaveInterface &_ifc)
-      :
-        SMMUProcess(name, _smmu),
-        ifc(_ifc)
-    {
-        reinit();
-    }
+        SMMUv3SlaveInterface &_ifc);
 
-    virtual ~SMMUTranslationProcess() {}
+    virtual ~SMMUTranslationProcess();
 
     void beginTransaction(const SMMUTranslRequest &req);
     void resumeTransaction();