X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmem%2Frequest.hh;h=11f1c74b3e404f48a4babfb62631f245c022a9fb;hb=8573a69d8f7bf7b3f074e3e0ac64994801c551be;hp=dce68087d2478c39ae3e6fd2e1160a8a95c90ff8;hpb=52d30813cac76b9dd69ed9c33bb4966f89c5e7a0;p=gem5.git diff --git a/src/mem/request.hh b/src/mem/request.hh index dce68087d..11f1c74b3 100644 --- a/src/mem/request.hh +++ b/src/mem/request.hh @@ -1,4 +1,16 @@ /* + * Copyright (c) 2012 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 2002-2005 The Regents of The University of Michigan * All rights reserved. * @@ -40,18 +52,37 @@ #define __MEM_REQUEST_HH__ #include +#include -#include "base/fast_alloc.hh" #include "base/flags.hh" #include "base/misc.hh" #include "base/types.hh" #include "sim/core.hh" +/** + * Special TaskIds that are used for per-context-switch stats dumps + * and Cache Occupancy. Having too many tasks seems to be a problem + * with vector stats. 1024 seems to be a reasonable number that + * doesn't cause a problem with stats and is large enough to realistic + * benchmarks (Linux/Android boot, BBench, etc.) + */ + +namespace ContextSwitchTaskId { + enum TaskId { + MaxNormalTaskId = 1021, /* Maximum number of normal tasks */ + Prefetcher = 1022, /* For cache lines brought in by prefetcher */ + DMA = 1023, /* Mostly Table Walker */ + Unknown = 1024, + NumTaskId + }; +} + class Request; typedef Request* RequestPtr; +typedef uint16_t MasterID; -class Request : public FastAlloc +class Request { public: typedef uint32_t FlagsType; @@ -100,6 +131,26 @@ class Request : public FastAlloc (assigned a new address). */ static const FlagsType STICKY_FLAGS = INST_FETCH; + /** Request Ids that are statically allocated + * @{*/ + /** This request id is used for writeback requests by the caches */ + static const MasterID wbMasterId = 0; + /** This request id is used for functional requests that don't come from a + * particular device + */ + static const MasterID funcMasterId = 1; + /** This request id is used for message signaled interrupts */ + static const MasterID intMasterId = 2; + /** Invalid request id for assertion checking only. It is invalid behavior + * to ever send this id as part of a request. + * @todo C++1x replace with numeric_limits when constexpr is added */ + static const MasterID invldMasterId = USHRT_MAX; + /** @} */ + + /** Invalid or unknown Pid. Possible when operating system is not present + * or has not assigned a pid yet */ + static const uint32_t invldPid = UINT_MAX; + private: typedef uint8_t PrivateFlagsType; typedef ::Flags PrivateFlags; @@ -137,6 +188,11 @@ class Request : public FastAlloc */ int _size; + /** The requestor ID which is unique in the system for all ports + * that are capable of issuing a transaction + */ + MasterID _masterId; + /** Flag structure for the request. */ Flags _flags; @@ -182,31 +238,31 @@ class Request : public FastAlloc * just physical address, size, flags, and timestamp (to curTick()). * These fields are adequate to perform a request. */ - Request(Addr paddr, int size, Flags flags) + Request(Addr paddr, int size, Flags flags, MasterID mid) { - setPhys(paddr, size, flags); + setPhys(paddr, size, flags, mid); } - Request(Addr paddr, int size, Flags flags, Tick time) + Request(Addr paddr, int size, Flags flags, MasterID mid, Tick time) { - setPhys(paddr, size, flags, time); + setPhys(paddr, size, flags, mid, time); } - Request(Addr paddr, int size, Flags flags, Tick time, Addr pc) + Request(Addr paddr, int size, Flags flags, MasterID mid, Tick time, Addr pc) { - setPhys(paddr, size, flags, time); + setPhys(paddr, size, flags, mid, time); privateFlags.set(VALID_PC); _pc = pc; } - Request(int asid, Addr vaddr, int size, Flags flags, Addr pc, + Request(int asid, Addr vaddr, int size, Flags flags, MasterID mid, Addr pc, int cid, ThreadID tid) { - setVirt(asid, vaddr, size, flags, pc); + setVirt(asid, vaddr, size, flags, mid, pc); setThreadContext(cid, tid); } - ~Request() {} // for FastAlloc + ~Request() {} /** * Set up CPU and thread numbers. @@ -224,13 +280,13 @@ class Request : public FastAlloc * allocated Request object. */ void - setPhys(Addr paddr, int size, Flags flags, Tick time) + setPhys(Addr paddr, int size, Flags flags, MasterID mid, Tick time) { assert(size >= 0); _paddr = paddr; _size = size; _time = time; - + _masterId = mid; _flags.clear(~STICKY_FLAGS); _flags.set(flags); privateFlags.clear(~STICKY_PRIVATE_FLAGS); @@ -238,9 +294,9 @@ class Request : public FastAlloc } void - setPhys(Addr paddr, int size, Flags flags) + setPhys(Addr paddr, int size, Flags flags, MasterID mid) { - setPhys(paddr, size, flags, curTick()); + setPhys(paddr, size, flags, mid, curTick()); } /** @@ -248,12 +304,13 @@ class Request : public FastAlloc * allocated Request object. */ void - setVirt(int asid, Addr vaddr, int size, Flags flags, Addr pc) + setVirt(int asid, Addr vaddr, int size, Flags flags, MasterID mid, Addr pc) { assert(size >= 0); _asid = asid; _vaddr = vaddr; _size = size; + _masterId = mid; _pc = pc; _time = curTick(); @@ -369,6 +426,13 @@ class Request : public FastAlloc return _vaddr; } + /** Accesssor for the requestor id. */ + MasterID + masterId() + { + return _masterId; + } + /** Accessor function for asid.*/ int getAsid()