From patchwork Tue Feb 14 07:51:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93919 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447245qgi; Mon, 13 Feb 2017 23:52:22 -0800 (PST) X-Received: by 10.99.156.2 with SMTP id f2mr31759315pge.189.1487058742101; Mon, 13 Feb 2017 23:52:22 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q21si12307412pgi.412.2017.02.13.23.52.21; Mon, 13 Feb 2017 23:52:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751946AbdBNHwU (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:20 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:39761 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751490AbdBNHwT (ORCPT ); Tue, 14 Feb 2017 02:52:19 -0500 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 <0OLC003IOTV3LK20@mailout3.w1.samsung.com>; Tue, 14 Feb 2017 07:52:15 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075214eucas1p2e4711c646332edd8e764678d44fcf4f7~jGAppMKVq3140531405eucas1p2h; Tue, 14 Feb 2017 07:52:14 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id B2.51.16908.137B2A85; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075214eucas1p1574c18c0fa166cdda50838b9fb8cc23b~jGApAZiU41805118051eucas1p1c; Tue, 14 Feb 2017 07:52:14 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-f7-58a2b7316f46 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 5A.5E.06687.D77B2A85; Tue, 14 Feb 2017 07:53:33 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:14 +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 00/15] Exynos MFC v6+ - remove the need for the reserved memory Date: Tue, 14 Feb 2017 08:51:53 +0100 Message-id: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsWy7djPc7qG2xdFGLxfKmlxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK+P33LeMBX3qFUdnb2NpYNwj38XIySEhYCJxc8NDRghbTOLCvfVsXYxcHEIC yxgltjfvYYdwPjNKfHndwQbT8eznOWa4qo3ztkO1NDBJ7O07wAJSxSZgKNH1tg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iDclsbIqtSg/vqg0 J7X4EKMp0O6JzFKiyfnAaMkriTc0MTS3NDQytrAwNzJSEuct+XAlXEggPbEkNTs1tSC1CKaP iYNTqoGxNiEvTJ8nP9au6+DuagZxJ3tlC5WrB39Ofx6lLGI1VzBD+tukg5NfFf8Vasg1rJdb tWDxG5GpL1U1eh6Vh648duwQk98VxtBOyzaZdfsX5a/qsRNXeLnva5//+y3rtzLl275o+8Mz 671truHvrVzXPu25mq/7w/nEbMVNvp5bs35HPl1jcNFCiaU4I9FQi7moOBEAuzdFm14CAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075214eucas1p1574c18c0fa166cdda50838b9fb8cc23b 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: 20170214075214eucas1p1574c18c0fa166cdda50838b9fb8cc23b X-RootMTR: 20170214075214eucas1p1574c18c0fa166cdda50838b9fb8cc23b References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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 'architectural clock gating' in SYSMMU has to be disabled. Fixing this will be handled separately. As a temporary solution, one need to clear CFG_ACGEN bit in REG_MMU_CFG of the SYSMMU, see __sysmmu_init_config function in drivers/iommu/exynos-iommu.c. Patches are based on linux-next from 9th February 2017 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 Patch summary: Marek Szyprowski (15): 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 segmetn 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+ 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 | 210 +++++++++++++-------- 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 | 71 +++---- 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, 264 insertions(+), 283 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas