linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: linux-pci@vger.kernel.org,
	Gabriele Paoloni <gabriele.paoloni@huawei.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Tomasz Nowicki <tn@semihalf.com>, Duc Dang <dhdang@apm.com>,
	Sinan Kaya <okaya@codeaurora.org>,
	Christopher Covington <cov@codeaurora.org>,
	Dongdong Liu <liudongdong3@huawei.com>
Subject: Re: [PATCH v10 02/12] PCI: Search ACPI namespace to ensure ECAM space is reserved
Date: Thu, 1 Dec 2016 14:17:29 +0000	[thread overview]
Message-ID: <20161201141729.GA9974@red-moon> (raw)
In-Reply-To: <20161201082939.12247.55077.stgit@bhelgaas-glaptop.roam.corp.google.com>

Hi Bjorn,

Thank you very much for putting this series together !

On Thu, Dec 01, 2016 at 02:29:39AM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> 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.

I have a question: do we want to carry out a search on a restricted set
of _HIDs here ? I am not sure we should consider an ECAM region matching
with a resource in a device _CRS whose _HID/_CID is not part of
{PNP0c02, PNP0A03, PNP0A08} as a success, actually I think that would be
a FW bug, right ?

Thanks,
Lorenzo

> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/pci/ecam.c |   21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> 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 <linux/acpi.h>
>  #include <linux/device.h>
>  #include <linux/io.h>
>  #include <linux/kernel.h>
> @@ -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;
> 

  reply	other threads:[~2016-12-01 14:17 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01  8:29 [PATCH v10 00/12] PCI: ARM64 ECAM quirks Bjorn Helgaas
2016-12-01  8:29 ` [PATCH v10 01/12] ACPI: Add acpi_resource_consumer() to find device that claims a resource Bjorn Helgaas
2016-12-01 13:17   ` Rafael J. Wysocki
2016-12-01 16:35     ` Bjorn Helgaas
2016-12-01  8:29 ` [PATCH v10 02/12] PCI: Search ACPI namespace to ensure ECAM space is reserved Bjorn Helgaas
2016-12-01 14:17   ` Lorenzo Pieralisi [this message]
2016-12-01 18:05     ` Bjorn Helgaas
2016-12-01  8:29 ` [PATCH v10 03/12] x86/PCI: Use acpi_resource_consumer() to search ACPI namespace for MMCFG Bjorn Helgaas
2016-12-01  8:29 ` [PATCH v10 04/12] arm64: PCI: Manage controller-specific data on per-controller basis Bjorn Helgaas
2016-12-01  8:30 ` [PATCH v10 05/12] PCI/ACPI: Extend pci_mcfg_lookup() to return ECAM config accessors Bjorn Helgaas
2016-12-01  8:30 ` [PATCH v10 06/12] PCI/ACPI: Check for platform-specific MCFG quirks Bjorn Helgaas
2016-12-01  8:30 ` [PATCH v10 07/12] PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform Bjorn Helgaas
2016-12-01  8:30 ` [PATCH v10 08/12] PCI: Add MCFG quirks for Qualcomm QDF2432 host controller Bjorn Helgaas
2016-12-01  8:30 ` [PATCH v10 09/12] PCI: Add MCFG quirks for HiSilicon Hip05/06/07 host controllers Bjorn Helgaas
2016-12-01  8:30 ` [PATCH v10 10/12] PCI: thunder-pem: Factor out resource lookup Bjorn Helgaas
2016-12-01  8:30 ` [PATCH v10 11/12] PCI: Add MCFG quirks for Cavium ThunderX pass2.x host controller Bjorn Helgaas
2016-12-02 17:35   ` Bjorn Helgaas
2016-12-05  8:32     ` Tomasz Nowicki
2016-12-01  8:31 ` [PATCH v10 12/12] PCI: Add MCFG quirks for Cavium ThunderX pass1.x " Bjorn Helgaas
2016-12-01 19:02   ` Tomasz Nowicki
2016-12-01 20:24     ` Bjorn Helgaas
2016-12-01 13:02 ` [PATCH v10 00/12] PCI: ARM64 ECAM quirks Dongdong Liu
2016-12-01 14:04   ` Dongdong Liu
2016-12-01 16:31     ` Bjorn Helgaas
2016-12-02  3:46       ` Dongdong Liu
2016-12-02  8:15         ` Hanjun Guo
2016-12-02 21:22           ` Bjorn Helgaas
2016-12-01 18:01 ` Bjorn Helgaas
2016-12-02 11:42   ` Dongdong Liu
2016-12-01 21:53 ` Gabriele Paoloni
2016-12-02 14:20 ` Tomasz Nowicki
2016-12-02 21:57   ` Bjorn Helgaas
2016-12-05 12:36     ` Tomasz Nowicki
2016-12-06 18:56       ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161201141729.GA9974@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=cov@codeaurora.org \
    --cc=dhdang@apm.com \
    --cc=gabriele.paoloni@huawei.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liudongdong3@huawei.com \
    --cc=okaya@codeaurora.org \
    --cc=rafael@kernel.org \
    --cc=tn@semihalf.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).