]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.16-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Apr 2022 12:21:03 +0000 (14:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Apr 2022 12:21:03 +0000 (14:21 +0200)
added patches:
pci-xgene-revert-pci-xgene-use-inbound-resources-for-setup.patch

queue-5.16/pci-xgene-revert-pci-xgene-use-inbound-resources-for-setup.patch [new file with mode: 0644]
queue-5.16/series

diff --git a/queue-5.16/pci-xgene-revert-pci-xgene-use-inbound-resources-for-setup.patch b/queue-5.16/pci-xgene-revert-pci-xgene-use-inbound-resources-for-setup.patch
new file mode 100644 (file)
index 0000000..baeef11
--- /dev/null
@@ -0,0 +1,110 @@
+From 1874b6d7ab1bdc900e8398026350313ac29caddb Mon Sep 17 00:00:00 2001
+From: Marc Zyngier <maz@kernel.org>
+Date: Mon, 21 Mar 2022 10:48:42 +0000
+Subject: PCI: xgene: Revert "PCI: xgene: Use inbound resources for setup"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Marc Zyngier <maz@kernel.org>
+
+commit 1874b6d7ab1bdc900e8398026350313ac29caddb upstream.
+
+Commit 6dce5aa59e0b ("PCI: xgene: Use inbound resources for setup")
+killed PCIe on my XGene-1 box (a Mustang board). The machine itself
+is still alive, but half of its storage (over NVMe) is gone, and the
+NVMe driver just times out.
+
+Note that this machine boots with a device tree provided by the
+UEFI firmware (2016 vintage), which could well be non conformant
+with the spec, hence the breakage.
+
+With the patch reverted, the box boots 5.17-rc8 with flying colors.
+
+Link: https://lore.kernel.org/all/Yf2wTLjmcRj+AbDv@xps13.dannf
+Link: https://lore.kernel.org/r/20220321104843.949645-2-maz@kernel.org
+Fixes: 6dce5aa59e0b ("PCI: xgene: Use inbound resources for setup")
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Cc: stable@vger.kernel.org
+Cc: Rob Herring <robh@kernel.org>
+Cc: Toan Le <toan@os.amperecomputing.com>
+Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Cc: Krzysztof Wilczyński <kw@linux.com>
+Cc: Bjorn Helgaas <bhelgaas@google.com>
+Cc: Stéphane Graber <stgraber@ubuntu.com>
+Cc: dann frazier <dann.frazier@canonical.com>
+[dannf: minor context adjustment]
+Signed-off-by: dann frazier <dann.frazier@canonical.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/controller/pci-xgene.c |   33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+--- a/drivers/pci/controller/pci-xgene.c
++++ b/drivers/pci/controller/pci-xgene.c
+@@ -479,28 +479,27 @@ static int xgene_pcie_select_ib_reg(u8 *
+ }
+ static void xgene_pcie_setup_ib_reg(struct xgene_pcie_port *port,
+-                                  struct resource_entry *entry,
+-                                  u8 *ib_reg_mask)
++                                  struct of_pci_range *range, u8 *ib_reg_mask)
+ {
+       void __iomem *cfg_base = port->cfg_base;
+       struct device *dev = port->dev;
+       void __iomem *bar_addr;
+       u32 pim_reg;
+-      u64 cpu_addr = entry->res->start;
+-      u64 pci_addr = cpu_addr - entry->offset;
+-      u64 size = resource_size(entry->res);
++      u64 cpu_addr = range->cpu_addr;
++      u64 pci_addr = range->pci_addr;
++      u64 size = range->size;
+       u64 mask = ~(size - 1) | EN_REG;
+       u32 flags = PCI_BASE_ADDRESS_MEM_TYPE_64;
+       u32 bar_low;
+       int region;
+-      region = xgene_pcie_select_ib_reg(ib_reg_mask, size);
++      region = xgene_pcie_select_ib_reg(ib_reg_mask, range->size);
+       if (region < 0) {
+               dev_warn(dev, "invalid pcie dma-range config\n");
+               return;
+       }
+-      if (entry->res->flags & IORESOURCE_PREFETCH)
++      if (range->flags & IORESOURCE_PREFETCH)
+               flags |= PCI_BASE_ADDRESS_MEM_PREFETCH;
+       bar_low = pcie_bar_low_val((u32)cpu_addr, flags);
+@@ -531,13 +530,25 @@ static void xgene_pcie_setup_ib_reg(stru
+ static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie_port *port)
+ {
+-      struct pci_host_bridge *bridge = pci_host_bridge_from_priv(port);
+-      struct resource_entry *entry;
++      struct device_node *np = port->node;
++      struct of_pci_range range;
++      struct of_pci_range_parser parser;
++      struct device *dev = port->dev;
+       u8 ib_reg_mask = 0;
+-      resource_list_for_each_entry(entry, &bridge->dma_ranges)
+-              xgene_pcie_setup_ib_reg(port, entry, &ib_reg_mask);
++      if (of_pci_dma_range_parser_init(&parser, np)) {
++              dev_err(dev, "missing dma-ranges property\n");
++              return -EINVAL;
++      }
++      /* Get the dma-ranges from DT */
++      for_each_of_pci_range(&parser, &range) {
++              u64 end = range.cpu_addr + range.size - 1;
++
++              dev_dbg(dev, "0x%08x 0x%016llx..0x%016llx -> 0x%016llx\n",
++                      range.flags, range.cpu_addr, end, range.pci_addr);
++              xgene_pcie_setup_ib_reg(port, &range, &ib_reg_mask);
++      }
+       return 0;
+ }
index 43b646e8f8252fc7191e6d3dd703bea973a2f69f..7ebd3e8177ecadbb356ac58f5a5d9894523dc94f 100644 (file)
@@ -1014,3 +1014,4 @@ coredump-snapshot-the-vmas-in-do_coredump.patch
 coredump-remove-the-warn_on-in-dump_vma_snapshot.patch
 coredump-elf-pass-coredump_params-into-fill_note_info.patch
 coredump-use-the-vma-snapshot-in-fill_files_note.patch
+pci-xgene-revert-pci-xgene-use-inbound-resources-for-setup.patch