All of lore.kernel.org
 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 v11 04/15] arm64: PCI: Search ACPI namespace to ensure ECAM space is reserved
Date: Tue, 6 Dec 2016 16:01:14 +0000	[thread overview]
Message-ID: <20161206160114.GC4601@red-moon> (raw)
In-Reply-To: <20161205232549.3957.25468.stgit@bhelgaas-glaptop.roam.corp.google.com>

On Mon, Dec 05, 2016 at 05:25:50PM -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.
> 
> Use acpi_resource_consumer() 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 <bhelgaas@google.com>
> ---
>  arch/arm64/kernel/pci.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index 8183c98..7909f59 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -124,8 +124,9 @@ pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root)
>  	struct device *dev = &root->device->dev;
>  	struct resource *bus_res = &root->secondary;
>  	u16 seg = root->segment;
> -	struct pci_config_window *cfg;
>  	struct resource cfgres;
> +	struct acpi_device *adev;
> +	struct pci_config_window *cfg;
>  	unsigned int bsz;
>  
>  	/* Use address from _CBA if present, otherwise lookup MCFG */
> @@ -141,6 +142,16 @@ pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root)
>  	cfgres.start = root->mcfg_addr + bus_res->start * bsz;
>  	cfgres.end = cfgres.start + resource_size(bus_res) * bsz - 1;
>  	cfgres.flags = IORESOURCE_MEM;
> +
> +	adev = acpi_resource_consumer(&cfgres);
> +	if (adev)

I think that currently:

if (unlikely(adev))

would be more appropriate. Joking (not really ;-))

> +		dev_info(dev, "ECAM area %pR reserved by %s\n", &cfgres,
> +			 dev_name(&adev->dev));
> +	else
> +		dev_warn(dev, FW_BUG "ECAM area %pR not reserved in ACPI namespace\n",
> +			 &cfgres);

This log is going to be rather popular.

> +
> +

Nit: One too many empty line.

Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

>  	cfg = pci_ecam_create(dev, &cfgres, bus_res, &pci_generic_ecam_ops);
>  	if (IS_ERR(cfg)) {
>  		dev_err(dev, "%04x:%pR error %ld mapping ECAM\n", seg, bus_res,
> 

  reply	other threads:[~2016-12-06 16:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 23:25 [PATCH v11 00/15] PCI: ARM64 ECAM quirks Bjorn Helgaas
2016-12-05 23:25 ` [PATCH v11 01/15] ACPI: Add acpi_resource_consumer() to find device that claims a resource Bjorn Helgaas
2016-12-05 23:25 ` [PATCH v11 02/15] x86/PCI: Use acpi_resource_consumer() to search ACPI namespace for MMCFG Bjorn Helgaas
2016-12-05 23:25 ` [PATCH v11 03/15] arm64: PCI: Add local struct device pointers Bjorn Helgaas
2016-12-06 16:02   ` Lorenzo Pieralisi
2016-12-05 23:25 ` [PATCH v11 04/15] arm64: PCI: Search ACPI namespace to ensure ECAM space is reserved Bjorn Helgaas
2016-12-06 16:01   ` Lorenzo Pieralisi [this message]
2016-12-05 23:25 ` [PATCH v11 05/15] arm64: PCI: Manage controller-specific data on per-controller basis Bjorn Helgaas
2016-12-06 15:45   ` Lorenzo Pieralisi
2016-12-05 23:26 ` [PATCH v11 06/15] arm64: PCI: Exclude ACPI "consumer" resources from host bridge windows Bjorn Helgaas
2016-12-05 23:26 ` [PATCH v11 07/15] PCI/ACPI: Extend pci_mcfg_lookup() to return ECAM config accessors Bjorn Helgaas
2016-12-05 23:26 ` [PATCH v11 08/15] PCI/ACPI: Check for platform-specific MCFG quirks Bjorn Helgaas
2016-12-05 23:26 ` [PATCH v11 09/15] PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform Bjorn Helgaas
2016-12-05 23:26 ` [PATCH v11 10/15] PCI: Add MCFG quirks for Qualcomm QDF2432 host controller Bjorn Helgaas
2016-12-05 23:26 ` [PATCH v11 11/15] PCI: Add MCFG quirks for HiSilicon Hip05/06/07 host controllers Bjorn Helgaas
2016-12-05 23:26 ` [PATCH v11 12/15] PCI: thunder-pem: Factor out resource lookup Bjorn Helgaas
2016-12-05 23:26 ` [PATCH v11 13/15] PCI: Add MCFG quirks for Cavium ThunderX pass2.x host controller Bjorn Helgaas
2016-12-06 13:07   ` Tomasz Nowicki
2016-12-06 20:45     ` Bjorn Helgaas
2016-12-07 12:23       ` Tomasz Nowicki
2016-12-05 23:27 ` [PATCH v11 14/15] PCI: Add MCFG quirks for Cavium ThunderX pass1.x " Bjorn Helgaas
2016-12-05 23:27 ` [PATCH v11 15/15] PCI: Add MCFG quirks for X-Gene " Bjorn Helgaas
2016-12-06  2:14 ` [PATCH v11 00/15] PCI: ARM64 ECAM quirks Duc Dang
2016-12-06  7:16 ` Dongdong Liu
2016-12-06 14:41 ` Tomasz Nowicki

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=20161206160114.GC4601@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.