On Tue, Jul 1, 2025, at 14:22, Tiwei Bie wrote:
> On 2025/7/1 16:43, Arnd Bergmann wrote:
>> On Tue, Jul 1, 2025, at 10:26, Geert Uytterhoeven wrote:
>> --- a/lib/Kconfig
>> +++ b/lib/Kconfig
>> @@ -381,7 +381,7 @@ config HAS_IOPORT
>>  config HAS_IOPORT_MAP
>>         bool
>>         depends on HAS_IOMEM && !NO_IOPORT_MAP
>> -       default y
>> +       default HAS_IOPORT
>>  
>>  source "kernel/dma/Kconfig"
>>  
>> It seems silly to turn off HAS_IOPORT_MAP on platforms that don't
>> have HAS_IOPORT to start with.
>
> I'm not entirely clear on the meaning of HAS_IOPORT though. It looks
> HAS_IOPORT was introduced to support disabling compilation of the I/O
> accessor functions inb()/outb() and friends [1].

Correct

> And looking at the
> code, xtensa supports IOPORT_MAP [2][3], but doesn't select HAS_IOPORT
> (which is also stated in the commit log in [1]).

xtensa selects NO_IOPORT_MAP, which means that HAS_IOPORT_MAP
gets disabled here:

arch/xtensa/Kconfig:config NO_IOPORT_MAP
arch/xtensa/Kconfig-    def_bool n

The NO_IOPORT_MAP symbol is a bit confusing, but I think it
works as intended, at least on xtensa. There are probably
still some platforms that started selecting NO_IOPORT_MAP
because they have no actual I/O port implementation, but
that still need to be updated to not select HAS_IOPORT.

With my patch above, we should probably stop selecting
NO_IOPORT_MAP on platforms that don't also set HAS_IOPORT,
and keep the HAS_IOPORT_MAP/NO_IOPORT_MAP logic around
only for the few cases that cannot abstract inb()/outb()
through ioread8()/iowrite8(), i.e. Arm RiscPC, m68k q40,
etc.

      Arnd

Reply via email to