From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ale.deltatee.com ([204.191.154.188]:52582 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731915AbgIHQ1k (ORCPT ); Tue, 8 Sep 2020 12:27:40 -0400 References: <20191221150402.13868-1-murphyt7@tcd.ie> <465815ae-9292-f37a-59b9-03949cb68460@deltatee.com> <20200529124523.GA11817@infradead.org> <33137cfb-603c-86e8-1091-f36117ecfaf3@deltatee.com> <766525c3-4da9-6db7-cd90-fb4b82cd8083@deltatee.com> <60a82319-cbee-4cd1-0d5e-3c407cc51330@linux.intel.com> From: Logan Gunthorpe Message-ID: Date: Tue, 8 Sep 2020 09:44:24 -0600 MIME-Version: 1.0 In-Reply-To: <60a82319-cbee-4cd1-0d5e-3c407cc51330@linux.intel.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Intel-gfx] [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api Sender: linux-s390-owner@vger.kernel.org List-ID: To: Tvrtko Ursulin , Tom Murphy Cc: kvm@vger.kernel.org, David Airlie , dri-devel@lists.freedesktop.org, Bjorn Andersson , linux-tegra@vger.kernel.org, Julien Grall , Will Deacon , Marek Szyprowski , Jean-Philippe Brucker , linux-samsung-soc@vger.kernel.org, Marc Zyngier , Krzysztof Kozlowski , Jonathan Hunter , Christoph Hellwig , linux-rockchip@lists.infradead.org, Andy Gross , linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Thomas Gleixner , virtualization@lists.linux-foundation.org, Gerald Schaefer , David Woodhouse , Cornelia Huck , Linux Kernel Mailing List , iommu@lists.linux-foundation.org, Kukjin Kim , Robin Murphy On 2020-09-08 9:28 a.m., Tvrtko Ursulin wrote: >> >> diff --git a/drivers/gpu/drm/i915/i915_scatterlist.h >> b/drivers/gpu/drm/i915/i915 >> index b7b59328cb76..9367ac801f0c 100644 >> --- a/drivers/gpu/drm/i915/i915_scatterlist.h >> +++ b/drivers/gpu/drm/i915/i915_scatterlist.h >> @@ -27,13 +27,19 @@ static __always_inline struct sgt_iter { >>   } __sgt_iter(struct scatterlist *sgl, bool dma) { >>          struct sgt_iter s = { .sgp = sgl }; >> >> +       if (sgl && !sg_dma_len(s.sgp)) > > I'd extend the condition to be, just to be safe: >     if (dma && sgl && !sg_dma_len(s.sgp)) > Right, good catch, that's definitely necessary. >> +               s.sgp = NULL; >> + >>          if (s.sgp) { >>                  s.max = s.curr = s.sgp->offset; >> -               s.max += s.sgp->length; >> -               if (dma) >> + >> +               if (dma) { >> +                       s.max += sg_dma_len(s.sgp); >>                          s.dma = sg_dma_address(s.sgp); >> -               else >> +               } else { >> +                       s.max += s.sgp->length; >>                          s.pfn = page_to_pfn(sg_page(s.sgp)); >> +               } > > Otherwise has this been tested or alternatively how to test it? (How to > repro the issue.) It has not been tested. To test it, you need Tom's patch set without the last "DO NOT MERGE" patch: https://lkml.kernel.org/lkml/20200907070035.GA25114@infradead.org/T/ Thanks, Logan