Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(C) 2021 Marvell. 3 : : */ 4 : : 5 : : #ifndef _CN9K_CRYPTODEV_OPS_H_ 6 : : #define _CN9K_CRYPTODEV_OPS_H_ 7 : : 8 : : #include <rte_compat.h> 9 : : #include <cryptodev_pmd.h> 10 : : 11 : : #include <hw/cpt.h> 12 : : 13 : : #if defined(__aarch64__) 14 : : #include "roc_io.h" 15 : : #else 16 : : #include "roc_io_generic.h" 17 : : #endif 18 : : 19 : : extern struct rte_cryptodev_ops cn9k_cpt_ops; 20 : : 21 : : static inline void 22 : : cn9k_cpt_inst_submit(struct cpt_inst_s *inst, uint64_t lmtline, uint64_t io_addr) 23 : : { 24 : : uint64_t lmt_status; 25 : : 26 : : do { 27 : : /* Copy CPT command to LMTLINE */ 28 : : roc_lmt_mov64((void *)lmtline, inst); 29 : : 30 : : /* 31 : : * Make sure compiler does not reorder memcpy and ldeor. 32 : : * LMTST transactions are always flushed from the write 33 : : * buffer immediately, a DMB is not required to push out 34 : : * LMTSTs. 35 : : */ 36 : 0 : rte_io_wmb(); 37 : : lmt_status = roc_lmt_submit_ldeor(io_addr); 38 : : } while (lmt_status == 0); 39 : : } 40 : : 41 : : static __plt_always_inline void 42 : : cn9k_cpt_inst_submit_dual(struct cpt_inst_s *inst, uint64_t lmtline, uint64_t io_addr) 43 : : { 44 : : uint64_t lmt_status; 45 : : 46 : : do { 47 : : /* Copy 2 CPT inst_s to LMTLINE */ 48 : : #if defined(RTE_ARCH_ARM64) 49 : : volatile const __uint128_t *src128 = (const __uint128_t *)inst; 50 : : volatile __uint128_t *dst128 = (__uint128_t *)lmtline; 51 : : 52 : : dst128[0] = src128[0]; 53 : : dst128[1] = src128[1]; 54 : : dst128[2] = src128[2]; 55 : : dst128[3] = src128[3]; 56 : : dst128[4] = src128[4]; 57 : : dst128[5] = src128[5]; 58 : : dst128[6] = src128[6]; 59 : : dst128[7] = src128[7]; 60 : : #else 61 : : roc_lmt_mov_seg((void *)lmtline, inst, 8); 62 : : #endif 63 : : 64 : : /* 65 : : * Make sure compiler does not reorder memcpy and ldeor. 66 : : * LMTST transactions are always flushed from the write 67 : : * buffer immediately, a DMB is not required to push out 68 : : * LMTSTs. 69 : : */ 70 : 0 : rte_io_wmb(); 71 : : lmt_status = roc_lmt_submit_ldeor(io_addr); 72 : : } while (lmt_status == 0); 73 : : } 74 : : 75 : : void cn9k_cpt_set_enqdeq_fns(struct rte_cryptodev *dev); 76 : : 77 : : __rte_internal 78 : : uint16_t cn9k_cpt_crypto_adapter_enqueue(uintptr_t base, 79 : : struct rte_crypto_op *op); 80 : : __rte_internal 81 : : uintptr_t cn9k_cpt_crypto_adapter_dequeue(uintptr_t get_work1); 82 : : 83 : : #endif /* _CN9K_CRYPTODEV_OPS_H_ */