2018-06-14 10:52:31

by Jacopo Mondi

[permalink] [raw]
Subject: [RESEND 0/6] iommu: ipmmu-vmsa: Add more Gen3 SoCs support

Hello,
this series collects patches sent to mailing lists in late 2017 to add
support for a number of R-Car Gen3 SoCs to the ipmmu-vmsa driver.

Part of the series these patches were part of went in through Alex Williamson
tree and are now included in v4.17.

These patches have not yet been collected, and need to be rebased on v4.17,
and this what this series serves for.

The series:
- Increses the micro-TLB size to 48bits to accomodate newer SoCs
- Adds support for M3-N, M3-W, V3-M and E3 to ipmmu-vmsa driver
- Documents M3-N, V3H and E3 device tree bindings

All patches have been acked/reviewed by, if nothing big happens they should
be ready to be collected.

Thanks
j

Jacopo Mondi (2):
dt-bindings: iommu/ipmmu-vmsa: Add R-Car M3-N (R8A77965)
iommu/ipmmu-vmsa: Hook up R8A77965 DT matching code

Magnus Damm (3):
iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
iommu/ipmmu-vmsa: Document R-Car V3H and E3 IPMMU DT bindings

Simon Horman (1):
iommu/ipmmu-vmsa: Hook up r8a779(70|95) DT matching code

.../bindings/iommu/renesas,ipmmu-vmsa.txt | 3 ++
drivers/iommu/ipmmu-vmsa.c | 38 ++++++++++++++++++----
2 files changed, 34 insertions(+), 7 deletions(-)

--
2.7.4



2018-06-14 10:50:05

by Jacopo Mondi

[permalink] [raw]
Subject: [RESEND 6/6] iommu/ipmmu-vmsa: Document R-Car V3H and E3 IPMMU DT bindings

From: Magnus Damm <[email protected]>

Update the IPMMU DT binding documentation to include the compat strings
for the IPMMU devices included in the R-Car V3H and E3 SoCs.

Signed-off-by: Magnus Damm <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Acked-by: Rob Herring <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
---
Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
index 8d145a4..c6e2d85 100644
--- a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
+++ b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
@@ -21,6 +21,8 @@ Required Properties:
- "renesas,ipmmu-r8a7796" for the R8A7796 (R-Car M3-W) IPMMU.
- "renesas,ipmmu-r8a77965" for the R8A77965 (R-Car M3-N) IPMMU.
- "renesas,ipmmu-r8a77970" for the R8A77970 (R-Car V3M) IPMMU.
+ - "renesas,ipmmu-r8a77980" for the R8A77980 (R-Car V3H) IPMMU.
+ - "renesas,ipmmu-r8a77990" for the R8A77990 (R-Car E3) IPMMU.
- "renesas,ipmmu-r8a77995" for the R8A77995 (R-Car D3) IPMMU.
- "renesas,ipmmu-vmsa" for generic R-Car Gen2 or RZ/G1 VMSA-compatible
IPMMU.
--
2.7.4


2018-06-14 10:50:36

by Jacopo Mondi

[permalink] [raw]
Subject: [RESEND 5/6] iommu/ipmmu-vmsa: Hook up R8A77965 DT matching code

Add support for R-Car M3-N (R8A77965) SoC IPMMUs.

Signed-off-by: Jacopo Mondi <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
---
drivers/iommu/ipmmu-vmsa.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 933a3da..6a0e714 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -763,6 +763,7 @@ static bool ipmmu_slave_whitelist(struct device *dev)
static const struct soc_device_attribute soc_rcar_gen3[] = {
{ .soc_id = "r8a7795", },
{ .soc_id = "r8a7796", },
+ { .soc_id = "r8a77965", },
{ .soc_id = "r8a77970", },
{ .soc_id = "r8a77995", },
{ /* sentinel */ }
@@ -945,6 +946,9 @@ static const struct of_device_id ipmmu_of_ids[] = {
.compatible = "renesas,ipmmu-r8a7796",
.data = &ipmmu_features_rcar_gen3,
}, {
+ .compatible = "renesas,ipmmu-r8a77965",
+ .data = &ipmmu_features_rcar_gen3,
+ }, {
.compatible = "renesas,ipmmu-r8a77970",
.data = &ipmmu_features_rcar_gen3,
}, {
@@ -1127,6 +1131,7 @@ module_exit(ipmmu_exit);
IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "renesas,ipmmu-vmsa");
IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795");
IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796");
+IOMMU_OF_DECLARE(ipmmu_r8a77965_iommu_of, "renesas,ipmmu-r8a77965");
IOMMU_OF_DECLARE(ipmmu_r8a77970_iommu_of, "renesas,ipmmu-r8a77970");
IOMMU_OF_DECLARE(ipmmu_r8a77995_iommu_of, "renesas,ipmmu-r8a77995");

--
2.7.4


2018-06-14 10:50:59

by Jacopo Mondi

[permalink] [raw]
Subject: [RESEND 2/6] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code

From: Magnus Damm <[email protected]>

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

[rebased on v4.17]
Signed-off-by: Jacopo Mondi <[email protected]>
Signed-off-by: Magnus Damm <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
---
drivers/iommu/ipmmu-vmsa.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 5c1ade7..04c8015 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -760,8 +760,9 @@ static bool ipmmu_slave_whitelist(struct device *dev)
return false;
}

-static const struct soc_device_attribute soc_r8a7795[] = {
+static const struct soc_device_attribute soc_rcar_gen3[] = {
{ .soc_id = "r8a7795", },
+ { .soc_id = "r8a7796", },
{ /* sentinel */ }
};

@@ -769,7 +770,7 @@ static int ipmmu_of_xlate(struct device *dev,
struct of_phandle_args *spec)
{
/* For R-Car Gen3 use a white list to opt-in slave devices */
- if (soc_device_match(soc_r8a7795) && !ipmmu_slave_whitelist(dev))
+ if (soc_device_match(soc_rcar_gen3) && !ipmmu_slave_whitelist(dev))
return -ENODEV;

iommu_fwspec_add_ids(dev, spec->args, 1);
@@ -923,7 +924,7 @@ static const struct ipmmu_features ipmmu_features_default = {
.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,
.number_of_contexts = 8,
@@ -937,7 +938,10 @@ static const struct of_device_id ipmmu_of_ids[] = {
.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 */
},
@@ -1114,6 +1118,7 @@ module_exit(ipmmu_exit);

IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "renesas,ipmmu-vmsa");
IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795");
+IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796");

MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU");
MODULE_AUTHOR("Laurent Pinchart <[email protected]>");
--
2.7.4


2018-06-14 10:51:16

by Jacopo Mondi

[permalink] [raw]
Subject: [RESEND 3/6] iommu/ipmmu-vmsa: Hook up r8a779(70|95) DT matching code

From: Simon Horman <[email protected]>

Support the r8a77970 (R-Car V3M) and r8a77995 (R-Car D3) IPMMUs by sharing
feature flags with r8a7795 (R-Car H3) and r8a7796 (R-Car M3-W). Also update
IOMMU_OF_DECLARE to hook up the compat strings.

Based on work for the r8a7796 by Magnus Damm

[rebased on v4.17]
Signed-off-by: Jacopo Mondi <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
---
drivers/iommu/ipmmu-vmsa.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 04c8015..933a3da 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -763,6 +763,8 @@ static bool ipmmu_slave_whitelist(struct device *dev)
static const struct soc_device_attribute soc_rcar_gen3[] = {
{ .soc_id = "r8a7795", },
{ .soc_id = "r8a7796", },
+ { .soc_id = "r8a77970", },
+ { .soc_id = "r8a77995", },
{ /* sentinel */ }
};

@@ -943,6 +945,12 @@ static const struct of_device_id ipmmu_of_ids[] = {
.compatible = "renesas,ipmmu-r8a7796",
.data = &ipmmu_features_rcar_gen3,
}, {
+ .compatible = "renesas,ipmmu-r8a77970",
+ .data = &ipmmu_features_rcar_gen3,
+ }, {
+ .compatible = "renesas,ipmmu-r8a77995",
+ .data = &ipmmu_features_rcar_gen3,
+ }, {
/* Terminator */
},
};
@@ -1119,6 +1127,8 @@ module_exit(ipmmu_exit);
IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "renesas,ipmmu-vmsa");
IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795");
IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-r8a7796");
+IOMMU_OF_DECLARE(ipmmu_r8a77970_iommu_of, "renesas,ipmmu-r8a77970");
+IOMMU_OF_DECLARE(ipmmu_r8a77995_iommu_of, "renesas,ipmmu-r8a77995");

MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU");
MODULE_AUTHOR("Laurent Pinchart <[email protected]>");
--
2.7.4


2018-06-14 10:51:26

by Jacopo Mondi

[permalink] [raw]
Subject: [RESEND 4/6] dt-bindings: iommu/ipmmu-vmsa: Add R-Car M3-N (R8A77965)

Add Renesas R-Car M3-N (R8A77965) compat string to IPMMU DT bindings
documentation.

Signed-off-by: Jacopo Mondi <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
index ffadb7c..8d145a4 100644
--- a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
+++ b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
@@ -19,6 +19,7 @@ Required Properties:
- "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-r8a77965" for the R8A77965 (R-Car M3-N) IPMMU.
- "renesas,ipmmu-r8a77970" for the R8A77970 (R-Car V3M) IPMMU.
- "renesas,ipmmu-r8a77995" for the R8A77995 (R-Car D3) IPMMU.
- "renesas,ipmmu-vmsa" for generic R-Car Gen2 or RZ/G1 VMSA-compatible
--
2.7.4


2018-06-14 10:51:45

by Jacopo Mondi

[permalink] [raw]
Subject: [RESEND 1/6] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48

From: Magnus Damm <[email protected]>

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 <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
---
drivers/iommu/ipmmu-vmsa.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 40ae6e8..5c1ade7 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -194,7 +194,9 @@ static struct ipmmu_vmsa_device *to_ipmmu(struct device *dev)
#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
@@ -204,7 +206,9 @@ static struct ipmmu_vmsa_device *to_ipmmu(struct device *dev)
#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)
@@ -955,7 +959,7 @@ static int ipmmu_probe(struct platform_device *pdev)
}

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 = of_device_get_match_data(&pdev->dev);
--
2.7.4


2018-06-20 11:30:17

by Simon Horman

[permalink] [raw]
Subject: Re: [RESEND 0/6] iommu: ipmmu-vmsa: Add more Gen3 SoCs support

[CC Alex Williamson]

On Thu, Jun 14, 2018 at 12:48:20PM +0200, Jacopo Mondi wrote:
> Hello,
> this series collects patches sent to mailing lists in late 2017 to add
> support for a number of R-Car Gen3 SoCs to the ipmmu-vmsa driver.
>
> Part of the series these patches were part of went in through Alex Williamson
> tree and are now included in v4.17.
>
> These patches have not yet been collected, and need to be rebased on v4.17,
> and this what this series serves for.
>
> The series:
> - Increses the micro-TLB size to 48bits to accomodate newer SoCs
> - Adds support for M3-N, M3-W, V3-M and E3 to ipmmu-vmsa driver
> - Documents M3-N, V3H and E3 device tree bindings
>
> All patches have been acked/reviewed by, if nothing big happens they should
> be ready to be collected.

All patches:

Reviewed-by: Simon Horman <[email protected]>

Joerg, Alex,

I'd be most grateful if we could find a way for these patches to progress
into mainline.

>
> Thanks
> j
>
> Jacopo Mondi (2):
> dt-bindings: iommu/ipmmu-vmsa: Add R-Car M3-N (R8A77965)
> iommu/ipmmu-vmsa: Hook up R8A77965 DT matching code
>
> Magnus Damm (3):
> iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
> iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
> iommu/ipmmu-vmsa: Document R-Car V3H and E3 IPMMU DT bindings
>
> Simon Horman (1):
> iommu/ipmmu-vmsa: Hook up r8a779(70|95) DT matching code
>
> .../bindings/iommu/renesas,ipmmu-vmsa.txt | 3 ++
> drivers/iommu/ipmmu-vmsa.c | 38 ++++++++++++++++++----
> 2 files changed, 34 insertions(+), 7 deletions(-)
>
> --
> 2.7.4
>

2018-07-06 12:14:35

by Joerg Roedel

[permalink] [raw]
Subject: Re: [RESEND 0/6] iommu: ipmmu-vmsa: Add more Gen3 SoCs support

On Thu, Jun 14, 2018 at 12:48:20PM +0200, Jacopo Mondi wrote:
> Jacopo Mondi (2):
> dt-bindings: iommu/ipmmu-vmsa: Add R-Car M3-N (R8A77965)
> iommu/ipmmu-vmsa: Hook up R8A77965 DT matching code
>
> Magnus Damm (3):
> iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
> iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
> iommu/ipmmu-vmsa: Document R-Car V3H and E3 IPMMU DT bindings
>
> Simon Horman (1):
> iommu/ipmmu-vmsa: Hook up r8a779(70|95) DT matching code

Applied for v4.19, thanks.