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 : __atomic_store_n((uint64_t *)swtag_desched_op, val, __ATOMIC_RELEASE); 37 : : } 38 : : 39 : : static __rte_always_inline void 40 : : cnxk_sso_hws_swtag_norm(uint32_t tag, uint8_t new_tt, uintptr_t swtag_norm_op) 41 : : { 42 : : uint64_t val; 43 : : 44 : 0 : val = tag | ((uint64_t)(new_tt & 0x3) << 32); 45 : 0 : plt_write64(val, swtag_norm_op); 46 : 0 : } 47 : : 48 : : static __rte_always_inline void 49 : : cnxk_sso_hws_swtag_untag(uintptr_t swtag_untag_op) 50 : : { 51 : 0 : plt_write64(0, swtag_untag_op); 52 : 0 : } 53 : : 54 : : static __rte_always_inline void 55 : : cnxk_sso_hws_swtag_flush(uint64_t base) 56 : : { 57 : 0 : plt_write64(0, base + SSOW_LF_GWS_OP_SWTAG_FLUSH); 58 : 0 : } 59 : : 60 : : static __rte_always_inline uint64_t 61 : : cnxk_sso_hws_swtag_wait(uintptr_t tag_op) 62 : : { 63 : : uint64_t swtp; 64 : : #ifdef RTE_ARCH_ARM64 65 : : 66 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE 67 : : " ldr %[swtb], [%[swtp_loc]] \n" 68 : : " tbz %[swtb], 62, .Ldone%= \n" 69 : : " sevl \n" 70 : : ".Lrty%=: wfe \n" 71 : : " ldr %[swtb], [%[swtp_loc]] \n" 72 : : " tbnz %[swtb], 62, .Lrty%= \n" 73 : : ".Ldone%=: \n" 74 : : : [swtb] "=&r"(swtp) 75 : : : [swtp_loc] "r"(tag_op)); 76 : : #else 77 : : /* Wait for the SWTAG/SWTAG_FULL operation */ 78 : : do { 79 : : swtp = plt_read64(tag_op); 80 : : } while (swtp & BIT_ULL(62)); 81 : : #endif 82 : : 83 : : return swtp; 84 : : } 85 : : 86 : : static __rte_always_inline void 87 : : cnxk_sso_hws_desched(uint64_t u64, uint64_t base) 88 : : { 89 : 0 : plt_write64(u64, base + SSOW_LF_GWS_OP_UPD_WQP_GRP1); 90 : 0 : plt_write64(0, base + SSOW_LF_GWS_OP_DESCHED); 91 : : } 92 : : 93 : : #endif