Message ID | cover.1597931875.git.robin.murphy@arm.com (mailing list archive) |
---|---|
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1k8m6G-00AK4p-T0; Thu, 20 Aug 2020 15:03:34 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728573AbgHTPI4 (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Thu, 20 Aug 2020 11:08:56 -0400 Received: from foss.arm.com ([217.140.110.172]:40680 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727920AbgHTPIy (ORCPT <rfc822;linux-media@vger.kernel.org>); Thu, 20 Aug 2020 11:08:54 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AA18331B; Thu, 20 Aug 2020 08:08:53 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1FDC83F6CF; Thu, 20 Aug 2020 08:08:50 -0700 (PDT) From: Robin Murphy <robin.murphy@arm.com> To: hch@lst.de, joro@8bytes.org, linux@armlinux.org.uk Cc: will@kernel.org, inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, m.szyprowski@samsung.com, agross@kernel.org, bjorn.andersson@linaro.org, thierry.reding@gmail.com, jonathanh@nvidia.com, vdumpa@nvidia.com, digetx@gmail.com, matthias.bgg@gmail.com, yong.wu@mediatek.com, geert+renesas@glider.be, magnus.damm@gmail.com, t-kristo@ti.com, s-anna@ti.com, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 00/18] Convert arch/arm to use iommu-dma Date: Thu, 20 Aug 2020 16:08:19 +0100 Message-Id: <cover.1597931875.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.28.0.dirty MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no |
Series |
Convert arch/arm to use iommu-dma
|
|
Message
Robin Murphy
Aug. 20, 2020, 3:08 p.m. UTC
Hi all, After 5 years or so of intending to get round to this, finally the time comes! The changes themselves actualy turn out to be relatively mechanical; the bigger concern appears to be how to get everything merged across about 5 diffferent trees given the dependencies. I've lightly boot-tested things on Rockchip RK3288 and Exynos 4412 (Odroid-U3), to the degree that their display drivers should be using IOMMU-backed buffers and don't explode (the Odroid doesn't manage to send a working HDMI signal to the one monitor I have that it actually detects, but that's a pre-existing condition...) Confirmation that the Mediatek, OMAP and Tegra changes work will be most welcome. Patches are based on 5.9-rc1, branch available here: git://linux-arm.org/linux-rm arm/dma Robin. Robin Murphy (18): ARM/dma-mapping: Drop .dma_supported for IOMMU ops ARM/dma-mapping: Consolidate IOMMU ops callbacks ARM/dma-mapping: Merge IOMMU ops iommu/dma: Add temporary hacks for arch/arm ARM/dma-mapping: Switch to iommu_dma_ops ARM/dma-mapping: Support IOMMU default domains iommu/arm-smmu: Remove arch/arm workaround iommu/renesas: Remove arch/arm workaround iommu/mediatek-v1: Add IOMMU_DOMAIN_DMA support iommu/msm: Add IOMMU_DOMAIN_DMA support iommu/omap: Add IOMMU_DOMAIN_DMA support iommu/tegra-gart: Add IOMMU_DOMAIN_DMA support iommu/tegra: Add IOMMU_DOMAIN_DMA support drm/exynos: Consolidate IOMMU mapping code drm/nouveau/tegra: Clean up IOMMU workaround staging/media/tegra-vde: Clean up IOMMU workaround media/omap3isp: Clean up IOMMU workaround ARM/dma-mapping: Remove legacy dma-iommu API arch/arm/Kconfig | 28 +- arch/arm/common/dmabounce.c | 1 - arch/arm/include/asm/device.h | 9 - arch/arm/include/asm/dma-iommu.h | 37 - arch/arm/mm/dma-mapping.c | 1198 +---------------- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 5 +- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 5 +- drivers/gpu/drm/exynos/exynos_drm_dma.c | 61 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 +- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 5 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 5 +- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 5 +- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 5 +- drivers/gpu/drm/exynos/exynos_drm_rotator.c | 5 +- drivers/gpu/drm/exynos/exynos_drm_scaler.c | 6 +- drivers/gpu/drm/exynos/exynos_mixer.c | 7 +- .../drm/nouveau/nvkm/engine/device/tegra.c | 13 - drivers/iommu/Kconfig | 8 - drivers/iommu/arm/arm-smmu/arm-smmu.c | 10 - drivers/iommu/ipmmu-vmsa.c | 69 - drivers/iommu/msm_iommu.c | 7 +- drivers/iommu/mtk_iommu.h | 2 - drivers/iommu/mtk_iommu_v1.c | 153 +-- drivers/iommu/omap-iommu.c | 22 +- drivers/iommu/tegra-gart.c | 17 +- drivers/iommu/tegra-smmu.c | 37 +- drivers/media/platform/Kconfig | 1 - drivers/media/platform/omap3isp/isp.c | 68 +- drivers/media/platform/omap3isp/isp.h | 3 - drivers/staging/media/tegra-vde/iommu.c | 12 - 30 files changed, 150 insertions(+), 1660 deletions(-) delete mode 100644 arch/arm/include/asm/dma-iommu.h
Comments
Hi Robin, On 20.08.2020 17:08, Robin Murphy wrote: > Hi all, > > After 5 years or so of intending to get round to this, finally the > time comes! The changes themselves actualy turn out to be relatively > mechanical; the bigger concern appears to be how to get everything > merged across about 5 diffferent trees given the dependencies. > > I've lightly boot-tested things on Rockchip RK3288 and Exynos 4412 > (Odroid-U3), to the degree that their display drivers should be using > IOMMU-backed buffers and don't explode (the Odroid doesn't manage to > send a working HDMI signal to the one monitor I have that it actually > detects, but that's a pre-existing condition...) Confirmation that the > Mediatek, OMAP and Tegra changes work will be most welcome. > > Patches are based on 5.9-rc1, branch available here: > > git://linux-arm.org/linux-rm arm/dma Well, my first proposal for the ARM and ARM64 DMA-mapping unification has been posted long time ago: https://lkml.org/lkml/2016/2/19/79 Thanks for resurrecting it! :) I've tested this patchset on various ARM32bit Exynos based boards (not only Exynos4412) and most of them works fine after your conversion. However there are issues you cannot learn from the code. Conversion of the Exynos DRM was straightforward (thanks!), but there are other Exynos drivers that depends on the old ARM implementation. The S5P-MFC (only for the v5 hardware) and Exynos4 FIMC-ISP drivers depends on the first-fit IOVA allocation algorithm in the old ARM DMA-mapping. This was the main reason I've didn't continue my initial conversion attempt. Both drivers allocate a buffer for their firmware and then in the hardware registers address video buffers as an offset from the begginning of the firmware. This doesn't work when underlying DMA-mapping allocates IOVA with the last-fit algorithm, what the drivers/iommu/dma-iommu.c does. So far I didn't find a good solution for that issue. I'm open for suggestions. One more limitation for the S5P-MFC driver is that the hardware is capable only for addressing 128MiB. They will probably need to call IOMMU API directly, but I would like to keep as much from the IOMMU/DMA-mapping code as possible. Anyway, we need to move ARM 32bit forward, so for the ARM DMA-mapping and Exynos DRM changes, feel free to add: Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Best regards
Tested full series on bananapi r2 (mt7623/mt2701, 5.9-rc1 + hdmi-patches), works so far fbcon+x without issues
Tested-by: Frank Wunderlich <frank-w@public-files.de>
regards Frank
On 27/08/2020 14:31, Frank Wunderlich wrote: > Tested full series on bananapi r2 (mt7623/mt2701, 5.9-rc1 + hdmi-patches), works so far fbcon+x without issues > > Tested-by: Frank Wunderlich <frank-w@public-files.de> > Thanks for testing. Robin this is especially relevant for: [PATCH 09/18] iommu/mediatek-v1: Add IOMMU_DOMAIN_DMA support Regards, Matthias
Hi all, On 24.08.2020 13:40, Marek Szyprowski wrote: > On 20.08.2020 17:08, Robin Murphy wrote: >> After 5 years or so of intending to get round to this, finally the >> time comes! The changes themselves actualy turn out to be relatively >> mechanical; the bigger concern appears to be how to get everything >> merged across about 5 diffferent trees given the dependencies. >> >> I've lightly boot-tested things on Rockchip RK3288 and Exynos 4412 >> (Odroid-U3), to the degree that their display drivers should be using >> IOMMU-backed buffers and don't explode (the Odroid doesn't manage to >> send a working HDMI signal to the one monitor I have that it actually >> detects, but that's a pre-existing condition...) Confirmation that the >> Mediatek, OMAP and Tegra changes work will be most welcome. >> >> Patches are based on 5.9-rc1, branch available here: >> >> git://linux-arm.org/linux-rm arm/dma > > Well, my first proposal for the ARM and ARM64 DMA-mapping unification > has been posted long time ago: https://lkml.org/lkml/2016/2/19/79 > > Thanks for resurrecting it! :) > > I've tested this patchset on various ARM32bit Exynos based boards (not > only Exynos4412) and most of them works fine after your conversion. > However there are issues you cannot learn from the code. > > Conversion of the Exynos DRM was straightforward (thanks!), but there > are other Exynos drivers that depends on the old ARM implementation. > The S5P-MFC (only for the v5 hardware) and Exynos4 FIMC-ISP drivers > depends on the first-fit IOVA allocation algorithm in the old ARM > DMA-mapping. This was the main reason I've didn't continue my initial > conversion attempt. > > Both drivers allocate a buffer for their firmware and then in the > hardware registers address video buffers as an offset from the > begginning of the firmware. This doesn't work when underlying > DMA-mapping allocates IOVA with the last-fit algorithm, what the > drivers/iommu/dma-iommu.c does. So far I didn't find a good solution > for that issue. > > I'm open for suggestions. One more limitation for the S5P-MFC driver > is that the hardware is capable only for addressing 128MiB. They will > probably need to call IOMMU API directly, but I would like to keep as > much from the IOMMU/DMA-mapping code as possible. Just for the record. I've finally managed to add needed workarounds to the both problematic Exynos4 drivers, so they work fine with this patchset. It turned out that it wasn't that hard: https://lore.kernel.org/linux-samsung-soc/20200918144833.14618-1-m.szyprowski@samsung.com/T/#t So from my side you have a green light to go ahead and switch ARM 32bit to generic code. Time to say good bye to the one of my biggest architecture related things merged once to mainline Linux. ;) Best regards