From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-pci@vger.kernel.org
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Guenter Roeck <linux@roeck-us.net>,
linux-alpha@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org,
linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-s390@vger.kernel.org, linux-sh@vger.kernel.org,
Russell King <linux@armlinux.org.uk>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
Helge Deller <deller@gmx.de>,
Michael Ellerman <mpe@ellerman.id.au>,
Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Chris Zankel <chris@zankel.net>,
Max Filippov <jcmvbkbc@gmail.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
x86@kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 09/10] PCI: Align head space better
Date: Wed, 25 Mar 2026 14:04:03 +0200 (EET) [thread overview]
Message-ID: <3a51ad39-558f-860d-4920-9f757b7d5131@linux.intel.com> (raw)
In-Reply-To: <20260324165633.4583-10-ilpo.jarvinen@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2856 bytes --]
On Tue, 24 Mar 2026, Ilpo Järvinen wrote:
> 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>
> ---
> arch/arm/kernel/bios32.c | 3 +++
> arch/m68k/kernel/pcibios.c | 4 ++++
> arch/mips/pci/pci-generic.c | 3 +++
> arch/mips/pci/pci-legacy.c | 2 ++
> arch/parisc/kernel/pci.c | 3 +++
> arch/powerpc/kernel/pci-common.c | 2 ++
> arch/sh/drivers/pci/pci.c | 2 ++
> arch/x86/pci/i386.c | 2 ++
> arch/xtensa/kernel/pci.c | 2 ++
> drivers/pci/setup-res.c | 39 +++++++++++++++++++++++++++++++-
> include/linux/pci.h | 5 ++++
> kernel/resource.c | 2 +-
> 12 files changed, 67 insertions(+), 2 deletions(-)
> diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
> index 7a0522316ee3..994c3bd36ef2 100644
> --- a/arch/sh/drivers/pci/pci.c
> +++ b/arch/sh/drivers/pci/pci.c
> @@ -185,6 +185,8 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
> */
> if (start & 0x300)
> start = (start + 0x3ff) & ~0x3ff;
> + } else (res->flags & IORESOURCE_MEM) {
I'll be adding the missing if into this in v2 (found by sashiko). It seems
lkp didn't test this so it was not caught earlier.
> + start = pci_align_resource(dev, res, empty_res, size, align);
> }
>
> return start;
--
i.
next prev parent reply other threads:[~2026-03-25 12:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 16:56 [PATCH 00/10] PCI: Improve head free space usage Ilpo Järvinen
2026-03-24 16:56 ` [PATCH 01/10] resource: Add __resource_contains_unbound() for internal contains checks Ilpo Järvinen
2026-03-24 16:56 ` [PATCH 02/10] resource: Pass full extent of empty space to resource_alignf CB Ilpo Järvinen
2026-03-24 16:56 ` [PATCH 03/10] resource: Rename 'tmp' variable to 'full_avail' Ilpo Järvinen
2026-03-24 16:56 ` [PATCH 04/10] ARM/PCI: Remove unnecessary second application of align Ilpo Järvinen
2026-03-24 16:56 ` [PATCH 05/10] am68k/PCI: " Ilpo Järvinen
2026-03-24 17:06 ` Geert Uytterhoeven
2026-03-24 17:43 ` John Paul Adrian Glaubitz
2026-03-24 17:55 ` Ilpo Järvinen
2026-03-24 18:36 ` John Paul Adrian Glaubitz
2026-03-27 2:55 ` Greg Ungerer
2026-03-24 16:56 ` [PATCH 06/10] MIPS: PCI: " Ilpo Järvinen
2026-03-24 16:56 ` [PATCH 07/10] parisc/PCI: Cleanup align handling Ilpo Järvinen
2026-03-24 16:56 ` [PATCH 08/10] PCI: Rename window_alignment() to pci_min_window_alignment() Ilpo Järvinen
2026-03-24 16:56 ` [PATCH 09/10] PCI: Align head space better Ilpo Järvinen
2026-03-25 12:04 ` Ilpo Järvinen [this message]
2026-03-24 16:56 ` [PATCH 10/10] PCI: Fix alignment calculation for resource size larger than align Ilpo Järvinen
2026-03-26 19:25 ` [PATCH 00/10] PCI: Improve head free space usage Bjorn Helgaas
2026-03-27 10:28 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a51ad39-558f-860d-4920-9f757b7d5131@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=chleroy@kernel.org \
--cc=chris@zankel.net \
--cc=dalias@libc.org \
--cc=dave.hansen@linux.intel.com \
--cc=deller@gmx.de \
--cc=geert@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=hpa@zytor.com \
--cc=jcmvbkbc@gmail.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@roeck-us.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=tglx@kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=x86@kernel.org \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox