All of lore.kernel.org
 help / color / mirror / Atom feed
From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
To: herbert@gondor.apana.org.au
Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com,
	marco.chiappero@intel.com,
	Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Subject: [PATCH v3 15/25] crypto: qat - differentiate between pf2vf and vf2pf offset
Date: Wed, 17 Nov 2021 14:30:48 +0000	[thread overview]
Message-ID: <20211117143058.211550-16-giovanni.cabiddu@intel.com> (raw)
In-Reply-To: <20211117143058.211550-1-giovanni.cabiddu@intel.com>

From: Marco Chiappero <marco.chiappero@intel.com>

Add the function get_vf2pf_offset() to adf_pfvf_ops to differentiate the
CSRs used for pf2vf and vf2pf.

Offsets may or may not be direction specific depending on QAT
generation. Since in QAT GEN2 the CSR is not direction specific, i.e.
there is a single mailbox register shared for pf2vf and vf2pf, both
get_vf2pf_offset() and get_vf2pf_offset() will return the same offset.

This change is to make the direction explicit, so it is easier to
understand and debug and also in preparation for the introduction of
PFVF support in the qat_4xxx driver since QAT GEN4 devices have a
separate CSR for pf2vf and vf2pf communications.

Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
---
 drivers/crypto/qat/qat_common/adf_accel_devices.h |  1 +
 drivers/crypto/qat/qat_common/adf_gen2_pfvf.c     | 10 ++++++----
 drivers/crypto/qat/qat_common/adf_pf2vf_msg.c     |  6 +++---
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h
index a1baa65bd034..d9b2cc935b61 100644
--- a/drivers/crypto/qat/qat_common/adf_accel_devices.h
+++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h
@@ -150,6 +150,7 @@ struct adf_etr_ring_data;
 struct adf_pfvf_ops {
 	int (*enable_comms)(struct adf_accel_dev *accel_dev);
 	u32 (*get_pf2vf_offset)(u32 i);
+	u32 (*get_vf2pf_offset)(u32 i);
 	u32 (*get_vf2pf_sources)(void __iomem *pmisc_addr);
 	void (*enable_vf2pf_interrupts)(void __iomem *pmisc_addr, u32 vf_mask);
 	void (*disable_vf2pf_interrupts)(void __iomem *pmisc_addr, u32 vf_mask);
diff --git a/drivers/crypto/qat/qat_common/adf_gen2_pfvf.c b/drivers/crypto/qat/qat_common/adf_gen2_pfvf.c
index 36c8ff009661..2f27146bb7c6 100644
--- a/drivers/crypto/qat/qat_common/adf_gen2_pfvf.c
+++ b/drivers/crypto/qat/qat_common/adf_gen2_pfvf.c
@@ -12,12 +12,12 @@
 #define ADF_GEN2_PF_PF2VF_OFFSET(i)	(0x3A000 + 0x280 + ((i) * 0x04))
 #define ADF_GEN2_VF_PF2VF_OFFSET	0x200
 
-static u32 adf_gen2_pf_get_pf2vf_offset(u32 i)
+static u32 adf_gen2_pf_get_pfvf_offset(u32 i)
 {
 	return ADF_GEN2_PF_PF2VF_OFFSET(i);
 }
 
-static u32 adf_gen2_vf_get_pf2vf_offset(u32 i)
+static u32 adf_gen2_vf_get_pfvf_offset(u32 i)
 {
 	return ADF_GEN2_VF_PF2VF_OFFSET;
 }
@@ -64,7 +64,8 @@ static void adf_gen2_disable_vf2pf_interrupts(void __iomem *pmisc_addr,
 void adf_gen2_init_pf_pfvf_ops(struct adf_pfvf_ops *pfvf_ops)
 {
 	pfvf_ops->enable_comms = adf_enable_pf2vf_comms;
-	pfvf_ops->get_pf2vf_offset = adf_gen2_pf_get_pf2vf_offset;
+	pfvf_ops->get_pf2vf_offset = adf_gen2_pf_get_pfvf_offset;
+	pfvf_ops->get_vf2pf_offset = adf_gen2_pf_get_pfvf_offset;
 	pfvf_ops->get_vf2pf_sources = adf_gen2_get_vf2pf_sources;
 	pfvf_ops->enable_vf2pf_interrupts = adf_gen2_enable_vf2pf_interrupts;
 	pfvf_ops->disable_vf2pf_interrupts = adf_gen2_disable_vf2pf_interrupts;
@@ -74,6 +75,7 @@ EXPORT_SYMBOL_GPL(adf_gen2_init_pf_pfvf_ops);
 void adf_gen2_init_vf_pfvf_ops(struct adf_pfvf_ops *pfvf_ops)
 {
 	pfvf_ops->enable_comms = adf_enable_vf2pf_comms;
-	pfvf_ops->get_pf2vf_offset = adf_gen2_vf_get_pf2vf_offset;
+	pfvf_ops->get_pf2vf_offset = adf_gen2_vf_get_pfvf_offset;
+	pfvf_ops->get_vf2pf_offset = adf_gen2_vf_get_pfvf_offset;
 }
 EXPORT_SYMBOL_GPL(adf_gen2_init_vf_pfvf_ops);
diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
index 78dc8aea4866..c420ec03081b 100644
--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
+++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
@@ -29,7 +29,7 @@ static int adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr)
 	int ret;
 
 	if (accel_dev->is_vf) {
-		pf2vf_offset = hw_data->pfvf_ops.get_pf2vf_offset(0);
+		pf2vf_offset = hw_data->pfvf_ops.get_vf2pf_offset(0);
 		lock = &accel_dev->vf.vf2pf_lock;
 		local_in_use_mask = ADF_VF2PF_IN_USE_BY_VF_MASK;
 		local_in_use_pattern = ADF_VF2PF_IN_USE_BY_VF;
@@ -258,7 +258,7 @@ bool adf_recv_and_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr)
 	u32 msg, resp = 0;
 
 	/* Read message from the VF */
-	msg = ADF_CSR_RD(pmisc_addr, hw_data->pfvf_ops.get_pf2vf_offset(vf_nr));
+	msg = ADF_CSR_RD(pmisc_addr, hw_data->pfvf_ops.get_vf2pf_offset(vf_nr));
 	if (!(msg & ADF_VF2PF_INT)) {
 		dev_info(&GET_DEV(accel_dev),
 			 "Spurious VF2PF interrupt, msg %X. Ignored\n", msg);
@@ -275,7 +275,7 @@ bool adf_recv_and_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr)
 
 	/* To ACK, clear the VF2PFINT bit */
 	msg &= ~ADF_VF2PF_INT;
-	ADF_CSR_WR(pmisc_addr, hw_data->pfvf_ops.get_pf2vf_offset(vf_nr), msg);
+	ADF_CSR_WR(pmisc_addr, hw_data->pfvf_ops.get_vf2pf_offset(vf_nr), msg);
 
 	if (adf_handle_vf2pf_msg(accel_dev, vf_nr, msg, &resp))
 		return false;
-- 
2.33.1


  parent reply	other threads:[~2021-11-17 14:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 14:30 [PATCH v3 00/25] crypto: qat - PFVF refactoring Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 01/25] crypto: qat - do not handle PFVF sources for qat_4xxx Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 02/25] crypto: qat - fix undetected PFVF timeout in ACK loop Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 03/25] crypto: qat - refactor PF top half for PFVF Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 04/25] crypto: qat - move vf2pf interrupt helpers Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 05/25] crypto: qat - move VF message handler to adf_vf2pf_msg.c Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 06/25] crypto: qat - move interrupt code out of the PFVF handler Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 07/25] crypto: qat - change PFVF ACK behaviour Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 08/25] crypto: qat - re-enable interrupts for legacy PFVF messages Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 09/25] crypto: qat - split PFVF message decoding from handling Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 10/25] crypto: qat - handle retries due to collisions in adf_iov_putmsg() Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 11/25] crypto: qat - relocate PFVF PF related logic Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 12/25] crypto: qat - relocate PFVF VF " Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 13/25] crypto: qat - relocate PFVF disabled function Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 14/25] crypto: qat - add pfvf_ops Giovanni Cabiddu
2021-11-17 14:30 ` Giovanni Cabiddu [this message]
2021-11-17 14:30 ` [PATCH v3 16/25] crypto: qat - abstract PFVF send function Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 17/25] crypto: qat - abstract PFVF receive logic Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 18/25] crypto: qat - reorganize PFVF code Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 19/25] crypto: qat - reorganize PFVF protocol definitions Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 20/25] crypto: qat - use enums for PFVF protocol codes Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 21/25] crypto: qat - pass the PF2VF responses back to the callers Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 22/25] crypto: qat - refactor pfvf version request messages Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 23/25] crypto: qat - do not rely on min version Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 24/25] crypto: qat - fix VF IDs in PFVF log messages Giovanni Cabiddu
2021-11-17 14:30 ` [PATCH v3 25/25] crypto: qat - improve logging of PFVF messages Giovanni Cabiddu
2021-11-26  5:31 ` [PATCH v3 00/25] crypto: qat - PFVF refactoring Herbert Xu

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=20211117143058.211550-16-giovanni.cabiddu@intel.com \
    --to=giovanni.cabiddu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=marco.chiappero@intel.com \
    --cc=qat-linux@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.