summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Leemhuis <fedora@leemhuis.info>2017-08-07 22:18:50 +0200
committerThorsten Leemhuis <fedora@leemhuis.info>2017-08-07 22:18:50 +0200
commitc7f1223e08e38f9dbb90bea031200f07a84c4b01 (patch)
tree65c3fccea11f1d8568b1de1d8c79c45ae79e1e52
parentea2a781a48382a50aaf33c945afb1116f81c40ee (diff)
parent0e2d67d2d2507df7517e72f6bdb99c2dab21ff2a (diff)
downloadkernel-c7f1223e08e38f9dbb90bea031200f07a84c4b01.tar.gz
kernel-c7f1223e08e38f9dbb90bea031200f07a84c4b01.tar.xz
kernel-c7f1223e08e38f9dbb90bea031200f07a84c4b01.zip
-rw-r--r--bcm283x-dma-mapping-skip-USB-devices-when-configuring-DMA-during-probe.patch127
-rw-r--r--kernel.spec22
-rw-r--r--sources3
3 files changed, 144 insertions, 8 deletions
diff --git a/bcm283x-dma-mapping-skip-USB-devices-when-configuring-DMA-during-probe.patch b/bcm283x-dma-mapping-skip-USB-devices-when-configuring-DMA-during-probe.patch
new file mode 100644
index 000000000..c6f7f12de
--- /dev/null
+++ b/bcm283x-dma-mapping-skip-USB-devices-when-configuring-DMA-during-probe.patch
@@ -0,0 +1,127 @@
+From patchwork Thu Aug 3 15:52:08 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v3] dma-mapping: skip USB devices when configuring DMA during probe
+From: Johan Hovold <johan@kernel.org>
+X-Patchwork-Id: 9879371
+Message-Id: <20170803155208.22165-1-johan@kernel.org>
+To: Christoph Hellwig <hch@lst.de>,
+ Marek Szyprowski <m.szyprowski@samsung.com>,
+ Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>,
+ linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
+ Alan Stern <stern@rowland.harvard.edu>, Johan Hovold <johan@kernel.org>,
+ stable <stable@vger.kernel.org>, Robin Murphy <robin.murphy@arm.com>,
+ Sricharan R <sricharan@codeaurora.org>,
+ Stefan Wahren <stefan.wahren@i2se.com>
+Date: Thu, 3 Aug 2017 17:52:08 +0200
+
+USB devices use the DMA mask and offset of the controller, which have
+already been setup when a device is probed. Note that modifying the
+DMA mask of a USB device would change the mask for the controller (and
+all devices on the bus) as the mask is literally shared.
+
+Since commit 2bf698671205 ("USB: of: fix root-hub device-tree node
+handling"), of_dma_configure() would be called also for root hubs, which
+use the device node of the controller. A separate, long-standing bug
+that makes of_dma_configure() generate a 30-bit DMA mask from the RPI3's
+"dma-ranges" would thus set a broken mask also for the controller. This
+in turn prevents USB devices from enumerating when control transfers
+fail:
+
+ dwc2 3f980000.usb: Cannot do DMA to address 0x000000003a166a00
+
+Note that the aforementioned DMA-mask bug was benign for the HCD itself
+as the dwc2 driver overwrites the mask previously set by
+of_dma_configure() for the platform device in its probe callback. The
+mask would only later get corrupted when the root-hub child device was
+probed.
+
+Fix this, and similar future problems, by adding a flag to struct device
+which prevents driver core from calling dma_configure() during probe and
+making sure it is set for USB devices.
+
+Fixes: 09515ef5ddad ("of/acpi: Configure dma operations at probe time for platform/amba/pci bus devices")
+Cc: stable <stable@vger.kernel.org> # 4.12
+Cc: Robin Murphy <robin.murphy@arm.com>
+Cc: Sricharan R <sricharan@codeaurora.org>
+Cc: Stefan Wahren <stefan.wahren@i2se.com>
+Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+---
+
+v3
+ - add flag to struct device to prevent DMA configuration during probe instead
+ of checking for the USB bus type, which is not available when USB is built
+ as a module as noted by Alan
+ - drop moderated rpi list from CC
+
+v2
+ - amend commit message and point out that the long-standing 30-bit DMA-mask
+ bug was benign to the dwc2 HCD itself (Robin)
+ - add and use a new dev_is_usb() helper (Robin)
+
+
+ drivers/base/dma-mapping.c | 6 ++++++
+ drivers/usb/core/usb.c | 1 +
+ include/linux/device.h | 3 +++
+ 3 files changed, 10 insertions(+)
+
+diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
+index b555ff9dd8fc..f9f703be0ad1 100644
+--- a/drivers/base/dma-mapping.c
++++ b/drivers/base/dma-mapping.c
+@@ -345,6 +345,9 @@ int dma_configure(struct device *dev)
+ enum dev_dma_attr attr;
+ int ret = 0;
+
++ if (dev->skip_dma_configure)
++ return 0;
++
+ if (dev_is_pci(dev)) {
+ bridge = pci_get_host_bridge_device(to_pci_dev(dev));
+ dma_dev = bridge;
+@@ -369,6 +372,9 @@ int dma_configure(struct device *dev)
+
+ void dma_deconfigure(struct device *dev)
+ {
++ if (dev->skip_dma_configure)
++ return;
++
+ of_dma_deconfigure(dev);
+ acpi_dma_deconfigure(dev);
+ }
+diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
+index 17681d5638ac..2a85d905b539 100644
+--- a/drivers/usb/core/usb.c
++++ b/drivers/usb/core/usb.c
+@@ -588,6 +588,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
+ * Note: calling dma_set_mask() on a USB device would set the
+ * mask for the entire HCD, so don't do that.
+ */
++ dev->dev.skip_dma_configure = true;
+ dev->dev.dma_mask = bus->sysdev->dma_mask;
+ dev->dev.dma_pfn_offset = bus->sysdev->dma_pfn_offset;
+ set_dev_node(&dev->dev, dev_to_node(bus->sysdev));
+diff --git a/include/linux/device.h b/include/linux/device.h
+index 723cd54b94da..022cf258068b 100644
+--- a/include/linux/device.h
++++ b/include/linux/device.h
+@@ -877,6 +877,8 @@ struct dev_links_info {
+ * @offline: Set after successful invocation of bus type's .offline().
+ * @of_node_reused: Set if the device-tree node is shared with an ancestor
+ * device.
++ * @skip_dma_configure: Set if driver core should not configure DMA for this
++ * device during probe.
+ *
+ * At the lowest level, every device in a Linux system is represented by an
+ * instance of struct device. The device structure contains the information
+@@ -965,6 +967,7 @@ struct device {
+ bool offline_disabled:1;
+ bool offline:1;
+ bool of_node_reused:1;
++ bool skip_dma_configure:1;
+ };
+
+ static inline struct device *kobj_to_dev(struct kobject *kobj)
diff --git a/kernel.spec b/kernel.spec
index f2534cc3f..41b343ad0 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -75,9 +75,9 @@ Summary: The Linux kernel
# The next upstream release sublevel (base_sublevel+1)
%define upstream_sublevel %(echo $((%{base_sublevel} + 1)))
# The rc snapshot level
-%global rcrev 3
+%global rcrev 4
# The git snapshot level
-%define gitrev 4
+%define gitrev 0
# Set rpm version accordingly
%define rpmversion 4.%{upstream_sublevel}.0
%endif
@@ -133,7 +133,7 @@ Summary: The Linux kernel
# Set debugbuildsenabled to 1 for production (build separate debug kernels)
# and 0 for rawhide (all kernels are debug kernels).
# See also 'make debug' and 'make release'.
-%define debugbuildsenabled 0
+%define debugbuildsenabled 1
# Want to build a vanilla kernel build without any non-upstream patches?
%define with_vanilla %{?_without_vanilla: 0} %{?!_without_vanilla: 1}
@@ -632,16 +632,19 @@ Patch312: qcom-display-iommu.patch
# https://patchwork.kernel.org/patch/9839803/
Patch313: qcom-Force-host-mode-for-USB-on-apq8016-sbc.patch
+# Breaking mustang booting
+Patch314: 0001-Revert-xgene-Don-t-fail-probe-if-there-is-no-clk-res.patch
+
# http://www.spinics.net/lists/dri-devel/msg132235.html
Patch320: bcm283x-vc4-Fix-OOPSes-from-trying-to-cache-a-partially-constructed-BO..patch
+# Fix USB on the RPi https://patchwork.kernel.org/patch/9879371/
+Patch321: bcm283x-dma-mapping-skip-USB-devices-when-configuring-DMA-during-probe.patch
+
# This breaks RPi booting with a LPAE kernel, we don't support the DSI ports currently
# Revert it while I engage upstream to work out what's going on
Patch322: Revert-ARM-dts-bcm2835-Add-the-DSI-module-nodes-and-.patch
-# Breaking mustang booting
-Patch323: 0001-Revert-xgene-Don-t-fail-probe-if-there-is-no-clk-res.patch
-
# 400 - IBM (ppc/s390x) patches
# 500 - Temp fixes/CVEs etc
@@ -2216,8 +2219,15 @@ fi
#
#
%changelog
+* Mon Aug 07 2017 Laura Abbott <labbott@fedoraproject.org> - 4.13.0-0.rc4.git0.1
+- Linux v4.13-rc4
+
+* Mon Aug 07 2017 Laura Abbott <labbott@fedoraproject.org>
+- Disable debugging options.
+
* Fri Aug 4 2017 Peter Robinson <pbrobinson@fedoraproject.org>
- ARM QCom updates
+- Patch to fix USB on Raspberry Pi
* Fri Aug 04 2017 Laura Abbott <labbott@fedoraproject.org> - 4.13.0-0.rc3.git4.1
- Linux v4.13-rc3-152-g869c058fbe74
diff --git a/sources b/sources
index 7bc5d5bbe..f5a972c3f 100644
--- a/sources
+++ b/sources
@@ -1,4 +1,3 @@
SHA512 (perf-man-4.12.tar.gz) = 4d3bbda1f520dba0007c351af46f45085fe4842074eb2e01aee736fd369df595f8f72ed6c1192715f1120bf3353279777f9dca1178fe93bffe5be2de700d409c
SHA512 (linux-4.12.tar.xz) = 8e81b41b253e63233e92948941f44c6482acb52aa3a3fd172f03a38a86f2c35b2ad4fd407acd1bc3964673eba344fe104d3a03e3ff4bf9cd1f22bd44263bd728
-SHA512 (patch-4.13-rc3.xz) = ac0e314aaf166ea27cc1dac23b00f816983f1b0d97d1cd72f86544ac1f2d01f6583c14eab88076bec619a49df94f27cb2b4ec054ff5f5bddbead6ce05c42d17d
-SHA512 (patch-4.13-rc3-git4.xz) = 3a67b4a8addce158ae1bcedef25ec9806ce4f479acd0da80f25058e8b0f429c67f64cd48f87d18777bf54c03ce3f07264f45b18072934f8e4196fa9fd650d53b
+SHA512 (patch-4.13-rc4.xz) = 0f03c25f705892ffcff410b3d3068fe25a876c91ec251497ceda37bfdef1c88bf0ed5486c5e68f399db1f5a11e9a08c48d894cc80cb8e9b3a56ce02f203cc1bc