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

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

Pull RISC-V fixes from Palmer Dabbelt:
"This contains a handful of mostly-independent patches:

- make our port respect TIF_NEED_RESCHED, which fixes
CONFIG_PREEMPT=y kernels

- fix double-put of OF nodes

- fix a misspelling of target in our Kconfig

- generic PCIe is enabled in our defconfig

- fix our SBI early console to properly handle line
endings

- fix max_low_pfn being counted in PFNs

- a change to TASK_UNMAPPED_BASE to match what other
arches do

This has passed my standard 'boot Fedora' flow"

* tag 'riscv-for-linus-5.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux:
riscv: Adjust mmap base address at a third of task size
riscv: fixup max_low_pfn with PFN_DOWN.
tty/serial: use uart_console_write in the RISC-V SBL early console
RISC-V: defconfig: Add CRYPTO_DEV_VIRTIO=y
RISC-V: defconfig: Enable Generic PCIE by default
RISC-V: defconfig: Move CONFIG_PCI{,E_XILINX}
RISC-V: Kconfig: fix spelling mistake "traget" -> "target"
RISC-V: asm/page.h: fix spelling mistake "CONFIG_64BITS" -> "CONFIG_64BIT"
RISC-V: fix bad use of of_node_put
RISC-V: Add _TIF_NEED_RESCHED check for kernel thread when CONFIG_PREEMPT=y

+38 -19
+1 -1
arch/riscv/Kconfig
··· 103 103 prompt "Base ISA" 104 104 default ARCH_RV64I 105 105 help 106 - This selects the base ISA that this kernel will traget and must match 106 + This selects the base ISA that this kernel will target and must match 107 107 the target platform. 108 108 109 109 config ARCH_RV32I
+5 -3
arch/riscv/configs/defconfig
··· 13 13 CONFIG_EXPERT=y 14 14 CONFIG_BPF_SYSCALL=y 15 15 CONFIG_SMP=y 16 - CONFIG_PCI=y 17 - CONFIG_PCIE_XILINX=y 18 16 CONFIG_MODULES=y 19 17 CONFIG_MODULE_UNLOAD=y 20 18 CONFIG_NET=y ··· 26 28 CONFIG_IP_PNP_BOOTP=y 27 29 CONFIG_IP_PNP_RARP=y 28 30 CONFIG_NETLINK_DIAG=y 31 + CONFIG_PCI=y 32 + CONFIG_PCIEPORTBUS=y 33 + CONFIG_PCI_HOST_GENERIC=y 34 + CONFIG_PCIE_XILINX=y 29 35 CONFIG_DEVTMPFS=y 30 36 CONFIG_BLK_DEV_LOOP=y 31 37 CONFIG_VIRTIO_BLK=y ··· 65 63 CONFIG_USB_UAS=y 66 64 CONFIG_VIRTIO_MMIO=y 67 65 CONFIG_SIFIVE_PLIC=y 68 - CONFIG_RAS=y 69 66 CONFIG_EXT4_FS=y 70 67 CONFIG_EXT4_FS_POSIX_ACL=y 71 68 CONFIG_AUTOFS4_FS=y ··· 78 77 CONFIG_NFS_V4_2=y 79 78 CONFIG_ROOT_NFS=y 80 79 CONFIG_CRYPTO_USER_API_HASH=y 80 + CONFIG_CRYPTO_DEV_VIRTIO=y 81 81 CONFIG_PRINTK_TIME=y 82 82 # CONFIG_RCU_TRACE is not set
+1 -1
arch/riscv/include/asm/page.h
··· 80 80 #define __pgd(x) ((pgd_t) { (x) }) 81 81 #define __pgprot(x) ((pgprot_t) { (x) }) 82 82 83 - #ifdef CONFIG_64BITS 83 + #ifdef CONFIG_64BIT 84 84 #define PTE_FMT "%016lx" 85 85 #else 86 86 #define PTE_FMT "%08lx"
+1 -1
arch/riscv/include/asm/processor.h
··· 22 22 * This decides where the kernel will search for a free chunk of vm 23 23 * space during mmap's. 24 24 */ 25 - #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE >> 1) 25 + #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) 26 26 27 27 #define STACK_TOP TASK_SIZE 28 28 #define STACK_TOP_MAX STACK_TOP
+1
arch/riscv/kernel/asm-offsets.c
··· 39 39 OFFSET(TASK_STACK, task_struct, stack); 40 40 OFFSET(TASK_TI, task_struct, thread_info); 41 41 OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); 42 + OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count); 42 43 OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); 43 44 OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp); 44 45 OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu);
+17 -1
arch/riscv/kernel/entry.S
··· 144 144 REG_L x2, PT_SP(sp) 145 145 .endm 146 146 147 + #if !IS_ENABLED(CONFIG_PREEMPT) 148 + .set resume_kernel, restore_all 149 + #endif 150 + 147 151 ENTRY(handle_exception) 148 152 SAVE_ALL 149 153 ··· 232 228 REG_L s0, PT_SSTATUS(sp) 233 229 csrc sstatus, SR_SIE 234 230 andi s0, s0, SR_SPP 235 - bnez s0, restore_all 231 + bnez s0, resume_kernel 236 232 237 233 resume_userspace: 238 234 /* Interrupts must be disabled here so flags are checked atomically */ ··· 253 249 restore_all: 254 250 RESTORE_ALL 255 251 sret 252 + 253 + #if IS_ENABLED(CONFIG_PREEMPT) 254 + resume_kernel: 255 + REG_L s0, TASK_TI_PREEMPT_COUNT(tp) 256 + bnez s0, restore_all 257 + need_resched: 258 + REG_L s0, TASK_TI_FLAGS(tp) 259 + andi s0, s0, _TIF_NEED_RESCHED 260 + beqz s0, restore_all 261 + call preempt_schedule_irq 262 + j need_resched 263 + #endif 256 264 257 265 work_pending: 258 266 /* Enter slow path for supplementary processing */
+1 -1
arch/riscv/kernel/setup.c
··· 181 181 BUG_ON(mem_size == 0); 182 182 183 183 set_max_mapnr(PFN_DOWN(mem_size)); 184 - max_low_pfn = memblock_end_of_DRAM(); 184 + max_low_pfn = PFN_DOWN(memblock_end_of_DRAM()); 185 185 186 186 #ifdef CONFIG_BLK_DEV_INITRD 187 187 setup_initrd();
+1 -5
arch/riscv/kernel/smpboot.c
··· 57 57 58 58 while ((dn = of_find_node_by_type(dn, "cpu"))) { 59 59 hart = riscv_of_processor_hartid(dn); 60 - if (hart < 0) { 61 - of_node_put(dn); 60 + if (hart < 0) 62 61 continue; 63 - } 64 62 65 63 if (hart == cpuid_to_hartid_map(0)) { 66 64 BUG_ON(found_boot_cpu); 67 65 found_boot_cpu = 1; 68 - of_node_put(dn); 69 66 continue; 70 67 } 71 68 ··· 70 73 set_cpu_possible(cpuid, true); 71 74 set_cpu_present(cpuid, true); 72 75 cpuid++; 73 - of_node_put(dn); 74 76 } 75 77 76 78 BUG_ON(!found_boot_cpu);
+2 -1
arch/riscv/mm/init.c
··· 28 28 unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, }; 29 29 30 30 #ifdef CONFIG_ZONE_DMA32 31 - max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G, max_low_pfn)); 31 + max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G, 32 + (unsigned long) PFN_PHYS(max_low_pfn))); 32 33 #endif 33 34 max_zone_pfns[ZONE_NORMAL] = max_low_pfn; 34 35
+8 -5
drivers/tty/serial/earlycon-riscv-sbi.c
··· 10 10 #include <linux/serial_core.h> 11 11 #include <asm/sbi.h> 12 12 13 - static void sbi_console_write(struct console *con, 14 - const char *s, unsigned int n) 13 + static void sbi_putc(struct uart_port *port, int c) 15 14 { 16 - int i; 15 + sbi_console_putchar(c); 16 + } 17 17 18 - for (i = 0; i < n; ++i) 19 - sbi_console_putchar(s[i]); 18 + static void sbi_console_write(struct console *con, 19 + const char *s, unsigned n) 20 + { 21 + struct earlycon_device *dev = con->data; 22 + uart_console_write(&dev->port, s, n, sbi_putc); 20 23 } 21 24 22 25 static int __init early_sbi_setup(struct earlycon_device *device,