Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[POWERPC] clean up pseries hcall interfaces

Our pseries hcall interfaces are out of control:

plpar_hcall_norets
plpar_hcall
plpar_hcall_8arg_2ret
plpar_hcall_4out
plpar_hcall_7arg_7ret
plpar_hcall_9arg_9ret

Create 3 interfaces to cover all cases:

plpar_hcall_norets: 7 arguments no returns
plpar_hcall: 6 arguments 4 returns
plpar_hcall9: 9 arguments 9 returns

There are only 2 cases in the kernel that need plpar_hcall9, hopefully
we can keep it that way.

Pass in a buffer to stash return parameters so we avoid the &dummy1,
&dummy2 madness.

Signed-off-by: Anton Blanchard <anton@samba.org>
--
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Anton Blanchard and committed by
Paul Mackerras
b9377ffc 57cad808

+185 -314
+14 -4
arch/powerpc/kernel/lparcfg.c
··· 182 182 unsigned long *resource) 183 183 { 184 184 unsigned long rc; 185 - rc = plpar_hcall_4out(H_GET_PPP, 0, 0, 0, 0, entitled, unallocated, 186 - aggregation, resource); 185 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 186 + 187 + rc = plpar_hcall(H_GET_PPP, retbuf); 188 + 189 + *entitled = retbuf[0]; 190 + *unallocated = retbuf[1]; 191 + *aggregation = retbuf[2]; 192 + *resource = retbuf[3]; 187 193 188 194 log_plpar_hcall_return(rc, "H_GET_PPP"); 189 195 ··· 199 193 static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs) 200 194 { 201 195 unsigned long rc; 202 - unsigned long dummy; 203 - rc = plpar_hcall(H_PIC, 0, 0, 0, 0, pool_idle_time, num_procs, &dummy); 196 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 197 + 198 + rc = plpar_hcall(H_PIC, retbuf); 199 + 200 + *pool_idle_time = retbuf[0]; 201 + *num_procs = retbuf[1]; 204 202 205 203 if (rc != H_AUTHORITY) 206 204 log_plpar_hcall_return(rc, "H_PIC");
+5 -6
arch/powerpc/kernel/rtas.c
··· 668 668 int i; 669 669 long state; 670 670 long rc; 671 - unsigned long dummy; 672 - 671 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 673 672 struct rtas_suspend_me_data data; 674 673 675 674 /* Make sure the state is valid */ 676 - rc = plpar_hcall(H_VASI_STATE, 677 - ((u64)args->args[0] << 32) | args->args[1], 678 - 0, 0, 0, 679 - &state, &dummy, &dummy); 675 + rc = plpar_hcall(H_VASI_STATE, retbuf, 676 + ((u64)args->args[0] << 32) | args->args[1]); 677 + 678 + state = retbuf[0]; 680 679 681 680 if (rc) { 682 681 printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc);
+36 -173
arch/powerpc/platforms/pseries/hvCall.S
··· 1 1 /* 2 2 * This file contains the generic code to perform a call to the 3 3 * pSeries LPAR hypervisor. 4 - * NOTE: this file will go away when we move to inline this work. 5 4 * 6 5 * This program is free software; you can redistribute it and/or 7 6 * modify it under the terms of the GNU General Public License ··· 15 16 16 17 .text 17 18 18 - /* long plpar_hcall(unsigned long opcode, R3 19 - unsigned long arg1, R4 20 - unsigned long arg2, R5 21 - unsigned long arg3, R6 22 - unsigned long arg4, R7 23 - unsigned long *out1, R8 24 - unsigned long *out2, R9 25 - unsigned long *out3); R10 26 - */ 27 - _GLOBAL(plpar_hcall) 28 - HMT_MEDIUM 29 - 30 - mfcr r0 31 - 32 - std r8,STK_PARM(r8)(r1) /* Save out ptrs */ 33 - std r9,STK_PARM(r9)(r1) 34 - std r10,STK_PARM(r10)(r1) 35 - 36 - stw r0,8(r1) 37 - 38 - HVSC /* invoke the hypervisor */ 39 - 40 - lwz r0,8(r1) 41 - 42 - ld r8,STK_PARM(r8)(r1) /* Fetch r4-r6 ret args */ 43 - ld r9,STK_PARM(r9)(r1) 44 - ld r10,STK_PARM(r10)(r1) 45 - std r4,0(r8) 46 - std r5,0(r9) 47 - std r6,0(r10) 48 - 49 - mtcrf 0xff,r0 50 - blr /* return r3 = status */ 51 - 52 - 53 - /* Simple interface with no output values (other than status) */ 54 19 _GLOBAL(plpar_hcall_norets) 55 20 HMT_MEDIUM 56 21 ··· 27 64 mtcrf 0xff,r0 28 65 blr /* return r3 = status */ 29 66 30 - 31 - /* long plpar_hcall_8arg_2ret(unsigned long opcode, R3 32 - unsigned long arg1, R4 33 - unsigned long arg2, R5 34 - unsigned long arg3, R6 35 - unsigned long arg4, R7 36 - unsigned long arg5, R8 37 - unsigned long arg6, R9 38 - unsigned long arg7, R10 39 - unsigned long arg8, 112(R1) 40 - unsigned long *out1); 120(R1) 41 - */ 42 - _GLOBAL(plpar_hcall_8arg_2ret) 43 - HMT_MEDIUM 44 - 45 - mfcr r0 46 - ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */ 47 - stw r0,8(r1) 48 - 49 - HVSC /* invoke the hypervisor */ 50 - 51 - lwz r0,8(r1) 52 - ld r10,STK_PARM(r12)(r1) /* Fetch r4 ret arg */ 53 - std r4,0(r10) 54 - mtcrf 0xff,r0 55 - blr /* return r3 = status */ 56 - 57 - 58 - /* long plpar_hcall_4out(unsigned long opcode, R3 59 - unsigned long arg1, R4 60 - unsigned long arg2, R5 61 - unsigned long arg3, R6 62 - unsigned long arg4, R7 63 - unsigned long *out1, R8 64 - unsigned long *out2, R9 65 - unsigned long *out3, R10 66 - unsigned long *out4); 112(R1) 67 - */ 68 - _GLOBAL(plpar_hcall_4out) 67 + _GLOBAL(plpar_hcall) 69 68 HMT_MEDIUM 70 69 71 70 mfcr r0 72 71 stw r0,8(r1) 73 72 74 - std r8,STK_PARM(r8)(r1) /* Save out ptrs */ 75 - std r9,STK_PARM(r9)(r1) 76 - std r10,STK_PARM(r10)(r1) 73 + std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 74 + 75 + mr r4,r5 76 + mr r5,r6 77 + mr r6,r7 78 + mr r7,r8 79 + mr r8,r9 80 + mr r9,r10 77 81 78 82 HVSC /* invoke the hypervisor */ 79 83 80 - lwz r0,8(r1) 81 - 82 - ld r8,STK_PARM(r8)(r1) /* Fetch r4-r7 ret args */ 83 - ld r9,STK_PARM(r9)(r1) 84 - ld r10,STK_PARM(r10)(r1) 85 - ld r11,STK_PARM(r11)(r1) 86 - std r4,0(r8) 87 - std r5,0(r9) 88 - std r6,0(r10) 89 - std r7,0(r11) 90 - 91 - mtcrf 0xff,r0 92 - blr /* return r3 = status */ 93 - 94 - /* plpar_hcall_7arg_7ret(unsigned long opcode, R3 95 - unsigned long arg1, R4 96 - unsigned long arg2, R5 97 - unsigned long arg3, R6 98 - unsigned long arg4, R7 99 - unsigned long arg5, R8 100 - unsigned long arg6, R9 101 - unsigned long arg7, R10 102 - unsigned long *out1, 112(R1) 103 - unsigned long *out2, 110(R1) 104 - unsigned long *out3, 108(R1) 105 - unsigned long *out4, 106(R1) 106 - unsigned long *out5, 104(R1) 107 - unsigned long *out6, 102(R1) 108 - unsigned long *out7); 100(R1) 109 - */ 110 - _GLOBAL(plpar_hcall_7arg_7ret) 111 - HMT_MEDIUM 112 - 113 - mfcr r0 114 - stw r0,8(r1) 115 - 116 - HVSC /* invoke the hypervisor */ 84 + ld r12,STK_PARM(r4)(r1) 85 + std r4, 0(r12) 86 + std r5, 8(r12) 87 + std r6, 16(r12) 88 + std r7, 24(r12) 117 89 118 90 lwz r0,8(r1) 119 - 120 - ld r11,STK_PARM(r11)(r1) /* Fetch r4 ret arg */ 121 - std r4,0(r11) 122 - ld r11,STK_PARM(r12)(r1) /* Fetch r5 ret arg */ 123 - std r5,0(r11) 124 - ld r11,STK_PARM(r13)(r1) /* Fetch r6 ret arg */ 125 - std r6,0(r11) 126 - ld r11,STK_PARM(r14)(r1) /* Fetch r7 ret arg */ 127 - std r7,0(r11) 128 - ld r11,STK_PARM(r15)(r1) /* Fetch r8 ret arg */ 129 - std r8,0(r11) 130 - ld r11,STK_PARM(r16)(r1) /* Fetch r9 ret arg */ 131 - std r9,0(r11) 132 - ld r11,STK_PARM(r17)(r1) /* Fetch r10 ret arg */ 133 - std r10,0(r11) 134 - 135 91 mtcrf 0xff,r0 136 92 137 93 blr /* return r3 = status */ 138 94 139 - /* plpar_hcall_9arg_9ret(unsigned long opcode, R3 140 - unsigned long arg1, R4 141 - unsigned long arg2, R5 142 - unsigned long arg3, R6 143 - unsigned long arg4, R7 144 - unsigned long arg5, R8 145 - unsigned long arg6, R9 146 - unsigned long arg7, R10 147 - unsigned long arg8, 112(R1) 148 - unsigned long arg9, 110(R1) 149 - unsigned long *out1, 108(R1) 150 - unsigned long *out2, 106(R1) 151 - unsigned long *out3, 104(R1) 152 - unsigned long *out4, 102(R1) 153 - unsigned long *out5, 100(R1) 154 - unsigned long *out6, 98(R1) 155 - unsigned long *out7); 96(R1) 156 - unsigned long *out8, 94(R1) 157 - unsigned long *out9, 92(R1) 158 - */ 159 - _GLOBAL(plpar_hcall_9arg_9ret) 95 + _GLOBAL(plpar_hcall9) 160 96 HMT_MEDIUM 161 97 162 98 mfcr r0 163 99 stw r0,8(r1) 164 100 165 - ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */ 166 - ld r12,STK_PARM(r12)(r1) /* put arg9 in R12 */ 101 + std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 102 + 103 + mr r4,r5 104 + mr r5,r6 105 + mr r6,r7 106 + mr r7,r8 107 + mr r8,r9 108 + mr r9,r10 109 + ld r10,STK_PARM(r11)(r1) /* put arg7 in R10 */ 110 + ld r11,STK_PARM(r12)(r1) /* put arg8 in R11 */ 111 + ld r12,STK_PARM(r13)(r1) /* put arg9 in R12 */ 167 112 168 113 HVSC /* invoke the hypervisor */ 169 114 170 - ld r0,STK_PARM(r13)(r1) /* Fetch r4 ret arg */ 171 - stdx r4,r0,r0 172 - ld r0,STK_PARM(r14)(r1) /* Fetch r5 ret arg */ 173 - stdx r5,r0,r0 174 - ld r0,STK_PARM(r15)(r1) /* Fetch r6 ret arg */ 175 - stdx r6,r0,r0 176 - ld r0,STK_PARM(r16)(r1) /* Fetch r7 ret arg */ 177 - stdx r7,r0,r0 178 - ld r0,STK_PARM(r17)(r1) /* Fetch r8 ret arg */ 179 - stdx r8,r0,r0 180 - ld r0,STK_PARM(r18)(r1) /* Fetch r9 ret arg */ 181 - stdx r9,r0,r0 182 - ld r0,STK_PARM(r19)(r1) /* Fetch r10 ret arg */ 183 - stdx r10,r0,r0 184 - ld r0,STK_PARM(r20)(r1) /* Fetch r11 ret arg */ 185 - stdx r11,r0,r0 186 - ld r0,STK_PARM(r21)(r1) /* Fetch r12 ret arg */ 187 - stdx r12,r0,r0 115 + ld r12,STK_PARM(r4)(r1) 116 + std r4, 0(r12) 117 + std r5, 8(r12) 118 + std r6, 16(r12) 119 + std r7, 24(r12) 120 + std r8, 32(r12) 121 + std r9, 40(r12) 122 + std r10,48(r12) 123 + std r11,56(r12) 124 + std r12,64(r12) 188 125 189 126 lwz r0,8(r1) 190 127 mtcrf 0xff,r0
+3 -2
arch/powerpc/platforms/pseries/hvconsole.c
··· 27 27 #include <linux/module.h> 28 28 #include <asm/hvcall.h> 29 29 #include <asm/hvconsole.h> 30 + #include "plpar_wrappers.h" 30 31 31 32 /** 32 33 * hvc_get_chars - retrieve characters from firmware for denoted vterm adatper ··· 41 40 { 42 41 unsigned long got; 43 42 44 - if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got, 45 - (unsigned long *)buf, (unsigned long *)buf+1) == H_SUCCESS) 43 + if (plpar_get_term_char(vtermno, &got, buf) == H_SUCCESS) 46 44 return got; 45 + 47 46 return 0; 48 47 } 49 48
+4 -8
arch/powerpc/platforms/pseries/lpar.c
··· 48 48 #define DBG_LOW(fmt...) do { } while(0) 49 49 #endif 50 50 51 - /* in pSeries_hvCall.S */ 51 + /* in hvCall.S */ 52 52 EXPORT_SYMBOL(plpar_hcall); 53 - EXPORT_SYMBOL(plpar_hcall_4out); 53 + EXPORT_SYMBOL(plpar_hcall9); 54 54 EXPORT_SYMBOL(plpar_hcall_norets); 55 - EXPORT_SYMBOL(plpar_hcall_8arg_2ret); 56 - EXPORT_SYMBOL(plpar_hcall_7arg_7ret); 57 - EXPORT_SYMBOL(plpar_hcall_9arg_9ret); 55 + 58 56 extern void pSeries_find_serial_port(void); 59 57 60 58 ··· 275 277 unsigned long flags; 276 278 unsigned long slot; 277 279 unsigned long hpte_v, hpte_r; 278 - unsigned long dummy0, dummy1; 279 280 280 281 if (!(vflags & HPTE_V_BOLTED)) 281 282 DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " ··· 299 302 if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE)) 300 303 hpte_r &= ~_PAGE_COHERENT; 301 304 302 - lpar_rc = plpar_hcall(H_ENTER, flags, hpte_group, hpte_v, 303 - hpte_r, &slot, &dummy0, &dummy1); 305 + lpar_rc = plpar_pte_enter(flags, hpte_group, hpte_v, hpte_r, &slot); 304 306 if (unlikely(lpar_rc == H_PTEG_FULL)) { 305 307 if (!(vflags & HPTE_V_BOLTED)) 306 308 DBG_LOW(" full\n");
+80 -17
arch/powerpc/platforms/pseries/plpar_wrappers.h
··· 5 5 6 6 static inline long poll_pending(void) 7 7 { 8 - unsigned long dummy; 9 - return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, &dummy, &dummy, &dummy); 8 + return plpar_hcall_norets(H_POLL_PENDING); 10 9 } 11 10 12 11 static inline long prod_processor(void) 13 12 { 14 - plpar_hcall_norets(H_PROD); 15 - return 0; 13 + return plpar_hcall_norets(H_PROD); 16 14 } 17 15 18 16 static inline long cede_processor(void) 19 17 { 20 - plpar_hcall_norets(H_CEDE); 21 - return 0; 18 + return plpar_hcall_norets(H_CEDE); 22 19 } 23 20 24 21 static inline long vpa_call(unsigned long flags, unsigned long cpu, ··· 39 42 40 43 extern void vpa_init(int cpu); 41 44 45 + static inline long plpar_pte_enter(unsigned long flags, 46 + unsigned long hpte_group, unsigned long hpte_v, 47 + unsigned long hpte_r, unsigned long *slot) 48 + { 49 + long rc; 50 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 51 + 52 + rc = plpar_hcall(H_ENTER, retbuf, flags, hpte_group, hpte_v, hpte_r); 53 + 54 + *slot = retbuf[0]; 55 + 56 + return rc; 57 + } 58 + 42 59 static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex, 43 60 unsigned long avpn, unsigned long *old_pteh_ret, 44 61 unsigned long *old_ptel_ret) 45 62 { 46 - unsigned long dummy; 47 - return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, old_pteh_ret, 48 - old_ptel_ret, &dummy); 63 + long rc; 64 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 65 + 66 + rc = plpar_hcall(H_REMOVE, retbuf, flags, ptex, avpn); 67 + 68 + *old_pteh_ret = retbuf[0]; 69 + *old_ptel_ret = retbuf[1]; 70 + 71 + return rc; 49 72 } 50 73 51 74 static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, 52 75 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) 53 76 { 54 - unsigned long dummy; 55 - return plpar_hcall(H_READ, flags, ptex, 0, 0, old_pteh_ret, 56 - old_ptel_ret, &dummy); 77 + long rc; 78 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 79 + 80 + rc = plpar_hcall(H_READ, retbuf, flags, ptex); 81 + 82 + *old_pteh_ret = retbuf[0]; 83 + *old_ptel_ret = retbuf[1]; 84 + 85 + return rc; 57 86 } 58 87 59 88 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, ··· 91 68 static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba, 92 69 unsigned long *tce_ret) 93 70 { 94 - unsigned long dummy; 95 - return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, tce_ret, &dummy, 96 - &dummy); 71 + long rc; 72 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 73 + 74 + rc = plpar_hcall(H_GET_TCE, retbuf, liobn, ioba); 75 + 76 + *tce_ret = retbuf[0]; 77 + 78 + return rc; 97 79 } 98 80 99 81 static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba, ··· 122 94 static inline long plpar_get_term_char(unsigned long termno, 123 95 unsigned long *len_ret, char *buf_ret) 124 96 { 97 + long rc; 98 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 125 99 unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */ 126 - return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, len_ret, 127 - lbuf + 0, lbuf + 1); 100 + 101 + rc = plpar_hcall(H_GET_TERM_CHAR, retbuf, termno); 102 + 103 + *len_ret = retbuf[0]; 104 + lbuf[0] = retbuf[1]; 105 + lbuf[1] = retbuf[2]; 106 + 107 + return rc; 128 108 } 129 109 130 110 static inline long plpar_put_term_char(unsigned long termno, unsigned long len, ··· 141 105 unsigned long *lbuf = (unsigned long *)buffer; /* TODO: alignment? */ 142 106 return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0], 143 107 lbuf[1]); 108 + } 109 + 110 + static inline long plpar_eoi(unsigned long xirr) 111 + { 112 + return plpar_hcall_norets(H_EOI, xirr); 113 + } 114 + 115 + static inline long plpar_cppr(unsigned long cppr) 116 + { 117 + return plpar_hcall_norets(H_CPPR, cppr); 118 + } 119 + 120 + static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr) 121 + { 122 + return plpar_hcall_norets(H_IPI, servernum, mfrr); 123 + } 124 + 125 + static inline long plpar_xirr(unsigned long *xirr_ret) 126 + { 127 + long rc; 128 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 129 + 130 + rc = plpar_hcall(H_XIRR, retbuf); 131 + 132 + *xirr_ret = retbuf[0]; 133 + 134 + return rc; 144 135 } 145 136 146 137 #endif /* _PSERIES_PLPAR_WRAPPERS_H */
+1 -21
arch/powerpc/platforms/pseries/xics.c
··· 34 34 #include <asm/i8259.h> 35 35 36 36 #include "xics.h" 37 + #include "plpar_wrappers.h" 37 38 38 39 #define XICS_IPI 2 39 40 #define XICS_IRQ_SPURIOUS 0 ··· 110 109 111 110 /* LPAR low level accessors */ 112 111 113 - 114 - static inline long plpar_eoi(unsigned long xirr) 115 - { 116 - return plpar_hcall_norets(H_EOI, xirr); 117 - } 118 - 119 - static inline long plpar_cppr(unsigned long cppr) 120 - { 121 - return plpar_hcall_norets(H_CPPR, cppr); 122 - } 123 - 124 - static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr) 125 - { 126 - return plpar_hcall_norets(H_IPI, servernum, mfrr); 127 - } 128 - 129 - static inline long plpar_xirr(unsigned long *xirr_ret) 130 - { 131 - unsigned long dummy; 132 - return plpar_hcall(H_XIRR, 0, 0, 0, 0, xirr_ret, &dummy, &dummy); 133 - } 134 112 135 113 static inline unsigned int lpar_xirr_info_get(int n_cpu) 136 114 {
+2 -1
drivers/net/ibmveth.c
··· 702 702 desc[3].desc, 703 703 desc[4].desc, 704 704 desc[5].desc, 705 - correlator); 705 + correlator, 706 + &correlator); 706 707 } while ((lpar_rc == H_BUSY) && (retry_count--)); 707 708 708 709 if(lpar_rc != H_SUCCESS && lpar_rc != H_DROPPED) {
+15 -2
drivers/net/ibmveth.h
··· 51 51 #define h_add_logical_lan_buffer(ua, buf) \ 52 52 plpar_hcall_norets(H_ADD_LOGICAL_LAN_BUFFER, ua, buf) 53 53 54 - #define h_send_logical_lan(ua, buf1, buf2, buf3, buf4, buf5, buf6, correlator) \ 55 - plpar_hcall_8arg_2ret(H_SEND_LOGICAL_LAN, ua, buf1, buf2, buf3, buf4, buf5, buf6, correlator, &correlator) 54 + static inline long h_send_logical_lan(unsigned long unit_address, 55 + unsigned long desc1, unsigned long desc2, unsigned long desc3, 56 + unsigned long desc4, unsigned long desc5, unsigned long desc6, 57 + unsigned long corellator_in, unsigned long *corellator_out) 58 + { 59 + long rc; 60 + unsigned long retbuf[PLPAR_HCALL9_BUFSIZE]; 61 + 62 + rc = plpar_hcall9(H_SEND_LOGICAL_LAN, retbuf, unit_address, desc1, 63 + desc2, desc3, desc4, desc5, desc6, corellator_in); 64 + 65 + *corellator_out = retbuf[0]; 66 + 67 + return rc; 68 + } 56 69 57 70 #define h_multicast_ctrl(ua, cmd, mac) \ 58 71 plpar_hcall_norets(H_MULTICAST_CTRL, ua, cmd, mac)
+25 -80
include/asm-powerpc/hvcall.h
··· 212 212 213 213 #ifndef __ASSEMBLY__ 214 214 215 - /* plpar_hcall() -- Generic call interface using above opcodes 215 + /** 216 + * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments 217 + * @opcode: The hypervisor call to make. 216 218 * 217 - * The actual call interface is a hypervisor call instruction with 218 - * the opcode in R3 and input args in R4-R7. 219 - * Status is returned in R3 with variable output values in R4-R11. 220 - * Only H_PTE_READ with H_READ_4 uses R6-R11 so we ignore it for now 221 - * and return only two out args which MUST ALWAYS BE PROVIDED. 222 - */ 223 - long plpar_hcall(unsigned long opcode, 224 - unsigned long arg1, 225 - unsigned long arg2, 226 - unsigned long arg3, 227 - unsigned long arg4, 228 - unsigned long *out1, 229 - unsigned long *out2, 230 - unsigned long *out3); 231 - 232 - /* Same as plpar_hcall but for those opcodes that return no values 233 - * other than status. Slightly more efficient. 219 + * This call supports up to 7 arguments and only returns the status of 220 + * the hcall. Use this version where possible, its slightly faster than 221 + * the other plpar_hcalls. 234 222 */ 235 223 long plpar_hcall_norets(unsigned long opcode, ...); 236 224 237 - /* 238 - * Special hcall interface for ibmveth support. 239 - * Takes 8 input parms. Returns a rc and stores the 240 - * R4 return value in *out1. 241 - */ 242 - long plpar_hcall_8arg_2ret(unsigned long opcode, 243 - unsigned long arg1, 244 - unsigned long arg2, 245 - unsigned long arg3, 246 - unsigned long arg4, 247 - unsigned long arg5, 248 - unsigned long arg6, 249 - unsigned long arg7, 250 - unsigned long arg8, 251 - unsigned long *out1); 252 - 253 - /* plpar_hcall_4out() 225 + /** 226 + * plpar_hcall: - Make a pseries hypervisor call 227 + * @opcode: The hypervisor call to make. 228 + * @retbuf: Buffer to store up to 4 return arguments in. 254 229 * 255 - * same as plpar_hcall except with 4 output arguments. 230 + * This call supports up to 6 arguments and 4 return arguments. Use 231 + * PLPAR_HCALL_BUFSIZE to size the return argument buffer. 256 232 * 233 + * Used for all but the craziest of phyp interfaces (see plpar_hcall9) 257 234 */ 258 - long plpar_hcall_4out(unsigned long opcode, 259 - unsigned long arg1, 260 - unsigned long arg2, 261 - unsigned long arg3, 262 - unsigned long arg4, 263 - unsigned long *out1, 264 - unsigned long *out2, 265 - unsigned long *out3, 266 - unsigned long *out4); 235 + #define PLPAR_HCALL_BUFSIZE 4 236 + long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...); 267 237 268 - long plpar_hcall_7arg_7ret(unsigned long opcode, 269 - unsigned long arg1, 270 - unsigned long arg2, 271 - unsigned long arg3, 272 - unsigned long arg4, 273 - unsigned long arg5, 274 - unsigned long arg6, 275 - unsigned long arg7, 276 - unsigned long *out1, 277 - unsigned long *out2, 278 - unsigned long *out3, 279 - unsigned long *out4, 280 - unsigned long *out5, 281 - unsigned long *out6, 282 - unsigned long *out7); 283 - 284 - long plpar_hcall_9arg_9ret(unsigned long opcode, 285 - unsigned long arg1, 286 - unsigned long arg2, 287 - unsigned long arg3, 288 - unsigned long arg4, 289 - unsigned long arg5, 290 - unsigned long arg6, 291 - unsigned long arg7, 292 - unsigned long arg8, 293 - unsigned long arg9, 294 - unsigned long *out1, 295 - unsigned long *out2, 296 - unsigned long *out3, 297 - unsigned long *out4, 298 - unsigned long *out5, 299 - unsigned long *out6, 300 - unsigned long *out7, 301 - unsigned long *out8, 302 - unsigned long *out9); 238 + /** 239 + * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments 240 + * @opcode: The hypervisor call to make. 241 + * @retbuf: Buffer to store up to 9 return arguments in. 242 + * 243 + * This call supports up to 9 arguments and 9 return arguments. Use 244 + * PLPAR_HCALL9_BUFSIZE to size the return argument buffer. 245 + */ 246 + #define PLPAR_HCALL9_BUFSIZE 9 247 + long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...); 303 248 304 249 #endif /* __ASSEMBLY__ */ 305 250 #endif /* __KERNEL__ */