* [PATCH 02/13] alpha/PCI: Convert to pci_bus_size_and_assign_resources()
[not found] <20261116152403.2672-1-ilpo.jarvinen@linux.intel.com>
@ 2026-11-16 15:23 ` Ilpo Järvinen
2026-11-16 19:50 ` Magnus Lindholm
0 siblings, 1 reply; 4+ messages in thread
From: Ilpo Järvinen @ 2026-11-16 15:23 UTC (permalink / raw)
To: linux-pci, Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring,
Krzysztof Wilczyński, Richard Henderson, Matt Turner,
Magnus Lindholm, linux-alpha, linux-kernel
Cc: Ilpo Järvinen
To serialize bridge window sizing and resource assignment, PCI core
needs to hold locks across both phases. Alpha nautilus PCI code calls
pci_bus_size_bridges() and pci_bus_assign_resources() separately
because it needs to do special resource alignment and setup after the
window sizes have been calculated. At least the former would seem to
belong to some existing __weak pcibios_*() hook but the latter might
need yet another pcibios_*() hook just for this single use.
The nautilus code runs during init, so nothing is likely to race with
it. Converting it is mainly about consolidating the sizing and
assignment entry points of PCI core, which eventually allows removing
pci_bus_assign_resources().
Instead of trying to do a complex rework of the code, which is risky
without the ability to test on the hardware, simply convert
pci_bus_assign_resources() to pci_bus_size_and_assign_resources(). This
adds a small bit of extra work by performing the sizing step again, but
the calculations should yield the same sizes, so it seems safe.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
arch/alpha/kernel/sys_nautilus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 13b79960b4b9..23a74fd4a83f 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -263,7 +263,7 @@ nautilus_init_pci(void)
if ((IRONGATE0->dev_vendor >> 16) > 0x7006) /* Albacore? */
IRONGATE0->pci_mem = pci_mem;
- pci_bus_assign_resources(bus);
+ pci_bus_size_and_assign_resources(bus);
pci_bus_add_devices(bus);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 02/13] alpha/PCI: Convert to pci_bus_size_and_assign_resources()
2026-11-16 15:23 ` [PATCH 02/13] alpha/PCI: Convert to pci_bus_size_and_assign_resources() Ilpo Järvinen
@ 2026-11-16 19:50 ` Magnus Lindholm
2026-11-16 20:15 ` Ilpo Järvinen
0 siblings, 1 reply; 4+ messages in thread
From: Magnus Lindholm @ 2026-11-16 19:50 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: linux-pci, Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring,
Krzysztof Wilczyński, Richard Henderson, Matt Turner,
linux-alpha, linux-kernel
Hi Ilpo,
On Mon, Nov 16, 2026 at 4:24 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> To serialize bridge window sizing and resource assignment, PCI core
> needs to hold locks across both phases. Alpha nautilus PCI code calls
> pci_bus_size_bridges() and pci_bus_assign_resources() separately
> because it needs to do special resource alignment and setup after the
> window sizes have been calculated. At least the former would seem to
> belong to some existing __weak pcibios_*() hook but the latter might
> need yet another pcibios_*() hook just for this single use.
>
> The nautilus code runs during init, so nothing is likely to race with
> it. Converting it is mainly about consolidating the sizing and
> assignment entry points of PCI core, which eventually allows removing
> pci_bus_assign_resources().
>
> Instead of trying to do a complex rework of the code, which is risky
> without the ability to test on the hardware, simply convert
> pci_bus_assign_resources() to pci_bus_size_and_assign_resources(). This
> adds a small bit of extra work by performing the sizing step again, but
> the calculations should yield the same sizes, so it seems safe
>
Agreed. By the second pass irongate_mem has been request_resource()d, so
pbus_size_mem() skips it as assigned, and ioport_resource is never picked
as a window (find_bus_resource_of_type()). Only the AGP bridge's
unassigned windows are sized again, from the same inputs.
That does rely on the assigned check, though: if your follow-up series
starts sizing assigned windows, nautilus' relocated root window
(size_windows = 1) must stay untouched by the second pass.
It builds at every patch for the generic and Nautilus configs. I have a
UP1100 (Nautilus), but it doesn't start up at the moment; if I get it
running again I'll give this a boot. But for the Alpha part of this series:
Acked-by: Magnus Lindholm <linmag7@gmail.com>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> arch/alpha/kernel/sys_nautilus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
> index 13b79960b4b9..23a74fd4a83f 100644
> --- a/arch/alpha/kernel/sys_nautilus.c
> +++ b/arch/alpha/kernel/sys_nautilus.c
> @@ -263,7 +263,7 @@ nautilus_init_pci(void)
> if ((IRONGATE0->dev_vendor >> 16) > 0x7006) /* Albacore? */
> IRONGATE0->pci_mem = pci_mem;
>
> - pci_bus_assign_resources(bus);
> + pci_bus_size_and_assign_resources(bus);
> pci_bus_add_devices(bus);
> }
>
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 02/13] alpha/PCI: Convert to pci_bus_size_and_assign_resources()
2026-11-16 19:50 ` Magnus Lindholm
@ 2026-11-16 20:15 ` Ilpo Järvinen
2026-11-16 22:11 ` Ilpo Järvinen
0 siblings, 1 reply; 4+ messages in thread
From: Ilpo Järvinen @ 2026-11-16 20:15 UTC (permalink / raw)
To: Magnus Lindholm
Cc: linux-pci, Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring,
Krzysztof Wilczyński, Richard Henderson, Matt Turner,
linux-alpha, LKML
[-- Attachment #1: Type: text/plain, Size: 3769 bytes --]
On Mon, 16 Nov 2026, Magnus Lindholm wrote:
> On Mon, Nov 16, 2026 at 4:24 PM Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com> wrote:
> >
> > To serialize bridge window sizing and resource assignment, PCI core
> > needs to hold locks across both phases. Alpha nautilus PCI code calls
> > pci_bus_size_bridges() and pci_bus_assign_resources() separately
> > because it needs to do special resource alignment and setup after the
> > window sizes have been calculated. At least the former would seem to
> > belong to some existing __weak pcibios_*() hook but the latter might
> > need yet another pcibios_*() hook just for this single use.
> >
> > The nautilus code runs during init, so nothing is likely to race with
> > it. Converting it is mainly about consolidating the sizing and
> > assignment entry points of PCI core, which eventually allows removing
> > pci_bus_assign_resources().
> >
> > Instead of trying to do a complex rework of the code, which is risky
> > without the ability to test on the hardware, simply convert
> > pci_bus_assign_resources() to pci_bus_size_and_assign_resources(). This
> > adds a small bit of extra work by performing the sizing step again, but
> > the calculations should yield the same sizes, so it seems safe
> >
>
> Agreed. By the second pass irongate_mem has been request_resource()d, so
> pbus_size_mem() skips it as assigned, and ioport_resource is never picked
> as a window (find_bus_resource_of_type()). Only the AGP bridge's
> unassigned windows are sized again, from the same inputs.
>
> That does rely on the assigned check, though: if your follow-up series
> starts sizing assigned windows,
Yes, it will start to do that then.
> nautilus' relocated root window
> (size_windows = 1) must stay untouched by the second pass.
If the same size is calculated (during init, I see no reason why the
sizing results would change), there should be no change even when it
starts to assign windows.
I'm bit worried though when it comes to the extra alignment done by this
nautilus code as that can change the size from the original but I don't
think there is anything that would allow shrinking the window even with
that so it looks okay to me even after the upcoming series.
But it might be easiest to just set IORESOURCE_PCI_FIXED flag after the
resource has been added to the tree. That should keep the usual sizing
and assignment from touching it at all.
> It builds at every patch for the generic and Nautilus configs. I have a
> UP1100 (Nautilus), but it doesn't start up at the moment; if I get it
> running again I'll give this a boot. But for the Alpha part of this series:
Oh, that would potentially make it possible to actually try to refactor
this to happen in pcibios_*() code, which I certainly dare not without
ability test the change.
> Acked-by: Magnus Lindholm <linmag7@gmail.com>
Thanks a lot for taking a look and all the insight, it's really
appreciated.
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---
> > arch/alpha/kernel/sys_nautilus.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
> > index 13b79960b4b9..23a74fd4a83f 100644
> > --- a/arch/alpha/kernel/sys_nautilus.c
> > +++ b/arch/alpha/kernel/sys_nautilus.c
> > @@ -263,7 +263,7 @@ nautilus_init_pci(void)
> > if ((IRONGATE0->dev_vendor >> 16) > 0x7006) /* Albacore? */
> > IRONGATE0->pci_mem = pci_mem;
> >
> > - pci_bus_assign_resources(bus);
> > + pci_bus_size_and_assign_resources(bus);
> > pci_bus_add_devices(bus);
> > }
> >
> > --
> > 2.47.3
> >
>
--
i.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 02/13] alpha/PCI: Convert to pci_bus_size_and_assign_resources()
2026-11-16 20:15 ` Ilpo Järvinen
@ 2026-11-16 22:11 ` Ilpo Järvinen
0 siblings, 0 replies; 4+ messages in thread
From: Ilpo Järvinen @ 2026-11-16 22:11 UTC (permalink / raw)
To: Magnus Lindholm
Cc: linux-pci, Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring,
Krzysztof Wilczyński, Richard Henderson, Matt Turner,
linux-alpha, LKML
[-- Attachment #1: Type: text/plain, Size: 4426 bytes --]
On Mon, 16 Nov 2026, Ilpo Järvinen wrote:
> On Mon, 16 Nov 2026, Magnus Lindholm wrote:
> > On Mon, Nov 16, 2026 at 4:24 PM Ilpo Järvinen
> > <ilpo.jarvinen@linux.intel.com> wrote:
> > >
> > > To serialize bridge window sizing and resource assignment, PCI core
> > > needs to hold locks across both phases. Alpha nautilus PCI code calls
> > > pci_bus_size_bridges() and pci_bus_assign_resources() separately
> > > because it needs to do special resource alignment and setup after the
> > > window sizes have been calculated. At least the former would seem to
> > > belong to some existing __weak pcibios_*() hook but the latter might
> > > need yet another pcibios_*() hook just for this single use.
> > >
> > > The nautilus code runs during init, so nothing is likely to race with
> > > it. Converting it is mainly about consolidating the sizing and
> > > assignment entry points of PCI core, which eventually allows removing
> > > pci_bus_assign_resources().
> > >
> > > Instead of trying to do a complex rework of the code, which is risky
> > > without the ability to test on the hardware, simply convert
> > > pci_bus_assign_resources() to pci_bus_size_and_assign_resources(). This
> > > adds a small bit of extra work by performing the sizing step again, but
> > > the calculations should yield the same sizes, so it seems safe
> > >
> >
> > Agreed. By the second pass irongate_mem has been request_resource()d, so
> > pbus_size_mem() skips it as assigned, and ioport_resource is never picked
> > as a window (find_bus_resource_of_type()). Only the AGP bridge's
> > unassigned windows are sized again, from the same inputs.
> >
> > That does rely on the assigned check, though: if your follow-up series
> > starts sizing assigned windows,
>
> Yes, it will start to do that then.
>
> > nautilus' relocated root window
> > (size_windows = 1) must stay untouched by the second pass.
>
> If the same size is calculated (during init, I see no reason why the
> sizing results would change), there should be no change even when it
> starts to assign windows.
>
> I'm bit worried though when it comes to the extra alignment done by this
> nautilus code as that can change the size from the original but I don't
> think there is anything that would allow shrinking the window even with
> that so it looks okay to me even after the upcoming series.
>
> But it might be easiest to just set IORESOURCE_PCI_FIXED flag after the
> resource has been added to the tree. That should keep the usual sizing
> and assignment from touching it at all.
For the record, I realized this won't be necessary because nothing in the
fitting and assignment algorithm can change the resource once it has been
assigned.
All direct resource changes are (or should be) blocked for assigned
resources to not corrupt the resource tree and root bus resources don't
have bus->self so they never go into lists that need bus->self
(add_list/realloc_head and the upcoming bridge_win_list).
> > It builds at every patch for the generic and Nautilus configs. I have a
> > UP1100 (Nautilus), but it doesn't start up at the moment; if I get it
> > running again I'll give this a boot. But for the Alpha part of this series:
>
> Oh, that would potentially make it possible to actually try to refactor
> this to happen in pcibios_*() code, which I certainly dare not without
> ability test the change.
>
> > Acked-by: Magnus Lindholm <linmag7@gmail.com>
>
> Thanks a lot for taking a look and all the insight, it's really
> appreciated.
>
> > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > > ---
> > > arch/alpha/kernel/sys_nautilus.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
> > > index 13b79960b4b9..23a74fd4a83f 100644
> > > --- a/arch/alpha/kernel/sys_nautilus.c
> > > +++ b/arch/alpha/kernel/sys_nautilus.c
> > > @@ -263,7 +263,7 @@ nautilus_init_pci(void)
> > > if ((IRONGATE0->dev_vendor >> 16) > 0x7006) /* Albacore? */
> > > IRONGATE0->pci_mem = pci_mem;
> > >
> > > - pci_bus_assign_resources(bus);
> > > + pci_bus_size_and_assign_resources(bus);
> > > pci_bus_add_devices(bus);
> > > }
> > >
> > > --
> > > 2.47.3
> > >
> >
>
>
--
i.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-16 22:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261116152403.2672-1-ilpo.jarvinen@linux.intel.com>
2026-11-16 15:23 ` [PATCH 02/13] alpha/PCI: Convert to pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-16 19:50 ` Magnus Lindholm
2026-11-16 20:15 ` Ilpo Järvinen
2026-11-16 22:11 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox