|
|
@@ -18,6 +18,7 @@
|
|
|
#include <linux/init.h>
|
|
|
#include <linux/cpumask.h>
|
|
|
#include <linux/export.h>
|
|
|
+#include <linux/dma-direct.h>
|
|
|
#include <linux/dma-mapping.h>
|
|
|
#include <linux/module.h>
|
|
|
#include <linux/types.h>
|
|
|
@@ -449,6 +450,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
|
|
|
phys_addr_t mem_to_map_phys;
|
|
|
phys_addr_t dest_phys;
|
|
|
phys_addr_t ptr_phys;
|
|
|
+ dma_addr_t ptr_dma;
|
|
|
size_t mem_to_map_sz;
|
|
|
size_t dest_sz;
|
|
|
size_t src_sz;
|
|
|
@@ -466,9 +468,10 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
|
|
|
ptr_sz = ALIGN(src_sz, SZ_64) + ALIGN(mem_to_map_sz, SZ_64) +
|
|
|
ALIGN(dest_sz, SZ_64);
|
|
|
|
|
|
- ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL);
|
|
|
+ ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_dma, GFP_KERNEL);
|
|
|
if (!ptr)
|
|
|
return -ENOMEM;
|
|
|
+ ptr_phys = dma_to_phys(__scm->dev, ptr_dma);
|
|
|
|
|
|
/* Fill source vmid detail */
|
|
|
src = ptr;
|
|
|
@@ -498,7 +501,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
|
|
|
|
|
|
ret = __qcom_scm_assign_mem(__scm->dev, mem_to_map_phys, mem_to_map_sz,
|
|
|
ptr_phys, src_sz, dest_phys, dest_sz);
|
|
|
- dma_free_coherent(__scm->dev, ALIGN(ptr_sz, SZ_64), ptr, ptr_phys);
|
|
|
+ dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_dma);
|
|
|
if (ret) {
|
|
|
dev_err(__scm->dev,
|
|
|
"Assign memory protection call failed %d.\n", ret);
|