mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Myron Stowe <myron.stowe@redhat.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 3.13.y-ckt 74/80] PCI: Handle read-only BARs on AMD CS553x devices
Date: Thu, 19 Mar 2015 15:36:02 -0700	[thread overview]
Message-ID: <1426804568-2907-75-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1426804568-2907-1-git-send-email-kamal@canonical.com>

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

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

From: Myron Stowe <myron.stowe@redhat.com>

commit 06cf35f903aa6da0cc8d9f81e9bcd1f7e1b534bb upstream.

Some AMD CS553x devices have read-only BARs because of a firmware or
hardware defect.  There's a workaround in quirk_cs5536_vsa(), but it no
longer works after 36e8164882ca ("PCI: Restore detection of read-only
BARs").  Prior to 36e8164882ca, we filled in res->start; afterwards we
leave it zeroed out.  The quirk only updated the size, so the driver tried
to use a region starting at zero, which didn't work.

Expand quirk_cs5536_vsa() to read the base addresses from the BARs and
hard-code the sizes.

On Nix's system BAR 2's read-only value is 0x6200.  Prior to 36e8164882ca,
we interpret that as a 512-byte BAR based on the lowest-order bit set.  Per
datasheet sec 5.6.1, that BAR (MFGPT) requires only 64 bytes; use that to
avoid clearing any address bits if a platform uses only 64-byte alignment.

[bhelgaas: changelog, reduce BAR 2 size to 64]
Fixes: 36e8164882ca ("PCI: Restore detection of read-only BARs")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=85991#c4
Link: http://support.amd.com/TechDocs/31506_cs5535_databook.pdf
Link: http://support.amd.com/TechDocs/33238G_cs5536_db.pdf
Reported-and-tested-by: Nix <nix@esperi.org.uk>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
[ kamal: backport to 3.13-stable: pcibios_bus_to_resource takes (pci_dev *) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/pci/quirks.c | 41 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 0fdf4d1..c9564d4 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -323,19 +323,52 @@ static void quirk_s3_64M(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3,	PCI_DEVICE_ID_S3_868,		quirk_s3_64M);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3,	PCI_DEVICE_ID_S3_968,		quirk_s3_64M);
 
+static void quirk_io(struct pci_dev *dev, int pos, unsigned size,
+		     const char *name)
+{
+	u32 region;
+	struct pci_bus_region bus_region;
+	struct resource *res = dev->resource + pos;
+
+	pci_read_config_dword(dev, PCI_BASE_ADDRESS_0 + (pos << 2), &region);
+
+	if (!region)
+		return;
+
+	res->name = pci_name(dev);
+	res->flags = region & ~PCI_BASE_ADDRESS_IO_MASK;
+	res->flags |=
+		(IORESOURCE_IO | IORESOURCE_PCI_FIXED | IORESOURCE_SIZEALIGN);
+	region &= ~(size - 1);
+
+	/* Convert from PCI bus to resource space */
+	bus_region.start = region;
+	bus_region.end = region + size - 1;
+	pcibios_bus_to_resource(dev, res, &bus_region);
+
+	dev_info(&dev->dev, FW_BUG "%s quirk: reg 0x%x: %pR\n",
+		 name, PCI_BASE_ADDRESS_0 + (pos << 2), res);
+}
+
 /*
  * Some CS5536 BIOSes (for example, the Soekris NET5501 board w/ comBIOS
  * ver. 1.33  20070103) don't set the correct ISA PCI region header info.
  * BAR0 should be 8 bytes; instead, it may be set to something like 8k
  * (which conflicts w/ BAR1's memory range).
+ *
+ * CS553x's ISA PCI BARs may also be read-only (ref:
+ * https://bugzilla.kernel.org/show_bug.cgi?id=85991 - Comment #4 forward).
  */
 static void quirk_cs5536_vsa(struct pci_dev *dev)
 {
+	static char *name = "CS5536 ISA bridge";
+
 	if (pci_resource_len(dev, 0) != 8) {
-		struct resource *res = &dev->resource[0];
-		res->end = res->start + 8 - 1;
-		dev_info(&dev->dev, "CS5536 ISA bridge bug detected "
-				"(incorrect header); workaround applied.\n");
+		quirk_io(dev, 0,   8, name);	/* SMB */
+		quirk_io(dev, 1, 256, name);	/* GPIO */
+		quirk_io(dev, 2,  64, name);	/* MFGPT */
+		dev_info(&dev->dev, "%s bug detected (incorrect header); workaround applied\n",
+			 name);
 	}
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, quirk_cs5536_vsa);
-- 
1.9.1


  parent reply	other threads:[~2015-03-19 22:39 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 22:34 [3.13.y-ckt stable] Linux 3.13.11-ckt17 stable review Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 01/80] splice: Apply generic position and size checks to each write Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 02/80] clocksource: arch_timer: Only use the virtual counter (CNTVCT) on arm64 Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 03/80] openvswitch: Silence RCU lockdep checks from flow lookup Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 04/80] openvswitch: Use exact lookup for flow_get and flow_del Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 05/80] Bluetooth: Enable Atheros 0cf3:311e for firmware upload Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 06/80] Bluetooth: Add firmware update for Atheros 0cf3:311f Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 07/80] Bluetooth: btusb: Add IMC Networks (Broadcom based) Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 08/80] Bluetooth: sort the list of IDs in the source code Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 09/80] Bluetooth: append new supported device to the list [0b05:17d0] Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 10/80] Bluetooth: Add support for Intel bootloader devices Kamal Mostafa
