RE: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support

2010-04-26 Thread Kanigeri, Hari
Hi Hiroshi,


 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com]
 Sent: Saturday, April 24, 2010 1:45 AM
 To: Kanigeri, Hari
 Cc: Gupta, Ramesh; linux-omap@vger.kernel.org
 Subject: Re: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support
 
 From: ext Kanigeri, Hari h-kanige...@ti.com
 Subject: RE: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support
 Date: Sat, 24 Apr 2010 01:43:19 +0200
 
  Hi Hiroshi,
 
 
  diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
  index 1e83fac..d09a0a1 100644
  --- a/arch/arm/plat-omap/iommu.c
  +++ b/arch/arm/plat-omap/iommu.c
  @@ -25,6 +25,9 @@
 
   #include iopgtable.h
 
  +#define for_each_iotlb_cr(obj, n, i, cr)  \
  +  for (i = 0; (i  n)  (cr = get_iotlb_cr(obj, i)); i++)
  +
  -- This code is giving compilation error.
 
 Should be like:
 
 +#define for_each_iotlb_cr(obj, n, __i, cr)   \
 + for (__i = 0;   \
 +  (__i  (n))  (cr = __iotlb_read_cr((obj), __i), true);   \
 +  __i++)
 +

-- The change looks good to me.

Thank you,
Best regards,
Hari
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support

2010-04-24 Thread Hiroshi DOYU
From: ext Kanigeri, Hari h-kanige...@ti.com
Subject: RE: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support
Date: Sat, 24 Apr 2010 01:43:19 +0200

 Hi Hiroshi,
 
 
 diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
 index 1e83fac..d09a0a1 100644
 --- a/arch/arm/plat-omap/iommu.c
 +++ b/arch/arm/plat-omap/iommu.c
 @@ -25,6 +25,9 @@
 
  #include iopgtable.h
 
 +#define for_each_iotlb_cr(obj, n, i, cr)\
 +for (i = 0; (i  n)  (cr = get_iotlb_cr(obj, i)); i++)
 +
 -- This code is giving compilation error. 

Should be like:

+#define for_each_iotlb_cr(obj, n, __i, cr) \
+   for (__i = 0;   \
+(__i  (n))  (cr = __iotlb_read_cr((obj), __i), true);   \
+__i++)
+
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support

2010-04-23 Thread Hiroshi DOYU
Hi Hari,

From: ext Hari Kanigeri h-kanige...@ti.com
Subject: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support
Date: Fri, 23 Apr 2010 01:16:36 +0200

 This patch adds TLB preservation support to IOMMU module
 
 Signed-off-by: Hari Kanigeri h-kanige...@ti.com
 Signed-off-by: Hiroshi Doyu hiroshi.d...@nokia.com

The above should be Acked-by:?

BTW:
Now the code gets a bit complicated for tlb iteration. So what about
introducing the following macro?

Not yet tested, though

From a88de5ab41792b5a34c460741b8f75f1611327b9 Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Fri, 23 Apr 2010 15:18:46 +0300
Subject: [PATCH 1/1] omap iommu: introduce iteration macro for iotlb entries 
scan

There are some places to scan iotlb entries. This iteration macro
could make these code a bit simpler.

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/iommu.c |   55 ++-
 1 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index 1e83fac..d09a0a1 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -25,6 +25,9 @@
 
 #include iopgtable.h
 
+#define for_each_iotlb_cr(obj, n, i, cr)   \
+   for (i = 0; (i  n)  (cr = get_iotlb_cr(obj, i)); i++)
+
 /* accommodate the difference between omap1 and omap2/3 */
 static const struct iommu_functions *arch_iommu;
 
@@ -211,6 +214,19 @@ static inline ssize_t iotlb_dump_cr(struct iommu *obj, 
struct cr_regs *cr,
return arch_iommu-dump_cr(obj, cr, buf);
 }
 
