From patchwork Tue Apr 6 18:05:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 12185679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D751C433ED for ; Tue, 6 Apr 2021 18:05:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01F52613D0 for ; Tue, 6 Apr 2021 18:05:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244447AbhDFSGD (ORCPT ); Tue, 6 Apr 2021 14:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232876AbhDFSGD (ORCPT ); Tue, 6 Apr 2021 14:06:03 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F26FCC06174A for ; Tue, 6 Apr 2021 11:05:54 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id w9so21273096ybw.7 for ; Tue, 06 Apr 2021 11:05:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=teD1nbWDmR8uP6HF7dWyx6/qjSabmbVIqj89B7QTpIM=; b=Eo4OfR7J9uEJ1O7UiFQNtCPIHUT04yszhryQQIKxQAMGBGCR3O5UNW8bwUB0pnjEg5 8pG+iuGEpFQ6EFN5nwZ5LBsMwy3rbDu+Z7lBJuEygjyFoaZqLkQDsQNId9tF7oCy+mbB 5NA7Yfc9BE9SL7WP+0Txj4pfzBV8VJYiuhmArtq0zBV5xmorR7XMh/QSf4GJDaBulzD1 nLCK/KHkv799fmjc2ScRbBvuaBcMAaRu3TMhWxcuSbpLcJ4h7Lg4/0Tp5a5paXrQ8+LS 0IT4yDj8nQMVwoFS7LXNS/AgvH5AFpxhjdP7HrAf75/+6l2Y6bDc8SFc4Zr4/J1JrLdD 9t3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=teD1nbWDmR8uP6HF7dWyx6/qjSabmbVIqj89B7QTpIM=; b=gEVTuroL9fME6xcBO6+1LMP8Re63GwxMzqs/askpC6z7nBskUB7BWb+a/C+/Ou01ym OP7/TClajnBpY0ec3BiHSB1y+H3TK2y4q4dZevmERXBkZO2798vmnWOjFVBylmyt8HMq Ua9O03j5hGsS4OCOM6WbcFt9nJ5grdR2htjTfCCsWOj6ALAsDsoRB5iD+sFbiGgIvgLF LYhjsZfatTTyAYHVn0x72y+22BgsmHcHlo6XcKmx9nt1y/LOumZWise0gy8CYHBfKlih sq0Vnx8sT8SNOGCqETj0R+G11m9fbQbT2GIqDW/9WgowBC53BlRH13x0HVmo+qnf5tPr +/8A== X-Gm-Message-State: AOAM530YeatxxhTQNwbO3rRqDvM796J9FhYOdSECAa+Rs9i90zAG2ysw iRL/uzA5GWznyuaIRW7qNFukaKfaGdONDw== X-Google-Smtp-Source: ABdhPJzSONE3JU+SpDL9G5e8YgnP6CB4IznsHb/HLDy4Wo3PC5lGY2zGHCCY2DNpHOrPB505QrJ/p/7gRHUzQA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:11:ff2:f4b8:7c38:13d7]) (user=ipylypiv job=sendgmr) by 2002:a25:7c47:: with SMTP id x68mr45560292ybc.358.1617732354237; Tue, 06 Apr 2021 11:05:54 -0700 (PDT) Date: Tue, 6 Apr 2021 11:05:33 -0700 In-Reply-To: <20210406180534.1924345-1-ipylypiv@google.com> Message-Id: <20210406180534.1924345-2-ipylypiv@google.com> Mime-Version: 1.0 References: <20210406180534.1924345-1-ipylypiv@google.com> X-Mailer: git-send-email 2.31.1.295.g9ea45b61b8-goog Subject: [PATCH v2 1/2] scsi: pm80xx: Increase timeout for pm80xx mpi_uninit_check() From: Igor Pylypiv To: Jack Wang , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Vishakha Channapattan , Akshat Jain , Jolly Shah , Yu Zheng , linux-scsi@vger.kernel.org, Viswas G , Deepak Ukey , Igor Pylypiv Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The mpi_uninit_check() takes longer for inbound doorbell register to be cleared. Increased the timeout substantially so that the driver does not fail to load. Previously, the inbound doorbell wait time was mistakenly increased in the mpi_init_check() instead of the mpi_uninit_check(). It is okay to leave the mpi_init_check() wait time as is as these are timeout values and if there is a failure, waiting longer is not an issue. Fixes: e90e236250e9 ("scsi: pm80xx: Increase timeout for pm80xx mpi_uninit_check") Reviewed-by: Vishakha Channapattan Signed-off-by: Igor Pylypiv --- drivers/scsi/pm8001/pm80xx_hwi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 84315560e8e1..c6b0834e3806 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -1502,9 +1502,9 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha) /* wait until Inbound DoorBell Clear Register toggled */ if (IS_SPCV_12G(pm8001_ha->pdev)) { - max_wait_count = 4 * 1000 * 1000;/* 4 sec */ + max_wait_count = 30 * 1000 * 1000; /* 30 sec */ } else { - max_wait_count = 2 * 1000 * 1000;/* 2 sec */ + max_wait_count = 15 * 1000 * 1000; /* 15 sec */ } do { udelay(1); From patchwork Tue Apr 6 18:05:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 12185681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E7DAC433ED for ; Tue, 6 Apr 2021 18:06:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4FF91613D0 for ; Tue, 6 Apr 2021 18:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244423AbhDFSGH (ORCPT ); Tue, 6 Apr 2021 14:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232876AbhDFSGH (ORCPT ); Tue, 6 Apr 2021 14:06:07 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AD67C06174A for ; Tue, 6 Apr 2021 11:05:58 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id b20so5623532qvf.2 for ; Tue, 06 Apr 2021 11:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=eic4V2E5QYXXouIYsjBjUC0eiCaHlV/G0hefFPFzL9c=; b=aCF6DzUmWjrJddmeiJ+Er7O7fvXgMUd7s+enaAXN04ws94d1y3eCiyRZbnz/yBb4dc 1azQMvl9oDHz5/ckMmrvfNYa2h66HwDI9E7h9XXYLC+nhCXEOAy4y5g4eTpUTGT3PrY8 69i6m/iToBJuujLaHS3KUgX4YQ8ReqVpvERgowxXoK74/TiyGPMkXPhR+wSUlFe56Qs0 sGyDcz5gaI3WddHqPmVCjTwgoaaRmRyKnxCA9PEM3gw7uDR+nhrj9YUlEc0beJS5nTqa z+IQUeCIeNw4D8jJxfB8yox9jzyCW3ypt3LRhm2SbkSh/N4l6V0OhMmRtzfXanGdIcQD M7ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=eic4V2E5QYXXouIYsjBjUC0eiCaHlV/G0hefFPFzL9c=; b=Z7rocvtLaeKI201gfskRcP4qaPb9Dh8OgbjOM8T2qGAPO4nzUqdTPk2Qo6zQHIaBTb AzDo7pl4kuSa7xzaXKw7x+nZlPGZaGAbm+bXiLSqj6FSbzmB5x4SsKAWC5sd0cCEjeEs v/TfTFmxwvf6rX4u+lSbDBr8xoQrjni0p3LnmoCFC3MHpPAjYfOVVmXM78T2PYVCt9Da W8B1zcUPA9tX4wcil/n+fMOQkTYTb3/LTNE/TatpE6l0wYLHc6xCnJhVAXqcmTm0jRNB CarNSM+4qDzYZGdtbYLZkbrgoI6VH3/eSex2z9c2YaWwNgFpbNx8KrIS2UphlelD5gZ3 kcoA== X-Gm-Message-State: AOAM530C0TCX3EDz3JxdDCjeELXZYmkCRV+EtgOu5yXitjR8NWUFePe9 JNaryo8U9VXvF7x3xpfao5WNwPILdqY7aw== X-Google-Smtp-Source: ABdhPJwHhObYyADNDH/g1MXsdlfZLluTAazZG6fTNu/+c18mp0dUjDJUD7nylORTaxJ7WwkyMpkZyIO6t30LkA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:11:ff2:f4b8:7c38:13d7]) (user=ipylypiv job=sendgmr) by 2002:a05:6214:9c9:: with SMTP id dp9mr4594501qvb.52.1617732357257; Tue, 06 Apr 2021 11:05:57 -0700 (PDT) Date: Tue, 6 Apr 2021 11:05:34 -0700 In-Reply-To: <20210406180534.1924345-1-ipylypiv@google.com> Message-Id: <20210406180534.1924345-3-ipylypiv@google.com> Mime-Version: 1.0 References: <20210406180534.1924345-1-ipylypiv@google.com> X-Mailer: git-send-email 2.31.1.295.g9ea45b61b8-goog Subject: [PATCH v2 2/2] scsi: pm80xx: Remove busy wait from mpi_uninit_check() From: Igor Pylypiv To: Jack Wang , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Vishakha Channapattan , Akshat Jain , Jolly Shah , Yu Zheng , linux-scsi@vger.kernel.org, Viswas G , Deepak Ukey , Igor Pylypiv Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org mpi_uninit_check() is not being called in an ATOMIC context. The only caller of mpi_uninit_check() is pm80xx_chip_soft_rst(). Callers of pm80xx_chip_soft_rst(): - pm8001_ioctl_soft_reset() - pm8001_pci_probe() - pm8001_pci_remove() - pm8001_pci_suspend() - pm8001_pci_resume() There was a similar fix for mpi_init_check() in commit d71023af4bec0 ("scsi: pm80xx: Do not busy wait in MPI init check"). Reviewed-by: Vishakha Channapattan Signed-off-by: Igor Pylypiv --- drivers/scsi/pm8001/pm80xx_hwi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index c6b0834e3806..9fade2ed9396 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -1502,12 +1502,12 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha) /* wait until Inbound DoorBell Clear Register toggled */ if (IS_SPCV_12G(pm8001_ha->pdev)) { - max_wait_count = 30 * 1000 * 1000; /* 30 sec */ + max_wait_count = SPCV_DOORBELL_CLEAR_TIMEOUT; } else { - max_wait_count = 15 * 1000 * 1000; /* 15 sec */ + max_wait_count = SPC_DOORBELL_CLEAR_TIMEOUT; } do { - udelay(1); + msleep(FW_READY_INTERVAL); value = pm8001_cr32(pm8001_ha, 0, MSGU_IBDB_SET); value &= SPCv_MSGU_CFG_TABLE_RESET; } while ((value != 0) && (--max_wait_count)); @@ -1519,9 +1519,9 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha) /* check the MPI-State for termination in progress */ /* wait until Inbound DoorBell Clear Register toggled */ - max_wait_count = 2 * 1000 * 1000; /* 2 sec for spcv/ve */ + max_wait_count = 100; /* 2 sec for spcv/ve */ do { - udelay(1); + msleep(FW_READY_INTERVAL); gst_len_mpistate = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, GST_GSTLEN_MPIS_OFFSET);