Loading Documentation/devicetree/bindings/uio/msm_sharedmem.txt +8 −0 Original line number Diff line number Diff line Loading @@ -9,10 +9,18 @@ Required properties: - reg-names : Indicates various client-names. - qcom,client-id : The client id for the QMI clients. Optional properties: - qcom,guard-memory: If this 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 some MSM HW, so as to make this memory not contiguous with other allocations that may possibly happen from other clients. Example: qcom,msm_sharedmem@0dc80000 { compatible = "qcom,sharedmem-uio"; reg = <0x0dc80000 0x00180000>, reg-names = "rmtfs"; qcom,client-id = <0x00000001>; qcom,guard-memory; }; drivers/uio/msm_sharedmem/msm_sharedmem.c +20 −1 Original line number Diff line number Diff line Loading @@ -97,9 +97,11 @@ 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; bool guard_memory = false; /* Get the addresses from platform-data */ if (!pdev->dev.of_node) { Loading Loading @@ -134,13 +136,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. */ Loading Loading
Documentation/devicetree/bindings/uio/msm_sharedmem.txt +8 −0 Original line number Diff line number Diff line Loading @@ -9,10 +9,18 @@ Required properties: - reg-names : Indicates various client-names. - qcom,client-id : The client id for the QMI clients. Optional properties: - qcom,guard-memory: If this 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 some MSM HW, so as to make this memory not contiguous with other allocations that may possibly happen from other clients. Example: qcom,msm_sharedmem@0dc80000 { compatible = "qcom,sharedmem-uio"; reg = <0x0dc80000 0x00180000>, reg-names = "rmtfs"; qcom,client-id = <0x00000001>; qcom,guard-memory; };
drivers/uio/msm_sharedmem/msm_sharedmem.c +20 −1 Original line number Diff line number Diff line Loading @@ -97,9 +97,11 @@ 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; bool guard_memory = false; /* Get the addresses from platform-data */ if (!pdev->dev.of_node) { Loading Loading @@ -134,13 +136,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. */ Loading