Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp888967rwi; Wed, 19 Oct 2022 04:21:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LPuZVmSfjXD0dV4uNcKRHlOCzmE2eJHlt5wXRr/EPiKVyHzayySgocJk5l/sS8I+kDNYc X-Received: by 2002:a05:6402:26cf:b0:45d:48d7:928e with SMTP id x15-20020a05640226cf00b0045d48d7928emr6709906edd.275.1666178486513; Wed, 19 Oct 2022 04:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178486; cv=none; d=google.com; s=arc-20160816; b=IcJmt8DaA43SAX8SQrf2E5EgonJYBBvkJkW0HtcyTwxwaiKrpigHbSLxXs7zj0tjgu yPcg7pa2p8/qM3ArIJcBRLm7fbc+tC+uXC3OHhFEvPfiCTzxsKbEGhfdjZQvTPEnYh6I Nmu0gJBfBgcxAhjcVSxlBvLjfGyLe4S5if8M05i9xeh0zJe3+gw5/HUNMOMPFMwUjwtH 6SHXmIuVmvRbTLYo9A6PNisqdO2qB2OB40r7xL9a52T/WdgWKQgyD7+og3r/go/wHhmw Id2joJOXBdCsweUPbpengiVzczkdW1gEyHCcJC3aNf2Oj8BSg15KXGSgpJhT1vaIEtRy IYzw== 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=nki1y1DMsRFEYFhPnOF0TVWggcZmELsmPUWXCfYbH4c=; b=RP5NwF4Ks4mOC5J9u9WPqyyE4RXFAHQ56wAr9HZHP79+s7kGhj982rTRVrPp6l9LTm GZaJpyk88U2QsbogNg99Ji/Z7hkJ8DMyv41uPVB6rTQxv/rRdF7P2xdelETNhR1OSBGk lvPyeRNqm6/NeumQ5G9UFzp32brWoDyDftD2WvR0nOHH2e8szyPQ5Y/AWI27n0XCQ+mt QTni+IWncSfp4ME/6O1RN8g2uXoUVenTK9p5ZUk/bdqBlBVj2+YhG+z3C2XYvAH7oN9c 6J3hjwtFXegJsBNDA3HfeRzFhTJFIWNrpyqAlqPfcXMVPp4OMrq0VN0friRsuXiDCKU7 y2bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EB2eA8dc; 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 k16-20020a170906971000b0078307781936si12176493ejx.359.2022.10.19.04.20.32; Wed, 19 Oct 2022 04:21:26 -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=EB2eA8dc; 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 S232845AbiJSLFV (ORCPT + 99 others); Wed, 19 Oct 2022 07:05:21 -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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 c1e0a1d96cd4..f3791a589b01 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; @@ -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 = 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