Skip to content

Commit

Permalink
Merge tag 'riscv/for-v5.4-rc6' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Linus Torvalds committed Nov 2, 2019
2 parents 31408fb + 1d9b0b6 commit e5897c7
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 18 deletions.
6 changes: 3 additions & 3 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -13906,7 +13906,7 @@ F: drivers/mtd/nand/raw/r852.h

RISC-V ARCHITECTURE
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>
L: linux-riscv@lists.infradead.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git
Expand Down Expand Up @@ -14783,7 +14783,7 @@ F: drivers/media/usb/siano/
F: drivers/media/mmc/siano/

SIFIVE DRIVERS
M: Palmer Dabbelt <palmer@sifive.com>
M: Palmer Dabbelt <palmer@dabbelt.com>
M: Paul Walmsley <paul.walmsley@sifive.com>
L: linux-riscv@lists.infradead.org
T: git git://github.com/sifive/riscv-linux.git
Expand All @@ -14793,7 +14793,7 @@ N: sifive

SIFIVE FU540 SYSTEM-ON-CHIP
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
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git
S: Supported
Expand Down
7 changes: 7 additions & 0 deletions arch/riscv/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <linux/types.h>
#include <asm/mmiowb.h>
#include <asm/pgtable.h>

extern void __iomem *ioremap(phys_addr_t offset, unsigned long size);

Expand Down Expand Up @@ -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(); })
#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.
* These are defined as being "fully synchronous", but also "not guaranteed to
Expand Down
3 changes: 3 additions & 0 deletions arch/riscv/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#ifndef _ASM_RISCV_IRQ_H
#define _ASM_RISCV_IRQ_H

#include <linux/interrupt.h>
#include <linux/linkage.h>

#define NR_IRQS 0

void riscv_timer_interrupt(void);
Expand Down
7 changes: 6 additions & 1 deletion arch/riscv/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define _ASM_RISCV_PGTABLE_H

#include <linux/mmzone.h>
#include <linux/sizes.h>

#include <asm/pgtable-bits.h>

Expand Down Expand Up @@ -86,6 +87,7 @@ extern pgd_t swapper_pg_dir[];
#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
#define VMALLOC_END (PAGE_OFFSET - 1)
#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
Expand All @@ -100,7 +102,10 @@ extern pgd_t swapper_pg_dir[];

#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
#define FIXADDR_SIZE PMD_SIZE
#else
Expand Down
1 change: 1 addition & 0 deletions arch/riscv/include/asm/switch_to.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef _ASM_RISCV_SWITCH_TO_H
#define _ASM_RISCV_SWITCH_TO_H

#include <linux/sched/task_stack.h>
#include <asm/processor.h>
#include <asm/ptrace.h>
#include <asm/csr.h>
Expand Down
1 change: 1 addition & 0 deletions arch/riscv/kernel/cpufeature.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <asm/processor.h>
#include <asm/hwcap.h>
#include <asm/smp.h>
#include <asm/switch_to.h>

unsigned long elf_hwcap __read_mostly;
#ifdef CONFIG_FPU
Expand Down
21 changes: 21 additions & 0 deletions arch/riscv/kernel/head.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* 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 */
2 changes: 1 addition & 1 deletion arch/riscv/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
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);

Expand Down
1 change: 1 addition & 0 deletions arch/riscv/kernel/module-sections.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/elf.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleloader.h>

unsigned long module_emit_got_entry(struct module *mod, unsigned long val)
{
Expand Down
2 changes: 2 additions & 0 deletions arch/riscv/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Copyright (C) 2017 SiFive
*/

#include <linux/cpu.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/sched/task_stack.h>
Expand All @@ -19,6 +20,7 @@
#include <asm/csr.h>
#include <asm/string.h>
#include <asm/switch_to.h>
#include <asm/thread_info.h>

extern asmlinkage void ret_from_fork(void);
extern asmlinkage void ret_from_kernel_thread(void);
Expand Down
4 changes: 2 additions & 2 deletions arch/riscv/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* {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 (tracehook_report_syscall_entry(regs))
Expand All @@ -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);
}

