Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp381201rwb; Wed, 28 Sep 2022 04:08:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4j0jKuluazRjYtn0p29ZvCUFUNjlegC4J0unKj7AkfEjMd8VEp0ahRm8QY3BA60LMctXYO X-Received: by 2002:a17:903:234c:b0:178:1a7c:28a5 with SMTP id c12-20020a170903234c00b001781a7c28a5mr30834055plh.32.1664363335471; Wed, 28 Sep 2022 04:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664363335; cv=none; d=google.com; s=arc-20160816; b=NBIjI28xMzCEb5o9Hij+yLOheTSKIRpheuO2i534DId2GWUHcT8vTGfPolROi+8wGp +ZZdyXkVIExD5XFDAaS30X9/nkMQEr19Ir5wY5YEGlMsbxoxYpa6wxZmwTunle+fx47F VIxpAJjp3JAXppqsS/QGqE77NnZNV7p7XyHJ+NE2dYyk8xHilj+yZ+loE6sLW/kgm98y mfrw4YixOr/sYPQ9heBg5a5caFTZLCigzuXNmicABzixpFD8MChJRsdngOMuMHb1tosr dnRXY0OfDCYfEwUIIW7kLrww1u2iD0N703x9G1rFoJbmsgBYzP2/34nweRoe+wrwqZqi Oh8w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/lUorqWHVGRnAT88EYIdYelQLnJZ6JU0rZvIuXw4R/I=; b=zTdY4eBT4vHiaQo2fPMQ0PJ0t5X7acXPXKfga2uogasbMd8NsdibhAndeYjaTJcomP 3HlZ0JZDVQY5Iw9UWapTrWxuknIzZevLdzHh1sK5Y+i3nYCrHetHeivnkZubGUFJ91cd pYhHX7Aw+UUFZSnbHQN9ccevB02blgXT5ZSzmhMAcwyazbHanzv9dx8APlZO5zkueZY8 09l9zzNuB9OVwIfh/96gLCwsMyfjt7Fdk0H9lj5CK2WOJNBF6c3PjZJpwR3Xhc3cqcTo RoBJq36L23cz/SIlSpitP9ZZOeF7jHqQsr9FYvCScvdE5lcCGQiaGqu3clhMWVeLCcPp VrmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=eFgcRFG8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a170902e5c900b00174fd2df917si5432508plf.101.2022.09.28.04.08.42; Wed, 28 Sep 2022 04:08:55 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=eFgcRFG8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234077AbiI1LBU (ORCPT + 99 others); Wed, 28 Sep 2022 07:01:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233969AbiI1LAt (ORCPT ); Wed, 28 Sep 2022 07:00:49 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92819816A3 for ; Wed, 28 Sep 2022 04:00:07 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d11so11464383pll.8 for ; Wed, 28 Sep 2022 04:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=/lUorqWHVGRnAT88EYIdYelQLnJZ6JU0rZvIuXw4R/I=; b=eFgcRFG8rZyt+ZzLjBVqt80mtlecZJilGFgBqp58JU1Th4+tjpU45u+gTrJURz6bU5 PZAKAIfYGUPeGJVCZmJg3vuzIfVwjnpOKC5ZUeOa4l5p7zXBugRQL+YNsLY/0707Lyn9 +qi4Uy0poKd8Sa4di3uUH+bWu2LaE4sKFOthWF/BkPiaa60pme+zM70DdJ8bi5BHQRrd zTgZFxfVJ1KS7X/LARzkICgCaD/+fH3z7w2NTbKIQJuAcpKztxzFV3FqhvJxhvv9Ztsp m+we2ILuvR+mw7GbnzjEDY/mut4/9s5b7+B54gO+wZHygWoM1S92vyJYtTH4k9+Pr7DT h49g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=/lUorqWHVGRnAT88EYIdYelQLnJZ6JU0rZvIuXw4R/I=; b=G8mvN0Xy4bBe9N2Vo5lyx8s+rLEWEnWpCHZrWNfpU/7iU1tkE5idE7Z7DILotQAkIA 3bPeqn8sN1atLB8gQargnOmToUHuZejMDnCTXfazZqw4w+2E8a4/F03BbIE0NoVZwARo jI1Yomdo35Zw6K3HPBPXjm+X52/Y77ARHWf8D+9Vrs1TK4PJxEpAJ9RAzIzyqcBYG5qs 1KtTdXYWrJP/J3f4ge6oA3CKi2/nIrL49m2PBll8woYO9BpbYcg2cpE4mImYCgbjxZWQ t68Ev9ob+24FU626hnq6BJ5V2hGjac3vOIlEn8MxUyL27nfCidd1mJf4Sx8VDB+E/U7G IjLQ== X-Gm-Message-State: ACrzQf2I5InQMt6HFKJEsTRJ3tyt+4HItbJYguUcVImIjh7QBryRhj0X 2xrQez9hGffem19SwCRc+leAGQ== X-Received: by 2002:a17:902:e154:b0:17a:606:6431 with SMTP id d20-20020a170902e15400b0017a06066431mr1417596pla.107.1664362806820; Wed, 28 Sep 2022 04:00:06 -0700 (PDT) Received: from C02F63J9MD6R.bytedance.net ([61.120.150.77]) by smtp.gmail.com with ESMTPSA id b13-20020a170902d50d00b00177efb56475sm1539524plg.85.2022.09.28.04.00.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Sep 2022 04:00:06 -0700 (PDT) From: Zhuo Chen To: sathyanarayanan.kuppuswamy@linux.intel.com, bhelgaas@google.com, ruscur@russell.cc, oohall@gmail.com, fancer.lancer@gmail.com, jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: chenzhuo.1@bytedance.com, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ntb@lists.linux.dev, linux-scsi@vger.kernel.org Subject: [PATCH v3 1/9] PCI/AER: Add pci_aer_clear_uncorrect_error_status() to PCI core Date: Wed, 28 Sep 2022 18:59:38 +0800 Message-Id: <20220928105946.12469-2-chenzhuo.1@bytedance.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220928105946.12469-1-chenzhuo.1@bytedance.com> References: <20220928105946.12469-1-chenzhuo.1@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 In lpfc_aer_cleanup_state(), uncorrectable error status needs to be cleared, which can be done by calling pci_aer_clear_nonfatal_status() and pci_aer_clear_fatal_status(). Meanwhile they can be combined in one function (the same in dpc_process_error). So add pci_aer_clear_uncorrect_error_status() function to PCI core and export symbol to other modules which wants to use it. Signed-off-by: Zhuo Chen --- drivers/pci/pcie/aer.c | 16 ++++++++++++++++ include/linux/aer.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index e2d8a74f83c3..4e637121be23 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -286,6 +286,22 @@ void pci_aer_clear_fatal_status(struct pci_dev *dev) pci_write_config_dword(dev, aer + PCI_ERR_UNCOR_STATUS, status); } +int pci_aer_clear_uncorrect_error_status(struct pci_dev *dev) +{ + int aer = dev->aer_cap; + u32 status; + + if (!pcie_aer_is_native(dev)) + return -EIO; + + pci_read_config_dword(dev, aer + PCI_ERR_UNCOR_STATUS, &status); + if (status) + pci_write_config_dword(dev, aer + PCI_ERR_UNCOR_STATUS, status); + + return 0; +} +EXPORT_SYMBOL_GPL(pci_aer_clear_uncorrect_error_status); + /** * pci_aer_raw_clear_status - Clear AER error registers. * @dev: the PCI device diff --git a/include/linux/aer.h b/include/linux/aer.h index 97f64ba1b34a..154690c278cb 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -45,6 +45,7 @@ struct aer_capability_regs { int pci_enable_pcie_error_reporting(struct pci_dev *dev); int pci_disable_pcie_error_reporting(struct pci_dev *dev); int pci_aer_clear_nonfatal_status(struct pci_dev *dev); +int pci_aer_clear_uncorrect_error_status(struct pci_dev *dev); void pci_save_aer_state(struct pci_dev *dev); void pci_restore_aer_state(struct pci_dev *dev); #else @@ -60,6 +61,10 @@ static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev) { return -EINVAL; } +static inline int pci_aer_clear_uncorrect_error_status(struct pci_dev *dev) +{ + return -EINVAL; +} static inline void pci_save_aer_state(struct pci_dev *dev) {} static inline void pci_restore_aer_state(struct pci_dev *dev) {} #endif -- 2.30.1 (Apple Git-130)