diff mbox series

[v2,7/7] cryptodev: pass session iova in configure session

Message ID 20211013192222.1582631-8-gakhil@marvell.com (mailing list archive)
State Superseded
Delegated to: akhil goyal
Headers show
Series crypto/security session framework rework | expand

Checks

Context Check Description
ci/Intel-compilation warning apply issues
ci/checkpatch success coding style OK

Commit Message

Akhil Goyal Oct. 13, 2021, 7:22 p.m. UTC
Some PMDs need session physical address which can be passed
to the hardware. But since sym_session_configure
does not allow PMD to get mempool object, the PMD cannot
call rte_mempool_virt2iova().
Hence the library layer need to calculate the iova for session
private data and pass it to the PMD.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c   |  2 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  3 ++-
 drivers/crypto/armv8/rte_armv8_pmd_ops.c       |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_session.c       |  2 +-
 drivers/crypto/bcmfs/bcmfs_sym_session.h       |  2 +-
 drivers/crypto/caam_jr/caam_jr.c               |  2 +-
 drivers/crypto/ccp/ccp_pmd_ops.c               |  2 +-
 drivers/crypto/cnxk/cnxk_cryptodev_ops.c       |  4 ++--
 drivers/crypto/cnxk/cnxk_cryptodev_ops.h       |  3 ++-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c    |  2 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c             |  3 ++-
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c     |  2 +-
 drivers/crypto/mlx5/mlx5_crypto.c              |  3 ++-
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c        |  3 ++-
 drivers/crypto/nitrox/nitrox_sym.c             |  4 ++--
 drivers/crypto/null/null_crypto_pmd_ops.c      |  2 +-
 drivers/crypto/octeontx/otx_cryptodev_ops.c    | 16 ++++++++++------
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c  | 17 +++++++++++------
 drivers/crypto/openssl/rte_openssl_pmd_ops.c   |  2 +-
 drivers/crypto/qat/qat_sym_session.c           | 10 ++++++----
 drivers/crypto/qat/qat_sym_session.h           |  6 ++++--
 drivers/crypto/scheduler/scheduler_pmd_ops.c   |  3 ++-
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c     |  2 +-
 drivers/crypto/virtio/virtio_cryptodev.c       |  5 +++--
 drivers/crypto/zuc/rte_zuc_pmd_ops.c           |  2 +-
 lib/cryptodev/cryptodev_pmd.h                  |  6 ++++--
 lib/cryptodev/rte_cryptodev.c                  |  6 +++++-
 27 files changed, 71 insertions(+), 45 deletions(-)
diff mbox series

Patch

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index 75330292af..52166674d0 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -258,7 +258,7 @@  aesni_gcm_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 aesni_gcm_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		struct rte_crypto_sym_xform *xform,
-		void *sess)
+		void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 	struct aesni_gcm_private *internals = dev->data->dev_private;
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index 997c4f330d..b7a806d51c 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -973,7 +973,8 @@  aesni_mb_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 /** Configure a aesni multi-buffer session from a crypto xform chain */
 static int
 aesni_mb_pmd_sym_session_configure(struct rte_cryptodev *dev,
-		struct rte_crypto_sym_xform *xform, void *sess)
+		struct rte_crypto_sym_xform *xform, void *sess,
+		rte_iova_t sess_iova __rte_unused)
 {
 	struct aesni_mb_private *internals = dev->data->dev_private;
 	int ret;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
index 2d3b54b063..9d9a6cf3dc 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c
@@ -267,7 +267,7 @@  armv8_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 armv8_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
-		void *sess)
+		void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.c b/drivers/crypto/bcmfs/bcmfs_sym_session.c
index b4b167d0c2..bee97596e0 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.c
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.c
@@ -224,7 +224,7 @@  bcmfs_sym_get_session(struct rte_crypto_op *op)
 int
 bcmfs_sym_session_configure(struct rte_cryptodev *dev,
 			    struct rte_crypto_sym_xform *xform,
-			    void *sess)
+			    void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	RTE_SET_USED(dev);
 	int ret;
