mem-cache: Use secure bit in findVictim
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Sat, 2 Jun 2018 13:04:49 +0000 (15:04 +0200)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Fri, 8 Jun 2018 09:37:23 +0000 (09:37 +0000)
Sector caches must know if there was a sector hit in order
to decide whether a victim's sector must be fully evicted
to give place to a new sector or not.

In order to do so it needs the tag and secure information.

Change-Id: Ib554169e25fa131d6bf986561f7970b787c56874
Reviewed-on: https://gem5-review.googlesource.com/10722
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

src/mem/cache/base.cc
src/mem/cache/tags/base.hh
src/mem/cache/tags/base_set_assoc.hh
src/mem/cache/tags/fa_lru.cc
src/mem/cache/tags/fa_lru.hh

index 75b17699a1ed4de8d130b689b6cd91c18b299bf7..fdfe37ef4e761c1fe5011f3b2eea78b6278b8e99 100644 (file)
@@ -1210,7 +1210,7 @@ BaseCache::allocateBlock(Addr addr, bool is_secure, PacketList &writebacks)
 {
     // Find replacement victim
     std::vector<CacheBlk*> evict_blks;
-    CacheBlk *victim = tags->findVictim(addr, evict_blks);
+    CacheBlk *victim = tags->findVictim(addr, is_secure, evict_blks);
 
     // It is valid to return nullptr if there is no victim
     if (!victim)
index 0cc79020dc9f466dd26ff7c54cb7f6dcfd7233f8..7ed90fbd9562488c382d63319b782b8b32231654 100644 (file)
@@ -270,11 +270,12 @@ class BaseTags : public ClockedObject
      * @sa insertBlock
      *
      * @param addr Address to find a victim for.
+     * @param is_secure True if the target memory space is secure.
      * @param evict_blks Cache blocks to be evicted.
      * @return Cache block to be replaced.
      */
-    virtual CacheBlk* findVictim(Addr addr, std::vector<CacheBlk*>& evict_blks)
-                                                                     const = 0;
+    virtual CacheBlk* findVictim(Addr addr, const bool is_secure,
+                                 std::vector<CacheBlk*>& evict_blks) const = 0;
 
     virtual CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat) = 0;
 
index b41c3096c782ba35706e5945dab547cfb103dd5c..12b2efb2f840dea261b1a9921813faa3a9008963 100644 (file)
@@ -204,11 +204,12 @@ class BaseSetAssoc : public BaseTags
      * only contains the victim.
      *
      * @param addr Address to find a victim for.
+     * @param is_secure True if the target memory space is secure.
      * @param evict_blks Cache blocks to be evicted.
      * @return Cache block to be replaced.
      */
-    CacheBlk* findVictim(Addr addr, std::vector<CacheBlk*>& evict_blks) const
-                                                                     override
+    CacheBlk* findVictim(Addr addr, const bool is_secure,
+                         std::vector<CacheBlk*>& evict_blks) const override
     {
         // Get possible locations for the victim block
         std::vector<CacheBlk*> locations = getPossibleLocations(addr);
index b5950f6cff48f0a1efb3d1cf8c2eca33df3680ee..3a60e99f921843c9605942d46b0ae598f420dfa6 100644 (file)
@@ -195,7 +195,8 @@ FALRU::findBlockBySetAndWay(int set, int way) const
 }
 
 CacheBlk*
-FALRU::findVictim(Addr addr, std::vector<CacheBlk*>& evict_blks) const
+FALRU::findVictim(Addr addr, const bool is_secure,
+                  std::vector<CacheBlk*>& evict_blks) const
 {
     // The victim is always stored on the tail for the FALRU
     FALRUBlk* victim = tail;
index b134417b56b3cd12efe32cc3ffb2940cf4c19b1b..7aec36a61478e9adae9b9bd60d6492e80fd6939a 100644 (file)
@@ -199,11 +199,12 @@ class FALRU : public BaseTags
      * only contains the victim.
      *
      * @param addr Address to find a victim for.
+     * @param is_secure True if the target memory space is secure.
      * @param evict_blks Cache blocks to be evicted.
      * @return Cache block to be replaced.
      */
-    CacheBlk* findVictim(Addr addr, std::vector<CacheBlk*>& evict_blks) const
-                                                                    override;
+    CacheBlk* findVictim(Addr addr, const bool is_secure,
+                         std::vector<CacheBlk*>& evict_blks) const override;
 
     /**
      * Insert the new block into the cache and update replacement data.