25 Oct, 2020

1 commit

  • Pull more RISC-V updates from Palmer Dabbelt:
    "Just a single patch set: the remainder of Christoph's work to remove
    set_fs, including the RISC-V portion"

    * tag 'riscv-for-linus-5.10-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
    riscv: remove address space overrides using set_fs()
    riscv: implement __get_kernel_nofault and __put_user_nofault
    riscv: refactor __get_user and __put_user
    riscv: use memcpy based uaccess for nommu again
    asm-generic: make the set_fs implementation optional
    asm-generic: add nommu implementations of __{get,put}_kernel_nofault
    asm-generic: improve the nommu {get,put}_user handling
    uaccess: provide a generic TASK_SIZE_MAX definition

    Linus Torvalds
     

23 Oct, 2020

1 commit

  • Pull initial set_fs() removal from Al Viro:
    "Christoph's set_fs base series + fixups"

    * 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: Allow a NULL pos pointer to __kernel_read
    fs: Allow a NULL pos pointer to __kernel_write
    powerpc: remove address space overrides using set_fs()
    powerpc: use non-set_fs based maccess routines
    x86: remove address space overrides using set_fs()
    x86: make TASK_SIZE_MAX usable from assembly code
    x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32,64}_types.h
    lkdtm: remove set_fs-based tests
    test_bitmap: remove user bitmap tests
    uaccess: add infrastructure for kernel builds with set_fs()
    fs: don't allow splice read/write without explicit ops
    fs: don't allow kernel reads and writes without iter ops
    sysctl: Convert to iter interfaces
    proc: add a read_iter method to proc proc_ops
    proc: cleanup the compat vs no compat file ops
    proc: remove a level of indentation in proc_get_inode

    Linus Torvalds
     

20 Oct, 2020

1 commit

  • Pull RISC-V updates from Palmer Dabbelt:
    "A handful of cleanups and new features:

    - A handful of cleanups for our page fault handling

    - Improvements to how we fill out cacheinfo

    - Support for EFI-based systems"

    * tag 'riscv-for-linus-5.10-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (22 commits)
    RISC-V: Add page table dump support for uefi
    RISC-V: Add EFI runtime services
    RISC-V: Add EFI stub support.
    RISC-V: Add PE/COFF header for EFI stub
    RISC-V: Implement late mapping page table allocation functions
    RISC-V: Add early ioremap support
    RISC-V: Move DT mapping outof fixmap
    RISC-V: Fix duplicate included thread_info.h
    riscv/mm/fault: Set FAULT_FLAG_INSTRUCTION flag in do_page_fault()
    riscv/mm/fault: Fix inline placement in vmalloc_fault() declaration
    riscv: Add cache information in AUX vector
    riscv: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO
    riscv: Set more data to cacheinfo
    riscv/mm/fault: Move access error check to function
    riscv/mm/fault: Move FAULT_FLAG_WRITE handling in do_page_fault()
    riscv/mm/fault: Simplify mm_fault_error()
    riscv/mm/fault: Move fault error handling to mm_fault_error()
    riscv/mm/fault: Simplify fault error handling
    riscv/mm/fault: Move vmalloc fault handling to vmalloc_fault()
    riscv/mm/fault: Move bad area handling to bad_area()
    ...

    Linus Torvalds
     

14 Oct, 2020

