diff --git a/src/mem/coherent_xbar.cc b/src/mem/coherent_xbar.cc index c0d8ab037..3e917dacc 100644 --- a/src/mem/coherent_xbar.cc +++ b/src/mem/coherent_xbar.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 ARM Limited + * Copyright (c) 2011-2016 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -266,7 +266,7 @@ CoherentXBar::recvTimingReq(PacketPtr pkt, PortID slave_port_id) if (snoopFilter && !system->bypassCaches()) { // Let the snoop filter know about the success of the send operation - snoopFilter->finishRequest(!success, addr); + snoopFilter->finishRequest(!success, addr, pkt->isSecure()); } // check if we were successful in sending the packet onwards @@ -666,7 +666,7 @@ CoherentXBar::recvAtomic(PacketPtr pkt, PortID slave_port_id) // operation, and do it even before sending it onwards to // avoid situations where atomic upward snoops sneak in // between and change the filter state - snoopFilter->finishRequest(false, pkt->getAddr()); + snoopFilter->finishRequest(false, pkt->getAddr(), pkt->isSecure()); snoop_result = forwardAtomic(pkt, slave_port_id, InvalidPortID, sf_res.first); diff --git a/src/mem/snoop_filter.cc b/src/mem/snoop_filter.cc index 14cdc7e07..ec96f6e8c 100755 --- a/src/mem/snoop_filter.cc +++ b/src/mem/snoop_filter.cc @@ -69,6 +69,9 @@ SnoopFilter::lookupRequest(const Packet* cpkt, const SlavePort& slave_port) bool allocate = !cpkt->req->isUncacheable() && slave_port.isSnooping() && cpkt->fromCache(); Addr line_addr = cpkt->getBlockAddr(linesize); + if (cpkt->isSecure()) { + line_addr |= LineSecure; + } SnoopMask req_port = portToMask(slave_port); reqLookupResult = cachedLocations.find(line_addr); bool is_hit = (reqLookupResult != cachedLocations.end()); @@ -146,12 +149,16 @@ SnoopFilter::lookupRequest(const Packet* cpkt, const SlavePort& slave_port) } void -SnoopFilter::finishRequest(bool will_retry, const Addr addr) +SnoopFilter::finishRequest(bool will_retry, Addr addr, bool is_secure) { if (reqLookupResult != cachedLocations.end()) { // since we rely on the caller, do a basic check to ensure // that finishRequest is being called following lookupRequest - assert(reqLookupResult->first == (addr & ~(Addr(linesize - 1)))); + Addr line_addr = (addr & ~(Addr(linesize - 1))); + if (is_secure) { + line_addr |= LineSecure; + } + assert(reqLookupResult->first == line_addr); if (will_retry) { // Undo any changes made in lookupRequest to the snoop filter // entry if the request will come again. retryItem holds @@ -175,6 +182,9 @@ SnoopFilter::lookupSnoop(const Packet* cpkt) assert(cpkt->isRequest()); Addr line_addr = cpkt->getBlockAddr(linesize); + if (cpkt->isSecure()) { + line_addr |= LineSecure; + } auto sf_it = cachedLocations.find(line_addr); bool is_hit = (sf_it != cachedLocations.end()); @@ -243,6 +253,9 @@ SnoopFilter::updateSnoopResponse(const Packet* cpkt, } Addr line_addr = cpkt->getBlockAddr(linesize); + if (cpkt->isSecure()) { + line_addr |= LineSecure; + } SnoopMask rsp_mask = portToMask(rsp_port); SnoopMask req_mask = portToMask(req_port); SnoopItem& sf_item = cachedLocations[line_addr]; @@ -289,6 +302,9 @@ SnoopFilter::updateSnoopForward(const Packet* cpkt, assert(cpkt->cacheResponding()); Addr line_addr = cpkt->getBlockAddr(linesize); + if (cpkt->isSecure()) { + line_addr |= LineSecure; + } auto sf_it = cachedLocations.find(line_addr); bool is_hit = sf_it != cachedLocations.end(); @@ -328,6 +344,9 @@ SnoopFilter::updateResponse(const Packet* cpkt, const SlavePort& slave_port) // next check if we actually allocated an entry Addr line_addr = cpkt->getBlockAddr(linesize); + if (cpkt->isSecure()) { + line_addr |= LineSecure; + } auto sf_it = cachedLocations.find(line_addr); if (sf_it == cachedLocations.end()) return; diff --git a/src/mem/snoop_filter.hh b/src/mem/snoop_filter.hh index 3851e5810..85cc75e9b 100755 --- a/src/mem/snoop_filter.hh +++ b/src/mem/snoop_filter.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015 ARM Limited + * Copyright (c) 2013-2016 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -143,7 +143,7 @@ class SnoopFilter : public SimObject { * @param will_retry This request will retry on this bus / snoop filter * @param addr Packet address, merely for sanity checking */ - void finishRequest(bool will_retry, const Addr addr); + void finishRequest(bool will_retry, Addr addr, bool is_secure); /** * Handle an incoming snoop from below (the master port). These @@ -282,6 +282,14 @@ class SnoopFilter : public SimObject { /** Max capacity in terms of cache blocks tracked, for sanity checking */ const unsigned maxEntryCount; + /** + * Use the lower bits of the address to keep track of the line status + */ + enum LineStatus { + /** block holds data from the secure memory space */ + LineSecure = 0x01, + }; + /** Statistics */ Stats::Scalar totRequests; Stats::Scalar hitSingleRequests;