From patchwork Wed Aug 1 14:50:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Goebel X-Patchwork-Id: 10552411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BEA014E2 for ; Wed, 1 Aug 2018 14:50:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D0962B700 for ; Wed, 1 Aug 2018 14:50:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30AC72B708; Wed, 1 Aug 2018 14:50:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E828F2B700 for ; Wed, 1 Aug 2018 14:50:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389593AbeHAQgr (ORCPT ); Wed, 1 Aug 2018 12:36:47 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.80]:29591 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389498AbeHAQgr (ORCPT ); Wed, 1 Aug 2018 12:36:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1533135038; s=strato-dkim-0002; d=imago-technologies.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=R2kIaaS2EBEU/dsB/FLLmVWX+bREEGLZLY+oU2E9Wxk=; b=p2i5eW/2f8GlTHm+649DK4nV9RRLvqzxW2VKK/3Qqd1wXDmevAwsqDB9mtwLmyTfwP f49oYW08zS1oevp8qiSqFnp28B/rI5lOBXWknxIVMZH2uTxBTZnxFm3V5uYo7Xz47+aB AraXEgdUYPXdTGlQ9FUKZO9ZCz9Qo0dle1AOOQPZ2zXAX3EwetQH4zsXh9SY9g22ESNO B86ni2qQOpACMZRSmLeSptS8KHPqwNN4jpFDugfML6k9A03wl+7RNo5F3vMX7RdNARoN s1w3zRf4C+IgKyxATdwYCevazZ8zNw4CBaxgq9cbc1nhL9JHxBLHRaZXMv29/ByR5en5 +pGg== X-RZG-AUTH: ":K2MBd0WkW+xmAm4LBrzhTFws1v6NnvbgSV9+Na9ItpZ3fkYHrac69t0U5tuClm8sXXe0Gk0=" X-RZG-CLASS-ID: mo00 Received: from debian9-ralf.imago.local by smtp.strato.de (RZmta 43.14 AUTH) with ESMTPSA id 603d7au71Eoc0is (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 1 Aug 2018 16:50:38 +0200 (CEST) From: Ralf Goebel To: "'Suman Anna'" , "'Joerg Roedel'" Cc: Ralf Goebel , linux-omap@vger.kernel.org, "'KISHON VIJAY ABRAHAM'" Subject: [PATCH] iommu/omap: Fix cache flushes on paging tables entries Date: Wed, 1 Aug 2018 16:50:26 +0200 Message-Id: <20180801145026.24026-1-ralf.goebel@imago-technologies.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <010401d428b5$64bf7e90$2e3e7bb0$@imago-technologies.com> References: <010401d428b5$64bf7e90$2e3e7bb0$@imago-technologies.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Suman Anna --- 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 *iopgd, pte_ready: iopte = iopte_offset(iopgd, da); - *pt_dma = virt_to_phys(iopte); + *pt_dma = 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); @@ -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); /*