[PATCH v3 25/27] media: rockchip: rga: disable multi-core support
Nicolas Dufresne
nicolas at ndufresne.ca
Fri Mar 20 11:01:59 PDT 2026
Le mardi 27 janvier 2026 à 15:39 +0100, Sven Püschel a écrit :
> Disable multi-core support in preparation of the RGA3 addition. The
> RK3588 SoC features two equal RGA3 cores. This allows scheduling of the
> work between both cores, which is not yet implemented. Until it is
> implemented avoid exposing both cores as independent video devices to
> prevent an ABI breakage when multi-core support is added.
>
> This patch is copied from the Hantro driver patch to disable multi core
> support by Sebastian Reichel. See
> commit ccdeb8d57f7f ("media: hantro: Disable multicore support")
>
> Link: https://lore.kernel.org/all/20240618183816.77597-4-sebastian.reichel@collabora.com/
> Signed-off-by: Sven Püschel <s.pueschel at pengutronix.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
> ---
> drivers/media/platform/rockchip/rga/rga.c | 47 +++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
>
> diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
> index 43644995c152e..e45b9c853d659 100644
> --- a/drivers/media/platform/rockchip/rga/rga.c
> +++ b/drivers/media/platform/rockchip/rga/rga.c
> @@ -708,6 +708,49 @@ static int rga_parse_dt(struct rockchip_rga *rga)
> return 0;
> }
>
> +/*
> + * Some SoCs, like RK3588 have multiple identical RGA3 cores, but the
> + * kernel is currently missing support for multi-core handling. Exposing
> + * separate devices for each core to userspace is bad, since that does
> + * not allow scheduling tasks properly (and creates ABI). With this workaround
> + * the driver will only probe for the first core and early exit for the other
> + * cores. Once the driver gains multi-core support, the same technique
> + * for detecting the main core can be used to cluster all cores together.
> + */
> +static int rga_disable_multicore(struct device *dev)
> +{
> + struct device_node *node = NULL;
> + const char *compatible;
> + bool is_main_core;
> + int ret;
> +
> + /* Intentionally ignores the fallback strings */
> + ret = of_property_read_string(dev->of_node, "compatible", &compatible);
> + if (ret)
> + return ret;
> +
> + /* The first compatible and available node found is considered the main core */
> + do {
> + node = of_find_compatible_node(node, NULL, compatible);
> + if (of_device_is_available(node))
> + break;
> + } while (node);
> +
> + if (!node)
> + return -EINVAL;
> +
> + is_main_core = (dev->of_node == node);
> +
> + of_node_put(node);
> +
> + if (!is_main_core) {
> + dev_info(dev, "missing multi-core support, ignoring this instance\n");
> + return -ENODEV;
> + }
> +
> + return 0;
> +}
> +
> static int rga_probe(struct platform_device *pdev)
> {
> struct rockchip_rga *rga;
> @@ -718,6 +761,10 @@ static int rga_probe(struct platform_device *pdev)
> if (!pdev->dev.of_node)
> return -ENODEV;
>
> + ret = rga_disable_multicore(&pdev->dev);
> + if (ret)
> + return ret;
> +
> rga = devm_kzalloc(&pdev->dev, sizeof(*rga), GFP_KERNEL);
> if (!rga)
> return -ENOMEM;
-------------- 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/20260320/bd3dc1e4/attachment.sig>
More information about the Linux-rockchip
mailing list