gpu: nvgpu: API to access fb memory

Add IOCTL API NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY
to read/write fb/vidmem memory

Interface will accept dmabuf_fd of the buffer in vidmem,
offset into the buffer to access, temporary buffer
to copy data across API, size of read/write and
command indicating either read or write operation

API will first parse all the inputs, and then call
gk20a_vidbuf_access_memory() to complete fb access

gk20a_vidbuf_access_memory() will then just use
gk20a_mem_rd_n() or gk20a_mem_wr_n() depending
on the command issued

Bug 1804714
Jira DNVGPU-192

Change-Id: Iba3c42410abe12c2884d3b603fa33d27782e4c56
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1255556
(cherry picked from commit 2c49a8a79d93fc526adbf6f808484fa9a3fa2498)
Reviewed-on: http://git-master/r/1260471
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
This commit is contained in:
Deepak Nibade
2016-11-16 15:19:12 +05:30
committed by mobile promotions
parent 5f6a2aa02b
commit af5d2d208a
4 changed files with 138 additions and 2 deletions

View File

@@ -917,11 +917,28 @@ struct nvgpu_dbg_gpu_suspend_resume_contexts_args {
_IOWR(NVGPU_DBG_GPU_IOCTL_MAGIC, 18, struct nvgpu_dbg_gpu_suspend_resume_contexts_args)
#define NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY_CMD_READ 1
#define NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY_CMD_WRITE 2
struct nvgpu_dbg_gpu_access_fb_memory_args {
__u32 cmd; /* in: either read or write */
__s32 dmabuf_fd; /* in: dmabuf fd of the buffer in FB */
__u64 offset; /* in: offset within buffer in FB, should be 4B aligned */
__u64 buffer; /* in/out: temp buffer to read/write from */
__u64 size; /* in: size of the buffer i.e. size of read/write in bytes, should be 4B aligned */
};
#define NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY \
_IOWR(NVGPU_DBG_GPU_IOCTL_MAGIC, 19, struct nvgpu_dbg_gpu_access_fb_memory_args)
#define NVGPU_DBG_GPU_IOCTL_LAST \
_IOC_NR(NVGPU_DBG_GPU_IOCTL_SUSPEND_RESUME_CONTEXTS)
_IOC_NR(NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY)
#define NVGPU_DBG_GPU_IOCTL_MAX_ARG_SIZE \
sizeof(struct nvgpu_dbg_gpu_perfbuf_map_args)
sizeof(struct nvgpu_dbg_gpu_access_fb_memory_args)
/*
* /dev/nvhost-gpu device