From patchwork Mon Aug 6 15:00:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Goebel X-Patchwork-Id: 10557339 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 DA38D13B4 for ; Mon, 6 Aug 2018 15:01:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA721298D7 for ; Mon, 6 Aug 2018 15:01:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C852A298DD; Mon, 6 Aug 2018 15:01:27 +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 444C5298D8 for ; Mon, 6 Aug 2018 15:01:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729808AbeHFRKy (ORCPT ); Mon, 6 Aug 2018 13:10:54 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.82]:28472 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729693AbeHFRKx (ORCPT ); Mon, 6 Aug 2018 13:10:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1533567681; 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=LsECxtZA4b6mR9OKEw4v9dvAmQAWFVCdAgevQNa0KQo=; b=luUTJNngfqOECX1GonUlD8/88lzWS7Mx6RYpF+3AktnMTON3VVvPtOPjSLX3mpw7ZU BVyPxsNDtHhBIKwO5p+gd85jKsEs4u8l+0nTK5YBfmwWXef2gEMTsQY04FKzjROKapbe dzML3/J2ynYGLWxMFw7w0Xljz6S0rUTgc4lrJFld7snrlcP/k1+fKQapoX+uDp04zw6e ED4GbMj3zRmYj2FO2o5r0FOvCKa1hQmWHRU0XLEzFkL/vqq4RIOJVeyeBBgPUOErdZOj zob2nGpNmUaNQG7xjIfrLQM8ocZJWMT2OS26835w8JU7jC6CDWJwkJ5773oDeXfhJIPh 52zg== X-RZG-AUTH: ":K2MBd0WkW+xmAm4LBrzhTFws1v6NnvbgSV9+Na9ItpZ3fkYHrac69t0U5tuClm8sXXe0Gk0=" X-RZG-CLASS-ID: mo00 Received: from debian9-ralf.imago by smtp.strato.de (RZmta 43.14 AUTH) with ESMTPSA id 603d7au76F1IHAk (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); Mon, 6 Aug 2018 17:01:18 +0200 (CEST) From: Ralf Goebel To: "'Suman Anna'" , "'Joerg Roedel'" Cc: Ralf Goebel , linux-omap@vger.kernel.org, iommu@lists.linux-foundation.org, "'KISHON VIJAY ABRAHAM'" Subject: [PATCH] iommu/omap: Fix cache flushes on L2 table entries Date: Mon, 6 Aug 2018 17:00:36 +0200 Message-Id: <20180806150036.14644-1-ralf.goebel@imago-technologies.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <7c58d42f-cb11-129a-6e04-45319443f1bb@ti.com> References: <7c58d42f-cb11-129a-6e04-45319443f1bb@ti.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 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 --- Changes in v2: Rephrase patch summary and description 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); /*