History

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

Linus Torvalds committed 7 years ago

Commit 74b13e72 parents c8864cb ae662ee10 files · +38 −19Browse files

Unified · Split

10 files
  1. arch/riscv/Kconfig +1 −1
  2. arch/riscv/configs/defconfig +5 −3
  3. arch/riscv/include/asm/page.h +1 −1
  4. arch/riscv/include/asm/processor.h +1 −1
  5. arch/riscv/kernel/asm-offsets.c +1 −0
  6. arch/riscv/kernel/entry.S +17 −1
  7. arch/riscv/kernel/setup.c +1 −1
  8. arch/riscv/kernel/smpboot.c +1 −5
  9. arch/riscv/mm/init.c +2 −1
  10. drivers/tty/serial/earlycon-riscv-sbi.c +8 −5
arch/riscv/Kconfig+1−1
@@ -103,7 +103,7 @@ choice · 102 unmodified lines
103 prompt "Base ISA"103 prompt "Base ISA"
104 default ARCH_RV64I104 default ARCH_RV64I
105 help105 help
106 This selects the base ISA that this kernel will traget and must match106 This selects the base ISA that this kernel will target and must match
107 the target platform.107 the target platform.
108 108
109config ARCH_RV32I109config ARCH_RV32I
arch/riscv/configs/defconfig+5−3
@@ -13,8 +13,6 @@ CONFIG_BLK_DEV_INITRD=y · 12 unmodified lines
13CONFIG_EXPERT=y13CONFIG_EXPERT=y
14CONFIG_BPF_SYSCALL=y14CONFIG_BPF_SYSCALL=y
15CONFIG_SMP=y15CONFIG_SMP=y
16CONFIG_PCI=y
17CONFIG_PCIE_XILINX=y
18CONFIG_MODULES=y16CONFIG_MODULES=y
19CONFIG_MODULE_UNLOAD=y17CONFIG_MODULE_UNLOAD=y
20CONFIG_NET=y18CONFIG_NET=y
@@ -28,6 +26,10 @@ CONFIG_IP_PNP_DHCP=y · 7 unmodified lines
28CONFIG_IP_PNP_BOOTP=y26CONFIG_IP_PNP_BOOTP=y
29CONFIG_IP_PNP_RARP=y27CONFIG_IP_PNP_RARP=y
30CONFIG_NETLINK_DIAG=y28CONFIG_NETLINK_DIAG=y
29CONFIG_PCI=y
30CONFIG_PCIEPORTBUS=y
31CONFIG_PCI_HOST_GENERIC=y
32CONFIG_PCIE_XILINX=y
31CONFIG_DEVTMPFS=y33CONFIG_DEVTMPFS=y
32CONFIG_BLK_DEV_LOOP=y34CONFIG_BLK_DEV_LOOP=y
33CONFIG_VIRTIO_BLK=y35CONFIG_VIRTIO_BLK=y
@@ -63,7 +65,6 @@ CONFIG_USB_STORAGE=y · 29 unmodified lines
63CONFIG_USB_UAS=y65CONFIG_USB_UAS=y
64CONFIG_VIRTIO_MMIO=y66CONFIG_VIRTIO_MMIO=y
65CONFIG_SIFIVE_PLIC=y67CONFIG_SIFIVE_PLIC=y
66CONFIG_RAS=y
67CONFIG_EXT4_FS=y68CONFIG_EXT4_FS=y
68CONFIG_EXT4_FS_POSIX_ACL=y69CONFIG_EXT4_FS_POSIX_ACL=y
69CONFIG_AUTOFS4_FS=y70CONFIG_AUTOFS4_FS=y
@@ -77,5 +78,6 @@ CONFIG_NFS_V4_1=y · 7 unmodified lines
77CONFIG_NFS_V4_2=y78CONFIG_NFS_V4_2=y
78CONFIG_ROOT_NFS=y79CONFIG_ROOT_NFS=y
79CONFIG_CRYPTO_USER_API_HASH=y80CONFIG_CRYPTO_USER_API_HASH=y
81CONFIG_CRYPTO_DEV_VIRTIO=y
80CONFIG_PRINTK_TIME=y82CONFIG_PRINTK_TIME=y
81# CONFIG_RCU_TRACE is not set83# CONFIG_RCU_TRACE is not set
arch/riscv/include/asm/page.h+1−1
@@ -80,7 +80,7 @@ typedef struct page *pgtable_t; · 79 unmodified lines
80#define __pgd(x) ((pgd_t) { (x) })80#define __pgd(x) ((pgd_t) { (x) })
81#define __pgprot(x) ((pgprot_t) { (x) })81#define __pgprot(x) ((pgprot_t) { (x) })
82 82
83#ifdef CONFIG_64BITS83#ifdef CONFIG_64BIT
84#define PTE_FMT "%016lx"84#define PTE_FMT "%016lx"
85#else85#else
86#define PTE_FMT "%08lx"86#define PTE_FMT "%08lx"
arch/riscv/include/asm/processor.h+1−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
22 * This decides where the kernel will search for a free chunk of vm22 * This decides where the kernel will search for a free chunk of vm
23 * space during mmap's.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#define STACK_TOP TASK_SIZE27#define STACK_TOP TASK_SIZE
28#define STACK_TOP_MAX STACK_TOP28#define STACK_TOP_MAX STACK_TOP
arch/riscv/kernel/asm-offsets.c+1−0
@@ -39,6 +39,7 @@ void asm_offsets(void) · 38 unmodified lines
39 OFFSET(TASK_STACK, task_struct, stack);39 OFFSET(TASK_STACK, task_struct, stack);
40 OFFSET(TASK_TI, task_struct, thread_info);40 OFFSET(TASK_TI, task_struct, thread_info);
41 OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags);41 OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags);
42 OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count);
42 OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp);43 OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp);
43 OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp);44 OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp);
44 OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu);45 OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu);
arch/riscv/kernel/entry.S+17−1
@@ -144,6 +144,10 @@ _save_context: · 143 unmodified lines
144 REG_L x2, PT_SP(sp)144 REG_L x2, PT_SP(sp)
145 .endm145 .endm
146 146
147#if !IS_ENABLED(CONFIG_PREEMPT)
148.set resume_kernel, restore_all
149#endif
150
147ENTRY(handle_exception)151ENTRY(handle_exception)
148 SAVE_ALL152 SAVE_ALL
149 153
@@ -228,7 +232,7 @@ ret_from_exception: · 78 unmodified lines
228 REG_L s0, PT_SSTATUS(sp)232 REG_L s0, PT_SSTATUS(sp)
229 csrc sstatus, SR_SIE233 csrc sstatus, SR_SIE
230 andi s0, s0, SR_SPP234 andi s0, s0, SR_SPP
231 bnez s0, restore_all235 bnez s0, resume_kernel
232 236
233resume_userspace:237resume_userspace:
234 /* Interrupts must be disabled here so flags are checked atomically */238 /* Interrupts must be disabled here so flags are checked atomically */
@@ -250,6 +254,18 @@ restore_all: · 15 unmodified lines
250 RESTORE_ALL254 RESTORE_ALL
251 sret255 sret
252 256
257#if IS_ENABLED(CONFIG_PREEMPT)
258resume_kernel:
259 REG_L s0, TASK_TI_PREEMPT_COUNT(tp)
260 bnez s0, restore_all
261need_resched:
262 REG_L s0, TASK_TI_FLAGS(tp)
263 andi s0, s0, _TIF_NEED_RESCHED
264 beqz s0, restore_all
265 call preempt_schedule_irq
266 j need_resched
267#endif
268
253work_pending:269work_pending:
254 /* Enter slow path for supplementary processing */270 /* Enter slow path for supplementary processing */
255 la ra, ret_from_exception271 la ra, ret_from_exception
arch/riscv/kernel/setup.c+1−1
@@ -181,7 +181,7 @@ static void __init setup_bootmem(void) · 180 unmodified lines
181 BUG_ON(mem_size == 0);181 BUG_ON(mem_size == 0);
182 182
183 set_max_mapnr(PFN_DOWN(mem_size));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#ifdef CONFIG_BLK_DEV_INITRD186#ifdef CONFIG_BLK_DEV_INITRD
187 setup_initrd();187 setup_initrd();
arch/riscv/kernel/smpboot.c+1−5
@@ -57,15 +57,12 @@ void __init setup_smp(void) · 56 unmodified lines
57 57
58 while ((dn = of_find_node_by_type(dn, "cpu"))) {58 while ((dn = of_find_node_by_type(dn, "cpu"))) {
59 hart = riscv_of_processor_hartid(dn);59 hart = riscv_of_processor_hartid(dn);
60 if (hart < 0) {60 if (hart < 0)
61 of_node_put(dn);
62 continue;61 continue;
63 }
64 62
65 if (hart == cpuid_to_hartid_map(0)) {63 if (hart == cpuid_to_hartid_map(0)) {
66 BUG_ON(found_boot_cpu);64 BUG_ON(found_boot_cpu);
67 found_boot_cpu = 1;65 found_boot_cpu = 1;
68 of_node_put(dn);
69 continue;66 continue;
70 }67 }
71 68
@@ -73,7 +70,6 @@ void __init setup_smp(void) · 1 unmodified line
73 set_cpu_possible(cpuid, true);70 set_cpu_possible(cpuid, true);
74 set_cpu_present(cpuid, true);71 set_cpu_present(cpuid, true);
75 cpuid++;72 cpuid++;
76 of_node_put(dn);
77 }73 }
78 74
79 BUG_ON(!found_boot_cpu);75 BUG_ON(!found_boot_cpu);
arch/riscv/mm/init.c+2−1
@@ -28,7 +28,8 @@ static void __init zone_sizes_init(void) · 27 unmodified lines
28 unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, };28 unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, };
29 29
30#ifdef CONFIG_ZONE_DMA3230#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#endif33#endif
33 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;34 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
34 35
drivers/tty/serial/earlycon-riscv-sbi.c+8−5
@@ -10,13 +10,16 @@ · 9 unmodified lines
10#include <linux/serial_core.h>10#include <linux/serial_core.h>
11#include <asm/sbi.h>11#include <asm/sbi.h>
12 12
13static void sbi_console_write(struct console *con,13static void sbi_putc(struct uart_port *port, int c)
14 const char *s, unsigned int n)
15{14{
16 int i;15 sbi_console_putchar(c);
16}
17 17
18 for (i = 0; i < n; ++i)18static void sbi_console_write(struct console *con,
19 sbi_console_putchar(s[i]);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
22static int __init early_sbi_setup(struct earlycon_device *device,25static int __init early_sbi_setup(struct earlycon_device *device,