mem-cache: Use PacketPtr in tags's accessBlock

Pass the packet to the tags, so that the replacement policies
more execution information.

Change-Id: I201884a6d60e3299fc3c9befebbb2e8b64a007f0
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38116
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
This commit is contained in:
Daniel R. Carvalho
2019-05-30 22:18:04 +02:00
committed by Daniel Carvalho
parent 2911839c22
commit ef99dc8310
7 changed files with 18 additions and 21 deletions

View File

@@ -1141,7 +1141,7 @@ BaseCache::access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat,
// Access block in the tags
Cycles tag_latency(0);
blk = tags->accessBlock(pkt->getAddr(), pkt->isSecure(), tag_latency);
blk = tags->accessBlock(pkt, tag_latency);
DPRINTF(Cache, "%s for %s %s\n", __func__, pkt->print(),
blk ? "hit " + blk->print() : "miss");

View File

@@ -285,12 +285,11 @@ class BaseTags : public ClockedObject
* should only be used as such. Returns the tag lookup latency as a side
* effect.
*
* @param addr The address to find.
* @param is_secure True if the target memory space is secure.
* @param pkt The packet holding the address to find.
* @param lat The latency of the tag lookup.
* @return Pointer to the cache block if found.
*/
virtual CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat) = 0;
virtual CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) = 0;
/**
* Generate the tag from the given address.

View File

@@ -117,14 +117,13 @@ class BaseSetAssoc : public BaseTags
* should only be used as such. Returns the tag lookup latency as a side
* effect.
*
* @param addr The address to find.
* @param is_secure True if the target memory space is secure.
* @param pkt The packet holding the address to find.
* @param lat The latency of the tag lookup.
* @return Pointer to the cache block if found.
*/
CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat) override
CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) override
{
CacheBlk *blk = findBlock(addr, is_secure);
CacheBlk *blk = findBlock(pkt->getAddr(), pkt->isSecure());
// Access all tags in parallel, hence one in each way. The data side
// either accesses all blocks in parallel, or one block sequentially on

View File

@@ -128,17 +128,18 @@ FALRU::invalidate(CacheBlk *blk)
}
CacheBlk*
FALRU::accessBlock(Addr addr, bool is_secure, Cycles &lat)
FALRU::accessBlock(const PacketPtr pkt, Cycles &lat)
{
return accessBlock(addr, is_secure, lat, 0);
return accessBlock(pkt, lat, 0);
}
CacheBlk*
FALRU::accessBlock(Addr addr, bool is_secure, Cycles &lat,
FALRU::accessBlock(const PacketPtr pkt, Cycles &lat,
CachesMask *in_caches_mask)
{
CachesMask mask = 0;
FALRUBlk* blk = static_cast<FALRUBlk*>(findBlock(addr, is_secure));
FALRUBlk* blk =
static_cast<FALRUBlk*>(findBlock(pkt->getAddr(), pkt->isSecure()));
// If a cache hit
if (blk && blk->isValid()) {

View File

@@ -173,19 +173,18 @@ class FALRU : public BaseTags
* cache access and should only be used as such.
* Returns tag lookup latency and the inCachesMask flags as a side effect.
*
* @param addr The address to look for.
* @param is_secure True if the target memory space is secure.
* @param pkt The packet holding the address to find.
* @param lat The latency of the tag lookup.
* @param in_cache_mask Mask indicating the caches in which the blk fits.
* @return Pointer to the cache block.
*/
CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat,
CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat,
CachesMask *in_cache_mask);
/**
* Just a wrapper of above function to conform with the base interface.
*/
CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat) override;
CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) override;
/**
* Find the block in the cache, do not update the replacement data.

View File

@@ -136,9 +136,9 @@ SectorTags::invalidate(CacheBlk *blk)
}
CacheBlk*
SectorTags::accessBlock(Addr addr, bool is_secure, Cycles &lat)
SectorTags::accessBlock(const PacketPtr pkt, Cycles &lat)
{
CacheBlk *blk = findBlock(addr, is_secure);
CacheBlk *blk = findBlock(pkt->getAddr(), pkt->isSecure());
// Access all tags in parallel, hence one in each way. The data side
// either accesses all blocks in parallel, or one block sequentially on

View File

@@ -136,12 +136,11 @@ class SectorTags : public BaseTags
* access and should only be used as such. Returns the tag lookup latency
* as a side effect.
*
* @param addr The address to find.
* @param is_secure True if the target memory space is secure.
* @param pkt The packet holding the address to find.
* @param lat The latency of the tag lookup.
* @return Pointer to the cache block if found.
*/
CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat) override;
CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) override;
/**
* Insert the new block into the cache and update replacement data.