aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm')
-rw-r--r--arch/powerpc/include/asm/perf_event_server.h6
-rw-r--r--arch/powerpc/include/asm/processor.h3
-rw-r--r--arch/powerpc/include/asm/reg.h8
-rw-r--r--arch/powerpc/include/asm/switch_to.h14
4 files changed, 30 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index f265049dd7d6..2dd7bfc459be 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -60,6 +60,7 @@ struct power_pmu {
60#define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */ 60#define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */
61#define PPMU_HAS_SIER 0x00000040 /* Has SIER */ 61#define PPMU_HAS_SIER 0x00000040 /* Has SIER */
62#define PPMU_BHRB 0x00000080 /* has BHRB feature enabled */ 62#define PPMU_BHRB 0x00000080 /* has BHRB feature enabled */
63#define PPMU_EBB 0x00000100 /* supports event based branch */
63 64
64/* 65/*
65 * Values for flags to get_alternatives() 66 * Values for flags to get_alternatives()
@@ -68,6 +69,11 @@ struct power_pmu {
68#define PPMU_LIMITED_PMC_REQD 2 /* have to put this on a limited PMC */ 69#define PPMU_LIMITED_PMC_REQD 2 /* have to put this on a limited PMC */
69#define PPMU_ONLY_COUNT_RUN 4 /* only counting in run state */ 70#define PPMU_ONLY_COUNT_RUN 4 /* only counting in run state */
70 71
72/*
73 * We use the event config bit 63 as a flag to request EBB.
74 */
75#define EVENT_CONFIG_EBB_SHIFT 63
76
71extern int register_power_pmu(struct power_pmu *); 77extern int register_power_pmu(struct power_pmu *);
72 78
73struct pt_regs; 79struct pt_regs;
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 3f19df3cc7a3..47a35b08b963 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -287,8 +287,9 @@ struct thread_struct {
287 unsigned long siar; 287 unsigned long siar;
288 unsigned long sdar; 288 unsigned long sdar;
289 unsigned long sier; 289 unsigned long sier;
290 unsigned long mmcr0;
291 unsigned long mmcr2; 290 unsigned long mmcr2;
291 unsigned mmcr0;
292 unsigned used_ebb;
292#endif 293#endif
293}; 294};
294 295
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 362142b69d5b..5d7d9c2a5473 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -621,6 +621,9 @@
621#define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */ 621#define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */
622#define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */ 622#define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */
623#define MMCR0_TBEE 0x00400000UL /* time base exception enable */ 623#define MMCR0_TBEE 0x00400000UL /* time base exception enable */
624#define MMCR0_EBE 0x00100000UL /* Event based branch enable */
625#define MMCR0_PMCC 0x000c0000UL /* PMC control */
626#define MMCR0_PMCC_U6 0x00080000UL /* PMC1-6 are R/W by user (PR) */
624#define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/ 627#define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/
625#define MMCR0_PMCjCE 0x00004000UL /* PMCj count enable*/ 628#define MMCR0_PMCjCE 0x00004000UL /* PMCj count enable*/
626#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */ 629#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */
@@ -674,6 +677,11 @@
674#define SIER_SIAR_VALID 0x0400000 /* SIAR contents valid */ 677#define SIER_SIAR_VALID 0x0400000 /* SIAR contents valid */
675#define SIER_SDAR_VALID 0x0200000 /* SDAR contents valid */ 678#define SIER_SDAR_VALID 0x0200000 /* SDAR contents valid */
676 679
680/* When EBB is enabled, some of MMCR0/MMCR2/SIER are user accessible */
681#define MMCR0_USER_MASK (MMCR0_FC | MMCR0_PMXE | MMCR0_PMAO)
682#define MMCR2_USER_MASK 0x4020100804020000UL /* (FC1P|FC2P|FC3P|FC4P|FC5P|FC6P) */
683#define SIER_USER_MASK 0x7fffffUL
684
677#define SPRN_PA6T_MMCR0 795 685#define SPRN_PA6T_MMCR0 795
678#define PA6T_MMCR0_EN0 0x0000000000000001UL 686#define PA6T_MMCR0_EN0 0x0000000000000001UL
679#define PA6T_MMCR0_EN1 0x0000000000000002UL 687#define PA6T_MMCR0_EN1 0x0000000000000002UL
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 200d763a0a67..49a13e0ef234 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -67,4 +67,18 @@ static inline void flush_spe_to_thread(struct task_struct *t)
67} 67}
68#endif 68#endif
69 69
70static inline void clear_task_ebb(struct task_struct *t)
71{
72#ifdef CONFIG_PPC_BOOK3S_64
73 /* EBB perf events are not inherited, so clear all EBB state. */
74 t->thread.bescr = 0;
75 t->thread.mmcr2 = 0;
76 t->thread.mmcr0 = 0;
77 t->thread.siar = 0;
78 t->thread.sdar = 0;
79 t->thread.sier = 0;
80 t->thread.used_ebb = 0;
81#endif
82}
83
70#endif /* _ASM_POWERPC_SWITCH_TO_H */ 84#endif /* _ASM_POWERPC_SWITCH_TO_H */