diff mbox

[RFC] iommu/arm-smmu: Add global SMR masking property

Message ID ad6b6a4937b1fe183e6d48ccbaf4cb46db92fed4.1481893907.git.robin.murphy@arm.com
State Changes Requested, archived
Headers show

Commit Message

Robin Murphy Dec. 16, 2016, 1:19 p.m. UTC
The current SMR masking support using a 2-cell iommu-specifier is
primarily intended to handle individual masters with large and/or
complex Stream ID assignments; it quickly gets a bit clunky in other SMR
use-cases where we just want to consistently mask out the same part of
every Stream ID (e.g. for MMU-500 configurations where the appended TBU
number gets in the way unnecessarily). Let's add a new property to allow
a single global mask value to better fit the latter situation.

CC: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---

Compile-tested only...

 Documentation/devicetree/bindings/iommu/arm,smmu.txt | 8 ++++++++
 drivers/iommu/arm-smmu.c                             | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Nipun Gupta Dec. 17, 2016, 9:06 p.m. UTC | #1
> -----Original Message-----
> From: iommu-bounces@lists.linux-foundation.org [mailto:iommu-
> bounces@lists.linux-foundation.org] On Behalf Of Robin Murphy
> Sent: Friday, December 16, 2016 18:49
> To: iommu@lists.linux-foundation.org; devicetree@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org
> Cc: mark.rutland@arm.com; will.deacon@arm.com; Stuart Yoder
> <stuart.yoder@nxp.com>
> Subject: [RFC PATCH] iommu/arm-smmu: Add global SMR masking property
> 
> The current SMR masking support using a 2-cell iommu-specifier is
> primarily intended to handle individual masters with large and/or
> complex Stream ID assignments; it quickly gets a bit clunky in other SMR
> use-cases where we just want to consistently mask out the same part of
> every Stream ID (e.g. for MMU-500 configurations where the appended TBU
> number gets in the way unnecessarily). Let's add a new property to allow
> a single global mask value to better fit the latter situation.
> 
> CC: Stuart Yoder <stuart.yoder@nxp.com>

Tested-by: Nipun Gupta <nipun.gupta@nxp.com>

> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> 
> Compile-tested only...
> 
>  Documentation/devicetree/bindings/iommu/arm,smmu.txt | 8 ++++++++
>  drivers/iommu/arm-smmu.c                             | 4 +++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> index e862d1485205..98f5cbe5fdb4 100644
> --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> @@ -60,6 +60,14 @@ conditions.
>                    aliases of secure registers have to be used during
>                    SMMU configuration.
> 
> +- stream-match-mask : Specifies a fixed SMR mask value to combine with
> +                  the Stream ID value from every iommu-specifier. This
> +                  may be used instead of an "#iommu-cells" value of 2
> +                  when there is no need for per-master SMR masks, but
> +                  it is still desired to mask some portion of every
> +                  Stream ID (e.g. for certain MMU-500 configurations
> +                  given globally unique external IDs).
> +
>  ** Deprecated properties:
> 
>  - mmu-masters (deprecated in favour of the generic "iommus" binding) :
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index 8f7281444551..f1abcb7dde36 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -1534,13 +1534,15 @@ static int arm_smmu_domain_set_attr(struct
> iommu_domain *domain,
> 
>  static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
>  {
> -	u32 fwid = 0;
> +	u32 mask, fwid = 0;
> 
>  	if (args->args_count > 0)
>  		fwid |= (u16)args->args[0];
> 
>  	if (args->args_count > 1)
>  		fwid |= (u16)args->args[1] << SMR_MASK_SHIFT;
> +	else if (!of_property_read_u32(args->np, "stream-match-mask",
> &mask))
> +		fwid |= (u16)mask << SMR_MASK_SHIFT;
> 
>  	return iommu_fwspec_add_ids(dev, &fwid, 1);
>  }
> --
> 2.10.2.dirty
> 
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring (Arm) Dec. 21, 2016, 3:29 a.m. UTC | #2
On Fri, Dec 16, 2016 at 01:19:29PM +0000, Robin Murphy wrote:
> The current SMR masking support using a 2-cell iommu-specifier is
> primarily intended to handle individual masters with large and/or
> complex Stream ID assignments; it quickly gets a bit clunky in other SMR
> use-cases where we just want to consistently mask out the same part of
> every Stream ID (e.g. for MMU-500 configurations where the appended TBU
> number gets in the way unnecessarily). Let's add a new property to allow
> a single global mask value to better fit the latter situation.
> 
> CC: Stuart Yoder <stuart.yoder@nxp.com>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> 
> Compile-tested only...
> 
>  Documentation/devicetree/bindings/iommu/arm,smmu.txt | 8 ++++++++
>  drivers/iommu/arm-smmu.c                             | 4 +++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> index e862d1485205..98f5cbe5fdb4 100644
> --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> @@ -60,6 +60,14 @@ conditions.
>                    aliases of secure registers have to be used during
>                    SMMU configuration.
>  
> +- stream-match-mask : Specifies a fixed SMR mask value to combine with

Needs a vendor prefix.

Otherwise looks fine.

> +                  the Stream ID value from every iommu-specifier. This
> +                  may be used instead of an "#iommu-cells" value of 2
> +                  when there is no need for per-master SMR masks, but
> +                  it is still desired to mask some portion of every
> +                  Stream ID (e.g. for certain MMU-500 configurations
> +                  given globally unique external IDs).
> +
>  ** Deprecated properties:
>  
>  - mmu-masters (deprecated in favour of the generic "iommus" binding) :
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Will Deacon Jan. 3, 2017, 1:47 p.m. UTC | #3
On Tue, Dec 20, 2016 at 09:29:21PM -0600, Rob Herring wrote:
> On Fri, Dec 16, 2016 at 01:19:29PM +0000, Robin Murphy wrote:
> > The current SMR masking support using a 2-cell iommu-specifier is
> > primarily intended to handle individual masters with large and/or
> > complex Stream ID assignments; it quickly gets a bit clunky in other SMR
> > use-cases where we just want to consistently mask out the same part of
> > every Stream ID (e.g. for MMU-500 configurations where the appended TBU
> > number gets in the way unnecessarily). Let's add a new property to allow
> > a single global mask value to better fit the latter situation.
> > 
> > CC: Stuart Yoder <stuart.yoder@nxp.com>
> > Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> > ---
> > 
> > Compile-tested only...
> > 
> >  Documentation/devicetree/bindings/iommu/arm,smmu.txt | 8 ++++++++
> >  drivers/iommu/arm-smmu.c                             | 4 +++-
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > index e862d1485205..98f5cbe5fdb4 100644
> > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > @@ -60,6 +60,14 @@ conditions.
> >                    aliases of secure registers have to be used during
> >                    SMMU configuration.
> >  
> > +- stream-match-mask : Specifies a fixed SMR mask value to combine with
> 
> Needs a vendor prefix.

Why does this need a vendor prefix? I'm not fussed either way, but since
the stream-match-mask is an optional architectural concept and not specific
to an implementation, it seems strange to me that it would need a prefix
whereas something like #global-interrupts does not.

> > +                  the Stream ID value from every iommu-specifier. This
> > +                  may be used instead of an "#iommu-cells" value of 2
> > +                  when there is no need for per-master SMR masks, but
> > +                  it is still desired to mask some portion of every
> > +                  Stream ID (e.g. for certain MMU-500 configurations
> > +                  given globally unique external IDs).

Robin -- it might be worth a sentence here saying that the property is
ignored if stream matching isn't supported by the hardware.

Will
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bharat Bhushan Jan. 9, 2017, 11:14 a.m. UTC | #4
Hi Robin,

> -----Original Message-----
> From: iommu-bounces@lists.linux-foundation.org [mailto:iommu-
> bounces@lists.linux-foundation.org] On Behalf Of Nipun Gupta
> Sent: Sunday, December 18, 2016 2:37 AM
> To: Robin Murphy <robin.murphy@arm.com>; iommu@lists.linux-
> foundation.org; devicetree@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org
> Cc: mark.rutland@arm.com; will.deacon@arm.com; Stuart Yoder
> <stuart.yoder@nxp.com>
> Subject: RE: [RFC PATCH] iommu/arm-smmu: Add global SMR masking
> property
> 
> 
> 
> > -----Original Message-----
> > From: iommu-bounces@lists.linux-foundation.org [mailto:iommu-
> > bounces@lists.linux-foundation.org] On Behalf Of Robin Murphy
> > Sent: Friday, December 16, 2016 18:49
> > To: iommu@lists.linux-foundation.org; devicetree@vger.kernel.org;
> > linux-arm- kernel@lists.infradead.org
> > Cc: mark.rutland@arm.com; will.deacon@arm.com; Stuart Yoder
> > <stuart.yoder@nxp.com>
> > Subject: [RFC PATCH] iommu/arm-smmu: Add global SMR masking
> property
> >
> > The current SMR masking support using a 2-cell iommu-specifier is
> > primarily intended to handle individual masters with large and/or
> > complex Stream ID assignments; it quickly gets a bit clunky in other
> > SMR use-cases where we just want to consistently mask out the same
> > part of every Stream ID (e.g. for MMU-500 configurations where the
> > appended TBU number gets in the way unnecessarily). Let's add a new
> > property to allow a single global mask value to better fit the latter situation.
> >
> > CC: Stuart Yoder <stuart.yoder@nxp.com>
> 
> Tested-by: Nipun Gupta <nipun.gupta@nxp.com>

We have verified this patches with PCI and FSL-MC bus devices.

I do not see any comment on this patch, I know there were holidays around, can we assume this as accepted and we can develop u-boot patches.

Thanks
-Bharat

> 
> > Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> > ---
> >
> > Compile-tested only...
> >
> >  Documentation/devicetree/bindings/iommu/arm,smmu.txt | 8 ++++++++
> >  drivers/iommu/arm-smmu.c                             | 4 +++-
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > index e862d1485205..98f5cbe5fdb4 100644
> > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > @@ -60,6 +60,14 @@ conditions.
> >                    aliases of secure registers have to be used during
> >                    SMMU configuration.
> >
> > +- stream-match-mask : Specifies a fixed SMR mask value to combine with
> > +                  the Stream ID value from every iommu-specifier. This
> > +                  may be used instead of an "#iommu-cells" value of 2
> > +                  when there is no need for per-master SMR masks, but
> > +                  it is still desired to mask some portion of every
> > +                  Stream ID (e.g. for certain MMU-500 configurations
> > +                  given globally unique external IDs).
> > +
> >  ** Deprecated properties:
> >
> >  - mmu-masters (deprecated in favour of the generic "iommus" binding) :
> > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index
> > 8f7281444551..f1abcb7dde36 100644
> > --- a/drivers/iommu/arm-smmu.c
> > +++ b/drivers/iommu/arm-smmu.c
> > @@ -1534,13 +1534,15 @@ static int arm_smmu_domain_set_attr(struct
> > iommu_domain *domain,
> >
> >  static int arm_smmu_of_xlate(struct device *dev, struct
> > of_phandle_args *args)  {
> > -	u32 fwid = 0;
> > +	u32 mask, fwid = 0;
> >
> >  	if (args->args_count > 0)
> >  		fwid |= (u16)args->args[0];
> >
> >  	if (args->args_count > 1)
> >  		fwid |= (u16)args->args[1] << SMR_MASK_SHIFT;
> > +	else if (!of_property_read_u32(args->np, "stream-match-mask",
> > &mask))
> > +		fwid |= (u16)mask << SMR_MASK_SHIFT;
> >
> >  	return iommu_fwspec_add_ids(dev, &fwid, 1);  }
> > --
> > 2.10.2.dirty
> >
> > _______________________________________________
> > iommu mailing list
> > iommu@lists.linux-foundation.org
> > https://lists.linuxfoundation.org/mailman/listinfo/iommu
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nipun Gupta March 2, 2017, 4:18 a.m. UTC | #5
Hi Robin/Will,

This patch is currently not applied on the tree.
I had verified the patch and it seems good.
Is ack required on the patch or do I need to send a non RFC patch (with Robin's signoff)?
This is very much required to support SMMU on NXP platform.

Thanks,
Nipun


> -----Original Message-----
> From: Nipun Gupta
> Sent: Sunday, December 18, 2016 2:37
> To: Robin Murphy <robin.murphy@arm.com>; iommu@lists.linux-
> foundation.org; devicetree@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org
> Cc: mark.rutland@arm.com; will.deacon@arm.com; Stuart Yoder
> <stuart.yoder@nxp.com>
> Subject: RE: [RFC PATCH] iommu/arm-smmu: Add global SMR masking property
> 
> 
> 
> > -----Original Message-----
> > From: iommu-bounces@lists.linux-foundation.org [mailto:iommu-
> > bounces@lists.linux-foundation.org] On Behalf Of Robin Murphy
> > Sent: Friday, December 16, 2016 18:49
> > To: iommu@lists.linux-foundation.org; devicetree@vger.kernel.org; linux-
> arm-
> > kernel@lists.infradead.org
> > Cc: mark.rutland@arm.com; will.deacon@arm.com; Stuart Yoder
> > <stuart.yoder@nxp.com>
> > Subject: [RFC PATCH] iommu/arm-smmu: Add global SMR masking property
> >
> > The current SMR masking support using a 2-cell iommu-specifier is
> > primarily intended to handle individual masters with large and/or
> > complex Stream ID assignments; it quickly gets a bit clunky in other SMR
> > use-cases where we just want to consistently mask out the same part of
> > every Stream ID (e.g. for MMU-500 configurations where the appended TBU
> > number gets in the way unnecessarily). Let's add a new property to allow
> > a single global mask value to better fit the latter situation.
> >
> > CC: Stuart Yoder <stuart.yoder@nxp.com>
> 
> Tested-by: Nipun Gupta <nipun.gupta@nxp.com>
> 
> > Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> > ---
> >
> > Compile-tested only...
> >
> >  Documentation/devicetree/bindings/iommu/arm,smmu.txt | 8 ++++++++
> >  drivers/iommu/arm-smmu.c                             | 4 +++-
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > index e862d1485205..98f5cbe5fdb4 100644
> > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> > @@ -60,6 +60,14 @@ conditions.
> >                    aliases of secure registers have to be used during
> >                    SMMU configuration.
> >
> > +- stream-match-mask : Specifies a fixed SMR mask value to combine with
> > +                  the Stream ID value from every iommu-specifier. This
> > +                  may be used instead of an "#iommu-cells" value of 2
> > +                  when there is no need for per-master SMR masks, but
> > +                  it is still desired to mask some portion of every
> > +                  Stream ID (e.g. for certain MMU-500 configurations
> > +                  given globally unique external IDs).
> > +
> >  ** Deprecated properties:
> >
> >  - mmu-masters (deprecated in favour of the generic "iommus" binding) :
> > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> > index 8f7281444551..f1abcb7dde36 100644
> > --- a/drivers/iommu/arm-smmu.c
> > +++ b/drivers/iommu/arm-smmu.c
> > @@ -1534,13 +1534,15 @@ static int arm_smmu_domain_set_attr(struct
> > iommu_domain *domain,
> >
> >  static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args
> *args)
> >  {
> > -	u32 fwid = 0;
> > +	u32 mask, fwid = 0;
> >
> >  	if (args->args_count > 0)
> >  		fwid |= (u16)args->args[0];
> >
> >  	if (args->args_count > 1)
> >  		fwid |= (u16)args->args[1] << SMR_MASK_SHIFT;
> > +	else if (!of_property_read_u32(args->np, "stream-match-mask",
> > &mask))
> > +		fwid |= (u16)mask << SMR_MASK_SHIFT;
> >
> >  	return iommu_fwspec_add_ids(dev, &fwid, 1);
> >  }
> > --
> > 2.10.2.dirty
> >
> > _______________________________________________
> > iommu mailing list
> > iommu@lists.linux-foundation.org
> > https://lists.linuxfoundation.org/mailman/listinfo/iommu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Robin Murphy March 2, 2017, 4:48 p.m. UTC | #6
On 02/03/17 04:18, Nipun Gupta wrote:
> 
> Hi Robin/Will,
> 
> This patch is currently not applied on the tree.
> I had verified the patch and it seems good.
> Is ack required on the patch or do I need to send a non RFC patch (with Robin's signoff)?
> This is very much required to support SMMU on NXP platform.

It's still sat in my "patches to do something with" queue - I don't
think we ever reached a concrete decision on the property name for a DT
maintainer ack, but I've tweaked the description per Will's comment;
thanks for the reminder. I'll send an rc1-based version out next week to
reboot the discussion.

Robin.

> 
> Thanks,
> Nipun
> 
> 
>> -----Original Message-----
>> From: Nipun Gupta
>> Sent: Sunday, December 18, 2016 2:37
>> To: Robin Murphy <robin.murphy@arm.com>; iommu@lists.linux-
>> foundation.org; devicetree@vger.kernel.org; linux-arm-
>> kernel@lists.infradead.org
>> Cc: mark.rutland@arm.com; will.deacon@arm.com; Stuart Yoder
>> <stuart.yoder@nxp.com>
>> Subject: RE: [RFC PATCH] iommu/arm-smmu: Add global SMR masking property
>>
>>
>>
>>> -----Original Message-----
>>> From: iommu-bounces@lists.linux-foundation.org [mailto:iommu-
>>> bounces@lists.linux-foundation.org] On Behalf Of Robin Murphy
>>> Sent: Friday, December 16, 2016 18:49
>>> To: iommu@lists.linux-foundation.org; devicetree@vger.kernel.org; linux-
>> arm-
>>> kernel@lists.infradead.org
>>> Cc: mark.rutland@arm.com; will.deacon@arm.com; Stuart Yoder
>>> <stuart.yoder@nxp.com>
>>> Subject: [RFC PATCH] iommu/arm-smmu: Add global SMR masking property
>>>
>>> The current SMR masking support using a 2-cell iommu-specifier is
>>> primarily intended to handle individual masters with large and/or
>>> complex Stream ID assignments; it quickly gets a bit clunky in other SMR
>>> use-cases where we just want to consistently mask out the same part of
>>> every Stream ID (e.g. for MMU-500 configurations where the appended TBU
>>> number gets in the way unnecessarily). Let's add a new property to allow
>>> a single global mask value to better fit the latter situation.
>>>
>>> CC: Stuart Yoder <stuart.yoder@nxp.com>
>>
>> Tested-by: Nipun Gupta <nipun.gupta@nxp.com>
>>
>>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>>> ---
>>>
>>> Compile-tested only...
>>>
>>>  Documentation/devicetree/bindings/iommu/arm,smmu.txt | 8 ++++++++
>>>  drivers/iommu/arm-smmu.c                             | 4 +++-
>>>  2 files changed, 11 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
>>> b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
>>> index e862d1485205..98f5cbe5fdb4 100644
>>> --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
>>> +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
>>> @@ -60,6 +60,14 @@ conditions.
>>>                    aliases of secure registers have to be used during
>>>                    SMMU configuration.
>>>
>>> +- stream-match-mask : Specifies a fixed SMR mask value to combine with
>>> +                  the Stream ID value from every iommu-specifier. This
>>> +                  may be used instead of an "#iommu-cells" value of 2
>>> +                  when there is no need for per-master SMR masks, but
>>> +                  it is still desired to mask some portion of every
>>> +                  Stream ID (e.g. for certain MMU-500 configurations
>>> +                  given globally unique external IDs).
>>> +
>>>  ** Deprecated properties:
>>>
>>>  - mmu-masters (deprecated in favour of the generic "iommus" binding) :
>>> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
>>> index 8f7281444551..f1abcb7dde36 100644
>>> --- a/drivers/iommu/arm-smmu.c
>>> +++ b/drivers/iommu/arm-smmu.c
>>> @@ -1534,13 +1534,15 @@ static int arm_smmu_domain_set_attr(struct
>>> iommu_domain *domain,
>>>
>>>  static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args
>> *args)
>>>  {
>>> -	u32 fwid = 0;
>>> +	u32 mask, fwid = 0;
>>>
>>>  	if (args->args_count > 0)
>>>  		fwid |= (u16)args->args[0];
>>>
>>>  	if (args->args_count > 1)
>>>  		fwid |= (u16)args->args[1] << SMR_MASK_SHIFT;
>>> +	else if (!of_property_read_u32(args->np, "stream-match-mask",
>>> &mask))
>>> +		fwid |= (u16)mask << SMR_MASK_SHIFT;
>>>
>>>  	return iommu_fwspec_add_ids(dev, &fwid, 1);
>>>  }
>>> --
>>> 2.10.2.dirty
>>>
>>> _______________________________________________
>>> iommu mailing list
>>> iommu@lists.linux-foundation.org
>>> https://lists.linuxfoundation.org/mailman/listinfo/iommu

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nipun Gupta March 3, 2017, 3:42 a.m. UTC | #7
Thanks Robin,
This would be of great help.

Regards,
Nipun

> -----Original Message-----
> From: Robin Murphy [mailto:robin.murphy@arm.com]
> Sent: Thursday, March 02, 2017 22:18
> To: Nipun Gupta <nipun.gupta@nxp.com>; iommu@lists.linux-foundation.org;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org
> Cc: mark.rutland@arm.com; will.deacon@arm.com; stuyoder@gmail.com;
> Bharat Bhushan <bharat.bhushan@nxp.com>
> Subject: Re: [RFC PATCH] iommu/arm-smmu: Add global SMR masking property
> 
> On 02/03/17 04:18, Nipun Gupta wrote:
> >
> > Hi Robin/Will,
> >
> > This patch is currently not applied on the tree.
> > I had verified the patch and it seems good.
> > Is ack required on the patch or do I need to send a non RFC patch (with Robin's
> signoff)?
> > This is very much required to support SMMU on NXP platform.
> 
> It's still sat in my "patches to do something with" queue - I don't
> think we ever reached a concrete decision on the property name for a DT
> maintainer ack, but I've tweaked the description per Will's comment;
> thanks for the reminder. I'll send an rc1-based version out next week to
> reboot the discussion.
> 
> Robin.
> 
> >
> > Thanks,
> > Nipun
> >
> >
> >> -----Original Message-----
> >> From: Nipun Gupta
> >> Sent: Sunday, December 18, 2016 2:37
> >> To: Robin Murphy <robin.murphy@arm.com>; iommu@lists.linux-
> >> foundation.org; devicetree@vger.kernel.org; linux-arm-
> >> kernel@lists.infradead.org
> >> Cc: mark.rutland@arm.com; will.deacon@arm.com; Stuart Yoder
> >> <stuart.yoder@nxp.com>
> >> Subject: RE: [RFC PATCH] iommu/arm-smmu: Add global SMR masking
> property
> >>
> >>
> >>
> >>> -----Original Message-----
> >>> From: iommu-bounces@lists.linux-foundation.org [mailto:iommu-
> >>> bounces@lists.linux-foundation.org] On Behalf Of Robin Murphy
> >>> Sent: Friday, December 16, 2016 18:49
> >>> To: iommu@lists.linux-foundation.org; devicetree@vger.kernel.org; linux-
> >> arm-
> >>> kernel@lists.infradead.org
> >>> Cc: mark.rutland@arm.com; will.deacon@arm.com; Stuart Yoder
> >>> <stuart.yoder@nxp.com>
> >>> Subject: [RFC PATCH] iommu/arm-smmu: Add global SMR masking property
> >>>
> >>> The current SMR masking support using a 2-cell iommu-specifier is
> >>> primarily intended to handle individual masters with large and/or
> >>> complex Stream ID assignments; it quickly gets a bit clunky in other SMR
> >>> use-cases where we just want to consistently mask out the same part of
> >>> every Stream ID (e.g. for MMU-500 configurations where the appended TBU
> >>> number gets in the way unnecessarily). Let's add a new property to allow
> >>> a single global mask value to better fit the latter situation.
> >>>
> >>> CC: Stuart Yoder <stuart.yoder@nxp.com>
> >>
> >> Tested-by: Nipun Gupta <nipun.gupta@nxp.com>
> >>
> >>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> >>> ---
> >>>
> >>> Compile-tested only...
> >>>
> >>>  Documentation/devicetree/bindings/iommu/arm,smmu.txt | 8 ++++++++
> >>>  drivers/iommu/arm-smmu.c                             | 4 +++-
> >>>  2 files changed, 11 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> >>> b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> >>> index e862d1485205..98f5cbe5fdb4 100644
> >>> --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> >>> +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
> >>> @@ -60,6 +60,14 @@ conditions.
> >>>                    aliases of secure registers have to be used during
> >>>                    SMMU configuration.
> >>>
> >>> +- stream-match-mask : Specifies a fixed SMR mask value to combine with
> >>> +                  the Stream ID value from every iommu-specifier. This
> >>> +                  may be used instead of an "#iommu-cells" value of 2
> >>> +                  when there is no need for per-master SMR masks, but
> >>> +                  it is still desired to mask some portion of every
> >>> +                  Stream ID (e.g. for certain MMU-500 configurations
> >>> +                  given globally unique external IDs).
> >>> +
> >>>  ** Deprecated properties:
> >>>
> >>>  - mmu-masters (deprecated in favour of the generic "iommus" binding) :
> >>> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> >>> index 8f7281444551..f1abcb7dde36 100644
> >>> --- a/drivers/iommu/arm-smmu.c
> >>> +++ b/drivers/iommu/arm-smmu.c
> >>> @@ -1534,13 +1534,15 @@ static int arm_smmu_domain_set_attr(struct
> >>> iommu_domain *domain,
> >>>
> >>>  static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args
> >> *args)
> >>>  {
> >>> -	u32 fwid = 0;
> >>> +	u32 mask, fwid = 0;
> >>>
> >>>  	if (args->args_count > 0)
> >>>  		fwid |= (u16)args->args[0];
> >>>
> >>>  	if (args->args_count > 1)
> >>>  		fwid |= (u16)args->args[1] << SMR_MASK_SHIFT;
> >>> +	else if (!of_property_read_u32(args->np, "stream-match-mask",
> >>> &mask))
> >>> +		fwid |= (u16)mask << SMR_MASK_SHIFT;
> >>>
> >>>  	return iommu_fwspec_add_ids(dev, &fwid, 1);
> >>>  }
> >>> --
> >>> 2.10.2.dirty
> >>>
> >>> _______________________________________________
> >>> iommu mailing list
> >>> iommu@lists.linux-foundation.org
> >>> https://lists.linuxfoundation.org/mailman/listinfo/iommu

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
index e862d1485205..98f5cbe5fdb4 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt
@@ -60,6 +60,14 @@  conditions.
                   aliases of secure registers have to be used during
                   SMMU configuration.
 
+- stream-match-mask : Specifies a fixed SMR mask value to combine with
+                  the Stream ID value from every iommu-specifier. This
+                  may be used instead of an "#iommu-cells" value of 2
+                  when there is no need for per-master SMR masks, but
+                  it is still desired to mask some portion of every
+                  Stream ID (e.g. for certain MMU-500 configurations
+                  given globally unique external IDs).
+
 ** Deprecated properties:
 
 - mmu-masters (deprecated in favour of the generic "iommus" binding) :
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 8f7281444551..f1abcb7dde36 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1534,13 +1534,15 @@  static int arm_smmu_domain_set_attr(struct iommu_domain *domain,
 
 static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
 {
-	u32 fwid = 0;
+	u32 mask, fwid = 0;
 
 	if (args->args_count > 0)
 		fwid |= (u16)args->args[0];
 
 	if (args->args_count > 1)
 		fwid |= (u16)args->args[1] << SMR_MASK_SHIFT;
+	else if (!of_property_read_u32(args->np, "stream-match-mask", &mask))
+		fwid |= (u16)mask << SMR_MASK_SHIFT;
 
 	return iommu_fwspec_add_ids(dev, &fwid, 1);
 }