linux/arch/sh/drivers/pci
Ilpo Järvinen 9036bd0efc PCI: Align head space better
When a bridge window contains big and small resource(s), the small
resource(s) may not amount to the half of the size of the big resource
which would allow calculate_head_align() to shrink the head alignment.
This results in always placing the small resource(s) after the big
resource.

In general, it would be good to be able to place the small resource(s)
before the big resource to achieve better utilization of the address space.
In the cases where the large resource can only fit at the end of the
window, it is even required.

However, carrying the information over from pbus_size_mem() and
calculate_head_align() to __pci_assign_resource() and
pcibios_align_resource() is not easy with the current data structures.

A somewhat hacky way to move the non-aligning tail part to the head is
possible within pcibios_align_resource(). The free space between the start
of the free space span and the aligned start address can be compared with
the non-aligning remainder of the size. If the free space is larger than
the remainder, placing the remainder before the start address is possible.
This relocation should generally work, because PCI resources consist only
power-of-2 atoms.

Various arch requirements may still need to override the relocation, so the
relocation is only applied selectively in such cases.

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221205
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Xifer <xiferdev@gmail.com>
Link: https://patch.msgid.link/20260324165633.4583-10-ilpo.jarvinen@linux.intel.com
2026-03-27 10:19:08 -05:00
..
common.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
fixups-dreamcast.c dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
fixups-landisk.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
fixups-r7780rp.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
fixups-rts7751r2d.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
fixups-sdk7780.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
fixups-sdk7786.c sh: Use pr_warn instead of pr_warning 2019-10-18 13:52:05 +02:00
fixups-se7751.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fixups-sh03.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fixups-snapgear.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
fixups-titan.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
Makefile sh: Remove SH5-based Cayman platform 2020-08-14 22:05:06 -04:00
ops-dreamcast.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
ops-sh4.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
ops-sh7786.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
pci-dreamcast.c sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
pci-sh4.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci-sh7751.c treewide: replace #include <asm/sizes.h> with #include <linux/sizes.h> 2019-05-14 19:52:52 -07:00
pci-sh7751.h sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
pci-sh7780.c sh: pci: Modernize printing of kernel messages 2020-08-14 22:05:10 -04:00
pci-sh7780.h sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00
pci.c PCI: Align head space better 2026-03-27 10:19:08 -05:00
pcie-sh7786.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
pcie-sh7786.h sh: drivers: convert to SPDX identifiers 2018-12-28 12:11:44 -08:00