linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support
@ 2016-06-07  3:39 Magnus Damm
  2016-06-07  3:39 ` [PATCH 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Magnus Damm @ 2016-06-07  3:39 UTC (permalink / raw)
  To: iommu
  Cc: laurent.pinchart+renesas, geert+renesas, joro, linux-kernel,
	linux-renesas-soc, horms+renesas, Magnus Damm

iommu/ipmmu-vmsa: Initial r8a7796 support

[PATCH 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding
[PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
[PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code

This series adds r8a7796 support to the IPMMU driver. The DT binding
gets updated, maximum number of micro-TLBs are increased and the
driver is adjusted to match on the new DT binding.

The main differences between r8a7795 and r8a7796 IPMMUs are:
1) Number of on-chip IPMMU device instances
2) Interrupt register bit assignment for IPMMU-MM
3) Maximum number of micro-TLBs
4) Micro-TLB assignment

DT binding extension and change number 3 above are part of this patch
series. Other changes will be part of DT integration code that will be
submitted separately.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 Developed on top of next-20160602 and:
 [PATCH v3 00/06] iommu/ipmmu-vmsa: IPMMU multi-arch update V3
 [PATCH v2 00/11] iommu/ipmmu-vmsa: r8a7795 support V2

 Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt |    1 
 drivers/iommu/ipmmu-vmsa.c                                     |   11 +++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

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

* [PATCH 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding
  2016-06-07  3:39 [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support Magnus Damm
@ 2016-06-07  3:39 ` Magnus Damm
  2016-06-08  0:17   ` Laurent Pinchart
  2016-06-07  3:39 ` [PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Magnus Damm @ 2016-06-07  3:39 UTC (permalink / raw)
  To: iommu
  Cc: laurent.pinchart+renesas, geert+renesas, joro, linux-kernel,
	linux-renesas-soc, horms+renesas, Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

Update the IPMMU DT binding documentation to include the r8a7796 compat
string for R-Car M3-W.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt |    1 +
 1 file changed, 1 insertion(+)

--- 0001/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
+++ work/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt	2016-06-06 11:27:37.560607110 +0900
@@ -16,6 +16,7 @@ Required Properties:
     - "renesas,ipmmu-r8a7793" for the R8A7793 (R-Car M2-N) IPMMU.
     - "renesas,ipmmu-r8a7794" for the R8A7794 (R-Car E2) IPMMU.
     - "renesas,ipmmu-r8a7795" for the R8A7795 (R-Car H3) IPMMU.
+    - "renesas,ipmmu-r8a7796" for the R8A7796 (R-Car M3-W) IPMMU.
     - "renesas,ipmmu-vmsa" for generic R-Car Gen2 VMSA-compatible IPMMU.
 
   - reg: Base address and size of the IPMMU registers.

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

* [PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
  2016-06-07  3:39 [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support Magnus Damm
  2016-06-07  3:39 ` [PATCH 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm
@ 2016-06-07  3:39 ` Magnus Damm
  2016-06-07 10:59   ` Sergei Shtylyov
  2016-06-08  0:17   ` Laurent Pinchart
  2016-06-07  3:39 ` [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code Magnus Damm
  2016-06-07  7:31 ` [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support Geert Uytterhoeven
  3 siblings, 2 replies; 16+ messages in thread
From: Magnus Damm @ 2016-06-07  3:39 UTC (permalink / raw)
  To: iommu
  Cc: laurent.pinchart+renesas, geert+renesas, joro, linux-kernel,
	linux-renesas-soc, horms+renesas, Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

Bump up the maximum numbers of micro-TLBS to 48.

Each IPMMU device instance get micro-TLB assignment via
the "iommus" property in DT. Older SoCs tend to use a
maximum number of 32 micro-TLBd per IPMMU instance however
newer SoCs such as r8a7796 make use of up to 48 micro-TLBs.

At this point no SoC specific handling is done to validate
the maximum number of micro-TLBs, and because of that the
DT information is assumed to be within correct range for
each particular SoC.

If needed in the future SoC specific feature flags can be
added to handle the maximum number of micro-TLBs without
requiring DT changes, however at this point this does not
seem necessary.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 drivers/iommu/ipmmu-vmsa.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 0029/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c	2016-06-06 11:17:33.230607110 +0900
@@ -1115,7 +1115,7 @@ static int ipmmu_probe(struct platform_d
 	}
 
 	mmu->dev = &pdev->dev;
-	mmu->num_utlbs = 32;
+	mmu->num_utlbs = 48;
 	spin_lock_init(&mmu->lock);
 	bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
 	mmu->features = match->data;

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

* [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2016-06-07  3:39 [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support Magnus Damm
  2016-06-07  3:39 ` [PATCH 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm
  2016-06-07  3:39 ` [PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
@ 2016-06-07  3:39 ` Magnus Damm
  2016-06-08  0:18   ` Laurent Pinchart
  2016-06-07  7:31 ` [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support Geert Uytterhoeven
  3 siblings, 1 reply; 16+ messages in thread
From: Magnus Damm @ 2016-06-07  3:39 UTC (permalink / raw)
  To: iommu
  Cc: laurent.pinchart+renesas, geert+renesas, joro, linux-kernel,
	linux-renesas-soc, horms+renesas, Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

Support the r8a7796 IPMMU by sharing feature flags between
r8a7795 and r8a7796. Also update IOMMU_OF_DECLARE to hook
up the updated compat string.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 drivers/iommu/ipmmu-vmsa.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- 0031/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c	2016-06-06 11:19:40.210607110 +0900
@@ -1074,7 +1074,7 @@ static const struct ipmmu_features ipmmu
 	.twobit_imttbcr_sl0 = false,
 };
 
-static const struct ipmmu_features ipmmu_features_r8a7795 = {
+static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
 	.use_ns_alias_offset = false,
 	.has_cache_leaf_nodes = true,
 	.has_eight_ctx = true,
@@ -1088,7 +1088,10 @@ static const struct of_device_id ipmmu_o
 		.data = &ipmmu_features_default,
 	}, {
 		.compatible = "renesas,ipmmu-r8a7795",
-		.data = &ipmmu_features_r8a7795,
+		.data = &ipmmu_features_rcar_gen3,
+	}, {
+		.compatible = "renesas,ipmmu-r8a7796",
+		.data = &ipmmu_features_rcar_gen3,
 	}, {
 		/* Terminator */
 	},
@@ -1268,6 +1271,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "r
 		 ipmmu_vmsa_iommu_of_setup);
 IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
 		 ipmmu_vmsa_iommu_of_setup);
+IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
+		 ipmmu_vmsa_iommu_of_setup);
 #endif
 
 MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU");

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

* Re: [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support
  2016-06-07  3:39 [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support Magnus Damm
                   ` (2 preceding siblings ...)
  2016-06-07  3:39 ` [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code Magnus Damm
@ 2016-06-07  7:31 ` Geert Uytterhoeven
  3 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2016-06-07  7:31 UTC (permalink / raw)
  To: Magnus Damm
  Cc: iommu, Laurent Pinchart, Geert Uytterhoeven, Joerg Roedel,
	linux-kernel, linux-renesas-soc, Simon Horman

Hi Magnus,

On Tue, Jun 7, 2016 at 5:39 AM, Magnus Damm <magnus.damm@gmail.com> wrote:
> iommu/ipmmu-vmsa: Initial r8a7796 support
>
> [PATCH 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding
> [PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
> [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
>
> This series adds r8a7796 support to the IPMMU driver. The DT binding
> gets updated, maximum number of micro-TLBs are increased and the
> driver is adjusted to match on the new DT binding.

Thanks for your series!

For your convenience, I've queued it up in topic/r8a7796-ipmmu-v1 at
https://git.kernel.org/cgit/linux/kernel/git/geert/renesas-drivers.git, and
will include it in next renesas-drivers release.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
  2016-06-07  3:39 ` [PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
@ 2016-06-07 10:59   ` Sergei Shtylyov
  2016-06-08  0:17   ` Laurent Pinchart
  1 sibling, 0 replies; 16+ messages in thread
From: Sergei Shtylyov @ 2016-06-07 10:59 UTC (permalink / raw)
  To: Magnus Damm, iommu
  Cc: laurent.pinchart+renesas, geert+renesas, joro, linux-kernel,
	linux-renesas-soc, horms+renesas

Hello.

On 6/7/2016 6:39 AM, Magnus Damm wrote:

> From: Magnus Damm <damm+renesas@opensource.se>
>
> Bump up the maximum numbers of micro-TLBS to 48.
>
> Each IPMMU device instance get micro-TLB assignment via
> the "iommus" property in DT. Older SoCs tend to use a
> maximum number of 32 micro-TLBd per IPMMU instance however

    Micro-TLBs?

> newer SoCs such as r8a7796 make use of up to 48 micro-TLBs.
>
> At this point no SoC specific handling is done to validate
> the maximum number of micro-TLBs, and because of that the
> DT information is assumed to be within correct range for
> each particular SoC.
>
> If needed in the future SoC specific feature flags can be
> added to handle the maximum number of micro-TLBs without
> requiring DT changes, however at this point this does not
> seem necessary.
>
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
[...]

MBR, Sergei

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

* Re: [PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
  2016-06-07  3:39 ` [PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
  2016-06-07 10:59   ` Sergei Shtylyov
@ 2016-06-08  0:17   ` Laurent Pinchart
  1 sibling, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2016-06-08  0:17 UTC (permalink / raw)
  To: Magnus Damm
  Cc: iommu, laurent.pinchart+renesas, geert+renesas, joro,
	linux-kernel, linux-renesas-soc, horms+renesas

Hi Magnus,

Thank you for the patch.

On Tuesday 07 Jun 2016 12:39:36 Magnus Damm wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
> 
> Bump up the maximum numbers of micro-TLBS to 48.
> 
> Each IPMMU device instance get micro-TLB assignment via
> the "iommus" property in DT. Older SoCs tend to use a
> maximum number of 32 micro-TLBd per IPMMU instance however
> newer SoCs such as r8a7796 make use of up to 48 micro-TLBs.
> 
> At this point no SoC specific handling is done to validate
> the maximum number of micro-TLBs, and because of that the
> DT information is assumed to be within correct range for
> each particular SoC.
> 
> If needed in the future SoC specific feature flags can be
> added to handle the maximum number of micro-TLBs without
> requiring DT changes, however at this point this does not
> seem necessary.
> 
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
> ---
> 
>  drivers/iommu/ipmmu-vmsa.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- 0029/drivers/iommu/ipmmu-vmsa.c
> +++ work/drivers/iommu/ipmmu-vmsa.c	2016-06-06 11:17:33.230607110 +0900
> @@ -1115,7 +1115,7 @@ static int ipmmu_probe(struct platform_d
>  	}
> 
>  	mmu->dev = &pdev->dev;
> -	mmu->num_utlbs = 32;
> +	mmu->num_utlbs = 48;

This value is only used to validate that all utlb numbers in the bus master DT 
nodes are within the range acceptable by the device. If we bump it up 
unconditionally we could as well remove it completely. A possibly better 
alternative would be to specify the number of utlbs, or even the mask of 
implemented utlbs, in the DT node of the IPMMU.

Why 48 by the way ? The IPMMU instance with the largest utlb number in the R-
Car Gen3 datasheet uses a 0-38 utlb range.

>  	spin_lock_init(&mmu->lock);
>  	bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
>  	mmu->features = match->data;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding
  2016-06-07  3:39 ` [PATCH 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm
@ 2016-06-08  0:17   ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2016-06-08  0:17 UTC (permalink / raw)
  To: Magnus Damm
  Cc: iommu, laurent.pinchart+renesas, geert+renesas, joro,
	linux-kernel, linux-renesas-soc, horms+renesas

Hi Magnus,

Thank you for the patch.

On Tuesday 07 Jun 2016 12:39:27 Magnus Damm wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
> 
> Update the IPMMU DT binding documentation to include the r8a7796 compat
> string for R-Car M3-W.
> 
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> 
>  Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- 0001/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
> +++
> work/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt	
2016-06
> -06 11:27:37.560607110 +0900 @@ -16,6 +16,7 @@ Required Properties:
>      - "renesas,ipmmu-r8a7793" for the R8A7793 (R-Car M2-N) IPMMU.
>      - "renesas,ipmmu-r8a7794" for the R8A7794 (R-Car E2) IPMMU.
>      - "renesas,ipmmu-r8a7795" for the R8A7795 (R-Car H3) IPMMU.
> +    - "renesas,ipmmu-r8a7796" for the R8A7796 (R-Car M3-W) IPMMU.
>      - "renesas,ipmmu-vmsa" for generic R-Car Gen2 VMSA-compatible IPMMU.
> 
>    - reg: Base address and size of the IPMMU registers.

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2016-06-07  3:39 ` [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code Magnus Damm
@ 2016-06-08  0:18   ` Laurent Pinchart
  2016-06-08  7:04     ` Geert Uytterhoeven
  2016-06-08  8:07     ` Magnus Damm
  0 siblings, 2 replies; 16+ messages in thread
From: Laurent Pinchart @ 2016-06-08  0:18 UTC (permalink / raw)
  To: Magnus Damm
  Cc: iommu, laurent.pinchart+renesas, geert+renesas, joro,
	linux-kernel, linux-renesas-soc, horms+renesas

Hi Magnus,

Thank you for the patch.

On Tuesday 07 Jun 2016 12:39:45 Magnus Damm wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
> 
> Support the r8a7796 IPMMU by sharing feature flags between
> r8a7795 and r8a7796. Also update IOMMU_OF_DECLARE to hook
> up the updated compat string.
> 
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
> ---
> 
>  drivers/iommu/ipmmu-vmsa.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> --- 0031/drivers/iommu/ipmmu-vmsa.c
> +++ work/drivers/iommu/ipmmu-vmsa.c	2016-06-06 11:19:40.210607110 +0900
> @@ -1074,7 +1074,7 @@ static const struct ipmmu_features ipmmu
>  	.twobit_imttbcr_sl0 = false,
>  };
> 
> -static const struct ipmmu_features ipmmu_features_r8a7795 = {
> +static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
>  	.use_ns_alias_offset = false,
>  	.has_cache_leaf_nodes = true,
>  	.has_eight_ctx = true,
> @@ -1088,7 +1088,10 @@ static const struct of_device_id ipmmu_o
>  		.data = &ipmmu_features_default,
>  	}, {
>  		.compatible = "renesas,ipmmu-r8a7795",
> -		.data = &ipmmu_features_r8a7795,
> +		.data = &ipmmu_features_rcar_gen3,
> +	}, {
> +		.compatible = "renesas,ipmmu-r8a7796",
> +		.data = &ipmmu_features_rcar_gen3,
>  	}, {
>  		/* Terminator */
>  	},
> @@ -1268,6 +1271,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "r
>  		 ipmmu_vmsa_iommu_of_setup);
>  IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
>  		 ipmmu_vmsa_iommu_of_setup);
> +IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
> +		 ipmmu_vmsa_iommu_of_setup);

How about a Gen3 generic compatible string in addition to the SoC-specific 
ones ?

>  #endif
> 
>  MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU");

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2016-06-08  0:18   ` Laurent Pinchart
@ 2016-06-08  7:04     ` Geert Uytterhoeven
  2016-06-08  8:05       ` Magnus Damm
  2016-06-08  8:48       ` Laurent Pinchart
  2016-06-08  8:07     ` Magnus Damm
  1 sibling, 2 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2016-06-08  7:04 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Magnus Damm, iommu, Laurent Pinchart, Geert Uytterhoeven,
	Joerg Roedel, linux-kernel, linux-renesas-soc, Simon Horman

Hi Laurent,

On Wed, Jun 8, 2016 at 2:18 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>> --- 0031/drivers/iommu/ipmmu-vmsa.c
>> +++ work/drivers/iommu/ipmmu-vmsa.c   2016-06-06 11:19:40.210607110 +0900
>> @@ -1074,7 +1074,7 @@ static const struct ipmmu_features ipmmu
>>       .twobit_imttbcr_sl0 = false,
>>  };
>>
>> -static const struct ipmmu_features ipmmu_features_r8a7795 = {
>> +static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
>>       .use_ns_alias_offset = false,
>>       .has_cache_leaf_nodes = true,
>>       .has_eight_ctx = true,
>> @@ -1088,7 +1088,10 @@ static const struct of_device_id ipmmu_o
>>               .data = &ipmmu_features_default,
>>       }, {
>>               .compatible = "renesas,ipmmu-r8a7795",
>> -             .data = &ipmmu_features_r8a7795,
>> +             .data = &ipmmu_features_rcar_gen3,
>> +     }, {
>> +             .compatible = "renesas,ipmmu-r8a7796",
>> +             .data = &ipmmu_features_rcar_gen3,
>>       }, {
>>               /* Terminator */
>>       },
>> @@ -1268,6 +1271,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "r
>>                ipmmu_vmsa_iommu_of_setup);
>>  IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
>>                ipmmu_vmsa_iommu_of_setup);
>> +IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
>> +              ipmmu_vmsa_iommu_of_setup);
>
> How about a Gen3 generic compatible string in addition to the SoC-specific
> ones ?

Do we want to specify the number of utlbs here?
Does it differ between r8a7795, r8a7796, and future members?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2016-06-08  7:04     ` Geert Uytterhoeven
@ 2016-06-08  8:05       ` Magnus Damm
  2016-06-08  8:48       ` Laurent Pinchart
  1 sibling, 0 replies; 16+ messages in thread
From: Magnus Damm @ 2016-06-08  8:05 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, iommu, Laurent Pinchart, Geert Uytterhoeven,
	Joerg Roedel, linux-kernel, linux-renesas-soc, Simon Horman

Hi Geert,

On Wed, Jun 8, 2016 at 4:04 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Hi Laurent,
>
> On Wed, Jun 8, 2016 at 2:18 AM, Laurent Pinchart
> <laurent.pinchart@ideasonboard.com> wrote:
>>> --- 0031/drivers/iommu/ipmmu-vmsa.c
>>> +++ work/drivers/iommu/ipmmu-vmsa.c   2016-06-06 11:19:40.210607110 +0900
>>> @@ -1074,7 +1074,7 @@ static const struct ipmmu_features ipmmu
>>>       .twobit_imttbcr_sl0 = false,
>>>  };
>>>
>>> -static const struct ipmmu_features ipmmu_features_r8a7795 = {
>>> +static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
>>>       .use_ns_alias_offset = false,
>>>       .has_cache_leaf_nodes = true,
>>>       .has_eight_ctx = true,
>>> @@ -1088,7 +1088,10 @@ static const struct of_device_id ipmmu_o
>>>               .data = &ipmmu_features_default,
>>>       }, {
>>>               .compatible = "renesas,ipmmu-r8a7795",
>>> -             .data = &ipmmu_features_r8a7795,
>>> +             .data = &ipmmu_features_rcar_gen3,
>>> +     }, {
>>> +             .compatible = "renesas,ipmmu-r8a7796",
>>> +             .data = &ipmmu_features_rcar_gen3,
>>>       }, {
>>>               /* Terminator */
>>>       },
>>> @@ -1268,6 +1271,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "r
>>>                ipmmu_vmsa_iommu_of_setup);
>>>  IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
>>>                ipmmu_vmsa_iommu_of_setup);
>>> +IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
>>> +              ipmmu_vmsa_iommu_of_setup);
>>
>> How about a Gen3 generic compatible string in addition to the SoC-specific
>> ones ?
>
> Do we want to specify the number of utlbs here?
> Does it differ between r8a7795, r8a7796, and future members?

The utlb number is already a property of the SoC part number. So I
don't see why we want to encode this as a separate DT property instead
of going with an in-driver feature flag.

Thanks,

/ magnus

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

* Re: [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2016-06-08  0:18   ` Laurent Pinchart
  2016-06-08  7:04     ` Geert Uytterhoeven
@ 2016-06-08  8:07     ` Magnus Damm
  1 sibling, 0 replies; 16+ messages in thread
From: Magnus Damm @ 2016-06-08  8:07 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: iommu, Laurent Pinchart, Geert Uytterhoeven, joro, linux-kernel,
	linux-renesas-soc, Simon Horman

Hi Laurent,

On Wed, Jun 8, 2016 at 9:18 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Magnus,
>
> Thank you for the patch.
>
> On Tuesday 07 Jun 2016 12:39:45 Magnus Damm wrote:
>> From: Magnus Damm <damm+renesas@opensource.se>
>>
>> Support the r8a7796 IPMMU by sharing feature flags between
>> r8a7795 and r8a7796. Also update IOMMU_OF_DECLARE to hook
>> up the updated compat string.
>>
>> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
>> ---
>>
>>  drivers/iommu/ipmmu-vmsa.c |    9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> --- 0031/drivers/iommu/ipmmu-vmsa.c
>> +++ work/drivers/iommu/ipmmu-vmsa.c   2016-06-06 11:19:40.210607110 +0900
>> @@ -1074,7 +1074,7 @@ static const struct ipmmu_features ipmmu
>>       .twobit_imttbcr_sl0 = false,
>>  };
>>
>> -static const struct ipmmu_features ipmmu_features_r8a7795 = {
>> +static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
>>       .use_ns_alias_offset = false,
>>       .has_cache_leaf_nodes = true,
>>       .has_eight_ctx = true,
>> @@ -1088,7 +1088,10 @@ static const struct of_device_id ipmmu_o
>>               .data = &ipmmu_features_default,
>>       }, {
>>               .compatible = "renesas,ipmmu-r8a7795",
>> -             .data = &ipmmu_features_r8a7795,
>> +             .data = &ipmmu_features_rcar_gen3,
>> +     }, {
>> +             .compatible = "renesas,ipmmu-r8a7796",
>> +             .data = &ipmmu_features_rcar_gen3,
>>       }, {
>>               /* Terminator */
>>       },
>> @@ -1268,6 +1271,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "r
>>                ipmmu_vmsa_iommu_of_setup);
>>  IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
>>                ipmmu_vmsa_iommu_of_setup);
>> +IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
>> +              ipmmu_vmsa_iommu_of_setup);
>
> How about a Gen3 generic compatible string in addition to the SoC-specific
> ones ?

As you probably know, neither R-Car Gen2 nor R-Car Gen3 families are
finished evolving. Because of that I find speculating with DT compat
strings just potentially confusing with no apparent upside. Just going
with what we know (ie the part number) is more than good enough IMO.

Thanks,

/ magnus

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

* Re: [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2016-06-08  7:04     ` Geert Uytterhoeven
  2016-06-08  8:05       ` Magnus Damm
@ 2016-06-08  8:48       ` Laurent Pinchart
  2016-06-08  9:12         ` Magnus Damm
  1 sibling, 1 reply; 16+ messages in thread
From: Laurent Pinchart @ 2016-06-08  8:48 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Magnus Damm, iommu, Laurent Pinchart, Geert Uytterhoeven,
	Joerg Roedel, linux-kernel, linux-renesas-soc, Simon Horman

Hi Geert,

On Wednesday 08 Jun 2016 09:04:17 Geert Uytterhoeven wrote:
> On Wed, Jun 8, 2016 at 2:18 AM, Laurent Pinchart wrote:
> >> --- 0031/drivers/iommu/ipmmu-vmsa.c
> >> +++ work/drivers/iommu/ipmmu-vmsa.c   2016-06-06 11:19:40.210607110 +0900
> >> @@ -1074,7 +1074,7 @@ static const struct ipmmu_features ipmmu
> >>       .twobit_imttbcr_sl0 = false,
 >>  };
> >> 
> >> -static const struct ipmmu_features ipmmu_features_r8a7795 = {
> >> +static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
> >>       .use_ns_alias_offset = false,
> >>       .has_cache_leaf_nodes = true,
> >>       .has_eight_ctx = true,
> >> @@ -1088,7 +1088,10 @@ static const struct of_device_id ipmmu_o
> >>               .data = &ipmmu_features_default,
> >>       }, {
> >>               .compatible = "renesas,ipmmu-r8a7795",
> >> -             .data = &ipmmu_features_r8a7795,
> >> +             .data = &ipmmu_features_rcar_gen3,
> >> +     }, {
> >> +             .compatible = "renesas,ipmmu-r8a7796",
> >> +             .data = &ipmmu_features_rcar_gen3,
> >>       }, {
> >>               /* Terminator */
> >>       },
> >> @@ -1268,6 +1271,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "r
> >>                ipmmu_vmsa_iommu_of_setup);
> >>  IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
> >>                ipmmu_vmsa_iommu_of_setup);
> >> +IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
> >> +              ipmmu_vmsa_iommu_of_setup);
> > 
> > How about a Gen3 generic compatible string in addition to the SoC-specific
> > ones ?
> 
> Do we want to specify the number of utlbs here?
> Does it differ between r8a7795, r8a7796, and future members?

It differs between IPMMU instances on a given SoC, so if we want to specify it 
it should be a DT property.

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2016-06-08  8:48       ` Laurent Pinchart
@ 2016-06-08  9:12         ` Magnus Damm
  2016-08-09 13:17           ` Laurent Pinchart
  0 siblings, 1 reply; 16+ messages in thread
From: Magnus Damm @ 2016-06-08  9:12 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Geert Uytterhoeven, iommu, Laurent Pinchart, Geert Uytterhoeven,
	Joerg Roedel, linux-kernel, linux-renesas-soc, Simon Horman

Hi Laurent,

On Wed, Jun 8, 2016 at 5:48 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Geert,
>
> On Wednesday 08 Jun 2016 09:04:17 Geert Uytterhoeven wrote:
>> On Wed, Jun 8, 2016 at 2:18 AM, Laurent Pinchart wrote:
>> >> --- 0031/drivers/iommu/ipmmu-vmsa.c
>> >> +++ work/drivers/iommu/ipmmu-vmsa.c   2016-06-06 11:19:40.210607110 +0900
>> >> @@ -1074,7 +1074,7 @@ static const struct ipmmu_features ipmmu
>> >>       .twobit_imttbcr_sl0 = false,
>  >>  };
>> >>
>> >> -static const struct ipmmu_features ipmmu_features_r8a7795 = {
>> >> +static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
>> >>       .use_ns_alias_offset = false,
>> >>       .has_cache_leaf_nodes = true,
>> >>       .has_eight_ctx = true,
>> >> @@ -1088,7 +1088,10 @@ static const struct of_device_id ipmmu_o
>> >>               .data = &ipmmu_features_default,
>> >>       }, {
>> >>               .compatible = "renesas,ipmmu-r8a7795",
>> >> -             .data = &ipmmu_features_r8a7795,
>> >> +             .data = &ipmmu_features_rcar_gen3,
>> >> +     }, {
>> >> +             .compatible = "renesas,ipmmu-r8a7796",
>> >> +             .data = &ipmmu_features_rcar_gen3,
>> >>       }, {
>> >>               /* Terminator */
>> >>       },
>> >> @@ -1268,6 +1271,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "r
>> >>                ipmmu_vmsa_iommu_of_setup);
>> >>  IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
>> >>                ipmmu_vmsa_iommu_of_setup);
>> >> +IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
>> >> +              ipmmu_vmsa_iommu_of_setup);
>> >
>> > How about a Gen3 generic compatible string in addition to the SoC-specific
>> > ones ?
>>
>> Do we want to specify the number of utlbs here?
>> Does it differ between r8a7795, r8a7796, and future members?
>
> It differs between IPMMU instances on a given SoC, so if we want to specify it
> it should be a DT property.

Can you please point out which documentation that says it varies with
IPMMU instance?

Based on IMUCTRn register description "H3-ES1" has 0-31 range while
"Others" have 0-47.

Thanks,

/ magnus

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

* Re: [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2016-06-08  9:12         ` Magnus Damm
@ 2016-08-09 13:17           ` Laurent Pinchart
  2016-08-09 13:19             ` Laurent Pinchart
  0 siblings, 1 reply; 16+ messages in thread
From: Laurent Pinchart @ 2016-08-09 13:17 UTC (permalink / raw)
  To: Magnus Damm
  Cc: Geert Uytterhoeven, iommu, Laurent Pinchart, Geert Uytterhoeven,
	Joerg Roedel, linux-kernel, linux-renesas-soc, Simon Horman

Hi Magnus,

On Wednesday 08 Jun 2016 18:12:31 Magnus Damm wrote:
> On Wed, Jun 8, 2016 at 5:48 PM, Laurent Pinchart wrote:
> > On Wednesday 08 Jun 2016 09:04:17 Geert Uytterhoeven wrote:
> >> On Wed, Jun 8, 2016 at 2:18 AM, Laurent Pinchart wrote:
> >>>> --- 0031/drivers/iommu/ipmmu-vmsa.c
> >>>> +++ work/drivers/iommu/ipmmu-vmsa.c   2016-06-06 11:19:40.210607110

[snip]

> >>>> @@ -1268,6 +1271,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "r
> >>>>                ipmmu_vmsa_iommu_of_setup);
> >>>>  IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
> >>>>                ipmmu_vmsa_iommu_of_setup);
> >>>> +IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
> >>>> +              ipmmu_vmsa_iommu_of_setup);
> >>> 
> >>> How about a Gen3 generic compatible string in addition to the
> >>> SoC-specific ones ?
> >> 
> >> Do we want to specify the number of utlbs here?
> >> Does it differ between r8a7795, r8a7796, and future members?
> > 
> > It differs between IPMMU instances on a given SoC, so if we want to
> > specify it it should be a DT property.
> 
> Can you please point out which documentation that says it varies with
> IPMMU instance?
> 
> Based on IMUCTRn register description "H3-ES1" has 0-31 range while
> "Others" have 0-47.

The maximum number of uTLBs is indeed the same according to that part of the 
documentation, but not all uTLBs are available in all IPMMU instances. We even 
have holes in the uTLB ranges, maybe a mask would be more appropriate.

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2016-08-09 13:17           ` Laurent Pinchart
@ 2016-08-09 13:19             ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2016-08-09 13:19 UTC (permalink / raw)
  To: Magnus Damm
  Cc: Geert Uytterhoeven, iommu, Laurent Pinchart, Geert Uytterhoeven,
	Joerg Roedel, linux-kernel, linux-renesas-soc, Simon Horman

On Tuesday 09 Aug 2016 16:17:57 Laurent Pinchart wrote:
> On Wednesday 08 Jun 2016 18:12:31 Magnus Damm wrote:
> > On Wed, Jun 8, 2016 at 5:48 PM, Laurent Pinchart wrote:
> >> On Wednesday 08 Jun 2016 09:04:17 Geert Uytterhoeven wrote:
> >>> On Wed, Jun 8, 2016 at 2:18 AM, Laurent Pinchart wrote:
> >>>>> --- 0031/drivers/iommu/ipmmu-vmsa.c
> >>>>> +++ work/drivers/iommu/ipmmu-vmsa.c   2016-06-06 11:19:40.210607110
> 
> [snip]
> 
> >>>>> @@ -1268,6 +1271,8 @@ IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "r
> >>>>>                ipmmu_vmsa_iommu_of_setup);
> >>>>>  IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795",
> >>>>>                ipmmu_vmsa_iommu_of_setup);
> >>>>> +IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796",
> >>>>> +              ipmmu_vmsa_iommu_of_setup);
> >>>> 
> >>>> How about a Gen3 generic compatible string in addition to the
> >>>> SoC-specific ones ?
> >>> 
> >>> Do we want to specify the number of utlbs here?
> >>> Does it differ between r8a7795, r8a7796, and future members?
> >> 
> >> It differs between IPMMU instances on a given SoC, so if we want to
> >> specify it it should be a DT property.
> > 
> > Can you please point out which documentation that says it varies with
> > IPMMU instance?
> > 
> > Based on IMUCTRn register description "H3-ES1" has 0-31 range while
> > "Others" have 0-47.
> 
> The maximum number of uTLBs is indeed the same according to that part of the
> documentation, but not all uTLBs are available in all IPMMU instances. We
> even have holes in the uTLB ranges, maybe a mask would be more appropriate.

And the other option is of course to ignore that and accept any uTLB number, 
in which case we will rely on the IOMMU bus master node providing correct 
information.

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2016-08-09 13:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-07  3:39 [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support Magnus Damm
2016-06-07  3:39 ` [PATCH 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm
2016-06-08  0:17   ` Laurent Pinchart
2016-06-07  3:39 ` [PATCH 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
2016-06-07 10:59   ` Sergei Shtylyov
2016-06-08  0:17   ` Laurent Pinchart
2016-06-07  3:39 ` [PATCH 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code Magnus Damm
2016-06-08  0:18   ` Laurent Pinchart
2016-06-08  7:04     ` Geert Uytterhoeven
2016-06-08  8:05       ` Magnus Damm
2016-06-08  8:48       ` Laurent Pinchart
2016-06-08  9:12         ` Magnus Damm
2016-08-09 13:17           ` Laurent Pinchart
2016-08-09 13:19             ` Laurent Pinchart
2016-06-08  8:07     ` Magnus Damm
2016-06-07  7:31 ` [PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support Geert Uytterhoeven

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