Commit c861151b authored by Ralf Goebel's avatar Ralf Goebel Committed by Greg Kroah-Hartman

iommu/omap: Fix cache flushes on L2 table entries

[ Upstream commit 04c532a1 ]

The base address used for DMA operations on the second-level table
did incorrectly include the offset for the table entry. The offset
was then added again which lead to incorrect behavior.

Operations on the L1 table are not affected.

The calculation of the base address is changed to point to the
beginning of the L2 table.

Fixes: bfee0cf0 ("iommu/omap: Use DMA-API for performing cache flushes")
Acked-by: default avatarSuman Anna <s-anna@ti.com>
Signed-off-by: default avatarRalf Goebel <ralf.goebel@imago-technologies.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0a65ab39
...@@ -529,7 +529,7 @@ static u32 *iopte_alloc(struct omap_iommu *obj, u32 *iopgd, ...@@ -529,7 +529,7 @@ static u32 *iopte_alloc(struct omap_iommu *obj, u32 *iopgd,
pte_ready: pte_ready:
iopte = iopte_offset(iopgd, da); iopte = iopte_offset(iopgd, da);
*pt_dma = virt_to_phys(iopte); *pt_dma = iopgd_page_paddr(iopgd);
dev_vdbg(obj->dev, dev_vdbg(obj->dev,
"%s: da:%08x pgd:%p *pgd:%08x pte:%p *pte:%08x\n", "%s: da:%08x pgd:%p *pgd:%08x pte:%p *pte:%08x\n",
__func__, da, iopgd, *iopgd, iopte, *iopte); __func__, da, iopgd, *iopgd, iopte, *iopte);
...@@ -717,7 +717,7 @@ static size_t iopgtable_clear_entry_core(struct omap_iommu *obj, u32 da) ...@@ -717,7 +717,7 @@ static size_t iopgtable_clear_entry_core(struct omap_iommu *obj, u32 da)
} }
bytes *= nent; bytes *= nent;
memset(iopte, 0, nent * sizeof(*iopte)); memset(iopte, 0, nent * sizeof(*iopte));
pt_dma = virt_to_phys(iopte); pt_dma = iopgd_page_paddr(iopgd);
flush_iopte_range(obj->dev, pt_dma, pt_offset, nent); flush_iopte_range(obj->dev, pt_dma, pt_offset, nent);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment