* [PATCH 00/11] Some OMAP IOMMU cleanup patches
@ 2015-07-20 22:33 Suman Anna
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
0 siblings, 1 reply; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
Hi Joerg,
The following series includes minor cleanup patches and checkpatch
fixes to the OMAP IOMMU driver. The first 5 patches do some cleanup
and some debugfs code rearrangement, while the last 6 patches deal
with the stricter checkpatch warnings/checks.
The series is baselined on 4.2-rc3 and should apply fine on any 4.2-rc.
regards
Suman
Suman Anna (11):
Documentation: dt: Add #iommu-cells info to OMAP iommu bindings
iommu/omap: Remove all module references
iommu/omap: Move debugfs functions to omap-iommu-debug.c
iommu/omap: Protect omap-iopgtable.h against double inclusion
iommu/omap: Remove unused union fields
iommu/omap: Remove trailing semi-colon from a macro
iommu/omap: Remove unnecessary error traces on alloc failures
iommu/omap: Use BIT(x) macros in omap-iopgtable.h
iommu/omap: Use BIT(x) macros in omap-iommu.h
iommu/omap: Align code with open parenthesis
iommu/omap: Split multiple assignments into separate lines
.../devicetree/bindings/iommu/ti,omap-iommu.txt | 6 +
drivers/iommu/omap-iommu-debug.c | 113 +++++++++++-
drivers/iommu/omap-iommu.c | 204 +++------------------
drivers/iommu/omap-iommu.h | 79 ++++----
drivers/iommu/omap-iopgtable.h | 27 ++-
5 files changed, 197 insertions(+), 232 deletions(-)
--
2.4.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 01/11] Documentation: dt: Add #iommu-cells info to OMAP iommu bindings
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
@ 2015-07-20 22:33 ` Suman Anna
[not found] ` <1437431613-55656-2-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-20 22:33 ` [PATCH 02/11] iommu/omap: Remove all module references Suman Anna
` (10 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
The OMAP IOMMU bindings is updated to reflect the required #iommu-cells
property.
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt b/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt
index 42531dc387aa..869699925fd5 100644
--- a/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt
+++ b/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt
@@ -8,6 +8,11 @@ Required properties:
- ti,hwmods : Name of the hwmod associated with the IOMMU instance
- reg : Address space for the configuration registers
- interrupts : Interrupt specifier for the IOMMU instance
+- #iommu-cells : Should be 0. OMAP IOMMUs are all "single-master" devices,
+ and needs no additional data in the pargs specifier. Please
+ also refer to the generic bindings document for more info
+ on this property,
+ Documentation/devicetree/bindings/iommu/iommu.txt
Optional properties:
- ti,#tlb-entries : Number of entries in the translation look-aside buffer.
@@ -18,6 +23,7 @@ Optional properties:
Example:
/* OMAP3 ISP MMU */
mmu_isp: mmu@480bd400 {
+ #iommu-cells = <0>;
compatible = "ti,omap2-iommu";
reg = <0x480bd400 0x80>;
interrupts = <24>;
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 02/11] iommu/omap: Remove all module references
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-20 22:33 ` [PATCH 01/11] Documentation: dt: Add #iommu-cells info to OMAP iommu bindings Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
[not found] ` <1437431613-55656-3-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-20 22:33 ` [PATCH 03/11] iommu/omap: Move debugfs functions to omap-iommu-debug.c Suman Anna
` (9 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
The OMAP IOMMU driver has been adapted to the IOMMU framework
for a while now, and it does not support being built as a
module anymore. So, remove all the module references from the
OMAP IOMMU driver.
While at it, also relocate a comment around the subsys_initcall
to avoid a checkpatch strict warning about using a blank line
after function/struct/union/enum declarations.
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iommu.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index a22c33d6a486..eeecfc4073af 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -12,7 +12,6 @@
*/
#include <linux/err.h>
-#include <linux/module.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
@@ -1089,7 +1088,6 @@ static const struct of_device_id omap_iommu_of_match[] = {
{ .compatible = "ti,dra7-iommu" },
{},
};
-MODULE_DEVICE_TABLE(of, omap_iommu_of_match);
static struct platform_driver omap_iommu_driver = {
.probe = omap_iommu_probe,
@@ -1405,20 +1403,5 @@ static int __init omap_iommu_init(void)
return platform_driver_register(&omap_iommu_driver);
}
-/* must be ready before omap3isp is probed */
subsys_initcall(omap_iommu_init);
-
-static void __exit omap_iommu_exit(void)
-{
- kmem_cache_destroy(iopte_cachep);
-
- platform_driver_unregister(&omap_iommu_driver);
-
- omap_iommu_debugfs_exit();
-}
-module_exit(omap_iommu_exit);
-
-MODULE_DESCRIPTION("omap iommu: tlb and pagetable primitives");
-MODULE_ALIAS("platform:omap-iommu");
-MODULE_AUTHOR("Hiroshi DOYU, Paul Mundt and Toshihiro Kobayashi");
-MODULE_LICENSE("GPL v2");
+/* must be ready before omap3isp is probed */
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/11] iommu/omap: Move debugfs functions to omap-iommu-debug.c
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-20 22:33 ` [PATCH 01/11] Documentation: dt: Add #iommu-cells info to OMAP iommu bindings Suman Anna
2015-07-20 22:33 ` [PATCH 02/11] iommu/omap: Remove all module references Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
2015-07-20 22:33 ` [PATCH 04/11] iommu/omap: Protect omap-iopgtable.h against double inclusion Suman Anna
` (8 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
The main OMAP IOMMU driver file has some helper functions used
by the OMAP IOMMU debugfs functionality, and there is already a
dedicated source file omap-iommu-debug.c dealing with these debugfs
routines. Move all these functions to the omap-iommu-debug.c file,
so that all the debugfs related routines are in one place.
The move required exposing some new functions and moving some
definitions to the internal omap-iommu.h header file.
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iommu-debug.c | 111 +++++++++++++++++++++++++++++
drivers/iommu/omap-iommu.c | 148 +--------------------------------------
drivers/iommu/omap-iommu.h | 28 ++++++--
3 files changed, 137 insertions(+), 150 deletions(-)
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index f3d20a2039d2..b4b96db37e6a 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -14,6 +14,7 @@
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
+#include <linux/pm_runtime.h>
#include <linux/debugfs.h>
#include <linux/platform_data/iommu-omap.h>
@@ -29,6 +30,59 @@ static inline bool is_omap_iommu_detached(struct omap_iommu *obj)
return !obj->domain;
}
+#define pr_reg(name) \
+ do { \
+ ssize_t bytes; \
+ const char *str = "%20s: %08x\n"; \
+ const int maxcol = 32; \
+ bytes = snprintf(p, maxcol, str, __stringify(name), \
+ iommu_read_reg(obj, MMU_##name)); \
+ p += bytes; \
+ len -= bytes; \
+ if (len < maxcol) \
+ goto out; \
+ } while (0)
+
+static ssize_t
+omap2_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len)
+{
+ char *p = buf;
+
+ pr_reg(REVISION);
+ pr_reg(IRQSTATUS);
+ pr_reg(IRQENABLE);
+ pr_reg(WALKING_ST);
+ pr_reg(CNTL);
+ pr_reg(FAULT_AD);
+ pr_reg(TTB);
+ pr_reg(LOCK);
+ pr_reg(LD_TLB);
+ pr_reg(CAM);
+ pr_reg(RAM);
+ pr_reg(GFLUSH);
+ pr_reg(FLUSH_ENTRY);
+ pr_reg(READ_CAM);
+ pr_reg(READ_RAM);
+ pr_reg(EMU_FAULT_AD);
+out:
+ return p - buf;
+}
+
+static ssize_t omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf,
+ ssize_t bytes)
+{
+ if (!obj || !buf)
+ return -EINVAL;
+
+ pm_runtime_get_sync(obj->dev);
+
+ bytes = omap2_iommu_dump_ctx(obj, buf, bytes);
+
+ pm_runtime_put_sync(obj->dev);
+
+ return bytes;
+}
+
static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
@@ -55,6 +109,63 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
return bytes;
}
+static int
+__dump_tlb_entries(struct omap_iommu *obj, struct cr_regs *crs, int num)
+{
+ int i;
+ struct iotlb_lock saved;
+ struct cr_regs tmp;
+ struct cr_regs *p = crs;
+
+ pm_runtime_get_sync(obj->dev);
+ iotlb_lock_get(obj, &saved);
+
+ for_each_iotlb_cr(obj, num, i, tmp) {
+ if (!iotlb_cr_valid(&tmp))
+ continue;
+ *p++ = tmp;
+ }
+
+ iotlb_lock_set(obj, &saved);
+ pm_runtime_put_sync(obj->dev);
+
+ return p - crs;
+}
+
+static ssize_t iotlb_dump_cr(struct omap_iommu *obj, struct cr_regs *cr,
+ char *buf)
+{
+ char *p = buf;
+
+ /* FIXME: Need more detail analysis of cam/ram */
+ p += sprintf(p, "%08x %08x %01x\n", cr->cam, cr->ram,
+ (cr->cam & MMU_CAM_P) ? 1 : 0);
+
+ return p - buf;
+}
+
+static size_t omap_dump_tlb_entries(struct omap_iommu *obj, char *buf,
+ ssize_t bytes)
+{
+ int i, num;
+ struct cr_regs *cr;
+ char *p = buf;
+
+ num = bytes / sizeof(*cr);
+ num = min(obj->nr_tlb_entries, num);
+
+ cr = kcalloc(num, sizeof(*cr), GFP_KERNEL);
+ if (!cr)
+ return 0;
+
+ num = __dump_tlb_entries(obj, cr, num);
+ for (i = 0; i < num; i++)
+ p += iotlb_dump_cr(obj, cr + i, p);
+ kfree(cr);
+
+ return p - buf;
+}
+
static ssize_t debug_read_tlb(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index eeecfc4073af..0fc00f31c39d 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -37,11 +37,6 @@
#define to_iommu(dev) \
((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
-#define for_each_iotlb_cr(obj, n, __i, cr) \
- for (__i = 0; \
- (__i < (n)) && (cr = __iotlb_read_cr((obj), __i), true); \
- __i++)
-
/* bitmap of the page sizes currently supported */
#define OMAP_IOMMU_PGSIZES (SZ_4K | SZ_64K | SZ_1M | SZ_16M)
@@ -71,11 +66,6 @@ struct omap_iommu_domain {
#define MMU_LOCK_VICT(x) \
((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
-struct iotlb_lock {
- short base;
- short vict;
-};
-
static struct platform_driver omap_iommu_driver;
static struct kmem_cache *iopte_cachep;
@@ -212,14 +202,6 @@ static void iommu_disable(struct omap_iommu *obj)
/*
* TLB operations
*/
-static inline int iotlb_cr_valid(struct cr_regs *cr)
-{
- if (!cr)
- return -EINVAL;
-
- return cr->cam & MMU_CAM_V;
-}
-
static u32 iotlb_cr_to_virt(struct cr_regs *cr)
{
u32 page_size = cr->cam & MMU_CAM_PGSZ_MASK;
@@ -259,7 +241,7 @@ static u32 iommu_report_fault(struct omap_iommu *obj, u32 *da)
return status;
}
-static void iotlb_lock_get(struct omap_iommu *obj, struct iotlb_lock *l)
+void iotlb_lock_get(struct omap_iommu *obj, struct iotlb_lock *l)
{
u32 val;
@@ -267,10 +249,9 @@ static void iotlb_lock_get(struct omap_iommu *obj, struct iotlb_lock *l)
l->base = MMU_LOCK_BASE(val);
l->vict = MMU_LOCK_VICT(val);
-
}
-static void iotlb_lock_set(struct omap_iommu *obj, struct iotlb_lock *l)
+void iotlb_lock_set(struct omap_iommu *obj, struct iotlb_lock *l)
{
u32 val;
@@ -296,7 +277,7 @@ static void iotlb_load_cr(struct omap_iommu *obj, struct cr_regs *cr)
}
/* only used in iotlb iteration for-loop */
-static struct cr_regs __iotlb_read_cr(struct omap_iommu *obj, int n)
+struct cr_regs __iotlb_read_cr(struct omap_iommu *obj, int n)
{
struct cr_regs cr;
struct iotlb_lock l;
@@ -467,129 +448,6 @@ static void flush_iotlb_all(struct omap_iommu *obj)
pm_runtime_put_sync(obj->dev);
}
-#ifdef CONFIG_OMAP_IOMMU_DEBUG
-
-#define pr_reg(name) \
- do { \
- ssize_t bytes; \
- const char *str = "%20s: %08x\n"; \
- const int maxcol = 32; \
- bytes = snprintf(p, maxcol, str, __stringify(name), \
- iommu_read_reg(obj, MMU_##name)); \
- p += bytes; \
- len -= bytes; \
- if (len < maxcol) \
- goto out; \
- } while (0)
-
-static ssize_t
-omap2_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len)
-{
- char *p = buf;
-
- pr_reg(REVISION);
- pr_reg(IRQSTATUS);
- pr_reg(IRQENABLE);
- pr_reg(WALKING_ST);
- pr_reg(CNTL);
- pr_reg(FAULT_AD);
- pr_reg(TTB);
- pr_reg(LOCK);
- pr_reg(LD_TLB);
- pr_reg(CAM);
- pr_reg(RAM);
- pr_reg(GFLUSH);
- pr_reg(FLUSH_ENTRY);
- pr_reg(READ_CAM);
- pr_reg(READ_RAM);
- pr_reg(EMU_FAULT_AD);
-out:
- return p - buf;
-}
-
-ssize_t omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t bytes)
-{
- if (!obj || !buf)
- return -EINVAL;
-
- pm_runtime_get_sync(obj->dev);
-
- bytes = omap2_iommu_dump_ctx(obj, buf, bytes);
-
- pm_runtime_put_sync(obj->dev);
-
- return bytes;
-}
-
-static int
-__dump_tlb_entries(struct omap_iommu *obj, struct cr_regs *crs, int num)
-{
- int i;
- struct iotlb_lock saved;
- struct cr_regs tmp;
- struct cr_regs *p = crs;
-
- pm_runtime_get_sync(obj->dev);
- iotlb_lock_get(obj, &saved);
-
- for_each_iotlb_cr(obj, num, i, tmp) {
- if (!iotlb_cr_valid(&tmp))
- continue;
- *p++ = tmp;
- }
-
- iotlb_lock_set(obj, &saved);
- pm_runtime_put_sync(obj->dev);
-
- return p - crs;
-}
-
-/**
- * iotlb_dump_cr - Dump an iommu tlb entry into buf
- * @obj: target iommu
- * @cr: contents of cam and ram register
- * @buf: output buffer
- **/
-static ssize_t iotlb_dump_cr(struct omap_iommu *obj, struct cr_regs *cr,
- char *buf)
-{
- char *p = buf;
-
- /* FIXME: Need more detail analysis of cam/ram */
- p += sprintf(p, "%08x %08x %01x\n", cr->cam, cr->ram,
- (cr->cam & MMU_CAM_P) ? 1 : 0);
-
- return p - buf;
-}
-
-/**
- * omap_dump_tlb_entries - dump cr arrays to given buffer
- * @obj: target iommu
- * @buf: output buffer
- **/
-size_t omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t bytes)
-{
- int i, num;
- struct cr_regs *cr;
- char *p = buf;
-
- num = bytes / sizeof(*cr);
- num = min(obj->nr_tlb_entries, num);
-
- cr = kcalloc(num, sizeof(*cr), GFP_KERNEL);
- if (!cr)
- return 0;
-
- num = __dump_tlb_entries(obj, cr, num);
- for (i = 0; i < num; i++)
- p += iotlb_dump_cr(obj, cr + i, p);
- kfree(cr);
-
- return p - buf;
-}
-
-#endif /* CONFIG_OMAP_IOMMU_DEBUG */
-
/*
* H/W pagetable operations
*/
diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h
index d736630df3c8..b6cc90b2ba41 100644
--- a/drivers/iommu/omap-iommu.h
+++ b/drivers/iommu/omap-iommu.h
@@ -13,6 +13,11 @@
#ifndef _OMAP_IOMMU_H
#define _OMAP_IOMMU_H
+#define for_each_iotlb_cr(obj, n, __i, cr) \
+ for (__i = 0; \
+ (__i < (n)) && (cr = __iotlb_read_cr((obj), __i), true); \
+ __i++)
+
struct iotlb_entry {
u32 da;
u32 pa;
@@ -65,6 +70,11 @@ struct cr_regs {
};
};
+struct iotlb_lock {
+ short base;
+ short vict;
+};
+
/**
* dev_to_omap_iommu() - retrieves an omap iommu object from a user device
* @dev: iommu client device
@@ -190,12 +200,12 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
/*
* global functions
*/
-#ifdef CONFIG_OMAP_IOMMU_DEBUG
-extern ssize_t
-omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
-extern size_t
-omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len);
+struct cr_regs __iotlb_read_cr(struct omap_iommu *obj, int n);
+void iotlb_lock_get(struct omap_iommu *obj, struct iotlb_lock *l);
+void iotlb_lock_set(struct omap_iommu *obj, struct iotlb_lock *l);
+
+#ifdef CONFIG_OMAP_IOMMU_DEBUG
void omap_iommu_debugfs_init(void);
void omap_iommu_debugfs_exit(void);
@@ -222,4 +232,12 @@ static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs)
__raw_writel(val, obj->regbase + offs);
}
+static inline int iotlb_cr_valid(struct cr_regs *cr)
+{
+ if (!cr)
+ return -EINVAL;
+
+ return cr->cam & MMU_CAM_V;
+}
+
#endif /* _OMAP_IOMMU_H */
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/11] iommu/omap: Protect omap-iopgtable.h against double inclusion
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
` (2 preceding siblings ...)
2015-07-20 22:33 ` [PATCH 03/11] iommu/omap: Move debugfs functions to omap-iommu-debug.c Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
[not found] ` <1437431613-55656-5-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-20 22:33 ` [PATCH 05/11] iommu/omap: Remove unused union fields Suman Anna
` (7 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
Protect the omap-pgtable.h header against double inclusion in
source code by using the standard include guard mechanism.
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iopgtable.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h
index f891683e3f05..bfde5405f514 100644
--- a/drivers/iommu/omap-iopgtable.h
+++ b/drivers/iommu/omap-iopgtable.h
@@ -10,6 +10,9 @@
* published by the Free Software Foundation.
*/
+#ifndef _OMAP_IOPGTABLE_H
+#define _OMAP_IOPGTABLE_H
+
/*
* "L2 table" address mask and size definitions.
*/
@@ -93,3 +96,5 @@ static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask)
/* to find an entry in the second-level page table. */
#define iopte_index(da) (((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1))
#define iopte_offset(iopgd, da) (iopgd_page_vaddr(iopgd) + iopte_index(da))
+
+#endif /* _OMAP_IOPGTABLE_H */
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/11] iommu/omap: Remove unused union fields
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
` (3 preceding siblings ...)
2015-07-20 22:33 ` [PATCH 04/11] iommu/omap: Protect omap-iopgtable.h against double inclusion Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
2015-07-20 22:33 ` [PATCH 06/11] iommu/omap: Remove trailing semi-colon from a macro Suman Anna
` (6 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
There are couple of unions defined in the structures
iotlb_entry and cr_regs. There are no usage/references
to some of these union fields in the code, so clean
them up and simplify the structures.
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iommu.h | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h
index b6cc90b2ba41..5b98408c18bf 100644
--- a/drivers/iommu/omap-iommu.h
+++ b/drivers/iommu/omap-iommu.h
@@ -22,12 +22,7 @@ struct iotlb_entry {
u32 da;
u32 pa;
u32 pgsz, prsvd, valid;
- union {
- u16 ap;
- struct {
- u32 endian, elsz, mixed;
- };
- };
+ u32 endian, elsz, mixed;
};
struct omap_iommu {
@@ -54,20 +49,8 @@ struct omap_iommu {
};
struct cr_regs {
- union {
- struct {
- u16 cam_l;
- u16 cam_h;
- };
- u32 cam;
- };
- union {
- struct {
- u16 ram_l;
- u16 ram_h;
- };
- u32 ram;
- };
+ u32 cam;
+ u32 ram;
};
struct iotlb_lock {
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/11] iommu/omap: Remove trailing semi-colon from a macro
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
` (4 preceding siblings ...)
2015-07-20 22:33 ` [PATCH 05/11] iommu/omap: Remove unused union fields Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
2015-07-20 22:33 ` [PATCH 07/11] iommu/omap: Remove unnecessary error traces on alloc failures Suman Anna
` (5 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
Remove the trailing semi-colon in the DEBUG_FOPS_RO macro
definition. This fixes the checking warning,
"WARNING: macros should not use a trailing semicolon"
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iommu-debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index b4b96db37e6a..e9f116f18531 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -265,7 +265,7 @@ static int debug_read_pagetable(struct seq_file *s, void *data)
.open = simple_open, \
.read = debug_read_##name, \
.llseek = generic_file_llseek, \
- };
+ }
DEBUG_FOPS_RO(regs);
DEBUG_FOPS_RO(tlb);
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 07/11] iommu/omap: Remove unnecessary error traces on alloc failures
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
` (5 preceding siblings ...)
2015-07-20 22:33 ` [PATCH 06/11] iommu/omap: Remove trailing semi-colon from a macro Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
[not found] ` <1437431613-55656-8-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-20 22:33 ` [PATCH 08/11] iommu/omap: Use BIT(x) macros in omap-iopgtable.h Suman Anna
` (4 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
Fix couple of checkpatch warnings of the type,
"WARNING: Possible unnecessary 'out of memory' message"
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iommu.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 0fc00f31c39d..4328d9855edb 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1093,16 +1093,12 @@ static struct iommu_domain *omap_iommu_domain_alloc(unsigned type)
return NULL;
omap_domain = kzalloc(sizeof(*omap_domain), GFP_KERNEL);
- if (!omap_domain) {
- pr_err("kzalloc failed\n");
+ if (!omap_domain)
goto out;
- }
omap_domain->pgtable = kzalloc(IOPGD_TABLE_SIZE, GFP_KERNEL);
- if (!omap_domain->pgtable) {
- pr_err("kzalloc failed\n");
+ if (!omap_domain->pgtable)
goto fail_nomem;
- }
/*
* should never fail, but please keep this around to ensure
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/11] iommu/omap: Use BIT(x) macros in omap-iopgtable.h
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
` (6 preceding siblings ...)
2015-07-20 22:33 ` [PATCH 07/11] iommu/omap: Remove unnecessary error traces on alloc failures Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
2015-07-20 22:33 ` [PATCH 09/11] iommu/omap: Use BIT(x) macros in omap-iommu.h Suman Anna
` (3 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
Switch to using the BIT(x) macros in omap-iopgtable.h where
possible. This eliminates the following checkpatch check
warning:
"CHECK: Prefer using the BIT macro"
A couple of macros that used zero bit shifting are defined
directly to avoid the above warning on one of the macros.
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iopgtable.h | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h
index bfde5405f514..01a315227bf0 100644
--- a/drivers/iommu/omap-iopgtable.h
+++ b/drivers/iommu/omap-iopgtable.h
@@ -13,25 +13,27 @@
#ifndef _OMAP_IOPGTABLE_H
#define _OMAP_IOPGTABLE_H
+#include <linux/bitops.h>
+
/*
* "L2 table" address mask and size definitions.
*/
#define IOPGD_SHIFT 20
-#define IOPGD_SIZE (1UL << IOPGD_SHIFT)
+#define IOPGD_SIZE BIT(IOPGD_SHIFT)
#define IOPGD_MASK (~(IOPGD_SIZE - 1))
/*
* "section" address mask and size definitions.
*/
#define IOSECTION_SHIFT 20
-#define IOSECTION_SIZE (1UL << IOSECTION_SHIFT)
+#define IOSECTION_SIZE BIT(IOSECTION_SHIFT)
#define IOSECTION_MASK (~(IOSECTION_SIZE - 1))
/*
* "supersection" address mask and size definitions.
*/
#define IOSUPER_SHIFT 24
-#define IOSUPER_SIZE (1UL << IOSUPER_SHIFT)
+#define IOSUPER_SIZE BIT(IOSUPER_SHIFT)
#define IOSUPER_MASK (~(IOSUPER_SIZE - 1))
#define PTRS_PER_IOPGD (1UL << (32 - IOPGD_SHIFT))
@@ -41,14 +43,14 @@
* "small page" address mask and size definitions.
*/
#define IOPTE_SHIFT 12
-#define IOPTE_SIZE (1UL << IOPTE_SHIFT)
+#define IOPTE_SIZE BIT(IOPTE_SHIFT)
#define IOPTE_MASK (~(IOPTE_SIZE - 1))
/*
* "large page" address mask and size definitions.
*/
#define IOLARGE_SHIFT 16
-#define IOLARGE_SIZE (1UL << IOLARGE_SHIFT)
+#define IOLARGE_SIZE BIT(IOLARGE_SHIFT)
#define IOLARGE_MASK (~(IOLARGE_SIZE - 1))
#define PTRS_PER_IOPTE (1UL << (IOPGD_SHIFT - IOPTE_SHIFT))
@@ -72,16 +74,16 @@ static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask)
/*
* some descriptor attributes.
*/
-#define IOPGD_TABLE (1 << 0)
-#define IOPGD_SECTION (2 << 0)
-#define IOPGD_SUPER (1 << 18 | 2 << 0)
+#define IOPGD_TABLE (1)
+#define IOPGD_SECTION (2)
+#define IOPGD_SUPER (BIT(18) | IOPGD_SECTION)
#define iopgd_is_table(x) (((x) & 3) == IOPGD_TABLE)
#define iopgd_is_section(x) (((x) & (1 << 18 | 3)) == IOPGD_SECTION)
#define iopgd_is_super(x) (((x) & (1 << 18 | 3)) == IOPGD_SUPER)
-#define IOPTE_SMALL (2 << 0)
-#define IOPTE_LARGE (1 << 0)
+#define IOPTE_SMALL (2)
+#define IOPTE_LARGE (1)
#define iopte_is_small(x) (((x) & 2) == IOPTE_SMALL)
#define iopte_is_large(x) (((x) & 3) == IOPTE_LARGE)
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/11] iommu/omap: Use BIT(x) macros in omap-iommu.h
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
` (7 preceding siblings ...)
2015-07-20 22:33 ` [PATCH 08/11] iommu/omap: Use BIT(x) macros in omap-iopgtable.h Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
2015-07-20 22:33 ` [PATCH 10/11] iommu/omap: Align code with open parenthesis Suman Anna
` (2 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
Switch to using the BIT(x) macros in omap-iommu.h where
possible. This eliminates the following checkpatch check
warning:
"CHECK: Prefer using the BIT macro"
A couple of the warnings were ignored for better readability
of the bit-shift for the different values.
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iommu.h | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h
index 5b98408c18bf..a656df2f9e03 100644
--- a/drivers/iommu/omap-iommu.h
+++ b/drivers/iommu/omap-iommu.h
@@ -13,6 +13,8 @@
#ifndef _OMAP_IOMMU_H
#define _OMAP_IOMMU_H
+#include <linux/bitops.h>
+
#define for_each_iotlb_cr(obj, n, __i, cr) \
for (__i = 0; \
(__i < (n)) && (cr = __iotlb_read_cr((obj), __i), true); \
@@ -96,11 +98,11 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
* MMU Register bit definitions
*/
/* IRQSTATUS & IRQENABLE */
-#define MMU_IRQ_MULTIHITFAULT (1 << 4)
-#define MMU_IRQ_TABLEWALKFAULT (1 << 3)
-#define MMU_IRQ_EMUMISS (1 << 2)
-#define MMU_IRQ_TRANSLATIONFAULT (1 << 1)
-#define MMU_IRQ_TLBMISS (1 << 0)
+#define MMU_IRQ_MULTIHITFAULT BIT(4)
+#define MMU_IRQ_TABLEWALKFAULT BIT(3)
+#define MMU_IRQ_EMUMISS BIT(2)
+#define MMU_IRQ_TRANSLATIONFAULT BIT(1)
+#define MMU_IRQ_TLBMISS BIT(0)
#define __MMU_IRQ_FAULT \
(MMU_IRQ_MULTIHITFAULT | MMU_IRQ_EMUMISS | MMU_IRQ_TRANSLATIONFAULT)
@@ -112,16 +114,16 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
/* MMU_CNTL */
#define MMU_CNTL_SHIFT 1
#define MMU_CNTL_MASK (7 << MMU_CNTL_SHIFT)
-#define MMU_CNTL_EML_TLB (1 << 3)
-#define MMU_CNTL_TWL_EN (1 << 2)
-#define MMU_CNTL_MMU_EN (1 << 1)
+#define MMU_CNTL_EML_TLB BIT(3)
+#define MMU_CNTL_TWL_EN BIT(2)
+#define MMU_CNTL_MMU_EN BIT(1)
/* CAM */
#define MMU_CAM_VATAG_SHIFT 12
#define MMU_CAM_VATAG_MASK \
((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
-#define MMU_CAM_P (1 << 3)
-#define MMU_CAM_V (1 << 2)
+#define MMU_CAM_P BIT(3)
+#define MMU_CAM_V BIT(2)
#define MMU_CAM_PGSZ_MASK 3
#define MMU_CAM_PGSZ_1M (0 << 0)
#define MMU_CAM_PGSZ_64K (1 << 0)
@@ -134,9 +136,9 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT)
#define MMU_RAM_ENDIAN_SHIFT 9
-#define MMU_RAM_ENDIAN_MASK (1 << MMU_RAM_ENDIAN_SHIFT)
+#define MMU_RAM_ENDIAN_MASK BIT(MMU_RAM_ENDIAN_SHIFT)
#define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT)
-#define MMU_RAM_ENDIAN_BIG (1 << MMU_RAM_ENDIAN_SHIFT)
+#define MMU_RAM_ENDIAN_BIG BIT(MMU_RAM_ENDIAN_SHIFT)
#define MMU_RAM_ELSZ_SHIFT 7
#define MMU_RAM_ELSZ_MASK (3 << MMU_RAM_ELSZ_SHIFT)
@@ -145,7 +147,7 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
#define MMU_RAM_ELSZ_32 (2 << MMU_RAM_ELSZ_SHIFT)
#define MMU_RAM_ELSZ_NONE (3 << MMU_RAM_ELSZ_SHIFT)
#define MMU_RAM_MIXED_SHIFT 6
-#define MMU_RAM_MIXED_MASK (1 << MMU_RAM_MIXED_SHIFT)
+#define MMU_RAM_MIXED_MASK BIT(MMU_RAM_MIXED_SHIFT)
#define MMU_RAM_MIXED MMU_RAM_MIXED_MASK
#define MMU_GP_REG_BUS_ERR_BACK_EN 0x1
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/11] iommu/omap: Align code with open parenthesis
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
` (8 preceding siblings ...)
2015-07-20 22:33 ` [PATCH 09/11] iommu/omap: Use BIT(x) macros in omap-iommu.h Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
2015-07-20 22:33 ` [PATCH 11/11] iommu/omap: Split multiple assignments into separate lines Suman Anna
2015-08-03 13:55 ` [PATCH 00/11] Some OMAP IOMMU cleanup patches Joerg Roedel
11 siblings, 0 replies; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
Fix all the occurrences of the following check warning
generated with the checkpatch --strict option:
"CHECK: Alignment should match open parenthesis"
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iommu.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 4328d9855edb..36d0033c2ccb 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -787,14 +787,14 @@ static irqreturn_t iommu_fault_handler(int irq, void *data)
if (!iopgd_is_table(*iopgd)) {
dev_err(obj->dev, "%s: errs:0x%08x da:0x%08x pgd:0x%p *pgd:px%08x\n",
- obj->name, errs, da, iopgd, *iopgd);
+ obj->name, errs, da, iopgd, *iopgd);
return IRQ_NONE;
}
iopte = iopte_offset(iopgd, da);
dev_err(obj->dev, "%s: errs:0x%08x da:0x%08x pgd:0x%p *pgd:0x%08x pte:0x%p *pte:0x%08x\n",
- obj->name, errs, da, iopgd, *iopgd, iopte, *iopte);
+ obj->name, errs, da, iopgd, *iopgd, iopte, *iopte);
return IRQ_NONE;
}
@@ -820,9 +820,8 @@ static struct omap_iommu *omap_iommu_attach(const char *name, u32 *iopgd)
struct device *dev;
struct omap_iommu *obj;
- dev = driver_find_device(&omap_iommu_driver.driver, NULL,
- (void *)name,
- device_match_by_alias);
+ dev = driver_find_device(&omap_iommu_driver.driver, NULL, (void *)name,
+ device_match_by_alias);
if (!dev)
return ERR_PTR(-ENODEV);
@@ -977,7 +976,7 @@ static u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa, int pgsz)
}
static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
- phys_addr_t pa, size_t bytes, int prot)
+ phys_addr_t pa, size_t bytes, int prot)
{
struct omap_iommu_domain *omap_domain = to_omap_domain(domain);
struct omap_iommu *oiommu = omap_domain->iommu_dev;
@@ -1004,7 +1003,7 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
}
static size_t omap_iommu_unmap(struct iommu_domain *domain, unsigned long da,
- size_t size)
+ size_t size)
{
struct omap_iommu_domain *omap_domain = to_omap_domain(domain);
struct omap_iommu *oiommu = omap_domain->iommu_dev;
@@ -1055,7 +1054,7 @@ out:
}
static void _omap_iommu_detach_dev(struct omap_iommu_domain *omap_domain,
- struct device *dev)
+ struct device *dev)
{
struct omap_iommu *oiommu = dev_to_omap_iommu(dev);
struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
@@ -1076,7 +1075,7 @@ static void _omap_iommu_detach_dev(struct omap_iommu_domain *omap_domain,
}
static void omap_iommu_detach_dev(struct iommu_domain *domain,
- struct device *dev)
+ struct device *dev)
{
struct omap_iommu_domain *omap_domain = to_omap_domain(domain);
@@ -1137,7 +1136,7 @@ static void omap_iommu_domain_free(struct iommu_domain *domain)
}
static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain,
- dma_addr_t da)
+ dma_addr_t da)
{
struct omap_iommu_domain *omap_domain = to_omap_domain(domain);
struct omap_iommu *oiommu = omap_domain->iommu_dev;
@@ -1154,7 +1153,7 @@ static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain,
ret = omap_iommu_translate(*pte, da, IOLARGE_MASK);
else
dev_err(dev, "bogus pte 0x%x, da 0x%llx", *pte,
- (unsigned long long)da);
+ (unsigned long long)da);
} else {
if (iopgd_is_section(*pgd))
ret = omap_iommu_translate(*pgd, da, IOSECTION_MASK);
@@ -1162,7 +1161,7 @@ static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain,
ret = omap_iommu_translate(*pgd, da, IOSUPER_MASK);
else
dev_err(dev, "bogus pgd 0x%x, da 0x%llx", *pgd,
- (unsigned long long)da);
+ (unsigned long long)da);
}
return ret;
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 11/11] iommu/omap: Split multiple assignments into separate lines
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
` (9 preceding siblings ...)
2015-07-20 22:33 ` [PATCH 10/11] iommu/omap: Align code with open parenthesis Suman Anna
@ 2015-07-20 22:33 ` Suman Anna
2015-08-03 13:55 ` [PATCH 00/11] Some OMAP IOMMU cleanup patches Joerg Roedel
11 siblings, 0 replies; 19+ messages in thread
From: Suman Anna @ 2015-07-20 22:33 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
Use separate assignments for assigning the same value into
different variables. This fixes the following check warning
generated with the checkpatch --strict option:
"CHECK: multiple assignments should be avoided"
Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
---
drivers/iommu/omap-iommu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 36d0033c2ccb..fe742c01a4f2 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1044,7 +1044,8 @@ omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
goto out;
}
- omap_domain->iommu_dev = arch_data->iommu_dev = oiommu;
+ omap_domain->iommu_dev = oiommu;
+ arch_data->iommu_dev = oiommu;
omap_domain->dev = dev;
oiommu->domain = domain;
@@ -1069,7 +1070,8 @@ static void _omap_iommu_detach_dev(struct omap_iommu_domain *omap_domain,
omap_iommu_detach(oiommu);
- omap_domain->iommu_dev = arch_data->iommu_dev = NULL;
+ omap_domain->iommu_dev = NULL;
+ arch_data->iommu_dev = NULL;
omap_domain->dev = NULL;
oiommu->domain = NULL;
}
--
2.4.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 01/11] Documentation: dt: Add #iommu-cells info to OMAP iommu bindings
[not found] ` <1437431613-55656-2-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
@ 2015-07-21 15:55 ` Laurent Pinchart
0 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2015-07-21 15:55 UTC (permalink / raw)
To: Suman Anna
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Hi Suman,
Thank you for the patch.
On Monday 20 July 2015 17:33:23 Suman Anna wrote:
> The OMAP IOMMU bindings is updated to reflect the required #iommu-cells
> property.
>
> Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
This brings the documentation in sync with both mainline DT sources and code
so it looks good to me.
Reviewed-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> ---
> Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt
> b/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt index
> 42531dc387aa..869699925fd5 100644
> --- a/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt
> +++ b/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt
> @@ -8,6 +8,11 @@ Required properties:
> - ti,hwmods : Name of the hwmod associated with the IOMMU instance
> - reg : Address space for the configuration registers
> - interrupts : Interrupt specifier for the IOMMU instance
> +- #iommu-cells : Should be 0. OMAP IOMMUs are all "single-master" devices,
> + and needs no additional data in the pargs specifier.
> Please + also refer to the generic bindings document for
> more info + on this property,
> + Documentation/devicetree/bindings/iommu/iommu.txt
>
> Optional properties:
> - ti,#tlb-entries : Number of entries in the translation look-aside buffer.
> @@ -18,6 +23,7 @@ Optional properties:
> Example:
> /* OMAP3 ISP MMU */
> mmu_isp: mmu@480bd400 {
> + #iommu-cells = <0>;
> compatible = "ti,omap2-iommu";
> reg = <0x480bd400 0x80>;
> interrupts = <24>;
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 02/11] iommu/omap: Remove all module references
[not found] ` <1437431613-55656-3-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
@ 2015-07-21 16:00 ` Laurent Pinchart
2015-07-21 23:44 ` Suman Anna
0 siblings, 1 reply; 19+ messages in thread
From: Laurent Pinchart @ 2015-07-21 16:00 UTC (permalink / raw)
To: Suman Anna
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Hi Suman,
On Monday 20 July 2015 17:33:24 Suman Anna wrote:
> The OMAP IOMMU driver has been adapted to the IOMMU framework
> for a while now, and it does not support being built as a
> module anymore. So, remove all the module references from the
> OMAP IOMMU driver.
>
> While at it, also relocate a comment around the subsys_initcall
> to avoid a checkpatch strict warning about using a blank line
> after function/struct/union/enum declarations.
>
> Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
I think this is one of the checkpatch warnings that can be safely ignored, but
it doesn't matter much. The comment will be removed after the OMAP3 ISP and
OMAP IOMMU drivers get support for a saner IOMMU probing dependency order
solution.
The code seems fine to me.
Reviewed-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> ---
> drivers/iommu/omap-iommu.c | 19 +------------------
> 1 file changed, 1 insertion(+), 18 deletions(-)
>
> diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
> index a22c33d6a486..eeecfc4073af 100644
> --- a/drivers/iommu/omap-iommu.c
> +++ b/drivers/iommu/omap-iommu.c
> @@ -12,7 +12,6 @@
> */
>
> #include <linux/err.h>
> -#include <linux/module.h>
> #include <linux/slab.h>
> #include <linux/interrupt.h>
> #include <linux/ioport.h>
> @@ -1089,7 +1088,6 @@ static const struct of_device_id omap_iommu_of_match[]
> = { { .compatible = "ti,dra7-iommu" },
> {},
> };
> -MODULE_DEVICE_TABLE(of, omap_iommu_of_match);
>
> static struct platform_driver omap_iommu_driver = {
> .probe = omap_iommu_probe,
> @@ -1405,20 +1403,5 @@ static int __init omap_iommu_init(void)
>
> return platform_driver_register(&omap_iommu_driver);
> }
> -/* must be ready before omap3isp is probed */
> subsys_initcall(omap_iommu_init);
> -
> -static void __exit omap_iommu_exit(void)
> -{
> - kmem_cache_destroy(iopte_cachep);
> -
> - platform_driver_unregister(&omap_iommu_driver);
> -
> - omap_iommu_debugfs_exit();
> -}
> -module_exit(omap_iommu_exit);
> -
> -MODULE_DESCRIPTION("omap iommu: tlb and pagetable primitives");
> -MODULE_ALIAS("platform:omap-iommu");
> -MODULE_AUTHOR("Hiroshi DOYU, Paul Mundt and Toshihiro Kobayashi");
> -MODULE_LICENSE("GPL v2");
> +/* must be ready before omap3isp is probed */
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 04/11] iommu/omap: Protect omap-iopgtable.h against double inclusion
[not found] ` <1437431613-55656-5-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
@ 2015-07-21 16:01 ` Laurent Pinchart
0 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2015-07-21 16:01 UTC (permalink / raw)
To: Suman Anna
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Hi Suman,
Thank you for the patch.
On Monday 20 July 2015 17:33:26 Suman Anna wrote:
> Protect the omap-pgtable.h header against double inclusion in
> source code by using the standard include guard mechanism.
>
> Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> ---
> drivers/iommu/omap-iopgtable.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h
> index f891683e3f05..bfde5405f514 100644
> --- a/drivers/iommu/omap-iopgtable.h
> +++ b/drivers/iommu/omap-iopgtable.h
> @@ -10,6 +10,9 @@
> * published by the Free Software Foundation.
> */
>
> +#ifndef _OMAP_IOPGTABLE_H
> +#define _OMAP_IOPGTABLE_H
> +
> /*
> * "L2 table" address mask and size definitions.
> */
> @@ -93,3 +96,5 @@ static inline phys_addr_t omap_iommu_translate(u32 d, u32
> va, u32 mask) /* to find an entry in the second-level page table. */
> #define iopte_index(da) (((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1))
> #define iopte_offset(iopgd, da) (iopgd_page_vaddr(iopgd) +
iopte_index(da))
> +
> +#endif /* _OMAP_IOPGTABLE_H */
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 07/11] iommu/omap: Remove unnecessary error traces on alloc failures
[not found] ` <1437431613-55656-8-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
@ 2015-07-21 16:03 ` Laurent Pinchart
0 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2015-07-21 16:03 UTC (permalink / raw)
To: Suman Anna
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Hi Suman,
Thank you for the patch.
On Monday 20 July 2015 17:33:29 Suman Anna wrote:
> Fix couple of checkpatch warnings of the type,
> "WARNING: Possible unnecessary 'out of memory' message"
>
> Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
The commit message could also mention that the reason to remove the error
messages is that memory allocation failures will already be reported in the
kernel log by the memory management code. No big deal though,
Reviewed-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> ---
> drivers/iommu/omap-iommu.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
> index 0fc00f31c39d..4328d9855edb 100644
> --- a/drivers/iommu/omap-iommu.c
> +++ b/drivers/iommu/omap-iommu.c
> @@ -1093,16 +1093,12 @@ static struct iommu_domain
> *omap_iommu_domain_alloc(unsigned type) return NULL;
>
> omap_domain = kzalloc(sizeof(*omap_domain), GFP_KERNEL);
> - if (!omap_domain) {
> - pr_err("kzalloc failed\n");
> + if (!omap_domain)
> goto out;
> - }
>
> omap_domain->pgtable = kzalloc(IOPGD_TABLE_SIZE, GFP_KERNEL);
> - if (!omap_domain->pgtable) {
> - pr_err("kzalloc failed\n");
> + if (!omap_domain->pgtable)
> goto fail_nomem;
> - }
>
> /*
> * should never fail, but please keep this around to ensure
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 02/11] iommu/omap: Remove all module references
2015-07-21 16:00 ` Laurent Pinchart
@ 2015-07-21 23:44 ` Suman Anna
0 siblings, 0 replies; 19+ messages in thread
From: Suman Anna @ 2015-07-21 23:44 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Hi Laurent,
>
> On Monday 20 July 2015 17:33:24 Suman Anna wrote:
>> The OMAP IOMMU driver has been adapted to the IOMMU framework
>> for a while now, and it does not support being built as a
>> module anymore. So, remove all the module references from the
>> OMAP IOMMU driver.
>>
>> While at it, also relocate a comment around the subsys_initcall
>> to avoid a checkpatch strict warning about using a blank line
>> after function/struct/union/enum declarations.
>>
>> Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
>
> I think this is one of the checkpatch warnings that can be safely ignored, but
> it doesn't matter much. The comment will be removed after the OMAP3 ISP and
> OMAP IOMMU drivers get support for a saner IOMMU probing dependency order
> solution.
>
> The code seems fine to me.
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
Yes, indeed. I have also started to work on some patches to switch to
using the IOMMU_OF_DECLARE init, that should also help us. I will post
those for the 4.4 kernel merge window.
regards
Suman
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 00/11] Some OMAP IOMMU cleanup patches
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
` (10 preceding siblings ...)
2015-07-20 22:33 ` [PATCH 11/11] iommu/omap: Split multiple assignments into separate lines Suman Anna
@ 2015-08-03 13:55 ` Joerg Roedel
[not found] ` <20150803135533.GH14980-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
11 siblings, 1 reply; 19+ messages in thread
From: Joerg Roedel @ 2015-08-03 13:55 UTC (permalink / raw)
To: Suman Anna
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
On Mon, Jul 20, 2015 at 05:33:22PM -0500, Suman Anna wrote:
> Suman Anna (11):
> Documentation: dt: Add #iommu-cells info to OMAP iommu bindings
> iommu/omap: Remove all module references
> iommu/omap: Move debugfs functions to omap-iommu-debug.c
> iommu/omap: Protect omap-iopgtable.h against double inclusion
> iommu/omap: Remove unused union fields
> iommu/omap: Remove trailing semi-colon from a macro
> iommu/omap: Remove unnecessary error traces on alloc failures
> iommu/omap: Use BIT(x) macros in omap-iopgtable.h
> iommu/omap: Use BIT(x) macros in omap-iommu.h
> iommu/omap: Align code with open parenthesis
Applied these patches to arm/omap.
> iommu/omap: Split multiple assignments into separate lines
Did not apply this one, there is nothing wrong with multiple
assignments.
Joerg
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 00/11] Some OMAP IOMMU cleanup patches
[not found] ` <20150803135533.GH14980-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
@ 2015-08-03 16:12 ` Suman Anna
0 siblings, 0 replies; 19+ messages in thread
From: Suman Anna @ 2015-08-03 16:12 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-omap-u79uwXL29TY76Z2rM5mHXA, Laurent Pinchart
On 08/03/2015 08:55 AM, Joerg Roedel wrote:
> On Mon, Jul 20, 2015 at 05:33:22PM -0500, Suman Anna wrote:
>> Suman Anna (11):
>> Documentation: dt: Add #iommu-cells info to OMAP iommu bindings
>> iommu/omap: Remove all module references
>> iommu/omap: Move debugfs functions to omap-iommu-debug.c
>> iommu/omap: Protect omap-iopgtable.h against double inclusion
>> iommu/omap: Remove unused union fields
>> iommu/omap: Remove trailing semi-colon from a macro
>> iommu/omap: Remove unnecessary error traces on alloc failures
>> iommu/omap: Use BIT(x) macros in omap-iopgtable.h
>> iommu/omap: Use BIT(x) macros in omap-iommu.h
>> iommu/omap: Align code with open parenthesis
>
> Applied these patches to arm/omap.
Thanks Joerg.
>
>> iommu/omap: Split multiple assignments into separate lines
>
> Did not apply this one, there is nothing wrong with multiple
> assignments.
Yeah, that was just to satisfy checkpatch --strict.
regards
Suman
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2015-08-03 16:12 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-20 22:33 [PATCH 00/11] Some OMAP IOMMU cleanup patches Suman Anna
[not found] ` <1437431613-55656-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-20 22:33 ` [PATCH 01/11] Documentation: dt: Add #iommu-cells info to OMAP iommu bindings Suman Anna
[not found] ` <1437431613-55656-2-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-21 15:55 ` Laurent Pinchart
2015-07-20 22:33 ` [PATCH 02/11] iommu/omap: Remove all module references Suman Anna
[not found] ` <1437431613-55656-3-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-21 16:00 ` Laurent Pinchart
2015-07-21 23:44 ` Suman Anna
2015-07-20 22:33 ` [PATCH 03/11] iommu/omap: Move debugfs functions to omap-iommu-debug.c Suman Anna
2015-07-20 22:33 ` [PATCH 04/11] iommu/omap: Protect omap-iopgtable.h against double inclusion Suman Anna
[not found] ` <1437431613-55656-5-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-21 16:01 ` Laurent Pinchart
2015-07-20 22:33 ` [PATCH 05/11] iommu/omap: Remove unused union fields Suman Anna
2015-07-20 22:33 ` [PATCH 06/11] iommu/omap: Remove trailing semi-colon from a macro Suman Anna
2015-07-20 22:33 ` [PATCH 07/11] iommu/omap: Remove unnecessary error traces on alloc failures Suman Anna
[not found] ` <1437431613-55656-8-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2015-07-21 16:03 ` Laurent Pinchart
2015-07-20 22:33 ` [PATCH 08/11] iommu/omap: Use BIT(x) macros in omap-iopgtable.h Suman Anna
2015-07-20 22:33 ` [PATCH 09/11] iommu/omap: Use BIT(x) macros in omap-iommu.h Suman Anna
2015-07-20 22:33 ` [PATCH 10/11] iommu/omap: Align code with open parenthesis Suman Anna
2015-07-20 22:33 ` [PATCH 11/11] iommu/omap: Split multiple assignments into separate lines Suman Anna
2015-08-03 13:55 ` [PATCH 00/11] Some OMAP IOMMU cleanup patches Joerg Roedel
[not found] ` <20150803135533.GH14980-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-08-03 16:12 ` Suman Anna
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).