DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
	"Kiran Kumar K" <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Pavan Nikhilesh <pbhagavatula@marvell.com>,
	Shijith Thotton <sthotton@marvell.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 1/3] cnxk/event: invalidate GWC on port reset
Date: Tue, 5 Sep 2023 22:09:06 +0530	[thread overview]
Message-ID: <20230905163908.19946-1-pbhagavatula@marvell.com> (raw)

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Invalidate GWC on event port i.e., HWS reset to prevent
invalid response from SSO.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/common/cnxk/roc_sso.c       | 31 +++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_sso.h       |  2 ++
 drivers/common/cnxk/version.map     |  1 +
 drivers/event/cnxk/cn10k_eventdev.c | 19 +++++++++++++++++-
 4 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c
index a5f48d5bbc..1ea0761531 100644
--- a/drivers/common/cnxk/roc_sso.c
+++ b/drivers/common/cnxk/roc_sso.c
@@ -357,6 +357,37 @@ roc_sso_hws_stats_get(struct roc_sso *roc_sso, uint8_t hws,
 	return rc;
 }
 
+void
+roc_sso_hws_gwc_invalidate(struct roc_sso *roc_sso, uint8_t *hws,
+			   uint8_t nb_hws)
+{
+	struct sso *sso = roc_sso_to_sso_priv(roc_sso);
+	struct ssow_lf_inv_req *req;
+	struct dev *dev = &sso->dev;
+	struct mbox *mbox;
+	int i;
+
+	if (!nb_hws)
+		return;
+
+	mbox = mbox_get(dev->mbox);
+	req = mbox_alloc_msg_sso_ws_cache_inv(mbox);
+	if (req == NULL) {
+		mbox_process(mbox);
+		req = mbox_alloc_msg_sso_ws_cache_inv(mbox);
+		if (req == NULL) {
+			mbox_put(mbox);
+			return;
+		}
+	}
+	req->hdr.ver = SSOW_INVAL_SELECTIVE_VER;
+	req->nb_hws = nb_hws;
+	for (i = 0; i < nb_hws; i++)
+		req->hws[i] = hws[i];
+	mbox_process(mbox);
+	mbox_put(mbox);
+}
+
 int
 roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint8_t hwgrp,
 			struct roc_sso_hwgrp_stats *stats)
