23 Oct, 2020

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - Support 'make compile_commands.json' to generate the compilation
    database more easily, avoiding stale entries

    - Support 'make clang-analyzer' and 'make clang-tidy' for static checks
    using clang-tidy

    - Preprocess scripts/modules.lds.S to allow CONFIG options in the
    module linker script

    - Drop cc-option tests from compiler flags supported by our minimal
    GCC/Clang versions

    - Use always 12-digits commit hash for CONFIG_LOCALVERSION_AUTO=y

    - Use sha1 build id for both BFD linker and LLD

    - Improve deb-pkg for reproducible builds and rootless builds

    - Remove stale, useless scripts/namespace.pl

    - Turn -Wreturn-type warning into error

    - Fix build error of deb-pkg when CONFIG_MODULES=n

    - Replace 'hostname' command with more portable 'uname -n'

    - Various Makefile cleanups

    * tag 'kbuild-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits)
    kbuild: Use uname for LINUX_COMPILE_HOST detection
    kbuild: Only add -fno-var-tracking-assignments for old GCC versions
    kbuild: remove leftover comment for filechk utility
    treewide: remove DISABLE_LTO
    kbuild: deb-pkg: clean up package name variables
    kbuild: deb-pkg: do not build linux-headers package if CONFIG_MODULES=n
    kbuild: enforce -Werror=return-type
    scripts: remove namespace.pl
    builddeb: Add support for all required debian/rules targets
    builddeb: Enable rootless builds
    builddeb: Pass -n to gzip for reproducible packages
    kbuild: split the build log of kallsyms
    kbuild: explicitly specify the build id style
    scripts/setlocalversion: make git describe output more reliable
    kbuild: remove cc-option test of -Werror=date-time
    kbuild: remove cc-option test of -fno-stack-check
    kbuild: remove cc-option test of -fno-strict-overflow
    kbuild: move CFLAGS_{KASAN,UBSAN,KCSAN} exports to relevant Makefiles
    kbuild: remove redundant CONFIG_KASAN check from scripts/Makefile.kasan
    kbuild: do not create built-in objects for external module builds
    ...

    Linus Torvalds
     

03 Oct, 2020

1 commit

  • 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
     

24 Sep, 2020

