diff mbox series

[v3,8/8] cryptodev: pass session iova in configure session

Message ID 20211018213452.2734720-9-gakhil@marvell.com (mailing list archive)
State New
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. 18, 2021, 9:34 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/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/ipsec_mb/ipsec_mb_ops.c        |  2 +-
 drivers/crypto/ipsec_mb/ipsec_mb_private.h    |  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/virtio/virtio_cryptodev.c      |  5 +++--
 lib/cryptodev/cryptodev_pmd.h                 |  6 ++++--
 lib/cryptodev/rte_cryptodev.c                 |  6 +++++-
 24 files changed, 67 insertions(+), 42 deletions(-)
diff mbox series

Patch

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 4c88ec637a..5b2f2e631b 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 776cf02b57..d012b7192e 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -497,7 +497,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;
@@ -563,7 +563,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 97a2fb1050..a2c48d5a5b 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -109,7 +109,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 717e506998..4426bf4aa3 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -3438,7 +3438,7 @@  dpaa2_sec_security_session_get_size(void *device __rte_unused)
 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 fc267784a8..a206865537 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -2534,7 +2534,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/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index e4b4de7612..1b1ee7cf24 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -310,7 +310,7 @@  ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev)
 int
 ipsec_mb_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 ipsec_mb_dev_private *internals = dev->data->dev_private;
 	struct ipsec_mb_internals *pmd_data =
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 38850c6532..3f84f7ed7f 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -392,7 +392,7 @@  ipsec_mb_sym_session_get_size(struct rte_cryptodev *dev);
 int ipsec_mb_sym_session_configure(
 	struct rte_cryptodev *dev,
 	struct rte_crypto_sym_xform *xform,
-	void *sess);
+	void *sess, rte_iova_t sess_iova);
 
 /** Clear the memory of session so it does not leave key material behind */
 void
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index 8babdad59f..51311cff2a 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 bf058d254c..504ce623b8 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 9405cb62f5..c6155b0bf5 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 5df8f86420..0d1f5a659e 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 299e758d1c..129acf1a84 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/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 70d03869fe..ca35bff8c2 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
@@ -1308,7 +1308,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/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 7810ca5b6f..8b55d601a4 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 4ab9b0f7af..9d5e08bba2 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -1707,6 +1707,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;
 
@@ -1733,8 +1734,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",