aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2013-06-28 04:15:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-25 17:07:22 -0400
commit8f6c5b6c1264c6cec9b04848d0744aac0853d641 (patch)
tree4e13d31c85d77802d75ccf489f8574c7c6631ba0 /arch
parent8cf3478f19143d4e2ece4947603bff7dbd360a36 (diff)
powerpc/perf: Freeze PMC5/6 if we're not using them
commit 7a7a41f9d5b28ac3a916b057a7d3cd3f435ee9a6 upstream. On Power8 we can freeze PMC5 and 6 if we're not using them. Normally they run all the time. As noticed by Anshuman, we should unfreeze them when we disable the PMU as there are legacy tools which expect them to run all the time. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/reg.h1
-rw-r--r--arch/powerpc/perf/core-book3s.c5
-rw-r--r--arch/powerpc/perf/power8-pmu.c4
3 files changed, 8 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 4a9e408644fe..362142b69d5b 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -626,6 +626,7 @@
626#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */ 626#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */
627#define MMCR0_PMAO 0x00000080UL /* performance monitor alert has occurred, set to 0 after handling exception */ 627#define MMCR0_PMAO 0x00000080UL /* performance monitor alert has occurred, set to 0 after handling exception */
628#define MMCR0_SHRFC 0x00000040UL /* SHRre freeze conditions between threads */ 628#define MMCR0_SHRFC 0x00000040UL /* SHRre freeze conditions between threads */
629#define MMCR0_FC56 0x00000010UL /* freeze counters 5 and 6 */
629#define MMCR0_FCTI 0x00000008UL /* freeze counters in tags inactive mode */ 630#define MMCR0_FCTI 0x00000008UL /* freeze counters in tags inactive mode */
630#define MMCR0_FCTA 0x00000004UL /* freeze counters in tags active mode */ 631#define MMCR0_FCTA 0x00000004UL /* freeze counters in tags active mode */
631#define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */ 632#define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 1ab306815ff3..3d566ee896e2 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -75,6 +75,7 @@ static unsigned int freeze_events_kernel = MMCR0_FCS;
75 75
76#define MMCR0_FCHV 0 76#define MMCR0_FCHV 0
77#define MMCR0_PMCjCE MMCR0_PMCnCE 77#define MMCR0_PMCjCE MMCR0_PMCnCE
78#define MMCR0_FC56 0
78#define MMCR0_PMAO 0 79#define MMCR0_PMAO 0
79 80
80#define SPRN_MMCRA SPRN_MMCR2 81#define SPRN_MMCRA SPRN_MMCR2
@@ -870,11 +871,11 @@ static void power_pmu_disable(struct pmu *pmu)
870 } 871 }
871 872
872 /* 873 /*
873 * Set the 'freeze counters' bit, clear PMAO. 874 * Set the 'freeze counters' bit, clear PMAO/FC56.
874 */ 875 */
875 val = mfspr(SPRN_MMCR0); 876 val = mfspr(SPRN_MMCR0);
876 val |= MMCR0_FC; 877 val |= MMCR0_FC;
877 val &= ~MMCR0_PMAO; 878 val &= ~(MMCR0_PMAO | MMCR0_FC56);
878 879
879 /* 880 /*
880 * The barrier is to make sure the mtspr has been 881 * The barrier is to make sure the mtspr has been
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
index 84cdc6d892e3..d59f5b2d4c2f 100644
--- a/arch/powerpc/perf/power8-pmu.c
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -391,6 +391,10 @@ static int power8_compute_mmcr(u64 event[], int n_ev,
391 if (pmc_inuse & 0x7c) 391 if (pmc_inuse & 0x7c)
392 mmcr[0] |= MMCR0_PMCjCE; 392 mmcr[0] |= MMCR0_PMCjCE;
393 393
394 /* If we're not using PMC 5 or 6, freeze them */
395 if (!(pmc_inuse & 0x60))
396 mmcr[0] |= MMCR0_FC56;
397
394 mmcr[1] = mmcr1; 398 mmcr[1] = mmcr1;
395 mmcr[2] = mmcra; 399 mmcr[2] = mmcra;
396 400