From patchwork Sat Oct 22 07:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109921wrr; Sat, 22 Oct 2022 01:50:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7C0J3kzGcOxOwUFF0q+qOvAQLN75eJFcfcgLU95BhyjVvzDsd4MWVpVI9cxhkeH5Z9tjxR X-Received: by 2002:a05:6402:528a:b0:454:8613:6560 with SMTP id en10-20020a056402528a00b0045486136560mr22177773edb.252.1666428636272; Sat, 22 Oct 2022 01:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428636; cv=none; d=google.com; s=arc-20160816; b=lIthKM/j4n/d59LFkPx/2YMf31jckdm+t2ISBbVyPI7Z/a7rLDuHXnHKdgoi4TURIl TsfyUSBHaqHHYjwYevyjnY/Rd8CvSPVFllga6fBos1PCsBmt070g/HcXgj26XxzTRbow fciKLZD/gvfwcQstIdPx4cpN7kd9jZlea9Ha6HM75LEgHi7hpGau/RJv678Ve5DFXspu FtFdRWdAXq1Kmw6FZ+hrrutvbvLZDMQLytmuWG9LvOfHYL4gkWNVycJnlitVNOItF3Fv 923GnB1IZGXL0JkJuwD7FQ7iar53cP2vCZLXw8nRx5LVWVpSWdaKxBnI9L4C4qTBE8nx EjhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bdGvK854tInQzKtgucNCQHvT3Q/SDwUJ44B/aMoVN2s=; b=ScwjpNPgRxs330VLtf8zyJnkl8V76sp7z3ChfqLrXF3v2hiQYQgqZZWaoiKvu5sRMk XL7OfeDb20b3k06J9hsw6wriCZs+/Aj+tffNnv5nhOCDKBUyMuie5pL4ZMW49Dku0W8S BUpxYITdXLU26U6iTcCbO0tJeFbAbHKNfXYxUobIrdF8xPImwAvkL4qPzyIj2om19CTB K02hEOWEYj/YW76emDAzZtjjPRT7C88eS7GeXU00v5G8k0YYq7da3SeQhyuS0+XH1xoo XQ/B1PcvphkUEn3XPUrWdmSMSDfPPN7aCCoiNkKZIX03S3y1orUGzmY8uizZk6ddjc50 zggA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AhQrvyxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a056402280100b0045cb68ca4ecsi28295856ede.37.2022.10.22.01.50.12; Sat, 22 Oct 2022 01:50:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AhQrvyxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234780AbiJVIs5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231969AbiJVIq3 (ORCPT ); Sat, 22 Oct 2022 04:46:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C8727170; Sat, 22 Oct 2022 01:09:43 -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 2768F60B93; Sat, 22 Oct 2022 08:08:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26150C433B5; Sat, 22 Oct 2022 08:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426105; bh=Nu/8SgC7SIH9saHjokos5h2G6lpvcu/bw7NjIhvY4m0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AhQrvyxojQDS7FN/qnjz54KrR8jKltFgtU7rbxO4wz8MV54OYy/tSqufuZ01VFDwS S8qNnin7VCGd0LCZ7tiY4y52Gqar7nt46r1DOkE2nLopYi0e8siNgcM5RXJZRtXZIB OvYS+heLhRW9vEAxkUjx6NhWE0Wwnzm0n3CSUE3w= 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 5.19 690/717] hwmon (occ): Retry for checksum failure Date: Sat, 22 Oct 2022 09:29:29 +0200 Message-Id: <20221022072529.012389948@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747377073897564573?= X-GMAIL-MSGID: =?utf-8?q?1747377073897564573?= 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 a91937e28e12..775147f31cb1 100644 --- a/drivers/hwmon/occ/p9_sbe.c +++ b/drivers/hwmon/occ/p9_sbe.c @@ -14,6 +14,8 @@ #include "common.h" +#define OCC_CHECKSUM_RETRIES 3 + struct p9_sbe_occ { struct occ occ; bool sbe_error; @@ -81,18 +83,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 = resp_len; struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ); - int rc; + int rc, i; - rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); - if (rc < 0) { + for (i = 0; i < OCC_CHECKSUM_RETRIES; ++i) { + rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); + if (rc >= 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 != -EBADE) + return rc; + resp_len = original_resp_len; } switch (((struct occ_response *)resp)->return_status) {