From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B95DCC433DF for ; Wed, 26 Aug 2020 21:24:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3681620737 for ; Wed, 26 Aug 2020 21:24:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=tcd-ie.20150623.gappssmtp.com header.i=@tcd-ie.20150623.gappssmtp.com header.b="rrACsr3C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3681620737 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tcd.ie Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7FC196EB04; Wed, 26 Aug 2020 21:24:48 +0000 (UTC) Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8C6CF6E858 for ; Wed, 26 Aug 2020 18:23:39 +0000 (UTC) Received: by mail-io1-xd44.google.com with SMTP id g14so3175889iom.0 for ; Wed, 26 Aug 2020 11:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iYoq01qIbGPauST5RfEEhLR3G1zLYNWZoPlBmyH0nwc=; b=rrACsr3CvBASDErVlhyy5K/fvnE8tuvuh2uL4jiaUL3ZGIxyyW4t874WgsTFTUoygE 0nd8dw2k6j5xfynBZ5BbH95ghQWO1tmk7qS4QlhhS+UpQrW6VIixR6b9/tabHPbrZ1TA woRwMlA1QVHyLaxTiI+ivqIC95ZJuDOtfQTTRjgK/HRRPkZA+BKnnG+a/1BKvKYfczZW giax0/bYLHTK1M0qOlsm4qENxTU2Bh4hQC+PjQEIdvsBdLlLAs06s5gOU5WsPK3RNiVa O8bil5tUrtg/+lUTAs1DLmtjKaPjTtBsrUkUk5J3gV7xeMNwjOueDK9lEWOPdwyFfjWL 4fgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iYoq01qIbGPauST5RfEEhLR3G1zLYNWZoPlBmyH0nwc=; b=T8lwPBYwGOruQiPXHrLy7CzKKBqo+Of0y8iavlRFCHpsP7/0/gSv/eag//q90P3hc9 IfsZu1toFEblX0MGE+H0GZ5TjOPuXRBMK5xrHtND5jrDy8dbHMxQxrwu3C9pPE+n4s2P XW3GKBVRnrPUEmYsF/35lV9R/CssP9UAFifKUbMgJZZSLoxH3ZwSfh+gcT0yNbT1SiH9 1VkH4idi0yt5d3gclU/1ujLRdAtBKddP43ZuB279yydTRxJ+nJAkhaeuAlncxkAezmcy RPuFNUZ+WPiviqgy33WODbQOEIpXTxwh426AJ0I7NneAK5tr+uJ6Rwd4z3z0bUCX6IyM ZQzg== X-Gm-Message-State: AOAM532ZqozDJQaGpjBjOQWR5o/LvvQgrOKlNUabeIKfgBCNfIBGH+om 3/X6kSgbrt/+Wlbw4EHwVbIvbQRO9Nb5PNFh79wF0A== X-Google-Smtp-Source: ABdhPJwFN6cBCs9PM+s7XTIce9XLWKWdjPF/GBPpGUznZWktGx6heltYKpGLa4ads24y20InNb1vg24deYZIDTRb1/0= X-Received: by 2002:a05:6638:258a:: with SMTP id s10mr16082808jat.101.1598466218702; Wed, 26 Aug 2020 11:23:38 -0700 (PDT) MIME-Version: 1.0 References: <20191221150402.13868-1-murphyt7@tcd.ie> <03caf286-09e8-a072-8d3a-b6bcca991516@arm.com> In-Reply-To: <03caf286-09e8-a072-8d3a-b6bcca991516@arm.com> From: Tom Murphy Date: Wed, 26 Aug 2020 14:23:26 -0400 Message-ID: To: Robin Murphy X-Mailman-Approved-At: Wed, 26 Aug 2020 21:24:47 +0000 Subject: Re: [Intel-gfx] [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , kvm@vger.kernel.org, David Airlie , dri-devel@lists.freedesktop.org, Bjorn Andersson , Matthias Brugger , Julien Grall , Will Deacon , Jean-Philippe Brucker , linux-samsung-soc@vger.kernel.org, Marc Zyngier , Krzysztof Kozlowski , Jonathan Hunter , linux-rockchip@lists.infradead.org, Andy Gross , Gerald Schaefer , linux-s390@vger.kernel.org, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-tegra@vger.kernel.org, Thomas Gleixner , virtualization@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Cornelia Huck , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Kukjin Kim , David Woodhouse Content-Type: multipart/mixed; boundary="===============0056316504==" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" --===============0056316504== Content-Type: multipart/alternative; boundary="00000000000026d76505adcbeb74" --00000000000026d76505adcbeb74 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable That would be great! On Wed., Aug. 26, 2020, 2:14 p.m. Robin Murphy, wrote: > Hi Tom, > > On 2019-12-21 15:03, Tom Murphy wrote: > > This patchset converts the intel iommu driver to the dma-iommu api. > > > > While converting the driver I exposed a bug in the intel i915 driver > which causes a huge amount of artifacts on the screen of my laptop. You c= an > see a picture of it here: > > > https://github.com/pippy360/kernelPatches/blob/master/IMG_20191219_225922= .jpg > > > > This issue is most likely in the i915 driver and is most likely caused > by the driver not respecting the return value of the dma_map_ops::map_sg > function. You can see the driver ignoring the return value here: > > > https://github.com/torvalds/linux/blob/7e0165b2f1a912a06e381e91f0f4e495f4= ac3736/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c#L51 > > > > Previously this didn=E2=80=99t cause issues because the intel map_sg al= ways > returned the same number of elements as the input scatter gather list but > with the change to this dma-iommu api this is no longer the case. I wasn= =E2=80=99t > able to track the bug down to a specific line of code unfortunately. > > > > Could someone from the intel team look at this? > > > > > > I have been testing on a lenovo x1 carbon 5th generation. Let me know i= f > there=E2=80=99s any more information you need. > > > > To allow my patch set to be tested I have added a patch (patch 8/8) in > this series to disable combining sg segments in the dma-iommu api which > fixes the bug but it doesn't fix the actual problem. > > > > As part of this patch series I copied the intel bounce buffer code to > the dma-iommu path. The addition of the bounce buffer code took me by > surprise. I did most of my development on this patch series before the > bounce buffer code was added and my reimplementation in the dma-iommu pat= h > is very rushed and not properly tested but I=E2=80=99m running out of tim= e to work > on this patch set. > > > > On top of that I also didn=E2=80=99t port over the intel tracing code f= rom this > commit: > > > https://github.com/torvalds/linux/commit/3b53034c268d550d9e8522e613a14ab5= 3b8840d8#diff-6b3e7c4993f05e76331e463ab1fc87e1 > > So all the work in that commit is now wasted. The code will need to be > removed and reimplemented in the dma-iommu path. I would like to take the > time to do this but I really don=E2=80=99t have the time at the moment an= d I want > to get these changes out before the iommu code changes any more. > > Further to what we just discussed at LPC, I've realised that tracepoints > are actually something I could do with *right now* for debugging my Arm > DMA ops series, so if I'm going to hack something up anyway I may as > well take responsibility for polishing it into a proper patch as well :) > > Robin. > > > > > Tom Murphy (8): > > iommu/vt-d: clean up 32bit si_domain assignment > > iommu/vt-d: Use default dma_direct_* mapping functions for direct > > mapped devices > > iommu/vt-d: Remove IOVA handling code from non-dma_ops path > > iommu: Handle freelists when using deferred flushing in iommu driver= s > > iommu: Add iommu_dma_free_cpu_cached_iovas function > > iommu: allow the dma-iommu api to use bounce buffers > > iommu/vt-d: Convert intel iommu driver to the iommu ops > > DO NOT MERGE: iommu: disable list appending in dma-iommu > > > > drivers/iommu/Kconfig | 1 + > > drivers/iommu/amd_iommu.c | 14 +- > > drivers/iommu/arm-smmu-v3.c | 3 +- > > drivers/iommu/arm-smmu.c | 3 +- > > drivers/iommu/dma-iommu.c | 183 +++++-- > > drivers/iommu/exynos-iommu.c | 3 +- > > drivers/iommu/intel-iommu.c | 936 ++++---------------------------= - > > drivers/iommu/iommu.c | 39 +- > > drivers/iommu/ipmmu-vmsa.c | 3 +- > > drivers/iommu/msm_iommu.c | 3 +- > > drivers/iommu/mtk_iommu.c | 3 +- > > drivers/iommu/mtk_iommu_v1.c | 3 +- > > drivers/iommu/omap-iommu.c | 3 +- > > drivers/iommu/qcom_iommu.c | 3 +- > > drivers/iommu/rockchip-iommu.c | 3 +- > > drivers/iommu/s390-iommu.c | 3 +- > > drivers/iommu/tegra-gart.c | 3 +- > > drivers/iommu/tegra-smmu.c | 3 +- > > drivers/iommu/virtio-iommu.c | 3 +- > > drivers/vfio/vfio_iommu_type1.c | 2 +- > > include/linux/dma-iommu.h | 3 + > > include/linux/intel-iommu.h | 1 - > > include/linux/iommu.h | 32 +- > > 23 files changed, 345 insertions(+), 908 deletions(-) > > > --00000000000026d76505adcbeb74 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
That would be great!

