Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3439777pxa; Tue, 25 Aug 2020 23:40:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzVVk47bBXchKQqxr1JVAEJHHvn9qXOS7MeRPioJ3tBFBcvHO3IMQ+zBg3fd1ho6vDlvol X-Received: by 2002:a17:907:388:: with SMTP id ss8mr13589808ejb.479.1598424043544; Tue, 25 Aug 2020 23:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598424043; cv=none; d=google.com; s=arc-20160816; b=MdeFUOK1/QbtaRsxwoIo3mQD1/G4xwseb8qtTknBzCyhxpXdXZcpPo93LYBKS7REeE OG4DWJ1JtxF79lQz+fO8l8Vv7G9tF8i6PiGQ0RueVBHmdeAruloTJ25qwF24tvgv4pBb Mhazkx5WL08/fT7qki4aPqnjLG9X59QXu4izFjzCELXm2EwigHpG7zV6igR2pXGKjb7w CdRoEOIyKyKQnjKPTO2ZoF9yQdwRGhx1sZRaIRMNYEb0dXb7qxmoHHGYKGUVIVRb35Jr fBfGy0PAl49B3TNHIBigim0jSGnZhDz1uXbbnHMhzKohs+dl7b7aaq8wjXViEPj7aQ17 e08Q== 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=8H1bscYmofV6UafZRI60uVVnlPqwrLm9J9QpIebQpZ0=; b=w21OjLiIfYA4VwHVaZpkc1A6KBTaEIyH4L/mUqYZgaoimXZ4qwTGAEExjZ8ac2HORW uvynNnl8bjkImagosOlQ30gFZrvJwoy6QedkP6VlID6WSIc7SiDOkapV9lyvtVBHm38P 9sQwq9LJAOiyc90evKuWNX7mg6oM/48L3un23BGG50lioRzYf0BDYCxbzWl3a5QO20Rn 7vRna/Sg52rIF+hVmhvxESHGzEr5EWxJQ8hCwr5dYg7sIOHquhMVJUapT9be34fo5Mc1 dk+LFhEvowZGVudUVfmGSvB8W1GV6R0mSY7Tf7KOx4Tt3+ugYpRCmDXtpAMZoX/0oxMI lyjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="H072O/jD"; 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; 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 e15si954785ejz.137.2020.08.25.23.40.03; Tue, 25 Aug 2020 23:40:43 -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=@samsung.com header.s=mail20170921 header.b="H072O/jD"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727932AbgHZGij (ORCPT + 99 others); Wed, 26 Aug 2020 02:38:39 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:37695 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbgHZGfd (ORCPT ); Wed, 26 Aug 2020 02:35:33 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200826063531euoutp0137477a2e7562b0fdb81c392a8b2f5989~uvepK8kn-1717017170euoutp01b for ; Wed, 26 Aug 2020 06:35:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200826063531euoutp0137477a2e7562b0fdb81c392a8b2f5989~uvepK8kn-1717017170euoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1598423731; bh=8H1bscYmofV6UafZRI60uVVnlPqwrLm9J9QpIebQpZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H072O/jDGDDFjuFTH5o3idIRZA7eo8/ZDFnBI5bCrEtr+dI1R17Y7bPDxKjoHJtQ8 SE1QNwAc9lI5BtTbbUPWmCWclFCh8KTKq6VvRkfk16vQxQJY7J3PjHkOGmhhz5i81W OuLw9rY6bbnaobEhiRcYuFMICfRe0GDOLEDWf3JM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200826063531eucas1p248ebe392029fc6a0fd4a1b8c8288bab3~uveo5b_lz0402804028eucas1p2e; Wed, 26 Aug 2020 06:35:31 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id CC.23.06456.3B2064F5; Wed, 26 Aug 2020 07:35:31 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200826063531eucas1p21c9277fe2a91e632e40822fb04a2c095~uveog6mDa0403504035eucas1p2o; Wed, 26 Aug 2020 06:35:31 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200826063531eusmtrp133d833530b3a2b770231736ad24afb9e~uveogH7nN1091110911eusmtrp1L; Wed, 26 Aug 2020 06:35:31 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-b7-5f4602b344c9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 8C.C0.06314.2B2064F5; Wed, 26 Aug 2020 07:35:30 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200826063530eusmtip247af081d1930d5e275f6f52617cdf1d2~uvenw-tS40092200922eusmtip2x; Wed, 26 Aug 2020 06:35:30 +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 , Kukjin Kim , Krzysztof Kozlowski , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , linux-samsung-soc@vger.kernel.org Subject: [PATCH v9 06/32] drm: exynos: use common helper for a scatterlist contiguity check Date: Wed, 26 Aug 2020 08:32:50 +0200 Message-Id: <20200826063316.23486-7-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826063316.23486-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSe0hTYRjG+XbOzs6Wy9M0/LKLMMhQUpOivkhNw+xEElGEGZTOPKipU87U sn8ahpmb5mpdRNTUSs17W6wwvOaaYrryhpJ5YRlajswbFGS5Hcv/fu/7Ps/3vLx8JCbp4buS cfIUhpXLEqSECDe8/Wn20vNCIva8VG9Bub1dPPQ8v56P/hjuYGhg6TuBnlUbeejuuAZHJS2H 0PTYBxzlWb5hyGxuEKCejFkBWhyY5CGdZYiP+hsLCZRvbuah2o5PAtQ295mP8rUzRKCErimu AXTTcglO66qyCfrl8gSfHlebeLT+yXX644oFo7XDFYB+PaIk6NsvqgC9oNtxasN5kV80kxCX xrA+AZGi2Kn7FkFyqcPVoYVBQgm0IhUgSUjtg4NGRxUQkRKqEsCsAT3gikUAjT+Ma8UCgHlZ mYQKCO0OVUUWwQ0qAFSOGdctk7oHfJuKoHyhyqqyO5ypTAA7cx1sIoyqwGFR9W+7yIm6AO+Z y4GNcWonnC3twmwspvyhUTm1FucGqxta7X0hFQBN6ry1/owAFs35cxwMO2Zz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17ZjPzfvYLy0MfgQowAHoxIP7wI213gh1sSy4srcQ4wSHMxKIrxOZ0/HCfGmJFZWpRbl xxeV5qQWH2I0BTpqIrOUaHI+MPbzSuINTQ3NLSwNzY3Njc0slMR5OwQOxggJpCeWpGanphak FsH0MXFwSjUwGq5vejPD8X7PrqZbxsqLvrg55WnMP3jAqq3FvbsgKuX974at358++DCD6WTO pEbWKde00ktsl5eUf/g0/52FrPOt+jcxd/yklm/vfL15m/jKqPeHfy9epHr23hOeRk8OfZ/t cX8OHeQued28K/qzjrn8lNNNijM1LjRcq/7EIZQ850NtqNfXGCWW4oxEQy3mouJEABxpr6LF AgAA X-CMS-MailID: 20200826063531eucas1p21c9277fe2a91e632e40822fb04a2c095 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200826063531eucas1p21c9277fe2a91e632e40822fb04a2c095 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200826063531eucas1p21c9277fe2a91e632e40822fb04a2c095 References: <20200826063316.23486-1-m.szyprowski@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use common helper for checking the contiguity of the imported dma-buf. Signed-off-by: Marek Szyprowski Reviewed-by: Andrzej Hajda Acked-by : Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) 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); -- 2.17.1