dev-arm: drain implementation for SMMUv3

SMMUv3 is drained when (1) no SMMU translations are pending
on any of its slave interfaces and (2) no commands are stored
in the Command Queue waiting to be processed.

Change-Id: I81cef5fd821fa5e509e130af02aece5239493df5
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19309
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Adrian Herrera
2019-06-18 16:56:18 +01:00
committed by Giacomo Travaglini
parent 09bc8b6f11
commit f82f1dd81b
5 changed files with 33 additions and 1 deletions

View File

@@ -741,7 +741,11 @@ SMMUv3::regStats()
DrainState
SMMUv3::drain()
{
panic("SMMUv3 doesn't support draining\n");
// Wait until the Command Executor is not busy
if (commandExecutor.isBusy()) {
return DrainState::Draining;
}
return DrainState::Drained;
}
void

View File

@@ -75,6 +75,8 @@ SMMUCommandExecProcess::main(Yield &yield)
}
busy = false;
// No more commands to process, signal the SMMU as drained
smmu.signalDrainDone();
doSleep(yield);
}

View File

@@ -253,6 +253,16 @@ SMMUv3SlaveInterface::scheduleDeviceRetry()
}
}
DrainState
SMMUv3SlaveInterface::drain()
{
// Wait until all SMMU translations are completed
if (xlateSlotsRemaining < params()->xlate_slots) {
return DrainState::Draining;
}
return DrainState::Drained;
}
SMMUv3SlaveInterface*
SMMUv3SlaveInterfaceParams::create()
{

View File

@@ -56,6 +56,9 @@ class SMMUSlavePort;
class SMMUv3SlaveInterface : public MemObject
{
protected:
friend class SMMUTranslationProcess;
public:
SMMUv3 *smmu;
SMMUTLB* microTLB;
@@ -124,6 +127,14 @@ class SMMUv3SlaveInterface : public MemObject
delete mainTLB;
}
const SMMUv3SlaveInterfaceParams *
params() const
{
return static_cast<const SMMUv3SlaveInterfaceParams *>(_params);
}
DrainState drain() override;
void setSMMU(SMMUv3 *_smmu) { smmu = _smmu; }
void sendRange();
};

View File

@@ -94,6 +94,11 @@ SMMUTranslationProcess::~SMMUTranslationProcess()
{
// Increase number of pending translation slots on the slave interface
ifc.xlateSlotsRemaining++;
// If no more SMMU translations are pending (all slots available),
// signal SMMU Slave Interface as drained
if (ifc.xlateSlotsRemaining == ifc.params()->xlate_slots) {
ifc.signalDrainDone();
}
}
void