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,
	Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
	Marco Chiappero <marco.chiappero@intel.com>,
	Fiona Trahe <fiona.trahe@intel.com>
Subject: [PATCH 06/20] crypto: qat - prevent spurious MSI interrupt in VF
Date: Thu, 12 Aug 2021 21:21:15 +0100	[thread overview]
Message-ID: <20210812202129.18831-7-giovanni.cabiddu@intel.com> (raw)
In-Reply-To: <20210812202129.18831-1-giovanni.cabiddu@intel.com>

QAT GEN2 devices suffer from a defect where the MSI interrupt can be
sent multiple times.

If the second (spurious) interrupt is handled before the bottom half
handler runs, then the extra interrupt is effectively ignored because
the bottom half is only scheduled once.
However, if the top half runs again after the bottom half runs, this
will appear as a spurious PF to VF interrupt.

This can be avoided by checking the interrupt mask register in addition
to the interrupt source register in the interrupt handler.

This patch is based on earlier work done by Conor McLoughlin.

Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Co-developed-by: Marco Chiappero <marco.chiappero@intel.com>
Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/qat_common/adf_vf_isr.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c
index 3e4f64d248f9..4359ca633ea9 100644
--- a/drivers/crypto/qat/qat_common/adf_vf_isr.c
+++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c
@@ -18,6 +18,7 @@
 #include "adf_pf2vf_msg.h"
 
 #define ADF_VINTSOU_OFFSET	0x204
+#define ADF_VINTMSK_OFFSET	0x208
 #define ADF_VINTSOU_BUN		BIT(0)
 #define ADF_VINTSOU_PF2VF	BIT(1)
 
@@ -161,11 +162,20 @@ static irqreturn_t adf_isr(int irq, void *privdata)
 			&GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)];
 	void __iomem *pmisc_bar_addr = pmisc->virt_addr;
 	bool handled = false;
-	u32 v_int;
+	u32 v_int, v_mask;
 
 	/* Read VF INT source CSR to determine the source of VF interrupt */
 	v_int = ADF_CSR_RD(pmisc_bar_addr, ADF_VINTSOU_OFFSET);
 
+	/* Read VF INT mask CSR to determine which sources are masked */
+	v_mask = ADF_CSR_RD(pmisc_bar_addr, ADF_VINTMSK_OFFSET);
+
+	/*
+	 * Recompute v_int ignoring sources that are masked. This is to
+	 * avoid rescheduling the tasklet for interrupts already handled
+	 */
+	v_int &= ~v_mask;
+
 	/* Check for PF2VF interrupt */
 	if (v_int & ADF_VINTSOU_PF2VF) {
 		/* Disable PF to VF interrupt */
-- 
2.31.1


  parent reply	other threads:[~2021-08-12 20:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 20:21 [PATCH 00/20] crypto: qat - cumulative fixes Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 01/20] crypto: qat - use proper type for vf_mask Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 02/20] crypto: qat - remove empty sriov_configure() Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 03/20] crypto: qat - enable interrupts only after ISR allocation Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 04/20] crypto: qat - do not ignore errors from enable_vf2pf_comms() Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 05/20] crypto: qat - handle both source of interrupt in VF ISR Giovanni Cabiddu
2021-08-12 20:21 ` Giovanni Cabiddu [this message]
2021-08-12 20:21 ` [PATCH 07/20] crypto: qat - prevent spurious MSI interrupt in PF Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 08/20] crypto: qat - rename compatibility version definition Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 09/20] crypto: qat - remove intermediate tasklet for vf2pf Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 10/20] crypto: qat - fix reuse of completion variable Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 11/20] crypto: qat - move pf2vf interrupt [en|dis]able to adf_vf_isr.c Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 12/20] crypto: qat - protect interrupt mask CSRs with a spinlock Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 13/20] crypto: qat - fix naming for init/shutdown VF to PF notifications Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 14/20] crypto: qat - move IO virtualization functions Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 15/20] crypto: qat - complete all the init steps before service notification Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 16/20] crypto: qat - fix naming of PF/VF enable functions Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 17/20] crypto: qat - remove the unnecessary get_vintmsk_offset() Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 18/20] crypto: qat - flush vf workqueue at driver removal Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 19/20] crypto: qat - do not export adf_iov_putmsg() Giovanni Cabiddu
2021-08-12 20:21 ` [PATCH 20/20] crypto: qat - store vf.compatible flag Giovanni Cabiddu
2021-08-21  7:49 ` [PATCH 00/20] crypto: qat - cumulative fixes 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=20210812202129.18831-7-giovanni.cabiddu@intel.com \
    --to=giovanni.cabiddu@intel.com \
    --cc=fiona.trahe@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.