Linux PCI subsystem development
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@kernel.org>
To: "Philipp Stanner" <pstanner@redhat.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Eric Auger" <eric.auger@redhat.com>,
	"Kent Overstreet" <kent.overstreet@gmail.com>,
	"Niklas Schnelle" <schnelle@linux.ibm.com>,
	"Neil Brown" <neilb@suse.de>, "John Sanpe" <sanpeqf@gmail.com>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Yury Norov" <yury.norov@gmail.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"David Gow" <davidgow@google.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"wuqiang.matt" <wuqiang.matt@bytedance.com>,
	"Jason Baron" <jbaron@akamai.com>,
	"Ben Dooks" <ben.dooks@codethink.co.uk>,
	"Danilo Krummrich" <dakr@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH 4/4] lib/iomap.c: improve comment about pci anomaly
Date: Wed, 29 Nov 2023 17:52:43 +0100	[thread overview]
Message-ID: <b80338ac-bf2c-49d0-b772-e3b66e8e056d@app.fastmail.com> (raw)
In-Reply-To: <10ef8eac12c01f52ec3b8c0bedf6cf34627d1ceb.camel@redhat.com>

On Wed, Nov 29, 2023, at 13:40, Philipp Stanner wrote:
> On Tue, 2023-11-21 at 11:03 +0100, Arnd Bergmann wrote:
>> On Mon, Nov 20, 2023, at 22:59, Philipp Stanner wrote:
>> We should be able to define a generic version like
>> 
>> void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
>> {
>> #ifdef CONFIG_HAS_IOPORT
>>        if (iomem_is_ioport(addr)) {
>>               ioport_unmap(addr);
>>               return;
>>        }
>> #endif
>>       iounmap(addr)
>> }
>
> ACK, I think this makes sense – if we agree (as in the other thread)
> that we never need an empty pci_iounmap().
>
>> 
>> and then define iomem_is_ioport() in lib/iomap.c for x86,
>
> Wait a minute.
> lib/ should never contain architecture-specific code, should it? I
> assume your argument is that we write a default version of
> iomem_is_ioport(), that could, in theory, be used by many
> architectures, but ultimately only x86 will use that default.

I would hope that eventually we can build lib/iomap.c
only on x86, as everything else can live without it.

>> while defining it in asm-generic/io.h for the rest,
>
> So we're not talking about the function prototypes here, but about the
> actual implementation that should reside in asm-generic/io.h, aye?
> Because the prototype obviously always has to be identical.

It could live in lib/pci_iomap.c or in
include/asm-generic/pci_iomap.h, it doesn't really matter
since the definition is trivial. asm-generic/io.h is probably
not the right place, unless we want to merge all of
asm-generic/pci_iomap.h into asm-generic/io.h. We could
do that now that all architectures include asm-generic/io.h
and that includes asm-generic/pci_iomap.h unconditionally.

>> with an override in asm/io.h for those architectures
>> that need a custom inb().
>
> So like this in ARCH/include/asm/io.h:
>
> #define iomem_is_ioport iomem_is_ioport
> bool iomem_is_ioport(...);
>
> and in include/asm-generic/io.h:
>
> #ifndef iomem_is_ioport
> bool iomem_is_ioport(...);
>
> correct?

Yes.
 
>> arch/powerpc/platforms/Kconfig: select GENERIC_IOMAP
>> 
>> This is only used for two platforms: cell and powernv,
>> though on Cell it no longer does anything after the
>> commit f4981a00636 ("powerpc: Remove the celleb support");
>> I think the entire io_workarounds code now be folded
>> back into spider_pci.c if we wanted to.
>> 
>> The PowerNV LPC support does seem to still rely on it.
>> This tries to do the exact same thing as lib/logic_pio.c
>> for Huawei arm64 servers. I suspect that neither of them
>> does it entirely correctly since the powerpc side appears
>> to just override any non-LPC PIO support while the arm64
>> side is missing the ioread/iowrite support.
>
> I think by now I get what the issue with GENERIC_IOMAP is. But do you
> want me to do something about GENERIC_IOMAP (besides the things
> directly related to the PCI functionality I'm touching) for you to
> approve of a modified version of this patch series?

It would be nice to clean up some of the architectures
that incorrectly select it at the moment, but that
can be a separate series if you want to get this one
done first, or I can take a look myself.

      Arnd

      reply	other threads:[~2023-11-29 16:53 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 21:59 [PATCH 0/4] Regather scattered PCI-Code Philipp Stanner
2023-11-20 21:59 ` [PATCH 1/4] lib: move pci_iomap.c to drivers/pci/ Philipp Stanner
2023-11-21  4:20   ` kernel test robot
2023-11-21 10:44     ` Philipp Stanner
2023-11-21  6:48   ` kernel test robot
2023-11-21  7:22     ` Arnd Bergmann
2023-11-21  7:20   ` kernel test robot
2023-11-21  7:45   ` kernel test robot
2023-11-21  7:58   ` kernel test robot
2023-11-21  8:46   ` kernel test robot
2023-11-21 10:44   ` kernel test robot
2023-11-21 10:44   ` kernel test robot
2023-11-21 13:14   ` kernel test robot
2023-11-21 14:38   ` kernel test robot
2023-11-21 15:04   ` kernel test robot
2023-11-21 15:40   ` kernel test robot
2023-11-21 15:56   ` kernel test robot
2023-11-22  1:51     ` Liu, Yujie
2023-11-22  8:15       ` Philipp Stanner
2023-11-23  6:42         ` Yujie Liu
2023-11-22 16:28   ` kernel test robot
2023-11-20 21:59 ` [PATCH 2/4] lib: move pci-specific devres code " Philipp Stanner
2023-11-21  7:29   ` Arnd Bergmann
2023-11-21  8:00     ` Philipp Stanner
2023-11-21 10:10       ` Arnd Bergmann
2023-11-20 21:59 ` [PATCH 3/4] pci: move devres code from pci.c to devres.c Philipp Stanner
2023-11-21 10:17   ` Arnd Bergmann
2023-11-21 10:36     ` Philipp Stanner
2023-11-20 21:59 ` [PATCH 4/4] lib/iomap.c: improve comment about pci anomaly Philipp Stanner
2023-11-21 10:03   ` Arnd Bergmann
2023-11-21 14:38     ` Philipp Stanner
2023-11-21 14:41       ` Arnd Bergmann
2023-11-24 19:08     ` Danilo Krummrich
2023-11-29 10:16       ` Philipp Stanner
2023-11-29 17:37         ` Arnd Bergmann
2023-11-29 12:40     ` Philipp Stanner
2023-11-29 16:52       ` Arnd Bergmann [this message]

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=b80338ac-bf2c-49d0-b772-e3b66e8e056d@app.fastmail.com \
    --to=arnd@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ben.dooks@codethink.co.uk \
    --cc=bhelgaas@google.com \
    --cc=dakr@redhat.com \
    --cc=dave.jiang@intel.com \
    --cc=davidgow@google.com \
    --cc=eric.auger@redhat.com \
    --cc=jbaron@akamai.com \
    --cc=jgg@ziepe.ca \
    --cc=keescook@chromium.org \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=neilb@suse.de \
    --cc=pstanner@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=sanpeqf@gmail.com \
    --cc=schnelle@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --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