diff options
author | David S. Miller <davem@davemloft.net> | 2012-08-16 23:35:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-19 02:03:53 -0400 |
commit | 8c79bfa51101354853f0f5d3b02435cec429da51 (patch) | |
tree | 412a66bd5885179b65a957956ad7978b6bada7f4 | |
parent | 6f859c0e96f0737a543610a189d12420c569110f (diff) |
sparc64: Add hypervisor interfaces for SPARC-T4 perf counter access.
Unlike for previous chips, access to the perf-counter control
registers are all hyper-privileged. Therefore, access to them must go
through a hypervisor interface.
Signed-off-by: David S. Miller <davem@davemloft.net>
-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 |
3 files changed, 28 insertions, 0 deletions
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h index 015a761eaa32..ca121f0fa3ec 100644 --- a/arch/sparc/include/asm/hypervisor.h +++ b/arch/sparc/include/asm/hypervisor.h | |||
@@ -2934,6 +2934,16 @@ extern unsigned long sun4v_reboot_data_set(unsigned long ra, | |||
2934 | unsigned long len); | 2934 | unsigned long len); |
2935 | #endif | 2935 | #endif |
2936 | 2936 | ||
2937 | #define HV_FAST_VT_GET_PERFREG 0x184 | ||
2938 | #define HV_FAST_VT_SET_PERFREG 0x185 | ||
2939 | |||
2940 | #ifndef __ASSEMBLY__ | ||
2941 | extern unsigned long sun4v_vt_get_perfreg(unsigned long reg_num, | ||
2942 | unsigned long *reg_val); | ||
2943 | extern unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, | ||
2944 | unsigned long reg_val); | ||
2945 | #endif | ||
2946 | |||
2937 | /* Function numbers for HV_CORE_TRAP. */ | 2947 | /* Function numbers for HV_CORE_TRAP. */ |
2938 | #define HV_CORE_SET_VER 0x00 | 2948 | #define HV_CORE_SET_VER 0x00 |
2939 | #define HV_CORE_PUTCHAR 0x01 | 2949 | #define HV_CORE_PUTCHAR 0x01 |
@@ -2964,6 +2974,7 @@ extern unsigned long sun4v_reboot_data_set(unsigned long ra, | |||
2964 | #define HV_GRP_NIU 0x0204 | 2974 | #define HV_GRP_NIU 0x0204 |
2965 | #define HV_GRP_VF_CPU 0x0205 | 2975 | #define HV_GRP_VF_CPU 0x0205 |
2966 | #define HV_GRP_KT_CPU 0x0209 | 2976 | #define HV_GRP_KT_CPU 0x0209 |
2977 | #define HV_GRP_VT_CPU 0x020c | ||
2967 | #define HV_GRP_DIAG 0x0300 | 2978 | #define HV_GRP_DIAG 0x0300 |
2968 | 2979 | ||
2969 | #ifndef __ASSEMBLY__ | 2980 | #ifndef __ASSEMBLY__ |
diff --git a/arch/sparc/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c index 8593672838fd..1032df43ec95 100644 --- a/arch/sparc/kernel/hvapi.c +++ b/arch/sparc/kernel/hvapi.c | |||
@@ -45,6 +45,7 @@ static struct api_info api_table[] = { | |||
45 | { .group = HV_GRP_NIU, }, | 45 | { .group = HV_GRP_NIU, }, |
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_DIAG, .flags = FLAG_PRE_API }, | 49 | { .group = HV_GRP_DIAG, .flags = FLAG_PRE_API }, |
49 | }; | 50 | }; |
50 | 51 | ||
diff --git a/arch/sparc/kernel/hvcalls.S b/arch/sparc/kernel/hvcalls.S index 58d60de4d65b..f3ab509b76a8 100644 --- a/arch/sparc/kernel/hvcalls.S +++ b/arch/sparc/kernel/hvcalls.S | |||
@@ -805,3 +805,19 @@ ENTRY(sun4v_reboot_data_set) | |||
805 | retl | 805 | retl |
806 | nop | 806 | nop |
807 | ENDPROC(sun4v_reboot_data_set) | 807 | ENDPROC(sun4v_reboot_data_set) |
808 | |||
809 | ENTRY(sun4v_vt_get_perfreg) | ||
810 | mov %o1, %o4 | ||
811 | mov HV_FAST_VT_GET_PERFREG, %o5 | ||
812 | ta HV_FAST_TRAP | ||
813 | stx %o1, [%o4] | ||
814 | retl | ||
815 | nop | ||
816 | ENDPROC(sun4v_vt_get_perfreg) | ||
817 | |||
818 | ENTRY(sun4v_vt_set_perfreg) | ||
819 | mov HV_FAST_VT_SET_PERFREG, %o5 | ||
820 | ta HV_FAST_TRAP | ||
821 | retl | ||
822 | nop | ||
823 | ENDPROC(sun4v_vt_set_perfreg) | ||