Pull RISC-V fixes from Paul Walmsley: "One fix for PCIe users: - Fix legacy PCI I/O port access emulation One set of cleanups: - Resolve most of the warnings generated by sparse across arch/riscv. No functional changes And one MAINTAINERS update: - Update Palmer's E-mail address" * tag 'riscv/for-v5.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: MAINTAINERS: Change to my personal email address RISC-V: Add PCIe I/O BAR memory mapping riscv: for C functions called only from assembly, mark with __visible riscv: fp: add missing __user pointer annotations riscv: add missing header file includes riscv: mark some code and data as file-static riscv: init: merge split string literals in preprocessor directive riscv: add prototypes for assembly language functions from head.S
Unified · Split
| @@ -13906,7 +13906,7 @@ F: drivers/mtd/nand/raw/r852.h · 13905 unmodified lines | ||
| 13906 | 13906 | |
| 13907 | 13907 | RISC-V ARCHITECTURE |
| 13908 | 13908 | M: Paul Walmsley <paul.walmsley@sifive.com> |
| 13909 | −M: Palmer Dabbelt <palmer@sifive.com> | |
| 13909 | +M: Palmer Dabbelt <palmer@dabbelt.com> | |
| 13910 | 13910 | M: Albert Ou <aou@eecs.berkeley.edu> |
| 13911 | 13911 | L: linux-riscv@lists.infradead.org |
| 13912 | 13912 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git |
| @@ -14783,7 +14783,7 @@ F: drivers/media/usb/siano/ · 870 unmodified lines | ||
| 14783 | 14783 | F: drivers/media/mmc/siano/ |
| 14784 | 14784 | |
| 14785 | 14785 | SIFIVE DRIVERS |
| 14786 | −M: Palmer Dabbelt <palmer@sifive.com> | |
| 14786 | +M: Palmer Dabbelt <palmer@dabbelt.com> | |
| 14787 | 14787 | M: Paul Walmsley <paul.walmsley@sifive.com> |
| 14788 | 14788 | L: linux-riscv@lists.infradead.org |
| 14789 | 14789 | T: git git://github.com/sifive/riscv-linux.git |
| @@ -14793,7 +14793,7 @@ N: sifive · 3 unmodified lines | ||
| 14793 | 14793 | |
| 14794 | 14794 | SIFIVE FU540 SYSTEM-ON-CHIP |
| 14795 | 14795 | M: Paul Walmsley <paul.walmsley@sifive.com> |
| 14796 | −M: Palmer Dabbelt <palmer@sifive.com> | |
| 14796 | +M: Palmer Dabbelt <palmer@dabbelt.com> | |
| 14797 | 14797 | L: linux-riscv@lists.infradead.org |
| 14798 | 14798 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git |
| 14799 | 14799 | S: Supported |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | #include <linux/types.h> |
| 15 | 15 | #include <asm/mmiowb.h> |
| 16 | +#include <asm/pgtable.h> | |
| 16 | 17 | |
| 17 | 18 | extern void __iomem *ioremap(phys_addr_t offset, unsigned long size); |
| 18 | 19 | |
| @@ -161,6 +162,12 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) · 142 unmodified lines | ||
| 161 | 162 | #define writeq(v,c) ({ __io_bw(); writeq_cpu((v),(c)); __io_aw(); }) |
| 162 | 163 | #endif |
| 163 | 164 | |
| 165 | +/* | |
| 166 | + * I/O port access constants. | |
| 167 | + */ | |
| 168 | +#define IO_SPACE_LIMIT (PCI_IO_SIZE - 1) | |
| 169 | +#define PCI_IOBASE ((void __iomem *)PCI_IO_START) | |
| 170 | + | |
| 164 | 171 | /* |
| 165 | 172 | * Emulation routines for the port-mapped IO space used by some PCI drivers. |
| 166 | 173 | * These are defined as being "fully synchronous", but also "not guaranteed to |
| @@ -7,6 +7,9 @@ · 6 unmodified lines | ||
| 7 | 7 | #ifndef _ASM_RISCV_IRQ_H |
| 8 | 8 | #define _ASM_RISCV_IRQ_H |
| 9 | 9 | |
| 10 | +#include <linux/interrupt.h> | |
| 11 | +#include <linux/linkage.h> | |
| 12 | + | |
| 10 | 13 | #define NR_IRQS 0 |
| 11 | 14 | |
| 12 | 15 | void riscv_timer_interrupt(void); |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #define _ASM_RISCV_PGTABLE_H |
| 8 | 8 | |
| 9 | 9 | #include <linux/mmzone.h> |
| 10 | +#include <linux/sizes.h> | |
| 10 | 11 | |
| 11 | 12 | #include <asm/pgtable-bits.h> |
| 12 | 13 | |
| @@ -86,6 +87,7 @@ extern pgd_t swapper_pg_dir[]; · 73 unmodified lines | ||
| 86 | 87 | #define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1) |
| 87 | 88 | #define VMALLOC_END (PAGE_OFFSET - 1) |
| 88 | 89 | #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE) |
| 90 | +#define PCI_IO_SIZE SZ_16M | |
| 89 | 91 | |
| 90 | 92 | /* |
| 91 | 93 | * Roughly size the vmemmap space to be large enough to fit enough |
| @@ -100,7 +102,10 @@ extern pgd_t swapper_pg_dir[]; · 8 unmodified lines | ||
| 100 | 102 | |
| 101 | 103 | #define vmemmap ((struct page *)VMEMMAP_START) |
| 102 | 104 | |
| 103 | −#define FIXADDR_TOP (VMEMMAP_START) | |
| 105 | +#define PCI_IO_END VMEMMAP_START | |
| 106 | +#define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE) | |
| 107 | +#define FIXADDR_TOP PCI_IO_START | |
| 108 | + | |
| 104 | 109 | #ifdef CONFIG_64BIT |
| 105 | 110 | #define FIXADDR_SIZE PMD_SIZE |
| 106 | 111 | #else |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | #ifndef _ASM_RISCV_SWITCH_TO_H |
| 7 | 7 | #define _ASM_RISCV_SWITCH_TO_H |
| 8 | 8 | |
| 9 | +#include <linux/sched/task_stack.h> | |
| 9 | 10 | #include <asm/processor.h> |
| 10 | 11 | #include <asm/ptrace.h> |
| 11 | 12 | #include <asm/csr.h> |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <asm/processor.h> |
| 11 | 11 | #include <asm/hwcap.h> |
| 12 | 12 | #include <asm/smp.h> |
| 13 | +#include <asm/switch_to.h> | |
| 13 | 14 | |
| 14 | 15 | unsigned long elf_hwcap __read_mostly; |
| 15 | 16 | #ifdef CONFIG_FPU |
| @@ -0,0 +1,21 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +/* | |
| 3 | + * Copyright (C) 2019 SiFive, Inc. | |
| 4 | + */ | |
| 5 | +#ifndef __ASM_HEAD_H | |
| 6 | +#define __ASM_HEAD_H | |
| 7 | + | |
| 8 | +#include <linux/linkage.h> | |
| 9 | +#include <linux/init.h> | |
| 10 | + | |
| 11 | +extern atomic_t hart_lottery; | |
| 12 | + | |
| 13 | +asmlinkage void do_page_fault(struct pt_regs *regs); | |
| 14 | +asmlinkage void __init setup_vm(uintptr_t dtb_pa); | |
| 15 | + | |
| 16 | +extern void *__cpu_up_stack_pointer[]; | |
| 17 | +extern void *__cpu_up_task_pointer[]; | |
| 18 | + | |
| 19 | +void __init parse_dtb(void); | |
| 20 | + | |
| 21 | +#endif /* __ASM_HEAD_H */ | |
| @@ -24,7 +24,7 @@ int arch_show_interrupts(struct seq_file *p, int prec) · 23 unmodified lines | ||
| 24 | 24 | return 0; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | −asmlinkage void __irq_entry do_IRQ(struct pt_regs *regs) | |
| 27 | +asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs) | |
| 28 | 28 | { |
| 29 | 29 | struct pt_regs *old_regs = set_irq_regs(regs); |
| 30 | 30 | |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/elf.h> |
| 9 | 9 | #include <linux/kernel.h> |
| 10 | 10 | #include <linux/module.h> |
| 11 | +#include <linux/moduleloader.h> | |
| 11 | 12 | |
| 12 | 13 | unsigned long module_emit_got_entry(struct module *mod, unsigned long val) |
| 13 | 14 | { |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | * Copyright (C) 2017 SiFive |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | +#include <linux/cpu.h> | |
| 10 | 11 | #include <linux/kernel.h> |
| 11 | 12 | #include <linux/sched.h> |
| 12 | 13 | #include <linux/sched/task_stack.h> |
| @@ -19,6 +20,7 @@ · 6 unmodified lines | ||
| 19 | 20 | #include <asm/csr.h> |
| 20 | 21 | #include <asm/string.h> |
| 21 | 22 | #include <asm/switch_to.h> |
| 23 | +#include <asm/thread_info.h> | |
| 22 | 24 | |
| 23 | 25 | extern asmlinkage void ret_from_fork(void); |
| 24 | 26 | extern asmlinkage void ret_from_kernel_thread(void); |
| @@ -148,7 +148,7 @@ long arch_ptrace(struct task_struct *child, long request, · 147 unmodified lines | ||
| 148 | 148 | * Allows PTRACE_SYSCALL to work. These are called from entry.S in |
| 149 | 149 | * {handle,ret_from}_syscall. |
| 150 | 150 | */ |
| 151 | −void do_syscall_trace_enter(struct pt_regs *regs) | |
| 151 | +__visible void 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)) |
| @@ -162,7 +162,7 @@ void do_syscall_trace_enter(struct pt_regs *regs) · 7 unmodified lines | ||
| 162 | 162 | audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | −void do_syscall_trace_exit(struct pt_regs *regs) | |
| 165 | +__visible void do_syscall_trace_exit(struct pt_regs *regs) | |
| 166 | 166 | { |
| 167 | 167 | audit_syscall_exit(regs); |
| 168 | 168 | |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include <linux/reboot.h> |
| 7 | +#include <linux/pm.h> | |
| 7 | 8 | #include <asm/sbi.h> |
| 8 | 9 | |
| 9 | 10 | static void default_power_off(void) |
| @@ -24,6 +24,8 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <asm/tlbflush.h> |
| 25 | 25 | #include <asm/thread_info.h> |
| 26 | 26 | |
| 27 | +#include "head.h" | |
| 28 | + | |
| 27 | 29 | #ifdef CONFIG_DUMMY_CONSOLE |
| 28 | 30 | struct screen_info screen_info = { |
| 29 | 31 | .orig_video_lines = 30, |
| @@ -26,7 +26,7 @@ struct rt_sigframe { · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | #ifdef CONFIG_FPU |
| 28 | 28 | static long restore_fp_state(struct pt_regs *regs, |
| 29 | − union __riscv_fp_state *sc_fpregs) | |
| 29 | + union __riscv_fp_state __user *sc_fpregs) | |
| 30 | 30 | { |
| 31 | 31 | long err; |
| 32 | 32 | struct __riscv_d_ext_state __user *state = &sc_fpregs->d; |
| @@ -53,7 +53,7 @@ static long restore_fp_state(struct pt_regs *regs, · 20 unmodified lines | ||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | static long save_fp_state(struct pt_regs *regs, |
| 56 | − union __riscv_fp_state *sc_fpregs) | |
| 56 | + union __riscv_fp_state __user *sc_fpregs) | |
| 57 | 57 | { |
| 58 | 58 | long err; |
| 59 | 59 | struct __riscv_d_ext_state __user *state = &sc_fpregs->d; |
| @@ -292,8 +292,8 @@ static void do_signal(struct pt_regs *regs) · 232 unmodified lines | ||
| 292 | 292 | * notification of userspace execution resumption |
| 293 | 293 | * - triggered by the _TIF_WORK_MASK flags |
| 294 | 294 | */ |
| 295 | −asmlinkage void do_notify_resume(struct pt_regs *regs, | |
| 296 | − unsigned long thread_info_flags) | |
| 295 | +asmlinkage __visible void do_notify_resume(struct pt_regs *regs, | |
| 296 | + unsigned long thread_info_flags) | |
| 297 | 297 | { |
| 298 | 298 | /* Handle pending signal delivery */ |
| 299 | 299 | if (thread_info_flags & _TIF_SIGPENDING) |
| @@ -8,7 +8,9 @@ · 7 unmodified lines | ||
| 8 | 8 | * Copyright (C) 2017 SiFive |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | +#include <linux/cpu.h> | |
| 11 | 12 | #include <linux/interrupt.h> |
| 13 | +#include <linux/profile.h> | |
| 12 | 14 | #include <linux/smp.h> |
| 13 | 15 | #include <linux/sched.h> |
| 14 | 16 | #include <linux/seq_file.h> |
| @@ -29,6 +29,9 @@ · 28 unmodified lines | ||
| 29 | 29 | #include <asm/tlbflush.h> |
| 30 | 30 | #include <asm/sections.h> |
| 31 | 31 | #include <asm/sbi.h> |
| 32 | +#include <asm/smp.h> | |
| 33 | + | |
| 34 | +#include "head.h" | |
| 32 | 35 | |
| 33 | 36 | void *__cpu_up_stack_pointer[NR_CPUS]; |
| 34 | 37 | void *__cpu_up_task_pointer[NR_CPUS]; |
| @@ -130,7 +133,7 @@ void __init smp_cpus_done(unsigned int max_cpus) · 95 unmodified lines | ||
| 130 | 133 | /* |
| 131 | 134 | * C entry point for a secondary processor. |
| 132 | 135 | */ |
| 133 | −asmlinkage void __init smp_callin(void) | |
| 136 | +asmlinkage __visible void __init smp_callin(void) | |
| 134 | 137 | { |
| 135 | 138 | struct mm_struct *mm = &init_mm; |
| 136 | 139 | |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/syscalls.h> |
| 9 | 9 | #include <asm-generic/syscalls.h> |
| 10 | 10 | #include <asm/vdso.h> |
| 11 | +#include <asm/syscall.h> | |
| 11 | 12 | |
| 12 | 13 | #undef __SYSCALL |
| 13 | 14 | #define __SYSCALL(nr, call) [nr] = (call), |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/clocksource.h> |
| 8 | 8 | #include <linux/delay.h> |
| 9 | 9 | #include <asm/sbi.h> |
| 10 | +#include <asm/processor.h> | |
| 10 | 11 | |
| 11 | 12 | unsigned long riscv_timebase; |
| 12 | 13 | EXPORT_SYMBOL_GPL(riscv_timebase); |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright (C) 2012 Regents of the University of California |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +#include <linux/cpu.h> | |
| 6 | 7 | #include <linux/kernel.h> |
| 7 | 8 | #include <linux/init.h> |
| 8 | 9 | #include <linux/sched.h> |
| @@ -83,7 +84,7 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code, · 74 unmodified lines | ||
| 83 | 84 | } |
| 84 | 85 | |
| 85 | 86 | #define DO_ERROR_INFO(name, signo, code, str) \ |
| 86 | −asmlinkage void name(struct pt_regs *regs) \ | |
| 87 | +asmlinkage __visible void name(struct pt_regs *regs) \ | |
| 87 | 88 | { \ |
| 88 | 89 | do_trap_error(regs, signo, code, regs->sepc, "Oops - " str); \ |
| 89 | 90 | } |
| @@ -120,7 +121,7 @@ static inline unsigned long get_break_insn_length(unsigned long pc) · 30 unmodified lines | ||
| 120 | 121 | return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL); |
| 121 | 122 | } |
| 122 | 123 | |
| 123 | −asmlinkage void do_trap_break(struct pt_regs *regs) | |
| 124 | +asmlinkage __visible void do_trap_break(struct pt_regs *regs) | |
| 124 | 125 | { |
| 125 | 126 | if (user_mode(regs)) |
| 126 | 127 | force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc); |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | * Copyright (C) 2015 Regents of the University of California |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +#include <linux/elf.h> | |
| 9 | 10 | #include <linux/mm.h> |
| 10 | 11 | #include <linux/slab.h> |
| 11 | 12 | #include <linux/binfmts.h> |
| @@ -25,7 +26,7 @@ static union { · 13 unmodified lines | ||
| 25 | 26 | struct vdso_data data; |
| 26 | 27 | u8 page[PAGE_SIZE]; |
| 27 | 28 | } vdso_data_store __page_aligned_data; |
| 28 | −struct vdso_data *vdso_data = &vdso_data_store.data; | |
| 29 | +static struct vdso_data *vdso_data = &vdso_data_store.data; | |
| 29 | 30 | |
| 30 | 31 | static int __init vdso_init(void) |
| 31 | 32 | { |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/mm.h> |
| 8 | 8 | #include <asm/tlbflush.h> |
| 9 | 9 | #include <asm/cacheflush.h> |
| 10 | +#include <asm/mmu_context.h> | |
| 10 | 11 | |
| 11 | 12 | /* |
| 12 | 13 | * When necessary, performs a deferred icache flush for the given MM context, |
| @@ -18,6 +18,8 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <asm/ptrace.h> |
| 19 | 19 | #include <asm/tlbflush.h> |
| 20 | 20 | |
| 21 | +#include "../kernel/head.h" | |
| 22 | + | |
| 21 | 23 | /* |
| 22 | 24 | * This routine handles page faults. It determines the address and the |
| 23 | 25 | * problem, and then passes it off to one of the appropriate routines. |
| @@ -19,6 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <asm/pgtable.h> |
| 20 | 20 | #include <asm/io.h> |
| 21 | 21 | |
| 22 | +#include "../kernel/head.h" | |
| 23 | + | |
| 22 | 24 | unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] |
| 23 | 25 | __page_aligned_bss; |
| 24 | 26 | EXPORT_SYMBOL(empty_zero_page); |
| @@ -337,8 +339,7 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size) · 312 unmodified lines | ||
| 337 | 339 | */ |
| 338 | 340 | |
| 339 | 341 | #ifndef __riscv_cmodel_medany |
| 340 | −#error "setup_vm() is called from head.S before relocate so it should " | |
| 341 | − "not use absolute addressing." | |
| 342 | +#error "setup_vm() is called from head.S before relocate so it should not use absolute addressing." | |
| 342 | 343 | #endif |
| 343 | 344 | |
| 344 | 345 | asmlinkage void __init setup_vm(uintptr_t dtb_pa) |
| @@ -142,7 +142,7 @@ static irqreturn_t l2_int_handler(int irq, void *device) · 141 unmodified lines | ||
| 142 | 142 | return IRQ_HANDLED; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | −int __init sifive_l2_init(void) | |
| 145 | +static int __init sifive_l2_init(void) | |
| 146 | 146 | { |
| 147 | 147 | struct device_node *np; |
| 148 | 148 | struct resource res; |