[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 09/12] ARM: VGIC: rework events_need_delivery()



On Thu, 19 Oct 2017, Andre Przywara wrote:
> In event.h we very deeply dive into the VGIC to learn if an event for
> a guest is pending.
> Rework that function to abstract the VGIC specific part out. Also
> reorder the queries there, as we only actually need to check for the
> event channel if there are no other pending IRQs.
> 
> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> ---
>  xen/arch/arm/vgic.c         | 11 +++++++++++
>  xen/include/asm-arm/event.h | 13 +++----------
>  xen/include/asm-arm/vgic.h  |  2 ++
>  3 files changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
> index 37a083e804..f8d0f46e71 100644
> --- a/xen/arch/arm/vgic.c
> +++ b/xen/arch/arm/vgic.c
> @@ -602,6 +602,17 @@ void arch_evtchn_inject(struct vcpu *v)
>      vgic_vcpu_inject_irq(v, v->domain->arch.evtchn_irq);
>  }
>  
> +bool vgic_evtchn_irq_pending(struct vcpu *v)
> +{
> +    struct pending_irq *p;
> +
> +    p = irq_to_pending(v, v->domain->arch.evtchn_irq);
> +    /* Does not work for LPIs. */
> +    ASSERT(!is_lpi(v->domain->arch.evtchn_irq));
> +
> +    return list_empty(&p->inflight);
> +}
> +
>  bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
>  {
>      struct vcpu *v = current;
> diff --git a/xen/include/asm-arm/event.h b/xen/include/asm-arm/event.h
> index caefa506a9..67684e9763 100644
> --- a/xen/include/asm-arm/event.h
> +++ b/xen/include/asm-arm/event.h
> @@ -16,12 +16,6 @@ static inline int vcpu_event_delivery_is_enabled(struct 
> vcpu *v)
>  
>  static inline int local_events_need_delivery_nomask(void)
>  {
> -    struct pending_irq *p = irq_to_pending(current,
> -                                           current->domain->arch.evtchn_irq);
> -
> -    /* Does not work for LPIs. */
> -    ASSERT(!is_lpi(current->domain->arch.evtchn_irq));
> -
>      /* XXX: if the first interrupt has already been delivered, we should
>       * check whether any other interrupts with priority higher than the
>       * one in GICV_IAR are in the lr_pending queue or in the LR
> @@ -33,11 +27,10 @@ static inline int local_events_need_delivery_nomask(void)
>      if ( gic_events_need_delivery() )
>          return 1;
>  
> -    if ( vcpu_info(current, evtchn_upcall_pending) &&
> -        list_empty(&p->inflight) )
> -        return 1;
> +    if ( !vcpu_info(current, evtchn_upcall_pending) )
> +        return 0;
>  
> -    return 0;
> +    return vgic_evtchn_irq_pending(current);
>  }
>  
>  static inline int local_events_need_delivery(void)
> diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
> index 49b8a4bec0..dcdb1acaf3 100644
> --- a/xen/include/asm-arm/vgic.h
> +++ b/xen/include/asm-arm/vgic.h
> @@ -219,6 +219,8 @@ extern void register_vgic_ops(struct domain *d, const 
> struct vgic_ops *ops);
>  int vgic_v2_init(struct domain *d, int *mmio_count);
>  int vgic_v3_init(struct domain *d, int *mmio_count);
>  
> +bool vgic_evtchn_irq_pending(struct vcpu *v);
> +
>  extern int domain_vgic_register(struct domain *d, int *mmio_count);
>  extern int vcpu_vgic_free(struct vcpu *v);
>  extern bool vgic_to_sgi(struct vcpu *v, register_t sgir,
> -- 
> 2.14.1
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.