From patchwork Mon Apr 20 21:37:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Derrick X-Patchwork-Id: 11499927 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2865C6CA for ; Mon, 20 Apr 2020 22:01:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A0492084D for ; Mon, 20 Apr 2020 22:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727019AbgDTWBN (ORCPT ); Mon, 20 Apr 2020 18:01:13 -0400 Received: from mga02.intel.com ([134.134.136.20]:16270 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbgDTWBL (ORCPT ); Mon, 20 Apr 2020 18:01:11 -0400 IronPort-SDR: ZOwC7V/bHnN92J1YgDnKPOCU0m2i9cZkK+Q/t0oDjCLkewrNRcpRQg/PuEZJuWY7R8znFt+cDY t5Tj7bSdKALQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2020 15:01:11 -0700 IronPort-SDR: B5K5EbZN/GSr4XUuymvuYRrd7HCa5RqMAPti5a6kXncsbreRaatYMRh8I0XZNELFVQPRkBhfRk 7rLmNZUQ5B5Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,407,1580803200"; d="scan'208";a="455848343" Received: from unknown (HELO nsgsw-wilsonpoint.lm.intel.com) ([10.232.116.102]) by fmsmga005.fm.intel.com with ESMTP; 20 Apr 2020 15:01:09 -0700 From: Jon Derrick To: Bjorn Helgaas Cc: , Keith Busch , Jon Derrick , Russell Currey , Sam Bobroff , "Oliver O'Halloran" , Bjorn Helgaas , Kuppuswamy Sathyanarayanan , Andy Shevchenko , Frederick Lawler , Rajat Jain , "Patel, Mayurkumar" , Olof Johansson , "Rafael J. Wysocki" , Mika Westerberg , Alex Williamson , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] PCI/AER: Allow Native AER Host Bridges to use AER Date: Mon, 20 Apr 2020 15:37:09 -0600 Message-Id: <1587418630-13562-2-git-send-email-jonathan.derrick@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587418630-13562-1-git-send-email-jonathan.derrick@intel.com> References: <1587418630-13562-1-git-send-email-jonathan.derrick@intel.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Some platforms have a mix of ports whose capabilities can be negotiated by _OSC, and some ports which are not described by ACPI and instead managed by Native drivers. The existing Firmware-First HEST model can incorrectly tag these Native, Non-ACPI ports as Firmware-First managed ports by advertising the HEST Global Flag and matching the type and class of the port (aer_hest_parse). If the port requests Native AER through the Host Bridge's capability settings, the AER driver should honor those settings and allow the port to bind. This patch changes the definition of Firmware-First to exclude ports whose Host Bridges request Native AER. Signed-off-by: Jon Derrick --- drivers/pci/pcie/aer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index f4274d3..30fbd1f 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -314,6 +314,9 @@ int pcie_aer_get_firmware_first(struct pci_dev *dev) if (pcie_ports_native) return 0; + if (pci_find_host_bridge(dev->bus)->native_aer) + return 0; + if (!dev->__aer_firmware_first_valid) aer_set_firmware_first(dev); return dev->__aer_firmware_first; From patchwork Mon Apr 20 21:37:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Derrick X-Patchwork-Id: 11499929 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D08276CA for ; Mon, 20 Apr 2020 22:01:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C312A2084D for ; Mon, 20 Apr 2020 22:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726532AbgDTWBQ (ORCPT ); Mon, 20 Apr 2020 18:01:16 -0400 Received: from mga02.intel.com ([134.134.136.20]:16270 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726913AbgDTWBM (ORCPT ); Mon, 20 Apr 2020 18:01:12 -0400 IronPort-SDR: NcL4+SkEHL/QSArFK4VXYoLYWEvMyGptOjbs3d3ih755ENT1GUXVLmWWAHJoCpKNvxxIub7Q/a Kwf/vWuau0tg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2020 15:01:12 -0700 IronPort-SDR: NaBAspYZuGnSTQEfEZz9R/EbojjS+9L7WFqbqEMeVWAABLhwoBVpCJ/CdN5nfrfXocev3M49EF hB6ewiUK3MTQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,407,1580803200"; d="scan'208";a="455848368" Received: from unknown (HELO nsgsw-wilsonpoint.lm.intel.com) ([10.232.116.102]) by fmsmga005.fm.intel.com with ESMTP; 20 Apr 2020 15:01:10 -0700 From: Jon Derrick To: Bjorn Helgaas Cc: , Keith Busch , Jon Derrick , Russell Currey , Sam Bobroff , "Oliver O'Halloran" , Bjorn Helgaas , Kuppuswamy Sathyanarayanan , Andy Shevchenko , Frederick Lawler , Rajat Jain , "Patel, Mayurkumar" , Olof Johansson , "Rafael J. Wysocki" , Mika Westerberg , Alex Williamson , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] PCI/DPC: Allow Native DPC Host Bridges to use DPC Date: Mon, 20 Apr 2020 15:37:10 -0600 Message-Id: <1587418630-13562-3-git-send-email-jonathan.derrick@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587418630-13562-1-git-send-email-jonathan.derrick@intel.com> References: <1587418630-13562-1-git-send-email-jonathan.derrick@intel.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The existing portdrv model prevents DPC services without either OS control (_OSC) granted to AER services, a Host Bridge requesting Native AER, or using one of the 'pcie_ports=' parameters of 'native' or 'dpc-native'. The DPC port service driver itself will also fail to probe if the kernel assumes the port is using Firmware-First AER. It's a reasonable expectation that a port using Firmware-First AER will also be using Firmware-First DPC, however if a Host Bridge requests Native DPC, the DPC driver should allow it and not fail to bind due to AER capability settings. Host Bridges which request Native DPC port services will also likely request Native AER, however it shouldn't be a requirement. This patch allows ports on those Host Bridges to have DPC port services. This will avoid the unlikely situation where the port is Firmware-First AER and Native DPC, and a BIOS or switch firmware preconfiguration of the DPC trigger could result in unhandled DPC events. Signed-off-by: Jon Derrick --- drivers/pci/pcie/dpc.c | 3 ++- drivers/pci/pcie/portdrv_core.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c index 7621704..3f3106f 100644 --- a/drivers/pci/pcie/dpc.c +++ b/drivers/pci/pcie/dpc.c @@ -284,7 +284,8 @@ static int dpc_probe(struct pcie_device *dev) int status; u16 ctl, cap; - if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native) + if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native && + !pci_find_host_bridge(pdev->bus)->native_dpc) return -ENOTSUPP; status = devm_request_threaded_irq(device, dev->irq, dpc_irq, diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 50a9522..f2139a1 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -256,7 +256,8 @@ static int get_port_device_capability(struct pci_dev *dev) */ if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) && pci_aer_available() && - (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER))) + (pcie_ports_dpc_native || host->native_dpc || + (services & PCIE_PORT_SERVICE_AER))) services |= PCIE_PORT_SERVICE_DPC; if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM ||