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-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:
"This contains a handful of fixes that I would like to target for 5.6:

- A pair of fixes to module loading, which we hope solve the last of
the issues with module text being loaded too sparsely for our call
relocations.

- A Kconfig fix that disallows selecting memory models not supported
by NOMMU.

- A series of Kconfig updates to ease selecting the drivers necessary
to run on QEMU's virt platform.

- DTS updates for SiFive's HiFive Unleashed.

- A fix to our seccomp support that avoids mangling restartable
syscalls"

* tag 'riscv-for-linus-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
riscv: fix seccomp reject syscall code path
riscv: dts: Add GPIO reboot method to HiFive Unleashed DTS file
RISC-V: Select Goldfish RTC driver for QEMU virt machine
RISC-V: Select SYSCON Reboot and Poweroff for QEMU virt machine
RISC-V: Enable QEMU virt machine support in defconfigs
RISC-V: Add kconfig option for QEMU virt machine
riscv: Fix range looking for kernel image memblock
riscv: Force flat memory model with no-mmu
riscv: Change code model of module to medany to improve data accessing
riscv: avoid the PIC offset of static percpu data in module beyond 2G limits

+65 -53
+1
arch/riscv/Kconfig
··· 121 121 122 122 config ARCH_SPARSEMEM_ENABLE 123 123 def_bool y 124 + depends on MMU 124 125 select SPARSEMEM_VMEMMAP_ENABLE 125 126 126 127 config ARCH_SELECT_MEMORY_MODEL
+24
arch/riscv/Kconfig.socs
··· 10 10 help 11 11 This enables support for SiFive SoC platform hardware. 12 12 13 + config SOC_VIRT 14 + bool "QEMU Virt Machine" 15 + select VIRTIO_PCI 16 + select VIRTIO_BALLOON 17 + select VIRTIO_MMIO 18 + select VIRTIO_CONSOLE 19 + select VIRTIO_NET 20 + select NET_9P_VIRTIO 21 + select VIRTIO_BLK 22 + select SCSI_VIRTIO 23 + select DRM_VIRTIO_GPU 24 + select HW_RANDOM_VIRTIO 25 + select RPMSG_CHAR 26 + select RPMSG_VIRTIO 27 + select CRYPTO_DEV_VIRTIO 28 + select VIRTIO_INPUT 29 + select POWER_RESET_SYSCON 30 + select POWER_RESET_SYSCON_POWEROFF 31 + select GOLDFISH 32 + select RTC_DRV_GOLDFISH 33 + select SIFIVE_PLIC 34 + help 35 + This enables support for QEMU Virt Machine. 36 + 13 37 endmenu
+4 -2
arch/riscv/Makefile
··· 13 13 ifeq ($(CONFIG_DYNAMIC_FTRACE),y) 14 14 LDFLAGS_vmlinux := --no-relax 15 15 endif 16 - KBUILD_AFLAGS_MODULE += -fPIC 17 - KBUILD_CFLAGS_MODULE += -fPIC 16 + 17 + ifeq ($(CONFIG_64BIT)$(CONFIG_CMODEL_MEDLOW),yy) 18 + KBUILD_CFLAGS_MODULE += -mcmodel=medany 19 + endif 18 20 19 21 export BITS 20 22 ifeq ($(CONFIG_ARCH_RV64I),y)
+5
arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
··· 2 2 /* Copyright (c) 2018-2019 SiFive, Inc */ 3 3 4 4 #include "fu540-c000.dtsi" 5 + #include <dt-bindings/gpio/gpio.h> 5 6 6 7 /* Clock frequency (in Hz) of the PCB crystal for rtcclk */ 7 8 #define RTCCLK_FREQ 1000000 ··· 41 40 compatible = "fixed-clock"; 42 41 clock-frequency = <RTCCLK_FREQ>; 43 42 clock-output-names = "rtcclk"; 43 + }; 44 + gpio-restart { 45 + compatible = "gpio-restart"; 46 + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; 44 47 }; 45 48 }; 46 49
+3 -14
arch/riscv/configs/defconfig
··· 15 15 CONFIG_EXPERT=y 16 16 CONFIG_BPF_SYSCALL=y 17 17 CONFIG_SOC_SIFIVE=y 18 + CONFIG_SOC_VIRT=y 18 19 CONFIG_SMP=y 19 20 CONFIG_MODULES=y 20 21 CONFIG_MODULE_UNLOAD=y ··· 31 30 CONFIG_IP_PNP_RARP=y 32 31 CONFIG_NETLINK_DIAG=y 33 32 CONFIG_NET_9P=y 34 - CONFIG_NET_9P_VIRTIO=y 35 33 CONFIG_PCI=y 36 34 CONFIG_PCIEPORTBUS=y 37 35 CONFIG_PCI_HOST_GENERIC=y ··· 38 38 CONFIG_DEVTMPFS=y 39 39 CONFIG_DEVTMPFS_MOUNT=y 40 40 CONFIG_BLK_DEV_LOOP=y 41 - CONFIG_VIRTIO_BLK=y 42 41 CONFIG_BLK_DEV_SD=y 43 42 CONFIG_BLK_DEV_SR=y 44 - CONFIG_SCSI_VIRTIO=y 45 43 CONFIG_ATA=y 46 44 CONFIG_SATA_AHCI=y 47 45 CONFIG_SATA_AHCI_PLATFORM=y 48 46 CONFIG_NETDEVICES=y 49 - CONFIG_VIRTIO_NET=y 50 47 CONFIG_MACB=y 51 48 CONFIG_E1000E=y 52 49 CONFIG_R8169=y ··· 54 57 CONFIG_SERIAL_OF_PLATFORM=y 55 58 CONFIG_SERIAL_EARLYCON_RISCV_SBI=y 56 59 CONFIG_HVC_RISCV_SBI=y 57 - CONFIG_VIRTIO_CONSOLE=y 58 60 CONFIG_HW_RANDOM=y 59 - CONFIG_HW_RANDOM_VIRTIO=y 60 61 CONFIG_SPI=y 61 62 CONFIG_SPI_SIFIVE=y 62 63 # CONFIG_PTP_1588_CLOCK is not set 64 + CONFIG_POWER_RESET=y 63 65 CONFIG_DRM=y 64 66 CONFIG_DRM_RADEON=y 65 - CONFIG_DRM_VIRTIO_GPU=y 66 67 CONFIG_FRAMEBUFFER_CONSOLE=y 67 68 CONFIG_USB=y 68 69 CONFIG_USB_XHCI_HCD=y ··· 73 78 CONFIG_USB_UAS=y 74 79 CONFIG_MMC=y 75 80 CONFIG_MMC_SPI=y 76 - CONFIG_VIRTIO_PCI=y 77 - CONFIG_VIRTIO_BALLOON=y 78 - CONFIG_VIRTIO_INPUT=y 79 - CONFIG_VIRTIO_MMIO=y 80 - CONFIG_RPMSG_CHAR=y 81 - CONFIG_RPMSG_VIRTIO=y 81 + CONFIG_RTC_CLASS=y 82 82 CONFIG_EXT4_FS=y 83 83 CONFIG_EXT4_FS_POSIX_ACL=y 84 84 CONFIG_AUTOFS4_FS=y ··· 88 98 CONFIG_ROOT_NFS=y 89 99 CONFIG_9P_FS=y 90 100 CONFIG_CRYPTO_USER_API_HASH=y 91 - CONFIG_CRYPTO_DEV_VIRTIO=y 92 101 CONFIG_PRINTK_TIME=y 93 102 CONFIG_DEBUG_FS=y 94 103 CONFIG_DEBUG_PAGEALLOC=y
+3 -15
arch/riscv/configs/rv32_defconfig
··· 14 14 CONFIG_BLK_DEV_INITRD=y 15 15 CONFIG_EXPERT=y 16 16 CONFIG_BPF_SYSCALL=y 17 + CONFIG_SOC_VIRT=y 17 18 CONFIG_ARCH_RV32I=y 18 19 CONFIG_SMP=y 19 20 CONFIG_MODULES=y ··· 31 30 CONFIG_IP_PNP_RARP=y 32 31 CONFIG_NETLINK_DIAG=y 33 32 CONFIG_NET_9P=y 34 - CONFIG_NET_9P_VIRTIO=y 35 33 CONFIG_PCI=y 36 34 CONFIG_PCIEPORTBUS=y 37 35 CONFIG_PCI_HOST_GENERIC=y ··· 38 38 CONFIG_DEVTMPFS=y 39 39 CONFIG_DEVTMPFS_MOUNT=y 40 40 CONFIG_BLK_DEV_LOOP=y 41 - CONFIG_VIRTIO_BLK=y 42 41 CONFIG_BLK_DEV_SD=y 43 42 CONFIG_BLK_DEV_SR=y 44 - CONFIG_SCSI_VIRTIO=y 45 43 CONFIG_ATA=y 46 44 CONFIG_SATA_AHCI=y 47 45 CONFIG_SATA_AHCI_PLATFORM=y 48 46 CONFIG_NETDEVICES=y 49 - CONFIG_VIRTIO_NET=y 50 47 CONFIG_MACB=y 51 48 CONFIG_E1000E=y 52 49 CONFIG_R8169=y ··· 54 57 CONFIG_SERIAL_OF_PLATFORM=y 55 58 CONFIG_SERIAL_EARLYCON_RISCV_SBI=y 56 59 CONFIG_HVC_RISCV_SBI=y 57 - CONFIG_VIRTIO_CONSOLE=y 58 60 CONFIG_HW_RANDOM=y 59 - CONFIG_HW_RANDOM_VIRTIO=y 60 61 # CONFIG_PTP_1588_CLOCK is not set 62 + CONFIG_POWER_RESET=y 61 63 CONFIG_DRM=y 62 64 CONFIG_DRM_RADEON=y 63 - CONFIG_DRM_VIRTIO_GPU=y 64 65 CONFIG_FRAMEBUFFER_CONSOLE=y 65 66 CONFIG_USB=y 66 67 CONFIG_USB_XHCI_HCD=y ··· 69 74 CONFIG_USB_OHCI_HCD_PLATFORM=y 70 75 CONFIG_USB_STORAGE=y 71 76 CONFIG_USB_UAS=y 72 - CONFIG_VIRTIO_PCI=y 73 - CONFIG_VIRTIO_BALLOON=y 74 - CONFIG_VIRTIO_INPUT=y 75 - CONFIG_VIRTIO_MMIO=y 76 - CONFIG_RPMSG_CHAR=y 77 - CONFIG_RPMSG_VIRTIO=y 78 - CONFIG_SIFIVE_PLIC=y 77 + CONFIG_RTC_CLASS=y 79 78 CONFIG_EXT4_FS=y 80 79 CONFIG_EXT4_FS_POSIX_ACL=y 81 80 CONFIG_AUTOFS4_FS=y ··· 84 95 CONFIG_ROOT_NFS=y 85 96 CONFIG_9P_FS=y 86 97 CONFIG_CRYPTO_USER_API_HASH=y 87 - CONFIG_CRYPTO_DEV_VIRTIO=y 88 98 CONFIG_PRINTK_TIME=y 89 99 CONFIG_DEBUG_FS=y 90 100 CONFIG_DEBUG_PAGEALLOC=y
-7
arch/riscv/include/asm/syscall.h
··· 28 28 return regs->a7; 29 29 } 30 30 31 - static inline void syscall_set_nr(struct task_struct *task, 32 - struct pt_regs *regs, 33 - int sysno) 34 - { 35 - regs->a7 = sysno; 36 - } 37 - 38 31 static inline void syscall_rollback(struct task_struct *task, 39 32 struct pt_regs *regs) 40 33 {
+3 -8
arch/riscv/kernel/entry.S
··· 229 229 li t0, __NR_syscalls 230 230 la s0, sys_ni_syscall 231 231 /* 232 - * The tracer can change syscall number to valid/invalid value. 233 - * We use syscall_set_nr helper in syscall_trace_enter thus we 234 - * cannot trust the current value in a7 and have to reload from 235 - * the current task pt_regs. 236 - */ 237 - REG_L a7, PT_A7(sp) 238 - /* 239 232 * Syscall number held in a7. 240 233 * If syscall number is above allowed value, redirect to ni_syscall. 241 234 */ 242 235 bge a7, t0, 1f 243 236 /* 244 - * Check if syscall is rejected by tracer or seccomp, i.e., a7 == -1. 237 + * Check if syscall is rejected by tracer, i.e., a7 == -1. 245 238 * If yes, we pretend it was executed. 246 239 */ 247 240 li t1, -1 ··· 327 334 handle_syscall_trace_enter: 328 335 move a0, sp 329 336 call do_syscall_trace_enter 337 + move t0, a0 330 338 REG_L a0, PT_A0(sp) 331 339 REG_L a1, PT_A1(sp) 332 340 REG_L a2, PT_A2(sp) ··· 336 342 REG_L a5, PT_A5(sp) 337 343 REG_L a6, PT_A6(sp) 338 344 REG_L a7, PT_A7(sp) 345 + bnez t0, ret_from_syscall_rejected 339 346 j check_syscall_nr 340 347 handle_syscall_trace_exit: 341 348 move a0, sp
+16
arch/riscv/kernel/module.c
··· 8 8 #include <linux/err.h> 9 9 #include <linux/errno.h> 10 10 #include <linux/moduleloader.h> 11 + #include <linux/vmalloc.h> 12 + #include <linux/sizes.h> 13 + #include <asm/pgtable.h> 14 + #include <asm/sections.h> 11 15 12 16 static int apply_r_riscv_32_rela(struct module *me, u32 *location, Elf_Addr v) 13 17 { ··· 390 386 391 387 return 0; 392 388 } 389 + 390 + #if defined(CONFIG_MMU) && defined(CONFIG_64BIT) 391 + #define VMALLOC_MODULE_START \ 392 + max(PFN_ALIGN((unsigned long)&_end - SZ_2G), VMALLOC_START) 393 + void *module_alloc(unsigned long size) 394 + { 395 + return __vmalloc_node_range(size, 1, VMALLOC_MODULE_START, 396 + VMALLOC_END, GFP_KERNEL, 397 + PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, 398 + __builtin_return_address(0)); 399 + } 400 + #endif
+5 -6
arch/riscv/kernel/ptrace.c
··· 148 148 * Allows PTRACE_SYSCALL to work. These are called from entry.S in 149 149 * {handle,ret_from}_syscall. 150 150 */ 151 - __visible void do_syscall_trace_enter(struct pt_regs *regs) 151 + __visible int do_syscall_trace_enter(struct pt_regs *regs) 152 152 { 153 153 if (test_thread_flag(TIF_SYSCALL_TRACE)) 154 154 if (tracehook_report_syscall_entry(regs)) 155 - syscall_set_nr(current, regs, -1); 155 + return -1; 156 156 157 157 /* 158 158 * Do the secure computing after ptrace; failures should be fast. 159 159 * If this fails we might have return value in a0 from seccomp 160 160 * (via SECCOMP_RET_ERRNO/TRACE). 161 161 */ 162 - if (secure_computing() == -1) { 163 - syscall_set_nr(current, regs, -1); 164 - return; 165 - } 162 + if (secure_computing() == -1) 163 + return -1; 166 164 167 165 #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS 168 166 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) ··· 168 170 #endif 169 171 170 172 audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3); 173 + return 0; 171 174 } 172 175 173 176 __visible void do_syscall_trace_exit(struct pt_regs *regs)
+1 -1
arch/riscv/mm/init.c
··· 131 131 for_each_memblock(memory, reg) { 132 132 phys_addr_t end = reg->base + reg->size; 133 133 134 - if (reg->base <= vmlinux_end && vmlinux_end <= end) { 134 + if (reg->base <= vmlinux_start && vmlinux_end <= end) { 135 135 mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET); 136 136 137 137 /*