dev-arm: Improper translation slot release in SMMUv3
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 15 Aug 2019 08:54:52 +0000 (09:54 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 5 Sep 2019 16:37:18 +0000 (16:37 +0000)
commit4f728b7d6cde5ba07956c8699c6b6e9f68769ec5
treecd84d439f11a7d2c1dad210a8497e117cf2f9e12
parent94f9eebd1f2da64287a27e6a94efe88edebb383c
dev-arm: Improper translation slot release in SMMUv3

The SMMUv3SlaveInterface is using the xlateSlotsRemaining to model a
limit on the number of translation requests it can receive from the
master device.

Patch

https://gem5-review.googlesource.com/c/public/gem5/+/19308/2

moved the resource acquire/release inside the SMMUTranslationProcess
constructor/destructor, for the sake of having a unique place for
calling the signalDrainDone.
While this is convenient, it breaks the original implementation,
which was freeing resources AFTER a translation has completed, but
BEFORE the final memory access (with the translated PA) is performed.
In other words the xlateSlotsRemaining is only modelling translation
slots and should be release once the PA gets produced.

The patch fixes this mismatch by restoring the resource release in
the right place (while keeping the acquire in the constructor)
and by adding a pendingMemAccess counter, which is keeping track
of a complete device memory request (translation + final access)
and will be used by the draining logic

Change-Id: I708fe2d0b6c96ed46f3f4f9a0512f8c1cc43a56c
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Adrian Herrera <adrian.herrera@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20260
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_slaveifc.hh
src/dev/arm/smmu_v3_transl.cc