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

Re: [Xen-devel] [PATCH v4 03/16] xen/arm: make sgi handling generic



On Mon, 26 May 2014, vijay.kilari@xxxxxxxxx wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
> 
> move all the hw specific sgi handling functionality
> to one function and use it.
> 
> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
> ---
>  xen/arch/arm/gic.c        |   37 ++++++++++++++++++++++++++++---------
>  xen/include/asm-arm/gic.h |    8 ++++++++
>  2 files changed, 36 insertions(+), 9 deletions(-)
> 
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index efcd785..f8e49df 100644
> --- a/xen/arch/arm/gic.c
> +++ b/xen/arch/arm/gic.c
> @@ -483,21 +483,40 @@ void __init gic_init(void)
>      spin_unlock(&gic.lock);
>  }
>  
> -void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
> +static void send_SGI(const cpumask_t *cpu_mask, enum gic_sgi sgi,
> +                     uint8_t irqmode)
>  {
>      unsigned int mask = 0;
> +
> +    switch ( irqmode )
> +    {
> +    case SGI_TARGET_OTHERS:
> +        GICD[GICD_SGIR] = GICD_SGI_TARGET_OTHERS | sgi;
> +        break;
> +    case SGI_TARGET_SELF:
> +        GICD[GICD_SGIR] = GICD_SGI_TARGET_SELF | sgi;
> +        break;
> +    case SGI_TARGET_LIST:
> +        mask = gic_cpu_mask(cpu_mask);
> +        GICD[GICD_SGIR] = GICD_SGI_TARGET_LIST |
> +                          (mask<<GICD_SGI_TARGET_SHIFT) | sgi;
> +        break;
> +    default:
> +        BUG_ON(1);
> +    }
> +}
> +
> +void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
> +{
>      cpumask_t online_mask;
>  
>      ASSERT(sgi < 16); /* There are only 16 SGIs */
>  
>      cpumask_and(&online_mask, cpumask, &cpu_online_map);
> -    mask = gic_cpu_mask(&online_mask);
>  
>      dsb(sy);
>  
> -    GICD[GICD_SGIR] = GICD_SGI_TARGET_LIST
> -        | (mask<<GICD_SGI_TARGET_SHIFT)
> -        | sgi;
> +    send_SGI(&online_mask, sgi, SGI_TARGET_LIST);
>  }
>  
>  void send_SGI_one(unsigned int cpu, enum gic_sgi sgi)
> @@ -512,18 +531,18 @@ void send_SGI_self(enum gic_sgi sgi)
>  
>      dsb(sy);
>  
> -    GICD[GICD_SGIR] = GICD_SGI_TARGET_SELF
> -        | sgi;
> +    send_SGI(cpumask_of(smp_processor_id()), sgi, SGI_TARGET_SELF);
>  }

Given that the mask is unused in this case, I think it would be
acceptable to pass NULL.


>  void send_SGI_allbutself(enum gic_sgi sgi)
>  {
> +   cpumask_t all_others_mask;
>     ASSERT(sgi < 16); /* There are only 16 SGIs */
>  
> +   cpumask_andnot(&all_others_mask, &cpu_possible_map, 
> cpumask_of(smp_processor_id()));
>     dsb(sy);
>  
> -   GICD[GICD_SGIR] = GICD_SGI_TARGET_OTHERS
> -       | sgi;
> +   send_SGI(&all_others_mask, sgi, SGI_TARGET_OTHERS);

Same here. Especially in this case you would avoid the useless
cpumask_andnot call.

In any case

Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>


>  }
>  
>  void smp_send_state_dump(unsigned int cpu)
> diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
> index 8e37ccf..c7b7368 100644
> --- a/xen/include/asm-arm/gic.h
> +++ b/xen/include/asm-arm/gic.h
> @@ -210,6 +210,14 @@ enum gic_sgi {
>      GIC_SGI_DUMP_STATE  = 1,
>      GIC_SGI_CALL_FUNCTION = 2,
>  };
> +
> +/* SGI irq mode types */
> +enum gic_sgi_mode {
> +    SGI_TARGET_LIST,
> +    SGI_TARGET_OTHERS,
> +    SGI_TARGET_SELF,
> +};
> +
>  extern void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi);
>  extern void send_SGI_one(unsigned int cpu, enum gic_sgi sgi);
>  extern void send_SGI_self(enum gic_sgi sgi);
> -- 
> 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®.