} else {
// let our snoop responses go first if there are responses to
// the same addresses
- if (checkConflictingSnoop(entry->blkAddr)) {
+ if (checkConflictingSnoop(entry->getTarget()->pkt)) {
return;
}
waitingOnRetry = entry->sendPacket(cache);
* send out, and if so simply stall any requests, and schedule
* a send event at the same time as the next snoop response is
* being sent out.
+ *
+ * @param pkt The packet to check for conflicts against.
*/
- bool checkConflictingSnoop(Addr addr)
+ bool checkConflictingSnoop(const PacketPtr pkt)
{
- if (snoopRespQueue.hasAddr(addr)) {
+ if (snoopRespQueue.checkConflict(pkt, cache.blkSize)) {
DPRINTF(CachePort, "Waiting for snoop response to be "
"sent\n");
Tick when = snoopRespQueue.deferredPacketReadyTime();
pkt->req->masterId());
pf = new Packet(req, pkt->cmd);
pf->allocate();
- assert(pf->getAddr() == pkt->getAddr());
+ assert(pf->matchAddr(pkt));
assert(pf->getSize() == pkt->getSize());
}
pkt->payloadDelay;
if (pkt->isRead() && !is_error) {
// sanity check
- assert(pkt->getAddr() == tgt_pkt->getAddr());
+ assert(pkt->matchAddr(tgt_pkt));
assert(pkt->getSize() >= tgt_pkt->getSize());
tgt_pkt->setData(pkt->getConstPtr<uint8_t>());
return str.str();
}
+bool
+Packet::matchBlockAddr(const Addr addr, const bool is_secure,
+ const int blk_size) const
+{
+ return (getBlockAddr(blk_size) == addr) && (isSecure() == is_secure);
+}
+
+bool
+Packet::matchBlockAddr(const PacketPtr pkt, const int blk_size) const
+{
+ return matchBlockAddr(pkt->getBlockAddr(blk_size), pkt->isSecure(),
+ blk_size);
+}
+
+bool
+Packet::matchAddr(const Addr addr, const bool is_secure) const
+{
+ return (getAddr() == addr) && (isSecure() == is_secure);
+}
+
+bool
+Packet::matchAddr(const PacketPtr pkt) const
+{
+ return matchAddr(pkt->getAddr(), pkt->isSecure());
+}
+
Packet::PrintReqState::PrintReqState(std::ostream &_os, int _verbosity)
: curPrefixPtr(new std::string("")), os(_os), verbosity(_verbosity)
{
flags.set(VALID_SIZE);
}
+ /**
+ * Check if packet corresponds to a given block-aligned address and
+ * address space.
+ *
+ * @param addr The address to compare against.
+ * @param is_secure Whether addr belongs to the secure address space.
+ * @param blk_size Block size in bytes.
+ * @return Whether packet matches description.
+ */
+ bool matchBlockAddr(const Addr addr, const bool is_secure,
+ const int blk_size) const;
+
+ /**
+ * Check if this packet refers to the same block-aligned address and
+ * address space as another packet.
+ *
+ * @param pkt The packet to compare against.
+ * @param blk_size Block size in bytes.
+ * @return Whether packet matches description.
+ */
+ bool matchBlockAddr(const PacketPtr pkt, const int blk_size) const;
+
+ /**
+ * Check if packet corresponds to a given address and address space.
+ *
+ * @param addr The address to compare against.
+ * @param is_secure Whether addr belongs to the secure address space.
+ * @return Whether packet matches description.
+ */
+ bool matchAddr(const Addr addr, const bool is_secure) const;
+
+ /**
+ * Check if this packet refers to the same address and address space as
+ * another packet.
+ *
+ * @param pkt The packet to compare against.
+ * @return Whether packet matches description.
+ */
+ bool matchAddr(const PacketPtr pkt) const;
public:
/**
}
bool
-PacketQueue::hasAddr(Addr addr) const
+PacketQueue::checkConflict(const PacketPtr pkt, const int blk_size) const
{
// caller is responsible for ensuring that all packets have the
// same alignment
for (const auto& p : transmitList) {
- if (p.pkt->getAddr() == addr)
+ if (p.pkt->matchBlockAddr(pkt, blk_size))
return true;
}
return false;
auto it = transmitList.end();
while (it != transmitList.begin()) {
--it;
- if ((forceOrder && it->pkt->getAddr() == pkt->getAddr()) ||
- it->tick <= when) {
+ if ((forceOrder && it->pkt->matchAddr(pkt)) || it->tick <= when) {
// emplace inserts the element before the position pointed to by
// the iterator, so advance it one step
transmitList.emplace(++it, when, pkt);
{ return transmitList.empty() ? MaxTick : transmitList.front().tick; }
/**
- * Check if a packets address exists in the queue.
+ * Check if a packet corresponding to the same address exists in the
+ * queue.
+ *
+ * @param pkt The packet to compare against.
+ * @param blk_size Block size in bytes.
+ * @return Whether a corresponding packet is found.
*/
- bool hasAddr(Addr addr) const;
+ bool checkConflict(const PacketPtr pkt, const int blk_size) const;
/** Check the list of buffered packets against the supplied
* functional request. */
auto i = packetQueue.end();
--i;
while (i != packetQueue.begin() && when_to_send < i->tick &&
- i->pkt->getAddr() != pkt->getAddr())
+ !i->pkt->matchAddr(pkt))
--i;
// emplace inserts the element before the position pointed to by