stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Ondrej Zary <linux@rainbow-software.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Sinan Kaya <okaya@codeaurora.org>,
	Jonathan Liu <net147@gmail.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: [PATCH 4.8 76/92] ACPI/PCI: pci_link: penalize SCI correctly
Date: Thu, 17 Nov 2016 11:32:49 +0100	[thread overview]
Message-ID: <20161117103227.594322633@linuxfoundation.org> (raw)
In-Reply-To: <20161117103224.218007793@linuxfoundation.org>

4.8-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sinan Kaya <okaya@codeaurora.org>

commit f1caa61df2a3dc4c58316295c5dc5edba4c68d85 upstream.

Ondrej reported that IRQs stopped working in v4.7 on several
platforms.  A typical scenario, from Ondrej's VT82C694X/694X, is:

ACPI: Using PIC for interrupt routing
ACPI: PCI Interrupt Link [LNKA] (IRQs 1 3 4 5 6 7 10 *11 12 14 15)
ACPI: No IRQ available for PCI Interrupt Link [LNKA]
8139too 0000:00:0f.0: PCI INT A: no GSI

We're using PIC routing, so acpi_irq_balance == 0, and LNKA is already
active at IRQ 11. In that case, acpi_pci_link_allocate() only tries
to use the active IRQ (IRQ 11) which also happens to be the SCI.

We should penalize the SCI by PIRQ_PENALTY_PCI_USING, but
irq_get_trigger_type(11) returns something other than
IRQ_TYPE_LEVEL_LOW, so we penalize it by PIRQ_PENALTY_ISA_ALWAYS
instead, which makes acpi_pci_link_allocate() assume the IRQ isn't
available and give up.

Add acpi_penalize_sci_irq() so platforms can tell us the SCI IRQ,
trigger, and polarity directly and we don't have to depend on
irq_get_trigger_type().

Fixes: 103544d86976 (ACPI,PCI,IRQ: reduce resource requirements)
Link: http://lkml.kernel.org/r/201609251512.05657.linux@rainbow-software.org
Reported-by: Ondrej Zary <linux@rainbow-software.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Tested-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kernel/acpi/boot.c |    1 +
 drivers/acpi/pci_link.c     |   30 +++++++++++++++---------------
 include/linux/acpi.h        |    1 +
 3 files changed, 17 insertions(+), 15 deletions(-)

--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -453,6 +453,7 @@ static void __init acpi_sci_ioapic_setup
 		polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK;
 
 	mp_override_legacy_irq(bus_irq, polarity, trigger, gsi);
+	acpi_penalize_sci_irq(bus_irq, trigger, polarity);
 
 	/*
 	 * stash over-ride to indicate we've been here
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -87,6 +87,7 @@ struct acpi_pci_link {
 
 static LIST_HEAD(acpi_link_list);
 static DEFINE_MUTEX(acpi_link_lock);
+static int sci_irq = -1, sci_penalty;
 
 /* --------------------------------------------------------------------------
                             PCI Link Device Management
@@ -496,25 +497,13 @@ static int acpi_irq_get_penalty(int irq)
 {
 	int penalty = 0;
 
-	/*
-	* 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 PCI IRQs.
-	*/
-	if (irq == acpi_gbl_FADT.sci_interrupt) {
-		u32 type = irq_get_trigger_type(irq) & IRQ_TYPE_SENSE_MASK;
-
-		if (type != IRQ_TYPE_LEVEL_LOW)
-			penalty += PIRQ_PENALTY_ISA_ALWAYS;
-		else
-			penalty += PIRQ_PENALTY_PCI_USING;
-	}
+	if (irq == sci_irq)
+		penalty += sci_penalty;
 
 	if (irq < ACPI_MAX_ISA_IRQS)
 		return penalty + acpi_isa_irq_penalty[irq];
 
-	penalty += acpi_irq_pci_sharing_penalty(irq);
-	return penalty;
+	return penalty + acpi_irq_pci_sharing_penalty(irq);
 }
 
 int __init acpi_irq_penalty_init(void)
@@ -881,6 +870,17 @@ bool acpi_isa_irq_available(int irq)
 		    acpi_irq_get_penalty(irq) < PIRQ_PENALTY_ISA_ALWAYS);
 }
 
+void acpi_penalize_sci_irq(int irq, int trigger, int polarity)
+{
+	sci_irq = irq;
+
+	if (trigger == ACPI_MADT_TRIGGER_LEVEL &&
+	    polarity == ACPI_MADT_POLARITY_ACTIVE_LOW)
+		sci_penalty = PIRQ_PENALTY_PCI_USING;
+	else
+		sci_penalty = PIRQ_PENALTY_ISA_ALWAYS;
+}
+
 /*
  * Over-ride default table to reserve additional IRQs for use by ISA
  * e.g. acpi_irq_isa=5
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -318,6 +318,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);
 
 extern int ec_read(u8 addr, u8 *val);

  parent reply	other threads:[~2016-11-17 10:32 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161117103726epcas5p2d4b3b822fdf8596bbd1a48a77364d0ac@epcas5p2.samsung.com>
2016-11-17 10:31 ` [PATCH 4.8 00/92] 4.8.9-stable review Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 01/92] ALSA: info: Return error for invalid read/write Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 02/92] ALSA: info: Limit the proc text input size Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 03/92] ASoC: cs4270: fix DAPM stream name mismatch Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 05/92] mm, frontswap: make sure allocated frontswap map is assigned Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 06/92] shmem: fix pageflags after swapping DMA32 object Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 07/92] swapfile: fix memory corruption via malformed swapfile Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 08/92] mm: hwpoison: fix thp split handling in memory_failure() Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 09/92] mm/hugetlb: fix huge page reservation leak in private mapping error paths Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 10/92] coredump: fix unfreezable coredumping task Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 11/92] s390/hypfs: Use get_free_page() instead of kmalloc to ensure page alignment Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 12/92] ARC: timer: rtc: implement read loop in "C" vs. inline asm Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 13/92] PCI: Dont attempt to claim shadow copies of ROM Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 14/92] arc: Implement arch-specific dma_map_ops.mmap Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 15/92] pinctrl: cherryview: Serialize register access in suspend/resume Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 16/92] pinctrl: cherryview: Prevent possible interrupt storm on resume Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 17/92] cpupower: Correct return type of cpu_power_is_cpu_online() in cpufreq-set Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 18/92] mmc: sdhci: Fix CMD line reset interfering with ongoing data transfer Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 19/92] mmc: sdhci: Fix unexpected data interrupt handling Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 20/92] mmc: mmc: Use 500ms as the default generic CMD6 timeout Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 21/92] staging: iio: ad5933: avoid uninitialized variable in error case Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 22/92] staging: sm750fb: Fix bugs introduced by early commits Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 23/92] staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 24/92] drivers: staging: nvec: remove bogus reset command for PS/2 interface Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 25/92] Revert "staging: nvec: ps2: change serio type to passthrough" Greg Kroah-Hartman
2016-11-17 10:31   ` [PATCH 4.8 26/92] staging: nvec: remove managed resource from PS2 driver Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 27/92] usb: dwc3: Fix error handling for core init Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 28/92] USB: cdc-acm: fix TIOCMIWAIT Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 30/92] drbd: Fix kernel_sendmsg() usage - potential NULL deref Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 31/92] toshiba-wmi: Fix loading the driver on non Toshiba laptops Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 32/92] clk: qoriq: Dont allow CPU clocks higher than starting value Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 33/92] cdc-acm: fix uninitialized variable Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 34/92] iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 35/92] iio: orientation: hid-sensor-rotation: Add PM function (fix non working driver) Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 36/92] iio: st_sensors: fix scale configuration for h3lis331dl Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 37/92] scsi: qla2xxx: Fix scsi scan hang triggered if adapter fails during init Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 38/92] scsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 39/92] scsi: scsi_dh_alua: fix missing kref_put() in alua_rtpg_work() Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 40/92] scsi: scsi_dh_alua: Fix a reference counting bug Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 41/92] KVM: arm/arm64: vgic: Prevent access to invalid SPIs Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 45/92] drm/i915/dp: Extend BDW DP audio workaround to GEN9 platforms Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 47/92] drm/amdgpu: fix crash in acp_hw_fini Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 51/92] xprtrdma: use complete() instead complete_all() Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 52/92] xprtrdma: Fix DMAR failure in frwr_op_map() after reconnect Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 53/92] iommu/io-pgtable-arm: Check for v7s-incapable systems Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 54/92] iommu/amd: Free domain id when free a domain of struct dma_ops_domain Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 55/92] iommu/vt-d: Fix dead-locks in disable_dmar_iommu() path Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 57/92] watchdog: core: Fix devres_alloc() allocation size Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 58/92] Input: synaptics-rmi4 - fix error handling in SPI transport driver Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 59/92] Input: synaptics-rmi4 - fix error handling in I2C " Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 60/92] perf top: Fix refreshing hierarchy entries on TUI Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 61/92] mei: bus: fix received data size check in NFC fixup Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 62/92] svcrdma: Skip put_page() when send_reply() fails Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 63/92] svcrdma: Tail iovec leaves an orphaned DMA mapping Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 64/92] nvme: Delete created IO queues on reset Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 65/92] Revert "clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init" Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 66/92] x86/build: Fix build with older GCC versions Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 67/92] clk: samsung: clk-exynos-audss: Fix module autoload Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 68/92] rtc: pcf2123: Add missing error code assignment before test Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 69/92] s390/dumpstack: restore reliable indicator for call traces Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 70/92] lib/genalloc.c: start search from start of chunk Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 71/92] hwrng: core - Dont use a stack buffer in add_early_randomness() Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 72/92] i40e: fix call of ndo_dflt_bridge_getlink() Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 73/92] mmc: sdhci-msm: Fix error return code in sdhci_msm_probe() Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 74/92] ACPI / APEI: Fix incorrect return value of ghes_proc() Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 75/92] ACPI/PCI/IRQ: assign ISA IRQ directly during early boot stages Greg Kroah-Hartman
2016-11-17 10:32   ` Greg Kroah-Hartman [this message]
2016-11-17 10:32   ` [PATCH 4.8 77/92] ACPI/PCI: pci_link: Include PIRQ_PENALTY_PCI_USING for ISA IRQs Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 80/92] gpio/mvebu: Use irq_domain_add_linear Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 81/92] gpio: of: fix GPIO drivers with multiple gpio_chip for a single node Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 82/92] ASoC: Intel: Skylake: Always acquire runtime pm ref on unload Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 83/92] ASoC: sun4i-codec: return error code instead of NULL when create_card fails Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 84/92] pinctrl: iproc: Fix iProc and NSP GPIO support Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 85/92] mmc: mxs: Initialize the spinlock prior to using it Greg Kroah-Hartman
2016-11-17 10:32   ` [PATCH 4.8 86/92] memcg: prevent memcg caches to be both OFF_SLAB & OBJFREELIST_SLAB Greg Kroah-Hartman
2016-11-17 10:33   ` [PATCH 4.8 87/92] libceph: fix legacy layout decode with pool 0 Greg Kroah-Hartman
2016-11-17 10:33   ` [PATCH 4.8 88/92] NFSv4.1: work around -Wmaybe-uninitialized warning Greg Kroah-Hartman
2016-11-17 10:33   ` [PATCH 4.8 92/92] netfilter: fix namespace handling in nf_log_proc_dostring Greg Kroah-Hartman
     [not found]   ` <20161117103227.709330459@linuxfoundation.org>
2016-11-17 10:51     ` [PATCH 4.8 78/92] batman-adv: fix splat on disabling an interface Sven Eckelmann
2016-11-17 12:02       ` Greg Kroah-Hartman
     [not found]   ` <ff6afc35-bd5d-f6f0-f483-e1bc692646d5@samsung.com>
2016-11-17 16:48     ` [PATCH 4.8 00/92] 4.8.9-stable review Greg Kroah-Hartman
2016-11-17 22:23   ` Guenter Roeck
2016-11-18  7:14     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161117103227.594322633@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rainbow-software.org \
    --cc=net147@gmail.com \
    --cc=okaya@codeaurora.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).