Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp819729pxk; Thu, 3 Sep 2020 13:28:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpiUKNBCgGbwPGzeIR5dkxpAP9KYyHq3gYWgILQsoIcILrwXJ8+Be5T132XJpWuqzHkYzj X-Received: by 2002:a17:906:2542:: with SMTP id j2mr3919061ejb.442.1599164902194; Thu, 03 Sep 2020 13:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599164902; cv=none; d=google.com; s=arc-20160816; b=RR5pkcUXempYUDyk8ca+aO7nmgU6B1EHnLPUIC6agvY0eJ00rBpEw9ioAAZQ6ejPYt EvDfcVWWcwPOzStOjBLmKJNPzN+OnptYWOe28qeeBL42O916AbC/38z4MJDZWTCpWidz HTws4OXvJPp5276STQaI4Hczx93o91V7+8E/iB+oFAbYiQKrnla5OgcGLutYmrfnddlk +AISIUGFsHQXXWrJ77hszdsCRctppGryY9FCkfrJ0Xq6g0PQfehlx2xOcyhl/LxE1r1j OgObH8QglML9XfVU95VIJDjKIUswkUzP3B9PrXDvH2QGIJgfzkAXqUF3+ZSyRc6WYaj4 t+2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XHoryAxbdooXqCdzEiDfBNHDRDqVJTRBeWqND7AhQWw=; b=Rj1GfFbrtTIsLYOaidyVN+Fl3UNclosjN4DKKOlTYXzLSSi7CDdsR00OdV8ELlPlgI F+kn22Q/t6DMCRwP4IOBll00otgK0ica2jsX52gebqPyof//BxJlNPtr5CUxD07AuVud Q8sLnTx8ii4dcV2iyqW4GfMINGr7phfD2gqVSITwDNEffnHHyjtQs297OY+9dixYA99b 5fgqUXRMtQeixJDXc/rAcWny5UGtQVK1d441FnZDzlIptbTU6TmxJ67OApcFBUXnHhBf yPYJT30GoiAWh2ZfLihqZhlcDoK7M7ikF/U7KixFj8/u68aCrpFjy81bDK1o4irR/m2K ORmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tcd-ie.20150623.gappssmtp.com header.s=20150623 header.b=RCNqeDrb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r21si2645560ejs.399.2020.09.03.13.27.59; Thu, 03 Sep 2020 13:28:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@tcd-ie.20150623.gappssmtp.com header.s=20150623 header.b=RCNqeDrb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728358AbgICU1R (ORCPT + 99 others); Thu, 3 Sep 2020 16:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729020AbgICU1N (ORCPT ); Thu, 3 Sep 2020 16:27:13 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5089FC06124F for ; Thu, 3 Sep 2020 13:27:10 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id g13so4783615ioo.9 for ; Thu, 03 Sep 2020 13:27:10 -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=XHoryAxbdooXqCdzEiDfBNHDRDqVJTRBeWqND7AhQWw=; b=RCNqeDrberJQa8iEXoKdFFmsXmVgm0OJW7eIchkOEab4PeUqCYPXFDpEN7VrPE2Q2r GUQQuiaAGbKydhEJAnnDCPiK90LXur6kCJr5L5sQ2r/ne46TMpiIdcTaCv2fHYoM6yNb n/CznyFIPF9GJUXXveE7AfWdl33o/8t6SBeJ8YB3I8NVC2PqmD4/iWDqPdEI5wN78LVf ncTI5ftXwXoF9V4Ax5mdMwpMg3xer78eQreGPZO8czXhtl772MKmX11X+ribr9UqcF1C urDp6n8FeZvPlJlmjz8S3oOgFUFG1EujxtEbZKlxpUccJF2SFlBjkXHX8U39zQ/QDpq6 IUOA== 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=XHoryAxbdooXqCdzEiDfBNHDRDqVJTRBeWqND7AhQWw=; b=bH8c58FWcLPwUWwdSYTmhnO8Z0tfpBLJ+d4F1Fr9G6z/FH5apxYPtvYXrK8ITNXrL4 ZU0jyV5hm0yOfZRXViYetaSvmkoeO5H+CHOA8Gl2Ai83l+fYEWp5H/b+EybPrsjh8adD JFy9pO27nDFNkdcBaMI/M8tjrvUSiHclGLRfEf26l+HulYQBXmy1YHUk678xQCeF6AGf IDQWlLK9chrwSoejENxAcetbLyEAH+BW632biq0CnU6z++Ln/RHNZxx3BWvujVcIqobq VQ08BUWomsaqcNc6mKQrG/IRk0P3quRrI4FODUsAmpND7yygJmMjTfpBl5nZIfya5zbJ +8cw== X-Gm-Message-State: AOAM530njzxW/PUCeMxqsVFEuwZR0Koq5/AUnEf5opkW3kdb7vzH+yX+ bFhV++Fn6r4qwMqEJHoltZP0xmxGFB+IYGQ6EuukEg== X-Received: by 2002:a02:834a:: with SMTP id w10mr5122585jag.63.1599164828964; Thu, 03 Sep 2020 13:27:08 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: From: Tom Murphy Date: Thu, 3 Sep 2020 21:26:57 +0100 Message-ID: Subject: Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api To: Logan Gunthorpe Cc: Marek Szyprowski , Christoph Hellwig , iommu@lists.linux-foundation.org, kvm@vger.kernel.org, David Airlie , dri-devel@lists.freedesktop.org, Bjorn Andersson , Matthias Brugger , Julien Grall , Thierry Reding , 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, Alex Williamson , linux-mediatek@lists.infradead.org, Rodrigo Vivi , linux-tegra@vger.kernel.org, Thomas Gleixner , virtualization@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Robin Murphy , Cornelia Huck , Linux Kernel Mailing List , Kukjin Kim , David Woodhouse , Jani Nikula , Joonas Lahtinen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 28 Aug 2020 at 00:34, Tom Murphy wrote: > > On Thu, 27 Aug 2020 at 22:36, Logan Gunthorpe wrote: > > > > > > > > On 2020-08-23 6:04 p.m., Tom Murphy wrote: > > > I have added a check for the sg_dma_len == 0 : > > > """ > > > } __sgt_iter(struct scatterlist *sgl, bool dma) { > > > struct sgt_iter s = { .sgp = sgl }; > > > > > > + if (sgl && sg_dma_len(sgl) == 0) > > > + s.sgp = NULL; > > > > > > if (s.sgp) { > > > ..... > > > """ > > > at location [1]. > > > but it doens't fix the problem. > > > > Based on my read of the code, it looks like we also need to change usage > > of sgl->length... Something like the rough patch below, maybe? > > > > Also, Tom, do you have an updated version of the patchset to convert the > > Intel IOMMU to dma-iommu available? The last one I've found doesn't > > apply cleanly (I'm assuming parts of it have been merged in slightly > > modified forms). > > > > I'll try and post one in the next 24hours I have just posted this now: The subject of the cover letter is: "[PATCH V2 0/5] Convert the intel iommu driver to the dma-iommu api" > > > Thanks, > > > > Logan > > > > -- > > > > 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)) > > + 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)); > > + } > > } > > > > return s;