dev-amdgpu: Implement SDMA RLC queue unmapping

The unmap queues packet specifies all non-static queues should be
unmapped which includes RLC queues in the SMDA. This functionality did
not exist before and is added in this changeset.

Fixes bug with rodinia_3.0/hip/bfs.

Change-Id: I80ca8cf8d89559625b5870745889b0a27916635e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63173
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
diff --git a/src/dev/amdgpu/amdgpu_device.cc b/src/dev/amdgpu/amdgpu_device.cc
index 9ed8911..09e46a5 100644
--- a/src/dev/amdgpu/amdgpu_device.cc
+++ b/src/dev/amdgpu/amdgpu_device.cc
@@ -643,6 +643,9 @@
 {
     idMap.erase(idMap.begin(), idMap.end());
     usedVMIDs.erase(usedVMIDs.begin(), usedVMIDs.end());
+
+    sdma0->deallocateRLCQueues();
+    sdma1->deallocateRLCQueues();
 }
 
 void
diff --git a/src/dev/amdgpu/sdma_engine.cc b/src/dev/amdgpu/sdma_engine.cc
index 27c9389..ae65e9a 100644
--- a/src/dev/amdgpu/sdma_engine.cc
+++ b/src/dev/amdgpu/sdma_engine.cc
@@ -202,6 +202,14 @@
     }
 }
 
+void
+SDMAEngine::deallocateRLCQueues()
+{
+    for (auto doorbell: rlcInfo) {
+        unregisterRLCQueue(doorbell);
+    }
+}
+
 /* Start decoding packets from the Gfx queue. */
 void
 SDMAEngine::processGfx(Addr wptrOffset)
diff --git a/src/dev/amdgpu/sdma_engine.hh b/src/dev/amdgpu/sdma_engine.hh
index 064afb1..3b150b3 100644
--- a/src/dev/amdgpu/sdma_engine.hh
+++ b/src/dev/amdgpu/sdma_engine.hh
@@ -266,6 +266,7 @@
      */
     void registerRLCQueue(Addr doorbell, Addr rb_base);
     void unregisterRLCQueue(Addr doorbell);
+    void deallocateRLCQueues();
 
     int cur_vmid = 0;
 };