summaryrefslogtreecommitdiffstats
path: root/hw/intc/arm_gicv3_common.c
diff options
context:
space:
mode:
authorPeter Maydell2016-06-17 16:23:46 +0200
committerPeter Maydell2016-06-17 16:23:51 +0200
commitce187c3c15f4bda579c9833cd78092fb73e651aa (patch)
treebd9c801b0e14a81f6a8d5bf674b6716bb5bc2a7f /hw/intc/arm_gicv3_common.c
parenthw/intc/arm_gicv3: ARM GICv3 device framework (diff)
downloadqemu-ce187c3c15f4bda579c9833cd78092fb73e651aa.tar.gz
qemu-ce187c3c15f4bda579c9833cd78092fb73e651aa.tar.xz
qemu-ce187c3c15f4bda579c9833cd78092fb73e651aa.zip
hw/intc/arm_gicv3: Implement functions to identify next pending irq
Implement the GICv3 logic to recalculate the highest priority pending interrupt for each CPU after some part of the GIC state has changed. We avoid unnecessary full recalculation where possible. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> Tested-by: Shannon Zhao <shannon.zhao@linaro.org> Message-id: 1465915112-29272-11-git-send-email-peter.maydell@linaro.org
Diffstat (limited to 'hw/intc/arm_gicv3_common.c')
-rw-r--r--hw/intc/arm_gicv3_common.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c
index d1714e42ab..0f8c4b86e0 100644
--- a/hw/intc/arm_gicv3_common.c
+++ b/hw/intc/arm_gicv3_common.c
@@ -246,6 +246,8 @@ static void arm_gicv3_common_reset(DeviceState *dev)
cs->gicr_nsacr = 0;
memset(cs->gicr_ipriorityr, 0, sizeof(cs->gicr_ipriorityr));
+ cs->hppi.prio = 0xff;
+
/* State in the CPU interface must *not* be reset here, because it
* is part of the CPU's reset domain, not the GIC device's.
*/
@@ -271,6 +273,13 @@ static void arm_gicv3_common_reset(DeviceState *dev)
memset(s->gicd_ipriority, 0, sizeof(s->gicd_ipriority));
memset(s->gicd_irouter, 0, sizeof(s->gicd_irouter));
memset(s->gicd_nsacr, 0, sizeof(s->gicd_nsacr));
+ /* GICD_IROUTER are UNKNOWN at reset so in theory the guest must
+ * write these to get sane behaviour and we need not populate the
+ * pointer cache here; however having the cache be different for
+ * "happened to be 0 from reset" and "guest wrote 0" would be
+ * too confusing.
+ */
+ gicv3_cache_all_target_cpustates(s);
if (s->irq_reset_nonsecure) {
/* If we're resetting a TZ-aware GIC as if secure firmware