Message ID | 20240527-shm-bridge-v10-12-ce7afaa58d3a@linaro.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | firmware: qcom: implement support for and enable SHM bridge | expand |
On Mon, May 27, 2024 at 02:55:02PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> > > 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> > --- > drivers/firmware/qcom/qcom_scm.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c > index 94c34cde8179..c82957727650 100644 > --- a/drivers/firmware/qcom/qcom_scm.c > +++ b/drivers/firmware/qcom/qcom_scm.c > @@ -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> > @@ -1942,6 +1943,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, > > -- > 2.43.0 >
diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 94c34cde8179..c82957727650 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -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> @@ -1942,6 +1943,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,