diff --git a/drivers/crypto/bcmfs/bcmfs_sym_session.h b/drivers/crypto/bcmfs/bcmfs_sym_session.h
index 7faafe2fd5..0df7d07830 100644
--- a/drivers/crypto/bcmfs/bcmfs_sym_session.h
+++ b/drivers/crypto/bcmfs/bcmfs_sym_session.h
@@ -93,7 +93,7 @@  bcmfs_process_crypto_op(struct rte_crypto_op *op,
 int
 bcmfs_sym_session_configure(struct rte_cryptodev *dev,
 			    struct rte_crypto_sym_xform *xform,
-			    void *sess);
+			    void *sess, rte_iova_t sess_iova __rte_unused);
 
 void
 bcmfs_sym_session_clear(struct rte_cryptodev *dev, void *sess);
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index a1fd6d996a..a03f05293b 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1692,7 +1692,7 @@  caam_jr_set_session_parameters(struct rte_cryptodev *dev,
 static int
 caam_jr_sym_session_configure(struct rte_cryptodev *dev,
 			      struct rte_crypto_sym_xform *xform,
-			      void *sess)
+			      void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 
diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c
index cac1268130..0730aba083 100644
--- a/drivers/crypto/ccp/ccp_pmd_ops.c
+++ b/drivers/crypto/ccp/ccp_pmd_ops.c
@@ -757,7 +757,7 @@  ccp_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 ccp_pmd_sym_session_configure(struct rte_cryptodev *dev,
 			  struct rte_crypto_sym_xform *xform,
-			  void *sess)
+			  void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 	struct ccp_private *internals;
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index 52d9cf0cf3..5b88e5efa6 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -494,7 +494,7 @@  cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt)
 int
 sym_session_configure(struct roc_cpt *roc_cpt,
 		      struct rte_crypto_sym_xform *xform,
-		      void *sess) 
+		      void *sess)
 {
 	struct cnxk_se_sess *sess_priv;
 	int ret;
@@ -560,7 +560,7 @@  sym_session_configure(struct roc_cpt *roc_cpt,
 int
 cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
 			       struct rte_crypto_sym_xform *xform,
-			       void *sess)
+			       void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	struct cnxk_cpt_vf *vf = dev->data->dev_private;
 	struct roc_cpt *roc_cpt = &vf->cpt;
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index 3c09d10582..978bd022e0 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -111,7 +111,8 @@  unsigned int cnxk_cpt_sym_session_get_size(struct rte_cryptodev *dev);
 
 int cnxk_cpt_sym_session_configure(struct rte_cryptodev *dev,
 				   struct rte_crypto_sym_xform *xform,
-				   void *sess);
+				   void *sess,
+				   rte_iova_t sess_iova __rte_unused);
 
 int sym_session_configure(struct roc_cpt *roc_cpt,
 			  struct rte_crypto_sym_xform *xform,
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index d4f223f2f9..95f54011d1 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -3439,7 +3439,7 @@  dpaa2_sec_security_session_destroy(void *dev __rte_unused, void *sess)
 static int
 dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
-		void *sess)
+		void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index a9295eb154..3370c18d7a 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -2537,7 +2537,8 @@  dpaa_sec_set_session_parameters(struct rte_cryptodev *dev,
 
 static int
 dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
-		struct rte_crypto_sym_xform *xform, void *sess)
+		struct rte_crypto_sym_xform *xform, void *sess,
+		rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
index b2e5c92598..2a15f63ff1 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
@@ -242,7 +242,7 @@  kasumi_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 kasumi_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
-		void *sess)
+		void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 	struct kasumi_private *internals = dev->data->dev_private;
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index 9c60c3d117..dc41896b4f 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -165,7 +165,8 @@  mlx5_crypto_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev,
 				  struct rte_crypto_sym_xform *xform,
