From patchwork Fri Oct 12 10:57:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10638487 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 D88F8933 for ; Fri, 12 Oct 2018 10:58:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8F1F2BAFC for ; Fri, 12 Oct 2018 10:58:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD8A82BB4D; Fri, 12 Oct 2018 10:58:08 +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 5E8FE2BAFC for ; Fri, 12 Oct 2018 10:58:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728097AbeJLS37 (ORCPT ); Fri, 12 Oct 2018 14:29:59 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:41730 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727652AbeJLS37 (ORCPT ); Fri, 12 Oct 2018 14:29:59 -0400 Received: by mail-ed1-f67.google.com with SMTP id x31-v6so11086439edd.8 for ; Fri, 12 Oct 2018 03:58:06 -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=GMFXvZmP9RBfdE4BHMURPn0eCvymBLrvbFDzc3QPXzw=; b=f2sz4t2qp8G0jA3Fd3cNFoAK/xrW7NqDJR4QPbng0mztTGC+xMGszMVpoc6AqvHaGw 3fP3qphua1MbVc+nBm60Gve4J6oWvNhRsJjqvvXhlmU/SFV9C9rOdr+TXRympYkttluU Ky09KnfhV3mW+h1VqUQ/dIjMiH0kRHPK0QtlA= 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=GMFXvZmP9RBfdE4BHMURPn0eCvymBLrvbFDzc3QPXzw=; b=H/RPAAC5zFFlP+PZHXx1seM9D/5GuASqugBDobn+KvrS0JmJb0Kmode0emSaWDkp+k tIGebpVEMUD+NphH21H8Z69RxFAZDelpiisTUwUSj4iOwtg1gXJfegxebz13uvGVgocw SPlI0oFuxUH1Pk8fsazJDiW5pSN6sBfJnNQd+sA+wDGlU0b7r9JhpzW8nqOS4I7buiNR /OC74dnkWOlCR9oqK4IgQlenNXzToCN8vk5fByWa9R8G+omw44Bo1IPuAe5sLZn3bYJo h6IWvvXLJ8s+7m53nTanjnqwfMOq9mKb6SNPYlIbjtA+C6HeeI4eIiC+EHwWLa+3Eh+N 4AgQ== X-Gm-Message-State: ABuFfogUp92V2gzM9dZW0J33aV7kuTf7I/doxKde31OtHcnb+J3/z5m4 OhajIH+zv8wmr/cdbAQqoqqt7WBckwEcxA== X-Google-Smtp-Source: ACcGV63z+ztFjoSq4xHli4CSjro09JZNw5Vjy46JIuUjks7biIWR8jfhVJKE6lVgpvl9GRvPNtt9Vg== X-Received: by 2002:a17:906:1ec9:: with SMTP id m9-v6mr6555970ejj.35.1539341885656; Fri, 12 Oct 2018 03:58:05 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id m25-v6sm451198edc.86.2018.10.12.03.58.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 03:58:04 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, Shivasharan S Subject: [PATCH 04/19] megaraid_sas: Add check for reset adapter bit Date: Fri, 12 Oct 2018 03:57:18 -0700 Message-Id: <1539341853-26814-5-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1539341853-26814-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1539341853-26814-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 aefc4c936b60..e8b3d2185692 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5301,7 +5301,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; @@ -5309,6 +5309,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; @@ -5357,19 +5358,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);