[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3871b83a-0e80-402e-bbe6-359c17127842@app.fastmail.com>
Date: Fri, 01 Dec 2023 17:27:40 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Philipp Stanner" <pstanner@...hat.com>,
"Bjorn Helgaas" <bhelgaas@...gle.com>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Dan Williams" <dan.j.williams@...el.com>,
"Jonathan Cameron" <Jonathan.Cameron@...wei.com>,
"Jakub Kicinski" <kuba@...nel.org>,
"Dave Jiang" <dave.jiang@...el.com>,
"Uladzislau Koshchanka" <koshchanka@...il.com>,
"Neil Brown" <neilb@...e.de>,
"Niklas Schnelle" <schnelle@...ux.ibm.com>,
"John Sanpe" <sanpeqf@...il.com>,
"Kent Overstreet" <kent.overstreet@...il.com>,
"Masami Hiramatsu" <mhiramat@...nel.org>,
"Kees Cook" <keescook@...omium.org>,
"David Gow" <davidgow@...gle.com>,
"Yury Norov" <yury.norov@...il.com>,
"wuqiang.matt" <wuqiang.matt@...edance.com>,
"Jason Baron" <jbaron@...mai.com>,
"Kefeng Wang" <wangkefeng.wang@...wei.com>,
"Ben Dooks" <ben.dooks@...ethink.co.uk>,
"Danilo Krummrich" <dakr@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
Linux-Arch <linux-arch@...r.kernel.org>
Subject: Re: [PATCH v2 0/4] Regather scattered PCI-Code
On Fri, Dec 1, 2023, at 13:16, Philipp Stanner wrote:
>
> Arnd has suggested that architectures defining a custom inb() need their
> own iomem_is_ioport(), as well. I've grepped for inb() and found the
> following list of archs that define their own:
> - alpha
> - arm
> - m68k <--
> - parisc
> - powerpc
> - sh
> - sparc
> - x86 <--
>
> All of those have their own definitons of pci_iounmap(). Therefore, they
> don't need our generic version in the first place and, thus, also need
> no iomem_is_ioport().
What I meant of course is that they should define iomem_is_ioport()
in order to drop the custom pci_iounmap() and have only one remaining
definition of that function left.
The one special case that I missed the last time is s390, which
does not use GENERIC_PCI_IOMAP and will just require a separate
copy of pci_iounmap() to go along with the is custom pci_iomap().
> The two exceptions are x86 and m68k. The former uses lib/iomap.c through
> CONFIG_GENERIC_IOMAP, as Arnd pointed out in the previous discussion
> (thus, CONFIG_GENERIC_IOMAP is not really generic in this regard).
>
> So as I see it, only m68k WOULD need its own custom definition of
> iomem_is_ioport(). But as I understand it it doesn't because it uses the
> one from asm-generic/pci_iomap.h ??
At the moment, m68k gets the pci_iounmap() from lib/iomap.c
if PCI is enabled for coldfire, but that incorrectly calls
iounmap() on PCI_IO_PA if it gets passed a PIO address.
The version from asm-generic/io.h should fix this.
For classic m68k, there is no PCI, so nothing calls pci_iounmap().
> I wasn't entirely sure how to deal with the address ranges for the
> generic implementation in asm-generic/io.h. It's marked with a TODO.
> Input appreciated.
I commented on the function directly. To clarify, I think we should
be able to directly turn each pci_iounmap() definition into
a iomem_is_ioport() definition by keeping the logic unchanged
and just return 'true' for the PIO variant or 'false' for the MMIO
version.
> I removed the guard around define pci_iounmap in asm-generic/io.h. An
> alternative would be to have it be guarded by CONFIG_GENERIC_IOMAP and
> CONFIG_GENERIC_PCI_IOMAP, both. Without such a guard, there is no
> collision however, because generic pci_iounmap() from
> drivers/pci/iomap.c will only get pulled in when
> CONFIG_GENERIC_PCI_IOMAP is actually set.
The "#define pci_iomap" can be removed entirely I think.
Arnd
Powered by blists - more mailing lists