[GIT PULL] RISC-V Patches for the 5.19 Merge Window, Part 1

Palmer Dabbelt palmer at rivosinc.com
Tue May 31 10:13:06 PDT 2022


The following changes since commit 9282d0996936c5fbf877c0d096a3feb456c878ad:

  csky: Move to generic ticket-spinlock (2022-05-11 11:50:15 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git tags/riscv-for-linus-5.19-mw0

for you to fetch changes up to 7699f7aacf3ebfee51c670b6f796b2797f0f7487:

  RISC-V: Prepare dropping week attribute from arch_kexec_apply_relocations[_add] (2022-05-30 16:04:37 -0700)

----------------------------------------------------------------
RISC-V Patches for the 5.19 Merge Window, Part 1

* Support for the Svpbmt extension, which allows memory attributes to be
  encoded in pages.
* Support for the Allwinner D1's implementation of page-based memory
  attributes.
* Support for running rv32 binaries on rv64 systems, via the compat
  subsystem.
* Support for kexec_file().
* Support for the new generic ticket-based spinlocks, which allows us to
  also move to qrwlock.  These should have already gone in through the
  asm-geneic tree as well.
* A handful of cleanups and fixes, include some larger ones around
  atomics and XIP.

----------------------------------------------------------------
The spinlock stuff that already went in isn't called out in the shortlog, IIUC
that's a feature.  It might have slightly messed up git-request-pull, though,
as I'd consider the base here really 5.18-rc1.

I have a single manual resolution in the fe510 device tree, just the result of
some conflicting fixes.  It's not showing up in my merge, but a bunch of other
automatic resolutions are which is a bit worrisome on my end -- I don't usually
touch other trees, but we had a handful of big cross-tree things this time.
Sorry in advance if I've screwed something up, here's what I'm seeing:

    diff --cc arch/arm64/Kconfig
    index ff674808681a,a4968845e67f..1652a9800ebe
    --- a/arch/arm64/Kconfig
    +++ b/arch/arm64/Kconfig
    @@@ -2120,8 -2155,12 +2155,8 @@@ config DM
      	  However, even with this option, the resultant kernel should
      	  continue to boot on existing non-UEFI platforms.
    
    - endmenu
    + endmenu # "Boot options"
    
     -config SYSVIPC_COMPAT
     -	def_bool y
     -	depends on COMPAT && SYSVIPC
     -
      menu "Power management options"
    
      source "kernel/power/Kconfig"
    diff --cc arch/x86/include/asm/compat.h
    index e74a107de0d0,20fd0acd7d80..b1221da477b7
    --- a/arch/x86/include/asm/compat.h
    +++ b/arch/x86/include/asm/compat.h
    @@@ -15,27 -15,20 +15,26 @@@
      #define compat_mode_t	compat_mode_t
      typedef u16		compat_mode_t;
    
     +#define __compat_uid_t	__compat_uid_t
     +typedef u16		__compat_uid_t;
     +typedef u16		__compat_gid_t;
     +
     +#define compat_dev_t	compat_dev_t
     +typedef u16		compat_dev_t;
     +
     +#define compat_ipc_pid_t compat_ipc_pid_t
     +typedef u16		 compat_ipc_pid_t;
     +
     +#define compat_statfs	compat_statfs
     +
      #include <asm-generic/compat.h>
    
     -#define COMPAT_USER_HZ		100
      #define COMPAT_UTS_MACHINE	"i686\0\0"
    
     -typedef u16		__compat_uid_t;
     -typedef u16		__compat_gid_t;
     -typedef u16		compat_dev_t;
      typedef u16		compat_nlink_t;
     -typedef u16		compat_ipc_pid_t;
     -typedef __kernel_fsid_t	compat_fsid_t;
    
      struct compat_stat {
    - 	compat_dev_t	st_dev;
    - 	u16		__pad1;
    + 	u32		st_dev;
      	compat_ino_t	st_ino;
      	compat_mode_t	st_mode;
      	compat_nlink_t	st_nlink;
    diff --cc include/linux/kexec.h
    index ebb1bffbf068,fcd5035209f1..ce6536f1d269
    --- a/include/linux/kexec.h
    +++ b/include/linux/kexec.h
    @@@ -227,8 -219,46 +219,46 @@@ struct crash_mem
      extern int crash_exclude_mem_range(struct crash_mem *mem,
      				   unsigned long long mstart,
      				   unsigned long long mend);
     -extern int crash_prepare_elf64_headers(struct crash_mem *mem, int kernel_map,
     +extern int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
      				       void **addr, unsigned long *sz);
    +
    + #ifndef arch_kexec_apply_relocations_add
    + /*
    +  * arch_kexec_apply_relocations_add - apply relocations of type RELA
    +  * @pi:		Purgatory to be relocated.
    +  * @section:	Section relocations applying to.
    +  * @relsec:	Section containing RELAs.
    +  * @symtab:	Corresponding symtab.
    +  *
    +  * Return: 0 on success, negative errno on error.
    +  */
    + static inline int
    + arch_kexec_apply_relocations_add(struct purgatory_info *pi, Elf_Shdr *section,
    + 				 const Elf_Shdr *relsec, const Elf_Shdr *symtab)
    + {
    + 	pr_err("RELA relocation unsupported.\n");
    + 	return -ENOEXEC;
    + }
    + #endif
    +
    + #ifndef arch_kexec_apply_relocations
    + /*
    +  * arch_kexec_apply_relocations - apply relocations of type REL
    +  * @pi:		Purgatory to be relocated.
    +  * @section:	Section relocations applying to.
    +  * @relsec:	Section containing RELs.
    +  * @symtab:	Corresponding symtab.
    +  *
    +  * Return: 0 on success, negative errno on error.
    +  */
    + static inline int
    + arch_kexec_apply_relocations(struct purgatory_info *pi, Elf_Shdr *section,
    + 			     const Elf_Shdr *relsec, const Elf_Shdr *symtab)
    + {
    + 	pr_err("REL relocation unsupported.\n");
    + 	return -ENOEXEC;
    + }
    + #endif
      #endif /* CONFIG_KEXEC_FILE */
    
      #ifdef CONFIG_KEXEC_ELF

The arm64 stuff is from a refactoring so it seems pretty safe, and the kexec
stuff looks like a straight-forward merge conflict that was autoresolved
correctly.  The x86 merge looks a bit scarier, but IIUC the autoresolver is
doing the right thing: 932aba1e1690 ("stat: fix inconsistency between struct
stat and struct compat_stat") changed compat_stat without changing
compat_dev_t, we're still matching that behavior.

I'll definately have a part 2 (or a respin), I'm farther behind that I usually
am this round.

----------------------------------------------------------------
Christoph Hellwig (3):
      uapi: simplify __ARCH_FLOCK{,64}_PAD a little
      uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h
      compat: consolidate the compat_flock{,64} definition

Chuanhua Han (1):
      riscv: mm: Remove the copy operation of pmd

Guo Ren (21):
      arch: Add SYSVIPC_COMPAT for all architectures
      fs: stat: compat: Add __ARCH_WANT_COMPAT_STAT
      asm-generic: compat: Cleanup duplicate definitions
      syscalls: compat: Fix the missing part for __SYSCALL_COMPAT
      riscv: Fixup difference with defconfig
      riscv: compat: Add basic compat data type implementation
      riscv: compat: Support TASK_SIZE for compat mode
      riscv: compat: syscall: Add compat_sys_call_table implementation
      riscv: compat: syscall: Add entry.S implementation
      riscv: compat: process: Add UXL_32 support in start_thread
      riscv: compat: Add elf.h implementation
      riscv: compat: Add hw capability check for elf
      riscv: compat: vdso: Add COMPAT_VDSO base code implementation
      riscv: compat: vdso: Add setup additional pages implementation
      riscv: compat: signal: Add rt_frame implementation
      riscv: compat: ptrace: Add compat_arch_ptrace implement
      riscv: compat: Add COMPAT Kbuild skeletal support
      riscv: atomic: Cleanup unnecessary definition
      riscv: atomic: Optimize dec_if_positive functions
      riscv: atomic: Add custom conditional atomic operation implementation
      riscv: compat: Using seperated vdso_maps for compat_vdso_info

Heiko Stuebner (12):
      riscv: integrate alternatives better into the main architecture
      riscv: allow different stages with alternatives
      riscv: implement module alternatives
      riscv: implement ALTERNATIVE_2 macro
      riscv: extend concatenated alternatives-lines to the same length
      riscv: prevent compressed instructions in alternatives
      riscv: move boot alternatives to after fill_hwcap
      riscv: Fix accessing pfn bits in PTEs for non-32bit variants
      riscv: add RISC-V Svpbmt extension support
      riscv: remove FIXMAP_PAGE_IO and fall back to its default value
      riscv: don't use global static vars to store alternative data
      riscv: add memory-type errata for T-Head

Li Zhengyu (3):
      RISC-V: Support for kexec_file on panic
      RISC-V: Add purgatory
      RISC-V: Load purgatory in kexec_file

Liao Chang (3):
      kexec_file: Fix kexec_file.c build error for riscv platform
      RISC-V: use memcpy for kexec_file mode
      RISC-V: Add kexec_file support

Niklas Cassel (1):
      riscv: Don't output a bogus mmu-type on a no MMU kernel

Palmer Dabbelt (9):
      riscv: support for Svpbmt and D1 memory types
      RISC-V: Add support for rv32 userspace via COMPAT
      riscv: kexec: add kexec_file_load() support
      Merge tag 'generic-ticket-spinlocks-v6' into for-next
      RISC-V: Avoid empty create_*_mapping definitions
      RISC-V: ignore xipImage
      RISC-V: Split out the XIP fixups into their own file
      RISC-V: Fix the XIP build
      RISC-V: Various XIP fixes

Uwe Kleine-König (1):
      RISC-V: Prepare dropping week attribute from arch_kexec_apply_relocations[_add]

Zong Li (2):
      riscv: dts: Add dma-channels property and modify compatible
      riscv: dts: rename the node name of dma

 arch/arm64/Kconfig                                 |   4 -
 arch/arm64/include/asm/compat.h                    |  93 +----
 arch/arm64/include/asm/unistd.h                    |   1 +
 arch/mips/Kconfig                                  |   5 -
 arch/mips/include/asm/compat.h                     |  41 +-
 arch/mips/include/asm/unistd.h                     |   2 +
 arch/mips/include/uapi/asm/fcntl.h                 |  30 +-
 arch/parisc/Kconfig                                |   4 -
 arch/parisc/include/asm/compat.h                   |  45 +--
 arch/parisc/include/asm/unistd.h                   |   1 +
 arch/powerpc/Kconfig                               |   5 -
 arch/powerpc/include/asm/compat.h                  |  50 +--
 arch/powerpc/include/asm/unistd.h                  |   1 +
 arch/riscv/Kbuild                                  |   2 +
 arch/riscv/Kconfig                                 |  67 +++
 arch/riscv/Kconfig.erratas                         |  34 +-
 arch/riscv/Kconfig.socs                            |   1 -
 arch/riscv/Makefile                                |  11 +-
 arch/riscv/boot/.gitignore                         |   1 +
 arch/riscv/boot/dts/sifive/fu540-c000.dtsi         |   5 +-
 arch/riscv/errata/Makefile                         |   2 +-
 arch/riscv/errata/alternative.c                    |  75 ----
 arch/riscv/errata/sifive/errata.c                  |  20 +-
 arch/riscv/errata/thead/Makefile                   |  11 +
 arch/riscv/errata/thead/errata.c                   |  82 ++++
 arch/riscv/include/asm/alternative-macros.h        | 129 ++++--
 arch/riscv/include/asm/alternative.h               |  25 +-
 arch/riscv/include/asm/asm.h                       |  26 --
 arch/riscv/include/asm/atomic.h                    | 102 ++++-
 arch/riscv/include/asm/cmpxchg.h                   |  12 -
 arch/riscv/include/asm/compat.h                    | 129 ++++++
 arch/riscv/include/asm/csr.h                       |   7 +
 arch/riscv/include/asm/elf.h                       |  50 ++-
 arch/riscv/include/asm/errata_list.h               |  59 +++
 arch/riscv/include/asm/fixmap.h                    |   2 -
 arch/riscv/include/asm/hwcap.h                     |   1 +
 arch/riscv/include/asm/kexec.h                     |  11 +
 arch/riscv/include/asm/mmu.h                       |   1 +
 arch/riscv/include/asm/pgtable-32.h                |  17 +
 arch/riscv/include/asm/pgtable-64.h                |  79 +++-
 arch/riscv/include/asm/pgtable-bits.h              |  10 -
 arch/riscv/include/asm/pgtable.h                   |  68 +++-
 arch/riscv/include/asm/processor.h                 |   6 +-
 arch/riscv/include/asm/signal32.h                  |  18 +
 arch/riscv/include/asm/syscall.h                   |   1 +
 arch/riscv/include/asm/thread_info.h               |   1 +
 arch/riscv/include/asm/unistd.h                    |  11 +
 arch/riscv/include/asm/vdso.h                      |   9 +
 arch/riscv/include/asm/vendorid_list.h             |   1 +
 arch/riscv/include/asm/xip_fixup.h                 |  31 ++
 arch/riscv/include/uapi/asm/unistd.h               |   2 +-
 arch/riscv/kernel/Makefile                         |  19 +
 arch/riscv/kernel/alternative.c                    | 118 ++++++
 arch/riscv/kernel/compat_signal.c                  | 243 +++++++++++
 arch/riscv/kernel/compat_syscall_table.c           |  19 +
 arch/riscv/kernel/compat_vdso/.gitignore           |   2 +
 arch/riscv/kernel/compat_vdso/Makefile             |  78 ++++
 arch/riscv/kernel/compat_vdso/compat_vdso.S        |   8 +
 arch/riscv/kernel/compat_vdso/compat_vdso.lds.S    |   3 +
 arch/riscv/kernel/compat_vdso/flush_icache.S       |   3 +
 .../kernel/compat_vdso/gen_compat_vdso_offsets.sh  |   5 +
 arch/riscv/kernel/compat_vdso/getcpu.S             |   3 +
 arch/riscv/kernel/compat_vdso/note.S               |   3 +
 arch/riscv/kernel/compat_vdso/rt_sigreturn.S       |   3 +
 arch/riscv/kernel/cpu.c                            |   5 +
 arch/riscv/kernel/cpufeature.c                     |  80 +++-
 arch/riscv/kernel/elf_kexec.c                      | 448 +++++++++++++++++++++
 arch/riscv/kernel/entry.S                          |  18 +-
 arch/riscv/kernel/head.S                           |   1 +
 arch/riscv/kernel/machine_kexec.c                  |   4 +-
 arch/riscv/kernel/machine_kexec_file.c             |  14 +
 arch/riscv/kernel/module.c                         |  29 ++
 arch/riscv/kernel/process.c                        |  37 ++
 arch/riscv/kernel/ptrace.c                         |  87 +++-
 arch/riscv/kernel/setup.c                          |   2 +
 arch/riscv/kernel/signal.c                         |   7 +-
 arch/riscv/kernel/smpboot.c                        |   4 -
 arch/riscv/kernel/suspend_entry.S                  |   1 +
 arch/riscv/kernel/sys_riscv.c                      |   6 +-
 arch/riscv/kernel/traps.c                          |   2 +-
 arch/riscv/kernel/vdso.c                           | 114 ++++--
 arch/riscv/kernel/vdso/vdso.S                      |   6 +-
 arch/riscv/mm/fault.c                              |  10 +-
 arch/riscv/mm/init.c                               |   9 +-
 arch/riscv/purgatory/.gitignore                    |   4 +
 arch/riscv/purgatory/Makefile                      |  95 +++++
 arch/riscv/purgatory/entry.S                       |  47 +++
 arch/riscv/purgatory/purgatory.c                   |  45 +++
 arch/s390/Kconfig                                  |   3 -
 arch/s390/include/asm/compat.h                     |  99 +----
 arch/s390/include/asm/unistd.h                     |   1 +
 arch/sparc/Kconfig                                 |   5 -
 arch/sparc/include/asm/compat.h                    |  61 +--
 arch/sparc/include/asm/unistd.h                    |   1 +
 arch/x86/Kconfig                                   |   4 -
 arch/x86/include/asm/compat.h                      | 104 +----
 arch/x86/include/asm/unistd.h                      |   1 +
 fs/open.c                                          |  24 ++
 fs/read_write.c                                    |  16 +
 fs/stat.c                                          |   2 +-
 fs/sync.c                                          |   9 +
 include/asm-generic/compat.h                       | 113 ++++++
 include/linux/compat.h                             |  68 ++++
 include/linux/kexec.h                              |   2 +-
 include/uapi/asm-generic/fcntl.h                   |  23 +-
 include/uapi/asm-generic/unistd.h                  |   4 +-
 init/Kconfig                                       |   4 +
 kernel/kexec_file.c                                |   4 +-
 mm/fadvise.c                                       |  11 +
 mm/readahead.c                                     |   7 +
 tools/include/uapi/asm-generic/fcntl.h             |  21 +-
 tools/include/uapi/asm-generic/unistd.h            |   4 +-
 112 files changed, 2786 insertions(+), 788 deletions(-)
 delete mode 100644 arch/riscv/errata/alternative.c
 create mode 100644 arch/riscv/errata/thead/Makefile
 create mode 100644 arch/riscv/errata/thead/errata.c
 create mode 100644 arch/riscv/include/asm/compat.h
 create mode 100644 arch/riscv/include/asm/signal32.h
 create mode 100644 arch/riscv/include/asm/xip_fixup.h
 create mode 100644 arch/riscv/kernel/alternative.c
 create mode 100644 arch/riscv/kernel/compat_signal.c
 create mode 100644 arch/riscv/kernel/compat_syscall_table.c
 create mode 100644 arch/riscv/kernel/compat_vdso/.gitignore
 create mode 100644 arch/riscv/kernel/compat_vdso/Makefile
 create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.S
 create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.lds.S
 create mode 100644 arch/riscv/kernel/compat_vdso/flush_icache.S
 create mode 100755 arch/riscv/kernel/compat_vdso/gen_compat_vdso_offsets.sh
 create mode 100644 arch/riscv/kernel/compat_vdso/getcpu.S
 create mode 100644 arch/riscv/kernel/compat_vdso/note.S
 create mode 100644 arch/riscv/kernel/compat_vdso/rt_sigreturn.S
 create mode 100644 arch/riscv/kernel/elf_kexec.c
 create mode 100644 arch/riscv/kernel/machine_kexec_file.c
 create mode 100644 arch/riscv/purgatory/.gitignore
 create mode 100644 arch/riscv/purgatory/Makefile
 create mode 100644 arch/riscv/purgatory/entry.S
 create mode 100644 arch/riscv/purgatory/purgatory.c



More information about the linux-riscv mailing list