Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3915209rwi; Sat, 22 Oct 2022 02:07:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6AH2RxiLfoZ2X3cvqzLRMVl2ckkSdk5ryG3ZablIqalzM4CrWDU80gA0tLtvOVXqrX5GNL X-Received: by 2002:a17:906:5dac:b0:78d:fa65:a4a9 with SMTP id n12-20020a1709065dac00b0078dfa65a4a9mr18549220ejv.223.1666429667029; Sat, 22 Oct 2022 02:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429667; cv=none; d=google.com; s=arc-20160816; b=QiJ7lbZsDbxnTzJBOewu4QbcONaIlLiv0EUIcIa2pm8dIP3Uy640Me6yzvpHZobmGh I/rI1o6x5nvhepuU7KzhvZQfgd8mS5iNwhZMLxfIYJjG45hxRvkZydg9QP7EC+mswyAw CrSuzcidXVssqNf77ocaj2tsaZZgEtQ79yB/vH9PqLUDoSPM9WZ5iBqrmEQ1tFPl+Z9t yXVixm+DcrouLl78W3LNezMIggsLXOipiDyVSe4Xob594UAH+Owl3nS9mfTWK2QZTOLH HDuGGdSob3XA8TMMD+nALK0Fh8ywNULvhx18zsQfzntxN8kZkPFVA/Fn81BJsUyTZqey zAbQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h17-20020aa7de11000000b0045992feabd9si18685017edv.132.2022.10.22.02.07.22; Sat, 22 Oct 2022 02:07:47 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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) { -- 2.35.1