Matthew Poremba has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/70037?usp=email )
Change subject: dev-amdgpu: Add writeROM method
......................................................................
dev-amdgpu: Add writeROM method
For non-KVM CPUs the VBIOS memory falls into an I/O hole and therefore
gets routed to the PIO bus in gem5. This gets routed to the GPU in the
case of a ROM write. We write to the ROM as a way to "load" the VBIOS
without creating holes in the KVM VM.
This write method allows the same scripts as KVM to be used by writing
to the ROM area and overwriting what might already be there from the
--gpu-rom option.
Change-Id: I8c2d2aa05a823569a774dfdd3bf2d2e773f38683
---
M src/dev/amdgpu/amdgpu_device.cc
M src/dev/amdgpu/amdgpu_device.hh
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/dev/amdgpu/amdgpu_device.cc
b/src/dev/amdgpu/amdgpu_device.cc
index cb180b6..3605882 100644
--- a/src/dev/amdgpu/amdgpu_device.cc
+++ b/src/dev/amdgpu/amdgpu_device.cc
@@ -107,6 +107,20 @@
pkt->getAddr(), rom_offset, rom_data);
}
+void
+AMDGPUDevice::writeROM(PacketPtr pkt)
+{
+ assert(isROM(pkt->getAddr()));
+
+ Addr rom_offset = pkt->getAddr() - romRange.start();
+ uint64_t rom_data = pkt->getUintX(ByteOrder::little);
+
+ memcpy(rom.data() + rom_offset, &rom_data, pkt->getSize());
+
+ DPRINTF(AMDGPUDevice, "Write to addr %#x on ROM offset %#x
data: %#x\n",
+ pkt->getAddr(), rom_offset, rom_data);
+}
+
AddrRangeList
AMDGPUDevice::getAddrRanges() const
{
@@ -386,6 +400,14 @@
Tick
AMDGPUDevice::write(PacketPtr pkt)
{
+ if (isROM(pkt->getAddr())) {
+ writeROM(pkt);
+
+ dispatchAccess(pkt, false);
+
+ return pioDelay;
+ }
+
int barnum = -1;
Addr offset = 0;
getBAR(pkt->getAddr(), barnum, offset);
diff --git a/src/dev/amdgpu/amdgpu_device.hh
b/src/dev/amdgpu/amdgpu_device.hh
index ac31b95..b64067a 100644
--- a/src/dev/amdgpu/amdgpu_device.hh
+++ b/src/dev/amdgpu/amdgpu_device.hh
@@ -94,6 +94,7 @@
AddrRange romRange;
bool isROM(Addr addr) const { return romRange.contains(addr); }
void readROM(PacketPtr pkt);
+ void writeROM(PacketPtr pkt);
std::array<uint8_t, ROM_SIZE> rom;
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/70037?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-MessageType: newchange
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8c2d2aa05a823569a774dfdd3bf2d2e773f38683
Gerrit-Change-Number: 70037
Gerrit-PatchSet: 1
Gerrit-Owner: Matthew Poremba <matthew.pore...@amd.com>
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org