54#include "debug/Loader.hh"
55#include "debug/Quiesce.hh"
56#include "debug/WorkItems.hh"
59#include "params/System.hh"
89 context->getSystemPtr()->workload->recordQuiesce();
111 panic_if(!
t.context,
"Can't replace a context which doesn't exist.");
112 if (
t.resumeEvent->scheduled()) {
113 Tick when =
t.resumeEvent->when();
114 t.context->getCpuPtr()->deschedule(
t.resumeEvent);
148 [[maybe_unused]]
BaseCPU *cpu =
t.context->getCpuPtr();
149 DPRINTFS(Quiesce, cpu,
"quiesce()\n");
157 BaseCPU *cpu =
t.context->getCpuPtr();
159 DPRINTFS(Quiesce, cpu,
"quiesceTick until %u\n", when);
170 p.external_memory_ranges.
end()),
175 physmem(
name() +
".physmem",
p.memories,
p.mmap_using_noreserve,
176 p.shared_backstore,
p.auto_unlink_shared_backstore),
178 p.shadow_rom_ranges.
end()),
189 "(could use StubWorkload?).",
name());
198 warn_once(
"Cache line size is neither 16, 32, 64 nor 128 bytes.\n");
214 for (
int x = 0;
x <
params().memories.size();
x++)
215 params().memories[
x]->system(
this);
243 workload->registerThreadContext(tc);
272 auto *otc =
threads[context_id];
273 threads.replace(tc, context_id);
297 if (range.contains(
addr)) {
329 "No device memory found for Requestor %d\n", rid);
345 if (
t.resumeEvent &&
t.resumeEvent->scheduled())
346 when =
t.resumeEvent->when();
363 !when || !
t.resumeEvent) {
366 t.context->getCpuPtr()->schedule(
t.resumeEvent, when);
370 physmem.unserializeSection(
cp,
"physmem");
380 std::stringstream namestr;
381 ccprintf(namestr,
"work_item_type%d", j);
384 .desc(
"Run time stat for" + namestr.str())
397 DPRINTF(WorkItems,
"Work item end: %d\t%d\t%lld\n", tid, workid, samp);
400 fatal(
"Got workid greater than specified in system configuration\n");
409 return workload->trapToGdb(signal, ctx_id);
415 std::ios::fmtflags flags(std::cerr.flags());
419 for (;
i != end; ++
i) {
421 std::cerr <<
"System " << sys->
name() <<
": " << std::hex << sys
425 std::cerr.flags(flags);
438 return requestor_name.substr(
name().size() + 1);
440 return requestor_name;
461 "Cannot lookup RequestorID by SimObject pointer: "
462 "More than one requestor is sharing the same SimObject\n");
496 const std::string& requestor_name)
512 fatal(
"Can't request a requestorId after regStats(). "
513 "You must do so in init().\n");
527 const std::string& subrequestor)
529 if (subrequestor.empty()) {
530 return requestor->
name();
534 return requestor->
name() +
"." + subrequestor;
542 fatal(
"Invalid requestor_id passed to getRequestorName()\n");
544 const auto& requestor_info =
requestors[requestor_id];
545 return requestor_info.req_name;
AbstractMemory declaration.
#define DPRINTFS(x, s,...)
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
virtual std::string name() const
virtual bool schedule(PCEvent *event)=0
AddrRange getAddrRange() const
Get address range to which this packet belongs.
RequestorID requestorId() const
Ports are used to interface objects to each other.
@ funcRequestorId
This requestor id is used for functional requests that don't come from a particular device.
@ invldRequestorId
Invalid requestor id for assertion checking only.
@ wbRequestorId
This requestor id is used for writeback requests by the caches.
@ intRequestorId
This requestor id is used for message signaled interrupts.
const_iterator end() const
void quiesceTick(ContextID id, Tick when)
const_iterator begin() const
void quiesce(ContextID id)
Thread & thread(ContextID id)
void insert(ThreadContext *tc)
std::vector< Thread > threads
void replace(ThreadContext *tc, ContextID id)
ThreadContext * findFree()
void serialize(CheckpointOut &cp) const override
Serialize an object.
RequestorID lookupRequestorId(const SimObject *obj) const
Looks up the RequestorID for a given SimObject returns an invalid RequestorID (invldRequestorId) if n...
bool remove(PCEvent *event) override
RequestorID _getRequestorId(const SimObject *requestor, const std::string &requestor_name)
helper function for getRequestorId
static int numSystemsRunning
void registerThreadContext(ThreadContext *tc)
enums::MemoryMode memoryMode
std::string leafRequestorName(const SimObject *requestor, const std::string &subrequestor)
Helper function for constructing the full (sub)requestor name by providing the root requestor and the...
void addDeviceMemory(RequestorID requestorId, memory::AbstractMemory *deviceMemory)
Add a physical memory range for a device.
Addr memSize() const
Amount of physical memory that exists.
std::unordered_map< RequestorID, std::vector< memory::AbstractMemory * > > deviceMemMap
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
AddrRangeList externalMemRanges
bool isMemAddr(Addr addr) const
Check if a physical address is within a range of a memory that is part of the global address map.
RequestorID getRequestorId(const SimObject *requestor, std::string subrequestor={})
Request an id used to create a request object in the system.
bool schedule(PCEvent *event) override
bool isDeviceMemAddr(const PacketPtr &pkt) const
Similar to isMemAddr but for devices.
std::map< std::pair< uint32_t, uint32_t >, Tick > lastWorkItemStarted
memory::PhysicalMemory physmem
static void printSystems()
std::map< uint32_t, statistics::Histogram * > workItemStats
std::string stripSystemName(const std::string &requestor_name) const
Strips off the system name from a requestor name.
void setMemoryMode(enums::MemoryMode mode)
Change the memory mode of the system.
void workItemEnd(uint32_t tid, uint32_t workid)
Workload * workload
OS kernel.
std::vector< RedirectPath * > redirectPaths
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
const Addr _cacheLineSize
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Additional function to return the Port of a memory object.
ThermalModel * thermalModel
void regStats() override
Callback to set stat parameters.
RequestorID getGlobalRequestorId(const std::string &requestor_name)
Registers a GLOBAL RequestorID, which is a RequestorID not related to any particular SimObject; since...
memory::AbstractMemory * getDeviceMemory(const PacketPtr &pkt) const
Return a pointer to the device memory.
std::list< PCEvent * > liveEvents
std::vector< RequestorInfo > requestors
This array is a per-system list of all devices capable of issuing a memory system request and an asso...
static std::vector< System * > systemList
bool trapToGdb(GDBSignal signal, ContextID ctx_id) const
AddrRangeList ShadowRomRanges
void replaceThreadContext(ThreadContext *tc, ContextID context_id)
const AddrRange _m5opRange
Range for memory-mapped m5 pseudo ops.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual System * getSystemPtr()=0
virtual BaseCPU * getCpuPtr()=0
@ Halted
Permanently shut down.
@ Halting
Trying to exit and waiting for an event to completely exit.
virtual void setContextId(ContextID id)=0
An abstract memory represents a contiguous block of physical memory, with an associated address range...
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
AddrRange RangeSize(Addr start, Addr size)
DrainState drainState() const
Return the current drain state of an object.
@ Drained
Buffers drained, ready for serialization/handover.
void schedule(Event &event, Tick when)
void reschedule(Event &event, Tick when, bool always=false)
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
#define fatal(...)
This implements a cprintf based fatal() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
bool optParamIn(CheckpointIn &cp, const std::string &name, T ¶m, bool do_warn=true)
This function is used for restoring optional parameters from the checkpoint.
const Params & params() const
SimObject(const Params &p)
virtual void regStats()
Callback to set stat parameters.
Copyright (c) 2024 Arm Limited All rights reserved.
bool startswith(const char *s, const char *prefix)
Return true if 's' starts with the prefix string 'prefix'.
Tick curTick()
The universal simulation clock.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
uint64_t Tick
Tick count type.
int ContextID
Globally unique thread context ID.
std::string csprintf(const char *format, const Args &...args)
void ccprintf(cp::Print &print)