cpacf.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * CP Assist for Cryptographic Functions (CPACF)
  4. *
  5. * Copyright IBM Corp. 2003, 2017
  6. * Author(s): Thomas Spatzier
  7. * Jan Glauber
  8. * Harald Freudenberger ([email protected])
  9. * Martin Schwidefsky <[email protected]>
  10. */
  11. #ifndef _ASM_S390_CPACF_H
  12. #define _ASM_S390_CPACF_H
  13. #include <asm/facility.h>
  14. /*
  15. * Instruction opcodes for the CPACF instructions
  16. */
  17. #define CPACF_KMAC 0xb91e /* MSA */
  18. #define CPACF_KM 0xb92e /* MSA */
  19. #define CPACF_KMC 0xb92f /* MSA */
  20. #define CPACF_KIMD 0xb93e /* MSA */
  21. #define CPACF_KLMD 0xb93f /* MSA */
  22. #define CPACF_PCKMO 0xb928 /* MSA3 */
  23. #define CPACF_KMF 0xb92a /* MSA4 */
  24. #define CPACF_KMO 0xb92b /* MSA4 */
  25. #define CPACF_PCC 0xb92c /* MSA4 */
  26. #define CPACF_KMCTR 0xb92d /* MSA4 */
  27. #define CPACF_PRNO 0xb93c /* MSA5 */
  28. #define CPACF_KMA 0xb929 /* MSA8 */
  29. #define CPACF_KDSA 0xb93a /* MSA9 */
  30. /*
  31. * En/decryption modifier bits
  32. */
  33. #define CPACF_ENCRYPT 0x00
  34. #define CPACF_DECRYPT 0x80
  35. /*
  36. * Function codes for the KM (CIPHER MESSAGE) instruction
  37. */
  38. #define CPACF_KM_QUERY 0x00
  39. #define CPACF_KM_DEA 0x01
  40. #define CPACF_KM_TDEA_128 0x02
  41. #define CPACF_KM_TDEA_192 0x03
  42. #define CPACF_KM_AES_128 0x12
  43. #define CPACF_KM_AES_192 0x13
  44. #define CPACF_KM_AES_256 0x14
  45. #define CPACF_KM_PAES_128 0x1a
  46. #define CPACF_KM_PAES_192 0x1b
  47. #define CPACF_KM_PAES_256 0x1c
  48. #define CPACF_KM_XTS_128 0x32
  49. #define CPACF_KM_XTS_256 0x34
  50. #define CPACF_KM_PXTS_128 0x3a
  51. #define CPACF_KM_PXTS_256 0x3c
  52. /*
  53. * Function codes for the KMC (CIPHER MESSAGE WITH CHAINING)
  54. * instruction
  55. */
  56. #define CPACF_KMC_QUERY 0x00
  57. #define CPACF_KMC_DEA 0x01
  58. #define CPACF_KMC_TDEA_128 0x02
  59. #define CPACF_KMC_TDEA_192 0x03
  60. #define CPACF_KMC_AES_128 0x12
  61. #define CPACF_KMC_AES_192 0x13
  62. #define CPACF_KMC_AES_256 0x14
  63. #define CPACF_KMC_PAES_128 0x1a
  64. #define CPACF_KMC_PAES_192 0x1b
  65. #define CPACF_KMC_PAES_256 0x1c
  66. #define CPACF_KMC_PRNG 0x43
  67. /*
  68. * Function codes for the KMCTR (CIPHER MESSAGE WITH COUNTER)
  69. * instruction
  70. */
  71. #define CPACF_KMCTR_QUERY 0x00
  72. #define CPACF_KMCTR_DEA 0x01
  73. #define CPACF_KMCTR_TDEA_128 0x02
  74. #define CPACF_KMCTR_TDEA_192 0x03
  75. #define CPACF_KMCTR_AES_128 0x12
  76. #define CPACF_KMCTR_AES_192 0x13
  77. #define CPACF_KMCTR_AES_256 0x14
  78. #define CPACF_KMCTR_PAES_128 0x1a
  79. #define CPACF_KMCTR_PAES_192 0x1b
  80. #define CPACF_KMCTR_PAES_256 0x1c
  81. /*
  82. * Function codes for the KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST)
  83. * instruction
  84. */
  85. #define CPACF_KIMD_QUERY 0x00
  86. #define CPACF_KIMD_SHA_1 0x01
  87. #define CPACF_KIMD_SHA_256 0x02
  88. #define CPACF_KIMD_SHA_512 0x03
  89. #define CPACF_KIMD_SHA3_224 0x20
  90. #define CPACF_KIMD_SHA3_256 0x21
  91. #define CPACF_KIMD_SHA3_384 0x22
  92. #define CPACF_KIMD_SHA3_512 0x23
  93. #define CPACF_KIMD_GHASH 0x41
  94. /*
  95. * Function codes for the KLMD (COMPUTE LAST MESSAGE DIGEST)
  96. * instruction
  97. */
  98. #define CPACF_KLMD_QUERY 0x00
  99. #define CPACF_KLMD_SHA_1 0x01
  100. #define CPACF_KLMD_SHA_256 0x02
  101. #define CPACF_KLMD_SHA_512 0x03
  102. #define CPACF_KLMD_SHA3_224 0x20
  103. #define CPACF_KLMD_SHA3_256 0x21
  104. #define CPACF_KLMD_SHA3_384 0x22
  105. #define CPACF_KLMD_SHA3_512 0x23
  106. /*
  107. * function codes for the KMAC (COMPUTE MESSAGE AUTHENTICATION CODE)
  108. * instruction
  109. */
  110. #define CPACF_KMAC_QUERY 0x00
  111. #define CPACF_KMAC_DEA 0x01
  112. #define CPACF_KMAC_TDEA_128 0x02
  113. #define CPACF_KMAC_TDEA_192 0x03
  114. /*
  115. * Function codes for the PCKMO (PERFORM CRYPTOGRAPHIC KEY MANAGEMENT)
  116. * instruction
  117. */
  118. #define CPACF_PCKMO_QUERY 0x00
  119. #define CPACF_PCKMO_ENC_DES_KEY 0x01
  120. #define CPACF_PCKMO_ENC_TDES_128_KEY 0x02
  121. #define CPACF_PCKMO_ENC_TDES_192_KEY 0x03
  122. #define CPACF_PCKMO_ENC_AES_128_KEY 0x12
  123. #define CPACF_PCKMO_ENC_AES_192_KEY 0x13
  124. #define CPACF_PCKMO_ENC_AES_256_KEY 0x14
  125. /*
  126. * Function codes for the PRNO (PERFORM RANDOM NUMBER OPERATION)
  127. * instruction
  128. */
  129. #define CPACF_PRNO_QUERY 0x00
  130. #define CPACF_PRNO_SHA512_DRNG_GEN 0x03
  131. #define CPACF_PRNO_SHA512_DRNG_SEED 0x83
  132. #define CPACF_PRNO_TRNG_Q_R2C_RATIO 0x70
  133. #define CPACF_PRNO_TRNG 0x72
  134. /*
  135. * Function codes for the KMA (CIPHER MESSAGE WITH AUTHENTICATION)
  136. * instruction
  137. */
  138. #define CPACF_KMA_QUERY 0x00
  139. #define CPACF_KMA_GCM_AES_128 0x12
  140. #define CPACF_KMA_GCM_AES_192 0x13
  141. #define CPACF_KMA_GCM_AES_256 0x14
  142. /*
  143. * Flags for the KMA (CIPHER MESSAGE WITH AUTHENTICATION) instruction
  144. */
  145. #define CPACF_KMA_LPC 0x100 /* Last-Plaintext/Ciphertext */
  146. #define CPACF_KMA_LAAD 0x200 /* Last-AAD */
  147. #define CPACF_KMA_HS 0x400 /* Hash-subkey Supplied */
  148. typedef struct { unsigned char bytes[16]; } cpacf_mask_t;
  149. /**
  150. * cpacf_query() - check if a specific CPACF function is available
  151. * @opcode: the opcode of the crypto instruction
  152. * @func: the function code to test for
  153. *
  154. * Executes the query function for the given crypto instruction @opcode
  155. * and checks if @func is available
  156. *
  157. * Returns 1 if @func is available for @opcode, 0 otherwise
  158. */
  159. static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
  160. {
  161. asm volatile(
  162. " lghi 0,0\n" /* query function */
  163. " lgr 1,%[mask]\n"
  164. " spm 0\n" /* pckmo doesn't change the cc */
  165. /* Parameter regs are ignored, but must be nonzero and unique */
  166. "0: .insn rrf,%[opc] << 16,2,4,6,0\n"
  167. " brc 1,0b\n" /* handle partial completion */
  168. : "=m" (*mask)
  169. : [mask] "d" ((unsigned long)mask), [opc] "i" (opcode)
  170. : "cc", "0", "1");
  171. }
  172. static __always_inline int __cpacf_check_opcode(unsigned int opcode)
  173. {
  174. switch (opcode) {
  175. case CPACF_KMAC:
  176. case CPACF_KM:
  177. case CPACF_KMC:
  178. case CPACF_KIMD:
  179. case CPACF_KLMD:
  180. return test_facility(17); /* check for MSA */
  181. case CPACF_PCKMO:
  182. return test_facility(76); /* check for MSA3 */
  183. case CPACF_KMF:
  184. case CPACF_KMO:
  185. case CPACF_PCC:
  186. case CPACF_KMCTR:
  187. return test_facility(77); /* check for MSA4 */
  188. case CPACF_PRNO:
  189. return test_facility(57); /* check for MSA5 */
  190. case CPACF_KMA:
  191. return test_facility(146); /* check for MSA8 */
  192. default:
  193. BUG();
  194. }
  195. }
  196. static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
  197. {
  198. if (__cpacf_check_opcode(opcode)) {
  199. __cpacf_query(opcode, mask);
  200. return 1;
  201. }
  202. memset(mask, 0, sizeof(*mask));
  203. return 0;
  204. }
  205. static inline int cpacf_test_func(cpacf_mask_t *mask, unsigned int func)
  206. {
  207. return (mask->bytes[func >> 3] & (0x80 >> (func & 7))) != 0;
  208. }
  209. static __always_inline int cpacf_query_func(unsigned int opcode, unsigned int func)
  210. {
  211. cpacf_mask_t mask;
  212. if (cpacf_query(opcode, &mask))
  213. return cpacf_test_func(&mask, func);
  214. return 0;
  215. }
  216. /**
  217. * cpacf_km() - executes the KM (CIPHER MESSAGE) instruction
  218. * @func: the function code passed to KM; see CPACF_KM_xxx defines
  219. * @param: address of parameter block; see POP for details on each func
  220. * @dest: address of destination memory area
  221. * @src: address of source memory area
  222. * @src_len: length of src operand in bytes
  223. *
  224. * Returns 0 for the query func, number of processed bytes for
  225. * encryption/decryption funcs
  226. */
  227. static inline int cpacf_km(unsigned long func, void *param,
  228. u8 *dest, const u8 *src, long src_len)
  229. {
  230. union register_pair d, s;
  231. d.even = (unsigned long)dest;
  232. s.even = (unsigned long)src;
  233. s.odd = (unsigned long)src_len;
  234. asm volatile(
  235. " lgr 0,%[fc]\n"
  236. " lgr 1,%[pba]\n"
  237. "0: .insn rre,%[opc] << 16,%[dst],%[src]\n"
  238. " brc 1,0b\n" /* handle partial completion */
  239. : [src] "+&d" (s.pair), [dst] "+&d" (d.pair)
  240. : [fc] "d" (func), [pba] "d" ((unsigned long)param),
  241. [opc] "i" (CPACF_KM)
  242. : "cc", "memory", "0", "1");
  243. return src_len - s.odd;
  244. }
  245. /**
  246. * cpacf_kmc() - executes the KMC (CIPHER MESSAGE WITH CHAINING) instruction
  247. * @func: the function code passed to KM; see CPACF_KMC_xxx defines
  248. * @param: address of parameter block; see POP for details on each func
  249. * @dest: address of destination memory area
  250. * @src: address of source memory area
  251. * @src_len: length of src operand in bytes
  252. *
  253. * Returns 0 for the query func, number of processed bytes for
  254. * encryption/decryption funcs
  255. */
  256. static inline int cpacf_kmc(unsigned long func, void *param,
  257. u8 *dest, const u8 *src, long src_len)
  258. {
  259. union register_pair d, s;
  260. d.even = (unsigned long)dest;
  261. s.even = (unsigned long)src;
  262. s.odd = (unsigned long)src_len;
  263. asm volatile(
  264. " lgr 0,%[fc]\n"
  265. " lgr 1,%[pba]\n"
  266. "0: .insn rre,%[opc] << 16,%[dst],%[src]\n"
  267. " brc 1,0b\n" /* handle partial completion */
  268. : [src] "+&d" (s.pair), [dst] "+&d" (d.pair)
  269. : [fc] "d" (func), [pba] "d" ((unsigned long)param),
  270. [opc] "i" (CPACF_KMC)
  271. : "cc", "memory", "0", "1");
  272. return src_len - s.odd;
  273. }
  274. /**
  275. * cpacf_kimd() - executes the KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST)
  276. * instruction
  277. * @func: the function code passed to KM; see CPACF_KIMD_xxx defines
  278. * @param: address of parameter block; see POP for details on each func
  279. * @src: address of source memory area
  280. * @src_len: length of src operand in bytes
  281. */
  282. static inline void cpacf_kimd(unsigned long func, void *param,
  283. const u8 *src, long src_len)
  284. {
  285. union register_pair s;
  286. s.even = (unsigned long)src;
  287. s.odd = (unsigned long)src_len;
  288. asm volatile(
  289. " lgr 0,%[fc]\n"
  290. " lgr 1,%[pba]\n"
  291. "0: .insn rre,%[opc] << 16,0,%[src]\n"
  292. " brc 1,0b\n" /* handle partial completion */
  293. : [src] "+&d" (s.pair)
  294. : [fc] "d" (func), [pba] "d" ((unsigned long)(param)),
  295. [opc] "i" (CPACF_KIMD)
  296. : "cc", "memory", "0", "1");
  297. }
  298. /**
  299. * cpacf_klmd() - executes the KLMD (COMPUTE LAST MESSAGE DIGEST) instruction
  300. * @func: the function code passed to KM; see CPACF_KLMD_xxx defines
  301. * @param: address of parameter block; see POP for details on each func
  302. * @src: address of source memory area
  303. * @src_len: length of src operand in bytes
  304. */
  305. static inline void cpacf_klmd(unsigned long func, void *param,
  306. const u8 *src, long src_len)
  307. {
  308. union register_pair s;
  309. s.even = (unsigned long)src;
  310. s.odd = (unsigned long)src_len;
  311. asm volatile(
  312. " lgr 0,%[fc]\n"
  313. " lgr 1,%[pba]\n"
  314. "0: .insn rre,%[opc] << 16,0,%[src]\n"
  315. " brc 1,0b\n" /* handle partial completion */
  316. : [src] "+&d" (s.pair)
  317. : [fc] "d" (func), [pba] "d" ((unsigned long)param),
  318. [opc] "i" (CPACF_KLMD)
  319. : "cc", "memory", "0", "1");
  320. }
  321. /**
  322. * cpacf_kmac() - executes the KMAC (COMPUTE MESSAGE AUTHENTICATION CODE)
  323. * instruction
  324. * @func: the function code passed to KM; see CPACF_KMAC_xxx defines
  325. * @param: address of parameter block; see POP for details on each func
  326. * @src: address of source memory area
  327. * @src_len: length of src operand in bytes
  328. *
  329. * Returns 0 for the query func, number of processed bytes for digest funcs
  330. */
  331. static inline int cpacf_kmac(unsigned long func, void *param,
  332. const u8 *src, long src_len)
  333. {
  334. union register_pair s;
  335. s.even = (unsigned long)src;
  336. s.odd = (unsigned long)src_len;
  337. asm volatile(
  338. " lgr 0,%[fc]\n"
  339. " lgr 1,%[pba]\n"
  340. "0: .insn rre,%[opc] << 16,0,%[src]\n"
  341. " brc 1,0b\n" /* handle partial completion */
  342. : [src] "+&d" (s.pair)
  343. : [fc] "d" (func), [pba] "d" ((unsigned long)param),
  344. [opc] "i" (CPACF_KMAC)
  345. : "cc", "memory", "0", "1");
  346. return src_len - s.odd;
  347. }
  348. /**
  349. * cpacf_kmctr() - executes the KMCTR (CIPHER MESSAGE WITH COUNTER) instruction
  350. * @func: the function code passed to KMCTR; see CPACF_KMCTR_xxx defines
  351. * @param: address of parameter block; see POP for details on each func
  352. * @dest: address of destination memory area
  353. * @src: address of source memory area
  354. * @src_len: length of src operand in bytes
  355. * @counter: address of counter value
  356. *
  357. * Returns 0 for the query func, number of processed bytes for
  358. * encryption/decryption funcs
  359. */
  360. static inline int cpacf_kmctr(unsigned long func, void *param, u8 *dest,
  361. const u8 *src, long src_len, u8 *counter)
  362. {
  363. union register_pair d, s, c;
  364. d.even = (unsigned long)dest;
  365. s.even = (unsigned long)src;
  366. s.odd = (unsigned long)src_len;
  367. c.even = (unsigned long)counter;
  368. asm volatile(
  369. " lgr 0,%[fc]\n"
  370. " lgr 1,%[pba]\n"
  371. "0: .insn rrf,%[opc] << 16,%[dst],%[src],%[ctr],0\n"
  372. " brc 1,0b\n" /* handle partial completion */
  373. : [src] "+&d" (s.pair), [dst] "+&d" (d.pair),
  374. [ctr] "+&d" (c.pair)
  375. : [fc] "d" (func), [pba] "d" ((unsigned long)param),
  376. [opc] "i" (CPACF_KMCTR)
  377. : "cc", "memory", "0", "1");
  378. return src_len - s.odd;
  379. }
  380. /**
  381. * cpacf_prno() - executes the PRNO (PERFORM RANDOM NUMBER OPERATION)
  382. * instruction
  383. * @func: the function code passed to PRNO; see CPACF_PRNO_xxx defines
  384. * @param: address of parameter block; see POP for details on each func
  385. * @dest: address of destination memory area
  386. * @dest_len: size of destination memory area in bytes
  387. * @seed: address of seed data
  388. * @seed_len: size of seed data in bytes
  389. */
  390. static inline void cpacf_prno(unsigned long func, void *param,
  391. u8 *dest, unsigned long dest_len,
  392. const u8 *seed, unsigned long seed_len)
  393. {
  394. union register_pair d, s;
  395. d.even = (unsigned long)dest;
  396. d.odd = (unsigned long)dest_len;
  397. s.even = (unsigned long)seed;
  398. s.odd = (unsigned long)seed_len;
  399. asm volatile (
  400. " lgr 0,%[fc]\n"
  401. " lgr 1,%[pba]\n"
  402. "0: .insn rre,%[opc] << 16,%[dst],%[seed]\n"
  403. " brc 1,0b\n" /* handle partial completion */
  404. : [dst] "+&d" (d.pair)
  405. : [fc] "d" (func), [pba] "d" ((unsigned long)param),
  406. [seed] "d" (s.pair), [opc] "i" (CPACF_PRNO)
  407. : "cc", "memory", "0", "1");
  408. }
  409. /**
  410. * cpacf_trng() - executes the TRNG subfunction of the PRNO instruction
  411. * @ucbuf: buffer for unconditioned data
  412. * @ucbuf_len: amount of unconditioned data to fetch in bytes
  413. * @cbuf: buffer for conditioned data
  414. * @cbuf_len: amount of conditioned data to fetch in bytes
  415. */
  416. static inline void cpacf_trng(u8 *ucbuf, unsigned long ucbuf_len,
  417. u8 *cbuf, unsigned long cbuf_len)
  418. {
  419. union register_pair u, c;
  420. u.even = (unsigned long)ucbuf;
  421. u.odd = (unsigned long)ucbuf_len;
  422. c.even = (unsigned long)cbuf;
  423. c.odd = (unsigned long)cbuf_len;
  424. asm volatile (
  425. " lghi 0,%[fc]\n"
  426. "0: .insn rre,%[opc] << 16,%[ucbuf],%[cbuf]\n"
  427. " brc 1,0b\n" /* handle partial completion */
  428. : [ucbuf] "+&d" (u.pair), [cbuf] "+&d" (c.pair)
  429. : [fc] "K" (CPACF_PRNO_TRNG), [opc] "i" (CPACF_PRNO)
  430. : "cc", "memory", "0");
  431. }
  432. /**
  433. * cpacf_pcc() - executes the PCC (PERFORM CRYPTOGRAPHIC COMPUTATION)
  434. * instruction
  435. * @func: the function code passed to PCC; see CPACF_KM_xxx defines
  436. * @param: address of parameter block; see POP for details on each func
  437. */
  438. static inline void cpacf_pcc(unsigned long func, void *param)
  439. {
  440. asm volatile(
  441. " lgr 0,%[fc]\n"
  442. " lgr 1,%[pba]\n"
  443. "0: .insn rre,%[opc] << 16,0,0\n" /* PCC opcode */
  444. " brc 1,0b\n" /* handle partial completion */
  445. :
  446. : [fc] "d" (func), [pba] "d" ((unsigned long)param),
  447. [opc] "i" (CPACF_PCC)
  448. : "cc", "memory", "0", "1");
  449. }
  450. /**
  451. * cpacf_pckmo() - executes the PCKMO (PERFORM CRYPTOGRAPHIC KEY
  452. * MANAGEMENT) instruction
  453. * @func: the function code passed to PCKMO; see CPACF_PCKMO_xxx defines
  454. * @param: address of parameter block; see POP for details on each func
  455. *
  456. * Returns 0.
  457. */
  458. static inline void cpacf_pckmo(long func, void *param)
  459. {
  460. asm volatile(
  461. " lgr 0,%[fc]\n"
  462. " lgr 1,%[pba]\n"
  463. " .insn rre,%[opc] << 16,0,0\n" /* PCKMO opcode */
  464. :
  465. : [fc] "d" (func), [pba] "d" ((unsigned long)param),
  466. [opc] "i" (CPACF_PCKMO)
  467. : "cc", "memory", "0", "1");
  468. }
  469. /**
  470. * cpacf_kma() - executes the KMA (CIPHER MESSAGE WITH AUTHENTICATION)
  471. * instruction
  472. * @func: the function code passed to KMA; see CPACF_KMA_xxx defines
  473. * @param: address of parameter block; see POP for details on each func
  474. * @dest: address of destination memory area
  475. * @src: address of source memory area
  476. * @src_len: length of src operand in bytes
  477. * @aad: address of additional authenticated data memory area
  478. * @aad_len: length of aad operand in bytes
  479. */
  480. static inline void cpacf_kma(unsigned long func, void *param, u8 *dest,
  481. const u8 *src, unsigned long src_len,
  482. const u8 *aad, unsigned long aad_len)
  483. {
  484. union register_pair d, s, a;
  485. d.even = (unsigned long)dest;
  486. s.even = (unsigned long)src;
  487. s.odd = (unsigned long)src_len;
  488. a.even = (unsigned long)aad;
  489. a.odd = (unsigned long)aad_len;
  490. asm volatile(
  491. " lgr 0,%[fc]\n"
  492. " lgr 1,%[pba]\n"
  493. "0: .insn rrf,%[opc] << 16,%[dst],%[src],%[aad],0\n"
  494. " brc 1,0b\n" /* handle partial completion */
  495. : [dst] "+&d" (d.pair), [src] "+&d" (s.pair),
  496. [aad] "+&d" (a.pair)
  497. : [fc] "d" (func), [pba] "d" ((unsigned long)param),
  498. [opc] "i" (CPACF_KMA)
  499. : "cc", "memory", "0", "1");
  500. }
  501. #endif /* _ASM_S390_CPACF_H */