diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-05-30 22:01:47 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-05-31 04:52:48 -0400 |
commit | dbbe3cb8cff6b494ac2cba6a94dc7aabe7e5b635 (patch) | |
tree | 38832dcc3083891ef65d794d34343d71b67c7984 | |
parent | 3f0a6766e0cc5a577805732e5adb50a585c58175 (diff) |
[SPARC64]: Add missing NCS and SVC hypervisor interfaces.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc64/kernel/entry.S | 72 | ||||
-rw-r--r-- | include/asm-sparc64/hypervisor.h | 168 |
2 files changed, 240 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index 8f10dda0f5c0..ed712e0b3372 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S | |||
@@ -2498,3 +2498,75 @@ sun4v_vintr_set_target: | |||
2498 | retl | 2498 | retl |
2499 | nop | 2499 | nop |
2500 | .size sun4v_vintr_set_target, .-sun4v_vintr_set_target | 2500 | .size sun4v_vintr_set_target, .-sun4v_vintr_set_target |
2501 | |||
2502 | /* %o0: NCS sub-function | ||
2503 | * %o1: sub-function arg real-address | ||
2504 | * %o2: sub-function arg size | ||
2505 | * | ||
2506 | * returns %o0: status | ||
2507 | */ | ||
2508 | .globl sun4v_ncs_request | ||
2509 | .type sun4v_ncs_request,#function | ||
2510 | sun4v_ncs_request: | ||
2511 | mov HV_FAST_NCS_REQUEST, %o5 | ||
2512 | ta HV_FAST_TRAP | ||
2513 | retl | ||
2514 | nop | ||
2515 | .size sun4v_ncs_request, .-sun4v_ncs_request | ||
2516 | |||
2517 | .globl sun4v_scv_send | ||
2518 | .type sun4v_scv_send,#function | ||
2519 | sun4v_scv_send: | ||
2520 | save %sp, -192, %sp | ||
2521 | mov %i0, %o0 | ||
2522 | mov %i1, %o1 | ||
2523 | mov %i2, %o2 | ||
2524 | mov HV_FAST_SVC_SEND, %o5 | ||
2525 | ta HV_FAST_TRAP | ||
2526 | stx %o1, [%i3] | ||
2527 | ret | ||
2528 | restore | ||
2529 | .size sun4v_scv_send, .-sun4v_scv_send | ||
2530 | |||
2531 | .globl sun4v_scv_recv | ||
2532 | .type sun4v_scv_recv,#function | ||
2533 | sun4v_scv_recv: | ||
2534 | save %sp, -192, %sp | ||
2535 | mov %i0, %o0 | ||
2536 | mov %i1, %o1 | ||
2537 | mov %i2, %o2 | ||
2538 | mov HV_FAST_SVC_RECV, %o5 | ||
2539 | ta HV_FAST_TRAP | ||
2540 | stx %o1, [%i3] | ||
2541 | ret | ||
2542 | restore | ||
2543 | .size sun4v_scv_recv, .-sun4v_scv_recv | ||
2544 | |||
2545 | .globl sun4v_scv_getstatus | ||
2546 | .type sun4v_scv_getstatus,#function | ||
2547 | sun4v_scv_getstatus: | ||
2548 | mov HV_FAST_SVC_GETSTATUS, %o5 | ||
2549 | mov %o1, %o4 | ||
2550 | ta HV_FAST_TRAP | ||
2551 | stx %o1, [%o4] | ||
2552 | retl | ||
2553 | nop | ||
2554 | .size sun4v_scv_getstatus, .-sun4v_scv_getstatus | ||
2555 | |||
2556 | .globl sun4v_scv_setstatus | ||
2557 | .type sun4v_scv_setstatus,#function | ||
2558 | sun4v_scv_setstatus: | ||
2559 | mov HV_FAST_SVC_SETSTATUS, %o5 | ||
2560 | ta HV_FAST_TRAP | ||
2561 | retl | ||
2562 | nop | ||
2563 | .size sun4v_scv_setstatus, .-sun4v_scv_setstatus | ||
2564 | |||
2565 | .globl sun4v_scv_clrstatus | ||
2566 | .type sun4v_scv_clrstatus,#function | ||
2567 | sun4v_scv_clrstatus: | ||
2568 | mov HV_FAST_SVC_CLRSTATUS, %o5 | ||
2569 | ta HV_FAST_TRAP | ||
2570 | retl | ||
2571 | nop | ||
2572 | .size sun4v_scv_clrstatus, .-sun4v_scv_clrstatus | ||
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h index 5cdb1ff04838..4a43075a0619 100644 --- a/include/asm-sparc64/hypervisor.h +++ b/include/asm-sparc64/hypervisor.h | |||
@@ -1097,6 +1097,80 @@ extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state, | |||
1097 | */ | 1097 | */ |
1098 | #define HV_FAST_MACH_GET_SOFT_STATE 0x71 | 1098 | #define HV_FAST_MACH_GET_SOFT_STATE 0x71 |
1099 | 1099 | ||
1100 | /* svc_send() | ||
1101 | * TRAP: HV_FAST_TRAP | ||
1102 | * FUNCTION: HV_FAST_SVC_SEND | ||
1103 | * ARG0: service ID | ||
1104 | * ARG1: buffer real address | ||
1105 | * ARG2: buffer size | ||
1106 | * RET0: STATUS | ||
1107 | * RET1: sent_bytes | ||
1108 | * | ||
1109 | * Be careful, all output registers are clobbered by this operation, | ||
1110 | * so for example it is not possible to save away a value in %o4 | ||
1111 | * across the trap. | ||
1112 | */ | ||
1113 | #define HV_FAST_SVC_SEND 0x80 | ||
1114 | |||
1115 | /* svc_recv() | ||
1116 | * TRAP: HV_FAST_TRAP | ||
1117 | * FUNCTION: HV_FAST_SVC_RECV | ||
1118 | * ARG0: service ID | ||
1119 | * ARG1: buffer real address | ||
1120 | * ARG2: buffer size | ||
1121 | * RET0: STATUS | ||
1122 | * RET1: recv_bytes | ||
1123 | * | ||
1124 | * Be careful, all output registers are clobbered by this operation, | ||
1125 | * so for example it is not possible to save away a value in %o4 | ||
1126 | * across the trap. | ||
1127 | */ | ||
1128 | #define HV_FAST_SVC_RECV 0x81 | ||
1129 | |||
1130 | /* svc_getstatus() | ||
1131 | * TRAP: HV_FAST_TRAP | ||
1132 | * FUNCTION: HV_FAST_SVC_GETSTATUS | ||
1133 | * ARG0: service ID | ||
1134 | * RET0: STATUS | ||
1135 | * RET1: status bits | ||
1136 | */ | ||
1137 | #define HV_FAST_SVC_GETSTATUS 0x82 | ||
1138 | |||
1139 | /* svc_setstatus() | ||
1140 | * TRAP: HV_FAST_TRAP | ||
1141 | * FUNCTION: HV_FAST_SVC_SETSTATUS | ||
1142 | * ARG0: service ID | ||
1143 | * ARG1: bits to set | ||
1144 | * RET0: STATUS | ||
1145 | */ | ||
1146 | #define HV_FAST_SVC_SETSTATUS 0x83 | ||
1147 | |||
1148 | /* svc_clrstatus() | ||
1149 | * TRAP: HV_FAST_TRAP | ||
1150 | * FUNCTION: HV_FAST_SVC_CLRSTATUS | ||
1151 | * ARG0: service ID | ||
1152 | * ARG1: bits to clear | ||
1153 | * RET0: STATUS | ||
1154 | */ | ||
1155 | #define HV_FAST_SVC_CLRSTATUS 0x84 | ||
1156 | |||
1157 | #ifndef __ASSEMBLY__ | ||
1158 | extern unsigned long sun4v_svc_send(unsigned long svc_id, | ||
1159 | unsigned long buffer, | ||
1160 | unsigned long buffer_size, | ||
1161 | unsigned long *sent_bytes); | ||
1162 | extern unsigned long sun4v_svc_recv(unsigned long svc_id, | ||
1163 | unsigned long buffer, | ||
1164 | unsigned long buffer_size, | ||
1165 | unsigned long *recv_bytes); | ||
1166 | extern unsigned long sun4v_svc_getstatus(unsigned long svc_id, | ||
1167 | unsigned long *status_bits); | ||
1168 | extern unsigned long sun4v_svc_setstatus(unsigned long svc_id, | ||
1169 | unsigned long status_bits); | ||
1170 | extern unsigned long sun4v_svc_clrstatus(unsigned long svc_id, | ||
1171 | unsigned long status_bits); | ||
1172 | #endif | ||
1173 | |||
1100 | /* Trap trace services. | 1174 | /* Trap trace services. |
1101 | * | 1175 | * |
1102 | * The hypervisor provides a trap tracing capability for privileged | 1176 | * The hypervisor provides a trap tracing capability for privileged |
@@ -2724,6 +2798,100 @@ struct hv_mmu_statistics { | |||
2724 | */ | 2798 | */ |
2725 | #define HV_FAST_MMUSTAT_INFO 0x103 | 2799 | #define HV_FAST_MMUSTAT_INFO 0x103 |
2726 | 2800 | ||
2801 | /* NCS crypto services */ | ||
2802 | |||
2803 | /* ncs_request() sub-function numbers */ | ||
2804 | #define HV_NCS_QCONF 0x01 | ||
2805 | #define HV_NCS_QTAIL_UPDATE 0x02 | ||
2806 | |||
2807 | #ifndef __ASSEMBLY__ | ||
2808 | struct hv_ncs_queue_entry { | ||
2809 | /* MAU Control Register */ | ||
2810 | unsigned long mau_control; | ||
2811 | #define MAU_CONTROL_INV_PARITY 0x0000000000002000 | ||
2812 | #define MAU_CONTROL_STRAND 0x0000000000001800 | ||
2813 | #define MAU_CONTROL_BUSY 0x0000000000000400 | ||
2814 | #define MAU_CONTROL_INT 0x0000000000000200 | ||
2815 | #define MAU_CONTROL_OP 0x00000000000001c0 | ||
2816 | #define MAU_CONTROL_OP_SHIFT 6 | ||
2817 | #define MAU_OP_LOAD_MA_MEMORY 0x0 | ||
2818 | #define MAU_OP_STORE_MA_MEMORY 0x1 | ||
2819 | #define MAU_OP_MODULAR_MULT 0x2 | ||
2820 | #define MAU_OP_MODULAR_REDUCE 0x3 | ||
2821 | #define MAU_OP_MODULAR_EXP_LOOP 0x4 | ||
2822 | #define MAU_CONTROL_LEN 0x000000000000003f | ||
2823 | #define MAU_CONTROL_LEN_SHIFT 0 | ||
2824 | |||
2825 | /* Real address of bytes to load or store bytes | ||
2826 | * into/out-of the MAU. | ||
2827 | */ | ||
2828 | unsigned long mau_mpa; | ||
2829 | |||
2830 | /* Modular Arithmetic MA Offset Register. */ | ||
2831 | unsigned long mau_ma; | ||
2832 | |||
2833 | /* Modular Arithmetic N Prime Register. */ | ||
2834 | unsigned long mau_np; | ||
2835 | }; | ||
2836 | |||
2837 | struct hv_ncs_qconf_arg { | ||
2838 | unsigned long mid; /* MAU ID, 1 per core on Niagara */ | ||
2839 | unsigned long base; /* Real address base of queue */ | ||
2840 | unsigned long end; /* Real address end of queue */ | ||
2841 | unsigned long num_ents; /* Number of entries in queue */ | ||
2842 | }; | ||
2843 | |||
2844 | struct hv_ncs_qtail_update_arg { | ||
2845 | unsigned long mid; /* MAU ID, 1 per core on Niagara */ | ||
2846 | unsigned long tail; /* New tail index to use */ | ||
2847 | unsigned long syncflag; /* only SYNCFLAG_SYNC is implemented */ | ||
2848 | #define HV_NCS_SYNCFLAG_SYNC 0x00 | ||
2849 | #define HV_NCS_SYNCFLAG_ASYNC 0x01 | ||
2850 | }; | ||
2851 | #endif | ||
2852 | |||
2853 | /* ncs_request() | ||
2854 | * TRAP: HV_FAST_TRAP | ||
2855 | * FUNCTION: HV_FAST_NCS_REQUEST | ||
2856 | * ARG0: NCS sub-function | ||
2857 | * ARG1: sub-function argument real address | ||
2858 | * ARG2: size in bytes of sub-function argument | ||
2859 | * RET0: status | ||
2860 | * | ||
2861 | * The MAU chip of the Niagara processor is not directly accessible | ||
2862 | * to privileged code, instead it is programmed indirectly via this | ||
2863 | * hypervisor API. | ||
2864 | * | ||
2865 | * The interfaces defines a queue of MAU operations to perform. | ||
2866 | * Privileged code registers a queue with the hypervisor by invoking | ||
2867 | * this HVAPI with the HV_NCS_QCONF sub-function, which defines the | ||
2868 | * base, end, and number of entries of the queue. Each queue entry | ||
2869 | * contains a MAU register struct block. | ||
2870 | * | ||
2871 | * The privileged code then proceeds to add entries to the queue and | ||
2872 | * then invoke the HV_NCS_QTAIL_UPDATE sub-function. Since only | ||
2873 | * synchronous operations are supported by the current hypervisor, | ||
2874 | * HV_NCS_QTAIL_UPDATE will run all the pending queue entries to | ||
2875 | * completion and return HV_EOK, or return an error code. | ||
2876 | * | ||
2877 | * The real address of the sub-function argument must be aligned on at | ||
2878 | * least an 8-byte boundary. | ||
2879 | * | ||
2880 | * The tail argument of HV_NCS_QTAIL_UPDATE is an index, not a byte | ||
2881 | * offset, into the queue and must be less than or equal the 'num_ents' | ||
2882 | * argument given in the HV_NCS_QCONF call. | ||
2883 | */ | ||
2884 | #define HV_FAST_NCS_REQUEST 0x110 | ||
2885 | |||
2886 | #ifndef __ASSEMBLY__ | ||
2887 | extern unsigned long sun4v_ncs_request(unsigned long request, | ||
2888 | unsigned long arg_ra, | ||
2889 | unsigned long arg_size); | ||
2890 | #endif | ||
2891 | |||
2892 | #define HV_FAST_FIRE_GET_PERFREG 0x120 | ||
2893 | #define HV_FAST_FIRE_SET_PERFREG 0x121 | ||
2894 | |||
2727 | /* Function numbers for HV_CORE_TRAP. */ | 2895 | /* Function numbers for HV_CORE_TRAP. */ |
2728 | #define HV_CORE_SET_VER 0x00 | 2896 | #define HV_CORE_SET_VER 0x00 |
2729 | #define HV_CORE_PUTCHAR 0x01 | 2897 | #define HV_CORE_PUTCHAR 0x01 |