From patchwork Wed Oct 19 08:35:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264472wrs; Wed, 19 Oct 2022 04:20:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4x33KP7WoO+IeUUmIIRwCZPejNBb5895/0jgKIqwdIruTttTVwFXH/uIOK8BXuCVisgRwJ X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr7022928edb.249.1666178406583; Wed, 19 Oct 2022 04:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178406; cv=none; d=google.com; s=arc-20160816; b=YReb6GBmgWV77ol2bGvhrqGUlsW9YE/XbtnzobGF24lt3kk/fHfGd8kHvooVpPWca+ IBtHhQPdPYR53lsyj91LCT/9Moou5ij/ZdAOZ54VboTkGCqtuYZHxoyNw3E1ILI0WDUr qLBDcGHk/gBrA+23/M+xvJjXoK16jmkfuKgU9NAVc8Wj+BjixLQC5o9gC7SrynXXJUq4 b8vmPn2zYgmiwdfQ8vSAUSJdgk6kAec40yUfw23/7f2oEOkBZjJF4n+3sX62SLr7pmyp nNov6g4QTGOxrwnkcJFq4WCV2fWEsIq/3ctrFfHqKB2BnzVOH7H+loUMOWtSYkq8663x YGUg== 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 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.19.41; Wed, 19 Oct 2022 04:20:06 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114688889170314?= X-GMAIL-MSGID: =?utf-8?q?1747114688889170314?= 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) {