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

Re: [Xen-devel] [PATCH v10 2/7] xen/arm: Add vgic callback to read irq priority



On Tue, 9 Sep 2014, vijay.kilari@xxxxxxxxx wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
> 
> Use callback in vgic driver to read priority for
> a given irq
> 
> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
> ---
>  xen/arch/arm/vgic-v2.c     |   15 +++++++++++++++
>  xen/arch/arm/vgic.c        |    2 +-
>  xen/include/asm-arm/vgic.h |    2 ++
>  3 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
> index 54751b6..ef18804 100644
> --- a/xen/arch/arm/vgic-v2.c
> +++ b/xen/arch/arm/vgic-v2.c
> @@ -521,6 +521,20 @@ static struct vcpu *vgic_v2_get_target_vcpu(struct vcpu 
> *v, unsigned int irq)
>      return v_target;
>  }
>  
> +static int vgic_v2_get_irq_priority(struct vcpu *v, unsigned int irq)
> +{
> +    struct vgic_irq_rank *rank;
> +    int priority;
> + 
> +    rank = vgic_rank_offset(v, 8, (irq / 4) * 4, DABT_WORD);
> +    ASSERT(spin_is_locked(&rank->lock));

you could just call vgic_rank_irq


> +    priority = vgic_byte_read(rank->ipriority[REG_RANK_INDEX(8, irq,
> +                                              DABT_WORD)], 0, irq & 0x3);
> +
> +    return priority;
> +}
> +
>  static int vgic_v2_vcpu_init(struct vcpu *v)
>  {
>      int i;
> @@ -555,6 +569,7 @@ static int vgic_v2_domain_init(struct domain *d)
>  static const struct vgic_ops vgic_v2_ops = {
>      .vcpu_init   = vgic_v2_vcpu_init,
>      .domain_init = vgic_v2_domain_init,
> +    .get_irq_priority = vgic_v2_get_irq_priority,
>      .get_target_vcpu = vgic_v2_get_target_vcpu,
>  };
>  
> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
> index d402a2a..30faefe 100644
> --- a/xen/arch/arm/vgic.c
> +++ b/xen/arch/arm/vgic.c
> @@ -371,7 +371,7 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int 
> irq)
>      bool_t running;
>  
>      vgic_lock_rank(v, rank, flags);
> -    priority = vgic_byte_read(rank->ipriority[REG_RANK_INDEX(8, irq, 
> DABT_WORD)], 0, irq & 0x3);
> +    priority = v->domain->arch.vgic.handler->get_irq_priority(v, irq);
>      vgic_unlock_rank(v, rank, flags);
>  
>      spin_lock_irqsave(&v->arch.vgic.lock, flags);
> diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
> index 338ba03..a9f1943 100644
> --- a/xen/include/asm-arm/vgic.h
> +++ b/xen/include/asm-arm/vgic.h
> @@ -96,6 +96,8 @@ struct vgic_ops {
>      int (*vcpu_init)(struct vcpu *v);
>      /* Domain specific initialization of vGIC */
>      int (*domain_init)(struct domain *d);
> +    /* Get priority for a given irq stored in vgic structure */
> +    int (*get_irq_priority)(struct vcpu *v, unsigned int irq);
>      /* Get the target vcpu for a given virq. The rank lock is already taken
>       * when calling this. */
>      struct vcpu *(*get_target_vcpu)(struct vcpu *v, unsigned int irq);
> -- 
> 1.7.9.5
> 

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


 


Rackspace

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