From patchwork Tue May 23 21:41:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranav Prasad X-Patchwork-Id: 685845 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 53A1EC7EE26 for ; Tue, 23 May 2023 21:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234835AbjEWVls (ORCPT ); Tue, 23 May 2023 17:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238288AbjEWVlq (ORCPT ); Tue, 23 May 2023 17:41:46 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA40FA for ; Tue, 23 May 2023 14:41:45 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-561f201a646so3829577b3.1 for ; Tue, 23 May 2023 14:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684878104; x=1687470104; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/zFD/sWJ5X0Do7uK1EvSSeUTvJhq9b59SmXRDn2sIn4=; b=TjM3N2YQOZ1c6QUEWJ2gRFeAs13Q1W9t1jDZOdVrzBU6CbUqi7nHykV1m6JwcXHVJP 5JWnTPKBI1VX76C5DYEhlVsMFIuz5LxoXP5IuEj3gCYjvlCjxityOZY23sT377bDYNzv zQ72uUFMHqWBjAEg3vu8biDuzrfuAusAdTRT71/hzPZDV8b55XErO+bgiw/uqgcrII9G skZ28g6UxTRxH6tOBABS2nFtvP0j6Yzh53KqL1x/YCA72JA6WXA0Ya8a2q9b/WZ2y1wV 4xiJiJUN8pJEpwYwKgAf0Q+XU8MMKxd1CDDGWdXqcBHzxPfowQGH/4rjgHCvQCRmR6TI DlSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684878104; x=1687470104; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/zFD/sWJ5X0Do7uK1EvSSeUTvJhq9b59SmXRDn2sIn4=; b=gkPIhDFjmar6NNUUSUu9G7EQRjCyXHo7R8CAEUNhbRE+RAfcXvKq+pg1wniDJNGEcu ulcl+RbDkWclwyZyFm+XDdkoj0ov7JO8j+qRgCpqZ1JvXzoUEZdCAQnlx2i42WyzxlNC wl86namgkKjb2//VxKIT7JXfmX4xCwEcUgqPxly3PVKOXiHBDQu1oOqs+q12UdP5eJ3j KY7YK3cg2JJ2dPOLHhL+p5TGXYJC+8RL31xsWK054c86310ZsGiCFKyk/pn4gfiQGkSB rFZ/CyP+XVDy/idBKMewhpBpPREdPkSp2oXbFwlZio+uENwl28rqM0JyPllONNnzg1YY N57Q== X-Gm-Message-State: AC+VfDxjqnW1ojuLEKjZ4O0JxRfHCuqv4Oc8BLZ4wMRZB+Z2zwqv+RMs HY1FvQg7eVvaJ5hdqsxwj71FydAnCopD9A== X-Google-Smtp-Source: ACHHUZ5O+MF+h1p3utfJMCythPh6m4T4DvAAYW9sRJc3IBsXOEI6BvM7U9Pcvymsut/+66qg4gz2Whtf+mzhkA== X-Received: from pranav-first.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:390b]) (user=pranavpp job=sendgmr) by 2002:a81:a704:0:b0:561:bf07:ee28 with SMTP id e4-20020a81a704000000b00561bf07ee28mr9728612ywh.5.1684878104664; Tue, 23 May 2023 14:41:44 -0700 (PDT) Date: Tue, 23 May 2023 21:41:26 +0000 In-Reply-To: <20230523214127.4006891-1-pranavpp@google.com> Mime-Version: 1.0 References: <20230523214127.4006891-1-pranavpp@google.com> X-Mailer: git-send-email 2.40.1.698.g37aff9b760-goog Message-ID: <20230523214127.4006891-2-pranavpp@google.com> Subject: [PATCH 1/2] scsi: pm80xx: Add fatal error check for pm8001_phy_control() From: Pranav Prasad To: Jack Wang , "James E . J . Bottomley" , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Changyuan Lyu , Pranav Prasad Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Changyuan Lyu This patch adds a fatal error check for the pm8001_phy_control() function. Signed-off-by: Changyuan Lyu Signed-off-by: Pranav Prasad --- drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index e5673c774f66..b153f0966e5d 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -167,6 +167,16 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, pm8001_ha = sas_phy->ha->lldd_ha; phy = &pm8001_ha->phy[phy_id]; pm8001_ha->phy[phy_id].enable_completion = &completion; + + if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) { + /* If the controller is in fatal error state, + * we will not get a response from the controller + */ + pm8001_dbg(pm8001_ha, FAIL, + "Phy control failed due to fatal errors\n"); + return -EFAULT; + } + switch (func) { case PHY_FUNC_SET_LINK_RATE: rates = funcdata; From patchwork Tue May 23 21:41:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranav Prasad X-Patchwork-Id: 685284 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 B0747C7EE2E for ; Tue, 23 May 2023 21:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238599AbjEWVlt (ORCPT ); Tue, 23 May 2023 17:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238498AbjEWVls (ORCPT ); Tue, 23 May 2023 17:41:48 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E29013E for ; Tue, 23 May 2023 14:41:47 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-51b743d592dso194429a12.0 for ; Tue, 23 May 2023 14:41:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684878106; x=1687470106; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=p0y4TtuUdT60W21aKygGNQwI4gipZiKpcs4SNuMEkSY=; b=ssXbTfLiWJHzNKyW9cRLv4qJz0+wozWiG0m+T7u/6ikFqQa5Y1voVgqWwarbUqIA4B QOGC04YUxTx/kg90d6Y65h2gFL9dQ/u9STNqIgjXo8DmBHwII50n3e3q0pHw3cuN9t2A HYS7AzQLooXf0NDESkkjAvVK0LVfnduzvb2mGkfN17NuhdhrAOMHoIkw0ygPw2Xy0ill kZgs7ZSv+m2jod/FW+qOuDrpSIzv3CyPqc6/cKJsmeTeaDtRvoU0H2X9ooys5QbLADPK G0ycwST00lBJntyLG1Vk1zR6xO+8MY05IJFbFiSmfbk0OqQeS5vSRghj1LBju+M8ek0I SmhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684878106; x=1687470106; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p0y4TtuUdT60W21aKygGNQwI4gipZiKpcs4SNuMEkSY=; b=IhuI7W1gXMOp/nYxV/63Cht1FKJFgP9SHDFGpqg6rjri27Ays/ZnTg9K7L13jgWcL+ XVIekI377Aup0C7d0QwKAMn8bmt+COgVpZxZbsKaklGOW964XAeNqzOK31lnAJwkQxY6 +VXMuw2p9vhBPmnkpxD3TemLWs8CpyXmSYjunM1uiKRszujtncpnIzsDU4LnSaO8/65M 65yM4cBmQtrYQd3vw2oA/j2wTtEgAw8BGeUATkwZGbxtW/zbqwI8AO7yPyRTv0EzVkyB H9ebhU/oaGU/rjKHQMm6bCeB6EEjvTSL06cfFsq93aXXOpy9X6Q9/RTj3Gpo87F7uodv Xl3A== X-Gm-Message-State: AC+VfDyp0hpJ7vQ4YXyHdQb+sACIyZO65F3QyLQ1mSjw+W/CiLjv2lJV j7pFJpLp15zKZaAUtvm2gywJPScecb1GUQ== X-Google-Smtp-Source: ACHHUZ5WbWCRwFFb7/v5db2npTTTZeheQ9Ywyi+pn2dnNcfvDn7hCXLkYgl5gQEaWlkCabgD3PZgzaIkuZyHrQ== X-Received: from pranav-first.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:390b]) (user=pranavpp job=sendgmr) by 2002:a63:111a:0:b0:530:236e:1bfe with SMTP id g26-20020a63111a000000b00530236e1bfemr4372514pgl.1.1684878106282; Tue, 23 May 2023 14:41:46 -0700 (PDT) Date: Tue, 23 May 2023 21:41:27 +0000 In-Reply-To: <20230523214127.4006891-1-pranavpp@google.com> Mime-Version: 1.0 References: <20230523214127.4006891-1-pranavpp@google.com> X-Mailer: git-send-email 2.40.1.698.g37aff9b760-goog Message-ID: <20230523214127.4006891-3-pranavpp@google.com> Subject: [PATCH 2/2] scsi: pm80xx: Add fatal error check for pm8001_lu_reset() From: Pranav Prasad To: Jack Wang , "James E . J . Bottomley" , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Pylypiv , Pranav Prasad Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Igor Pylypiv This patch adds a fatal error check for pm8001_lu_reset(). Signed-off-by: Igor Pylypiv Signed-off-by: Pranav Prasad Acked-by: Jack Wang --- drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index b153f0966e5d..e302d5879bb7 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -918,6 +918,16 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun) struct pm8001_device *pm8001_dev = dev->lldd_dev; struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev); DECLARE_COMPLETION_ONSTACK(completion_setstate); + + if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) { + /* If the controller is in fatal error state, + * we will not get a response from the controller + */ + pm8001_dbg(pm8001_ha, FAIL, + "LUN reset failed due to fatal errors\n"); + return rc; + } + if (dev_is_sata(dev)) { struct sas_phy *phy = sas_get_local_phy(dev); sas_execute_internal_abort_dev(dev, 0, NULL);