1 commit

  • Pull seccomp updates from Kees Cook:
    "The bulk of the changes are with the seccomp selftests to accommodate
    some powerpc-specific behavioral characteristics. Additional cleanups,
    fixes, and improvements are also included:

    - heavily refactor seccomp selftests (and clone3 selftests
    dependency) to fix powerpc (Kees Cook, Thadeu Lima de Souza
    Cascardo)

    - fix style issue in selftests (Zou Wei)

    - upgrade "unknown action" from KILL_THREAD to KILL_PROCESS (Rich
    Felker)

    - replace task_pt_regs(current) with current_pt_regs() (Denis
    Efremov)

    - fix corner-case race in USER_NOTIF (Jann Horn)

    - make CONFIG_SECCOMP no longer per-arch (YiFei Zhu)"

    * tag 'seccomp-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (23 commits)
    seccomp: Make duplicate listener detection non-racy
    seccomp: Move config option SECCOMP to arch/Kconfig
    selftests/clone3: Avoid OS-defined clone_args
    selftests/seccomp: powerpc: Set syscall return during ptrace syscall exit
    selftests/seccomp: Allow syscall nr and ret value to be set separately
    selftests/seccomp: Record syscall during ptrace entry
    selftests/seccomp: powerpc: Fix seccomp return value testing
    selftests/seccomp: Remove SYSCALL_NUM_RET_SHARE_REG in favor of SYSCALL_RET_SET
    selftests/seccomp: Avoid redundant register flushes
    selftests/seccomp: Convert REGSET calls into ARCH_GETREG/ARCH_SETREG
    selftests/seccomp: Convert HAVE_GETREG into ARCH_GETREG/ARCH_SETREG
    selftests/seccomp: Remove syscall setting #ifdefs
    selftests/seccomp: mips: Remove O32-specific macro
    selftests/seccomp: arm64: Define SYSCALL_NUM_SET macro
    selftests/seccomp: arm: Define SYSCALL_NUM_SET macro
    selftests/seccomp: mips: Define SYSCALL_NUM_SET macro
    selftests/seccomp: Provide generic syscall setting macro
    selftests/seccomp: Refactor arch register macros to avoid xtensa special case
    selftests/seccomp: Use __NR_mknodat instead of __NR_mknod
    selftests/seccomp: Use bitwise instead of arithmetic operator for flags
    ...

    Linus Torvalds
     

09 Oct, 2020

1 commit

  • In order to make adding configurable features into seccomp easier,
    it's better to have the options at one single location, considering
    especially that the bulk of seccomp code is arch-independent. An quick
    look also show that many SECCOMP descriptions are outdated; they talk
    about /proc rather than prctl.

    As a result of moving the config option and keeping it default on,
    architectures arm, arm64, csky, riscv, sh, and xtensa did not have SECCOMP
    on by default prior to this and SECCOMP will be default in this change.

    Architectures microblaze, mips, powerpc, s390, sh, and sparc have an
    outdated depend on PROC_FS and this dependency is removed in this change.

    Suggested-by: Jann Horn
    Link: https://lore.kernel.org/lkml/CAG48ez1YWz9cnp08UZgeieYRhHdqh-ch7aNwc4JRBnGyrmgfMg@mail.gmail.com/
    Signed-off-by: YiFei Zhu
    [kees: added HAVE_ARCH_SECCOMP help text, tweaked wording]
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/9ede6ef35c847e58d61e476c6a39540520066613.1600951211.git.yifeifz2@illinois.edu

    YiFei Zhu
     

05 Oct, 2020

3 commits

  • Stop providing the possibility to override the address space using
    set_fs() now that there is no need for that any more.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Palmer Dabbelt

    Christoph Hellwig
     
  • This reverts commit adccfb1a805ea84d2db38eb53032533279bdaa97.

    Now that the generic uaccess by mempcy code handles unaligned addresses
    the generic code can be used for all RISC-V CPUs.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Palmer Dabbelt

    Christoph Hellwig
     
  • This is a dependency for Christoph's removal of set_fs.

    * 'base.set_fs' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    powerpc: remove address space overrides using set_fs()
    powerpc: use non-set_fs based maccess routines
    x86: remove address space overrides using set_fs()
    x86: make TASK_SIZE_MAX usable from assembly code
    x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32,64}_types.h
    lkdtm: remove set_fs-based tests
    test_bitmap: remove user bitmap tests
    uaccess: add infrastructure for kernel builds with set_fs()
    fs: don't allow splice read/write without explicit ops
    fs: don't allow kernel reads and writes without iter ops
    sysctl: Convert to iter interfaces
    proc: add a read_iter method to proc proc_ops
    proc: cleanup the compat vs no compat file ops
    proc: remove a level of indentation in proc_get_inode

    Palmer Dabbelt
     

03 Oct, 2020

3 commits

  • This patch adds EFI runtime service support for RISC-V.

    Signed-off-by: Atish Patra
    [ardb: - Remove the page check]
    Signed-off-by: Ard Biesheuvel
    Acked-by: Ard Biesheuvel
    Signed-off-by: Palmer Dabbelt

    Atish Patra
     
  • Add a RISC-V architecture specific stub code that actually copies the
    actual kernel image to a valid address and jump to it after boot services
    are terminated. Enable UEFI related kernel configs as well for RISC-V.

    Signed-off-by: Atish Patra
    Link: https://lore.kernel.org/r/20200421033336.9663-4-atish.patra@wdc.com
    [ardb: - move hartid fetch into check_platform_features()
    - use image_size not reserve_size
    - select ISA_C
    - do not use dram_base]
    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Palmer Dabbelt

    Atish Patra
     
  • UEFI uses early IO or memory mappings for runtime services before
    normal ioremap() is usable. Add the necessary fixmap bindings and
    pmd mappings for generic ioremap support to work.

    Signed-off-by: Atish Patra
    Reviewed-by: Anup Patel
    Reviewed-by: Palmer Dabbelt
    Signed-off-by: Palmer Dabbelt

    Atish Patra
     

