From patchwork Thu Dec 1 08:29:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 9455595 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6EED560756 for ; Thu, 1 Dec 2016 08:39:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6616E28402 for ; Thu, 1 Dec 2016 08:39:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B02428446; Thu, 1 Dec 2016 08:39:09 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham 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 026D828446 for ; Thu, 1 Dec 2016 08:39:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932232AbcLAIjH (ORCPT ); Thu, 1 Dec 2016 03:39:07 -0500 Received: from mail.kernel.org ([198.145.29.136]:52288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754525AbcLAIjG (ORCPT ); Thu, 1 Dec 2016 03:39:06 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B17BC2017E; Thu, 1 Dec 2016 08:29:41 +0000 (UTC) Received: from localhost (unknown [69.71.4.155]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8FB1D202C8; Thu, 1 Dec 2016 08:29:40 +0000 (UTC) Subject: [PATCH v10 02/12] PCI: Search ACPI namespace to ensure ECAM space is reserved From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: Lorenzo Pieralisi , Gabriele Paoloni , "Rafael J. Wysocki" , Tomasz Nowicki , Duc Dang , Sinan Kaya , Christopher Covington , Dongdong Liu Date: Thu, 01 Dec 2016 02:29:39 -0600 Message-ID: <20161201082939.12247.55077.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <20161201075131.12247.2211.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <20161201075131.12247.2211.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bjorn Helgaas The static MCFG table tells us the base of ECAM space, but it does not reserve the space -- the reservation should be done via a device in the ACPI namespace whose _CRS includes the ECAM region. Add pci_ecam_verify_reservation() to check whether the ECAM space is reserved by an ACPI namespace device. If it is, emit a message showing which device reserves it. If not, emit a "[Firmware Bug]" warning. Signed-off-by: Bjorn Helgaas --- drivers/pci/ecam.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c index 43ed08d..3805122 100644 --- a/drivers/pci/ecam.c +++ b/drivers/pci/ecam.c @@ -14,6 +14,7 @@ * version 2 (GPLv2) along with this source code. */ +#include #include #include #include @@ -29,6 +30,24 @@ */ static const bool per_bus_mapping = !IS_ENABLED(CONFIG_64BIT); +static void pci_ecam_verify_reservation(struct device *dev, + struct resource *ecam) +{ +#ifdef CONFIG_ACPI + struct acpi_device *adev; + + adev = acpi_resource_consumer(ecam); + if (!adev) { + dev_warn(dev, FW_BUG "ECAM area %pR not reserved in ACPI namespace\n", + ecam); + return; + } + + dev_info(dev, "ECAM area %pR reserved by %s\n", ecam, + dev_name(&adev->dev)); +#endif +} + /* * Create a PCI config space window * - reserve mem region @@ -51,6 +70,8 @@ struct pci_config_window *pci_ecam_create(struct device *dev, if (!cfg) return ERR_PTR(-ENOMEM); + pci_ecam_verify_reservation(dev, cfgres); + cfg->parent = dev; cfg->ops = ops; cfg->busr.start = busr->start;