diff mbox

[v7,01/18] ACPI, irq: fix regression casued by 6b9fb7082409

Message ID 1414387308-27148-2-git-send-email-jiang.liu@linux.intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jiang Liu Oct. 27, 2014, 5:21 a.m. UTC
When IOAPIC is disabled, acpi_gsi_to_irq() should return gsi directly
instead of calling mp_map_gsi_to_irq() to translate gsi to IRQ by IOAPIC.
It fixes https://bugzilla.kernel.org/show_bug.cgi?id=84381.

Reported-by: Thomas Richter <thor@math.tu-berlin.de>
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: rui.zhang@intel.com
Cc: <stable@vger.kernel.org> # 3.17
---
 arch/x86/kernel/acpi/boot.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Pavel Machek Oct. 28, 2014, 5:44 p.m. UTC | #1
Hi!

> When IOAPIC is disabled, acpi_gsi_to_irq() should return gsi directly
> instead of calling mp_map_gsi_to_irq() to translate gsi to IRQ by IOAPIC.
> It fixes https://bugzilla.kernel.org/show_bug.cgi?id=84381.
> 
> Reported-by: Thomas Richter <thor@math.tu-berlin.de>
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> Cc: rui.zhang@intel.com
> Cc: <stable@vger.kernel.org> # 3.17
> ---
>  arch/x86/kernel/acpi/boot.c |   13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index b436fc735aa4..eceba9d9e116 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -604,14 +604,19 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
>  
>  int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
>  {
> -	int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK);
> +	int irq;
>  
> -	if (irq >= 0) {
> +	if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
> +		*irqp = gsi;

As you have multiple return points, anyway, I'd do return 0; here

> +	} else {
> +		irq = mp_map_gsi_to_irq(gsi,
> +					IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK);
> +		if (irq < 0)
> +			return -1;
>  		*irqp = irq;
> -		return 0;
>  	}

...so that one level of nesting is avoided, and there are no problems
with fiting to 80 colums.

With that,

Acked-by: Pavel Machek <pavel@ucw.cz>
Bjorn Helgaas Oct. 28, 2014, 6:13 p.m. UTC | #2
The subject should describe the change you're making.  "Fix regression
caused by xxx" doesn't say anything about what the patch does.

On Sun, Oct 26, 2014 at 11:21 PM, Jiang Liu <jiang.liu@linux.intel.com> wrote:
> When IOAPIC is disabled, acpi_gsi_to_irq() should return gsi directly
> instead of calling mp_map_gsi_to_irq() to translate gsi to IRQ by IOAPIC.

I don't know what the convention is or if there even is one, but "GSI"
is even more of an acronym than "IRQ", so I'd capitalize it.

> It fixes https://bugzilla.kernel.org/show_bug.cgi?id=84381.

A line like the following may be useful to those who have to backport this.

Fixes: 6b9fb7082409 ("x86, ACPI, irq: Consolidate algorithm of mapping
(ioapic, pin) to IRQ number")

> Reported-by: Thomas Richter <thor@math.tu-berlin.de>
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> Cc: rui.zhang@intel.com
> Cc: <stable@vger.kernel.org> # 3.17
> ---
>  arch/x86/kernel/acpi/boot.c |   13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index b436fc735aa4..eceba9d9e116 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -604,14 +604,19 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
>
>  int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
>  {
> -       int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK);
> +       int irq;
>
> -       if (irq >= 0) {
> +       if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
> +               *irqp = gsi;
> +       } else {
> +               irq = mp_map_gsi_to_irq(gsi,
> +                                       IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK);
> +               if (irq < 0)
> +                       return -1;
>                 *irqp = irq;
> -               return 0;
>         }
>
> -       return -1;
> +       return 0;
>  }
>  EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
>
> --
> 1.7.10.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thomas Gleixner Oct. 28, 2014, 6:45 p.m. UTC | #3
On Tue, 28 Oct 2014, Bjorn Helgaas wrote:
> The subject should describe the change you're making.  "Fix regression
> caused by xxx" doesn't say anything about what the patch does.
> 
> On Sun, Oct 26, 2014 at 11:21 PM, Jiang Liu <jiang.liu@linux.intel.com> wrote:
> > When IOAPIC is disabled, acpi_gsi_to_irq() should return gsi directly
> > instead of calling mp_map_gsi_to_irq() to translate gsi to IRQ by IOAPIC.
> 
> I don't know what the convention is or if there even is one, but "GSI"
> is even more of an acronym than "IRQ", so I'd capitalize it.
> 
> > It fixes https://bugzilla.kernel.org/show_bug.cgi?id=84381.
> 
> A line like the following may be useful to those who have to backport this.
> 
> Fixes: 6b9fb7082409 ("x86, ACPI, irq: Consolidate algorithm of mapping
> (ioapic, pin) to IRQ number")

The patch is already queued in tip x86/urgent with a proper changelog.

http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=961b6a7003acec4f9d70dabc1a253b783cb74272

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index b436fc735aa4..eceba9d9e116 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -604,14 +604,19 @@  void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
 
 int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
 {
-	int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK);
+	int irq;
 
-	if (irq >= 0) {
+	if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
+		*irqp = gsi;
+	} else {
+		irq = mp_map_gsi_to_irq(gsi,
+					IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK);
+		if (irq < 0)
+			return -1;
 		*irqp = irq;
-		return 0;
 	}
 
-	return -1;
+	return 0;
 }
 EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);