+static struct cr_regs get_iotlb_cr(struct iommu *obj, int n)
+{
+   struct cr_regs cr;
+   struct iotlb_lock l;
+
+   iotlb_lock_get(obj, l);
+   l.vict = n;
+   iotlb_lock_set(obj, l);
+   iotlb_read_cr(obj, cr);
+
+   return cr;
+}
+
 /**
  * load_iotlb_entry - Set an iommu tlb entry
  * @obj:   target iommu
@@ -218,7 +234,6 @@ static inline ssize_t iotlb_dump_cr(struct iommu *obj, 
struct cr_regs *cr,
  **/
 int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e)
 {
-   int i;
int err = 0;
struct iotlb_lock l;
struct cr_regs *cr;
@@ -235,21 +250,20 @@ int load_iotlb_entry(struct iommu *obj, struct 
iotlb_entry *e)
goto out;
}
if (!e-prsvd) {
-   for (i = l.base; i  obj-nr_tlb_entries; i++) {
-   struct cr_regs tmp;
+   int i;
+   struct cr_regs tmp;
 
-   iotlb_lock_get(obj, l);
-   l.vict = i;
-   iotlb_lock_set(obj, l);
-   iotlb_read_cr(obj, tmp);
+   for_each_iotlb_cr(obj, obj-nr_tlb_entries, i, tmp)
if (!iotlb_cr_valid(tmp))
break;
-   }
+
if (i == obj-nr_tlb_entries) {
dev_dbg(obj-dev, %s: full: no entry\n, __func__);
err = -EBUSY;
goto out;
}
+
+   iotlb_lock_get(obj, l);
} else {
l.vict = l.base;
iotlb_lock_set(obj, l);
@@ -285,20 +299,15 @@ EXPORT_SYMBOL_GPL(load_iotlb_entry);
  **/
 void flush_iotlb_page(struct iommu *obj, u32 da)
 {
-   struct iotlb_lock l;
int i;
+   struct cr_regs cr;
 
clk_enable(obj-clk);
 
-   for (i = 0; i  obj-nr_tlb_entries; i++) {
-   struct cr_regs cr;
+   for_each_iotlb_cr(obj, obj-nr_tlb_entries, i, cr) {
u32 start;
size_t bytes;
 
-   iotlb_lock_get(obj, l);
-   l.vict = i;
-   iotlb_lock_set(obj, l);
-   iotlb_read_cr(obj, cr);
if (!iotlb_cr_valid(cr))
continue;
 
@@ -308,7 +317,6 @@ void flush_iotlb_page(struct iommu *obj, u32 da)
if ((start = da)  (da  start + bytes)) {
dev_dbg(obj-dev, %s: %08x=%08x(%x)\n,
__func__, start, da, bytes);
-   iotlb_load_cr(obj, cr);
iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY);
}
}
@@ -379,26 +387,19 @@ EXPORT_SYMBOL_GPL(iommu_dump_ctx);
 static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs, int num)
 {
int i;
-   struct iotlb_lock saved, l;
+   struct iotlb_lock saved;
+   struct cr_regs tmp;
struct cr_regs *p = crs;
 
clk_enable(obj-clk);
-
iotlb_lock_get(obj, saved);
-   memcpy(l, saved, sizeof(saved));
 
-   for (i = 0; i  num; i++) {
-   struct cr_regs tmp;
-
-   iotlb_lock_get(obj, l);
-   l.vict = i;
-   iotlb_lock_set(obj, l);
-   iotlb_read_cr(obj, tmp);
+   for_each_iotlb_cr(obj, num, i, tmp) {
if (!iotlb_cr_valid(tmp))
 

RE: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support

2010-04-23 Thread Kanigeri, Hari
Hi Hiroshi,

 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com]
 Sent: Friday, April 23, 2010 7:34 AM
 To: Kanigeri, Hari
 Cc: Gupta, Ramesh; linux-omap@vger.kernel.org
 Subject: Re: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support
 
 Hi Hari,
 
 From: ext Hari Kanigeri h-kanige...@ti.com
 Subject: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support
 Date: Fri, 23 Apr 2010 01:16:36 +0200
 
  This patch adds TLB preservation support to IOMMU module
 
  Signed-off-by: Hari Kanigeri h-kanige...@ti.com
  Signed-off-by: Hiroshi Doyu hiroshi.d...@nokia.com
 
 The above should be Acked-by:?

-- By you :)

 
 BTW:
 Now the code gets a bit complicated for tlb iteration. So what about
 introducing the following macro?
 
 Not yet tested, though

-- I like it. Let me test your changes, and will send a revised patch with 
these changes.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 4/4][v4] OMAP:iommu- add TLB preservation support

2010-04-23 Thread Kanigeri, Hari
Hi Hiroshi,

 
 diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
 index 1e83fac..d09a0a1 100644
 --- a/arch/arm/plat-omap/iommu.c
 +++ b/arch/arm/plat-omap/iommu.c
 @@ -25,6 +25,9 @@
 
  #include iopgtable.h
 
 +#define for_each_iotlb_cr(obj, n, i, cr) \
 + for (i = 0; (i  n)  (cr = get_iotlb_cr(obj, i)); i++)
 +
-- This code is giving compilation error. 
Can you please send a new patch after fixing this on top of my patches.

Thank you,
Best regards,
Hari
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html