diff --git a/drivers/common/cnxk/roc_sso.h b/drivers/common/cnxk/roc_sso.h
index a2bb6fcb22..8ee62afb9a 100644
--- a/drivers/common/cnxk/roc_sso.h
+++ b/drivers/common/cnxk/roc_sso.h
@@ -100,6 +100,8 @@ int __roc_api roc_sso_hwgrp_free_xaq_aura(struct roc_sso *roc_sso,
 int __roc_api roc_sso_hwgrp_stash_config(struct roc_sso *roc_sso,
 					 struct roc_sso_hwgrp_stash *stash,
 					 uint16_t nb_stash);
+void __roc_api roc_sso_hws_gwc_invalidate(struct roc_sso *roc_sso, uint8_t *hws,
+					  uint8_t nb_hws);
 
 /* Debug */
 void __roc_api roc_sso_dump(struct roc_sso *roc_sso, uint8_t nb_hws,
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 8c71497df8..cfb7efbdc7 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -475,6 +475,7 @@ INTERNAL {
 	roc_sso_hws_base_get;
 	roc_sso_hws_link;
 	roc_sso_hws_stats_get;
+	roc_sso_hws_gwc_invalidate;
 	roc_sso_hws_unlink;
 	roc_sso_ns_to_gw;
 	roc_sso_rsrc_fini;
diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
index 499a3aace7..56482c20a1 100644
--- a/drivers/event/cnxk/cn10k_eventdev.c
+++ b/drivers/event/cnxk/cn10k_eventdev.c
@@ -118,6 +118,7 @@ static int
 cn10k_sso_hws_flush_events(void *hws, uint8_t queue_id, uintptr_t base,
 			   cnxk_handle_event_t fn, void *arg)
 {
+	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(arg);
 	uint64_t retry = CNXK_SSO_FLUSH_RETRY_MAX;
 	struct cn10k_sso_hws *ws = hws;
 	uint64_t cq_ds_cnt = 1;
@@ -128,6 +129,7 @@ cn10k_sso_hws_flush_events(void *hws, uint8_t queue_id, uintptr_t base,
 
 	plt_write64(0, base + SSO_LF_GGRP_QCTL);
 
+	roc_sso_hws_gwc_invalidate(&dev->sso, &ws->hws_id, 1);
 	plt_write64(0, ws->base + SSOW_LF_GWS_OP_GWC_INVAL);
 	req = queue_id;	    /* GGRP ID */
 	req |= BIT_ULL(18); /* Grouped */
@@ -162,6 +164,7 @@ cn10k_sso_hws_flush_events(void *hws, uint8_t queue_id, uintptr_t base,
 		return -EAGAIN;
 
 	plt_write64(0, ws->base + SSOW_LF_GWS_OP_GWC_INVAL);
+	roc_sso_hws_gwc_invalidate(&dev->sso, &ws->hws_id, 1);
 	rte_mb();
 
 	return 0;
@@ -181,6 +184,7 @@ cn10k_sso_hws_reset(void *arg, void *hws)
 	uint8_t pend_tt;
 	bool is_pend;
 
+	roc_sso_hws_gwc_invalidate(&dev->sso, &ws->hws_id, 1);
 	plt_write64(0, ws->base + SSOW_LF_GWS_OP_GWC_INVAL);
 	/* Wait till getwork/swtp/waitw/desched completes. */
 	is_pend = false;
@@ -237,6 +241,7 @@ cn10k_sso_hws_reset(void *arg, void *hws)
 	}
 
 	plt_write64(0, base + SSOW_LF_GWS_OP_GWC_INVAL);
+	roc_sso_hws_gwc_invalidate(&dev->sso, &ws->hws_id, 1);
 	rte_mb();
 }
 
@@ -670,7 +675,9 @@ cn10k_sso_configure_queue_stash(struct rte_eventdev *event_dev)
 static int
 cn10k_sso_start(struct rte_eventdev *event_dev)
 {
-	int rc;
+	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
+	uint8_t hws[RTE_EVENT_MAX_PORTS_PER_DEV];
+	int rc, i;
 
 	rc = cn10k_sso_updt_tx_adptr_data(event_dev);
 	if (rc < 0)
@@ -682,6 +689,9 @@ cn10k_sso_start(struct rte_eventdev *event_dev)
 	if (rc < 0)
 		return rc;
 	cn10k_sso_fp_fns_set(event_dev);
+	for (i = 0; i < event_dev->data->nb_ports; i++)
+		hws[i] = i;
+	roc_sso_hws_gwc_invalidate(&dev->sso, hws, event_dev->data->nb_ports);
 
 	return rc;
 }
@@ -689,6 +699,13 @@ cn10k_sso_start(struct rte_eventdev *event_dev)
 static void
 cn10k_sso_stop(struct rte_eventdev *event_dev)
 {
+	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
+	uint8_t hws[RTE_EVENT_MAX_PORTS_PER_DEV];
+	int i;
+
+	for (i = 0; i < event_dev->data->nb_ports; i++)
+		hws[i] = i;
+	roc_sso_hws_gwc_invalidate(&dev->sso, hws, event_dev->data->nb_ports);
 	cnxk_sso_stop(event_dev, cn10k_sso_hws_reset,
 		      cn10k_sso_hws_flush_events);
 }
-- 
2.41.0


             reply	other threads:[~2023-09-05 16:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 16:39 pbhagavatula [this message]
2023-09-05 16:39 ` [PATCH 2/3] event/cnxk: remove checks from op release pbhagavatula
2023-09-05 16:39 ` [PATCH 3/3] common/cnxk: use local labels in asm intrinsic pbhagavatula
2023-09-19 16:22   ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230905163908.19946-1-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=sthotton@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).