Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp119098imn; Mon, 25 Jul 2022 11:28:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vzWByQLiSAh8NG8lSnFdh7mH8Q+oKicWvCD9oHrro2TV8CLTIm6CaMBDw34aO5fcgZMU+U X-Received: by 2002:a63:d441:0:b0:41a:861b:e037 with SMTP id i1-20020a63d441000000b0041a861be037mr12380758pgj.118.1658773724857; Mon, 25 Jul 2022 11:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658773724; cv=none; d=google.com; s=arc-20160816; b=qDjpatNR8EFJuHIHH5aKabmh90gRu4SGADnylSDEp/yFuegw1ndYs1qPWN46zsQkTH uekJMpDOHPEQ+WGMyLEdRKRWv7mA1AduL77W4yn25AamzDDqaTyZYtA31MSfXbeQeuKD 9IEtFzuV5ua4ErJsBkcGQmDqldmTyzX/8SwTGVAxjxM/hWtvFu4lX64nFJ7PC0bDS9t9 pRakDgkhi1EgmRk3FPNLsUfsLqC3zgNIOHc6oeG45zdEy/aH11ZOaVmZBLD2vJeEHd7f 0goH7kQ9TQaN11fKj7f2czJ0vpoEIMVZa7qExW06U+43DzPVYZhMbr1i+hqkNMZRw/8X o0/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=96wT5nSr/qQDUcFqOd+X20ld3GIyz1ATCrRZWBCuCRY=; b=TKR2JCn3pdfEe+NJ2lf69I1+cPZOF736Z6NwYxwTXmqG3LDkU9hreu0iQi89oHNmVT 8U9GykxdeoADxXP20qB6TJNQDz+meu1nTzh4HPNWoqOmnUG2qZqrs1dVfJcDKd2Poo9W YJBeqEJcsqjWI7nn3JGNy4l+OwwkfzeUEIgQUa8xpfLgmMvp2OT9kK5c2PDz5I4mYfhw mojrTjZDV3RG9fk+9o4qtAXRrbv7l7dNpS9eP/s1aCdgVDS0K6sY1jzvK4hozkLq7d4+ xF+er8PDzhpyNsdhv5UTdAFwuqUoLb5VUPS2rYUDcNAqv0iXPzUMPx9gxOz5d5n8DS6r xE7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I8mvqZZn; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s37-20020a635265000000b00411f3d72b41si15737755pgl.506.2022.07.25.11.28.29; Mon, 25 Jul 2022 11:28:44 -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=@intel.com header.s=Intel header.b=I8mvqZZn; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235220AbiGYSNh (ORCPT + 99 others); Mon, 25 Jul 2022 14:13:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiGYSNg (ORCPT ); Mon, 25 Jul 2022 14:13:36 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EA15DF4B; Mon, 25 Jul 2022 11:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658772815; x=1690308815; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=W1W3K6HtndLxG/12lj9ntiMcXN03GrPr2INAm/PqZW0=; b=I8mvqZZnQb6BLS4RNVokv6c6Ho5GkbL9Julcnws03sVD/l4znFW0oJO8 701hKDQbkDAEg8zDDmCK/OrefLnb5tmAOV0tP0FbS1zqaIijzvxQu8tub 78dz13qfXfI5lcqnncKpY3cArKR4/vgUsJto6+L0mPDpZ0gpSY6yyBV+K tUYp3COea2JJQsZ+clabqadtWLwFSOYhDECdK9WCGnL2Pk6ShM90CHYS/ ING5vUsrXSKxb6dNUdDNafTTMMM4OsBKBR4KUMdhtaEPG90mGtqwyMTwv axvJY6cVGiG73D5vW9swyLQhxp0KZad2oToimUn5IHv6wXDfY8YY7L/jU Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10419"; a="288521824" X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="288521824" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2022 11:13:35 -0700 X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="575153907" Received: from mgarner-mobl.amr.corp.intel.com (HELO [10.209.39.177]) ([10.209.39.177]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2022 11:13:35 -0700 Message-ID: Date: Mon, 25 Jul 2022 11:13:34 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.11.0 Subject: Re: [PATCH] PCI/ERR: Use pcie_aer_is_native() to judge whether OS owns AER Content-Language: en-US To: Zhuo Chen , ruscur@russell.cc, oohall@gmail.com, bhelgaas@google.com Cc: 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 References: <20220725160131.83687-1-chenzhuo.1@bytedance.com> From: Sathyanarayanan Kuppuswamy In-Reply-To: <20220725160131.83687-1-chenzhuo.1@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 On 7/25/22 9:01 AM, Zhuo Chen wrote: > After commit 7d7cbeaba5b7 ("PCI/ERR: Clear status of the reporting > device"), the AER status of the device that reported the error > rather than the first downstream port is cleared. So the problem > in commit aa344bc8b727 ("PCI/ERR: Clear AER status only when we > control AER") is no longer existent, and we change to use > pcie_aer_is_native() here. Can you add the details of the problem you are referring to? Also include details about how this problem relates to your commit. IIUC, your commit replaces "host->native_aer || pcie_ports_native" with pcie_aer_is_native(dev, correct? If so, add a note in commit log that it has no functional changes. > > 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(). > > Signed-off-by: Zhuo Chen > --- > 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; > > /* -- Sathyanarayanan Kuppuswamy Linux Kernel Developer