mshr.cc (11197:f8fdd931e674) mshr.cc (11271:f4ad5be63ba8)
1/*
2 * Copyright (c) 2012-2013, 2015 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

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

359 // logically we don't have the block anymore; no need for
360 // further snooping.
361 return true;
362 }
363
364 if (isPendingDirty() || pkt->isInvalidate()) {
365 // We need to save and replay the packet in two cases:
366 // 1. We're awaiting an exclusive copy, so ownership is pending,
1/*
2 * Copyright (c) 2012-2013, 2015 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

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

359 // logically we don't have the block anymore; no need for
360 // further snooping.
361 return true;
362 }
363
364 if (isPendingDirty() || pkt->isInvalidate()) {
365 // We need to save and replay the packet in two cases:
366 // 1. We're awaiting an exclusive copy, so ownership is pending,
367 // and we need to respond after we receive data.
367 // and we need to deal with the snoop after we receive data.
368 // 2. It's an invalidation (e.g., UpgradeReq), and we need
369 // to forward the snoop up the hierarchy after the current
370 // transaction completes.
368 // 2. It's an invalidation (e.g., UpgradeReq), and we need
369 // to forward the snoop up the hierarchy after the current
370 // transaction completes.
371
372 // Actual target device (typ. a memory) will delete the
373 // packet on reception, so we need to save a copy here.
374
371
375 // Clear flags and also allocate new data as the original
376 // packet data storage may have been deleted by the time we
377 // get to send this packet.
378 PacketPtr cp_pkt = nullptr;
372 // Start by determining if we will eventually respond or not,
373 // matching the conditions checked in Cache::handleSnoop
374 bool will_respond = isPendingDirty() && pkt->needsResponse() &&
375 pkt->cmd != MemCmd::InvalidateReq;
379
376
377 // The packet we are snooping may be deleted by the time we
378 // actually process the target, and we consequently need to
379 // save a copy here. Clear flags and also allocate new data as
380 // the original packet data storage may have been deleted by
381 // the time we get to process this packet. In the cases where
382 // we are not responding after handling the snoop we also need
383 // to create a copy of the request to be on the safe side. In
384 // the latter case the cache is responsible for deleting both
385 // the packet and the request as part of handling the deferred
386 // snoop.
387 PacketPtr cp_pkt = will_respond ? new Packet(pkt, true, true) :
388 new Packet(new Request(*pkt->req), pkt->cmd);
389
380 if (isPendingDirty()) {
390 if (isPendingDirty()) {
381 // Case 1: The new packet will need to get the response from the
391 // The new packet will need to get the response from the
382 // MSHR already queued up here
392 // MSHR already queued up here
383 cp_pkt = new Packet(pkt, true, true);
384 pkt->assertMemInhibit();
385 // in the case of an uncacheable request there is no need
386 // to set the exclusive flag, but since the recipient does
387 // not care there is no harm in doing so
388 pkt->setSupplyExclusive();
393 pkt->assertMemInhibit();
394 // in the case of an uncacheable request there is no need
395 // to set the exclusive flag, but since the recipient does
396 // not care there is no harm in doing so
397 pkt->setSupplyExclusive();
389 } else {
390 // Case 2: We only need to buffer the packet for information
391 // purposes; the original request can proceed without waiting
392 // => Create a copy of the request, as that may get deallocated as
393 // well
394 cp_pkt = new Packet(new Request(*pkt->req), pkt->cmd);
395 DPRINTF(Cache, "Copying packet %p -> %p and request %p -> %p\n",
396 pkt, cp_pkt, pkt->req, cp_pkt->req);
397 }
398 targets.add(cp_pkt, curTick(), _order, Target::FromSnoop,
399 downstreamPending && targets.needsExclusive);
400
401 if (pkt->needsExclusive()) {
402 // This transaction will take away our pending copy
403 postInvalidate = true;
404 }

--- 107 unchanged lines hidden ---
398 }
399 targets.add(cp_pkt, curTick(), _order, Target::FromSnoop,
400 downstreamPending && targets.needsExclusive);
401
402 if (pkt->needsExclusive()) {
403 // This transaction will take away our pending copy
404 postInvalidate = true;
405 }

--- 107 unchanged lines hidden ---