Message ID | CADysL2bb+LC1ySgkp8Hd_VL8GaFJ_gsuMF=WkmWp+YTdJqKJ4A@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Sep 12, 2012 at 08:49:16PM +0530, Gupta, Ramesh wrote: > Thanks to the RMK's suggestions. I should've made clear the distinction between _range and _area. A _range function takes start and end. An _area function takes a start and size. So... > -static void flush_iopgd_range(u32 *first, u32 *last) > +static void flush_iopgd_range(u32 *first, size_t size) This should change to flush_iopgd_area(). > { > - /* 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_range(u32 *first, size_t size) > + flush_iopte_area(). (And there shouldn't be a blank line between this and the open curley.) Otherwise, looks fine. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Russell, On Wed, Sep 12, 2012 at 10:11 PM, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote: > On Wed, Sep 12, 2012 at 08:49:16PM +0530, Gupta, Ramesh wrote: >> Thanks to the RMK's suggestions. > > I should've made clear the distinction between _range and _area. > A _range function takes start and end. An _area function takes a start > and size. So... > >> -static void flush_iopgd_range(u32 *first, u32 *last) >> +static void flush_iopgd_range(u32 *first, size_t size) > > This should change to flush_iopgd_area(). Looks like I missed this, I will fix and send the updated patch. > >> { >> - /* 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_range(u32 *first, size_t size) >> + > > flush_iopte_area(). (And there shouldn't be a blank line between this > and the open curley.) I will fix it. > Otherwise, looks fine. thank you. Best regards Ramesh Gupta G -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index d0b1234..8f61ef9 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -469,24 +469,21 @@ EXPORT_SYMBOL_GPL(omap_foreach_iommu_device); /* * H/W pagetable operations */ -static void flush_iopgd_range(u32 *first, u32 *last) +static void flush_iopgd_range(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_range(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 +512,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_range(iopgd, sizeof(*iopgd)); dev_vdbg(obj->dev, "%s: a new pte:%p\n", __func__, iopte);