All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20160526121210.GA7006@wunner.de>

diff --git a/a/1.txt b/N1/1.txt
index 729510c..0705d6c 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -20,3 +20,337 @@ Thanks,
 Lukas
 
 -- >8 --
+>From 37ddc5de665e155df1ceee475d851a21f16c4aba Mon Sep 17 00:00:00 2001
+From: Lukas Wunner <lukas@wunner.de>
+Date: Mon, 23 May 2016 19:05:00 +0200
+Subject: [PATCH] x86: Add early quirk to reset Apple AirPort card
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The EFI firmware on Macs contains a full-fledged network stack for
+downloading OS X images from osrecovery.apple.com. Unfortunately
+on Macs introduced 2011 and 2012, EFI brings up the Broadcom 4331
+wireless card on every boot and leaves it enabled even after
+ExitBootServices has been called. The card continues to assert its IRQ
+line, causing spurious interrupts if the IRQ is shared. It also corrupts
+memory by DMAing received packets, allowing for remote code execution
+over the air. This only stops when a driver is loaded for the wireless
+card, which may be never if the driver is not installed or blacklisted.
+
+The issue seems to be constrained to the Broadcom 4331. Chris Milsted
+has verified that the newer Broadcom 4360 built into the MacBookPro11,3
+(2013/2014) does not exhibit this behaviour. The chances that Apple will
+ever supply a firmware fix for the older machines appear to be zero.
+
+The solution is to reset the card on boot by writing to a reset bit in
+its mmio space. This must be done as an early quirk and not as a plain
+vanilla PCI quirk to successfully combat memory corruption by DMAed
+packets: Matthew Garrett found out in 2012 that the packets are written
+to EfiBootServicesData memory (http://mjg59.dreamwidth.org/11235.html).
+This type of memory is made available to the page allocator by
+efi_free_boot_services(). Plain vanilla PCI quirks run much later, in
+subsys initcall level. In-between a time window would be open for memory
+corruption. Random crashes occurring in this time window and attributed
+to DMAed packets have indeed been observed in the wild by Chris
+Bainbridge.
+
+When Matthew Garrett analyzed the memory corruption issue in 2012, he
+sought to fix it with a grub quirk which transitions the card to D3hot:
+http://git.savannah.gnu.org/cgit/grub.git/commit/?id=9d34bb85da56
+
+This approach does not help users with other bootloaders and while it
+may prevent DMAed packets, it does not cure the spurious interrupts
+emanating from the card. Unfortunately the card's mmio space is
+inaccessible in D3hot, so to reset it, we have to undo the effect of
+Matthew's grub patch and transition the card back to D0.
+
+Since commit 8659c406ade3 ("x86: only scan the root bus in early PCI
+quirks"), early quirks can only be applied to devices on the root bus.
+However the Broadcom 4331 card is located on a secondary bus behind a
+PCIe root port. The present commit therefore reintroduces scanning of
+secondary buses. The primary motivation of 8659c406ade3 was to prevent
+application of the nvidia_bugs() quirk on secondary buses. Amend the
+quirk to open code this requirement.
+
+A secondary motivation was to speed up PCI scanning. The algorithm used
+prior to 8659c406ade3 was particularly time consuming because it scanned
+buses 0 to 31 brute force. The recursive algorithm used by the present
+commit only scans buses that are actually reachable from the root bus
+and should thus be a bit faster. If this algorithm is found to
+significantly impact boot time, it would be possible to limit its
+recursion depth: The Apple AirPort quirk applies at depth 1, all others
+at depth 0, so the bus need not be scanned deeper than that for now. An
+alternative approach would be to continue scanning only the root bus,
+and apply the AirPort quirk to the root ports 8086:1c12, 8086:1e12 and
+8086:1e16. Apple always positioned the Broadcom 4331 behind one of these
+three ports (see model list below). The quirk would then check presence
+of the Broadcom 4331 in slot 0 below the root port and do its deed.
+
+Note that the quirk takes a few shortcuts to reduce the amount of code:
+The size of BAR 0 and the location of the PM capability is identical
+on all affected machines and therefore hardcoded. Only the address of
+BAR 0 differs between models. Also, it is assumed that the BCMA core
+currently mapped is the 802.11 core. The EFI driver seems to always take
+care of this.
+
+Michael BÃŒsch, Bjorn Helgaas and Matt Fleming contributed feedback
+towards finding the best solution to this problem.
+
+The following should be a comprehensive list of affected models:
+    iMac13,1        2012  21.5"       [Root Port 00:1c.3 = 8086:1e16]
+    iMac13,2        2012  27"         [Root Port 00:1c.3 = 8086:1e16]
+    Macmini5,1      2011  i5 2.3 GHz  [Root Port 00:1c.1 = 8086:1c12]
+    Macmini5,2      2011  i5 2.5 GHz  [Root Port 00:1c.1 = 8086:1c12]
+    Macmini5,3      2011  i7 2.0 GHz  [Root Port 00:1c.1 = 8086:1c12]
+    Macmini6,1      2012  i5 2.5 GHz  [Root Port 00:1c.1 = 8086:1e12]
+    Macmini6,2      2012  i7 2.3 GHz  [Root Port 00:1c.1 = 8086:1e12]
+    MacBookPro8,1   2011  13"         [Root Port 00:1c.1 = 8086:1c12]
+    MacBookPro8,2   2011  15"         [Root Port 00:1c.1 = 8086:1c12]
+    MacBookPro8,3   2011  17"         [Root Port 00:1c.1 = 8086:1c12]
+    MacBookPro9,1   2012  15"         [Root Port 00:1c.1 = 8086:1e12]
+    MacBookPro9,2   2012  13"         [Root Port 00:1c.1 = 8086:1e12]
+    MacBookPro10,1  2012  15"         [Root Port 00:1c.1 = 8086:1e12]
+    MacBookPro10,2  2012  13"         [Root Port 00:1c.1 = 8086:1e12]
+
+For posterity, spurious interrupts caused by the Broadcom 4331 wireless
+card resulted in splats like this (stacktrace omitted):
+    irq 17: nobody cared (try booting with the "irqpoll" option)
+    handlers:
+    [<ffffffff81374370>] pcie_isr
+    [<ffffffffc0704550>] sdhci_irq [sdhci] threaded [<ffffffffc07013c0>] sdhci_thread_irq [sdhci]
+    [<ffffffffc0a0b960>] azx_interrupt [snd_hda_codec]
+    Disabling IRQ #17
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=79301
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111781
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=728916
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=895951#c16
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1009819
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1098621
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1149632#c5
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1279130
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1332732
+Cc: Chris Milsted <cmilsted@redhat.com>
+Cc: Matthew Garrett <mjg59@srcf.ucam.org>
+Cc: Chris Bainbridge <chris.bainbridge@gmail.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Michael Buesch <m@bues.ch>
+Cc: Bjorn Helgaas <bhelgaas@google.com>
+Cc: Matt Fleming <matt@codeblueprint.co.uk>
+Cc: x86@kernel.org
+Cc: stable@vger.kernel.org
+Cc: linux-pci@vger.kernel.org
+Cc: linux-kernel@vger.kernel.org
+Cc: linux-wireless@vger.kernel.org
+Cc: b43-dev@lists.infradead.org
+Tested-by: Konstantin Simanov <k.simanov@stlk.ru> # [MacBookPro8,1]
+Tested-by: Lukas Wunner <lukas@wunner.de> # [MacBookPro9,1]
+Tested-by: Chris Bainbridge <chris.bainbridge@gmail.com> # [MacBookPro10,2]
+Signed-off-by: Lukas Wunner <lukas@wunner.de>
+Acked-by: Rafał Miłecki <zajec5@gmail.com>
+---
+ arch/x86/kernel/early-quirks.c | 88 +++++++++++++++++++++++++++++++++++-------
+ drivers/bcma/bcma_private.h    |  2 -
+ include/linux/bcma/bcma.h      |  1 +
+ 3 files changed, 76 insertions(+), 15 deletions(-)
+
+diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
+index bca14c8..514fa84 100644
+--- a/arch/x86/kernel/early-quirks.c
++++ b/arch/x86/kernel/early-quirks.c
+@@ -11,7 +11,11 @@
+ 
+ #include <linux/pci.h>
+ #include <linux/acpi.h>
++#include <linux/delay.h>
++#include <linux/dmi.h>
+ #include <linux/pci_ids.h>
++#include <linux/bcma/bcma.h>
++#include <linux/bcma/bcma_regs.h>
+ #include <drm/i915_drm.h>
+ #include <asm/pci-direct.h>
+ #include <asm/dma.h>
+@@ -21,6 +25,7 @@
+ #include <asm/iommu.h>
+ #include <asm/gart.h>
+ #include <asm/irq_remapping.h>
++#include <asm/early_ioremap.h>
+ 
+ static void __init fix_hypertransport_config(int num, int slot, int func)
+ {
+@@ -76,6 +81,13 @@ static void __init nvidia_bugs(int num, int slot, int func)
+ #ifdef CONFIG_ACPI
+ #ifdef CONFIG_X86_IO_APIC
+ 	/*
++	 * Only applies to Nvidia root ports (bus 0) and not to
++	 * Nvidia graphics cards with PCI ports on secondary buses.
++	 */
++	if (num)
++		return;
++
++	/*
+ 	 * All timer overrides on Nvidia are
+ 	 * wrong unless HPET is enabled.
+ 	 * Unfortunately that's not true on many Asus boards.
+@@ -590,6 +602,47 @@ static void __init force_disable_hpet(int num, int slot, int func)
+ #endif
+ }
+ 
++#define BCM4331_MMIO_SIZE	16384
++#define BCM4331_PM_CAP		0x40
++
++static void __init apple_airport_reset(int bus, int slot, int func)
++{
++	void __iomem *mmio;
++	u16 pmcsr;
++	u64 addr;
++
++	if (!dmi_match(DMI_SYS_VENDOR, "Apple Inc."))
++		return;
++
++	/* Card may have been put into PCI_D3hot by grub quirk */
++	pmcsr = read_pci_config_16(bus, slot, func,
++				   BCM4331_PM_CAP + PCI_PM_CTRL);
++	if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) {
++		pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
++		write_pci_config_16(bus, slot, func,
++				    BCM4331_PM_CAP + PCI_PM_CTRL, pmcsr);
++		mdelay(10);
++		pmcsr = read_pci_config_16(bus, slot, func,
++					   BCM4331_PM_CAP + PCI_PM_CTRL);
++		if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) {
++			pr_err("Cannot power up Apple AirPort card\n");
++			return;
++		}
++	}
++
++	addr  =      read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_0);
++	addr |= (u64)read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_1) << 32;
++	addr &= PCI_BASE_ADDRESS_MEM_MASK;
++	mmio = early_ioremap(addr, BCM4331_MMIO_SIZE);
++	if (!mmio) {
++		pr_err("Cannot iomap Apple AirPort card\n");
++		return;
++	}
++	pr_info("Resetting Apple AirPort card\n");
++	iowrite32(BCMA_RESET_CTL_RESET,
++		  mmio + (1 * BCMA_CORE_SIZE) + BCMA_RESET_CTL);
++	early_iounmap(mmio, BCM4331_MMIO_SIZE);
++}
+ 
+ #define QFLAG_APPLY_ONCE 	0x1
+ #define QFLAG_APPLIED		0x2
+@@ -603,12 +656,6 @@ struct chipset {
+ 	void (*f)(int num, int slot, int func);
+ };
+ 
+-/*
+- * Only works for devices on the root bus. If you add any devices
+- * not on bus 0 readd another loop level in early_quirks(). But
+- * be careful because at least the Nvidia quirk here relies on
+- * only matching on bus 0.
+- */
+ static struct chipset early_qrk[] __initdata = {
+ 	{ PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+ 	  PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs },
+@@ -638,9 +685,13 @@ static struct chipset early_qrk[] __initdata = {
+ 	 */
+ 	{ PCI_VENDOR_ID_INTEL, 0x0f00,
+ 		PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet},
++	{ PCI_VENDOR_ID_BROADCOM, 0x4331,
++	  PCI_CLASS_NETWORK_OTHER, PCI_ANY_ID, 0, apple_airport_reset},
+ 	{}
+ };
+ 
++static void __init early_pci_scan_bus(int bus);
++
+ /**
+  * check_dev_quirk - apply early quirks to a given PCI device
+  * @num: bus number
+@@ -649,7 +700,7 @@ static struct chipset early_qrk[] __initdata = {
+  *
+  * Check the vendor & device ID against the early quirks table.
+  *
+- * If the device is single function, let early_quirks() know so we don't
++ * If the device is single function, let early_pci_scan_bus() know so we don't
+  * poke at this device again.
+  */
+ static int __init check_dev_quirk(int num, int slot, int func)
+@@ -658,6 +709,7 @@ static int __init check_dev_quirk(int num, int slot, int func)
+ 	u16 vendor;
+ 	u16 device;
+ 	u8 type;
++	u8 sec;
+ 	int i;
+ 
+ 	class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE);
+@@ -685,25 +737,35 @@ static int __init check_dev_quirk(int num, int slot, int func)
+ 
+ 	type = read_pci_config_byte(num, slot, func,
+ 				    PCI_HEADER_TYPE);
++
++	if ((type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) {
++		sec = read_pci_config_byte(num, slot, func, PCI_SECONDARY_BUS);
++		early_pci_scan_bus(sec);
++	}
++
+ 	if (!(type & 0x80))
+ 		return -1;
+ 
+ 	return 0;
+ }
+ 
+-void __init early_quirks(void)
++static void __init early_pci_scan_bus(int bus)
+ {
+ 	int slot, func;
+ 
+-	if (!early_pci_allowed())
+-		return;
+-
+ 	/* Poor man's PCI discovery */
+-	/* Only scan the root bus */
+ 	for (slot = 0; slot < 32; slot++)
+ 		for (func = 0; func < 8; func++) {
+ 			/* Only probe function 0 on single fn devices */
+-			if (check_dev_quirk(0, slot, func))
++			if (check_dev_quirk(bus, slot, func))
+ 				break;
+ 		}
+ }
++
++void __init early_quirks(void)
++{
++	if (!early_pci_allowed())
++		return;
++
++	early_pci_scan_bus(0);
++}
+diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
+index eda0909..f642c42 100644
+--- a/drivers/bcma/bcma_private.h
++++ b/drivers/bcma/bcma_private.h
+@@ -8,8 +8,6 @@
+ #include <linux/bcma/bcma.h>
+ #include <linux/delay.h>
+ 
+-#define BCMA_CORE_SIZE		0x1000
+-
+ #define bcma_err(bus, fmt, ...) \
+ 	pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__)
+ #define bcma_warn(bus, fmt, ...) \
+diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
+index 0367c63..5c37b58 100644
+--- a/include/linux/bcma/bcma.h
++++ b/include/linux/bcma/bcma.h
+@@ -158,6 +158,7 @@ struct bcma_host_ops {
+ #define BCMA_CORE_DEFAULT		0xFFF
+ 
+ #define BCMA_MAX_NR_CORES		16
++#define BCMA_CORE_SIZE			0x1000
+ 
+ /* Chip IDs of PCIe devices */
+ #define BCMA_CHIP_ID_BCM4313	0x4313
+-- 
+2.8.1
diff --git a/a/content_digest b/N1/content_digest
index d55ce13..b92e386 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -28,6 +28,340 @@
  "\n"
  "Lukas\n"
  "\n"
- -- >8 --
+ "-- >8 --\n"
+ ">From 37ddc5de665e155df1ceee475d851a21f16c4aba Mon Sep 17 00:00:00 2001\n"
+ "From: Lukas Wunner <lukas@wunner.de>\n"
+ "Date: Mon, 23 May 2016 19:05:00 +0200\n"
+ "Subject: [PATCH] x86: Add early quirk to reset Apple AirPort card\n"
+ "MIME-Version: 1.0\n"
+ "Content-Type: text/plain; charset=UTF-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
+ "\n"
+ "The EFI firmware on Macs contains a full-fledged network stack for\n"
+ "downloading OS X images from osrecovery.apple.com. Unfortunately\n"
+ "on Macs introduced 2011 and 2012, EFI brings up the Broadcom 4331\n"
+ "wireless card on every boot and leaves it enabled even after\n"
+ "ExitBootServices has been called. The card continues to assert its IRQ\n"
+ "line, causing spurious interrupts if the IRQ is shared. It also corrupts\n"
+ "memory by DMAing received packets, allowing for remote code execution\n"
+ "over the air. This only stops when a driver is loaded for the wireless\n"
+ "card, which may be never if the driver is not installed or blacklisted.\n"
+ "\n"
+ "The issue seems to be constrained to the Broadcom 4331. Chris Milsted\n"
+ "has verified that the newer Broadcom 4360 built into the MacBookPro11,3\n"
+ "(2013/2014) does not exhibit this behaviour. The chances that Apple will\n"
+ "ever supply a firmware fix for the older machines appear to be zero.\n"
+ "\n"
+ "The solution is to reset the card on boot by writing to a reset bit in\n"
+ "its mmio space. This must be done as an early quirk and not as a plain\n"
+ "vanilla PCI quirk to successfully combat memory corruption by DMAed\n"
+ "packets: Matthew Garrett found out in 2012 that the packets are written\n"
+ "to EfiBootServicesData memory (http://mjg59.dreamwidth.org/11235.html).\n"
+ "This type of memory is made available to the page allocator by\n"
+ "efi_free_boot_services(). Plain vanilla PCI quirks run much later, in\n"
+ "subsys initcall level. In-between a time window would be open for memory\n"
+ "corruption. Random crashes occurring in this time window and attributed\n"
+ "to DMAed packets have indeed been observed in the wild by Chris\n"
+ "Bainbridge.\n"
+ "\n"
+ "When Matthew Garrett analyzed the memory corruption issue in 2012, he\n"
+ "sought to fix it with a grub quirk which transitions the card to D3hot:\n"
+ "http://git.savannah.gnu.org/cgit/grub.git/commit/?id=9d34bb85da56\n"
+ "\n"
+ "This approach does not help users with other bootloaders and while it\n"
+ "may prevent DMAed packets, it does not cure the spurious interrupts\n"
+ "emanating from the card. Unfortunately the card's mmio space is\n"
+ "inaccessible in D3hot, so to reset it, we have to undo the effect of\n"
+ "Matthew's grub patch and transition the card back to D0.\n"
+ "\n"
+ "Since commit 8659c406ade3 (\"x86: only scan the root bus in early PCI\n"
+ "quirks\"), early quirks can only be applied to devices on the root bus.\n"
+ "However the Broadcom 4331 card is located on a secondary bus behind a\n"
+ "PCIe root port. The present commit therefore reintroduces scanning of\n"
+ "secondary buses. The primary motivation of 8659c406ade3 was to prevent\n"
+ "application of the nvidia_bugs() quirk on secondary buses. Amend the\n"
+ "quirk to open code this requirement.\n"
+ "\n"
+ "A secondary motivation was to speed up PCI scanning. The algorithm used\n"
+ "prior to 8659c406ade3 was particularly time consuming because it scanned\n"
+ "buses 0 to 31 brute force. The recursive algorithm used by the present\n"
+ "commit only scans buses that are actually reachable from the root bus\n"
+ "and should thus be a bit faster. If this algorithm is found to\n"
+ "significantly impact boot time, it would be possible to limit its\n"
+ "recursion depth: The Apple AirPort quirk applies at depth 1, all others\n"
+ "at depth 0, so the bus need not be scanned deeper than that for now. An\n"
+ "alternative approach would be to continue scanning only the root bus,\n"
+ "and apply the AirPort quirk to the root ports 8086:1c12, 8086:1e12 and\n"
+ "8086:1e16. Apple always positioned the Broadcom 4331 behind one of these\n"
+ "three ports (see model list below). The quirk would then check presence\n"
+ "of the Broadcom 4331 in slot 0 below the root port and do its deed.\n"
+ "\n"
+ "Note that the quirk takes a few shortcuts to reduce the amount of code:\n"
+ "The size of BAR 0 and the location of the PM capability is identical\n"
+ "on all affected machines and therefore hardcoded. Only the address of\n"
+ "BAR 0 differs between models. Also, it is assumed that the BCMA core\n"
+ "currently mapped is the 802.11 core. The EFI driver seems to always take\n"
+ "care of this.\n"
+ "\n"
+ "Michael B\303\203\305\222sch, Bjorn Helgaas and Matt Fleming contributed feedback\n"
+ "towards finding the best solution to this problem.\n"
+ "\n"
+ "The following should be a comprehensive list of affected models:\n"
+ "    iMac13,1        2012  21.5\"       [Root Port 00:1c.3 = 8086:1e16]\n"
+ "    iMac13,2        2012  27\"         [Root Port 00:1c.3 = 8086:1e16]\n"
+ "    Macmini5,1      2011  i5 2.3 GHz  [Root Port 00:1c.1 = 8086:1c12]\n"
+ "    Macmini5,2      2011  i5 2.5 GHz  [Root Port 00:1c.1 = 8086:1c12]\n"
+ "    Macmini5,3      2011  i7 2.0 GHz  [Root Port 00:1c.1 = 8086:1c12]\n"
+ "    Macmini6,1      2012  i5 2.5 GHz  [Root Port 00:1c.1 = 8086:1e12]\n"
+ "    Macmini6,2      2012  i7 2.3 GHz  [Root Port 00:1c.1 = 8086:1e12]\n"
+ "    MacBookPro8,1   2011  13\"         [Root Port 00:1c.1 = 8086:1c12]\n"
+ "    MacBookPro8,2   2011  15\"         [Root Port 00:1c.1 = 8086:1c12]\n"
+ "    MacBookPro8,3   2011  17\"         [Root Port 00:1c.1 = 8086:1c12]\n"
+ "    MacBookPro9,1   2012  15\"         [Root Port 00:1c.1 = 8086:1e12]\n"
+ "    MacBookPro9,2   2012  13\"         [Root Port 00:1c.1 = 8086:1e12]\n"
+ "    MacBookPro10,1  2012  15\"         [Root Port 00:1c.1 = 8086:1e12]\n"
+ "    MacBookPro10,2  2012  13\"         [Root Port 00:1c.1 = 8086:1e12]\n"
+ "\n"
+ "For posterity, spurious interrupts caused by the Broadcom 4331 wireless\n"
+ "card resulted in splats like this (stacktrace omitted):\n"
+ "    irq 17: nobody cared (try booting with the \"irqpoll\" option)\n"
+ "    handlers:\n"
+ "    [<ffffffff81374370>] pcie_isr\n"
+ "    [<ffffffffc0704550>] sdhci_irq [sdhci] threaded [<ffffffffc07013c0>] sdhci_thread_irq [sdhci]\n"
+ "    [<ffffffffc0a0b960>] azx_interrupt [snd_hda_codec]\n"
+ "    Disabling IRQ #17\n"
+ "\n"
+ "Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=79301\n"
+ "Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111781\n"
+ "Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=728916\n"
+ "Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=895951#c16\n"
+ "Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1009819\n"
+ "Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1098621\n"
+ "Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1149632#c5\n"
+ "Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1279130\n"
+ "Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1332732\n"
+ "Cc: Chris Milsted <cmilsted@redhat.com>\n"
+ "Cc: Matthew Garrett <mjg59@srcf.ucam.org>\n"
+ "Cc: Chris Bainbridge <chris.bainbridge@gmail.com>\n"
+ "Cc: Andi Kleen <ak@linux.intel.com>\n"
+ "Cc: Michael Buesch <m@bues.ch>\n"
+ "Cc: Bjorn Helgaas <bhelgaas@google.com>\n"
+ "Cc: Matt Fleming <matt@codeblueprint.co.uk>\n"
+ "Cc: x86@kernel.org\n"
+ "Cc: stable@vger.kernel.org\n"
+ "Cc: linux-pci@vger.kernel.org\n"
+ "Cc: linux-kernel@vger.kernel.org\n"
+ "Cc: linux-wireless@vger.kernel.org\n"
+ "Cc: b43-dev@lists.infradead.org\n"
+ "Tested-by: Konstantin Simanov <k.simanov@stlk.ru> # [MacBookPro8,1]\n"
+ "Tested-by: Lukas Wunner <lukas@wunner.de> # [MacBookPro9,1]\n"
+ "Tested-by: Chris Bainbridge <chris.bainbridge@gmail.com> # [MacBookPro10,2]\n"
+ "Signed-off-by: Lukas Wunner <lukas@wunner.de>\n"
+ "Acked-by: Rafa\303\205\302\202 Mi\303\205\302\202ecki <zajec5@gmail.com>\n"
+ "---\n"
+ " arch/x86/kernel/early-quirks.c | 88 +++++++++++++++++++++++++++++++++++-------\n"
+ " drivers/bcma/bcma_private.h    |  2 -\n"
+ " include/linux/bcma/bcma.h      |  1 +\n"
+ " 3 files changed, 76 insertions(+), 15 deletions(-)\n"
+ "\n"
+ "diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c\n"
+ "index bca14c8..514fa84 100644\n"
+ "--- a/arch/x86/kernel/early-quirks.c\n"
+ "+++ b/arch/x86/kernel/early-quirks.c\n"
+ "@@ -11,7 +11,11 @@\n"
+ " \n"
+ " #include <linux/pci.h>\n"
+ " #include <linux/acpi.h>\n"
+ "+#include <linux/delay.h>\n"
+ "+#include <linux/dmi.h>\n"
+ " #include <linux/pci_ids.h>\n"
+ "+#include <linux/bcma/bcma.h>\n"
+ "+#include <linux/bcma/bcma_regs.h>\n"
+ " #include <drm/i915_drm.h>\n"
+ " #include <asm/pci-direct.h>\n"
+ " #include <asm/dma.h>\n"
+ "@@ -21,6 +25,7 @@\n"
+ " #include <asm/iommu.h>\n"
+ " #include <asm/gart.h>\n"
+ " #include <asm/irq_remapping.h>\n"
+ "+#include <asm/early_ioremap.h>\n"
+ " \n"
+ " static void __init fix_hypertransport_config(int num, int slot, int func)\n"
+ " {\n"
+ "@@ -76,6 +81,13 @@ static void __init nvidia_bugs(int num, int slot, int func)\n"
+ " #ifdef CONFIG_ACPI\n"
+ " #ifdef CONFIG_X86_IO_APIC\n"
+ " \t/*\n"
+ "+\t * Only applies to Nvidia root ports (bus 0) and not to\n"
+ "+\t * Nvidia graphics cards with PCI ports on secondary buses.\n"
+ "+\t */\n"
+ "+\tif (num)\n"
+ "+\t\treturn;\n"
+ "+\n"
+ "+\t/*\n"
+ " \t * All timer overrides on Nvidia are\n"
+ " \t * wrong unless HPET is enabled.\n"
+ " \t * Unfortunately that's not true on many Asus boards.\n"
+ "@@ -590,6 +602,47 @@ static void __init force_disable_hpet(int num, int slot, int func)\n"
+ " #endif\n"
+ " }\n"
+ " \n"
+ "+#define BCM4331_MMIO_SIZE\t16384\n"
+ "+#define BCM4331_PM_CAP\t\t0x40\n"
+ "+\n"
+ "+static void __init apple_airport_reset(int bus, int slot, int func)\n"
+ "+{\n"
+ "+\tvoid __iomem *mmio;\n"
+ "+\tu16 pmcsr;\n"
+ "+\tu64 addr;\n"
+ "+\n"
+ "+\tif (!dmi_match(DMI_SYS_VENDOR, \"Apple Inc.\"))\n"
+ "+\t\treturn;\n"
+ "+\n"
+ "+\t/* Card may have been put into PCI_D3hot by grub quirk */\n"
+ "+\tpmcsr = read_pci_config_16(bus, slot, func,\n"
+ "+\t\t\t\t   BCM4331_PM_CAP + PCI_PM_CTRL);\n"
+ "+\tif ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) {\n"
+ "+\t\tpmcsr &= ~PCI_PM_CTRL_STATE_MASK;\n"
+ "+\t\twrite_pci_config_16(bus, slot, func,\n"
+ "+\t\t\t\t    BCM4331_PM_CAP + PCI_PM_CTRL, pmcsr);\n"
+ "+\t\tmdelay(10);\n"
+ "+\t\tpmcsr = read_pci_config_16(bus, slot, func,\n"
+ "+\t\t\t\t\t   BCM4331_PM_CAP + PCI_PM_CTRL);\n"
+ "+\t\tif ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) {\n"
+ "+\t\t\tpr_err(\"Cannot power up Apple AirPort card\\n\");\n"
+ "+\t\t\treturn;\n"
+ "+\t\t}\n"
+ "+\t}\n"
+ "+\n"
+ "+\taddr  =      read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_0);\n"
+ "+\taddr |= (u64)read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_1) << 32;\n"
+ "+\taddr &= PCI_BASE_ADDRESS_MEM_MASK;\n"
+ "+\tmmio = early_ioremap(addr, BCM4331_MMIO_SIZE);\n"
+ "+\tif (!mmio) {\n"
+ "+\t\tpr_err(\"Cannot iomap Apple AirPort card\\n\");\n"
+ "+\t\treturn;\n"
+ "+\t}\n"
+ "+\tpr_info(\"Resetting Apple AirPort card\\n\");\n"
+ "+\tiowrite32(BCMA_RESET_CTL_RESET,\n"
+ "+\t\t  mmio + (1 * BCMA_CORE_SIZE) + BCMA_RESET_CTL);\n"
+ "+\tearly_iounmap(mmio, BCM4331_MMIO_SIZE);\n"
+ "+}\n"
+ " \n"
+ " #define QFLAG_APPLY_ONCE \t0x1\n"
+ " #define QFLAG_APPLIED\t\t0x2\n"
+ "@@ -603,12 +656,6 @@ struct chipset {\n"
+ " \tvoid (*f)(int num, int slot, int func);\n"
+ " };\n"
+ " \n"
+ "-/*\n"
+ "- * Only works for devices on the root bus. If you add any devices\n"
+ "- * not on bus 0 readd another loop level in early_quirks(). But\n"
+ "- * be careful because at least the Nvidia quirk here relies on\n"
+ "- * only matching on bus 0.\n"
+ "- */\n"
+ " static struct chipset early_qrk[] __initdata = {\n"
+ " \t{ PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,\n"
+ " \t  PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs },\n"
+ "@@ -638,9 +685,13 @@ static struct chipset early_qrk[] __initdata = {\n"
+ " \t */\n"
+ " \t{ PCI_VENDOR_ID_INTEL, 0x0f00,\n"
+ " \t\tPCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet},\n"
+ "+\t{ PCI_VENDOR_ID_BROADCOM, 0x4331,\n"
+ "+\t  PCI_CLASS_NETWORK_OTHER, PCI_ANY_ID, 0, apple_airport_reset},\n"
+ " \t{}\n"
+ " };\n"
+ " \n"
+ "+static void __init early_pci_scan_bus(int bus);\n"
+ "+\n"
+ " /**\n"
+ "  * check_dev_quirk - apply early quirks to a given PCI device\n"
+ "  * @num: bus number\n"
+ "@@ -649,7 +700,7 @@ static struct chipset early_qrk[] __initdata = {\n"
+ "  *\n"
+ "  * Check the vendor & device ID against the early quirks table.\n"
+ "  *\n"
+ "- * If the device is single function, let early_quirks() know so we don't\n"
+ "+ * If the device is single function, let early_pci_scan_bus() know so we don't\n"
+ "  * poke at this device again.\n"
+ "  */\n"
+ " static int __init check_dev_quirk(int num, int slot, int func)\n"
+ "@@ -658,6 +709,7 @@ static int __init check_dev_quirk(int num, int slot, int func)\n"
+ " \tu16 vendor;\n"
+ " \tu16 device;\n"
+ " \tu8 type;\n"
+ "+\tu8 sec;\n"
+ " \tint i;\n"
+ " \n"
+ " \tclass = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE);\n"
+ "@@ -685,25 +737,35 @@ static int __init check_dev_quirk(int num, int slot, int func)\n"
+ " \n"
+ " \ttype = read_pci_config_byte(num, slot, func,\n"
+ " \t\t\t\t    PCI_HEADER_TYPE);\n"
+ "+\n"
+ "+\tif ((type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) {\n"
+ "+\t\tsec = read_pci_config_byte(num, slot, func, PCI_SECONDARY_BUS);\n"
+ "+\t\tearly_pci_scan_bus(sec);\n"
+ "+\t}\n"
+ "+\n"
+ " \tif (!(type & 0x80))\n"
+ " \t\treturn -1;\n"
+ " \n"
+ " \treturn 0;\n"
+ " }\n"
+ " \n"
+ "-void __init early_quirks(void)\n"
+ "+static void __init early_pci_scan_bus(int bus)\n"
+ " {\n"
+ " \tint slot, func;\n"
+ " \n"
+ "-\tif (!early_pci_allowed())\n"
+ "-\t\treturn;\n"
+ "-\n"
+ " \t/* Poor man's PCI discovery */\n"
+ "-\t/* Only scan the root bus */\n"
+ " \tfor (slot = 0; slot < 32; slot++)\n"
+ " \t\tfor (func = 0; func < 8; func++) {\n"
+ " \t\t\t/* Only probe function 0 on single fn devices */\n"
+ "-\t\t\tif (check_dev_quirk(0, slot, func))\n"
+ "+\t\t\tif (check_dev_quirk(bus, slot, func))\n"
+ " \t\t\t\tbreak;\n"
+ " \t\t}\n"
+ " }\n"
+ "+\n"
+ "+void __init early_quirks(void)\n"
+ "+{\n"
+ "+\tif (!early_pci_allowed())\n"
+ "+\t\treturn;\n"
+ "+\n"
+ "+\tearly_pci_scan_bus(0);\n"
+ "+}\n"
+ "diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h\n"
+ "index eda0909..f642c42 100644\n"
+ "--- a/drivers/bcma/bcma_private.h\n"
+ "+++ b/drivers/bcma/bcma_private.h\n"
+ "@@ -8,8 +8,6 @@\n"
+ " #include <linux/bcma/bcma.h>\n"
+ " #include <linux/delay.h>\n"
+ " \n"
+ "-#define BCMA_CORE_SIZE\t\t0x1000\n"
+ "-\n"
+ " #define bcma_err(bus, fmt, ...) \\\n"
+ " \tpr_err(\"bus%d: \" fmt, (bus)->num, ##__VA_ARGS__)\n"
+ " #define bcma_warn(bus, fmt, ...) \\\n"
+ "diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h\n"
+ "index 0367c63..5c37b58 100644\n"
+ "--- a/include/linux/bcma/bcma.h\n"
+ "+++ b/include/linux/bcma/bcma.h\n"
+ "@@ -158,6 +158,7 @@ struct bcma_host_ops {\n"
+ " #define BCMA_CORE_DEFAULT\t\t0xFFF\n"
+ " \n"
+ " #define BCMA_MAX_NR_CORES\t\t16\n"
+ "+#define BCMA_CORE_SIZE\t\t\t0x1000\n"
+ " \n"
+ " /* Chip IDs of PCIe devices */\n"
+ " #define BCMA_CHIP_ID_BCM4313\t0x4313\n"
+ "-- \n"
+ 2.8.1
 
-b695997f45368955bc805602a166bd04c498c442196b0946945dc8fe73ff1e3a
+22994682d2248b03634d4142a4de174ecf5a1cf284dc493864c425d6e9ffd5c0

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.