From patchwork Thu Aug 17 12:56:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 9906291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EB22260386 for ; Thu, 17 Aug 2017 13:03:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1AD228AEA for ; Thu, 17 Aug 2017 13:03:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C686828AF9; Thu, 17 Aug 2017 13:03:51 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7AD3E28AE1 for ; Thu, 17 Aug 2017 13:03:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 94AC16E5B4; Thu, 17 Aug 2017 13:03:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 410 seconds by postgrey-1.35 at gabe; Thu, 17 Aug 2017 13:03:46 UTC Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5ED636E5AB; Thu, 17 Aug 2017 13:03:46 +0000 (UTC) Received: by theia.8bytes.org (Postfix, from userid 1000) id E1F26205; Thu, 17 Aug 2017 14:56:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1502974614; bh=hENryPcGuN4pSlC4AZGv8YgyJ5ITYE22DRDgaEyuX+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YDtMsh0oqP632IQtpg9/bGZ88IeKOmBCnoT4W13/4/6Sh3nuUkC0Ef/Y5wE48rK73 PKtfwgEFMRDydgwy2YbByeIaFB6Co+AMBAUyZi8nA7BtERSCW/P3EnRnkADZish7XX 7mXqPJe3dPtX+3FoFlb07Z27BFbfjGui4KyTKR6L3QregTSE938G9zhNE3iDn6DQni 9Pq2xLh/5axlfpoFtGZ4YB8SZQn4BC+P7g2y2nJ8yqNCJ6surgN9JNo35p3rPTN8ka l4H6BelTH+BXuGWRsn/jGn3YKS+lNejHm51FrbI1EuIUegtjk0LGUHf8szfTxnUMZh D1i7b5NfkR0pA== From: Joerg Roedel To: iommu@lists.linux-foundation.org Subject: [PATCH 06/13] drm/etnaviv: Use sychronized interface of the IOMMU-API Date: Thu, 17 Aug 2017 14:56:29 +0200 Message-Id: <1502974596-23835-7-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502974596-23835-1-git-send-email-joro@8bytes.org> References: <1502974596-23835-1-git-send-email-joro@8bytes.org> Cc: Joerg Roedel , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, etnaviv@lists.freedesktop.org, Suravee Suthikulpanit , Russell King X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel The map and unmap functions of the IOMMU-API changed their semantics: They do no longer guarantee that the hardware TLBs are synchronized with the page-table updates they made. To make conversion easier, new synchronized functions have been introduced which give these guarantees again until the code is converted to use the new TLB-flush interface of the IOMMU-API, which allows certain optimizations. But for now, just convert this code to use the synchronized functions so that it will behave as before. Cc: Lucas Stach Cc: Russell King Cc: Christian Gmeiner Cc: David Airlie Cc: etnaviv@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Joerg Roedel --- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c index f103e78..ae0247c 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c @@ -47,7 +47,7 @@ int etnaviv_iommu_map(struct etnaviv_iommu *iommu, u32 iova, VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes); - ret = iommu_map(domain, da, pa, bytes, prot); + ret = iommu_map_sync(domain, da, pa, bytes, prot); if (ret) goto fail; @@ -62,7 +62,7 @@ int etnaviv_iommu_map(struct etnaviv_iommu *iommu, u32 iova, for_each_sg(sgt->sgl, sg, i, j) { size_t bytes = sg_dma_len(sg) + sg->offset; - iommu_unmap(domain, da, bytes); + iommu_unmap_sync(domain, da, bytes); da += bytes; } return ret; @@ -80,7 +80,7 @@ int etnaviv_iommu_unmap(struct etnaviv_iommu *iommu, u32 iova, size_t bytes = sg_dma_len(sg) + sg->offset; size_t unmapped; - unmapped = iommu_unmap(domain, da, bytes); + unmapped = iommu_unmap_sync(domain, da, bytes); if (unmapped < bytes) return unmapped; @@ -338,7 +338,7 @@ int etnaviv_iommu_get_suballoc_va(struct etnaviv_gpu *gpu, dma_addr_t paddr, mutex_unlock(&mmu->lock); return ret; } - ret = iommu_map(mmu->domain, vram_node->start, paddr, size, + ret = iommu_map_sync(mmu->domain, vram_node->start, paddr, size, IOMMU_READ); if (ret < 0) { drm_mm_remove_node(vram_node); @@ -362,7 +362,7 @@ void etnaviv_iommu_put_suballoc_va(struct etnaviv_gpu *gpu, if (mmu->version == ETNAVIV_IOMMU_V2) { mutex_lock(&mmu->lock); - iommu_unmap(mmu->domain,iova, size); + iommu_unmap_sync(mmu->domain,iova, size); drm_mm_remove_node(vram_node); mutex_unlock(&mmu->lock); }