event/octeontx2: use WFE while waiting for head
authorPavan Nikhilesh <pbhagavatula@marvell.com>
Wed, 23 Oct 2019 16:12:43 +0000 (21:42 +0530)
committerJerin Jacob <jerinj@marvell.com>
Wed, 30 Oct 2019 13:24:03 +0000 (14:24 +0100)
Use WFE to save power while waiting for tag to become head.

SSO signals EVENTI to allow cores to exit from wfe when they
are waiting for specific operations in which one of them is
setting HEAD bit in GWS_TAG.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
drivers/event/octeontx2/otx2_worker.h

index 4e971f2..7a55cac 100644 (file)
@@ -226,10 +226,34 @@ otx2_ssogws_swtag_wait(struct otx2_ssogws *ws)
 }
 
 static __rte_always_inline void
-otx2_ssogws_head_wait(struct otx2_ssogws *ws, const uint8_t wait_flag)
+otx2_ssogws_head_wait(struct otx2_ssogws *ws)
 {
-       while (wait_flag && !(otx2_read64(ws->tag_op) & BIT_ULL(35)))
+#ifdef RTE_ARCH_ARM64
+       uint64_t tag;
+
+       asm volatile (
+                       "       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" (ws->tag_op)
+                       );
+#else
+       /* Wait for the HEAD to be set */
+       while (!(otx2_read64(ws->tag_op) & BIT_ULL(35)))
                ;
+#endif
+}
+
+static __rte_always_inline void
+otx2_ssogws_order(struct otx2_ssogws *ws, const uint8_t wait_flag)
+{
+       if (wait_flag)
+               otx2_ssogws_head_wait(ws);
 
        rte_cio_wmb();
 }
@@ -258,7 +282,7 @@ otx2_ssogws_event_tx(struct otx2_ssogws *ws, struct rte_event ev[],
 
        /* Perform header writes before barrier for TSO */
        otx2_nix_xmit_prepare_tso(m, flags);
-       otx2_ssogws_head_wait(ws, !ev->sched_type);
+       otx2_ssogws_order(ws, !ev->sched_type);
        otx2_ssogws_prepare_pkt(txq, m, cmd, flags);
 
        if (flags & NIX_TX_MULTI_SEG_F) {