cache.cc (11284:b3926db25371) cache.cc (11285:25715951a4b8)
1/*
2 * Copyright (c) 2010-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

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

1899 assert(pkt->isRequest());
1900
1901 // the packet may get modified if we or a forwarded snooper
1902 // responds in atomic mode, so remember a few things about the
1903 // original packet up front
1904 bool invalidate = pkt->isInvalidate();
1905 bool M5_VAR_USED needs_writable = pkt->needsWritable();
1906
1/*
2 * Copyright (c) 2010-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

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

1899 assert(pkt->isRequest());
1900
1901 // the packet may get modified if we or a forwarded snooper
1902 // responds in atomic mode, so remember a few things about the
1903 // original packet up front
1904 bool invalidate = pkt->isInvalidate();
1905 bool M5_VAR_USED needs_writable = pkt->needsWritable();
1906
1907 // at the moment we could get an uncacheable write which does not
1908 // have the invalidate flag, and we need a suitable way of dealing
1909 // with this case
1910 panic_if(invalidate && pkt->req->isUncacheable(),
1911 "%s got an invalidating uncacheable snoop request %s to %#llx",
1912 name(), pkt->cmdString(), pkt->getAddr());
1913
1907 uint32_t snoop_delay = 0;
1908
1909 if (forwardSnoops) {
1910 // first propagate snoop upward to see if anyone above us wants to
1911 // handle it. save & restore packet src since it will get
1912 // rewritten to be relative to cpu-side bus (if any)
1913 bool alreadyResponded = pkt->cacheResponding();
1914 if (is_timing) {

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

1983 // downstream caches observe.
1984 if (pkt->mustCheckAbove()) {
1985 DPRINTF(Cache, "Found addr %#llx in upper level cache for snoop %s from"
1986 " lower cache\n", pkt->getAddr(), pkt->cmdString());
1987 pkt->setBlockCached();
1988 return snoop_delay;
1989 }
1990
1914 uint32_t snoop_delay = 0;
1915
1916 if (forwardSnoops) {
1917 // first propagate snoop upward to see if anyone above us wants to
1918 // handle it. save & restore packet src since it will get
1919 // rewritten to be relative to cpu-side bus (if any)
1920 bool alreadyResponded = pkt->cacheResponding();
1921 if (is_timing) {

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

1990 // downstream caches observe.
1991 if (pkt->mustCheckAbove()) {
1992 DPRINTF(Cache, "Found addr %#llx in upper level cache for snoop %s from"
1993 " lower cache\n", pkt->getAddr(), pkt->cmdString());
1994 pkt->setBlockCached();
1995 return snoop_delay;
1996 }
1997
1991 if (!pkt->req->isUncacheable() && pkt->isRead() && !invalidate) {
1992 // reading without requiring the line in a writable state,
1993 // note that we retain the block as Owned if it is Modified
1994 // (dirty data), with the response taken care of below, and
1995 // otherwhise simply downgrade from Exclusive to Shared (or
1996 // remain in Shared)
1998 if (pkt->isRead() && !invalidate) {
1999 // reading without requiring the line in a writable state
1997 assert(!needs_writable);
1998 pkt->setHasSharers();
2000 assert(!needs_writable);
2001 pkt->setHasSharers();
1999 blk->status &= ~BlkWritable;
2002
2003 // if the requesting packet is uncacheable, retain the line in
2004 // the current state, otherwhise unset the writable flag,
2005 // which means we go from Modified to Owned (and will respond
2006 // below), remain in Owned (and will respond below), from
2007 // Exclusive to Shared, or remain in Shared
2008 if (!pkt->req->isUncacheable())
2009 blk->status &= ~BlkWritable;
2000 }
2001
2002 if (respond) {
2003 // prevent anyone else from responding, cache as well as
2004 // memory, and also prevent any memory from even seeing the
2005 // request
2006 pkt->setCacheResponding();
2007 if (have_writable) {

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

2015 // recipient does not care there is no harm in doing so
2016 } else {
2017 // if the packet has needsWritable set we invalidate our
2018 // copy below and all other copies will be invalidates
2019 // through express snoops, and if needsWritable is not set
2020 // we already called setHasSharers above
2021 }
2022
2010 }
2011
2012 if (respond) {
2013 // prevent anyone else from responding, cache as well as
2014 // memory, and also prevent any memory from even seeing the
2015 // request
2016 pkt->setCacheResponding();
2017 if (have_writable) {

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

2025 // recipient does not care there is no harm in doing so
2026 } else {
2027 // if the packet has needsWritable set we invalidate our
2028 // copy below and all other copies will be invalidates
2029 // through express snoops, and if needsWritable is not set
2030 // we already called setHasSharers above
2031 }
2032
2033 // if we are returning a writable and dirty (Modified) line,
2034 // we should be invalidating the line
2035 panic_if(!invalidate && !pkt->hasSharers(),
2036 "%s is passing a Modified line through %s to %#llx, "
2037 "but keeping the block",
2038 name(), pkt->cmdString(), pkt->getAddr());
2039
2023 if (is_timing) {
2024 doTimingSupplyResponse(pkt, blk->data, is_deferred, pending_inval);
2025 } else {
2026 pkt->makeAtomicResponse();
2027 pkt->setDataFromBlock(blk->data, blkSize);
2028 }
2029 }
2030

--- 644 unchanged lines hidden ---
2040 if (is_timing) {
2041 doTimingSupplyResponse(pkt, blk->data, is_deferred, pending_inval);
2042 } else {
2043 pkt->makeAtomicResponse();
2044 pkt->setDataFromBlock(blk->data, blkSize);
2045 }
2046 }
2047

--- 644 unchanged lines hidden ---