linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: property: Add device link support for "iommu-map"
@ 2019-11-20 19:00 Will Deacon
  2019-11-20 21:29 ` Saravana Kannan
  2019-11-22 14:47 ` Rob Herring
  0 siblings, 2 replies; 8+ messages in thread
From: Will Deacon @ 2019-11-20 19:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: devicetree, iommu, Will Deacon, Greg Kroah-Hartman, Rob Herring,
	Saravana Kannan, Robin Murphy

Commit 8e12257dead7 ("of: property: Add device link support for iommus,
mboxes and io-channels") added device link support for IOMMU linkages
described using the "iommus" property. For PCI devices, this property
is not present and instead the "iommu-map" property is used on the host
bridge node to map the endpoint RequesterIDs to their corresponding
IOMMU instance.

Add support for "iommu-map" to the device link supplier bindings so that
probing of PCI devices can be deferred until after the IOMMU is
available.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Saravana Kannan <saravanak@google.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
---

Applies against driver-core/driver-core-next.
Tested on AMD Seattle (arm64).

 drivers/of/property.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 0fa04692e3cc..37e0d408430d 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1190,10 +1190,20 @@ DEFINE_SIMPLE_PROP(mboxes, "mboxes", "#mbox-cells")
 DEFINE_SIMPLE_PROP(io_channels, "io-channel", "#io-channel-cells")
 DEFINE_SUFFIX_PROP(regulators, "-supply", NULL)
 
+static struct device_node *parse_iommu_maps(struct device_node *np,
+					    const char *prop_name, int index)
+{
+	if (strcmp(prop_name, "iommu-map"))
+		return NULL;
+
+	return of_parse_phandle(np, prop_name, (index * 4) + 1);
+}
+
 static const struct supplier_bindings of_supplier_bindings[] = {
 	{ .parse_prop = parse_clocks, },
 	{ .parse_prop = parse_interconnects, },
 	{ .parse_prop = parse_iommus, },
+	{ .parse_prop = parse_iommu_maps, },
 	{ .parse_prop = parse_mboxes, },
 	{ .parse_prop = parse_io_channels, },
 	{ .parse_prop = parse_regulators, },
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] of: property: Add device link support for "iommu-map"
  2019-11-20 19:00 [PATCH] of: property: Add device link support for "iommu-map" Will Deacon
@ 2019-11-20 21:29 ` Saravana Kannan
  2019-11-22 14:47 ` Rob Herring
  1 sibling, 0 replies; 8+ messages in thread
From: Saravana Kannan @ 2019-11-20 21:29 UTC (permalink / raw)
  To: Will Deacon
  Cc: LKML, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	iommu, Greg Kroah-Hartman, Rob Herring, Robin Murphy

On Wed, Nov 20, 2019 at 11:00 AM Will Deacon <will@kernel.org> wrote:
>
> Commit 8e12257dead7 ("of: property: Add device link support for iommus,
> mboxes and io-channels") added device link support for IOMMU linkages
> described using the "iommus" property. For PCI devices, this property
> is not present and instead the "iommu-map" property is used on the host
> bridge node to map the endpoint RequesterIDs to their corresponding
> IOMMU instance.
>
> Add support for "iommu-map" to the device link supplier bindings so that
> probing of PCI devices can be deferred until after the IOMMU is
> available.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Saravana Kannan <saravanak@google.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Will Deacon <will@kernel.org>
> ---
>
> Applies against driver-core/driver-core-next.
> Tested on AMD Seattle (arm64).
>
>  drivers/of/property.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index 0fa04692e3cc..37e0d408430d 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1190,10 +1190,20 @@ DEFINE_SIMPLE_PROP(mboxes, "mboxes", "#mbox-cells")
>  DEFINE_SIMPLE_PROP(io_channels, "io-channel", "#io-channel-cells")
>  DEFINE_SUFFIX_PROP(regulators, "-supply", NULL)
>
> +static struct device_node *parse_iommu_maps(struct device_node *np,
> +                                           const char *prop_name, int index)
> +{
> +       if (strcmp(prop_name, "iommu-map"))
> +               return NULL;
> +
> +       return of_parse_phandle(np, prop_name, (index * 4) + 1);
> +}
> +
>  static const struct supplier_bindings of_supplier_bindings[] = {
>         { .parse_prop = parse_clocks, },
>         { .parse_prop = parse_interconnects, },
>         { .parse_prop = parse_iommus, },
> +       { .parse_prop = parse_iommu_maps, },
>         { .parse_prop = parse_mboxes, },
>         { .parse_prop = parse_io_channels, },
>         { .parse_prop = parse_regulators, },

Heh... a lot smaller than I thought this would be.

Acked-by: Saravana Kannan <saravanak@google.com>

-Saravana

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] of: property: Add device link support for "iommu-map"
  2019-11-20 19:00 [PATCH] of: property: Add device link support for "iommu-map" Will Deacon
  2019-11-20 21:29 ` Saravana Kannan
@ 2019-11-22 14:47 ` Rob Herring
  2019-11-22 14:55   ` Will Deacon
  1 sibling, 1 reply; 8+ messages in thread
From: Rob Herring @ 2019-11-22 14:47 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-kernel, devicetree, iommu, Greg Kroah-Hartman,
	Saravana Kannan, Robin Murphy

On Wed, Nov 20, 2019 at 1:00 PM Will Deacon <will@kernel.org> wrote:
>
> Commit 8e12257dead7 ("of: property: Add device link support for iommus,
> mboxes and io-channels") added device link support for IOMMU linkages
> described using the "iommus" property. For PCI devices, this property
> is not present and instead the "iommu-map" property is used on the host
> bridge node to map the endpoint RequesterIDs to their corresponding
> IOMMU instance.
>
> Add support for "iommu-map" to the device link supplier bindings so that
> probing of PCI devices can be deferred until after the IOMMU is
> available.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Saravana Kannan <saravanak@google.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Will Deacon <will@kernel.org>
> ---
>
> Applies against driver-core/driver-core-next.
> Tested on AMD Seattle (arm64).

Guess that answers my question whether anyone uses Seattle with DT.
Seattle uses the old SMMU binding, and there's not even an IOMMU
associated with the PCI host. I raise this mainly because the dts
files for Seattle either need some love or perhaps should be removed.

No issues with the patch itself though. I'll queue it after rc1.

Rob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] of: property: Add device link support for "iommu-map"
  2019-11-22 14:47 ` Rob Herring
@ 2019-11-22 14:55   ` Will Deacon
  2019-11-22 16:01     ` Rob Herring
  0 siblings, 1 reply; 8+ messages in thread
From: Will Deacon @ 2019-11-22 14:55 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-kernel, devicetree, iommu, Greg Kroah-Hartman,
	Saravana Kannan, Robin Murphy, ard.biesheuvel

[+Ard]

Hi Rob,

On Fri, Nov 22, 2019 at 08:47:46AM -0600, Rob Herring wrote:
> On Wed, Nov 20, 2019 at 1:00 PM Will Deacon <will@kernel.org> wrote:
> >
> > Commit 8e12257dead7 ("of: property: Add device link support for iommus,
> > mboxes and io-channels") added device link support for IOMMU linkages
> > described using the "iommus" property. For PCI devices, this property
> > is not present and instead the "iommu-map" property is used on the host
> > bridge node to map the endpoint RequesterIDs to their corresponding
> > IOMMU instance.
> >
> > Add support for "iommu-map" to the device link supplier bindings so that
> > probing of PCI devices can be deferred until after the IOMMU is
> > available.
> >
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Rob Herring <robh@kernel.org>
> > Cc: Saravana Kannan <saravanak@google.com>
> > Cc: Robin Murphy <robin.murphy@arm.com>
> > Signed-off-by: Will Deacon <will@kernel.org>
> > ---
> >
> > Applies against driver-core/driver-core-next.
> > Tested on AMD Seattle (arm64).
> 
> Guess that answers my question whether anyone uses Seattle with DT.
> Seattle uses the old SMMU binding, and there's not even an IOMMU
> associated with the PCI host. I raise this mainly because the dts
> files for Seattle either need some love or perhaps should be removed.

I'm using the new DT bindings on my Seattle, thanks to the firmware fairy
(Ard) visiting my flat with a dediprog. The patches I've posted to enable
modular builds of the arm-smmu driver require that the old binding is
disabled [1].

> No issues with the patch itself though. I'll queue it after rc1.

Thanks, although I think Greg has already queued it [2] due to the
dependencies on other patches in his tree.

Will

[1] https://lore.kernel.org/lkml/20191121114918.2293-14-will@kernel.org/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=driver-core-next&id=e149573b2f84d0517648dafc0db625afa681ed54

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] of: property: Add device link support for "iommu-map"
  2019-11-22 14:55   ` Will Deacon
@ 2019-11-22 16:01     ` Rob Herring
  2019-11-22 16:12       ` Ard Biesheuvel
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2019-11-22 16:01 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-kernel, devicetree, iommu, Greg Kroah-Hartman,
	Saravana Kannan, Robin Murphy, Ard Biesheuvel

On Fri, Nov 22, 2019 at 8:55 AM Will Deacon <will@kernel.org> wrote:
>
> [+Ard]
>
> Hi Rob,
>
> On Fri, Nov 22, 2019 at 08:47:46AM -0600, Rob Herring wrote:
> > On Wed, Nov 20, 2019 at 1:00 PM Will Deacon <will@kernel.org> wrote:
> > >
> > > Commit 8e12257dead7 ("of: property: Add device link support for iommus,
> > > mboxes and io-channels") added device link support for IOMMU linkages
> > > described using the "iommus" property. For PCI devices, this property
> > > is not present and instead the "iommu-map" property is used on the host
> > > bridge node to map the endpoint RequesterIDs to their corresponding
> > > IOMMU instance.
> > >
> > > Add support for "iommu-map" to the device link supplier bindings so that
> > > probing of PCI devices can be deferred until after the IOMMU is
> > > available.
> > >
> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Cc: Rob Herring <robh@kernel.org>
> > > Cc: Saravana Kannan <saravanak@google.com>
> > > Cc: Robin Murphy <robin.murphy@arm.com>
> > > Signed-off-by: Will Deacon <will@kernel.org>
> > > ---
> > >
> > > Applies against driver-core/driver-core-next.
> > > Tested on AMD Seattle (arm64).
> >
> > Guess that answers my question whether anyone uses Seattle with DT.
> > Seattle uses the old SMMU binding, and there's not even an IOMMU
> > associated with the PCI host. I raise this mainly because the dts
> > files for Seattle either need some love or perhaps should be removed.
>
> I'm using the new DT bindings on my Seattle, thanks to the firmware fairy
> (Ard) visiting my flat with a dediprog. The patches I've posted to enable
> modular builds of the arm-smmu driver require that the old binding is
> disabled [1].

Going to post those dts changes?

> > No issues with the patch itself though. I'll queue it after rc1.
>
> Thanks, although I think Greg has already queued it [2] due to the
> dependencies on other patches in his tree.

Okay, forgot to check my spam from Greg folder and missed that.

Rob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] of: property: Add device link support for "iommu-map"
  2019-11-22 16:01     ` Rob Herring
@ 2019-11-22 16:12       ` Ard Biesheuvel
  2019-11-22 20:16         ` Rob Herring
  0 siblings, 1 reply; 8+ messages in thread
From: Ard Biesheuvel @ 2019-11-22 16:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: Will Deacon, linux-kernel, Devicetree List, iommu,
	Greg Kroah-Hartman, Saravana Kannan, Robin Murphy

On Fri, 22 Nov 2019 at 17:01, Rob Herring <robh@kernel.org> wrote:
>
> On Fri, Nov 22, 2019 at 8:55 AM Will Deacon <will@kernel.org> wrote:
> >
> > [+Ard]
> >
> > Hi Rob,
> >
> > On Fri, Nov 22, 2019 at 08:47:46AM -0600, Rob Herring wrote:
> > > On Wed, Nov 20, 2019 at 1:00 PM Will Deacon <will@kernel.org> wrote:
> > > >
> > > > Commit 8e12257dead7 ("of: property: Add device link support for iommus,
> > > > mboxes and io-channels") added device link support for IOMMU linkages
> > > > described using the "iommus" property. For PCI devices, this property
> > > > is not present and instead the "iommu-map" property is used on the host
> > > > bridge node to map the endpoint RequesterIDs to their corresponding
> > > > IOMMU instance.
> > > >
> > > > Add support for "iommu-map" to the device link supplier bindings so that
> > > > probing of PCI devices can be deferred until after the IOMMU is
> > > > available.
> > > >
> > > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > Cc: Rob Herring <robh@kernel.org>
> > > > Cc: Saravana Kannan <saravanak@google.com>
> > > > Cc: Robin Murphy <robin.murphy@arm.com>
> > > > Signed-off-by: Will Deacon <will@kernel.org>
> > > > ---
> > > >
> > > > Applies against driver-core/driver-core-next.
> > > > Tested on AMD Seattle (arm64).
> > >
> > > Guess that answers my question whether anyone uses Seattle with DT.
> > > Seattle uses the old SMMU binding, and there's not even an IOMMU
> > > associated with the PCI host. I raise this mainly because the dts
> > > files for Seattle either need some love or perhaps should be removed.
> >
> > I'm using the new DT bindings on my Seattle, thanks to the firmware fairy
> > (Ard) visiting my flat with a dediprog. The patches I've posted to enable
> > modular builds of the arm-smmu driver require that the old binding is
> > disabled [1].
>
> Going to post those dts changes?
>

Last time I tried upstreaming seattle DT changes I got zero response,
so I didn't bother since.


> > > No issues with the patch itself though. I'll queue it after rc1.
> >
> > Thanks, although I think Greg has already queued it [2] due to the
> > dependencies on other patches in his tree.
>
> Okay, forgot to check my spam from Greg folder and missed that.
>
> Rob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] of: property: Add device link support for "iommu-map"
  2019-11-22 16:12       ` Ard Biesheuvel
@ 2019-11-22 20:16         ` Rob Herring
  2019-11-25  7:49           ` Will Deacon
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2019-11-22 20:16 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Will Deacon, linux-kernel, Devicetree List, iommu,
	Greg Kroah-Hartman, Saravana Kannan, Robin Murphy

On Fri, Nov 22, 2019 at 10:13 AM Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
>
> On Fri, 22 Nov 2019 at 17:01, Rob Herring <robh@kernel.org> wrote:
> >
> > On Fri, Nov 22, 2019 at 8:55 AM Will Deacon <will@kernel.org> wrote:
> > >
> > > [+Ard]
> > >
> > > Hi Rob,
> > >
> > > On Fri, Nov 22, 2019 at 08:47:46AM -0600, Rob Herring wrote:
> > > > On Wed, Nov 20, 2019 at 1:00 PM Will Deacon <will@kernel.org> wrote:
> > > > >
> > > > > Commit 8e12257dead7 ("of: property: Add device link support for iommus,
> > > > > mboxes and io-channels") added device link support for IOMMU linkages
> > > > > described using the "iommus" property. For PCI devices, this property
> > > > > is not present and instead the "iommu-map" property is used on the host
> > > > > bridge node to map the endpoint RequesterIDs to their corresponding
> > > > > IOMMU instance.
> > > > >
> > > > > Add support for "iommu-map" to the device link supplier bindings so that
> > > > > probing of PCI devices can be deferred until after the IOMMU is
> > > > > available.
> > > > >
> > > > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > > Cc: Rob Herring <robh@kernel.org>
> > > > > Cc: Saravana Kannan <saravanak@google.com>
> > > > > Cc: Robin Murphy <robin.murphy@arm.com>
> > > > > Signed-off-by: Will Deacon <will@kernel.org>
> > > > > ---
> > > > >
> > > > > Applies against driver-core/driver-core-next.
> > > > > Tested on AMD Seattle (arm64).
> > > >
> > > > Guess that answers my question whether anyone uses Seattle with DT.
> > > > Seattle uses the old SMMU binding, and there's not even an IOMMU
> > > > associated with the PCI host. I raise this mainly because the dts
> > > > files for Seattle either need some love or perhaps should be removed.
> > >
> > > I'm using the new DT bindings on my Seattle, thanks to the firmware fairy
> > > (Ard) visiting my flat with a dediprog. The patches I've posted to enable
> > > modular builds of the arm-smmu driver require that the old binding is
> > > disabled [1].
> >
> > Going to post those dts changes?
> >
>
> Last time I tried upstreaming seattle DT changes I got zero response,
> so I didn't bother since.

I leave most dts reviews up to sub-arch maintainers and I'm pretty
sure AMD doesn't care about it anymore, so we need a new maintainer or
just send a pull request to Arnd/Olof.

Rob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] of: property: Add device link support for "iommu-map"
  2019-11-22 20:16         ` Rob Herring
@ 2019-11-25  7:49           ` Will Deacon
  0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2019-11-25  7:49 UTC (permalink / raw)
  To: Rob Herring
  Cc: Ard Biesheuvel, linux-kernel, Devicetree List, iommu,
	Greg Kroah-Hartman, Saravana Kannan, Robin Murphy

On Fri, Nov 22, 2019 at 02:16:31PM -0600, Rob Herring wrote:
> On Fri, Nov 22, 2019 at 10:13 AM Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
> >
> > On Fri, 22 Nov 2019 at 17:01, Rob Herring <robh@kernel.org> wrote:
> > >
> > > On Fri, Nov 22, 2019 at 8:55 AM Will Deacon <will@kernel.org> wrote:
> > > >
> > > > [+Ard]
> > > >
> > > > Hi Rob,
> > > >
> > > > On Fri, Nov 22, 2019 at 08:47:46AM -0600, Rob Herring wrote:
> > > > > On Wed, Nov 20, 2019 at 1:00 PM Will Deacon <will@kernel.org> wrote:
> > > > > >
> > > > > > Commit 8e12257dead7 ("of: property: Add device link support for iommus,
> > > > > > mboxes and io-channels") added device link support for IOMMU linkages
> > > > > > described using the "iommus" property. For PCI devices, this property
> > > > > > is not present and instead the "iommu-map" property is used on the host
> > > > > > bridge node to map the endpoint RequesterIDs to their corresponding
> > > > > > IOMMU instance.
> > > > > >
> > > > > > Add support for "iommu-map" to the device link supplier bindings so that
> > > > > > probing of PCI devices can be deferred until after the IOMMU is
> > > > > > available.
> > > > > >
> > > > > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > > > Cc: Rob Herring <robh@kernel.org>
> > > > > > Cc: Saravana Kannan <saravanak@google.com>
> > > > > > Cc: Robin Murphy <robin.murphy@arm.com>
> > > > > > Signed-off-by: Will Deacon <will@kernel.org>
> > > > > > ---
> > > > > >
> > > > > > Applies against driver-core/driver-core-next.
> > > > > > Tested on AMD Seattle (arm64).
> > > > >
> > > > > Guess that answers my question whether anyone uses Seattle with DT.
> > > > > Seattle uses the old SMMU binding, and there's not even an IOMMU
> > > > > associated with the PCI host. I raise this mainly because the dts
> > > > > files for Seattle either need some love or perhaps should be removed.
> > > >
> > > > I'm using the new DT bindings on my Seattle, thanks to the firmware fairy
> > > > (Ard) visiting my flat with a dediprog. The patches I've posted to enable
> > > > modular builds of the arm-smmu driver require that the old binding is
> > > > disabled [1].
> > >
> > > Going to post those dts changes?
> > >
> >
> > Last time I tried upstreaming seattle DT changes I got zero response,
> > so I didn't bother since.
> 
> I leave most dts reviews up to sub-arch maintainers and I'm pretty
> sure AMD doesn't care about it anymore, so we need a new maintainer or
> just send a pull request to Arnd/Olof.

Feel free to add my:

Tested-by: Will Deacon <will@kernel.org>

If it's the same as the DT exposed by the firmware I have.

Will

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-25  7:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 19:00 [PATCH] of: property: Add device link support for "iommu-map" Will Deacon
2019-11-20 21:29 ` Saravana Kannan
2019-11-22 14:47 ` Rob Herring
2019-11-22 14:55   ` Will Deacon
2019-11-22 16:01     ` Rob Herring
2019-11-22 16:12       ` Ard Biesheuvel
2019-11-22 20:16         ` Rob Herring
2019-11-25  7:49           ` Will Deacon

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).