=
On Wed., Aug. 26, 2020, 2:14 p.m. Rob= in Murphy, <robin.murphy@arm.com= > wrote:
Hi Tom,

On 2019-12-21 15:03, Tom Murphy wrote:
> This patchset converts the intel iommu driver to the dma-iommu api. >
> While converting the driver I exposed a bug in the intel i915 driver w= hich causes a huge amount of artifacts on the screen of my laptop. You can = see a picture of it here:
> https:/= /github.com/pippy360/kernelPatches/blob/master/IMG_20191219_225922.jpg<= br> >
> This issue is most likely in the i915 driver and is most likely caused= by the driver not respecting the return value of the dma_map_ops::map_sg f= unction. You can see the driver ignoring the return value here:
> https://github.com/torvalds/linux= /blob/7e0165b2f1a912a06e381e91f0f4e495f4ac3736/drivers/gpu/drm/i915/gem/i91= 5_gem_dmabuf.c#L51
>
> Previously this didn=E2=80=99t cause issues because the intel map_sg a= lways returned the same number of elements as the input scatter gather list= but with the change to this dma-iommu api this is no longer the case. I wa= sn=E2=80=99t able to track the bug down to a specific line of code unfortun= ately.
>
> Could someone from the intel team look at this?
>
>
> I have been testing on a lenovo x1 carbon 5th generation. Let me know = if there=E2=80=99s any more information you need.
>
> To allow my patch set to be tested I have added a patch (patch 8/8) in= this series to disable combining sg segments in the dma-iommu api which fi= xes the bug but it doesn't fix the actual problem.
>
> As part of this patch series I copied the intel bounce buffer code to = the dma-iommu path. The addition of the bounce buffer code took me by surpr= ise. I did most of my development on this patch series before the bounce bu= ffer code was added and my reimplementation in the dma-iommu path is very r= ushed and not properly tested but I=E2=80=99m running out of time to work o= n this patch set.
>
> On top of that I also didn=E2=80=99t port over the intel tracing code = from this commit:
> https://github.com/torvalds/linux/commit= /3b53034c268d550d9e8522e613a14ab53b8840d8#diff-6b3e7c4993f05e76331e463ab1fc= 87e1
> So all the work in that commit is now wasted. The code will need to be= removed and reimplemented in the dma-iommu path. I would like to take the = time to do this but I really don=E2=80=99t have the time at the moment and = I want to get these changes out before the iommu code changes any more.

