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=-13.6 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 A1575C433E2 for ; Tue, 1 Sep 2020 19:34:37 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 802D52087C for ; Tue, 1 Sep 2020 19:34:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 802D52087C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 656128711C; Tue, 1 Sep 2020 19:34:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KusfLnjuGF-K; Tue, 1 Sep 2020 19:34:35 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id ABF0C8710D; Tue, 1 Sep 2020 19:34:35 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 98F1DC07FF; Tue, 1 Sep 2020 19:34:35 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 89B8CC0051 for ; Tue, 1 Sep 2020 19:34:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7833F8710D for ; Tue, 1 Sep 2020 19:34:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W10dFJ9grUnp for ; Tue, 1 Sep 2020 19:34:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by hemlock.osuosl.org (Postfix) with ESMTP id F3AAF8710C for ; Tue, 1 Sep 2020 19:34:32 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 63F041FB; Tue, 1 Sep 2020 12:34:32 -0700 (PDT) Received: from [10.57.40.122] (unknown [10.57.40.122]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D91FB3F71F; Tue, 1 Sep 2020 12:34:29 -0700 (PDT) Subject: Re: [PATCH v9 16/32] drm: rockchip: use common helper for a scatterlist contiguity check To: Marek Szyprowski , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org References: <20200826063316.23486-1-m.szyprowski@samsung.com> <20200826063316.23486-17-m.szyprowski@samsung.com> From: Robin Murphy Message-ID: <263143f0-8b39-6daa-1d26-54ef32b54c27@arm.com> Date: Tue, 1 Sep 2020 20:34:28 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200826063316.23486-17-m.szyprowski@samsung.com> Content-Language: en-GB Cc: =?UTF-8?Q?Heiko_St=c3=bcbner?= , Bartlomiej Zolnierkiewicz , David Airlie , Sandy Huang , linux-rockchip@lists.infradead.org, Daniel Vetter , Christoph Hellwig , linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2020-08-26 07:33, Marek Szyprowski wrote: > Use common helper for checking the contiguity of the imported dma-buf. Reviewed-by: Robin Murphy > Signed-off-by: Marek Szyprowski > --- > drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 19 +------------------ > 1 file changed, 1 insertion(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c > index b9275ba7c5a5..2970e534e2bb 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c > @@ -460,23 +460,6 @@ struct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj) > return sgt; > } > > -static unsigned long rockchip_sg_get_contiguous_size(struct sg_table *sgt, > - int count) > -{ > - struct scatterlist *s; > - dma_addr_t expected = sg_dma_address(sgt->sgl); > - unsigned int i; > - unsigned long size = 0; > - > - for_each_sg(sgt->sgl, s, count, i) { > - if (sg_dma_address(s) != expected) > - break; > - expected = sg_dma_address(s) + sg_dma_len(s); > - size += sg_dma_len(s); > - } > - return size; > -} > - > static int > rockchip_gem_iommu_map_sg(struct drm_device *drm, > struct dma_buf_attachment *attach, > @@ -498,7 +481,7 @@ rockchip_gem_dma_map_sg(struct drm_device *drm, > if (!count) > return -EINVAL; > > - if (rockchip_sg_get_contiguous_size(sg, count) < attach->dmabuf->size) { > + if (drm_prime_get_contiguous_size(sg) < attach->dmabuf->size) { > DRM_ERROR("failed to map sg_table to contiguous linear address.\n"); > dma_unmap_sg(drm->dev, sg->sgl, sg->nents, > DMA_BIDIRECTIONAL); > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu