From patchwork Thu Aug 17 12:56:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 9906301 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 7B3DA60386 for ; Thu, 17 Aug 2017 13:04:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61C8A27F81 for ; Thu, 17 Aug 2017 13:04:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54C6D28861; Thu, 17 Aug 2017 13:04:13 +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 4D8BD27F81 for ; Thu, 17 Aug 2017 13:04:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 050576E5C2; Thu, 17 Aug 2017 13:03:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF0CA6E5AD for ; Thu, 17 Aug 2017 13:03:47 +0000 (UTC) Received: by theia.8bytes.org (Postfix, from userid 1000) id 4357224B; Thu, 17 Aug 2017 14:56:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1502974615; bh=FtubNaseDaTmCm8xJxxpELcs5ouSEtI2ajagNDp4Wpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fu/Z8HLKzmH3rkC2wFt9x/zCP2EzySgSK0XHjuPT3SGdPv33j4D85MjivtSSzWNn9 nCYk9rT04hOqNc+cRPfIzl2GhVe/zrAuyHqGmdCkU2mB0yQivdtYwEDTJW2cGbGODH ZaQI0qyLHs3SM+xsY2qYmXjwceOAkwhva8wzsuEfQMTHWC1EoFtlp7nGufbezi6QxE 9A56G9zCZNMZ9b2FhCn0cO4AW0p2bYfz5XzRGtryppkWGN4QHX/Una5S8FWEAUfLdn 9jyjOmhxlmGkoZWQ9Xo/y2Ig3IHCgEZQDfMs2uXUnuRq84z6HmqaKyayEwfZvqc8yB h22B+jUaq6aLg== From: Joerg Roedel To: iommu@lists.linux-foundation.org Subject: [PATCH 11/13] gpu: host1x: Use sychronized interface of the IOMMU-API Date: Thu, 17 Aug 2017 14:56:34 +0200 Message-Id: <1502974596-23835-12-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, Thierry Reding , Suravee Suthikulpanit , linux-tegra@vger.kernel.org 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: Thierry Reding Cc: dri-devel@lists.freedesktop.org Cc: linux-tegra@vger.kernel.org Signed-off-by: Joerg Roedel Acked-by: Thierry Reding --- drivers/gpu/host1x/cdma.c | 6 +++--- drivers/gpu/host1x/job.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index 28541b2..bdf557e 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c @@ -55,7 +55,7 @@ static void host1x_pushbuffer_destroy(struct push_buffer *pb) return; if (host1x->domain) { - iommu_unmap(host1x->domain, pb->dma, pb->alloc_size); + iommu_unmap_sync(host1x->domain, pb->dma, pb->alloc_size); free_iova(&host1x->iova, iova_pfn(&host1x->iova, pb->dma)); } @@ -105,8 +105,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb) } pb->dma = iova_dma_addr(&host1x->iova, alloc); - err = iommu_map(host1x->domain, pb->dma, pb->phys, size, - IOMMU_READ); + err = iommu_map_sync(host1x->domain, pb->dma, pb->phys, size, + IOMMU_READ); if (err) goto iommu_free_iova; } else { diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index bee5044..70a029c 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c @@ -243,7 +243,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job) goto unpin; } - err = iommu_map_sg(host->domain, + err = iommu_map_sg_sync(host->domain, iova_dma_addr(&host->iova, alloc), sgt->sgl, sgt->nents, IOMMU_READ); if (err == 0) { @@ -695,8 +695,8 @@ void host1x_job_unpin(struct host1x_job *job) struct host1x_job_unpin_data *unpin = &job->unpins[i]; if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) { - iommu_unmap(host->domain, job->addr_phys[i], - unpin->size); + iommu_unmap_sync(host->domain, job->addr_phys[i], + unpin->size); free_iova(&host->iova, iova_pfn(&host->iova, job->addr_phys[i])); }