* [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ
@ 2015-09-17 6:02 Jiang Liu
2015-09-17 6:02 ` [Bugfix 2/2] ACPI / PCI: Remove duplicated penalty on SCI IRQ Jiang Liu
2015-09-25 23:40 ` [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ Bjorn Helgaas
0 siblings, 2 replies; 5+ messages in thread
From: Jiang Liu @ 2015-09-17 6:02 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Thomas Gleixner,
Rafael J. Wysocki, Len Brown
Cc: Jiang Liu, wfg, linux-kernel, linux-pci, linux-acpi, x86
Avoid IRQs occupied by ISA IRQs when allocating IRQs for PCI link devices,
otherwise it may cause interrupt storm due to incompatible pin attributes.
This issue was triggered on a KVM virtual machine, which
1) uses IRQ9 for SCI in high level mode.
2) defines an PCI interrupt link device (LNKS) with IRQ9 as the only
possible irq.
3) has an PCI device referring to link device LNKS.
So it causes interrupt storm when enabling the PCI device because PCI IRQ
works in low level mode.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/acpi/pci_irq.c | 1 +
drivers/acpi/pci_link.c | 13 +++++++++++++
include/linux/acpi.h | 1 +
3 files changed, 15 insertions(+)
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 6da0f9beab19..c9336751e5e3 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -372,6 +372,7 @@ static int acpi_isa_register_gsi(struct pci_dev *dev)
/* Interrupt Line values above 0xF are forbidden */
if (dev->irq > 0 && (dev->irq <= 0xF) &&
+ acpi_isa_irq_available(dev->irq) &&
(acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) {
dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n",
pin_name(dev->pin), dev->irq);
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 3b4ea98e3ea0..246e50d22120 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -553,6 +553,13 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
irq = link->irq.possible[i];
}
}
+ if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) {
+ printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. "
+ "Try pci=noacpi or acpi=off\n",
+ acpi_device_name(link->device),
+ acpi_device_bid(link->device));
+ return -ENODEV;
+ }
/* Attempt to enable the link device at this IRQ. */
if (acpi_pci_link_set(link, irq)) {
@@ -821,6 +828,12 @@ void acpi_penalize_isa_irq(int irq, int active)
}
}
+bool acpi_isa_irq_available(int irq)
+{
+ return irq >= 0 && (irq >= ARRAY_SIZE(acpi_irq_penalty) ||
+ acpi_irq_penalty[irq] < PIRQ_PENALTY_ISA_ALWAYS);
+}
+
/*
* Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict with
* PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be use for
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 7235c4851460..43856d19cf4d 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -217,6 +217,7 @@ struct pci_dev;
int acpi_pci_irq_enable (struct pci_dev *dev);
void acpi_penalize_isa_irq(int irq, int active);
+bool acpi_isa_irq_available(int irq);
void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
void acpi_pci_irq_disable (struct pci_dev *dev);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Bugfix 2/2] ACPI / PCI: Remove duplicated penalty on SCI IRQ
2015-09-17 6:02 [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ Jiang Liu
@ 2015-09-17 6:02 ` Jiang Liu
2015-09-25 23:41 ` Bjorn Helgaas
2015-09-25 23:40 ` [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ Bjorn Helgaas
1 sibling, 1 reply; 5+ messages in thread
From: Jiang Liu @ 2015-09-17 6:02 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Thomas Gleixner,
Rafael J. Wysocki, Len Brown
Cc: Jiang Liu, wfg, linux-kernel, linux-pci, linux-acpi, x86
Now we have dedicated interface acpi_penalize_sci_irq() to penalize
ISA IRQ used by ACPI SCI, so remove duplicated code to penalize ACPI SCI
in acpi_irq_penalty_init().
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/acpi/pci_link.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 246e50d22120..7c8408b946ca 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -498,8 +498,7 @@ int __init acpi_irq_penalty_init(void)
PIRQ_PENALTY_PCI_POSSIBLE;
}
}
- /* Add a penalty for the SCI */
- acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING;
+
return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ
2015-09-17 6:02 [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ Jiang Liu
2015-09-17 6:02 ` [Bugfix 2/2] ACPI / PCI: Remove duplicated penalty on SCI IRQ Jiang Liu
@ 2015-09-25 23:40 ` Bjorn Helgaas
2015-09-28 13:57 ` Rafael J. Wysocki
1 sibling, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2015-09-25 23:40 UTC (permalink / raw)
To: Jiang Liu
Cc: Rafael J . Wysocki, Bjorn Helgaas, Thomas Gleixner,
Rafael J. Wysocki, Len Brown, wfg, linux-kernel, linux-pci,
linux-acpi, x86
On Thu, Sep 17, 2015 at 02:02:45PM +0800, Jiang Liu wrote:
> Avoid IRQs occupied by ISA IRQs when allocating IRQs for PCI link devices,
> otherwise it may cause interrupt storm due to incompatible pin attributes.
>
> This issue was triggered on a KVM virtual machine, which
> 1) uses IRQ9 for SCI in high level mode.
> 2) defines an PCI interrupt link device (LNKS) with IRQ9 as the only
> possible irq.
> 3) has an PCI device referring to link device LNKS.
> So it causes interrupt storm when enabling the PCI device because PCI IRQ
> works in low level mode.
>
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/acpi/pci_irq.c | 1 +
> drivers/acpi/pci_link.c | 13 +++++++++++++
> include/linux/acpi.h | 1 +
> 3 files changed, 15 insertions(+)
>
> diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
> index 6da0f9beab19..c9336751e5e3 100644
> --- a/drivers/acpi/pci_irq.c
> +++ b/drivers/acpi/pci_irq.c
> @@ -372,6 +372,7 @@ static int acpi_isa_register_gsi(struct pci_dev *dev)
>
> /* Interrupt Line values above 0xF are forbidden */
> if (dev->irq > 0 && (dev->irq <= 0xF) &&
> + acpi_isa_irq_available(dev->irq) &&
> (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) {
> dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n",
> pin_name(dev->pin), dev->irq);
> diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
> index 3b4ea98e3ea0..246e50d22120 100644
> --- a/drivers/acpi/pci_link.c
> +++ b/drivers/acpi/pci_link.c
> @@ -553,6 +553,13 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
> irq = link->irq.possible[i];
> }
> }
> + if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) {
> + printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. "
> + "Try pci=noacpi or acpi=off\n",
> + acpi_device_name(link->device),
> + acpi_device_bid(link->device));
> + return -ENODEV;
> + }
>
> /* Attempt to enable the link device at this IRQ. */
> if (acpi_pci_link_set(link, irq)) {
> @@ -821,6 +828,12 @@ void acpi_penalize_isa_irq(int irq, int active)
> }
> }
>
> +bool acpi_isa_irq_available(int irq)
> +{
> + return irq >= 0 && (irq >= ARRAY_SIZE(acpi_irq_penalty) ||
> + acpi_irq_penalty[irq] < PIRQ_PENALTY_ISA_ALWAYS);
> +}
> +
> /*
> * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict with
> * PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be use for
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 7235c4851460..43856d19cf4d 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -217,6 +217,7 @@ struct pci_dev;
>
> int acpi_pci_irq_enable (struct pci_dev *dev);
> void acpi_penalize_isa_irq(int irq, int active);
> +bool acpi_isa_irq_available(int irq);
> void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
> void acpi_pci_irq_disable (struct pci_dev *dev);
>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Bugfix 2/2] ACPI / PCI: Remove duplicated penalty on SCI IRQ
2015-09-17 6:02 ` [Bugfix 2/2] ACPI / PCI: Remove duplicated penalty on SCI IRQ Jiang Liu
@ 2015-09-25 23:41 ` Bjorn Helgaas
0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2015-09-25 23:41 UTC (permalink / raw)
To: Jiang Liu
Cc: Rafael J . Wysocki, Bjorn Helgaas, Thomas Gleixner,
Rafael J. Wysocki, Len Brown, wfg, linux-kernel, linux-pci,
linux-acpi, x86
On Thu, Sep 17, 2015 at 02:02:46PM +0800, Jiang Liu wrote:
> Now we have dedicated interface acpi_penalize_sci_irq() to penalize
> ISA IRQ used by ACPI SCI, so remove duplicated code to penalize ACPI SCI
> in acpi_irq_penalty_init().
>
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/acpi/pci_link.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
> index 246e50d22120..7c8408b946ca 100644
> --- a/drivers/acpi/pci_link.c
> +++ b/drivers/acpi/pci_link.c
> @@ -498,8 +498,7 @@ int __init acpi_irq_penalty_init(void)
> PIRQ_PENALTY_PCI_POSSIBLE;
> }
> }
> - /* Add a penalty for the SCI */
> - acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING;
> +
> return 0;
> }
>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ
2015-09-25 23:40 ` [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ Bjorn Helgaas
@ 2015-09-28 13:57 ` Rafael J. Wysocki
0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2015-09-28 13:57 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Jiang Liu, Rafael J . Wysocki, Bjorn Helgaas, Thomas Gleixner,
Len Brown, wfg, linux-kernel, linux-pci, linux-acpi, x86
On Friday, September 25, 2015 06:40:40 PM Bjorn Helgaas wrote:
> On Thu, Sep 17, 2015 at 02:02:45PM +0800, Jiang Liu wrote:
> > Avoid IRQs occupied by ISA IRQs when allocating IRQs for PCI link devices,
> > otherwise it may cause interrupt storm due to incompatible pin attributes.
> >
> > This issue was triggered on a KVM virtual machine, which
> > 1) uses IRQ9 for SCI in high level mode.
> > 2) defines an PCI interrupt link device (LNKS) with IRQ9 as the only
> > possible irq.
> > 3) has an PCI device referring to link device LNKS.
> > So it causes interrupt storm when enabling the PCI device because PCI IRQ
> > works in low level mode.
> >
> > Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Thanks!
Queued up both this and the [2/2] for 4.3-rc4.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-28 13:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 6:02 [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ Jiang Liu
2015-09-17 6:02 ` [Bugfix 2/2] ACPI / PCI: Remove duplicated penalty on SCI IRQ Jiang Liu
2015-09-25 23:41 ` Bjorn Helgaas
2015-09-25 23:40 ` [Bugfix 1/2] ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ Bjorn Helgaas
2015-09-28 13:57 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).