20 Sep, 2020

1 commit

  • The K210 doesn't implement rdtime in M-mode, and since that's where Linux runs
    in the NOMMU systems that means we can't use rdtime. The K210 is the only
    system that anyone is currently running NOMMU or M-mode on, so here we're just
    inlining the timer read directly.

    This also adds the CLINT driver as an !MMU dependency, as it's currently the
    only timer driver availiable for these systems and without it we get a build
    failure for some configurations.

    Tested-by: Damien Le Moal
    Signed-off-by: Palmer Dabbelt

    Palmer Dabbelt
     

09 Sep, 2020

1 commit

  • Add a CONFIG_SET_FS option that is selected by architecturess that
    implement set_fs, which is all of them initially. If the option is not
    set stubs for routines related to overriding the address space are
    provided so that architectures can start to opt out of providing set_fs.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Kees Cook
    Signed-off-by: Al Viro

    Christoph Hellwig
     

21 Aug, 2020

1 commit

  • Right now the RISC-V timer driver is convoluted to support:
    1. Linux RISC-V S-mode (with MMU) where it will use TIME CSR for
    clocksource and SBI timer calls for clockevent device.
    2. Linux RISC-V M-mode (without MMU) where it will use CLINT MMIO
    counter register for clocksource and CLINT MMIO compare register
    for clockevent device.

    We now have a separate CLINT timer driver which also provide CLINT
    based IPI operations so let's remove CLINT MMIO related code from
    arch/riscv directory and RISC-V timer driver.

    Signed-off-by: Anup Patel
    Tested-by: Emil Renner Berhing
    Acked-by: Daniel Lezcano
    Reviewed-by: Atish Patra
    Reviewed-by: Palmer Dabbelt
    Signed-off-by: Palmer Dabbelt

    Anup Patel
     

08 Aug, 2020

1 commit

  • Pull RISC-V updates from Palmer Dabbelt:
    "We have a lot of new kernel features for this merge window:

    - ARCH_SUPPORTS_ATOMIC_RMW, to allow OSQ locks to be enabled

    - The ability to enable NO_HZ_FULL

    - Support for enabling kcov, kmemleak, stack protector, and VM
    debugging

    - JUMP_LABEL support

    There are also a handful of cleanups"

    * tag 'riscv-for-linus-5.9-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (24 commits)
    riscv: disable stack-protector for vDSO
    RISC-V: Fix build warning for smpboot.c
    riscv: fix build warning of mm/pageattr
    riscv: Fix build warning for mm/init
    RISC-V: Setup exception vector early
    riscv: Select ARCH_HAS_DEBUG_VM_PGTABLE
    riscv: Use generic pgprot_* macros from
    mm: pgtable: Make generic pgprot_* macros available for no-MMU
    riscv: Cleanup unnecessary define in asm-offset.c
    riscv: Add jump-label implementation
    riscv: Support R_RISCV_ADD64 and R_RISCV_SUB64 relocs
    Replace HTTP links with HTTPS ones: RISC-V
    riscv: Add STACKPROTECTOR supported
    riscv: Fix typo in asm/hwcap.h uapi header
    riscv: Add kmemleak support
    riscv: Allow building with kcov coverage
    riscv: Enable context tracking
    riscv: Support irq_work via self IPIs
    riscv: Enable LOCKDEP_SUPPORT & fixup TRACE_IRQFLAGS_SUPPORT
    riscv: Fixup lockdep_assert_held with wrong param cpu_running
    ...

    Linus Torvalds
     

05 Aug, 2020

