diff mbox

[5/6] ARM: OMAP2+: Make some definitions local

Message ID 20121018202848.11834.17893.stgit@muffinssi.local (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren Oct. 18, 2012, 8:28 p.m. UTC
From: Ido Yariv <ido@wizery.com>

Move some of the definitions in omap-iommu.h that can be made local to
either drivers/iommu.

Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Signed-off-by: Ido Yariv <ido@wizery.com>
[tony@atomide.com: updated for header changes in the series]
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/iommu/omap-iommu.c  |   15 +++++++++++++++
 drivers/iommu/omap-iommu.h  |   33 +++------------------------------
 drivers/iommu/omap-iommu2.c |    6 ++++++
 3 files changed, 24 insertions(+), 30 deletions(-)

Comments

Laurent Pinchart Oct. 19, 2012, 9:44 a.m. UTC | #1
Hi Tony,

On Thursday 18 October 2012 13:28:48 Tony Lindgren wrote:
> From: Ido Yariv <ido@wizery.com>
> 
> Move some of the definitions in omap-iommu.h that can be made local to
> either drivers/iommu.
> 
> Cc: Joerg Roedel <joerg.roedel@amd.com>
> Cc: Ohad Ben-Cohen <ohad@wizery.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> Cc: Omar Ramirez Luna <omar.luna@linaro.org>
> Signed-off-by: Ido Yariv <ido@wizery.com>
> [tony@atomide.com: updated for header changes in the series]
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/iommu/omap-iommu.c  |   15 +++++++++++++++
>  drivers/iommu/omap-iommu.h  |   33 +++------------------------------
>  drivers/iommu/omap-iommu2.c |    6 ++++++
>  3 files changed, 24 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
> index 4db86e1..df84087 100644
> --- a/drivers/iommu/omap-iommu.c
> +++ b/drivers/iommu/omap-iommu.c
> @@ -54,6 +54,21 @@ struct omap_iommu_domain {
>  	spinlock_t lock;
>  };
> 
> +#define MMU_LOCK_BASE_SHIFT	10
> +#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
> +#define MMU_LOCK_BASE(x)	\
> +	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
> +
> +#define MMU_LOCK_VICT_SHIFT	4
> +#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
> +#define MMU_LOCK_VICT(x)	\
> +	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
> +
> +struct iotlb_lock {
> +	short base;
> +	short vict;
> +};
> +
>  /* accommodate the difference between omap1 and omap2/3 */
>  static const struct iommu_functions *arch_iommu;
> 
> diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h
> index 8c3378d..2b5f3c0 100644
> --- a/drivers/iommu/omap-iommu.h
> +++ b/drivers/iommu/omap-iommu.h
> @@ -72,11 +72,6 @@ struct cr_regs {
>  	};
>  };
> 
> -struct iotlb_lock {
> -	short base;
> -	short vict;
> -};
> -
>  /* architecture specific functions */
>  struct iommu_functions {
>  	unsigned long	version;
> @@ -117,13 +112,6 @@ static inline struct omap_iommu
> *dev_to_omap_iommu(struct device *dev) }
>  #endif
> 
> -/* IOMMU errors */
> -#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
> -#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
> -#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
> -#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
> -#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
> -

I'll use those in the tidspbridge driver, in patches that I plan to push soon.

I will apply this patch set on top of mine, see what breaks. Would you like me 
to propose a modified version of this set, or add additional patches in my set 
?

