[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqLMAyUEZgLjiKmNL2ioTYJwj-TbTWFJmEi7pynKZHXmoQ@mail.gmail.com>
Date: Tue, 4 May 2021 09:34:54 -0500
From: Rob Herring <robh@...nel.org>
To: Mike Rapoport <rppt@...nel.org>, Boqun Feng <boqun.feng@...il.com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>, Arnd Bergmann <arnd@...db.de>,
Marc Zyngier <maz@...nel.org>,
Russell King <linux@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
Gregory Clement <gregory.clement@...tlin.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Robin Murphy <robin.murphy@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Jon Derrick <jonathan.derrick@...el.com>,
Sunil Muthuswamy <sunilmut@...rosoft.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org, linux-pci@...r.kernel.org,
linux-hyperv@...r.kernel.org
Subject: Re: [RFC v2 1/7] PCI: Introduce pci_host_bridge::domain_nr
On Tue, May 4, 2021 at 12:16 AM Mike Rapoport <rppt@...nel.org> wrote:
>
> On Mon, May 03, 2021 at 10:46:29PM +0800, Boqun Feng wrote:
> > Currently we retrieve the PCI domain number of the host bridge from the
> > bus sysdata (or pci_config_window if PCI_DOMAINS_GENERIC=y). Actually
> > we have the information at PCI host bridge probing time, and it makes
> > sense that we store it into pci_host_bridge. One benefit of doing so is
> > the requirement for supporting PCI on Hyper-V for ARM64, because the
> > host bridge of Hyper-V doesnt' have pci_config_window, whereas ARM64 is
> > a PCI_DOMAINS_GENERIC=y arch, so we cannot retrieve the PCI domain
> > number from pci_config_window on ARM64 Hyper-V guest.
> >
> > As the preparation for ARM64 Hyper-V PCI support, we introduce the
> > domain_nr in pci_host_bridge, and set it properly at probing time, then
> > for PCI_DOMAINS_GENERIC=y archs, bus domain numbers are set by the
> > bridge domain_nr.
> >
> > Signed-off-by: Boqun Feng <boqun.feng@...il.com>
> > ---
> > arch/arm/kernel/bios32.c | 2 ++
> > arch/arm/mach-dove/pcie.c | 2 ++
> > arch/arm/mach-mv78xx0/pcie.c | 2 ++
> > arch/arm/mach-orion5x/pci.c | 2 ++
> > arch/arm64/kernel/pci.c | 3 +--
> > arch/mips/pci/pci-legacy.c | 2 ++
> > arch/mips/pci/pci-xtalk-bridge.c | 2 ++
> > drivers/pci/controller/pci-ftpci100.c | 2 ++
> > drivers/pci/controller/pci-mvebu.c | 2 ++
> > drivers/pci/pci.c | 4 ++--
> > drivers/pci/probe.c | 7 ++++++-
> > include/linux/pci.h | 11 ++++++++---
> > 12 files changed, 33 insertions(+), 8 deletions(-)
> >
> > diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
> > index e7ef2b5bea9c..4942cd681e41 100644
> > --- a/arch/arm/kernel/bios32.c
> > +++ b/arch/arm/kernel/bios32.c
> > @@ -471,6 +471,8 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
> > bridge->sysdata = sys;
> > bridge->busnr = sys->busnr;
> > bridge->ops = hw->ops;
> > + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC))
> > + bridge->domain_nr = pci_bus_find_domain_nr(sys, parent);
> >
> > ret = pci_scan_root_bus_bridge(bridge);
> > }
> > diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
> > index ee91ac6b5ebf..92eb8484b49b 100644
> > --- a/arch/arm/mach-dove/pcie.c
> > +++ b/arch/arm/mach-dove/pcie.c
> > @@ -167,6 +167,8 @@ dove_pcie_scan_bus(int nr, struct pci_host_bridge *bridge)
> > bridge->sysdata = sys;
> > bridge->busnr = sys->busnr;
> > bridge->ops = &pcie_ops;
> > + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC))
> > + bridge->domain_nr = pci_bus_find_domain_nr(sys, NULL);
>
> The check for CONFIG_PCI_DOMAINS_GENERIC is excessive because there is a
> stub for pci_bus_find_domain_nr().
>
> I'm not an expert in PCI, but maybe the repeated assignment of
> bridge->domain_nr can live in the generic code, say, in
> pci_scan_root_bus_bridge(). E.g. it will set the domain_nr when it is zero.
Yes. There's zero reason h/w drivers should care what the domain_nr is.
There's another issue with domains you should be aware of:
https://lore.kernel.org/linux-pci/20210425152155.mstuxndsoqdbdape@pali/
That may need to be fixed first because deferred probing could cause
the domain to increment each time you retry probe.
Rob
Powered by blists - more mailing lists