From: Peng Fan <peng....@nxp.com>

Inject physical IRQ priority to inmates.

Signed-off-by: Peng Fan <peng....@nxp.com>
---
 hypervisor/arch/arm-common/gic-v3.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hypervisor/arch/arm-common/gic-v3.c 
b/hypervisor/arch/arm-common/gic-v3.c
index 4ebb2357..2293f844 100644
--- a/hypervisor/arch/arm-common/gic-v3.c
+++ b/hypervisor/arch/arm-common/gic-v3.c
@@ -533,9 +533,11 @@ static void gicv3_eoi_irq(u32 irq_id, bool deactivate)
 
 static int gicv3_inject_irq(u16 irq_id, u16 sender)
 {
+       void *gicr = this_cpu_public()->gicr.base + GICR_SGI_BASE;
        unsigned int n;
        int free_lr = -1;
        u32 elsr;
+       u32 iprio;
        u64 lr;
 
        arm_read_sysreg(ICH_ELSR_EL2, elsr);
@@ -572,6 +574,16 @@ static int gicv3_inject_irq(u16 irq_id, u16 sender)
        if (!is_sgi(irq_id)) {
                lr |= ICH_LR_HW_BIT;
                lr |= (u64)irq_id << ICH_LR_PHYS_ID_SHIFT;
+
+               if (is_spi(irq_id))
+                       iprio = mmio_read32(gicd_base + GICD_IPRIORITYR +
+                                           (irq_id & ~3));
+               else
+                       iprio = mmio_read32(gicr + GICR_IPRIORITYR +
+                                           (irq_id & ~3));
+
+               iprio = (iprio >> ((irq_id & 3) * 8)) & 0xff;
+               lr |= (u64)iprio << ICH_LR_PRIORITY_SHIFT;
        }
        /* GICv3 doesn't support the injection of the calling CPU ID */
 
-- 
2.30.0

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20210323062536.3888-1-peng.fan%40nxp.com.

Reply via email to