ehca_main.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  1. /*
  2. * IBM eServer eHCA Infiniband device driver for Linux on POWER
  3. *
  4. * module start stop, hca detection
  5. *
  6. * Authors: Heiko J Schick <schickhj@de.ibm.com>
  7. * Hoang-Nam Nguyen <hnguyen@de.ibm.com>
  8. * Joachim Fenkes <fenkes@de.ibm.com>
  9. *
  10. * Copyright (c) 2005 IBM Corporation
  11. *
  12. * All rights reserved.
  13. *
  14. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  15. * BSD.
  16. *
  17. * OpenIB BSD License
  18. *
  19. * Redistribution and use in source and binary forms, with or without
  20. * modification, are permitted provided that the following conditions are met:
  21. *
  22. * Redistributions of source code must retain the above copyright notice, this
  23. * list of conditions and the following disclaimer.
  24. *
  25. * Redistributions in binary form must reproduce the above copyright notice,
  26. * this list of conditions and the following disclaimer in the documentation
  27. * and/or other materials
  28. * provided with the distribution.
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  31. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  33. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  34. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  35. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  36. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  37. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  38. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  39. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGE.
  41. */
  42. #ifdef CONFIG_PPC_64K_PAGES
  43. #include <linux/slab.h>
  44. #endif
  45. #include <linux/notifier.h>
  46. #include <linux/memory.h>
  47. #include "ehca_classes.h"
  48. #include "ehca_iverbs.h"
  49. #include "ehca_mrmw.h"
  50. #include "ehca_tools.h"
  51. #include "hcp_if.h"
  52. #define HCAD_VERSION "0029"
  53. MODULE_LICENSE("Dual BSD/GPL");
  54. MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>");
  55. MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver");
  56. MODULE_VERSION(HCAD_VERSION);
  57. static int ehca_open_aqp1 = 0;
  58. static int ehca_hw_level = 0;
  59. static int ehca_poll_all_eqs = 1;
  60. int ehca_debug_level = 0;
  61. int ehca_nr_ports = -1;
  62. int ehca_use_hp_mr = 0;
  63. int ehca_port_act_time = 30;
  64. int ehca_static_rate = -1;
  65. int ehca_scaling_code = 0;
  66. int ehca_lock_hcalls = -1;
  67. int ehca_max_cq = -1;
  68. int ehca_max_qp = -1;
  69. module_param_named(open_aqp1, ehca_open_aqp1, bool, S_IRUGO);
  70. module_param_named(debug_level, ehca_debug_level, int, S_IRUGO);
  71. module_param_named(hw_level, ehca_hw_level, int, S_IRUGO);
  72. module_param_named(nr_ports, ehca_nr_ports, int, S_IRUGO);
  73. module_param_named(use_hp_mr, ehca_use_hp_mr, bool, S_IRUGO);
  74. module_param_named(port_act_time, ehca_port_act_time, int, S_IRUGO);
  75. module_param_named(poll_all_eqs, ehca_poll_all_eqs, bool, S_IRUGO);
  76. module_param_named(static_rate, ehca_static_rate, int, S_IRUGO);
  77. module_param_named(scaling_code, ehca_scaling_code, bool, S_IRUGO);
  78. module_param_named(lock_hcalls, ehca_lock_hcalls, bool, S_IRUGO);
  79. module_param_named(number_of_cqs, ehca_max_cq, int, S_IRUGO);
  80. module_param_named(number_of_qps, ehca_max_qp, int, S_IRUGO);
  81. MODULE_PARM_DESC(open_aqp1,
  82. "Open AQP1 on startup (default: no)");
  83. MODULE_PARM_DESC(debug_level,
  84. "Amount of debug output (0: none (default), 1: traces, "
  85. "2: some dumps, 3: lots)");
  86. MODULE_PARM_DESC(hw_level,
  87. "Hardware level (0: autosensing (default), "
  88. "0x10..0x14: eHCA, 0x20..0x23: eHCA2)");
  89. MODULE_PARM_DESC(nr_ports,
  90. "number of connected ports (-1: autodetect (default), "
  91. "1: port one only, 2: two ports)");
  92. MODULE_PARM_DESC(use_hp_mr,
  93. "Use high performance MRs (default: no)");
  94. MODULE_PARM_DESC(port_act_time,
  95. "Time to wait for port activation (default: 30 sec)");
  96. MODULE_PARM_DESC(poll_all_eqs,
  97. "Poll all event queues periodically (default: yes)");
  98. MODULE_PARM_DESC(static_rate,
  99. "Set permanent static rate (default: no static rate)");
  100. MODULE_PARM_DESC(scaling_code,
  101. "Enable scaling code (default: no)");
  102. MODULE_PARM_DESC(lock_hcalls,
  103. "Serialize all hCalls made by the driver "
  104. "(default: autodetect)");
  105. MODULE_PARM_DESC(number_of_cqs,
  106. "Max number of CQs which can be allocated "
  107. "(default: autodetect)");
  108. MODULE_PARM_DESC(number_of_qps,
  109. "Max number of QPs which can be allocated "
  110. "(default: autodetect)");
  111. DEFINE_RWLOCK(ehca_qp_idr_lock);
  112. DEFINE_RWLOCK(ehca_cq_idr_lock);
  113. DEFINE_IDR(ehca_qp_idr);
  114. DEFINE_IDR(ehca_cq_idr);
  115. static LIST_HEAD(shca_list); /* list of all registered ehcas */
  116. DEFINE_SPINLOCK(shca_list_lock);
  117. static struct timer_list poll_eqs_timer;
  118. #ifdef CONFIG_PPC_64K_PAGES
  119. static struct kmem_cache *ctblk_cache;
  120. void *ehca_alloc_fw_ctrlblock(gfp_t flags)
  121. {
  122. void *ret = kmem_cache_zalloc(ctblk_cache, flags);
  123. if (!ret)
  124. ehca_gen_err("Out of memory for ctblk");
  125. return ret;
  126. }
  127. void ehca_free_fw_ctrlblock(void *ptr)
  128. {
  129. if (ptr)
  130. kmem_cache_free(ctblk_cache, ptr);
  131. }
  132. #endif
  133. int ehca2ib_return_code(u64 ehca_rc)
  134. {
  135. switch (ehca_rc) {
  136. case H_SUCCESS:
  137. return 0;
  138. case H_RESOURCE: /* Resource in use */
  139. case H_BUSY:
  140. return -EBUSY;
  141. case H_NOT_ENOUGH_RESOURCES: /* insufficient resources */
  142. case H_CONSTRAINED: /* resource constraint */
  143. case H_NO_MEM:
  144. return -ENOMEM;
  145. default:
  146. return -EINVAL;
  147. }
  148. }
  149. static int ehca_create_slab_caches(void)
  150. {
  151. int ret;
  152. ret = ehca_init_pd_cache();
  153. if (ret) {
  154. ehca_gen_err("Cannot create PD SLAB cache.");
  155. return ret;
  156. }
  157. ret = ehca_init_cq_cache();
  158. if (ret) {
  159. ehca_gen_err("Cannot create CQ SLAB cache.");
  160. goto create_slab_caches2;
  161. }
  162. ret = ehca_init_qp_cache();
  163. if (ret) {
  164. ehca_gen_err("Cannot create QP SLAB cache.");
  165. goto create_slab_caches3;
  166. }
  167. ret = ehca_init_av_cache();
  168. if (ret) {
  169. ehca_gen_err("Cannot create AV SLAB cache.");
  170. goto create_slab_caches4;
  171. }
  172. ret = ehca_init_mrmw_cache();
  173. if (ret) {
  174. ehca_gen_err("Cannot create MR&MW SLAB cache.");
  175. goto create_slab_caches5;
  176. }
  177. ret = ehca_init_small_qp_cache();
  178. if (ret) {
  179. ehca_gen_err("Cannot create small queue SLAB cache.");
  180. goto create_slab_caches6;
  181. }
  182. #ifdef CONFIG_PPC_64K_PAGES
  183. ctblk_cache = kmem_cache_create("ehca_cache_ctblk",
  184. EHCA_PAGESIZE, H_CB_ALIGNMENT,
  185. SLAB_HWCACHE_ALIGN,
  186. NULL);
  187. if (!ctblk_cache) {
  188. ehca_gen_err("Cannot create ctblk SLAB cache.");
  189. ehca_cleanup_small_qp_cache();
  190. goto create_slab_caches6;
  191. }
  192. #endif
  193. return 0;
  194. create_slab_caches6:
  195. ehca_cleanup_mrmw_cache();
  196. create_slab_caches5:
  197. ehca_cleanup_av_cache();
  198. create_slab_caches4:
  199. ehca_cleanup_qp_cache();
  200. create_slab_caches3:
  201. ehca_cleanup_cq_cache();
  202. create_slab_caches2:
  203. ehca_cleanup_pd_cache();
  204. return ret;
  205. }
  206. static void ehca_destroy_slab_caches(void)
  207. {
  208. ehca_cleanup_small_qp_cache();
  209. ehca_cleanup_mrmw_cache();
  210. ehca_cleanup_av_cache();
  211. ehca_cleanup_qp_cache();
  212. ehca_cleanup_cq_cache();
  213. ehca_cleanup_pd_cache();
  214. #ifdef CONFIG_PPC_64K_PAGES
  215. if (ctblk_cache)
  216. kmem_cache_destroy(ctblk_cache);
  217. #endif
  218. }
  219. #define EHCA_HCAAVER EHCA_BMASK_IBM(32, 39)
  220. #define EHCA_REVID EHCA_BMASK_IBM(40, 63)
  221. static struct cap_descr {
  222. u64 mask;
  223. char *descr;
  224. } hca_cap_descr[] = {
  225. { HCA_CAP_AH_PORT_NR_CHECK, "HCA_CAP_AH_PORT_NR_CHECK" },
  226. { HCA_CAP_ATOMIC, "HCA_CAP_ATOMIC" },
  227. { HCA_CAP_AUTO_PATH_MIG, "HCA_CAP_AUTO_PATH_MIG" },
  228. { HCA_CAP_BAD_P_KEY_CTR, "HCA_CAP_BAD_P_KEY_CTR" },
  229. { HCA_CAP_SQD_RTS_PORT_CHANGE, "HCA_CAP_SQD_RTS_PORT_CHANGE" },
  230. { HCA_CAP_CUR_QP_STATE_MOD, "HCA_CAP_CUR_QP_STATE_MOD" },
  231. { HCA_CAP_INIT_TYPE, "HCA_CAP_INIT_TYPE" },
  232. { HCA_CAP_PORT_ACTIVE_EVENT, "HCA_CAP_PORT_ACTIVE_EVENT" },
  233. { HCA_CAP_Q_KEY_VIOL_CTR, "HCA_CAP_Q_KEY_VIOL_CTR" },
  234. { HCA_CAP_WQE_RESIZE, "HCA_CAP_WQE_RESIZE" },
  235. { HCA_CAP_RAW_PACKET_MCAST, "HCA_CAP_RAW_PACKET_MCAST" },
  236. { HCA_CAP_SHUTDOWN_PORT, "HCA_CAP_SHUTDOWN_PORT" },
  237. { HCA_CAP_RC_LL_QP, "HCA_CAP_RC_LL_QP" },
  238. { HCA_CAP_SRQ, "HCA_CAP_SRQ" },
  239. { HCA_CAP_UD_LL_QP, "HCA_CAP_UD_LL_QP" },
  240. { HCA_CAP_RESIZE_MR, "HCA_CAP_RESIZE_MR" },
  241. { HCA_CAP_MINI_QP, "HCA_CAP_MINI_QP" },
  242. { HCA_CAP_H_ALLOC_RES_SYNC, "HCA_CAP_H_ALLOC_RES_SYNC" },
  243. };
  244. static int ehca_sense_attributes(struct ehca_shca *shca)
  245. {
  246. int i, ret = 0;
  247. u64 h_ret;
  248. struct hipz_query_hca *rblock;
  249. struct hipz_query_port *port;
  250. const char *loc_code;
  251. static const u32 pgsize_map[] = {
  252. HCA_CAP_MR_PGSIZE_4K, 0x1000,
  253. HCA_CAP_MR_PGSIZE_64K, 0x10000,
  254. HCA_CAP_MR_PGSIZE_1M, 0x100000,
  255. HCA_CAP_MR_PGSIZE_16M, 0x1000000,
  256. };
  257. ehca_gen_dbg("Probing adapter %s...",
  258. shca->ofdev->dev.of_node->full_name);
  259. loc_code = of_get_property(shca->ofdev->dev.of_node, "ibm,loc-code",
  260. NULL);
  261. if (loc_code)
  262. ehca_gen_dbg(" ... location lode=%s", loc_code);
  263. rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL);
  264. if (!rblock) {
  265. ehca_gen_err("Cannot allocate rblock memory.");
  266. return -ENOMEM;
  267. }
  268. h_ret = hipz_h_query_hca(shca->ipz_hca_handle, rblock);
  269. if (h_ret != H_SUCCESS) {
  270. ehca_gen_err("Cannot query device properties. h_ret=%lli",
  271. h_ret);
  272. ret = -EPERM;
  273. goto sense_attributes1;
  274. }
  275. if (ehca_nr_ports == 1)
  276. shca->num_ports = 1;
  277. else
  278. shca->num_ports = (u8)rblock->num_ports;
  279. ehca_gen_dbg(" ... found %x ports", rblock->num_ports);
  280. if (ehca_hw_level == 0) {
  281. u32 hcaaver;
  282. u32 revid;
  283. hcaaver = EHCA_BMASK_GET(EHCA_HCAAVER, rblock->hw_ver);
  284. revid = EHCA_BMASK_GET(EHCA_REVID, rblock->hw_ver);
  285. ehca_gen_dbg(" ... hardware version=%x:%x", hcaaver, revid);
  286. if (hcaaver == 1) {
  287. if (revid <= 3)
  288. shca->hw_level = 0x10 | (revid + 1);
  289. else
  290. shca->hw_level = 0x14;
  291. } else if (hcaaver == 2) {
  292. if (revid == 0)
  293. shca->hw_level = 0x21;
  294. else if (revid == 0x10)
  295. shca->hw_level = 0x22;
  296. else if (revid == 0x20 || revid == 0x21)
  297. shca->hw_level = 0x23;
  298. }
  299. if (!shca->hw_level) {
  300. ehca_gen_warn("unknown hardware version"
  301. " - assuming default level");
  302. shca->hw_level = 0x22;
  303. }
  304. } else
  305. shca->hw_level = ehca_hw_level;
  306. ehca_gen_dbg(" ... hardware level=%x", shca->hw_level);
  307. shca->hca_cap = rblock->hca_cap_indicators;
  308. ehca_gen_dbg(" ... HCA capabilities:");
  309. for (i = 0; i < ARRAY_SIZE(hca_cap_descr); i++)
  310. if (EHCA_BMASK_GET(hca_cap_descr[i].mask, shca->hca_cap))
  311. ehca_gen_dbg(" %s", hca_cap_descr[i].descr);
  312. /* Autodetect hCall locking -- the "H_ALLOC_RESOURCE synced" flag is
  313. * a firmware property, so it's valid across all adapters
  314. */
  315. if (ehca_lock_hcalls == -1)
  316. ehca_lock_hcalls = !(shca->hca_cap & HCA_CAP_H_ALLOC_RES_SYNC);
  317. /* translate supported MR page sizes; always support 4K */
  318. shca->hca_cap_mr_pgsize = EHCA_PAGESIZE;
  319. for (i = 0; i < ARRAY_SIZE(pgsize_map); i += 2)
  320. if (rblock->memory_page_size_supported & pgsize_map[i])
  321. shca->hca_cap_mr_pgsize |= pgsize_map[i + 1];
  322. /* Set maximum number of CQs and QPs to calculate EQ size */
  323. if (shca->max_num_qps == -1)
  324. shca->max_num_qps = min_t(int, rblock->max_qp,
  325. EHCA_MAX_NUM_QUEUES);
  326. else if (shca->max_num_qps < 1 || shca->max_num_qps > rblock->max_qp) {
  327. ehca_gen_warn("The requested number of QPs is out of range "
  328. "(1 - %i) specified by HW. Value is set to %i",
  329. rblock->max_qp, rblock->max_qp);
  330. shca->max_num_qps = rblock->max_qp;
  331. }
  332. if (shca->max_num_cqs == -1)
  333. shca->max_num_cqs = min_t(int, rblock->max_cq,
  334. EHCA_MAX_NUM_QUEUES);
  335. else if (shca->max_num_cqs < 1 || shca->max_num_cqs > rblock->max_cq) {
  336. ehca_gen_warn("The requested number of CQs is out of range "
  337. "(1 - %i) specified by HW. Value is set to %i",
  338. rblock->max_cq, rblock->max_cq);
  339. }
  340. /* query max MTU from first port -- it's the same for all ports */
  341. port = (struct hipz_query_port *)rblock;
  342. h_ret = hipz_h_query_port(shca->ipz_hca_handle, 1, port);
  343. if (h_ret != H_SUCCESS) {
  344. ehca_gen_err("Cannot query port properties. h_ret=%lli",
  345. h_ret);
  346. ret = -EPERM;
  347. goto sense_attributes1;
  348. }
  349. shca->max_mtu = port->max_mtu;
  350. sense_attributes1:
  351. ehca_free_fw_ctrlblock(rblock);
  352. return ret;
  353. }
  354. static int init_node_guid(struct ehca_shca *shca)
  355. {
  356. int ret = 0;
  357. struct hipz_query_hca *rblock;
  358. rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL);
  359. if (!rblock) {
  360. ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
  361. return -ENOMEM;
  362. }
  363. if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) {
  364. ehca_err(&shca->ib_device, "Can't query device properties");
  365. ret = -EINVAL;
  366. goto init_node_guid1;
  367. }
  368. memcpy(&shca->ib_device.node_guid, &rblock->node_guid, sizeof(u64));
  369. init_node_guid1:
  370. ehca_free_fw_ctrlblock(rblock);
  371. return ret;
  372. }
  373. static int ehca_init_device(struct ehca_shca *shca)
  374. {
  375. int ret;
  376. ret = init_node_guid(shca);
  377. if (ret)
  378. return ret;
  379. strlcpy(shca->ib_device.name, "ehca%d", IB_DEVICE_NAME_MAX);
  380. shca->ib_device.owner = THIS_MODULE;
  381. shca->ib_device.uverbs_abi_ver = 8;
  382. shca->ib_device.uverbs_cmd_mask =
  383. (1ull << IB_USER_VERBS_CMD_GET_CONTEXT) |
  384. (1ull << IB_USER_VERBS_CMD_QUERY_DEVICE) |
  385. (1ull << IB_USER_VERBS_CMD_QUERY_PORT) |
  386. (1ull << IB_USER_VERBS_CMD_ALLOC_PD) |
  387. (1ull << IB_USER_VERBS_CMD_DEALLOC_PD) |
  388. (1ull << IB_USER_VERBS_CMD_REG_MR) |
  389. (1ull << IB_USER_VERBS_CMD_DEREG_MR) |
  390. (1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
  391. (1ull << IB_USER_VERBS_CMD_CREATE_CQ) |
  392. (1ull << IB_USER_VERBS_CMD_DESTROY_CQ) |
  393. (1ull << IB_USER_VERBS_CMD_CREATE_QP) |
  394. (1ull << IB_USER_VERBS_CMD_MODIFY_QP) |
  395. (1ull << IB_USER_VERBS_CMD_QUERY_QP) |
  396. (1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
  397. (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) |
  398. (1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
  399. shca->ib_device.node_type = RDMA_NODE_IB_CA;
  400. shca->ib_device.phys_port_cnt = shca->num_ports;
  401. shca->ib_device.num_comp_vectors = 1;
  402. shca->ib_device.dma_device = &shca->ofdev->dev;
  403. shca->ib_device.query_device = ehca_query_device;
  404. shca->ib_device.query_port = ehca_query_port;
  405. shca->ib_device.query_gid = ehca_query_gid;
  406. shca->ib_device.query_pkey = ehca_query_pkey;
  407. /* shca->in_device.modify_device = ehca_modify_device */
  408. shca->ib_device.modify_port = ehca_modify_port;
  409. shca->ib_device.alloc_ucontext = ehca_alloc_ucontext;
  410. shca->ib_device.dealloc_ucontext = ehca_dealloc_ucontext;
  411. shca->ib_device.alloc_pd = ehca_alloc_pd;
  412. shca->ib_device.dealloc_pd = ehca_dealloc_pd;
  413. shca->ib_device.create_ah = ehca_create_ah;
  414. /* shca->ib_device.modify_ah = ehca_modify_ah; */
  415. shca->ib_device.query_ah = ehca_query_ah;
  416. shca->ib_device.destroy_ah = ehca_destroy_ah;
  417. shca->ib_device.create_qp = ehca_create_qp;
  418. shca->ib_device.modify_qp = ehca_modify_qp;
  419. shca->ib_device.query_qp = ehca_query_qp;
  420. shca->ib_device.destroy_qp = ehca_destroy_qp;
  421. shca->ib_device.post_send = ehca_post_send;
  422. shca->ib_device.post_recv = ehca_post_recv;
  423. shca->ib_device.create_cq = ehca_create_cq;
  424. shca->ib_device.destroy_cq = ehca_destroy_cq;
  425. shca->ib_device.resize_cq = ehca_resize_cq;
  426. shca->ib_device.poll_cq = ehca_poll_cq;
  427. /* shca->ib_device.peek_cq = ehca_peek_cq; */
  428. shca->ib_device.req_notify_cq = ehca_req_notify_cq;
  429. /* shca->ib_device.req_ncomp_notif = ehca_req_ncomp_notif; */
  430. shca->ib_device.get_dma_mr = ehca_get_dma_mr;
  431. shca->ib_device.reg_phys_mr = ehca_reg_phys_mr;
  432. shca->ib_device.reg_user_mr = ehca_reg_user_mr;
  433. shca->ib_device.query_mr = ehca_query_mr;
  434. shca->ib_device.dereg_mr = ehca_dereg_mr;
  435. shca->ib_device.rereg_phys_mr = ehca_rereg_phys_mr;
  436. shca->ib_device.alloc_mw = ehca_alloc_mw;
  437. shca->ib_device.bind_mw = ehca_bind_mw;
  438. shca->ib_device.dealloc_mw = ehca_dealloc_mw;
  439. shca->ib_device.alloc_fmr = ehca_alloc_fmr;
  440. shca->ib_device.map_phys_fmr = ehca_map_phys_fmr;
  441. shca->ib_device.unmap_fmr = ehca_unmap_fmr;
  442. shca->ib_device.dealloc_fmr = ehca_dealloc_fmr;
  443. shca->ib_device.attach_mcast = ehca_attach_mcast;
  444. shca->ib_device.detach_mcast = ehca_detach_mcast;
  445. shca->ib_device.process_mad = ehca_process_mad;
  446. shca->ib_device.mmap = ehca_mmap;
  447. shca->ib_device.dma_ops = &ehca_dma_mapping_ops;
  448. if (EHCA_BMASK_GET(HCA_CAP_SRQ, shca->hca_cap)) {
  449. shca->ib_device.uverbs_cmd_mask |=
  450. (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) |
  451. (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) |
  452. (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) |
  453. (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ);
  454. shca->ib_device.create_srq = ehca_create_srq;
  455. shca->ib_device.modify_srq = ehca_modify_srq;
  456. shca->ib_device.query_srq = ehca_query_srq;
  457. shca->ib_device.destroy_srq = ehca_destroy_srq;
  458. shca->ib_device.post_srq_recv = ehca_post_srq_recv;
  459. }
  460. return ret;
  461. }
  462. static int ehca_create_aqp1(struct ehca_shca *shca, u32 port)
  463. {
  464. struct ehca_sport *sport = &shca->sport[port - 1];
  465. struct ib_cq *ibcq;
  466. struct ib_qp *ibqp;
  467. struct ib_qp_init_attr qp_init_attr;
  468. int ret;
  469. if (sport->ibcq_aqp1) {
  470. ehca_err(&shca->ib_device, "AQP1 CQ is already created.");
  471. return -EPERM;
  472. }
  473. ibcq = ib_create_cq(&shca->ib_device, NULL, NULL, (void *)(-1), 10, 0);
  474. if (IS_ERR(ibcq)) {
  475. ehca_err(&shca->ib_device, "Cannot create AQP1 CQ.");
  476. return PTR_ERR(ibcq);
  477. }
  478. sport->ibcq_aqp1 = ibcq;
  479. if (sport->ibqp_sqp[IB_QPT_GSI]) {
  480. ehca_err(&shca->ib_device, "AQP1 QP is already created.");
  481. ret = -EPERM;
  482. goto create_aqp1;
  483. }
  484. memset(&qp_init_attr, 0, sizeof(struct ib_qp_init_attr));
  485. qp_init_attr.send_cq = ibcq;
  486. qp_init_attr.recv_cq = ibcq;
  487. qp_init_attr.sq_sig_type = IB_SIGNAL_ALL_WR;
  488. qp_init_attr.cap.max_send_wr = 100;
  489. qp_init_attr.cap.max_recv_wr = 100;
  490. qp_init_attr.cap.max_send_sge = 2;
  491. qp_init_attr.cap.max_recv_sge = 1;
  492. qp_init_attr.qp_type = IB_QPT_GSI;
  493. qp_init_attr.port_num = port;
  494. qp_init_attr.qp_context = NULL;
  495. qp_init_attr.event_handler = NULL;
  496. qp_init_attr.srq = NULL;
  497. ibqp = ib_create_qp(&shca->pd->ib_pd, &qp_init_attr);
  498. if (IS_ERR(ibqp)) {
  499. ehca_err(&shca->ib_device, "Cannot create AQP1 QP.");
  500. ret = PTR_ERR(ibqp);
  501. goto create_aqp1;
  502. }
  503. sport->ibqp_sqp[IB_QPT_GSI] = ibqp;
  504. return 0;
  505. create_aqp1:
  506. ib_destroy_cq(sport->ibcq_aqp1);
  507. return ret;
  508. }
  509. static int ehca_destroy_aqp1(struct ehca_sport *sport)
  510. {
  511. int ret;
  512. ret = ib_destroy_qp(sport->ibqp_sqp[IB_QPT_GSI]);
  513. if (ret) {
  514. ehca_gen_err("Cannot destroy AQP1 QP. ret=%i", ret);
  515. return ret;
  516. }
  517. ret = ib_destroy_cq(sport->ibcq_aqp1);
  518. if (ret)
  519. ehca_gen_err("Cannot destroy AQP1 CQ. ret=%i", ret);
  520. return ret;
  521. }
  522. static ssize_t ehca_show_debug_level(struct device_driver *ddp, char *buf)
  523. {
  524. return snprintf(buf, PAGE_SIZE, "%d\n", ehca_debug_level);
  525. }
  526. static ssize_t ehca_store_debug_level(struct device_driver *ddp,
  527. const char *buf, size_t count)
  528. {
  529. int value = (*buf) - '0';
  530. if (value >= 0 && value <= 9)
  531. ehca_debug_level = value;
  532. return 1;
  533. }
  534. static DRIVER_ATTR(debug_level, S_IRUSR | S_IWUSR,
  535. ehca_show_debug_level, ehca_store_debug_level);
  536. static struct attribute *ehca_drv_attrs[] = {
  537. &driver_attr_debug_level.attr,
  538. NULL
  539. };
  540. static struct attribute_group ehca_drv_attr_grp = {
  541. .attrs = ehca_drv_attrs
  542. };
  543. static const struct attribute_group *ehca_drv_attr_groups[] = {
  544. &ehca_drv_attr_grp,
  545. NULL,
  546. };
  547. #define EHCA_RESOURCE_ATTR(name) \
  548. static ssize_t ehca_show_##name(struct device *dev, \
  549. struct device_attribute *attr, \
  550. char *buf) \
  551. { \
  552. struct ehca_shca *shca; \
  553. struct hipz_query_hca *rblock; \
  554. int data; \
  555. \
  556. shca = dev_get_drvdata(dev); \
  557. \
  558. rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); \
  559. if (!rblock) { \
  560. dev_err(dev, "Can't allocate rblock memory.\n"); \
  561. return 0; \
  562. } \
  563. \
  564. if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) { \
  565. dev_err(dev, "Can't query device properties\n"); \
  566. ehca_free_fw_ctrlblock(rblock); \
  567. return 0; \
  568. } \
  569. \
  570. data = rblock->name; \
  571. ehca_free_fw_ctrlblock(rblock); \
  572. \
  573. if ((strcmp(#name, "num_ports") == 0) && (ehca_nr_ports == 1)) \
  574. return snprintf(buf, 256, "1\n"); \
  575. else \
  576. return snprintf(buf, 256, "%d\n", data); \
  577. \
  578. } \
  579. static DEVICE_ATTR(name, S_IRUGO, ehca_show_##name, NULL);
  580. EHCA_RESOURCE_ATTR(num_ports);
  581. EHCA_RESOURCE_ATTR(hw_ver);
  582. EHCA_RESOURCE_ATTR(max_eq);
  583. EHCA_RESOURCE_ATTR(cur_eq);
  584. EHCA_RESOURCE_ATTR(max_cq);
  585. EHCA_RESOURCE_ATTR(cur_cq);
  586. EHCA_RESOURCE_ATTR(max_qp);
  587. EHCA_RESOURCE_ATTR(cur_qp);
  588. EHCA_RESOURCE_ATTR(max_mr);
  589. EHCA_RESOURCE_ATTR(cur_mr);
  590. EHCA_RESOURCE_ATTR(max_mw);
  591. EHCA_RESOURCE_ATTR(cur_mw);
  592. EHCA_RESOURCE_ATTR(max_pd);
  593. EHCA_RESOURCE_ATTR(max_ah);
  594. static ssize_t ehca_show_adapter_handle(struct device *dev,
  595. struct device_attribute *attr,
  596. char *buf)
  597. {
  598. struct ehca_shca *shca = dev_get_drvdata(dev);
  599. return sprintf(buf, "%llx\n", shca->ipz_hca_handle.handle);
  600. }
  601. static DEVICE_ATTR(adapter_handle, S_IRUGO, ehca_show_adapter_handle, NULL);
  602. static struct attribute *ehca_dev_attrs[] = {
  603. &dev_attr_adapter_handle.attr,
  604. &dev_attr_num_ports.attr,
  605. &dev_attr_hw_ver.attr,
  606. &dev_attr_max_eq.attr,
  607. &dev_attr_cur_eq.attr,
  608. &dev_attr_max_cq.attr,
  609. &dev_attr_cur_cq.attr,
  610. &dev_attr_max_qp.attr,
  611. &dev_attr_cur_qp.attr,
  612. &dev_attr_max_mr.attr,
  613. &dev_attr_cur_mr.attr,
  614. &dev_attr_max_mw.attr,
  615. &dev_attr_cur_mw.attr,
  616. &dev_attr_max_pd.attr,
  617. &dev_attr_max_ah.attr,
  618. NULL
  619. };
  620. static struct attribute_group ehca_dev_attr_grp = {
  621. .attrs = ehca_dev_attrs
  622. };
  623. static int __devinit ehca_probe(struct of_device *dev,
  624. const struct of_device_id *id)
  625. {
  626. struct ehca_shca *shca;
  627. const u64 *handle;
  628. struct ib_pd *ibpd;
  629. int ret, i, eq_size;
  630. unsigned long flags;
  631. handle = of_get_property(dev->dev.of_node, "ibm,hca-handle", NULL);
  632. if (!handle) {
  633. ehca_gen_err("Cannot get eHCA handle for adapter: %s.",
  634. dev->dev.of_node->full_name);
  635. return -ENODEV;
  636. }
  637. if (!(*handle)) {
  638. ehca_gen_err("Wrong eHCA handle for adapter: %s.",
  639. dev->dev.of_node->full_name);
  640. return -ENODEV;
  641. }
  642. shca = (struct ehca_shca *)ib_alloc_device(sizeof(*shca));
  643. if (!shca) {
  644. ehca_gen_err("Cannot allocate shca memory.");
  645. return -ENOMEM;
  646. }
  647. mutex_init(&shca->modify_mutex);
  648. atomic_set(&shca->num_cqs, 0);
  649. atomic_set(&shca->num_qps, 0);
  650. shca->max_num_qps = ehca_max_qp;
  651. shca->max_num_cqs = ehca_max_cq;
  652. for (i = 0; i < ARRAY_SIZE(shca->sport); i++)
  653. spin_lock_init(&shca->sport[i].mod_sqp_lock);
  654. shca->ofdev = dev;
  655. shca->ipz_hca_handle.handle = *handle;
  656. dev_set_drvdata(&dev->dev, shca);
  657. ret = ehca_sense_attributes(shca);
  658. if (ret < 0) {
  659. ehca_gen_err("Cannot sense eHCA attributes.");
  660. goto probe1;
  661. }
  662. ret = ehca_init_device(shca);
  663. if (ret) {
  664. ehca_gen_err("Cannot init ehca device struct");
  665. goto probe1;
  666. }
  667. eq_size = 2 * shca->max_num_cqs + 4 * shca->max_num_qps;
  668. /* create event queues */
  669. ret = ehca_create_eq(shca, &shca->eq, EHCA_EQ, eq_size);
  670. if (ret) {
  671. ehca_err(&shca->ib_device, "Cannot create EQ.");
  672. goto probe1;
  673. }
  674. ret = ehca_create_eq(shca, &shca->neq, EHCA_NEQ, 513);
  675. if (ret) {
  676. ehca_err(&shca->ib_device, "Cannot create NEQ.");
  677. goto probe3;
  678. }
  679. /* create internal protection domain */
  680. ibpd = ehca_alloc_pd(&shca->ib_device, (void *)(-1), NULL);
  681. if (IS_ERR(ibpd)) {
  682. ehca_err(&shca->ib_device, "Cannot create internal PD.");
  683. ret = PTR_ERR(ibpd);
  684. goto probe4;
  685. }
  686. shca->pd = container_of(ibpd, struct ehca_pd, ib_pd);
  687. shca->pd->ib_pd.device = &shca->ib_device;
  688. /* create internal max MR */
  689. ret = ehca_reg_internal_maxmr(shca, shca->pd, &shca->maxmr);
  690. if (ret) {
  691. ehca_err(&shca->ib_device, "Cannot create internal MR ret=%i",
  692. ret);
  693. goto probe5;
  694. }
  695. ret = ib_register_device(&shca->ib_device, NULL);
  696. if (ret) {
  697. ehca_err(&shca->ib_device,
  698. "ib_register_device() failed ret=%i", ret);
  699. goto probe6;
  700. }
  701. /* create AQP1 for port 1 */
  702. if (ehca_open_aqp1 == 1) {
  703. shca->sport[0].port_state = IB_PORT_DOWN;
  704. ret = ehca_create_aqp1(shca, 1);
  705. if (ret) {
  706. ehca_err(&shca->ib_device,
  707. "Cannot create AQP1 for port 1.");
  708. goto probe7;
  709. }
  710. }
  711. /* create AQP1 for port 2 */
  712. if ((ehca_open_aqp1 == 1) && (shca->num_ports == 2)) {
  713. shca->sport[1].port_state = IB_PORT_DOWN;
  714. ret = ehca_create_aqp1(shca, 2);
  715. if (ret) {
  716. ehca_err(&shca->ib_device,
  717. "Cannot create AQP1 for port 2.");
  718. goto probe8;
  719. }
  720. }
  721. ret = sysfs_create_group(&dev->dev.kobj, &ehca_dev_attr_grp);
  722. if (ret) /* only complain; we can live without attributes */
  723. ehca_err(&shca->ib_device,
  724. "Cannot create device attributes ret=%d", ret);
  725. spin_lock_irqsave(&shca_list_lock, flags);
  726. list_add(&shca->shca_list, &shca_list);
  727. spin_unlock_irqrestore(&shca_list_lock, flags);
  728. return 0;
  729. probe8:
  730. ret = ehca_destroy_aqp1(&shca->sport[0]);
  731. if (ret)
  732. ehca_err(&shca->ib_device,
  733. "Cannot destroy AQP1 for port 1. ret=%i", ret);
  734. probe7:
  735. ib_unregister_device(&shca->ib_device);
  736. probe6:
  737. ret = ehca_dereg_internal_maxmr(shca);
  738. if (ret)
  739. ehca_err(&shca->ib_device,
  740. "Cannot destroy internal MR. ret=%x", ret);
  741. probe5:
  742. ret = ehca_dealloc_pd(&shca->pd->ib_pd);
  743. if (ret)
  744. ehca_err(&shca->ib_device,
  745. "Cannot destroy internal PD. ret=%x", ret);
  746. probe4:
  747. ret = ehca_destroy_eq(shca, &shca->neq);
  748. if (ret)
  749. ehca_err(&shca->ib_device,
  750. "Cannot destroy NEQ. ret=%x", ret);
  751. probe3:
  752. ret = ehca_destroy_eq(shca, &shca->eq);
  753. if (ret)
  754. ehca_err(&shca->ib_device,
  755. "Cannot destroy EQ. ret=%x", ret);
  756. probe1:
  757. ib_dealloc_device(&shca->ib_device);
  758. return -EINVAL;
  759. }
  760. static int __devexit ehca_remove(struct of_device *dev)
  761. {
  762. struct ehca_shca *shca = dev_get_drvdata(&dev->dev);
  763. unsigned long flags;
  764. int ret;
  765. sysfs_remove_group(&dev->dev.kobj, &ehca_dev_attr_grp);
  766. if (ehca_open_aqp1 == 1) {
  767. int i;
  768. for (i = 0; i < shca->num_ports; i++) {
  769. ret = ehca_destroy_aqp1(&shca->sport[i]);
  770. if (ret)
  771. ehca_err(&shca->ib_device,
  772. "Cannot destroy AQP1 for port %x "
  773. "ret=%i", ret, i);
  774. }
  775. }
  776. ib_unregister_device(&shca->ib_device);
  777. ret = ehca_dereg_internal_maxmr(shca);
  778. if (ret)
  779. ehca_err(&shca->ib_device,
  780. "Cannot destroy internal MR. ret=%i", ret);
  781. ret = ehca_dealloc_pd(&shca->pd->ib_pd);
  782. if (ret)
  783. ehca_err(&shca->ib_device,
  784. "Cannot destroy internal PD. ret=%i", ret);
  785. ret = ehca_destroy_eq(shca, &shca->eq);
  786. if (ret)
  787. ehca_err(&shca->ib_device, "Cannot destroy EQ. ret=%i", ret);
  788. ret = ehca_destroy_eq(shca, &shca->neq);
  789. if (ret)
  790. ehca_err(&shca->ib_device, "Canot destroy NEQ. ret=%i", ret);
  791. ib_dealloc_device(&shca->ib_device);
  792. spin_lock_irqsave(&shca_list_lock, flags);
  793. list_del(&shca->shca_list);
  794. spin_unlock_irqrestore(&shca_list_lock, flags);
  795. return ret;
  796. }
  797. static struct of_device_id ehca_device_table[] =
  798. {
  799. {
  800. .name = "lhca",
  801. .compatible = "IBM,lhca",
  802. },
  803. {},
  804. };
  805. MODULE_DEVICE_TABLE(of, ehca_device_table);
  806. static struct of_platform_driver ehca_driver = {
  807. .probe = ehca_probe,
  808. .remove = ehca_remove,
  809. .driver = {
  810. .name = "ehca",
  811. .owner = THIS_MODULE,
  812. .groups = ehca_drv_attr_groups,
  813. .of_match_table = ehca_device_table,
  814. },
  815. };
  816. void ehca_poll_eqs(unsigned long data)
  817. {
  818. struct ehca_shca *shca;
  819. spin_lock(&shca_list_lock);
  820. list_for_each_entry(shca, &shca_list, shca_list) {
  821. if (shca->eq.is_initialized) {
  822. /* call deadman proc only if eq ptr does not change */
  823. struct ehca_eq *eq = &shca->eq;
  824. int max = 3;
  825. volatile u64 q_ofs, q_ofs2;
  826. unsigned long flags;
  827. spin_lock_irqsave(&eq->spinlock, flags);
  828. q_ofs = eq->ipz_queue.current_q_offset;
  829. spin_unlock_irqrestore(&eq->spinlock, flags);
  830. do {
  831. spin_lock_irqsave(&eq->spinlock, flags);
  832. q_ofs2 = eq->ipz_queue.current_q_offset;
  833. spin_unlock_irqrestore(&eq->spinlock, flags);
  834. max--;
  835. } while (q_ofs == q_ofs2 && max > 0);
  836. if (q_ofs == q_ofs2)
  837. ehca_process_eq(shca, 0);
  838. }
  839. }
  840. mod_timer(&poll_eqs_timer, round_jiffies(jiffies + HZ));
  841. spin_unlock(&shca_list_lock);
  842. }
  843. static int ehca_mem_notifier(struct notifier_block *nb,
  844. unsigned long action, void *data)
  845. {
  846. static unsigned long ehca_dmem_warn_time;
  847. unsigned long flags;
  848. switch (action) {
  849. case MEM_CANCEL_OFFLINE:
  850. case MEM_CANCEL_ONLINE:
  851. case MEM_ONLINE:
  852. case MEM_OFFLINE:
  853. return NOTIFY_OK;
  854. case MEM_GOING_ONLINE:
  855. case MEM_GOING_OFFLINE:
  856. /* only ok if no hca is attached to the lpar */
  857. spin_lock_irqsave(&shca_list_lock, flags);
  858. if (list_empty(&shca_list)) {
  859. spin_unlock_irqrestore(&shca_list_lock, flags);
  860. return NOTIFY_OK;
  861. } else {
  862. spin_unlock_irqrestore(&shca_list_lock, flags);
  863. if (printk_timed_ratelimit(&ehca_dmem_warn_time,
  864. 30 * 1000))
  865. ehca_gen_err("DMEM operations are not allowed"
  866. "in conjunction with eHCA");
  867. return NOTIFY_BAD;
  868. }
  869. }
  870. return NOTIFY_OK;
  871. }
  872. static struct notifier_block ehca_mem_nb = {
  873. .notifier_call = ehca_mem_notifier,
  874. };
  875. static int __init ehca_module_init(void)
  876. {
  877. int ret;
  878. printk(KERN_INFO "eHCA Infiniband Device Driver "
  879. "(Version " HCAD_VERSION ")\n");
  880. ret = ehca_create_comp_pool();
  881. if (ret) {
  882. ehca_gen_err("Cannot create comp pool.");
  883. return ret;
  884. }
  885. ret = ehca_create_slab_caches();
  886. if (ret) {
  887. ehca_gen_err("Cannot create SLAB caches");
  888. ret = -ENOMEM;
  889. goto module_init1;
  890. }
  891. ret = ehca_create_busmap();
  892. if (ret) {
  893. ehca_gen_err("Cannot create busmap.");
  894. goto module_init2;
  895. }
  896. ret = ibmebus_register_driver(&ehca_driver);
  897. if (ret) {
  898. ehca_gen_err("Cannot register eHCA device driver");
  899. ret = -EINVAL;
  900. goto module_init3;
  901. }
  902. ret = register_memory_notifier(&ehca_mem_nb);
  903. if (ret) {
  904. ehca_gen_err("Failed registering memory add/remove notifier");
  905. goto module_init4;
  906. }
  907. if (ehca_poll_all_eqs != 1) {
  908. ehca_gen_err("WARNING!!!");
  909. ehca_gen_err("It is possible to lose interrupts.");
  910. } else {
  911. init_timer(&poll_eqs_timer);
  912. poll_eqs_timer.function = ehca_poll_eqs;
  913. poll_eqs_timer.expires = jiffies + HZ;
  914. add_timer(&poll_eqs_timer);
  915. }
  916. return 0;
  917. module_init4:
  918. ibmebus_unregister_driver(&ehca_driver);
  919. module_init3:
  920. ehca_destroy_busmap();
  921. module_init2:
  922. ehca_destroy_slab_caches();
  923. module_init1:
  924. ehca_destroy_comp_pool();
  925. return ret;
  926. };
  927. static void __exit ehca_module_exit(void)
  928. {
  929. if (ehca_poll_all_eqs == 1)
  930. del_timer_sync(&poll_eqs_timer);
  931. ibmebus_unregister_driver(&ehca_driver);
  932. unregister_memory_notifier(&ehca_mem_nb);
  933. ehca_destroy_busmap();
  934. ehca_destroy_slab_caches();
  935. ehca_destroy_comp_pool();
  936. idr_destroy(&ehca_cq_idr);
  937. idr_destroy(&ehca_qp_idr);
  938. };
  939. module_init(ehca_module_init);
  940. module_exit(ehca_module_exit);