Patchwork [v7] PCI: Try best to allocate pref mmio 64bit above 4g

login
register
mail settings
Submitter Yinghai Lu
Date April 17, 2014, 3:30 a.m.
Message ID <CAE9FiQUKYMPvXLsk84o-gH-j0-wiJGL0Wt1aTW2o4FPSm0PvbQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/339771/
State Superseded
Headers show

Comments

Yinghai Lu - April 17, 2014, 3:30 a.m.
On Wed, Apr 16, 2014 at 10:06 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> I think we should stop putting PCI_PREF_RANGE_TYPE_64 in res->flags.
> I don't think we ever test for PCI_PREF_RANGE_TYPE_64 today, except
> for the trivial usage in pci_read_bridge_mmio_pref(), which can be
> easily removed.
>
> Everywhere else, we use IORESOURCE_MEM, IORESOURCE_MEM_64, and
> IORESOURCE_PREFETCH to keep track of the properties of the hardware
> underlying the struct resource, i.e., the BAR.  Why shouldn't we do
> the same for bridge windows?
>
> The struct resource flags should tell us the *possible* properties of
> the window, e.g., what the bridge can support.  These properties are
> fixed by the bridge hardware, regardless of what devices happen to be
> below the bridge.  We discover those properties at enumeration-time,
> and we shouldn't change them afterwards.

After this patch (we check exact type with 64bit pref), actually bridge flags
IORESOURCE_MEM_64 would not get cleared.
so we don't check that in pbus_size_mem anymore.

Following patch could be applied later.

Subject: [PATCH] PCI: don't update bridge resource flags according to children

After  PCI: Try best to allocate pref mmio 64bit above 4g
We don't need to check if children support 64bit, and update
bridge resource flags anymore.
As the code size and assign according exact type already.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 drivers/pci/setup-bus.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Patch

Subject: [PATCH] PCI: don't update bridge resource flags according to children

After  PCI: Try best to allocate pref mmio 64bit above 4g
We don't need to check if children support 64bit, and update
bridge resource flags anymore.
As the code size and assign according exact type already.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 drivers/pci/setup-bus.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Index: linux-2.6/drivers/pci/setup-bus.c
===================================================================
--- linux-2.6.orig/drivers/pci/setup-bus.c
+++ linux-2.6/drivers/pci/setup-bus.c
@@ -926,7 +926,6 @@  static int pbus_size_mem(struct pci_bus
 	int order, max_order;
 	struct resource *b_res = find_free_bus_resource(bus,
 					 mask | IORESOURCE_PREFETCH, type);
-	unsigned int mem64_mask = 0;
 	resource_size_t children_add_size = 0;
 
 	if (!b_res)
@@ -936,9 +935,6 @@  static int pbus_size_mem(struct pci_bus
 	max_order = 0;
 	size = 0;
 
-	mem64_mask = b_res->flags & IORESOURCE_MEM_64;
-	b_res->flags &= ~IORESOURCE_MEM_64;
-
 	list_for_each_entry(dev, &bus->devices, bus_list) {
 		int i;
 
@@ -980,7 +976,6 @@  static int pbus_size_mem(struct pci_bus
 				aligns[order] += align;
 			if (order > max_order)
 				max_order = order;
-			mem64_mask &= r->flags & IORESOURCE_MEM_64;
 
 			if (realloc_head)
 				children_add_size += get_res_add_size(realloc_head, r);
@@ -1005,7 +1000,7 @@  static int pbus_size_mem(struct pci_bus
 	}
 	b_res->start = min_align;
 	b_res->end = size0 + min_align - 1;
-	b_res->flags |= IORESOURCE_STARTALIGN | mem64_mask;
+	b_res->flags |= IORESOURCE_STARTALIGN;
 	if (size1 > size0 && realloc_head) {
 		add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align);
 		dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window "