All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khuong Dinh <kdinh@apm.com>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	msalter@redhat.com, Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, jcm@redhat.com, patches@apm.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, rjw@rjwysocki.net,
	Duc Dang <dhdang@apm.com>
Subject: Re: [PATCH v2 pci] PCI/MSI: pci-xgene-msi: Enable MSI support in ACPI boot for X-Gene v1
Date: Tue, 13 Jun 2017 13:56:44 -0700	[thread overview]
Message-ID: <CAAsHzqv=mjd_k1K+uOSjfZmnrFeidpjg4DdqUtQeLvAYeCOC-w@mail.gmail.com> (raw)
In-Reply-To: <20170608103956.GB8644@red-moon>

Hi Lorenzo,

On Thu, Jun 8, 2017 at 3:39 AM, Lorenzo Pieralisi
<lorenzo.pieralisi@arm.com> wrote:
> On Tue, Jun 06, 2017 at 09:44:15AM -0700, Khuong Dinh wrote:
>> Hi Lorenzo,
>>
>> On Tue, May 9, 2017 at 3:55 PM, Khuong Dinh <kdinh@apm.com> wrote:
>> > Hi Lorenzo,
>> >
>> > On Fri, May 5, 2017 at 9:51 AM, Lorenzo Pieralisi
>> > <lorenzo.pieralisi@arm.com> wrote:
>> >> On Thu, May 04, 2017 at 05:36:06PM -0700, Khuong Dinh wrote:
>> >>> Hi Marc,
>> >>> There's no explicit dependency between pcie driver and msi
>> >>> controller.  The current solution that we did is relying on the
>> >>> node ordering in BIOS.  ACPI 5.0 introduced _DEP method to assign a
>> >>> higher priority in start ordering.  This method could be applied in
>> >>> case of msi and pcie are the same level of subsys_init (in ACPI
>> >>> boot).  However, PCIe driver has not supported for this dependency
>> >>> check yet.  How do you think about this solution.
>> >>
>> >> First off, you can't post emails with confidentiality notices on
>> >> mailing lists so remove it from now onwards.
>> >
>> > Fixed
>> >
>> >> Secondly, I commented on this before, so you know what my opinion is.
>> >
>> > I got your opinion. I'll implement as your suggestion.
>> >
>>
>>   Regarding to your previous suggestion to add a hook walking the ACPI
>>   namespace before acpi_bus_scan() in acpi_scan_init() to make MSI
>>   controllers must be probed before PCI.  I have a concern that the
>>   MSI namespace “ _SB.MSIX” is not a unique name and how can we walk
>>   the ACPI namespace and use this name to make MSI probed before PCI.
>>   May you have little bit more information for this or do you have
>>   another suggestion for this?
>>
>>    There’s another solution which makes this simpler and I’d like to
>>    ask your opinion about this.
>>    The solution is to make an hierarchy between MSI and PCI nodes  as below:
>> Device(\_SB.MSIX) {
>>    Device(\_SB.PCI0)
>>    Device(\_SB.PCI1)
>>    ……
>> }
>>   In other word, MSIX node is a parent node of PCI nodes in ACPI
>>   table.  In this sense, there’s an explicit dependency between MSI
>>   and PCI, MSI controller must be probed before PCI and it will
>>   guarantee not breaking next kernel releases.  How do you think about
>>   this solution.
>
> I think that's a plaster as ineffective as reordering nodes, in short
> it is not a solution and you still rely on kernel link ordering, you
> can fiddle with ACPI tables as much as you want but that does not change.
>
>>  I also tried to use _DEP method to describe the dependency of PCIe
>>  nodes, but it looks that it does not work as PCI and MSI are handed
>>  by acpi_bus_scan and still having issue when we re-probe PCI.
>
> That's a tad vague to be frank, anyway it is pretty clear to me that we
> have hit a wall. In ACPI there is no way to describe probe dependencies
> like the one you have, it is as simple as that, and this MSI issue you
> are facing is just an example, there are more eg:
>
> https://www.spinics.net/lists/arm-kernel/msg585825.html
>
> At the end of the day the choice is simple either we accept (and we
> maintain because that's the problem) these hacks - and I am not willing
> to do that - or we find a way to solve this from a general perspective not
> as a point hack.
>
> I can have a look at solving the whole issue but it won't happen
> tomorrow.

Thanks for helping to resolve this general ACPI dependence issue.
I look forward for a version to test with.

Can we separate the general dependence patch from the X-Gene MSI ACPI
enable patch.
This original patch was to enable ACPI support for PCIe MSI.
The dependence issue can be resolved separately.
Can you help to pull in the patch.

Best regards,
Khuong Dinh

> Thanks,
> Lorenzo
>
>> Thanks,
>> Khuong Dinh
>>
>> >> Finally, please execute this command on the vmlinux that "works"
>> >> for you:
>> >>
>> >> nm vmlinux | grep -E '__initcall_(xgene_pcie_msi_init|acpi_init)'
>> >
>> > $ nm vmlinux | grep -E '__initcall_(xgene_pcie_msi_init|acpi_init)'
>> > ffff000008dab2d8 t __initcall_acpi_init4
>> > ffff000008dab2c8 t __initcall_xgene_pcie_msi_init4
>> >
>> > Best regards,
>> > Khuong Dinh
>> >
>> >> Even by ordering devices in the ACPI tables (that I abhor) I still do
>> >> not understand how this works (I mean without relying on kernel link
>> >> order to ensure that the MSI driver is probed before PCI devices are
>> >> enumerated in acpi_init()).
>> >>
>> >> Thanks,
>> >> Lorenzo
>> >>
>> >>> Best regards,
>> >>> Khuong
>> >>>
>> >>> On Fri, Apr 28, 2017 at 2:27 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>> >>> > On 28/04/17 01:54, Khuong Dinh wrote:
>> >>> >> From: Khuong Dinh <kdinh@apm.com>
>> >>> >>
>> >>> >> This patch makes pci-xgene-msi driver ACPI-aware and provides
>> >>> >> MSI capability for X-Gene v1 PCIe controllers in ACPI boot mode.
>> >>> >>
>> >>> >> Signed-off-by: Khuong Dinh <kdinh@apm.com>
>> >>> >> Signed-off-by: Duc Dang <dhdang@apm.com>
>> >>> >> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
>> >>> >> ---
>> >>> >> v2:
>> >>> >>  - Verify with BIOS version 3.06.25 and 3.07.09
>> >>> >> v1:
>> >>> >>  - Initial version
>> >>> >> ---
>> >>> >>  drivers/pci/host/pci-xgene-msi.c |   35 ++++++++++++++++++++++++++++++++---
>> >>> >>  1 files changed, 32 insertions(+), 3 deletions(-)
>> >>> >>
>> >>> >> diff --git a/drivers/pci/host/pci-xgene-msi.c b/drivers/pci/host/pci-xgene-msi.c
>> >>> >> index f1b633b..00aaa3d 100644
>> >>> >> --- a/drivers/pci/host/pci-xgene-msi.c
>> >>> >> +++ b/drivers/pci/host/pci-xgene-msi.c
>> >>> >> @@ -24,6 +24,7 @@
>> >>> >>  #include <linux/pci.h>
>> >>> >>  #include <linux/platform_device.h>
>> >>> >>  #include <linux/of_pci.h>
>> >>> >> +#include <linux/acpi.h>
>> >>> >>
>> >>> >>  #define MSI_IR0                      0x000000
>> >>> >>  #define MSI_INT0             0x800000
>> >>> >> @@ -39,7 +40,7 @@ struct xgene_msi_group {
>> >>> >>  };
>> >>> >>
>> >>> >>  struct xgene_msi {
>> >>> >> -     struct device_node      *node;
>> >>> >> +     struct fwnode_handle    *fwnode;
>> >>> >>       struct irq_domain       *inner_domain;
>> >>> >>       struct irq_domain       *msi_domain;
>> >>> >>       u64                     msi_addr;
>> >>> >> @@ -249,6 +250,13 @@ static void xgene_irq_domain_free(struct irq_domain *domain,
>> >>> >>       .free   = xgene_irq_domain_free,
>> >>> >>  };
>> >>> >>
>> >>> >> +#ifdef CONFIG_ACPI
>> >>> >> +static struct fwnode_handle *xgene_msi_get_fwnode(struct device *dev)
>> >>> >> +{
>> >>> >> +     return xgene_msi_ctrl.fwnode;
>> >>> >> +}
>> >>> >> +#endif
>> >>> >> +
>> >>> >>  static int xgene_allocate_domains(struct xgene_msi *msi)
>> >>> >>  {
>> >>> >>       msi->inner_domain = irq_domain_add_linear(NULL, NR_MSI_VEC,
>> >>> >> @@ -256,7 +264,7 @@ static int xgene_allocate_domains(struct xgene_msi *msi)
>> >>> >>       if (!msi->inner_domain)
>> >>> >>               return -ENOMEM;
>> >>> >>
>> >>> >> -     msi->msi_domain = pci_msi_create_irq_domain(of_node_to_fwnode(msi->node),
>> >>> >> +     msi->msi_domain = pci_msi_create_irq_domain(msi->fwnode,
>> >>> >>                                                   &xgene_msi_domain_info,
>> >>> >>                                                   msi->inner_domain);
>> >>> >>
>> >>> >> @@ -265,6 +273,9 @@ static int xgene_allocate_domains(struct xgene_msi *msi)
>> >>> >>               return -ENOMEM;
>> >>> >>       }
>> >>> >>
>> >>> >> +#ifdef CONFIG_ACPI
>> >>> >> +     pci_msi_register_fwnode_provider(&xgene_msi_get_fwnode);
>> >>> >> +#endif
>> >>> >>       return 0;
>> >>> >>  }
>> >>> >>
>> >>> >> @@ -449,6 +460,13 @@ static int xgene_msi_hwirq_free(unsigned int cpu)
>> >>> >>       {},
>> >>> >>  };
>> >>> >>
>> >>> >> +#ifdef CONFIG_ACPI
>> >>> >> +static const struct acpi_device_id xgene_msi_acpi_ids[] = {
>> >>> >> +     {"APMC0D0E", 0},
>> >>> >> +     { },
>> >>> >> +};
>> >>> >> +#endif
>> >>> >> +
>> >>> >>  static int xgene_msi_probe(struct platform_device *pdev)
>> >>> >>  {
>> >>> >>       struct resource *res;
>> >>> >> @@ -469,7 +487,17 @@ static int xgene_msi_probe(struct platform_device *pdev)
>> >>> >>               goto error;
>> >>> >>       }
>> >>> >>       xgene_msi->msi_addr = res->start;
>> >>> >> -     xgene_msi->node = pdev->dev.of_node;
>> >>> >> +
>> >>> >> +     xgene_msi->fwnode = of_node_to_fwnode(pdev->dev.of_node);
>> >>> >> +     if (!xgene_msi->fwnode) {
>> >>> >> +             xgene_msi->fwnode = irq_domain_alloc_fwnode(NULL);
>> >>> >
>> >>> > Please provide something other than NULL, such as the base address if
>> >>> > the device. That's quite useful for debugging.
>> >>> >
>> >>> >> +             if (!xgene_msi->fwnode) {
>> >>> >> +                     dev_err(&pdev->dev, "Failed to create fwnode\n");
>> >>> >> +                     rc = ENOMEM;
>> >>> >> +                     goto error;
>> >>> >> +             }
>> >>> >> +     }
>> >>> >> +
>> >>> >>       xgene_msi->num_cpus = num_possible_cpus();
>> >>> >>
>> >>> >>       rc = xgene_msi_init_allocator(xgene_msi);
>> >>> >> @@ -540,6 +568,7 @@ static int xgene_msi_probe(struct platform_device *pdev)
>> >>> >>       .driver = {
>> >>> >>               .name = "xgene-msi",
>> >>> >>               .of_match_table = xgene_msi_match_table,
>> >>> >> +             .acpi_match_table = ACPI_PTR(xgene_msi_acpi_ids),
>> >>> >>       },
>> >>> >>       .probe = xgene_msi_probe,
>> >>> >>       .remove = xgene_msi_remove,
>> >>> >>
>> >>> >
>> >>> > The code is trivial, but relies on the MSI controller to probe before
>> >>> > the PCI bus. What enforces this? How is it making sure that this is not
>> >>> > going to break in the next kernel release? As far as I can tell, there
>> >>> > is no explicit dependency between the two, making it the whole thing
>> >>> > extremely fragile.
>> >>> >
>> >>> > Thanks,
>> >>> >
>> >>> >         M.
>> >>> > --
>> >>> > Jazz is not dead. It just smells funny...
>> >>>
>> >>> --

WARNING: multiple messages have this Message-ID (diff)
From: Khuong Dinh <kdinh@apm.com>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: rjw@rjwysocki.net, Duc Dang <dhdang@apm.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	linux-pci@vger.kernel.org, msalter@redhat.com, patches@apm.com,
	linux-kernel@vger.kernel.org, jcm@redhat.com,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 pci] PCI/MSI: pci-xgene-msi: Enable MSI support in ACPI boot for X-Gene v1
Date: Tue, 13 Jun 2017 13:56:44 -0700	[thread overview]
Message-ID: <CAAsHzqv=mjd_k1K+uOSjfZmnrFeidpjg4DdqUtQeLvAYeCOC-w@mail.gmail.com> (raw)
In-Reply-To: <20170608103956.GB8644@red-moon>

SGkgTG9yZW56bywKCk9uIFRodSwgSnVuIDgsIDIwMTcgYXQgMzozOSBBTSwgTG9yZW56byBQaWVy
YWxpc2kKPGxvcmVuem8ucGllcmFsaXNpQGFybS5jb20+IHdyb3RlOgo+IE9uIFR1ZSwgSnVuIDA2
LCAyMDE3IGF0IDA5OjQ0OjE1QU0gLTA3MDAsIEtodW9uZyBEaW5oIHdyb3RlOgo+PiBIaSBMb3Jl
bnpvLAo+Pgo+PiBPbiBUdWUsIE1heSA5LCAyMDE3IGF0IDM6NTUgUE0sIEtodW9uZyBEaW5oIDxr
ZGluaEBhcG0uY29tPiB3cm90ZToKPj4gPiBIaSBMb3JlbnpvLAo+Pi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raW5nIHN1cmUgdGhhdCB0aGlzIGlzIG5vdAo+PiA+Pj4gPiBn
b2luZyB0byBicmVhayBpbiB0aGUgbmV4dCBrZXJuZWwgcmVsZWFzZT8gQXMgZmFyIGFzIEkgY2Fu
IHRlbGwsIHRoZXJlCj4+ID4+PiA+IGlzIG5vIGV4cGxpY2l0IGRlcGVuZGVuY3kgYmV0d2VlbiB0
aGUgdHdvLCBtYWtpbmcgaXQgdGhlIHdob2xlIHRoaW5nCj4+ID4+PiA+IGV4dHJlbWVseSBmcmFn
aWxlLgo+PiA+Pj4gPgo+PiA+Pj4gPiBUaGFua3MsCj4+ID4+PiA+Cj4+ID4+PiA+ICAgICAgICAg
TS4KPj4gPj4+ID4gLS0KPj4gPj4+ID4gSmF6eiBpcyBub3QgZGVhZC4gSXQganVzdCBzbWVsbHMg
ZnVubnkuLi4KPj4gPj4+Cj4+ID4+PiAtLQoKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX18KbGludXgtYXJtLWtlcm5lbCBtYWlsaW5nIGxpc3QKbGludXgtYXJt
LWtlcm5lbEBsaXN0cy5pbmZyYWRlYWQub3JnCmh0dHA6Ly9saXN0cy5pbmZyYWRlYWQub3JnL21h
aWxtYW4vbGlzdGluZm8vbGludXgtYXJtLWtlcm5lbAo=

WARNING: multiple messages have this Message-ID (diff)
From: kdinh@apm.com (Khuong Dinh)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 pci] PCI/MSI: pci-xgene-msi: Enable MSI support in ACPI boot for X-Gene v1
Date: Tue, 13 Jun 2017 13:56:44 -0700	[thread overview]
Message-ID: <CAAsHzqv=mjd_k1K+uOSjfZmnrFeidpjg4DdqUtQeLvAYeCOC-w@mail.gmail.com> (raw)
In-Reply-To: <20170608103956.GB8644@red-moon>

Hi Lorenzo,

On Thu, Jun 8, 2017 at 3:39 AM, Lorenzo Pieralisi
<lorenzo.pieralisi@arm.com> wrote:
> On Tue, Jun 06, 2017 at 09:44:15AM -0700, Khuong Dinh wrote:
>> Hi Lorenzo,
>>
>> On Tue, May 9, 2017 at 3:55 PM, Khuong Dinh <kdinh@apm.com> wrote:
>> > Hi Lorenzo,
>> >
>> > On Fri, May 5, 2017 at 9:51 AM, Lorenzo Pieralisi
>> > <lorenzo.pieralisi@arm.com> wrote:
>> >> On Thu, May 04, 2017 at 05:36:06PM -0700, Khuong Dinh wrote:
>> >>> Hi Marc,
>> >>> There's no explicit dependency between pcie driver and msi
>> >>> controller.  The current solution that we did is relying on the
>> >>> node ordering in BIOS.  ACPI 5.0 introduced _DEP method to assign a
>> >>> higher priority in start ordering.  This method could be applied in
>> >>> case of msi and pcie are the same level of subsys_init (in ACPI
>> >>> boot).  However, PCIe driver has not supported for this dependency
>> >>> check yet.  How do you think about this solution.
>> >>
>> >> First off, you can't post emails with confidentiality notices on
>> >> mailing lists so remove it from now onwards.
>> >
>> > Fixed
>> >
>> >> Secondly, I commented on this before, so you know what my opinion is.
>> >
>> > I got your opinion. I'll implement as your suggestion.
>> >
>>
>>   Regarding to your previous suggestion to add a hook walking the ACPI
>>   namespace before acpi_bus_scan() in acpi_scan_init() to make MSI
>>   controllers must be probed before PCI.  I have a concern that the
>>   MSI namespace ? _SB.MSIX? is not a unique name and how can we walk
>>   the ACPI namespace and use this name to make MSI probed before PCI.
>>   May you have little bit more information for this or do you have
>>   another suggestion for this?
>>
>>    There?s another solution which makes this simpler and I?d like to
>>    ask your opinion about this.
>>    The solution is to make an hierarchy between MSI and PCI nodes  as below:
>> Device(\_SB.MSIX) {
>>    Device(\_SB.PCI0)
>>    Device(\_SB.PCI1)
>>    ??
>> }
>>   In other word, MSIX node is a parent node of PCI nodes in ACPI
>>   table.  In this sense, there?s an explicit dependency between MSI
>>   and PCI, MSI controller must be probed before PCI and it will
>>   guarantee not breaking next kernel releases.  How do you think about
>>   this solution.
>
> I think that's a plaster as ineffective as reordering nodes, in short
> it is not a solution and you still rely on kernel link ordering, you
> can fiddle with ACPI tables as much as you want but that does not change.
>
>>  I also tried to use _DEP method to describe the dependency of PCIe
>>  nodes, but it looks that it does not work as PCI and MSI are handed
>>  by acpi_bus_scan and still having issue when we re-probe PCI.
>
> That's a tad vague to be frank, anyway it is pretty clear to me that we
> have hit a wall. In ACPI there is no way to describe probe dependencies
> like the one you have, it is as simple as that, and this MSI issue you
> are facing is just an example, there are more eg:
>
> https://www.spinics.net/lists/arm-kernel/msg585825.html
>
> At the end of the day the choice is simple either we accept (and we
> maintain because that's the problem) these hacks - and I am not willing
> to do that - or we find a way to solve this from a general perspective not
> as a point hack.
>
> I can have a look at solving the whole issue but it won't happen
> tomorrow.

Thanks for helping to resolve this general ACPI dependence issue.
I look forward for a version to test with.

Can we separate the general dependence patch from the X-Gene MSI ACPI
enable patch.
This original patch was to enable ACPI support for PCIe MSI.
The dependence issue can be resolved separately.
Can you help to pull in the patch.

Best regards,
Khuong Dinh

> Thanks,
> Lorenzo
>
>> Thanks,
>> Khuong Dinh
>>
>> >> Finally, please execute this command on the vmlinux that "works"
>> >> for you:
>> >>
>> >> nm vmlinux | grep -E '__initcall_(xgene_pcie_msi_init|acpi_init)'
>> >
>> > $ nm vmlinux | grep -E '__initcall_(xgene_pcie_msi_init|acpi_init)'
>> > ffff000008dab2d8 t __initcall_acpi_init4
>> > ffff000008dab2c8 t __initcall_xgene_pcie_msi_init4
>> >
>> > Best regards,
>> > Khuong Dinh
>> >
>> >> Even by ordering devices in the ACPI tables (that I abhor) I still do
>> >> not understand how this works (I mean without relying on kernel link
>> >> order to ensure that the MSI driver is probed before PCI devices are
>> >> enumerated in acpi_init()).
>> >>
>> >> Thanks,
>> >> Lorenzo
>> >>
>> >>> Best regards,
>> >>> Khuong
>> >>>
>> >>> On Fri, Apr 28, 2017 at 2:27 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>> >>> > On 28/04/17 01:54, Khuong Dinh wrote:
>> >>> >> From: Khuong Dinh <kdinh@apm.com>
>> >>> >>
>> >>> >> This patch makes pci-xgene-msi driver ACPI-aware and provides
>> >>> >> MSI capability for X-Gene v1 PCIe controllers in ACPI boot mode.
>> >>> >>
>> >>> >> Signed-off-by: Khuong Dinh <kdinh@apm.com>
>> >>> >> Signed-off-by: Duc Dang <dhdang@apm.com>
>> >>> >> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
>> >>> >> ---
>> >>> >> v2:
>> >>> >>  - Verify with BIOS version 3.06.25 and 3.07.09
>> >>> >> v1:
>> >>> >>  - Initial version
>> >>> >> ---
>> >>> >>  drivers/pci/host/pci-xgene-msi.c |   35 ++++++++++++++++++++++++++++++++---
>> >>> >>  1 files changed, 32 insertions(+), 3 deletions(-)
>> >>> >>
>> >>> >> diff --git a/drivers/pci/host/pci-xgene-msi.c b/drivers/pci/host/pci-xgene-msi.c
>> >>> >> index f1b633b..00aaa3d 100644
>> >>> >> --- a/drivers/pci/host/pci-xgene-msi.c
>> >>> >> +++ b/drivers/pci/host/pci-xgene-msi.c
>> >>> >> @@ -24,6 +24,7 @@
>> >>> >>  #include <linux/pci.h>
>> >>> >>  #include <linux/platform_device.h>
>> >>> >>  #include <linux/of_pci.h>
>> >>> >> +#include <linux/acpi.h>
>> >>> >>
>> >>> >>  #define MSI_IR0                      0x000000
>> >>> >>  #define MSI_INT0             0x800000
>> >>> >> @@ -39,7 +40,7 @@ struct xgene_msi_group {
>> >>> >>  };
>> >>> >>
>> >>> >>  struct xgene_msi {
>> >>> >> -     struct device_node      *node;
>> >>> >> +     struct fwnode_handle    *fwnode;
>> >>> >>       struct irq_domain       *inner_domain;
>> >>> >>       struct irq_domain       *msi_domain;
>> >>> >>       u64                     msi_addr;
>> >>> >> @@ -249,6 +250,13 @@ static void xgene_irq_domain_free(struct irq_domain *domain,
>> >>> >>       .free   = xgene_irq_domain_free,
>> >>> >>  };
>> >>> >>
>> >>> >> +#ifdef CONFIG_ACPI
>> >>> >> +static struct fwnode_handle *xgene_msi_get_fwnode(struct device *dev)
>> >>> >> +{
>> >>> >> +     return xgene_msi_ctrl.fwnode;
>> >>> >> +}
>> >>> >> +#endif
>> >>> >> +
>> >>> >>  static int xgene_allocate_domains(struct xgene_msi *msi)
>> >>> >>  {
>> >>> >>       msi->inner_domain = irq_domain_add_linear(NULL, NR_MSI_VEC,
>> >>> >> @@ -256,7 +264,7 @@ static int xgene_allocate_domains(struct xgene_msi *msi)
>> >>> >>       if (!msi->inner_domain)
>> >>> >>               return -ENOMEM;
>> >>> >>
>> >>> >> -     msi->msi_domain = pci_msi_create_irq_domain(of_node_to_fwnode(msi->node),
>> >>> >> +     msi->msi_domain = pci_msi_create_irq_domain(msi->fwnode,
>> >>> >>                                                   &xgene_msi_domain_info,
>> >>> >>                                                   msi->inner_domain);
>> >>> >>
>> >>> >> @@ -265,6 +273,9 @@ static int xgene_allocate_domains(struct xgene_msi *msi)
>> >>> >>               return -ENOMEM;
>> >>> >>       }
>> >>> >>
>> >>> >> +#ifdef CONFIG_ACPI
>> >>> >> +     pci_msi_register_fwnode_provider(&xgene_msi_get_fwnode);
>> >>> >> +#endif
>> >>> >>       return 0;
>> >>> >>  }
>> >>> >>
>> >>> >> @@ -449,6 +460,13 @@ static int xgene_msi_hwirq_free(unsigned int cpu)
>> >>> >>       {},
>> >>> >>  };
>> >>> >>
>> >>> >> +#ifdef CONFIG_ACPI
>> >>> >> +static const struct acpi_device_id xgene_msi_acpi_ids[] = {
>> >>> >> +     {"APMC0D0E", 0},
>> >>> >> +     { },
>> >>> >> +};
>> >>> >> +#endif
>> >>> >> +
>> >>> >>  static int xgene_msi_probe(struct platform_device *pdev)
>> >>> >>  {
>> >>> >>       struct resource *res;
>> >>> >> @@ -469,7 +487,17 @@ static int xgene_msi_probe(struct platform_device *pdev)
>> >>> >>               goto error;
>> >>> >>       }
>> >>> >>       xgene_msi->msi_addr = res->start;
>> >>> >> -     xgene_msi->node = pdev->dev.of_node;
>> >>> >> +
>> >>> >> +     xgene_msi->fwnode = of_node_to_fwnode(pdev->dev.of_node);
>> >>> >> +     if (!xgene_msi->fwnode) {
>> >>> >> +             xgene_msi->fwnode = irq_domain_alloc_fwnode(NULL);
>> >>> >
>> >>> > Please provide something other than NULL, such as the base address if
>> >>> > the device. That's quite useful for debugging.
>> >>> >
>> >>> >> +             if (!xgene_msi->fwnode) {
>> >>> >> +                     dev_err(&pdev->dev, "Failed to create fwnode\n");
>> >>> >> +                     rc = ENOMEM;
>> >>> >> +                     goto error;
>> >>> >> +             }
>> >>> >> +     }
>> >>> >> +
>> >>> >>       xgene_msi->num_cpus = num_possible_cpus();
>> >>> >>
>> >>> >>       rc = xgene_msi_init_allocator(xgene_msi);
>> >>> >> @@ -540,6 +568,7 @@ static int xgene_msi_probe(struct platform_device *pdev)
>> >>> >>       .driver = {
>> >>> >>               .name = "xgene-msi",
>> >>> >>               .of_match_table = xgene_msi_match_table,
>> >>> >> +             .acpi_match_table = ACPI_PTR(xgene_msi_acpi_ids),
>> >>> >>       },
>> >>> >>       .probe = xgene_msi_probe,
>> >>> >>       .remove = xgene_msi_remove,
>> >>> >>
>> >>> >
>> >>> > The code is trivial, but relies on the MSI controller to probe before
>> >>> > the PCI bus. What enforces this? How is it making sure that this is not
>> >>> > going to break in the next kernel release? As far as I can tell, there
>> >>> > is no explicit dependency between the two, making it the whole thing
>> >>> > extremely fragile.
>> >>> >
>> >>> > Thanks,
>> >>> >
>> >>> >         M.
>> >>> > --
>> >>> > Jazz is not dead. It just smells funny...
>> >>>
>> >>> --

  reply	other threads:[~2017-06-13 20:56 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28  0:54 [PATCH v2 pci] PCI/MSI: pci-xgene-msi: Enable MSI support in ACPI boot for X-Gene v1 Khuong Dinh
2017-04-28  0:54 ` Khuong Dinh
2017-04-28  0:54 ` Khuong Dinh
2017-04-28  5:11 ` Jon Masters
2017-04-28  5:11   ` Jon Masters
2017-04-28  5:11   ` Jon Masters
2017-04-28 16:36   ` Jon Masters
2017-04-28 16:36     ` Jon Masters
2017-04-28 16:36     ` Jon Masters
2017-05-04 23:24     ` Jon Masters
2017-05-04 23:24       ` Jon Masters
2017-05-04 23:24       ` Jon Masters
2017-04-28  9:27 ` Marc Zyngier
2017-04-28  9:27   ` Marc Zyngier
2017-04-28  9:27   ` Marc Zyngier
2017-05-05  0:36   ` Khuong Dinh
2017-05-05  0:36     ` Khuong Dinh
2017-05-05  0:36     ` Khuong Dinh
2017-05-05 16:51     ` Lorenzo Pieralisi
2017-05-05 16:51       ` Lorenzo Pieralisi
2017-05-05 16:51       ` Lorenzo Pieralisi
2017-05-09 22:55       ` Khuong Dinh
2017-05-09 22:55         ` Khuong Dinh
2017-05-09 22:55         ` Khuong Dinh
2017-06-06 16:44         ` Khuong Dinh
2017-06-06 16:44           ` Khuong Dinh
2017-06-06 16:44           ` Khuong Dinh
2017-06-08 10:39           ` Lorenzo Pieralisi
2017-06-08 10:39             ` Lorenzo Pieralisi
2017-06-08 10:39             ` Lorenzo Pieralisi
2017-06-13 20:56             ` Khuong Dinh [this message]
2017-06-13 20:56               ` Khuong Dinh
2017-06-13 20:56               ` Khuong Dinh
2017-06-14 12:59               ` Lorenzo Pieralisi
2017-06-14 12:59                 ` Lorenzo Pieralisi
2017-06-14 12:59                 ` Lorenzo Pieralisi
2017-06-14 17:43                 ` Khuong Dinh
2017-06-14 17:43                   ` Khuong Dinh
2017-06-14 17:43                   ` Khuong Dinh
2017-06-15 11:06                   ` Lorenzo Pieralisi
2017-06-15 11:06                     ` Lorenzo Pieralisi
2017-06-15 11:06                     ` Lorenzo Pieralisi
2017-05-31 11:29 ` Jonathan Toppins
2017-05-31 11:29   ` Jonathan Toppins
2017-05-31 16:13   ` Loc Ho
2017-05-31 16:13     ` Loc Ho
2017-05-31 16:13     ` Loc Ho

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='CAAsHzqv=mjd_k1K+uOSjfZmnrFeidpjg4DdqUtQeLvAYeCOC-w@mail.gmail.com' \
    --to=kdinh@apm.com \
    --cc=bhelgaas@google.com \
    --cc=dhdang@apm.com \
    --cc=jcm@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marc.zyngier@arm.com \
    --cc=msalter@redhat.com \
    --cc=patches@apm.com \
    --cc=rjw@rjwysocki.net \
    /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.