Matthew Poremba has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/46381 )
Change subject: sim: Handle interleaved device memory
......................................................................
sim: Handle interleaved device memory
Device memories are used for PCI devices which have their own pools of
backing store memory such as amdgpu device. The check for an address
being in device memory previously did not handle multiple interleaved
memory devices with the same address range. Therefore, the device memory
check would fail if the interleaving masks did not match. This updates
the method to iterate through all device memories that handle the
RequestorID and returns true if any of the device memories contain the
packet address.
Change-Id: I9339d39c1cb54a5b9075c4a122c118fe61dc6fdb
---
M src/sim/system.cc
M src/sim/system.hh
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 90576eb..7860fa0 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -386,18 +386,28 @@
bool
System::isDeviceMemAddr(PacketPtr pkt) const
{
- const RequestorID& id = pkt->requestorId();
+ if (!deviceMemMap.count(pkt->requestorId())) {
+ return false;
+ }
- return (deviceMemMap.count(id) &&
- deviceMemMap.at(id)->getAddrRange().contains(pkt->getAddr()));
+ return (getDeviceMemory(pkt) != nullptr);
}
AbstractMemory *
-System::getDeviceMemory(RequestorID id) const
+System::getDeviceMemory(PacketPtr pkt) const
{
- panic_if(!deviceMemMap.count(id),
- "No device memory found for RequestorID %d\n", id);
- return deviceMemMap.at(id);
+ const RequestorID& rid = pkt->requestorId();
+
+ panic_if(!deviceMemMap.count(rid),
+ "No device memory found for MasterID %d\n", rid);
+
+ for (auto& mem : deviceMemMap.at(rid)) {
+ if (pkt->getAddrRange().isSubset(mem->getAddrRange())) {
+ return mem;
+ }
+ }
+
+ return nullptr;
}
void
diff --git a/src/sim/system.hh b/src/sim/system.hh
index b22d441..a5651bc 100644
--- a/src/sim/system.hh
+++ b/src/sim/system.hh
@@ -376,7 +376,7 @@
/**
* Return a pointer to the device memory.
*/
- AbstractMemory *getDeviceMemory(RequestorID _id) const;
+ AbstractMemory *getDeviceMemory(PacketPtr pkt) const;
/*
* Return the list of address ranges backed by a shadowed ROM.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/46381
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: I9339d39c1cb54a5b9075c4a122c118fe61dc6fdb
Gerrit-Change-Number: 46381
Gerrit-PatchSet: 1
Gerrit-Owner: Matthew Poremba <matthew.pore...@amd.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s