Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp363622imn; Mon, 25 Jul 2022 19:32:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uzS54mm9PhpWModeb+xx0wLcLWXDiYSMSLUQ+wjz4xWtSP6e2CjyhoBvduznCV3AIjCJwx X-Received: by 2002:a17:90b:4a12:b0:1ef:a8bb:b475 with SMTP id kk18-20020a17090b4a1200b001efa8bbb475mr17139480pjb.124.1658802720069; Mon, 25 Jul 2022 19:32:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658802720; cv=none; d=google.com; s=arc-20160816; b=fgqRwt2cDobb9a/ZkTBlJm0umgatHtVbRu9uyHAHEX5x9erzxTQXj1PObtKUqVrDeQ 8kzkgIElDkP15ztOQEWCfmqKNWPXsq9eH69/q6vq4Aklb8vyVMCFdX1jH8zpgOZ8Lkwx XnNz+M+zD7JhWiJbWXD5oO7yzM2f2lMepUzavvYSkdyreGiuz4QR/ms9cdnUUkTdeFdu BDdJpFbXr2a4tv7eIF90TkliUCretGLJv3tPB2Fv0gRMlSBENBM8LmSlyKaZRaMCcZY6 Gmp+4xYSSC1+j+ghJxoI44xIssAmXs17+GyXC1BBP6pbs0ix6H5eFTWENkr0VU3WOSrY z/1w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=PcLN0/0rRk3ozwmqISVR6hRqPCsf6L35JebQehRi1LA=; b=Q4w67tyWfgOHsgE6JSN+S5+STAp9unprmUQjAT2veP/JvnPpHWHDYAtBIzZ+ebTZ14 akAxTwR8zuZDav/XhSMDHLp8AoXFIMBP1w2YhyVZEBC3yb2X5rDY8frvchbrYK0Px5cG ZZ/BgCAQe4xMguY61f/8Zy1PIejYwKn6NMtKHG4uSqKwKq0pevGBc+Be8olZlCLjEse3 1V71XbdfVJgQCnkddawm2Rsko/F3ZgUMG4fqDJSxAUXJ5+vWB4kH8gtIPTXFDQyqpdPe AZGxIVzmjXCbOjJOZcS/Vo4t/sGkOGr38bxS0IY9e6K0GCVq7wuANIeHbGBuFafU0w6h F0gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="nTioK+/s"; 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 i18-20020a63d452000000b00415ea6aca03si14582622pgj.547.2022.07.25.19.31.45; Mon, 25 Jul 2022 19:32:00 -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="nTioK+/s"; 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 S234254AbiGZCFl (ORCPT + 99 others); Mon, 25 Jul 2022 22:05:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230418AbiGZCFk (ORCPT ); Mon, 25 Jul 2022 22:05:40 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47DB1764D for ; Mon, 25 Jul 2022 19:05:39 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id e16so11988306pfm.11 for ; Mon, 25 Jul 2022 19:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PcLN0/0rRk3ozwmqISVR6hRqPCsf6L35JebQehRi1LA=; b=nTioK+/s3DBU4jhK/bp6W9HoNaLbn9VTPFlcs/nnOeaSY3yYsAwlorbKuiVR7waFli AxujWyUJgbFWM1RSWzgWAot6NAd4pZCKLsDvc0HoF7s+VR5bgVgLdNXLJPLxIyzHIRK4 dZTAKNdgCB93tMvwtYmp03T0eThljIHTh6fSfcaZulw0c/dHrvS+dfJJOU2Vek4SJ9P9 RIm02AJVXfyvtCeoZx6qBZIxr8dWPSUmMt8ey9XYpzEl4vsh4ETs7Jwhzi3CAIH58g4Z je5gG6n2jX+D76groH6t8w6Ym4ZwYL7z4ZhI/ZxwWmin5anmjrCyI5e1VsfJpb2RWXti 1jiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PcLN0/0rRk3ozwmqISVR6hRqPCsf6L35JebQehRi1LA=; b=M3AvwXEbRbjan+CXWgeS+dEeNv4kObrpzRL+1pmiS+x+tkzXOK2L0AMXwTlEzCpcUs rYtCcQe4RxH2+exBvbSvQ9ShgoaXtUjCP9Po0koGLjzLWaCJVFON4Zpnf+/3MTOFFWcq hyTJ4v2YErROMBZpsFIJ8XnKJngDtmxRbOiVd/FLVufQ7j5KGSpRhT9sxgnwiU4P78uj UARiec8WqMv3rHaZOgAaOtHn7B7KFMyec1nos1FJ9bdHm1zVb7dQszkow9Xmiq1ziOkT 50YHtAW6EPuKCy38d5/6MCkbxMK/2CEiJ6aeGENOMkfk2AR3s1CGiskD5sA03SYdCRii HoMQ== X-Gm-Message-State: AJIora99QJL+0/fgkTTTdUu+C1DT+fnfGx+pX0ZV+t3i+cCO0/unOXNl YCuWm+vQtgJtb8kC40UZ+WMtKQ== X-Received: by 2002:a62:7bd7:0:b0:52b:1d57:e098 with SMTP id w206-20020a627bd7000000b0052b1d57e098mr15017966pfc.19.1658801138825; Mon, 25 Jul 2022 19:05:38 -0700 (PDT) Received: from C02F63J9MD6R.bytedance.net ([61.120.150.78]) by smtp.gmail.com with ESMTPSA id f4-20020a170902684400b0016bdf0032b9sm9834200pln.110.2022.07.25.19.05.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jul 2022 19:05:38 -0700 (PDT) From: Zhuo Chen To: ruscur@russell.cc, oohall@gmail.com, bhelgaas@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Cc: chenzhuo.1@bytedance.com, lukas@wunner.de, jan.kiszka@siemens.com, stuart.w.hayes@gmail.com, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] PCI/ERR: Use pcie_aer_is_native() to judge whether OS owns AER Date: Tue, 26 Jul 2022 10:05:27 +0800 Message-Id: <20220726020527.99816-1-chenzhuo.1@bytedance.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) 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 The AER status of the device that reported the error rather than the first downstream port is cleared after commit 7d7cbeaba5b7 ("PCI/ERR: Clear status of the reporting device"). So "a bridge may not exist" which commit aa344bc8b727 ("PCI/ERR: Clear AER status only when we control AER") referring to is no longer existent, and we just use pcie_aer_is_native() in stead of "host->native_aer || pcie_ports_native". pci_aer_clear_nonfatal_status() already has pcie_aer_is_native(), so we move pci_aer_clear_nonfatal_status() out of pcie_aer_is_native(). Replace statements that judge whether OS owns AER in get_port_device_capability() with pcie_aer_is_native(), which has no functional changes. Signed-off-by: Zhuo Chen --- v2: - Add details and note in commit log --- drivers/pci/pcie/err.c | 12 ++---------- drivers/pci/pcie/portdrv_core.c | 3 +-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index 0c5a143025af..28339c741555 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -184,7 +184,6 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, int type = pci_pcie_type(dev); struct pci_dev *bridge; pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER; - struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); /* * If the error was detected by a Root Port, Downstream Port, RCEC, @@ -237,16 +236,9 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, pci_dbg(bridge, "broadcast resume message\n"); pci_walk_bridge(bridge, report_resume, &status); - /* - * If we have native control of AER, clear error status in the device - * that detected the error. If the platform retained control of AER, - * it is responsible for clearing this status. In that case, the - * signaling device may not even be visible to the OS. - */ - if (host->native_aer || pcie_ports_native) { + if (pcie_aer_is_native(dev)) pcie_clear_device_status(dev); - pci_aer_clear_nonfatal_status(dev); - } + pci_aer_clear_nonfatal_status(dev); pci_info(bridge, "device recovery successful\n"); return status; diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 604feeb84ee4..98c18f4a01b2 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; /* -- 2.30.1 (Apple Git-130)