>  /*
>   * MMU Register offsets
>   */
> @@ -151,16 +139,6 @@ static inline struct omap_iommu
> *dev_to_omap_iommu(struct device *dev) /*
>   * MMU Register bit definitions
>   */
> -#define MMU_LOCK_BASE_SHIFT	10
> -#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
> -#define MMU_LOCK_BASE(x)	\
> -	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
> -
> -#define MMU_LOCK_VICT_SHIFT	4
> -#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
> -#define MMU_LOCK_VICT(x)	\
> -	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
> -
>  #define MMU_CAM_VATAG_SHIFT	12
>  #define MMU_CAM_VATAG_MASK \
>  	((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
> @@ -222,20 +200,15 @@ extern void omap_iotlb_cr_to_e(struct cr_regs *cr,
> struct iotlb_entry *e); extern int
>  omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e);
> 
> -extern int omap_iommu_set_isr(const char *name,
> -		 int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs,
> -				    void *priv),
> -			 void *isr_priv);
> -
>  extern void omap_iommu_save_ctx(struct device *dev);
>  extern void omap_iommu_restore_ctx(struct device *dev);
> 
> -extern int omap_install_iommu_arch(const struct iommu_functions *ops);
> -extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
> -
>  extern int omap_foreach_iommu_device(void *data,
>  				int (*fn)(struct device *, void *));
> 
> +extern int omap_install_iommu_arch(const struct iommu_functions *ops);
> +extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
> +
>  extern ssize_t
>  omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
>  extern size_t
> diff --git a/drivers/iommu/omap-iommu2.c b/drivers/iommu/omap-iommu2.c
> index 066e6b2..4d8d91d 100644
> --- a/drivers/iommu/omap-iommu2.c
> +++ b/drivers/iommu/omap-iommu2.c
> @@ -68,6 +68,12 @@
>  	 ((pgsz) == MMU_CAM_PGSZ_64K) ? 0xffff0000 :	\
>  	 ((pgsz) == MMU_CAM_PGSZ_4K)  ? 0xfffff000 : 0)
> 
> +/* IOMMU errors */
> +#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
> +#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
> +#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
> +#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
> +#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
> 
>  static void __iommu_set_twl(struct omap_iommu *obj, bool on)
>  {
Tony Lindgren Oct. 19, 2012, 4:17 p.m. UTC | #2
* Laurent Pinchart <laurent.pinchart@ideasonboard.com> [121019 02:45]:
> On Thursday 18 October 2012 13:28:48 Tony Lindgren wrote:
> > @@ -117,13 +112,6 @@ static inline struct omap_iommu
> > *dev_to_omap_iommu(struct device *dev) }
> >  #endif
> > 
> > -/* IOMMU errors */
> > -#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
> > -#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
> > -#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
> > -#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
> > -#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
> > -
> 
> I'll use those in the tidspbridge driver, in patches that I plan to push soon.
> 
> I will apply this patch set on top of mine, see what breaks. Would you like me 
> to propose a modified version of this set, or add additional patches in my set 
> ?

Sure, let's try to expose only the minimal amount of omap
iommu things with this patch set so we don't break things.
Then the iommu development can continue on it's own independent
of the core omap code except for the platform data.

But again, if there are nasty layering violations using this
code, I would just remove those features. Those things tend to
just get worse unless they are fixed properly to start with.

Regards,

Tony
Laurent Pinchart Oct. 24, 2012, 11:26 p.m. UTC | #3
Ho Tony,

On Friday 19 October 2012 09:17:43 Tony Lindgren wrote:
> * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [121019 02:45]:
> > On Thursday 18 October 2012 13:28:48 Tony Lindgren wrote:
> > > @@ -117,13 +112,6 @@ static inline struct omap_iommu
> > > *dev_to_omap_iommu(struct device *dev) }
> > > 
> > >  #endif
> > > 
> > > -/* IOMMU errors */
> > > -#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
> > > -#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
> > > -#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
> > > -#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
> > > -#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
> > > -
> > 
> > I'll use those in the tidspbridge driver, in patches that I plan to push
> > soon.
> > 
> > I will apply this patch set on top of mine, see what breaks. Would you
> > like me to propose a modified version of this set, or add additional
> > patches in my set ?
> 
> Sure, let's try to expose only the minimal amount of omap iommu things with
> this patch set so we don't break things. Then the iommu development can
> continue on it's own independent of the core omap code except for the
> platform data.

I'll rebase my DSP patches on top of this patch set then, it will be easier.

> But again, if there are nasty layering violations using this code, I would
> just remove those features. Those things tend to just get worse unless they
> are fixed properly to start with.

