38 #ifndef __DEV_ARM_GICV3_ITS_H__ 39 #define __DEV_ARM_GICV3_ITS_H__ 45 #include "params/Gicv3Its.hh" 76 friend class ::ItsProcess;
77 friend class ::ItsTranslation;
78 friend class ::ItsCommand;
99 Port & getPort(
const std::string &if_name,
PortID idx)
override;
103 Gicv3Its(
const Gicv3ItsParams *params);
105 void setGIC(
Gicv3 *_gic);
107 static const uint32_t itsControl = 0x0;
108 static const uint32_t itsTranslate = 0x10000;
113 static const uint32_t NUM_BASER_REGS = 8;
118 static const uint64_t BASER_INDIRECT = 0x4000000000000000;
119 static const uint64_t BASER_TYPE = 0x0700000000000000;
120 static const uint64_t BASER_ESZ = 0x001F000000000000;
121 static const uint64_t BASER_SZ = 0x00000000000000FF;
122 static const uint64_t BASER_WMASK =
123 ~(BASER_INDIRECT | BASER_TYPE | BASER_ESZ);
124 static const uint64_t BASER_WMASK_UNIMPL =
125 ~(BASER_INDIRECT | BASER_TYPE | BASER_ESZ | BASER_SZ);
133 GITS_CTLR = itsControl + 0x0000,
134 GITS_IIDR = itsControl + 0x0004,
135 GITS_TYPER = itsControl + 0x0008,
136 GITS_CBASER = itsControl + 0x0080,
137 GITS_CWRITER = itsControl + 0x0088,
138 GITS_CREADR = itsControl + 0x0090,
139 GITS_PIDR2 = itsControl + 0xffe8,
142 GITS_TRANSLATER = itsTranslate + 0x0040
157 Bitfield<31> quiescent;
165 Bitfield<63, 32> high;
173 Bitfield<63, 32> high;
176 Bitfield<61, 59> innerCache;
177 Bitfield<55, 53> outerCache;
179 Bitfield<11, 10> shareability;
185 Bitfield<62> indirect;
186 Bitfield<61, 59> innerCache;
188 Bitfield<55, 53> outerCache;
189 Bitfield<52, 48> entrySize;
191 Bitfield<11, 10> shareability;
192 Bitfield<9, 8> pageSize;
197 Bitfield<63, 32> high;
201 Bitfield<35, 32> cidBits;
202 Bitfield<31, 24> hcc;
205 Bitfield<17, 13> devBits;
206 Bitfield<12, 8> idBits;
207 Bitfield<7, 4> ittEntrySize;
209 Bitfield<1> _virtual;
210 Bitfield<0> physical;
219 uint32_t gitsTranslater;
227 bool idOutOfRange(uint32_t event_id, uint8_t itt_range) const;
234 bool deviceOutOfRange(uint32_t device_id) const;
242 bool sizeOutOfRange(uint32_t size) const;
249 bool collectionOutOfRange(uint32_t collection_id) const;
255 bool lpiOutOfRange(uint32_t intid) const;
258 uint64_t maxCommands() const;
259 void checkCommandQueue();
260 void incrementReadPointer();
264 Bitfield<57, 53> ittRange;
265 Bitfield<52, 1> ittAddress;
270 Bitfield<59, 46> vpeid;
271 Bitfield<45, 30> icid;
272 Bitfield<29, 16> intNumHyp;
273 Bitfield<15, 2> intNum;
279 Bitfield<40, 1> rdBase;
285 VIRTUAL_INTERRUPT = 0,
286 PHYSICAL_INTERRUPT = 1
293 return getRedistributor(cte.rdBase);
304 TRANSLATION_TABLE = 3,
317 void moveAllPendingState(
348 using DTE = Gicv3Its::DTE;
350 using CTE = Gicv3Its::CTE;
358 const std::string
name()
const;
366 void writeDeviceTable(
Yield &yield, uint32_t device_id,
DTE dte);
368 void writeIrqTranslationTable(
369 Yield &yield,
const Addr itt_base, uint32_t event_id,
ITTE itte);
371 void writeIrqCollectionTable(
372 Yield &yield, uint32_t collection_id,
CTE cte);
374 uint64_t readDeviceTable(
375 Yield &yield, uint32_t device_id);
377 uint64_t readIrqTranslationTable(
378 Yield &yield,
const Addr itt_base, uint32_t event_id);
380 uint64_t readIrqCollectionTable(
Yield &yield, uint32_t collection_id);
382 void doRead(
Yield &yield,
Addr addr,
void *ptr,
size_t size);
383 void doWrite(
Yield &yield,
Addr addr,
void *ptr,
size_t size);
384 void terminate(
Yield &yield);
409 translateLPI(
Yield &yield, uint32_t device_id, uint32_t event_id);
469 using ExecFn = std::function<void(ItsCommand*, Yield&, CommandEntry&)>;
472 :
name(_name), exec(_exec)
484 static std::string commandName(uint32_t cmd);
515 return its.idOutOfRange(command.
eventId, dte.ittRange);
520 return its.deviceOutOfRange(command.
deviceId);
525 const auto size =
bits(command.
raw[1], 4, 0);
526 const auto valid =
bits(command.
raw[2], 63);
528 return its.sizeOutOfRange(size);
535 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
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
DrainState
Object drain/handover states.
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