forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'nds32-for-linus-4.21' of git://git.kernel.org/pub/scm/linu…
…x/kernel/git/greentime/linux Pull nds32 updates from Greentime Hu: - Perf support - Power management support - FPU support - Hardware prefetcher support - Build error fixed - Performance enhancement * tag 'nds32-for-linus-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux: nds32: support hardware prefetcher nds32: Fix the items of hwcap_str ordering issue. math-emu/soft-fp.h: (_FP_ROUND_ZERO) cast 0 to void to fix warning math-emu/op-2.h: Use statement expressions to prevent negative constant shift nds32: support denormalized result through FP emulator nds32: Support FP emulation nds32: nds32 FPU port nds32: Remove duplicated include from pm.c nds32: Power management for nds32 nds32: Add document for NDS32 PMU. nds32: Add perf call-graph support. nds32: Perf porting nds32: Fix bug in bitfield.h nds32: Fix gcc 8.0 compiler option incompatible. nds32: Fill all TLB entries with kernel image mapping nds32: Remove the redundant assignment
- Loading branch information
Showing
65 changed files
with
4,441 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
* NDS32 Performance Monitor Units | ||
|
||
NDS32 core have a PMU for counting cpu and cache events like cache misses. | ||
The NDS32 PMU representation in the device tree should be done as under: | ||
|
||
Required properties: | ||
|
||
- compatible : | ||
"andestech,nds32v3-pmu" | ||
|
||
- interrupts : The interrupt number for NDS32 PMU is 13. | ||
|
||
Example: | ||
pmu{ | ||
compatible = "andestech,nds32v3-pmu"; | ||
interrupts = <13>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,4 +82,9 @@ | |
interrupts = <18>; | ||
}; | ||
}; | ||
|
||
pmu { | ||
compatible = "andestech,nds32v3-pmu"; | ||
interrupts= <13>; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* Copyright (C) 2005-2018 Andes Technology Corporation */ | ||
|
||
#ifndef __ASM_NDS32_FPU_H | ||
#define __ASM_NDS32_FPU_H | ||
|
||
#if IS_ENABLED(CONFIG_FPU) | ||
#ifndef __ASSEMBLY__ | ||
#include <linux/sched/task_stack.h> | ||
#include <linux/preempt.h> | ||
#include <asm/ptrace.h> | ||
|
||
extern bool has_fpu; | ||
|
||
extern void save_fpu(struct task_struct *__tsk); | ||
extern void load_fpu(const struct fpu_struct *fpregs); | ||
extern bool do_fpu_exception(unsigned int subtype, struct pt_regs *regs); | ||
extern int do_fpuemu(struct pt_regs *regs, struct fpu_struct *fpu); | ||
|
||
#define test_tsk_fpu(regs) (regs->fucop_ctl & FUCOP_CTL_mskCP0EN) | ||
|
||
/* | ||
* Initially load the FPU with signalling NANS. This bit pattern | ||
* has the property that no matter whether considered as single or as | ||
* double precision, it still represents a signalling NAN. | ||
*/ | ||
|
||
#define sNAN64 0xFFFFFFFFFFFFFFFFULL | ||
#define sNAN32 0xFFFFFFFFUL | ||
|
||
#if IS_ENABLED(CONFIG_SUPPORT_DENORMAL_ARITHMETIC) | ||
/* | ||
* Denormalized number is unsupported by nds32 FPU. Hence the operation | ||
* is treated as underflow cases when the final result is a denormalized | ||
* number. To enhance precision, underflow exception trap should be | ||
* enabled by default and kerenl will re-execute it by fpu emulator | ||
* when getting underflow exception. | ||
*/ | ||
#define FPCSR_INIT FPCSR_mskUDFE | ||
#else | ||
#define FPCSR_INIT 0x0UL | ||
#endif | ||
|
||
extern const struct fpu_struct init_fpuregs; | ||
|
||
static inline void disable_ptreg_fpu(struct pt_regs *regs) | ||
{ | ||
regs->fucop_ctl &= ~FUCOP_CTL_mskCP0EN; | ||
} | ||
|
||
static inline void enable_ptreg_fpu(struct pt_regs *regs) | ||
{ | ||
regs->fucop_ctl |= FUCOP_CTL_mskCP0EN; | ||
} | ||
|
||
static inline void enable_fpu(void) | ||
{ | ||
unsigned long fucop_ctl; | ||
|
||
fucop_ctl = __nds32__mfsr(NDS32_SR_FUCOP_CTL) | FUCOP_CTL_mskCP0EN; | ||
__nds32__mtsr(fucop_ctl, NDS32_SR_FUCOP_CTL); | ||
__nds32__isb(); | ||
} | ||
|
||
static inline void disable_fpu(void) | ||
{ | ||
unsigned long fucop_ctl; | ||
|
||
fucop_ctl = __nds32__mfsr(NDS32_SR_FUCOP_CTL) & ~FUCOP_CTL_mskCP0EN; | ||
__nds32__mtsr(fucop_ctl, NDS32_SR_FUCOP_CTL); | ||
__nds32__isb(); | ||
} | ||
|
||
static inline void lose_fpu(void) | ||
{ | ||
preempt_disable(); | ||
#if IS_ENABLED(CONFIG_LAZY_FPU) | ||
if (last_task_used_math == current) { | ||
last_task_used_math = NULL; | ||
#else | ||
if (test_tsk_fpu(task_pt_regs(current))) { | ||
#endif | ||
save_fpu(current); | ||
} | ||
disable_ptreg_fpu(task_pt_regs(current)); | ||
preempt_enable(); | ||
} | ||
|
||
static inline void own_fpu(void) | ||
{ | ||
preempt_disable(); | ||
#if IS_ENABLED(CONFIG_LAZY_FPU) | ||
if (last_task_used_math != current) { | ||
if (last_task_used_math != NULL) | ||
save_fpu(last_task_used_math); | ||
load_fpu(¤t->thread.fpu); | ||
last_task_used_math = current; | ||
} | ||
#else | ||
if (!test_tsk_fpu(task_pt_regs(current))) { | ||
load_fpu(¤t->thread.fpu); | ||
} | ||
#endif | ||
enable_ptreg_fpu(task_pt_regs(current)); | ||
preempt_enable(); | ||
} | ||
|
||
#if !IS_ENABLED(CONFIG_LAZY_FPU) | ||
static inline void unlazy_fpu(struct task_struct *tsk) | ||
{ | ||
preempt_disable(); | ||
if (test_tsk_fpu(task_pt_regs(tsk))) | ||
save_fpu(tsk); | ||
preempt_enable(); | ||
} | ||
#endif /* !CONFIG_LAZY_FPU */ | ||
static inline void clear_fpu(struct pt_regs *regs) | ||
{ | ||
preempt_disable(); | ||
if (test_tsk_fpu(regs)) | ||
disable_ptreg_fpu(regs); | ||
preempt_enable(); | ||
} | ||
#endif /* CONFIG_FPU */ | ||
#endif /* __ASSEMBLY__ */ | ||
#endif /* __ASM_NDS32_FPU_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* Copyright (C) 2005-2018 Andes Technology Corporation */ | ||
|
||
#ifndef __ARCH_NDS32_FPUEMU_H | ||
#define __ARCH_NDS32_FPUEMU_H | ||
|
||
/* | ||
* single precision | ||
*/ | ||
|
||
void fadds(void *ft, void *fa, void *fb); | ||
void fsubs(void *ft, void *fa, void *fb); | ||
void fmuls(void *ft, void *fa, void *fb); | ||
void fdivs(void *ft, void *fa, void *fb); | ||
void fs2d(void *ft, void *fa); | ||
void fsqrts(void *ft, void *fa); | ||
void fnegs(void *ft, void *fa); | ||
int fcmps(void *ft, void *fa, void *fb, int cop); | ||
|
||
/* | ||
* double precision | ||
*/ | ||
void faddd(void *ft, void *fa, void *fb); | ||
void fsubd(void *ft, void *fa, void *fb); | ||
void fmuld(void *ft, void *fa, void *fb); | ||
void fdivd(void *ft, void *fa, void *fb); | ||
void fsqrtd(void *ft, void *fa); | ||
void fd2s(void *ft, void *fa); | ||
void fnegd(void *ft, void *fa); | ||
int fcmpd(void *ft, void *fa, void *fb, int cop); | ||
|
||
#endif /* __ARCH_NDS32_FPUEMU_H */ |
Oops, something went wrong.