From patchwork Thu Jun 18 15:39:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 191110 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp1538189ilo; Thu, 18 Jun 2020 08:40:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFzj2gct0FZ+cJX85DdNjULGR1bmU0PaNjOGZi/5nLX85+gPUUAhzdALtjrx+Gr8SSlHk+ X-Received: by 2002:a50:d790:: with SMTP id w16mr4399510edi.231.1592494828413; Thu, 18 Jun 2020 08:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592494828; cv=none; d=google.com; s=arc-20160816; b=a9gIRtBBKbl6l6WQ+HXMqUH6jnjQajeUSbcw0sJUVEflgs1RXTKo7ufwq5cOBbya6D v0PqZ7qD7Rw7vBNOOXEyG9XQ5eBqot8qN/iYTs4N//0gBT6m05VVB/Bg/Qrz02UCbmJO jG/8zqETjc9/R2Ic0W4lJJXYG9k7oXo3+6g73S1+FlYrgGld+nPsOcogjcT4QGp6uclB SanrmR8uId53UcAodzu423lt6yfIOepOvHbdQCCloOzu8yJ3fT1wqu7i2guxV+dMEZ+r 96iEnqQN06byTGRlaMNIn3Po4A4sJqbd/V/dv0Df6AlTJLQ/jQmtbHHvYzAXP9xhppkQ pwLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=MqT40NSX2hFbmyPasraeZB6y//Q28ZVdzAVMaxtMZLY=; b=yc1U66V6di1oMI6FXhzTSzKileKSz1ihnTg6X4ltfCDmzSMuUm9jtpF/szJKyVhkpP khVCdhak9Ht3TOcFal2shUpsTjgElogzYP4X+7HE2Ykug8jm75ucgxJZshc+vy5Bfm6H RQHlaxxBNAvhAvoLHgpudrIaPj3db31V4oAgYrMnopUr1xZfhBIsQtVbtx0URUDB5XWp mTbpsbKbSQcvgRVmKaGKAnxq7i6MHfluktTIko37VX+gsWxzoX3BtKVSZq7EOMWwfvRk sblfWfB5q53OBP5QY8iTI+V8IrUWH7BxJURnnJWMeyTdODTOGonfH9dEVdAFHylrEECD sTwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=BM2TYRU1; spf=pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj16si2134885ejb.373.2020.06.18.08.40.28; Thu, 18 Jun 2020 08:40:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-samsung-soc-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=@samsung.com header.s=mail20170921 header.b=BM2TYRU1; spf=pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731612AbgFRPk1 (ORCPT + 3 others); Thu, 18 Jun 2020 11:40:27 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:38364 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731577AbgFRPkU (ORCPT ); Thu, 18 Jun 2020 11:40:20 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200618154019euoutp02fe152c770220a7afa6f6868da73089e3~ZrZnVRmF51250012500euoutp02c for ; Thu, 18 Jun 2020 15:40:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200618154019euoutp02fe152c770220a7afa6f6868da73089e3~ZrZnVRmF51250012500euoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1592494819; bh=MqT40NSX2hFbmyPasraeZB6y//Q28ZVdzAVMaxtMZLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BM2TYRU11NKYlfv+/fdF9BvK6LPrvmrFCvBlVe0Dh37zuEuEylD67ussbhTtjo3eO 2b2/oFtONww6nhdsHwBeq5t6VeQjVTSXmJ0aMS3X8PPMr9zC3gcgsnyPdWkvrCN6mj elUhL3dGrS9jnImCwRme5mLMnKtGBo4qfTjwcwvY= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200618154019eucas1p2d67fbfd901798698c28a153faec6ea32~ZrZnAcJYb2977729777eucas1p2-; Thu, 18 Jun 2020 15:40:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id C0.60.60698.3EA8BEE5; Thu, 18 Jun 2020 16:40:19 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200618154018eucas1p259b2d1c250b2078772b091212325f93e~ZrZmrQgZ80501005010eucas1p2X; Thu, 18 Jun 2020 15:40:18 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200618154018eusmtrp28c05d58a5da917d59bf0bb279c56477c~ZrZmqoAKa0370403704eusmtrp2c; Thu, 18 Jun 2020 15:40:18 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-1d-5eeb8ae39f29 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B4.EE.08375.2EA8BEE5; Thu, 18 Jun 2020 16:40:18 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200618154018eusmtip16b0cf50bb6921ca0c67990095bc31987~ZrZl93tAK0833608336eusmtip1N; Thu, 18 Jun 2020 15:40:17 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Christoph Hellwig , Robin Murphy , Bartlomiej Zolnierkiewicz , linux-arm-kernel@lists.infradead.org, David Airlie , Daniel Vetter , Inki Dae , Seung-Woo Kim , linux-samsung-soc@vger.kernel.org Subject: [PATCH v6 07/36] drm: exynos: use common helper for a scatterlist contiguity check Date: Thu, 18 Jun 2020 17:39:28 +0200 Message-Id: <20200618153956.29558-8-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200618153956.29558-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSa0hTYRzGeXcuO1tOTtPwRTNpaFaUd+KQJSVFpxuU9KnUmnpQUadsaqkf skSRpaaOSCQvyULzmqbTFi5d6Qzzkve8YLaCplnexWXa5tH69vu/z/O8z5+Xl0CEKsyWCJfE MlKJOFKE81FV+1rPUb18JtBtcRSlMrvfc6javBqM2lTlINTA8i+cel7RxqFyJ7NRqviNN7U0 MMWh6vRDGNWvfoJTeT0aDlX1boJLtc59xag8hQE/ZUlXFlYCunmlGKUbVz5j9OQDHYd+qbxL j23oEVoxUgro15+ScTqrvhzQi3X7rvCv80+EMJHh8YzU1ecWP2zw6R805u2uO1UGLUgGLTw5 4BGQ9IIlxh9ADviEkCwDUHlvlWMWhOQSgM0diaywCGBn0xy+kygyzGGsUApgRkUtwg6mxKOa TNTswkl3KJ+VbyWsyVQAOzItzCaETEfgU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gZFvASPDKkaR1NLi3PTcYkO94sTc4tK8dL3k/NxNjMBo2Xbs5+YdjJc2Bh9iFOBgVOLhfRHy Ok6INbGsuDL3EKMEB7OSCK/T2dNxQrwpiZVVqUX58UWlOanFhxhNgY6ayCwlmpwPjOS8knhD U0NzC0tDc2NzYzMLJXHeDoGDMUIC6YklqdmpqQWpRTB9TBycUg2M6TVWuUn+gpdKs3Zf/NU+ S9/33bLtUxe03lCv0qs8X6x7d8bl7E3TYne6RvnVn0hp2BWtHrpo1o+Fh+sFbxsetFBadvbS q/3FMVLsT9eXbJGT1LwvlaDiqdsnnrB15VWx0NW1S5VzmRbZ9GV+WuFUOOmw6au98Wc330i8 cFyJ7/6p+pkxDw//UmIpzkg01GIuKk4EAJreD6esAgAA X-CMS-MailID: 20200618154018eucas1p259b2d1c250b2078772b091212325f93e X-Msg-Generator: CA X-RootMTR: 20200618154018eucas1p259b2d1c250b2078772b091212325f93e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200618154018eucas1p259b2d1c250b2078772b091212325f93e References: <20200618153956.29558-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Use common helper for checking the contiguity of the imported dma-buf. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index efa476858db5..1716a023bca0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -431,27 +431,10 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev, { struct exynos_drm_gem *exynos_gem; - if (sgt->nents < 1) + /* check if the entries in the sg_table are contiguous */ + if (drm_prime_get_contiguous_size(sgt) < attach->dmabuf->size) { + DRM_ERROR("buffer chunks must be mapped contiguously"); return ERR_PTR(-EINVAL); - - /* - * Check if the provided buffer has been mapped as contiguous - * into DMA address space. - */ - if (sgt->nents > 1) { - dma_addr_t next_addr = sg_dma_address(sgt->sgl); - struct scatterlist *s; - unsigned int i; - - for_each_sg(sgt->sgl, s, sgt->nents, i) { - if (!sg_dma_len(s)) - break; - if (sg_dma_address(s) != next_addr) { - DRM_ERROR("buffer chunks must be mapped contiguously"); - return ERR_PTR(-EINVAL); - } - next_addr = sg_dma_address(s) + sg_dma_len(s); - } } exynos_gem = exynos_drm_gem_init(dev, attach->dmabuf->size);