Re: [Bugfix] x86, irq: Fix bug in setting IOAPIC pin attributes

2014-08-27 Thread Mika Westerberg
On Wed, Aug 27, 2014 at 01:53:11PM +0800, Jiang Liu wrote:
> Commit 15a3c7cc9154321fc3 "x86, irq: Introduce two helper functions
> to support irqdomain map operation" breaks LPSS ACPI enumerated
> devices.
> 
> On startup, IOAPIC driver preallocates IRQ descriptors and programs
> IOAPIC pins with default level and polarity attributes for all legacy
> IRQs. Later legacy IRQ users may fail to set IOAPIC pin attributes
> if the requested attributes conflicts with the default IOAPIC pin
> attributes. So change mp_irqdomain_map() to allow the first legacy IRQ
> user to reprogram IOAPIC pin with different attributes.
> 
> Reported-by: Mika Westerberg 
> Signed-off-by: Jiang Liu 
> ---
> Hi Mika,
>   We have a plan to kill function mp_set_gsi_attr() later, so
> I have slightly modified your changes. Could you please help to test
> it again?

Works fine here, thanks!

Tested-by: Mika Westerberg 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bugfix] x86, irq: Fix bug in setting IOAPIC pin attributes

2014-08-27 Thread Mika Westerberg
On Wed, Aug 27, 2014 at 01:53:11PM +0800, Jiang Liu wrote:
 Commit 15a3c7cc9154321fc3 x86, irq: Introduce two helper functions
 to support irqdomain map operation breaks LPSS ACPI enumerated
 devices.
 
 On startup, IOAPIC driver preallocates IRQ descriptors and programs
 IOAPIC pins with default level and polarity attributes for all legacy
 IRQs. Later legacy IRQ users may fail to set IOAPIC pin attributes
 if the requested attributes conflicts with the default IOAPIC pin
 attributes. So change mp_irqdomain_map() to allow the first legacy IRQ
 user to reprogram IOAPIC pin with different attributes.
 
 Reported-by: Mika Westerberg mika.westerb...@linux.intel.com
 Signed-off-by: Jiang Liu jiang@linux.intel.com
 ---
 Hi Mika,
   We have a plan to kill function mp_set_gsi_attr() later, so
 I have slightly modified your changes. Could you please help to test
 it again?

Works fine here, thanks!

Tested-by: Mika Westerberg mika.westerb...@linux.intel.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bugfix] x86, irq: Fix bug in setting IOAPIC pin attributes

2014-08-26 Thread Thomas Gleixner
On Tue, 26 Aug 2014, Mika Westerberg wrote:

> On Tue, Aug 26, 2014 at 04:45:01PM +0800, Jiang Liu wrote:
> > On startup, IOAPIC driver preallocates IRQ descriptors and programs
> > IOAPIC pins with default level and polarity attributes for all legacy
> > IRQs. Later legacy IRQ users may fail to set IOAPIC pin attributes
> > if the requested attributes conflicts with the default IOAPIC pin
> > attributes. So change mp_irqdomain_map() to allow the first legacy IRQ
> > user to reprogram IOAPIC pin with different attributes.
> > 
> > Signed-off-by: Jiang Liu 
> 
> I tried this and now we get further in setting up the IOAPIC but it
> still doesn't work :-(
> 
> I noticed that mp_set_gsi_attr() never programs the IOAPIC in case
> info->set is 0 so I added following on top of your patch. With the below
> patch, the system seems to work as expected.
> 
> diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
> index 66c2700c9f83..62a0ad09 100644
> --- a/arch/x86/kernel/apic/io_apic.c
> +++ b/arch/x86/kernel/apic/io_apic.c
> @@ -3942,10 +3942,16 @@ int mp_set_gsi_attr(u32 gsi, int trigger, int 
> polarity, int node)
>  
>   mutex_lock(_mutex);
>   if (!info->set) {
> + struct io_apic_irq_attr attr;
> +
>   info->trigger = trigger;
>   info->polarity = polarity;
>   info->node = node;
>   info->set = 1;
> +
> + /* Now program the IOAPIC with the new attributes */
> + set_io_apic_irq_attr(, ioapic, pin, trigger, polarity);
> + ret = io_apic_setup_irq_pin(gsi, node, );
>   } else if (info->trigger != trigger || info->polarity != polarity) {
>   ret = -EBUSY;
>   }

Can someone please combine this into a single patch with a proper
changelog?

Thanks,

tglx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bugfix] x86, irq: Fix bug in setting IOAPIC pin attributes

2014-08-26 Thread Randy Dunlap
On 08/26/14 01:45, Jiang Liu wrote:
> diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
> index 29290f554e79..66c2700c9f83 100644
> --- a/arch/x86/kernel/apic/io_apic.c
> +++ b/arch/x86/kernel/apic/io_apic.c
> @@ -3896,7 +3896,15 @@ int mp_irqdomain_map(struct irq_domain *domain, 
> unsigned int virq,
> + /*
> +  * setup_IO_APIC_irqs() programs all legacy IRQs with default
> +  * trigger and polarity attirbutes. Don't set the flag for that

attributes.

> +  * case so the first legacy IRQ user could reprogram the pin
> +  * with real trigger and polarity attributes.
> +  */

thanks,
-- 
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bugfix] x86, irq: Fix bug in setting IOAPIC pin attributes

2014-08-26 Thread Mika Westerberg
On Tue, Aug 26, 2014 at 04:45:01PM +0800, Jiang Liu wrote:
> On startup, IOAPIC driver preallocates IRQ descriptors and programs
> IOAPIC pins with default level and polarity attributes for all legacy
> IRQs. Later legacy IRQ users may fail to set IOAPIC pin attributes
> if the requested attributes conflicts with the default IOAPIC pin
> attributes. So change mp_irqdomain_map() to allow the first legacy IRQ
> user to reprogram IOAPIC pin with different attributes.
> 
> Signed-off-by: Jiang Liu 

I tried this and now we get further in setting up the IOAPIC but it
still doesn't work :-(

I noticed that mp_set_gsi_attr() never programs the IOAPIC in case
info->set is 0 so I added following on top of your patch. With the below
patch, the system seems to work as expected.

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 66c2700c9f83..62a0ad09 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3942,10 +3942,16 @@ int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, 
int node)
 
mutex_lock(_mutex);
if (!info->set) {
+   struct io_apic_irq_attr attr;
+
info->trigger = trigger;
info->polarity = polarity;
info->node = node;
info->set = 1;
+
+   /* Now program the IOAPIC with the new attributes */
+   set_io_apic_irq_attr(, ioapic, pin, trigger, polarity);
+   ret = io_apic_setup_irq_pin(gsi, node, );
} else if (info->trigger != trigger || info->polarity != polarity) {
ret = -EBUSY;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bugfix] x86, irq: Fix bug in setting IOAPIC pin attributes

2014-08-26 Thread Mika Westerberg
On Tue, Aug 26, 2014 at 04:45:01PM +0800, Jiang Liu wrote:
 On startup, IOAPIC driver preallocates IRQ descriptors and programs
 IOAPIC pins with default level and polarity attributes for all legacy
 IRQs. Later legacy IRQ users may fail to set IOAPIC pin attributes
 if the requested attributes conflicts with the default IOAPIC pin
 attributes. So change mp_irqdomain_map() to allow the first legacy IRQ
 user to reprogram IOAPIC pin with different attributes.
 
 Signed-off-by: Jiang Liu jiang@linux.intel.com

I tried this and now we get further in setting up the IOAPIC but it
still doesn't work :-(

I noticed that mp_set_gsi_attr() never programs the IOAPIC in case
info-set is 0 so I added following on top of your patch. With the below
patch, the system seems to work as expected.

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 66c2700c9f83..62a0ad09 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3942,10 +3942,16 @@ int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, 
int node)
 
mutex_lock(ioapic_mutex);
if (!info-set) {
+   struct io_apic_irq_attr attr;
+
info-trigger = trigger;
info-polarity = polarity;
info-node = node;
info-set = 1;
+
+   /* Now program the IOAPIC with the new attributes */
+   set_io_apic_irq_attr(attr, ioapic, pin, trigger, polarity);
+   ret = io_apic_setup_irq_pin(gsi, node, attr);
} else if (info-trigger != trigger || info-polarity != polarity) {
ret = -EBUSY;
}
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bugfix] x86, irq: Fix bug in setting IOAPIC pin attributes

2014-08-26 Thread Randy Dunlap
On 08/26/14 01:45, Jiang Liu wrote:
 diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
 index 29290f554e79..66c2700c9f83 100644
 --- a/arch/x86/kernel/apic/io_apic.c
 +++ b/arch/x86/kernel/apic/io_apic.c
 @@ -3896,7 +3896,15 @@ int mp_irqdomain_map(struct irq_domain *domain, 
 unsigned int virq,
 + /*
 +  * setup_IO_APIC_irqs() programs all legacy IRQs with default
 +  * trigger and polarity attirbutes. Don't set the flag for that

attributes.

 +  * case so the first legacy IRQ user could reprogram the pin
 +  * with real trigger and polarity attributes.
 +  */

thanks,
-- 
~Randy
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bugfix] x86, irq: Fix bug in setting IOAPIC pin attributes

2014-08-26 Thread Thomas Gleixner
On Tue, 26 Aug 2014, Mika Westerberg wrote:

 On Tue, Aug 26, 2014 at 04:45:01PM +0800, Jiang Liu wrote:
  On startup, IOAPIC driver preallocates IRQ descriptors and programs
  IOAPIC pins with default level and polarity attributes for all legacy
  IRQs. Later legacy IRQ users may fail to set IOAPIC pin attributes
  if the requested attributes conflicts with the default IOAPIC pin
  attributes. So change mp_irqdomain_map() to allow the first legacy IRQ
  user to reprogram IOAPIC pin with different attributes.
  
  Signed-off-by: Jiang Liu jiang@linux.intel.com
 
 I tried this and now we get further in setting up the IOAPIC but it
 still doesn't work :-(
 
 I noticed that mp_set_gsi_attr() never programs the IOAPIC in case
 info-set is 0 so I added following on top of your patch. With the below
 patch, the system seems to work as expected.
 
 diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
 index 66c2700c9f83..62a0ad09 100644
 --- a/arch/x86/kernel/apic/io_apic.c
 +++ b/arch/x86/kernel/apic/io_apic.c
 @@ -3942,10 +3942,16 @@ int mp_set_gsi_attr(u32 gsi, int trigger, int 
 polarity, int node)
  
   mutex_lock(ioapic_mutex);
   if (!info-set) {
 + struct io_apic_irq_attr attr;
 +
   info-trigger = trigger;
   info-polarity = polarity;
   info-node = node;
   info-set = 1;
 +
 + /* Now program the IOAPIC with the new attributes */
 + set_io_apic_irq_attr(attr, ioapic, pin, trigger, polarity);
 + ret = io_apic_setup_irq_pin(gsi, node, attr);
   } else if (info-trigger != trigger || info-polarity != polarity) {
   ret = -EBUSY;
   }

Can someone please combine this into a single patch with a proper
changelog?

Thanks,

tglx

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/