* [PATCH/RFC V2] iommu/ipmmu-vmsa: Disable IPMMU when address expansion is not needed
@ 2019-03-19 13:25 Magnus Damm
2019-03-19 13:34 ` Geert Uytterhoeven
0 siblings, 1 reply; 3+ messages in thread
From: Magnus Damm @ 2019-03-19 13:25 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: Magnus Damm
From: Magnus Damm <damm+renesas@opensource.se>
Add a memory bank location check to the whitelist handling.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---
Changes since V1:
- None, simply broke out this patch from the rest of the series
drivers/iommu/ipmmu-vmsa.c | 7 +++++++
1 file changed, 7 insertions(+)
--- 0001/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c 2019-03-19 21:04:43.000000000 +0900
@@ -17,6 +17,7 @@
#include <linux/io.h>
#include <linux/io-pgtable.h>
#include <linux/iommu.h>
+#include <linux/memblock.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_iommu.h>
@@ -797,6 +798,12 @@ static bool ipmmu_slave_whitelist(struct
if (!soc_device_match(soc_rcar_gen3_whitelist))
return false;
+ /* In case all system memory fits within 32 bits of physical space
+ * then assume the IPMMU will not be needed for address expansion.
+ */
+ if (memblock_end_of_DRAM() <= SZ_4G)
+ return false;
+
/* 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]))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH/RFC V2] iommu/ipmmu-vmsa: Disable IPMMU when address expansion is not needed
2019-03-19 13:25 [PATCH/RFC V2] iommu/ipmmu-vmsa: Disable IPMMU when address expansion is not needed Magnus Damm
@ 2019-03-19 13:34 ` Geert Uytterhoeven
2019-03-19 13:47 ` Magnus Damm
0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2019-03-19 13:34 UTC (permalink / raw)
To: Magnus Damm; +Cc: Linux-Renesas
Hi Magnus,
On Tue, Mar 19, 2019 at 2:24 PM Magnus Damm <magnus.damm@gmail.com> wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> Add a memory bank location check to the whitelist handling.
>
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Thanks for your patch!
> --- 0001/drivers/iommu/ipmmu-vmsa.c
> +++ work/drivers/iommu/ipmmu-vmsa.c 2019-03-19 21:04:43.000000000 +0900
> @@ -17,6 +17,7 @@
> #include <linux/io.h>
> #include <linux/io-pgtable.h>
> #include <linux/iommu.h>
> +#include <linux/memblock.h>
> #include <linux/of.h>
> #include <linux/of_device.h>
> #include <linux/of_iommu.h>
> @@ -797,6 +798,12 @@ static bool ipmmu_slave_whitelist(struct
> if (!soc_device_match(soc_rcar_gen3_whitelist))
> return false;
>
> + /* In case all system memory fits within 32 bits of physical space
> + * then assume the IPMMU will not be needed for address expansion.
> + */
> + if (memblock_end_of_DRAM() <= SZ_4G)
> + return false;
The IPMMU may still be useful for IO virtualization, with KVM+VFIO.
Perhaps the check can be enhanced to keep it enabled when the CPU cores
are running in HYP mode?
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] 3+ messages in thread
* Re: [PATCH/RFC V2] iommu/ipmmu-vmsa: Disable IPMMU when address expansion is not needed
2019-03-19 13:34 ` Geert Uytterhoeven
@ 2019-03-19 13:47 ` Magnus Damm
0 siblings, 0 replies; 3+ messages in thread
From: Magnus Damm @ 2019-03-19 13:47 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Linux-Renesas
Hi Geert,
On Tue, Mar 19, 2019 at 10:34 PM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> Hi Magnus,
>
> On Tue, Mar 19, 2019 at 2:24 PM Magnus Damm <magnus.damm@gmail.com> wrote:
> > From: Magnus Damm <damm+renesas@opensource.se>
> >
> > Add a memory bank location check to the whitelist handling.
> >
> > Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
>
> Thanks for your patch!
>
> > --- 0001/drivers/iommu/ipmmu-vmsa.c
> > +++ work/drivers/iommu/ipmmu-vmsa.c 2019-03-19 21:04:43.000000000 +0900
> > @@ -17,6 +17,7 @@
> > #include <linux/io.h>
> > #include <linux/io-pgtable.h>
> > #include <linux/iommu.h>
> > +#include <linux/memblock.h>
> > #include <linux/of.h>
> > #include <linux/of_device.h>
> > #include <linux/of_iommu.h>
> > @@ -797,6 +798,12 @@ static bool ipmmu_slave_whitelist(struct
> > if (!soc_device_match(soc_rcar_gen3_whitelist))
> > return false;
> >
> > + /* In case all system memory fits within 32 bits of physical space
> > + * then assume the IPMMU will not be needed for address expansion.
> > + */
> > + if (memblock_end_of_DRAM() <= SZ_4G)
> > + return false;
>
> The IPMMU may still be useful for IO virtualization, with KVM+VFIO.
You're right.
> Perhaps the check can be enhanced to keep it enabled when the CPU cores
> are running in HYP mode?
That might indeed be useful.
Next quarter perhaps you and I can discuss a bit about IO
virtualization with KVM?
Cheers,
/ magnus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-19 13:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 13:25 [PATCH/RFC V2] iommu/ipmmu-vmsa: Disable IPMMU when address expansion is not needed Magnus Damm
2019-03-19 13:34 ` Geert Uytterhoeven
2019-03-19 13:47 ` 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).