diff mbox

[Xen-devel,RFC,18/35] arm : add helper function for setting interrupt type

Message ID 1423058539-26403-19-git-send-email-parth.dixit@linaro.org
State New
Headers show

Commit Message

Parth Dixit Feb. 4, 2015, 2:02 p.m. UTC
From: Parth Dixit <parth.dixit@linaro.org>

set edge/level type information for an interrupt

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
---
 xen/arch/arm/irq.c        | 19 +++++++++++++++++++
 xen/include/asm-arm/irq.h |  4 ++++
 2 files changed, 23 insertions(+)

Comments

Julien Grall Feb. 4, 2015, 9:59 p.m. UTC | #1
Hi Parth,

On 04/02/2015 14:02, parth.dixit@linaro.org wrote:
> From: Parth Dixit <parth.dixit@linaro.org>
>
> set edge/level type information for an interrupt
>
> Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
> ---
>   xen/arch/arm/irq.c        | 19 +++++++++++++++++++
>   xen/include/asm-arm/irq.h |  4 ++++
>   2 files changed, 23 insertions(+)
>
> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
> index 25ecf1d..ae4e99a 100644
> --- a/xen/arch/arm/irq.c
> +++ b/xen/arch/arm/irq.c
> @@ -545,6 +545,25 @@ int platform_get_irq(const struct dt_device_node *device, int index)
>       return irq;
>   }
>
> +#if defined(CONFIG_ARM_64) && defined(CONFIG_ACPI)
> +int acpi_set_irq(int irq,int type)
> +{
> +    int res;
> +
> +    /* Setup the IRQ type */
> +    if ( irq < NR_LOCAL_IRQS )
> +        res = irq_local_set_type(irq, type);
> +    else
> +        res = irq_set_spi_type(irq, type);
> +
> +    if ( res )
> +        return -1;
> +
> +    return 0;
> +
> +}
> +#endif
> +

IIRC Ian was requiring a similar function for PCI. So I would rename to 
a generic name.

Also, now that we start to support ACPI the name of the define DT_IRQ_* 
are not anymore relevant. Maybe we should rename it.

Regards,
Julien Grall Feb. 11, 2015, 6:12 a.m. UTC | #2
Hi Stefano,

On 05/02/2015 23:33, Stefano Stabellini wrote:
> On Wed, 4 Feb 2015, parth.dixit@linaro.org wrote:
>> From: Parth Dixit <parth.dixit@linaro.org>
>>
>> set edge/level type information for an interrupt
>>
>> Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
>> ---
>>   xen/arch/arm/irq.c        | 19 +++++++++++++++++++
>>   xen/include/asm-arm/irq.h |  4 ++++
>>   2 files changed, 23 insertions(+)
>>
>> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
>> index 25ecf1d..ae4e99a 100644
>> --- a/xen/arch/arm/irq.c
>> +++ b/xen/arch/arm/irq.c
>> @@ -545,6 +545,25 @@ int platform_get_irq(const struct dt_device_node *device, int index)
>>       return irq;
>>   }
>>
>> +#if defined(CONFIG_ARM_64) && defined(CONFIG_ACPI)
>> +int acpi_set_irq(int irq,int type)
>> +{
>> +    int res;
>> +
>> +    /* Setup the IRQ type */
>> +    if ( irq < NR_LOCAL_IRQS )
>> +        res = irq_local_set_type(irq, type);
>> +    else
>> +        res = irq_set_spi_type(irq, type);
>> +
>> +    if ( res )
>> +        return -1;
>> +
>> +    return 0;
>> +
>> +}
>> +#endif
>
> As you are using this function in previous patches, you should
> defenitely move this patch earlier in the series.
>
> Please introduce another set of IRQ_TYPEs that are not DT specific, or
> make the existing ones generic.

The existing (DT_IRQ_*) one has to be kept because it's part of the 
device tree bindings.

I would introduce new one and, if necessary, add function to translate 
DT_IRQ_* to IRQ_TYPEs.

Regards,
diff mbox

Patch

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 25ecf1d..ae4e99a 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -545,6 +545,25 @@  int platform_get_irq(const struct dt_device_node *device, int index)
     return irq;
 }
 
+#if defined(CONFIG_ARM_64) && defined(CONFIG_ACPI)
+int acpi_set_irq(int irq,int type)
+{
+    int res;
+
+    /* Setup the IRQ type */
+    if ( irq < NR_LOCAL_IRQS )
+        res = irq_local_set_type(irq, type);
+    else
+        res = irq_set_spi_type(irq, type);
+
+    if ( res )
+        return -1;
+
+    return 0;
+
+}
+#endif
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
index 435dfcd..7b09557 100644
--- a/xen/include/asm-arm/irq.h
+++ b/xen/include/asm-arm/irq.h
@@ -47,6 +47,10 @@  void arch_move_irqs(struct vcpu *v);
 /* Set IRQ type for an SPI */
 int irq_set_spi_type(unsigned int spi, unsigned int type);
 
+#if defined(CONFIG_ARM_64) && defined(CONFIG_ACPI)
+int acpi_set_irq(int irq,int type);
+#endif
+
 int platform_get_irq(const struct dt_device_node *device, int index);
 
 void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask);