diff -r 7d5c6434fd41 -r d8dcd52d0eac src/mem/coherent_xbar.cc --- a/src/mem/coherent_xbar.cc Tue Jul 12 08:10:41 2016 +0100 +++ b/src/mem/coherent_xbar.cc Tue Jul 12 08:11:08 2016 +0100 @@ -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 @@ 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 @@ -661,7 +661,7 @@ // 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 -r 7d5c6434fd41 -r d8dcd52d0eac src/mem/snoop_filter.hh --- a/src/mem/snoop_filter.hh Tue Jul 12 08:10:41 2016 +0100 +++ b/src/mem/snoop_filter.hh Tue Jul 12 08:11:08 2016 +0100 @@ -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 @@ * @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 @@ /** 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; diff -r 7d5c6434fd41 -r d8dcd52d0eac src/mem/snoop_filter.cc --- a/src/mem/snoop_filter.cc Tue Jul 12 08:10:41 2016 +0100 +++ b/src/mem/snoop_filter.cc Tue Jul 12 08:11:08 2016 +0100 @@ -69,6 +69,9 @@ 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 @@ } 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 @@ 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 @@ } 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 @@ 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 @@ // 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;