gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: dev-amdgpu: Fix nbio psp ring assert

MP
Matthew Poremba (Gerrit)
Mon, May 22, 2023 3:08 PM

Matthew Poremba has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/70677?usp=email )

Change subject: dev-amdgpu: Fix nbio psp ring assert
......................................................................

dev-amdgpu: Fix nbio psp ring assert

The size of the packet changes between ROCm 4.x and ROCm 5.x. Change how
the address is set based on the incoming packet size so that both
versions continue to work for now.

Change-Id: I91694e4760198fd9129e60140df4e863666be2e2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70677
Tested-by: kokoro noreply+kokoro@google.com
Reviewed-by: Matt Sinclair mattdsinclair@gmail.com
Maintainer: Matt Sinclair mattdsinclair@gmail.com

M src/dev/amdgpu/amdgpu_nbio.cc
1 file changed, 17 insertions(+), 3 deletions(-)

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

diff --git a/src/dev/amdgpu/amdgpu_nbio.cc b/src/dev/amdgpu/amdgpu_nbio.cc
index 8064fd2..69e4373 100644
--- a/src/dev/amdgpu/amdgpu_nbio.cc
+++ b/src/dev/amdgpu/amdgpu_nbio.cc
@@ -162,9 +162,23 @@
AMDGPUNbio::writeFrame(PacketPtr pkt, Addr offset)
{
if (offset == psp_ring_listen_addr) {

  •    assert(pkt->getSize() == 8);
    
  •    psp_ring_dev_addr = pkt->getLE<uint64_t>()
    
  •                      - gpuDevice->getVM().getSysAddrRangeLow();
    
  •    DPRINTF(AMDGPUDevice, "Saw psp_ring_listen_addr with size %ld  
    

value "

  •            "%ld\n", pkt->getSize(), pkt->getUintX(ByteOrder::little));
    
  •    /*
    
  •     * In ROCm versions 4.x this packet is a 4 byte value. In ROCm 5.x
    
  •     * the packet is 8 bytes and mapped as a system address which needs
    
  •     * to be subtracted out to get the framebuffer address.
    
  •     */
    
  •    if (pkt->getSize() == 4) {
    
  •        psp_ring_dev_addr = pkt->getLE<uint32_t>();
    
  •    } else if (pkt->getSize() == 8) {
    
  •        psp_ring_dev_addr = pkt->getUintX(ByteOrder::little)
    
  •                          - gpuDevice->getVM().getSysAddrRangeLow();
    
  •    } else {
    
  •        panic("Invalid write size to psp_ring_listen_addr\n");
    
  •    }
    
  •     DPRINTF(AMDGPUDevice, "Setting PSP ring device address to %#lx\n",
                psp_ring_dev_addr);
    }
    

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

Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I91694e4760198fd9129e60140df4e863666be2e2
Gerrit-Change-Number: 70677
Gerrit-PatchSet: 3
Gerrit-Owner: Matthew Poremba matthew.poremba@amd.com
Gerrit-Reviewer: Matt Sinclair mattdsinclair@gmail.com
Gerrit-Reviewer: Matthew Poremba matthew.poremba@amd.com
Gerrit-Reviewer: VISHNU RAMADAS vramadas@wisc.edu
Gerrit-Reviewer: kokoro noreply+kokoro@google.com

Matthew Poremba has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/70677?usp=email ) Change subject: dev-amdgpu: Fix nbio psp ring assert ...................................................................... dev-amdgpu: Fix nbio psp ring assert The size of the packet changes between ROCm 4.x and ROCm 5.x. Change how the address is set based on the incoming packet size so that both versions continue to work for now. Change-Id: I91694e4760198fd9129e60140df4e863666be2e2 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70677 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com> Maintainer: Matt Sinclair <mattdsinclair@gmail.com> --- M src/dev/amdgpu/amdgpu_nbio.cc 1 file changed, 17 insertions(+), 3 deletions(-) Approvals: kokoro: Regressions pass Matt Sinclair: Looks good to me, approved; Looks good to me, approved diff --git a/src/dev/amdgpu/amdgpu_nbio.cc b/src/dev/amdgpu/amdgpu_nbio.cc index 8064fd2..69e4373 100644 --- a/src/dev/amdgpu/amdgpu_nbio.cc +++ b/src/dev/amdgpu/amdgpu_nbio.cc @@ -162,9 +162,23 @@ AMDGPUNbio::writeFrame(PacketPtr pkt, Addr offset) { if (offset == psp_ring_listen_addr) { - assert(pkt->getSize() == 8); - psp_ring_dev_addr = pkt->getLE<uint64_t>() - - gpuDevice->getVM().getSysAddrRangeLow(); + DPRINTF(AMDGPUDevice, "Saw psp_ring_listen_addr with size %ld value " + "%ld\n", pkt->getSize(), pkt->getUintX(ByteOrder::little)); + + /* + * In ROCm versions 4.x this packet is a 4 byte value. In ROCm 5.x + * the packet is 8 bytes and mapped as a system address which needs + * to be subtracted out to get the framebuffer address. + */ + if (pkt->getSize() == 4) { + psp_ring_dev_addr = pkt->getLE<uint32_t>(); + } else if (pkt->getSize() == 8) { + psp_ring_dev_addr = pkt->getUintX(ByteOrder::little) + - gpuDevice->getVM().getSysAddrRangeLow(); + } else { + panic("Invalid write size to psp_ring_listen_addr\n"); + } + DPRINTF(AMDGPUDevice, "Setting PSP ring device address to %#lx\n", psp_ring_dev_addr); } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/70677?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I91694e4760198fd9129e60140df4e863666be2e2 Gerrit-Change-Number: 70677 Gerrit-PatchSet: 3 Gerrit-Owner: Matthew Poremba <matthew.poremba@amd.com> Gerrit-Reviewer: Matt Sinclair <mattdsinclair@gmail.com> Gerrit-Reviewer: Matthew Poremba <matthew.poremba@amd.com> Gerrit-Reviewer: VISHNU RAMADAS <vramadas@wisc.edu> Gerrit-Reviewer: kokoro <noreply+kokoro@google.com>