From patchwork Thu Nov 15 23:16:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 10685309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2FB314E2 for ; Thu, 15 Nov 2018 23:16:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5EE52D619 for ; Thu, 15 Nov 2018 23:16:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A89FC2D61F; Thu, 15 Nov 2018 23:16:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 449B52D619 for ; Thu, 15 Nov 2018 23:16:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388993AbeKPJ0O (ORCPT ); Fri, 16 Nov 2018 04:26:14 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:34567 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725860AbeKPJ0N (ORCPT ); Fri, 16 Nov 2018 04:26:13 -0500 Received: by mail-ot1-f65.google.com with SMTP id t5so19700117otk.1; Thu, 15 Nov 2018 15:16:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0/zlQteT7Eb+WVjd5aUv8zmL6TUh4WrZMBcM1VmM60w=; b=RJd4WjRrMh+I3fogDnQnkEar5Mze93Z9Lnb32BCllXD4QjvTA0UEeAiidrUwivLnkn Zy/jNIr4E7xK4+d5YunPO0SLw5nz1ms8tF1F4vtVwUjUdFpX+mZwzbr69vM6g5Irx9fF oEcYj2+jBiQDx1nqXa+N0Ub37260OCLxo/2uV61XakP5nD4ffB4PHW0EaB4uhSNDvDOE Nd5qcppdMBDhjG9Fwr+Lhp9IWUadb5LCndSrYruFqZwq+K9cioIutFKELf1ycYZdMGdI O3uN65WmZ9rKbWXm41TjcLij/8yTtzOf1h++geWO6jvOru1cSUHB3rWEMogRsXIAl94e ck3g== 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:in-reply-to :references; bh=0/zlQteT7Eb+WVjd5aUv8zmL6TUh4WrZMBcM1VmM60w=; b=OLVSQRCvscSfL1nob0esDXWIZLKAvQZAj0vTvxsskYt5gscHb9hZD79PSK1fdEkL50 zZfE9I3RAGl1cnfXTEb3ULV5ErFNWLKE8P+bsOKLLzWUXikxeZmXlFWsVvFqJTxo0sAC V2Eo9Y2AYKZ+ZAXc3jGdw3z/J6Jy9Y4qN8NEWD6hHLkETiJkTWqFQBnYMByqKnwM+7e+ VlsoLOUTGtR/Z9YjbrrO/8DxBWUMQMkd8SnwKz18zn10PGrpzM2G4WfP1J2XY04tszyE 9dV+KERXaahQw3hvx9BbgaJcTJyJBwISnjWNlEFN6FdTR+TKqXHX17VXgFZq/NJCVoW3 SCsA== X-Gm-Message-State: AGRZ1gJf9NO8CrVzbnoDFxV7FLsJahQamwCcb8HdSsdnQDAgwPZ10MC0 QwbBbWE7wGhivGj1V7CNbqMQ4fc3GZM= X-Google-Smtp-Source: AJdET5cXWr6Qmr40kj0P21sABhxXuWQiugOA6lCkMgOojEvFft0MixSoyluh6J5y5WMoO5U1IIzehQ== X-Received: by 2002:a9d:41ca:: with SMTP id v10mr5271965oti.101.1542323779488; Thu, 15 Nov 2018 15:16:19 -0800 (PST) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id o81-v6sm8680267oif.1.2018.11.15.15.16.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 15:16:19 -0800 (PST) From: Alexandru Gagniuc To: helgaas@google.com Cc: austin_bolen@dell.com, alex_gagniuc@dellteam.com, keith.busch@intel.com, Shyam_Iyer@Dell.com, lukas@wunner.de, Alexandru Gagniuc , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , Russell Currey , Sam Bobroff , "Oliver O'Halloran" , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/2] PCI/AER: Do not use APEI/HEST to disable AER services globally Date: Thu, 15 Nov 2018 17:16:02 -0600 Message-Id: <20181115231605.24352-2-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181115231605.24352-1-mr.nuke.me@gmail.com> References: <20181115231605.24352-1-mr.nuke.me@gmail.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP HEST is used to describe the meaning of errors received as part of ACPI Platform Error Interfaces (APEI). HEST is tightly coupled to ownership of AER, however the correct way to determine AER ownership is the _OSC method. _OSC is negotiated per root bus. It's possible to have one HEST descriptor for all root busses where AER is owned by firmware, and still have root busses that are not firmware-first. In that case we would incorrectly disable AER services globally. Instead of using HEST in making the determination, always request AER control via _OSC, and only disable AER when firmware denies control. Signed-off-by: Alexandru Gagniuc --- drivers/acpi/pci_root.c | 9 ++------- drivers/pci/pcie/aer.c | 25 +------------------------ include/linux/pci-acpi.h | 6 ------ 3 files changed, 3 insertions(+), 37 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 707aafc7c2aa..32b2053bb0fa 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -491,13 +491,8 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, if (IS_ENABLED(CONFIG_HOTPLUG_PCI_SHPC)) control |= OSC_PCI_SHPC_NATIVE_HP_CONTROL; - if (pci_aer_available()) { - if (aer_acpi_firmware_first()) - dev_info(&device->dev, - "PCIe AER handled by firmware\n"); - else - control |= OSC_PCI_EXPRESS_AER_CONTROL; - } + if (pci_aer_available()) + control |= OSC_PCI_EXPRESS_AER_CONTROL; requested = control; status = acpi_pci_osc_control_set(handle, &control, diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index a90a9194ac4a..ac014151b7a6 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -316,29 +316,6 @@ int pcie_aer_get_firmware_first(struct pci_dev *dev) return dev->__aer_firmware_first; } -static bool aer_firmware_first; - -/** - * aer_acpi_firmware_first - Check if APEI should control AER. - */ -bool aer_acpi_firmware_first(void) -{ - static bool parsed = false; - struct aer_hest_parse_info info = { - .pci_dev = NULL, /* Check all PCIe devices */ - .firmware_first = 0, - }; - - if (pcie_ports_native) - return false; - - if (!parsed) { - apei_hest_parse(aer_hest_parse, &info); - aer_firmware_first = info.firmware_first; - parsed = true; - } - return aer_firmware_first; -} #endif #define PCI_EXP_AER_FLAGS (PCI_EXP_DEVCTL_CERE | PCI_EXP_DEVCTL_NFERE | \ @@ -1453,7 +1430,7 @@ static struct pcie_port_service_driver aerdriver = { */ int __init pcie_aer_init(void) { - if (!pci_aer_available() || aer_acpi_firmware_first()) + if (!pci_aer_available()) return -ENXIO; return pcie_port_service_register(&aerdriver); } diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 8082b612f561..2e9c0b973eba 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -116,10 +116,4 @@ static inline void acpi_pci_add_bus(struct pci_bus *bus) { } static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } #endif /* CONFIG_ACPI */ -#ifdef CONFIG_ACPI_APEI -extern bool aer_acpi_firmware_first(void); -#else -static inline bool aer_acpi_firmware_first(void) { return false; } -#endif - #endif /* _PCI_ACPI_H_ */ From patchwork Thu Nov 15 23:16:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 10685305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7B0D713BF for ; Thu, 15 Nov 2018 23:16:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69EDA2D619 for ; Thu, 15 Nov 2018 23:16:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 593692D61F; Thu, 15 Nov 2018 23:16:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 069622D619 for ; Thu, 15 Nov 2018 23:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389085AbeKPJ0Q (ORCPT ); Fri, 16 Nov 2018 04:26:16 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:41528 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725860AbeKPJ0Q (ORCPT ); Fri, 16 Nov 2018 04:26:16 -0500 Received: by mail-oi1-f196.google.com with SMTP id g188-v6so18227216oif.8; Thu, 15 Nov 2018 15:16:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/PmV1hM4vrJlqJyO21xijvwrR0pYLkAAA5QXEtDSQMk=; b=oIcLNF+yYQ013z44r1tNgoJwxIhR3FmZvqn62c/4aCbaIc0Z3aUWvLWj93DzAuHTwa gq0DrCk+lFgcGJQrDL3/BWwvLwhnJr154/FCj1Z5b5Tb6WlgVgXzczj8Vf/mtWLwXj46 TnzRY0a6KXM26AYLwqkd4P7QAVAeXBw5d3X+UjdmI+X5ZCUiaQvtE0iKImfVYTdFKRe4 bF30KDK0uPyPcuFN3JfKCixfspFpAuY8JyFzXGqFLrdFwO5ZxuRMms2f0scLXgwwUQ8P gbUX/LYpUaXDZ62W1CY3jIvy4S1sdcsYw8t8g9Qu6cgk/K+CEvx7q1JAD3h4r+Dzivpv ls2g== 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:in-reply-to :references; bh=/PmV1hM4vrJlqJyO21xijvwrR0pYLkAAA5QXEtDSQMk=; b=eVTHbiutl2wM4iCtXcN4IPMP7uFOK5EO6hsBYxcOAF1DJucp+InVl8I1TVntW3xVrn b0pK3FyrFofhYbHMlmCie7/U8o3YZ4TtnPM36i/LcwSLbPeNprhxPVGmDCjJrm5xOzeN KCo/CeWlLQ7jmMY2O8L16giFKBtHCrhHGv2NrnhdKRMPf93/KuNhtJnuxUJZSm6hhl4j uBZfHFB8xpg+TA2k9hdwY49UJ/LS/VZC3VFrHlTDHwUeFL+cM9tAW9LsDw24mmaLDPRb 5FeX2OKHD7eXZUJNCxvoLpPIpHuXfjwVmJt4lCEUWljFGAw66CkgC1Tn4x+V5qi2fNiB wnww== X-Gm-Message-State: AGRZ1gKH/OFe/iBJdDDM8h2+d5wfkSJNB6Tbzet29pXxUulJybKcBTc5 8acVU2V+IeWm2smkNGOAfB0= X-Google-Smtp-Source: AJdET5dEM4LH/60J1XaBaSQP72vzRRSWkD/tk88ONGpgvdu8jH27+iSofBXX7RzMh67AkjhyG65g8g== X-Received: by 2002:aca:a6c5:: with SMTP id t66mr2568680oij.225.1542323782908; Thu, 15 Nov 2018 15:16:22 -0800 (PST) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id o81-v6sm8680267oif.1.2018.11.15.15.16.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 15:16:22 -0800 (PST) From: Alexandru Gagniuc To: helgaas@google.com Cc: austin_bolen@dell.com, alex_gagniuc@dellteam.com, keith.busch@intel.com, Shyam_Iyer@Dell.com, lukas@wunner.de, Alexandru Gagniuc , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , Russell Currey , Sam Bobroff , "Oliver O'Halloran" , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/2] PCI/AER: Determine AER ownership based on _OSC instead of HEST Date: Thu, 15 Nov 2018 17:16:03 -0600 Message-Id: <20181115231605.24352-3-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181115231605.24352-1-mr.nuke.me@gmail.com> References: <20181115231605.24352-1-mr.nuke.me@gmail.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP HEST is used to describe the meaning of errors received as part of ACPI Platform Error Interfaces (APEI), however the correct way to determine AER ownership is the _OSC method. pci_dev->__aer_firmware_first is used to prevent modification of AER registers when firmware owns AER. This is synonymous with the AER ownership negotiated during _OSC. Thus _OSC is the correct way to use to set this flag, not HEST. Signed-off-by: Alexandru Gagniuc --- drivers/pci/pcie/aer.c | 57 ++---------------------------------------- 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index ac014151b7a6..dd9594e8ed08 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -240,66 +240,13 @@ static inline bool hest_match_type(struct acpi_hest_header *hest_hdr, return false; } -struct aer_hest_parse_info { - struct pci_dev *pci_dev; - int firmware_first; -}; - -static int hest_source_is_pcie_aer(struct acpi_hest_header *hest_hdr) -{ - if (hest_hdr->type == ACPI_HEST_TYPE_AER_ROOT_PORT || - hest_hdr->type == ACPI_HEST_TYPE_AER_ENDPOINT || - hest_hdr->type == ACPI_HEST_TYPE_AER_BRIDGE) - return 1; - return 0; -} - -static int aer_hest_parse(struct acpi_hest_header *hest_hdr, void *data) -{ - struct aer_hest_parse_info *info = data; - struct acpi_hest_aer_common *p; - int ff; - - if (!hest_source_is_pcie_aer(hest_hdr)) - return 0; - - p = (struct acpi_hest_aer_common *)(hest_hdr + 1); - ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); - - /* - * If no specific device is supplied, determine whether - * FIRMWARE_FIRST is set for *any* PCIe device. - */ - if (!info->pci_dev) { - info->firmware_first |= ff; - return 0; - } - /* Otherwise, check the specific device */ - if (p->flags & ACPI_HEST_GLOBAL) { - if (hest_match_type(hest_hdr, info->pci_dev)) - info->firmware_first = ff; - } else - if (hest_match_pci(p, info->pci_dev)) - info->firmware_first = ff; - - return 0; -} static void aer_set_firmware_first(struct pci_dev *pci_dev) { - int rc; - struct aer_hest_parse_info info = { - .pci_dev = pci_dev, - .firmware_first = 0, - }; + struct pci_host_bridge *host = pci_find_host_bridge(pci_dev->bus); - rc = apei_hest_parse(aer_hest_parse, &info); - - if (rc) - pci_dev->__aer_firmware_first = 0; - else - pci_dev->__aer_firmware_first = info.firmware_first; + pci_dev->__aer_firmware_first = !host->native_aer; pci_dev->__aer_firmware_first_valid = 1; }