1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
5 #ifndef __CNXK_WORKER_H__
6 #define __CNXK_WORKER_H__
8 #include "cnxk_eventdev.h"
12 static __rte_always_inline void
13 cnxk_sso_hws_add_work(const uint64_t event_ptr, const uint32_t tag,
14 const uint8_t new_tt, const uintptr_t grp_base)
18 add_work0 = tag | ((uint64_t)(new_tt) << 32);
19 roc_store_pair(add_work0, event_ptr, grp_base);
22 static __rte_always_inline void
23 cnxk_sso_hws_swtag_desched(uint32_t tag, uint8_t new_tt, uint16_t grp,
24 uintptr_t swtag_desched_op)
28 val = tag | ((uint64_t)(new_tt & 0x3) << 32) | ((uint64_t)grp << 34);
29 __atomic_store_n((uint64_t *)swtag_desched_op, val, __ATOMIC_RELEASE);
32 static __rte_always_inline void
33 cnxk_sso_hws_swtag_norm(uint32_t tag, uint8_t new_tt, uintptr_t swtag_norm_op)
37 val = tag | ((uint64_t)(new_tt & 0x3) << 32);
38 plt_write64(val, swtag_norm_op);
41 static __rte_always_inline void
42 cnxk_sso_hws_swtag_untag(uintptr_t swtag_untag_op)
44 plt_write64(0, swtag_untag_op);
47 static __rte_always_inline void
48 cnxk_sso_hws_swtag_flush(uint64_t tag_op, uint64_t flush_op)
50 if (CNXK_TT_FROM_TAG(plt_read64(tag_op)) == SSO_TT_EMPTY)
52 plt_write64(0, flush_op);
55 static __rte_always_inline void
56 cnxk_sso_hws_swtag_wait(uintptr_t tag_op)
61 asm volatile(PLT_CPU_FEATURE_PREAMBLE
62 " ldr %[swtb], [%[swtp_loc]] \n"
63 " tbz %[swtb], 62, done%= \n"
66 " ldr %[swtb], [%[swtp_loc]] \n"
67 " tbnz %[swtb], 62, rty%= \n"
70 : [swtp_loc] "r"(tag_op));
72 /* Wait for the SWTAG/SWTAG_FULL operation */
73 while (plt_read64(tag_op) & BIT_ULL(62))