diff options
| author | Sahitya Tummala <stummala@codeaurora.org> | 2017-10-05 14:39:40 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-08-16 08:00:12 -0700 |
| commit | 7b270ed1989f7dc0d9a2cd05fca0aaa5007550d4 (patch) | |
| tree | 43ebb630f79f3d77897bd4730808f884aa392744 /drivers/uio | |
| parent | 4bef50d041e80243d279ed1bccda5297b81ba306 (diff) | |
uio: msm_sharedmem: add guard page around shared memory
If guard_memory dtsi property is set, then the shared memory
region will be guarded by SZ_4K at the start and at the end.
This is needed to overcome the XPU limitation on few MSM HW,
so as to make this memory not contiguous with other allocations
that may possibly happen from other clients in the system.
Change-Id: I57637619cea8fe7f0f7254624e07177ea4a4fce0
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Diffstat (limited to 'drivers/uio')
| -rw-r--r-- | drivers/uio/msm_sharedmem/msm_sharedmem.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/uio/msm_sharedmem/msm_sharedmem.c b/drivers/uio/msm_sharedmem/msm_sharedmem.c index 633656009daf..a9294670ca37 100644 --- a/drivers/uio/msm_sharedmem/msm_sharedmem.c +++ b/drivers/uio/msm_sharedmem/msm_sharedmem.c @@ -127,10 +127,12 @@ static int msm_sharedmem_probe(struct platform_device *pdev) struct resource *clnt_res = NULL; u32 client_id = ((u32)~0U); u32 shared_mem_size = 0; + u32 shared_mem_tot_sz = 0; void *shared_mem = NULL; phys_addr_t shared_mem_pyhsical = 0; bool is_addr_dynamic = false; struct sharemem_qmi_entry qmi_entry; + bool guard_memory = false; /* Get the addresses from platform-data */ if (!pdev->dev.of_node) { @@ -165,13 +167,30 @@ static int msm_sharedmem_probe(struct platform_device *pdev) if (shared_mem_pyhsical == 0) { is_addr_dynamic = true; - shared_mem = dma_alloc_coherent(&pdev->dev, shared_mem_size, + + /* + * If guard_memory is set, then the shared memory region + * will be guarded by SZ_4K at the start and at the end. + * This is needed to overcome the XPU limitation on few + * MSM HW, so as to make this memory not contiguous with + * other allocations that may possibly happen from other + * clients in the system. + */ + guard_memory = of_property_read_bool(pdev->dev.of_node, + "qcom,guard-memory"); + + shared_mem_tot_sz = guard_memory ? shared_mem_size + SZ_8K : + shared_mem_size; + + shared_mem = dma_alloc_coherent(&pdev->dev, shared_mem_tot_sz, &shared_mem_pyhsical, GFP_KERNEL); if (shared_mem == NULL) { pr_err("Shared mem alloc client=%s, size=%u\n", clnt_res->name, shared_mem_size); return -ENOMEM; } + if (guard_memory) + shared_mem_pyhsical += SZ_4K; } /* Set up the permissions for the shared ram that was allocated. */ |
