cache.cc (12425:7f8c9032b18c) cache.cc (12500:a91cf4e8b6a4)
1/*
1/*
2 * Copyright (c) 2010-2017 ARM Limited
2 * Copyright (c) 2010-2018 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 389 unchanged lines hidden (view full) ---

400 blk->status = (BlkValid | BlkReadable);
401 if (pkt->isSecure()) {
402 blk->status |= BlkSecure;
403 }
404 }
405 // only mark the block dirty if we got a writeback command,
406 // and leave it as is for a clean writeback
407 if (pkt->cmd == MemCmd::WritebackDirty) {
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 389 unchanged lines hidden (view full) ---

400 blk->status = (BlkValid | BlkReadable);
401 if (pkt->isSecure()) {
402 blk->status |= BlkSecure;
403 }
404 }
405 // only mark the block dirty if we got a writeback command,
406 // and leave it as is for a clean writeback
407 if (pkt->cmd == MemCmd::WritebackDirty) {
408 assert(!blk->isDirty());
408 blk->status |= BlkDirty;
409 }
410 // if the packet does not have sharers, it is passing
411 // writable, and we got the writeback in Modified or Exclusive
412 // state, if not we are in the Owned or Shared state
413 if (!pkt->hasSharers()) {
414 blk->status |= BlkWritable;
415 }

--- 46 unchanged lines hidden (view full) ---

462 }
463 }
464 }
465
466 // at this point either this is a writeback or a write-through
467 // write clean operation and the block is already in this
468 // cache, we need to update the data and the block flags
469 assert(blk);
409 blk->status |= BlkDirty;
410 }
411 // if the packet does not have sharers, it is passing
412 // writable, and we got the writeback in Modified or Exclusive
413 // state, if not we are in the Owned or Shared state
414 if (!pkt->hasSharers()) {
415 blk->status |= BlkWritable;
416 }

--- 46 unchanged lines hidden (view full) ---

463 }
464 }
465 }
466
467 // at this point either this is a writeback or a write-through
468 // write clean operation and the block is already in this
469 // cache, we need to update the data and the block flags
470 assert(blk);
471 assert(!blk->isDirty());
470 if (!pkt->writeThrough()) {
471 blk->status |= BlkDirty;
472 }
473 // nothing else to do; writeback doesn't expect response
474 assert(!pkt->needsResponse());
475 std::memcpy(blk->data, pkt->getConstPtr<uint8_t>(), blkSize);
476 DPRINTF(Cache, "%s new state is %s\n", __func__, blk->print());
477

--- 1214 unchanged lines hidden (view full) ---

1692Cache::writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id)
1693{
1694 Request *req = new Request(tags->regenerateBlkAddr(blk->tag, blk->set),
1695 blkSize, 0, Request::wbMasterId);
1696 if (blk->isSecure()) {
1697 req->setFlags(Request::SECURE);
1698 }
1699 req->taskId(blk->task_id);
472 if (!pkt->writeThrough()) {
473 blk->status |= BlkDirty;
474 }
475 // nothing else to do; writeback doesn't expect response
476 assert(!pkt->needsResponse());
477 std::memcpy(blk->data, pkt->getConstPtr<uint8_t>(), blkSize);
478 DPRINTF(Cache, "%s new state is %s\n", __func__, blk->print());
479

--- 1214 unchanged lines hidden (view full) ---

1694Cache::writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id)
1695{
1696 Request *req = new Request(tags->regenerateBlkAddr(blk->tag, blk->set),
1697 blkSize, 0, Request::wbMasterId);
1698 if (blk->isSecure()) {
1699 req->setFlags(Request::SECURE);
1700 }
1701 req->taskId(blk->task_id);
1700 blk->task_id = ContextSwitchTaskId::Unknown;
1702
1701 PacketPtr pkt = new Packet(req, MemCmd::WriteClean, blkSize, id);
1703 PacketPtr pkt = new Packet(req, MemCmd::WriteClean, blkSize, id);
1704
1705 if (dest) {
1706 req->setFlags(dest);
1707 pkt->setWriteThrough();
1708 }
1709
1702 DPRINTF(Cache, "Create %s writable: %d, dirty: %d\n", pkt->print(),
1703 blk->isWritable(), blk->isDirty());
1710 DPRINTF(Cache, "Create %s writable: %d, dirty: %d\n", pkt->print(),
1711 blk->isWritable(), blk->isDirty());
1712
1713 if (blk->isWritable()) {
1714 // not asserting shared means we pass the block in modified
1715 // state, mark our own block non-writeable
1716 blk->status &= ~BlkWritable;
1717 } else {
1718 // we are in the Owned state, tell the receiver
1719 pkt->setHasSharers();
1720 }
1721
1704 // make sure the block is not marked dirty
1705 blk->status &= ~BlkDirty;
1722 // make sure the block is not marked dirty
1723 blk->status &= ~BlkDirty;
1724
1706 pkt->allocate();
1725 pkt->allocate();
1707 // We inform the cache below that the block has sharers in the
1708 // system as we retain our copy.
1709 pkt->setHasSharers();
1710 if (dest) {
1711 req->setFlags(dest);
1712 pkt->setWriteThrough();
1713 }
1714 std::memcpy(pkt->getPtr<uint8_t>(), blk->data, blkSize);
1726 std::memcpy(pkt->getPtr<uint8_t>(), blk->data, blkSize);
1727
1715 return pkt;
1716}
1717
1718
1719PacketPtr
1720Cache::cleanEvictBlk(CacheBlk *blk)
1721{
1722 assert(!writebackClean);

--- 1151 unchanged lines hidden ---
1728 return pkt;
1729}
1730
1731
1732PacketPtr
1733Cache::cleanEvictBlk(CacheBlk *blk)
1734{
1735 assert(!writebackClean);

--- 1151 unchanged lines hidden ---