From: Liviu.Dudau@arm.com
To: Tomasz Nowicki <tn@semihalf.com>
Cc: bhelgaas@google.com, arnd@arndb.de, will.deacon@arm.com,
catalin.marinas@arm.com, rjw@rjwysocki.net,
hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com,
jiang.liu@linux.intel.com, robert.richter@caviumnetworks.com,
Narinder.Dhillon@caviumnetworks.com, ddaney@caviumnetworks.com,
tglx@linutronix.de, wangyijing@huawei.com,
Suravee.Suthikulpanit@amd.com, msalter@redhat.com,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linaro-acpi@lists.linaro.org
Subject: Re: [PATCH V1 10/11] pci, acpi: Provide generic way to assign bus domain number.
Date: Wed, 28 Oct 2015 11:38:37 +0000 [thread overview]
Message-ID: <20151028113837.GK963@e106497-lin.cambridge.arm.com> (raw)
In-Reply-To: <1445963922-22711-11-git-send-email-tn@semihalf.com>
On Tue, Oct 27, 2015 at 05:38:41PM +0100, Tomasz Nowicki wrote:
> Architectures which support PCI_DOMAINS_GENERIC (like ARM64)
> cannot call pci_bus_assign_domain_nr along ACPI PCI host bridge
> initialization since this function needs valid parent device reference
> to be able to retrieve domain number (aka segment).
>
> We can omit that blocker and pass down host bridge device via
> pci_create_root_bus parameter and then be able to evaluate _SEG method
> being in pci_bus_assign_domain_nr.
>
> Note that _SEG method is optional, therefore _SEG absence means
> that all PCI buses belong to domain 0.
>
> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
> ---
> drivers/acpi/pci_root.c | 2 +-
> drivers/pci/pci.c | 32 +++++++++++++++++++++++++++-----
> 2 files changed, 28 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 850d7bf..e682dc6 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -839,7 +839,7 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
>
> pci_acpi_root_add_resources(info);
> pci_add_resource(&info->resources, &root->secondary);
> - bus = pci_create_root_bus(NULL, busnum, ops->pci_ops,
> + bus = pci_create_root_bus(&device->dev, busnum, ops->pci_ops,
> sysdata, &info->resources);
Not sure this change should be in this patch, I don't see the relation.
To put it differently: I think the patch should introduce the retrieval of the
domain number from _SEG method and leave the passing of a valid host bridge device
to a more appropriate patch.
> if (!bus)
> goto out_release_info;
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 6a9a111..17d1857 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -25,6 +25,7 @@
> #include <linux/device.h>
> #include <linux/pm_runtime.h>
> #include <linux/pci_hotplug.h>
> +#include <linux/acpi.h>
> #include <asm-generic/pci-bridge.h>
> #include <asm/setup.h>
> #include "pci.h"
> @@ -4501,7 +4502,7 @@ int pci_get_new_domain_nr(void)
> void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> {
> static int use_dt_domains = -1;
> - int domain = of_get_pci_domain_nr(parent->of_node);
> + int domain;
>
> /*
> * Check DT domain and use_dt_domains values.
> @@ -4523,14 +4524,35 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> * API and update the use_dt_domains value to keep track of method we
> * are using to assign domain numbers (use_dt_domains = 0).
> *
> + * IF ACPI, we expect non-DT method (use_dt_domains == -1)
> + * and call _SEG method for corresponding host bridge device.
> + * If _SEG method does not exist, following ACPI spec (6.5.6)
> + * all PCI buses belong to domain 0.
> + *
> * All other combinations imply we have a platform that is trying
> - * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
> - * which is a recipe for domain mishandling and it is prevented by
> - * invalidating the domain value (domain = -1) and printing a
> - * corresponding error.
> + * to mix domain numbers obtained from DT, ACPI and
> + * pci_get_new_domain_nr(), which is a recipe for domain mishandling and
> + * it is prevented by invalidating the domain value (domain = -1) and
> + * printing a corresponding error.
> */
> +
> + domain = of_get_pci_domain_nr(parent->of_node);
Not sure what you've got here by splitting the original line into two other than an increase
in the change count.
Otherwise, it looks sensible.
Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com>
> if (domain >= 0 && use_dt_domains) {
> use_dt_domains = 1;
> +#ifdef CONFIG_ACPI
> + } else if (!acpi_disabled && use_dt_domains == -1) {
> + struct acpi_device *acpi_dev = to_acpi_device(parent);
> + unsigned long long segment = 0;
> + acpi_status status;
> +
> + status = acpi_evaluate_integer(acpi_dev->handle,
> + METHOD_NAME__SEG, NULL,
> + &segment);
> + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND)
> + dev_err(&acpi_dev->dev, "can't evaluate _SEG\n");
> +
> + domain = segment;
> +#endif
> } else if (domain < 0 && use_dt_domains != 1) {
> use_dt_domains = 0;
> domain = pci_get_new_domain_nr();
> --
> 1.9.1
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
next prev parent reply other threads:[~2015-10-28 11:38 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 16:38 [PATCH V1 00/11] MMCONFIG refactoring and ARM64 PCI hostbridge init based on ACPI Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 01/11] x86, pci: Reorder logic of pci_mmconfig_insert() function Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 02/11] x86, pci, acpi: Move arch-agnostic MMCONFIG (aka ECAM) and ACPI code out of arch/x86/ directory Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 03/11] pci, acpi, mcfg: Provide generic implementation of MCFG code initialization Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 04/11] x86, pci: mmconfig_{32,64}.c code refactoring - remove code duplication Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 05/11] x86, pci, ecam: mmconfig_64.c becomes default implementation for ECAM driver Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 06/11] pci, acpi, mcfg: Provide default RAW ACPI PCI config space accessors Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 07/11] XEN / PCI: Remove the dependence on arch x86 when PCI_MMCONFIG=y Tomasz Nowicki
2015-10-27 16:47 ` [Linaro-acpi] " Tomasz Nowicki
2015-10-27 17:25 ` Boris Ostrovsky
2015-10-28 10:49 ` Stefano Stabellini
2015-10-28 10:56 ` Tomasz Nowicki
2015-10-28 13:45 ` Hanjun Guo
2015-10-28 14:07 ` Boris Ostrovsky
2015-10-27 16:38 ` [PATCH V1 08/11] pci, acpi, ecam: Add flag to indicate whether ECAM region was hot added or not Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 09/11] x86, pci: Use previously added ECAM hot_added flag to remove ECAM regions Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 10/11] pci, acpi: Provide generic way to assign bus domain number Tomasz Nowicki
2015-10-28 11:38 ` Liviu.Dudau [this message]
2015-10-28 12:47 ` [Linaro-acpi] " Tomasz Nowicki
2015-11-03 16:10 ` Lorenzo Pieralisi
2015-11-04 10:04 ` [Linaro-acpi] " Tomasz Nowicki
2015-10-27 16:38 ` [PATCH V1 11/11] arm64, pci, acpi: Support for ACPI based PCI hostbridge init Tomasz Nowicki
2015-10-28 11:49 ` Liviu.Dudau
2015-10-28 13:42 ` Tomasz Nowicki
2015-10-28 13:51 ` Liviu.Dudau
2015-11-03 14:32 ` Lorenzo Pieralisi
2015-11-03 16:28 ` Liviu.Dudau
2015-10-28 18:46 ` Sinan Kaya
2015-11-03 14:15 ` Lorenzo Pieralisi
2015-11-03 14:39 ` Tomasz Nowicki
2015-11-03 15:10 ` Sinan Kaya
2015-11-03 15:59 ` Arnd Bergmann
2015-11-03 16:33 ` Sinan Kaya
2015-11-03 16:55 ` Arnd Bergmann
2015-11-03 17:43 ` Sinan Kaya
2015-11-05 14:48 ` [Linaro-acpi] " Sinan Kaya
2015-11-03 15:19 ` Hanjun Guo
2015-11-03 17:39 ` David Daney
2015-11-03 18:00 ` Gabriele Paoloni
2015-11-03 16:55 ` Lorenzo Pieralisi
2015-11-04 9:59 ` Tomasz Nowicki
2015-11-04 10:11 ` Tomasz Nowicki
2015-10-30 4:07 ` [PATCH V1 00/11] MMCONFIG refactoring and ARM64 PCI hostbridge init based on ACPI Jon Masters
2015-10-30 4:50 ` Hanjun Guo
2015-10-30 8:26 ` Tomasz Nowicki
2015-10-30 16:38 ` Suravee Suthikulpanit
2015-12-07 20:31 ` Bjorn Helgaas
[not found] ` <20151209100125.GA12632@jayachandranc.netlogicmicro.com>
2015-12-09 15:55 ` Lorenzo Pieralisi
[not found] ` <20151216125136.GE5890@jayachandranc.netlogicmicro.com>
2015-12-16 14:05 ` Lorenzo Pieralisi
2015-12-08 17:43 ` Jeremy Linton
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=20151028113837.GK963@e106497-lin.cambridge.arm.com \
--to=liviu.dudau@arm.com \
--cc=Lorenzo.Pieralisi@arm.com \
--cc=Narinder.Dhillon@caviumnetworks.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=catalin.marinas@arm.com \
--cc=ddaney@caviumnetworks.com \
--cc=hanjun.guo@linaro.org \
--cc=jiang.liu@linux.intel.com \
--cc=linaro-acpi@lists.linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=msalter@redhat.com \
--cc=rjw@rjwysocki.net \
--cc=robert.richter@caviumnetworks.com \
--cc=tglx@linutronix.de \
--cc=tn@semihalf.com \
--cc=wangyijing@huawei.com \
--cc=will.deacon@arm.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).