]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
um: stop using PCI port I/O
authorArnd Bergmann <arnd@arndb.de>
Fri, 9 May 2025 08:40:52 +0000 (10:40 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 2 Jun 2025 09:22:09 +0000 (11:22 +0200)
arch/um is one of the last users of CONFIG_GENERIC_IOMAP, but upon
closer look it appears that the PCI host bridge does not register
any port I/O, and the absense of both custom inb/outb functions and
a PCI_IOBASE constant means that actually trying to use port I/O
results on a NULL pointer access.

Build testing with clang confirms this by warning about this exact
problem:

include/asm-generic/io.h:549:31: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
  549 |         val = __raw_readb(PCI_IOBASE + addr);
      |                           ~~~~~~~~~~ ^

Remove all the Kconfig selects that refer to legacy port I/O
and instead just build the normal MMIO path that is emulated
by the virtio PCI host.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20250509084125.1488601-1-arnd@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/Kconfig
arch/um/kernel/Makefile
arch/um/kernel/ioport.c [deleted file]

index 79509c7f39def3d3e13c4787dbe2491b7f97e638..f08e8a7fac93d9f98384de02710542fd75d23553 100644 (file)
@@ -52,13 +52,7 @@ config NO_IOMEM
 config UML_IOMEM_EMULATION
        bool
        select INDIRECT_IOMEM
-       select HAS_IOPORT
        select GENERIC_PCI_IOMAP
-       select GENERIC_IOMAP
-       select NO_GENERIC_PCI_IOPORT_MAP
-
-config NO_IOPORT_MAP
-       def_bool !UML_IOMEM_EMULATION
 
 config ISA
        bool
index 4df1cd0d20179e09d907e6350b72d25b652d6ad1..4669db2aa9be6d00d87d108a556736766cffe69a 100644 (file)
@@ -25,7 +25,6 @@ obj-$(CONFIG_GPROF)   += gprof_syms.o
 obj-$(CONFIG_OF) += dtb.o
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-$(CONFIG_STACKTRACE) += stacktrace.o
-obj-$(CONFIG_GENERIC_PCI_IOMAP) += ioport.o
 
 USER_OBJS := config.o
 
diff --git a/arch/um/kernel/ioport.c b/arch/um/kernel/ioport.c
deleted file mode 100644 (file)
index 7220615..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2021 Intel Corporation
- * Author: Johannes Berg <johannes@sipsolutions.net>
- */
-#include <asm/iomap.h>
-#include <asm-generic/pci_iomap.h>
-
-void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
-                              unsigned int nr)
-{
-       return NULL;
-}