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

Re: [Xen-devel] [RFC 5/8] xen/arm: gic: Document how gic_set_irq_type should be called



On Tue, 7 Jun 2016, Julien Grall wrote:
> Changing the value of Int_config is UNPREDICTABLE when the corresponding
> interrupt is not disabled.
> 
> The driver is assuming the interrupt will be disabled by the caller of
> gic_set_irq_type. Add an ASSERT to ensure it.
> 
> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>

Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


>  xen/arch/arm/gic.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index 8b992d8..27cd177 100644
> --- a/xen/arch/arm/gic.c
> +++ b/xen/arch/arm/gic.c
> @@ -96,8 +96,14 @@ void gic_restore_state(struct vcpu *v)
>      gic_restore_pending_irqs(v);
>  }
>  
> +/* desc->irq needs to be disabled before calling this function */
>  static void gic_set_irq_type(struct irq_desc *desc, unsigned int type)
>  {
> +    /*
> +     * IRQ must be disabled before configuring it (see 4.3.13 in ARM IHI
> +     * 0048B.b). We rely on the caller to do it.
> +     */
> +    ASSERT(test_bit(_IRQ_DISABLED, &desc->status));
>      ASSERT(spin_is_locked(&desc->lock));
>      ASSERT(type != IRQ_TYPE_INVALID);
>  
> -- 
> 1.9.1
> 

_______________________________________________
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®.