Merge tag 'riscv-for-linus-5.13-mw0' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 May 2021 16:24:18 +0000 (09:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 May 2021 16:24:18 +0000 (09:24 -0700)
Pull RISC-V updates from Palmer Dabbelt:

 - Support for the memtest= kernel command-line argument.

 - Support for building the kernel with FORTIFY_SOURCE.

 - Support for generic clockevent broadcasts.

 - Support for the buildtar build target.

 - Some build system cleanups to pass more LLVM-friendly arguments.

 - Support for kprobes.

 - A rearranged kernel memory map, the first part of supporting sv48
   systems.

 - Improvements to kexec, along with support for kdump and crash
   kernels.

 - An alternatives-based errata framework, along with support for
   handling a pair of errata that manifest on some SiFive designs
   (including the HiFive Unmatched).

 - Support for XIP.

 - A device tree for the Microchip PolarFire ICICLE SoC and associated
   dev board.

... along with a bunch of cleanups.  There are already a handful of fixes
on the list so there will likely be a part 2.

* tag 'riscv-for-linus-5.13-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (45 commits)
  RISC-V: Always define XIP_FIXUP
  riscv: Remove 32b kernel mapping from page table dump
  riscv: Fix 32b kernel build with CONFIG_DEBUG_VIRTUAL=y
  RISC-V: Fix error code returned by riscv_hartid_to_cpuid()
  RISC-V: Enable Microchip PolarFire ICICLE SoC
  RISC-V: Initial DTS for Microchip ICICLE board
  dt-bindings: riscv: microchip: Add YAML documentation for the PolarFire SoC
  RISC-V: Add Microchip PolarFire SoC kconfig option
  RISC-V: enable XIP
  RISC-V: Add crash kernel support
  RISC-V: Add kdump support
  RISC-V: Improve init_resources()
  RISC-V: Add kexec support
  RISC-V: Add EM_RISCV to kexec UAPI header
  riscv: vdso: fix and clean-up Makefile
  riscv/mm: Use BUG_ON instead of if condition followed by BUG.
  riscv/kprobe: fix kernel panic when invoking sys_read traced by kprobe
  riscv: Set ARCH_HAS_STRICT_MODULE_RWX if MMU
  riscv: module: Create module allocations without exec permissions
  riscv: bpf: Avoid breaking W^X
  ...

14 files changed:
1  2 
Documentation/admin-guide/kernel-parameters.txt
arch/riscv/Kconfig
arch/riscv/Kconfig.socs
arch/riscv/include/asm/sbi.h
arch/riscv/kernel/Makefile
arch/riscv/kernel/entry.S
arch/riscv/kernel/probes/kprobes.c
arch/riscv/kernel/sbi.c
arch/riscv/kernel/time.c
arch/riscv/kernel/traps.c
arch/riscv/mm/fault.c
arch/riscv/mm/init.c
arch/riscv/mm/kasan_init.c
scripts/recordmcount.pl

                        seconds.  Use this parameter to check at some
                        other rate.  0 disables periodic checking.
  
-       memtest=        [KNL,X86,ARM,PPC] Enable memtest
 +      memory_hotplug.memmap_on_memory
 +                      [KNL,X86,ARM] Boolean flag to enable this feature.
 +                      Format: {on | off (default)}
 +                      When enabled, runtime hotplugged memory will
 +                      allocate its internal metadata (struct pages)
 +                      from the hotadded memory which will allow to
 +                      hotadd a lot of memory without requiring
 +                      additional memory to do so.
 +                      This feature is disabled by default because it
 +                      has some implication on large (e.g. GB)
 +                      allocations in some configurations (e.g. small
 +                      memory blocks).
 +                      The state of the flag can be read in
 +                      /sys/module/memory_hotplug/parameters/memmap_on_memory.
 +                      Note that even when enabled, there are a few cases where
 +                      the feature is not effective.
 +
+       memtest=        [KNL,X86,ARM,PPC,RISCV] Enable memtest
                        Format: <integer>
                        default : 0 <disable>
                        Specifies the number of memtest passes to be
@@@ -27,10 -28,11 +28,12 @@@ config RISC
        select ARCH_HAS_PTE_SPECIAL
        select ARCH_HAS_SET_DIRECT_MAP
        select ARCH_HAS_SET_MEMORY
-       select ARCH_HAS_STRICT_KERNEL_RWX 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_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
        select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
 +      select ARCH_SUPPORTS_HUGETLBFS if MMU
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
Simple merge
Simple merge
@@@ -8,8 -8,11 +8,12 @@@ CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTR
  CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE)
  CFLAGS_REMOVE_sbi.o   = $(CC_FLAGS_FTRACE)
  endif
 +CFLAGS_syscall_table.o        += $(call cc-option,-Wno-override-init,)
  
+ ifdef CONFIG_KEXEC
+ AFLAGS_kexec_relocate.o := -mcmodel=medany -mno-relax
+ endif
  extra-y += head.o
  extra-y += vmlinux.lds
  
Simple merge
Simple merge
Simple merge
@@@ -9,9 -9,8 +9,9 @@@
  #include <linux/delay.h>
  #include <asm/sbi.h>
  #include <asm/processor.h>
 +#include <asm/timex.h>
  
- unsigned long riscv_timebase;
+ unsigned long riscv_timebase __ro_after_init;
  EXPORT_SYMBOL_GPL(riscv_timebase);
  
  void __init time_init(void)
Simple merge
Simple merge
Simple merge
@@@ -159,36 -162,8 +162,9 @@@ static void __init kasan_shallow_popula
  {
        unsigned long vaddr = (unsigned long)start & PAGE_MASK;
        unsigned long vend = PAGE_ALIGN((unsigned long)end);
-       unsigned long pfn;
-       int index;
-       void *p;
-       pud_t *pud_dir, *pud_k;
-       pgd_t *pgd_dir, *pgd_k;
-       p4d_t *p4d_dir, *p4d_k;
-       while (vaddr < vend) {
-               index = pgd_index(vaddr);
-               pfn = csr_read(CSR_SATP) & SATP_PPN;
-               pgd_dir = (pgd_t *)pfn_to_virt(pfn) + index;
-               pgd_k = init_mm.pgd + index;
-               pgd_dir = pgd_offset_k(vaddr);
-               set_pgd(pgd_dir, *pgd_k);
-               p4d_dir = p4d_offset(pgd_dir, vaddr);
-               p4d_k  = p4d_offset(pgd_k, vaddr);
-               vaddr = (vaddr + PUD_SIZE) & PUD_MASK;
-               pud_dir = pud_offset(p4d_dir, vaddr);
-               pud_k = pud_offset(p4d_k, vaddr);
-               if (pud_present(*pud_dir)) {
-                       p = early_alloc(PAGE_SIZE, NUMA_NO_NODE);
-                       pud_populate(&init_mm, pud_dir, p);
-               }
-               vaddr += PAGE_SIZE;
-       }
  
+       kasan_shallow_populate_pgd(vaddr, vend);
 +      local_flush_tlb_all();
  }
  
  void __init kasan_init(void)
                        break;
  
                kasan_populate(kasan_mem_to_shadow(start), kasan_mem_to_shadow(end));
 -      };
 +      }
  
+       /* Populate kernel, BPF, modules mapping */
+       kasan_populate(kasan_mem_to_shadow((const void *)MODULES_VADDR),
+                      kasan_mem_to_shadow((const void *)BPF_JIT_REGION_END));
        for (i = 0; i < PTRS_PER_PTE; i++)
                set_pte(&kasan_early_shadow_pte[i],
                        mk_pte(virt_to_page(kasan_early_shadow_page),
Simple merge