Go to the documentation of this file.
44 #include "debug/GIC.hh"
56 cpuInterface(nullptr),
59 peInLowPowerState(true),
61 irqEnabled(
Gicv3::SGI_MAX +
Gicv3::PPI_MAX, false),
62 irqPending(
Gicv3::SGI_MAX +
Gicv3::PPI_MAX, false),
63 irqPendingIspendr(
Gicv3::SGI_MAX +
Gicv3::PPI_MAX, false),
64 irqActive(
Gicv3::SGI_MAX +
Gicv3::PPI_MAX, false),
65 irqPriority(
Gicv3::SGI_MAX +
Gicv3::PPI_MAX, 0),
73 lpiConfigurationTablePtr(0),
75 lpiPendingTablePtr(0),
76 addrRangeSize(
gic->params()->gicv4 ? 0x40000 : 0x20000)
96 for (
int i = 0, int_id = first_intid;
i < size;
i++, int_id++) {
105 prio = (prio << 1) & 0xff;
109 value |= prio << (
i * 8);
132 value |= GICR_CTLR_ENABLE_LPIS;
165 return (affinity << 32) | (1 << 24) | (
cpuId << 8) |
166 (1 << 5) | (last << 4) | (1 << 3) | (1 << 0);
187 uint8_t part_1 = 0x4;
188 return (des_0 << 4) | (part_1 << 0);
192 uint8_t arch_rev = 0x3;
195 return (arch_rev << 4) | (jedec << 3) | (des_1 << 0);
204 return (size << 4) | (des_2 << 0);
220 for (
int int_id = 0; int_id < 8 * size; int_id++) {
221 value |= (
irqGroup[int_id] << int_id);
231 for (
int int_id = 0; int_id < 8 * size; int_id++) {
240 value |= (1 << int_id);
251 for (
int int_id = 0; int_id < 8 * size; int_id++) {
269 for (
int int_id = 0; int_id < 8 * size; int_id++) {
288 for (
int i = 0, int_id = first_int_id;
i < 32;
289 i =
i + 2, int_id++) {
311 if (!is_secure_access) {
315 for (
int int_id = 0; int_id < 8 * size; int_id++) {
331 if (!is_secure_access) {
335 for (
int i = 0, int_id = 0;
i < 8 * size;
336 i =
i + 2, int_id++) {
379 panic(
"Gicv3Redistributor::read(): invalid offset %#x\n",
addr);
386 bool is_secure_access)
391 for (
int i = 0, int_id = first_intid;
i < size;
i++, int_id++) {
392 uint8_t prio =
bits(
data, (
i + 1) * 8 - 1, (
i * 8));
400 prio = 0x80 | (prio >> 1);
405 DPRINTF(GIC,
"Gicv3Redistributor::write(): "
406 "int_id %d priority %d\n", int_id,
irqPriority[int_id]);
432 DPRINTF(GIC,
"Gicv3Redistributor::write(): "
433 "PE entering in low power state\n");
436 DPRINTF(GIC,
"Gicv3Redistributor::write(): powering up PE\n");
449 for (
int int_id = 0; int_id < 8 * size; int_id++) {
451 DPRINTF(GIC,
"Gicv3Redistributor::write(): "
452 "int_id %d group %d\n", int_id,
irqGroup[int_id]);
458 for (
int int_id = 0; int_id < 8 * size; int_id++) {
472 DPRINTF(GIC,
"Gicv3Redistributor::write(): "
473 "int_id %d enable %i\n", int_id,
irqEnabled[int_id]);
479 for (
int int_id = 0; int_id < 8 * size; int_id++) {
493 DPRINTF(GIC,
"Gicv3Redistributor::write(): "
494 "int_id %d enable %i\n", int_id,
irqEnabled[int_id]);
500 for (
int int_id = 0; int_id < 8 * size; int_id++) {
508 bool pending =
data & (1 << int_id) ? 1 : 0;
511 DPRINTF(GIC,
"Gicv3Redistributor::write() "
512 "(GICR_ISPENDR0): int_id %d (PPI) "
513 "pending bit set\n", int_id);
523 for (
int int_id = 0; int_id < 8 * size; int_id++) {
531 bool clear =
data & (1 << int_id) ? 1 : 0;
541 for (
int int_id = 0; int_id < 8 * size; int_id++) {
549 bool activate =
data & (1 << int_id) ? 1 : 0;
553 DPRINTF(GIC,
"Gicv3Redistributor::write(): "
554 "int_id %d active set\n", int_id);
564 for (
int int_id = 0; int_id < 8 * size; int_id++) {
572 bool clear =
data & (1 << int_id) ? 1 : 0;
576 DPRINTF(GIC,
"Gicv3Redistributor::write(): "
577 "int_id %d active cleared\n", int_id);
592 for (
int i = 0, int_id = first_intid;
i < 8 * size;
593 i =
i + 2, int_id++) {
604 DPRINTF(GIC,
"Gicv3Redistributor::write(): "
605 "int_id %d (PPI) config %d\n",
616 for (
int int_id = 0; int_id < 8 * size; int_id++) {
617 if (!is_secure_access) {
633 if (!is_secure_access) {
636 for (
int i = 0, int_id = 0;
i < 8 * size;
637 i =
i + 2, int_id++) {
706 panic(
"Gicv3Redistributor::write(): invalid offset %#x\n",
addr);
718 DPRINTF(GIC,
"Gicv3Redistributor::sendPPInt(): "
719 "int_id %d (PPI) pending bit set\n", int_id);
740 bool forward =
false;
758 forward = (group == int_group) ||
763 if (!forward)
return;
767 DPRINTF(GIC,
"Gicv3ReDistributor::sendSGI(): "
768 "int_id %d (SGI) pending bit set\n", int_id);
816 int_id < cpuInterface->hppi.intid)) {
827 const uint32_t largest_lpi_id = 1 << (
lpiIDBits + 1);
830 uint8_t lpi_pending_table[largest_lpi_id / 8];
831 uint8_t lpi_config_table[number_lpis];
835 sizeof(lpi_pending_table));
839 sizeof(lpi_config_table));
843 uint32_t lpi_pending_entry_byte = lpi_id / 8;
844 uint8_t lpi_pending_entry_bit_position = lpi_id % 8;
845 bool lpi_is_pending = lpi_pending_table[lpi_pending_entry_byte] &
846 1 << lpi_pending_entry_bit_position;
849 LPIConfigurationTableEntry config_entry =
850 lpi_config_table[lpi_configuration_entry_index];
852 bool lpi_is_enable = config_entry.enable;
859 if (lpi_is_pending && lpi_is_enable && group_enabled) {
860 uint8_t lpi_priority = config_entry.priority << 2;
862 if ((lpi_priority < cpuInterface->hppi.prio) ||
888 uint8_t lpi_pending_entry;
891 sizeof(lpi_pending_entry));
893 return lpi_pending_entry;
903 sizeof(lpi_pending_entry));
912 uint8_t lpi_pending_entry_bit_position = lpi_id % 8;
913 bool is_set = lpi_pending_entry & (1 << lpi_pending_entry_bit_position);
927 uint32_t lpi_id =
data & 0xffffffff;
928 uint32_t largest_lpi_id = 1 << (
lpiIDBits + 1);
930 if (lpi_id > largest_lpi_id) {
939 uint8_t lpi_pending_entry_bit_position = lpi_id % 8;
940 bool is_set = lpi_pending_entry & (1 << lpi_pending_entry_bit_position);
949 lpi_pending_entry |= 1 << (lpi_pending_entry_bit_position);
957 lpi_pending_entry &= ~(1 << (lpi_pending_entry_bit_position));
1022 uint64_t affinity = ((mpidr & 0xff00000000) >> 8) | (mpidr & (0xffffff));
void activateIRQ(uint32_t int_id)
uint32_t getAffinity() const
std::vector< bool > irqPendingIspendr
Gicv3Distributor * distributor
#define UNSERIALIZE_SCALAR(scalar)
static const uint32_t GICR_WAKER_ProcessorSleep
#define UNSERIALIZE_CONTAINER(member)
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
Addr lpiConfigurationTablePtr
uint64_t read(Addr addr, size_t size, bool is_secure_access)
Gicv3Distributor * getDistributor() const
static const uint32_t GICR_CTLR_DPG0
void writeEntryLPI(uint32_t intid, uint8_t lpi_entry)
Gicv3Redistributor(Gicv3 *gic, uint32_t cpu_id)
std::vector< bool > irqPending
bool contains(const Addr &a) const
Determine if the range contains an address.
void resetHppi(uint32_t intid)
RegVal getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
This helper function is returning the value of MPIDR_EL1.
std::vector< bool > irqActive
bool isPendingLPI(uint32_t intid)
bool isLevelSensitive(uint32_t int_id) const
std::vector< uint8_t > irqGroup
std::vector< uint8_t > irqPriority
static const uint32_t GICR_CTLR_DPG1S
void writeBlob(Addr addr, const void *p, int size) const
Same as tryWriteBlob, but insists on success.
uint8_t readEntryLPI(uint32_t intid)
void clearPPInt(uint32_t int_id)
std::vector< Gicv3::IntTriggerType > irqConfig
Gicv3::GroupId getIntGroup(int int_id) const
ThreadContext is the external interface to all thread state for anything outside of the CPU.
static const uint32_t GICR_CTLR_DPG1NS
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
std::vector< bool > irqEnabled
Gicv3CPUInterface * cpuInterface
bool groupEnabled(Gicv3::GroupId group) const
void assertWakeRequest(void)
void deassertWakeRequest(void)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
#define SERIALIZE_SCALAR(scalar)
static const AddrRange GICR_IPRIORITYR
static const uint32_t GICR_WAKER_ChildrenAsleep
void sendSGI(uint32_t int_id, Gicv3::GroupId group, bool ns)
Gicv3::IntStatus intStatus(uint32_t int_id) const
void serialize(CheckpointOut &cp) const override
Serialize an object.
void write(Addr addr, uint64_t data, size_t size, bool is_secure_access)
Addr start() const
Get the start address of the range.
Gicv3CPUInterface * getCPUInterface(int cpu_id) const
void clearPendingInterrupts(void)
#define SERIALIZE_CONTAINER(member)
void sendPPInt(uint32_t int_id)
std::vector< uint8_t > irqGrpmod
void deactivateIRQ(uint32_t int_id)
std::ostream CheckpointOut
ArmSystem * getSystem() const
static const uint32_t SMALLEST_LPI_ID
bool havePendingInterrupts(void) const
bool treatAsEdgeTriggered(uint32_t int_id) const
This helper is used to check if an interrupt should be treated as edge triggered in the following sce...
bool canBeSelectedFor1toNInterrupt(Gicv3::GroupId group) const
void readBlob(Addr addr, void *p, int size) const
Higher level interfaces based on the above.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void setClrLPI(uint64_t data, bool set)
#define panic(...)
This implements a cprintf based panic() function.
std::vector< uint8_t > irqNsacr
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Generated on Wed Sep 30 2020 14:02:10 for gem5 by doxygen 1.8.17