[gem5-dev] [S] Change in gem5/gem5[develop]: dev-amdgpu: Fix SDMA trap ring ID, context

2022-11-01 Thread Matthew Poremba (Gerrit) via gem5-dev
Matthew Poremba has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/65093?usp=email )


Change subject: dev-amdgpu: Fix SDMA trap ring ID, context
..

dev-amdgpu: Fix SDMA trap ring ID, context

SDMA traps are used in the driver as a DMA fence. To pass a fence, the
SDMA sends the driver the interrupt context from a trap packet and the
ring ID which specifies which queue in the SDMA engine is passing a
fence. Currently the interrupt context is using the wrong value in the
packet and the ring ID is hard-coded to always be the gfx queue.

This changeset uses the correct interrupt context from the SDMA packet
and sets the ring ID to either 0 if the gfx queue is currently being
processed or 3 if the page queue is being processed.

The relevant interrupt service routine in the driver can be found at:
https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver/blob/roc-4.3.x/
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c#L2129

Change-Id: Ie4a4a9d6ab1d3bf83bf76bb57a02a91100217b51
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65093
Reviewed-by: Matt Sinclair 
Maintainer: Matt Sinclair 
Tested-by: kokoro 
---
M src/dev/amdgpu/sdma_engine.cc
1 file changed, 36 insertions(+), 4 deletions(-)

Approvals:
  Matt Sinclair: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/dev/amdgpu/sdma_engine.cc b/src/dev/amdgpu/sdma_engine.cc
index 1cd6ff2..e9a4c17 100644
--- a/src/dev/amdgpu/sdma_engine.cc
+++ b/src/dev/amdgpu/sdma_engine.cc
@@ -713,11 +713,16 @@
 {
 q->incRptr(sizeof(sdmaTrap));

-DPRINTF(SDMAEngine, "Trap contextId: %p rbRptr: %p ibOffset: %p\n",
-pkt->contextId, pkt->rbRptr, pkt->ibOffset);
+DPRINTF(SDMAEngine, "Trap contextId: %p\n", pkt->intrContext);

-gpuDevice->getIH()->prepareInterruptCookie(pkt->contextId, 0,
-getIHClientId(), TRAP_ID);
+uint32_t ring_id = 0;
+assert(page.processing() ^ gfx.processing());
+if (page.processing()) {
+ring_id = 3;
+}
+
+gpuDevice->getIH()->prepareInterruptCookie(pkt->intrContext, ring_id,
+   getIHClientId(), TRAP_ID);
 gpuDevice->getIH()->submitInterruptCookie();

 delete pkt;

--
To view, visit  
https://gem5-review.googlesource.com/c/public/gem5/+/65093?usp=email
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ie4a4a9d6ab1d3bf83bf76bb57a02a91100217b51
Gerrit-Change-Number: 65093
Gerrit-PatchSet: 2
Gerrit-Owner: Matthew Poremba 
Gerrit-Reviewer: Alexandru Duțu (Alex) 
Gerrit-Reviewer: Matt Sinclair 
Gerrit-Reviewer: Matthew Poremba 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org


[gem5-dev] [S] Change in gem5/gem5[develop]: dev-amdgpu: Fix SDMA trap ring ID, context

2022-10-30 Thread Matthew Poremba (Gerrit) via gem5-dev
Matthew Poremba has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/65093?usp=email )



Change subject: dev-amdgpu: Fix SDMA trap ring ID, context
..

dev-amdgpu: Fix SDMA trap ring ID, context

SDMA traps are used in the driver as a DMA fence. To pass a fence, the
SDMA sends the driver the interrupt context from a trap packet and the
ring ID which specifies which queue in the SDMA engine is passing a
fence. Currently the interrupt context is using the wrong value in the
packet and the ring ID is hard-coded to always be the gfx queue.

This changeset uses the correct interrupt context from the SDMA packet
and sets the ring ID to either 0 if the gfx queue is currently being
processed or 3 if the page queue is being processed.

The relevant interrupt service routine in the driver can be found at:
https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver/blob/roc-4.3.x/
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c#L2129

Change-Id: Ie4a4a9d6ab1d3bf83bf76bb57a02a91100217b51
---
M src/dev/amdgpu/sdma_engine.cc
1 file changed, 32 insertions(+), 4 deletions(-)



diff --git a/src/dev/amdgpu/sdma_engine.cc b/src/dev/amdgpu/sdma_engine.cc
index cafef6c..729ba9d 100644
--- a/src/dev/amdgpu/sdma_engine.cc
+++ b/src/dev/amdgpu/sdma_engine.cc
@@ -684,11 +684,16 @@
 {
 q->incRptr(sizeof(sdmaTrap));

-DPRINTF(SDMAEngine, "Trap contextId: %p rbRptr: %p ibOffset: %p\n",
-pkt->contextId, pkt->rbRptr, pkt->ibOffset);
+DPRINTF(SDMAEngine, "Trap contextId: %p\n", pkt->intrContext);

-gpuDevice->getIH()->prepareInterruptCookie(pkt->contextId, 0,
-getIHClientId(), TRAP_ID);
+uint32_t ring_id = 0;
+assert(page.processing() ^ gfx.processing());
+if (page.processing()) {
+ring_id = 3;
+}
+
+gpuDevice->getIH()->prepareInterruptCookie(pkt->intrContext, ring_id,
+   getIHClientId(), TRAP_ID);
 gpuDevice->getIH()->submitInterruptCookie();

 delete pkt;

--
To view, visit  
https://gem5-review.googlesource.com/c/public/gem5/+/65093?usp=email
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ie4a4a9d6ab1d3bf83bf76bb57a02a91100217b51
Gerrit-Change-Number: 65093
Gerrit-PatchSet: 1
Gerrit-Owner: Matthew Poremba 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org