put_l2_iste(cs, cfg, &h);
break;
}
+ case GICV5_SPI:
+ {
+ GICv5SPIState *spi = gicv5_spi_state(cs, id, domain);
+
+ if (!spi) {
+ qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_priority: tried to set "
+ "priority of unreachable SPI %d\n", id);
+ return;
+ }
+
+ spi->priority = priority;
+ break;
+ }
default:
qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_priority: tried to set "
"priority of bad interrupt type %d\n", type);
put_l2_iste(cs, cfg, &h);
break;
}
+ case GICV5_SPI:
+ {
+ GICv5SPIState *spi = gicv5_spi_state(cs, id, domain);
+
+ if (!spi) {
+ qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_enabled: tried to set "
+ "enable state of unreachable SPI %d\n", id);
+ return;
+ }
+
+ spi->enabled = true;
+ break;
+ }
default:
qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_enabled: tried to set "
"enable state of bad interrupt type %d\n", type);
put_l2_iste(cs, cfg, &h);
break;
}
+ case GICV5_SPI:
+ {
+ GICv5SPIState *spi = gicv5_spi_state(cs, id, domain);
+
+ if (!spi) {
+ qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_pending: tried to set "
+ "pending state of unreachable SPI %d\n", id);
+ return;
+ }
+
+ spi->pending = true;
+ break;
+ }
default:
qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_pending: tried to set "
"pending state of bad interrupt type %d\n", type);
put_l2_iste(cs, cfg, &h);
break;
}
+ case GICV5_SPI:
+ {
+ GICv5SPIState *spi = gicv5_spi_state(cs, id, domain);
+
+ if (!spi) {
+ qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_handling: tried to set "
+ "priority of unreachable SPI %d\n", id);
+ }
+
+ spi->hm = handling;
+ break;
+ }
default:
qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_handling: tried to set "
"handling mode of bad interrupt type %d\n", type);
put_l2_iste(cs, cfg, &h);
break;
}
+ case GICV5_SPI:
+ {
+ GICv5SPIState *spi = gicv5_spi_state(cs, id, domain);
+
+ if (!spi) {
+ qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_target: tried to set "
+ "target of unreachable SPI %d\n", id);
+ return;
+ }
+
+ spi->iaffid = iaffid;
+ break;
+ }
default:
qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_target: tried to set "
"target of bad interrupt type %d\n", type);
return "arm-gicv5";
}
+/**
+ * gicv5_raw_spi_state
+ * @cs: GIC object
+ * @id: INTID of SPI to look up
+ *
+ * Return pointer to the GICv5SPIState for this SPI, or NULL if the
+ * interrupt ID is out of range. This does not do a check that the SPI
+ * is assigned to the right domain: generally you should call it via
+ * some other wrapper that performs an appropriate further check.
+ */
+static inline GICv5SPIState *gicv5_raw_spi_state(GICv5Common *cs, uint32_t id)
+{
+ if (id < cs->spi_base || id >= cs->spi_base + cs->spi_irs_range) {
+ return NULL;
+ }
+
+ return cs->spi + (id - cs->spi_base);
+}
+
+/**
+ * gicv5_spi_state:
+ * @cs: GIC object
+ * @id: INTID of SPI to look up
+ * @domain: domain to check
+ *
+ * Return pointer to the GICv5SPIState for this SPI, or NULL if the
+ * interrupt is unreachable (which can be because the INTID is out of
+ * range, or because the SPI is configured for a different domain).
+ */
+static inline GICv5SPIState *gicv5_spi_state(GICv5Common *cs, uint32_t id,
+ GICv5Domain domain)
+{
+ GICv5SPIState *spi = gicv5_raw_spi_state(cs, id);
+
+ if (!spi || spi->domain != domain) {
+ return NULL;
+ }
+ return spi;
+}
+
#endif