Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1166376rwb; Tue, 27 Sep 2022 09:13:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QziNsqyYpD4OWDF/72E4sE2OBDMwxvN0U5bF9BACjHUknNnTyJd/Se3q8ERHmWAy9fHv3 X-Received: by 2002:a17:907:c25:b0:782:9dc8:eef1 with SMTP id ga37-20020a1709070c2500b007829dc8eef1mr19891162ejc.667.1664295205208; Tue, 27 Sep 2022 09:13:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664295205; cv=none; d=google.com; s=arc-20160816; b=Rzh38vwvBxkswgAxtMFL5+TpE7pm5B2337wSHSR3JpmsT5bm6p9UvnXbtd6GI1wMBT VPg0bkPA/oZKyH+BCqPGfdORG18hAfYhW6QU+m5V72WdAWuKOH98WTjBTAhi7kKJANrJ zdH6ea37wxp3iUoUdx8C+KZl+2U46JjFKT/nhlS5teFqFTB5PrcBhoYkMVLFza5NUZpX F9VxFNfYJjX8nqIeMIUQQqjEvhpf2vB3RFLgyw8DD3FKC9cmudrgrF26izAMlPlmSbQO XCJunKwd7m8tlFqUfKBE6iLBlGzdHgkEugl+0fJLPC1U++EtHpMf1pzYgkbEtq9e2NE3 IDaA== 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=u9XQU41RsTUx8hAj0GByCivfHFYNLe/LcJ7HOx2cRk8=; b=yRQsFQujla4zVFVj8g1Yen+Ar9WvmgiO/Qs3dqQRBRM3EEMYZOA74WfSAmUgcBwzVE 352CciA0XWLlNGf83dDp/KJRqhIp1qIJc1BwSJCYr/Lcldev5Cnnnf1lRdJukO8VIKXT XKGDoCWufQCr/dPOj5+aH6Nl3PuVPAN5DroLuWLCTjLkKZxqfYp717GhP+6gQG58oarP 12GaCPdiUxm8dGEUPk6wSzJBIEoMQB5nPINFhEjBEuK0zjKqBX3vom+SYgYZlOqq/J4A /JhdUTcS/k/s80whxmCXiuYXe9Tpq9WZdjbVLKWIwxfe6w3ia99LUSWGroVoT01Ah2WW dOVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=fsCBG+DP; 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 jg5-20020a170907970500b007307fa2da78si2143718ejc.450.2022.09.27.09.12.55; Tue, 27 Sep 2022 09:13:25 -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=fsCBG+DP; 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 S232844AbiI0Pke (ORCPT + 99 others); Tue, 27 Sep 2022 11:40:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232693AbiI0Pjl (ORCPT ); Tue, 27 Sep 2022 11:39:41 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 968DA1CFBA1 for ; Tue, 27 Sep 2022 08:37:42 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id y136so10036956pfb.3 for ; Tue, 27 Sep 2022 08:37:42 -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=u9XQU41RsTUx8hAj0GByCivfHFYNLe/LcJ7HOx2cRk8=; b=fsCBG+DPjSI2nTALjsV1M/duBiunTKI6jkFKOOGmtIR6r5bAo2o2uEDMVUtUArXGVW fTKfg77exYvCPT+Mzd0FRfvrUOIrPM0DrH3XCnFfLmLZAzuiZ2q+x3gMaVyQqyuZbgoc mGw37ZG9ieu06mhPTRrMnhx0rx5zACS7/QMWCatKRH3/B8MceesI9gSMJlvNlTGtys+s ZpK4iFTZ+b88nfx2U5yAVmqtVht2gc9J38/VXFStCvpAzAuNNnvoupyJoxQ0dC/t5q0l 0LCVpcQakk9Ng6ATtk5ggTfQOe2Fv4tFHfwKswt99YRJayi96CpsLFwM80CWJJkYBuZB ajRw== 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=u9XQU41RsTUx8hAj0GByCivfHFYNLe/LcJ7HOx2cRk8=; b=5DzJg1egtPKVy62n89Ctham5fBjUUZg6IJhQrmRHMfUdQCKuHeDxF+L3ua0OPmW1X+ f9ndzSZXaTgzOUhBS+O8kYRqXqxwQ5s1omv4sISnytBlYevMx0h4K390JCcDJdI434K7 f4B5tWZ3nMO1n6JJELpUREFGZbQHNDqIJOZmDobLuqh7yTFYNIv0LeGrHJngUJZjQDDN lx5gAZ6sqvARDYe9EqboSNHf6lzcYc5IyBbwSIx3XYTUPZ++/VIPDKKxkJi9aiM9Ek8Z JPzRk6cFBl1Hrpvz30fr39LFVHcufnK/bh+WJsDKmTmk97wsICkc/MwEVxWVECs7irLw jb7Q== X-Gm-Message-State: ACrzQf2HWyDukmpEb7gG860x2PsS1cmSFPEtPwGhQPyo/MHx3GSU4ix1 GkxSSCscB99WxR2SGcR2ByX1ow== X-Received: by 2002:a63:d40b:0:b0:43b:e86f:d384 with SMTP id a11-20020a63d40b000000b0043be86fd384mr24815734pgh.167.1664293032304; Tue, 27 Sep 2022 08:37:12 -0700 (PDT) Received: from C02F63J9MD6R.bytedance.net ([61.120.150.77]) by smtp.gmail.com with ESMTPSA id w16-20020aa79a10000000b0053639773ad8sm1933087pfj.119.2022.09.27.08.37.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Sep 2022 08:37:12 -0700 (PDT) From: Zhuo Chen To: 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 v2 7/9] PCI/AER: Use pcie_aer_is_native() to judge whether OS owns AER Date: Tue, 27 Sep 2022 23:35:22 +0800 Message-Id: <20220927153524.49172-8-chenzhuo.1@bytedance.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220927153524.49172-1-chenzhuo.1@bytedance.com> References: <20220927153524.49172-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 Use pcie_aer_is_native() in place of "host->native_aer || pcie_ports_native" to judge whether OS owns AER in aer_root_reset(). Replace "dev->aer_cap && (pcie_ports_native || host->native_aer)" in get_port_device_capability() with pcie_aer_is_native(), which has no functional changes. Signed-off-by: Zhuo Chen --- drivers/pci/pcie/aer.c | 5 ++--- drivers/pci/pcie/portdrv_core.c | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index e2320ab27a31..a6d29269ccf2 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1403,7 +1403,6 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev) int type = pci_pcie_type(dev); struct pci_dev *root; int aer; - struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); u32 reg32; int rc; @@ -1424,7 +1423,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev) */ aer = root ? root->aer_cap : 0; - if ((host->native_aer || pcie_ports_native) && aer) { + if (aer && pcie_aer_is_native(root)) { /* Disable Root's interrupt in response to error messages */ pci_read_config_dword(root, aer + PCI_ERR_ROOT_COMMAND, ®32); reg32 &= ~ROOT_PORT_INTR_ON_MESG_MASK; @@ -1443,7 +1442,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev) pci_is_root_bus(dev->bus) ? "Root" : "Downstream", rc); } - if ((host->native_aer || pcie_ports_native) && aer) { + if (aer && pcie_aer_is_native(root)) { /* Clear Root Error Status */ pci_read_config_dword(root, aer + PCI_ERR_ROOT_STATUS, ®32); pci_write_config_dword(root, aer + PCI_ERR_ROOT_STATUS, reg32); diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 1ac7fec47d6f..844297c0c85e 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -221,8 +221,7 @@ static int get_port_device_capability(struct pci_dev *dev) } #ifdef CONFIG_PCIEAER - if (dev->aer_cap && pci_aer_available() && - (pcie_ports_native || host->native_aer)) + if (pcie_aer_is_native(dev) && pci_aer_available()) services |= PCIE_PORT_SERVICE_AER; #endif -- 2.30.1 (Apple Git-130)