[Letux-kernel] Fw: [PATCH] iommu/omap: Fix cache flushes on paging tables entries

Andreas Kemnade andreas at kemnade.info
Sat Aug 4 18:50:55 CEST 2018


i subscribed the linux-omap list to not produce duplicate patches.

I found this interesting, might fix some trouble. It got an Acked-By:
from a ti person.


Begin forwarded message:

Date: Wed,  1 Aug 2018 16:50:26 +0200
From: Ralf Goebel <ralf.goebel at imago-technologies.com>
To: "'Suman Anna'" <s-anna at ti.com>, "'Joerg Roedel'" <joro at 8bytes.org>
Cc: Ralf Goebel <ralf.goebel at imago-technologies.com>,
linux-omap at vger.kernel.org,        "'KISHON VIJAY ABRAHAM'"
<kishon at ti.com> Subject: [PATCH] iommu/omap: Fix cache flushes on
paging tables entries

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

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

Signed-off-by: Ralf Goebel <ralf.goebel at imago-technologies.com>
 drivers/iommu/omap-iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index af4a8e7fcd27..3b05117118c3 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -550,7 +550,7 @@ static u32 *iopte_alloc(struct omap_iommu *obj, u32
 	iopte = iopte_offset(iopgd, da);
-	*pt_dma = virt_to_phys(iopte);
+	*pt_dma = iopgd_page_paddr(iopgd);
 		 "%s: da:%08x pgd:%p *pgd:%08x pte:%p *pte:%08x\n",
 		 __func__, da, iopgd, *iopgd, iopte, *iopte);
@@ -738,7 +738,7 @@ static size_t iopgtable_clear_entry_core(struct
omap_iommu *obj, u32 da) }
 		bytes *= nent;
 		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);

To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.goldelico.com/pipermail/letux-kernel/attachments/20180804/a814a573/attachment.asc>

More information about the Letux-kernel mailing list