ioremap_cache() isn't recommended for portable drivers, but there's a handful of uses of it within the kernel. This adds a HAVE_IOREMAP_CACHE Kconfig, which is enabled for the ports that have implemented it and added as a driver dependency when ioremap_cache() is uncoditionally called (a handful of drivers have arch-specific ifdefs already, those I left alone). Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx> --- Not sure what to do about splitting this up, it touches a lot of trees but it seems saner to do this atomicly. I've just included linux-arch for now, just to try and keep from blasting everyone. Another option here would be to add some sort of ioremap_cache() fallback, but I'm assuming that has not been done to discourage more use of ioremap_cache() in drivers. I'm also not sure all these ports should have ioremap_cache(), but I figured it'd be easier to just enumerate what's there rather than trying to change the ports. Preventing the drivers from compiling also seems like a pretty heavy hammer, as it seems like some of these could have their ioremap_cache() dependency removed pretty easily, but again I figured it'd be better to start small. This has barely been tested, just a defconfig build on x86. That's very much insufficient, but with this touching so many ports I figure it's better to let the autobuilders have at that. --- arch/Kconfig | 3 +++ arch/arm/Kconfig | 1 + arch/arm64/Kconfig | 1 + arch/ia64/Kconfig | 1 + arch/loongarch/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/xtensa/Kconfig | 1 + drivers/acpi/apei/Kconfig | 2 +- drivers/firmware/meson/Kconfig | 1 + drivers/gpu/drm/Kconfig | 2 +- drivers/mtd/devices/Kconfig | 2 +- drivers/mtd/maps/Kconfig | 2 +- drivers/video/fbdev/Kconfig | 2 +- include/acpi/acpi_io.h | 2 +- 17 files changed, 19 insertions(+), 6 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index f330410da63a..2b282fabde13 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -188,6 +188,9 @@ config USER_RETURN_NOTIFIER Provide a kernel-internal notification when a cpu is about to switch to user mode. +config HAVE_IOREMAP_CACHE + def_bool n + config HAVE_IOREMAP_PROT bool diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 87badeae3181..a5e738e0ddd7 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -100,6 +100,7 @@ config ARM select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7) select HAVE_IRQ_TIME_ACCOUNTING + select HAVE_IOREMAP_CACHE if MMU select HAVE_KERNEL_GZIP select HAVE_KERNEL_LZ4 select HAVE_KERNEL_LZMA diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 571cc234d0b3..e0de7f45fbde 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -190,6 +190,7 @@ config ARM64 select HAVE_FUNCTION_GRAPH_TRACER select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS + select HAVE_IOREMAP_CACHE select HAVE_IOREMAP_PROT select HAVE_IRQ_TIME_ACCOUNTING select HAVE_KVM diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 26ac8ea15a9e..e51612a94c73 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -53,6 +53,7 @@ config IA64 select GENERIC_TIME_VSYSCALL select LEGACY_TIMER_TICK select SWIOTLB + select HAVE_IOREMAP_CACHE select SYSCTL_ARCH_UNALIGN_NO_WARN select HAVE_MOD_ARCH_SPECIFIC select MODULES_USE_ELF_RELA diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index 4abc9a28aba4..90d9ad188e67 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -85,6 +85,7 @@ config LOONGARCH select HAVE_EXIT_THREAD select HAVE_FAST_GUP select HAVE_GENERIC_VDSO + select HAVE_IOREMAP_CACHE select HAVE_IOREMAP_PROT select HAVE_IRQ_EXIT_ON_IRQ_STACK select HAVE_IRQ_TIME_ACCOUNTING diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ec21f8999249..2900d5c5d5f1 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -74,6 +74,7 @@ config MIPS select HAVE_FUNCTION_TRACER select HAVE_GCC_PLUGINS select HAVE_GENERIC_VDSO + select HAVE_IOREMAP_CACHE if MMU select HAVE_IOREMAP_PROT select HAVE_IRQ_EXIT_ON_IRQ_STACK select HAVE_IRQ_TIME_ACCOUNTING diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 4c466acdc70d..c552fc97aad2 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -223,6 +223,7 @@ config PPC select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC_BOOK3S_64 && SMP select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx) + select HAVE_IOREMAP_CACHE select HAVE_IOREMAP_PROT select HAVE_IRQ_TIME_ACCOUNTING select HAVE_KERNEL_GZIP diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 5f220e903e5a..bd9426cfc13b 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -37,6 +37,7 @@ config SUPERH select HAVE_FUNCTION_TRACER select HAVE_FTRACE_MCOUNT_RECORD select HAVE_HW_BREAKPOINT + select HAVE_IOREMAP_CACHE if MMU select HAVE_IOREMAP_PROT if MMU && !X2TLB select HAVE_KERNEL_BZIP2 select HAVE_KERNEL_GZIP diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f9920f1341c8..05fa399fe103 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -209,6 +209,7 @@ config X86 select HAVE_FUNCTION_TRACER select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT + select HAVE_IOREMAP_CACHE select HAVE_IOREMAP_PROT select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 select HAVE_IRQ_TIME_ACCOUNTING diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 12ac277282ba..edfa5127322c 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -42,6 +42,7 @@ config XTENSA select HAVE_FUNCTION_TRACER select HAVE_GCC_PLUGINS if GCC_VERSION >= 120000 select HAVE_HW_BREAKPOINT if PERF_EVENTS + select HAVE_IOREMAP_CACHE select HAVE_IRQ_TIME_ACCOUNTING select HAVE_PCI select HAVE_PERF_EVENTS diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 6b18f8bc7be3..56e215641e63 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig @@ -10,7 +10,7 @@ config ACPI_APEI select MISC_FILESYSTEMS select PSTORE select UEFI_CPER - depends on HAVE_ACPI_APEI + depends on HAVE_ACPI_APEI && HAVE_IOREMAP_CACHE help APEI allows to report errors (for example from the chipset) to the operating system. This improves NMI handling diff --git a/drivers/firmware/meson/Kconfig b/drivers/firmware/meson/Kconfig index f2fdd3756648..612ca9ad3256 100644 --- a/drivers/firmware/meson/Kconfig +++ b/drivers/firmware/meson/Kconfig @@ -7,5 +7,6 @@ config MESON_SM depends on ARCH_MESON || COMPILE_TEST default y depends on ARM64_4K_PAGES + depends on HAVE_IOREMAP_CACHE help Say y here to enable the Amlogic secure monitor driver diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 6c2256e8474b..3c28b3ee1384 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -405,7 +405,7 @@ source "drivers/gpu/drm/sprd/Kconfig" config DRM_HYPERV tristate "DRM Support for Hyper-V synthetic video device" - depends on DRM && PCI && MMU && HYPERV + depends on DRM && PCI && MMU && HYPERV && HAVE_IOREMAP_CACHE select DRM_KMS_HELPER select DRM_GEM_SHMEM_HELPER help diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig index 79cb981ececc..e6b55cab5a4a 100644 --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig @@ -114,7 +114,7 @@ config MTD_SST25L config MTD_BCM47XXSFLASH tristate "Support for serial flash on BCMA bus" - depends on BCMA_SFLASH && (MIPS || ARM) + depends on BCMA_SFLASH && (MIPS || ARM) && HAVE_IOREMAP_CACHE help BCMA bus can have various flash memories attached, they are registered by bcma as platform devices. This enables driver for diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index e098ae937ce8..e40d3277dcf6 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -183,7 +183,7 @@ config MTD_SBC_GXX config MTD_PXA2XX tristate "CFI Flash device mapped on Intel XScale PXA2xx based boards" - depends on (PXA25x || PXA27x) && MTD_CFI_INTELEXT + depends on (PXA25x || PXA27x) && MTD_CFI_INTELEXT && HAVE_IOREMAP_CACHE help This provides a driver for the NOR flash attached to a PXA2xx chip. diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index cfc55273dc5d..99f160319b5c 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -2181,7 +2181,7 @@ config FB_BROADSHEET config FB_HYPERV tristate "Microsoft Hyper-V Synthetic Video support" - depends on FB && HYPERV + depends on FB && HYPERV && HAVE_IOREMAP_CACHE select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h index 027faa8883aa..4fb945a449e6 100644 --- a/include/acpi/acpi_io.h +++ b/include/acpi/acpi_io.h @@ -6,7 +6,7 @@ #include <asm/acpi.h> -#ifndef acpi_os_ioremap +#if !defined(acpi_os_ioremap) && defined(CONFIG_HAVE_IOREMAP_CACHE) static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) { -- 2.34.1