@@ -469,24 +469,20 @@ EXPORT_SYMBOL_GPL(omap_foreach_iommu_device);
/*
* H/W pagetable operations
*/
-static void flush_iopgd_range(u32 *first, u32 *last)
+static void flush_iopgd_area(u32 *first, size_t size)
{
- /* FIXME: L2 cache should be taken care of if it exists */
- do {
- asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pgd"
- : : "r" (first));
- first += L1_CACHE_BYTES / sizeof(*first);
- } while (first <= last);
+ phys_addr_t phys = virt_to_phys(first);
+
+ iommu_flush_area(first, size);
+ outer_flush_range(phys, phys + size);
}
-static void flush_iopte_range(u32 *first, u32 *last)
+static void flush_iopte_area(u32 *first, size_t size)
{
- /* FIXME: L2 cache should be taken care of if it exists */
- do {
- asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pte"
- : : "r" (first));
- first += L1_CACHE_BYTES / sizeof(*first);
- } while (first <= last);
+ phys_addr_t phys = virt_to_phys(first);
+
+ iommu_flush_area(first, size);
+ outer_flush_range(phys, phys + size);
}
static void iopte_free(u32 *iopte)
@@ -515,7 +511,7 @@ static u32 *iopte_alloc(struct omap_iommu *obj,
u32 *iopgd, u32 da)
return ERR_PTR(-ENOMEM);
*iopgd = virt_to_phys(iopte) | IOPGD_TABLE;
- flush_iopgd_range(iopgd, iopgd);
+ flush_iopgd_area(iopgd, sizeof(*iopgd));
dev_vdbg(obj->dev, "%s: a new pte:%p\n", __func__, iopte);