Nikos Nikoleris has submitted this change and it was merged. (
https://gem5-review.googlesource.com/7 )
Change subject: mem: Use address range to find the destination port in the
xbar
..
mem: Use address range to find the destination port in the xbar
Previously the xbar used the start address to lookup the port map and
determine the right destination of an incoming packet. This change
uses the full address range to correctly determine the right master.
Change-Id: I5118712c43ae65aba64e71bf030bca5c99770bdd
Reviewed-on: https://gem5-review.googlesource.com/7
Reviewed-by: Jason Lowe-Power
Maintainer: Nikos Nikoleris
---
M src/mem/coherent_xbar.cc
M src/mem/noncoherent_xbar.cc
M src/mem/xbar.cc
M src/mem/xbar.hh
4 files changed, 31 insertions(+), 23 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved
Nikos Nikoleris: Looks good to me, approved
diff --git a/src/mem/coherent_xbar.cc b/src/mem/coherent_xbar.cc
index 872ee5c..d46f389 100644
--- a/src/mem/coherent_xbar.cc
+++ b/src/mem/coherent_xbar.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2017 ARM Limited
+ * Copyright (c) 2011-2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -151,8 +151,9 @@
// and the cache responding flag should always be the same
assert(is_express_snoop == cache_responding);
-// determine the destination based on the address
-PortID master_port_id = findPort(pkt->getAddr());
+// determine the destination based on the destination address range
+AddrRange addr_range = RangeSize(pkt->getAddr(), pkt->getSize());
+PortID master_port_id = findPort(addr_range);
// test if the crossbar should be considered occupied for the current
// port, and exclude express snoops from the check
@@ -551,7 +552,9 @@
// device responsible for the address range something is
// wrong, hence there is nothing further to do as the packet
// would be going back to where it came from
-assert(master_port_id == findPort(pkt->getAddr()));
+AddrRange addr_range M5_VAR_USED =
+RangeSize(pkt->getAddr(), pkt->getSize());
+assert(findPort(addr_range) == master_port_id);
}
bool
@@ -781,7 +784,8 @@
// even if we had a snoop response, we must continue and also
// perform the actual request at the destination
-PortID master_port_id = findPort(pkt->getAddr());
+AddrRange addr_range = RangeSize(pkt->getAddr(), pkt->getSize());
+PortID master_port_id = findPort(addr_range);
if (sink_packet) {
DPRINTF(CoherentXBar, "%s: Not forwarding %s\n", __func__,
@@ -1005,7 +1009,7 @@
}
}
-PortID dest_id = findPort(pkt->getAddr());
+PortID dest_id = findPort(RangeSize(pkt->getAddr(),
pkt->getSize()));
masterPorts[dest_id]->sendFunctional(pkt);
}
diff --git a/src/mem/noncoherent_xbar.cc b/src/mem/noncoherent_xbar.cc
index 3ff991f..7bd04cb 100644
--- a/src/mem/noncoherent_xbar.cc
+++ b/src/mem/noncoherent_xbar.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 ARM Limited
+ * Copyright (c) 2011-2015, 2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -108,7 +108,8 @@
assert(!pkt->isExpressSnoop());
// determine the destination based on the address
-PortID master_port_id = findPort(pkt->getAddr());
+AddrRange addr_range = RangeSize(pkt->getAddr(), pkt->getSize());
+PortID master_port_id = findPort(addr_range);
// test if the layer should be considered occupied for the current
// port
@@ -253,7 +254,8 @@
unsigned int pkt_cmd = pkt->cmdToIndex();
// determine the destination port
-PortID master_port_id = findPort(pkt->getAddr());
+AddrRange addr_range = RangeSize(pkt->getAddr(), pkt->getSize());
+PortID master_port_id = findPort(addr_range);
// stats updates for the request
pktCount[slave_port_id][master_port_id]++;
@@ -303,7 +305,8 @@
}
// determine the destination port
-PortID dest_id = findPort(pkt->getAddr());
+AddrRange addr_range = RangeSize(pkt->getAddr(), pkt->getSize());
+PortID dest_id = findPort(addr_range);
// forward the request to the appropriate destination
masterPorts[dest_id]->sendFunctional(pkt);
diff --git a/src/mem/xbar.cc b/src/mem/xbar.cc
index c3a5c83..b139cdc 100644
--- a/src/mem/xbar.cc
+++ b/src/mem/xbar.cc
@@ -321,34 +321,34 @@
}
PortID
-BaseXBar::findPort(Addr addr)
+BaseXBar::findPort(AddrRange addr_range)
{
// we should never see any address lookups before we've got the
// ranges of all connected slave modules
assert(gotAllAddrRanges);
// Check the address map interval tree
-auto i = portMap.contains(addr);
+auto i = portMap.contains(addr_range);
if (i != portMap.end()) {
return i->second;
}