diff options
Diffstat (limited to 'src/mem/cache/prefetch/base.cc')
-rw-r--r-- | src/mem/cache/prefetch/base.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc index 53260ae0d..e58d4f3d5 100644 --- a/src/mem/cache/prefetch/base.cc +++ b/src/mem/cache/prefetch/base.cc @@ -56,6 +56,19 @@ #include "params/BasePrefetcher.hh" #include "sim/system.hh" +BasePrefetcher::PrefetchInfo::PrefetchInfo(PacketPtr pkt, Addr addr) + : address(addr), pc(pkt->req->hasPC() ? pkt->req->getPC() : 0), + masterId(pkt->req->masterId()), validPC(pkt->req->hasPC()), + secure(pkt->isSecure()) +{ +} + +BasePrefetcher::PrefetchInfo::PrefetchInfo(PrefetchInfo const &pfi, Addr addr) + : address(addr), pc(pfi.pc), masterId(pfi.masterId), validPC(pfi.validPC), + secure(pfi.secure) +{ +} + void BasePrefetcher::PrefetchListener::notify(const PacketPtr &pkt) { @@ -67,7 +80,8 @@ BasePrefetcher::BasePrefetcher(const BasePrefetcherParams *p) lBlkSize(floorLog2(blkSize)), onMiss(p->on_miss), onRead(p->on_read), onWrite(p->on_write), onData(p->on_data), onInst(p->on_inst), masterId(p->sys->getMasterId(this)), pageBytes(p->sys->getPageBytes()), - prefetchOnAccess(p->prefetch_on_access) + prefetchOnAccess(p->prefetch_on_access), + useVirtualAddresses(p->use_virtual_addresses) { } @@ -175,7 +189,17 @@ BasePrefetcher::probeNotify(const PacketPtr &pkt) if (pkt->cmd.isSWPrefetch()) return; if (pkt->req->isCacheMaintenance()) return; if (pkt->isWrite() && cache != nullptr && cache->coalesce()) return; - notify(pkt); + + // Verify this access type is observed by prefetcher + if (observeAccess(pkt)) { + if (useVirtualAddresses && pkt->req->hasVaddr()) { + PrefetchInfo pfi(pkt, pkt->req->getVaddr()); + notify(pkt, pfi); + } else if (!useVirtualAddresses && pkt->req->hasPaddr()) { + PrefetchInfo pfi(pkt, pkt->req->getPaddr()); + notify(pkt, pfi); + } + } } void |