1 commit

  • Pull fork cleanups from Christian Brauner:
    "This is cleanup series from when we reworked a chunk of the process
    creation paths in the kernel and switched to struct
    {kernel_}clone_args.

    High-level this does two main things:

    - Remove the double export of both do_fork() and _do_fork() where
    do_fork() used the incosistent legacy clone calling convention.

    Now we only export _do_fork() which is based on struct
    kernel_clone_args.

    - Remove the copy_thread_tls()/copy_thread() split making the
    architecture specific HAVE_COYP_THREAD_TLS config option obsolete.

    This switches all remaining architectures to select
    HAVE_COPY_THREAD_TLS and thus to the copy_thread_tls() calling
    convention. The current split makes the process creation codepaths
    more convoluted than they need to be. Each architecture has their own
    copy_thread() function unless it selects HAVE_COPY_THREAD_TLS then it
    has a copy_thread_tls() function.

    The split is not needed anymore nowadays, all architectures support
    CLONE_SETTLS but quite a few of them never bothered to select
    HAVE_COPY_THREAD_TLS and instead simply continued to use copy_thread()
    and use the old calling convention. Removing this split cleans up the
    process creation codepaths and paves the way for implementing clone3()
    on such architectures since it requires the copy_thread_tls() calling
    convention.

    After having made each architectures support copy_thread_tls() this
    series simply renames that function back to copy_thread(). It also
    switches all architectures that call do_fork() directly over to
    _do_fork() and the struct kernel_clone_args calling convention. This
    is a corollary of switching the architectures that did not yet support
    it over to copy_thread_tls() since do_fork() is conditional on not
    supporting copy_thread_tls() (Mostly because it lacks a separate
    argument for tls which is trivial to fix but there's no need for this
    function to exist.).

    The do_fork() removal is in itself already useful as it allows to to
    remove the export of both do_fork() and _do_fork() we currently have
    in favor of only _do_fork(). This has already been discussed back when
    we added clone3(). The legacy clone() calling convention is - as is
    probably well-known - somewhat odd:

    #
    # ABI hall of shame
    #
    config CLONE_BACKWARDS
    config CLONE_BACKWARDS2
    config CLONE_BACKWARDS3

    that is aggravated by the fact that some architectures such as sparc
    follow the CLONE_BACKWARDSx calling convention but don't really select
    the corresponding config option since they call do_fork() directly.

    So do_fork() enforces a somewhat arbitrary calling convention in the
    first place that doesn't really help the individual architectures that
    deviate from it. They can thus simply be switched to _do_fork()
    enforcing a single calling convention. (I really hope that any new
    architectures will __not__ try to implement their own calling
    conventions...)

    Most architectures already have made a similar switch (m68k comes to
    mind).

    Overall this removes more code than it adds even with a good portion
    of added comments. It simplifies a chunk of arch specific assembly
    either by moving the code into C or by simply rewriting the assembly.

    Architectures that have been touched in non-trivial ways have all been
    actually boot and stress tested: sparc and ia64 have been tested with
    Debian 9 images. They are the two architectures which have been
    touched the most. All non-trivial changes to architectures have seen
    acks from the relevant maintainers. nios2 with a custom built
    buildroot image. h8300 I couldn't get something bootable to test on
    but the changes have been fairly automatic and I'm sure we'll hear
    people yell if I broke something there.

    All other architectures that have been touched in trivial ways have
    been compile tested for each single patch of the series via git rebase
    -x "make ..." v5.8-rc2. arm{64} and x86{_64} have been boot tested
    even though they have just been trivially touched (removal of the
    HAVE_COPY_THREAD_TLS macro from their Kconfig) because well they are
    basically "core architectures" and since it is trivial to get your
    hands on a useable image"

    * tag 'fork-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
    arch: rename copy_thread_tls() back to copy_thread()
    arch: remove HAVE_COPY_THREAD_TLS
    unicore: switch to copy_thread_tls()
    sh: switch to copy_thread_tls()
    nds32: switch to copy_thread_tls()
    microblaze: switch to copy_thread_tls()
    hexagon: switch to copy_thread_tls()
    c6x: switch to copy_thread_tls()
    alpha: switch to copy_thread_tls()
    fork: remove do_fork()
    h8300: select HAVE_COPY_THREAD_TLS, switch to kernel_clone_args
    nios2: enable HAVE_COPY_THREAD_TLS, switch to kernel_clone_args
    ia64: enable HAVE_COPY_THREAD_TLS, switch to kernel_clone_args
    sparc: unconditionally enable HAVE_COPY_THREAD_TLS
    sparc: share process creation helpers between sparc and sparc64
    sparc64: enable HAVE_COPY_THREAD_TLS
    fork: fold legacy_clone_args_valid() into _do_fork()

    Linus Torvalds
     

