From patchwork Fri Feb 24 14:43:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 13151314 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 2F67FC678D5 for ; Fri, 24 Feb 2023 14:44:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbjBXOou (ORCPT ); Fri, 24 Feb 2023 09:44:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230084AbjBXOoc (ORCPT ); Fri, 24 Feb 2023 09:44:32 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 257BF3A85B for ; Fri, 24 Feb 2023 06:44:28 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id i10so8049039plr.9 for ; Fri, 24 Feb 2023 06:44:28 -0800 (PST) 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:message-id:reply-to; bh=zAjduA3SIVMMPdQOZQHvPgbRb7ITZzdZRJNOUrq7duc=; b=eVAccO+avX01hwtKpX7aQjWlxhaAxiIA11c0ibtXMDjoNUkiEzi85HBOXTVW48Vzm4 nXcVXBouz0hAMFFTPQPV7aeOj2tzC9TLiYtG3G1Jv2AvrScAJA2MnxONL4QKlEeJKZMu KTWfavbAmEut1EMEYPyWkExSuMb6K6E+0mJQs= 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:message-id:reply-to; bh=zAjduA3SIVMMPdQOZQHvPgbRb7ITZzdZRJNOUrq7duc=; b=MTcEdT/L3Zns8La6lzJ7nS41fdbk4HdsGXjsiL4vKtEmxaKhx/4J3rtIef9JasZIWz hg1TzmDz/Gh7gE1cytAPSzKjGsWNDBQu2ly2KHsqnYIwJ0wPnw6jYZPJ4hjSESBoEI07 /2XgZlKfTTsoW6PCuSaI943oZu9NnlwQvJeBgcFxQxGsczTNj3UsZ/VRD68f2MBZuglE 9E4wuHR8Xwf+zOSvKsBViDMDEwx69RqRw0xy7AGvTfwQULdR2O6IJyMnkOL+8XJne13q o3vRvCxsitN4aOI8nF+Q+hJPka6Hoyc07RVoZlSh/gI/RWVJp4o6qzUgAUk0cWvJKRHF 8vxg== X-Gm-Message-State: AO0yUKUmsk+Qsk3pZBfXrK44jRqnDQz5sGFU1l/VeJaREwFV067kRzGI 7wBKhvW5Loz+Ip/m3LR9C70Nzu/dZctOW0fW+VVb4IoMlE3QxB7v/ACvTJM1j60C6UD/mya4q7J SPGqmbiDWFfWWbD/Bcdt1Llt+Z0+tuZGwiLWXZvcokHLN+tx8JIUv5S468Ba2COdYd63Aacxvey BPlAPL+HE= X-Google-Smtp-Source: AK7set94FKKFnQfyR1Uw5eXd5ixJFnFS0IIBKKbl6/CJ9c1EZ7k7M8SA4gJph7750eBAhMfDxdO9Vg== X-Received: by 2002:a17:903:70c:b0:19c:d0c9:8ff6 with SMTP id kk12-20020a170903070c00b0019cd0c98ff6mr2636227plb.60.1677249867255; Fri, 24 Feb 2023 06:44:27 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id b5-20020a170902a9c500b00186748fe6ccsm8911549plr.214.2023.02.24.06.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 06:44:26 -0800 (PST) From: Ranjan Kumar To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: rajsekhar.chundru@broadcom.com, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, Ranjan Kumar , Sreekanth Reddy Subject: [PATCH 09/15] mpi3mr: Wait for diagnostic save during controller init Date: Fri, 24 Feb 2023 06:43:14 -0800 Message-Id: <20230224144320.10601-10-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230224144320.10601-1-ranjan.kumar@broadcom.com> References: <20230224144320.10601-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the controller reset operation is triggered to recover the controller from the fault state then wait for the snapdump to be saved in the firmware region before proceeding for resetting the controller. Signed-off-by: Ranjan Kumar Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpi3mr/mpi3mr_fw.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index e9b3552ccafb..936a6edb00f4 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -1201,7 +1201,7 @@ mpi3mr_revalidate_factsdata(struct mpi3mr_ioc *mrioc) */ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc) { - u32 ioc_config, ioc_status, timeout; + u32 ioc_config, ioc_status, timeout, host_diagnostic; int retval = 0; enum mpi3mr_iocstate ioc_state; u64 base_info; @@ -1255,6 +1255,23 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc) retval, mpi3mr_iocstate_name(ioc_state)); } if (ioc_state != MRIOC_STATE_RESET) { + if (ioc_state == MRIOC_STATE_FAULT) { + timeout = MPI3_SYSIF_DIAG_SAVE_TIMEOUT * 10; + mpi3mr_print_fault_info(mrioc); + do { + host_diagnostic = + readl(&mrioc->sysif_regs->host_diagnostic); + if (!(host_diagnostic & + MPI3_SYSIF_HOST_DIAG_SAVE_IN_PROGRESS)) + break; + if (!pci_device_is_present(mrioc->pdev)) { + mrioc->unrecoverable = 1; + ioc_err(mrioc, "controller is not present at the bringup\n"); + goto out_device_not_present; + } + msleep(100); + } while (--timeout); + } mpi3mr_print_fault_info(mrioc); ioc_info(mrioc, "issuing soft reset to bring to reset state\n"); retval = mpi3mr_issue_reset(mrioc,