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>
This commit is contained in:
Matthew Poremba
2023-05-16 19:46:50 -05:00
parent 44919c1c4d
commit 08644a7670

View File

@@ -162,9 +162,23 @@ void
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);
}