dev-arm: Implement invalidateASID in SMMUv3 WalkCache
authorJan-Peter Larsson <jan-peter.larsson@arm.com>
Thu, 15 Aug 2019 11:49:16 +0000 (12:49 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 5 Sep 2019 16:37:18 +0000 (16:37 +0000)
This patch fixes a bug where issuing a invalidate-by-ASID command
(CMD_TLBI_NH_ASID) to the SMMU would cause Gem5 to crash.

Change-Id: I5b8343a17e43762fe3917560ae401a20be1e05b8
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20259
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_caches.cc

index d92c54480dee252e4277b97064299ea88309a1dc..f6384b4662e8cec884b4f4df3091c0dc7ec114d4 100644 (file)
@@ -1122,7 +1122,16 @@ WalkCache::invalidateVAA(Addr va, uint16_t vmid, const bool leaf_only)
 void
 WalkCache::invalidateASID(uint16_t asid, uint16_t vmid)
 {
-    panic("%s unimplemented\n", __func__);
+    for (size_t s = 0; s < sets.size(); s++) {
+        Set &set = sets[s];
+
+        for (size_t i = 0; i < set.size(); i++) {
+            Entry &e = set[i];
+
+            if (e.asid==asid && e.vmid==vmid)
+                e.valid = false;
+        }
+    }
 }
 
 void