Skip to contentSkip to conversation

hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled

PATCH In review Peter Maydell 2 participants 2 messages Mar 28, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled

If the group of the highest priority pending interrupt is disabled via ICC_IGRPEN*, the ICC_HPPIR* registers should return INTID_SPURIOUS, not the interrupt ID. (See the GIC architecture specification pseudocode functions ICC_HPPIR1_EL1[] and HighestPriorityPendingInterrupt().)

Make HPPIR reads honour the group disable, the way we already do when determining whether to preempt in icc_hppi_can_preempt().

---
Pre-existing bug which I happened to notice while working on review of the FEAT_NMI patches. I don't suppose real world code disables interrupt groups which it's actually using, which is why nobody's noticed it. Still, it's a safe bugfix so might as well go to stable too.

---
 hw/intc/arm_gicv3_cpuif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/intc/arm_gicv3_cpuif.c +2 -2
index e1a60d8c15b..67d8fd07b7f 100644
@@ -1067,7 +1067,7 @@ static uint64_t icc_hppir0_value(GICv3CPUState *cs, CPUARMState *env)
      */
     bool irq_is_secure;
 
-    if (cs->hppi.prio == 0xff) {
+    if (icc_no_enabled_hppi(cs)) {
         return INTID_SPURIOUS;
     }
 
@@ -1104,7 +1104,7 @@ static uint64_t icc_hppir1_value(GICv3CPUState *cs, CPUARMState *env)
      */
     bool irq_is_secure;
 
-    if (cs->hppi.prio == 0xff) {
+    if (icc_no_enabled_hppi(cs)) {
         return INTID_SPURIOUS;
     }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Peter Maydell

If the group of the highest priority pending interrupt is disabled via ICC_IGRPEN*, the ICC_HPPIR* registers should return INTID_SPURIOUS, not the interrupt ID. (See the GIC architecture specification pseudocode functions ICC_HPPIR1_EL1[] and HighestPriorityPendingInterrupt().)

Make HPPIR reads honour the group disable, the way we already do when determining whether to preempt in icc_hppi_can_preempt().

---
Pre-existing bug which I happened to notice while working on review of the FEAT_NMI patches. I don't suppose real world code disables interrupt groups which it's actually using, which is why nobody's noticed it. Still, it's a safe bugfix so might as well go to stable too.

Quoted 3 lines
---
  hw/intc/arm_gicv3_cpuif.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

r~