summaryrefslogtreecommitdiff
path: root/drivers/soc/qcom
diff options
context:
space:
mode:
authorBjorn Andersson <quic_bjorande@quicinc.com>2023-09-21 05:37:31 +0300
committerBjorn Andersson <andersson@kernel.org>2023-09-28 02:05:58 +0300
commit9265bc6bce6919c771970e5a425a66551a1c78a0 (patch)
tree7ca02fa6dd7c8df1e9873fb68fceafc408fbc5a6 /drivers/soc/qcom
parent3ad96787949a96256931ca59aff73ea604bc0e6c (diff)
downloadlinux-9265bc6bce6919c771970e5a425a66551a1c78a0.tar.xz
soc: qcom: rmtfs: Support discarding guard pages
In some configurations, the exact placement of the rmtfs shared memory region isn't so strict. The DeviceTree author can then choose to use the "size" property and rely on the OS for placement (in combination with "alloc-ranges", if desired). But on some platforms the rmtfs memory region may not be allocated adjacent to regions allocated by other clients. Add support for discarding the first and last 4k block in the region, if qcom,use-guard-pages is specified in DeviceTree. Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com> Reviewed-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20230920-rmtfs-mem-guard-pages-v3-2-305b37219b78@quicinc.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Diffstat (limited to 'drivers/soc/qcom')
-rw-r--r--drivers/soc/qcom/rmtfs_mem.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
index f83811f51175..9c937d24ba42 100644
--- a/drivers/soc/qcom/rmtfs_mem.c
+++ b/drivers/soc/qcom/rmtfs_mem.c
@@ -200,6 +200,15 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
rmtfs_mem->client_id = client_id;
rmtfs_mem->size = rmem->size;
+ /*
+ * If requested, discard the first and last 4k block in order to ensure
+ * that the rmtfs region isn't adjacent to other protected regions.
+ */
+ if (of_property_read_bool(node, "qcom,use-guard-pages")) {
+ rmtfs_mem->addr += SZ_4K;
+ rmtfs_mem->size -= 2 * SZ_4K;
+ }
+
device_initialize(&rmtfs_mem->dev);
rmtfs_mem->dev.parent = &pdev->dev;
rmtfs_mem->dev.groups = qcom_rmtfs_mem_groups;