From patchwork Tue Feb 28 14:08:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 657681 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 09010C64EC7 for ; Tue, 28 Feb 2023 14:09:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjB1OJH (ORCPT ); Tue, 28 Feb 2023 09:09:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbjB1OJE (ORCPT ); Tue, 28 Feb 2023 09:09:04 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38B4E3A8E for ; Tue, 28 Feb 2023 06:09:02 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id ky4so10576497plb.3 for ; Tue, 28 Feb 2023 06:09:02 -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=BkvNywLQA1LEffvNBLuzG6qT4Ha0dSCflwL/WKv/nlc=; b=YUHPIoS4XSmhIx3idMjeq/toBzsWHxp4CFQ0Ohd3Bf5KcjQo0T4PuNNA8HrNrz80eB pprMJxgKBdJhLD3WhKPLYfXApaXwMUR+J+GGMkig/E8q8vLbvOEkdPlpSbab4H5RlxZ6 Wayk7OnUErCdoHwr/s85uWakBgxefilTLV/XE= 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=BkvNywLQA1LEffvNBLuzG6qT4Ha0dSCflwL/WKv/nlc=; b=av3AUUGizgcuFK/m94AfxGVq5YJBqUiD7AZwh3mDqNMxiOo1egcqBdG9+hUmhnBKDd h35q++t7wHSqz9zxGTXzNymxl2q3kR00aZFd4a3TYnYOD9WdN10K4QYWd0oK9bC6Kgp7 oGDiRhHrYgdZX1FnS8HwbQldVQOy/xQxe//cEOFLy0OUlnKvGc+Z68fX78/QVdsInrMa dyv2k2WBHqwn4JvvpZAiU1OFdehZALn2S/oIS7BjEZU778+Q/KSCyh+aSlTlXTXzFWIa BXTZYusgxtXhKnpN4o65TacRLCSfo/SuzB5rrqptdE5m9GhpUMETY6lC8DvlzY904ITE A+IQ== X-Gm-Message-State: AO0yUKU/uCBQQsOpKyr23az1FJS137gDC63AS+NsNo5ExhwraE11ki2z 89pXp6SztnQESsGFXcNR9GlYKqwjpOll7bbuerEUam1I4RMGRdohV3dLG2WEqybxKTx6Mj/zJe3 p6qzpX0f123lPk9D7pG7NQKNeXUeBT4UcQ+mMfl7PoSxptHIaKFFVns0B0/TnVox1VgKbGUGgUB 35PSD3ffs= X-Google-Smtp-Source: AK7set9OIc1exP/rL+T7lAH+rsTM4x6J5MAxr3KZ/TpedOpecyv9wm3TjP8TfHqH4tRIK7ZpHfjFkg== X-Received: by 2002:a17:902:7c97:b0:19d:244:a3a8 with SMTP id y23-20020a1709027c9700b0019d0244a3a8mr2274268pll.10.1677593341339; Tue, 28 Feb 2023 06:09:01 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id ji1-20020a170903324100b00198e03c3ad4sm6625465plb.278.2023.02.28.06.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 06:09:00 -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 3/6] mpi3mr: Wait for diagnostic save during controller init Date: Tue, 28 Feb 2023 06:08:32 -0800 Message-Id: <20230228140835.4075-4-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230228140835.4075-1-ranjan.kumar@broadcom.com> References: <20230228140835.4075-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 e7ea3f7b9205..e5c0bc6d47d5 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,