[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1444340359-8011-37-git-send-email-yinghai@kernel.org>
Date: Thu, 8 Oct 2015 14:38:55 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Bjorn Helgaas <bhelgaas@...gle.com>,
David Miller <davem@...emloft.net>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Wei Yang <weiyang@...ux.vnet.ibm.com>, TJ <linux@....tj>,
Yijing Wang <wangyijing@...wei.com>,
Khalid Aziz <khalid.aziz@...cle.com>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH v7 36/60] PCI: Cache window alignment value during bus sizing
There are several calling to window_alignment(), and we will have more
for alt_size support, cache the value instead of keeping on getting it.
Signed-off-by: Yinghai Lu <yinghai@...nel.org>
---
drivers/pci/setup-bus.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index b86417d..deed016 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1241,6 +1241,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
mask | IORESOURCE_PREFETCH, type);
LIST_HEAD(align_test_list);
LIST_HEAD(align_test_add_list);
+ resource_size_t window_align;
if (!b_res)
return -ENOSPC;
@@ -1250,6 +1251,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
min_size = 0;
}
+ window_align = window_alignment(bus, b_res->flags);
+
list_for_each_entry(dev, &bus->devices, bus_list) {
int i;
@@ -1311,10 +1314,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
}
}
- max_align = max(max_align, window_alignment(bus, b_res->flags));
+ max_align = max(max_align, window_align);
if (size || min_size) {
min_align = calculate_mem_align(&align_test_list, max_align,
- size, window_alignment(bus, b_res->flags));
+ size, window_align);
size0 = calculate_memsize(size, min_size,
resource_size(b_res), min_align);
}
@@ -1325,7 +1328,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
if (sum_add_size > size && realloc_head) {
min_add_align = calculate_mem_align(&align_test_add_list,
max_add_align, sum_add_size,
- window_alignment(bus, b_res->flags));
+ window_align);
size1 = calculate_memsize(sum_add_size, min_size,
resource_size(b_res), min_add_align);
}
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists