Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715678

Re: [PATCH 07/13] drm/msm: Use sychronized interface of the IOMMU-API

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Rob Clark <robdclark@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 07/13] drm/msm: Use sychronized interface of the IOMMU-API
Date Sat, 19 Aug 2017 17:40:02 +0200
Message-ID <uge0W-31Q-7@gated-at.bofh.it> (permalink)
References <ufsyZ-4YZ-7@gated-at.bofh.it> <ufsyZ-4YZ-5@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=3Rb0VtrYkKIyHScrAUdjNnQVXse1wqNRDuqNLXCbf5A=; b=dNlzviZ5fDQa7S5mHTMg9OIR4R9ijPuXVJaLZ5sZagtzX9pIbjYb9OiPrZOueB06ZU 0Flb6OF+6/3zgzd3ddZtd/HN3mbD61xia9472vG75/bGxg97WvQAHHRBgBh7mcEUH6a2 aTFffzKYt0l4Qkx6/ChUd0A3u85ZXn3Qceq5op8x+/4R4feA5amTkfpXCQK5deXXtBTU jU0UOvXdienpKD+pkhhRBiU9vqFOukvwQDFjICEaDnMB789my+eOwvTNg6txz9rhmP5f YvdLYrbHX+xE4yAzTxtnEyMb6UeW9frGnyBmky3+77ek2K8wmd5yhgvO7X7lZ+olqeYI 2d0g==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3Rb0VtrYkKIyHScrAUdjNnQVXse1wqNRDuqNLXCbf5A=; b=sxq1rp0IG11gsHDXwzoThXTBI/De8/ARtqSN3aJa/VUIgWqknLSMvb4j9spT9yP7pi 9i5W5AjgGyEpa36gmVkLvGaIUYLhizNoCbKsm9D0SbOe7hiu9yUNtO1mLiq4I3ggqcnP +994gOU5VER41v+7xQMefVmNIQv9XsyFKZ3dZtvxOgAQSLkJySdIImDc+AOmT3HKU8IS SY3Shg34ANdKmxvG1AAup4z0nhn4aABoTrNMEQ5YDMskXdQZslH2PrhYiPuKhgSqYbkC 1sL+K4imYRWPFZf79iI7g96Kbxtej7ioSvAbwPKu2Mx5UE3oQ3Fp2YKWFwb9BGhnpkDm pZQQ==
X-Gm-Message-State AHYfb5h+YF0XrFQ7x22YOKBXrC2pbQ67o/mPDmG7pgn/NCTOijcEWlq0 yifK8k8Up3m4wPGWXalaZJCkjvqxuw==
X-Received by 10.25.26.199 with SMTP id a190mr3825050lfa.214.1503157176322; Sat, 19 Aug 2017 08:39:36 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset="UTF-8"
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 61
Organization linux.* mail to news gateway
X-Original-Cc "iommu@lists.linux-foundation.org" <iommu@lists.linux-foundation.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>, Joerg Roedel <jroedel@suse.de>, David Airlie <airlied@linux.ie>, linux-arm-msm <linux-arm-msm@vger.kernel.org>, "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>, freedreno <freedreno@lists.freedesktop.org>
X-Original-Date Sat, 19 Aug 2017 11:39:35 -0400
X-Original-Message-ID <CAF6AEGta3aHs5WEV+X9CpMp0YHzgmWqOJLsznm-yWa97_BuQ7A@mail.gmail.com>
X-Original-References <1502974596-23835-1-git-send-email-joro@8bytes.org> <1502974596-23835-8-git-send-email-joro@8bytes.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1715678

Show key headers only | View raw


On Thu, Aug 17, 2017 at 8:56 AM, Joerg Roedel <joro@8bytes.org> wrote:
> From: Joerg Roedel <jroedel@suse.de>
>
> 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.


I like the idea of decoupling tlb inv with map (well that doesn't
really effect any recent hw) and unmap (which does need tlb flush)..
and for a gpu driver it should be pretty easy to back up unmaps.

I did slightly prefer adding a new iommu_{map,unmap}_async() rather
than changing semantics of existing API, but either way:

Acked-by: Rob Clark <robdclark@gmail.com>

> Cc: Rob Clark <robdclark@gmail.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: freedreno@lists.freedesktop.org
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
>  drivers/gpu/drm/msm/msm_iommu.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
> index b23d336..b3525b7 100644
> --- a/drivers/gpu/drm/msm/msm_iommu.c
> +++ b/drivers/gpu/drm/msm/msm_iommu.c
> @@ -64,7 +64,8 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint64_t iova,
>         size_t ret;
>
>  //     pm_runtime_get_sync(mmu->dev);
> -       ret = iommu_map_sg(iommu->domain, iova, sgt->sgl, sgt->nents, prot);
> +       ret = iommu_map_sg_sync(iommu->domain, iova, sgt->sgl,
> +                               sgt->nents, prot);
>  //     pm_runtime_put_sync(mmu->dev);
>         WARN_ON(ret < 0);
>
> @@ -77,7 +78,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint64_t iova,
>         struct msm_iommu *iommu = to_msm_iommu(mmu);
>
>         pm_runtime_get_sync(mmu->dev);
> -       iommu_unmap(iommu->domain, iova, len);
> +       iommu_unmap_sync(iommu->domain, iova, len);
>         pm_runtime_put_sync(mmu->dev);
>
>         return 0;
> --
> 2.7.4
>

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 07/13] drm/msm: Use sychronized interface of the IOMMU-API Joerg Roedel <joro@8bytes.org> - 2017-08-17 15:00 +0200
  Re: [PATCH 07/13] drm/msm: Use sychronized interface of the IOMMU-API Rob Clark <robdclark@gmail.com> - 2017-08-19 17:40 +0200

csiph-web