Go to the documentation of this file.
52 #include "config/the_isa.hh"
53 #include "config/use_kvm.hh"
62 #include "debug/Loader.hh"
63 #include "debug/Quiesce.hh"
64 #include "debug/WorkItems.hh"
67 #include "params/System.hh"
91 return csprintf(
"%s.threads[%d]", context->getSystemPtr()->name(),
92 context->contextId());
99 context->getSystemPtr()->workload->recordQuiesce();
106 for (
id = 0;
id <
size();
id++) {
118 "Cannot have two thread contexts with the same id (%d).",
id);
134 panic_if(!
t.context,
"Can't replace a context which doesn't exist.");
136 if (
t.resumeEvent->scheduled()) {
137 Tick when =
t.resumeEvent->when();
138 t.context->getCpuPtr()->deschedule(
t.resumeEvent);
139 tc->
getCpuPtr()->schedule(
t.resumeEvent, when);
174 [[maybe_unused]] BaseCPU *cpu =
t.context->getCpuPtr();
175 DPRINTFS(Quiesce, cpu,
"quiesce()\n");
185 BaseCPU *cpu =
t.context->getCpuPtr();
187 DPRINTFS(Quiesce, cpu,
"quiesceTick until %u\n", when);
190 cpu->reschedule(
t.resumeEvent, when,
true);
205 physmem(
name() +
".physmem",
p.memories,
p.mmap_using_noreserve,
208 p.shadow_rom_ranges.
end()),
219 "(could use StubWorkload?).",
name());
234 warn_once(
"Cache line size is neither 16, 32, 64 nor 128 bytes.\n");
250 for (
int x = 0;
x <
params().memories.size();
x++)
251 params().memories[
x]->system(
this);
291 all = tc->schedule(
event) && all;
301 all = tc->remove(
event) && all;
308 auto *otc =
threads[context_id];
327 if (!
dynamic_cast<BaseKvmCPU *
>(tc->getCpuPtr()))
372 "No device memory found for Requestor %d\n", rid);
388 if (
t.resumeEvent &&
t.resumeEvent->scheduled())
389 when =
t.resumeEvent->when();
406 !when || !
t.resumeEvent) {
410 t.context->getCpuPtr()->schedule(
t.resumeEvent, when);
425 std::stringstream namestr;
426 ccprintf(namestr,
"work_item_type%d",
j);
429 .desc(
"Run time stat for" + namestr.str())
442 DPRINTF(WorkItems,
"Work item end: %d\t%d\t%lld\n", tid, workid, samp);
445 fatal(
"Got workid greater than specified in system configuration\n");
460 std::ios::fmtflags flags(std::cerr.flags());
464 for (;
i != end; ++
i) {
466 std::cerr <<
"System " << sys->
name() <<
": " << std::hex << sys
470 std::cerr.flags(flags);
483 return requestor_name.substr(
name().size() + 1);
485 return requestor_name;
506 "Cannot lookup RequestorID by SimObject pointer: "
507 "More than one requestor is sharing the same SimObject\n");
541 const std::string& requestor_name)
557 fatal(
"Can't request a requestorId after regStats(). "
558 "You must do so in init().\n");
572 const std::string& subrequestor)
574 if (subrequestor.empty()) {
575 return requestor->
name();
579 return requestor->
name() +
"." + subrequestor;
587 fatal(
"Invalid requestor_id passed to getRequestorName()\n");
589 const auto& requestor_info =
requestors[requestor_id];
590 return requestor_info.req_name;
Tick curTick()
The universal simulation clock.
#define fatal(...)
This implements a cprintf based fatal() function.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void addDeviceMemory(RequestorID requestorId, memory::AbstractMemory *deviceMemory)
Add a physical memory range for a device.
std::map< std::pair< uint32_t, uint32_t >, Tick > lastWorkItemStarted
virtual System * getSystemPtr()=0
void workItemEnd(uint32_t tid, uint32_t workid)
RequestorID lookupRequestorId(const SimObject *obj) const
Looks up the RequestorID for a given SimObject returns an invalid RequestorID (invldRequestorId) if n...
@ Halted
Permanently shut down.
DrainState drainState() const
Return the current drain state of an object.
std::list< PCEvent * > liveEvents
AddrRange RangeSize(Addr start, Addr size)
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
bool schedule(PCEvent *event) override
const ContextID InvalidContextID
void quiesce(ContextID id)
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Additional function to return the Port of a memory object.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
void setSystem(System *s)
Initialize system pointer.
std::map< uint32_t, statistics::Histogram * > workItemStats
bool startswith(const char *s, const char *prefix)
Return true if 's' starts with the prefix string 'prefix'.
Workload * workload
OS kernel.
void replace(ThreadContext *tc, ContextID id)
const_iterator end() const
void setMemoryMode(enums::MemoryMode mode)
Change the memory mode of the system.
virtual void activate()=0
Set the status to Active.
static int numSystemsRunning
std::string csprintf(const char *format, const Args &...args)
void regStats() override
Callback to set stat parameters.
memory::AbstractMemory * getDeviceMemory(const PacketPtr &pkt) const
Return a pointer to the device memory.
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
@ funcRequestorId
This requestor id is used for functional requests that don't come from a particular device.
void ccprintf(cp::Print &print)
virtual Status status() const =0
RequestorID _getRequestorId(const SimObject *requestor, const std::string &requestor_name)
helper function for getRequestorId
std::string stripSystemName(const std::string &requestor_name) const
Strips off the system name from a requestor name.
void quiesceTick(ContextID id, Tick when)
std::vector< RequestorInfo > requestors
This array is a per-system list of all devices capable of issuing a memory system request and an asso...
std::vector< RedirectPath * > redirectPaths
std::vector< Thread > threads
std::unordered_map< RequestorID, std::vector< memory::AbstractMemory * > > deviceMemMap
ThreadContext is the external interface to all thread state for anything outside of the CPU.
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.
virtual std::string name() const
RequestorID requestorId() const
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
memory::PhysicalMemory physmem
const Params & params() const
static std::vector< System * > systemList
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Base class for KVM based CPU models.
An abstract memory represents a contiguous block of physical memory, with an associated address range...
uint64_t Tick
Tick count type.
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
RequestorID getGlobalRequestorId(const std::string &requestor_name)
Registers a GLOBAL RequestorID, which is a RequestorID not related to any particular SimObject; since...
@ intRequestorId
This requestor id is used for message signaled interrupts.
@ wbRequestorId
This requestor id is used for writeback requests by the caches.
RequestorID getRequestorId(const SimObject *requestor, std::string subrequestor={})
Request an id used to create a request object in the system.
Addr memSize() const
Amount of physical memory that exists.
enums::MemoryMode memoryMode
Abstract superclass for simulation objects.
@ Drained
Buffers drained, ready for serialization/handover.
const_iterator begin() const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool remove(PCEvent *event) override
virtual void setContextId(ContextID id)=0
#define DPRINTFS(x, s,...)
bool trapToGdb(int signal, ContextID ctx_id)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
virtual void regStats()
Callback to set stat parameters.
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...
bool trapToGdb(int signal, ContextID ctx_id) const
bool isDeviceMemAddr(const PacketPtr &pkt) const
Similar to isMemAddr but for devices.
#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.
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
Ports are used to interface objects to each other.
AddrRangeList ShadowRomRanges
virtual void replaceThreadContext(ThreadContext *tc)
Thread & thread(ContextID id)
@ Halting
Trying to exit and waiting for an event to completely exit.
int ContextID
Globally unique thread context ID.
void serialize(CheckpointOut &cp) const override
Serialize an object.
const AddrRange _m5opRange
Range for memory-mapped m5 pseudo ops.
static void printSystems()
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.
bool validKvmEnvironment() const
Verify gem5 configuration will support KVM emulation.
void registerThreadContext(ThreadContext *tc, ContextID assigned=InvalidContextID)
std::ostream CheckpointOut
void replaceThreadContext(ThreadContext *tc, ContextID context_id)
virtual BaseCPU * getCpuPtr()=0
uint64_t totalSize() const
Get the total physical memory size.
@ invldRequestorId
Invalid requestor id for assertion checking only.
void insert(ThreadContext *tc, ContextID id=InvalidContextID)
virtual bool schedule(PCEvent *event)=0
virtual void setSystem(System *sys)
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
virtual void registerThreadContext(ThreadContext *tc)
ThreadContext * findFree()
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
AddrRange getAddrRange() const
Get address range to which this packet belongs.
const unsigned int _cacheLineSize
ThermalModel * thermalModel
Generated on Wed May 4 2022 12:13:49 for gem5 by doxygen 1.8.17