diff mbox series

[v2,07/10] PCI: call add_bus method also for root bus

Message ID 20190219155728.19163-8-tbogendoerfer@suse.de (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show
Series MIPS: SGI-IP27 rework | expand

Commit Message

Thomas Bogendoerfer Feb. 19, 2019, 3:57 p.m. UTC
pci-xtalk controller code uses the add_bus method to set node of
the bus device, which then is used for pcibus_to_node() implementation.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/pci/probe.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Bjorn Helgaas Feb. 21, 2019, 11:37 p.m. UTC | #1
Hi Thomas,

On Tue, Feb 19, 2019 at 04:57:21PM +0100, Thomas Bogendoerfer wrote:
> pci-xtalk controller code uses the add_bus method to set node of
> the bus device, which then is used for pcibus_to_node() implementation.
> 
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> ---
>  drivers/pci/probe.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 257b9f6f2ebb..456448d5f46d 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -837,6 +837,12 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
>  
>  	pcibios_add_bus(bus);
>  
> +	if (bus->ops->add_bus) {
> +		err = bus->ops->add_bus(bus);
> +		if (WARN_ON(err < 0))
> +			dev_err(&bus->dev, "failed to add bus: %d\n", err);
> +	}

Is there something special about pci-xtalk that prevents it from
setting the node the way other platforms do, without using the
add_bus() method?

I haven't researched the details of how other platforms do it, but if
it would be possible for pci-xtalk to do it the same way, that would
be ideal.

>  	/* Create legacy_io and legacy_mem files for this bus */
>  	pci_create_legacy_files(bus);
>  
> -- 
> 2.13.7
>
Thomas Bogendoerfer Feb. 23, 2019, 11:04 a.m. UTC | #2
On Thu, Feb 21, 2019 at 05:37:08PM -0600, Bjorn Helgaas wrote:
> On Tue, Feb 19, 2019 at 04:57:21PM +0100, Thomas Bogendoerfer wrote:
> > pci-xtalk controller code uses the add_bus method to set node of
> > the bus device, which then is used for pcibus_to_node() implementation.
> > 
> > Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> > ---
> >  drivers/pci/probe.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> > index 257b9f6f2ebb..456448d5f46d 100644
> > --- a/drivers/pci/probe.c
> > +++ b/drivers/pci/probe.c
> > @@ -837,6 +837,12 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
> >  
> >  	pcibios_add_bus(bus);
> >  
> > +	if (bus->ops->add_bus) {
> > +		err = bus->ops->add_bus(bus);
> > +		if (WARN_ON(err < 0))
> > +			dev_err(&bus->dev, "failed to add bus: %d\n", err);
> > +	}
> 
> Is there something special about pci-xtalk that prevents it from
> setting the node the way other platforms do, without using the
> add_bus() method?

x86: uses node in common struct pci_sysdata
ia64: uses node in common struct pci_controller
powerpc: uses node in common struct pci_controller
sparc: uses numa_node in common struct pci_pbm_info
arm64: uses dev_to_node(&bus->dev) and node is set via pcibios_add_bus()

MIPS right now has no common struct, which is reachable via bus->sysdata,
if CONFIG_PCI_DRIVERS_LEGACY is not selected (and I want to get away
with that option). So I liked the arm64 way, but I didn't want to implement
pcibios_add_bus just for SGI-IP27 and noticed, that pcibios_add_bus
is called for child and root bus, while add_bus method only for
child buses. So my patch gives add_bus the same power as pcibios_add_bus
already have. Is this good enough as argument ?

> I haven't researched the details of how other platforms do it, but if
> it would be possible for pci-xtalk to do it the same way, that would
> be ideal.

there is always a different way of course. If you don't like my patch
I'll find one ;-)

Thomas.
Thomas Bogendoerfer Feb. 28, 2019, 1:03 p.m. UTC | #3
On Thu, Feb 21, 2019 at 05:37:08PM -0600, Bjorn Helgaas wrote:
> I haven't researched the details of how other platforms do it, but if
> it would be possible for pci-xtalk to do it the same way, that would
> be ideal.

I don't need this patch any longer. So you could just ignore it.

Thomas.
diff mbox series

Patch

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 257b9f6f2ebb..456448d5f46d 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -837,6 +837,12 @@  static int pci_register_host_bridge(struct pci_host_bridge *bridge)
 
 	pcibios_add_bus(bus);
 
+	if (bus->ops->add_bus) {
+		err = bus->ops->add_bus(bus);
+		if (WARN_ON(err < 0))
+			dev_err(&bus->dev, "failed to add bus: %d\n", err);
+	}
+
 	/* Create legacy_io and legacy_mem files for this bus */
 	pci_create_legacy_files(bus);