Re: [GIT PULL 1/2] asm-generic: rework PCI I/O space access

From: John Garry
Date: Fri Dec 17 2021 - 10:27:43 EST


On 17/12/2021 14:32, Arnd Bergmann wrote:
I was interesting in the IOPORT_NATIVE flag (or whatever we call it) as
it solves the problem of drivers which "unconditionally do inb()/outb()
without checking the validity of the address using firmware or other
methods first" being built for (and loaded on and crashing) unsuitable
systems. Such a problem is in [0]

So if we want to support that later, then it seems that someone would
need to go back and re-edit many same driver Kconfigs – like hwmon, for
example. I think it's better to avoid that and do it now.

Arnd, any opinion on that?

I'm happy to help with that effort.
I looked at the options the other day and couldn't really find any that
fell into this category, so I suggested that Niklas would skip that for the
moment.

From looking at the patch Niklas directed us at, as I understand, HAS_IOPORT is to decide whether the arch/platform may support PIO accessors - inb et al. And on that basis I am confused why it is not selected for arm64. And further compounded by:

config INDIRECT_PIO
bool "Access I/O in non-MMIO mode"
depends on ARM64
+ depends on HAS_IOPORT

If arm64 does not select, then why depend on it?

> If you have a better way of finding the affected drivers,
> that would be great.

Assuming arm64 should select HAS_IOPORT, I am talking about f71805f as an example. According to that patch, this driver additionally depends on HAS_IOPORT; however I would rather arm64, like powerpc, should not allow that driver to be built at all.

Thanks,
John