Commit feff82eb authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'riscv-for-linus-7.1-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V updates from Paul Walmsley:
 "There is one significant change outside arch/riscv in this pull
  request: the addition of a set of KUnit tests for strlen(), strnlen(),
  and strrchr().

  Otherwise, the most notable changes are to add some RISC-V-specific
  string function implementations, to remove XIP kernel support, to add
  hardware error exception handling, and to optimize our runtime
  unaligned access speed testing.

  A few comments on the motivation for removing XIP support. It's been
  broken in the RISC-V kernel for months. The code is not easy to
  maintain. Furthermore, for XIP support to truly be useful for RISC-V,
  we think that compile-time feature switches would need to be added for
  many of the RISC-V ISA features and microarchitectural properties that
  are currently implemented with runtime patching. No one has stepped
  forward to take responsibility for that work, so many of us think it's
  best to remove it until clear use cases and champions emerge.

  Summary:

   - Add Kunit correctness testing and microbenchmarks for strlen(),
     strnlen(), and strrchr()

   - Add RISC-V-specific strnlen(), strchr(), strrchr() implementations

   - Add hardware error exception handling

   - Clean up and optimize our unaligned access probe code

   - Enable HAVE_IOREMAP_PROT to be able to use generic_access_phys()

   - Remove XIP kernel support

   - Warn when addresses outside the vmemmap range are passed to
     vmemmap_populate()

   - Update the ACPI FADT revision check to warn if it's not at least
     ACPI v6.6, which is when key RISC-V-specific tables were added to
     the specification

   - Increase COMMAND_LINE_SIZE to 2048 to match ARM64, x86, PowerPC,
     etc.

   - Make kaslr_offset() a static inline function, since there's no need
     for it to show up in the symbol table

   - Add KASLR offset and SATP to the VMCOREINFO ELF notes to improve
     kdump support

   - Add Makefile cleanup rule for vdso_cfi copied source files, and add
     a .gitignore for the build artifacts in that directory

   - Remove some redundant ifdefs that check Kconfig macros

   - Add missing SPDX license tag to the CFI selftest

   - Simplify UTS_MACHINE assignment in the RISC-V Makefile

   - Clarify some unclear comments and remove some superfluous comments

   - Fix various English typos across the RISC-V codebase"

* tag 'riscv-for-linus-7.1-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (31 commits)
  riscv: Remove support for XIP kernel
  riscv: Reuse compare_unaligned_access() in check_vector_unaligned_access()
  riscv: Split out compare_unaligned_access()
  riscv: Reuse measure_cycles() in check_vector_unaligned_access()
  riscv: Split out measure_cycles() for reuse
  riscv: Clean up & optimize unaligned scalar access probe
  riscv: lib: add strrchr() implementation
  riscv: lib: add strchr() implementation
  riscv: lib: add strnlen() implementation
  lib/string_kunit: extend benchmarks to strnlen() and chr searches
  lib/string_kunit: add performance benchmark for strlen()
  lib/string_kunit: add correctness test for strrchr()
  lib/string_kunit: add correctness test for strnlen()
  lib/string_kunit: add correctness test for strlen()
  riscv: vdso_cfi: Add .gitignore for build artifacts
  riscv: vdso_cfi: Add clean rule for copied sources
  riscv: enable HAVE_IOREMAP_PROT
  riscv: mm: WARN_ON() for bad addresses in vmemmap_populate()
  riscv: acpi: update FADT revision check to 6.6
  riscv: add hardware error trap handler support
  ...
parents ff57d592 9b3a2be8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
    |    openrisc: | TODO |
    |      parisc: | TODO |
    |     powerpc: |  ok  |
    |       riscv: | TODO |
    |       riscv: |  ok  |
    |        s390: |  ok  |
    |          sh: |  ok  |
    |       sparc: | TODO |
+24 −63
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@ config RISCV
	select ARCH_HAS_PTE_SPECIAL
	select ARCH_HAS_SET_DIRECT_MAP if MMU
	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_STRICT_KERNEL_RWX if MMU
	select ARCH_HAS_STRICT_MODULE_RWX if MMU
	select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
	select ARCH_HAS_SYSCALL_WRAPPER
	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
