From nobody Sat Oct 18 02:15:34 2025 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 B0183C43219 for ; Wed, 19 Oct 2022 11:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232723AbiJSLFX (ORCPT ); Wed, 19 Oct 2022 07:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234893AbiJSLEM (ORCPT ); Wed, 19 Oct 2022 07:04:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 047D914EC58; Wed, 19 Oct 2022 03:33:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21874617F2; Wed, 19 Oct 2022 09:15:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39BD2C433D6; Wed, 19 Oct 2022 09:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170908; bh=3t7YvvkwEOPmixL8bgqdKSwqQRF35jS7csXR8qeViUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EB2eA8dcYVU9/gkA4zioVNq3W9DNUGAxdsfYwr/gaSNlc2ZN5TfdxObtBwXcru7ar xnWEa0XPqC99FOw0/i/fbA12BbFxLTsvPGoI0jG2nNTKZ33to3EBCc7r4+stEidB1M RSNJzHZUi4gCEdVpoZLLwY5x37a7E9OJPOTqWlOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Guenter Roeck , Joel Stanley , Sasha Levin Subject: [PATCH 6.0 833/862] hwmon (occ): Retry for checksum failure Date: Wed, 19 Oct 2022 10:35:20 +0200 Message-Id: <20221019083326.697191417@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eddie James [ Upstream commit dbed963ed62c4c2b8870a02c8b7dcb0c2af3ee0b ] Due to the OCC communication design with a shared SRAM area, checkum errors are expected due to corrupted buffer from OCC communications with other system components. Therefore, retry the command twice in the event of a checksum failure. Signed-off-by: Eddie James Acked-by: Guenter Roeck Link: https://lore.kernel.org/r/20220426154956.27205-3-eajames@linux.ibm.com Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/hwmon/occ/p9_sbe.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c index c1e0a1d96cd4..f3791a589b01 100644 --- a/drivers/hwmon/occ/p9_sbe.c +++ b/drivers/hwmon/occ/p9_sbe.c @@ -14,6 +14,8 @@ =20 #include "common.h" =20 +#define OCC_CHECKSUM_RETRIES 3 + struct p9_sbe_occ { struct occ occ; bool sbe_error; @@ -80,18 +82,23 @@ static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx= , const void *resp, static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len, void *resp, size_t resp_len) { + size_t original_resp_len =3D resp_len; struct p9_sbe_occ *ctx =3D to_p9_sbe_occ(occ); - int rc; + int rc, i; =20 - rc =3D fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); - if (rc < 0) { + for (i =3D 0; i < OCC_CHECKSUM_RETRIES; ++i) { + rc =3D fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); + if (rc >=3D 0) + break; if (resp_len) { if (p9_sbe_occ_save_ffdc(ctx, resp, resp_len)) sysfs_notify(&occ->bus_dev->kobj, NULL, bin_attr_ffdc.attr.name); + return rc; } - - return rc; + if (rc !=3D -EBADE) + return rc; + resp_len =3D original_resp_len; } =20 switch (((struct occ_response *)resp)->return_status) { --=20 2.35.1