-				  void *session)
+				  void *session,
+				  rte_iova_t sess_iova __rte_unused)
 {
 	struct mlx5_crypto_priv *priv = dev->data->dev_private;
 	struct mlx5_crypto_session *sess_private_data = session;
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index 2e4b27ea21..d5cbb12458 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -734,7 +734,8 @@  mrvl_crypto_pmd_sym_session_get_size(__rte_unused struct rte_cryptodev *dev)
  */
 static int
 mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
-		struct rte_crypto_sym_xform *xform, void *sess)
+		struct rte_crypto_sym_xform *xform, void *sess,
+		rte_iova_t sess_iova __rte_unused)
 {
 	struct mrvl_crypto_session *mrvl_sess;
 	int ret;
diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c
index 0c9bbfef46..99ee23b7fc 100644
--- a/drivers/crypto/nitrox/nitrox_sym.c
+++ b/drivers/crypto/nitrox/nitrox_sym.c
@@ -532,7 +532,7 @@  configure_aead_ctx(struct rte_crypto_aead_xform *xform,
 static int
 nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
 			      struct rte_crypto_sym_xform *xform,
-			      void *sess)
+			      void *sess, rte_iova_t sess_iova)
 {
 	struct nitrox_crypto_ctx *ctx;
 	struct rte_crypto_cipher_xform *cipher_xform = NULL;
@@ -579,7 +579,7 @@  nitrox_sym_dev_sess_configure(struct rte_cryptodev *cdev,
 		goto err;
 	}
 
-	ctx->iova = rte_mempool_virt2iova(ctx);
+	ctx->iova = sess_iova;
 	return 0;
 err:
 	return ret;
diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 65bfa8dcf7..54bcee7af5 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -257,7 +257,7 @@  null_crypto_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 null_crypto_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		struct rte_crypto_sym_xform *xform,
-		void *sess)
+		void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index abd0963be0..27ac6d0123 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -243,7 +243,7 @@  sym_xform_verify(struct rte_crypto_sym_xform *xform)
 
 static int
 sym_session_configure(struct rte_crypto_sym_xform *xform,
-		      void *sess)
+		      void *sess, rte_iova_t sess_iova)
 {
 	struct rte_crypto_sym_xform *temp_xform = xform;
 	struct cpt_sess_misc *misc;
@@ -293,8 +293,7 @@  sym_session_configure(struct rte_crypto_sym_xform *xform,
 		goto priv_put;
 	}
 
-	misc->ctx_dma_addr = rte_mempool_virt2iova(misc) +
-			     sizeof(struct cpt_sess_misc);
+	misc->ctx_dma_addr = sess_iova + sizeof(struct cpt_sess_misc);
 
 	vq_cmd_w3.u64 = 0;
 	vq_cmd_w3.s.grp = 0;
@@ -330,12 +329,12 @@  sym_session_clear(void *sess)
 static int
 otx_cpt_session_cfg(struct rte_cryptodev *dev,
 		    struct rte_crypto_sym_xform *xform,
-		    void *sess)
+		    void *sess, rte_iova_t sess_iova)
 {
 	CPT_PMD_INIT_FUNC_TRACE();
 	RTE_SET_USED(dev);
 
-	return sym_session_configure(xform, sess);
+	return sym_session_configure(xform, sess, sess_iova);
 }
 
 
@@ -558,6 +557,7 @@  otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
 {
 	struct rte_crypto_sym_op *sym_op = op->sym;
 	struct rte_cryptodev_sym_session *sess;
+	rte_iova_t sess_iova;
 	void *req;
 	int ret;
 
@@ -572,8 +572,12 @@  otx_cpt_enq_single_sym_sessless(struct cpt_instance *instance,
 			(void *)((uint8_t *)sess +
 			rte_cryptodev_sym_get_header_session_size() +
 			(otx_cryptodev_driver_id * sess->priv_sz));
+	sess_iova = rte_mempool_virt2iova(sess) +
+			rte_cryptodev_sym_get_header_session_size() +
+			(otx_cryptodev_driver_id * sess->priv_sz);
 	ret = sym_session_configure(sym_op->xform,
-			sess->sess_data[otx_cryptodev_driver_id].data);
+			sess->sess_data[otx_cryptodev_driver_id].data,
+			sess_iova);
 	if (ret)
 		goto sess_put;
 
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index dcfbc49996..aa843f2e82 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -371,7 +371,8 @@  sym_xform_verify(struct rte_crypto_sym_xform *xform)
 }
 
 static int
-sym_session_configure(struct rte_crypto_sym_xform *xform, void *sess)
+sym_session_configure(struct rte_crypto_sym_xform *xform, void *sess,
+		      rte_iova_t sess_iova)
 {
 	struct rte_crypto_sym_xform *temp_xform = xform;
 	struct cpt_sess_misc *misc;
@@ -420,8 +421,7 @@  sym_session_configure(struct rte_crypto_sym_xform *xform, void *sess)
 		return -ENOTSUP;
 	}
 
