summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorMarco Chiappero <marco.chiappero@intel.com>2021-12-16 09:13:19 +0000
committerHerbert Xu <herbert@gondor.apana.org.au>2021-12-24 14:18:25 +1100
commit0aeda694f1870f50900603c276423ffc05035f90 (patch)
treecb694f77b23db33ec6a430ac7a449f70a021f3a3 /drivers/crypto
parent028042856802c4731c6afebe15d95fed4d39a614 (diff)
crypto: qat - set PFVF_MSGORIGIN just before sending
In this implementation of the PFVF protocol every egressing message must include the ADF_PFVF_MSGORIGIN_SYSTEM flag. However, this flag can be set on all the outbound messages just before sending them rather than at message build time, as currently done. Remove the unnecessary code duplication by setting the ADF_PFVF_MSGORIGIN_SYSTEM flag only once at send time in adf_gen2_pfvf_send(). Signed-off-by: Marco Chiappero <marco.chiappero@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Fiona Trahe <fiona.trahe@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/qat/qat_common/adf_gen2_pfvf.c1
-rw-r--r--drivers/crypto/qat/qat_common/adf_pfvf_pf_msg.c3
-rw-r--r--drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c2
-rw-r--r--drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c12
4 files changed, 7 insertions, 11 deletions
diff --git a/drivers/crypto/qat/qat_common/adf_gen2_pfvf.c b/drivers/crypto/qat/qat_common/adf_gen2_pfvf.c
index 1e45f3230c19..97bef41ddc47 100644
--- a/drivers/crypto/qat/qat_common/adf_gen2_pfvf.c
+++ b/drivers/crypto/qat/qat_common/adf_gen2_pfvf.c
@@ -149,6 +149,7 @@ static int adf_gen2_pfvf_send(struct adf_accel_dev *accel_dev, u32 msg,
/* Pre-calculate message, shifting it in place and setting
* the in use pattern
*/
+ msg |= ADF_PFVF_MSGORIGIN_SYSTEM;
msg = gen2_csr_msg_to_position(msg, local_offset);
gen2_csr_set_in_use(&msg, remote_offset);
diff --git a/drivers/crypto/qat/qat_common/adf_pfvf_pf_msg.c b/drivers/crypto/qat/qat_common/adf_pfvf_pf_msg.c
index 4057d7d74d62..f6d05cd29a82 100644
--- a/drivers/crypto/qat/qat_common/adf_pfvf_pf_msg.c
+++ b/drivers/crypto/qat/qat_common/adf_pfvf_pf_msg.c
@@ -9,8 +9,7 @@
void adf_pf2vf_notify_restarting(struct adf_accel_dev *accel_dev)
{
struct adf_accel_vf_info *vf;
- u32 msg = (ADF_PFVF_MSGORIGIN_SYSTEM |
- (ADF_PF2VF_MSGTYPE_RESTARTING << ADF_PFVF_MSGTYPE_SHIFT));
+ u32 msg = ADF_PF2VF_MSGTYPE_RESTARTING << ADF_PFVF_MSGTYPE_SHIFT;
int i, num_vfs = pci_num_vf(accel_to_pci_dev(accel_dev));
for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++) {
diff --git a/drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c b/drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c
index 4e4daec2ae34..9f4baa9b14fc 100644
--- a/drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c
+++ b/drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c
@@ -64,7 +64,6 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr,
else
compat = ADF_PF2VF_VF_COMPAT_UNKNOWN;
- resp = ADF_PFVF_MSGORIGIN_SYSTEM;
resp |= ADF_PF2VF_MSGTYPE_VERSION_RESP <<
ADF_PFVF_MSGTYPE_SHIFT;
resp |= ADF_PFVF_COMPAT_THIS_VERSION <<
@@ -83,7 +82,6 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr,
/* PF always newer than legacy VF */
compat = ADF_PF2VF_VF_COMPATIBLE;
- resp = ADF_PFVF_MSGORIGIN_SYSTEM;
resp |= ADF_PF2VF_MSGTYPE_VERSION_RESP <<
ADF_PFVF_MSGTYPE_SHIFT;
/* Set legacy major and minor version num */
diff --git a/drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c b/drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c
index c9e929651a7d..0463743a8d43 100644
--- a/drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c
+++ b/drivers/crypto/qat/qat_common/adf_pfvf_vf_msg.c
@@ -16,8 +16,7 @@
*/
int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev)
{
- u32 msg = (ADF_PFVF_MSGORIGIN_SYSTEM |
- (ADF_VF2PF_MSGTYPE_INIT << ADF_PFVF_MSGTYPE_SHIFT));
+ u32 msg = ADF_VF2PF_MSGTYPE_INIT << ADF_PFVF_MSGTYPE_SHIFT;
if (adf_send_vf2pf_msg(accel_dev, msg)) {
dev_err(&GET_DEV(accel_dev),
@@ -39,8 +38,7 @@ EXPORT_SYMBOL_GPL(adf_vf2pf_notify_init);
*/
void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev)
{
- u32 msg = (ADF_PFVF_MSGORIGIN_SYSTEM |
- (ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_PFVF_MSGTYPE_SHIFT));
+ u32 msg = ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_PFVF_MSGTYPE_SHIFT;
if (test_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status))
if (adf_send_vf2pf_msg(accel_dev, msg))
@@ -57,9 +55,9 @@ int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)
u32 resp;
int ret;
- msg = ADF_PFVF_MSGORIGIN_SYSTEM;
- msg |= ADF_VF2PF_MSGTYPE_COMPAT_VER_REQ << ADF_PFVF_MSGTYPE_SHIFT;
- msg |= ADF_PFVF_COMPAT_THIS_VERSION << ADF_VF2PF_COMPAT_VER_REQ_SHIFT;
+ msg = ADF_VF2PF_MSGTYPE_COMPAT_VER_REQ << ADF_PFVF_MSGTYPE_SHIFT |
+ ADF_PFVF_COMPAT_THIS_VERSION << ADF_VF2PF_COMPAT_VER_REQ_SHIFT;
+
BUILD_BUG_ON(ADF_PFVF_COMPAT_THIS_VERSION > 255);
ret = adf_send_vf2pf_req(accel_dev, msg, &resp);