Merge patch series "riscv: Introduce KASLR"
[platform/kernel/linux-rpi.git] / arch / riscv / Kconfig
index 6a606d5..712ae02 100644 (file)
@@ -35,6 +35,7 @@ config RISCV
        select ARCH_HAS_SET_MEMORY if MMU
        select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
        select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
+       select ARCH_HAS_SYSCALL_WRAPPER
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARCH_HAS_VDSO_DATA
@@ -42,18 +43,20 @@ config RISCV
        select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
        select ARCH_STACKWALK
        select ARCH_SUPPORTS_ATOMIC_RMW
+       select ARCH_SUPPORTS_CFI_CLANG
        select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
        select ARCH_SUPPORTS_HUGETLBFS if MMU
        select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
        select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
        select ARCH_USE_MEMTEST
        select ARCH_USE_QUEUED_RWLOCKS
+       select ARCH_USES_CFI_TRAPS if CFI_CLANG
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
        select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
        select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
-       select ARCH_WANT_OPTIMIZE_VMEMMAP
+       select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
        select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
        select BUILDTIME_TABLE_SORT if MMU
@@ -62,6 +65,7 @@ config RISCV
        select COMMON_CLK
        select CPU_PM if CPU_IDLE || HIBERNATION
        select EDAC_SUPPORT
+       select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
        select GENERIC_ARCH_TOPOLOGY
        select GENERIC_ATOMIC64 if !64BIT
        select GENERIC_CLOCKEVENTS_BROADCAST if SMP
@@ -130,6 +134,7 @@ config RISCV
        select HAVE_PERF_REGS
        select HAVE_PERF_USER_STACK_DUMP
        select HAVE_POSIX_CPU_TIMERS_TASK_WORK
+       select HAVE_PREEMPT_DYNAMIC_KEY if !XIP_KERNEL
        select HAVE_REGS_AND_STACK_ACCESS_API
        select HAVE_RETHOOK if !XIP_KERNEL
        select HAVE_RSEQ
@@ -267,8 +272,16 @@ config RISCV_DMA_NONCOHERENT
        select ARCH_HAS_SETUP_DMA_OPS
        select ARCH_HAS_SYNC_DMA_FOR_CPU
        select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+       select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
        select DMA_DIRECT_REMAP
 
+config RISCV_NONSTANDARD_CACHE_OPS
+       bool
+       depends on RISCV_DMA_NONCOHERENT
+       help
+         This enables function pointer support for non-standard noncoherent
+         systems to handle cache management.
+
 config AS_HAS_INSN
        def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
 
@@ -570,24 +583,30 @@ config TOOLCHAIN_HAS_ZIHINTPAUSE
 config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
        def_bool y
        # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
-       depends on AS_IS_GNU && AS_VERSION >= 23800
-       help
-         Newer binutils versions default to ISA spec version 20191213 which
-         moves some instructions from the I extension to the Zicsr and Zifencei
-         extensions.
+       # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98416dbb0a62579d4a7a4a76bab51b5b52fec2cd
+       depends on AS_IS_GNU && AS_VERSION >= 23600
+       help
+         Binutils-2.38 and GCC-12.1.0 bumped the default ISA spec to the newer
+         20191213 version, which moves some instructions from the I extension to
+         the Zicsr and Zifencei extensions. This requires explicitly specifying
+         Zicsr and Zifencei when binutils >= 2.38 or GCC >= 12.1.0. Zicsr
+         and Zifencei are supported in binutils from version 2.36 onwards.
+         To make life easier, and avoid forcing toolchains that default to a
+         newer ISA spec to version 2.2, relax the check to binutils >= 2.36.
+         For clang < 17 or GCC < 11.3.0, for which this is not possible or need
+         special treatment, this is dealt with in TOOLCHAIN_NEEDS_OLD_ISA_SPEC.
 
 config TOOLCHAIN_NEEDS_OLD_ISA_SPEC
        def_bool y
        depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
        # https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
