From patchwork Thu Sep 8 12:53:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 12970036 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 86E21C54EE9 for ; Thu, 8 Sep 2022 12:42:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231979AbiIHMmB (ORCPT ); Thu, 8 Sep 2022 08:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbiIHMlt (ORCPT ); Thu, 8 Sep 2022 08:41:49 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55BFFE620F for ; Thu, 8 Sep 2022 05:41:30 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id f24so17743784plr.1 for ; Thu, 08 Sep 2022 05:41:30 -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=DgkPzch0GJaaX4latt/og8QbRMzv6ceAAwTJCl3C6eA=; b=V5L2uQ7apYIGFmxX1ies6p4JfIX+jR1l7eVEi1k5Ki1K5gMhAWW0AsEGkdUq10oNch +LUJItDf/FXC8kEy55tpVk2Gor7SZTa9Q5rIBYvvGhIwasKK2Tm2r/9yYvvJjJApbZLE soYeJzvSWFLy4/rO02DE6p0GiZYYeAkgx8kmc= 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=DgkPzch0GJaaX4latt/og8QbRMzv6ceAAwTJCl3C6eA=; b=NCdyOya4WTemJnKxaKTiKiBqpuGWNfMu1dwQgVIi1ng4YzENQf4tkup8xM1xTxR9ar MmpA5/PiYc48Xoq4Wd9gz2OSi8hu6j8b+ucI9vK8ATMYgaDfQpkttqL45n0X8AUQ7iGF kGrZnVP+FbE0BHMZiaDnzcqcBn2qUJYQk7ZnPnaQxEgb4q66L16QWm0aEmH7So/iwHzc SomjRf85K0ZHsOHkXOFFZWAWIS27n9hJFDxFvC6v2Xve+5sAE8i3r37be7yh9kXN7S2M C1yoesGFPL1NnnlnkuVZcpTmMfE2szUd1rknOKULUhIIo/V5WG7eGQj3qYOJyBv/Hdry 0GgA== X-Gm-Message-State: ACgBeo3kKjJUmvm+5RCfIJzHkUlR5i9UkCdERz37g5f42sXget3oDTxV BqAMfWcNV6HB7HqhwHqCT+/zh2rLEVehp3rYRHl77uCQ47+NNnTIuVURzFYCas4PNCSqwQOpbRE aUwSuwuG/w0vbUXyihBIbkWjBRcihO130USy1c5Glgt8uYUxn+hx/x1+X/zfXT1+/cqMR14aAQR Ra/9RLUYMZ X-Google-Smtp-Source: AA6agR7lDpHqT0h6GZydxmUNw4IdluktwvMc3YpNMWJeEjgYYZXGsEZsSJiSpgWr7gLAK1A12p+Bug== X-Received: by 2002:a17:90b:2704:b0:1fd:aaa9:6d0b with SMTP id px4-20020a17090b270400b001fdaaa96d0bmr4031187pjb.128.1662640889079; Thu, 08 Sep 2022 05:41:29 -0700 (PDT) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id c17-20020a63ef51000000b0043395af24f6sm11106807pgk.25.2022.09.08.05.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 05:41:28 -0700 (PDT) From: Sreekanth Reddy To: linux-scsi@vger.kernel.org Cc: martin.petersen@oracle.com, Sreekanth Reddy Subject: [PATCH 7/9] mpi3mr: Scan the devices during resume time Date: Thu, 8 Sep 2022 18:23:30 +0530 Message-Id: <20220908125332.21110-8-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220908125332.21110-1-sreekanth.reddy@broadcom.com> References: <20220908125332.21110-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 1289bbe..ad78b9b 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -4039,10 +4039,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); @@ -4909,7 +4907,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;