From patchwork Wed Oct 17 06:37:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10644645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0761157A for ; Wed, 17 Oct 2018 06:38:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD42929573 for ; Wed, 17 Oct 2018 06:38:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0BA82955A; Wed, 17 Oct 2018 06:38:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70E9529547 for ; Wed, 17 Oct 2018 06:38:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727249AbeJQOc2 (ORCPT ); Wed, 17 Oct 2018 10:32:28 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44787 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727099AbeJQOc2 (ORCPT ); Wed, 17 Oct 2018 10:32:28 -0400 Received: by mail-pg1-f194.google.com with SMTP id g2-v6so12020189pgu.11 for ; Tue, 16 Oct 2018 23:38:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CUrVq6sPxHWaGSjbxi46Pb7Jtez9gR9utQA7WUpWEHE=; b=Cfy5BbJhEQDBYjtf44yX/xQKxoYaFz7p01mdMGSvYnYBvdl6WtejLT2OAz+IOrNjaV TKcb8+0Cyq6SvGwEybYDDtF0dBPzk5Ph1Q4WNNako0SkvQ4/WbiflzTcsFb0CHSSZcHE JB0Vt5aRhNS0N4DATKrob7Wdehe/b7UKcsfLk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CUrVq6sPxHWaGSjbxi46Pb7Jtez9gR9utQA7WUpWEHE=; b=WbYa0v0g2sT7CMaEXGHwJy8uhPgYCGdKWE9AobYPDpAooj22rVtw/8bH8OSWaASQzi Ts1fdb+U/89Wod/jm24UnmLxiY4vnHd/k+YGvnhDCfFS0JjQjil3n9a/57vZodZFXVi0 gsMHhGeD2KivFQBP5yXOjE5D/mA99x58xiXm5AIpknt65W5I0c7lNPEEsF62dTafeFTe /3Wi/WwgZ7Ed+pKCvZIh4sxbplxNjxYJ//aD2sUNnXUq4Zusay749uRT1CrDjFqybNwU UT2fltSJQhImkBTlBusU3r/siUGcpQ+mT5NesWb5glgozFWMfOEVyN5MfB0wzpat/KOb LsBg== X-Gm-Message-State: ABuFfohHPy1QMVcUZI3CIyPh82pLJ8wXPFC7NqMryIe5PdqrBy6sbe7W pjUx3upSnS9tzMucedT9ZlTSboHpmqs+IQ== X-Google-Smtp-Source: ACcGV63cj99j4Tpwmia+8Pf1etWHICNbBnaLJjkXSCrDsxe6nmCosQpL2qK5+V7L+8pfwiDv0yByYA== X-Received: by 2002:a63:5726:: with SMTP id l38-v6mr23424162pgb.118.1539758299872; Tue, 16 Oct 2018 23:38:19 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id y131-v6sm19375425pfg.164.2018.10.16.23.38.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Oct 2018 23:38:18 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, Shivasharan S Subject: [PATCH V2 04/19] megaraid_sas: Add check for reset adapter bit Date: Tue, 16 Oct 2018 23:37:42 -0700 Message-Id: <1539758277-1882-5-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1539758277-1882-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1539758277-1882-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For SAS3 and later controllers, FW sets the reset adapter bit indicating the driver to perform a controller reset. Driver needs to check if this bit is set before doing a reset. This reduces the driver probe failure time to 180seconds in case there is a faulty controller connected. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 33 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 23cdeca26c53..3b9850f550ea 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5300,7 +5300,7 @@ static int megasas_init_fw(struct megasas_instance *instance) { u32 max_sectors_1; u32 max_sectors_2, tmp_sectors, msix_enable; - u32 scratch_pad_2, scratch_pad_3, scratch_pad_4; + u32 scratch_pad_2, scratch_pad_3, scratch_pad_4, status_reg; resource_size_t base_addr; struct megasas_register_set __iomem *reg_set; struct megasas_ctrl_info *ctrl_info = NULL; @@ -5308,6 +5308,7 @@ static int megasas_init_fw(struct megasas_instance *instance) int i, j, loop, fw_msix_count = 0; struct IOV_111 *iovPtr; struct fusion_context *fusion; + bool do_adp_reset = true; fusion = instance->ctrl_context; @@ -5356,19 +5357,29 @@ static int megasas_init_fw(struct megasas_instance *instance) } if (megasas_transition_to_ready(instance, 0)) { - 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); - dev_info(&instance->pdev->dev, - "FW restarted successfully from %s!\n", - __func__); + if (instance->adapter_type >= INVADER_SERIES) { + status_reg = instance->instancet->read_fw_status_reg( + instance->reg_set); + do_adp_reset = status_reg & MFI_RESET_ADAPTER; + } - /*waitting for about 30 second before retry*/ - ssleep(30); + if (do_adp_reset) { + 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); + dev_info(&instance->pdev->dev, + "FW restarted successfully from %s!\n", + __func__); + + /*waitting for about 30 second before retry*/ + ssleep(30); - if (megasas_transition_to_ready(instance, 0)) + if (megasas_transition_to_ready(instance, 0)) + goto fail_ready_state; + } else { goto fail_ready_state; + } } megasas_init_ctrl_params(instance);