@@ -84,7 +84,7 @@ config RISCV
	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_LD_ORPHAN_WARN
	select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
	select ARCH_WANTS_NO_INSTR
@@ -112,6 +112,7 @@ config RISCV
	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO && 64BIT
	select GENERIC_IDLE_POLL_SETUP
	select GENERIC_IOREMAP if MMU
	select HAVE_IOREMAP_PROT if MMU
	select GENERIC_IRQ_IPI if SMP
	select GENERIC_IRQ_IPI_MUX if SMP
	select GENERIC_IRQ_MULTI_HANDLER
@@ -129,13 +130,13 @@ config RISCV
	select HAVE_ARCH_AUDITSYSCALL
	select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
	select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT
	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
	select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
	select HAVE_ARCH_JUMP_LABEL
	select HAVE_ARCH_JUMP_LABEL_RELATIVE
	select HAVE_ARCH_KASAN if MMU && 64BIT
	select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
	select HAVE_ARCH_KFENCE if MMU && 64BIT
	select HAVE_ARCH_KSTACK_ERASE
	select HAVE_ARCH_KGDB if !XIP_KERNEL
	select HAVE_ARCH_KGDB
	select HAVE_ARCH_KGDB_QXFER_PKT
	select HAVE_ARCH_MMAP_RND_BITS if MMU
	select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
@@ -153,7 +154,7 @@ config RISCV
	select HAVE_CONTEXT_TRACKING_USER
	select HAVE_DEBUG_KMEMLEAK
	select HAVE_DMA_CONTIGUOUS if MMU
	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
	select HAVE_DYNAMIC_FTRACE if MMU && (CLANG_SUPPORTS_DYNAMIC_FTRACE || GCC_SUPPORTS_DYNAMIC_FTRACE)
	select FUNCTION_ALIGNMENT_4B if HAVE_DYNAMIC_FTRACE && RISCV_ISA_C
	select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS if HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS
	select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS if (DYNAMIC_FTRACE_WITH_ARGS && !CFI)
@@ -161,7 +162,7 @@ config RISCV
	select HAVE_FTRACE_GRAPH_FUNC
	select HAVE_FUNCTION_GRAPH_TRACER if HAVE_DYNAMIC_FTRACE_WITH_ARGS
	select HAVE_FUNCTION_GRAPH_FREGS
	select HAVE_FUNCTION_TRACER if !XIP_KERNEL && HAVE_DYNAMIC_FTRACE
	select HAVE_FUNCTION_TRACER if HAVE_DYNAMIC_FTRACE
	select HAVE_EBPF_JIT if MMU
	select HAVE_GENERIC_TIF_BITS
	select HAVE_GUP_FAST if MMU
@@ -170,16 +171,16 @@ config RISCV
	select HAVE_GCC_PLUGINS
	select HAVE_GENERIC_VDSO if MMU
	select HAVE_IRQ_TIME_ACCOUNTING
	select HAVE_KERNEL_BZIP2 if !XIP_KERNEL && !EFI_ZBOOT
	select HAVE_KERNEL_GZIP if !XIP_KERNEL && !EFI_ZBOOT
	select HAVE_KERNEL_LZ4 if !XIP_KERNEL && !EFI_ZBOOT
	select HAVE_KERNEL_LZMA if !XIP_KERNEL && !EFI_ZBOOT
	select HAVE_KERNEL_LZO if !XIP_KERNEL && !EFI_ZBOOT
	select HAVE_KERNEL_UNCOMPRESSED if !XIP_KERNEL && !EFI_ZBOOT
	select HAVE_KERNEL_ZSTD if !XIP_KERNEL && !EFI_ZBOOT
	select HAVE_KERNEL_XZ if !XIP_KERNEL && !EFI_ZBOOT
	select HAVE_KPROBES if !XIP_KERNEL
	select HAVE_KRETPROBES if !XIP_KERNEL
	select HAVE_KERNEL_BZIP2 if !EFI_ZBOOT
	select HAVE_KERNEL_GZIP if !EFI_ZBOOT
	select HAVE_KERNEL_LZ4 if !EFI_ZBOOT
	select HAVE_KERNEL_LZMA if !EFI_ZBOOT
	select HAVE_KERNEL_LZO if !EFI_ZBOOT
	select HAVE_KERNEL_UNCOMPRESSED if !EFI_ZBOOT
	select HAVE_KERNEL_ZSTD if !EFI_ZBOOT
	select HAVE_KERNEL_XZ if !EFI_ZBOOT
	select HAVE_KPROBES
	select HAVE_KRETPROBES
	# https://github.com/ClangBuiltLinux/linux/issues/1881
	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
	select HAVE_MOVE_PMD
@@ -190,9 +191,9 @@ 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_PREEMPT_DYNAMIC_KEY
	select HAVE_REGS_AND_STACK_ACCESS_API
	select HAVE_RETHOOK if !XIP_KERNEL
	select HAVE_RETHOOK
	select HAVE_RSEQ
	select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
	select HAVE_SAMPLE_FTRACE_DIRECT
@@ -213,7 +214,7 @@ config RISCV
	select PCI_ECAM if (ACPI && PCI)
	select PCI_MSI if PCI
	select RELOCATABLE if !MMU && !PHYS_RAM_BASE_FIXED
	select RISCV_ALTERNATIVE if !XIP_KERNEL
	select RISCV_ALTERNATIVE
	select RISCV_APLIC
	select RISCV_IMSIC
	select RISCV_INTC
@@ -537,7 +538,6 @@ endchoice

config RISCV_ALTERNATIVE
	bool
	depends on !XIP_KERNEL
	help
	  This Kconfig allows the kernel to automatically patch the
	  erratum or cpufeature required by the execution platform at run
@@ -1126,7 +1126,6 @@ config PARAVIRT_TIME_ACCOUNTING

config RELOCATABLE
	bool "Build a relocatable kernel"
	depends on !XIP_KERNEL
	select MODULE_SECTIONS if MODULES
	select ARCH_VMLINUX_NEEDS_RELOCS
	help
@@ -1143,7 +1142,7 @@ config RELOCATABLE
config RANDOMIZE_BASE
        bool "Randomize the address of the kernel image"
        select RELOCATABLE
        depends on MMU && 64BIT && !XIP_KERNEL
        depends on MMU && 64BIT
        help
          Randomizes the virtual address at which the kernel image is
          loaded, as a security feature that deters exploit attempts
@@ -1233,7 +1232,7 @@ config EFI_STUB

config EFI
	bool "UEFI runtime support"
	depends on OF && !XIP_KERNEL
	depends on OF
	depends on MMU
	default y
	select ARCH_SUPPORTS_ACPI if 64BIT
@@ -1284,44 +1283,6 @@ config PHYS_RAM_BASE
	  explicitly specified to run early relocations of read-write data
	  from flash to RAM.

config XIP_KERNEL
	bool "Kernel Execute-In-Place from ROM"
	depends on MMU && SPARSEMEM && NONPORTABLE
	# This prevents XIP from being enabled by all{yes,mod}config, which
	# fail to build since XIP doesn't support large kernels.
	depends on !COMPILE_TEST
	select PHYS_RAM_BASE_FIXED
	help
	  Execute-In-Place allows the kernel to run from non-volatile storage
	  directly addressable by the CPU, such as NOR flash. This saves RAM
	  space since the text section of the kernel is not loaded from flash
	  to RAM.  Read-write sections, such as the data section and stack,
	  are still copied to RAM.  The XIP kernel is not compressed since
	  it has to run directly from flash, so it will take more space to
	  store it.  The flash address used to link the kernel object files,
	  and for storing it, is configuration dependent. Therefore, if you
	  say Y here, you must know the proper physical address where to
	  store the kernel image depending on your own flash memory usage.

	  Also note that the make target becomes "make xipImage" rather than
	  "make zImage" or "make Image".  The final kernel binary to put in
	  ROM memory will be arch/riscv/boot/xipImage.

	  SPARSEMEM is required because the kernel text and rodata that are
	  flash resident are not backed by memmap, then any attempt to get
	  a struct page on those regions will trigger a fault.

	  If unsure, say N.

config XIP_PHYS_ADDR
	hex "XIP Kernel Physical Location"
	depends on XIP_KERNEL
	default "0x21000000"
	help
	  This is the physical address in your flash memory the kernel will
	  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
