From patchwork Mon Mar 20 10:56:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 95514 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp883720qgd; Mon, 20 Mar 2017 04:03:39 -0700 (PDT) X-Received: by 10.98.18.216 with SMTP id 85mr32680488pfs.131.1490007819489; Mon, 20 Mar 2017 04:03:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si17082225pgf.338.2017.03.20.04.03.39; Mon, 20 Mar 2017 04:03:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754273AbdCTLAx (ORCPT + 4 others); Mon, 20 Mar 2017 07:00:53 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:30564 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753331AbdCTK5J (ORCPT ); Mon, 20 Mar 2017 06:57:09 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ON400DIL12PV920@mailout3.w1.samsung.com>; Mon, 20 Mar 2017 10:56:49 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170320105649eucas1p1315b5e280e48e803e9e5ac3d1c044db5~tkdgmoIZF0560205602eucas1p1X; Mon, 20 Mar 2017 10:56:49 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 38.D1.30614.075BFC85; Mon, 20 Mar 2017 10:56:49 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170320105648eucas1p29654616c7d29c45abdc3c2ba002126ec~tkdf852Bg2243122431eucas1p2Z; Mon, 20 Mar 2017 10:56:48 +0000 (GMT) X-AuditID: cbfec7f1-f793f6d000007796-79-58cfb5707851 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AF.D7.06687.AD5BFC85; Mon, 20 Mar 2017 10:58:34 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ON4005OP12KYT20@eusync4.samsung.com>; Mon, 20 Mar 2017 10:56:48 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH v3 00/16] Exynos MFC v6+ - remove the need for the reserved memory Date: Mon, 20 Mar 2017 11:56:26 +0100 Message-id: <1490007402-30265-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsWy7djPc7qFW89HGCyXtbi17hyrxaT7E1gs zp/fwG7Rs2Erq8WM8/uYLNYeuctucfhNO5A7+SWbA4fHplWdbB59W1YxenzeJBfAHMVlk5Ka k1mWWqRvl8CVceTtG6aCV5oV954+ZmxgvKvYxcjJISFgItGyfyojhC0mceHeerYuRi4OIYGl jBIffzxjgXA+M0p8OnubGabjxoMWdojEMkaJK9fWMUM4DUwSj152g81iEzCU6HrbxQZiiwg4 SSyc9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tj3fIQQb0piZVVqUX58 UWlOavEhRlOg5ROZpUST84HxklcSb2hiaG5paGRsYWFuZKQkzlvy4Uq4kEB6YklqdmpqQWoR TB8TB6dUA6NTQeEb8V2PBbw7i0OWNqpc+Gm3eM+6STb3Pkf8mrHuXdidRTZr1085lb6z6/yX Wk67C5J7KrK0iv3inK/V2cgvLwuXMX0x0cdJ5M7t/saoNeaeOn36TXo3+/SUjPuS570V1tnw 8fn+detWF/wNrYne9jRi559CC52tItp6wqqSRi96yrM/+yqxFGckGmoxFxUnAgCARLv+XwIA AA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170320105648eucas1p29654616c7d29c45abdc3c2ba002126ec X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170320105648eucas1p29654616c7d29c45abdc3c2ba002126ec X-RootMTR: 20170320105648eucas1p29654616c7d29c45abdc3c2ba002126ec References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Dear All, This patchset is a result of my work on enabling full support for MFC device (multimedia codec) on Exynos 5433 on ARM64 architecture. Initially I thought that to let it working on ARM64 architecture with IOMMU, I would need to solve the issue related to the fact that s5p-mfc driver was depending on the first-fit allocation method in the DMA-mapping / IOMMU glue code (ARM64 use different algorithm). It turned out, that there is a much simpler way. During my research I found that some of the requirements for the memory buffers for MFC v6+ devices were blindly copied from the previous hardware (v5) version and simply turned out to be excessive. It turned out that there is no strict requirement for ALL buffers to be allocated on the higher addresses than the firmware base. This requirement is true only for the device and per-context buffers. All video data buffers can be allocated anywhere for all MFC v6+ versions. This heavily simplifies memory management in the driver. Such relaxed requirements for the memory buffers can be easily fulfilled by allocating firmware, device and per-context buffers from the probe-time preallocated larger buffer. There is no need to create special reserved memory regions. The only case, when those memory regions are needed is an oldest Exynos series - Exynos4210 or Exyno4412, which both have MFC v5 hardware, and only when IOMMU is disabled. This patchset has been tested on Odroid U3 (Exynos4412 with MFC v5), Google Snow (Exynos5250 with MFC v6), Odroid XU3 (Exynos5422 with MFC v8) and TM2 (Exynos5433 with MFC v8, ARM64) boards. To get it working on TM2/Exynos5433 with IOMMU enabled, the following fixes to Exynos SYSMMU driver are needed: https://www.spinics.net/lists/linux-samsung-soc/msg58832.html https://www.spinics.net/lists/linux-samsung-soc/msg58833.html Patches are based on v4.11-rc3 with "media: s5p-mfc: Fix initialization of internal structures" patch applied: https://patchwork.linuxtv.org/patch/39198/ I've tried to split changes into small pieces to make it easier to review the code. I've also did a bit of cleanup while touching the driver. Best regards Marek Szyprowski Samsung R&D Institute Poland Changelog: v3: - collected tags - added a patch, which renames BANK1/2 to BANK_L/R to match documentation - rebased onto v4.11-rc3 v2: - fixed issues pointed by Javier Martinez Canillas: code compiles now after applying each patch, added missing cleanup - added tags v1: https://www.spinics.net/lists/linux-media/msg111156.html - initial version Patch summary: Marek Szyprowski (16): media: s5p-mfc: Remove unused structures and dead code media: s5p-mfc: Use generic of_device_get_match_data helper media: s5p-mfc: Replace mem_dev_* entries with an array media: s5p-mfc: Replace bank1/bank2 entries with an array media: s5p-mfc: Simplify alloc/release private buffer functions media: s5p-mfc: Move setting DMA max segment size to DMA configure function media: s5p-mfc: Put firmware to private buffer structure media: s5p-mfc: Move firmware allocation to DMA configure function media: s5p-mfc: Allocate firmware with internal private buffer alloc function media: s5p-mfc: Reduce firmware buffer size for MFC v6+ variants media: s5p-mfc: Split variant DMA memory configuration into separate functions media: s5p-mfc: Add support for probe-time preallocated block based allocator media: s5p-mfc: Remove special configuration of IOMMU domain media: s5p-mfc: Use preallocated block allocator always for MFC v6+ media: s5p-mfc: Rename BANK1/2 to BANK_L/R to better match documentation ARM: dts: exynos: Remove MFC reserved buffers .../devicetree/bindings/media/s5p-mfc.txt | 2 +- arch/arm/boot/dts/exynos5250-arndale.dts | 1 - arch/arm/boot/dts/exynos5250-smdk5250.dts | 1 - arch/arm/boot/dts/exynos5250-spring.dts | 1 - arch/arm/boot/dts/exynos5420-arndale-octa.dts | 1 - arch/arm/boot/dts/exynos5420-peach-pit.dts | 1 - arch/arm/boot/dts/exynos5420-smdk5420.dts | 1 - arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi | 1 - arch/arm/boot/dts/exynos5800-peach-pi.dts | 1 - drivers/media/platform/s5p-mfc/regs-mfc-v6.h | 2 +- drivers/media/platform/s5p-mfc/regs-mfc-v7.h | 2 +- drivers/media/platform/s5p-mfc/regs-mfc-v8.h | 2 +- drivers/media/platform/s5p-mfc/s5p_mfc.c | 214 +++++++++++++-------- drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c | 2 +- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 43 ++--- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 72 +++---- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.h | 1 - drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 8 +- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 10 +- drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h | 51 +---- drivers/media/platform/s5p-mfc/s5p_mfc_opr.c | 65 +++++-- drivers/media/platform/s5p-mfc/s5p_mfc_opr.h | 8 +- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c | 48 ++--- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 14 +- 24 files changed, 269 insertions(+), 283 deletions(-) -- 1.9.1