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=-6.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 71EA8C2D0A5 for ; Thu, 3 Sep 2020 20:27:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3F729206C0 for ; Thu, 3 Sep 2020 20:27:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mMw8iRLM"; 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="RCNqeDrb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F729206C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tcd.ie Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Fa8sUCaRJQ2ZUUWl/fEDYldgOeoRaHSs7jxpx0brmSc=; b=mMw8iRLM99ZbSmNqxBwTSSMEK ePAQwgY1WoFWtP6rJDYCKeVAvPg3ZoNma+kNPLP3QNTaL7prKrWB+8veFrMPKVf/TqbFBtcO330lV +2HctLREp9y3IAErxJ4LXSp9PrKWasbj1N/vHBRR8OHvhkDKb28h1o19HAeni3ezHnbCTTHnhXKnX o1PP/7X5+10U9/F0m0pnDTEWQ89GRVT3cwFESb1PvyBzPqDqHFsdCinF0UFXbouKlKw5WdxW9ZAD/ ps/6F4szAi1Pg+QUWnLKyoTuBNGmN5/ub9dFflRtiZw0hay/9rDQQSualMz3tsuqW0g4sB8GGVWwU 3GbYJhziw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDvpE-0002n2-1V; Thu, 03 Sep 2020 20:27:16 +0000 Received: from mail-io1-xd42.google.com ([2607:f8b0:4864:20::d42]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDvp8-0002jC-O2 for linux-rockchip@lists.infradead.org; Thu, 03 Sep 2020 20:27:11 +0000 Received: by mail-io1-xd42.google.com with SMTP id m17so4829072ioo.1 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=YGAv773ENwshBooF/TcC4Vr8SOa1YYDiZVeKviaps6OZQm5d/iuPOz0Ds2G3uhRq9m Nms8Ayd2zEkJSCVw8LNf3k6U4/xrCHCPGiDcK7RBmCm36LzAwxzF9C+zXdAN0OG7DGL4 bomTg2s7HZc86ga4hxsxm4rKVxQeXXvqC8+7dC7oVhKvrLXyUlv2wY0+R/AMmOXyqo7K F7pcAaoQi5mQOzLOlV0IscJDiq/nMAVQ3XSWcQ1u/5QwPz++7rMLpUFhnxgO2Y+glnzT g33f4AYkOvAg+Rr3muxqHidMkvDFnRMdiyx1GHfwr7oOdOxsHSC6iGcunw6lHXgLY+F8 ib9w== X-Gm-Message-State: AOAM531mBotaUKK16keGDhbffZshR4SOwF2RKMgtLCfpgd634eWL3dzO x+6/FqzDElcUwf5S+LWgK46A926niEpn1GbkX8KNfg== X-Google-Smtp-Source: ABdhPJwmTrpk85LWcnftpfNTJtQ24c/2yXv/TkIoKUAohLkMn+MLB1sF1W3BqKfqx9SeVWLrNTgZBBPqyFF6pQr5QKA= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200903_162710_844686_A170352C X-CRM114-Status: GOOD ( 28.29 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, David Airlie , Joonas Lahtinen , dri-devel@lists.freedesktop.org, Bjorn Andersson , linux-tegra@vger.kernel.org, Julien Grall , Thierry Reding , 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, Jani Nikula , Alex Williamson , linux-mediatek@lists.infradead.org, Rodrigo Vivi , 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.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; _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip