All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org
Cc: Scott.Benesh@microsemi.com, tom.white@microsemi.com,
	aacraid@microsemi.com,
	"Guilherme G . Piccoli" <gpiccoli@linux.vnet.ibm.com>,
	Bart Van Assche <Bart.VanAssche@wdc.com>
Subject: [PATCH 3/3] scsi: aacraid: Auto detect INTx or MSIx mode during sync cmd processing
Date: Fri, 19 Jan 2018 17:01:57 -0800	[thread overview]
Message-ID: <20180120010157.22674-4-RaghavaAditya.Renukunta@microsemi.com> (raw)
In-Reply-To: <20180120010157.22674-1-RaghavaAditya.Renukunta@microsemi.com>

During sync command processing if legacy INTx status indicates
command is not completed, sample the MSIx register and check if
it indicates command completion, set controller MSIx enabled flag.

Signed-off-by: Prasad B Munirathnam <prasad.munirathnam@microsemi.com>
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
---
 drivers/scsi/aacraid/aacraid.h |  1 +
 drivers/scsi/aacraid/src.c     | 22 ++++++++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 784783b..7834d09 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1231,6 +1231,7 @@ struct src_registers {
 
 #define SRC_ODR_SHIFT		12
 #define SRC_IDR_SHIFT		9
+#define SRC_MSI_READ_MASK	0x1000
 
 typedef void (*fib_callback)(void *ctxt, struct fib *fibctx);
 
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index b05c3cf..f9600b6 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -1399,13 +1399,23 @@ void aac_src_access_devreg(struct aac_dev *dev, int mode)
 
 static int aac_src_get_sync_status(struct aac_dev *dev)
 {
+	int msix_val = 0;
+	int legacy_val = 0;
 
-	int val;
+	msix_val = src_readl(dev, MUnit.ODR_MSI) & SRC_MSI_READ_MASK ? 1 : 0;
 
-	if (dev->msi_enabled)
-		val = src_readl(dev, MUnit.ODR_MSI) & 0x1000 ? 1 : 0;
-	else
-		val = src_readl(dev, MUnit.ODR_R) >> SRC_ODR_SHIFT;
+	if (!dev->msi_enabled) {
+		/*
+		 * if Legacy int status indicates cmd is not complete
+		 * sample MSIx register to see if it indiactes cmd complete,
+		 * if yes set the controller in MSIx mode and consider cmd
+		 * completed
+		 */
+		legacy_val = src_readl(dev, MUnit.ODR_R) >> SRC_ODR_SHIFT;
+		if (!(legacy_val & 1) && msix_val)
+			dev->msi_enabled = 1;
+		return legacy_val;
+	}
 
-	return val;
+	return msix_val;
 }
-- 
2.9.4

  parent reply	other threads:[~2018-01-20  1:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20  1:01 [PATCH 0/3] scsi: aacraid: Multi controller Kdump IOP reset handling Raghava Aditya Renukunta
2018-01-20  1:01 ` [PATCH 1/3] scsi: aacraid: Implement DropIO sync command Raghava Aditya Renukunta
2018-01-29 16:34   ` Dave Carroll
2018-01-20  1:01 ` [PATCH 2/3] scsi: aacraid: Preserve MSIX mode in the OMR register Raghava Aditya Renukunta
2018-01-29 16:35   ` Dave Carroll
2018-01-20  1:01 ` Raghava Aditya Renukunta [this message]
2018-01-29 16:39   ` [PATCH 3/3] scsi: aacraid: Auto detect INTx or MSIx mode during sync cmd processing Dave Carroll
2018-02-07  0:21 ` [PATCH 0/3] scsi: aacraid: Multi controller Kdump IOP reset handling Martin K. Petersen
2018-02-07 15:52   ` Raghava Aditya Renukunta

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=20180120010157.22674-4-RaghavaAditya.Renukunta@microsemi.com \
    --to=raghavaaditya.renukunta@microsemi.com \
    --cc=Bart.VanAssche@wdc.com \
    --cc=Scott.Benesh@microsemi.com \
    --cc=aacraid@microsemi.com \
    --cc=gpiccoli@linux.vnet.ibm.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tom.white@microsemi.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.