1 commit

  • There was a request to preprocess the module linker script like we
    do for the vmlinux one. (https://lkml.org/lkml/2020/8/21/512)

    The difference between vmlinux.lds and module.lds is that the latter
    is needed for external module builds, thus must be cleaned up by
    'make mrproper' instead of 'make clean'. Also, it must be created
    by 'make modules_prepare'.

    You cannot put it in arch/$(SRCARCH)/kernel/, which is cleaned up by
    'make clean'. I moved arch/$(SRCARCH)/kernel/module.lds to
    arch/$(SRCARCH)/include/asm/module.lds.h, which is included from
    scripts/module.lds.S.

    scripts/module.lds is fine because 'make clean' keeps all the
    build artifacts under scripts/.

    You can add arch-specific sections in .

    Signed-off-by: Masahiro Yamada
    Tested-by: Jessica Yu
    Acked-by: Will Deacon
    Acked-by: Geert Uytterhoeven
    Acked-by: Palmer Dabbelt
    Reviewed-by: Kees Cook
    Acked-by: Jessica Yu

    Masahiro Yamada
     

10 Apr, 2020

1 commit

  • Pull RISC-V updates from Palmer Dabbelt:
    "This contains a handful of new features:

    - Partial support for the Kendryte K210.

    There are still a few outstanding issues that I have patches for,
    but I don't actually have a board to test them so they're not
    included yet.

    - SBI v0.2 support.

    - Fixes to support for building with LLVM-based toolchains. The
    resulting images are known not to boot yet.

    I don't anticipate a part two, but I'll probably have something early
    in the RCs to finish up the K210 support"

    * tag 'riscv-for-linus-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (38 commits)
    riscv: create a loader.bin boot image for Kendryte SoC
    riscv: Kendryte K210 default config
    riscv: Add Kendryte K210 device tree
    riscv: Select required drivers for Kendryte SOC
    riscv: Add Kendryte K210 SoC support
    riscv: Add SOC early init support
    riscv: Unaligned load/store handling for M_MODE
    RISC-V: Support cpu hotplug
    RISC-V: Add supported for ordered booting method using HSM
    RISC-V: Add SBI HSM extension definitions
    RISC-V: Export SBI error to linux error mapping function
    RISC-V: Add cpu_ops and modify default booting method
    RISC-V: Move relocate and few other functions out of __init
    RISC-V: Implement new SBI v0.2 extensions
    RISC-V: Introduce a new config for SBI v0.1
    RISC-V: Add SBI v0.2 extension definitions
    RISC-V: Add basic support for SBI v0.2
    RISC-V: Mark existing SBI as 0.1 SBI.
    riscv: Use macro definition instead of magic number
    riscv: Add support to dump the kernel page tables
    ...

    Linus Torvalds
     

04 Apr, 2020

1 commit

  • Create the loader.bin bootable image file that can be loaded into
    Kendryte K210 based boards using the kflash.py tool with the command:

    kflash.py/kflash.py -t arch/riscv/boot/loader.bin

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Damien Le Moal
    Reviewed-by: Anup Patel
    Reviewed-by: Palmer Dabbelt
    Signed-off-by: Palmer Dabbelt

    Christoph Hellwig
     

04 Mar, 2020

1 commit


18 Nov, 2019

1 commit

  • This allows just loading the kernel at a pre-set address without
    qemu going bonkers trying to map the ELF file.

    Contains a contribution from Aurabindo Jayamohanan to reuse the
    PAGE_OFFSET definition.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Anup Patel
    [paul.walmsley@sifive.com: fixed checkpatch issue; minor commit
    message fix]
    Signed-off-by: Paul Walmsley

    Christoph Hellwig
     

20 Sep, 2019

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - add modpost warn exported symbols marked as 'static' because 'static'
    and EXPORT_SYMBOL is an odd combination

    - break the build early if gold linker is used

    - optimize the Bison rule to produce .c and .h files by a single
    pattern rule

    - handle PREEMPT_RT in the module vermagic and UTS_VERSION

    - warn CONFIG options leaked to the user-space except existing ones

    - make single targets work properly

    - rebuild modules when module linker scripts are updated

    - split the module final link stage into scripts/Makefile.modfinal

    - fix the missed error code in merge_config.sh

    - improve the error message displayed on the attempt of the O= build in
    unclean source tree

    - remove 'clean-dirs' syntax

    - disable -Wimplicit-fallthrough warning for Clang

    - add CONFIG_CC_OPTIMIZE_FOR_SIZE_O3 for ARC

    - remove ARCH_{CPP,A,C}FLAGS variables

    - add $(BASH) to run bash scripts

    - change *CFLAGS_.o to take the relative path to $(obj)
    instead of the basename

    - stop suppressing Clang's -Wunused-function warnings when W=1

    - fix linux/export.h to avoid genksyms calculating CRC of trimmed
    exported symbols

    - misc cleanups

    * tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (63 commits)
    genksyms: convert to SPDX License Identifier for lex.l and parse.y
    modpost: use __section in the output to *.mod.c
    modpost: use MODULE_INFO() for __module_depends
    export.h, genksyms: do not make genksyms calculate CRC of trimmed symbols
    export.h: remove defined(__KERNEL__), which is no longer needed
    kbuild: allow Clang to find unused static inline functions for W=1 build
    kbuild: rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN
    kbuild: refactor scripts/Makefile.extrawarn
    merge_config.sh: ignore unwanted grep errors
    kbuild: change *FLAGS_.o to take the path relative to $(obj)
    modpost: add NOFAIL to strndup
    modpost: add guid_t type definition
    kbuild: add $(BASH) to run scripts with bash-extension
    kbuild: remove ARCH_{CPP,A,C}FLAGS
    kbuild,arc: add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC
    kbuild: Do not enable -Wimplicit-fallthrough for clang for now
    kbuild: clean up subdir-ymn calculation in Makefile.clean
    kbuild: remove unneeded '+' marker from cmd_clean
    kbuild: remove clean-dirs syntax
    kbuild: check clean srctree even earlier
    ...

    Linus Torvalds
     

05 Sep, 2019

1 commit

  • This patch add support for perf callchain sampling on riscv platforms.
    The return address of leaf function is retrieved from pt_regs as
    it is not saved in the outmost frame.

    Signed-off-by: Mao Han
    Cc: Paul Walmsley
    Cc: Greentime Hu
    Cc: Palmer Dabbelt
    Cc: linux-riscv
    Cc: Christoph Hellwig
    Cc: Guo Ren
    Tested-by: Greentime Hu
    [paul.walmsley@sifive.com: fixed some 'checkpatch.pl --strict' issues;
    fixed patch description spelling]
    Signed-off-by: Paul Walmsley

    Mao Han
     

31 Aug, 2019

1 commit


21 Aug, 2019

1 commit


17 Jul, 2019

1 commit


09 Jun, 2019

1 commit

  • Until recently, if KBUILD_DEFCONFIG was not set by the arch Makefile,
    the default path arch/*/defconfig was used.

    The last users of the default are gone by the following commits:

    - Commit f3e20ad67b4c ("s390: move arch/s390/defconfig to
    arch/s390/configs/defconfig")

    - Commit 986a13769c4b ("alpha: move arch/alpha/defconfig to
    arch/alpha/configs/defconfig")

    Let's set arch/*/configs/defconfig as a new default. This saves
    KBUILD_DEFCONFIG for some architectures.

    Signed-off-by: Masahiro Yamada
    Acked-by: Catalin Marinas

    Masahiro Yamada
     

26 Apr, 2019

1 commit

  • This option is always enabled, and not supporting the A extensions would
    create a complete ABI trainwreck, so there is no point in even slightly
    encouraging such an idea by keeping this unselectable code around.

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

    Christoph Hellwig
     

05 Feb, 2019

1 commit

  • This commit adds a BPF JIT for RV64G.

    The JIT is a two-pass JIT, and has a dynamic prolog/epilogue (similar
    to the MIPS64 BPF JIT) instead of static ones (e.g. x86_64).

    At the moment the RISC-V Linux port does not support
    CONFIG_HAVE_KPROBES, which means that CONFIG_BPF_EVENTS is not
    supported. Thus, no tests involving BPF_PROG_TYPE_TRACEPOINT,
    BPF_PROG_TYPE_PERF_EVENT, BPF_PROG_TYPE_KPROBE and
    BPF_PROG_TYPE_RAW_TRACEPOINT passes.

    The implementation does not support "far branching" (>4KiB).

    Test results:
    # modprobe test_bpf
    test_bpf: Summary: 378 PASSED, 0 FAILED, [366/366 JIT'ed]

    # echo 1 > /proc/sys/kernel/unprivileged_bpf_disabled
    # ./test_verifier
    ...
    Summary: 761 PASSED, 507 SKIPPED, 2 FAILED

    Note that "test_verifier" was run with one build with
    CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y and one without, otherwise
    many of the the tests that require unaligned access were skipped.

    CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y:
    # echo 1 > /proc/sys/kernel/unprivileged_bpf_disabled
    # ./test_verifier | grep -c 'NOTE.*unknown align'
    0

    No CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS:
    # echo 1 > /proc/sys/kernel/unprivileged_bpf_disabled
    # ./test_verifier | grep -c 'NOTE.*unknown align'
    59

    The two failing test_verifier tests are:
    "ld_abs: vlan + abs, test 1"
    "ld_abs: jump around ld_abs"

    This is due to that "far branching" involved in those tests.

    All tests where done on QEMU (QEMU emulator version 3.1.50
    (v3.1.0-688-g8ae951fbc106)).

    Signed-off-by: Björn Töpel
    Signed-off-by: Daniel Borkmann

    Björn Töpel
     

20 Nov, 2018

1 commit

  • This patch extends Linux RISC-V build system to build and install:
    Image - Flat uncompressed kernel image
    Image.gz - Flat and GZip compressed kernel image

    Quiet a few bootloaders (such as Uboot, UEFI, etc) are capable of
    booting flat and compressed kernel images. In case of Uboot, booting
    Image or Image.gz is achieved using bootm command.

    The flat and uncompressed kernel image (i.e. Image) is very useful
    in pre-silicon developent and testing because we can create back-door
    HEX files for RAM on FPGAs from Image.

    Signed-off-by: Anup Patel
    Signed-off-by: Palmer Dabbelt

    Anup Patel
     

13 Nov, 2018

1 commit


23 Oct, 2018

4 commits

  • This patchset adds an option, CONFIG_FPU, to enable/disable floating-
    point support within the kernel. The kernel's new behavior will be as
    follows:

    * with CONFIG_FPU=y
    All FPU codes are reserved. If no FPU is found during booting, a
    global flag will be set, and those functions will be bypassed with
    condition check to that flag.

    * with CONFIG_FPU=n
    No floating-point instructions in kernel and all related settings
    are excluded.

    Signed-off-by: Palmer Dabbelt

    Palmer Dabbelt
     
  • This becomes much neater in Kconfig.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Palmer Dabbelt

    Masahiro Yamada
     
  • FPU codes have been separated from common part in previous patches.
    This patch add the CONFIG_FPU option and some stubs, so that a no-FPU
    configuration is allowed.

    Signed-off-by: Alan Kao
    Cc: Greentime Hu
    Cc: Vincent Chen
    Cc: Zong Li
    Cc: Nick Hu
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Palmer Dabbelt

    Alan Kao
     
  • This patch cleanup the MARCH string passing to both compiler and
    assembler. Note that the CFLAGS should not contain "fd" before we
    have mechnisms like kernel_fpu_begin/end in other architectures.

    Signed-off-by: Alan Kao
    Cc: Greentime Hu
    Cc: Vincent Chen
    Cc: Zong Li
    Cc: Nick Hu
    Signed-off-by: Palmer Dabbelt

    Alan Kao
     

24 Aug, 2018

1 commit

  • Commit a0f97e06a43c ("kbuild: enable 'make CFLAGS=...' to add
    additional options to CC") renamed CFLAGS to KBUILD_CFLAGS.

    Commit 222d394d30e7 ("kbuild: enable 'make AFLAGS=...' to add
    additional options to AS") renamed AFLAGS to KBUILD_AFLAGS.

    Commit 06c5040cdb13 ("kbuild: enable 'make CPPFLAGS=...' to add
    additional options to CPP") renamed CPPFLAGS to KBUILD_CPPFLAGS.

    For some reason, LDFLAGS was not renamed.

    Using a well-known variable like LDFLAGS may result in accidental
    override of the variable.

    Kbuild generally uses KBUILD_ prefixed variables for the internally
    appended options, so here is one more conversion to sanitize the
    naming convention.

    I did not touch Makefiles under tools/ since the tools build system
    is a different world.

    Signed-off-by: Masahiro Yamada
    Acked-by: Kirill A. Shutemov
    Reviewed-by: Palmer Dabbelt

    Masahiro Yamada
     

20 Aug, 2018

1 commit

  • …l/git/palmer/riscv-linux

    Pull RISC-V updates from Palmer Dabbelt:
    "This contains some major improvements to the RISC-V port, including
    the necessary interrupt controller and timer support to actually make
    it to userspace. Support for three devices has been added:

    - the ISA-mandated timers on RISC-V systems.

    - the ISA-mandated first-level interrupt controller on RISC-V
    systems, which is handled as part of our core arch code because
    it's very small and tightly tied to the ISA.

    - SiFive's platform-level interrupt controller, which talks to the
    actual devices.

    In addition to these new devices, there are a handful of cleanups all
    over the RISC-V tree:

    - build fixes for various configurations:
    * A fix to the vDSO build's makefile so it respects CFLAGS.
    * The addition of __lshrti3, a libgcc derived function necessary
    for some 32-bit configurations.
    * !SMP && PERF_EVENTS

    - Cleanups to the arch code to remove the remnants of old versions of
    the drivers that were just properly submitted.
    * Some dead code from the timer driver, most of which wasn't ever
    even compiled.
    * Cleanups of some interrupt #defines, which are now local to the
    interrupt handling code.

    - Fixes to ptrace(), which while not being sufficient to fully make
    GDB work are at least sufficient to get simple GDB tasks to work.

    - Early printk support via RISC-V's architecturally mandated SBI
    console device.

    - A fix to our early debug trap handler to ensure it's always
    aligned.

    These patches have all been through a fairly extensive review process,
    but as this enables a whole pile of functionality (ie, userspace) I'm
    confident we'll need to submit a few more patches. The only concrete
    issues I know about are the sys_riscv_flush_icache patches, but as I
    managed to screw those up on Friday I figured it'd be best to let them
    bake another week.

    This tag boots a Fedora root filesystem on QEMU's master branch for
    me, and before this morning's rebase (from 4.18-rc8 to 4.18) it booted
    on the HiFive Unleashed.

    Thanks to Christoph Hellwig and the other guys at WD for getting the
    new drivers in shape!"

    * tag 'riscv-for-linus-4.19-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux:
    dt-bindings: interrupt-controller: SiFive Plaform Level Interrupt Controller
    dt-bindings: interrupt-controller: RISC-V local interrupt controller
    RISC-V: Fix !CONFIG_SMP compilation error
    irqchip: add a SiFive PLIC driver
    RISC-V: Add the directive for alignment of stvec's value
    clocksource: new RISC-V SBI timer driver
    RISC-V: implement low-level interrupt handling
    RISC-V: add a definition for the SIE SEIE bit
    RISC-V: remove INTERRUPT_CAUSE_* defines from asm/irq.h
    RISC-V: simplify software interrupt / IPI code
    RISC-V: remove timer leftovers
    RISC-V: Add early printk support via the SBI console
    RISC-V: Don't increment sepc after breakpoint.
    RISC-V: implement __lshrti3.
    RISC-V: Use KBUILD_CFLAGS instead of KCFLAGS when building the vDSO

    Linus Torvalds
     

13 Aug, 2018

1 commit


19 Jul, 2018

1 commit


12 Jun, 2018

1 commit

  • RISC-V uses the macro __riscv_xlen, predefined by GCC, to
    make the distinction between 32 or 64 bit code.

    However, sparse doesn't know anything about this macro
    which lead to wrong warnings and failures.

    Fix this by adding a define of __riscv_xlen to CHECKFLAGS
    and add one for __riscv too.

    Signed-off-by: Luc Van Oostenryck
    Signed-off-by: Palmer Dabbelt

    Luc Van Oostenryck
     

03 Apr, 2018

3 commits

  • This cleans up the module support that was commited earlier to work with
    what's actually emitted from our GCC port as it lands upstream. Most of
    the work here is adding new relocations to the kernel.

    There's some limitations on module loading imposed by the kernel:

    * The kernel doesn't support linker relaxation, which is necessary to
    support R_RISCV_ALIGN. In order to get reliable module building
    you're going to need to a GCC that supports the new '-mno-relax',
    which IIRC isn't going to be out until 8.1.0. It's somewhat unlikely
    that R_RISCV_ALIGN will appear in a module even without '-mno-relax'
    support, so issues shouldn't be common.

    * There is no large code model for RISC-V, which means modules must be
    loaded within a 32-bit signed offset of the kernel. We don't
    currently have any mechanism for ensuring this memory remains free or
    moving pages around, so issues here might be common.

    I fixed a singcle merge conflict in arch/riscv/kernel/Makefile.

    Palmer Dabbelt
     
  • The address of external symbols will locate more than 32-bit offset
    in 64-bit kernel with sv39 or sv48 virtual addressing.

    Module loader emits the GOT and PLT entries for data symbols and
    function symbols respectively.

    The PLT entry is a trampoline code for jumping to the 64-bit
    real address. The GOT entry is just the data symbol address.

    Signed-off-by: Zong Li
    Signed-off-by: Palmer Dabbelt

    Zong Li
     
  • Now recordmcount.pl recognizes RISC-V object files. For the mechanism to
    work, we have to disable the linker relaxation.

    Cc: Greentime Hu
    Signed-off-by: Alan Kao
    Signed-off-by: Palmer Dabbelt

    Alan Kao
     

27 Sep, 2017

1 commit

  • This patch contains all the build infrastructure that actually enables
    the RISC-V port. This includes Makefiles, linker scripts, and Kconfig
    files. It also contains the only top-level change, which adds RISC-V to
    the list of architectures that need a sed run to produce the ARCH
    variable when building locally.

    Signed-off-by: Palmer Dabbelt

    Palmer Dabbelt