From: Philipp Stanner <pstanner@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>,
Bjorn Helgaas <bhelgaas@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Dan Williams <dan.j.williams@intel.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Jakub Kicinski <kuba@kernel.org>,
Dave Jiang <dave.jiang@intel.com>,
Uladzislau Koshchanka <koshchanka@gmail.com>,
Neil Brown <neilb@suse.de>,
Niklas Schnelle <schnelle@linux.ibm.com>,
John Sanpe <sanpeqf@gmail.com>,
Kent Overstreet <kent.overstreet@gmail.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Kees Cook <keescook@chromium.org>,
David Gow <davidgow@google.com>,
Yury Norov <yury.norov@gmail.com>,
"wuqiang.matt" <wuqiang.matt@bytedance.com>,
Jason Baron <jbaron@akamai.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
Ben Dooks <ben.dooks@codethink.co.uk>,
Danilo Krummrich <dakr@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
Linux-Arch <linux-arch@vger.kernel.org>,
pstanner@redhat.com
Subject: Re: [PATCH v2 0/4] Regather scattered PCI-Code
Date: Fri, 01 Dec 2023 20:09:51 +0100 [thread overview]
Message-ID: <65079f6d5f512f9aff003bdfea127b214a9f9290.camel@redhat.com> (raw)
In-Reply-To: <3871b83a-0e80-402e-bbe6-359c17127842@app.fastmail.com>
On Fri, 2023-12-01 at 17:27 +0100, Arnd Bergmann wrote:
> 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.
Ah, gotcha!
Yes, that would be neat. Would also allow for droping
ARCH_WANTS_GENERIC_PCI_IOUNMAP.
>
> 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.
So, to be sure: m68k will use the generic iomem_is_ioport() despite
defining its own inb()?
>
> 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.
I also think it can, because first arch/asm/io.h includes asm-
generic/io.h.
I was just wondering why many other functions in asm-generic/io.h
always define their own names..
It's obviously very hard to test which config will break, so I thought
it's better safe than sorry here
P.
>
> Arnd
>
next prev parent reply other threads:[~2023-12-01 19:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 12:16 [PATCH v2 0/4] Regather scattered PCI-Code Philipp Stanner
2023-12-01 12:16 ` [PATCH v2 1/4] lib: move pci_iomap.c to drivers/pci/ Philipp Stanner
2023-12-01 14:43 ` Arnd Bergmann
2023-12-01 18:56 ` Philipp Stanner
2023-12-01 22:17 ` Arnd Bergmann
2023-12-01 12:16 ` [PATCH v2 2/4] lib: move pci-specific devres code " Philipp Stanner
2023-12-01 14:44 ` Arnd Bergmann
2023-12-01 19:00 ` Philipp Stanner
2023-12-01 22:31 ` Arnd Bergmann
2023-12-01 12:16 ` [PATCH v2 3/4] pci: move devres code from pci.c to devres.c Philipp Stanner
2023-12-01 12:16 ` [PATCH v2 4/4] lib, pci: unify generic pci_iounmap() Philipp Stanner
2023-12-01 15:26 ` Arnd Bergmann
2023-12-01 19:37 ` Philipp Stanner
2023-12-01 21:32 ` Arnd Bergmann
2023-12-01 21:56 ` Philipp Stanner
2023-12-01 21:59 ` Arnd Bergmann
2023-12-01 16:27 ` [PATCH v2 0/4] Regather scattered PCI-Code Arnd Bergmann
2023-12-01 19:09 ` Philipp Stanner [this message]
2023-12-01 22:17 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65079f6d5f512f9aff003bdfea127b214a9f9290.camel@redhat.com \
--to=pstanner@redhat.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=ben.dooks@codethink.co.uk \
--cc=bhelgaas@google.com \
--cc=dakr@redhat.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=davidgow@google.com \
--cc=jbaron@akamai.com \
--cc=keescook@chromium.org \
--cc=kent.overstreet@gmail.com \
--cc=koshchanka@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=neilb@suse.de \
--cc=sanpeqf@gmail.com \
--cc=schnelle@linux.ibm.com \
--cc=wangkefeng.wang@huawei.com \
--cc=wuqiang.matt@bytedance.com \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox