All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist()
@ 2018-11-28  6:10 ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  6:10 UTC (permalink / raw)
  To: joro
  Cc: magnus.damm, geert+renesas, horms+renesas, iommu,
	linux-renesas-soc, Yoshihiro Shimoda

This patch set is based on iommu.git / latest next branch
(commit id = f262283c224537962cba0f41b8823e3be9f7b0ff)

I talked with Geert-san about this topic on below:
https://patchwork.kernel.org/patch/10651375/

Also Simon-san suggests we should keep the whitelist.

So, not to change behavior of R-Car Gen2, this patch set adds
two conditions. After applied this patch set, we can add slave
devices easily like below:

--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -774,6 +774,8 @@ static int ipmmu_init_platform_device(struct device *dev,
 };
 
 static const char * const rcar_gen3_slave_whitelist[] = {
+	"e6700000.dma-controller",
+	"e7300000.dma-controller"
 };
 
 static bool ipmmu_slave_whitelist(struct device *dev)


Yoshihiro Shimoda (2):
  iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC
    revisions
  iommu/ipmmu-vmsa: add an array of slave devices whitelist

 drivers/iommu/ipmmu-vmsa.c | 45 +++++++++++++++++++++++++++++++++++++--------
 1 file changed, 37 insertions(+), 8 deletions(-)

-- 
1.9.1

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

* [PATCH 1/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions
@ 2018-11-28  6:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  6:10 UTC (permalink / raw)
  To: joro
  Cc: magnus.damm, geert+renesas, horms+renesas, iommu,
	linux-renesas-soc, Yoshihiro Shimoda

Some R-Car Gen3 SoCs has hardware restrictions on the IPMMU. So,
to check whether this R-Car Gen3 SoC can use the IPMMU correctly,
this patch modifies the ipmmu_slave_whitelist().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/iommu/ipmmu-vmsa.c | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 9e2655f..1c38538 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -754,12 +754,6 @@ static int ipmmu_init_platform_device(struct device *dev,
 	return 0;
 }
 
-static bool ipmmu_slave_whitelist(struct device *dev)
-{
-	/* By default, do not allow use of IPMMU */
-	return false;
-}
-
 static const struct soc_device_attribute soc_rcar_gen3[] = {
 	{ .soc_id = "r8a774a1", },
 	{ .soc_id = "r8a7795", },
@@ -771,11 +765,35 @@ static bool ipmmu_slave_whitelist(struct device *dev)
 	{ /* sentinel */ }
 };
 
+static const struct soc_device_attribute soc_rcar_gen3_whitelist[] = {
+	{ .soc_id = "r8a7795", .revision = "ES3.0" },
+	{ .soc_id = "r8a77965", },
+	{ .soc_id = "r8a77990", },
+	{ .soc_id = "r8a77995", },
+	{ /* sentinel */ }
+};
+
+static bool ipmmu_slave_whitelist(struct device *dev)
+{
+	/*
+	 * For R-Car Gen3 use a white list to opt-in slave devices.
+	 * For Other SoCs, this returns true anyway.
+	 */
+	if (!soc_device_match(soc_rcar_gen3))
+		return true;
+
+	/* Check whether this R-Car Gen3 can use the IPMMU correctly or not */
+	if (!soc_device_match(soc_rcar_gen3_whitelist))
+		return false;
+
+	/* By default, do not allow use of IPMMU */
+	return false;
+}
+
 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_rcar_gen3) && !ipmmu_slave_whitelist(dev))
+	if (!ipmmu_slave_whitelist(dev))
 		return -ENODEV;
 
 	iommu_fwspec_add_ids(dev, spec->args, 1);
-- 
1.9.1

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

* [PATCH 1/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions
@ 2018-11-28  6:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  6:10 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A
  Cc: geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ,
	magnus.damm-Re5JQEeQqe8AvxtiuMwx3w,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	horms+renesas-/R6kz+dDXgpPR4JQBCEnsQ

Some R-Car Gen3 SoCs has hardware restrictions on the IPMMU. So,
to check whether this R-Car Gen3 SoC can use the IPMMU correctly,
this patch modifies the ipmmu_slave_whitelist().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
 drivers/iommu/ipmmu-vmsa.c | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 9e2655f..1c38538 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -754,12 +754,6 @@ static int ipmmu_init_platform_device(struct device *dev,
 	return 0;
 }
 
-static bool ipmmu_slave_whitelist(struct device *dev)
-{
-	/* By default, do not allow use of IPMMU */
-	return false;
-}
-
 static const struct soc_device_attribute soc_rcar_gen3[] = {
 	{ .soc_id = "r8a774a1", },
 	{ .soc_id = "r8a7795", },
@@ -771,11 +765,35 @@ static bool ipmmu_slave_whitelist(struct device *dev)
 	{ /* sentinel */ }
 };
 
+static const struct soc_device_attribute soc_rcar_gen3_whitelist[] = {
+	{ .soc_id = "r8a7795", .revision = "ES3.0" },
+	{ .soc_id = "r8a77965", },
+	{ .soc_id = "r8a77990", },
+	{ .soc_id = "r8a77995", },
+	{ /* sentinel */ }
+};
+
+static bool ipmmu_slave_whitelist(struct device *dev)
+{
+	/*
+	 * For R-Car Gen3 use a white list to opt-in slave devices.
+	 * For Other SoCs, this returns true anyway.
+	 */
+	if (!soc_device_match(soc_rcar_gen3))
+		return true;
+
+	/* Check whether this R-Car Gen3 can use the IPMMU correctly or not */
+	if (!soc_device_match(soc_rcar_gen3_whitelist))
+		return false;
+
+	/* By default, do not allow use of IPMMU */
+	return false;
+}
+
 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_rcar_gen3) && !ipmmu_slave_whitelist(dev))
+	if (!ipmmu_slave_whitelist(dev))
 		return -ENODEV;
 
 	iommu_fwspec_add_ids(dev, spec->args, 1);
-- 
1.9.1

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

* [PATCH 0/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist()
@ 2018-11-28  6:10 ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  6:10 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A
  Cc: geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ,
	magnus.damm-Re5JQEeQqe8AvxtiuMwx3w,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	horms+renesas-/R6kz+dDXgpPR4JQBCEnsQ

This patch set is based on iommu.git / latest next branch
(commit id = f262283c224537962cba0f41b8823e3be9f7b0ff)

I talked with Geert-san about this topic on below:
https://patchwork.kernel.org/patch/10651375/

Also Simon-san suggests we should keep the whitelist.

So, not to change behavior of R-Car Gen2, this patch set adds
two conditions. After applied this patch set, we can add slave
devices easily like below:

--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -774,6 +774,8 @@ static int ipmmu_init_platform_device(struct device *dev,
 };
 
 static const char * const rcar_gen3_slave_whitelist[] = {
+	"e6700000.dma-controller",
+	"e7300000.dma-controller"
 };
 
 static bool ipmmu_slave_whitelist(struct device *dev)


Yoshihiro Shimoda (2):
  iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC
    revisions
  iommu/ipmmu-vmsa: add an array of slave devices whitelist

 drivers/iommu/ipmmu-vmsa.c | 45 +++++++++++++++++++++++++++++++++++++--------
 1 file changed, 37 insertions(+), 8 deletions(-)

-- 
1.9.1

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

* [PATCH 2/2] iommu/ipmmu-vmsa: add an array of slave devices whitelist
@ 2018-11-28  6:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  6:10 UTC (permalink / raw)
  To: joro
  Cc: magnus.damm, geert+renesas, horms+renesas, iommu,
	linux-renesas-soc, Yoshihiro Shimoda

To avoid adding copy and pasted strcmp codes in the future,
this patch adds an array "rcar_gen3_slave_whitelist" to check
whether the device can work with the IPMMU or not.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/iommu/ipmmu-vmsa.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 1c38538..1f65469 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -773,8 +773,13 @@ static int ipmmu_init_platform_device(struct device *dev,
 	{ /* sentinel */ }
 };
 
+static const char * const rcar_gen3_slave_whitelist[] = {
+};
+
 static bool ipmmu_slave_whitelist(struct device *dev)
 {
+	int i;
+
 	/*
 	 * For R-Car Gen3 use a white list to opt-in slave devices.
 	 * For Other SoCs, this returns true anyway.
@@ -786,7 +791,13 @@ static bool ipmmu_slave_whitelist(struct device *dev)
 	if (!soc_device_match(soc_rcar_gen3_whitelist))
 		return false;
 
-	/* By default, do not allow use of IPMMU */
+	/* Check whether this slave device can work with the IPMMU */
+	for (i = 0; i < ARRAY_SIZE(rcar_gen3_slave_whitelist); i++) {
+		if (!strcmp(dev_name(dev), rcar_gen3_slave_whitelist[i]))
+			return true;
+	}
+
+	/* Otherwise, do not allow use of IPMMU */
 	return false;
 }
 
-- 
1.9.1

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

* [PATCH 2/2] iommu/ipmmu-vmsa: add an array of slave devices whitelist
@ 2018-11-28  6:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  6:10 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A
  Cc: geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ,
	magnus.damm-Re5JQEeQqe8AvxtiuMwx3w,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	horms+renesas-/R6kz+dDXgpPR4JQBCEnsQ

To avoid adding copy and pasted strcmp codes in the future,
this patch adds an array "rcar_gen3_slave_whitelist" to check
whether the device can work with the IPMMU or not.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
 drivers/iommu/ipmmu-vmsa.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 1c38538..1f65469 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -773,8 +773,13 @@ static int ipmmu_init_platform_device(struct device *dev,
 	{ /* sentinel */ }
 };
 
+static const char * const rcar_gen3_slave_whitelist[] = {
+};
+
 static bool ipmmu_slave_whitelist(struct device *dev)
 {
+	int i;
+
 	/*
 	 * For R-Car Gen3 use a white list to opt-in slave devices.
 	 * For Other SoCs, this returns true anyway.
@@ -786,7 +791,13 @@ static bool ipmmu_slave_whitelist(struct device *dev)
 	if (!soc_device_match(soc_rcar_gen3_whitelist))
 		return false;
 
-	/* By default, do not allow use of IPMMU */
+	/* Check whether this slave device can work with the IPMMU */
+	for (i = 0; i < ARRAY_SIZE(rcar_gen3_slave_whitelist); i++) {
+		if (!strcmp(dev_name(dev), rcar_gen3_slave_whitelist[i]))
+			return true;
+	}
+
+	/* Otherwise, do not allow use of IPMMU */
 	return false;
 }
 
-- 
1.9.1

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

* Re: [PATCH 1/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions
@ 2018-11-28  8:46     ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2018-11-28  8:46 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: Joerg Roedel, Magnus Damm, Geert Uytterhoeven, Simon Horman,
	Linux IOMMU, Linux-Renesas

Hi Shimoda-san,

On Wed, Nov 28, 2018 at 7:10 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> Some R-Car Gen3 SoCs has hardware restrictions on the IPMMU. So,
> to check whether this R-Car Gen3 SoC can use the IPMMU correctly,
> this patch modifies the ipmmu_slave_whitelist().
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

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

One question below.

> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c

> @@ -771,11 +765,35 @@ static bool ipmmu_slave_whitelist(struct device *dev)
>         { /* sentinel */ }
>  };
>
> +static const struct soc_device_attribute soc_rcar_gen3_whitelist[] = {
> +       { .soc_id = "r8a7795", .revision = "ES3.0" },

Don't you want "ES3.*"?

> +       { .soc_id = "r8a77965", },
> +       { .soc_id = "r8a77990", },
> +       { .soc_id = "r8a77995", },
> +       { /* sentinel */ }
> +};

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

* Re: [PATCH 1/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions
@ 2018-11-28  8:46     ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2018-11-28  8:46 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: Geert Uytterhoeven, Magnus Damm, Linux-Renesas, Linux IOMMU,
	Simon Horman

Hi Shimoda-san,

On Wed, Nov 28, 2018 at 7:10 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> wrote:
> Some R-Car Gen3 SoCs has hardware restrictions on the IPMMU. So,
> to check whether this R-Car Gen3 SoC can use the IPMMU correctly,
> this patch modifies the ipmmu_slave_whitelist().
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>

One question below.

> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c

> @@ -771,11 +765,35 @@ static bool ipmmu_slave_whitelist(struct device *dev)
>         { /* sentinel */ }
>  };
>
> +static const struct soc_device_attribute soc_rcar_gen3_whitelist[] = {
> +       { .soc_id = "r8a7795", .revision = "ES3.0" },

Don't you want "ES3.*"?

> +       { .soc_id = "r8a77965", },
> +       { .soc_id = "r8a77990", },
> +       { .soc_id = "r8a77995", },
> +       { /* sentinel */ }
> +};

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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] 14+ messages in thread

* Re: [PATCH 2/2] iommu/ipmmu-vmsa: add an array of slave devices whitelist
@ 2018-11-28  8:47     ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2018-11-28  8:47 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: Joerg Roedel, Magnus Damm, Geert Uytterhoeven, Simon Horman,
	Linux IOMMU, Linux-Renesas

Hi Shimoda-san,

On Wed, Nov 28, 2018 at 7:10 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> To avoid adding copy and pasted strcmp codes in the future,
> this patch adds an array "rcar_gen3_slave_whitelist" to check
> whether the device can work with the IPMMU or not.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

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

One small comment below.

> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -773,8 +773,13 @@ static int ipmmu_init_platform_device(struct device *dev,
>         { /* sentinel */ }
>  };
>
> +static const char * const rcar_gen3_slave_whitelist[] = {
> +};
> +
>  static bool ipmmu_slave_whitelist(struct device *dev)
>  {
> +       int i;

unsigned int

> +
>         /*
>          * For R-Car Gen3 use a white list to opt-in slave devices.
>          * For Other SoCs, this returns true anyway.
> @@ -786,7 +791,13 @@ static bool ipmmu_slave_whitelist(struct device *dev)
>         if (!soc_device_match(soc_rcar_gen3_whitelist))
>                 return false;
>
> -       /* By default, do not allow use of IPMMU */
> +       /* Check whether this slave device can work with the IPMMU */
> +       for (i = 0; i < ARRAY_SIZE(rcar_gen3_slave_whitelist); i++) {
> +               if (!strcmp(dev_name(dev), rcar_gen3_slave_whitelist[i]))
> +                       return true;
> +       }
> +
> +       /* Otherwise, do not allow use of IPMMU */
>         return false;
>  }

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

* Re: [PATCH 2/2] iommu/ipmmu-vmsa: add an array of slave devices whitelist
@ 2018-11-28  8:47     ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2018-11-28  8:47 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: Geert Uytterhoeven, Magnus Damm, Linux-Renesas, Linux IOMMU,
	Simon Horman

Hi Shimoda-san,

On Wed, Nov 28, 2018 at 7:10 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> wrote:
> To avoid adding copy and pasted strcmp codes in the future,
> this patch adds an array "rcar_gen3_slave_whitelist" to check
> whether the device can work with the IPMMU or not.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>

One small comment below.

> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -773,8 +773,13 @@ static int ipmmu_init_platform_device(struct device *dev,
>         { /* sentinel */ }
>  };
>
> +static const char * const rcar_gen3_slave_whitelist[] = {
> +};
> +
>  static bool ipmmu_slave_whitelist(struct device *dev)
>  {
> +       int i;

unsigned int

> +
>         /*
>          * For R-Car Gen3 use a white list to opt-in slave devices.
>          * For Other SoCs, this returns true anyway.
> @@ -786,7 +791,13 @@ static bool ipmmu_slave_whitelist(struct device *dev)
>         if (!soc_device_match(soc_rcar_gen3_whitelist))
>                 return false;
>
> -       /* By default, do not allow use of IPMMU */
> +       /* Check whether this slave device can work with the IPMMU */
> +       for (i = 0; i < ARRAY_SIZE(rcar_gen3_slave_whitelist); i++) {
> +               if (!strcmp(dev_name(dev), rcar_gen3_slave_whitelist[i]))
> +                       return true;
> +       }
> +
> +       /* Otherwise, do not allow use of IPMMU */
>         return false;
>  }

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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] 14+ messages in thread

* RE: [PATCH 1/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions
@ 2018-11-28  9:04       ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  9:04 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Joerg Roedel, Magnus Damm, Geert Uytterhoeven, Simon Horman,
	Linux IOMMU, Linux-Renesas

Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Wednesday, November 28, 2018 5:47 PM
> 
> Hi Shimoda-san,
> 
> On Wed, Nov 28, 2018 at 7:10 AM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com> wrote:
> > Some R-Car Gen3 SoCs has hardware restrictions on the IPMMU. So,
> > to check whether this R-Car Gen3 SoC can use the IPMMU correctly,
> > this patch modifies the ipmmu_slave_whitelist().
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thank you for the review!

> One question below.
> 
> > --- a/drivers/iommu/ipmmu-vmsa.c
> > +++ b/drivers/iommu/ipmmu-vmsa.c
> 
> > @@ -771,11 +765,35 @@ static bool ipmmu_slave_whitelist(struct device *dev)
> >         { /* sentinel */ }
> >  };
> >
> > +static const struct soc_device_attribute soc_rcar_gen3_whitelist[] = {
> > +       { .soc_id = "r8a7795", .revision = "ES3.0" },
> 
> Don't you want "ES3.*"?

Indeed (I want "ES3.*"). So, I'll submit v2 patch to fix it.

Best regards,
Yoshihiro Shimoda

> > +       { .soc_id = "r8a77965", },
> > +       { .soc_id = "r8a77990", },
> > +       { .soc_id = "r8a77995", },
> > +       { /* sentinel */ }
> > +};
> 
> 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] 14+ messages in thread

* RE: [PATCH 1/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions
@ 2018-11-28  9:04       ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  9:04 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Geert Uytterhoeven, Magnus Damm, Linux-Renesas, Linux IOMMU,
	Simon Horman

Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Wednesday, November 28, 2018 5:47 PM
> 
> Hi Shimoda-san,
> 
> On Wed, Nov 28, 2018 at 7:10 AM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> wrote:
> > Some R-Car Gen3 SoCs has hardware restrictions on the IPMMU. So,
> > to check whether this R-Car Gen3 SoC can use the IPMMU correctly,
> > this patch modifies the ipmmu_slave_whitelist().
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>

Thank you for the review!

> One question below.
> 
> > --- a/drivers/iommu/ipmmu-vmsa.c
> > +++ b/drivers/iommu/ipmmu-vmsa.c
> 
> > @@ -771,11 +765,35 @@ static bool ipmmu_slave_whitelist(struct device *dev)
> >         { /* sentinel */ }
> >  };
> >
> > +static const struct soc_device_attribute soc_rcar_gen3_whitelist[] = {
> > +       { .soc_id = "r8a7795", .revision = "ES3.0" },
> 
> Don't you want "ES3.*"?

Indeed (I want "ES3.*"). So, I'll submit v2 patch to fix it.

Best regards,
Yoshihiro Shimoda

> > +       { .soc_id = "r8a77965", },
> > +       { .soc_id = "r8a77990", },
> > +       { .soc_id = "r8a77995", },
> > +       { /* sentinel */ }
> > +};
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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] 14+ messages in thread

* RE: [PATCH 2/2] iommu/ipmmu-vmsa: add an array of slave devices whitelist
@ 2018-11-28  9:08       ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  9:08 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Joerg Roedel, Magnus Damm, Geert Uytterhoeven, Simon Horman,
	Linux IOMMU, Linux-Renesas

Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Wednesday, November 28, 2018 5:48 PM
> 
> Hi Shimoda-san,
> 
> On Wed, Nov 28, 2018 at 7:10 AM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com> wrote:
> > To avoid adding copy and pasted strcmp codes in the future,
> > this patch adds an array "rcar_gen3_slave_whitelist" to check
> > whether the device can work with the IPMMU or not.
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thank you for your review!

> One small comment below.
> 
> > --- a/drivers/iommu/ipmmu-vmsa.c
> > +++ b/drivers/iommu/ipmmu-vmsa.c
> > @@ -773,8 +773,13 @@ static int ipmmu_init_platform_device(struct device *dev,
> >         { /* sentinel */ }
> >  };
> >
> > +static const char * const rcar_gen3_slave_whitelist[] = {
> > +};
> > +
> >  static bool ipmmu_slave_whitelist(struct device *dev)
> >  {
> > +       int i;
> 
> unsigned int

I got it. I'll submit v2 patch.

Best regards,
Yoshihiro Shimoda

> > +
> >         /*
> >          * For R-Car Gen3 use a white list to opt-in slave devices.
> >          * For Other SoCs, this returns true anyway.
> > @@ -786,7 +791,13 @@ static bool ipmmu_slave_whitelist(struct device *dev)
> >         if (!soc_device_match(soc_rcar_gen3_whitelist))
> >                 return false;
> >
> > -       /* By default, do not allow use of IPMMU */
> > +       /* Check whether this slave device can work with the IPMMU */
> > +       for (i = 0; i < ARRAY_SIZE(rcar_gen3_slave_whitelist); i++) {
> > +               if (!strcmp(dev_name(dev), rcar_gen3_slave_whitelist[i]))
> > +                       return true;
> > +       }
> > +
> > +       /* Otherwise, do not allow use of IPMMU */
> >         return false;
> >  }
> 
> 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] 14+ messages in thread

* RE: [PATCH 2/2] iommu/ipmmu-vmsa: add an array of slave devices whitelist
@ 2018-11-28  9:08       ` Yoshihiro Shimoda
  0 siblings, 0 replies; 14+ messages in thread
From: Yoshihiro Shimoda @ 2018-11-28  9:08 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Geert Uytterhoeven, Magnus Damm, Linux-Renesas, Linux IOMMU,
	Simon Horman

Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Wednesday, November 28, 2018 5:48 PM
> 
> Hi Shimoda-san,
> 
> On Wed, Nov 28, 2018 at 7:10 AM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> wrote:
> > To avoid adding copy and pasted strcmp codes in the future,
> > this patch adds an array "rcar_gen3_slave_whitelist" to check
> > whether the device can work with the IPMMU or not.
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>

Thank you for your review!

> One small comment below.
> 
> > --- a/drivers/iommu/ipmmu-vmsa.c
> > +++ b/drivers/iommu/ipmmu-vmsa.c
> > @@ -773,8 +773,13 @@ static int ipmmu_init_platform_device(struct device *dev,
> >         { /* sentinel */ }
> >  };
> >
> > +static const char * const rcar_gen3_slave_whitelist[] = {
> > +};
> > +
> >  static bool ipmmu_slave_whitelist(struct device *dev)
> >  {
> > +       int i;
> 
> unsigned int

I got it. I'll submit v2 patch.

Best regards,
Yoshihiro Shimoda

> > +
> >         /*
> >          * For R-Car Gen3 use a white list to opt-in slave devices.
> >          * For Other SoCs, this returns true anyway.
> > @@ -786,7 +791,13 @@ static bool ipmmu_slave_whitelist(struct device *dev)
> >         if (!soc_device_match(soc_rcar_gen3_whitelist))
> >                 return false;
> >
> > -       /* By default, do not allow use of IPMMU */
> > +       /* Check whether this slave device can work with the IPMMU */
> > +       for (i = 0; i < ARRAY_SIZE(rcar_gen3_slave_whitelist); i++) {
> > +               if (!strcmp(dev_name(dev), rcar_gen3_slave_whitelist[i]))
> > +                       return true;
> > +       }
> > +
> > +       /* Otherwise, do not allow use of IPMMU */
> >         return false;
> >  }
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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] 14+ messages in thread

end of thread, other threads:[~2018-11-28 20:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28  6:10 [PATCH 0/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() Yoshihiro Shimoda
2018-11-28  6:10 ` Yoshihiro Shimoda
2018-11-28  6:10 ` [PATCH 1/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions Yoshihiro Shimoda
2018-11-28  6:10   ` Yoshihiro Shimoda
2018-11-28  8:46   ` Geert Uytterhoeven
2018-11-28  8:46     ` Geert Uytterhoeven
2018-11-28  9:04     ` Yoshihiro Shimoda
2018-11-28  9:04       ` Yoshihiro Shimoda
2018-11-28  6:10 ` [PATCH 2/2] iommu/ipmmu-vmsa: add an array of slave devices whitelist Yoshihiro Shimoda
2018-11-28  6:10   ` Yoshihiro Shimoda
2018-11-28  8:47   ` Geert Uytterhoeven
2018-11-28  8:47     ` Geert Uytterhoeven
2018-11-28  9:08     ` Yoshihiro Shimoda
2018-11-28  9:08       ` Yoshihiro Shimoda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.