31 Jul, 2020

7 commits

  • This allows the pgtable tests to be built.

    Signed-off-by: Emil Renner Berthing
    Signed-off-by: Palmer Dabbelt

    Emil Renner Berthing
     
  • Add jump-label implementation based on the ARM64 version
    and add CONFIG_JUMP_LABEL=y to the defconfigs.

    Signed-off-by: Emil Renner Berthing
    Reviewed-by: Björn Töpel
    Tested-by: Björn Töpel
    Signed-off-by: Palmer Dabbelt

    Emil Renner Berthing
     
  • The -fstack-protector & -fstack-protector-strong features are from
    gcc. The patch only add basic kernel support to stack-protector
    feature and some arch could have its own solution such as
    ARM64_PTR_AUTH.

    After enabling STACKPROTECTOR and STACKPROTECTOR_STRONG, the .text
    size is expanded from 0x7de066 to 0x81fb32 (only 5%) to add canary
    checking code.

    Signed-off-by: Guo Ren
    Reviewed-by: Kees Cook
    Signed-off-by: Palmer Dabbelt

    Guo Ren
     
  • Tested using syzkaller in QEMU's riscv64 virt machine.

    Signed-off-by: Tobias Klauser
    Signed-off-by: Palmer Dabbelt

    Tobias Klauser
     
  • Add ARCH_HAS_KCOV and HAVE_GCC_PLUGINS to the riscv Kconfig.
    Also disable instrumentation of some early boot code and vdso.

    Boot-tested on QEMU's riscv64 virt machine.

    Signed-off-by: Tobias Klauser
    Acked-by: Dmitry Vyukov
    Signed-off-by: Palmer Dabbelt

    Tobias Klauser
     
  • This patch implements and enables context tracking for riscv (which is a
    prerequisite for CONFIG_NO_HZ_FULL support)

    It adds checking for previous state in the entry that all excepttions and
    interrupts goes to and calls context_tracking_user_exit() if it comes from
    user space. It also calls context_tracking_user_enter() if it will return
    to user space before restore_all.

    This patch is tested with the dynticks-testing testcase in
    qemu-system-riscv64 virt machine and Unleashed board.
    git://git.kernel.org/pub/scm/linux/kernel/git/frederic/dynticks-testing.git

    We can see the log here. The tick got mostly stopped during the execution
    of the user loop.

    _-----=> irqs-off
    / _----=> need-resched
    | / _---=> hardirq/softirq
    || / _--=> preempt-depth
    ||| / delay
    TASK-PID CPU# |||| TIMESTAMP FUNCTION
    | | | |||| | |
    -0 [001] d..2 604.183512: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=taskset next_pid=273 next_prio=120
    user_loop-273 [001] d.h1 604.184788: hrtimer_expire_entry: hrtimer=000000002eda5fab function=tick_sched_timer now=604176096300
    user_loop-273 [001] d.s2 604.184897: workqueue_queue_work: work struct=00000000383402c2 function=vmstat_update workqueue=00000000f36d35d4 req_cpu=1 cpu=1
    user_loop-273 [001] dns2 604.185039: tick_stop: success=0 dependency=SCHED
    user_loop-273 [001] dn.1 604.185103: tick_stop: success=0 dependency=SCHED
    user_loop-273 [001] d..2 604.185154: sched_switch: prev_comm=taskset prev_pid=273 prev_prio=120 prev_state=R+ ==> next_comm=kworker/1:1 next_pid=46 next_prio=120
    -46 [001] .... 604.185194: workqueue_execute_start: work struct 00000000383402c2: function vmstat_update
    -46 [001] d..2 604.185266: sched_switch: prev_comm=kworker/1:1 prev_pid=46 prev_prio=120 prev_state=I ==> next_comm=taskset next_pid=273 next_prio=120
    user_loop-273 [001] d.h1 604.188812: hrtimer_expire_entry: hrtimer=000000002eda5fab function=tick_sched_timer now=604180133400
    user_loop-273 [001] d..1 604.189050: tick_stop: success=1 dependency=NONE
    user_loop-273 [001] d..2 614.251386: sched_switch: prev_comm=user_loop prev_pid=273 prev_prio=120 prev_state=X ==> next_comm=swapper/1 next_pid=0 next_prio=120
    -0 [001] d..2 614.315391: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=taskset next_pid=276 next_prio=120

    Signed-off-by: Greentime Hu
    Signed-off-by: Palmer Dabbelt

    Greentime Hu
     
  • Lockdep is needed by proving the spinlocks and rwlocks. To suupport
    it, we need fixup TRACE_IRQFLAGS_SUPPORT in kernel/entry.S. This
    patch follow Documentation/irqflags-tracing.txt.

    Signed-off-by: Guo Ren
    Signed-off-by: Palmer Dabbelt

    Guo Ren
     

10 Jul, 2020

1 commit

  • Due to lack of hardware breakpoint support, the kernel option
    CONFIG_STRICT_KERNEL_RWX should be disabled when using KGDB. However,
    CONFIG_STRICT_KERNEL_RWX is always enabled now. Therefore, select
    ARCH_OPTIONAL_KERNEL_RWX_DEFAULT to enable CONFIG_STRICT_KERNEL_RWX
    by default, and then select ARCH_OPTIONAL_KERNEL_RWX to enable the
    Kconfig prompt of CONFIG_STRICT_KERNEL_RWX so that users can turn it off.

    Signed-off-by: Vincent Chen
    Signed-off-by: Palmer Dabbelt

    Vincent Chen
     

05 Jul, 2020

1 commit

  • All architectures support copy_thread_tls() now, so remove the legacy
    copy_thread() function and the HAVE_COPY_THREAD_TLS config option. Everyone
    uses the same process creation calling convention based on
    copy_thread_tls() and struct kernel_clone_args. This will make it easier to
    maintain the core process creation code under kernel/, simplifies the
    callpaths and makes the identical for all architectures.

    Cc: linux-arch@vger.kernel.org
    Acked-by: Thomas Bogendoerfer
    Acked-by: Greentime Hu
    Acked-by: Geert Uytterhoeven
    Reviewed-by: Kees Cook
    Signed-off-by: Christian Brauner

    Christian Brauner
     

30 Jun, 2020

1 commit


11 Jun, 2020

1 commit

  • Even if RISC-V has supported the vDSO feature, the latency of the functions
    for obtaining the system time is still expensive. It is because these
    functions still trigger a corresponding system call in the process, which
    slows down the response time. If we want to remove the system call to
    reduce the latency, the kernel should have the ability to output the system
    clock information to userspace. This patch introduces the vDSO common flow
    to enable the kernel to achieve the above feature and uses "rdtime"
    instruction to obtain the current time in the user space. Under this
    condition, the latency cost by the ecall from U-mode to S-mode can be
    eliminated. After applying this patch, the latency of gettimeofday()
    measured on the HiFive unleashed board can be reduced by %61.

    Signed-off-by: Vincent Chen
    Reviewed-by: Atish Patra
    Signed-off-by: Palmer Dabbelt

    Vincent Chen
     

10 Jun, 2020

3 commits

  • The RISC-V per-HART local interrupt controller driver is mandatory
    for all RISC-V system (with/without MMU) hence we force select it
    for CONFIG_RISCV (just like RISCV_TIMER).

    Signed-off-by: Anup Patel
    Reviewed-by: Atish Patra
    Signed-off-by: Palmer Dabbelt

    Anup Patel
     
  • The RISC-V per-HART local interrupt controller manages software
    interrupts, timer interrupts, external interrupts (which are routed
    via the platform level interrupt controller) and other per-HART
    local interrupts.

    We add a driver for the RISC-V local interrupt controller, which
    eventually replaces the RISC-V architecture code, allowing for a
    better split between arch code and drivers.

    The driver is compliant with RISC-V Hart-Level Interrupt Controller
    DT bindings located at:
    Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt

    Co-developed-by: Palmer Dabbelt
    Signed-off-by: Anup Patel
    [Palmer: Cleaned up warnings]
    Signed-off-by: Palmer Dabbelt

    Anup Patel
     
  • Like patch b1b3f49 ("ARM: config: sort select statements alphanumerically")
    , we sort all our select statements alphanumerically by using the perl
    script in patch b1b3f49 as above.

    As suggested by Andrew Morton:

    This is a pet peeve of mine. Any time there's a long list of items
    (header file inclusions, kconfig entries, array initalisers, etc) and
    someone wants to add a new item, they *always* go and stick it at the
    end of the list.

    Guys, don't do this. Either put the new item into a randomly-chosen
    position or, probably better, alphanumerically sort the list.

    Suggested-by: Zong Li
    [Palmer: Re-ran the script, as there were predictably a bunch of conflicts]
    Signed-off-by: Palmer Dabbelt

    Palmer Dabbelt
     

