Received: by 2002:a17:90a:8504:0:0:0:0 with SMTP id l4csp2235975pjn; Thu, 24 Oct 2019 06:48:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUCm5SyZiNizkvuqWgi2spLJ/KODm8UY8w5V9WITEfCbKlYZFCjWMDUIxX6RKQVh0kUKHd X-Received: by 2002:a17:906:d72:: with SMTP id s18mr22080979ejh.29.1571924924750; Thu, 24 Oct 2019 06:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571924924; cv=none; d=google.com; s=arc-20160816; b=DyyL7XZjQW4GQcCaReAzV7lOxV/5BQC2hJwz0NFQug2wDjr9SeLpzvoRQG4U3QGO+Q Oo5cF/jn1Iblyhu0F9CvrseB7N4woN42Dj7BmZU7PM/tI7/+QyBpdIPhX4CXHkSkj8UV 1zohdrdNEosyb+ACMO79rz+RLtnqV/r+kuYBfhMLZ+oKVjjc4Hs0GAPk5wfjM1kYCOm4 DBkJchnJkcTezSut3qOX6bF9jD71S+/dpi3Je6+CsiagEz+R2hvJ2Oeg1EGj6Vz7nPQU uj7JiyTC2x9H3erO7uQmFguXYpL1quaOWc/7R7ETAJDiS50ZpC2TfitFCskOG/hsUNMa OTdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=AWSzxloZFjqBSYPavsipaCsXnn7FGNC3x2RIp+ASNJ8=; b=Dhq4KhgW8RxmY+XStaJ2Jk8FXXBqX3AoyD74LkbVmzAHQ/vn/DI7fabkY6xAqpNLeb Q07Xf+jR/FG4zdXd53fLBuJjrv1AmLgou/FK+9ABatAIYTEBPcQmaJPIAAw9PnZ2Yc4i 6oo2UeTsPLwy1G76v6UgrHRPpyDUEsiwKtiL9hY04ebIQxZWYFiygJKSh+QjBazjTHPw s71tKsPXeb5+rCdfCx/9fF3MPQ/Z6MXmXTM4MaaqpjysW5HBjHahkCfMzSm/CpS45Ezp igpkEsFm9e79kBul89+edNxVlSOxh5l0te5DNn8V73EdRKvhHHg+Er2yaBaBPO7KaIpx +HdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=y0ZJLr+c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si17130039edc.96.2019.10.24.06.48.17; Thu, 24 Oct 2019 06:48:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=y0ZJLr+c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391351AbfJWTWX (ORCPT + 99 others); Wed, 23 Oct 2019 15:22:23 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:44351 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733199AbfJWTWW (ORCPT ); Wed, 23 Oct 2019 15:22:22 -0400 Received: by mail-ot1-f66.google.com with SMTP id n48so3503516ota.11 for ; Wed, 23 Oct 2019 12:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lixom-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=AWSzxloZFjqBSYPavsipaCsXnn7FGNC3x2RIp+ASNJ8=; b=y0ZJLr+cgueiZO+fvCl5wIdEf3wPufsEH3or0+C0r5plqTxF1gFC/WLiGlDAkykQhC ag8VtmVwHXOSW8923OLMhCe1w9F4ChfzgZeulr2vEzCCTuUyiV5WOFki57obZ/R95fDz QYHccMqGnIjqC3R4ZHQR/6bW6rpvDnP5r2I3H+bzcou2XpyFOt/Ml+IMaEEZ8vrk+rNt TYeHQZ70HuC30AuFX6ekWQ6nXUcyWoB1TkYV8urrgfx0ouxJzxoUZEU6pMXUYVsfWsIt B0VccJ/4phWLs9Ow9ky4hzFnDr3sJaBu4zGPHBZ7grhiUiYILikWh/fbHSyMxj33k/80 gVuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AWSzxloZFjqBSYPavsipaCsXnn7FGNC3x2RIp+ASNJ8=; b=C6Rv3mGK9q2Vqm8cZEHXFMcIuePrTb+o6mB2HyDf3zidAoi1kmCe6gU97Gm7dzzbla wAQF8xg1pOW1JEp69dtVxK8uyHZzQ/5bcMre+T/BFxLSciaOJgNE8XbMdsoXq1uAxjrk LnUj7nr5LnAMEO2DMrieyLFl7Np3hpLQJwA4narz1xxziwCy+ExkJJ0waoNwsFLWKp2K LkNUCoaDwV+4aeHSX7s33mhUP0uzkw/dZIRuBu1CyWpainNL3nGMQ7I6OukgKyIQgPJy 7BJRHaATvWCo+TiTIoaB9R5myyXkIScFPa33eYSso44gHnWvWlhpsLNyNag/0e2oqSYO 9eYg== X-Gm-Message-State: APjAAAVMXbAh7FGBoikX0PH0o1u7yVhwRiKwr/hmFUL+F+C+ZZnDTgur Je8ROTB+38lGlNL/1ijxwwxZXQ== X-Received: by 2002:a9d:3476:: with SMTP id v109mr8496480otb.211.1571858541669; Wed, 23 Oct 2019 12:22:21 -0700 (PDT) Received: from rip.lixom.net (99-152-116-91.lightspeed.sntcca.sbcglobal.net. [99.152.116.91]) by smtp.gmail.com with ESMTPSA id d25sm5783461oic.23.2019.10.23.12.22.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Oct 2019 12:22:20 -0700 (PDT) From: Olof Johansson To: Bjorn Helgaas Cc: Keith Busch , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Olof Johansson Subject: [PATCH] PCI/DPC: Add pcie_ports=dpc-native parameter to bring back old behavior Date: Wed, 23 Oct 2019 12:22:05 -0700 Message-Id: <20191023192205.97024-1-olof@lixom.net> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In commit eed85ff4c0da7 ("PCI/DPC: Enable DPC only if AER is available"), the behavior was changed such that native (kernel) handling of DPC got tied to whether the kernel also handled AER. While this is what the standard recommends, there are BIOSes out there that lack the DPC handling since it was never required in the past. To make DPC still work on said platforms the same way they did before, add a "pcie_ports=dpc-native" kernel parameter that can be passed in if needed, while keeping defaults unchanged. Signed-off-by: Olof Johansson --- Documentation/admin-guide/kernel-parameters.txt | 1 + drivers/pci/pcie/dpc.c | 2 +- drivers/pci/pcie/portdrv_core.c | 7 ++++++- drivers/pci/pcie/portdrv_pci.c | 8 ++++++++ include/linux/pci.h | 2 ++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 5e27d74e2b74b..e0325421980aa 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3548,6 +3548,7 @@ even if the platform doesn't give the OS permission to use them. This may cause conflicts if the platform also tries to use these services. + dpc-native Use native PCIe service for DPC, but none other. compat Disable native PCIe services (PME, AER, DPC, PCIe hotplug). diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c index a32ec3487a8d0..e06f42f58d3d4 100644 --- a/drivers/pci/pcie/dpc.c +++ b/drivers/pci/pcie/dpc.c @@ -291,7 +291,7 @@ static int dpc_probe(struct pcie_device *dev) int status; u16 ctl, cap; - if (pcie_aer_get_firmware_first(pdev)) + if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native) return -ENOTSUPP; dpc = devm_kzalloc(device, sizeof(*dpc), GFP_KERNEL); diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 1b330129089fe..c24bf6cac4186 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -250,8 +250,13 @@ static int get_port_device_capability(struct pci_dev *dev) pcie_pme_interrupt_enable(dev, false); } + /* + * With dpc-native, we set it if AER is available, even if AER is + * handled by firmware. + */ if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) && - pci_aer_available() && services & PCIE_PORT_SERVICE_AER) + pci_aer_available() && + (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER))) services |= PCIE_PORT_SERVICE_DPC; if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM || diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 0a87091a0800e..b415656519a73 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c @@ -29,12 +29,20 @@ bool pcie_ports_disabled; */ bool pcie_ports_native; +/* + * If the user specified "pcie_ports=dpc-native", use the PCIe services + * for DPC, but cuse platform defaults for the others. + */ +bool pcie_ports_dpc_native; + static int __init pcie_port_setup(char *str) { if (!strncmp(str, "compat", 6)) pcie_ports_disabled = true; else if (!strncmp(str, "native", 6)) pcie_ports_native = true; + else if (!strncmp(str, "dpc-native", 10)) + pcie_ports_dpc_native = true; return 1; } diff --git a/include/linux/pci.h b/include/linux/pci.h index fc1844061e88f..603d4822757b6 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1534,9 +1534,11 @@ static inline int pci_irqd_intx_xlate(struct irq_domain *d, #ifdef CONFIG_PCIEPORTBUS extern bool pcie_ports_disabled; extern bool pcie_ports_native; +extern bool pcie_ports_dpc_native; #else #define pcie_ports_disabled true #define pcie_ports_native false +#define pcie_ports_dpc_native false #endif #define PCIE_LINK_STATE_L0S BIT(0) -- 2.11.0