crypto: qat - disregard spurious PFVF interrupts
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Tue, 28 Sep 2021 11:44:30 +0000 (12:44 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 8 Oct 2021 12:02:38 +0000 (20:02 +0800)
Upon receiving a PFVF message, check if the interrupt bit is set in the
message. If it is not, that means that the interrupt was probably
triggered by a collision. In this case, disregard the message and
re-enable the interrupts.

Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV")
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
drivers/crypto/qat/qat_common/adf_vf_isr.c

index 789a413..5a41beb 100644 (file)
@@ -211,6 +211,11 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)
 
        /* Read message from the VF */
        msg = ADF_CSR_RD(pmisc_addr, hw_data->get_pf2vf_offset(vf_nr));
+       if (!(msg & ADF_VF2PF_INT)) {
+               dev_info(&GET_DEV(accel_dev),
+                        "Spurious VF2PF interrupt, msg %X. Ignored\n", msg);
+               goto out;
+       }
 
        /* To ACK, clear the VF2PFINT bit */
        msg &= ~ADF_VF2PF_INT;
@@ -294,6 +299,7 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)
        if (resp && adf_iov_putmsg(accel_dev, resp, vf_nr))
                dev_err(&GET_DEV(accel_dev), "Failed to send response to VF\n");
 
+out:
        /* re-enable interrupt on PF from this VF */
        adf_enable_vf2pf_interrupts(accel_dev, (1 << vf_nr));
 
index 07f8168..db5e7ab 100644 (file)
@@ -96,6 +96,11 @@ static void adf_pf2vf_bh_handler(void *data)
 
        /* Read the message from PF */
        msg = ADF_CSR_RD(pmisc_bar_addr, hw_data->get_pf2vf_offset(0));
+       if (!(msg & ADF_PF2VF_INT)) {
+               dev_info(&GET_DEV(accel_dev),
+                        "Spurious PF2VF interrupt, msg %X. Ignored\n", msg);
+               goto out;
+       }
 
        if (!(msg & ADF_PF2VF_MSGORIGIN_SYSTEM))
                /* Ignore legacy non-system (non-kernel) PF2VF messages */
@@ -144,6 +149,7 @@ static void adf_pf2vf_bh_handler(void *data)
        msg &= ~ADF_PF2VF_INT;
        ADF_CSR_WR(pmisc_bar_addr, hw_data->get_pf2vf_offset(0), msg);
 
+out:
        /* Re-enable PF2VF interrupts */
        adf_enable_pf2vf_interrupts(accel_dev);
        return;