linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] iommu/ipmmu-vmsa: r8a7796 support V2
@ 2017-01-23 11:39 Magnus Damm
  2017-01-23 11:40 ` [PATCH v2 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Magnus Damm @ 2017-01-23 11: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: r8a7796 support V2

[PATCH v2 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding
[PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
[PATCH v2 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.

Changes since last version include:
- Patch #1 (DT binding patch) updated with more Acked-by tags
- Patch #2 (micro-TLB patch) updated with high I/O register range support

If possible I would like to fast-track merge of patch #1 to fix DT interface.

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

 Developed on top of renesas-drivers-2017-01-10-v4.10-rc3 with locally reverted
 "[PATCH 0/3] iommu/ipmmu-vmsa: Initial r8a7796 support"

 More detailed patch stack dependency is v4.10-rc3 + iommu/next and:
 [PATCH v6 00/07] iommu/ipmmu-vmsa: IPMMU multi-arch update V6
 [PATCH v2 00/11] iommu/ipmmu-vmsa: r8a7795 support V2

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

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

* [PATCH v2 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding
  2017-01-23 11:39 [PATCH v2 0/3] iommu/ipmmu-vmsa: r8a7796 support V2 Magnus Damm
@ 2017-01-23 11:40 ` Magnus Damm
  2017-01-23 11:40 ` [PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
  2017-01-23 11:40 ` [PATCH v2 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code Magnus Damm
  2 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2017-01-23 11:40 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>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
---

 Previously posted separately as
 [PATCH v3] iommu/ipmmu-vmsa: Add r8a7796 DT binding

 Changes since separate V3 version:
 - Added Acked-by from Geert - thanks!

 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] 7+ messages in thread

* [PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
  2017-01-23 11:39 [PATCH v2 0/3] iommu/ipmmu-vmsa: r8a7796 support V2 Magnus Damm
  2017-01-23 11:40 ` [PATCH v2 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm
@ 2017-01-23 11:40 ` Magnus Damm
  2017-01-23 12:42   ` Geert Uytterhoeven
  2017-01-27 11:47   ` Joerg Roedel
  2017-01-23 11:40 ` [PATCH v2 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code Magnus Damm
  2 siblings, 2 replies; 7+ messages in thread
From: Magnus Damm @ 2017-01-23 11:40 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-TLBs 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>
---

 Changes since V1:
 - Added support for the second I/O range at 0x600.

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

--- 0008/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c	2017-01-23 19:22:54.150607110 +0900
@@ -214,7 +214,9 @@ static void set_archdata(struct device *
 #define IMPMBA(n)			(0x0280 + ((n) * 4))
 #define IMPMBD(n)			(0x02c0 + ((n) * 4))
 
-#define IMUCTR(n)			(0x0300 + ((n) * 16))
+#define IMUCTR(n)			(n) < 32 ? IMUCTR0(n) : IMUCTR32(n)
+#define IMUCTR0(n)			(0x0300 + ((n) * 16))
+#define IMUCTR32(n)			(0x0600 + (((n) - 32) * 16))
 #define IMUCTR_FIXADDEN			(1 << 31)
 #define IMUCTR_FIXADD_MASK		(0xff << 16)
 #define IMUCTR_FIXADD_SHIFT		16
@@ -224,7 +226,9 @@ static void set_archdata(struct device *
 #define IMUCTR_FLUSH			(1 << 1)
 #define IMUCTR_MMUEN			(1 << 0)
 
-#define IMUASID(n)			(0x0308 + ((n) * 16))
+#define IMUASID(n)			(n) < 32 ? IMUASID0(n) : IMUASID32(n)
+#define IMUASID0(n)			(0x0308 + ((n) * 16))
+#define IMUASID32(n)			(0x0608 + (((n) - 32) * 16))
 #define IMUASID_ASID8_MASK		(0xff << 8)
 #define IMUASID_ASID8_SHIFT		8
 #define IMUASID_ASID0_MASK		(0xff << 0)
@@ -1141,7 +1145,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] 7+ messages in thread

* [PATCH v2 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
  2017-01-23 11:39 [PATCH v2 0/3] iommu/ipmmu-vmsa: r8a7796 support V2 Magnus Damm
  2017-01-23 11:40 ` [PATCH v2 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm
  2017-01-23 11:40 ` [PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
@ 2017-01-23 11:40 ` Magnus Damm
  2 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2017-01-23 11:40 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>
---

 Changes since V1:
 - None

 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] 7+ messages in thread

* Re: [PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
  2017-01-23 11:40 ` [PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
@ 2017-01-23 12:42   ` Geert Uytterhoeven
  2017-01-27 11:47   ` Joerg Roedel
  1 sibling, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2017-01-23 12:42 UTC (permalink / raw)
  To: Magnus Damm
  Cc: iommu, Laurent Pinchart, Geert Uytterhoeven, Joerg Roedel,
	linux-kernel, Linux-Renesas, Simon Horman

Hi Magnus,

On Mon, Jan 23, 2017 at 12:40 PM, Magnus Damm <magnus.damm@gmail.com> 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-TLBs 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>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> @@ -1141,7 +1145,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 the utlb channel numbers received from DT,
in ipmmu_init_platform_device(), right?

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

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] 7+ messages in thread

* Re: [PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
  2017-01-23 11:40 ` [PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
  2017-01-23 12:42   ` Geert Uytterhoeven
@ 2017-01-27 11:47   ` Joerg Roedel
  2017-01-30 22:16     ` Magnus Damm
  1 sibling, 1 reply; 7+ messages in thread
From: Joerg Roedel @ 2017-01-27 11:47 UTC (permalink / raw)
  To: Magnus Damm
  Cc: iommu, laurent.pinchart+renesas, geert+renesas, linux-kernel,
	linux-renesas-soc, horms+renesas

On Mon, Jan 23, 2017 at 08:40:29PM +0900, 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-TLBs 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>

I get a conflict when applying this to v4.10-rc5. What is this based on,
any patches I missed?


	Joerg

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

* Re: [PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
  2017-01-27 11:47   ` Joerg Roedel
@ 2017-01-30 22:16     ` Magnus Damm
  0 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2017-01-30 22:16 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: iommu, Laurent Pinchart, Geert Uytterhoeven, linux-kernel,
	Linux-Renesas, Simon Horman

Hi Joerg,

On Fri, Jan 27, 2017 at 8:47 PM, Joerg Roedel <joro@8bytes.org> wrote:
> On Mon, Jan 23, 2017 at 08:40:29PM +0900, 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-TLBs 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>
>
> I get a conflict when applying this to v4.10-rc5. What is this based on,
> any patches I missed?

Thanks for giving it a go. The second patch in this series should apply as-is:
[PATCH v2 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding

However for driver code there are two series in between:
 [PATCH v6 00/07] iommu/ipmmu-vmsa: IPMMU multi-arch update V6
 [PATCH v2 00/11] iommu/ipmmu-vmsa: r8a7795 support V2

For more detailed dependency information please see the cover letter!

Regarding the driver code please wait for "IPMMU multi-arch update V7"
that takes comments from Laurent into consideration. Hopefully I
should be able to send it out some time this week.

As for "[PATCH v2 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding",
would it be possible to fast track mainline merge of that particular
DT binding patch? Can you take it in your tree?

To give some background, we already have the IPMMU DT binding for
older devices and the sister device r8a7795 in mainline, so the
r8a7796 DT binding is just a small incremental step. To make sure we
don't go too wild with DT changes we tend to require that the DT
binding change should be queued up before starting to merge changes to
DTS files. So currently some DT changes are blocking on that r8a7796
DT binding and it would be nice to unblock those if possible..

Thanks!

/ magnus

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

end of thread, other threads:[~2017-01-30 22:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 11:39 [PATCH v2 0/3] iommu/ipmmu-vmsa: r8a7796 support V2 Magnus Damm
2017-01-23 11:40 ` [PATCH v2 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm
2017-01-23 11:40 ` [PATCH v2 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm
2017-01-23 12:42   ` Geert Uytterhoeven
2017-01-27 11:47   ` Joerg Roedel
2017-01-30 22:16     ` Magnus Damm
2017-01-23 11:40 ` [PATCH v2 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code Magnus Damm

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