1. 21 May, 2022 1 commit
  2. 20 May, 2022 1 commit
    • Palmer Dabbelt's avatar
      Merge tag 'generic-ticket-spinlocks-v6' into for-next · 19bc59bb
      Palmer Dabbelt authored
      asm-generic: New generic ticket-based spinlock
      
      This contains a new ticket-based spinlock that uses only generic
      atomics and doesn't require as much from the memory system as qspinlock
      does in order to be fair.  It also includes a bit of documentation about
      the qspinlock and qrwlock fairness requirements.
      
      This will soon be used by a handful of architectures that don't meet the
      qspinlock requirements.
      
      * tag 'generic-ticket-spinlocks-v6':
        csky: Move to generic ticket-spinlock
        RISC-V: Move to queued RW locks
        RISC-V: Move to generic spinlocks
        openrisc: Move to ticket-spinlock
        asm-generic: qrwlock: Document the spinlock fairness requirements
        asm-generic: qspinlock: Indicate the use of mixed-size atomics
        asm-generic: ticket-lock: New generic ticket-based spinlock
      19bc59bb
  3. 19 May, 2022 8 commits
    • Palmer Dabbelt's avatar
      riscv: kexec: add kexec_file_load() support · 83a7a614
      Palmer Dabbelt authored
      This patch set implements kexec_file_load() for RISC-V, which is
      currently only allowed on rv64 due to some minor build issues on 32-bit
      platforms in the generic code.  This allows users to kexec() using an FD
      as opposed to a buffer.
      
      Link: https://lore.kernel.org/all/20220408100914.150110-1-lizhengyu3@huawei.com/
      
      * palmer/riscv-kexec_file:
        RISC-V: Load purgatory in kexec_file
        RISC-V: Add purgatory
        RISC-V: Support for kexec_file on panic
        RISC-V: Add kexec_file support
        RISC-V: use memcpy for kexec_file mode
        kexec_file: Fix kexec_file.c build error for riscv platform
      83a7a614
    • Li Zhengyu's avatar
      RISC-V: Load purgatory in kexec_file · 838b3e28
      Li Zhengyu authored
      This patch supports kexec_file to load and relocate purgatory.
      It works well on riscv64 QEMU, being tested with devmem.
      Signed-off-by: default avatarLi Zhengyu <lizhengyu3@huawei.com>
      Link: https://lore.kernel.org/r/20220408100914.150110-7-lizhengyu3@huawei.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      838b3e28
    • Li Zhengyu's avatar
      RISC-V: Add purgatory · 736e30af
      Li Zhengyu authored
      This patch adds purgatory, the name and concept have been taken
      from kexec-tools. Purgatory runs between two kernels, and do
      verify sha256 hash to ensure the kernel to jump to is fine and
      has not been corrupted after loading. Makefile is modified based
      on x86 platform.
      Signed-off-by: default avatarLi Zhengyu <lizhengyu3@huawei.com>
      Link: https://lore.kernel.org/r/20220408100914.150110-6-lizhengyu3@huawei.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      736e30af
    • Li Zhengyu's avatar
      RISC-V: Support for kexec_file on panic · 8acea455
      Li Zhengyu authored
      This patch adds support for loading a kexec on panic (kdump) kernel.
      It has been tested with vmcore-dmesg on riscv64 QEMU on both an smp
      and a non-smp system.
      Signed-off-by: default avatarLi Zhengyu <lizhengyu3@huawei.com>
      Link: https://lore.kernel.org/r/20220408100914.150110-5-lizhengyu3@huawei.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      8acea455
    • Liao Chang's avatar
      RISC-V: Add kexec_file support · 6261586e
      Liao Chang authored
      This patch adds support for kexec_file on RISC-V. I tested it on riscv64
      QEMU with busybear-linux and single core along with the OpenSBI firmware
      fw_jump.bin for generic platform.
      
      On SMP system, it depends on CONFIG_{HOTPLUG_CPU, RISCV_SBI} to
      resume/stop hart through OpenSBI firmware, it also needs a OpenSBI that
      support the HSM extension.
      Signed-off-by: default avatarLiao Chang <liaochang1@huawei.com>
      Signed-off-by: default avatarLi Zhengyu <lizhengyu3@huawei.com>
      Link: https://lore.kernel.org/r/20220408100914.150110-4-lizhengyu3@huawei.com
      [Palmer: Make 64-bit only]
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      6261586e
    • Liao Chang's avatar
      RISC-V: use memcpy for kexec_file mode · b7fb4d78
      Liao Chang authored
      The pointer to buffer loading kernel binaries is in kernel space for
      kexec_fil mode, When copy_from_user copies data from pointer to a block
      of memory, it checkes that the pointer is in the user space range, on
      RISCV-V that is:
      
      static inline bool __access_ok(unsigned long addr, unsigned long size)
      {
      	return size <= TASK_SIZE && addr <= TASK_SIZE - size;
      }
      
      and TASK_SIZE is 0x4000000000 for 64-bits, which now causes
      copy_from_user to reject the access of the field 'buf' of struct
      kexec_segment that is in range [CONFIG_PAGE_OFFSET - VMALLOC_SIZE,
      CONFIG_PAGE_OFFSET), is invalid user space pointer.
      
      This patch fixes this issue by skipping access_ok(), use mempcy() instead.
      Signed-off-by: default avatarLiao Chang <liaochang1@huawei.com>
      Link: https://lore.kernel.org/r/20220408100914.150110-3-lizhengyu3@huawei.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      b7fb4d78
    • Liao Chang's avatar
      kexec_file: Fix kexec_file.c build error for riscv platform · 4853f68d
      Liao Chang authored
      When CONFIG_KEXEC_FILE is set for riscv platform, the compilation of
      kernel/kexec_file.c generate build error:
      
      kernel/kexec_file.c: In function 'crash_prepare_elf64_headers':
      ./arch/riscv/include/asm/page.h:110:71: error: request for member 'virt_addr' in something not a structure or union
        110 |  ((x) >= PAGE_OFFSET && (!IS_ENABLED(CONFIG_64BIT) || (x) < kernel_map.virt_addr))
            |                                                                       ^
      ./arch/riscv/include/asm/page.h:131:2: note: in expansion of macro 'is_linear_mapping'
        131 |  is_linear_mapping(_x) ?       \
            |  ^~~~~~~~~~~~~~~~~
      ./arch/riscv/include/asm/page.h:140:31: note: in expansion of macro '__va_to_pa_nodebug'
        140 | #define __phys_addr_symbol(x) __va_to_pa_nodebug(x)
            |                               ^~~~~~~~~~~~~~~~~~
      ./arch/riscv/include/asm/page.h:143:24: note: in expansion of macro '__phys_addr_symbol'
        143 | #define __pa_symbol(x) __phys_addr_symbol(RELOC_HIDE((unsigned long)(x), 0))
            |                        ^~~~~~~~~~~~~~~~~~
      kernel/kexec_file.c:1327:36: note: in expansion of macro '__pa_symbol'
       1327 |   phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
      
      This occurs is because the "kernel_map" referenced in macro
      is_linear_mapping()  is suppose to be the one of struct kernel_mapping
      defined in arch/riscv/mm/init.c, but the 2nd argument of
      crash_prepare_elf64_header() has same symbol name, in expansion of macro
      is_linear_mapping in function crash_prepare_elf64_header(), "kernel_map"
      actually is the local variable.
      Signed-off-by: default avatarLiao Chang <liaochang1@huawei.com>
      Link: https://lore.kernel.org/r/20220408100914.150110-2-lizhengyu3@huawei.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      4853f68d
    • Palmer Dabbelt's avatar
      RISC-V: Add support for rv32 userspace via COMPAT · 7eb6369d
      Palmer Dabbelt authored
      The RISC-V port supports the rv32i and rv64i base ISAs, but provides no
      mechanism to run 32-bit userspace on 64-bit systems.  This adds that
      support, via the COMPAT framework.  As the RISC-V ISAs (and uABIs) were
      developed concurrently, the resulting compat support is mostly generic.
      
      This includes a handful of cleanups to the generic compat infrastructure
      to more cleanly support RISC-V, followed by the RISC-V implementation.
      
      * palmer/riscv-compat:
        riscv: compat: Add COMPAT Kbuild skeletal support
        riscv: compat: ptrace: Add compat_arch_ptrace implement
        riscv: compat: signal: Add rt_frame implementation
        riscv: compat: vdso: Add setup additional pages implementation
        riscv: compat: vdso: Add COMPAT_VDSO base code implementation
        riscv: compat: Add hw capability check for elf
        riscv: compat: Add elf.h implementation
        riscv: compat: process: Add UXL_32 support in start_thread
        riscv: compat: syscall: Add entry.S implementation
        riscv: compat: syscall: Add compat_sys_call_table implementation
        riscv: compat: Support TASK_SIZE for compat mode
        riscv: compat: Add basic compat data type implementation
        riscv: Fixup difference with defconfig
        syscalls: compat: Fix the missing part for __SYSCALL_COMPAT
        asm-generic: compat: Cleanup duplicate definitions
        fs: stat: compat: Add __ARCH_WANT_COMPAT_STAT
        arch: Add SYSVIPC_COMPAT for all architectures
        compat: consolidate the compat_flock{,64} definition
        uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h
        uapi: simplify __ARCH_FLOCK{,64}_PAD a little
      7eb6369d
  4. 17 May, 2022 3 commits
  5. 12 May, 2022 13 commits
  6. 11 May, 2022 7 commits
  7. 26 Apr, 2022 7 commits