native.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097
  1. /*
  2. * Copyright 2014 IBM Corp.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #include <linux/spinlock.h>
  10. #include <linux/sched.h>
  11. #include <linux/slab.h>
  12. #include <linux/sched.h>
  13. #include <linux/mutex.h>
  14. #include <linux/mm.h>
  15. #include <linux/uaccess.h>
  16. #include <asm/synch.h>
  17. #include <misc/cxl-base.h>
  18. #include "cxl.h"
  19. #include "trace.h"
  20. static int afu_control(struct cxl_afu *afu, u64 command,
  21. u64 result, u64 mask, bool enabled)
  22. {
  23. u64 AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
  24. unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT);
  25. int rc = 0;
  26. spin_lock(&afu->afu_cntl_lock);
  27. pr_devel("AFU command starting: %llx\n", command);
  28. trace_cxl_afu_ctrl(afu, command);
  29. cxl_p2n_write(afu, CXL_AFU_Cntl_An, AFU_Cntl | command);
  30. AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
  31. while ((AFU_Cntl & mask) != result) {
  32. if (time_after_eq(jiffies, timeout)) {
  33. dev_warn(&afu->dev, "WARNING: AFU control timed out!\n");
  34. rc = -EBUSY;
  35. goto out;
  36. }
  37. if (!cxl_ops->link_ok(afu->adapter, afu)) {
  38. afu->enabled = enabled;
  39. rc = -EIO;
  40. goto out;
  41. }
  42. pr_devel_ratelimited("AFU control... (0x%016llx)\n",
  43. AFU_Cntl | command);
  44. cpu_relax();
  45. AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
  46. };
  47. pr_devel("AFU command complete: %llx\n", command);
  48. afu->enabled = enabled;
  49. out:
  50. trace_cxl_afu_ctrl_done(afu, command, rc);
  51. spin_unlock(&afu->afu_cntl_lock);
  52. return rc;
  53. }
  54. static int afu_enable(struct cxl_afu *afu)
  55. {
  56. pr_devel("AFU enable request\n");
  57. return afu_control(afu, CXL_AFU_Cntl_An_E,
  58. CXL_AFU_Cntl_An_ES_Enabled,
  59. CXL_AFU_Cntl_An_ES_MASK, true);
  60. }
  61. int cxl_afu_disable(struct cxl_afu *afu)
  62. {
  63. pr_devel("AFU disable request\n");
  64. return afu_control(afu, 0, CXL_AFU_Cntl_An_ES_Disabled,
  65. CXL_AFU_Cntl_An_ES_MASK, false);
  66. }
  67. /* This will disable as well as reset */
  68. static int native_afu_reset(struct cxl_afu *afu)
  69. {
  70. pr_devel("AFU reset request\n");
  71. return afu_control(afu, CXL_AFU_Cntl_An_RA,
  72. CXL_AFU_Cntl_An_RS_Complete | CXL_AFU_Cntl_An_ES_Disabled,
  73. CXL_AFU_Cntl_An_RS_MASK | CXL_AFU_Cntl_An_ES_MASK,
  74. false);
  75. }
  76. static int native_afu_check_and_enable(struct cxl_afu *afu)
  77. {
  78. if (!cxl_ops->link_ok(afu->adapter, afu)) {
  79. WARN(1, "Refusing to enable afu while link down!\n");
  80. return -EIO;
  81. }
  82. if (afu->enabled)
  83. return 0;
  84. return afu_enable(afu);
  85. }
  86. int cxl_psl_purge(struct cxl_afu *afu)
  87. {
  88. u64 PSL_CNTL = cxl_p1n_read(afu, CXL_PSL_SCNTL_An);
  89. u64 AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
  90. u64 dsisr, dar;
  91. u64 start, end;
  92. unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT);
  93. int rc = 0;
  94. trace_cxl_psl_ctrl(afu, CXL_PSL_SCNTL_An_Pc);
  95. pr_devel("PSL purge request\n");
  96. if (!cxl_ops->link_ok(afu->adapter, afu)) {
  97. dev_warn(&afu->dev, "PSL Purge called with link down, ignoring\n");
  98. rc = -EIO;
  99. goto out;
  100. }
  101. if ((AFU_Cntl & CXL_AFU_Cntl_An_ES_MASK) != CXL_AFU_Cntl_An_ES_Disabled) {
  102. WARN(1, "psl_purge request while AFU not disabled!\n");
  103. cxl_afu_disable(afu);
  104. }
  105. cxl_p1n_write(afu, CXL_PSL_SCNTL_An,
  106. PSL_CNTL | CXL_PSL_SCNTL_An_Pc);
  107. start = local_clock();
  108. PSL_CNTL = cxl_p1n_read(afu, CXL_PSL_SCNTL_An);
  109. while ((PSL_CNTL & CXL_PSL_SCNTL_An_Ps_MASK)
  110. == CXL_PSL_SCNTL_An_Ps_Pending) {
  111. if (time_after_eq(jiffies, timeout)) {
  112. dev_warn(&afu->dev, "WARNING: PSL Purge timed out!\n");
  113. rc = -EBUSY;
  114. goto out;
  115. }
  116. if (!cxl_ops->link_ok(afu->adapter, afu)) {
  117. rc = -EIO;
  118. goto out;
  119. }
  120. dsisr = cxl_p2n_read(afu, CXL_PSL_DSISR_An);
  121. pr_devel_ratelimited("PSL purging... PSL_CNTL: 0x%016llx PSL_DSISR: 0x%016llx\n", PSL_CNTL, dsisr);
  122. if (dsisr & CXL_PSL_DSISR_TRANS) {
  123. dar = cxl_p2n_read(afu, CXL_PSL_DAR_An);
  124. dev_notice(&afu->dev, "PSL purge terminating pending translation, DSISR: 0x%016llx, DAR: 0x%016llx\n", dsisr, dar);
  125. cxl_p2n_write(afu, CXL_PSL_TFC_An, CXL_PSL_TFC_An_AE);
  126. } else if (dsisr) {
  127. dev_notice(&afu->dev, "PSL purge acknowledging pending non-translation fault, DSISR: 0x%016llx\n", dsisr);
  128. cxl_p2n_write(afu, CXL_PSL_TFC_An, CXL_PSL_TFC_An_A);
  129. } else {
  130. cpu_relax();
  131. }
  132. PSL_CNTL = cxl_p1n_read(afu, CXL_PSL_SCNTL_An);
  133. };
  134. end = local_clock();
  135. pr_devel("PSL purged in %lld ns\n", end - start);
  136. cxl_p1n_write(afu, CXL_PSL_SCNTL_An,
  137. PSL_CNTL & ~CXL_PSL_SCNTL_An_Pc);
  138. out:
  139. trace_cxl_psl_ctrl_done(afu, CXL_PSL_SCNTL_An_Pc, rc);
  140. return rc;
  141. }
  142. static int spa_max_procs(int spa_size)
  143. {
  144. /*
  145. * From the CAIA:
  146. * end_of_SPA_area = SPA_Base + ((n+4) * 128) + (( ((n*8) + 127) >> 7) * 128) + 255
  147. * Most of that junk is really just an overly-complicated way of saying
  148. * the last 256 bytes are __aligned(128), so it's really:
  149. * end_of_SPA_area = end_of_PSL_queue_area + __aligned(128) 255
  150. * and
  151. * end_of_PSL_queue_area = SPA_Base + ((n+4) * 128) + (n*8) - 1
  152. * so
  153. * sizeof(SPA) = ((n+4) * 128) + (n*8) + __aligned(128) 256
  154. * Ignore the alignment (which is safe in this case as long as we are
  155. * careful with our rounding) and solve for n:
  156. */
  157. return ((spa_size / 8) - 96) / 17;
  158. }
  159. int cxl_alloc_spa(struct cxl_afu *afu)
  160. {
  161. /* Work out how many pages to allocate */
  162. afu->native->spa_order = 0;
  163. do {
  164. afu->native->spa_order++;
  165. afu->native->spa_size = (1 << afu->native->spa_order) * PAGE_SIZE;
  166. afu->native->spa_max_procs = spa_max_procs(afu->native->spa_size);
  167. } while (afu->native->spa_max_procs < afu->num_procs);
  168. WARN_ON(afu->native->spa_size > 0x100000); /* Max size supported by the hardware */
  169. if (!(afu->native->spa = (struct cxl_process_element *)
  170. __get_free_pages(GFP_KERNEL | __GFP_ZERO, afu->native->spa_order))) {
  171. pr_err("cxl_alloc_spa: Unable to allocate scheduled process area\n");
  172. return -ENOMEM;
  173. }
  174. pr_devel("spa pages: %i afu->spa_max_procs: %i afu->num_procs: %i\n",
  175. 1<<afu->native->spa_order, afu->native->spa_max_procs, afu->num_procs);
  176. return 0;
  177. }
  178. static void attach_spa(struct cxl_afu *afu)
  179. {
  180. u64 spap;
  181. afu->native->sw_command_status = (__be64 *)((char *)afu->native->spa +
  182. ((afu->native->spa_max_procs + 3) * 128));
  183. spap = virt_to_phys(afu->native->spa) & CXL_PSL_SPAP_Addr;
  184. spap |= ((afu->native->spa_size >> (12 - CXL_PSL_SPAP_Size_Shift)) - 1) & CXL_PSL_SPAP_Size;
  185. spap |= CXL_PSL_SPAP_V;
  186. pr_devel("cxl: SPA allocated at 0x%p. Max processes: %i, sw_command_status: 0x%p CXL_PSL_SPAP_An=0x%016llx\n",
  187. afu->native->spa, afu->native->spa_max_procs,
  188. afu->native->sw_command_status, spap);
  189. cxl_p1n_write(afu, CXL_PSL_SPAP_An, spap);
  190. }
  191. static inline void detach_spa(struct cxl_afu *afu)
  192. {
  193. cxl_p1n_write(afu, CXL_PSL_SPAP_An, 0);
  194. }
  195. void cxl_release_spa(struct cxl_afu *afu)
  196. {
  197. if (afu->native->spa) {
  198. free_pages((unsigned long) afu->native->spa,
  199. afu->native->spa_order);
  200. afu->native->spa = NULL;
  201. }
  202. }
  203. int cxl_tlb_slb_invalidate(struct cxl *adapter)
  204. {
  205. unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT);
  206. pr_devel("CXL adapter wide TLBIA & SLBIA\n");
  207. cxl_p1_write(adapter, CXL_PSL_AFUSEL, CXL_PSL_AFUSEL_A);
  208. cxl_p1_write(adapter, CXL_PSL_TLBIA, CXL_TLB_SLB_IQ_ALL);
  209. while (cxl_p1_read(adapter, CXL_PSL_TLBIA) & CXL_TLB_SLB_P) {
  210. if (time_after_eq(jiffies, timeout)) {
  211. dev_warn(&adapter->dev, "WARNING: CXL adapter wide TLBIA timed out!\n");
  212. return -EBUSY;
  213. }
  214. if (!cxl_ops->link_ok(adapter, NULL))
  215. return -EIO;
  216. cpu_relax();
  217. }
  218. cxl_p1_write(adapter, CXL_PSL_SLBIA, CXL_TLB_SLB_IQ_ALL);
  219. while (cxl_p1_read(adapter, CXL_PSL_SLBIA) & CXL_TLB_SLB_P) {
  220. if (time_after_eq(jiffies, timeout)) {
  221. dev_warn(&adapter->dev, "WARNING: CXL adapter wide SLBIA timed out!\n");
  222. return -EBUSY;
  223. }
  224. if (!cxl_ops->link_ok(adapter, NULL))
  225. return -EIO;
  226. cpu_relax();
  227. }
  228. return 0;
  229. }
  230. static int cxl_write_sstp(struct cxl_afu *afu, u64 sstp0, u64 sstp1)
  231. {
  232. int rc;
  233. /* 1. Disable SSTP by writing 0 to SSTP1[V] */
  234. cxl_p2n_write(afu, CXL_SSTP1_An, 0);
  235. /* 2. Invalidate all SLB entries */
  236. if ((rc = cxl_afu_slbia(afu)))
  237. return rc;
  238. /* 3. Set SSTP0_An */
  239. cxl_p2n_write(afu, CXL_SSTP0_An, sstp0);
  240. /* 4. Set SSTP1_An */
  241. cxl_p2n_write(afu, CXL_SSTP1_An, sstp1);
  242. return 0;
  243. }
  244. /* Using per slice version may improve performance here. (ie. SLBIA_An) */
  245. static void slb_invalid(struct cxl_context *ctx)
  246. {
  247. struct cxl *adapter = ctx->afu->adapter;
  248. u64 slbia;
  249. WARN_ON(!mutex_is_locked(&ctx->afu->native->spa_mutex));
  250. cxl_p1_write(adapter, CXL_PSL_LBISEL,
  251. ((u64)be32_to_cpu(ctx->elem->common.pid) << 32) |
  252. be32_to_cpu(ctx->elem->lpid));
  253. cxl_p1_write(adapter, CXL_PSL_SLBIA, CXL_TLB_SLB_IQ_LPIDPID);
  254. while (1) {
  255. if (!cxl_ops->link_ok(adapter, NULL))
  256. break;
  257. slbia = cxl_p1_read(adapter, CXL_PSL_SLBIA);
  258. if (!(slbia & CXL_TLB_SLB_P))
  259. break;
  260. cpu_relax();
  261. }
  262. }
  263. static int do_process_element_cmd(struct cxl_context *ctx,
  264. u64 cmd, u64 pe_state)
  265. {
  266. u64 state;
  267. unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT);
  268. int rc = 0;
  269. trace_cxl_llcmd(ctx, cmd);
  270. WARN_ON(!ctx->afu->enabled);
  271. ctx->elem->software_state = cpu_to_be32(pe_state);
  272. smp_wmb();
  273. *(ctx->afu->native->sw_command_status) = cpu_to_be64(cmd | 0 | ctx->pe);
  274. smp_mb();
  275. cxl_p1n_write(ctx->afu, CXL_PSL_LLCMD_An, cmd | ctx->pe);
  276. while (1) {
  277. if (time_after_eq(jiffies, timeout)) {
  278. dev_warn(&ctx->afu->dev, "WARNING: Process Element Command timed out!\n");
  279. rc = -EBUSY;
  280. goto out;
  281. }
  282. if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) {
  283. dev_warn(&ctx->afu->dev, "WARNING: Device link down, aborting Process Element Command!\n");
  284. rc = -EIO;
  285. goto out;
  286. }
  287. state = be64_to_cpup(ctx->afu->native->sw_command_status);
  288. if (state == ~0ULL) {
  289. pr_err("cxl: Error adding process element to AFU\n");
  290. rc = -1;
  291. goto out;
  292. }
  293. if ((state & (CXL_SPA_SW_CMD_MASK | CXL_SPA_SW_STATE_MASK | CXL_SPA_SW_LINK_MASK)) ==
  294. (cmd | (cmd >> 16) | ctx->pe))
  295. break;
  296. /*
  297. * The command won't finish in the PSL if there are
  298. * outstanding DSIs. Hence we need to yield here in
  299. * case there are outstanding DSIs that we need to
  300. * service. Tuning possiblity: we could wait for a
  301. * while before sched
  302. */
  303. schedule();
  304. }
  305. out:
  306. trace_cxl_llcmd_done(ctx, cmd, rc);
  307. return rc;
  308. }
  309. static int add_process_element(struct cxl_context *ctx)
  310. {
  311. int rc = 0;
  312. mutex_lock(&ctx->afu->native->spa_mutex);
  313. pr_devel("%s Adding pe: %i started\n", __func__, ctx->pe);
  314. if (!(rc = do_process_element_cmd(ctx, CXL_SPA_SW_CMD_ADD, CXL_PE_SOFTWARE_STATE_V)))
  315. ctx->pe_inserted = true;
  316. pr_devel("%s Adding pe: %i finished\n", __func__, ctx->pe);
  317. mutex_unlock(&ctx->afu->native->spa_mutex);
  318. return rc;
  319. }
  320. static int terminate_process_element(struct cxl_context *ctx)
  321. {
  322. int rc = 0;
  323. /* fast path terminate if it's already invalid */
  324. if (!(ctx->elem->software_state & cpu_to_be32(CXL_PE_SOFTWARE_STATE_V)))
  325. return rc;
  326. mutex_lock(&ctx->afu->native->spa_mutex);
  327. pr_devel("%s Terminate pe: %i started\n", __func__, ctx->pe);
  328. /* We could be asked to terminate when the hw is down. That
  329. * should always succeed: it's not running if the hw has gone
  330. * away and is being reset.
  331. */
  332. if (cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
  333. rc = do_process_element_cmd(ctx, CXL_SPA_SW_CMD_TERMINATE,
  334. CXL_PE_SOFTWARE_STATE_V | CXL_PE_SOFTWARE_STATE_T);
  335. ctx->elem->software_state = 0; /* Remove Valid bit */
  336. pr_devel("%s Terminate pe: %i finished\n", __func__, ctx->pe);
  337. mutex_unlock(&ctx->afu->native->spa_mutex);
  338. return rc;
  339. }
  340. static int remove_process_element(struct cxl_context *ctx)
  341. {
  342. int rc = 0;
  343. mutex_lock(&ctx->afu->native->spa_mutex);
  344. pr_devel("%s Remove pe: %i started\n", __func__, ctx->pe);
  345. /* We could be asked to remove when the hw is down. Again, if
  346. * the hw is down, the PE is gone, so we succeed.
  347. */
  348. if (cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
  349. rc = do_process_element_cmd(ctx, CXL_SPA_SW_CMD_REMOVE, 0);
  350. if (!rc)
  351. ctx->pe_inserted = false;
  352. slb_invalid(ctx);
  353. pr_devel("%s Remove pe: %i finished\n", __func__, ctx->pe);
  354. mutex_unlock(&ctx->afu->native->spa_mutex);
  355. return rc;
  356. }
  357. void cxl_assign_psn_space(struct cxl_context *ctx)
  358. {
  359. if (!ctx->afu->pp_size || ctx->master) {
  360. ctx->psn_phys = ctx->afu->psn_phys;
  361. ctx->psn_size = ctx->afu->adapter->ps_size;
  362. } else {
  363. ctx->psn_phys = ctx->afu->psn_phys +
  364. (ctx->afu->native->pp_offset + ctx->afu->pp_size * ctx->pe);
  365. ctx->psn_size = ctx->afu->pp_size;
  366. }
  367. }
  368. static int activate_afu_directed(struct cxl_afu *afu)
  369. {
  370. int rc;
  371. dev_info(&afu->dev, "Activating AFU directed mode\n");
  372. afu->num_procs = afu->max_procs_virtualised;
  373. if (afu->native->spa == NULL) {
  374. if (cxl_alloc_spa(afu))
  375. return -ENOMEM;
  376. }
  377. attach_spa(afu);
  378. cxl_p1n_write(afu, CXL_PSL_SCNTL_An, CXL_PSL_SCNTL_An_PM_AFU);
  379. cxl_p1n_write(afu, CXL_PSL_AMOR_An, 0xFFFFFFFFFFFFFFFFULL);
  380. cxl_p1n_write(afu, CXL_PSL_ID_An, CXL_PSL_ID_An_F | CXL_PSL_ID_An_L);
  381. afu->current_mode = CXL_MODE_DIRECTED;
  382. if ((rc = cxl_chardev_m_afu_add(afu)))
  383. return rc;
  384. if ((rc = cxl_sysfs_afu_m_add(afu)))
  385. goto err;
  386. if ((rc = cxl_chardev_s_afu_add(afu)))
  387. goto err1;
  388. return 0;
  389. err1:
  390. cxl_sysfs_afu_m_remove(afu);
  391. err:
  392. cxl_chardev_afu_remove(afu);
  393. return rc;
  394. }
  395. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  396. #define set_endian(sr) ((sr) |= CXL_PSL_SR_An_LE)
  397. #else
  398. #define set_endian(sr) ((sr) &= ~(CXL_PSL_SR_An_LE))
  399. #endif
  400. static u64 calculate_sr(struct cxl_context *ctx)
  401. {
  402. u64 sr = 0;
  403. set_endian(sr);
  404. if (ctx->master)
  405. sr |= CXL_PSL_SR_An_MP;
  406. if (mfspr(SPRN_LPCR) & LPCR_TC)
  407. sr |= CXL_PSL_SR_An_TC;
  408. if (ctx->kernel) {
  409. sr |= CXL_PSL_SR_An_R | (mfmsr() & MSR_SF);
  410. sr |= CXL_PSL_SR_An_HV;
  411. } else {
  412. sr |= CXL_PSL_SR_An_PR | CXL_PSL_SR_An_R;
  413. sr &= ~(CXL_PSL_SR_An_HV);
  414. if (!test_tsk_thread_flag(current, TIF_32BIT))
  415. sr |= CXL_PSL_SR_An_SF;
  416. }
  417. return sr;
  418. }
  419. static int attach_afu_directed(struct cxl_context *ctx, u64 wed, u64 amr)
  420. {
  421. u32 pid;
  422. int r, result;
  423. cxl_assign_psn_space(ctx);
  424. ctx->elem->ctxtime = 0; /* disable */
  425. ctx->elem->lpid = cpu_to_be32(mfspr(SPRN_LPID));
  426. ctx->elem->haurp = 0; /* disable */
  427. ctx->elem->sdr = cpu_to_be64(mfspr(SPRN_SDR1));
  428. pid = current->pid;
  429. if (ctx->kernel)
  430. pid = 0;
  431. ctx->elem->common.tid = 0;
  432. ctx->elem->common.pid = cpu_to_be32(pid);
  433. ctx->elem->sr = cpu_to_be64(calculate_sr(ctx));
  434. ctx->elem->common.csrp = 0; /* disable */
  435. ctx->elem->common.aurp0 = 0; /* disable */
  436. ctx->elem->common.aurp1 = 0; /* disable */
  437. cxl_prefault(ctx, wed);
  438. ctx->elem->common.sstp0 = cpu_to_be64(ctx->sstp0);
  439. ctx->elem->common.sstp1 = cpu_to_be64(ctx->sstp1);
  440. for (r = 0; r < CXL_IRQ_RANGES; r++) {
  441. ctx->elem->ivte_offsets[r] = cpu_to_be16(ctx->irqs.offset[r]);
  442. ctx->elem->ivte_ranges[r] = cpu_to_be16(ctx->irqs.range[r]);
  443. }
  444. ctx->elem->common.amr = cpu_to_be64(amr);
  445. ctx->elem->common.wed = cpu_to_be64(wed);
  446. /* first guy needs to enable */
  447. if ((result = cxl_ops->afu_check_and_enable(ctx->afu)))
  448. return result;
  449. return add_process_element(ctx);
  450. }
  451. static int deactivate_afu_directed(struct cxl_afu *afu)
  452. {
  453. dev_info(&afu->dev, "Deactivating AFU directed mode\n");
  454. afu->current_mode = 0;
  455. afu->num_procs = 0;
  456. cxl_sysfs_afu_m_remove(afu);
  457. cxl_chardev_afu_remove(afu);
  458. cxl_ops->afu_reset(afu);
  459. cxl_afu_disable(afu);
  460. cxl_psl_purge(afu);
  461. return 0;
  462. }
  463. static int activate_dedicated_process(struct cxl_afu *afu)
  464. {
  465. dev_info(&afu->dev, "Activating dedicated process mode\n");
  466. cxl_p1n_write(afu, CXL_PSL_SCNTL_An, CXL_PSL_SCNTL_An_PM_Process);
  467. cxl_p1n_write(afu, CXL_PSL_CtxTime_An, 0); /* disable */
  468. cxl_p1n_write(afu, CXL_PSL_SPAP_An, 0); /* disable */
  469. cxl_p1n_write(afu, CXL_PSL_AMOR_An, 0xFFFFFFFFFFFFFFFFULL);
  470. cxl_p1n_write(afu, CXL_PSL_LPID_An, mfspr(SPRN_LPID));
  471. cxl_p1n_write(afu, CXL_HAURP_An, 0); /* disable */
  472. cxl_p1n_write(afu, CXL_PSL_SDR_An, mfspr(SPRN_SDR1));
  473. cxl_p2n_write(afu, CXL_CSRP_An, 0); /* disable */
  474. cxl_p2n_write(afu, CXL_AURP0_An, 0); /* disable */
  475. cxl_p2n_write(afu, CXL_AURP1_An, 0); /* disable */
  476. afu->current_mode = CXL_MODE_DEDICATED;
  477. afu->num_procs = 1;
  478. return cxl_chardev_d_afu_add(afu);
  479. }
  480. static int attach_dedicated(struct cxl_context *ctx, u64 wed, u64 amr)
  481. {
  482. struct cxl_afu *afu = ctx->afu;
  483. u64 pid;
  484. int rc;
  485. pid = (u64)current->pid << 32;
  486. if (ctx->kernel)
  487. pid = 0;
  488. cxl_p2n_write(afu, CXL_PSL_PID_TID_An, pid);
  489. cxl_p1n_write(afu, CXL_PSL_SR_An, calculate_sr(ctx));
  490. if ((rc = cxl_write_sstp(afu, ctx->sstp0, ctx->sstp1)))
  491. return rc;
  492. cxl_prefault(ctx, wed);
  493. cxl_p1n_write(afu, CXL_PSL_IVTE_Offset_An,
  494. (((u64)ctx->irqs.offset[0] & 0xffff) << 48) |
  495. (((u64)ctx->irqs.offset[1] & 0xffff) << 32) |
  496. (((u64)ctx->irqs.offset[2] & 0xffff) << 16) |
  497. ((u64)ctx->irqs.offset[3] & 0xffff));
  498. cxl_p1n_write(afu, CXL_PSL_IVTE_Limit_An, (u64)
  499. (((u64)ctx->irqs.range[0] & 0xffff) << 48) |
  500. (((u64)ctx->irqs.range[1] & 0xffff) << 32) |
  501. (((u64)ctx->irqs.range[2] & 0xffff) << 16) |
  502. ((u64)ctx->irqs.range[3] & 0xffff));
  503. cxl_p2n_write(afu, CXL_PSL_AMR_An, amr);
  504. /* master only context for dedicated */
  505. cxl_assign_psn_space(ctx);
  506. if ((rc = cxl_ops->afu_reset(afu)))
  507. return rc;
  508. cxl_p2n_write(afu, CXL_PSL_WED_An, wed);
  509. return afu_enable(afu);
  510. }
  511. static int deactivate_dedicated_process(struct cxl_afu *afu)
  512. {
  513. dev_info(&afu->dev, "Deactivating dedicated process mode\n");
  514. afu->current_mode = 0;
  515. afu->num_procs = 0;
  516. cxl_chardev_afu_remove(afu);
  517. return 0;
  518. }
  519. static int native_afu_deactivate_mode(struct cxl_afu *afu, int mode)
  520. {
  521. if (mode == CXL_MODE_DIRECTED)
  522. return deactivate_afu_directed(afu);
  523. if (mode == CXL_MODE_DEDICATED)
  524. return deactivate_dedicated_process(afu);
  525. return 0;
  526. }
  527. static int native_afu_activate_mode(struct cxl_afu *afu, int mode)
  528. {
  529. if (!mode)
  530. return 0;
  531. if (!(mode & afu->modes_supported))
  532. return -EINVAL;
  533. if (!cxl_ops->link_ok(afu->adapter, afu)) {
  534. WARN(1, "Device link is down, refusing to activate!\n");
  535. return -EIO;
  536. }
  537. if (mode == CXL_MODE_DIRECTED)
  538. return activate_afu_directed(afu);
  539. if (mode == CXL_MODE_DEDICATED)
  540. return activate_dedicated_process(afu);
  541. return -EINVAL;
  542. }
  543. static int native_attach_process(struct cxl_context *ctx, bool kernel,
  544. u64 wed, u64 amr)
  545. {
  546. if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) {
  547. WARN(1, "Device link is down, refusing to attach process!\n");
  548. return -EIO;
  549. }
  550. ctx->kernel = kernel;
  551. if (ctx->afu->current_mode == CXL_MODE_DIRECTED)
  552. return attach_afu_directed(ctx, wed, amr);
  553. if (ctx->afu->current_mode == CXL_MODE_DEDICATED)
  554. return attach_dedicated(ctx, wed, amr);
  555. return -EINVAL;
  556. }
  557. static inline int detach_process_native_dedicated(struct cxl_context *ctx)
  558. {
  559. cxl_ops->afu_reset(ctx->afu);
  560. cxl_afu_disable(ctx->afu);
  561. cxl_psl_purge(ctx->afu);
  562. return 0;
  563. }
  564. static inline int detach_process_native_afu_directed(struct cxl_context *ctx)
  565. {
  566. if (!ctx->pe_inserted)
  567. return 0;
  568. if (terminate_process_element(ctx))
  569. return -1;
  570. if (remove_process_element(ctx))
  571. return -1;
  572. return 0;
  573. }
  574. static int native_detach_process(struct cxl_context *ctx)
  575. {
  576. trace_cxl_detach(ctx);
  577. if (ctx->afu->current_mode == CXL_MODE_DEDICATED)
  578. return detach_process_native_dedicated(ctx);
  579. return detach_process_native_afu_directed(ctx);
  580. }
  581. static int native_get_irq_info(struct cxl_afu *afu, struct cxl_irq_info *info)
  582. {
  583. u64 pidtid;
  584. /* If the adapter has gone away, we can't get any meaningful
  585. * information.
  586. */
  587. if (!cxl_ops->link_ok(afu->adapter, afu))
  588. return -EIO;
  589. info->dsisr = cxl_p2n_read(afu, CXL_PSL_DSISR_An);
  590. info->dar = cxl_p2n_read(afu, CXL_PSL_DAR_An);
  591. info->dsr = cxl_p2n_read(afu, CXL_PSL_DSR_An);
  592. pidtid = cxl_p2n_read(afu, CXL_PSL_PID_TID_An);
  593. info->pid = pidtid >> 32;
  594. info->tid = pidtid & 0xffffffff;
  595. info->afu_err = cxl_p2n_read(afu, CXL_AFU_ERR_An);
  596. info->errstat = cxl_p2n_read(afu, CXL_PSL_ErrStat_An);
  597. info->proc_handle = 0;
  598. return 0;
  599. }
  600. static irqreturn_t native_handle_psl_slice_error(struct cxl_context *ctx,
  601. u64 dsisr, u64 errstat)
  602. {
  603. u64 fir1, fir2, fir_slice, serr, afu_debug;
  604. fir1 = cxl_p1_read(ctx->afu->adapter, CXL_PSL_FIR1);
  605. fir2 = cxl_p1_read(ctx->afu->adapter, CXL_PSL_FIR2);
  606. fir_slice = cxl_p1n_read(ctx->afu, CXL_PSL_FIR_SLICE_An);
  607. serr = cxl_p1n_read(ctx->afu, CXL_PSL_SERR_An);
  608. afu_debug = cxl_p1n_read(ctx->afu, CXL_AFU_DEBUG_An);
  609. dev_crit(&ctx->afu->dev, "PSL ERROR STATUS: 0x%016llx\n", errstat);
  610. dev_crit(&ctx->afu->dev, "PSL_FIR1: 0x%016llx\n", fir1);
  611. dev_crit(&ctx->afu->dev, "PSL_FIR2: 0x%016llx\n", fir2);
  612. dev_crit(&ctx->afu->dev, "PSL_SERR_An: 0x%016llx\n", serr);
  613. dev_crit(&ctx->afu->dev, "PSL_FIR_SLICE_An: 0x%016llx\n", fir_slice);
  614. dev_crit(&ctx->afu->dev, "CXL_PSL_AFU_DEBUG_An: 0x%016llx\n", afu_debug);
  615. dev_crit(&ctx->afu->dev, "STOPPING CXL TRACE\n");
  616. cxl_stop_trace(ctx->afu->adapter);
  617. return cxl_ops->ack_irq(ctx, 0, errstat);
  618. }
  619. static irqreturn_t fail_psl_irq(struct cxl_afu *afu, struct cxl_irq_info *irq_info)
  620. {
  621. if (irq_info->dsisr & CXL_PSL_DSISR_TRANS)
  622. cxl_p2n_write(afu, CXL_PSL_TFC_An, CXL_PSL_TFC_An_AE);
  623. else
  624. cxl_p2n_write(afu, CXL_PSL_TFC_An, CXL_PSL_TFC_An_A);
  625. return IRQ_HANDLED;
  626. }
  627. static irqreturn_t native_irq_multiplexed(int irq, void *data)
  628. {
  629. struct cxl_afu *afu = data;
  630. struct cxl_context *ctx;
  631. struct cxl_irq_info irq_info;
  632. int ph = cxl_p2n_read(afu, CXL_PSL_PEHandle_An) & 0xffff;
  633. int ret;
  634. if ((ret = native_get_irq_info(afu, &irq_info))) {
  635. WARN(1, "Unable to get CXL IRQ Info: %i\n", ret);
  636. return fail_psl_irq(afu, &irq_info);
  637. }
  638. rcu_read_lock();
  639. ctx = idr_find(&afu->contexts_idr, ph);
  640. if (ctx) {
  641. ret = cxl_irq(irq, ctx, &irq_info);
  642. rcu_read_unlock();
  643. return ret;
  644. }
  645. rcu_read_unlock();
  646. WARN(1, "Unable to demultiplex CXL PSL IRQ for PE %i DSISR %016llx DAR"
  647. " %016llx\n(Possible AFU HW issue - was a term/remove acked"
  648. " with outstanding transactions?)\n", ph, irq_info.dsisr,
  649. irq_info.dar);
  650. return fail_psl_irq(afu, &irq_info);
  651. }
  652. static irqreturn_t native_slice_irq_err(int irq, void *data)
  653. {
  654. struct cxl_afu *afu = data;
  655. u64 fir_slice, errstat, serr, afu_debug;
  656. WARN(irq, "CXL SLICE ERROR interrupt %i\n", irq);
  657. serr = cxl_p1n_read(afu, CXL_PSL_SERR_An);
  658. fir_slice = cxl_p1n_read(afu, CXL_PSL_FIR_SLICE_An);
  659. errstat = cxl_p2n_read(afu, CXL_PSL_ErrStat_An);
  660. afu_debug = cxl_p1n_read(afu, CXL_AFU_DEBUG_An);
  661. dev_crit(&afu->dev, "PSL_SERR_An: 0x%016llx\n", serr);
  662. dev_crit(&afu->dev, "PSL_FIR_SLICE_An: 0x%016llx\n", fir_slice);
  663. dev_crit(&afu->dev, "CXL_PSL_ErrStat_An: 0x%016llx\n", errstat);
  664. dev_crit(&afu->dev, "CXL_PSL_AFU_DEBUG_An: 0x%016llx\n", afu_debug);
  665. cxl_p1n_write(afu, CXL_PSL_SERR_An, serr);
  666. return IRQ_HANDLED;
  667. }
  668. static irqreturn_t native_irq_err(int irq, void *data)
  669. {
  670. struct cxl *adapter = data;
  671. u64 fir1, fir2, err_ivte;
  672. WARN(1, "CXL ERROR interrupt %i\n", irq);
  673. err_ivte = cxl_p1_read(adapter, CXL_PSL_ErrIVTE);
  674. dev_crit(&adapter->dev, "PSL_ErrIVTE: 0x%016llx\n", err_ivte);
  675. dev_crit(&adapter->dev, "STOPPING CXL TRACE\n");
  676. cxl_stop_trace(adapter);
  677. fir1 = cxl_p1_read(adapter, CXL_PSL_FIR1);
  678. fir2 = cxl_p1_read(adapter, CXL_PSL_FIR2);
  679. dev_crit(&adapter->dev, "PSL_FIR1: 0x%016llx\nPSL_FIR2: 0x%016llx\n", fir1, fir2);
  680. return IRQ_HANDLED;
  681. }
  682. int cxl_native_register_psl_err_irq(struct cxl *adapter)
  683. {
  684. int rc;
  685. adapter->irq_name = kasprintf(GFP_KERNEL, "cxl-%s-err",
  686. dev_name(&adapter->dev));
  687. if (!adapter->irq_name)
  688. return -ENOMEM;
  689. if ((rc = cxl_register_one_irq(adapter, native_irq_err, adapter,
  690. &adapter->native->err_hwirq,
  691. &adapter->native->err_virq,
  692. adapter->irq_name))) {
  693. kfree(adapter->irq_name);
  694. adapter->irq_name = NULL;
  695. return rc;
  696. }
  697. cxl_p1_write(adapter, CXL_PSL_ErrIVTE, adapter->native->err_hwirq & 0xffff);
  698. return 0;
  699. }
  700. void cxl_native_release_psl_err_irq(struct cxl *adapter)
  701. {
  702. if (adapter->native->err_virq != irq_find_mapping(NULL, adapter->native->err_hwirq))
  703. return;
  704. cxl_p1_write(adapter, CXL_PSL_ErrIVTE, 0x0000000000000000);
  705. cxl_unmap_irq(adapter->native->err_virq, adapter);
  706. cxl_ops->release_one_irq(adapter, adapter->native->err_hwirq);
  707. kfree(adapter->irq_name);
  708. }
  709. int cxl_native_register_serr_irq(struct cxl_afu *afu)
  710. {
  711. u64 serr;
  712. int rc;
  713. afu->err_irq_name = kasprintf(GFP_KERNEL, "cxl-%s-err",
  714. dev_name(&afu->dev));
  715. if (!afu->err_irq_name)
  716. return -ENOMEM;
  717. if ((rc = cxl_register_one_irq(afu->adapter, native_slice_irq_err, afu,
  718. &afu->serr_hwirq,
  719. &afu->serr_virq, afu->err_irq_name))) {
  720. kfree(afu->err_irq_name);
  721. afu->err_irq_name = NULL;
  722. return rc;
  723. }
  724. serr = cxl_p1n_read(afu, CXL_PSL_SERR_An);
  725. serr = (serr & 0x00ffffffffff0000ULL) | (afu->serr_hwirq & 0xffff);
  726. cxl_p1n_write(afu, CXL_PSL_SERR_An, serr);
  727. return 0;
  728. }
  729. void cxl_native_release_serr_irq(struct cxl_afu *afu)
  730. {
  731. if (afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq))
  732. return;
  733. cxl_p1n_write(afu, CXL_PSL_SERR_An, 0x0000000000000000);
  734. cxl_unmap_irq(afu->serr_virq, afu);
  735. cxl_ops->release_one_irq(afu->adapter, afu->serr_hwirq);
  736. kfree(afu->err_irq_name);
  737. }
  738. int cxl_native_register_psl_irq(struct cxl_afu *afu)
  739. {
  740. int rc;
  741. afu->psl_irq_name = kasprintf(GFP_KERNEL, "cxl-%s",
  742. dev_name(&afu->dev));
  743. if (!afu->psl_irq_name)
  744. return -ENOMEM;
  745. if ((rc = cxl_register_one_irq(afu->adapter, native_irq_multiplexed,
  746. afu, &afu->native->psl_hwirq, &afu->native->psl_virq,
  747. afu->psl_irq_name))) {
  748. kfree(afu->psl_irq_name);
  749. afu->psl_irq_name = NULL;
  750. }
  751. return rc;
  752. }
  753. void cxl_native_release_psl_irq(struct cxl_afu *afu)
  754. {
  755. if (afu->native->psl_virq != irq_find_mapping(NULL, afu->native->psl_hwirq))
  756. return;
  757. cxl_unmap_irq(afu->native->psl_virq, afu);
  758. cxl_ops->release_one_irq(afu->adapter, afu->native->psl_hwirq);
  759. kfree(afu->psl_irq_name);
  760. }
  761. static void recover_psl_err(struct cxl_afu *afu, u64 errstat)
  762. {
  763. u64 dsisr;
  764. pr_devel("RECOVERING FROM PSL ERROR... (0x%016llx)\n", errstat);
  765. /* Clear PSL_DSISR[PE] */
  766. dsisr = cxl_p2n_read(afu, CXL_PSL_DSISR_An);
  767. cxl_p2n_write(afu, CXL_PSL_DSISR_An, dsisr & ~CXL_PSL_DSISR_An_PE);
  768. /* Write 1s to clear error status bits */
  769. cxl_p2n_write(afu, CXL_PSL_ErrStat_An, errstat);
  770. }
  771. static int native_ack_irq(struct cxl_context *ctx, u64 tfc, u64 psl_reset_mask)
  772. {
  773. trace_cxl_psl_irq_ack(ctx, tfc);
  774. if (tfc)
  775. cxl_p2n_write(ctx->afu, CXL_PSL_TFC_An, tfc);
  776. if (psl_reset_mask)
  777. recover_psl_err(ctx->afu, psl_reset_mask);
  778. return 0;
  779. }
  780. int cxl_check_error(struct cxl_afu *afu)
  781. {
  782. return (cxl_p1n_read(afu, CXL_PSL_SCNTL_An) == ~0ULL);
  783. }
  784. static bool native_support_attributes(const char *attr_name,
  785. enum cxl_attrs type)
  786. {
  787. return true;
  788. }
  789. static int native_afu_cr_read64(struct cxl_afu *afu, int cr, u64 off, u64 *out)
  790. {
  791. if (unlikely(!cxl_ops->link_ok(afu->adapter, afu)))
  792. return -EIO;
  793. if (unlikely(off >= afu->crs_len))
  794. return -ERANGE;
  795. *out = in_le64(afu->native->afu_desc_mmio + afu->crs_offset +
  796. (cr * afu->crs_len) + off);
  797. return 0;
  798. }
  799. static int native_afu_cr_read32(struct cxl_afu *afu, int cr, u64 off, u32 *out)
  800. {
  801. if (unlikely(!cxl_ops->link_ok(afu->adapter, afu)))
  802. return -EIO;
  803. if (unlikely(off >= afu->crs_len))
  804. return -ERANGE;
  805. *out = in_le32(afu->native->afu_desc_mmio + afu->crs_offset +
  806. (cr * afu->crs_len) + off);
  807. return 0;
  808. }
  809. static int native_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off, u16 *out)
  810. {
  811. u64 aligned_off = off & ~0x3L;
  812. u32 val;
  813. int rc;
  814. rc = native_afu_cr_read32(afu, cr, aligned_off, &val);
  815. if (!rc)
  816. *out = (val >> ((off & 0x3) * 8)) & 0xffff;
  817. return rc;
  818. }
  819. static int native_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off, u8 *out)
  820. {
  821. u64 aligned_off = off & ~0x3L;
  822. u32 val;
  823. int rc;
  824. rc = native_afu_cr_read32(afu, cr, aligned_off, &val);
  825. if (!rc)
  826. *out = (val >> ((off & 0x3) * 8)) & 0xff;
  827. return rc;
  828. }
  829. static int native_afu_cr_write32(struct cxl_afu *afu, int cr, u64 off, u32 in)
  830. {
  831. if (unlikely(!cxl_ops->link_ok(afu->adapter, afu)))
  832. return -EIO;
  833. if (unlikely(off >= afu->crs_len))
  834. return -ERANGE;
  835. out_le32(afu->native->afu_desc_mmio + afu->crs_offset +
  836. (cr * afu->crs_len) + off, in);
  837. return 0;
  838. }
  839. static int native_afu_cr_write16(struct cxl_afu *afu, int cr, u64 off, u16 in)
  840. {
  841. u64 aligned_off = off & ~0x3L;
  842. u32 val32, mask, shift;
  843. int rc;
  844. rc = native_afu_cr_read32(afu, cr, aligned_off, &val32);
  845. if (rc)
  846. return rc;
  847. shift = (off & 0x3) * 8;
  848. WARN_ON(shift == 24);
  849. mask = 0xffff << shift;
  850. val32 = (val32 & ~mask) | (in << shift);
  851. rc = native_afu_cr_write32(afu, cr, aligned_off, val32);
  852. return rc;
  853. }
  854. static int native_afu_cr_write8(struct cxl_afu *afu, int cr, u64 off, u8 in)
  855. {
  856. u64 aligned_off = off & ~0x3L;
  857. u32 val32, mask, shift;
  858. int rc;
  859. rc = native_afu_cr_read32(afu, cr, aligned_off, &val32);
  860. if (rc)
  861. return rc;
  862. shift = (off & 0x3) * 8;
  863. mask = 0xff << shift;
  864. val32 = (val32 & ~mask) | (in << shift);
  865. rc = native_afu_cr_write32(afu, cr, aligned_off, val32);
  866. return rc;
  867. }
  868. const struct cxl_backend_ops cxl_native_ops = {
  869. .module = THIS_MODULE,
  870. .adapter_reset = cxl_pci_reset,
  871. .alloc_one_irq = cxl_pci_alloc_one_irq,
  872. .release_one_irq = cxl_pci_release_one_irq,
  873. .alloc_irq_ranges = cxl_pci_alloc_irq_ranges,
  874. .release_irq_ranges = cxl_pci_release_irq_ranges,
  875. .setup_irq = cxl_pci_setup_irq,
  876. .handle_psl_slice_error = native_handle_psl_slice_error,
  877. .psl_interrupt = NULL,
  878. .ack_irq = native_ack_irq,
  879. .attach_process = native_attach_process,
  880. .detach_process = native_detach_process,
  881. .support_attributes = native_support_attributes,
  882. .link_ok = cxl_adapter_link_ok,
  883. .release_afu = cxl_pci_release_afu,
  884. .afu_read_err_buffer = cxl_pci_afu_read_err_buffer,
  885. .afu_check_and_enable = native_afu_check_and_enable,
  886. .afu_activate_mode = native_afu_activate_mode,
  887. .afu_deactivate_mode = native_afu_deactivate_mode,
  888. .afu_reset = native_afu_reset,
  889. .afu_cr_read8 = native_afu_cr_read8,
  890. .afu_cr_read16 = native_afu_cr_read16,
  891. .afu_cr_read32 = native_afu_cr_read32,
  892. .afu_cr_read64 = native_afu_cr_read64,
  893. .afu_cr_write8 = native_afu_cr_write8,
  894. .afu_cr_write16 = native_afu_cr_write16,
  895. .afu_cr_write32 = native_afu_cr_write32,
  896. .read_adapter_vpd = cxl_pci_read_adapter_vpd,
  897. };