29 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
34 static inline u16 get_order_of_qentries(
u16 queue_entries)
37 while (((1
U << ld) - 1) < queue_entries)
43 #define H_ALL_RES_TYPE_QP 1
44 #define H_ALL_RES_TYPE_CQ 2
45 #define H_ALL_RES_TYPE_EQ 3
46 #define H_ALL_RES_TYPE_MR 5
47 #define H_ALL_RES_TYPE_MW 6
49 static long ehea_plpar_hcall_norets(
unsigned long opcode,
61 for (i = 0; i < 5; i++) {
62 ret = plpar_hcall_norets(opcode, arg1, arg2, arg3, arg4,
65 if (H_IS_LONG_BUSY(ret)) {
66 sleep_msecs = get_longbusy_msecs(ret);
72 pr_err(
"opcode=%lx ret=%lx"
73 " arg1=%lx arg2=%lx arg3=%lx arg4=%lx"
74 " arg5=%lx arg6=%lx arg7=%lx\n",
76 arg1, arg2, arg3, arg4, arg5, arg6, arg7);
84 static long ehea_plpar_hcall9(
unsigned long opcode,
100 for (i = 0; i < 5; i++) {
101 ret = plpar_hcall9(opcode, outs,
102 arg1, arg2, arg3, arg4, arg5,
103 arg6, arg7, arg8, arg9);
105 if (H_IS_LONG_BUSY(ret)) {
106 sleep_msecs = get_longbusy_msecs(ret);
113 if ((ret < H_SUCCESS) && !(((ret == H_AUTHORITY)
114 && (opcode == H_MODIFY_HEA_PORT))
118 pr_err(
"opcode=%lx ret=%lx"
119 " arg1=%lx arg2=%lx arg3=%lx arg4=%lx"
120 " arg5=%lx arg6=%lx arg7=%lx arg8=%lx"
122 " out1=%lx out2=%lx out3=%lx out4=%lx"
123 " out5=%lx out6=%lx out7=%lx out8=%lx"
126 arg1, arg2, arg3, arg4, arg5,
127 arg6, arg7, arg8, arg9,
128 outs[0], outs[1], outs[2], outs[3], outs[4],
129 outs[5], outs[6], outs[7], outs[8]);
139 return ehea_plpar_hcall_norets(H_QUERY_HEA_QP,
149 #define H_ALL_RES_QP_EQPO EHEA_BMASK_IBM(9, 11)
150 #define H_ALL_RES_QP_QPP EHEA_BMASK_IBM(12, 12)
151 #define H_ALL_RES_QP_RQR EHEA_BMASK_IBM(13, 15)
152 #define H_ALL_RES_QP_EQEG EHEA_BMASK_IBM(16, 16)
153 #define H_ALL_RES_QP_LL_QP EHEA_BMASK_IBM(17, 17)
154 #define H_ALL_RES_QP_DMA128 EHEA_BMASK_IBM(19, 19)
155 #define H_ALL_RES_QP_HSM EHEA_BMASK_IBM(20, 21)
156 #define H_ALL_RES_QP_SIGT EHEA_BMASK_IBM(22, 23)
157 #define H_ALL_RES_QP_TENURE EHEA_BMASK_IBM(48, 55)
158 #define H_ALL_RES_QP_RES_TYP EHEA_BMASK_IBM(56, 63)
161 #define H_ALL_RES_QP_TOKEN EHEA_BMASK_IBM(0, 31)
162 #define H_ALL_RES_QP_PD EHEA_BMASK_IBM(32, 63)
165 #define H_ALL_RES_QP_MAX_SWQE EHEA_BMASK_IBM(4, 7)
166 #define H_ALL_RES_QP_MAX_R1WQE EHEA_BMASK_IBM(12, 15)
167 #define H_ALL_RES_QP_MAX_R2WQE EHEA_BMASK_IBM(20, 23)
168 #define H_ALL_RES_QP_MAX_R3WQE EHEA_BMASK_IBM(28, 31)
170 #define H_ALL_RES_QP_MAX_SSGE EHEA_BMASK_IBM(37, 39)
171 #define H_ALL_RES_QP_MAX_R1SGE EHEA_BMASK_IBM(45, 47)
173 #define H_ALL_RES_QP_MAX_R2SGE EHEA_BMASK_IBM(53, 55)
174 #define H_ALL_RES_QP_MAX_R3SGE EHEA_BMASK_IBM(61, 63)
177 #define H_ALL_RES_QP_SWQE_IDL EHEA_BMASK_IBM(0, 7)
179 #define H_ALL_RES_QP_PORT_NUM EHEA_BMASK_IBM(48, 63)
182 #define H_ALL_RES_QP_TH_RQ2 EHEA_BMASK_IBM(0, 15)
184 #define H_ALL_RES_QP_TH_RQ3 EHEA_BMASK_IBM(16, 31)
188 #define H_ALL_RES_QP_ACT_SWQE EHEA_BMASK_IBM(0, 15)
189 #define H_ALL_RES_QP_ACT_R1WQE EHEA_BMASK_IBM(16, 31)
190 #define H_ALL_RES_QP_ACT_R2WQE EHEA_BMASK_IBM(32, 47)
191 #define H_ALL_RES_QP_ACT_R3WQE EHEA_BMASK_IBM(48, 63)
194 #define H_ALL_RES_QP_ACT_SSGE EHEA_BMASK_IBM(0, 7)
195 #define H_ALL_RES_QP_ACT_R1SGE EHEA_BMASK_IBM(8, 15)
196 #define H_ALL_RES_QP_ACT_R2SGE EHEA_BMASK_IBM(16, 23)
197 #define H_ALL_RES_QP_ACT_R3SGE EHEA_BMASK_IBM(24, 31)
198 #define H_ALL_RES_QP_ACT_SWQE_IDL EHEA_BMASK_IBM(32, 39)
201 #define H_ALL_RES_QP_SIZE_SQ EHEA_BMASK_IBM(0, 31)
202 #define H_ALL_RES_QP_SIZE_RQ1 EHEA_BMASK_IBM(32, 63)
203 #define H_ALL_RES_QP_SIZE_RQ2 EHEA_BMASK_IBM(0, 31)
204 #define H_ALL_RES_QP_SIZE_RQ3 EHEA_BMASK_IBM(32, 63)
207 #define H_ALL_RES_QP_LIOBN_SQ EHEA_BMASK_IBM(0, 31)
208 #define H_ALL_RES_QP_LIOBN_RQ1 EHEA_BMASK_IBM(32, 63)
209 #define H_ALL_RES_QP_LIOBN_RQ2 EHEA_BMASK_IBM(0, 31)
210 #define H_ALL_RES_QP_LIOBN_RQ3 EHEA_BMASK_IBM(32, 63)
217 unsigned long outs[PLPAR_HCALL9_BUFSIZE];
219 u64 allocate_controls =
257 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
269 *qp_handle = outs[0];
305 hcp_epas_ctor(h_epas, outs[6], outs[6]);
315 unsigned long outs[PLPAR_HCALL9_BUFSIZE];
317 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
326 *cq_handle = outs[0];
331 hcp_epas_ctor(epas, outs[5], outs[6]);
337 #define H_ALL_RES_TYPE_QP 1
338 #define H_ALL_RES_TYPE_CQ 2
339 #define H_ALL_RES_TYPE_EQ 3
340 #define H_ALL_RES_TYPE_MR 5
341 #define H_ALL_RES_TYPE_MW 6
344 #define H_ALL_RES_EQ_NEQ EHEA_BMASK_IBM(0, 0)
345 #define H_ALL_RES_EQ_NON_NEQ_ISN EHEA_BMASK_IBM(6, 7)
346 #define H_ALL_RES_EQ_INH_EQE_GEN EHEA_BMASK_IBM(16, 16)
347 #define H_ALL_RES_EQ_RES_TYPE EHEA_BMASK_IBM(56, 63)
349 #define H_ALL_RES_EQ_MAX_EQE EHEA_BMASK_IBM(32, 63)
352 #define H_ALL_RES_EQ_LIOBN EHEA_BMASK_IBM(32, 63)
355 #define H_ALL_RES_EQ_ACT_EQE EHEA_BMASK_IBM(32, 63)
358 #define H_ALL_RES_EQ_ACT_PS EHEA_BMASK_IBM(32, 63)
361 #define H_ALL_RES_EQ_ACT_EQ_IST_C EHEA_BMASK_IBM(30, 31)
362 #define H_ALL_RES_EQ_ACT_EQ_IST_1 EHEA_BMASK_IBM(40, 63)
365 #define H_ALL_RES_EQ_ACT_EQ_IST_2 EHEA_BMASK_IBM(40, 63)
368 #define H_ALL_RES_EQ_ACT_EQ_IST_3 EHEA_BMASK_IBM(40, 63)
371 #define H_ALL_RES_EQ_ACT_EQ_IST_4 EHEA_BMASK_IBM(40, 63)
376 u64 hret, allocate_controls;
377 unsigned long outs[PLPAR_HCALL9_BUFSIZE];
386 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
393 *eq_handle = outs[0];
396 eq_attr->
ist1 = outs[5];
397 eq_attr->
ist2 = outs[6];
398 eq_attr->
ist3 = outs[7];
399 eq_attr->
ist4 = outs[8];
406 void *cb_addr,
u64 *inv_attr_id,
u64 *proc_mask,
407 u16 *out_swr,
u16 *out_rwr)
410 unsigned long outs[PLPAR_HCALL9_BUFSIZE];
412 hret = ehea_plpar_hcall9(H_MODIFY_HEA_QP,
421 *inv_attr_id = outs[0];
424 *proc_mask = outs[5];
438 return ehea_plpar_hcall_norets(H_REGISTER_HEA_RPAGES,
448 const u64 vaddr_in,
const u32 access_ctrl,
const u32 pd,
452 unsigned long outs[PLPAR_HCALL9_BUFSIZE];
454 hret = ehea_plpar_hcall9(H_REGISTER_SMR,
459 (((
u64)access_ctrl) << 32ULL),
471 unsigned long outs[PLPAR_HCALL9_BUFSIZE];
473 return ehea_plpar_hcall9(H_DISABLE_AND_GET_HEA,
484 return ehea_plpar_hcall_norets(H_FREE_RESOURCE,
496 unsigned long outs[PLPAR_HCALL9_BUFSIZE];
498 hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
504 (((
u64) access_ctrl) << 32ULL),
508 *mr_handle = outs[0];
509 *lkey = (
u32)outs[2];
517 if ((count > 1) && (log_pageaddr & ~
PAGE_MASK)) {
518 pr_err(
"not on pageboundary\n");
523 queue_type, mr_handle,
524 log_pageaddr, count);
529 u64 hret, cb_logaddr;
531 cb_logaddr =
__pa(cb_addr);
533 hret = ehea_plpar_hcall_norets(H_QUERY_HEA,
544 const u8 cb_cat,
const u64 select_mask,
548 u64 cb_logaddr =
__pa(cb_addr);
554 return ehea_plpar_hcall_norets(H_QUERY_HEA_PORT,
564 const u8 cb_cat,
const u64 select_mask,
567 unsigned long outs[PLPAR_HCALL9_BUFSIZE];
570 u64 cb_logaddr =
__pa(cb_addr);
577 return ehea_plpar_hcall9(H_MODIFY_HEA_PORT,
588 const u8 reg_type,
const u64 mc_mac_addr,
591 u64 r5_port_num, r6_reg_type, r7_mc_mac_addr, r8_vlan_id;
599 return ehea_plpar_hcall_norets(hcall_id,
609 const u64 event_mask)
611 return ehea_plpar_hcall_norets(H_RESET_EVENTS,
621 return ehea_plpar_hcall_norets(H_ERROR_DATA,