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

Re: [Xen-devel] [PATCH 11/12] ARM: VGIC: factor out vgic_get_hw_irq_desc()



On Thu, 19 Oct 2017, Andre Przywara wrote:
> At the moment we happily access the VGIC internal struct pending_irq
> (which describes a virtual IRQ) in irq.c.
> Factor out the actually needed functionality to learn the associated
> hardware IRQ and move that into gic-vgic.c to improve abstraction.
> 
> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>

Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> ---
>  xen/arch/arm/gic-vgic.c    | 15 +++++++++++++++
>  xen/arch/arm/irq.c         |  7 ++-----
>  xen/include/asm-arm/vgic.h |  2 ++
>  3 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
> index bf9455a34e..7765d83432 100644
> --- a/xen/arch/arm/gic-vgic.c
> +++ b/xen/arch/arm/gic-vgic.c
> @@ -385,6 +385,21 @@ void gic_inject(struct vcpu *v)
>          gic_hw_ops->update_hcr_status(GICH_HCR_UIE, 1);
>  }
>  
> +struct irq_desc *vgic_get_hw_irq_desc(struct domain *d, struct vcpu *v,
> +                                      unsigned int virq)
> +{
> +    struct pending_irq *p;
> +
> +    if ( !v )
> +        v = d->vcpu[0];
> +
> +    p = irq_to_pending(v, virq);
> +    if ( !p )
> +        return NULL;
> +
> +    return p->desc;
> +}
> +
>  int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, unsigned int virq,
>                          struct irq_desc *desc)
>  {
> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
> index 7f133de549..62103a20e3 100644
> --- a/xen/arch/arm/irq.c
> +++ b/xen/arch/arm/irq.c
> @@ -534,19 +534,16 @@ int release_guest_irq(struct domain *d, unsigned int 
> virq)
>      struct irq_desc *desc;
>      struct irq_guest *info;
>      unsigned long flags;
> -    struct pending_irq *p;
>      int ret;
>  
>      /* Only SPIs are supported */
>      if ( virq < NR_LOCAL_IRQS || virq >= vgic_num_irqs(d) )
>          return -EINVAL;
>  
> -    p = spi_to_pending(d, virq);
> -    if ( !p->desc )
> +    desc = vgic_get_hw_irq_desc(d, NULL, virq);
> +    if ( !desc )
>          return -EINVAL;
>  
> -    desc = p->desc;
> -
>      spin_lock_irqsave(&desc->lock, flags);
>  
>      ret = -EINVAL;
> diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
> index cf02dc6394..947950875b 100644
> --- a/xen/include/asm-arm/vgic.h
> +++ b/xen/include/asm-arm/vgic.h
> @@ -220,6 +220,8 @@ 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);
> +struct irq_desc *vgic_get_hw_irq_desc(struct domain *d, struct vcpu *v,
> +                                      unsigned int virq);
>  int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, unsigned int virq,
>                          struct irq_desc *desc);
>  
> -- 
> 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®.