+4 −4
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ menu "SoC selection"

config ARCH_ANDES
	bool "Andes SoCs"
	depends on MMU && !XIP_KERNEL
	depends on MMU
	select ERRATA_ANDES
	help
	  This enables support for Andes SoC platform hardware.
@@ -33,7 +33,7 @@ config ARCH_RENESAS

config ARCH_SIFIVE
	bool "SiFive SoCs"
	select ERRATA_SIFIVE if !XIP_KERNEL
	select ERRATA_SIFIVE
	help
	  This enables support for SiFive SoC platform hardware.

@@ -61,7 +61,7 @@ config SOC_STARFIVE

config ARCH_SUNXI
	bool "Allwinner sun20i SoCs"
	depends on MMU && !XIP_KERNEL
	depends on MMU
	select ERRATA_THEAD
	select SUN4I_TIMER
	help
@@ -78,7 +78,7 @@ config ARCH_TENSTORRENT

config ARCH_THEAD
	bool "T-HEAD RISC-V SoCs"
	depends on MMU && !XIP_KERNEL
	depends on MMU
	select ERRATA_THEAD
	select PM_GENERIC_DOMAINS if PM
	help
+2 −5
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ endif
export BITS
ifeq ($(CONFIG_ARCH_RV64I),y)
	BITS := 64
	UTS_MACHINE := riscv64

	KBUILD_CFLAGS += -mabi=lp64
	KBUILD_AFLAGS += -mabi=lp64
@@ -39,13 +38,14 @@ ifeq ($(CONFIG_ARCH_RV64I),y)
			    -Cno-redzone
else
	BITS := 32
	UTS_MACHINE := riscv32

	KBUILD_CFLAGS += -mabi=ilp32
	KBUILD_AFLAGS += -mabi=ilp32
	KBUILD_LDFLAGS += -melf32lriscv
endif

UTS_MACHINE := riscv$(BITS)

# LLVM has an issue with target-features and LTO: https://github.com/llvm/llvm-project/issues/59350
# Ensure it is aware of linker relaxation with LTO, otherwise relocations may
# be incorrect: https://github.com/llvm/llvm-project/issues/65090
@@ -150,7 +150,6 @@ ifdef CONFIG_RISCV_M_MODE
boot-image-$(CONFIG_SOC_CANAAN_K210)	:= loader.bin
endif
boot-image-$(CONFIG_EFI_ZBOOT)		:= vmlinuz.efi
boot-image-$(CONFIG_XIP_KERNEL)		:= xipImage
KBUILD_IMAGE				:= $(boot)/$(boot-image-y)

libs-y += arch/riscv/lib/
@@ -218,8 +217,6 @@ define archhelp
  echo  '  Image.xz	- Compressed kernel image (arch/riscv/boot/Image.xz)'
  echo  '  vmlinuz.efi	- Compressed EFI kernel image (arch/riscv/boot/vmlinuz.efi)'
  echo  '		  Default when CONFIG_EFI_ZBOOT=y'
  echo  '  xipImage	- Execute-in-place kernel image (arch/riscv/boot/xipImage)'
  echo  '		  Default when CONFIG_XIP_KERNEL=y'
  echo  '  install	- Install kernel using (your) ~/bin/$(INSTALLKERNEL) or'
  echo  '		  (distribution) /sbin/$(INSTALLKERNEL) or install to '
  echo  '		  $$(INSTALL_PATH)'
+0 −11
Original line number Diff line number Diff line
@@ -20,17 +20,6 @@ OBJCOPYFLAGS_xipImage :=-O binary -R .note -R .note.gnu.build-id -R .comment -S

targets := Image Image.* loader loader.o loader.lds loader.bin xipImage

ifeq ($(CONFIG_XIP_KERNEL),y)

quiet_cmd_mkxip = $(quiet_cmd_objcopy)
cmd_mkxip = $(cmd_objcopy)

$(obj)/xipImage: vmlinux FORCE
	$(call if_changed,mkxip)
	@$(kecho) '  Physical Address of xipImage: $(CONFIG_XIP_PHYS_ADDR)'

endif

$(obj)/Image: vmlinux FORCE
	$(call if_changed,objcopy)

Loading