common/mlx5: fix device list operations concurrency
[dpdk.git] / drivers / common / cnxk / roc_sso.h
index a6030e7..b28f608 100644 (file)
@@ -44,6 +44,29 @@ struct roc_sso {
        uint8_t reserved[ROC_SSO_MEM_SZ] __plt_cache_aligned;
 } __plt_cache_aligned;
 
+static __plt_always_inline void
+roc_sso_hws_head_wait(uintptr_t tag_op)
+{
+#ifdef RTE_ARCH_ARM64
+       uint64_t tag;
+
+       asm volatile(PLT_CPU_FEATURE_PREAMBLE
+                    "          ldr %[tag], [%[tag_op]] \n"
+                    "          tbnz %[tag], 35, done%=         \n"
+                    "          sevl                            \n"
+                    "rty%=:    wfe                             \n"
+                    "          ldr %[tag], [%[tag_op]] \n"
+                    "          tbz %[tag], 35, rty%=           \n"
+                    "done%=:                                   \n"
+                    : [tag] "=&r"(tag)
+                    : [tag_op] "r"(tag_op));
+#else
+       /* Wait for the SWTAG/SWTAG_FULL operation */
+       while (!(plt_read64(tag_op) & BIT_ULL(35)))
+               ;
+#endif
+}
+
 /* SSO device initialization */
 int __roc_api roc_sso_dev_init(struct roc_sso *roc_sso);
 int __roc_api roc_sso_dev_fini(struct roc_sso *roc_sso);