Refactor memory mapping with DSP address tracking#299
Refactor memory mapping with DSP address tracking#299quic-vkatoch wants to merge 2 commits intoqualcomm:developmentfrom
Conversation
Remove rpcmem_set_dmabuf_name() which was a no-op dummy function. Cleaned up declaration, implementation, and all call sites. Signed-off-by: Vinayak Katoch <[email protected]>
6a63077 to
cc429b1
Compare
Head branch was pushed to by a user without write access
cc429b1 to
d1f5390
Compare
d1f5390 to
3b6206f
Compare
Introduce fastrpc_mmap_internal() and fastrpc_munmap_internal() to handle buffer mapping with DSP virtual address management. These functions maintain mappings in the static map list and enable lookup by DSP virtual address. Extract common mmap logic into fastrpc_mmap_helper() to eliminate code duplication between fastrpc_mmap() and fastrpc_mmap_internal(). Simplify apps_mem_request_map64() by removing conditional allocation logic and always allocating in userspace, then using fastrpc_mmap_internal() for mapping. Update apps_mem_request_unmap64() to route to appropriate unmap function based on mapping type: - FASTRPC_ALLOC_HLOS_FD: use fastrpc_munmap() - ADSP_MMAP_HEAP_ADDR/ADSP_MMAP_REMOTE_HEAP_ADDR: use remote_munmap64() - Other allocations: use fastrpc_munmap_internal() Signed-off-by: Vinayak Katoch <[email protected]>
3b6206f to
6ad405c
Compare
| fd = rpcmem_to_fd_internal(buf); | ||
| VERIFYC(fd > 0, AEE_EBADPARM); | ||
| } | ||
| VERIFYC(NULL != (buf = rpcmem_alloc_internal(heapid, lflags, len)), |
There was a problem hiding this comment.
for signed or unsigned we will allocate in user space always now, why? is okay to allocate signed memory in user space
There was a problem hiding this comment.
There isn’t a clear or specific technical reason for this. However, allocating it in user space is acceptable and works for our use case.
| * | ||
| * @return 0 on success, error code on failure | ||
| */ | ||
| int fastrpc_mmap_internal(int domain, int fd, void *vaddr, int offset, size_t length, uint32_t flags, uint64_t *raddr); |
There was a problem hiding this comment.
for offset shouldn't we use unsigned vars?
There was a problem hiding this comment.
Since fastrpc_mmap uses an int for the offset, we are keeping it the same here.
|
|
||
| VERIFY(AEE_SUCCESS == (nErr = fastrpc_init_once())); | ||
|
|
||
| VERIFYC(raddr != NULL, AEE_EBADPARM); |
There was a problem hiding this comment.
verify requested length is greater than 0
There was a problem hiding this comment.
This is already handled earlier inside the rpcmem_alloc_internal function.
Refactor memory mapping implementation to use internal functions with DSP virtual address tracking and simplify allocation logic.