From 09bc8b6f1177df5fe5de9d2984781cc1fb8b75b4 Mon Sep 17 00:00:00 2001 From: Adrian Herrera Date: Tue, 18 Jun 2019 12:22:15 +0100 Subject: [PATCH] dev-arm: pending SMMU transl update on constructor/destructor Change-Id: I6f61651123aab129cfbe5a88aa6355cd21544a5e Reviewed-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19308 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg Tested-by: kokoro --- src/dev/arm/smmu_v3_slaveifc.cc | 3 --- src/dev/arm/smmu_v3_transl.cc | 23 ++++++++++++++++++----- src/dev/arm/smmu_v3_transl.hh | 10 ++-------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/dev/arm/smmu_v3_slaveifc.cc b/src/dev/arm/smmu_v3_slaveifc.cc index 72c319d07..48b114115 100644 --- a/src/dev/arm/smmu_v3_slaveifc.cc +++ b/src/dev/arm/smmu_v3_slaveifc.cc @@ -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 = diff --git a/src/dev/arm/smmu_v3_transl.cc b/src/dev/arm/smmu_v3_transl.cc index 4a3efc6d8..6e0dacb88 100644 --- a/src/dev/arm/smmu_v3_transl.cc +++ b/src/dev/arm/smmu_v3_transl.cc @@ -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; diff --git a/src/dev/arm/smmu_v3_transl.hh b/src/dev/arm/smmu_v3_transl.hh index ac0dc7777..6a69460de 100644 --- a/src/dev/arm/smmu_v3_transl.hh +++ b/src/dev/arm/smmu_v3_transl.hh @@ -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(); -- 2.30.2