05 Jun, 2020

1 commit

  • Pull RISC-V updates from Palmer Dabbelt:

    - The remainder of the code necessary to support the Kendryte K210:

    * Support for building device trees into the kernel, as the K210
    doesn't have a bootloader that provides one

    * A K210 device tree and the associated defconfig update

    * Support for skipping PMP initialization on systems that trap on
    PMP accesses rather than treating them as WARL

    - Support for KGDB

    - Improvements to text patching

    - Some cleanups to the SiFive L2 cache driver

    * tag 'riscv-for-linus-5.8-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
    soc: sifive: l2 cache: Mark l2_get_priv_group as static
    soc: sifive: l2 cache: Eliminate an unsigned zero compare warning
    riscv: Add support to determine no. of L2 cache way enabled
    riscv: cacheinfo: Implement cache_get_priv_group with a generic ops structure
    riscv: Use text_mutex instead of patch_lock
    riscv: Use NOKPROBE_SYMBOL() instead of __krpobes annotation
    riscv: Remove the 'riscv_' prefix of function name
    riscv: Add SW single-step support for KDB
    riscv: Use the XML target descriptions to report 3 system registers
    riscv: Add KGDB support
    kgdb: Add kgdb_has_hit_break function
    RISC-V: Skip setting up PMPs on traps
    riscv: K210: Update defconfig
    riscv: K210: Add a built-in device tree
    riscv: Allow device trees to be built into the kernel

    Linus Torvalds
     

04 Jun, 2020

2 commits

  • Support DEBUG_WX to check whether there are mapping with write and execute
    permission at the same time.

    [akpm@linux-foundation.org: replace macros with C]
    Signed-off-by: Zong Li
    Signed-off-by: Andrew Morton
    Cc: Borislav Petkov
    Cc: Catalin Marinas
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Palmer Dabbelt
    Cc: Paul Walmsley
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Link: http://lkml.kernel.org/r/282e266311bced080bc6f7c255b92f87c1eb65d6.1587455584.git.zong.li@sifive.com
    Signed-off-by: Linus Torvalds

    Zong Li
     
  • CONFIG_HAVE_MEMBLOCK_NODE_MAP is used to differentiate initialization of
    nodes and zones structures between the systems that have region to node
    mapping in memblock and those that don't.

    Currently all the NUMA architectures enable this option and for the
    non-NUMA systems we can presume that all the memory belongs to node 0 and
    therefore the compile time configuration option is not required.

    The remaining few architectures that use DISCONTIGMEM without NUMA are
    easily updated to use memblock_add_node() instead of memblock_add() and
    thus have proper correspondence of memblock regions to NUMA nodes.

    Still, free_area_init_node() must have a backward compatible version
    because its semantics with and without CONFIG_HAVE_MEMBLOCK_NODE_MAP is
    different. Once all the architectures will use the new semantics, the
    entire compatibility layer can be dropped.

    To avoid addition of extra run time memory to store node id for
    architectures that keep memblock but have only a single node, the node id
    field of the memblock_region is guarded by CONFIG_NEED_MULTIPLE_NODES and
    the corresponding accessors presume that in those cases it is always 0.

    Signed-off-by: Mike Rapoport
    Signed-off-by: Andrew Morton
    Tested-by: Hoan Tran [arm64]
    Acked-by: Catalin Marinas [arm64]
    Cc: Baoquan He
    Cc: Brian Cain
    Cc: "David S. Miller"
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Ungerer
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: "James E.J. Bottomley"
    Cc: Jonathan Corbet
    Cc: Ley Foon Tan
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Hocko
    Cc: Michal Simek
    Cc: Nick Hu
    Cc: Paul Walmsley
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Thomas Bogendoerfer
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Link: http://lkml.kernel.org/r/20200412194859.12663-4-rppt@kernel.org
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

19 May, 2020

