Commit 860aad71 authored by Michael Ellerman's avatar Michael Ellerman Committed by Benjamin Herrenschmidt

powerpc/perf: Add regs_no_sipr()

On power8 the presence or absence of SIPR depends on settings at runtime,
so convert to using a dynamic flag for NO_SIPR. Existing backends that
set NO_SIPR unconditionally set the dynamic flag obviously.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Acked-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 33904054
...@@ -156,6 +156,11 @@ static bool regs_sipr(struct pt_regs *regs) ...@@ -156,6 +156,11 @@ static bool regs_sipr(struct pt_regs *regs)
return !!(regs->dsisr & sipr); return !!(regs->dsisr & sipr);
} }
static bool regs_no_sipr(struct pt_regs *regs)
{
return !!(regs->result & 2);
}
static inline u32 perf_flags_from_msr(struct pt_regs *regs) static inline u32 perf_flags_from_msr(struct pt_regs *regs)
{ {
if (regs->msr & MSR_PR) if (regs->msr & MSR_PR)
...@@ -178,7 +183,7 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs) ...@@ -178,7 +183,7 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
* SIAR which should give slightly more reliable * SIAR which should give slightly more reliable
* results * results
*/ */
if (ppmu->flags & PPMU_NO_SIPR) { if (regs_no_sipr(regs)) {
unsigned long siar = mfspr(SPRN_SIAR); unsigned long siar = mfspr(SPRN_SIAR);
if (siar >= PAGE_OFFSET) if (siar >= PAGE_OFFSET)
return PERF_RECORD_MISC_KERNEL; return PERF_RECORD_MISC_KERNEL;
...@@ -208,6 +213,10 @@ static inline void perf_read_regs(struct pt_regs *regs) ...@@ -208,6 +213,10 @@ static inline void perf_read_regs(struct pt_regs *regs)
int use_siar; int use_siar;
regs->dsisr = mmcra; regs->dsisr = mmcra;
regs->result = 0;
if (ppmu->flags & PPMU_NO_SIPR)
regs->result |= 2;
/* /*
* If this isn't a PMU exception (eg a software event) the SIAR is * If this isn't a PMU exception (eg a software event) the SIAR is
...@@ -232,12 +241,12 @@ static inline void perf_read_regs(struct pt_regs *regs) ...@@ -232,12 +241,12 @@ static inline void perf_read_regs(struct pt_regs *regs)
use_siar = 1; use_siar = 1;
else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING)) else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING))
use_siar = 0; use_siar = 0;
else if (!(ppmu->flags & PPMU_NO_SIPR) && regs_sipr(regs)) else if (!regs_no_sipr(regs) && regs_sipr(regs))
use_siar = 0; use_siar = 0;
else else
use_siar = 1; use_siar = 1;
regs->result = use_siar; regs->result |= use_siar;
} }
/* /*
......
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