2015-03-19 22:34 ` [PATCH 3.13.y-ckt 11/80] Bluetooth: Ignore isochronous endpoints for Intel USB bootloader Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 12/80] Bluetooth: Add support for Acer [13D3:3432] Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 13/80] Bluetooth: Add support for Broadcom device of Asus Z97-DELUXE motherboard Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 14/80] Add a new PID/VID 0227/0930 for AR3012 Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 15/80] Bluetooth: Add support for Acer [0489:e078] Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 16/80] Bluetooth: Add USB device 04ca:3010 as Atheros AR3012 Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 17/80] x86: mm: move mmap_sem unlock from mm_fault_error() to caller Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 18/80] vm: add VM_FAULT_SIGSEGV handling support Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 19/80] vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 20/80] net: sctp: fix slab corruption from use after free on INIT collisions Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 21/80] ipv4: try to cache dst_entries which would cause a redirect Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 22/80] x86, mm/ASLR: Fix stack randomization on 64-bit systems Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 23/80] net: llc: use correct size for sysctl timeout entries Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 24/80] net: rds: use correct size for max unacked packets and bytes Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 25/80] spi/pxa2xx: Clear cur_chip pointer before starting next message Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 26/80] spi: dw: Fix detecting FIFO depth Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 27/80] spi: dw-mid: fix FIFO size Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 28/80] ASoC: wm8960: Fix capture sample rate from 11250 to 11025 Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 29/80] regulator: core: fix race condition in regulator_put() Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 30/80] ASoC: omap-mcbsp: Correct CBM_CFS dai format configuration Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 31/80] powerpc/xmon: Fix another endiannes issue in RTAS call from xmon Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 32/80] can: c_can: end pending transmission on network stop (ifdown) Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 33/80] nfs: fix dio deadlock when O_DIRECT flag is flipped Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 34/80] NFSv4.1: Fix an Oops in nfs41_walk_client_list Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 35/80] Input: i8042 - add noloop quirk for Medion Akoya E7225 (MD98857) Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 36/80] mac80211: properly set CCK flag in radiotap Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 37/80] nl80211: fix per-station group key get/del and memory leak Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 38/80] i2c: s3c2410: fix ABBA deadlock by keeping clock prepared Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 39/80] usb-storage/SCSI: blacklist FUA on JMicron 152d:2566 USB-SATA controller Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 40/80] drm/i915: Only fence tiled region of object Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 41/80] drm/i915: Fix and clean BDW PCH identification Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 42/80] drm/i915: BDW Fix Halo PCI IDs marked as ULT Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 43/80] ALSA: seq-dummy: remove deadlock-causing events on close Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 44/80] drivers/rtc/rtc-s5m.c: terminate s5m_rtc_id array with empty element Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 45/80] drivers: net: cpsw: discard dual emac default vlan configuration Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 46/80] can: kvaser_usb: Do not sleep in atomic context Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 47/80] can: kvaser_usb: Send correct context to URB completion Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 48/80] can: kvaser_usb: Retry the first bulk transfer on -ETIMEDOUT Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 49/80] can: kvaser_usb: Fix state handling upon BUS_ERROR events Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 50/80] quota: Switch ->get_dqblk() and ->set_dqblk() to use bytes as space units Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 51/80] rbd: fix rbd_dev_parent_get() when parent_overlap == 0 Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 52/80] rbd: drop parent_ref in rbd_dev_unprobe() unconditionally Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 53/80] dm cache: fix missing ERR_PTR returns and handling Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 54/80] dm thin: don't allow messages to be sent to a pool target in READ_ONLY or FAIL mode Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 55/80] net: cls_bpf: fix size mismatch on filter preparation Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 56/80] net: cls_bpf: fix auto generation of per list handles Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 57/80] ipv6: replacing a rt6_info needs to purge possible propagated rt6_infos too Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 58/80] perf: Tighten (and fix) the grouping condition Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 59/80] arc: mm: Fix build failure Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 60/80] MIPS: IRQ: Fix disable_irq on CPU IRQs Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 61/80] Complete oplock break jobs before closing file handle Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 62/80] smpboot: Add missing get_online_cpus() in smpboot_register_percpu_thread() Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 63/80] ASoC: atmel_ssc_dai: fix start event for I2S mode Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 64/80] spi: fsl-dspi: Fix memory leak Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 65/80] spi: spi-fsl-dspi: Remove usage of devm_kzalloc Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 66/80] ALSA: ak411x: Fix stall in work callback Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 67/80] lib/checksum.c: fix carry in csum_tcpudp_nofold Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 68/80] MIPS: Fix kernel lockup or crash after CPU offline/online Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 69/80] gpio: sysfs: fix memory leak in gpiod_export_link Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 70/80] gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low Kamal Mostafa
2015-03-19 22:35 ` [PATCH 3.13.y-ckt 71/80] MIPS: Fix C0_Pagegrain[IEC] support Kamal Mostafa
2015-03-19 23:10   ` David Daney
2015-03-20 17:02     ` Kamal Mostafa
2015-03-19 22:36 ` [PATCH 3.13.y-ckt 72/80] PCI: Add NEC variants to Stratus ftServer PCIe DMI check Kamal Mostafa
2015-03-19 22:36 ` [PATCH 3.13.y-ckt 73/80] ASoC: sgtl5000: add delay before first I2C access Kamal Mostafa
2015-03-19 22:36 ` Kamal Mostafa [this message]
2015-03-19 22:36 ` [PATCH 3.13.y-ckt 75/80] mm: pagewalk: call pte_hole() for VM_PFNMAP during walk_page_range Kamal Mostafa
2015-03-19 22:36 ` [PATCH 3.13.y-ckt 76/80] nilfs2: fix deadlock of segment constructor over I_SYNC flag Kamal Mostafa
2015-03-19 22:36 ` [PATCH 3.13.y-ckt 77/80] tcp: ipv4: initialize unicast_sock sk_pacing_rate Kamal Mostafa
2015-03-19 22:36 ` [PATCH 3.13.y-ckt 78/80] caif: remove wrong dev_net_set() call Kamal Mostafa
2015-03-19 22:36 ` [PATCH 3.13.y-ckt 79/80] qlge: Fix qlge_update_hw_vlan_features to handle if interface is down Kamal Mostafa
2015-03-19 22:36 ` [PATCH 3.13.y-ckt 80/80] ip6_gre: fix endianness errors in ip6gre_err Kamal Mostafa

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=1426804568-2907-75-git-send-email-kamal@canonical.com \
    --to=kamal@canonical.com \
    --cc=bhelgaas@google.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myron.stowe@redhat.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

all inboxes | Powered by JetHome®