40 #ifndef __DEV_ARM_GICV3_ITS_H__ 41 #define __DEV_ARM_GICV3_ITS_H__ 47 #include "params/Gicv3Its.hh" 78 friend class ::ItsProcess;
79 friend class ::ItsTranslation;
80 friend class ::ItsCommand;
101 Port & getPort(
const std::string &if_name,
PortID idx)
override;
105 Gicv3Its(
const Gicv3ItsParams *params);
107 void setGIC(
Gicv3 *_gic);
109 static const uint32_t itsControl = 0x0;
110 static const uint32_t itsTranslate = 0x10000;
115 static const uint32_t NUM_BASER_REGS = 8;
120 static const uint64_t BASER_INDIRECT = 0x4000000000000000;
121 static const uint64_t BASER_TYPE = 0x0700000000000000;
122 static const uint64_t BASER_ESZ = 0x001F000000000000;
123 static const uint64_t BASER_SZ = 0x00000000000000FF;
124 static const uint64_t BASER_WMASK =
125 ~(BASER_INDIRECT | BASER_TYPE | BASER_ESZ);
126 static const uint64_t BASER_WMASK_UNIMPL =
127 ~(BASER_INDIRECT | BASER_TYPE | BASER_ESZ | BASER_SZ);
135 GITS_CTLR = itsControl + 0x0000,
136 GITS_IIDR = itsControl + 0x0004,
137 GITS_TYPER = itsControl + 0x0008,
138 GITS_CBASER = itsControl + 0x0080,
139 GITS_CWRITER = itsControl + 0x0088,
140 GITS_CREADR = itsControl + 0x0090,
141 GITS_PIDR2 = itsControl + 0xffe8,
144 GITS_TRANSLATER = itsTranslate + 0x0040
159 Bitfield<31> quiescent;
167 Bitfield<63, 32> high;
175 Bitfield<63, 32> high;
178 Bitfield<61, 59> innerCache;
179 Bitfield<55, 53> outerCache;
181 Bitfield<11, 10> shareability;
187 Bitfield<62> indirect;
188 Bitfield<61, 59> innerCache;
190 Bitfield<55, 53> outerCache;
191 Bitfield<52, 48> entrySize;
193 Bitfield<11, 10> shareability;
194 Bitfield<9, 8> pageSize;
199 Bitfield<63, 32> high;
203 Bitfield<35, 32> cidBits;
204 Bitfield<31, 24> hcc;
207 Bitfield<17, 13> devBits;
208 Bitfield<12, 8> idBits;
209 Bitfield<7, 4> ittEntrySize;
211 Bitfield<1> _virtual;
212 Bitfield<0> physical;
221 uint32_t gitsTranslater;
229 bool idOutOfRange(uint32_t event_id, uint8_t itt_range) const;
236 bool deviceOutOfRange(uint32_t device_id) const;
244 bool sizeOutOfRange(uint32_t size) const;
251 bool collectionOutOfRange(uint32_t collection_id) const;
257 bool lpiOutOfRange(uint32_t intid) const;
260 uint64_t maxCommands() const;
261 void checkCommandQueue();
262 void incrementReadPointer();
266 Bitfield<57, 53> ittRange;
267 Bitfield<52, 1> ittAddress;
272 Bitfield<59, 46> vpeid;
273 Bitfield<45, 30> icid;
274 Bitfield<29, 16> intNumHyp;
275 Bitfield<15, 2> intNum;
281 Bitfield<40, 1> rdBase;
287 VIRTUAL_INTERRUPT = 0,
288 PHYSICAL_INTERRUPT = 1
295 return getRedistributor(cte.rdBase);
306 TRANSLATION_TABLE = 3,
319 void moveAllPendingState(
350 using DTE = Gicv3Its::DTE;
352 using CTE = Gicv3Its::CTE;
360 const std::string
name()
const;
368 void writeDeviceTable(
Yield &yield, uint32_t device_id,
DTE dte);
370 void writeIrqTranslationTable(
371 Yield &yield,
const Addr itt_base, uint32_t event_id,
ITTE itte);
373 void writeIrqCollectionTable(
374 Yield &yield, uint32_t collection_id,
CTE cte);
376 uint64_t readDeviceTable(
377 Yield &yield, uint32_t device_id);
379 uint64_t readIrqTranslationTable(
380 Yield &yield,
const Addr itt_base, uint32_t event_id);
382 uint64_t readIrqCollectionTable(
Yield &yield, uint32_t collection_id);
384 void doRead(
Yield &yield,
Addr addr,
void *ptr,
size_t size);
385 void doWrite(
Yield &yield,
Addr addr,
void *ptr,
size_t size);
386 void terminate(
Yield &yield);
411 translateLPI(
Yield &yield, uint32_t device_id, uint32_t event_id);
471 using ExecFn = std::function<void(ItsCommand*, Yield&, CommandEntry&)>;
474 :
name(_name), exec(_exec)
486 static std::string commandName(uint32_t cmd);
517 return its.idOutOfRange(command.
eventId, dte.ittRange);
522 return its.deviceOutOfRange(command.
deviceId);
527 const auto size =
bits(command.
raw[1], 4, 0);
528 const auto valid =
bits(command.
raw[2], 63);
530 return its.sizeOutOfRange(size);
537 return its.collectionOutOfRange(
bits(command.
raw[2], 15, 0));
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
Ports are used to interface objects to each other.
bool deviceOutOfRange(CommandEntry &command) const
const std::string & name()
EndBitUnion(UserDescFlags) struct UserDesc32
DrainState
Object drain/handover states.
static const AddrRange GITS_BASER
EventFunctionWrapper commandEvent
Overload hash function for BasicBlockRange type.
An ItsTranslation is created whenever a peripheral writes a message in GITS_TRANSLATER (MSI)...
bool sizeOutOfRange(CommandEntry &command) const
int main(int argc, char **argv)
CallerType: A reference to an object of this class will be passed to the coroutine task...
Dispatch entry is a metadata struct which contains information about the command (like the name) and ...
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
bool recvTimingResp(PacketPtr pkt)
std::unordered_map< std::underlying_type< enum CommandType >::type, DispatchEntry > DispatchTable
uint64_t Tick
Tick count type.
This template defines a Coroutine wrapper type with a Boost-like interface.
void serialize(const ThreadContext &tc, CheckpointOut &cp)
Thread context serialization helpers.
Bitfield< 7, 4 > itsNumber
ItsProcess is a base coroutine wrapper which is spawned by the Gicv3Its module when the latter needs ...
An ItsCommand is created whenever there is a new command in the command queue.
bool collectionOutOfRange(CommandEntry &command) const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
std::unique_ptr< Coroutine > coroutine
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
A virtual base opaque structure used to hold state associated with the packet (e.g., an MSHR), specific to a SimObject that sees the packet.
Gicv3Redistributor * getRedistributor(CTE cte)
std::queue< ItsAction > packetsToRetry
static const uint32_t CTLR_QUIESCENT
std::ostream CheckpointOut
DataPort(const std::string &_name, Gicv3Its &_its)
static DispatchTable cmdDispatcher
void unserialize(ThreadContext &tc, CheckpointIn &cp)
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
BitUnion32(UserDescFlags) Bitfield< 0 > seg_32bit
std::function< void(ItsCommand *, Yield &, CommandEntry &)> ExecFn
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
DispatchEntry(std::string _name, ExecFn _exec)
bool idOutOfRange(CommandEntry &command, DTE dte) const
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
uint32_t pendingTranslations