Michael Ellerman <m...@ellerman.id.au> writes:
> "Arnd Bergmann" <a...@arndb.de> writes:
>> On Thu, Apr 18, 2024, at 08:26, Michael Ellerman wrote:
>>> Arnd Bergmann <a...@kernel.org> writes:
>>
>>> @@ -692,6 +692,7 @@ static inline void name at                          
>>>         \
>>>  #define writesw writesw
>>>  #define writesl writesl
>>>
>>> +#ifdef CONFIG_HAS_IOPORT
>>>  #define inb inb
>>>  #define inw inw
>>>  #define inl inl
>>> @@ -704,6 +705,8 @@ static inline void name at                          
>>>         \
>>>  #define outsb outsb
>>>  #define outsw outsw
>>>  #define outsl outsl
>>> +#endif // CONFIG_HAS_IOPORT
>>> +
>>>  #ifdef __powerpc64__
>>>  #define readq  readq
>>>  #define writeq writeq
>>
>> I had included this at first, but then I still ran into
>> the same warnings because it ends up pulling in the
>> generic outsb() etc from include/asm-generic/io.h
>> that relies on setting a non-NULL PCI_IOBASE.
>
> Yes you're right. The above fixes the gcc build, but not clang.
>
> So I think I'll just cherry pick f0a816fb12da ("/dev/port: don't compile
> file operations without CONFIG_DEVPORT") into my next and then apply
> this. But will see if there's any other build failures over night.

That didn't work. Still lots of drivers in my tree (based on rc2) which
use inb/outb etc, and barf on the empty #define inb.

So I think this patch needs to wait until all the CONFIG_HAS_IOPORT
checks have been merged for various drivers.

For now the below fixes the clang warning. AFAICS it's safe because any
code using inb() etc. with CONFIG_PCI=n is currently just doing a plain
load from virtual address ~zero which should fault anyway.

cheers


diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 08c550ed49be..1cd6eb6c8101 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -37,7 +37,7 @@ extern struct pci_dev *isa_bridge_pcidev;
  * define properly based on the platform
  */
 #ifndef CONFIG_PCI
-#define _IO_BASE       0
+#define _IO_BASE       POISON_POINTER_DELTA
 #define _ISA_MEM_BASE  0
 #define PCI_DRAM_OFFSET 0
 #elif defined(CONFIG_PPC32)

Reply via email to