1/* |
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) { |
408 assert(!blk->isDirty()); |
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()); |
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); |
1702 |
1703 PacketPtr pkt = new Packet(req, MemCmd::WriteClean, blkSize, id); |
1704 1705 if (dest) { 1706 req->setFlags(dest); 1707 pkt->setWriteThrough(); 1708 } 1709 |
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 |
1722 // make sure the block is not marked dirty 1723 blk->status &= ~BlkDirty; |
1724 |
1725 pkt->allocate(); |
1726 std::memcpy(pkt->getPtr<uint8_t>(), blk->data, blkSize); |
1727 |
1728 return pkt; 1729} 1730 1731 1732PacketPtr 1733Cache::cleanEvictBlk(CacheBlk *blk) 1734{ 1735 assert(!writebackClean); --- 1151 unchanged lines hidden --- |