[PATCH] media: rkvdec: Use dma_map_resource() to map RCB SRAM buffers
Nicolas Dufresne
nicolas at ndufresne.ca
Fri Nov 20 15:05:20 PST 2026
Le samedi 14 novembre 2026 à 09:49 +0000, Lukas Splavec a écrit :
> rkvdec_allocate_rcb() uses the CPU virtual address of the SRAM buffer
> as the decoder's IOVA and writes it into the IOMMU page table directly
> with iommu_map(), bypassing the DMA API. Only the low 32 bits of that
> address are used, which falls inside the IOVA range managed by the
> allocator. The IOVA allocator does not know about this range and
> considers it free. Under load it hands out the same IOVA to another
> buffer, e.g. a capture buffer, whose mapping then fails:
>
> [ 66.930512] iova: 0x0000000082100000 already mapped to 0x00000000ff001000 cannot remap to phys: 0x0000000168231000 prot: 0x3
> [ 66.930674] rkvdec fdc38100.video-codec: dma alloc of size 16588800 failed
>
> and decoding cannot start.
>
> Map the SRAM buffer with dma_map_resource() instead, so the IOVA is
> allocated by the IOVA allocator and the mapping is created by the DMA
> API, and release it with dma_unmap_resource(). Without an IOMMU,
> dma_map_resource() returns the physical address, so the separate
> no-IOMMU path is no longer needed.
>
> Fixes: e5640dbb991c ("media: rkvdec: Add RCB and SRAM support")
> Signed-off-by: Lukas Splavec <lukas.splavec at puresig.cz>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-rockchip/attachments/20261120/48b56562/attachment.sig>
More information about the Linux-rockchip
mailing list