]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch from everywhere
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Jul 2020 15:26:51 +0000 (17:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Jul 2020 15:26:51 +0000 (17:26 +0200)
queue-4.14/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch [deleted file]
queue-4.14/series
queue-4.19/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch [deleted file]
queue-4.19/series
queue-4.9/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch [deleted file]
queue-4.9/series
queue-5.4/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch [deleted file]
queue-5.4/series

diff --git a/queue-4.14/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch b/queue-4.14/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch
deleted file mode 100644 (file)
index a6473b7..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-From 3a22f17915954263f594bbf9ca32ae9d2d171b64 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 13 Jan 2020 18:22:40 +0100
-Subject: efi/arm: Defer probe of PCIe backed efifb on DT systems
-
-From: Ard Biesheuvel <ardb@kernel.org>
-
-[ Upstream commit 64c8a0cd0a535891d5905c3a1651150f0f141439 ]
-
-The new of_devlink support breaks PCIe probing on ARM platforms booting
-via UEFI if the firmware exposes a EFI framebuffer that is backed by a
-PCI device. The reason is that the probing order gets reversed,
-resulting in a resource conflict on the framebuffer memory window when
-the PCIe probes last, causing it to give up entirely.
-
-Given that we rely on PCI quirks to deal with EFI framebuffers that get
-moved around in memory, we cannot simply drop the memory reservation, so
-instead, let's use the device link infrastructure to register this
-dependency, and force the probing to occur in the expected order.
-
-Co-developed-by: Saravana Kannan <saravanak@google.com>
-Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Saravana Kannan <saravanak@google.com>
-Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Link: https://lore.kernel.org/r/20200113172245.27925-9-ardb@kernel.org
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/firmware/efi/arm-init.c | 107 ++++++++++++++++++++++++++++++--
- 1 file changed, 103 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
-index 312f9f32e1683..7d4cb9583bf4f 100644
---- a/drivers/firmware/efi/arm-init.c
-+++ b/drivers/firmware/efi/arm-init.c
-@@ -14,10 +14,12 @@
- #define pr_fmt(fmt)   "efi: " fmt
- #include <linux/efi.h>
-+#include <linux/fwnode.h>
- #include <linux/init.h>
- #include <linux/memblock.h>
- #include <linux/mm_types.h>
- #include <linux/of.h>
-+#include <linux/of_address.h>
- #include <linux/of_fdt.h>
- #include <linux/platform_device.h>
- #include <linux/screen_info.h>
-@@ -271,15 +273,112 @@ void __init efi_init(void)
-               efi_memmap_unmap();
- }
-+static bool efifb_overlaps_pci_range(const struct of_pci_range *range)
-+{
-+      u64 fb_base = screen_info.lfb_base;
-+
-+      if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
-+              fb_base |= (u64)(unsigned long)screen_info.ext_lfb_base << 32;
-+
-+      return fb_base >= range->cpu_addr &&
-+             fb_base < (range->cpu_addr + range->size);
-+}
-+
-+static struct device_node *find_pci_overlap_node(void)
-+{
-+      struct device_node *np;
-+
-+      for_each_node_by_type(np, "pci") {
-+              struct of_pci_range_parser parser;
-+              struct of_pci_range range;
-+              int err;
-+
-+              err = of_pci_range_parser_init(&parser, np);
-+              if (err) {
-+                      pr_warn("of_pci_range_parser_init() failed: %d\n", err);
-+                      continue;
-+              }
-+
-+              for_each_of_pci_range(&parser, &range)
-+                      if (efifb_overlaps_pci_range(&range))
-+                              return np;
-+      }
-+      return NULL;
-+}
-+
-+/*
-+ * If the efifb framebuffer is backed by a PCI graphics controller, we have
-+ * to ensure that this relation is expressed using a device link when
-+ * running in DT mode, or the probe order may be reversed, resulting in a
-+ * resource reservation conflict on the memory window that the efifb
-+ * framebuffer steals from the PCIe host bridge.
-+ */
-+static int efifb_add_links(const struct fwnode_handle *fwnode,
-+                         struct device *dev)
-+{
-+      struct device_node *sup_np;
-+      struct device *sup_dev;
-+
-+      sup_np = find_pci_overlap_node();
-+
-+      /*
-+       * If there's no PCI graphics controller backing the efifb, we are
-+       * done here.
-+       */
-+      if (!sup_np)
-+              return 0;
-+
-+      sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
-+      of_node_put(sup_np);
-+
-+      /*
-+       * Return -ENODEV if the PCI graphics controller device hasn't been
-+       * registered yet.  This ensures that efifb isn't allowed to probe
-+       * and this function is retried again when new devices are
-+       * registered.
-+       */
-+      if (!sup_dev)
-+              return -ENODEV;
-+
-+      /*
-+       * If this fails, retrying this function at a later point won't
-+       * change anything. So, don't return an error after this.
-+       */
-+      if (!device_link_add(dev, sup_dev, 0))
-+              dev_warn(dev, "device_link_add() failed\n");
-+
-+      put_device(sup_dev);
-+
-+      return 0;
-+}
-+
-+static const struct fwnode_operations efifb_fwnode_ops = {
-+      .add_links = efifb_add_links,
-+};
-+
-+static struct fwnode_handle efifb_fwnode = {
-+      .ops = &efifb_fwnode_ops,
-+};
-+
- static int __init register_gop_device(void)
- {
--      void *pd;
-+      struct platform_device *pd;
-+      int err;
-       if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
-               return 0;
--      pd = platform_device_register_data(NULL, "efi-framebuffer", 0,
--                                         &screen_info, sizeof(screen_info));
--      return PTR_ERR_OR_ZERO(pd);
-+      pd = platform_device_alloc("efi-framebuffer", 0);
-+      if (!pd)
-+              return -ENOMEM;
-+
-+      if (IS_ENABLED(CONFIG_PCI))
-+              pd->dev.fwnode = &efifb_fwnode;
-+
-+      err = platform_device_add_data(pd, &screen_info, sizeof(screen_info));
-+      if (err)
-+              return err;
-+
-+      return platform_device_add(pd);
- }
- subsys_initcall(register_gop_device);
--- 
-2.25.1
-
index 72b13b282ed9ba13dfe122640c77c4acc7e17f45..be15deed7919c9bcb7173f120adc9883efc7fa6e 100644 (file)
@@ -73,7 +73,6 @@ of-of_mdio-correct-loop-scanning-logic.patch
 revert-usb-ohci-platform-fix-a-warning-when-hibernat.patch
 revert-usb-ehci-platform-set-pm-runtime-as-active-on.patch
 revert-usb-xhci-plat-set-pm-runtime-as-active-on-res.patch
-efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch
 doc-dt-bindings-usb-dwc3-update-entries-for-disablin.patch
 mmc-sdhci-do-not-enable-card-detect-interrupt-for-gp.patch
 acpi-video-use-native-backlight-on-acer-aspire-5783z.patch
diff --git a/queue-4.19/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch b/queue-4.19/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch
deleted file mode 100644 (file)
index 4892e83..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-From 37f50b36e616f403b8d4cdee13cf0ba612275b7b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 13 Jan 2020 18:22:40 +0100
-Subject: efi/arm: Defer probe of PCIe backed efifb on DT systems
-
-From: Ard Biesheuvel <ardb@kernel.org>
-
-[ Upstream commit 64c8a0cd0a535891d5905c3a1651150f0f141439 ]
-
-The new of_devlink support breaks PCIe probing on ARM platforms booting
-via UEFI if the firmware exposes a EFI framebuffer that is backed by a
-PCI device. The reason is that the probing order gets reversed,
-resulting in a resource conflict on the framebuffer memory window when
-the PCIe probes last, causing it to give up entirely.
-
-Given that we rely on PCI quirks to deal with EFI framebuffers that get
-moved around in memory, we cannot simply drop the memory reservation, so
-instead, let's use the device link infrastructure to register this
-dependency, and force the probing to occur in the expected order.
-
-Co-developed-by: Saravana Kannan <saravanak@google.com>
-Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Saravana Kannan <saravanak@google.com>
-Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Link: https://lore.kernel.org/r/20200113172245.27925-9-ardb@kernel.org
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/firmware/efi/arm-init.c | 107 ++++++++++++++++++++++++++++++--
- 1 file changed, 103 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
-index 1a6a77df8a5e8..85533ec55396a 100644
---- a/drivers/firmware/efi/arm-init.c
-+++ b/drivers/firmware/efi/arm-init.c
-@@ -14,10 +14,12 @@
- #define pr_fmt(fmt)   "efi: " fmt
- #include <linux/efi.h>
-+#include <linux/fwnode.h>
- #include <linux/init.h>
- #include <linux/memblock.h>
- #include <linux/mm_types.h>
- #include <linux/of.h>
-+#include <linux/of_address.h>
- #include <linux/of_fdt.h>
- #include <linux/platform_device.h>
- #include <linux/screen_info.h>
-@@ -271,15 +273,112 @@ void __init efi_init(void)
-               efi_memmap_unmap();
- }
-+static bool efifb_overlaps_pci_range(const struct of_pci_range *range)
-+{
-+      u64 fb_base = screen_info.lfb_base;
-+
-+      if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
-+              fb_base |= (u64)(unsigned long)screen_info.ext_lfb_base << 32;
-+
-+      return fb_base >= range->cpu_addr &&
-+             fb_base < (range->cpu_addr + range->size);
-+}
-+
-+static struct device_node *find_pci_overlap_node(void)
-+{
-+      struct device_node *np;
-+
-+      for_each_node_by_type(np, "pci") {
-+              struct of_pci_range_parser parser;
-+              struct of_pci_range range;
-+              int err;
-+
-+              err = of_pci_range_parser_init(&parser, np);
-+              if (err) {
-+                      pr_warn("of_pci_range_parser_init() failed: %d\n", err);
-+                      continue;
-+              }
-+
-+              for_each_of_pci_range(&parser, &range)
-+                      if (efifb_overlaps_pci_range(&range))
-+                              return np;
-+      }
-+      return NULL;
-+}
-+
-+/*
-+ * If the efifb framebuffer is backed by a PCI graphics controller, we have
-+ * to ensure that this relation is expressed using a device link when
-+ * running in DT mode, or the probe order may be reversed, resulting in a
-+ * resource reservation conflict on the memory window that the efifb
-+ * framebuffer steals from the PCIe host bridge.
-+ */
-+static int efifb_add_links(const struct fwnode_handle *fwnode,
-+                         struct device *dev)
-+{
-+      struct device_node *sup_np;
-+      struct device *sup_dev;
-+
-+      sup_np = find_pci_overlap_node();
-+
-+      /*
-+       * If there's no PCI graphics controller backing the efifb, we are
-+       * done here.
-+       */
-+      if (!sup_np)
-+              return 0;
-+
-+      sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
-+      of_node_put(sup_np);
-+
-+      /*
-+       * Return -ENODEV if the PCI graphics controller device hasn't been
-+       * registered yet.  This ensures that efifb isn't allowed to probe
-+       * and this function is retried again when new devices are
-+       * registered.
-+       */
-+      if (!sup_dev)
-+              return -ENODEV;
-+
-+      /*
-+       * If this fails, retrying this function at a later point won't
-+       * change anything. So, don't return an error after this.
-+       */
-+      if (!device_link_add(dev, sup_dev, 0))
-+              dev_warn(dev, "device_link_add() failed\n");
-+
-+      put_device(sup_dev);
-+
-+      return 0;
-+}
-+
-+static const struct fwnode_operations efifb_fwnode_ops = {
-+      .add_links = efifb_add_links,
-+};
-+
-+static struct fwnode_handle efifb_fwnode = {
-+      .ops = &efifb_fwnode_ops,
-+};
-+
- static int __init register_gop_device(void)
- {
--      void *pd;
-+      struct platform_device *pd;
-+      int err;
-       if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
-               return 0;
--      pd = platform_device_register_data(NULL, "efi-framebuffer", 0,
--                                         &screen_info, sizeof(screen_info));
--      return PTR_ERR_OR_ZERO(pd);
-+      pd = platform_device_alloc("efi-framebuffer", 0);
-+      if (!pd)
-+              return -ENOMEM;
-+
-+      if (IS_ENABLED(CONFIG_PCI))
-+              pd->dev.fwnode = &efifb_fwnode;
-+
-+      err = platform_device_add_data(pd, &screen_info, sizeof(screen_info));
-+      if (err)
-+              return err;
-+
-+      return platform_device_add(pd);
- }
- subsys_initcall(register_gop_device);
--- 
-2.25.1
-
index 306ff6db490456cbfdd4abe51cfab4db45a027fb..c557e717eebfd778732e741d19cca99cedccd010 100644 (file)
@@ -44,7 +44,6 @@ revert-usb-xhci-plat-set-pm-runtime-as-active-on-res.patch
 revert-usb-ehci-platform-set-pm-runtime-as-active-on.patch
 net-sfp-add-support-for-module-quirks.patch
 net-sfp-add-some-quirks-for-gpon-modules.patch
-efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch
 hid-quirks-remove-ite-8595-entry-from-hid_have_speci.patch
 arm-at91-pm-add-quirk-for-sam9x60-s-ulp1.patch
 scsi-sr-remove-references-to-blk_dev_sr_vendor-leave.patch
diff --git a/queue-4.9/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch b/queue-4.9/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch
deleted file mode 100644 (file)
index bad19ae..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-From cff5a08a72f64cc9fb3191a87903955fa0e2cf7f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 13 Jan 2020 18:22:40 +0100
-Subject: efi/arm: Defer probe of PCIe backed efifb on DT systems
-
-From: Ard Biesheuvel <ardb@kernel.org>
-
-[ Upstream commit 64c8a0cd0a535891d5905c3a1651150f0f141439 ]
-
-The new of_devlink support breaks PCIe probing on ARM platforms booting
-via UEFI if the firmware exposes a EFI framebuffer that is backed by a
-PCI device. The reason is that the probing order gets reversed,
-resulting in a resource conflict on the framebuffer memory window when
-the PCIe probes last, causing it to give up entirely.
-
-Given that we rely on PCI quirks to deal with EFI framebuffers that get
-moved around in memory, we cannot simply drop the memory reservation, so
-instead, let's use the device link infrastructure to register this
-dependency, and force the probing to occur in the expected order.
-
-Co-developed-by: Saravana Kannan <saravanak@google.com>
-Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Saravana Kannan <saravanak@google.com>
-Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Link: https://lore.kernel.org/r/20200113172245.27925-9-ardb@kernel.org
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/firmware/efi/arm-init.c | 107 ++++++++++++++++++++++++++++++--
- 1 file changed, 103 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
-index 8ee91777abce7..e4ddd6e6edb31 100644
---- a/drivers/firmware/efi/arm-init.c
-+++ b/drivers/firmware/efi/arm-init.c
-@@ -14,10 +14,12 @@
- #define pr_fmt(fmt)   "efi: " fmt
- #include <linux/efi.h>
-+#include <linux/fwnode.h>
- #include <linux/init.h>
- #include <linux/memblock.h>
- #include <linux/mm_types.h>
- #include <linux/of.h>
-+#include <linux/of_address.h>
- #include <linux/of_fdt.h>
- #include <linux/platform_device.h>
- #include <linux/screen_info.h>
-@@ -262,15 +264,112 @@ void __init efi_init(void)
-               efi_memmap_unmap();
- }
-+static bool efifb_overlaps_pci_range(const struct of_pci_range *range)
-+{
-+      u64 fb_base = screen_info.lfb_base;
-+
-+      if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
-+              fb_base |= (u64)(unsigned long)screen_info.ext_lfb_base << 32;
-+
-+      return fb_base >= range->cpu_addr &&
-+             fb_base < (range->cpu_addr + range->size);
-+}
-+
-+static struct device_node *find_pci_overlap_node(void)
-+{
-+      struct device_node *np;
-+
-+      for_each_node_by_type(np, "pci") {
-+              struct of_pci_range_parser parser;
-+              struct of_pci_range range;
-+              int err;
-+
-+              err = of_pci_range_parser_init(&parser, np);
-+              if (err) {
-+                      pr_warn("of_pci_range_parser_init() failed: %d\n", err);
-+                      continue;
-+              }
-+
-+              for_each_of_pci_range(&parser, &range)
-+                      if (efifb_overlaps_pci_range(&range))
-+                              return np;
-+      }
-+      return NULL;
-+}
-+
-+/*
-+ * If the efifb framebuffer is backed by a PCI graphics controller, we have
-+ * to ensure that this relation is expressed using a device link when
-+ * running in DT mode, or the probe order may be reversed, resulting in a
-+ * resource reservation conflict on the memory window that the efifb
-+ * framebuffer steals from the PCIe host bridge.
-+ */
-+static int efifb_add_links(const struct fwnode_handle *fwnode,
-+                         struct device *dev)
-+{
-+      struct device_node *sup_np;
-+      struct device *sup_dev;
-+
-+      sup_np = find_pci_overlap_node();
-+
-+      /*
-+       * If there's no PCI graphics controller backing the efifb, we are
-+       * done here.
-+       */
-+      if (!sup_np)
-+              return 0;
-+
-+      sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
-+      of_node_put(sup_np);
-+
-+      /*
-+       * Return -ENODEV if the PCI graphics controller device hasn't been
-+       * registered yet.  This ensures that efifb isn't allowed to probe
-+       * and this function is retried again when new devices are
-+       * registered.
-+       */
-+      if (!sup_dev)
-+              return -ENODEV;
-+
-+      /*
-+       * If this fails, retrying this function at a later point won't
-+       * change anything. So, don't return an error after this.
-+       */
-+      if (!device_link_add(dev, sup_dev, 0))
-+              dev_warn(dev, "device_link_add() failed\n");
-+
-+      put_device(sup_dev);
-+
-+      return 0;
-+}
-+
-+static const struct fwnode_operations efifb_fwnode_ops = {
-+      .add_links = efifb_add_links,
-+};
-+
-+static struct fwnode_handle efifb_fwnode = {
-+      .ops = &efifb_fwnode_ops,
-+};
-+
- static int __init register_gop_device(void)
- {
--      void *pd;
-+      struct platform_device *pd;
-+      int err;
-       if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
-               return 0;
--      pd = platform_device_register_data(NULL, "efi-framebuffer", 0,
--                                         &screen_info, sizeof(screen_info));
--      return PTR_ERR_OR_ZERO(pd);
-+      pd = platform_device_alloc("efi-framebuffer", 0);
-+      if (!pd)
-+              return -ENOMEM;
-+
-+      if (IS_ENABLED(CONFIG_PCI))
-+              pd->dev.fwnode = &efifb_fwnode;
-+
-+      err = platform_device_add_data(pd, &screen_info, sizeof(screen_info));
-+      if (err)
-+              return err;
-+
-+      return platform_device_add(pd);
- }
- subsys_initcall(register_gop_device);
--- 
-2.25.1
-
index bbc41c86c3d309b045483b082925025ba93e663f..747c9e2090079f9cd6391f43496f18269a8ad59a 100644 (file)
@@ -49,7 +49,6 @@ net-dsa-bcm_sf2-fix-node-reference-count.patch
 revert-usb-ehci-platform-set-pm-runtime-as-active-on.patch
 revert-usb-xhci-plat-set-pm-runtime-as-active-on-res.patch
 revert-usb-ohci-platform-fix-a-warning-when-hibernat.patch
-efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch
 iio-health-afe4404-fix-timestamp-alignment-and-preve.patch
 spi-spi-sun6i-sun6i_spi_transfer_one-fix-setting-of-.patch
 usb-gadget-udc-atmel-fix-uninitialized-read-in-debug.patch
diff --git a/queue-5.4/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch b/queue-5.4/efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch
deleted file mode 100644 (file)
index 31b8ab6..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-From 89d201e59b1ae9ae29787771817cd070ffed2e8a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 13 Jan 2020 18:22:40 +0100
-Subject: efi/arm: Defer probe of PCIe backed efifb on DT systems
-
-From: Ard Biesheuvel <ardb@kernel.org>
-
-[ Upstream commit 64c8a0cd0a535891d5905c3a1651150f0f141439 ]
-
-The new of_devlink support breaks PCIe probing on ARM platforms booting
-via UEFI if the firmware exposes a EFI framebuffer that is backed by a
-PCI device. The reason is that the probing order gets reversed,
-resulting in a resource conflict on the framebuffer memory window when
-the PCIe probes last, causing it to give up entirely.
-
-Given that we rely on PCI quirks to deal with EFI framebuffers that get
-moved around in memory, we cannot simply drop the memory reservation, so
-instead, let's use the device link infrastructure to register this
-dependency, and force the probing to occur in the expected order.
-
-Co-developed-by: Saravana Kannan <saravanak@google.com>
-Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Saravana Kannan <saravanak@google.com>
-Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Link: https://lore.kernel.org/r/20200113172245.27925-9-ardb@kernel.org
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/firmware/efi/arm-init.c | 107 ++++++++++++++++++++++++++++++--
- 1 file changed, 103 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
-index 311cd349a8628..f136b77e13d98 100644
---- a/drivers/firmware/efi/arm-init.c
-+++ b/drivers/firmware/efi/arm-init.c
-@@ -10,10 +10,12 @@
- #define pr_fmt(fmt)   "efi: " fmt
- #include <linux/efi.h>
-+#include <linux/fwnode.h>
- #include <linux/init.h>
- #include <linux/memblock.h>
- #include <linux/mm_types.h>
- #include <linux/of.h>
-+#include <linux/of_address.h>
- #include <linux/of_fdt.h>
- #include <linux/platform_device.h>
- #include <linux/screen_info.h>
-@@ -267,15 +269,112 @@ void __init efi_init(void)
-               efi_memmap_unmap();
- }
-+static bool efifb_overlaps_pci_range(const struct of_pci_range *range)
-+{
-+      u64 fb_base = screen_info.lfb_base;
-+
-+      if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
-+              fb_base |= (u64)(unsigned long)screen_info.ext_lfb_base << 32;
-+
-+      return fb_base >= range->cpu_addr &&
-+             fb_base < (range->cpu_addr + range->size);
-+}
-+
-+static struct device_node *find_pci_overlap_node(void)
-+{
-+      struct device_node *np;
-+
-+      for_each_node_by_type(np, "pci") {
-+              struct of_pci_range_parser parser;
-+              struct of_pci_range range;
-+              int err;
-+
-+              err = of_pci_range_parser_init(&parser, np);
-+              if (err) {
-+                      pr_warn("of_pci_range_parser_init() failed: %d\n", err);
-+                      continue;
-+              }
-+
-+              for_each_of_pci_range(&parser, &range)
-+                      if (efifb_overlaps_pci_range(&range))
-+                              return np;
-+      }
-+      return NULL;
-+}
-+
-+/*
-+ * If the efifb framebuffer is backed by a PCI graphics controller, we have
-+ * to ensure that this relation is expressed using a device link when
-+ * running in DT mode, or the probe order may be reversed, resulting in a
-+ * resource reservation conflict on the memory window that the efifb
-+ * framebuffer steals from the PCIe host bridge.
-+ */
-+static int efifb_add_links(const struct fwnode_handle *fwnode,
-+                         struct device *dev)
-+{
-+      struct device_node *sup_np;
-+      struct device *sup_dev;
-+
-+      sup_np = find_pci_overlap_node();
-+
-+      /*
-+       * If there's no PCI graphics controller backing the efifb, we are
-+       * done here.
-+       */
-+      if (!sup_np)
-+              return 0;
-+
-+      sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
-+      of_node_put(sup_np);
-+
-+      /*
-+       * Return -ENODEV if the PCI graphics controller device hasn't been
-+       * registered yet.  This ensures that efifb isn't allowed to probe
-+       * and this function is retried again when new devices are
-+       * registered.
-+       */
-+      if (!sup_dev)
-+              return -ENODEV;
-+
-+      /*
-+       * If this fails, retrying this function at a later point won't
-+       * change anything. So, don't return an error after this.
-+       */
-+      if (!device_link_add(dev, sup_dev, 0))
-+              dev_warn(dev, "device_link_add() failed\n");
-+
-+      put_device(sup_dev);
-+
-+      return 0;
-+}
-+
-+static const struct fwnode_operations efifb_fwnode_ops = {
-+      .add_links = efifb_add_links,
-+};
-+
-+static struct fwnode_handle efifb_fwnode = {
-+      .ops = &efifb_fwnode_ops,
-+};
-+
- static int __init register_gop_device(void)
- {
--      void *pd;
-+      struct platform_device *pd;
-+      int err;
-       if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
-               return 0;
--      pd = platform_device_register_data(NULL, "efi-framebuffer", 0,
--                                         &screen_info, sizeof(screen_info));
--      return PTR_ERR_OR_ZERO(pd);
-+      pd = platform_device_alloc("efi-framebuffer", 0);
-+      if (!pd)
-+              return -ENOMEM;
-+
-+      if (IS_ENABLED(CONFIG_PCI))
-+              pd->dev.fwnode = &efifb_fwnode;
-+
-+      err = platform_device_add_data(pd, &screen_info, sizeof(screen_info));
-+      if (err)
-+              return err;
-+
-+      return platform_device_add(pd);
- }
- subsys_initcall(register_gop_device);
--- 
-2.25.1
-
index d75f1e9b058a35218065d49ada1f736b5d9b11b6..154c80261a2c0681d94ad64f6e5d6a24794c3d7a 100644 (file)
@@ -67,7 +67,6 @@ arm-omap4-remove-pdata-quirks-for-omap4-iommus.patch
 arm-omap2-add-workaround-for-dra7-dsp-mstandby-errat.patch
 arm-omap2-use-separate-iommu-pdata-to-fix-dra7-ipu1-.patch
 mmc-mmci-support-any-block-sizes-for-ux500v2-and-qco.patch
-efi-arm-defer-probe-of-pcie-backed-efifb-on-dt-syste.patch
 hid-quirks-remove-ite-8595-entry-from-hid_have_speci.patch
 arm-at91-pm-add-quirk-for-sam9x60-s-ulp1.patch
 drm-sun4i-tcon-separate-quirks-for-tcon0-and-tcon1-o.patch