On 23.03.21 07:25, peng....@nxp.com wrote:
> From: Peng Fan <peng....@nxp.com>
> 
> Inject physical IRQ priority to inmates.
> 

Reasoning is missing, use case description. Specifically as this
approach has no influence on the ordering in the software queue. And as
it's only targeting GICv2. And possibly there are more limitations.

So far the decision was to ignore those rarely used IRQ prios because of
the additional complexity to emulate them accurately.

See also
https://github.com/siemens/jailhouse/commit/03475882880dc5ae49d0852c628a8b8958be80ac.

> 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 */
>  
> 

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

-- 
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/ff73ae1f-352d-52a0-c21e-fd7351a444ad%40siemens.com.

Reply via email to