dma-heap: qcom: Roll-back secure-heap changes in the system heap

Remove all secure-by-default support from the system heap.

Change-Id: I3ad2fbb94234dc27470df55faf0730e20f53cd42
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
This commit is contained in:
Chris Goldsworthy 2021-03-20 18:36:15 -07:00
parent 3908bb8739
commit 04248e0ff2
4 changed files with 9 additions and 37 deletions

View File

@ -6,7 +6,7 @@ obj-$(CONFIG_DMABUF_HEAPS_CMA) += cma_heap.o
obj-$(CONFIG_QCOM_DMABUF_HEAPS) += qcom_dma_heaps.o
qcom_dma_heaps-y := qcom_dma_heap.o qcom_dt_parser.o
qcom_dma_heaps-$(CONFIG_QCOM_DMABUF_HEAPS_SYSTEM) += qcom_system_heap.o qcom_heap_helpers.o \
qcom_dynamic_page_pool.o qcom_dma_heap_secure_utils.o
qcom_dynamic_page_pool.o
qcom_dma_heaps-$(CONFIG_QCOM_DMABUF_HEAPS_SYSTEM_SECURE) += qcom_secure_system_heap.o \
qcom_dynamic_page_pool.o \
qcom_dma_heap_secure_utils.o

View File

@ -21,10 +21,10 @@ static int qcom_dma_heap_probe(struct platform_device *pdev)
int i;
struct platform_data *heaps;
qcom_system_heap_create("system", false, 0);
qcom_system_heap_create("qcom,system", false, 0);
qcom_system_heap_create("system", false);
qcom_system_heap_create("qcom,system", false);
#ifdef CONFIG_QCOM_DMABUF_HEAPS_SYSTEM_UNCACHED
qcom_system_heap_create("qcom,system-uncached", true, 0);
qcom_system_heap_create("qcom,system-uncached", true);
#endif
qcom_secure_system_heap_create("system-secure",
QCOM_DMA_HEAP_FLAG_CP_PIXEL);

View File

@ -100,10 +100,6 @@ static void system_heap_free(struct qcom_sg_buffer *buffer)
sys_heap = dma_heap_get_drvdata(buffer->heap);
table = &buffer->sg_table;
if (sys_heap->vmid)
if (hyp_unassign_sg_from_flags(table, sys_heap->vmid, true))
return;
/* Zero the buffer pages before adding back to the pool */
system_heap_zero_buffer(buffer);
@ -165,7 +161,6 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
struct list_head pages;
struct page *page, *tmp_page;
int i, ret = -ENOMEM;
int perms;
buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
if (!buffer)
@ -224,20 +219,11 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
dma_unmap_sgtable(dma_heap_get_dev(heap), table, DMA_BIDIRECTIONAL, 0);
}
if (sys_heap->vmid) {
if (hyp_assign_sg_from_flags(table, sys_heap->vmid, true))
goto free_pages;
perms = msm_secure_get_vmid_perms(sys_heap->vmid);
buffer->vmperm = mem_buf_vmperm_alloc_staticvm(table,
&sys_heap->vmid, &perms, 1);
} else {
buffer->vmperm = mem_buf_vmperm_alloc(table);
}
buffer->vmperm = mem_buf_vmperm_alloc(table);
if (IS_ERR(buffer->vmperm)) {
ret = PTR_ERR(buffer->vmperm);
goto hyp_unassign;
goto free_sg;
}
/* create the dmabuf */
@ -254,18 +240,6 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
vmperm_release:
mem_buf_vmperm_release(buffer->vmperm);
hyp_unassign:
if (sys_heap->vmid && hyp_unassign_sg_from_flags(table, sys_heap->vmid, true))
goto free_sg;
free_pages:
for_each_sgtable_sg(table, sg, i) {
struct page *p = sg_page(sg);
__free_pages(p, compound_order(p));
}
free_sg:
sg_free_table(table);
free_buffer:
@ -280,7 +254,7 @@ static const struct dma_heap_ops system_heap_ops = {
.allocate = system_heap_allocate,
};
int qcom_system_heap_create(char *name, bool uncached, int vmid)
int qcom_system_heap_create(char *name, bool uncached)
{
struct dma_heap_export_info exp_info;
struct dma_heap *heap;
@ -302,7 +276,6 @@ int qcom_system_heap_create(char *name, bool uncached, int vmid)
exp_info.priv = sys_heap;
sys_heap->uncached = uncached;
sys_heap->vmid = vmid;
sys_heap->pool_list = dynamic_page_pool_create_pools(0, NULL);
if (IS_ERR(sys_heap->pool_list)) {

View File

@ -13,11 +13,10 @@
struct qcom_system_heap {
int uncached;
struct dynamic_page_pool **pool_list;
int vmid;
};
#ifdef CONFIG_QCOM_DMABUF_HEAPS_SYSTEM
int qcom_system_heap_create(char *name, bool uncached, int vmid);
int qcom_system_heap_create(char *name, bool uncached);
struct page *qcom_sys_heap_alloc_largest_available(struct dynamic_page_pool **pools,
unsigned long size,
unsigned int max_order);
@ -29,7 +28,7 @@ struct page *qcom_sys_heap_alloc_largest_available(struct dynamic_page_pool **po
return ERR_PTR(-EOPNOTSUPP);
}
static int qcom_system_heap_create(char *name, bool uncached, int vmid)
static int qcom_system_heap_create(char *name, bool uncached)
{
return 1;
}