Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'riscv-for-linus-4.20-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux

Pull RISC-V fixes from Palmer Dabbelt:
"This week is a bit bigger than I expected. That's my fault, as I
missed a few patches while I was at Plumbers last week. We have:

- A fix to a quite embarassing issue where raw_copy_to_user() was
implemented with asm_copy_from_user() (and vice versa).

- Improvements to our makefile to allow flat binaries to be
generated.

- A build fix that predeclares "struct module" at the top of
<asm/module.h>, which triggers warnings later in that header.

- The addition of our own <uapi/asm/unistd> header, which is
necessary to align our stat ABI on 32-bit systems.

- A fix to avoid printing a warning when the S or U bits are set in
print_isa().

I already have one patch in the queue for next week"

* tag 'riscv-for-linus-4.20-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux:
RISC-V: recognize S/U mode bits in print_isa
riscv: add asm/unistd.h UAPI header
riscv: fix warning in arch/riscv/include/asm/module.h
RISC-V: Build flat and compressed kernel images
RISC-V: Fix raw_copy_{to,from}_user()

+150 -17
+14 -1
arch/riscv/Makefile
··· 71 71 # arch specific predefines for sparse 72 72 CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS) 73 73 74 + # Default target when executing plain make 75 + boot := arch/riscv/boot 76 + KBUILD_IMAGE := $(boot)/Image.gz 77 + 74 78 head-y := arch/riscv/kernel/head.o 75 79 76 80 core-y += arch/riscv/kernel/ arch/riscv/mm/ ··· 85 81 vdso_install: 86 82 $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ 87 83 88 - all: vmlinux 84 + all: Image.gz 85 + 86 + Image: vmlinux 87 + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 88 + 89 + Image.%: Image 90 + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 91 + 92 + zinstall install: 93 + $(Q)$(MAKE) $(build)=$(boot) $@
+2
arch/riscv/boot/.gitignore
··· 1 + Image 2 + Image.gz
+33
arch/riscv/boot/Makefile
··· 1 + # 2 + # arch/riscv/boot/Makefile 3 + # 4 + # This file is included by the global makefile so that you can add your own 5 + # architecture-specific flags and dependencies. 6 + # 7 + # This file is subject to the terms and conditions of the GNU General Public 8 + # License. See the file "COPYING" in the main directory of this archive 9 + # for more details. 10 + # 11 + # Copyright (C) 2018, Anup Patel. 12 + # Author: Anup Patel <anup@brainfault.org> 13 + # 14 + # Based on the ia64 and arm64 boot/Makefile. 15 + # 16 + 17 + OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S 18 + 19 + targets := Image 20 + 21 + $(obj)/Image: vmlinux FORCE 22 + $(call if_changed,objcopy) 23 + 24 + $(obj)/Image.gz: $(obj)/Image FORCE 25 + $(call if_changed,gzip) 26 + 27 + install: 28 + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 29 + $(obj)/Image System.map "$(INSTALL_PATH)" 30 + 31 + zinstall: 32 + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 33 + $(obj)/Image.gz System.map "$(INSTALL_PATH)"
+60
arch/riscv/boot/install.sh
··· 1 + #!/bin/sh 2 + # 3 + # arch/riscv/boot/install.sh 4 + # 5 + # This file is subject to the terms and conditions of the GNU General Public 6 + # License. See the file "COPYING" in the main directory of this archive 7 + # for more details. 8 + # 9 + # Copyright (C) 1995 by Linus Torvalds 10 + # 11 + # Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin 12 + # Adapted from code in arch/i386/boot/install.sh by Russell King 13 + # 14 + # "make install" script for the RISC-V Linux port 15 + # 16 + # Arguments: 17 + # $1 - kernel version 18 + # $2 - kernel image file 19 + # $3 - kernel map file 20 + # $4 - default install path (blank if root directory) 21 + # 22 + 23 + verify () { 24 + if [ ! -f "$1" ]; then 25 + echo "" 1>&2 26 + echo " *** Missing file: $1" 1>&2 27 + echo ' *** You need to run "make" before "make install".' 1>&2 28 + echo "" 1>&2 29 + exit 1 30 + fi 31 + } 32 + 33 + # Make sure the files actually exist 34 + verify "$2" 35 + verify "$3" 36 + 37 + # User may have a custom install script 38 + if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 39 + if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 40 + 41 + if [ "$(basename $2)" = "Image.gz" ]; then 42 + # Compressed install 43 + echo "Installing compressed kernel" 44 + base=vmlinuz 45 + else 46 + # Normal install 47 + echo "Installing normal kernel" 48 + base=vmlinux 49 + fi 50 + 51 + if [ -f $4/$base-$1 ]; then 52 + mv $4/$base-$1 $4/$base-$1.old 53 + fi 54 + cat $2 > $4/$base-$1 55 + 56 + # Install system map file 57 + if [ -f $4/System.map-$1 ]; then 58 + mv $4/System.map-$1 $4/System.map-$1.old 59 + fi 60 + cp $3 $4/System.map-$1
+1
arch/riscv/include/asm/module.h
··· 8 8 9 9 #define MODULE_ARCH_VERMAGIC "riscv" 10 10 11 + struct module; 11 12 u64 module_emit_got_entry(struct module *mod, u64 val); 12 13 u64 module_emit_plt_entry(struct module *mod, u64 val); 13 14
+2 -2
arch/riscv/include/asm/uaccess.h
··· 400 400 static inline unsigned long 401 401 raw_copy_from_user(void *to, const void __user *from, unsigned long n) 402 402 { 403 - return __asm_copy_to_user(to, from, n); 403 + return __asm_copy_from_user(to, from, n); 404 404 } 405 405 406 406 static inline unsigned long 407 407 raw_copy_to_user(void __user *to, const void *from, unsigned long n) 408 408 { 409 - return __asm_copy_from_user(to, from, n); 409 + return __asm_copy_to_user(to, from, n); 410 410 } 411 411 412 412 extern long strncpy_from_user(char *dest, const char __user *src, long count);
+2 -3
arch/riscv/include/asm/unistd.h
··· 13 13 14 14 /* 15 15 * There is explicitly no include guard here because this file is expected to 16 - * be included multiple times. See uapi/asm/syscalls.h for more info. 16 + * be included multiple times. 17 17 */ 18 18 19 - #define __ARCH_WANT_NEW_STAT 20 19 #define __ARCH_WANT_SYS_CLONE 20 + 21 21 #include <uapi/asm/unistd.h> 22 - #include <uapi/asm/syscalls.h>
+19 -7
arch/riscv/include/uapi/asm/syscalls.h arch/riscv/include/uapi/asm/unistd.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 2 /* 3 - * Copyright (C) 2017-2018 SiFive 3 + * Copyright (C) 2018 David Abdurachmanov <david.abdurachmanov@gmail.com> 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License version 2 as 7 + * published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + * 14 + * You should have received a copy of the GNU General Public License 15 + * along with this program. If not, see <http://www.gnu.org/licenses/>. 4 16 */ 5 17 6 - /* 7 - * There is explicitly no include guard here because this file is expected to 8 - * be included multiple times in order to define the syscall macros via 9 - * __SYSCALL. 10 - */ 18 + #ifdef __LP64__ 19 + #define __ARCH_WANT_NEW_STAT 20 + #endif /* __LP64__ */ 21 + 22 + #include <asm-generic/unistd.h> 11 23 12 24 /* 13 25 * Allows the instruction cache to be flushed from userspace. Despite RISC-V
+6 -3
arch/riscv/kernel/cpu.c
··· 64 64 65 65 static void print_isa(struct seq_file *f, const char *orig_isa) 66 66 { 67 - static const char *ext = "mafdc"; 67 + static const char *ext = "mafdcsu"; 68 68 const char *isa = orig_isa; 69 69 const char *e; 70 70 ··· 88 88 /* 89 89 * Check the rest of the ISA string for valid extensions, printing those 90 90 * we find. RISC-V ISA strings define an order, so we only print the 91 - * extension bits when they're in order. 91 + * extension bits when they're in order. Hide the supervisor (S) 92 + * extension from userspace as it's not accessible from there. 92 93 */ 93 94 for (e = ext; *e != '\0'; ++e) { 94 95 if (isa[0] == e[0]) { 95 - seq_write(f, isa, 1); 96 + if (isa[0] != 's') 97 + seq_write(f, isa, 1); 98 + 96 99 isa++; 97 100 } 98 101 }
+10
arch/riscv/kernel/head.S
··· 44 44 amoadd.w a3, a2, (a3) 45 45 bnez a3, .Lsecondary_start 46 46 47 + /* Clear BSS for flat non-ELF images */ 48 + la a3, __bss_start 49 + la a4, __bss_stop 50 + ble a4, a3, clear_bss_done 51 + clear_bss: 52 + REG_S zero, (a3) 53 + add a3, a3, RISCV_SZPTR 54 + blt a3, a4, clear_bss 55 + clear_bss_done: 56 + 47 57 /* Save hart ID and DTB physical address */ 48 58 mv s0, a0 49 59 mv s1, a1
+1 -1
arch/riscv/kernel/vmlinux.lds.S
··· 74 74 *(.sbss*) 75 75 } 76 76 77 - BSS_SECTION(0, 0, 0) 77 + BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0) 78 78 79 79 EXCEPTION_TABLE(0x10) 80 80 NOTES