Merge tag 'riscv-for-linus-4.18-merge_window' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux
Pull RISC-V updates from Palmer Dabbelt: "This contains some small RISC-V updates I'd like to target for 4.18. They are all fairly small this time. Here's a short summary, there's more info in the commits/merges: - a fix to __clear_user to respect the passed arguments. - enough support for the perf subsystem to work with RISC-V's ISA defined performance counters. - support for sparse and cleanups suggested by it. - support for R_RISCV_32 (a relocation, not the 32-bit ISA). - some MAINTAINERS cleanups. - the addition of CONFIG_HVC_RISCV_SBI to our defconfig, as it's always present. I've given these a simple build+boot test" * tag 'riscv-for-linus-4.18-merge_window' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux: RISC-V: Add CONFIG_HVC_RISCV_SBI=y to defconfig RISC-V: Handle R_RISCV_32 in modules riscv/ftrace: Export _mcount when DYNAMIC_FTRACE isn't set riscv: add riscv-specific predefines to CHECKFLAGS riscv: split the declaration of __copy_user riscv: no __user for probe_kernel_address() riscv: use NULL instead of a plain 0 perf: riscv: Add Document for Future Porting Guide perf: riscv: preliminary RISC-V support MAINTAINERS: Update Albert's email, he's back at Berkeley MAINTAINERS: Add myself as a maintainer for SiFive's drivers riscv: Fix the bug in memory access fixup code
Esse commit está contido em:
@@ -25,6 +25,7 @@ generic-y += kdebug.h
|
||||
generic-y += kmap_types.h
|
||||
generic-y += kvm_para.h
|
||||
generic-y += local.h
|
||||
generic-y += local64.h
|
||||
generic-y += mm-arch-hooks.h
|
||||
generic-y += mman.h
|
||||
generic-y += module.h
|
||||
|
@@ -47,7 +47,7 @@ static inline void flush_dcache_page(struct page *page)
|
||||
|
||||
#else /* CONFIG_SMP */
|
||||
|
||||
#define flush_icache_all() sbi_remote_fence_i(0)
|
||||
#define flush_icache_all() sbi_remote_fence_i(NULL)
|
||||
void flush_icache_mm(struct mm_struct *mm, bool local);
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
84
arch/riscv/include/asm/perf_event.h
Arquivo normal
84
arch/riscv/include/asm/perf_event.h
Arquivo normal
@@ -0,0 +1,84 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2018 SiFive
|
||||
* Copyright (C) 2018 Andes Technology Corporation
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ASM_RISCV_PERF_EVENT_H
|
||||
#define _ASM_RISCV_PERF_EVENT_H
|
||||
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/ptrace.h>
|
||||
|
||||
#define RISCV_BASE_COUNTERS 2
|
||||
|
||||
/*
|
||||
* The RISCV_MAX_COUNTERS parameter should be specified.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_RISCV_BASE_PMU
|
||||
#define RISCV_MAX_COUNTERS 2
|
||||
#endif
|
||||
|
||||
#ifndef RISCV_MAX_COUNTERS
|
||||
#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU."
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These are the indexes of bits in counteren register *minus* 1,
|
||||
* except for cycle. It would be coherent if it can directly mapped
|
||||
* to counteren bit definition, but there is a *time* register at
|
||||
* counteren[1]. Per-cpu structure is scarce resource here.
|
||||
*
|
||||
* According to the spec, an implementation can support counter up to
|
||||
* mhpmcounter31, but many high-end processors has at most 6 general
|
||||
* PMCs, we give the definition to MHPMCOUNTER8 here.
|
||||
*/
|
||||
#define RISCV_PMU_CYCLE 0
|
||||
#define RISCV_PMU_INSTRET 1
|
||||
#define RISCV_PMU_MHPMCOUNTER3 2
|
||||
#define RISCV_PMU_MHPMCOUNTER4 3
|
||||
#define RISCV_PMU_MHPMCOUNTER5 4
|
||||
#define RISCV_PMU_MHPMCOUNTER6 5
|
||||
#define RISCV_PMU_MHPMCOUNTER7 6
|
||||
#define RISCV_PMU_MHPMCOUNTER8 7
|
||||
|
||||
#define RISCV_OP_UNSUPP (-EOPNOTSUPP)
|
||||
|
||||
struct cpu_hw_events {
|
||||
/* # currently enabled events*/
|
||||
int n_events;
|
||||
/* currently enabled events */
|
||||
struct perf_event *events[RISCV_MAX_COUNTERS];
|
||||
/* vendor-defined PMU data */
|
||||
void *platform;
|
||||
};
|
||||
|
||||
struct riscv_pmu {
|
||||
struct pmu *pmu;
|
||||
|
||||
/* generic hw/cache events table */
|
||||
const int *hw_events;
|
||||
const int (*cache_events)[PERF_COUNT_HW_CACHE_MAX]
|
||||
[PERF_COUNT_HW_CACHE_OP_MAX]
|
||||
[PERF_COUNT_HW_CACHE_RESULT_MAX];
|
||||
/* method used to map hw/cache events */
|
||||
int (*map_hw_event)(u64 config);
|
||||
int (*map_cache_event)(u64 config);
|
||||
|
||||
/* max generic hw events in map */
|
||||
int max_events;
|
||||
/* number total counters, 2(base) + x(general) */
|
||||
int num_counters;
|
||||
/* the width of the counter */
|
||||
int counter_width;
|
||||
|
||||
/* vendor-defined PMU features */
|
||||
void *platform;
|
||||
|
||||
irqreturn_t (*handle_irq)(int irq_num, void *dev);
|
||||
int irq;
|
||||
};
|
||||
|
||||
#endif /* _ASM_RISCV_PERF_EVENT_H */
|
@@ -49,7 +49,7 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
|
||||
|
||||
#include <asm/sbi.h>
|
||||
|
||||
#define flush_tlb_all() sbi_remote_sfence_vma(0, 0, -1)
|
||||
#define flush_tlb_all() sbi_remote_sfence_vma(NULL, 0, -1)
|
||||
#define flush_tlb_page(vma, addr) flush_tlb_range(vma, addr, 0)
|
||||
#define flush_tlb_range(vma, start, end) \
|
||||
sbi_remote_sfence_vma(mm_cpumask((vma)->vm_mm)->bits, \
|
||||
|
@@ -392,19 +392,21 @@ do { \
|
||||
})
|
||||
|
||||
|
||||
extern unsigned long __must_check __copy_user(void __user *to,
|
||||
extern unsigned long __must_check __asm_copy_to_user(void __user *to,
|
||||
const void *from, unsigned long n);
|
||||
extern unsigned long __must_check __asm_copy_from_user(void *to,
|
||||
const void __user *from, unsigned long n);
|
||||
|
||||
static inline unsigned long
|
||||
raw_copy_from_user(void *to, const void __user *from, unsigned long n)
|
||||
{
|
||||
return __copy_user(to, from, n);
|
||||
return __asm_copy_to_user(to, from, n);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
raw_copy_to_user(void __user *to, const void *from, unsigned long n)
|
||||
{
|
||||
return __copy_user(to, from, n);
|
||||
return __asm_copy_from_user(to, from, n);
|
||||
}
|
||||
|
||||
extern long strncpy_from_user(char *dest, const char __user *src, long count);
|
||||
|
Referência em uma nova issue
Block a user