From patchwork Tue Apr 7 13:42:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 185237 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp4879011ilr; Tue, 7 Apr 2020 06:43:28 -0700 (PDT) X-Google-Smtp-Source: APiQypKqV1znLAtwjEOy6pwgv+HrmPh2wgdqvzP1ARKz4TxQYt8esPkQtkXvbCcD3eDcK8VF39WB X-Received: by 2002:a17:90a:e398:: with SMTP id b24mr2834837pjz.113.1586267008060; Tue, 07 Apr 2020 06:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586267008; cv=none; d=google.com; s=arc-20160816; b=pIdXFvwXTk+Ts3PqSMoERijhHvnL8EULCC9dhYh7VoWw1YfW6X/kU57bOnckHsv5Zh KCiyZa3j0fxEUsLEmiSMOxOelfmHKAmtJR4aI9uQqoZ5+Ry6edvGHNXB+jPNgusWgCv6 xmHp100TZ7RtTKU8tMGjdC/Jy1XuFajK+h81edOHen0eHcztfBH1ROB4CEe+G+065UdU 7hxHfKltbB7eA+QOEJ/gNxRilijg7Y7AYcYGaPvm975tOEXWTrrLo8glSE5xN1lRiRap JvvtnijeRc1FvRJ3ADXODRwqv0VuZotdEfru5L0IR/Lb3UlPJut4RsZj+tm+s71IQiA8 qgVA== 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=vj57medCRnj/CI+Xpoupov5HSzJeWn02TPQC6MaFDMA=; b=GNumfldpyyFIZxzrYTd4PInFNn1y3/r5hf2v/v5uzoESiLQ22h9m+6mk21/3mcrYWQ TcNwyulrPdo8mb32tM3AXaSwuyn6yXQa+7/3VNBCCx57NkUaP2IIh5rUVkdGDEvQ8eua Bov8/ZSzRoNTh9xrIGfQNeI9674fbiXDWlTXC+s4qT0+1YuFTcbg3/4DVuqq99DBL5y6 /Eq0G+gKAeVa/v5ntXo1izwviBlQ5yFkLDOZKQ00qCzwGB5v5c/kh3BBapfvn/hD1Mzu Mm7EazSz3GV0HslCgFbtkes/1Ix2vHnfQe92aMeF2pilgVdkWbcVw1MdRS/CY4YalbW9 f5Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=YUjJ2ic0; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id w12si1455475pjb.48.2020.04.07.06.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 06:43:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=YUjJ2ic0; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 0AC196E87C; Tue, 7 Apr 2020 13:43:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C3936E87C for ; Tue, 7 Apr 2020 13:43:16 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200407134314euoutp0218ab7499b1615660c575b35e00921155~DjW1X04nW1158911589euoutp02z for ; Tue, 7 Apr 2020 13:43:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200407134314euoutp0218ab7499b1615660c575b35e00921155~DjW1X04nW1158911589euoutp02z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1586266994; bh=bcEbGrmufxbXH+41WsayCMBUWxXhEu+MfRalXv8WG9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YUjJ2ic0bZU1MqCL2a0PGU7PL986fg3QUL0lRh+05aU1cAbGAWlosHCycidSosNXz YBJ94RnBhUf+3yi/NHBRY1LndFblDbkHAQZb3pstITVrxIzMmIk0gQb+DOtWvj6pef 7Y/pSrmN/3I7HojKIMdQ/sb0gtYl3LOFbay/5F80= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200407134314eucas1p2097b0503072026f981cc4edef732b529~DjW1AnC5T1024810248eucas1p2C; Tue, 7 Apr 2020 13:43:14 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 1B.7D.61286.2738C8E5; Tue, 7 Apr 2020 14:43:14 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200407134313eucas1p1a86ed9bd35c8f1eb88a09c32fb949335~DjW0sw4oB1682116821eucas1p1M; Tue, 7 Apr 2020 13:43:13 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200407134313eusmtrp216bead281ec23c828a449a1f5d9fc2ec~DjW0sJiI83117631176eusmtrp2u; Tue, 7 Apr 2020 13:43:13 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-3b-5e8c8372ce52 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 71.9D.07950.1738C8E5; Tue, 7 Apr 2020 14:43:13 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200407134313eusmtip1701220988246e3badca2340d232866ed~DjW0VPHiN0417004170eusmtip1x; Tue, 7 Apr 2020 13:43:13 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 1/3] drm/exynos: gem: Remove dead-code Date: Tue, 7 Apr 2020 15:42:54 +0200 Message-Id: <20200407134256.9129-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407134256.9129-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPIsWRmVeSWpSXmKPExsWy7djPc7pFzT1xBve+sVncWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbjFj8ks2B3aP+93HmTz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoErY8bkioLpohUX7nA0MPYJdTFycEgImEg8OG3RxcjFISSwglHi8ZWHzBDOF0aJJ/0n 2SCcz4wSXb9mMsF0zJpSDRFfzijRvGozK1zHph9dQO2cHGwChhJdb7vYQGwRATeJpsMzwYqY Ba4zSnz7sYgdJCEsYCbRdvM2mM0ioCrx5fg/sAZeARuJjy9fgNkSAvISqzccABvKKWArcWHH LrBBEgKP2STWTlrBCHGSi8Svy7wQ9cISr45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JK4g1NDc0tLA3Njc2NzSyUxHk7BA7G CAmkJ5akZqemFqQWwfQxcXBKNTCmHn9gcG6bQv6mBUeNJTtWpL8Ouu3FYaJ++8WkSV8MHzCX fRNhT/E+fXLlqWfCz3x9TjHeCzZdrnrv7/Mj/68feRNz5V9vl+3MGPZ3J9Ter3qTeUDFxOW+ jZOshOCEhwranxfpay843XTuDesxgSBdS9m0Fc3nv11/dHZZzf+IzZdmuB4ScNd7qMRSnJFo qMVcVJwIAOtiOtlkAgAA X-CMS-MailID: 20200407134313eucas1p1a86ed9bd35c8f1eb88a09c32fb949335 X-Msg-Generator: CA X-RootMTR: 20200407134313eucas1p1a86ed9bd35c8f1eb88a09c32fb949335 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200407134313eucas1p1a86ed9bd35c8f1eb88a09c32fb949335 References: <20200407134256.9129-1-m.szyprowski@samsung.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Seung-Woo Kim , Marek Szyprowski MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The ExynosDRM page fault handler is never used, drm_gem_mmap() always calls exynos_drm_gem_mmap() function, which perform complete mapping for the given virtual address-space area. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 - drivers/gpu/drm/exynos/exynos_drm_gem.c | 20 -------------------- drivers/gpu/drm/exynos/exynos_drm_gem.h | 3 --- 3 files changed, 24 deletions(-) -- 2.17.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 57defeb44522..dbd80f1e4c78 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -76,7 +76,6 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) } static const struct vm_operations_struct exynos_drm_gem_vm_ops = { - .fault = exynos_drm_gem_fault, .open = drm_gem_vm_open, .close = drm_gem_vm_close, }; diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index d734d9d51762..40514d3dcf60 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -381,26 +381,6 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, return 0; } -vm_fault_t exynos_drm_gem_fault(struct vm_fault *vmf) -{ - struct vm_area_struct *vma = vmf->vma; - struct drm_gem_object *obj = vma->vm_private_data; - struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj); - unsigned long pfn; - pgoff_t page_offset; - - page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT; - - if (page_offset >= (exynos_gem->size >> PAGE_SHIFT)) { - DRM_ERROR("invalid page offset\n"); - return VM_FAULT_SIGBUS; - } - - pfn = page_to_pfn(exynos_gem->pages[page_offset]); - return vmf_insert_mixed(vma, vmf->address, - __pfn_to_pfn_t(pfn, PFN_DEV)); -} - static int exynos_drm_gem_mmap_obj(struct drm_gem_object *obj, struct vm_area_struct *vma) { diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index 42ec67bc262d..f00044c0b688 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h @@ -101,9 +101,6 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev, struct drm_mode_create_dumb *args); -/* page fault handler and mmap fault address(virtual) to physical memory. */ -vm_fault_t exynos_drm_gem_fault(struct vm_fault *vmf); - /* set vm_flags and we can change the vm attribute to other one at here. */ int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); From patchwork Tue Apr 7 13:42:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 185234 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp4878885ilr; Tue, 7 Apr 2020 06:43:19 -0700 (PDT) X-Google-Smtp-Source: APiQypJ5ZU2skFJ+yqPw23BKjeAE+l6n7vSGwnTmuahqkAUV2pRkCTS5VQqDFJfwCo/9Vz2ciuFM X-Received: by 2002:a65:5249:: with SMTP id q9mr2119731pgp.150.1586266999779; Tue, 07 Apr 2020 06:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586266999; cv=none; d=google.com; s=arc-20160816; b=0GERNSB0AkLwoEm5dp2NARZXIbnMOEz1zYL8Shn9nPthBva83lcQ2JYa47gu3JqGH7 CtEv3fip0bTqrVfKv3wHUebhUKkiIrHmgqslUlrvVnc64EFaXE2BSQ5XRUmpuPMieNO3 JAjnBU+nN6oba1HMx0b19tN0m2bjm7ZZ2HqYhMtVqT44bsN2lQiRL+kzoLizbp+YNivQ tKrNoebzmrV3Dj7OMifRh2LEjoFKvXbnQUPl68gLp5soy+cFPE0Nd9osF9j76okqYdec nsGzNe9QSzj/HrwafQT+CN6TKcsU7MC8l9yfvSQeMWtrf8Y5/AkHRYvlteLuiEfHK9v7 0T+Q== 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=cgt9dFM+iZNFe5H8Y9Hlat3SMATwfoclp0nkREyM9bg=; b=dNlesD3/Ebx9cHHIq5YcLeXiNnirnayRGFIIC/vwbhGRrk8LLkwO5zW/uGhhTVVLgp sqlBs8+CdEp+yipRDvKDVBeIsCOTfMVEoe/Zkc/pxffXSeqq0ITJSZW5Pzi61Ets+LtL pLP9WFmMsb/ISbRAXROScBA7mqDFuEaNdVJgvXHebepnvPRZ+eDHCEjXZ7Mnw++Okt3d p2MBc8NSDszyCrJFBhGd/ltYSweYcRW1yiXcfc9sqlPWyeNYX255R5nvoNpFYLAaNQYk zC7vABbDekPrU5ZwNO2XaqLvUqQQ7ZDRqozNJlLBANRDZi10z51vG6xC7QUMirc0klh2 JZFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=DVGYFnyE; 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: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id m66si2391292pga.142.2020.04.07.06.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 06:43: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=DVGYFnyE; 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 DA5E76E0CF; Tue, 7 Apr 2020 13:43:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6BFFE6E877 for ; Tue, 7 Apr 2020 13:43:16 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200407134314euoutp0225b054e87e5a66bd4a07450f2a92d2b2~DjW1uDOYA1214712147euoutp02k for ; Tue, 7 Apr 2020 13:43:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200407134314euoutp0225b054e87e5a66bd4a07450f2a92d2b2~DjW1uDOYA1214712147euoutp02k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1586266994; bh=uUJPJklxt2/uUOtgdn6uJV4flK8igVvMSY2AWPBTxJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DVGYFnyEUJv7Kn1JIww48VaDk5Wyt3uMp3fmOre88l8cE6ihedR/cVrhAcvJMlWcE dPALVymfjGLU0blUNmTo5lVkxV5V5zv/TnACy/vVKfLGbzQvkDQxu1tjEb9g4Tyf81 T1wnbF+sJH5z164bY1+K9mNHgDchpA2o9U6fgsa0= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200407134314eucas1p272ee27a69f80f2cdf2ac7a47f70206db~DjW1fuAnf1027710277eucas1p23; Tue, 7 Apr 2020 13:43:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 6A.29.60679.2738C8E5; Tue, 7 Apr 2020 14:43:14 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200407134314eucas1p1bfe654163e093db30c4a31bd9e1ccada~DjW1GtrHh2294322943eucas1p1M; Tue, 7 Apr 2020 13:43:14 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200407134314eusmtrp1d24b5b06ed49b2401fc61d6e9d9b3b94~DjW1GKALX2889128891eusmtrp1g; Tue, 7 Apr 2020 13:43:14 +0000 (GMT) X-AuditID: cbfec7f4-0cbff7000001ed07-19-5e8c837269d7 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id DF.1F.08375.2738C8E5; Tue, 7 Apr 2020 14:43:14 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200407134313eusmtip1fcd91bb01cba8ba97798ce970718f163~DjW0q9YlM0251902519eusmtip1o; Tue, 7 Apr 2020 13:43:13 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 2/3] drm/exynos: gem: Rework scatter-list contiguity check on Prime import Date: Tue, 7 Apr 2020 15:42:55 +0200 Message-Id: <20200407134256.9129-3-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407134256.9129-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrEIsWRmVeSWpSXmKPExsWy7djP87pFzT1xBo+XqVvcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbjFj8ks2B3aP+93HmTz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoErY/HcxewFkwUrdh74w9LA+IK3i5GTQ0LAROL49E3MXYxcHEICKxgl/j7uZIVwvjBK vNzzlQ3C+cwo0fz3MiNMS8vqfUwQieWMEstugiSgWn5f38cKUsUmYCjR9baLDcQWEXCTaDo8 E2wus8B1RolvPxaxgySEBWIkpq2dwQJiswioSnxuOARUxMHBK2AjsWCVCcQ2eYnVGw4wg9ic ArYSF3b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5ilOBgVhLh lertjBPiTUmsrEotyo8vKs1JLT7EaAp000RmKdHkfGDs5JXEG5oamltYGpobmxubWSiJ83YI HIwREkhPLEnNTk0tSC2C6WPi4JRqYPRorg6s9Itp/yb5MU+TjV12VZVMY4IJn492A+Pj653F 5y+6vgj+VLT5n+mhKYGrPlifW+6er/Dhp/WSjJTbViqr05Mexle5/qy8+eygfILarsXGsunX 43/Zv/n6/2RbYkvv001TupXjrB+XV0dEOIUqOy+LONe46FeAUm2TX7b4+Rvhgc/1lFiKMxIN tZiLihMBOB3UgWUCAAA= X-CMS-MailID: 20200407134314eucas1p1bfe654163e093db30c4a31bd9e1ccada X-Msg-Generator: CA X-RootMTR: 20200407134314eucas1p1bfe654163e093db30c4a31bd9e1ccada X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200407134314eucas1p1bfe654163e093db30c4a31bd9e1ccada References: <20200407134256.9129-1-m.szyprowski@samsung.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Seung-Woo Kim , Marek Szyprowski MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Explicitly check if the imported buffer has been mapped as contiguous in the DMA address space, what is required by all Exynos DRM CRTC drivers. While touching this, set buffer flags depending on the availability of the IOMMU. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 36 +++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) -- 2.17.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 40514d3dcf60..9d4e4d321bda 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -458,6 +458,23 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev, int npages; int ret; + 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)) + continue; + 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); + } + return ERR_PTR(-EINVAL); + } + exynos_gem = exynos_drm_gem_init(dev, attach->dmabuf->size); if (IS_ERR(exynos_gem)) { ret = PTR_ERR(exynos_gem); @@ -480,18 +497,15 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev, exynos_gem->sgt = sgt; - if (sgt->nents == 1) { - /* always physically continuous memory if sgt->nents is 1. */ - exynos_gem->flags |= EXYNOS_BO_CONTIG; - } else { - /* - * this case could be CONTIG or NONCONTIG type but for now - * sets NONCONTIG. - * TODO. we have to find a way that exporter can notify - * the type of its own buffer to importer. - */ + /* + * Buffer has been mapped as contiguous into DMA address space, + * but if there is IOMMU, it can be either CONTIG or NONCONTIG. + * We assume a simplified logic below: + */ + if (is_drm_iommu_supported(dev)) exynos_gem->flags |= EXYNOS_BO_NONCONTIG; - } + else + exynos_gem->flags |= EXYNOS_BO_CONTIG; return &exynos_gem->base; From patchwork Tue Apr 7 13:42:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 185235 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp4878954ilr; Tue, 7 Apr 2020 06:43:23 -0700 (PDT) X-Google-Smtp-Source: APiQypJzFCYlLeYN3SMqUp/kiABsM3CNqR/mHmY0+k3yErZkepki9Yp317eEsMQHqNWG3gg9/Jfp X-Received: by 2002:a63:f95c:: with SMTP id q28mr2110069pgk.321.1586267003690; Tue, 07 Apr 2020 06:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586267003; cv=none; d=google.com; s=arc-20160816; b=G37KgyDfQojP4O8qf6F3CzBnR+3q8caQzPUiNzGnZ+s8gIlduAD06vBw+Zjl+zZF7z Zg9rZ4wb2mnVS2YqdE8J1/rMMSEHGDE9iBZ98Jbxts4MumdmlvWfwdOFPvqmqzetZ3fG sBc+7HOVnc4w7HMfI5CDgqbFASE7ONkM7an+vgAwaFiXNuoBbxqQA3HoWXHxHm89n1SU rzu5c/SPa6k03n0RuThE64mB8A17g2bgnka4e3c3y9khDX4k/iZTxSs0aR7u+6eYfCnp cyOSi1q9y3WB1EmANNPGIrRRCfzZ0LKz42LsiEQ74puF5yRP6TiBKpY0ohFcd8eageg7 9emg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:references:cms-type:mime-version:in-reply-to:message-id :date:subject:to:from:dkim-signature:dkim-filter:delivered-to; bh=GFYsRrgrngzuFhabbzVW5mIQsQQEi1QqbwP2iBx03Rc=; b=CmVmNjj+yDMxFWRDiEh0idgo1T5X/yCMV/DlwBsMKuAl5EympXSAE5D3JEXK1+cpbI NQebQp3UdRIGjd5Kr56WHKsn6I7vJqBC7dwTnvPMpOBhum/IYjvE6izJNnCRluV/c25s Belkn40W80bDi7BbwPNxFbvAGqUS0NYYfLGuku5DCRPgIv7KWEkKjgzisONELV6kgI1Q QQ5/tlyqXN1V7t6oRf6RxYBXAFtMix/pyGDEv3icAjgCC+joA0gQ7x7HIGc9AzYpdeF+ lYEzlFwJYjPBJ20QYq1mWwUV62TC/J8BTxH2lSp7Kn3d6OwFpFwaYrxkwy/BnRUh2y+x Hg3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b="Ud4pMDH/"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id r23si2411565pgo.443.2020.04.07.06.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 06:43:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b="Ud4pMDH/"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 067156E877; Tue, 7 Apr 2020 13:43:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id A45566E87E for ; Tue, 7 Apr 2020 13:43:16 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200407134315euoutp02c16c5d6885f0971f208c04a689bf9423~DjW2L6nfN1155011550euoutp02B for ; Tue, 7 Apr 2020 13:43:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200407134315euoutp02c16c5d6885f0971f208c04a689bf9423~DjW2L6nfN1155011550euoutp02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1586266995; bh=TyyQfhEc1u2kAJ8LAO4nnLnGsh3p7Of0VJXjvuRadoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ud4pMDH/2x1nHKnaj6bxTeiCkRJXnYj5qhz5UBrEIw0FQe04yVBxvRBK2t0jU880+ axRsnvq/WSsdHc4BFl2+5zJ6wkmNosfRavmXEkWMRTa5HBJMpi54bwlW6v2raP0IaX ombC5RkfSXfBMvKL8nPqqcuytC8OrUSX1AHKVOyQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200407134315eucas1p11b8ea3f2d65c5a9bccc2907a2b2e413e~DjW19rk9f0333903339eucas1p11; Tue, 7 Apr 2020 13:43:15 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id A2.DC.60698.3738C8E5; Tue, 7 Apr 2020 14:43:15 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200407134314eucas1p1895d868d9dbf5eee08c675dd10266d81~DjW1dp0ZE2294322943eucas1p1Q; Tue, 7 Apr 2020 13:43:14 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200407134314eusmtrp16623a828f9a6d1d1922a7dc36355bfc8~DjW1dH9Lf2789027890eusmtrp1O; Tue, 7 Apr 2020 13:43:14 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-c8-5e8c83732941 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 50.2F.08375.2738C8E5; Tue, 7 Apr 2020 14:43:14 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200407134314eusmtip1242fa0534add2d07a7157963de415d1b~DjW1BV0GN0417004170eusmtip1y; Tue, 7 Apr 2020 13:43:14 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 3/3] drm/exynos: gem: Get rid of the internal 'pages' array Date: Tue, 7 Apr 2020 15:42:56 +0200 Message-Id: <20200407134256.9129-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407134256.9129-1-m.szyprowski@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCKsWRmVeSWpSXmKPExsWy7djP87rFzT1xBnc3slncWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbjFj8ks2B3aP+93HmTz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoEr4//Mm0wFGxIrPnT/Zm9g/OHfxcjBISFgIrGoq66LkYtDSGAFo8Tc06dZIZwvjBIz vvawQDifGSWO7JjM3sXICdZxadYDJhBbSGA5o8SxecwQNlDH5GseIDabgKFE19suNhBbRMBN ounwTLCpzALXGSW+/VgENkhYwFti/6FNjCA2i4CqxJOmVWCDeAVsJCZfvgm1TF5i9YYDYHFO AVuJCzt2sULUCEqcnPmEBcRmBqpp3jqbGWSBhMBkdom3h++yQTS7SJy7sQ5qkLDEq+NboGwZ idOTIV6TEGhmlHh4bi07hNPDKHG5aQYjRJW1xJ1zv9hAocQsoCmxfpc+RNhR4tLVi8yQwOOT uPFWEOIIPolJ26ZDhXklOtqEIKrVJGYdXwe39uCFS8wQtofE0Wf7WCcwKs5C8s4sJO/MQti7 gJF5FaN4amlxbnpqsXFearlecWJucWleul5yfu4mRmBaOf3v+NcdjPv+JB1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FR+29RZKz179fsGfqmooJzHd7CrsWHe9cHK1f 9fjEWhcHCe7Nv3jOZfLoaDwWvvOwxM+MccVDlXRzJZbijERDLeai4kQAi6qhQ60CAAA= X-CMS-MailID: 20200407134314eucas1p1895d868d9dbf5eee08c675dd10266d81 X-Msg-Generator: CA X-RootMTR: 20200407134314eucas1p1895d868d9dbf5eee08c675dd10266d81 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200407134314eucas1p1895d868d9dbf5eee08c675dd10266d81 References: <20200407134256.9129-1-m.szyprowski@samsung.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Seung-Woo Kim , Marek Szyprowski Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Internal pages array and scatter-list for them is not really needed for anything. FBDev emulation can simply rely on the DMA-mapping framework to create a proper kernel mapping for the buffer, while all other buffer use cases don't really need that array at all. Suggested-by: Christian König Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 28 +---- drivers/gpu/drm/exynos/exynos_drm_gem.c | 124 +++++++--------------- drivers/gpu/drm/exynos/exynos_drm_gem.h | 13 +-- 3 files changed, 42 insertions(+), 123 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index e6ceaf36fb04..56a2b47e1af7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -76,7 +76,6 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, struct fb_info *fbi; struct drm_framebuffer *fb = helper->fb; unsigned int size = fb->width * fb->height * fb->format->cpp[0]; - unsigned int nr_pages; unsigned long offset; fbi = drm_fb_helper_alloc_fbi(helper); @@ -90,16 +89,6 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, drm_fb_helper_fill_info(fbi, helper, sizes); - nr_pages = exynos_gem->size >> PAGE_SHIFT; - - exynos_gem->kvaddr = (void __iomem *) vmap(exynos_gem->pages, nr_pages, - VM_MAP, pgprot_writecombine(PAGE_KERNEL)); - if (!exynos_gem->kvaddr) { - DRM_DEV_ERROR(to_dma_dev(helper->dev), - "failed to map pages to kernel space.\n"); - return -EIO; - } - offset = fbi->var.xoffset * fb->format->cpp[0]; offset += fbi->var.yoffset * fb->pitches[0]; @@ -133,18 +122,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, size = mode_cmd.pitches[0] * mode_cmd.height; - exynos_gem = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG, size); - /* - * If physically contiguous memory allocation fails and if IOMMU is - * supported then try to get buffer from non physically contiguous - * memory area. - */ - if (IS_ERR(exynos_gem) && is_drm_iommu_supported(dev)) { - dev_warn(dev->dev, "contiguous FB allocation failed, falling back to non-contiguous\n"); - exynos_gem = exynos_drm_gem_create(dev, EXYNOS_BO_NONCONTIG, - size); - } - + exynos_gem = exynos_drm_gem_create(dev, EXYNOS_BO_WC, size, true); if (IS_ERR(exynos_gem)) return PTR_ERR(exynos_gem); @@ -229,12 +207,8 @@ int exynos_drm_fbdev_init(struct drm_device *dev) static void exynos_drm_fbdev_destroy(struct drm_device *dev, struct drm_fb_helper *fb_helper) { - struct exynos_drm_fbdev *exynos_fbd = to_exynos_fbdev(fb_helper); - struct exynos_drm_gem *exynos_gem = exynos_fbd->exynos_gem; struct drm_framebuffer *fb; - vunmap(exynos_gem->kvaddr); - /* release drm framebuffer and real buffer */ if (fb_helper->fb && fb_helper->fb->funcs) { fb = fb_helper->fb; diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 9d4e4d321bda..3c2732380517 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -17,28 +17,23 @@ #include "exynos_drm_drv.h" #include "exynos_drm_gem.h" -static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem) +static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem, bool kvmap) { struct drm_device *dev = exynos_gem->base.dev; - unsigned long attr; - unsigned int nr_pages; - struct sg_table sgt; - int ret = -ENOMEM; + unsigned long attr = 0; if (exynos_gem->dma_addr) { DRM_DEV_DEBUG_KMS(to_dma_dev(dev), "already allocated.\n"); return 0; } - exynos_gem->dma_attrs = 0; - /* * if EXYNOS_BO_CONTIG, fully physically contiguous memory * region will be allocated else physically contiguous * as possible. */ if (!(exynos_gem->flags & EXYNOS_BO_NONCONTIG)) - exynos_gem->dma_attrs |= DMA_ATTR_FORCE_CONTIGUOUS; + attr |= DMA_ATTR_FORCE_CONTIGUOUS; /* * if EXYNOS_BO_WC or EXYNOS_BO_NONCACHABLE, writecombine mapping @@ -46,61 +41,29 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem) */ if (exynos_gem->flags & EXYNOS_BO_WC || !(exynos_gem->flags & EXYNOS_BO_CACHABLE)) - attr = DMA_ATTR_WRITE_COMBINE; + attr |= DMA_ATTR_WRITE_COMBINE; else - attr = DMA_ATTR_NON_CONSISTENT; - - exynos_gem->dma_attrs |= attr; - exynos_gem->dma_attrs |= DMA_ATTR_NO_KERNEL_MAPPING; - - nr_pages = exynos_gem->size >> PAGE_SHIFT; + attr |= DMA_ATTR_NON_CONSISTENT; - exynos_gem->pages = kvmalloc_array(nr_pages, sizeof(struct page *), - GFP_KERNEL | __GFP_ZERO); - if (!exynos_gem->pages) { - DRM_DEV_ERROR(to_dma_dev(dev), "failed to allocate pages.\n"); - return -ENOMEM; - } + /* FBDev emulation requires kernel mapping */ + if (!kvmap) + attr |= DMA_ATTR_NO_KERNEL_MAPPING; + exynos_gem->dma_attrs = attr; exynos_gem->cookie = dma_alloc_attrs(to_dma_dev(dev), exynos_gem->size, &exynos_gem->dma_addr, GFP_KERNEL, exynos_gem->dma_attrs); if (!exynos_gem->cookie) { DRM_DEV_ERROR(to_dma_dev(dev), "failed to allocate buffer.\n"); - goto err_free; - } - - ret = dma_get_sgtable_attrs(to_dma_dev(dev), &sgt, exynos_gem->cookie, - exynos_gem->dma_addr, exynos_gem->size, - exynos_gem->dma_attrs); - if (ret < 0) { - DRM_DEV_ERROR(to_dma_dev(dev), "failed to get sgtable.\n"); - goto err_dma_free; - } - - if (drm_prime_sg_to_page_addr_arrays(&sgt, exynos_gem->pages, NULL, - nr_pages)) { - DRM_DEV_ERROR(to_dma_dev(dev), "invalid sgtable.\n"); - ret = -EINVAL; - goto err_sgt_free; + return -ENOMEM; } - sg_free_table(&sgt); + if (kvmap) + exynos_gem->kvaddr = exynos_gem->cookie; DRM_DEV_DEBUG_KMS(to_dma_dev(dev), "dma_addr(0x%lx), size(0x%lx)\n", (unsigned long)exynos_gem->dma_addr, exynos_gem->size); - return 0; - -err_sgt_free: - sg_free_table(&sgt); -err_dma_free: - dma_free_attrs(to_dma_dev(dev), exynos_gem->size, exynos_gem->cookie, - exynos_gem->dma_addr, exynos_gem->dma_attrs); -err_free: - kvfree(exynos_gem->pages); - - return ret; } static void exynos_drm_free_buf(struct exynos_drm_gem *exynos_gem) @@ -118,8 +81,6 @@ static void exynos_drm_free_buf(struct exynos_drm_gem *exynos_gem) dma_free_attrs(to_dma_dev(dev), exynos_gem->size, exynos_gem->cookie, (dma_addr_t)exynos_gem->dma_addr, exynos_gem->dma_attrs); - - kvfree(exynos_gem->pages); } static int exynos_drm_gem_handle_create(struct drm_gem_object *obj, @@ -203,7 +164,8 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev, struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev, unsigned int flags, - unsigned long size) + unsigned long size, + bool kvmap) { struct exynos_drm_gem *exynos_gem; int ret; @@ -237,7 +199,7 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev, /* set memory type and cache attribute from user side. */ exynos_gem->flags = flags; - ret = exynos_drm_alloc_buf(exynos_gem); + ret = exynos_drm_alloc_buf(exynos_gem, kvmap); if (ret < 0) { drm_gem_object_release(&exynos_gem->base); kfree(exynos_gem); @@ -254,7 +216,7 @@ int exynos_drm_gem_create_ioctl(struct drm_device *dev, void *data, struct exynos_drm_gem *exynos_gem; int ret; - exynos_gem = exynos_drm_gem_create(dev, args->flags, args->size); + exynos_gem = exynos_drm_gem_create(dev, args->flags, args->size, false); if (IS_ERR(exynos_gem)) return PTR_ERR(exynos_gem); @@ -365,7 +327,7 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, else flags = EXYNOS_BO_CONTIG | EXYNOS_BO_WC; - exynos_gem = exynos_drm_gem_create(dev, flags, args->size); + exynos_gem = exynos_drm_gem_create(dev, flags, args->size, false); if (IS_ERR(exynos_gem)) { dev_warn(dev->dev, "FB allocation failed.\n"); return PTR_ERR(exynos_gem); @@ -442,11 +404,24 @@ struct drm_gem_object *exynos_drm_gem_prime_import(struct drm_device *dev, struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj) { struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj); - int npages; + struct drm_device *drm_dev = obj->dev; + struct sg_table *sgt; + int ret; + + sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); + if (!sgt) + return ERR_PTR(-ENOMEM); - npages = exynos_gem->size >> PAGE_SHIFT; + ret = dma_get_sgtable_attrs(to_dma_dev(drm_dev), sgt, exynos_gem->cookie, + exynos_gem->dma_addr, exynos_gem->size, + exynos_gem->dma_attrs); + if (ret) { + DRM_ERROR("failed to get sgtable, %d\n", ret); + kfree(sgt); + return ERR_PTR(ret); + } - return drm_prime_pages_to_sg(exynos_gem->pages, npages); + return sgt; } struct drm_gem_object * @@ -455,8 +430,6 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev, struct sg_table *sgt) { struct exynos_drm_gem *exynos_gem; - int npages; - int ret; if (sgt->nents != 1) { dma_addr_t next_addr = sg_dma_address(sgt->sgl); @@ -476,26 +449,8 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev, } exynos_gem = exynos_drm_gem_init(dev, attach->dmabuf->size); - if (IS_ERR(exynos_gem)) { - ret = PTR_ERR(exynos_gem); - return ERR_PTR(ret); - } - - exynos_gem->dma_addr = sg_dma_address(sgt->sgl); - - npages = exynos_gem->size >> PAGE_SHIFT; - exynos_gem->pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL); - if (!exynos_gem->pages) { - ret = -ENOMEM; - goto err; - } - - ret = drm_prime_sg_to_page_addr_arrays(sgt, exynos_gem->pages, NULL, - npages); - if (ret < 0) - goto err_free_large; - - exynos_gem->sgt = sgt; + if (IS_ERR(exynos_gem)) + return ERR_CAST(exynos_gem); /* * Buffer has been mapped as contiguous into DMA address space, @@ -507,14 +462,9 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev, else exynos_gem->flags |= EXYNOS_BO_CONTIG; + exynos_gem->dma_addr = sg_dma_address(sgt->sgl); + exynos_gem->sgt = sgt; return &exynos_gem->base; - -err_free_large: - kvfree(exynos_gem->pages); -err: - drm_gem_object_release(&exynos_gem->base); - kfree(exynos_gem); - return ERR_PTR(ret); } void *exynos_drm_gem_prime_vmap(struct drm_gem_object *obj) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index f00044c0b688..6ef001f890aa 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h @@ -21,20 +21,15 @@ * @base: a gem object. * - a new handle to this gem object would be created * by drm_gem_handle_create(). - * @buffer: a pointer to exynos_drm_gem_buffer object. - * - contain the information to memory region allocated - * by user request or at framebuffer creation. - * continuous memory region allocated by user request - * or at framebuffer creation. * @flags: indicate memory type to allocated buffer and cache attruibute. * @size: size requested from user, in bytes and this size is aligned * in page unit. * @cookie: cookie returned by dma_alloc_attrs - * @kvaddr: kernel virtual address to allocated memory region. + * @kvaddr: kernel virtual address to allocated memory region (for fbdev) * @dma_addr: bus address(accessed by dma) to allocated memory region. * - this address could be physical address without IOMMU and * device address with IOMMU. - * @pages: Array of backing pages. + * @dma_attrs: attrs passed dma mapping framework * @sgt: Imported sg_table. * * P.S. this object would be transferred to user as kms_bo.handle so @@ -48,7 +43,6 @@ struct exynos_drm_gem { void __iomem *kvaddr; dma_addr_t dma_addr; unsigned long dma_attrs; - struct page **pages; struct sg_table *sgt; }; @@ -58,7 +52,8 @@ void exynos_drm_gem_destroy(struct exynos_drm_gem *exynos_gem); /* create a new buffer with gem object */ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev, unsigned int flags, - unsigned long size); + unsigned long size, + bool kvmap); /* * request gem object creation and buffer allocation as the size