gem5
|
#include <gic.hh>
Public Member Functions | |
MuxingKvmGic (const MuxingKvmGicParams *p) | |
~MuxingKvmGic () | |
void | loadState (CheckpointIn &cp) override |
loadState() is called on each SimObject when restoring from a checkpoint. More... | |
void | startup () override |
startup() is the final initialization call before simulation. More... | |
DrainState | drain () override |
Notify an object that it needs to drain its state. More... | |
void | drainResume () override |
Resume execution after a successful drain. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
Tick | read (PacketPtr pkt) override |
Pure virtual function that the device must implement. More... | |
Tick | write (PacketPtr pkt) override |
Pure virtual function that the device must implement. More... | |
void | sendInt (uint32_t num) override |
Post an interrupt from a device that is connected to the GIC. More... | |
void | clearInt (uint32_t num) override |
Clear an interrupt from a device that is connected to the GIC. More... | |
void | sendPPInt (uint32_t num, uint32_t cpu) override |
Interface call for private peripheral interrupts. More... | |
void | clearPPInt (uint32_t num, uint32_t cpu) override |
![]() | |
const Params * | params () const |
Pl390 (const Params *p) | |
DrainState | drain () override |
Notify an object that it needs to drain its state. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
AddrRangeList | getAddrRanges () const override |
Every PIO device is obliged to provide an implementation that returns the address ranges the device responds to. More... | |
Tick | read (PacketPtr pkt) override |
A PIO read to the device, immediately split up into readDistributor() or readCpu() More... | |
Tick | write (PacketPtr pkt) override |
A PIO read to the device, immediately split up into writeDistributor() or writeCpu() More... | |
void | sendInt (uint32_t number) override |
Post an interrupt from a device that is connected to the GIC. More... | |
void | clearInt (uint32_t number) override |
Clear an interrupt from a device that is connected to the GIC. More... | |
void | sendPPInt (uint32_t num, uint32_t cpu) override |
Interface call for private peripheral interrupts. More... | |
void | clearPPInt (uint32_t num, uint32_t cpu) override |
void | driveSPI (uint32_t spi) |
void | driveLegIRQ (bool state) |
void | driveLegFIQ (bool state) |
void | driveIrqEn (bool state) |
![]() | |
BaseGic (const Params *p) | |
virtual | ~BaseGic () |
const Params * | params () const |
![]() | |
PioDevice (const Params *p) | |
virtual | ~PioDevice () |
const Params * | params () const |
virtual void | init () |
init() is called after all C++ SimObjects have been created and all ports are connected. More... | |
virtual BaseSlavePort & | getSlavePort (const std::string &if_name, PortID idx=InvalidPortID) |
Get a slave port with a given name and index. More... | |
![]() | |
const Params * | params () const |
MemObject (const Params *params) | |
virtual BaseMasterPort & | getMasterPort (const std::string &if_name, PortID idx=InvalidPortID) |
Get a master port with a given name and index. More... | |
![]() | |
ClockedObject (const ClockedObjectParams *p) | |
const Params * | params () const |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
Enums::PwrState | pwrState () const |
std::string | pwrStateName () const |
std::vector< double > | pwrStateWeights () const |
Returns the percentage residency for each power state. More... | |
void | computeStats () |
Record stats values like state residency by computing the time difference from previous update. More... | |
void | pwrState (Enums::PwrState) |
void | regStats () override |
Register statistics for this object. More... | |
![]() | |
const Params * | params () const |
SimObject (const Params *_params) | |
virtual | ~SimObject () |
virtual const std::string | name () const |
virtual void | initState () |
initState() is called on each SimObject when not restoring from a checkpoint. More... | |
virtual void | resetStats () |
Reset statistics associated with this object. More... | |
virtual void | regProbePoints () |
Register probe points for this object. 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... | |
![]() | |
EventManager (EventManager &em) | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
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) |
void | setCurTick (Tick newVal) |
![]() | |
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... | |
virtual void | notifyFork () |
Notify a child process of a fork. More... | |
![]() | |
void | updateClockPeriod () const |
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 |
Protected Member Functions | |
bool | validKvmEnvironment () const |
Verify gem5 configuration will support KVM emulation. More... | |
![]() | |
BitUnion32 (SWI) Bitfield<3 | |
EndBitUnion (SWI) BitUnion32(IAR) Bitfield<9 | |
BankedRegs & | getBankedRegs (ContextID) |
uint32_t & | getIntEnabled (ContextID ctx, uint32_t ix) |
uint32_t & | getPendingInt (ContextID ctx, uint32_t ix) |
uint32_t & | getActiveInt (ContextID ctx, uint32_t ix) |
uint8_t & | getIntPriority (ContextID ctx, uint32_t ix) |
uint8_t | getCpuTarget (ContextID ctx, uint32_t ix) |
uint8_t | getCpuPriority (unsigned cpu) |
void | softInt (ContextID ctx, SWI swi) |
software generated interrupt More... | |
void | updateIntState (int hint) |
See if some processor interrupt flags need to be enabled/disabled. More... | |
void | updateRunPri () |
Update the register that records priority of the highest priority active interrupt. More... | |
uint64_t | genSwiMask (int cpu) |
generate a bit mask to check cpuSgi for an interrupt. More... | |
int | intNumToWord (int num) const |
int | intNumToBit (int num) const |
void | postInt (uint32_t cpu, Tick when) |
Post an interrupt to a CPU with a delay. More... | |
void | postDelayedInt (uint32_t cpu) |
Deliver a delayed interrupt to the target CPU. More... | |
Tick | readDistributor (PacketPtr pkt) |
Handle a read to the distributor portion of the GIC. More... | |
uint32_t | readDistributor (ContextID ctx, Addr daddr, size_t resp_sz) |
uint32_t | readDistributor (ContextID ctx, Addr daddr) override |
Tick | readCpu (PacketPtr pkt) |
Handle a read to the cpu portion of the GIC. More... | |
uint32_t | readCpu (ContextID ctx, Addr daddr) override |
Tick | writeDistributor (PacketPtr pkt) |
Handle a write to the distributor portion of the GIC. More... | |
void | writeDistributor (ContextID ctx, Addr daddr, uint32_t data, size_t data_sz) |
void | writeDistributor (ContextID ctx, Addr daddr, uint32_t data) override |
Tick | writeCpu (PacketPtr pkt) |
Handle a write to the cpu portion of the GIC. More... | |
void | writeCpu (ContextID ctx, Addr daddr, uint32_t data) override |
![]() | |
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... | |
Protected Attributes | |
System & | system |
System this interrupt controller belongs to. More... | |
KvmKernelGicV2 * | kernelGic |
Kernel GIC device. More... | |
![]() | |
sgi_id | |
Bitfield< 23, 16 > | cpu_list |
Bitfield< 25, 24 > | list_type |
ack_id | |
Bitfield< 12, 10 > | cpu_id |
EndBitUnion(IAR) protected const AddrRange | cpuRange |
Address range for the distributor interface. More... | |
const AddrRangeList | addrRanges |
All address ranges used by this GIC. More... | |
const Tick | distPioDelay |
Latency for a distributor operation. More... | |
const Tick | cpuPioDelay |
Latency for a cpu operation. More... | |
const Tick | intLatency |
Latency for a interrupt to get to CPU. More... | |
bool | enabled |
Gic enabled. More... | |
const bool | haveGem5Extensions |
Are gem5 extensions available? More... | |
bool | gem5ExtensionsEnabled |
gem5 many-core extension enabled by driver More... | |
uint32_t | itLines |
Number of itLines enabled. More... | |
std::vector< BankedRegs * > | bankedRegs |
uint32_t | intEnabled [INT_BITS_MAX-1] |
GICD_I{S,C}ENABLER{1..31} interrupt enable bits for global interrupts 1b per interrupt, 32 bits per word, 31 words. More... | |
uint32_t | pendingInt [INT_BITS_MAX-1] |
GICD_I{S,C}PENDR{1..31} interrupt pending bits for global interrupts 1b per interrupt, 32 bits per word, 31 words. More... | |
uint32_t | activeInt [INT_BITS_MAX-1] |
GICD_I{S,C}ACTIVER{1..31} interrupt active bits for global interrupts 1b per interrupt, 32 bits per word, 31 words. More... | |
uint32_t | iccrpr [CPU_MAX] |
read only running priority register, 1 per cpu More... | |
uint8_t | intPriority [GLOBAL_INT_LINES] |
GICD_IPRIORITYR{8..255} an 8 bit priority (lower is higher priority) for each of the global (not replicated per CPU) interrupts. More... | |
uint8_t | cpuTarget [GLOBAL_INT_LINES] |
GICD_ITARGETSR{8..255} an 8 bit cpu target id for each global interrupt. More... | |
uint32_t | intConfig [INT_BITS_MAX *2] |
2 bit per interrupt signaling if it's level or edge sensitive and if it is 1:N or N:N More... | |
bool | cpuEnabled [CPU_MAX] |
CPU enabled. More... | |
uint8_t | cpuPriority [CPU_MAX] |
CPU priority. More... | |
uint8_t | cpuBpr [CPU_MAX] |
Binary point registers. More... | |
uint32_t | cpuHighestInt [CPU_MAX] |
highest interrupt that is interrupting CPU More... | |
uint64_t | cpuSgiPending [SGI_MAX] |
One bit per cpu per software interrupt that is pending for each possible sgi source. More... | |
uint64_t | cpuSgiActive [SGI_MAX] |
uint32_t | cpuSgiPendingExt [CPU_MAX] |
SGI pending arrays for gem5 GIC extension mode, which instead keeps 16 SGI pending bits for each of the (large number of) CPUs. More... | |
uint32_t | cpuSgiActiveExt [CPU_MAX] |
uint32_t | cpuPpiPending [CPU_MAX] |
One bit per private peripheral interrupt. More... | |
uint32_t | cpuPpiActive [CPU_MAX] |
bool | irqEnable |
IRQ Enable Used for debug. More... | |
PostIntEvent * | postIntEvent [CPU_MAX] |
int | pendingDelayedInterrupts |
![]() | |
Platform * | platform |
Platform this GIC belongs to. More... | |
![]() | |
System * | sys |
PioPort | pioPort |
The pioPort that handles the requests for us and provides us requests that it sees. More... | |
![]() | |
Enums::PwrState | _currPwrState |
To keep track of the current power state. More... | |
Tick | prvEvalTick |
Stats::Scalar | numPwrStateTransitions |
Stats::Distribution | pwrStateClkGateDist |
Stats::Vector | pwrStateResidencyTicks |
![]() | |
const SimObjectParams * | _params |
Cached copy of the object parameters. More... | |
![]() | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Private Member Functions | |
void | fromPl390ToKvm () |
Multiplexing implementation. More... | |
void | fromKvmToPl390 () |
void | copyGicState (BaseGicRegisters *from, BaseGicRegisters *to) |
void | copyDistRegister (BaseGicRegisters *from, BaseGicRegisters *to, ContextID ctx, Addr daddr) |
void | copyCpuRegister (BaseGicRegisters *from, BaseGicRegisters *to, ContextID ctx, Addr daddr) |
void | copyBankedDistRange (BaseGicRegisters *from, BaseGicRegisters *to, Addr daddr, size_t size) |
void | clearBankedDistRange (BaseGicRegisters *to, Addr daddr, size_t size) |
void | copyDistRange (BaseGicRegisters *from, BaseGicRegisters *to, Addr daddr, size_t size) |
void | clearDistRange (BaseGicRegisters *to, Addr daddr, size_t size) |
Private Attributes | |
bool | usingKvm |
Additional Inherited Members | |
![]() | |
typedef Pl390Params | Params |
![]() | |
typedef struct BaseGicParams | Params |
![]() | |
typedef PioDeviceParams | Params |
![]() | |
typedef MemObjectParams | Params |
![]() | |
typedef ClockedObjectParams | Params |
Parameters of ClockedObject. More... | |
![]() | |
typedef SimObjectParams | Params |
![]() | |
static void | serializeAll (CheckpointOut &cp) |
Serialize 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 const std::string & | currentSection () |
Get the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
static void | unserializeGlobals (CheckpointIn &cp) |
![]() | |
static int | ckptCount = 0 |
static int | ckptMaxCount = 0 |
static int | ckptPrevCount = -1 |
![]() | |
enum | { GICD_CTLR = 0x000, GICD_TYPER = 0x004, GICD_IIDR = 0x008, GICD_SGIR = 0xf00, DIST_SIZE = 0xfff } |
enum | { GICC_CTLR = 0x00, GICC_PMR = 0x04, GICC_BPR = 0x08, GICC_IAR = 0x0C, GICC_EOIR = 0x10, GICC_RPR = 0x14, GICC_HPPIR = 0x18, GICC_ABPR = 0x1c, GICC_IIDR = 0xfc, CPU_SIZE = 0xff } |
![]() | |
static const AddrRange | GICD_IGROUPR |
static const AddrRange | GICD_ISENABLER |
static const AddrRange | GICD_ICENABLER |
static const AddrRange | GICD_ISPENDR |
static const AddrRange | GICD_ICPENDR |
static const AddrRange | GICD_ISACTIVER |
static const AddrRange | GICD_ICACTIVER |
static const AddrRange | GICD_IPRIORITYR |
static const AddrRange | GICD_ITARGETSR |
static const AddrRange | GICD_ICFGR |
static const int | SGI_MAX = 16 |
static const int | PPI_MAX = 16 |
static const int | SGI_MASK = 0xFFFF0000 |
Mask off SGI's when setting/clearing pending bits. More... | |
static const int | NN_CONFIG_MASK = 0x55555555 |
Mask for bits that config N:N mode in GICD_ICFGR's. More... | |
static const int | CPU_MAX = 256 |
static const int | SPURIOUS_INT = 1023 |
static const int | INT_BITS_MAX = 32 |
static const int | INT_LINES_MAX = 1020 |
static const int | GLOBAL_INT_LINES = INT_LINES_MAX - SGI_MAX - PPI_MAX |
static const int | GICC_BPR_MINIMUM = 2 |
minimum value for Binary Point Register ("IMPLEMENTATION DEFINED"); chosen for consistency with Linux's in-kernel KVM GIC model More... | |
MuxingKvmGic::MuxingKvmGic | ( | const MuxingKvmGicParams * | p | ) |
Definition at line 166 of file gic.cc.
References System::getKvmVM(), kernelGic, system, and ArmISA::vm.
|
private |
Definition at line 332 of file gic.cc.
References System::_numContexts, ArmISA::a, X86ISA::size(), system, and BaseGicRegisters::writeDistributor().
Referenced by copyGicState().
|
private |
Definition at line 349 of file gic.cc.
References ArmISA::a, X86ISA::size(), and BaseGicRegisters::writeDistributor().
Referenced by copyGicState().
|
overridevirtual |
Clear an interrupt from a device that is connected to the GIC.
Depending on the configuration, the GIC may de-assert it's CPU line.
num | number of interrupt to send |
Implements BaseGic.
Definition at line 262 of file gic.cc.
References Pl390::clearInt(), KvmKernelGicV2::clearSPI(), DPRINTF, kernelGic, and usingKvm.
|
overridevirtual |
Implements BaseGic.
Definition at line 281 of file gic.cc.
References KvmKernelGicV2::clearPPI(), Pl390::clearPPInt(), DPRINTF, kernelGic, and usingKvm.
|
private |
Definition at line 323 of file gic.cc.
References System::_numContexts, ArmISA::a, copyDistRegister(), X86ISA::size(), and system.
Referenced by copyGicState().
|
private |
Definition at line 314 of file gic.cc.
References DPRINTF, BaseGicRegisters::readCpu(), X86ISA::val, and BaseGicRegisters::writeCpu().
Referenced by copyGicState().
|
private |
Definition at line 341 of file gic.cc.
References ArmISA::a, copyDistRegister(), and X86ISA::size().
Referenced by copyGicState().
|
private |
Definition at line 305 of file gic.cc.
References DPRINTF, BaseGicRegisters::readDistributor(), X86ISA::val, and BaseGicRegisters::writeDistributor().
Referenced by copyBankedDistRange(), copyDistRange(), and copyGicState().
|
private |
CPU state (GICC_*)
Distributor state (GICD_*)
Definition at line 357 of file gic.cc.
References System::_numContexts, ArmISA::clear(), clearBankedDistRange(), clearDistRange(), copyBankedDistRange(), copyCpuRegister(), copyDistRange(), copyDistRegister(), Pl390::GICC_BPR, Pl390::GICC_CTLR, Pl390::GICC_PMR, Pl390::GICD_CTLR, Pl390::GICD_ICACTIVER, Pl390::GICD_ICENABLER, Pl390::GICD_ICFGR, Pl390::GICD_ICPENDR, Pl390::GICD_IPRIORITYR, Pl390::GICD_ISACTIVER, Pl390::GICD_ISENABLER, Pl390::GICD_ISPENDR, Pl390::GICD_ITARGETSR, Pl390::itLines, X86ISA::size(), AddrRange::start(), and system.
Referenced by fromKvmToPl390(), and fromPl390ToKvm().
|
overridevirtual |
Notify 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 Drainable.
Definition at line 198 of file gic.cc.
References Pl390::drain(), fromKvmToPl390(), and usingKvm.
|
overridevirtual |
Resume execution after a successful drain.
Reimplemented from Drainable.
Definition at line 206 of file gic.cc.
References Drainable::drainResume(), fromPl390ToKvm(), kernelGic, usingKvm, and validKvmEnvironment().
|
private |
Definition at line 436 of file gic.cc.
References System::_numContexts, copyGicState(), Pl390::cpuPriority, kernelGic, and system.
Referenced by drain().
|
private |
Multiplexing implementation.
Definition at line 430 of file gic.cc.
References copyGicState(), and kernelGic.
Referenced by drainResume(), and startup().
|
overridevirtual |
loadState() is called on each SimObject when restoring from a checkpoint.
The default implementation simply calls unserialize() if there is a corresponding section in the checkpoint. However, objects can override loadState() to get other behaviors, e.g., doing other programmed initializations after unserialize(), or complaining if no checkpoint section is found.
cp | Checkpoint to restore the state from. |
Reimplemented from SimObject.
Definition at line 183 of file gic.cc.
References SimObject::loadState().
Pure virtual function that the device must implement.
Called when a read command is recieved by the port.
pkt | Packet describing this request |
Implements PioDevice.
Definition at line 234 of file gic.cc.
References panic, Pl390::read(), and usingKvm.
|
overridevirtual |
Post an interrupt from a device that is connected to the GIC.
Depending on the configuration, the GIC will pass this interrupt on through to a CPU.
num | number of interrupt to send |
Implements BaseGic.
Definition at line 252 of file gic.cc.
References DPRINTF, kernelGic, Pl390::sendInt(), KvmKernelGicV2::setSPI(), and usingKvm.
|
overridevirtual |
Interface call for private peripheral interrupts.
num | number of interrupt to send |
cpu | CPU to forward interrupt to |
Implements BaseGic.
Definition at line 272 of file gic.cc.
References DPRINTF, kernelGic, Pl390::sendPPInt(), KvmKernelGicV2::setPPI(), and usingKvm.
|
overridevirtual |
Serialize an object.
Output an object's state into the current checkpoint section.
cp | Checkpoint state |
Implements Serializable.
Definition at line 221 of file gic.cc.
References Pl390::serialize().
|
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 SimObject.
Definition at line 189 of file gic.cc.
References fromPl390ToKvm(), kernelGic, SimObject::startup(), usingKvm, and validKvmEnvironment().
|
overridevirtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
cp | Checkpoint state |
Implements Serializable.
Definition at line 228 of file gic.cc.
References Pl390::unserialize().
|
protected |
Verify gem5 configuration will support KVM emulation.
Definition at line 291 of file gic.cc.
References system, and System::threadContexts.
Referenced by drainResume(), and startup().
Pure virtual function that the device must implement.
Called when a write command is recieved by the port.
pkt | Packet describing this request |
Implements PioDevice.
Definition at line 243 of file gic.cc.
References panic, usingKvm, and Pl390::write().
|
protected |
Kernel GIC device.
Definition at line 205 of file gic.hh.
Referenced by clearInt(), clearPPInt(), drainResume(), fromKvmToPl390(), fromPl390ToKvm(), MuxingKvmGic(), sendInt(), sendPPInt(), and startup().
|
protected |
System this interrupt controller belongs to.
Definition at line 202 of file gic.hh.
Referenced by clearBankedDistRange(), copyBankedDistRange(), copyGicState(), fromKvmToPl390(), MuxingKvmGic(), and validKvmEnvironment().
|
private |
Definition at line 208 of file gic.hh.
Referenced by clearInt(), clearPPInt(), drain(), drainResume(), read(), sendInt(), sendPPInt(), startup(), and write().