The long-term goal is to move the tidspbridge driver to the IOMMU API, but 
we'll need a step by step approach.
Tony Lindgren Oct. 24, 2012, 11:33 p.m. UTC | #4
* Laurent Pinchart <laurent.pinchart@ideasonboard.com> [121024 16:26]:
> Ho Tony,
> 
> On Friday 19 October 2012 09:17:43 Tony Lindgren wrote:
> > * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [121019 02:45]:
> > > On Thursday 18 October 2012 13:28:48 Tony Lindgren wrote:
> > > > @@ -117,13 +112,6 @@ static inline struct omap_iommu
> > > > *dev_to_omap_iommu(struct device *dev) }
> > > > 
> > > >  #endif
> > > > 
> > > > -/* IOMMU errors */
> > > > -#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
> > > > -#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
> > > > -#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
> > > > -#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
> > > > -#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
> > > > -
> > > 
> > > I'll use those in the tidspbridge driver, in patches that I plan to push
> > > soon.
> > > 
> > > I will apply this patch set on top of mine, see what breaks. Would you
> > > like me to propose a modified version of this set, or add additional
> > > patches in my set ?
> > 
> > Sure, let's try to expose only the minimal amount of omap iommu things with
> > this patch set so we don't break things. Then the iommu development can
> > continue on it's own independent of the core omap code except for the
> > platform data.
> 
> I'll rebase my DSP patches on top of this patch set then, it will be easier.

OK sounds good to me.

Once we have the minimal changes acked by you and Joerg, I'll push
it into an immutable branch that we all can merge in as needed.

BTW, after updating patch 3/6 I noticed patches 4 - 6 had trivial merge
conflicts with the includes, so let me know if you want met to repost the
whole set.
 
> > But again, if there are nasty layering violations using this code, I would
> > just remove those features. Those things tend to just get worse unless they
> > are fixed properly to start with.
> 
> The long-term goal is to move the tidspbridge driver to the IOMMU API, but 
> we'll need a step by step approach.

Yes agreed.

Regards,

Tony
Laurent Pinchart Oct. 24, 2012, 11:37 p.m. UTC | #5
Hi Tony,

On Wednesday 24 October 2012 16:33:18 Tony Lindgren wrote:
> * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [121024 16:26]:
> > On Friday 19 October 2012 09:17:43 Tony Lindgren wrote:
> > > * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [121019 02:45]:
> > > > On Thursday 18 October 2012 13:28:48 Tony Lindgren wrote:
> > > > > @@ -117,13 +112,6 @@ static inline struct omap_iommu
> > > > > *dev_to_omap_iommu(struct device *dev) }
> > > > > 
> > > > >  #endif
> > > > > 
> > > > > -/* IOMMU errors */
> > > > > -#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
> > > > > -#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
> > > > > -#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
> > > > > -#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
> > > > > -#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
> > > > > -
> > > > 
> > > > I'll use those in the tidspbridge driver, in patches that I plan to
> > > > push soon.
> > > > 
> > > > I will apply this patch set on top of mine, see what breaks. Would you
> > > > like me to propose a modified version of this set, or add additional
> > > > patches in my set ?
> > > 
> > > Sure, let's try to expose only the minimal amount of omap iommu things
> > > with this patch set so we don't break things. Then the iommu development
> > > can continue on it's own independent of the core omap code except for
> > > the platform data.
> > 
> > I'll rebase my DSP patches on top of this patch set then, it will be
> > easier.
>
> OK sounds good to me.
> 
> Once we have the minimal changes acked by you and Joerg, I'll push
> it into an immutable branch that we all can merge in as needed.
> 
> BTW, after updating patch 3/6 I noticed patches 4 - 6 had trivial merge
> conflicts with the includes, so let me know if you want met to repost the
> whole set.

Please do. I'll then ack it (provided I have no more comments to make of 
course :-)).
 
> > > But again, if there are nasty layering violations using this code, I
> > > would just remove those features. Those things tend to just get worse
> > > unless they are fixed properly to start with.
> > 
> > The long-term goal is to move the tidspbridge driver to the IOMMU API, but
> > we'll need a step by step approach.
> 
> Yes agreed.
Tony Lindgren Oct. 25, 2012, 12:24 a.m. UTC | #6
* Laurent Pinchart <laurent.pinchart@ideasonboard.com> [121024 16:38]:
> On Wednesday 24 October 2012 16:33:18 Tony Lindgren wrote:
> > 
> > BTW, after updating patch 3/6 I noticed patches 4 - 6 had trivial merge
> > conflicts with the includes, so let me know if you want met to repost the
> > whole set.
> 
> Please do. I'll then ack it (provided I have no more comments to make of 
> course :-)).

Posted now as "[PATCH v4 0/6] omap iommu changes to remove plat includes".
Also noticed one more sorting issue in the isp files that's fixed now.

Regards,

Tony
diff mbox

Patch

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 4db86e1..df84087 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -54,6 +54,21 @@  struct omap_iommu_domain {
 	spinlock_t lock;
 };
 
+#define MMU_LOCK_BASE_SHIFT	10
+#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
+#define MMU_LOCK_BASE(x)	\
+	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
+
+#define MMU_LOCK_VICT_SHIFT	4
+#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
+#define MMU_LOCK_VICT(x)	\
+	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
+
+struct iotlb_lock {
+	short base;
+	short vict;
+};
+
 /* accommodate the difference between omap1 and omap2/3 */
 static const struct iommu_functions *arch_iommu;
 
diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h
index 8c3378d..2b5f3c0 100644
--- a/drivers/iommu/omap-iommu.h
+++ b/drivers/iommu/omap-iommu.h
@@ -72,11 +72,6 @@  struct cr_regs {
 	};
 };
 
-struct iotlb_lock {
-	short base;
-	short vict;
-};
-
 /* architecture specific functions */
 struct iommu_functions {
 	unsigned long	version;
@@ -117,13 +112,6 @@  static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
 }
 #endif
 
-/* IOMMU errors */
-#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
-#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
-#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
-#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
-#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
-
 /*
  * MMU Register offsets
  */
@@ -151,16 +139,6 @@  static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
 /*
  * MMU Register bit definitions
  */
-#define MMU_LOCK_BASE_SHIFT	10
-#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
-#define MMU_LOCK_BASE(x)	\
-	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
-
-#define MMU_LOCK_VICT_SHIFT	4
-#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
-#define MMU_LOCK_VICT(x)	\
-	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
-
 #define MMU_CAM_VATAG_SHIFT	12
 #define MMU_CAM_VATAG_MASK \
 	((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
@@ -222,20 +200,15 @@  extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e);
 extern int
 omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e);
 
-extern int omap_iommu_set_isr(const char *name,
-		 int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs,
-				    void *priv),
-			 void *isr_priv);
-
 extern void omap_iommu_save_ctx(struct device *dev);
 extern void omap_iommu_restore_ctx(struct device *dev);
 
-extern int omap_install_iommu_arch(const struct iommu_functions *ops);
-extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
-
 extern int omap_foreach_iommu_device(void *data,
 				int (*fn)(struct device *, void *));
 
+extern int omap_install_iommu_arch(const struct iommu_functions *ops);
+extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
+
 extern ssize_t
 omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
 extern size_t
diff --git a/drivers/iommu/omap-iommu2.c b/drivers/iommu/omap-iommu2.c
index 066e6b2..4d8d91d 100644
--- a/drivers/iommu/omap-iommu2.c
+++ b/drivers/iommu/omap-iommu2.c
@@ -68,6 +68,12 @@ 
 	 ((pgsz) == MMU_CAM_PGSZ_64K) ? 0xffff0000 :	\
 	 ((pgsz) == MMU_CAM_PGSZ_4K)  ? 0xfffff000 : 0)
 
+/* IOMMU errors */
+#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
+#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
+#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
+#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
+#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
 
 static void __iommu_set_twl(struct omap_iommu *obj, bool on)
 {