-       depends on CC_IS_CLANG && CLANG_VERSION < 170000
+       # https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d29f5d6ab513c52fd872f532c492e35ae9fd6671
+       depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_VERSION < 110300)
        help
-         Certain versions of clang do not support zicsr and zifencei via -march
-         but newer versions of binutils require it for the reasons noted in the
-         help text of CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. This
-         option causes an older ISA spec compatible with these older versions
-         of clang to be passed to GAS, which has the same result as passing zicsr
-         and zifencei to -march.
+         Certain versions of clang and GCC do not support zicsr and zifencei via
+         -march. This option causes an older ISA spec compatible with these older
+         versions of clang and GCC to be passed to GAS, which has the same result
+         as passing zicsr and zifencei to -march.
 
 config FPU
        bool "FPU support"
@@ -650,48 +669,30 @@ config RISCV_BOOT_SPINWAIT
 
          If unsure what to do here, say N.
 
-config KEXEC
-       bool "Kexec system call"
-       depends on MMU
+config ARCH_SUPPORTS_KEXEC
+       def_bool MMU
+
+config ARCH_SELECTS_KEXEC
+       def_bool y
+       depends on KEXEC
        select HOTPLUG_CPU if SMP
-       select KEXEC_CORE
-       help
-         kexec is a system call that implements the ability to shutdown your
-         current kernel, and to start another kernel. It is like a reboot
-         but it is independent of the system firmware. And like a reboot
-         you can start any kernel with it, not just Linux.
 
-         The name comes from the similarity to the exec system call.
+config ARCH_SUPPORTS_KEXEC_FILE
+       def_bool 64BIT && MMU
 
-config KEXEC_FILE
-       bool "kexec file based systmem call"
-       depends on 64BIT && MMU
+config ARCH_SELECTS_KEXEC_FILE
+       def_bool y
+       depends on KEXEC_FILE
        select HAVE_IMA_KEXEC if IMA
-       select KEXEC_CORE
        select KEXEC_ELF
-       help
-         This is new version of kexec system call. This system call is
-         file based and takes file descriptors as system call argument
-         for kernel and initramfs as opposed to list of segments as
-         accepted by previous system call.
-
-         If you don't know what to do here, say Y.
 
-config ARCH_HAS_KEXEC_PURGATORY
+config ARCH_SUPPORTS_KEXEC_PURGATORY
        def_bool KEXEC_FILE
        depends on CRYPTO=y
        depends on CRYPTO_SHA256=y
 
-config CRASH_DUMP
-       bool "Build kdump crash kernel"
-       help
-         Generate crash dump after being started by kexec. This should
-         be normally only set in special crash dump kernels which are
-         loaded in the main kernel with kexec-tools into a specially
-         reserved region and then later executed after a crash by
-         kdump/kexec.
-
-         For more details see Documentation/admin-guide/kdump/kdump.rst
+config ARCH_SUPPORTS_CRASH_DUMP
+       def_bool y
 
 config COMPAT
        bool "Kernel support for 32-bit U-mode"
@@ -867,6 +868,24 @@ config XIP_PHYS_ADDR
          be linked for and stored to.  This address is dependent on your
          own flash usage.
 
+config RISCV_ISA_FALLBACK
+       bool "Permit falling back to parsing riscv,isa for extension support by default"
+       default y
+       help
+         Parsing the "riscv,isa" devicetree property has been deprecated and
+         replaced by a list of explicitly defined strings. For compatibility
+         with existing platforms, the kernel will fall back to parsing the
+         "riscv,isa" property if the replacements are not found.
+
+         Selecting N here will result in a kernel that does not use the
+         fallback, unless the commandline "riscv_isa_fallback" parameter is
+         present.
+
+         Please see the dt-binding, located at
+         Documentation/devicetree/bindings/riscv/extensions.yaml for details
+         on the replacement properties, "riscv,isa-base" and
+         "riscv,isa-extensions".
+
 endmenu # "Boot options"
 
 config BUILTIN_DTB