46 #include "debug/GIC.hh"
83 irqAffinityRouting(it_lines, 0),
117 int max_spi_int_id =
itLines - 1;
118 int it_lines_number =
divCeil(max_spi_int_id + 1, 32) - 1;
120 (1 << 17) | (1 << 16) |
122 (it_lines_number << 0);
142 if (!
DS && !is_secure_access) {
153 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
168 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
189 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
210 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
234 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
259 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
284 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
307 for (
int i = 0, int_id = first_intid;
i < size && int_id <
itLines;
312 if (!
DS && !is_secure_access) {
318 prio = (prio << 1) & 0xff;
322 val |= prio << (
i * 8);
329 warn(
"Gicv3Distributor::read(): "
330 "GICD_ITARGETSR is RAZ/WI, legacy not supported!\n");
342 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
343 i =
i + 2, int_id++) {
362 if (!is_secure_access) {
374 for (
int i = 0, int_id = first_intid;
375 i < 8 * size && int_id <
itLines;
i++, int_id++) {
391 if (
DS || (!
DS && !is_secure_access)) {
397 for (
int i = 0, int_id = first_intid;
398 i < 8 * size && int_id <
itLines;
i =
i + 2, int_id++) {
405 warn(
"Gicv3Distributor::read(): "
406 "GICD_CPENDSGIR is RAZ/WI, legacy not supported!\n");
410 warn(
"Gicv3Distributor::read(): "
411 "GICD_SPENDSGIR is RAZ/WI, legacy not supported!\n");
442 if (is_secure_access) {
464 return (
DS << 6) | (
ARE << 4) |
503 panic(
"Gicv3Distributor::read(): invalid offset %#x\n",
addr);
510 bool is_secure_access)
513 if (!
DS && !is_secure_access) {
524 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
527 DPRINTF(GIC,
"Gicv3Distributor::write(): int_id %d group %d\n",
540 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
552 DPRINTF(GIC,
"Gicv3Distributor::write(): "
553 "int_id %d enabled\n", int_id);
569 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
581 DPRINTF(GIC,
"Gicv3Distributor::write(): "
582 "int_id %d disabled\n", int_id);
598 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
609 bool pending =
data & (1 <<
i) ? 1 : 0;
612 DPRINTF(GIC,
"Gicv3Distributor::write() (GICD_ISPENDR): "
613 "int_id %d (SPI) pending bit set\n", int_id);
629 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
640 bool clear =
data & (1 <<
i) ? 1 : 0;
658 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
666 bool active =
data & (1 <<
i) ? 1 : 0;
682 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
690 bool clear =
data & (1 <<
i) ? 1 : 0;
694 DPRINTF(GIC,
"Gicv3Distributor::write(): "
695 "int_id %d active cleared\n", int_id);
711 for (
int i = 0, int_id = first_intid;
i < size && int_id <
itLines;
713 uint8_t prio =
bits(
data, (
i + 1) * 8 - 1, (
i * 8));
715 if (!
DS && !is_secure_access) {
720 prio = 0x80 | (prio >> 1);
725 DPRINTF(GIC,
"Gicv3Distributor::write(): int_id %d priority %d\n",
733 warn(
"Gicv3Distributor::write(): "
734 "GICD_ITARGETSR is RAZ/WI, legacy not supported!\n");
749 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
750 i =
i + 2, int_id++) {
759 DPRINTF(GIC,
"Gicv3Distributor::write(): int_id %d config %d\n",
769 if (!is_secure_access) {
779 for (
int i = 0, int_id = first_intid;
780 i < 8 * size && int_id <
itLines;
i++, int_id++) {
797 if (
DS || (!
DS && !is_secure_access)) {
801 for (
int i = 0, int_id = first_intid;
802 i < 8 * size && int_id <
itLines;
i =
i + 2, int_id++) {
836 DPRINTF(GIC,
"Gicv3Distributor::write(): "
837 "int_id %d GICD_IROUTER %#llx\n",
854 if ((
data & (1 << 4)) == 0) {
855 warn(
"Gicv3Distributor::write(): "
856 "setting ARE to 0 is not supported!\n");
861 DPRINTF(GIC,
"Gicv3Distributor::write(): (DS 1)"
862 "EnableGrp1NS %d EnableGrp0 %d\n",
865 if (is_secure_access) {
878 if ((
data & (1 << 5)) == 0) {
879 warn(
"Gicv3Distributor::write(): "
880 "setting ARE_NS to 0 is not supported!\n");
883 if ((
data & (1 << 4)) == 0) {
884 warn(
"Gicv3Distributor::write(): "
885 "setting ARE_S to 0 is not supported!\n");
892 DPRINTF(GIC,
"Gicv3Distributor::write(): (DS 0 secure)"
894 "EnableGrp1S %d EnableGrp1NS %d EnableGrp0 %d\n",
907 if ((
data & (1 << 4)) == 0) {
908 warn(
"Gicv3Distributor::write(): "
909 "setting ARE_NS to 0 is not supported!\n");
913 DPRINTF(GIC,
"Gicv3Distributor::write(): (DS 0 non-secure)"
933 const uint32_t intid =
bits(
data, 9, 0);
952 const uint32_t intid =
bits(
data, 9, 0);
970 const uint32_t intid =
bits(
data, 9, 0);
986 const uint32_t intid =
bits(
data, 9, 0);
997 panic(
"Gicv3Distributor::write(): invalid offset %#x\n",
addr);
1009 DPRINTF(GIC,
"Gicv3Distributor::sendInt(): "
1010 "int_id %d (SPI) pending bit set\n", int_id);
1043 if (affinity_routing.IRM) {
1049 if (redistributor_i->
1051 target_redistributor = redistributor_i;
1056 uint32_t affinity = (affinity_routing.Aff3 << 24) |
1057 (affinity_routing.Aff2 << 16) |
1058 (affinity_routing.Aff1 << 8) |
1059 (affinity_routing.Aff0 << 0);
1060 target_redistributor =
1064 if (!target_redistributor) {
1075 auto cpu_interface =
route(int_id);
1077 cpu_interface->resetHppi(int_id);
1096 if (!target_cpu_interface)
continue;
1100 int_id < target_cpu_interface->hppi.intid)) {
1102 target_cpu_interface->
hppi.
intid = int_id;
1104 target_cpu_interface->
hppi.
group = int_group;