From patchwork Mon Sep 12 13:57:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 605240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9B12ECAAD5 for ; Mon, 12 Sep 2022 13:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbiILNpu (ORCPT ); Mon, 12 Sep 2022 09:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbiILNpn (ORCPT ); Mon, 12 Sep 2022 09:45:43 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ED272494A for ; Mon, 12 Sep 2022 06:45:41 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id b75so3423091pfb.7 for ; Mon, 12 Sep 2022 06:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date; bh=8Mvk9n1LXiWrZO8vipyF5/+f3m/U3JPLWYaiguLsNYY=; b=Qk2QwEP0v7jxVRfOk6OfDEPy8J2pZNNmmb+KbRN6ljp3RqzXzJRg+nFHW9y7uvowiV vaNdLKoi332PYsYRDguhWcxW8439XPi51Ugoe7Wqf2GCxdmpe1tFaEmG4+6JTk8qWNzx ULysskJH7R0a6LTZe/Q1wC0w1hocHyelEU3dY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=8Mvk9n1LXiWrZO8vipyF5/+f3m/U3JPLWYaiguLsNYY=; b=mpeKeAFZLeRsfOfg8Y7p7rwNp8vo9eEhvOH9C48hlPWpP9EcGMz4pC1E1mwHQ5UVDe 3SKWfr3y0SFq8Qx9ypIOYcYUrh0pR7ulhpmeben+RBYOHh0qhzlz1T9+PUM29MG/0rLj jCzmfe7UzqxXO8TrMQWqEEgj8NELQnRTS/4bBdeM/33bjnjyx5uG1pagfVeX1XkcvI5+ cj95heCjafFjcq6iIdc76fiuWegf/Ra0/mlsXoTmZkE10HP8K45NK6Obvf9agNRIckcw ilTG3ZpSpmlzC5o0LaeUHiakHFYD//aMEVShCydL0j1ZMHaRdRQNKPC1japLPfJcR44T Qhfg== X-Gm-Message-State: ACgBeo2EpOt9/79b56j8UVGSBe4Q+yD6F0GGI8T7Z2y9z6dGAEJtaGIi vvjptSsEojmRwtKfywF0SKxPafRnq3H9yrcNRxvjRSQKZ/oKZcrnJXFUK8YQjGJkO0sJdaygtHc aMolQfCIndx/L/HMvUbOqlMssqbByRTBO70rqFX8m/PYXqWnTOA22+tFyW/Ou2yXy7+vH1O0cLu Y5cc2Lax5X X-Google-Smtp-Source: AA6agR4l7Na5vA0FPpL1r1eoqgOPbFpxKQs/GjzGDpam9t81qLDX1QJ8yyOIyJvR4EugCq1ni3vHjg== X-Received: by 2002:a65:6e0d:0:b0:42d:707c:94ee with SMTP id bd13-20020a656e0d000000b0042d707c94eemr23073024pgb.260.1662990340698; Mon, 12 Sep 2022 06:45:40 -0700 (PDT) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id u7-20020a170903124700b00176e8f85146sm6112900plh.185.2022.09.12.06.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 06:45:40 -0700 (PDT) From: Sreekanth Reddy To: linux-scsi@vger.kernel.org Cc: martin.petersen@oracle.com, Sreekanth Reddy Subject: [PATCH v2 7/9] mpi3mr: Scan the devices during resume time Date: Mon, 12 Sep 2022 19:27:40 +0530 Message-Id: <20220912135742.11764-8-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220912135742.11764-1-sreekanth.reddy@broadcom.com> References: <20220912135742.11764-1-sreekanth.reddy@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Scan the target devices during system resume time and add or remove the target device with the SML if the corresponding target device is newly added or removed respectively. Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpi3mr/mpi3mr.h | 2 ++ drivers/scsi/mpi3mr/mpi3mr_fw.c | 8 +++----- drivers/scsi/mpi3mr/mpi3mr_os.c | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index 883ed59..5b10504 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -132,6 +132,8 @@ extern atomic64_t event_counter; #define MPI3MR_DEFAULT_CFG_PAGE_SZ 1024 /* in bytes */ +#define MPI3MR_RESET_TOPOLOGY_SETTLE_TIME 10 + #define MPI3MR_SCMD_TIMEOUT (60 * HZ) #define MPI3MR_EH_SCMD_TIMEOUT (60 * HZ) diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index e3df044..f841a44 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -4042,10 +4042,8 @@ retry_init: goto out_failed; } - if (!is_resume) { - mrioc->device_refresh_on = 1; - mpi3mr_add_event_wait_for_device_refresh(mrioc); - } + mrioc->device_refresh_on = 1; + mpi3mr_add_event_wait_for_device_refresh(mrioc); ioc_info(mrioc, "sending port enable\n"); retval = mpi3mr_issue_port_enable(mrioc, 1); @@ -4912,7 +4910,7 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc, mrioc->name, reset_reason); goto out; } - ssleep(10); + ssleep(MPI3MR_RESET_TOPOLOGY_SETTLE_TIME); out: if (!retval) { diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index bb276b5..f474c56 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -5228,13 +5228,17 @@ mpi3mr_resume(struct device *dev) } mrioc->stop_drv_processing = 0; + mpi3mr_invalidate_devhandles(mrioc); + mpi3mr_free_enclosure_list(mrioc); mpi3mr_memset_buffers(mrioc); r = mpi3mr_reinit_ioc(mrioc, 1); if (r) { ioc_err(mrioc, "resuming controller failed[%d]\n", r); return r; } + ssleep(MPI3MR_RESET_TOPOLOGY_SETTLE_TIME); scsi_unblock_requests(shost); + mrioc->device_refresh_on = 0; mpi3mr_start_watchdog(mrioc); return 0;