Hi,
The vc-sm-cma driver allows contiguous memory blocks to be imported into the VideoCore VPU memory map. This series adds support for this driver and changes to VCHIQ MMAL layer required to get it functional.
These changes have lived in the staging directory of the downstream Raspberry Pi tree since quite some time, but are necessary for getting the VCHIQ based peripherals like the ISP and codec functional in mainline.
Thanks, Jai
Signed-off-by: Jai Luthra jai.luthra@ideasonboard.com --- Changes in v2: - Drop patches that are not related to vc-sm-cma, or used for codec and not ISP, so that is v1 PATCH 1, 2, 4, 5, 6, 7, 8, 12 - Move v1 PATCH 11 to the top, adding a Fixes tag - Don't use global singletons for storing `struct vchiq_device` in VCHIQ, instead converting the existing device drivers (audio) to be stored inside `struct vchiq_drv_mgmt` - Update the vc-sm-cma driver to latest standards, like: - Replace MODULE_ALIAS call with a proper device id_table - Add kernel-doc comments for exported functions - Move exported functions to a header under include/linux for use in MMAL (and later V4L2 ISP and codec drivers) - Use xarray instead of deprecated idr to map an integer ID to imported/allocated buffer pointers - Drop unnecessary pr_debug calls - Replacing pr_xxx use with dev_xxx wherever possible - Clean up stray comments - Link to v1: https://lore.kernel.org/r/20251031-b4-vc-sm-cma-v1-0-0dd5c0ec3f5c@ideasonboa...
--- Dave Stevenson (5): platform/raspberrypi: vchiq-mmal: Reset buffers_with_vpu on port_enable platform/raspberrypi: Add VideoCore shared memory support platform/raspberrypi: vchiq-mmal: Use vc-sm-cma to support zero copy platform/raspberrypi: vchiq-mmal: Support sending data to MMAL ports platform/raspberrypi: vchiq: Register vc-sm-cma as a platform driver
Jai Luthra (1): platform/raspberrypi: vchiq: Store audio device in driver management struct
MAINTAINERS | 7 + drivers/platform/raspberrypi/Kconfig | 2 + drivers/platform/raspberrypi/Makefile | 1 + drivers/platform/raspberrypi/vc-sm-cma/Kconfig | 9 + drivers/platform/raspberrypi/vc-sm-cma/Makefile | 5 + drivers/platform/raspberrypi/vc-sm-cma/vc_sm.c | 1571 ++++++++++++++++++++ drivers/platform/raspberrypi/vc-sm-cma/vc_sm.h | 83 ++ .../raspberrypi/vc-sm-cma/vc_sm_cma_vchi.c | 507 +++++++ .../raspberrypi/vc-sm-cma/vc_sm_cma_vchi.h | 63 + .../platform/raspberrypi/vc-sm-cma/vc_sm_defs.h | 298 ++++ .../raspberrypi/vchiq-interface/vchiq_arm.c | 13 +- drivers/platform/raspberrypi/vchiq-mmal/Kconfig | 3 +- .../platform/raspberrypi/vchiq-mmal/mmal-common.h | 4 + .../platform/raspberrypi/vchiq-mmal/mmal-vchiq.c | 85 +- .../platform/raspberrypi/vchiq-mmal/mmal-vchiq.h | 1 + include/linux/raspberrypi/vc_sm_cma_ioctl.h | 110 ++ include/linux/raspberrypi/vc_sm_knl.h | 75 + include/linux/raspberrypi/vchiq_arm.h | 9 + 18 files changed, 2827 insertions(+), 19 deletions(-) --- base-commit: 3e7f562e20ee87a25e104ef4fce557d39d62fa85 change-id: 20251030-b4-vc-sm-cma-f6727c39cd25
Best regards,
From: Dave Stevenson dave.stevenson@raspberrypi.com
Should we go through the timeout failure case with port_disable not returning all buffers for whatever reason, the buffers_with_vpu counter gets left at a non-zero value, which will cause reference counting issues should the instance be reused.
Reset the count when the port is enabled again, but before any buffers have been sent to the VPU.
Fixes: 70ec64ccdaac ("staging: bcm2835-camera: Ensure all buffers are returned on disable") Cc: stable@vger.kernel.org Signed-off-by: Dave Stevenson dave.stevenson@raspberrypi.com Signed-off-by: Jai Luthra jai.luthra@ideasonboard.com --- drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c b/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c index cd073ed3ea2dd9c45b137f1a32e236e520b7b320..e76551948bd9c4f60bef1138280fe8dd9d32477b 100644 --- a/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c +++ b/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c @@ -1364,6 +1364,8 @@ static int port_enable(struct vchiq_mmal_instance *instance,
port->enabled = true;
+ atomic_set(&port->buffers_with_vpu, 0); + if (port->buffer_cb) { /* send buffer headers to videocore */ hdr_count = 1;
linux-stable-mirror@lists.linaro.org