On 03.09.25 05:55, Mykola Kvach wrote:

Hello Mykola

From: Mykola Kvach <mykola_kv...@epam.com>

Use GIC_PRI_IPI priority for SGI interrupts instead of the generic
GIC_PRI_IRQ priority in setup_irq().

This change ensures that SGIs get the correct priority level when
being set up for Xen's use, maintaining proper interrupt precedence
in the system.

The priority assignment now follows ARM GIC best practices:
- SGIs (0-15): GIC_PRI_IPI (higher priority)
- PPIs/SPIs (16+): GIC_PRI_IRQ (standard priority)

Signed-off-by: Mykola Kvach <mykola_kv...@epam.com>

Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshche...@epam.com>


---
  xen/arch/arm/irq.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 02ca82c089..17c7ac92b5 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -397,7 +397,13 @@ int setup_irq(unsigned int irq, unsigned int irqflags, 
struct irqaction *new)
      /* First time the IRQ is setup */
      if ( disabled )
      {
-        gic_route_irq_to_xen(desc, GIC_PRI_IRQ);
+        unsigned int prio = GIC_PRI_IRQ;
+
+        /* Use appropriate priority based on interrupt type */
+        if (desc->irq < NR_GIC_SGI)
+            prio = GIC_PRI_IPI;
+
+        gic_route_irq_to_xen(desc, prio);
          /* It's fine to use smp_processor_id() because:
           * For SGI and PPI: irq_desc is banked
           * For SPI: we don't care for now which CPU will receive the


Reply via email to