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) |
500 panic(
"Gicv3Distributor::read(): invalid offset %#x\n",
addr);
507 bool is_secure_access)
510 if (!
DS && !is_secure_access) {
521 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
524 DPRINTF(GIC,
"Gicv3Distributor::write(): int_id %d group %d\n",
537 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
549 DPRINTF(GIC,
"Gicv3Distributor::write(): "
550 "int_id %d enabled\n", int_id);
566 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
578 DPRINTF(GIC,
"Gicv3Distributor::write(): "
579 "int_id %d disabled\n", int_id);
595 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
606 bool pending =
data & (1 <<
i) ? 1 : 0;
609 DPRINTF(GIC,
"Gicv3Distributor::write() (GICD_ISPENDR): "
610 "int_id %d (SPI) pending bit set\n", int_id);
626 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
637 bool clear =
data & (1 <<
i) ? 1 : 0;
655 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
663 bool active =
data & (1 <<
i) ? 1 : 0;
679 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
687 bool clear =
data & (1 <<
i) ? 1 : 0;
691 DPRINTF(GIC,
"Gicv3Distributor::write(): "
692 "int_id %d active cleared\n", int_id);
708 for (
int i = 0, int_id = first_intid;
i < size && int_id <
itLines;
710 uint8_t prio =
bits(
data, (
i + 1) * 8 - 1, (
i * 8));
712 if (!
DS && !is_secure_access) {
717 prio = 0x80 | (prio >> 1);
722 DPRINTF(GIC,
"Gicv3Distributor::write(): int_id %d priority %d\n",
730 warn(
"Gicv3Distributor::write(): "
731 "GICD_ITARGETSR is RAZ/WI, legacy not supported!\n");
746 for (
int i = 0, int_id = first_intid;
i < 8 * size && int_id <
itLines;
747 i =
i + 2, int_id++) {
756 DPRINTF(GIC,
"Gicv3Distributor::write(): int_id %d config %d\n",
766 if (!is_secure_access) {
776 for (
int i = 0, int_id = first_intid;
777 i < 8 * size && int_id <
itLines;
i++, int_id++) {
794 if (
DS || (!
DS && !is_secure_access)) {
798 for (
int i = 0, int_id = first_intid;
799 i < 8 * size && int_id <
itLines;
i =
i + 2, int_id++) {
833 DPRINTF(GIC,
"Gicv3Distributor::write(): "
834 "int_id %d GICD_IROUTER %#llx\n",
851 if ((
data & (1 << 4)) == 0) {
852 warn(
"Gicv3Distributor::write(): "
853 "setting ARE to 0 is not supported!\n");
858 DPRINTF(GIC,
"Gicv3Distributor::write(): (DS 1)"
859 "EnableGrp1NS %d EnableGrp0 %d\n",
862 if (is_secure_access) {
875 if ((
data & (1 << 5)) == 0) {
876 warn(
"Gicv3Distributor::write(): "
877 "setting ARE_NS to 0 is not supported!\n");
880 if ((
data & (1 << 4)) == 0) {
881 warn(
"Gicv3Distributor::write(): "
882 "setting ARE_S to 0 is not supported!\n");
889 DPRINTF(GIC,
"Gicv3Distributor::write(): (DS 0 secure)"
891 "EnableGrp1S %d EnableGrp1NS %d EnableGrp0 %d\n",
904 if ((
data & (1 << 4)) == 0) {
905 warn(
"Gicv3Distributor::write(): "
906 "setting ARE_NS to 0 is not supported!\n");
910 DPRINTF(GIC,
"Gicv3Distributor::write(): (DS 0 non-secure)"
930 const uint32_t intid =
bits(
data, 9, 0);
949 const uint32_t intid =
bits(
data, 9, 0);
967 const uint32_t intid =
bits(
data, 9, 0);
983 const uint32_t intid =
bits(
data, 9, 0);
994 panic(
"Gicv3Distributor::write(): invalid offset %#x\n",
addr);
1006 DPRINTF(GIC,
"Gicv3Distributor::sendInt(): "
1007 "int_id %d (SPI) pending bit set\n", int_id);
1040 if (affinity_routing.IRM) {
1046 if (redistributor_i->
1048 target_redistributor = redistributor_i;
1053 uint32_t affinity = (affinity_routing.Aff3 << 24) |
1054 (affinity_routing.Aff2 << 16) |
1055 (affinity_routing.Aff1 << 8) |
1056 (affinity_routing.Aff0 << 0);
1057 target_redistributor =
1061 if (!target_redistributor) {
1072 auto cpu_interface =
route(int_id);
1074 cpu_interface->resetHppi(int_id);
1093 if (!target_cpu_interface)
continue;
1097 int_id < target_cpu_interface->hppi.intid)) {
1099 target_cpu_interface->
hppi.
intid = int_id;
1101 target_cpu_interface->
hppi.
group = int_group;