3 commits

  • The $status, $badaddr, and $cause registers belong to the thread context,
    so KGDB can obtain their contents from pt_regs in each trap. However, the
    sequential number of these registers in the gdb register list is far from
    the general-purpose registers. If riscv port uses the existing method to
    report these three registers, many trivial registers with sequence numbers
    in the middle of them will also be packaged to the reply packets. To solve
    this problem, the riscv port wants to introduce the GDB target description
    mechanism to customize the reported register list. By the list, the KGDB
    can ignore the intermediate registers and just reports the general-purpose
    registers and these three system registers.

    Signed-off-by: Vincent Chen
    Signed-off-by: Palmer Dabbelt

    Vincent Chen
     
  • The skeleton of RISC-V KGDB port.

    Signed-off-by: Vincent Chen
    Reviewed-by: Palmer Dabbelt
    Signed-off-by: Palmer Dabbelt

    Vincent Chen
     
  • Some systems don't provide a useful device tree to the kernel on boot.
    Chasing around bootloaders for these systems is a headache, so instead
    le't's just keep a device tree table in the kernel, keyed by the SOC's
    unique identifier, that contains the relevant DTB.

    This is only implemented for M mode right now. While we could implement
    this via the SBI calls that allow access to these identifiers, we don't
    have any systems that need this right now.

    Signed-off-by: Palmer Dabbelt

    Palmer Dabbelt
     

13 May, 2020

2 commits


25 Apr, 2020

1 commit

  • ARCH_HAS_STRICT_KERNEL_RWX is not useful for NO-MMU systems.
    Furthermore, has this option leads to very large boot image files on
    64bits architectures, do not enable this option to allow supporting
    no-mmu platforms such as the Kendryte K210 SoC based boards.

    Fixes: 00cb41d5ad31 ("riscv: add alignment for text, rodata and data sections")
    Signed-off-by: Damien Le Moal
    Reviewed-by: Anup Patel
    Reviewed-by: Wladimir J. van der Laan
    Signed-off-by: Palmer Dabbelt

    Damien Le Moal
     

17 Apr, 2020

1 commit

  • Pull networking fixes from David Miller:

    1) Disable RISCV BPF JIT builds when !MMU, from Björn Töpel.

    2) nf_tables leaves dangling pointer after free, fix from Eric Dumazet.

    3) Out of boundary write in __xsk_rcv_memcpy(), fix from Li RongQing.

    4) Adjust icmp6 message source address selection when routes have a
    preferred source address set, from Tim Stallard.

    5) Be sure to validate HSR protocol version when creating new links,
    from Taehee Yoo.

    6) CAP_NET_ADMIN should be sufficient to manage l2tp tunnels even in
    non-initial namespaces, from Michael Weiß.

    7) Missing release firmware call in mlx5, from Eran Ben Elisha.

    8) Fix variable type in macsec_changelink(), caught by KASAN. Fix from
    Taehee Yoo.

    9) Fix pause frame negotiation in marvell phy driver, from Clemens
    Gruber.

    10) Record RX queue early enough in tun packet paths such that XDP
    programs will see the correct RX queue index, from Gilberto Bertin.

    11) Fix double unlock in mptcp, from Florian Westphal.

    12) Fix offset overflow in ARM bpf JIT, from Luke Nelson.

    13) marvell10g needs to soft reset PHY when coming out of low power
    mode, from Russell King.

    14) Fix MTU setting regression in stmmac for some chip types, from
    Florian Fainelli.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (101 commits)
    amd-xgbe: Use __napi_schedule() in BH context
    mISDN: make dmril and dmrim static
    net: stmmac: dwmac-sunxi: Provide TX and RX fifo sizes
    net: dsa: mt7530: fix tagged frames pass-through in VLAN-unaware mode
    tipc: fix incorrect increasing of link window
    Documentation: Fix tcp_challenge_ack_limit default value
    net: tulip: make early_486_chipsets static
    dt-bindings: net: ethernet-phy: add desciption for ethernet-phy-id1234.d400
    ipv6: remove redundant assignment to variable err
    net/rds: Use ERR_PTR for rds_message_alloc_sgs()
    net: mscc: ocelot: fix untagged packet drops when enslaving to vlan aware bridge
    selftests/bpf: Check for correct program attach/detach in xdp_attach test
    libbpf: Fix type of old_fd in bpf_xdp_set_link_opts
    libbpf: Always specify expected_attach_type on program load if supported
    xsk: Add missing check on user supplied headroom size
    mac80211: fix channel switch trigger from unknown mesh peer
    mac80211: fix race in ieee80211_register_hw()
    net: marvell10g: soft-reset the PHY when coming out of low power
    net: marvell10g: report firmware version
    net/cxgb4: Check the return from t4_query_params properly
    ...

    Linus Torvalds