mem: Add a FromCache packet attribute
This patch adds a FromCache attribute to the packet, and updates a number of the existing request commands to reflect that the request originates from a cache. The attribute simplifies checking if a requests came from a cache or not, and this is used by both the cache and snoop filter in follow-on patches. Change-Id: Ib0a7a080bbe4d6036ddd84b46fd45bc7eb41cd8f Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Tony Gutierrez <anthony.gutierrez@amd.com> Reviewed-by: Steve Reinhardt <stever@gmail.com>
This commit is contained in:
parent
da07c5c26a
commit
2509553403
3 changed files with 26 additions and 23 deletions
10
src/mem/cache/cache.cc
vendored
10
src/mem/cache/cache.cc
vendored
|
@ -191,14 +191,8 @@ Cache::satisfyCpuSideRequest(PacketPtr pkt, CacheBlk *blk,
|
||||||
assert(pkt->hasRespData());
|
assert(pkt->hasRespData());
|
||||||
pkt->setDataFromBlock(blk->data, blkSize);
|
pkt->setDataFromBlock(blk->data, blkSize);
|
||||||
|
|
||||||
// determine if this read is from a (coherent) cache, or not
|
// determine if this read is from a (coherent) cache or not
|
||||||
// by looking at the command type; we could potentially add a
|
if (pkt->fromCache()) {
|
||||||
// packet attribute such as 'FromCache' to make this check a
|
|
||||||
// bit cleaner
|
|
||||||
if (pkt->cmd == MemCmd::ReadExReq ||
|
|
||||||
pkt->cmd == MemCmd::ReadSharedReq ||
|
|
||||||
pkt->cmd == MemCmd::ReadCleanReq ||
|
|
||||||
pkt->cmd == MemCmd::SCUpgradeFailReq) {
|
|
||||||
assert(pkt->getSize() == blkSize);
|
assert(pkt->getSize() == blkSize);
|
||||||
// special handling for coherent block requests from
|
// special handling for coherent block requests from
|
||||||
// upper-level caches
|
// upper-level caches
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2015 ARM Limited
|
* Copyright (c) 2011-2016 ARM Limited
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* The license below extends only to copyright in the software and shall
|
* The license below extends only to copyright in the software and shall
|
||||||
|
@ -65,6 +65,8 @@ using namespace std;
|
||||||
#define SET4(a1, a2, a3, a4) (SET3(a1, a2, a3) | SET1(a4))
|
#define SET4(a1, a2, a3, a4) (SET3(a1, a2, a3) | SET1(a4))
|
||||||
#define SET5(a1, a2, a3, a4, a5) (SET4(a1, a2, a3, a4) | SET1(a5))
|
#define SET5(a1, a2, a3, a4, a5) (SET4(a1, a2, a3, a4) | SET1(a5))
|
||||||
#define SET6(a1, a2, a3, a4, a5, a6) (SET5(a1, a2, a3, a4, a5) | SET1(a6))
|
#define SET6(a1, a2, a3, a4, a5, a6) (SET5(a1, a2, a3, a4, a5) | SET1(a6))
|
||||||
|
#define SET7(a1, a2, a3, a4, a5, a6, a7) (SET6(a1, a2, a3, a4, a5, a6) | \
|
||||||
|
SET1(a7))
|
||||||
|
|
||||||
const MemCmd::CommandInfo
|
const MemCmd::CommandInfo
|
||||||
MemCmd::commandInfo[] =
|
MemCmd::commandInfo[] =
|
||||||
|
@ -85,20 +87,20 @@ MemCmd::commandInfo[] =
|
||||||
/* WriteResp */
|
/* WriteResp */
|
||||||
{ SET2(IsWrite, IsResponse), InvalidCmd, "WriteResp" },
|
{ SET2(IsWrite, IsResponse), InvalidCmd, "WriteResp" },
|
||||||
/* WritebackDirty */
|
/* WritebackDirty */
|
||||||
{ SET4(IsWrite, IsRequest, IsEviction, HasData),
|
{ SET5(IsWrite, IsRequest, IsEviction, HasData, FromCache),
|
||||||
InvalidCmd, "WritebackDirty" },
|
InvalidCmd, "WritebackDirty" },
|
||||||
/* WritebackClean - This allows the upstream cache to writeback a
|
/* WritebackClean - This allows the upstream cache to writeback a
|
||||||
* line to the downstream cache without it being considered
|
* line to the downstream cache without it being considered
|
||||||
* dirty. */
|
* dirty. */
|
||||||
{ SET4(IsWrite, IsRequest, IsEviction, HasData),
|
{ SET5(IsWrite, IsRequest, IsEviction, HasData, FromCache),
|
||||||
InvalidCmd, "WritebackClean" },
|
InvalidCmd, "WritebackClean" },
|
||||||
/* CleanEvict */
|
/* CleanEvict */
|
||||||
{ SET2(IsRequest, IsEviction), InvalidCmd, "CleanEvict" },
|
{ SET3(IsRequest, IsEviction, FromCache), InvalidCmd, "CleanEvict" },
|
||||||
/* SoftPFReq */
|
/* SoftPFReq */
|
||||||
{ SET4(IsRead, IsRequest, IsSWPrefetch, NeedsResponse),
|
{ SET4(IsRead, IsRequest, IsSWPrefetch, NeedsResponse),
|
||||||
SoftPFResp, "SoftPFReq" },
|
SoftPFResp, "SoftPFReq" },
|
||||||
/* HardPFReq */
|
/* HardPFReq */
|
||||||
{ SET4(IsRead, IsRequest, IsHWPrefetch, NeedsResponse),
|
{ SET5(IsRead, IsRequest, IsHWPrefetch, NeedsResponse, FromCache),
|
||||||
HardPFResp, "HardPFReq" },
|
HardPFResp, "HardPFReq" },
|
||||||
/* SoftPFResp */
|
/* SoftPFResp */
|
||||||
{ SET4(IsRead, IsResponse, IsSWPrefetch, HasData),
|
{ SET4(IsRead, IsResponse, IsSWPrefetch, HasData),
|
||||||
|
@ -110,18 +112,19 @@ MemCmd::commandInfo[] =
|
||||||
{ SET5(IsWrite, NeedsWritable, IsRequest, NeedsResponse, HasData),
|
{ SET5(IsWrite, NeedsWritable, IsRequest, NeedsResponse, HasData),
|
||||||
WriteResp, "WriteLineReq" },
|
WriteResp, "WriteLineReq" },
|
||||||
/* UpgradeReq */
|
/* UpgradeReq */
|
||||||
{ SET5(IsInvalidate, NeedsWritable, IsUpgrade, IsRequest, NeedsResponse),
|
{ SET6(IsInvalidate, NeedsWritable, IsUpgrade, IsRequest, NeedsResponse,
|
||||||
|
FromCache),
|
||||||
UpgradeResp, "UpgradeReq" },
|
UpgradeResp, "UpgradeReq" },
|
||||||
/* SCUpgradeReq: response could be UpgradeResp or UpgradeFailResp */
|
/* SCUpgradeReq: response could be UpgradeResp or UpgradeFailResp */
|
||||||
{ SET6(IsInvalidate, NeedsWritable, IsUpgrade, IsLlsc,
|
{ SET7(IsInvalidate, NeedsWritable, IsUpgrade, IsLlsc,
|
||||||
IsRequest, NeedsResponse),
|
IsRequest, NeedsResponse, FromCache),
|
||||||
UpgradeResp, "SCUpgradeReq" },
|
UpgradeResp, "SCUpgradeReq" },
|
||||||
/* UpgradeResp */
|
/* UpgradeResp */
|
||||||
{ SET2(IsUpgrade, IsResponse),
|
{ SET2(IsUpgrade, IsResponse),
|
||||||
InvalidCmd, "UpgradeResp" },
|
InvalidCmd, "UpgradeResp" },
|
||||||
/* SCUpgradeFailReq: generates UpgradeFailResp but still gets the data */
|
/* SCUpgradeFailReq: generates UpgradeFailResp but still gets the data */
|
||||||
{ SET6(IsRead, NeedsWritable, IsInvalidate,
|
{ SET7(IsRead, NeedsWritable, IsInvalidate,
|
||||||
IsLlsc, IsRequest, NeedsResponse),
|
IsLlsc, IsRequest, NeedsResponse, FromCache),
|
||||||
UpgradeFailResp, "SCUpgradeFailReq" },
|
UpgradeFailResp, "SCUpgradeFailReq" },
|
||||||
/* UpgradeFailResp - Behaves like a ReadExReq, but notifies an SC
|
/* UpgradeFailResp - Behaves like a ReadExReq, but notifies an SC
|
||||||
* that it has failed, acquires line as Dirty*/
|
* that it has failed, acquires line as Dirty*/
|
||||||
|
@ -130,7 +133,8 @@ MemCmd::commandInfo[] =
|
||||||
/* ReadExReq - Read issues by a cache, always cache-line aligned,
|
/* ReadExReq - Read issues by a cache, always cache-line aligned,
|
||||||
* and the response is guaranteed to be writeable (exclusive or
|
* and the response is guaranteed to be writeable (exclusive or
|
||||||
* even modified) */
|
* even modified) */
|
||||||
{ SET5(IsRead, NeedsWritable, IsInvalidate, IsRequest, NeedsResponse),
|
{ SET6(IsRead, NeedsWritable, IsInvalidate, IsRequest, NeedsResponse,
|
||||||
|
FromCache),
|
||||||
ReadExResp, "ReadExReq" },
|
ReadExResp, "ReadExReq" },
|
||||||
/* ReadExResp - Response matching a read exclusive, as we check
|
/* ReadExResp - Response matching a read exclusive, as we check
|
||||||
* the need for exclusive also on responses */
|
* the need for exclusive also on responses */
|
||||||
|
@ -139,11 +143,13 @@ MemCmd::commandInfo[] =
|
||||||
/* ReadCleanReq - Read issued by a cache, always cache-line
|
/* ReadCleanReq - Read issued by a cache, always cache-line
|
||||||
* aligned, and the response is guaranteed to not contain dirty data
|
* aligned, and the response is guaranteed to not contain dirty data
|
||||||
* (exclusive or shared).*/
|
* (exclusive or shared).*/
|
||||||
{ SET3(IsRead, IsRequest, NeedsResponse), ReadResp, "ReadCleanReq" },
|
{ SET4(IsRead, IsRequest, NeedsResponse, FromCache),
|
||||||
|
ReadResp, "ReadCleanReq" },
|
||||||
/* ReadSharedReq - Read issued by a cache, always cache-line
|
/* ReadSharedReq - Read issued by a cache, always cache-line
|
||||||
* aligned, response is shared, possibly exclusive, owned or even
|
* aligned, response is shared, possibly exclusive, owned or even
|
||||||
* modified. */
|
* modified. */
|
||||||
{ SET3(IsRead, IsRequest, NeedsResponse), ReadResp, "ReadSharedReq" },
|
{ SET4(IsRead, IsRequest, NeedsResponse, FromCache),
|
||||||
|
ReadResp, "ReadSharedReq" },
|
||||||
/* LoadLockedReq: note that we use plain ReadResp as response, so that
|
/* LoadLockedReq: note that we use plain ReadResp as response, so that
|
||||||
* we can also use ReadRespWithInvalidate when needed */
|
* we can also use ReadRespWithInvalidate when needed */
|
||||||
{ SET4(IsRead, IsLlsc, IsRequest, NeedsResponse),
|
{ SET4(IsRead, IsLlsc, IsRequest, NeedsResponse),
|
||||||
|
@ -187,7 +193,7 @@ MemCmd::commandInfo[] =
|
||||||
/* Flush Request */
|
/* Flush Request */
|
||||||
{ SET3(IsRequest, IsFlush, NeedsWritable), InvalidCmd, "FlushReq" },
|
{ SET3(IsRequest, IsFlush, NeedsWritable), InvalidCmd, "FlushReq" },
|
||||||
/* Invalidation Request */
|
/* Invalidation Request */
|
||||||
{ SET4(IsInvalidate, IsRequest, NeedsWritable, NeedsResponse),
|
{ SET5(IsInvalidate, IsRequest, NeedsWritable, NeedsResponse, FromCache),
|
||||||
InvalidateResp, "InvalidateReq" },
|
InvalidateResp, "InvalidateReq" },
|
||||||
/* Invalidation Response */
|
/* Invalidation Response */
|
||||||
{ SET2(IsInvalidate, IsResponse),
|
{ SET2(IsInvalidate, IsResponse),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2015 ARM Limited
|
* Copyright (c) 2012-2016 ARM Limited
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* The license below extends only to copyright in the software and shall
|
* The license below extends only to copyright in the software and shall
|
||||||
|
@ -151,6 +151,7 @@ class MemCmd
|
||||||
IsError, //!< Error response
|
IsError, //!< Error response
|
||||||
IsPrint, //!< Print state matching address (for debugging)
|
IsPrint, //!< Print state matching address (for debugging)
|
||||||
IsFlush, //!< Flush the address from caches
|
IsFlush, //!< Flush the address from caches
|
||||||
|
FromCache, //!< Request originated from a caching agent
|
||||||
NUM_COMMAND_ATTRIBUTES
|
NUM_COMMAND_ATTRIBUTES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -193,6 +194,7 @@ class MemCmd
|
||||||
bool needsResponse() const { return testCmdAttrib(NeedsResponse); }
|
bool needsResponse() const { return testCmdAttrib(NeedsResponse); }
|
||||||
bool isInvalidate() const { return testCmdAttrib(IsInvalidate); }
|
bool isInvalidate() const { return testCmdAttrib(IsInvalidate); }
|
||||||
bool isEviction() const { return testCmdAttrib(IsEviction); }
|
bool isEviction() const { return testCmdAttrib(IsEviction); }
|
||||||
|
bool fromCache() const { return testCmdAttrib(FromCache); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A writeback is an eviction that carries data.
|
* A writeback is an eviction that carries data.
|
||||||
|
@ -514,6 +516,7 @@ class Packet : public Printable
|
||||||
bool needsResponse() const { return cmd.needsResponse(); }
|
bool needsResponse() const { return cmd.needsResponse(); }
|
||||||
bool isInvalidate() const { return cmd.isInvalidate(); }
|
bool isInvalidate() const { return cmd.isInvalidate(); }
|
||||||
bool isEviction() const { return cmd.isEviction(); }
|
bool isEviction() const { return cmd.isEviction(); }
|
||||||
|
bool fromCache() const { return cmd.fromCache(); }
|
||||||
bool isWriteback() const { return cmd.isWriteback(); }
|
bool isWriteback() const { return cmd.isWriteback(); }
|
||||||
bool hasData() const { return cmd.hasData(); }
|
bool hasData() const { return cmd.hasData(); }
|
||||||
bool hasRespData() const
|
bool hasRespData() const
|
||||||
|
|
Loading…
Reference in a new issue