dev-amdgpu: Handle framebuffer counter accesses

There are special counters in the framebuffer that are tested during
driver initialization. The expected behavior of the counters is to
return the previously read value + 1. There is one (known) counter used
in driver initialization at a fixed BAR address offset.

Change-Id: Id2dbb5fa9365b0a0453b15013c45aa67a2eec190
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46163
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
This commit is contained in:
Matthew Poremba
2021-05-28 18:58:11 -05:00
parent f46c9ddbfb
commit 3adefc2dd9

View File

@@ -148,7 +148,20 @@ void
AMDGPUDevice::readFrame(PacketPtr pkt, Addr offset)
{
DPRINTF(AMDGPUDevice, "Read framebuffer address %#lx\n", offset);
mmioReader.readFromTrace(pkt, FRAMEBUFFER_BAR, offset);
/* Handle special counter addresses in framebuffer. */
if (offset == 0xa28000) {
/* Counter addresses expect the read to return previous value + 1. */
if (regs.find(pkt->getAddr()) == regs.end()) {
regs[pkt->getAddr()] = 1;
} else {
regs[pkt->getAddr()]++;
}
pkt->setUintX(regs[pkt->getAddr()], ByteOrder::little);
}
}
void