Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(C) 2021 Marvell. 3 : : */ 4 : : 5 : : #ifndef __CNXK_WORKER_H__ 6 : : #define __CNXK_WORKER_H__ 7 : : 8 : : #if defined(__aarch64__) 9 : : #include "roc_io.h" 10 : : #else 11 : : #include "roc_io_generic.h" 12 : : #endif 13 : : 14 : : #include "cnxk_eventdev_dp.h" 15 : : #include "hw/ssow.h" 16 : : 17 : : /* SSO Operations */ 18 : : 19 : : static __rte_always_inline void 20 : : cnxk_sso_hws_add_work(const uint64_t event_ptr, const uint32_t tag, 21 : : const uint8_t new_tt, const uintptr_t grp_base) 22 : : { 23 : : uint64_t add_work0; 24 : : 25 : 0 : add_work0 = tag | ((uint64_t)(new_tt) << 32); 26 : 0 : roc_store_pair(add_work0, event_ptr, grp_base); 27 : : } 28 : : 29 : : static __rte_always_inline void 30 : : cnxk_sso_hws_swtag_desched(uint32_t tag, uint8_t new_tt, uint16_t grp, 31 : : uintptr_t swtag_desched_op) 32 : : { 33 : : uint64_t val; 34 : : 35 : 0 : val = tag | ((uint64_t)(new_tt & 0x3) << 32) | ((uint64_t)grp << 34); 36 : 0 : rte_atomic_store_explicit((uint64_t __rte_atomic *)swtag_desched_op, val, 37 : : rte_memory_order_release); 38 : : } 39 : : 40 : : static __rte_always_inline void 41 : : cnxk_sso_hws_swtag_norm(uint32_t tag, uint8_t new_tt, uintptr_t swtag_norm_op) 42 : : { 43 : : uint64_t val; 44 : : 45 : 0 : val = tag | ((uint64_t)(new_tt & 0x3) << 32); 46 : 0 : plt_write64(val, swtag_norm_op); 47 : 0 : } 48 : : 49 : : static __rte_always_inline void 50 : : cnxk_sso_hws_swtag_untag(uintptr_t swtag_untag_op) 51 : : { 52 : 0 : plt_write64(0, swtag_untag_op); 53 : 0 : } 54 : : 55 : : static __rte_always_inline void 56 : : cnxk_sso_hws_swtag_flush(uint64_t base) 57 : : { 58 : 0 : plt_write64(0, base + SSOW_LF_GWS_OP_SWTAG_FLUSH); 59 : 0 : } 60 : : 61 : : static __rte_always_inline uint64_t 62 : : cnxk_sso_hws_swtag_wait(uintptr_t tag_op) 63 : : { 64 : : uint64_t swtp; 65 : : #ifdef RTE_ARCH_ARM64 66 : : 67 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE 68 : : " ldr %[swtb], [%[swtp_loc]] \n" 69 : : " tbz %[swtb], 62, .Ldone%= \n" 70 : : " sevl \n" 71 : : ".Lrty%=: wfe \n" 72 : : " ldr %[swtb], [%[swtp_loc]] \n" 73 : : " tbnz %[swtb], 62, .Lrty%= \n" 74 : : ".Ldone%=: \n" 75 : : : [swtb] "=&r"(swtp) 76 : : : [swtp_loc] "r"(tag_op)); 77 : : #else 78 : : /* Wait for the SWTAG/SWTAG_FULL operation */ 79 : : do { 80 : : swtp = plt_read64(tag_op); 81 : : } while (swtp & BIT_ULL(62)); 82 : : #endif 83 : : 84 : : return swtp; 85 : : } 86 : : 87 : : static __rte_always_inline void 88 : : cnxk_sso_hws_desched(uint64_t u64, uint64_t base) 89 : : { 90 : 0 : plt_write64(u64, base + SSOW_LF_GWS_OP_UPD_WQP_GRP1); 91 : 0 : plt_write64(0, base + SSOW_LF_GWS_OP_DESCHED); 92 : : } 93 : : 94 : : #endif