Re: [PATCH] OMAP:iommu - pgd and pte entries weren't getting flushed out

From: David Cohen
Date: Wed Mar 02 2011 - 07:42:56 EST


Hi,

On Tue, Mar 1, 2011 at 9:46 PM, Fernando Guzman Lugo
<fernando.lugo@xxxxxx> wrote:
> From: Hari Kanigeri <h-kanigeri2@xxxxxx>
>
> pgd and pte entries weren't getting flushed out leading to MMU faults.

May I ask you to add to the patch body description why it's wrong and
why your solution is necessary?

Br,

David

>
> Signed-off-by: Hari Kanigeri <h-kanigeri2@xxxxxx>
> ---
> Âarch/arm/plat-omap/iommu.c | Â 12 ++++++------
> Â1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
> index aeb2c33..e9473ff 100644
> --- a/arch/arm/plat-omap/iommu.c
> +++ b/arch/arm/plat-omap/iommu.c
> @@ -508,7 +508,7 @@ static u32 *iopte_alloc(struct 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, iopgd + 1);
>
> Â Â Â Â Â Â Â Âdev_vdbg(obj->dev, "%s: a new pte:%p\n", __func__, iopte);
> Â Â Â Â} else {
> @@ -537,7 +537,7 @@ static int iopgd_alloc_section(struct iommu *obj, u32 da, u32 pa, u32 prot)
> Â Â Â Â}
>
> Â Â Â Â*iopgd = (pa & IOSECTION_MASK) | prot | IOPGD_SECTION;
> - Â Â Â flush_iopgd_range(iopgd, iopgd);
> + Â Â Â flush_iopgd_range(iopgd, iopgd + 1);
> Â Â Â Âreturn 0;
> Â}
>
> @@ -554,7 +554,7 @@ static int iopgd_alloc_super(struct iommu *obj, u32 da, u32 pa, u32 prot)
>
> Â Â Â Âfor (i = 0; i < 16; i++)
> Â Â Â Â Â Â Â Â*(iopgd + i) = (pa & IOSUPER_MASK) | prot | IOPGD_SUPER;
> - Â Â Â flush_iopgd_range(iopgd, iopgd + 15);
> + Â Â Â flush_iopgd_range(iopgd, iopgd + 16);
> Â Â Â Âreturn 0;
> Â}
>
> @@ -567,7 +567,7 @@ static int iopte_alloc_page(struct iommu *obj, u32 da, u32 pa, u32 prot)
> Â Â Â Â Â Â Â Âreturn PTR_ERR(iopte);
>
> Â Â Â Â*iopte = (pa & IOPAGE_MASK) | prot | IOPTE_SMALL;
> - Â Â Â flush_iopte_range(iopte, iopte);
> + Â Â Â flush_iopte_range(iopte, iopte + 1);
>
> Â Â Â Âdev_vdbg(obj->dev, "%s: da:%08x pa:%08x pte:%p *pte:%08x\n",
> Â Â Â Â Â Â Â Â __func__, da, pa, iopte, *iopte);
> @@ -592,7 +592,7 @@ static int iopte_alloc_large(struct iommu *obj, u32 da, u32 pa, u32 prot)
>
> Â Â Â Âfor (i = 0; i < 16; i++)
> Â Â Â Â Â Â Â Â*(iopte + i) = (pa & IOLARGE_MASK) | prot | IOPTE_LARGE;
> - Â Â Â flush_iopte_range(iopte, iopte + 15);
> + Â Â Â flush_iopte_range(iopte, iopte + 16);
> Â Â Â Âreturn 0;
> Â}
>
> @@ -763,7 +763,7 @@ void iopgtable_clear_entry_all(struct iommu *obj)
> Â Â Â Â Â Â Â Â Â Â Â Âiopte_free(iopte_offset(iopgd, 0));
>
> Â Â Â Â Â Â Â Â*iopgd = 0;
> - Â Â Â Â Â Â Â flush_iopgd_range(iopgd, iopgd);
> + Â Â Â Â Â Â Â flush_iopgd_range(iopgd, iopgd + 1);
> Â Â Â Â}
>
> Â Â Â Âflush_iotlb_all(obj);
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/