Commit c00ddfb5 authored by Roman Gilg's avatar Roman Gilg
Browse files

[patch] replace DELL-XPS patch with v5 series

Uses v5 of patch series discussed on kernel mailing list:
https://lore.kernel.org/patchwork/project/lkml/list/?series=414600
parent 25a3ddc1
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -43,7 +43,10 @@ source=("https://www.kernel.org/pub/linux/kernel/v5.x/linux-${_basekernel}.tar.x
        '0002-apparmor-af_unix-mediation.patch::https://gitlab.com/apparmor/apparmor-kernel/commit/7a291673471aa583694ee760aa33e5a3f5ae9a9e.patch'
        '0003-apparmor-fix-use-after-free-in-sk_peer_label.patch::https://gitlab.com/apparmor/apparmor-kernel/commit/9ae046ed7b54b01078e33227fa266282c41f981d.patch'
        '0004-apparmor-fix-apparmor-mediating-locking-non-fs-unix-sockets.patch::https://gitlab.com/apparmor/apparmor-kernel/commit/b6a5dfbaa728854457570bf72b693a89550cc1f8.patch'
        '0001-mfd-intel-lpss-add-quirk-for-Dell-XPS-13-7390-2-in-1.patch'
        'v5-1-4-sparc64-implement-ioremap_uc.patch'
        'v5-2-4-lib-devres-add-a-helper-function-for-ioremap_uc.patch'
        'v5-3-4-mfd-intel-lpss-use-devm_ioremap_uc-for-MMIO.patch'
        'v5-4-4-docs-driver-model-add-devm_ioremap_uc.patch'
        #"prepatch-${_basekernel}.patch"
        # Bootsplash
        '0001-bootsplash.patch'
@@ -81,7 +84,10 @@ sha256sums=('78f3c397513cf4ff0f96aa7d09a921d003e08fa97c09e0bb71d88211b40567b2'
            'ac2cff4d3b04dde98bafc67e1a898fa8628f3bacba08531ce473edc43ddcccff'
            '749ac28edc2cd2ac3a4406becc13327a1ece3445196ca41cbfca460454fa01bf'
            'e55e88fe22256f079f5ac7b015c2d510912cae6f48a27a0f768b8f5f6acfc11b'
            'edbba4df1d115f04d26af682e4ed308266cd03c9796d3ce7792c69e257c162f0'
            'f196cf64384cc4c35f9b82615bd62aca538653fa1e8d2ee82cd021697daa27b2'
            '62539558ec5b5f87f1740f5e4e84a3740528afb8bec6335d2de721a3c8b93531'
            '267a28e932095238604e4e23062d142fa1e2836b629190e673614159968dbec7'
            'e82c72cd391261e79ae25330848877c451b4fa60cabed9c16898983eab269c89'
            'a504f6cf84094e08eaa3cc5b28440261797bf4f06f04993ee46a20628ff2b53c'
            'e096b127a5208f56d368d2cb938933454d7200d70c86b763aa22c38e0ddb8717'
            '8c1c880f2caa9c7ae43281a35410203887ea8eae750fe8d360d0c8bf80fcc6e0'
@@ -117,7 +123,12 @@ prepare() {
  patch -Np1 -i "${srcdir}/0002-apparmor-af_unix-mediation.patch"
  patch -Np1 -i "${srcdir}/0003-apparmor-fix-use-after-free-in-sk_peer_label.patch"
  patch -Np1 -i "${srcdir}/0004-apparmor-fix-apparmor-mediating-locking-non-fs-unix-sockets.patch"
  patch -Np1 -i "${srcdir}/0001-mfd-intel-lpss-add-quirk-for-Dell-XPS-13-7390-2-in-1.patch"

  # fix dell xps 13 2-in-1 issue
  patch -Np1 -i "${srcdir}/v5-1-4-sparc64-implement-ioremap_uc.patch"
  patch -Np1 -i "${srcdir}/v5-2-4-lib-devres-add-a-helper-function-for-ioremap_uc.patch"
  patch -Np1 -i "${srcdir}/v5-3-4-mfd-intel-lpss-use-devm_ioremap_uc-for-MMIO.patch"
  patch -Np1 -i "${srcdir}/v5-4-4-docs-driver-model-add-devm_ioremap_uc.patch"

  # Add bootsplash - http://lkml.iu.edu/hypermail/linux/kernel/1710.3/01542.html
  patch -Np1 -i "${srcdir}/0001-bootsplash.patch"
+12 −0
Original line number Diff line number Diff line
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 688911051b44..f4afa301954a 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -407,6 +407,7 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 }
 
 #define ioremap_nocache(X,Y)		ioremap((X),(Y))
+#define ioremap_uc(X,Y)			ioremap((X),(Y))
 #define ioremap_wc(X,Y)			ioremap((X),(Y))
 #define ioremap_wt(X,Y)			ioremap((X),(Y))
 
+57 −0
Original line number Diff line number Diff line
From c89736f0db3e2d4b25289761eea6e4b8d99a9f4b Mon Sep 17 00:00:00 2001
From: AceLan Kao <acelan.kao@canonical.com>
Date: Thu, 26 Sep 2019 16:32:49 +0800
Subject: [PATCH] mfd: intel-lpss: add quirk for Dell XPS 13 7390 2-in-1

The memory region intel-lpss-pci uses has been declared as
write-combining
[    0.001728]   5 base 4000000000 mask 6000000000 write-combining
This leads to the system hangs druing booting up.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=203485
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
 drivers/mfd/intel-lpss.c | 20 ++++++++++++++++++--
 include/linux/io.h       |  2 ++
 lib/devres.c             | 20 ++++++++++++++++++++
 3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index a475cbd2b9ef..b37d11ab9a94 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -14,6 +14,7 @@
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
 #include <linux/debugfs.h>
+#include <linux/dmi.h>
 #include <linux/idr.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
@@ -128,6 +129,17 @@ static const struct mfd_cell intel_lpss_spi_cell = {
 static DEFINE_IDA(intel_lpss_devid_ida);
 static struct dentry *intel_lpss_debugfs;
 
+static const struct dmi_system_id mtrr_large_wc_region[] = {
+	{
+		.ident = "Dell Computer Corporation",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 7390 2-in-1"),
+		},
+	},
+	{ }
+};
+
 static int intel_lpss_request_dma_module(const char *name)
 {
 	static bool intel_lpss_dma_requested;
@@ -395,8 +407,12 @@ int intel_lpss_probe(struct device *dev,
 	if (!lpss)
 		return -ENOMEM;
 
-	lpss->priv = devm_ioremap(dev, info->mem->start + LPSS_PRIV_OFFSET,
-				  LPSS_PRIV_SIZE);
+	if (dmi_check_system(mtrr_large_wc_region))
+		lpss->priv = devm_ioremap_uc(dev, info->mem->start + LPSS_PRIV_OFFSET,
+					     LPSS_PRIV_SIZE);
+	else
+		lpss->priv = devm_ioremap(dev, info->mem->start + LPSS_PRIV_OFFSET,
+					  LPSS_PRIV_SIZE);
 	if (!lpss->priv)
 		return -ENOMEM;
 
diff --git a/include/linux/io.h b/include/linux/io.h
index 9876e5801a9d..715f41dbe315 100644
index accac822336a..a59834bc0a11 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -63,6 +63,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
@@ -64,6 +64,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
 
 void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
 			   resource_size_t size);
@@ -75,7 +12,7 @@ index 9876e5801a9d..715f41dbe315 100644
 				   resource_size_t size);
 void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
diff --git a/lib/devres.c b/lib/devres.c
index 6a0e9bd6524a..ca4a18f71798 100644
index 6a0e9bd6524a..17624d35e82d 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -9,6 +9,7 @@
@@ -96,7 +33,7 @@ index 6a0e9bd6524a..ca4a18f71798 100644
 	case DEVM_IOREMAP_WC:
 		addr = ioremap_wc(offset, size);
 		break;
@@ -68,6 +72,22 @@ void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
@@ -68,6 +72,21 @@ void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
 }
 EXPORT_SYMBOL(devm_ioremap);
 
@@ -113,12 +50,8 @@ index 6a0e9bd6524a..ca4a18f71798 100644
+{
+	return __devm_ioremap(dev, offset, size, DEVM_IOREMAP_UC);
+}
+EXPORT_SYMBOL(devm_ioremap_uc);
+
+EXPORT_SYMBOL_GPL(devm_ioremap_uc);
+
 /**
  * devm_ioremap_nocache - Managed ioremap_nocache()
  * @dev: Generic device to remap IO address for
-- 
2.20.1
+13 −0
Original line number Diff line number Diff line
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index bfe4ff337581..b0f0781a6b9c 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -384,7 +384,7 @@ int intel_lpss_probe(struct device *dev,
 	if (!lpss)
 		return -ENOMEM;
 
-	lpss->priv = devm_ioremap(dev, info->mem->start + LPSS_PRIV_OFFSET,
+	lpss->priv = devm_ioremap_uc(dev, info->mem->start + LPSS_PRIV_OFFSET,
 				  LPSS_PRIV_SIZE);
 	if (!lpss->priv)
 		return -ENOMEM;
+12 −0
Original line number Diff line number Diff line
diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index a100bef54952..92628fdc2f11 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -314,6 +314,7 @@ IOMAP
   devm_ioport_unmap()
   devm_ioremap()
   devm_ioremap_nocache()
+  devm_ioremap_uc()
   devm_ioremap_wc()
   devm_ioremap_resource() : checks resource, requests memory region, ioremaps
   devm_iounmap()
Loading