Further to what we just discussed at LPC, I've realised that tracepoint= s
are actually something I could do with *right now* for debugging my Arm DMA ops series, so if I'm going to hack something up anyway I may as well take responsibility for polishing it into a proper patch as well :)
Robin.

>
> Tom Murphy (8):
>=C2=A0 =C2=A0 iommu/vt-d: clean up 32bit si_domain assignment
>=C2=A0 =C2=A0 iommu/vt-d: Use default dma_direct_* mapping functions fo= r direct
>=C2=A0 =C2=A0 =C2=A0 mapped devices
>=C2=A0 =C2=A0 iommu/vt-d: Remove IOVA handling code from non-dma_ops pa= th
>=C2=A0 =C2=A0 iommu: Handle freelists when using deferred flushing in i= ommu drivers
>=C2=A0 =C2=A0 iommu: Add iommu_dma_free_cpu_cached_iovas function
>=C2=A0 =C2=A0 iommu: allow the dma-iommu api to use bounce buffers
>=C2=A0 =C2=A0 iommu/vt-d: Convert intel iommu driver to the iommu ops >=C2=A0 =C2=A0 DO NOT MERGE: iommu: disable list appending in dma-iommu<= br> >
>=C2=A0 =C2=A0drivers/iommu/Kconfig=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0|=C2=A0 =C2=A01 +
>=C2=A0 =C2=A0drivers/iommu/amd_iommu.c=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 14 +-
>=C2=A0 =C2=A0drivers/iommu/arm-smmu-v3.c=C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2= =A03 +-
>=C2=A0 =C2=A0drivers/iommu/arm-smmu.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2= =A0 =C2=A03 +-
>=C2=A0 =C2=A0drivers/iommu/dma-iommu.c=C2=A0 =C2=A0 =C2=A0 =C2=A0| 183 = +++++--
>=C2=A0 =C2=A0drivers/iommu/exynos-iommu.c=C2=A0 =C2=A0 |=C2=A0 =C2=A03 = +-
>=C2=A0 =C2=A0drivers/iommu/intel-iommu.c=C2=A0 =C2=A0 =C2=A0| 936 ++++-= ---------------------------
>=C2=A0 =C2=A0drivers/iommu/iommu.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0|=C2=A0 39 +-
>=C2=A0 =C2=A0drivers/iommu/ipmmu-vmsa.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A03 +-
>=C2=A0 =C2=A0drivers/iommu/msm_iommu.c=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 =C2=A03 +-
>=C2=A0 =C2=A0drivers/iommu/mtk_iommu.c=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 =C2=A03 +-
>=C2=A0 =C2=A0drivers/iommu/mtk_iommu_v1.c=C2=A0 =C2=A0 |=C2=A0 =C2=A03 = +-
>=C2=A0 =C2=A0drivers/iommu/omap-iommu.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A03 +-
>=C2=A0 =C2=A0drivers/iommu/qcom_iommu.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A03 +-
>=C2=A0 =C2=A0drivers/iommu/rockchip-iommu.c=C2=A0 |=C2=A0 =C2=A03 +- >=C2=A0 =C2=A0drivers/iommu/s390-iommu.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A03 +-
>=C2=A0 =C2=A0drivers/iommu/tegra-gart.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A03 +-
>=C2=A0 =C2=A0drivers/iommu/tegra-smmu.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A03 +-
>=C2=A0 =C2=A0drivers/iommu/virtio-iommu.c=C2=A0 =C2=A0 |=C2=A0 =C2=A03 = +-
>=C2=A0 =C2=A0drivers/vfio/vfio_iommu_type1.c |=C2=A0 =C2=A02 +-
>=C2=A0 =C2=A0include/linux/dma-iommu.h=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 =C2=A03 +
>=C2=A0 =C2=A0include/linux/intel-iommu.h=C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2= =A01 -
>=C2=A0 =C2=A0include/linux/iommu.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0|=C2=A0 32 +-
>=C2=A0 =C2=A023 files changed, 345 insertions(+), 908 deletions(-)
>
--00000000000026d76505adcbeb74-- --===============0056316504== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============0056316504==--