]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
UBUNTU: SAUCE: mfd: intel-lpss: add quirk for Dell XPS 13 7390 2-in-1
authorAceLan Kao <acelan.kao@canonical.com>
Fri, 27 Sep 2019 08:07:45 +0000 (16:07 +0800)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 27 Sep 2019 16:41:53 +0000 (11:41 -0500)
BugLink: https://bugs.launchpad.net/bugs/1845584
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 up during booting up.

Tuowen Zhao(ztuowen@gmail.com) provides a diff patch for intel-lpss
driver to claim to use un-cacheable memory while calling
__devm_ioremap(), and it works well. But it haven't been accepted by
maintainer yet.

To avoid the potential impact on other machines, I add a quirk to list
the machines which has the write-combining area in MTRR which overlaps
with the address that intel-lpss uses, only the machines in the list
pass the DEVM_IOREMAP_UC to __devm_ioremap().

Link: https://bugzilla.kernel.org/show_bug.cgi?id=203485
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/mfd/intel-lpss.c
include/linux/io.h
lib/devres.c

index 277f48f1cc1c808f7356d7d8005ece67f8746cbc..5223aba7ba1d558ed8f5e00bf3ccddeafd10d6a2 100644 (file)
@@ -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;
 
index accac822336aabfc5bce6c65eab939c19d20e22d..a59834bc0a114f99dae0ae91f18fd3b1d870979e 100644 (file)
@@ -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);
+void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset,
+                                  resource_size_t size);
 void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
                                   resource_size_t size);
 void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
index 6a0e9bd6524aecc06e2e1f3f3da202ec95374202..ca4a18f71798cd5e88a24d9cc79f7787384224ab 100644 (file)
@@ -9,6 +9,7 @@
 enum devm_ioremap_type {
        DEVM_IOREMAP = 0,
        DEVM_IOREMAP_NC,
+       DEVM_IOREMAP_UC,
        DEVM_IOREMAP_WC,
 };
 
@@ -39,6 +40,9 @@ static void __iomem *__devm_ioremap(struct device *dev, resource_size_t offset,
        case DEVM_IOREMAP_NC:
                addr = ioremap_nocache(offset, size);
                break;
+       case DEVM_IOREMAP_UC:
+               addr = ioremap_uc(offset, size);
+               break;
        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,
 }
 EXPORT_SYMBOL(devm_ioremap);
 
+/**
+ * devm_ioremap_uc - Managed ioremap_uc()
+ * @dev: Generic device to remap IO address for
+ * @offset: Resource address to map
+ * @size: Size of map
+ *
+ * Managed ioremap_uc().  Map is automatically unmapped on driver detach.
+ */
+void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset,
+                             resource_size_t size)
+{
+       return __devm_ioremap(dev, offset, size, DEVM_IOREMAP_UC);
+}
+EXPORT_SYMBOL(devm_ioremap_uc);
+
+
 /**
  * devm_ioremap_nocache - Managed ioremap_nocache()
  * @dev: Generic device to remap IO address for