Re: [PATCH v5 03/11] platform/raspberrypi: Add VideoCore shared memory support

From: Florian Fainelli

Date: Fri Nov 13 2026 - 22:29:05 EST




On 11/12/2026 3:18 AM, Jai Luthra wrote:
From: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>

Add support for the vc-sm-cma driver, to enable sharing of contiguous
CMA memory allocations with the VideoCore VPU on Raspberry Pi. The
driver allocates CMA-backed buffers, imports external dmabufs, and
manages their lifetime via VCHIQ messaging to the VPU service, ensuring
buffers are not released until both the linux userspace and the VPU
confirm completion.

VC4 can only physically address the lower 1GB of RAM and requires
buffers to be mapped through specific uncached address aliases
(0xC0000000). Thus, standard CMA could not be used as it has no
mechanism to ensure allocations are visible and valid to VideoCore
firmware, or handle cache flushes as VC4 can't see ARM's cache state.

The vc-sm-cma driver bridges this gap by allocating memory via CMA on
the ARM side and explicitly importing it into VideoCore via VCHI.

This driver is primarily used by the wrapper V4L2 drivers for codec and
ISP, where firmware running on VC4 does the actual video and image
processing, while the linux userspace interacts with standard V4L2
driver interfaces. For example, the ISP driver populates large
lens-shading related tables for a particular camera setup, and uses
vc-sm-cma to share this buffer with VC4.

Signed-off-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>
Signed-off-by: Dom Cobley <popcornmix@xxxxxxxxx>
Signed-off-by: Phil Elwell <phil@xxxxxxxxxxxxxxx>
Signed-off-by: Alexander Winkowski <dereference23@xxxxxxxxxxx>
Signed-off-by: Kieran Bingham <kieran.bingham@xxxxxxxxxxxxxxxx>
Signed-off-by: Juerg Haefliger <juerg.haefliger@xxxxxxxxxxxxx>
[clean-up for mainline and switch to xarray instead of idr]
Signed-off-by: Jai Luthra <jai.luthra@xxxxxxxxxxxxxxxx>
---

Applied to https://github.com/Broadcom/stblinux/commits/drivers/next, thanks!
--
Florian