diff mbox

[PATCH/WIP/RFC,02/14] shmobile-iommu: Move IPMMU driver to drivers/iommu

Message ID 1355678760-27357-3-git-send-email-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart Dec. 16, 2012, 5:25 p.m. UTC
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 arch/arm/mach-shmobile/Kconfig                     |    6 ------
 arch/arm/mach-shmobile/Makefile                    |    3 ---
 drivers/iommu/Kconfig                              |    6 ++++++
 drivers/iommu/Makefile                             |    1 +
 .../ipmmu.c => drivers/iommu/shmobile-ipmmu.c      |    0
 5 files changed, 7 insertions(+), 9 deletions(-)
 rename arch/arm/mach-shmobile/ipmmu.c => drivers/iommu/shmobile-ipmmu.c (100%)

diff --git a/arch/arm/mach-shmobile/ipmmu.c b/drivers/iommu/shmobile-ipmmu.c
similarity index 100%
rename from arch/arm/mach-shmobile/ipmmu.c
rename to drivers/iommu/shmobile-ipmmu.c

Comments

Damian Hobson-Garcia Dec. 17, 2012, 3:10 a.m. UTC | #1
Hi Laurent,

On 2012/12/17 2:25, Laurent Pinchart wrote:
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  arch/arm/mach-shmobile/Kconfig                     |    6 ------
>  arch/arm/mach-shmobile/Makefile                    |    3 ---
>  drivers/iommu/Kconfig                              |    6 ++++++
>  drivers/iommu/Makefile                             |    1 +
>  .../ipmmu.c => drivers/iommu/shmobile-ipmmu.c      |    0
>  5 files changed, 7 insertions(+), 9 deletions(-)
>  rename arch/arm/mach-shmobile/ipmmu.c => drivers/iommu/shmobile-ipmmu.c (100%)

I agree that arch/arm is not a good place, but I'm not completely sure
that ipmmu.c belongs in drivers/iommu.  The reason is because of the PMB
functionality provided by the IPMMU.  The PMB provides a fixed address
remapping capability that is completely unrelated to the IOMMU
functionality.  Since this remapping is done by writing the IPMMU
registers directly, instead of via a page table it doesn't really fit in
well with the IOMMU API (it also supports things like tiled/linear
address translation, which require some other method to set up).  Since
the PMB and the IOMMU functions of the IPPMU share the same register
address space, we would like to have one driver to handle the register
accesses of both of these functions.  That driver is ipmmu.c.  So if
ipmmu.c is in drivers/iommu, the entire IOMMU subsystem must be enabled
in order to use the PMB functionality.
So maybe it might be better to treat the IPMMU like a multifuction
device, with a core driver (ipmmu.c) in one location and the function
implementations in their own respective directories. Does drivers/mfd
sound like a good place for it?

Thanks,
Damian.

 --
Damian Hobson-Garcia
IGEL Co.,Ltd
http://www.igel.co.jp
Laurent Pinchart Dec. 17, 2012, 8:45 a.m. UTC | #2
Hi Damian,

(CC'ing iommu@lists.linux-foundation.org)

On Monday 17 December 2012 12:10:28 Damian Hobson-Garcia wrote:
> On 2012/12/17 2:25, Laurent Pinchart wrote:
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  arch/arm/mach-shmobile/Kconfig                     |    6 ------
> >  arch/arm/mach-shmobile/Makefile                    |    3 ---
> >  drivers/iommu/Kconfig                              |    6 ++++++
> >  drivers/iommu/Makefile                             |    1 +
> >  .../ipmmu.c => drivers/iommu/shmobile-ipmmu.c      |    0
> >  5 files changed, 7 insertions(+), 9 deletions(-)
> >  rename arch/arm/mach-shmobile/ipmmu.c => drivers/iommu/shmobile-ipmmu.c
> >  (100%)
>
> I agree that arch/arm is not a good place, but I'm not completely sure that
> ipmmu.c belongs in drivers/iommu.  The reason is because of the PMB
> functionality provided by the IPMMU.  The PMB provides a fixed address
> remapping capability that is completely unrelated to the IOMMU
> functionality.  Since this remapping is done by writing the IPMMU registers
> directly, instead of via a page table it doesn't really fit in well with the
> IOMMU API (it also supports things like tiled/linear address translation,
> which require some other method to set up).  Since the PMB and the IOMMU
> functions of the IPPMU share the same register address space, we would like
> to have one driver to handle the register accesses of both of these
> functions.  That driver is ipmmu.c.  So if ipmmu.c is in drivers/iommu, the
> entire IOMMU subsystem must be enabled in order to use the PMB
> functionality. So maybe it might be better to treat the IPMMU like a
> multifuction device, with a core driver (ipmmu.c) in one location and the
> function implementations in their own respective directories. Does
> drivers/mfd sound like a good place for it?

I've thought about this as well. The IPMMU indeed provides two different 
functions, so drivers/mfd/ could be a candidate. This being said, both the 
IOMMU function and the PMB function are related to virtual memory space 
management, so they're not totally unrelated. I agree that the PMB function 
isn't really an IOMMU in the sense that it will likely not be exposed through 
the existing IOMMU API.

However, drivers/iommu/ seems to me like a more natural place to store the 
IPMMU driver compared to drivers/mfd/. Enabling IOMMU support 
(CONFIG_IOMMU_SUPPORT) doesn't mean the IOMMU core (CONFIG_IOMMU_API) will be 
compiled in. There would thus be no extra code compiled in if the IOMMU 
function of the IPMMU is disabled.
diff mbox

Patch

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index de69ab3..8ae100c 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -210,12 +210,6 @@  endmenu
 config SH_CLK_CPG
 	bool
 
-config SHMOBILE_IPMMU
-	bool
-
-config SHMOBILE_IPMMU_TLB
-	bool
-
 source "drivers/sh/Kconfig"
 
 endif
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 4ffba9d..fe2c97c 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -60,6 +60,3 @@  obj-$(CONFIG_MACH_KZM9G)	+= board-kzm9g.o
 # Framework support
 obj-$(CONFIG_SMP)		+= $(smp-y)
 obj-$(CONFIG_GENERIC_GPIO)	+= $(pfc-y)
-
-# IPMMU/IPMMUI
-obj-$(CONFIG_SHMOBILE_IPMMU)	+= ipmmu.o
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 265829f..cb2a3e8 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -187,6 +187,12 @@  config EXYNOS_IOMMU_DEBUG
 
 	  Say N unless you need kernel log message for IOMMU debugging
 
+config SHMOBILE_IPMMU
+	bool
+
+config SHMOBILE_IPMMU_TLB
+	bool
+
 config SHMOBILE_IOMMU
 	bool "IOMMU for Renesas IPMMU/IPMMUI"
 	default n
diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile
index 62cf917..e65384f 100644
--- a/drivers/iommu/Makefile
+++ b/drivers/iommu/Makefile
@@ -13,3 +13,4 @@  obj-$(CONFIG_TEGRA_IOMMU_GART) += tegra-gart.o
 obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o
 obj-$(CONFIG_EXYNOS_IOMMU) += exynos-iommu.o
 obj-$(CONFIG_SHMOBILE_IOMMU) += shmobile-iommu.o
+obj-$(CONFIG_SHMOBILE_IPMMU) += shmobile-ipmmu.o