linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Lodnoor <anand.lodnoor@broadcom.com>
To: linux-scsi@vger.kernel.org
Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com,
	kiran-kumar.kasturi@broadcom.com,
	Anand Lodnoor <anand.lodnoor@broadcom.com>,
	Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Subject: [PATCH 01/11] megaraid_sas: Add transition_to_ready retry logic in resume path
Date: Fri,  3 Jan 2020 17:02:25 +0530	[thread overview]
Message-ID: <1578051155-14716-2-git-send-email-anand.lodnoor@broadcom.com> (raw)
In-Reply-To: <1578051155-14716-1-git-send-email-anand.lodnoor@broadcom.com>

Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: Anand Lodnoor <anand.lodnoor@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 34 +++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index a4bc814..b5f0221 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -7593,6 +7593,7 @@ static void megasas_shutdown_controller(struct megasas_instance *instance,
 	struct Scsi_Host *host;
 	struct megasas_instance *instance;
 	int irq_flags = PCI_IRQ_LEGACY;
+	u32 status_reg;
 
 	instance = pci_get_drvdata(pdev);
 
@@ -7620,9 +7621,38 @@ static void megasas_shutdown_controller(struct megasas_instance *instance,
 	/*
 	 * We expect the FW state to be READY
 	 */
-	if (megasas_transition_to_ready(instance, 0))
-		goto fail_ready_state;
 
+	if (megasas_transition_to_ready(instance, 0)) {
+		dev_info(&instance->pdev->dev,
+			 "Failed to transition controller to ready from %s!\n",
+			 __func__);
+		if (instance->adapter_type != MFI_SERIES) {
+			status_reg =
+			instance->instancet->read_fw_status_reg(instance);
+			if (status_reg & MFI_RESET_ADAPTER) {
+				if (megasas_adp_reset_wait_for_ready
+					(instance, true, 0) == FAILED)
+					goto fail_ready_state;
+				} else {
+					goto fail_ready_state;
+				}
+		} else {
+			atomic_set(&instance->fw_reset_no_pci_access, 1);
+			instance->instancet->adp_reset
+				(instance, instance->reg_set);
+			atomic_set(&instance->fw_reset_no_pci_access, 0);
+
+			/*waitting for about 30 second before retry*/
+			ssleep(30);
+
+			if (megasas_transition_to_ready(instance, 0))
+				goto fail_ready_state;
+		}
+
+		dev_info(&instance->pdev->dev,
+			 "FW restarted successfully from %s!\n",
+			 __func__);
+	}
 	if (megasas_set_dma_mask(instance))
 		goto fail_set_dma_mask;
 
-- 
1.8.3.1


  reply	other threads:[~2020-01-03 11:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-03 11:32 [PATCH 00/11] megaraid_sas: driver updates to 07.713.01.00-rc1 Anand Lodnoor
2020-01-03 11:32 ` Anand Lodnoor [this message]
2020-01-10  6:00   ` [PATCH 01/11] megaraid_sas: Add transition_to_ready retry logic in resume path Martin K. Petersen
2020-01-03 11:32 ` [PATCH 02/11] megaraid_sas: Set no_write_same only for Virtual Disk Anand Lodnoor
2020-01-03 11:32 ` [PATCH 03/11] megaraid_sas: Update queue_depth of SAS and NVMe devices Anand Lodnoor
2020-01-10  6:03   ` Martin K. Petersen
2020-01-03 11:32 ` =?y?q?=5BPATCH=2004/11=5D=20megaraid=5Fsas=3A=20Don=E2=80=99t=20kill=20already=20dead=20adapter?= Anand Lodnoor
2020-01-10  6:03   ` .PATCH.04/11.megaraid.sas.Don.t.kill.already.dead.adapter Martin K. Petersen
2020-01-03 11:32 ` [PATCH 05/11] megaraid_sas: Do not kill HBA if JBOD Seqence map or RAID map is disabled Anand Lodnoor
2020-01-03 11:32 ` [PATCH 06/11] megaraid_sas: Do not set HBA Operational if FW is not in operational state Anand Lodnoor
2020-01-03 11:32 ` [PATCH 07/11] megaraid_sas: Re-Define enum DCMD_RETURN_STATUS Anand Lodnoor
2020-01-03 11:32 ` [PATCH 08/11] megaraid_sas: Do not initiate OCR if controller is not in ready state Anand Lodnoor
     [not found]   ` <20200104053110.9D26124649@mail.kernel.org>
2020-01-07  7:59     ` Sumit Saxena
2020-01-03 11:32 ` [PATCH 09/11] megaraid_sas: Return pended IOCTLs after 3 retries Anand Lodnoor
2020-01-03 11:32 ` [PATCH 10/11] megaraid_sas: Use Block layer API to check SCSI device in-flight IO requests Anand Lodnoor
2020-01-03 11:32 ` [PATCH 11/11] megaraid_sas: Update driver version to 07.713.01.00-rc1 Anand Lodnoor

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=1578051155-14716-2-git-send-email-anand.lodnoor@broadcom.com \
    --to=anand.lodnoor@broadcom.com \
    --cc=chandrakanth.patil@broadcom.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=kiran-kumar.kasturi@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sumit.saxena@broadcom.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;
as well as URLs for NNTP newsgroup(s).