void do_syscall_trace_exit(struct pt_regs *regs)
__visible void do_syscall_trace_exit(struct pt_regs *regs)
{
audit_syscall_exit(regs);

Expand Down
1 change: 1 addition & 0 deletions arch/riscv/kernel/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <linux/reboot.h>
#include <linux/pm.h>
#include <asm/sbi.h>

static void default_power_off(void)
Expand Down
2 changes: 2 additions & 0 deletions arch/riscv/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <asm/tlbflush.h>
#include <asm/thread_info.h>

#include "head.h"

#ifdef CONFIG_DUMMY_CONSOLE
struct screen_info screen_info = {
.orig_video_lines = 30,
Expand Down
8 changes: 4 additions & 4 deletions arch/riscv/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct rt_sigframe {

#ifdef CONFIG_FPU
static long restore_fp_state(struct pt_regs *regs,
union __riscv_fp_state *sc_fpregs)
union __riscv_fp_state __user *sc_fpregs)
{
long err;
struct __riscv_d_ext_state __user *state = &sc_fpregs->d;
Expand All @@ -53,7 +53,7 @@ static long restore_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;
struct __riscv_d_ext_state __user *state = &sc_fpregs->d;
Expand Down Expand Up @@ -292,8 +292,8 @@ static void do_signal(struct pt_regs *regs)
* notification of userspace execution resumption
* - triggered by the _TIF_WORK_MASK flags
*/
asmlinkage void do_notify_resume(struct pt_regs *regs,
unsigned long thread_info_flags)
asmlinkage __visible void do_notify_resume(struct pt_regs *regs,
unsigned long thread_info_flags)
{
/* Handle pending signal delivery */
if (thread_info_flags & _TIF_SIGPENDING)
Expand Down
2 changes: 2 additions & 0 deletions arch/riscv/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* Copyright (C) 2017 SiFive
*/

#include <linux/cpu.h>
#include <linux/interrupt.h>
#include <linux/profile.h>
#include <linux/smp.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
Expand Down
5 changes: 4 additions & 1 deletion arch/riscv/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include <asm/tlbflush.h>
#include <asm/sections.h>
#include <asm/sbi.h>
#include <asm/smp.h>

#include "head.h"

void *__cpu_up_stack_pointer[NR_CPUS];
void *__cpu_up_task_pointer[NR_CPUS];
Expand Down Expand Up @@ -130,7 +133,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
/*
* 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;

Expand Down
1 change: 1 addition & 0 deletions arch/riscv/kernel/syscall_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/syscalls.h>
#include <asm-generic/syscalls.h>
#include <asm/vdso.h>
#include <asm/syscall.h>

#undef __SYSCALL
#define __SYSCALL(nr, call) [nr] = (call),
Expand Down
1 change: 1 addition & 0 deletions arch/riscv/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <linux/clocksource.h>
#include <linux/delay.h>
#include <asm/sbi.h>
#include <asm/processor.h>

unsigned long riscv_timebase;
EXPORT_SYMBOL_GPL(riscv_timebase);
Expand Down
5 changes: 3 additions & 2 deletions arch/riscv/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2012 Regents of the University of California
*/

#include <linux/cpu.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
Expand Down Expand Up @@ -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) \
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); \
}
Expand Down Expand Up @@ -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);
}

asmlinkage void do_trap_break(struct pt_regs *regs)
asmlinkage __visible void do_trap_break(struct pt_regs *regs)
{
if (user_mode(regs))
force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc);
Expand Down
3 changes: 2 additions & 1 deletion arch/riscv/kernel/vdso.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Copyright (C) 2015 Regents of the University of California
*/

#include <linux/elf.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/binfmts.h>
Expand All @@ -25,7 +26,7 @@ static union {
struct vdso_data data;
u8 page[PAGE_SIZE];
} 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)
{
Expand Down
1 change: 1 addition & 0 deletions arch/riscv/mm/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <linux/mm.h>
#include <asm/tlbflush.h>
#include <asm/cacheflush.h>
#include <asm/mmu_context.h>

/*
* When necessary, performs a deferred icache flush for the given MM context,
Expand Down
2 changes: 2 additions & 0 deletions arch/riscv/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <asm/ptrace.h>
#include <asm/tlbflush.h>

#include "../kernel/head.h"

/*
* This routine handles page faults. It determines the address and the
* problem, and then passes it off to one of the appropriate routines.
Expand Down
5 changes: 3 additions & 2 deletions arch/riscv/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <asm/pgtable.h>
#include <asm/io.h>

#include "../kernel/head.h"

unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
__page_aligned_bss;
EXPORT_SYMBOL(empty_zero_page);
Expand Down Expand Up @@ -337,8 +339,7 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size)
*/

#ifndef __riscv_cmodel_medany
#error "setup_vm() is called from head.S before relocate so it should "
"not use absolute addressing."
#error "setup_vm() is called from head.S before relocate so it should not use absolute addressing."
#endif

asmlinkage void __init setup_vm(uintptr_t dtb_pa)
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/mm/sifive_l2_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static irqreturn_t l2_int_handler(int irq, void *device)
return IRQ_HANDLED;
}

int __init sifive_l2_init(void)
static int __init sifive_l2_init(void)
{
struct device_node *np;
struct resource res;
Expand Down

0 comments on commit e5897c7

Please sign in to comment.