]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
firmware: qcom: scm: add support for SHM bridge memory carveout
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 27 May 2024 12:55:02 +0000 (14:55 +0200)
committerBjorn Andersson <andersson@kernel.org>
Sun, 23 Jun 2024 21:08:21 +0000 (16:08 -0500)
Parse the "memory-region" property and - if present - use it to assign
the dedicated reserved memory to the underlying DMA callbacks which will
then allocate memory for the SCM calls from it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Elliot Berman <quic_eberman@quicinc.com>
Link: https://lore.kernel.org/r/20240527-shm-bridge-v10-12-ce7afaa58d3a@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/firmware/qcom/qcom_scm.c

index 19950ec801c29a1d1b035c135f6e0443be7df9dc..df748fa8af4d4106e9f6f1991c18c768064cf772 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
 #include <linux/sizes.h>
@@ -1956,6 +1957,11 @@ static int qcom_scm_probe(struct platform_device *pdev)
        if (of_property_read_bool(pdev->dev.of_node, "qcom,sdi-enabled"))
                qcom_scm_disable_sdi();
 
+       ret = of_reserved_mem_device_init(__scm->dev);
+       if (ret && ret != -ENODEV)
+               return dev_err_probe(__scm->dev, ret,
+                                    "Failed to setup the reserved memory region for TZ mem\n");
+
        ret = qcom_tzmem_enable(__scm->dev);
        if (ret)
                return dev_err_probe(__scm->dev, ret,