diff options
author | bob picco <bpicco@meloft.net> | 2014-09-16 10:09:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-16 21:26:40 -0400 |
commit | 05aa1651e8b9ca078b1808a2fe7b50703353ec02 (patch) | |
tree | 9a3cb98b69a4f1960c627586975043bcb364c82e /arch/sparc | |
parent | 7c21d533ab2ffa1e681bdaf4a53ce3046f6e0e17 (diff) |
sparc64: T5 PMU
The T5 (niagara5) has different PCR related HV fast trap values and a new
HV API Group. This patch utilizes these and shares when possible with niagara4.
We use the same sparc_pmu niagara4_pmu. Should there be new effort to
obtain the MCU perf statistics then this would have to be changed.
Cc: sparclinux@vger.kernel.org
Signed-off-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/include/asm/hypervisor.h | 11 | ||||
-rw-r--r-- | arch/sparc/kernel/hvapi.c | 1 | ||||
-rw-r--r-- | arch/sparc/kernel/hvcalls.S | 16 | ||||
-rw-r--r-- | arch/sparc/kernel/pcr.c | 47 | ||||
-rw-r--r-- | arch/sparc/kernel/perf_event.c | 3 |
5 files changed, 73 insertions, 5 deletions
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h index 94b39caea3eb..4f6725ff4c33 100644 --- a/arch/sparc/include/asm/hypervisor.h +++ b/arch/sparc/include/asm/hypervisor.h | |||
@@ -2947,6 +2947,16 @@ unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, | |||
2947 | unsigned long reg_val); | 2947 | unsigned long reg_val); |
2948 | #endif | 2948 | #endif |
2949 | 2949 | ||
2950 | #define HV_FAST_T5_GET_PERFREG 0x1a8 | ||
2951 | #define HV_FAST_T5_SET_PERFREG 0x1a9 | ||
2952 | |||
2953 | #ifndef __ASSEMBLY__ | ||
2954 | unsigned long sun4v_t5_get_perfreg(unsigned long reg_num, | ||
2955 | unsigned long *reg_val); | ||
2956 | unsigned long sun4v_t5_set_perfreg(unsigned long reg_num, | ||
2957 | unsigned long reg_val); | ||
2958 | #endif | ||
2959 | |||
2950 | /* Function numbers for HV_CORE_TRAP. */ | 2960 | /* Function numbers for HV_CORE_TRAP. */ |
2951 | #define HV_CORE_SET_VER 0x00 | 2961 | #define HV_CORE_SET_VER 0x00 |
2952 | #define HV_CORE_PUTCHAR 0x01 | 2962 | #define HV_CORE_PUTCHAR 0x01 |
@@ -2978,6 +2988,7 @@ unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, | |||
2978 | #define HV_GRP_VF_CPU 0x0205 | 2988 | #define HV_GRP_VF_CPU 0x0205 |
2979 | #define HV_GRP_KT_CPU 0x0209 | 2989 | #define HV_GRP_KT_CPU 0x0209 |
2980 | #define HV_GRP_VT_CPU 0x020c | 2990 | #define HV_GRP_VT_CPU 0x020c |
2991 | #define HV_GRP_T5_CPU 0x0211 | ||
2981 | #define HV_GRP_DIAG 0x0300 | 2992 | #define HV_GRP_DIAG 0x0300 |
2982 | 2993 | ||
2983 | #ifndef __ASSEMBLY__ | 2994 | #ifndef __ASSEMBLY__ |
diff --git a/arch/sparc/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c index c0a2de0fd624..5c55145bfbf0 100644 --- a/arch/sparc/kernel/hvapi.c +++ b/arch/sparc/kernel/hvapi.c | |||
@@ -46,6 +46,7 @@ static struct api_info api_table[] = { | |||
46 | { .group = HV_GRP_VF_CPU, }, | 46 | { .group = HV_GRP_VF_CPU, }, |
47 | { .group = HV_GRP_KT_CPU, }, | 47 | { .group = HV_GRP_KT_CPU, }, |
48 | { .group = HV_GRP_VT_CPU, }, | 48 | { .group = HV_GRP_VT_CPU, }, |
49 | { .group = HV_GRP_T5_CPU, }, | ||
49 | { .group = HV_GRP_DIAG, .flags = FLAG_PRE_API }, | 50 | { .group = HV_GRP_DIAG, .flags = FLAG_PRE_API }, |
50 | }; | 51 | }; |
51 | 52 | ||
diff --git a/arch/sparc/kernel/hvcalls.S b/arch/sparc/kernel/hvcalls.S index f3ab509b76a8..caedf8320416 100644 --- a/arch/sparc/kernel/hvcalls.S +++ b/arch/sparc/kernel/hvcalls.S | |||
@@ -821,3 +821,19 @@ ENTRY(sun4v_vt_set_perfreg) | |||
821 | retl | 821 | retl |
822 | nop | 822 | nop |
823 | ENDPROC(sun4v_vt_set_perfreg) | 823 | ENDPROC(sun4v_vt_set_perfreg) |
824 | |||
825 | ENTRY(sun4v_t5_get_perfreg) | ||
826 | mov %o1, %o4 | ||
827 | mov HV_FAST_T5_GET_PERFREG, %o5 | ||
828 | ta HV_FAST_TRAP | ||
829 | stx %o1, [%o4] | ||
830 | retl | ||
831 | nop | ||
832 | ENDPROC(sun4v_t5_get_perfreg) | ||
833 | |||
834 | ENTRY(sun4v_t5_set_perfreg) | ||
835 | mov HV_FAST_T5_SET_PERFREG, %o5 | ||
836 | ta HV_FAST_TRAP | ||
837 | retl | ||
838 | nop | ||
839 | ENDPROC(sun4v_t5_set_perfreg) | ||
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c index 269af58497aa..7e967c8018c8 100644 --- a/arch/sparc/kernel/pcr.c +++ b/arch/sparc/kernel/pcr.c | |||
@@ -191,12 +191,41 @@ static const struct pcr_ops n4_pcr_ops = { | |||
191 | .pcr_nmi_disable = PCR_N4_PICNPT, | 191 | .pcr_nmi_disable = PCR_N4_PICNPT, |
192 | }; | 192 | }; |
193 | 193 | ||
194 | static u64 n5_pcr_read(unsigned long reg_num) | ||
195 | { | ||
196 | unsigned long val; | ||
197 | |||
198 | (void) sun4v_t5_get_perfreg(reg_num, &val); | ||
199 | |||
200 | return val; | ||
201 | } | ||
202 | |||
203 | static void n5_pcr_write(unsigned long reg_num, u64 val) | ||
204 | { | ||
205 | (void) sun4v_t5_set_perfreg(reg_num, val); | ||
206 | } | ||
207 | |||
208 | static const struct pcr_ops n5_pcr_ops = { | ||
209 | .read_pcr = n5_pcr_read, | ||
210 | .write_pcr = n5_pcr_write, | ||
211 | .read_pic = n4_pic_read, | ||
212 | .write_pic = n4_pic_write, | ||
213 | .nmi_picl_value = n4_picl_value, | ||
214 | .pcr_nmi_enable = (PCR_N4_PICNPT | PCR_N4_STRACE | | ||
215 | PCR_N4_UTRACE | PCR_N4_TOE | | ||
216 | (26 << PCR_N4_SL_SHIFT)), | ||
217 | .pcr_nmi_disable = PCR_N4_PICNPT, | ||
218 | }; | ||
219 | |||
220 | |||
194 | static unsigned long perf_hsvc_group; | 221 | static unsigned long perf_hsvc_group; |
195 | static unsigned long perf_hsvc_major; | 222 | static unsigned long perf_hsvc_major; |
196 | static unsigned long perf_hsvc_minor; | 223 | static unsigned long perf_hsvc_minor; |
197 | 224 | ||
198 | static int __init register_perf_hsvc(void) | 225 | static int __init register_perf_hsvc(void) |
199 | { | 226 | { |
227 | unsigned long hverror; | ||
228 | |||
200 | if (tlb_type == hypervisor) { | 229 | if (tlb_type == hypervisor) { |
201 | switch (sun4v_chip_type) { | 230 | switch (sun4v_chip_type) { |
202 | case SUN4V_CHIP_NIAGARA1: | 231 | case SUN4V_CHIP_NIAGARA1: |
@@ -215,6 +244,10 @@ static int __init register_perf_hsvc(void) | |||
215 | perf_hsvc_group = HV_GRP_VT_CPU; | 244 | perf_hsvc_group = HV_GRP_VT_CPU; |
216 | break; | 245 | break; |
217 | 246 | ||
247 | case SUN4V_CHIP_NIAGARA5: | ||
248 | perf_hsvc_group = HV_GRP_T5_CPU; | ||
249 | break; | ||
250 | |||
218 | default: | 251 | default: |
219 | return -ENODEV; | 252 | return -ENODEV; |
220 | } | 253 | } |
@@ -222,10 +255,12 @@ static int __init register_perf_hsvc(void) | |||
222 | 255 | ||
223 | perf_hsvc_major = 1; | 256 | perf_hsvc_major = 1; |
224 | perf_hsvc_minor = 0; | 257 | perf_hsvc_minor = 0; |
225 | if (sun4v_hvapi_register(perf_hsvc_group, | 258 | hverror = sun4v_hvapi_register(perf_hsvc_group, |
226 | perf_hsvc_major, | 259 | perf_hsvc_major, |
227 | &perf_hsvc_minor)) { | 260 | &perf_hsvc_minor); |
228 | printk("perfmon: Could not register hvapi.\n"); | 261 | if (hverror) { |
262 | pr_err("perfmon: Could not register hvapi(0x%lx).\n", | ||
263 | hverror); | ||
229 | return -ENODEV; | 264 | return -ENODEV; |
230 | } | 265 | } |
231 | } | 266 | } |
@@ -254,6 +289,10 @@ static int __init setup_sun4v_pcr_ops(void) | |||
254 | pcr_ops = &n4_pcr_ops; | 289 | pcr_ops = &n4_pcr_ops; |
255 | break; | 290 | break; |
256 | 291 | ||
292 | case SUN4V_CHIP_NIAGARA5: | ||
293 | pcr_ops = &n5_pcr_ops; | ||
294 | break; | ||
295 | |||
257 | default: | 296 | default: |
258 | ret = -ENODEV; | 297 | ret = -ENODEV; |
259 | break; | 298 | break; |
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index d35c490a91cb..c9759ad3f34a 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
@@ -1662,7 +1662,8 @@ static bool __init supported_pmu(void) | |||
1662 | sparc_pmu = &niagara2_pmu; | 1662 | sparc_pmu = &niagara2_pmu; |
1663 | return true; | 1663 | return true; |
1664 | } | 1664 | } |
1665 | if (!strcmp(sparc_pmu_type, "niagara4")) { | 1665 | if (!strcmp(sparc_pmu_type, "niagara4") || |
1666 | !strcmp(sparc_pmu_type, "niagara5")) { | ||
1666 | sparc_pmu = &niagara4_pmu; | 1667 | sparc_pmu = &niagara4_pmu; |
1667 | return true; | 1668 | return true; |
1668 | } | 1669 | } |