gem5
v21.1.0.0
|
Base class for KVM based CPU models. More...
#include <base.hh>
Classes | |
class | KVMCpuPort |
KVM memory port. More... | |
struct | StatGroup |
Public Member Functions | |
BaseKvmCPU (const BaseKvmCPUParams ¶ms) | |
virtual | ~BaseKvmCPU () |
void | init () override |
init() is called after all C++ SimObjects have been created and all ports are connected. More... | |
void | startup () override |
startup() is the final initialization call before simulation. More... | |
void | serializeThread (CheckpointOut &cp, ThreadID tid) const override |
Serialize a single thread. More... | |
void | unserializeThread (CheckpointIn &cp, ThreadID tid) override |
Unserialize one thread. More... | |
DrainState | drain () override |
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight. More... | |
void | drainResume () override |
Resume execution after a successful drain. More... | |
void | notifyFork () override |
Notify a child process of a fork. More... | |
void | switchOut () override |
Prepare for another CPU to take over execution. More... | |
void | takeOverFrom (BaseCPU *cpu) override |
Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be switched in. More... | |
void | verifyMemoryMode () const override |
Verify that the system is in a memory mode supported by the CPU. More... | |
Port & | getDataPort () override |
Purely virtual method that returns a reference to the data port. More... | |
Port & | getInstPort () override |
Purely virtual method that returns a reference to the instruction port. More... | |
void | wakeup (ThreadID tid=0) override |
void | activateContext (ThreadID thread_num) override |
Notify the CPU that the indicated context is now active. More... | |
void | suspendContext (ThreadID thread_num) override |
Notify the CPU that the indicated context is now suspended. More... | |
void | deallocateContext (ThreadID thread_num) |
void | haltContext (ThreadID thread_num) override |
Notify the CPU that the indicated context is now halted. More... | |
long | getVCpuID () const |
ThreadContext * | getContext (int tn) override |
Given a thread num get tho thread context for it. More... | |
Counter | totalInsts () const override |
Counter | totalOps () const override |
void | finishMMIOPending () |
Callback from KvmCPUPort to transition the CPU out of RunningMMIOPending when all timing requests have completed. More... | |
virtual void | dump () const |
Dump the internal state to the terminal. More... | |
void | kick () const |
Force an exit from KVM. More... | |
![]() | |
int | cpuId () const |
Reads this CPU's ID. More... | |
uint32_t | socketId () const |
Reads this CPU's Socket ID. More... | |
RequestorID | dataRequestorId () const |
Reads this CPU's unique data requestor ID. More... | |
RequestorID | instRequestorId () const |
Reads this CPU's unique instruction requestor ID. More... | |
Port & | getPort (const std::string &if_name, PortID idx=InvalidPortID) override |
Get a port on this CPU. More... | |
uint32_t | taskId () const |
Get cpu task id. More... | |
void | taskId (uint32_t id) |
Set cpu task id. More... | |
uint32_t | getPid () const |
void | setPid (uint32_t pid) |
void | workItemBegin () |
void | workItemEnd () |
Tick | instCount () |
BaseInterrupts * | getInterruptController (ThreadID tid) |
void | postInterrupt (ThreadID tid, int int_num, int index) |
void | clearInterrupt (ThreadID tid, int int_num, int index) |
void | clearInterrupts (ThreadID tid) |
bool | checkInterrupts (ThreadID tid) const |
Trace::InstTracer * | getTracer () |
Provide access to the tracer pointer. More... | |
int | findContext (ThreadContext *tc) |
Given a Thread Context pointer return the thread num. More... | |
unsigned | numContexts () |
Get the number of thread contexts available. More... | |
ThreadID | contextToThread (ContextID cid) |
Convert ContextID to threadID. More... | |
PARAMS (BaseCPU) | |
BaseCPU (const Params ¶ms, bool is_checker=false) | |
virtual | ~BaseCPU () |
void | regStats () override |
Callback to set stat parameters. More... | |
void | regProbePoints () override |
Register probe points for this object. More... | |
void | registerThreadContexts () |
void | deschedulePowerGatingEvent () |
void | schedulePowerGatingEvent () |
void | flushTLBs () |
Flush all TLBs in the CPU. More... | |
bool | switchedOut () const |
Determine if the CPU is switched out. More... | |
unsigned int | cacheLineSize () const |
Get the cache line size of the system. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize this object to the given output stream. More... | |
void | unserialize (CheckpointIn &cp) override |
Reconstruct the state of this object from a checkpoint. More... | |
void | scheduleInstStop (ThreadID tid, Counter insts, const char *cause) |
Schedule an event that exits the simulation loops after a predefined number of instructions. More... | |
uint64_t | getCurrentInstCount (ThreadID tid) |
Get the number of instructions executed by the specified thread on this CPU. More... | |
void | traceFunctions (Addr pc) |
void | armMonitor (ThreadID tid, Addr address) |
bool | mwait (ThreadID tid, PacketPtr pkt) |
void | mwaitAtomic (ThreadID tid, ThreadContext *tc, BaseMMU *mmu) |
AddressMonitor * | getCpuAddrMonitor (ThreadID tid) |
virtual void | probeInstCommit (const StaticInstPtr &inst, Addr pc) |
Helper method to trigger PMU probes for a committed instruction. More... | |
![]() | |
ClockedObject (const ClockedObjectParams &p) | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
![]() | |
const Params & | params () const |
SimObject (const Params &p) | |
virtual | ~SimObject () |
virtual void | loadState (CheckpointIn &cp) |
loadState() is called on each SimObject when restoring from a checkpoint. More... | |
virtual void | initState () |
initState() is called on each SimObject when not restoring from a checkpoint. More... | |
virtual void | regProbeListeners () |
Register probe listeners for this object. More... | |
ProbeManager * | getProbeManager () |
Get the probe manager for this object. More... | |
DrainState | drain () override |
Provide a default implementation of the drain interface for objects that don't need draining. More... | |
virtual void | memWriteback () |
Write back dirty buffers to memory using functional writes. More... | |
virtual void | memInvalidate () |
Invalidate the contents of memory buffers. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
![]() | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick) -1) |
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. More... | |
void | setCurTick (Tick newVal) |
EventManager (EventManager &em) | |
Event manger manages events in the event queue. More... | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
![]() | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. More... | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. More... | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
![]() | |
DrainState | drainState () const |
Return the current drain state of an object. More... | |
![]() | |
Group (Group *parent, const char *name=nullptr) | |
Construct a new statistics group. More... | |
virtual | ~Group () |
virtual void | resetStats () |
Callback to reset stats. More... | |
virtual void | preDumpStats () |
Callback before stats are dumped. More... | |
void | addStat (statistics::Info *info) |
Register a stat with this group. More... | |
const std::map< std::string, Group * > & | getStatGroups () const |
Get all child groups associated with this object. More... | |
const std::vector< Info * > & | getStats () const |
Get all stats associated with this object. More... | |
void | addStatGroup (const char *name, Group *block) |
Add a stat block as a child of this block. More... | |
const Info * | resolveStat (std::string name) const |
Resolve a stat by its name within this group. More... | |
void | mergeStatGroup (Group *block) |
Merge the contents (stats & children) of a block to this block. More... | |
Group ()=delete | |
Group (const Group &)=delete | |
Group & | operator= (const Group &)=delete |
![]() | |
Named (const std::string &name_) | |
virtual | ~Named ()=default |
virtual std::string | name () const |
![]() | |
void | updateClockPeriod () |
Update the tick to the current tick. More... | |
Tick | clockEdge (Cycles cycles=Cycles(0)) const |
Determine the tick when a cycle begins, by default the current one, but the argument also enables the caller to determine a future cycle. More... | |
Cycles | curCycle () const |
Determine the current cycle, corresponding to a tick aligned to a clock edge. More... | |
Tick | nextCycle () const |
Based on the clock of the object, determine the start tick of the first cycle that is at least one cycle in the future. More... | |
uint64_t | frequency () const |
Tick | clockPeriod () const |
double | voltage () const |
Cycles | ticksToCycles (Tick t) const |
Tick | cyclesToTicks (Cycles c) const |
Public Attributes | |
SimpleThread * | thread |
A cached copy of a thread's state in the form of a SimpleThread object. More... | |
ThreadContext * | tc |
ThreadContext object, provides an interface for external objects to modify this thread's state. More... | |
KvmVM & | vm |
gem5::BaseKvmCPU::StatGroup | stats |
Counter | ctrInsts |
Number of instructions executed by the CPU. More... | |
![]() | |
ThreadID | numThreads |
Number of threads we're actually simulating (<= SMT_MAX_THREADS). More... | |
System * | system |
gem5::BaseCPU::BaseCPUStats | baseStats |
Cycles | syscallRetryLatency |
![]() | |
PowerState * | powerState |
Protected Types | |
enum | Status { Idle, Running, RunningService, RunningMMIOPending, RunningServiceCompletion } |
![]() | |
enum | CPUState { CPU_STATE_ON, CPU_STATE_SLEEP, CPU_STATE_WAKEUP } |
Protected Member Functions | |
void | tick () |
Execute the CPU until the next event in the main event queue or until the guest needs service from gem5. More... | |
virtual uint64_t | getHostCycles () const |
Get the value of the hardware cycle counter in the guest. More... | |
virtual Tick | kvmRun (Tick ticks) |
Request KVM to run the guest for a given number of ticks. More... | |
virtual Tick | kvmRunDrain () |
Request the CPU to run until draining completes. More... | |
struct kvm_run * | getKvmRunState () |
Get a pointer to the kvm_run structure containing all the input and output parameters from kvmRun(). More... | |
uint8_t * | getGuestData (uint64_t offset) const |
Retrieve a pointer to guest data stored at the end of the kvm_run structure. More... | |
void | kvmNonMaskableInterrupt () |
Send a non-maskable interrupt to the guest. More... | |
void | kvmInterrupt (const struct kvm_interrupt &interrupt) |
Send a normal interrupt to the guest. More... | |
std::string | getAndFormatOneReg (uint64_t id) const |
Get and format one register for printout. More... | |
virtual bool | archIsDrained () const |
Is the architecture specific code in a state that prevents draining? More... | |
Tick | doMMIOAccess (Addr paddr, void *data, int size, bool write) |
Inject a memory mapped IO request into gem5. More... | |
int | ioctl (int request, long p1) const |
vCPU ioctl interface. More... | |
int | ioctl (int request, void *p1) const |
int | ioctl (int request) const |
virtual void | ioctlRun () |
Execute the KVM_RUN ioctl. More... | |
void | getRegisters (struct kvm_regs ®s) const |
Get/Set the register state of the guest vCPU. More... | |
void | setRegisters (const struct kvm_regs ®s) |
void | getSpecialRegisters (struct kvm_sregs ®s) const |
void | setSpecialRegisters (const struct kvm_sregs ®s) |
void | getFPUState (struct kvm_fpu &state) const |
Get/Set the guest FPU/vector state. More... | |
void | setFPUState (const struct kvm_fpu &state) |
void | setOneReg (uint64_t id, const void *addr) |
Get/Set single register using the KVM_(SET|GET)_ONE_REG API. More... | |
void | setOneReg (uint64_t id, uint64_t value) |
void | setOneReg (uint64_t id, uint32_t value) |
void | getOneReg (uint64_t id, void *addr) const |
uint64_t | getOneRegU64 (uint64_t id) const |
uint32_t | getOneRegU32 (uint64_t id) const |
virtual void | updateKvmState ()=0 |
Update the KVM state from the current thread context. More... | |
virtual void | updateThreadContext ()=0 |
Update the current thread context with the KVM state. More... | |
void | syncThreadContext () |
Update a thread context if the KVM state is dirty with respect to the cached thread context. More... | |
EventQueue * | deviceEventQueue () |
Get a pointer to the event queue owning devices. More... | |
void | syncKvmState () |
Update the KVM if the thread context is dirty. More... | |
virtual Tick | handleKvmExit () |
Main kvmRun exit handler, calls the relevant handleKvmExit* depending on exit type. More... | |
virtual Tick | handleKvmExitIO () |
The guest performed a legacy IO request (out/inp on x86) More... | |
virtual Tick | handleKvmExitHypercall () |
The guest requested a monitor service using a hypercall. More... | |
virtual Tick | handleKvmExitIRQWindowOpen () |
The guest exited because an interrupt window was requested. More... | |
virtual Tick | handleKvmExitUnknown () |
An unknown architecture dependent error occurred when starting the vCPU. More... | |
virtual Tick | handleKvmExitException () |
An unhandled virtualization exception occured. More... | |
virtual Tick | handleKvmExitFailEntry () |
KVM failed to start the virtualized CPU. More... | |
void | setSignalMask (const sigset_t *mask) |
Set the signal mask used in kvmRun() More... | |
![]() | |
void | updateCycleCounters (CPUState state) |
base method keeping track of cycle progression More... | |
void | enterPwrGating () |
probing::PMUUPtr | pmuProbePoint (const char *name) |
Helper method to instantiate probe points belonging to this object. More... | |
![]() | |
Drainable () | |
virtual | ~Drainable () |
void | signalDrainDone () const |
Signal that an object is drained. More... | |
![]() | |
Clocked (ClockDomain &clk_domain) | |
Create a clocked object and set the clock domain based on the parameters. More... | |
Clocked (Clocked &)=delete | |
Clocked & | operator= (Clocked &)=delete |
virtual | ~Clocked () |
Virtual destructor due to inheritance. More... | |
void | resetClock () const |
Reset the object's clock using the current global tick value. More... | |
virtual void | clockPeriodUpdated () |
A hook subclasses can implement so they can do any extra work that's needed when the clock rate is changed. More... | |
Protected Attributes | |
Status | _status |
CPU run state. More... | |
KVMCpuPort | dataPort |
Port for data requests. More... | |
KVMCpuPort | instPort |
Unused dummy port for the instruction interface. More... | |
const bool | alwaysSyncTC |
Be conservative and always synchronize the thread context on KVM entry/exit. More... | |
bool | threadContextDirty |
Is the gem5 context dirty? Set to true to force an update of the KVM vCPU state upon the next call to kvmRun(). More... | |
bool | kvmStateDirty |
Is the KVM state dirty? Set to true to force an update of the KVM vCPU state upon the next call to kvmRun(). More... | |
const long | vcpuID |
KVM internal ID of the vCPU. More... | |
pthread_t | vcpuThread |
ID of the vCPU thread. More... | |
![]() | |
Tick | instCnt |
Instruction count used for SPARC misc register. More... | |
int | _cpuId |
const uint32_t | _socketId |
Each cpu will have a socket ID that corresponds to its physical location in the system. More... | |
RequestorID | _instRequestorId |
instruction side request id that must be placed in all requests More... | |
RequestorID | _dataRequestorId |
data side request id that must be placed in all requests More... | |
uint32_t | _taskId |
An intrenal representation of a task identifier within gem5. More... | |
uint32_t | _pid |
The current OS process ID that is executing on this processor. More... | |
bool | _switchedOut |
Is the CPU switched out or active? More... | |
const unsigned int | _cacheLineSize |
Cache the cache line size that we get from the system. More... | |
std::vector< BaseInterrupts * > | interrupts |
std::vector< ThreadContext * > | threadContexts |
Trace::InstTracer * | tracer |
Cycles | previousCycle |
CPUState | previousState |
const Cycles | pwrGatingLatency |
const bool | powerGatingOnIdle |
EventFunctionWrapper | enterPwrGatingEvent |
probing::PMUUPtr | ppRetiredInsts |
Instruction commit probe point. More... | |
probing::PMUUPtr | ppRetiredInstsPC |
probing::PMUUPtr | ppRetiredLoads |
Retired load instructions. More... | |
probing::PMUUPtr | ppRetiredStores |
Retired store instructions. More... | |
probing::PMUUPtr | ppRetiredBranches |
Retired branches (any type) More... | |
probing::PMUUPtr | ppAllCycles |
CPU cycle counter even if any thread Context is suspended. More... | |
probing::PMUUPtr | ppActiveCycles |
CPU cycle counter, only counts if any thread contexts is active. More... | |
ProbePointArg< bool > * | ppSleeping |
ProbePoint that signals transitions of threadContexts sets. More... | |
![]() | |
const SimObjectParams & | _params |
Cached copy of the object parameters. More... | |
![]() | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Private Member Functions | |
Tick | flushCoalescedMMIO () |
Service MMIO requests in the mmioRing. More... | |
void | setupSignalHandler () |
Setup a signal handler to catch the timer signal used to switch back to the monitor. More... | |
bool | discardPendingSignal (int signum) const |
Discard a (potentially) pending signal. More... | |
void | startupThread () |
Thread-specific initialization. More... | |
bool | tryDrain () |
Try to drain the CPU if a drain is pending. More... | |
void | setupInstStop () |
Setup an instruction break if there is one pending. More... | |
Private Attributes | |
int | vcpuFD |
KVM vCPU file descriptor. More... | |
int | vcpuMMapSize |
Size of MMAPed kvm_run area. More... | |
struct kvm_run * | _kvmRun |
Pointer to the kvm_run structure used to communicate parameters with KVM. More... | |
struct kvm_coalesced_mmio_ring * | mmioRing |
Coalesced MMIO ring buffer. More... | |
const long | pageSize |
Cached page size of the host. More... | |
EventFunctionWrapper | tickEvent |
std::unique_ptr< BaseKvmTimer > | runTimer |
Timer used to force execution into the monitor after a specified number of simulation tick equivalents have executed in the guest. More... | |
float | hostFactor |
Host factor as specified in the configuration. More... | |
uint64_t | activeInstPeriod |
Currently active instruction count breakpoint. More... | |
PerfKvmCounter | hwCycles |
Guest cycle counter. More... | |
PerfKvmCounter | hwInstructions |
Guest instruction counter. More... | |
bool | perfControlledByTimer |
Does the runTimer control the performance counters? More... | |
void | setupCounters () |
Setup hardware performance counters. More... | |
void | setupInstCounter (uint64_t period=0) |
Setup the guest instruction counter. More... | |
Additional Inherited Members | |
![]() | |
using | Params = ClockedObjectParams |
Parameters of ClockedObject. More... | |
![]() | |
typedef SimObjectParams | Params |
![]() | |
static int | numSimulatedCPUs () |
static Counter | numSimulatedInsts () |
static Counter | numSimulatedOps () |
![]() | |
static void | serializeAll (const std::string &cpt_dir) |
Create a checkpoint by serializing all SimObjects in the system. More... | |
static SimObject * | find (const char *name) |
Find the SimObject with the given name and return a pointer to it. More... | |
static void | setSimObjectResolver (SimObjectResolver *resolver) |
There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. More... | |
static SimObjectResolver * | getSimObjectResolver () |
There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. More... | |
![]() | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. More... | |
static void | generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream) |
Generate a checkpoint file so that the serialization can be routed to it. More... | |
![]() | |
static const uint32_t | invldPid = std::numeric_limits<uint32_t>::max() |
Invalid or unknown Pid. More... | |
![]() | |
static std::unique_ptr< GlobalStats > | globalStats |
Pointer to the global stat structure. More... | |
Base class for KVM based CPU models.
All architecture specific KVM implementation should inherit from this class. The most basic CPU models only need to override the updateKvmState() and updateThreadContext() methods to implement state synchronization between gem5 and KVM.
The architecture specific implementation is also responsible for delivering interrupts into the VM. This is typically done by overriding tick() and checking the thread context before entering into the VM. In order to deliver an interrupt, the implementation then calls KvmVM::setIRQLine() or BaseKvmCPU::kvmInterrupt() depending on the specifics of the underlying hardware/drivers.
|
protected |
gem5::BaseKvmCPU::BaseKvmCPU | ( | const BaseKvmCPUParams & | params | ) |
|
virtual |
Definition at line 101 of file base.cc.
References _kvmRun, vcpuFD, and vcpuMMapSize.
|
overridevirtual |
Notify the CPU that the indicated context is now active.
Reimplemented from gem5::BaseCPU.
Definition at line 493 of file base.cc.
References _status, gem5::BaseCPU::baseStats, gem5::Clocked::clockEdge(), DPRINTF, Idle, gem5::ThreadState::lastActivate, gem5::ThreadState::lastSuspend, gem5::BaseCPU::BaseCPUStats::numCycles, Running, gem5::EventManager::schedule(), gem5::Event::scheduled(), thread, tickEvent, and gem5::Clocked::ticksToCycles().
|
inlineprotectedvirtual |
Is the architecture specific code in a state that prevents draining?
This method should return false if there are any pending events in the guest vCPU that won't be carried over to the gem5 state and thus will prevent correct checkpointing or CPU handover. It might, for example, check for pending interrupts that have been passed to the vCPU but not acknowledged by the OS. Architecures implementing this method must override kvmRunDrain().
Reimplemented in gem5::X86KvmCPU.
Definition at line 532 of file base.hh.
Referenced by drain(), and tryDrain().
void gem5::BaseKvmCPU::deallocateContext | ( | ThreadID | thread_num | ) |
Definition at line 535 of file base.cc.
References suspendContext().
|
inlineprotected |
Get a pointer to the event queue owning devices.
Devices always live in a separate device event queue when running in multi-core mode. We need to temporarily migrate to this queue when accessing devices. By convention, devices and the VM use the same event queue.
Definition at line 438 of file base.hh.
References gem5::EventManager::eventQueue(), and vm.
Referenced by doMMIOAccess(), gem5::X86KvmCPU::handleKvmExitIO(), gem5::ArmV8KvmCPU::updateKvmState(), and gem5::ArmV8KvmCPU::updateThreadContext().
|
private |
Inject a memory mapped IO request into gem5.
paddr | Physical address |
data | Pointer to the source/destination buffer |
size | Memory access size |
write | True if write, False if read |
Definition at line 1079 of file base.cc.
References gem5::Clocked::clockPeriod(), gem5::ThreadContext::contextId(), data, dataPort, gem5::BaseCPU::dataRequestorId(), gem5::Packet::dataStatic(), deviceEventQueue(), gem5::BaseMMU::finalizePhysical(), gem5::ThreadContext::getMMUPtr(), gem5::SimpleThread::getTC(), gem5::ThreadContext::instAddr(), gem5::NoFault, gem5::BaseMMU::Read, gem5::MemCmd::ReadReq, gem5::ThreadContext::setNPC(), gem5::BaseKvmCPU::KVMCpuPort::submitIO(), syncThreadContext(), tc, thread, threadContextDirty, gem5::Request::UNCACHEABLE, warn, gem5::BaseMMU::Write, and gem5::MemCmd::WriteReq.
Referenced by flushCoalescedMMIO(), and handleKvmExit().
|
overridevirtual |
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight.
Draining is mostly used before forking and creating a check point.
This function notifies an object that it needs to drain its state.
If the object does not need further simulation to drain internal buffers, it returns DrainState::Drained and automatically switches to the Drained state. If the object needs more simulation, it returns DrainState::Draining and automatically enters the Draining state. Other return values are invalid.
Implements gem5::Drainable.
Definition at line 313 of file base.cc.
References _status, archIsDrained(), gem5::EventManager::deschedule(), DPRINTF, gem5::Drained, gem5::Draining, gem5::EventManager::eventQueue(), GEM5_FALLTHROUGH, Idle, gem5::X86ISA::lock, panic, Running, RunningMMIOPending, RunningService, RunningServiceCompletion, gem5::Event::scheduled(), gem5::BaseCPU::switchedOut(), syncThreadContext(), and tickEvent.
|
overridevirtual |
Resume execution after a successful drain.
Reimplemented from gem5::Drainable.
Definition at line 384 of file base.cc.
References _status, gem5::ThreadContext::Active, DPRINTF, Idle, gem5::Clocked::nextCycle(), Running, gem5::EventManager::schedule(), gem5::Event::scheduled(), gem5::ThreadContext::status(), gem5::BaseCPU::switchedOut(), tc, tickEvent, and verifyMemoryMode().
|
virtual |
Dump the internal state to the terminal.
Reimplemented in gem5::ArmV8KvmCPU, and gem5::X86KvmCPU.
Definition at line 572 of file base.cc.
References inform.
Referenced by handleKvmExit(), handleKvmExitException(), handleKvmExitFailEntry(), handleKvmExitUnknown(), and serializeThread().
void gem5::BaseKvmCPU::finishMMIOPending | ( | ) |
Callback from KvmCPUPort to transition the CPU out of RunningMMIOPending when all timing requests have completed.
Definition at line 225 of file base.cc.
References _status, gem5::Clocked::nextCycle(), RunningMMIOPending, RunningServiceCompletion, gem5::EventManager::schedule(), gem5::Event::scheduled(), and tickEvent.
|
private |
Service MMIO requests in the mmioRing.
Definition at line 1159 of file base.cc.
References doMMIOAccess(), DPRINTF, mmioRing, gem5::BaseKvmCPU::StatGroup::numCoalescedMMIO, and stats.
Referenced by kvmRun().
|
protected |
Get and format one register for printout.
This function call getOneReg() to retrieve the contents of one register and automatically formats it for printing.
Definition at line 884 of file base.cc.
Referenced by gem5::ArmV8KvmCPU::dump(), gem5::ArmKvmCPU::dumpKvmStateCoProc(), gem5::ArmKvmCPU::dumpKvmStateMisc(), gem5::ArmKvmCPU::dumpKvmStateVFP(), gem5::ArmV8KvmCPU::updateKvmState(), and gem5::ArmV8KvmCPU::updateThreadContext().
|
overridevirtual |
Given a thread num get tho thread context for it.
Reimplemented from gem5::BaseCPU.
Definition at line 550 of file base.cc.
References syncThreadContext(), and tc.
|
inlineoverridevirtual |
Purely virtual method that returns a reference to the data port.
All subclasses must implement this method.
Implements gem5::BaseCPU.
Definition at line 108 of file base.hh.
References dataPort.
|
protected |
Get/Set the guest FPU/vector state.
Definition at line 835 of file base.cc.
References ioctl(), and panic.
Referenced by gem5::X86KvmCPU::dumpFpuRegs(), and gem5::X86KvmCPU::updateThreadContext().
|
inlineprotected |
Retrieve a pointer to guest data stored at the end of the kvm_run structure.
This is mainly used for PIO operations (KVM_EXIT_IO).
offset | Offset as specified by the kvm_run structure |
Definition at line 318 of file base.hh.
References _kvmRun, and gem5::ArmISA::offset.
Referenced by gem5::X86KvmCPU::handleIOMiscReg32(), and gem5::X86KvmCPU::handleKvmExitIO().
|
protectedvirtual |
Get the value of the hardware cycle counter in the guest.
This method is supposed to return the total number of cycles executed in hardware mode relative to some arbitrary point in the past. It's mainly used when estimating the number of cycles actually executed by the CPU in kvmRun(). The default behavior of this method is to use the cycles performance counter, but some architectures may want to use internal registers instead.
Reimplemented in gem5::X86KvmCPU.
Definition at line 688 of file base.cc.
References hwCycles, and gem5::PerfKvmCounter::read().
Referenced by kvmRun().
|
inlineoverridevirtual |
Purely virtual method that returns a reference to the instruction port.
All subclasses must implement this method.
Implements gem5::BaseCPU.
Definition at line 109 of file base.hh.
References instPort.
|
inlineprotected |
Get a pointer to the kvm_run structure containing all the input and output parameters from kvmRun().
Definition at line 308 of file base.hh.
References _kvmRun.
Referenced by gem5::X86KvmCPU::handleIOMiscReg32(), gem5::X86KvmCPU::handleKvmExitIO(), gem5::X86KvmCPU::ioctlRun(), gem5::BaseArmKvmCPU::kvmRun(), gem5::X86KvmCPU::kvmRun(), gem5::X86KvmCPU::kvmRunDrain(), and gem5::X86KvmCPU::updateThreadContextSRegs().
|
protected |
Definition at line 867 of file base.cc.
References gem5::X86ISA::addr, gem5::ArmISA::id, ioctl(), panic, and gem5::X86ISA::reg.
Referenced by getOneRegU32(), getOneRegU64(), gem5::BaseArmKvmCPU::ioctlRun(), and gem5::ArmV8KvmCPU::updateThreadContext().
|
inlineprotected |
Definition at line 386 of file base.hh.
References getOneReg().
Referenced by gem5::ArmKvmCPU::dumpKvmStateCoProc(), gem5::ArmKvmCPU::dumpKvmStateCore(), gem5::ArmKvmCPU::updateTCStateCoProc(), and gem5::ArmKvmCPU::updateTCStateCore().
|
inlineprotected |
Definition at line 381 of file base.hh.
References getOneReg().
Referenced by gem5::ArmKvmCPU::updateTCStateCoProc(), gem5::ArmKvmCPU::updateTCStateVFP(), and gem5::ArmV8KvmCPU::updateThreadContext().
|
protected |
Get/Set the register state of the guest vCPU.
KVM has two different interfaces for accessing the state of the guest CPU. One interface updates 'normal' registers and one updates 'special' registers. The distinction between special and normal registers isn't very clear and is architecture dependent.
Definition at line 807 of file base.cc.
References ioctl(), and panic.
Referenced by gem5::X86KvmCPU::dumpIntRegs(), and gem5::X86KvmCPU::updateThreadContext().
|
protected |
Definition at line 821 of file base.cc.
References ioctl(), and panic.
Referenced by gem5::X86KvmCPU::dumpSpecRegs(), and gem5::X86KvmCPU::updateThreadContext().
|
inline |
|
overridevirtual |
Notify the CPU that the indicated context is now halted.
Reimplemented from gem5::BaseCPU.
Definition at line 542 of file base.cc.
References gem5::BaseCPU::CPU_STATE_SLEEP, suspendContext(), and gem5::BaseCPU::updateCycleCounters().
|
protectedvirtual |
Main kvmRun exit handler, calls the relevant handleKvmExit* depending on exit type.
Definition at line 955 of file base.cc.
References _kvmRun, _status, dataPort, doMMIOAccess(), DPRINTF, dump(), handleKvmExitException(), handleKvmExitFailEntry(), handleKvmExitHypercall(), handleKvmExitIO(), handleKvmExitIRQWindowOpen(), handleKvmExitUnknown(), Idle, gem5::BaseKvmCPU::KVMCpuPort::nextIOState(), gem5::BaseKvmCPU::StatGroup::numHalt, gem5::BaseKvmCPU::StatGroup::numHypercalls, gem5::BaseKvmCPU::StatGroup::numIO, gem5::BaseKvmCPU::StatGroup::numMMIO, panic, Running, RunningService, stats, gem5::SimpleThread::suspend(), and thread.
Referenced by tick().
|
protectedvirtual |
An unhandled virtualization exception occured.
Some KVM virtualization drivers return unhandled exceptions to the user-space monitor. This interface is currently only used by the Intel VMX KVM driver.
Definition at line 1062 of file base.cc.
References _kvmRun, dump(), and panic.
Referenced by handleKvmExit().
|
protectedvirtual |
|
protectedvirtual |
The guest requested a monitor service using a hypercall.
Definition at line 1040 of file base.cc.
References panic.
Referenced by handleKvmExit().
|
protectedvirtual |
The guest performed a legacy IO request (out/inp on x86)
Reimplemented in gem5::X86KvmCPU.
Definition at line 1032 of file base.cc.
References _kvmRun, and panic.
Referenced by handleKvmExit().
|
protectedvirtual |
The guest exited because an interrupt window was requested.
The guest exited because an interrupt window was requested (request_interrupt_window in the kvm_run structure was set to 1 before calling kvmRun) and it is now ready to receive
Reimplemented in gem5::X86KvmCPU.
Definition at line 1046 of file base.cc.
References warn.
Referenced by handleKvmExit().
|
protectedvirtual |
An unknown architecture dependent error occurred when starting the vCPU.
The kvm_run data structure contains the hardware error code. The defaults behavior of this method just prints the HW error code and panics. Architecture dependent implementations may want to override this method to provide better, hardware-aware, error messages.
Definition at line 1054 of file base.cc.
References _kvmRun, dump(), and panic.
Referenced by handleKvmExit().
|
overridevirtual |
init() is called after all C++ SimObjects have been created and all ports are connected.
Initializations that are independent of unserialization but rely on a fully instantiated and connected SimObject graph should be done here.
Reimplemented from gem5::BaseCPU.
Definition at line 109 of file base.cc.
References fatal, gem5::BaseCPU::init(), gem5::ThreadContext::initMemProxies(), gem5::BaseCPU::numThreads, and tc.
Referenced by gem5::ArmKvmCPU::kvmArmVCpuInit(), and gem5::BaseArmKvmCPU::kvmArmVCpuInit().
|
protectedvirtual |
Execute the KVM_RUN ioctl.
Reimplemented in gem5::X86KvmCPU, and gem5::BaseArmKvmCPU.
Definition at line 1311 of file base.cc.
References ioctl(), and panic.
Referenced by gem5::BaseArmKvmCPU::ioctlRun(), gem5::X86KvmCPU::ioctlRun(), and kvmRun().
|
inline |
Force an exit from KVM.
Send a signal to the thread owning this vCPU to get it to exit from KVM. Ignored if the vCPU is not executing.
Definition at line 138 of file base.hh.
References KVM_KICK_SIGNAL, and vcpuThread.
Request KVM to run the guest for a given number of ticks.
The method returns the approximate number of ticks executed.
ticks | Number of ticks to execute, set to 0 to exit immediately after finishing pending operations. |
Reimplemented in gem5::X86KvmCPU, gem5::BaseArmKvmCPU, and gem5::ArmKvmCPU.
Definition at line 694 of file base.cc.
References gem5::BaseCPU::baseStats, gem5::Clocked::clockPeriod(), gem5::BaseKvmCPU::StatGroup::committedInsts, ctrInsts, gem5::curEventQueue(), discardPendingSignal(), DPRINTF, fatal_if, flushCoalescedMMIO(), getHostCycles(), hostFactor, hwCycles, hwInstructions, ioctlRun(), kick(), KVM_KICK_SIGNAL, gem5::BaseCPU::BaseCPUStats::numCycles, gem5::BaseKvmCPU::StatGroup::numVMExits, gem5::BaseKvmCPU::StatGroup::numVMHalfEntries, perfControlledByTimer, gem5::PerfKvmCounter::read(), runTimer, gem5::PerfKvmCounter::start(), stats, gem5::PerfKvmCounter::stop(), and vcpuFD.
Referenced by gem5::BaseArmKvmCPU::kvmRun(), gem5::X86KvmCPU::kvmRun(), gem5::ArmKvmCPU::kvmRun(), gem5::X86KvmCPU::kvmRunDrain(), kvmRunDrain(), and tick().
|
protectedvirtual |
Request the CPU to run until draining completes.
This function normally calls kvmRun(0) to make KVM finish pending MMIO operations. Architecures implementing archIsDrained() must override this method.
Reimplemented in gem5::X86KvmCPU.
Definition at line 674 of file base.cc.
References _status, kvmRun(), RunningMMIOPending, and RunningServiceCompletion.
Referenced by tick().
|
overridevirtual |
Notify a child process of a fork.
SimObjects are told that the process is going to be forked.
Forking is a process of splitting a process in to two processes, which is then used for multiprocessing.
When calling fork in gem5, we need to ensure that resources shared between the parent and the child are consistent. This method is intended to be overloaded to handle that. For example, an object could use this method to re-open input files to get a separate file description with a private file offset.
This method is only called in the child of the fork. The call takes place in a drained system.
Reimplemented from gem5::Drainable.
Definition at line 407 of file base.cc.
References _kvmRun, _status, gem5::PerfKvmCounter::detach(), hwCycles, hwInstructions, Idle, gem5::Event::scheduled(), tickEvent, vcpuFD, vcpuMMapSize, and warn.
|
overridevirtual |
Serialize a single thread.
cp | The stream to serialize to. |
tid | ID of the current thread. |
Reimplemented from gem5::BaseCPU.
Definition at line 289 of file base.cc.
References _status, DPRINTF, dump(), Idle, gem5::SimpleThread::serialize(), and thread.
|
protected |
Definition at line 842 of file base.cc.
References ioctl(), and panic.
Referenced by gem5::X86KvmCPU::updateKvmStateFPULegacy().
|
protected |
Get/Set single register using the KVM_(SET|GET)_ONE_REG API.
Definition at line 850 of file base.cc.
References gem5::X86ISA::addr, gem5::ArmISA::id, ioctl(), panic, and gem5::X86ISA::reg.
Referenced by gem5::BaseArmKvmCPU::ioctlRun(), gem5::ArmV8KvmCPU::startup(), gem5::ArmV8KvmCPU::updateKvmState(), gem5::ArmKvmCPU::updateKvmStateCoProc(), gem5::ArmKvmCPU::updateKvmStateCore(), and gem5::ArmKvmCPU::updateKvmStateVFP().
|
inlineprotected |
|
inlineprotected |
|
protected |
Definition at line 814 of file base.cc.
References ioctl(), and panic.
Referenced by gem5::X86KvmCPU::updateKvmStateRegs().
|
protected |
Set the signal mask used in kvmRun()
This method allows the signal mask of the thread executing kvmRun() to be overridden inside the actual system call. This allows us to mask timer signals used to force KVM exits while in gem5.
The signal mask can be disabled by setting it to NULL.
mask | Signals to mask |
Definition at line 1129 of file base.cc.
References ioctl(), gem5::mask(), and panic.
Referenced by setupSignalHandler().
|
protected |
Definition at line 828 of file base.cc.
References ioctl(), and panic.
Referenced by gem5::X86KvmCPU::updateKvmStateSRegs().
|
private |
Setup hardware performance counters.
Definition at line 1258 of file base.cc.
References gem5::PerfKvmCounter::attach(), gem5::PerfKvmCounterConfig::disabled(), DPRINTF, gem5::PerfKvmCounterConfig::exclude_host(), gem5::PerfKvmCounterConfig::exclude_hv(), hwCycles, perfControlledByTimer, gem5::PerfKvmCounterConfig::pinned(), gem5::PerfKvmCounterConfig::samplePeriod(), setupInstCounter(), and gem5::PerfKvmCounterConfig::wakeupEvents().
Referenced by startupThread().
|
private |
Setup the guest instruction counter.
Setup the guest instruction counter and optionally request a signal every N instructions executed by the guest. This method will re-attach the counter if the counter has already been attached and its sampling settings have changed.
period | Signal period, set to 0 to disable signaling. |
Definition at line 1333 of file base.cc.
References activeInstPeriod, gem5::PerfKvmCounter::attach(), gem5::PerfKvmCounter::attached(), gem5::PerfKvmCounter::detach(), gem5::PerfKvmCounter::enableSignals(), gem5::PerfKvmCounterConfig::exclude_host(), gem5::PerfKvmCounterConfig::exclude_hv(), hwCycles, hwInstructions, KVM_KICK_SIGNAL, gem5::PerfKvmCounterConfig::samplePeriod(), and gem5::PerfKvmCounterConfig::wakeupEvents().
Referenced by setupCounters(), and setupInstStop().
|
private |
Setup an instruction break if there is one pending.
Check if there are pending instruction breaks in the CPU's instruction event queue and schedule an instruction break using PerfEvent.
Definition at line 1321 of file base.cc.
References gem5::SimpleThread::comInstEventQueue, ctrInsts, gem5::EventQueue::empty(), gem5::EventQueue::nextTick(), setupInstCounter(), and thread.
Referenced by tick().
|
private |
Setup a signal handler to catch the timer signal used to switch back to the monitor.
Definition at line 1201 of file base.cc.
References KVM_KICK_SIGNAL, gem5::onKickSignal(), panic, gem5::ArmISA::sa, and setSignalMask().
Referenced by startupThread().
|
overridevirtual |
startup() is the final initialization call before simulation.
All state is initialized (including unserialized state, if any, such as the curTick() value), so this is the appropriate place to schedule initial event(s) for objects that need them.
Reimplemented from gem5::BaseCPU.
Reimplemented in gem5::X86KvmCPU.
Definition at line 120 of file base.cc.
References _kvmRun, gem5::Kvm::capCoalescedMMIO(), gem5::KvmVM::cpuStartup(), gem5::KvmVM::createVCPU(), gem5::curTick(), gem5::Kvm::getVCPUMMapSize(), inform, gem5::KvmVM::kvm, mmioRing, gem5::Named::name(), gem5::MipsISA::p, pageSize, panic, gem5::SimObject::params(), gem5::EventManager::schedule(), gem5::BaseCPU::startup(), startupThread(), vcpuFD, vcpuID, vcpuMMapSize, and vm.
Referenced by gem5::X86KvmCPU::startup(), gem5::BaseArmKvmCPU::startup(), and gem5::ArmKvmCPU::startup().
|
private |
Thread-specific initialization.
Some KVM-related initialization requires us to know the TID of the thread that is going to execute our event queue. For example, when setting up timers, we need to know the TID of the thread executing in KVM in order to deliver the timer signal to that thread. This method is called as the first event in this SimObject's event queue.
Definition at line 235 of file base.cc.
References hwCycles, KVM_KICK_SIGNAL, gem5::MipsISA::p, gem5::SimObject::params(), runTimer, setupCounters(), setupSignalHandler(), and vcpuThread.
Referenced by startup().
|
overridevirtual |
Notify the CPU that the indicated context is now suspended.
Check if possible to enter a lower power state
Reimplemented from gem5::BaseCPU.
Definition at line 512 of file base.cc.
References _status, gem5::EventManager::deschedule(), DPRINTF, Idle, Running, RunningServiceCompletion, gem5::Event::scheduled(), thread, and tickEvent.
Referenced by deallocateContext(), and haltContext().
|
overridevirtual |
Prepare for another CPU to take over execution.
When this method exits, all internal state should have been flushed. After the method returns, the simulator calls takeOverFrom() on the new CPU with this CPU as its parameter.
Reimplemented from gem5::BaseCPU.
Definition at line 430 of file base.cc.
References _status, DPRINTF, Idle, gem5::Event::scheduled(), gem5::BaseCPU::switchOut(), and tickEvent.
|
protected |
Update the KVM if the thread context is dirty.
Definition at line 943 of file base.cc.
References kvmStateDirty, threadContextDirty, and updateKvmState().
Referenced by tick().
|
protected |
Update a thread context if the KVM state is dirty with respect to the cached thread context.
Definition at line 931 of file base.cc.
References kvmStateDirty, threadContextDirty, and updateThreadContext().
Referenced by gem5::X86KvmCPU::deliverInterrupts(), doMMIOAccess(), drain(), getContext(), gem5::X86KvmCPU::kvmRun(), and tick().
|
overridevirtual |
Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be switched in.
A CPU model implementing this method is expected to initialize its state from the old CPU and connect its memory (unless they are already connected) to the memories connected to the old CPU.
cpu | CPU to initialize read state from. |
Reimplemented from gem5::BaseCPU.
Definition at line 444 of file base.cc.
References _status, DPRINTF, Idle, gem5::Event::scheduled(), gem5::BaseCPU::takeOverFrom(), threadContextDirty, gem5::BaseCPU::threadContexts, tickEvent, and updateKvmState().
|
protected |
Execute the CPU until the next event in the main event queue or until the guest needs service from gem5.
Definition at line 578 of file base.cc.
References _kvmRun, _status, alwaysSyncTC, gem5::Clocked::clockEdge(), gem5::SimpleThread::comInstEventQueue, ctrInsts, gem5::curEventQueue(), gem5::curTick(), DPRINTF, gem5::Draining, gem5::Drainable::drainState(), handleKvmExit(), Idle, kvmRun(), kvmRunDrain(), kvmStateDirty, gem5::MaxTick, gem5::BaseKvmCPU::StatGroup::numExitSignal, panic, Running, RunningMMIOPending, RunningService, RunningServiceCompletion, runTimer, gem5::EventManager::schedule(), setupInstStop(), stats, syncKvmState(), syncThreadContext(), thread, threadContextDirty, tickEvent, gem5::Clocked::ticksToCycles(), and tryDrain().
Referenced by BaseKvmCPU().
|
overridevirtual |
|
overridevirtual |
Implements gem5::BaseCPU.
|
private |
Try to drain the CPU if a drain is pending.
Definition at line 1289 of file base.cc.
References _status, archIsDrained(), DPRINTF, gem5::Draining, gem5::Drainable::drainState(), Idle, Running, and gem5::Drainable::signalDrainDone().
Referenced by tick().
|
overridevirtual |
Unserialize one thread.
cp | The checkpoint use. |
tid | ID of the current thread. |
Reimplemented from gem5::BaseCPU.
Definition at line 302 of file base.cc.
References _status, DPRINTF, Idle, thread, threadContextDirty, and gem5::SimpleThread::unserialize().
|
protectedpure virtual |
Update the KVM state from the current thread context.
The base CPU calls this method before starting the guest CPU when the contextDirty flag is set. The architecture dependent CPU implementation is expected to update all guest state (registers, special registers, and FPU state).
Implemented in gem5::X86KvmCPU, gem5::ArmV8KvmCPU, and gem5::ArmKvmCPU.
Referenced by syncKvmState(), and takeOverFrom().
|
protectedpure virtual |
Update the current thread context with the KVM state.
The base CPU after the guest updates any of the KVM state. In practice, this happens after kvmRun is called. The architecture dependent code is expected to read the state of the guest CPU and update gem5's thread state.
Implemented in gem5::X86KvmCPU, gem5::ArmV8KvmCPU, and gem5::ArmKvmCPU.
Referenced by syncThreadContext().
|
overridevirtual |
Verify that the system is in a memory mode supported by the CPU.
Implementations are expected to query the system for the current memory mode and ensure that it is what the CPU model expects. If the check fails, the implementation should terminate the simulation using fatal().
Reimplemented from gem5::BaseCPU.
Definition at line 466 of file base.cc.
References gem5::System::bypassCaches(), fatal, and gem5::BaseCPU::system.
Referenced by drainResume().
|
overridevirtual |
Implements gem5::BaseCPU.
Definition at line 475 of file base.cc.
References gem5::SimpleThread::activate(), DPRINTF, gem5::EventManager::eventQueue(), kick(), gem5::SimpleThread::status(), gem5::ThreadContext::Suspended, and thread.
|
private |
Pointer to the kvm_run structure used to communicate parameters with KVM.
Definition at line 706 of file base.hh.
Referenced by getGuestData(), getKvmRunState(), handleKvmExit(), handleKvmExitException(), handleKvmExitFailEntry(), handleKvmExitIO(), handleKvmExitUnknown(), notifyFork(), startup(), tick(), and ~BaseKvmCPU().
|
protected |
CPU run state.
Definition at line 240 of file base.hh.
Referenced by activateContext(), drain(), drainResume(), finishMMIOPending(), handleKvmExit(), gem5::X86KvmCPU::kvmRun(), kvmRunDrain(), notifyFork(), serializeThread(), suspendContext(), switchOut(), takeOverFrom(), tick(), tryDrain(), and unserializeThread().
|
private |
Currently active instruction count breakpoint.
Definition at line 746 of file base.hh.
Referenced by setupInstCounter().
|
protected |
Counter gem5::BaseKvmCPU::ctrInsts |
Number of instructions executed by the CPU.
Definition at line 811 of file base.hh.
Referenced by kvmRun(), setupInstStop(), tick(), totalInsts(), and totalOps().
|
protected |
Port for data requests.
Definition at line 624 of file base.hh.
Referenced by doMMIOAccess(), getDataPort(), handleKvmExit(), and gem5::X86KvmCPU::handleKvmExitIO().
|
private |
|
private |
Guest cycle counter.
This is the group leader of all performance counters measuring the guest system. It can be used in conjunction with the PerfKvmTimer (see perfControlledByTimer) to trigger exits from KVM.
Definition at line 756 of file base.hh.
Referenced by getHostCycles(), kvmRun(), notifyFork(), setupCounters(), setupInstCounter(), and startupThread().
|
private |
Guest instruction counter.
This counter is typically only used to measure the number of instructions executed by the guest. However, it can also be used to trigger exits from KVM if the configuration script requests an exit after a certain number of instructions.
Definition at line 769 of file base.hh.
Referenced by kvmRun(), notifyFork(), and setupInstCounter().
|
protected |
Unused dummy port for the instruction interface.
Definition at line 627 of file base.hh.
Referenced by getInstPort().
|
protected |
Is the KVM state dirty? Set to true to force an update of the KVM vCPU state upon the next call to kvmRun().
Definition at line 645 of file base.hh.
Referenced by syncKvmState(), syncThreadContext(), and tick().
|
private |
Coalesced MMIO ring buffer.
NULL if coalesced MMIO is not supported.
Definition at line 711 of file base.hh.
Referenced by flushCoalescedMMIO(), and startup().
|
private |
|
private |
Does the runTimer control the performance counters?
The run timer will automatically enable and disable performance counters if a PerfEvent-based timer is used to control KVM exits.
Definition at line 778 of file base.hh.
Referenced by kvmRun(), and setupCounters().
|
private |
Timer used to force execution into the monitor after a specified number of simulation tick equivalents have executed in the guest.
This counter generates the signal specified by KVM_TIMER_SIGNAL.
Definition at line 787 of file base.hh.
Referenced by kvmRun(), startupThread(), and tick().
gem5::BaseKvmCPU::StatGroup gem5::BaseKvmCPU::stats |
Referenced by flushCoalescedMMIO(), handleKvmExit(), kvmInterrupt(), kvmNonMaskableInterrupt(), kvmRun(), and tick().
ThreadContext* gem5::BaseKvmCPU::tc |
ThreadContext object, provides an interface for external objects to modify this thread's state.
Definition at line 158 of file base.hh.
Referenced by gem5::X86KvmCPU::deliverInterrupts(), doMMIOAccess(), drainResume(), gem5::ArmKvmCPU::dumpKvmStateCoProc(), getContext(), gem5::X86KvmCPU::handleIOMiscReg32(), gem5::X86KvmCPU::handleKvmExitIO(), init(), gem5::X86KvmCPU::ioctlRun(), gem5::BaseArmKvmCPU::startup(), gem5::ArmV8KvmCPU::startup(), gem5::X86KvmCPU::updateCPUID(), gem5::ArmV8KvmCPU::updateKvmState(), gem5::ArmKvmCPU::updateKvmStateCoProc(), gem5::ArmKvmCPU::updateKvmStateCore(), gem5::X86KvmCPU::updateKvmStateFPULegacy(), gem5::X86KvmCPU::updateKvmStateFPUXSave(), gem5::X86KvmCPU::updateKvmStateMSRs(), gem5::X86KvmCPU::updateKvmStateRegs(), gem5::X86KvmCPU::updateKvmStateSRegs(), gem5::ArmKvmCPU::updateKvmStateVFP(), gem5::ArmKvmCPU::updateTCStateCoProc(), gem5::ArmKvmCPU::updateTCStateCore(), gem5::ArmKvmCPU::updateTCStateVFP(), gem5::ArmV8KvmCPU::updateThreadContext(), gem5::X86KvmCPU::updateThreadContext(), gem5::X86KvmCPU::updateThreadContextFPU(), gem5::X86KvmCPU::updateThreadContextMSRs(), gem5::X86KvmCPU::updateThreadContextRegs(), and gem5::X86KvmCPU::updateThreadContextXSave().
SimpleThread* gem5::BaseKvmCPU::thread |
A cached copy of a thread's state in the form of a SimpleThread object.
Normally the actual thread state is stored in the KVM vCPU. If KVM has been running this copy is will be out of date. If we recently handled some events within gem5 that required state to be updated this could be the most up-to-date copy. When getContext() or updateThreadContext() is called this copy gets updated. The method syncThreadContext can be used within a KVM CPU to update the thread context if the KVM state is dirty (i.e., the vCPU has been run since the last update).
Definition at line 153 of file base.hh.
Referenced by activateContext(), gem5::X86KvmCPU::deliverInterrupts(), doMMIOAccess(), handleKvmExit(), serializeThread(), setupInstStop(), suspendContext(), tick(), unserializeThread(), and wakeup().
|
protected |
Is the gem5 context dirty? Set to true to force an update of the KVM vCPU state upon the next call to kvmRun().
Definition at line 639 of file base.hh.
Referenced by gem5::X86KvmCPU::deliverInterrupts(), doMMIOAccess(), syncKvmState(), syncThreadContext(), takeOverFrom(), tick(), and unserializeThread().
|
private |
Definition at line 715 of file base.hh.
Referenced by activateContext(), drain(), drainResume(), finishMMIOPending(), notifyFork(), suspendContext(), switchOut(), takeOverFrom(), and tick().
|
private |
KVM vCPU file descriptor.
Definition at line 695 of file base.hh.
Referenced by ioctl(), kvmRun(), notifyFork(), startup(), and ~BaseKvmCPU().
|
protected |
KVM internal ID of the vCPU.
Definition at line 648 of file base.hh.
Referenced by getVCpuID(), gem5::BaseArmKvmCPU::kvmRun(), gem5::ArmKvmCPU::kvmRun(), and startup().
|
private |
Size of MMAPed kvm_run area.
Definition at line 697 of file base.hh.
Referenced by notifyFork(), startup(), and ~BaseKvmCPU().
|
protected |
ID of the vCPU thread.
Definition at line 651 of file base.hh.
Referenced by kick(), and startupThread().
KvmVM& gem5::BaseKvmCPU::vm |
Definition at line 160 of file base.hh.
Referenced by deviceEventQueue(), gem5::X86KvmCPU::dumpMSRs(), gem5::X86KvmCPU::getMsrIntersection(), gem5::BaseArmKvmCPU::kvmRun(), gem5::ArmKvmCPU::kvmRun(), gem5::BaseArmKvmCPU::startup(), startup(), and gem5::X86KvmCPU::X86KvmCPU().