-	misc->ctx_dma_addr = rte_mempool_virt2iova(misc) +
-			     sizeof(struct cpt_sess_misc);
+	misc->ctx_dma_addr = sess_iova + sizeof(struct cpt_sess_misc);
 
 	vq_cmd_w3.u64 = 0;
 	vq_cmd_w3.s.cptr = misc->ctx_dma_addr + offsetof(struct cpt_ctx,
@@ -751,6 +751,7 @@  otx2_cpt_enqueue_sym_sessless(struct otx2_cpt_qp *qp, struct rte_crypto_op *op,
 {
 	struct rte_crypto_sym_op *sym_op = op->sym;
 	struct rte_cryptodev_sym_session *sess;
+	rte_iova_t sess_iova;
 	int ret;
 
 	/* Create temporary session */
@@ -762,8 +763,12 @@  otx2_cpt_enqueue_sym_sessless(struct otx2_cpt_qp *qp, struct rte_crypto_op *op,
 			(void *)((uint8_t *)sess +
 			rte_cryptodev_sym_get_header_session_size() +
 			(otx2_cryptodev_driver_id * sess->priv_sz));
+	sess_iova = rte_mempool_virt2iova(sess) +
+			rte_cryptodev_sym_get_header_session_size() +
+			(otx2_cryptodev_driver_id * sess->priv_sz);
 	ret = sym_session_configure(sym_op->xform,
-			sess->sess_data[otx2_cryptodev_driver_id].data);
+			sess->sess_data[otx2_cryptodev_driver_id].data,
+			sess_iova);
 	if (ret)
 		goto sess_put;
 
@@ -1315,12 +1320,12 @@  otx2_cpt_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 otx2_cpt_sym_session_configure(struct rte_cryptodev *dev,
 			       struct rte_crypto_sym_xform *xform,
-			       void *sess)
+			       void *sess, rte_iova_t sess_iova)
 {
 	CPT_PMD_INIT_FUNC_TRACE();
 	RTE_SET_USED(dev);
 
-	return sym_session_configure(xform, sess);
+	return sym_session_configure(xform, sess, sess_iova);
 }
 
 static void
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index 1b48a6b400..02382f3c6a 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -771,7 +771,7 @@  openssl_pmd_asym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		struct rte_crypto_sym_xform *xform,
-		void *sess)
+		void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 3bca88385a..ef92f22c1a 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -451,11 +451,13 @@  qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
 int
 qat_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
-		void *sess_private_data)
+		void *sess_private_data,
+		rte_iova_t sess_iova)
 {
 	int ret;
 
-	ret = qat_sym_session_set_parameters(dev, xform, sess_private_data);
+	ret = qat_sym_session_set_parameters(dev, xform, sess_private_data,
+			sess_iova);
 	if (ret != 0) {
 		QAT_LOG(ERR,
 		    "Crypto QAT PMD: failed to configure session parameters");
@@ -540,7 +542,8 @@  qat_sym_session_handle_mixed(const struct rte_cryptodev *dev,
 
 int
 qat_sym_session_set_parameters(struct rte_cryptodev *dev,
-		struct rte_crypto_sym_xform *xform, void *session_private)
+		struct rte_crypto_sym_xform *xform, void *session_private,
+		rte_iova_t session_paddr)
 {
 	struct qat_sym_session *session = session_private;
 	struct qat_sym_dev_private *internals = dev->data->dev_private;
@@ -550,7 +553,6 @@  qat_sym_session_set_parameters(struct rte_cryptodev *dev,
 	int handle_mixed = 0;
 
 	/* Verify the session physical address is known */
-	rte_iova_t session_paddr = rte_mempool_virt2iova(session);
 	if (session_paddr == 0 || session_paddr == RTE_BAD_IOVA) {
 		QAT_LOG(ERR,
 			"Session physical address unknown. Bad memory pool.");
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index c7dceb2add..4b7de4c9e7 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -112,11 +112,13 @@  struct qat_sym_session {
 int
 qat_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
-		void *sess);
+		void *sess, rte_iova_t sess_iova);
 
 int
 qat_sym_session_set_parameters(struct rte_cryptodev *dev,
-		struct rte_crypto_sym_xform *xform, void *session_private);
+		struct rte_crypto_sym_xform *xform,
+		void *session_private,
+		rte_iova_t sess_iova __rte_unused);
 
 int
 qat_sym_session_configure_aead(struct rte_cryptodev *dev,
diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c
index 87260b5a22..ddc80f165d 100644
--- a/drivers/crypto/scheduler/scheduler_pmd_ops.c
+++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c
@@ -476,7 +476,8 @@  scheduler_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 
 static int
 scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev,
-	struct rte_crypto_sym_xform *xform, void *sess)
+	struct rte_crypto_sym_xform *xform, void *sess,
+	rte_iova_t sess_iova __rte_unused)
 {
 	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
 	uint32_t i;
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
index b0f8f6d86a..d543f74a73 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
@@ -249,7 +249,7 @@  snow3g_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 snow3g_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
-		void *sess)
+		void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 	struct snow3g_private *internals = dev->data->dev_private;
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index de52fec32e..e306225432 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -40,7 +40,7 @@  static void virtio_crypto_sym_clear_session(struct rte_cryptodev *dev,
 		void *sess);
 static int virtio_crypto_sym_configure_session(struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
-		void *session);
+		void *session, rte_iova_t sess_iova __rte_unused);
 
 /*
  * The set of PCI devices this driver supports
@@ -1306,7 +1306,8 @@  static int
 virtio_crypto_sym_configure_session(
 		struct rte_cryptodev *dev,
 		struct rte_crypto_sym_xform *xform,
-		void *sess)
+		void *sess,
+		rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 	struct virtio_crypto_session *session;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd_ops.c b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
index 04126c8a04..4495f07013 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd_ops.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd_ops.c
@@ -249,7 +249,7 @@  zuc_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
 static int
 zuc_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		struct rte_crypto_sym_xform *xform,
-		void *sess)
+		void *sess, rte_iova_t sess_iova __rte_unused)
 {
 	int ret;
 
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 8d2a15d495..a6e663c1b5 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -300,7 +300,8 @@  typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
  *
  * @param	dev		Crypto device pointer
  * @param	xform		Single or chain of crypto xforms
- * @param	session		Pointer to cryptodev's private session structure
+ * @param	session		Pointer to cryptodev's private session
+ * @param	sess_iova	Iova of private session pointer
  *
  * @return
  *  - Returns 0 if private session structure have been created successfully.
@@ -309,7 +310,8 @@  typedef unsigned int (*cryptodev_asym_get_session_private_size_t)(
  *  - Returns -ENOMEM if the private session could not be allocated.
  */
 typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev,
-		struct rte_crypto_sym_xform *xform, void *session);
+		struct rte_crypto_sym_xform *xform, void *session,
+		rte_iova_t sess_iova);
 /**
  * Configure a Crypto asymmetric session on a device.
  *
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index d516a444c6..c492518595 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -1722,6 +1722,7 @@  rte_cryptodev_sym_session_init(uint8_t dev_id,
 	struct rte_cryptodev_sym_session *sess = sess_opaque;
 	uint32_t sess_priv_sz = rte_cryptodev_sym_get_private_session_size(
 			dev_id);
+	rte_iova_t sess_iova;
 	uint8_t index;
 	int ret;
 
@@ -1748,8 +1749,11 @@  rte_cryptodev_sym_session_init(uint8_t dev_id,
 		sess->sess_data[index].data = (void *)((uint8_t *)sess +
 				rte_cryptodev_sym_get_header_session_size() +
 				(index * sess->priv_sz));
+		sess_iova = rte_mempool_virt2iova(sess) +
+				rte_cryptodev_sym_get_header_session_size() +
+				(index * sess->priv_sz);
 		ret = dev->dev_ops->sym_session_configure(dev, xforms,
-				sess->sess_data[index].data);
+				sess->sess_data[index].data, sess_iova);
 		if (ret < 0) {
 			CDEV_LOG_ERR(
 				"dev_id %d failed to configure session details",