]> www.infradead.org Git - users/jedix/linux-maple.git/commit
risc-v: Use generic io.h helpers for nommu
authorNiklas Schnelle <niklas@komani.de>
Mon, 10 May 2021 14:52:33 +0000 (16:52 +0200)
committerArnd Bergmann <arnd@arndb.de>
Mon, 10 May 2021 15:37:51 +0000 (17:37 +0200)
commit78924148a3d22e030fe8f5c1a0ce10e177856423
tree643808e9e0b235ff0612ac31ee75e1b544c8a74d
parenta5f7166b58cda2430123eb9bb96d60340e699ae4
risc-v: Use generic io.h helpers for nommu

Without MMU support PCI_IOBASE is left undefined because PCI_IO_END is
VMEMMAP_START. Nevertheless the in*()/out*() helper macros are left
defined with uses of PCI_IOBASE.

At the moment this only compiles because asm-generic/io.h defines
PCI_IOBASE as 0 if it is undefined and so at macro expansion PCI_IOBASE
is defined. This leads to compilation errors when asm-generic/io.h is
changed to leave PCI_IOBASE undefined.  More importantly it is currently
broken at runtime, as accessing a fixed I/O port number of an ISA device
on NOMMU RISC-V would turn into a NULL pointer dereference.

Instead only define the in*()/out*() helper macros with MMU support and
fall back to the asm-generic/io.h helper stubs otherwise.

Signed-off-by: Niklas Schnelle <niklas@komani.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/riscv/include/asm/io.h