public inbox for linux-scsi@vger.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: David.Carroll@microsemi.com, Gana.Sridaran@microsemi.com,
	Scott.Benesh@microsemi.com, Prasad.Munirathnam@microsemi.com
Subject: [PATCH V2 12/19] aacraid: Rework SOFT reset code
Date: Wed, 10 May 2017 09:39:46 -0700	[thread overview]
Message-ID: <1494434393-17261-13-git-send-email-RaghavaAditya.Renukunta@microsemi.com> (raw)
In-Reply-To: <1494434393-17261-1-git-send-email-RaghavaAditya.Renukunta@microsemi.com>

Now the driver issues a soft reset and waits for the controller to be up
and running by periodically checking on the status of the controller
health registers. Also prevents ARC adapters from issuing soft reset if
IOP resets failed.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <david.carroll@microsemi.com>

---
Changes in V2:
None

 drivers/scsi/aacraid/src.c | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index 67185eb..8ed7be0 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -754,8 +754,8 @@ static void aac_send_hardware_soft_reset(struct aac_dev *dev)
 
 static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type)
 {
-	unsigned long status, start;
 	bool is_ctrl_up;
+	int ret = 0;
 
 	if (bled < 0)
 		goto invalid_out;
@@ -785,24 +785,21 @@ static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type)
 		else
 			goto set_startup;
 
-		/*
-		 * Check to see if KERNEL_UP_AND_RUNNING
-		 * Wait for the adapter to be up and running.
-		 * If !KERNEL_UP_AND_RUNNING issue HW Soft Reset
-		 */
-		status = src_readl(dev, MUnit.OMR);
-		if (dev->sa_firmware
-		 && !(status & KERNEL_UP_AND_RUNNING)) {
-			start = jiffies;
-			do {
-				status = src_readl(dev, MUnit.OMR);
-				if (time_after(jiffies,
-				 start+HZ*SOFT_RESET_TIME)) {
-					aac_send_hardware_soft_reset(dev);
-					start = jiffies;
-				}
-			} while (!(status & KERNEL_UP_AND_RUNNING));
+		if (!dev->sa_firmware) {
+			ret = -ENODEV;
+			goto out;
 		}
+
+		aac_send_hardware_soft_reset(dev);
+		dev->msi_enabled = 0;
+
+		is_ctrl_up = aac_is_ctrl_up_and_running(dev);
+		if (!is_ctrl_up) {
+			dev_err(&dev->pdev->dev, "SOFT reset failed\n");
+			ret = -ENODEV;
+			goto out;
+		}
+
 		break;
 	case HW_SOFT_RESET:
 		if (dev->sa_firmware) {
@@ -818,13 +815,14 @@ static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type)
 invalid_out:
 
 	if (src_readl(dev, MUnit.OMR) & KERNEL_PANIC)
-		return -ENODEV;
+		ret = -ENODEV;
 
 set_startup:
 	if (startup_timeout < 300)
 		startup_timeout = 300;
 
-	return 0;
+out:
+	return ret;
 }
 
 /**
-- 
2.7.4

  parent reply	other threads:[~2017-05-10  6:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 16:39 [PATCH V2 00/19] aacraid: Patchset with reset rework and misc fixes Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 01/19] aacraid: Remove __GFP_DMA for raw srb memory Raghava Aditya Renukunta
2017-05-10 15:36   ` Dave Carroll
2017-05-10 16:39 ` [PATCH V2 02/19] aacraid: Fix DMAR issues with iommu=pt Raghava Aditya Renukunta
2017-05-10 15:37   ` Dave Carroll
2017-05-10 16:39 ` [PATCH V2 03/19] aacraid: Added 32 and 64 queue depth for arc natives Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 04/19] aacraid: Set correct Queue Depth for HBA1000 RAW disks Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 05/19] aacraid: Remove reset support from check_health Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 06/19] aacraid: Change wait time for fib completion Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 07/19] aacraid: Log count info of scsi cmds before reset Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 08/19] aacraid: Print ctrl status before eh reset Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 09/19] aacraid: Using single reset mask for IOP reset Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 10/19] aacraid: Rework " Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 11/19] aacraid: Add periodic checks to see IOP reset status Raghava Aditya Renukunta
2017-05-10 16:39 ` Raghava Aditya Renukunta [this message]
2017-05-10 16:39 ` [PATCH V2 13/19] aacraid: Rework aac_src_restart Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 14/19] aacraid: Use correct function to get ctrl health Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 15/19] aacraid: Make sure ioctl returns on controller reset Raghava Aditya Renukunta
2017-05-10 15:40   ` Dave Carroll
2017-05-10 16:39 ` [PATCH V2 16/19] aacraid: Enable ctrl reset for both hba and arc Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 17/19] aacraid : Add reset debugging statements Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 18/19] aacraid: Remove reference to Series-9 Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 19/19] aacraid: Update driver version to 50834 Raghava Aditya Renukunta
2017-05-12  3:07 ` [PATCH V2 00/19] aacraid: Patchset with reset rework and misc fixes Martin K. Petersen

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=1494434393-17261-13-git-send-email-RaghavaAditya.Renukunta@microsemi.com \
    --to=raghavaaditya.renukunta@microsemi.com \
    --cc=David.Carroll@microsemi.com \
    --cc=Gana.Sridaran@microsemi.com \
    --cc=Prasad.Munirathnam@microsemi.com \
    --cc=Scott.Benesh@microsemi.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox