Return-Path: Received: from mail-bl2nam02on0130.outbound.protection.outlook.com ([104.47.38.130]:33741 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727815AbeH3WPl (ORCPT ); Thu, 30 Aug 2018 18:15:41 -0400 From: Sasha Levin To: "stable@vger.kernel.org" CC: Ralf Goebel , Joerg Roedel , Sasha Levin Subject: [PATCH AUTOSEL 4.14 51/67] iommu/omap: Fix cache flushes on L2 table entries Date: Thu, 30 Aug 2018 18:11:39 +0000 Message-ID: <20180830180918.36327-51-alexander.levin@microsoft.com> References: <20180830180918.36327-1-alexander.levin@microsoft.com> In-Reply-To: <20180830180918.36327-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Ralf Goebel [ Upstream commit 04c532a1cdc7e423656c07937aa4b5c1c2b064f9 ] 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: bfee0cf0ee1d ("iommu/omap: Use DMA-API for performing cache flushes"= ) Acked-by: Suman Anna Signed-off-by: Ralf Goebel Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- 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 bd67e1b2c64e..57960cb5e045 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -529,7 +529,7 @@ static u32 *iopte_alloc(struct omap_iommu *obj, u32 *io= pgd, =20 pte_ready: iopte =3D iopte_offset(iopgd, da); - *pt_dma =3D virt_to_phys(iopte); + *pt_dma =3D iopgd_page_paddr(iopgd); dev_vdbg(obj->dev, "%s: da:%08x pgd:%p *pgd:%08x pte:%p *pte:%08x\n", __func__, da, iopgd, *iopgd, iopte, *iopte); @@ -717,7 +717,7 @@ static size_t iopgtable_clear_entry_core(struct omap_io= mmu *obj, u32 da) } bytes *=3D nent; memset(iopte, 0, nent * sizeof(*iopte)); - pt_dma =3D virt_to_phys(iopte); + pt_dma =3D iopgd_page_paddr(iopgd); flush_iopte_range(obj->dev, pt_dma, pt_offset, nent); =20 /* --=20 2.17.1