Commit e5897c7d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'riscv/for-v5.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

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
parents 31408fbe 1d9b0b66
...@@ -13906,7 +13906,7 @@ F: drivers/mtd/nand/raw/r852.h ...@@ -13906,7 +13906,7 @@ F: drivers/mtd/nand/raw/r852.h
RISC-V ARCHITECTURE RISC-V ARCHITECTURE
M: Paul Walmsley <paul.walmsley@sifive.com> M: Paul Walmsley <paul.walmsley@sifive.com>
M: Palmer Dabbelt <palmer@sifive.com> M: Palmer Dabbelt <palmer@dabbelt.com>
M: Albert Ou <aou@eecs.berkeley.edu> M: Albert Ou <aou@eecs.berkeley.edu>
L: linux-riscv@lists.infradead.org L: linux-riscv@lists.infradead.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git
...@@ -14783,7 +14783,7 @@ F: drivers/media/usb/siano/ ...@@ -14783,7 +14783,7 @@ F: drivers/media/usb/siano/
F: drivers/media/mmc/siano/ F: drivers/media/mmc/siano/
SIFIVE DRIVERS SIFIVE DRIVERS
M: Palmer Dabbelt <palmer@sifive.com> M: Palmer Dabbelt <palmer@dabbelt.com>
M: Paul Walmsley <paul.walmsley@sifive.com> M: Paul Walmsley <paul.walmsley@sifive.com>
L: linux-riscv@lists.infradead.org L: linux-riscv@lists.infradead.org
T: git git://github.com/sifive/riscv-linux.git T: git git://github.com/sifive/riscv-linux.git
...@@ -14793,7 +14793,7 @@ N: sifive ...@@ -14793,7 +14793,7 @@ N: sifive
SIFIVE FU540 SYSTEM-ON-CHIP SIFIVE FU540 SYSTEM-ON-CHIP
M: Paul Walmsley <paul.walmsley@sifive.com> M: Paul Walmsley <paul.walmsley@sifive.com>
M: Palmer Dabbelt <palmer@sifive.com> M: Palmer Dabbelt <palmer@dabbelt.com>
L: linux-riscv@lists.infradead.org L: linux-riscv@lists.infradead.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git
S: Supported S: Supported
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <asm/mmiowb.h> #include <asm/mmiowb.h>
#include <asm/pgtable.h>
extern void __iomem *ioremap(phys_addr_t offset, unsigned long size); extern void __iomem *ioremap(phys_addr_t offset, unsigned long size);
...@@ -161,6 +162,12 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) ...@@ -161,6 +162,12 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
#define writeq(v,c) ({ __io_bw(); writeq_cpu((v),(c)); __io_aw(); }) #define writeq(v,c) ({ __io_bw(); writeq_cpu((v),(c)); __io_aw(); })
#endif #endif
/*
* I/O port access constants.
*/
#define IO_SPACE_LIMIT (PCI_IO_SIZE - 1)
#define PCI_IOBASE ((void __iomem *)PCI_IO_START)
/* /*
* Emulation routines for the port-mapped IO space used by some PCI drivers. * Emulation routines for the port-mapped IO space used by some PCI drivers.
* These are defined as being "fully synchronous", but also "not guaranteed to * These are defined as being "fully synchronous", but also "not guaranteed to
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#ifndef _ASM_RISCV_IRQ_H #ifndef _ASM_RISCV_IRQ_H
#define _ASM_RISCV_IRQ_H #define _ASM_RISCV_IRQ_H
#include <linux/interrupt.h>
#include <linux/linkage.h>
#define NR_IRQS 0 #define NR_IRQS 0
void riscv_timer_interrupt(void); void riscv_timer_interrupt(void);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define _ASM_RISCV_PGTABLE_H #define _ASM_RISCV_PGTABLE_H
#include <linux/mmzone.h> #include <linux/mmzone.h>
#include <linux/sizes.h>
#include <asm/pgtable-bits.h> #include <asm/pgtable-bits.h>
...@@ -86,6 +87,7 @@ extern pgd_t swapper_pg_dir[]; ...@@ -86,6 +87,7 @@ extern pgd_t swapper_pg_dir[];
#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1) #define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
#define VMALLOC_END (PAGE_OFFSET - 1) #define VMALLOC_END (PAGE_OFFSET - 1)
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE) #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
#define PCI_IO_SIZE SZ_16M
/* /*
* Roughly size the vmemmap space to be large enough to fit enough * Roughly size the vmemmap space to be large enough to fit enough
...@@ -100,7 +102,10 @@ extern pgd_t swapper_pg_dir[]; ...@@ -100,7 +102,10 @@ extern pgd_t swapper_pg_dir[];
#define vmemmap ((struct page *)VMEMMAP_START) #define vmemmap ((struct page *)VMEMMAP_START)
#define FIXADDR_TOP (VMEMMAP_START) #define PCI_IO_END VMEMMAP_START
#define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE)
#define FIXADDR_TOP PCI_IO_START
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
#define FIXADDR_SIZE PMD_SIZE #define FIXADDR_SIZE PMD_SIZE
#else #else
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#ifndef _ASM_RISCV_SWITCH_TO_H #ifndef _ASM_RISCV_SWITCH_TO_H
#define _ASM_RISCV_SWITCH_TO_H #define _ASM_RISCV_SWITCH_TO_H
#include <linux/sched/task_stack.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/csr.h> #include <asm/csr.h>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/hwcap.h> #include <asm/hwcap.h>
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/switch_to.h>
unsigned long elf_hwcap __read_mostly; unsigned long elf_hwcap __read_mostly;
#ifdef CONFIG_FPU #ifdef CONFIG_FPU
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2019 SiFive, Inc.
*/
#ifndef __ASM_HEAD_H
#define __ASM_HEAD_H
#include <linux/linkage.h>
#include <linux/init.h>
extern atomic_t hart_lottery;
asmlinkage void do_page_fault(struct pt_regs *regs);
asmlinkage void __init setup_vm(uintptr_t dtb_pa);
extern void *__cpu_up_stack_pointer[];
extern void *__cpu_up_task_pointer[];
void __init parse_dtb(void);
#endif /* __ASM_HEAD_H */
...@@ -24,7 +24,7 @@ int arch_show_interrupts(struct seq_file *p, int prec) ...@@ -24,7 +24,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
return 0; return 0;
} }
asmlinkage void __irq_entry do_IRQ(struct pt_regs *regs) asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs)
{ {
struct pt_regs *old_regs = set_irq_regs(regs); struct pt_regs *old_regs = set_irq_regs(regs);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/elf.h> #include <linux/elf.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleloader.h>
unsigned long module_emit_got_entry(struct module *mod, unsigned long val) unsigned long module_emit_got_entry(struct module *mod, unsigned long val)
{ {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Copyright (C) 2017 SiFive * Copyright (C) 2017 SiFive
*/ */
#include <linux/cpu.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sched/task_stack.h> #include <linux/sched/task_stack.h>
...@@ -19,6 +20,7 @@ ...@@ -19,6 +20,7 @@
#include <asm/csr.h> #include <asm/csr.h>
#include <asm/string.h> #include <asm/string.h>
#include <asm/switch_to.h> #include <asm/switch_to.h>
#include <asm/thread_info.h>
extern asmlinkage void ret_from_fork(void); extern asmlinkage void ret_from_fork(void);
extern asmlinkage void ret_from_kernel_thread(void); extern asmlinkage void ret_from_kernel_thread(void);
......
...@@ -148,7 +148,7 @@ long arch_ptrace(struct task_struct *child, long request, ...@@ -148,7 +148,7 @@ long arch_ptrace(struct task_struct *child, long request,
* Allows PTRACE_SYSCALL to work. These are called from entry.S in * Allows PTRACE_SYSCALL to work. These are called from entry.S in
* {handle,ret_from}_syscall. * {handle,ret_from}_syscall.
*/ */
void do_syscall_trace_enter(struct pt_regs *regs) __visible void do_syscall_trace_enter(struct pt_regs *regs)
{ {
if (test_thread_flag(TIF_SYSCALL_TRACE)) if (test_thread_flag(TIF_SYSCALL_TRACE))
if (tracehook_report_syscall_entry(regs)) if (tracehook_report_syscall_entry(regs))
...@@ -162,7 +162,7 @@ void do_syscall_trace_enter(struct pt_regs *regs) ...@@ -162,7 +162,7 @@ void do_syscall_trace_enter(struct pt_regs *regs)
audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3); audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3);
} }
void do_syscall_trace_exit(struct pt_regs *regs) __visible void do_syscall_trace_exit(struct pt_regs *regs)
{ {
audit_syscall_exit(regs); audit_syscall_exit(regs);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/pm.h>
#include <asm/sbi.h> #include <asm/sbi.h>
static void default_power_off(void) static void default_power_off(void)
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
#include "head.h"
#ifdef CONFIG_DUMMY_CONSOLE #ifdef CONFIG_DUMMY_CONSOLE
struct screen_info screen_info = { struct screen_info screen_info = {
.orig_video_lines = 30, .orig_video_lines = 30,
......
...@@ -26,7 +26,7 @@ struct rt_sigframe { ...@@ -26,7 +26,7 @@ struct rt_sigframe {
#ifdef CONFIG_FPU #ifdef CONFIG_FPU
static long restore_fp_state(struct pt_regs *regs, static long restore_fp_state(struct pt_regs *regs,
union __riscv_fp_state *sc_fpregs) union __riscv_fp_state __user *sc_fpregs)
{ {
long err; long err;
struct __riscv_d_ext_state __user *state = &sc_fpregs->d; struct __riscv_d_ext_state __user *state = &sc_fpregs->d;
...@@ -53,7 +53,7 @@ static long restore_fp_state(struct pt_regs *regs, ...@@ -53,7 +53,7 @@ static long restore_fp_state(struct pt_regs *regs,
} }
static long save_fp_state(struct pt_regs *regs, static long save_fp_state(struct pt_regs *regs,
union __riscv_fp_state *sc_fpregs) union __riscv_fp_state __user *sc_fpregs)
{ {
long err; long err;
struct __riscv_d_ext_state __user *state = &sc_fpregs->d; struct __riscv_d_ext_state __user *state = &sc_fpregs->d;
...@@ -292,7 +292,7 @@ static void do_signal(struct pt_regs *regs) ...@@ -292,7 +292,7 @@ static void do_signal(struct pt_regs *regs)
* notification of userspace execution resumption * notification of userspace execution resumption
* - triggered by the _TIF_WORK_MASK flags * - triggered by the _TIF_WORK_MASK flags
*/ */
asmlinkage void do_notify_resume(struct pt_regs *regs, asmlinkage __visible void do_notify_resume(struct pt_regs *regs,
unsigned long thread_info_flags) unsigned long thread_info_flags)
{ {
/* Handle pending signal delivery */ /* Handle pending signal delivery */
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
* Copyright (C) 2017 SiFive * Copyright (C) 2017 SiFive
*/ */
#include <linux/cpu.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/profile.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/sbi.h> #include <asm/sbi.h>
#include <asm/smp.h>
#include "head.h"
void *__cpu_up_stack_pointer[NR_CPUS]; void *__cpu_up_stack_pointer[NR_CPUS];
void *__cpu_up_task_pointer[NR_CPUS]; void *__cpu_up_task_pointer[NR_CPUS];
...@@ -130,7 +133,7 @@ void __init smp_cpus_done(unsigned int max_cpus) ...@@ -130,7 +133,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
/* /*
* C entry point for a secondary processor. * C entry point for a secondary processor.
*/ */
asmlinkage void __init smp_callin(void) asmlinkage __visible void __init smp_callin(void)
{ {
struct mm_struct *mm = &init_mm; struct mm_struct *mm = &init_mm;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <asm-generic/syscalls.h> #include <asm-generic/syscalls.h>
#include <asm/vdso.h> #include <asm/vdso.h>
#include <asm/syscall.h>
#undef __SYSCALL #undef __SYSCALL
#define __SYSCALL(nr, call) [nr] = (call), #define __SYSCALL(nr, call) [nr] = (call),
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <asm/sbi.h> #include <asm/sbi.h>
#include <asm/processor.h>
unsigned long riscv_timebase; unsigned long riscv_timebase;
EXPORT_SYMBOL_GPL(riscv_timebase); EXPORT_SYMBOL_GPL(riscv_timebase);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Copyright (C) 2012 Regents of the University of California * Copyright (C) 2012 Regents of the University of California
*/ */
#include <linux/cpu.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -83,7 +84,7 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code, ...@@ -83,7 +84,7 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code,
} }
#define DO_ERROR_INFO(name, signo, code, str) \ #define DO_ERROR_INFO(name, signo, code, str) \
asmlinkage void name(struct pt_regs *regs) \ asmlinkage __visible void name(struct pt_regs *regs) \
{ \ { \
do_trap_error(regs, signo, code, regs->sepc, "Oops - " str); \ do_trap_error(regs, signo, code, regs->sepc, "Oops - " str); \
} }
...@@ -120,7 +121,7 @@ static inline unsigned long get_break_insn_length(unsigned long pc) ...@@ -120,7 +121,7 @@ static inline unsigned long get_break_insn_length(unsigned long pc)
return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL); return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL);
} }
asmlinkage void do_trap_break(struct pt_regs *regs) asmlinkage __visible void do_trap_break(struct pt_regs *regs)
{ {
if (user_mode(regs)) if (user_mode(regs))
force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc); force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Copyright (C) 2015 Regents of the University of California * Copyright (C) 2015 Regents of the University of California
*/ */
#include <linux/elf.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/binfmts.h> #include <linux/binfmts.h>
...@@ -25,7 +26,7 @@ static union { ...@@ -25,7 +26,7 @@ static union {
struct vdso_data data; struct vdso_data data;
u8 page[PAGE_SIZE]; u8 page[PAGE_SIZE];
} vdso_data_store __page_aligned_data; } vdso_data_store __page_aligned_data;
struct vdso_data *vdso_data = &vdso_data_store.data; static struct vdso_data *vdso_data = &vdso_data_store.data;
static int __init vdso_init(void) static int __init vdso_init(void)
{ {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/mmu_context.h>
/* /*
* When necessary, performs a deferred icache flush for the given MM context, * When necessary, performs a deferred icache flush for the given MM context,
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include "../kernel/head.h"
/* /*
* This routine handles page faults. It determines the address and the * This routine handles page faults. It determines the address and the
* problem, and then passes it off to one of the appropriate routines. * problem, and then passes it off to one of the appropriate routines.
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/io.h> #include <asm/io.h>
#include "../kernel/head.h"
unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
__page_aligned_bss; __page_aligned_bss;
EXPORT_SYMBOL(empty_zero_page); EXPORT_SYMBOL(empty_zero_page);
...@@ -337,8 +339,7 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size) ...@@ -337,8 +339,7 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size)
*/ */
#ifndef __riscv_cmodel_medany #ifndef __riscv_cmodel_medany
#error "setup_vm() is called from head.S before relocate so it should " #error "setup_vm() is called from head.S before relocate so it should not use absolute addressing."
"not use absolute addressing."
#endif #endif
asmlinkage void __init setup_vm(uintptr_t dtb_pa) asmlinkage void __init setup_vm(uintptr_t dtb_pa)
......
...@@ -142,7 +142,7 @@ static irqreturn_t l2_int_handler(int irq, void *device) ...@@ -142,7 +142,7 @@ static irqreturn_t l2_int_handler(int irq, void *device)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
int __init sifive_l2_init(void) static int __init sifive_l2_init(void)
{ {
struct device_node *np; struct device_node *np;
struct resource res; struct resource res;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment