From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>
Cc: Anoob Joseph <anoobj@marvell.com>,
Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>,
<dev@dpdk.org>
Subject: [PATCH 06/11] common/cnxk: ensure flush inval completion with CSR read
Date: Fri, 24 Feb 2023 11:18:08 +0530 [thread overview]
Message-ID: <20230224054813.2855914-7-ktejasree@marvell.com> (raw)
In-Reply-To: <20230224054813.2855914-1-ktejasree@marvell.com>
From: Anoob Joseph <anoobj@marvell.com>
If a CSR read is issued after a write, the read would block till the
write operation is complete. This would help in determining when the
FLUSH+INVALIDATE operation is complete.
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
drivers/common/cnxk/hw/cpt.h | 11 +++++++++++
drivers/common/cnxk/roc_cpt.c | 16 ++++++++++++++++
drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 4 ----
3 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/drivers/common/cnxk/hw/cpt.h b/drivers/common/cnxk/hw/cpt.h
index d378a4eadd..44ff8b08b2 100644
--- a/drivers/common/cnxk/hw/cpt.h
+++ b/drivers/common/cnxk/hw/cpt.h
@@ -100,6 +100,17 @@ union cpt_lf_ctx_flush {
} s;
};
+union cpt_lf_ctx_err {
+ uint64_t u;
+ struct {
+ uint64_t flush_st_flt : 1;
+ uint64_t busy_flr : 1;
+ uint64_t busy_sw_flush : 1;
+ uint64_t reload_faulted : 1;
+ uint64_t reserved_4_63 : 1;
+ } s;
+};
+
union cpt_lf_ctx_reload {
uint64_t u;
struct {
diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index cf514be69f..dff2fbf2a4 100644
--- a/drivers/common/cnxk/roc_cpt.c
+++ b/drivers/common/cnxk/roc_cpt.c
@@ -783,6 +783,7 @@ int
roc_cpt_lf_ctx_flush(struct roc_cpt_lf *lf, void *cptr, bool inval)
{
union cpt_lf_ctx_flush reg;
+ union cpt_lf_ctx_err err;
if (lf == NULL) {
plt_err("Could not trigger CTX flush");
@@ -795,6 +796,21 @@ roc_cpt_lf_ctx_flush(struct roc_cpt_lf *lf, void *cptr, bool inval)
plt_write64(reg.u, lf->rbase + CPT_LF_CTX_FLUSH);
+ plt_atomic_thread_fence(__ATOMIC_ACQ_REL);
+
+ /* Read a CSR to ensure that the FLUSH operation is complete */
+ err.u = plt_read64(lf->rbase + CPT_LF_CTX_ERR);
+
+ if (err.s.busy_sw_flush && inval) {
+ plt_err("CTX entry could not be invalidated due to active usage.");
+ return -EAGAIN;
+ }
+
+ if (err.s.flush_st_flt) {
+ plt_err("CTX flush could not complete due to store fault");
+ abort();
+ }
+
return 0;
}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index f03646fe1a..67bd7e3243 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -737,8 +737,6 @@ sym_session_clear(struct rte_cryptodev_sym_session *sess, bool is_session_less)
/* Trigger CTX flush + invalidate to remove from CTX_CACHE */
roc_cpt_lf_ctx_flush(sess_priv->lf, &sess_priv->roc_se_ctx.se_ctx, true);
- plt_delay_ms(1);
-
if (sess_priv->roc_se_ctx.auth_key != NULL)
plt_free(sess_priv->roc_se_ctx.auth_key);
@@ -767,8 +765,6 @@ cnxk_ae_session_clear(struct rte_cryptodev *dev, struct rte_cryptodev_asym_sessi
/* Trigger CTX flush + invalidate to remove from CTX_CACHE */
roc_cpt_lf_ctx_flush(priv->lf, &priv->hw_ctx, true);
- plt_delay_ms(1);
-
/* Free resources allocated in session_cfg */
cnxk_ae_free_session_parameters(priv);
--
2.25.1
next prev parent reply other threads:[~2023-02-24 5:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 5:48 [PATCH 00/11] fixes and improvements to cnxk crypto PMD Tejasree Kondoj
2023-02-24 5:48 ` [PATCH 01/11] common/cnxk: fix incorrect auth key length Tejasree Kondoj
2023-02-24 5:48 ` [PATCH 02/11] crypto/cnxk: make sg version check const Tejasree Kondoj
2023-02-24 5:48 ` [PATCH 03/11] crypto/cnxk: use version field directly Tejasree Kondoj
2023-02-24 5:48 ` [PATCH 04/11] crypto/cnxk: use direct mode for zero aad length Tejasree Kondoj
2023-02-24 5:48 ` [PATCH 05/11] crypto/cnxk: set ctx for AE Tejasree Kondoj
2023-02-27 17:38 ` Akhil Goyal
2023-02-24 5:48 ` Tejasree Kondoj [this message]
2023-02-24 5:48 ` [PATCH 07/11] common/cnxk: add errata function for CPT set ctx Tejasree Kondoj
2023-02-24 5:48 ` [PATCH 08/11] common/cnxk: replace CPT revision check with caps Tejasree Kondoj
2023-02-24 5:48 ` [PATCH 09/11] crypto/cnxk: support cn10k IPsec SG mode Tejasree Kondoj
2023-02-24 5:48 ` [PATCH 10/11] crypto/cnxk: fix order of ECFPM params Tejasree Kondoj
2023-02-24 5:48 ` [PATCH 11/11] crypto/cnxk: add model check for pdcp chain Tejasree Kondoj
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=20230224054813.2855914-7-ktejasree@marvell.com \
--to=ktejasree@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=gmuthukrishn@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).