Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210933

[PATCH v4 36/52] PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64

From Yinghai Lu <yinghai@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v4 36/52] PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64
Date 2015-08-21 08:40 +0200
Message-ID <pZO9B-44i-41@gated-at.bofh.it> (permalink)
References <pZNZT-3SZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If any bridge up to root only have 32bit pref mmio, We don't need to
treat device non-pref mmio64 as as pref mmio64.

We need to move pci_bridge_check_ranges calling early.
for parent bridges pref mmio BAR may not allocated by BIOS, res flags
is still 0, we need to have it correct set before we check them for
child device resources.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/setup-bus.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 4772a09..9667cbf5 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1032,6 +1032,18 @@ int pci_claim_bridge_resource(struct pci_dev *bridge, int i)
 	return -EINVAL;
 }
 
+static bool pci_up_path_over_pref_mem64(struct pci_bus *bus)
+{
+	if (pci_is_root_bus(bus))
+		return true;
+
+	if (bus->self && !(bus->self->resource[PCI_BRIDGE_RESOURCES + 2].flags &
+			   IORESOURCE_MEM_64))
+		return false;
+
+	return pci_up_path_over_pref_mem64(bus->parent);
+}
+
 int pci_resource_pref_compatible(const struct pci_dev *dev,
 				 struct resource *res)
 {
@@ -1040,7 +1052,8 @@ int pci_resource_pref_compatible(const struct pci_dev *dev,
 
 	if ((res->flags & IORESOURCE_MEM) &&
 	    (res->flags & IORESOURCE_MEM_64) &&
-	    dev->on_all_pcie_path)
+	    dev->on_all_pcie_path &&
+	    pci_up_path_over_pref_mem64(dev->bus))
 		return res->flags | IORESOURCE_PREFETCH;
 
 	return res->flags;
@@ -1821,6 +1834,10 @@ void __pci_bus_size_bridges(struct pci_bus *bus, struct list_head *realloc_head)
 	struct resource *b_res;
 	int ret;
 
+	if (!pci_is_root_bus(bus) &&
+	    (bus->self->class >> 8) == PCI_CLASS_BRIDGE_PCI)
+		pci_bridge_check_ranges(bus);
+
 	list_for_each_entry(dev, &bus->devices, bus_list) {
 		struct pci_bus *b = dev->subordinate;
 		if (!b)
@@ -1848,7 +1865,6 @@ void __pci_bus_size_bridges(struct pci_bus *bus, struct list_head *realloc_head)
 		break;
 
 	case PCI_CLASS_BRIDGE_PCI:
-		pci_bridge_check_ranges(bus);
 		if (bus->self->is_hotplug_bridge) {
 			min_io_size  = pci_hotplug_io_size;
 			min_mem_size = pci_hotplug_mem_size;
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 00/52] PCI: Resource allocation cleanup for v4.3 Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 23/52] PCI: Add support for more than two alt_size under same bridge Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 09/52] PCI: Rename pdev_sort_resources() to pdev_assign_resources_prepare() Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 18/52] PCI: Move comment to pci_need_to_release() Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 04/52] PCI: Optimize bus min_align/size calculation during sizing Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 27/52] PCI: Move ISA io port align out of calculate_iosize() Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 08/52] PCI: Remove duplicated code for resource sorting Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 05/52] PCI: Optimize bus align/size calculation for optional during sizing Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 36/52] PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64 Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 43/52] OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
    Re: [PATCH v4 43/52] OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource Rob Herring <robherring2@gmail.com> - 2015-08-21 20:20 +0200
      Re: [PATCH v4 43/52] OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource Yinghai Lu <yinghai@kernel.org> - 2015-08-21 20:30 +0200
  [PATCH v4 15/52] PCI: Cache window alignment value during bus sizing Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 01/52] PCI: Cleanup res_to_dev_res() printout Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 32/52] PCI: Kill macro checking for bus io port sizing Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 21/52] PCI: Move saved required resource list out of required+optional assigning Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 22/52] PCI: Add alt_size ressource allocation support Yinghai Lu <yinghai@kernel.org> - 2015-08-21 09:30 +0200
  [PATCH v4 44/52] PCI: Treat optional as required in first try for bridge rescan Yinghai Lu <yinghai@kernel.org> - 2015-08-21 09:30 +0200
  [PATCH v4 29/52] PCI: Unify calculate_size() for io port and MMIO Yinghai Lu <yinghai@kernel.org> - 2015-08-21 09:30 +0200

csiph-web