Re: [RFC v2 25/39] pcmcia: add HAS_IOPORT dependencies

From: Bjorn Helgaas
Date: Wed May 04 2022 - 14:03:08 EST


On Wed, May 04, 2022 at 03:24:39PM +0100, Maciej W. Rozycki wrote:
> On Wed, 4 May 2022, Arnd Bergmann wrote:
>
> > > POWER9 is another architecture with no port I/O space[1]:
> >
> > POWER9 is just an implementation of the power architecture
> > that has a particular PCI host bridge. I would assume that
> > arch/powerpc/ would continue to set HAS_IOPORT because
> > it knows how to access I/O ports at compile-time.
>
> Well, yes, except I would expect POWER9_CPU (and any higher versions we
> eventually get) to clear HAS_IOPORT. Generic configurations (GENERIC_CPU)
> would set HAS_IOPORT of course, as would any lower architecture variants
> that do or may support port I/O (it's not clear to me if there are any
> that do not). Ideally a generic configuration would not issue accesses to
> random MMIO locations for port I/O accesses via `inb'/`outb', etc. for
> systems that do not support port I/O (which it now does, or at least used
> to until recently).

It would seem weird to me that a module would build and run on a
generic kernel running on POWER9 (with some safe way of handling
inb/outb that don't actually work), but not on a kernel built
specifically for POWER9_CPU.

It sounds like inb/outb in a generic kernel on POWER9 may not
currently do something sensible, but that's fixable, e.g., make inb()
return 0xff and outb() a no-op. I would naively expect the same
behavior in a POWER9_CPU kernel.

Bjorn