1 From 52f881e3afa89bb1ca9e8b037f7600bcc97626e8 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Wed, 22 May 2019 15:40:37 +0100
4 Subject: [PATCH 629/806] staging: vcsm-cma: Fixup the alloc code handling of
7 The allocation code had been copied in from an old branch prior
8 to having added the IDR for 64bit support. It was therefore pushing
9 a pointer into the kernel_id field instead of an IDR handle, the
10 lookup therefore failed, and we never released the buffer.
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
14 drivers/staging/vc04_services/vc-sm-cma/vc_sm.c | 3 ++-
15 1 file changed, 2 insertions(+), 1 deletion(-)
17 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
18 +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
19 @@ -1206,7 +1206,7 @@ int vc_sm_cma_ioctl_alloc(struct vc_sm_p
21 import.addr = (uint32_t)sg_dma_address(buffer->sg_table->sgl);
22 import.size = aligned_size;
23 - import.kernel_id = (uint32_t)buffer;
24 + import.kernel_id = get_kernel_id(buffer);
26 /* Wrap it into a videocore buffer. */
27 status = vc_sm_cma_vchi_import(sm_state->sm_handle, &import, &result,
28 @@ -1231,6 +1231,7 @@ int vc_sm_cma_ioctl_alloc(struct vc_sm_p
29 buffer->size = import.size;
30 buffer->dma_addr = import.addr;
31 buffer->vpu_state = VPU_MAPPED;
32 + buffer->kernel_id = import.kernel_id;
33 //buffer->res_cached = ioparam->cached;
35 fd = dma_buf_fd(dmabuf, O_CLOEXEC);