Re: [PATCH 00/18] Convert arch/arm to use iommu-dma

Marek Szyprowski
2020-08-24T11:41:05Z

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
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland