diff options
author | Tony Lindgren <tony@atomide.com> | 2010-07-02 04:23:30 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-07-02 04:23:30 -0400 |
commit | f40fd0e215b1bde4e43add1aacbe6faf6dbbea53 (patch) | |
tree | 05eeb8b7236f07303510162602afe05bfceecebe /arch/arm/plat-omap | |
parent | 9f2952dbcbc0a143cff19f2e44fc504901aad86f (diff) | |
parent | 1fd7f467127fcaea490451052fea22f234bbb206 (diff) |
Merge branch 'v2.6.35-rc3-iommu-for-next' of git://gitorious.org/~doyu/lk/mainline into omap-for-linus
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/include/plat/iommu.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/iommu.c | 27 | ||||
-rw-r--r-- | arch/arm/plat-omap/iopgtable.h | 8 |
3 files changed, 30 insertions, 7 deletions
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h index 0752af9d099e..33c7d41cb6a5 100644 --- a/arch/arm/plat-omap/include/plat/iommu.h +++ b/arch/arm/plat-omap/include/plat/iommu.h | |||
@@ -80,6 +80,7 @@ struct iommu_functions { | |||
80 | 80 | ||
81 | int (*enable)(struct iommu *obj); | 81 | int (*enable)(struct iommu *obj); |
82 | void (*disable)(struct iommu *obj); | 82 | void (*disable)(struct iommu *obj); |
83 | void (*set_twl)(struct iommu *obj, bool on); | ||
83 | u32 (*fault_isr)(struct iommu *obj, u32 *ra); | 84 | u32 (*fault_isr)(struct iommu *obj, u32 *ra); |
84 | 85 | ||
85 | void (*tlb_read_cr)(struct iommu *obj, struct cr_regs *cr); | 86 | void (*tlb_read_cr)(struct iommu *obj, struct cr_regs *cr); |
@@ -143,6 +144,7 @@ extern void iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); | |||
143 | extern u32 iotlb_cr_to_virt(struct cr_regs *cr); | 144 | extern u32 iotlb_cr_to_virt(struct cr_regs *cr); |
144 | 145 | ||
145 | extern int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e); | 146 | extern int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e); |
147 | extern void iommu_set_twl(struct iommu *obj, bool on); | ||
146 | extern void flush_iotlb_page(struct iommu *obj, u32 da); | 148 | extern void flush_iotlb_page(struct iommu *obj, u32 da); |
147 | extern void flush_iotlb_range(struct iommu *obj, u32 start, u32 end); | 149 | extern void flush_iotlb_range(struct iommu *obj, u32 start, u32 end); |
148 | extern void flush_iotlb_all(struct iommu *obj); | 150 | extern void flush_iotlb_all(struct iommu *obj); |
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c index bc094dbacee6..a202a2ce6e3d 100644 --- a/arch/arm/plat-omap/iommu.c +++ b/arch/arm/plat-omap/iommu.c | |||
@@ -370,6 +370,23 @@ void flush_iotlb_all(struct iommu *obj) | |||
370 | } | 370 | } |
371 | EXPORT_SYMBOL_GPL(flush_iotlb_all); | 371 | EXPORT_SYMBOL_GPL(flush_iotlb_all); |
372 | 372 | ||
373 | /** | ||
374 | * iommu_set_twl - enable/disable table walking logic | ||
375 | * @obj: target iommu | ||
376 | * @on: enable/disable | ||
377 | * | ||
378 | * Function used to enable/disable TWL. If one wants to work | ||
379 | * exclusively with locked TLB entries and receive notifications | ||
380 | * for TLB miss then call this function to disable TWL. | ||
381 | */ | ||
382 | void iommu_set_twl(struct iommu *obj, bool on) | ||
383 | { | ||
384 | clk_enable(obj->clk); | ||
385 | arch_iommu->set_twl(obj, on); | ||
386 | clk_disable(obj->clk); | ||
387 | } | ||
388 | EXPORT_SYMBOL_GPL(iommu_set_twl); | ||
389 | |||
373 | #if defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE) | 390 | #if defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE) |
374 | 391 | ||
375 | ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes) | 392 | ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes) |
@@ -653,7 +670,7 @@ void iopgtable_lookup_entry(struct iommu *obj, u32 da, u32 **ppgd, u32 **ppte) | |||
653 | if (!*iopgd) | 670 | if (!*iopgd) |
654 | goto out; | 671 | goto out; |
655 | 672 | ||
656 | if (*iopgd & IOPGD_TABLE) | 673 | if (iopgd_is_table(*iopgd)) |
657 | iopte = iopte_offset(iopgd, da); | 674 | iopte = iopte_offset(iopgd, da); |
658 | out: | 675 | out: |
659 | *ppgd = iopgd; | 676 | *ppgd = iopgd; |
@@ -670,7 +687,7 @@ static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da) | |||
670 | if (!*iopgd) | 687 | if (!*iopgd) |
671 | return 0; | 688 | return 0; |
672 | 689 | ||
673 | if (*iopgd & IOPGD_TABLE) { | 690 | if (iopgd_is_table(*iopgd)) { |
674 | int i; | 691 | int i; |
675 | u32 *iopte = iopte_offset(iopgd, da); | 692 | u32 *iopte = iopte_offset(iopgd, da); |
676 | 693 | ||
@@ -745,7 +762,7 @@ static void iopgtable_clear_entry_all(struct iommu *obj) | |||
745 | if (!*iopgd) | 762 | if (!*iopgd) |
746 | continue; | 763 | continue; |
747 | 764 | ||
748 | if (*iopgd & IOPGD_TABLE) | 765 | if (iopgd_is_table(*iopgd)) |
749 | iopte_free(iopte_offset(iopgd, 0)); | 766 | iopte_free(iopte_offset(iopgd, 0)); |
750 | 767 | ||
751 | *iopgd = 0; | 768 | *iopgd = 0; |
@@ -783,9 +800,11 @@ static irqreturn_t iommu_fault_handler(int irq, void *data) | |||
783 | if (!stat) | 800 | if (!stat) |
784 | return IRQ_HANDLED; | 801 | return IRQ_HANDLED; |
785 | 802 | ||
803 | iommu_disable(obj); | ||
804 | |||
786 | iopgd = iopgd_offset(obj, da); | 805 | iopgd = iopgd_offset(obj, da); |
787 | 806 | ||
788 | if (!(*iopgd & IOPGD_TABLE)) { | 807 | if (!iopgd_is_table(*iopgd)) { |
789 | dev_err(obj->dev, "%s: da:%08x pgd:%p *pgd:%08x\n", __func__, | 808 | dev_err(obj->dev, "%s: da:%08x pgd:%p *pgd:%08x\n", __func__, |
790 | da, iopgd, *iopgd); | 809 | da, iopgd, *iopgd); |
791 | return IRQ_NONE; | 810 | return IRQ_NONE; |
diff --git a/arch/arm/plat-omap/iopgtable.h b/arch/arm/plat-omap/iopgtable.h index ab23b6a140fd..c3e93bb0911f 100644 --- a/arch/arm/plat-omap/iopgtable.h +++ b/arch/arm/plat-omap/iopgtable.h | |||
@@ -63,6 +63,8 @@ | |||
63 | #define IOPGD_SECTION (2 << 0) | 63 | #define IOPGD_SECTION (2 << 0) |
64 | #define IOPGD_SUPER (1 << 18 | 2 << 0) | 64 | #define IOPGD_SUPER (1 << 18 | 2 << 0) |
65 | 65 | ||
66 | #define iopgd_is_table(x) (((x) & 3) == IOPGD_TABLE) | ||
67 | |||
66 | #define IOPTE_SMALL (2 << 0) | 68 | #define IOPTE_SMALL (2 << 0) |
67 | #define IOPTE_LARGE (1 << 0) | 69 | #define IOPTE_LARGE (1 << 0) |
68 | 70 | ||
@@ -70,12 +72,12 @@ | |||
70 | #define iopgd_index(da) (((da) >> IOPGD_SHIFT) & (PTRS_PER_IOPGD - 1)) | 72 | #define iopgd_index(da) (((da) >> IOPGD_SHIFT) & (PTRS_PER_IOPGD - 1)) |
71 | #define iopgd_offset(obj, da) ((obj)->iopgd + iopgd_index(da)) | 73 | #define iopgd_offset(obj, da) ((obj)->iopgd + iopgd_index(da)) |
72 | 74 | ||
73 | #define iopte_paddr(iopgd) (*iopgd & ~((1 << 10) - 1)) | 75 | #define iopgd_page_paddr(iopgd) (*iopgd & ~((1 << 10) - 1)) |
74 | #define iopte_vaddr(iopgd) ((u32 *)phys_to_virt(iopte_paddr(iopgd))) | 76 | #define iopgd_page_vaddr(iopgd) ((u32 *)phys_to_virt(iopgd_page_paddr(iopgd))) |
75 | 77 | ||
76 | /* to find an entry in the second-level page table. */ | 78 | /* to find an entry in the second-level page table. */ |
77 | #define iopte_index(da) (((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1)) | 79 | #define iopte_index(da) (((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1)) |
78 | #define iopte_offset(iopgd, da) (iopte_vaddr(iopgd) + iopte_index(da)) | 80 | #define iopte_offset(iopgd, da) (iopgd_page_vaddr(iopgd) + iopte_index(da)) |
79 | 81 | ||
80 | static inline u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa, | 82 | static inline u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa, |
81 | u32 flags) | 83 | u32 flags) |