All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Khuong Dinh <kdinh@apm.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: Wed, 14 Jun 2017 13:59:02 +0100	[thread overview]
Message-ID: <20170614125902.GA29762@red-moon> (raw)
In-Reply-To: <CAAsHzqv=mjd_k1K+uOSjfZmnrFeidpjg4DdqUtQeLvAYeCOC-w@mail.gmail.com>

On Tue, Jun 13, 2017 at 01:56:44PM -0700, Khuong Dinh wrote:
> 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.

Ok, pragmatically the only sane thing you can do is:

(1)  Add an X-gene specific hook in drivers/acpi/scan.c (acpi_scan_init())
     that carries out fwnode registration (ie register the fwnode by
     searching the MSI HID object - this does not depend on ACPI device
     nodes order - you enforce the order by parsing the namespace before
     ACPI core does it, at that point in time ACPI objects are created).
     Not sure Rafael will be happy to see this code but that's the only
     solution that does not rely on ACPI device nodes ordering and kernel
     link ordering. You may achieve the same by extending the ACPI APD
     code (drivers/acpi/acpi_apd.c) whether that's the best way forward is
     to be seen.

(2)  You can also add an xgene specific scan handler at arch_init_call()
     but given that PCI root bridge is managed through a scan handler too you
     would rely on ACPI devices nodes ordering in the DSDT. Let me explain
     something for the benefit of everyone reading this thread: I do not want
     X-gene ACPI tables to force the kernel to scan devices in any order
     whatsover because this would mean we will _never_ be able to change the
     scan order if we wanted to lest we trigger regressions. So this is
     a non-option in my opinion.

(3) Last option is to register the MSI fwnode either in PCI ECAM quirk
    handling or in arm64 before probing the PCI root bus.

I am not keen on (2) and (3) at all, so _if_ we have to find a solution
to this problem (1) is the only option you have for the time being as
far as I am concerned.

Lorenzo

> 
> 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: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Khuong Dinh <kdinh@apm.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: Wed, 14 Jun 2017 13:59:02 +0100	[thread overview]
Message-ID: <20170614125902.GA29762@red-moon> (raw)
In-Reply-To: <CAAsHzqv=mjd_k1K+uOSjfZmnrFeidpjg4DdqUtQeLvAYeCOC-w@mail.gmail.com>

T24gVHVlLCBKdW4gMTMsIDIwMTcgYXQgMDE6NTY6NDRQTSAtMDcwMCwgS2h1b25nIERpbmggd3Jv
dGU6Cj4gSGkgTG9yZW56bywKPiAKPiBPbiBUaHUsIEp1biA4LCAyMDE3IGF0IDM6MzkgQU0sIExv
cmVuem8gUGllcmFsaXNpCj4gPGxvcmVuem8ucGllcmFsaXNpQGFybS5jb20+IHdyb3RlOgo+ID4g
T24gVHVlLCBKdW4gMDYsIDIwMTcgYXQgMDk6NDQ6MTVBTSAtMDcwMCwgS2h1b25nIERpbmggd3Jv
dGU6Cj4gPj4gSGkgTG9yZW56bywKPiA+Pgo+ID4+IE9uIFR1ZSwgTWF5IDksIDIwMTcgYXQgMzo1
NSBQTSwgS2h1b25nIERpbmggPGtkaW5oQGFwbS5jb20+IHdyb3RlOgo+ID4+ID4gSGkgTG9yZW56
bywKPiA+PiA+Cj4gPj4gPiBPbiBGcmksIE1heSA1LCAyMDE3IGF0IDk6NTEgQU0sIExvcmV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X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fCmxpbnV4LWFybS1rZXJuZWwgbWFpbGluZyBsaXN0CmxpbnV4LWFybS1rZXJuZWxAbGlz
dHMuaW5mcmFkZWFkLm9yZwpodHRwOi8vbGlzdHMuaW5mcmFkZWFkLm9yZy9tYWlsbWFuL2xpc3Rp
bmZvL2xpbnV4LWFybS1rZXJuZWwK

WARNING: multiple messages have this Message-ID (diff)
From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
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: Wed, 14 Jun 2017 13:59:02 +0100	[thread overview]
Message-ID: <20170614125902.GA29762@red-moon> (raw)
In-Reply-To: <CAAsHzqv=mjd_k1K+uOSjfZmnrFeidpjg4DdqUtQeLvAYeCOC-w@mail.gmail.com>

On Tue, Jun 13, 2017 at 01:56:44PM -0700, Khuong Dinh wrote:
> 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.

Ok, pragmatically the only sane thing you can do is:

(1)  Add an X-gene specific hook in drivers/acpi/scan.c (acpi_scan_init())
     that carries out fwnode registration (ie register the fwnode by
     searching the MSI HID object - this does not depend on ACPI device
     nodes order - you enforce the order by parsing the namespace before
     ACPI core does it, at that point in time ACPI objects are created).
     Not sure Rafael will be happy to see this code but that's the only
     solution that does not rely on ACPI device nodes ordering and kernel
     link ordering. You may achieve the same by extending the ACPI APD
     code (drivers/acpi/acpi_apd.c) whether that's the best way forward is
     to be seen.

(2)  You can also add an xgene specific scan handler at arch_init_call()
     but given that PCI root bridge is managed through a scan handler too you
     would rely on ACPI devices nodes ordering in the DSDT. Let me explain
     something for the benefit of everyone reading this thread: I do not want
     X-gene ACPI tables to force the kernel to scan devices in any order
     whatsover because this would mean we will _never_ be able to change the
     scan order if we wanted to lest we trigger regressions. So this is
     a non-option in my opinion.

(3) Last option is to register the MSI fwnode either in PCI ECAM quirk
    handling or in arm64 before probing the PCI root bus.

I am not keen on (2) and (3) at all, so _if_ we have to find a solution
to this problem (1) is the only option you have for the time being as
far as I am concerned.

Lorenzo

> 
> 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-14 12:57 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
2017-06-13 20:56               ` Khuong Dinh
2017-06-13 20:56               ` Khuong Dinh
2017-06-14 12:59               ` Lorenzo Pieralisi [this message]
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=20170614125902.GA29762@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=bhelgaas@google.com \
    --cc=dhdang@apm.com \
    --cc=jcm@redhat.com \
    --cc=kdinh@apm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --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.