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


Groups > linux.kernel > #1237013

[PATCH v6 39/53] PCI: Allow bridge optional only io port resource required size to be 0

From Yinghai Lu <yinghai@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v6 39/53] PCI: Allow bridge optional only io port resource required size to be 0
Date 2015-10-01 08:10 +0200
Message-ID <qeFe2-3CQ-21@gated-at.bofh.it> (permalink)
References <qeF4l-3bG-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When there is no child device under the non hotplug bridge,
We can use 0 for required size, and do not use old size as required size.

That will save some io port range for other bridges, as BIOS could do
some partial assign, and we want to use those not used io port range.

When there is child device, size will not be 0.
when the bridge supports hotplug, min_size will not be 0.
So they will still honor the old size as required size.

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

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 0fd66b6..7a474d9 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1192,8 +1192,9 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
 
 	size = size_aligned_for_isa(size);
 	size += size1;
-	size0 = calculate_size(size, min_size,
-			resource_size(b_res), min_align);
+	if (size || min_size)
+		size0 = calculate_size(size, min_size,
+					resource_size(b_res), min_align);
 	sum_add_size = size_aligned_for_isa(sum_add_size);
 	sum_add_size += sum_add_size1;
 	if (sum_add_size < min_sum_size)
@@ -1209,7 +1210,7 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
 		return;
 	}
 
-	b_res->start = min_align;
+	b_res->start = size0 ? min_align : 0;
 	b_res->end = b_res->start + size0 - 1;
 	b_res->flags |= IORESOURCE_STARTALIGN;
 	if (size1 > size0 && realloc_head) {
-- 
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 v6 00/53] PCI: Resource allocation cleanup for v4.4 Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 27/53] PCI: Separate out save_resources()/restore_resources() Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 41/53] PCI: Kill macro checking for bus io port sizing Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 38/53] PCI: Unify calculate_size() for io port and MMIO Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 46/53] PCI: Check pref compatible bit for mem64 resource of PCIe device Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 35/53] PCI: Don't add too much optional size for hotplug bridge io Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 50/53] PCI: Restore pref MMIO allocation logic for host bridge without mmio64 Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 16/53] PCI: Optimize bus align/size calculation for optional during sizing Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 21/53] PCI: Treat ROM resource as optional during realloc Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 30/53] PCI: Skip required+optional if there is no optional Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 39/53] PCI: Allow bridge optional only io port resource required size to be 0 Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 25/53] PCI: Cache window alignment value during bus sizing Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 53/53] PCI: Don't set flags to 0 when assign resource fail Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 17/53] PCI: Don't add too much optional size for hotplug bridge MMIO Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 42/53] resources: Split out __allocate_resource() Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 48/53] PCI: Add has_mem64 for struct host_bridge Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 33/53] PCI: Add support for more than two alt_size entries under same bridge Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 45/53] PCI: Add debug print out for min_align and alt_size Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:10 +0200
  [PATCH v6 24/53] PCI: Add __add_to_list() Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:20 +0200
  [PATCH v6 44/53] PCI, x86: Allocate from high in available window for MMIO Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:20 +0200
  [PATCH v6 12/53] PCI: Cleanup res_to_dev_res() printout Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:20 +0200
  [PATCH v6 52/53] PCI: Introduce resource_disabled() Yinghai Lu <yinghai@kernel.org> - 2015-10-01 08:20 +0200
  [PATCH v6 51/53] PCI, x86: Add pci=assign_pref_bars to reallocate pref BARs Yinghai Lu <yinghai@kernel.org> - 2015-10-01 09:00 +0200
  [PATCH v6 26/53] PCI: Check if resource is allocated before trying to assign one Yinghai Lu <yinghai@kernel.org> - 2015-10-01 09:00 +0200
  [PATCH v6 20/53] PCI: Rename pdev_sort_resources() to pdev_assign_resources_prepare() Yinghai Lu <yinghai@kernel.org> - 2015-10-01 09:00 +0200
  [PATCH v6 49/53] PCI: Only treat non-pref mmio64 as pref if host bridge has mmio64 Yinghai Lu <yinghai@kernel.org> - 2015-10-01 09:00 +0200
  [PATCH v6 34/53] PCI: Fix size calculation with old_size on rescan path Yinghai Lu <yinghai@kernel.org> - 2015-10-01 09:00 +0200

csiph-web