[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a3SaRTJ_a6tJOHjBeCqwyQTe39-1_2bkD71ZzhJQWCM1Q@mail.gmail.com>
Date: Wed, 22 Sep 2021 17:33:03 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: Huacai Chen <chenhuacai@...il.com>, Arnd Bergmann <arnd@...db.de>,
Huacai Chen <chenhuacai@...ngson.cn>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
David Airlie <airlied@...ux.ie>,
Jonathan Corbet <corbet@....net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-arch <linux-arch@...r.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Xuefeng Li <lixuefeng@...ngson.cn>,
Yanteng Si <siyanteng@...ngson.cn>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Jianmin Lv <lvjianmin@...ngson.cn>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
linux-pci <linux-pci@...r.kernel.org>,
Will Deacon <will@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Rob Herring <robh@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH V3 18/22] LoongArch: Add PCI controller support
On Wed, Sep 22, 2021 at 12:36 AM Bjorn Helgaas <helgaas@...nel.org> wrote:
>
> On Sat, Sep 18, 2021 at 03:36:52PM +0800, Huacai Chen wrote:
> > On Fri, Sep 17, 2021 at 5:02 PM Arnd Bergmann <arnd@...db.de> wrote:
> > > On Fri, Sep 17, 2021 at 5:57 AM Huacai Chen <chenhuacai@...ngson.cn> wrote:
> > > >
> > > > Loongson64 based systems are PC-like systems which use PCI/PCIe as its
> > > > I/O bus, This patch adds the PCI host controller support for LoongArch.
> > > >
> > > > Signed-off-by: Jianmin Lv <lvjianmin@...ngson.cn>
> > > > Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>
> > >
> > > As discussed before, I think the PCI support should not be part of the
> > > architecture code or this patch series. The headers are ok, but the pci.c
> > > and acpi.c files have nothing loongarch specific in them, and you clearly
> > > just copied most of this from arm64 or x86.
> >
> > In V2 part of the PCI code (pci-loongson.c) has moved to
> > drivers/pci/controllers. For pci.c and acpi.c, I agree that "the thing
> > should be like that", but have some different ideas about "the way to
> > arrive at that". In my opinion, we can let this series be merged at
> > first, and then do another series to "restructure the files and move
> > common parts to the drivers directory". That way looks more natural to
> > me (doing the other series at first may block the whole thing).
It should not hold up the current series, but I think you should be able
to do both sides (architecture code and pci support) independently
at the same time.
> > > What I would suggest you do instead is:
> > >
> > > - start a separate patch series, addressed to the ACPI, PCI host driver
> > > and ARM64 maintainers.
> > >
> > > - Move all the bits you need from arch/{arm64,ia64,x86} into
> > > drivers/acpi/pci/pci_root.c, duplicating them with #if/#elif/#else
> > > where they are too different, making the #else path the
> > > default that can be shared with loongarch.
> > >
> > > - Move the bits from pci_root_info/acpi_pci_root_info that are
> > > always needed into struct pci_host_bridge, with an
> > > #ifdef CONFIG_ACPI where appropriate.
> > >
> > > - Simplify as much as you can easily do.
>
> I would love to see this done.
>
> But we already have this kind of redundant code for arm64/ia64/x86.
> Arguably, we should have refactored it for ia64 or arm64. It's
> unfortunate to add loongarch to that list, but why should we penalize
> loongarch more than arm64 and ia64?
There is usually something like this that comes up when support for a
new architecture gets posted and it duplicates some code from other
architectures.
When I review the port, I try to come to a reasonable balance asking
the submitters to clean up some aspect of the common code base
so they and everyone afterwards is able to use more shared
infrastructure without duplication. This is clearly a different area
every time, but I think the ACPI PCI code is an obvious thing to
ask for cleaning up this time, as there are only three existing users.
We could probably have done a better job for the arm64 version,
but even getting that working was enough of a mess (initially
you had only ACPI or PCI but not both together), and there
were other problems with the architecture port that needed sorting
out at the time.
I can definitely offer to help plan this part a little bit better, but
I actually hope it's not all that much work.
Arnd
Powered by blists - more mailing lists