Message ID | 20200619103636.11974-11-m.szyprowski@samsung.com |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp399913ilo; Fri, 19 Jun 2020 03:37:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe8rUuvHL6Ht++tPijIf1rNybETpMQhIAfZatJ0DAD7uUOfuq4NcrN8u9f8Nr677G7PhU9 X-Received: by 2002:a17:90a:e7cd:: with SMTP id kb13mr2865285pjb.138.1592563039920; Fri, 19 Jun 2020 03:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592563039; cv=none; d=google.com; s=arc-20160816; b=lZeAYkrA8dB9pp1bi9YWJ/f2g3/kmCHJGVappCGZCordu4sz4srPDCgSHKw09mMd66 YDiQWt00QaioSAYkywMcWZSDCyQiwS+YmXiifi9GuZRN6XkthBbw9wzRTxntyU0M3jeL 0Dmrm6lkuSW5wlgJajZc45rs5iCr76F3gdxamxl7Q09QWZMbhJVGpz8tbcoM55XjtCXI Ot8fR8blfIw0740bS4jLFK1vA5hwXDhWQJdOKoFeX9I8ju+gmWanAaUXKHroxsDrtzUr QIhhyil7DbO3vJd2z6TDoSrNMxXGIZxOmLhGrOV0H8PAcd1yu2Mh7fzlhblM9kamdHZM zZvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:cms-type:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-filter:delivered-to; bh=kyDWxeKvgs6eGPn7My5OW8V2mK7bDI5wo9wOCsMVDgE=; b=tnOqplbtma/hRn2h+Ypcl0dKp7zkMUxJp+UHnb0F0Fp+TMHd7IaPhnVj6tBG3CxHJt 2la+RIXXq13hjadMBQGPGLY16hrjcp7XBtcIw7EqZGKJOLL9/94QPjjDbX4wIFKo3p1X uL1nLOqorTtL2HDYkARatmtFX9Uwk6YoP9jBo96iFOSZWtOro45Kvc8ncQtynlRX8APG fNClVLXnN/p7CAuWXBtil5PtrAVgwtyh5z1BHm/XRoYL5FbAWyLWAP7rIzkG6p4x/BqX K6Yr2LnAwAuDIRo5ZxsGn+5LDg8iruEseEK7GqemSiyxBadKli12ZcEr3dgWN6bQ8gWU g6JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=pN2LIMKg; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: <dri-devel-bounces@lists.freedesktop.org> Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 62si3933862pfy.239.2020.06.19.03.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 03:37:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=pN2LIMKg; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5E8A6EC64; Fri, 19 Jun 2020 10:37:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id C10066EC69 for <dri-devel@lists.freedesktop.org>; Fri, 19 Jun 2020 10:37:01 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200619103700euoutp01cce9de1d16cc988e803621f1e919ac8b~Z66EdP9tf1680716807euoutp01Z for <dri-devel@lists.freedesktop.org>; Fri, 19 Jun 2020 10:37:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200619103700euoutp01cce9de1d16cc988e803621f1e919ac8b~Z66EdP9tf1680716807euoutp01Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1592563020; bh=3Uytyvwzt4UX7mjIW5nSX3tNMM/3bhp/av3KF6qTx7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pN2LIMKgQ2C9Mr1LCcp1YtdQpWBpE2ZRylR1TTz98Ft4oFsyWbEYlH3I5pInSZyaB WiwgCTUKZFGx++brsBebUlHkj5o3nU6sUag53JJkB1RefikE1jUdTX4oXDiWvvFUhC cGZ14lfqahzylgzlOSA3ffJOc3y795UzEsDCTkUU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200619103700eucas1p1d0eaf478d3169376d5c1ae4142fe0012~Z66EMseGC0706007060eucas1p1n; Fri, 19 Jun 2020 10:37:00 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id ED.8C.06318.C459CEE5; Fri, 19 Jun 2020 11:37:00 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200619103659eucas1p15d57f701ea85df16e953bfd5098423f6~Z66D1x1_M0550605506eucas1p1n; Fri, 19 Jun 2020 10:36:59 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200619103659eusmtrp1cc184c2cf49a2fe9b3ebee1f26d43797~Z66D1GWMR0949709497eusmtrp1F; Fri, 19 Jun 2020 10:36:59 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-5a-5eec954c959f Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D5.0B.06017.B459CEE5; Fri, 19 Jun 2020 11:36:59 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200619103659eusmtip2ee4aded76d4a08a25256a4a1d9badba6~Z66DN1fjk0247402474eusmtip2Z; Fri, 19 Jun 2020 10:36:59 +0000 (GMT) From: Marek Szyprowski <m.szyprowski@samsung.com> To: dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 10/36] drm: lima: fix common struct sg_table related issues Date: Fri, 19 Jun 2020 12:36:10 +0200 Message-Id: <20200619103636.11974-11-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200619103636.11974-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKKsWRmVeSWpSXmKPExsWy7djPc7o+U9/EGeybwGrRe+4kk8XGGetZ Lf5vm8hsceXrezaLlauPMlks2G9t8XneJjaLL1ceMllsenyN1eLyrjlsFmuP3GW3OPjhCavF h7VfmRx4PdbMW8PosffbAhaPnbPusnts//aA1eN+93Emj81L6j1u/3vM7DH5xnJGj903G9g8 +rasYvT4vEkugDuKyyYlNSezLLVI3y6BK+PA8/+MBfekKt4fCmlgnCfWxcjJISFgIvHx02Xm LkYuDiGBFYwSp5qvMUI4XxglTnc3skM4nxklrr7ayArTcvXwajaIxHJGie6ONia4lnuT/jOD VLEJGEp0ve1iA7FFBFoZJU708oAUMQtcZpKYf7SJBSQh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VF4BO4l9cy+yQWyQl1i94QAziM0JFH/dchCsRkjAVmL5gvfM Exj5FjAyrGIUSS0tzk3PLTbSK07MLS7NS9dLzs/dxAiMlG3Hfm7Zwdj1LvgQowAHoxIP74uQ 13FCrIllxZW5hxglOJiVRHidzp6OE+JNSaysSi3Kjy8qzUktPsRoCnTURGYp0eR8YBTnlcQb mhqaW1gamhubG5tZKInzdggcjBESSE8sSc1OTS1ILYLpY+LglGpgnL6TPWxPnGP8ss+ROVOe J5mV7Pnc/HpFjE9lAPehy+eXT3Pad9Rae9YxkRZj7kXMCysOs9/lP2+ZGvxTwGqxlqfrAsn7 7zbOap78a+a+xbxKa6OPT/pQlBg9N6op4XDzVNlZSRsDw9P0WJWU/j7VtFj11azewejaGRsx qbPap1OLUj/+DmviU2Ipzkg01GIuKk4EAI22K9KqAgAA X-CMS-MailID: 20200619103659eucas1p15d57f701ea85df16e953bfd5098423f6 X-Msg-Generator: CA X-RootMTR: 20200619103659eucas1p15d57f701ea85df16e953bfd5098423f6 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200619103659eucas1p15d57f701ea85df16e953bfd5098423f6 References: <20200619103636.11974-1-m.szyprowski@samsung.com> <CGME20200619103659eucas1p15d57f701ea85df16e953bfd5098423f6@eucas1p1.samsung.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Cc: lima@lists.freedesktop.org, Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>, David Airlie <airlied@linux.ie>, Qiang Yu <yuq825@gmail.com>, Robin Murphy <robin.murphy@arm.com>, Christoph Hellwig <hch@lst.de>, linux-arm-kernel@lists.infradead.org, Marek Szyprowski <m.szyprowski@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> |
Series |
DRM: fix struct sg_table nents vs. orig_nents misuse
|
expand
|
diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_gem.c index 155f2b4b4030..11223fe348df 100644 --- a/drivers/gpu/drm/lima/lima_gem.c +++ b/drivers/gpu/drm/lima/lima_gem.c @@ -69,8 +69,7 @@ int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm) return ret; if (bo->base.sgt) { - dma_unmap_sg(dev, bo->base.sgt->sgl, - bo->base.sgt->nents, DMA_BIDIRECTIONAL); + dma_unmap_sgtable(dev, bo->base.sgt, DMA_BIDIRECTIONAL, 0); sg_free_table(bo->base.sgt); } else { bo->base.sgt = kmalloc(sizeof(*bo->base.sgt), GFP_KERNEL); @@ -80,7 +79,13 @@ int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm) } } - dma_map_sg(dev, sgt.sgl, sgt.nents, DMA_BIDIRECTIONAL); + ret = dma_map_sgtable(dev, &sgt, DMA_BIDIRECTIONAL, 0); + if (ret) { + sg_free_table(&sgt); + kfree(bo->base.sgt); + bo->base.sgt = NULL; + return ret; + } *bo->base.sgt = sgt; diff --git a/drivers/gpu/drm/lima/lima_vm.c b/drivers/gpu/drm/lima/lima_vm.c index 5b92fb82674a..2b2739adc7f5 100644 --- a/drivers/gpu/drm/lima/lima_vm.c +++ b/drivers/gpu/drm/lima/lima_vm.c @@ -124,7 +124,7 @@ int lima_vm_bo_add(struct lima_vm *vm, struct lima_bo *bo, bool create) if (err) goto err_out1; - for_each_sg_dma_page(bo->base.sgt->sgl, &sg_iter, bo->base.sgt->nents, 0) { + for_each_sgtable_dma_page(bo->base.sgt, &sg_iter, 0) { err = lima_vm_map_page(vm, sg_page_iter_dma_address(&sg_iter), bo_va->node.start + offset); if (err) @@ -298,8 +298,7 @@ int lima_vm_map_bo(struct lima_vm *vm, struct lima_bo *bo, int pageoff) mutex_lock(&vm->lock); base = bo_va->node.start + (pageoff << PAGE_SHIFT); - for_each_sg_dma_page(bo->base.sgt->sgl, &sg_iter, - bo->base.sgt->nents, pageoff) { + for_each_sgtable_dma_page(bo->base.sgt, &sg_iter, pageoff) { err = lima_vm_map_page(vm, sg_page_iter_dma_address(&sg_iter), base + offset); if (err)