gpu: nvgpu: Add get_gr_context support for Linux.

Implement the feature of retrieving gr context contents for all chips.
Two IOCTLs, NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT_SIZE and _GET_GR_CONTEXT,
are added.

Bug 3102903

Change-Id: If11006f4e294f190785a2c3159ca491b9f3b5187
Signed-off-by: Lili Sang <lilis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2449183
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Chris Johnson <cwj@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Lili Sang
2020-11-16 13:30:20 -08:00
committed by Alex Waterman
parent 471ea46f91
commit 3f0ea98b73
6 changed files with 225 additions and 2 deletions

View File

@@ -197,6 +197,8 @@ struct nvgpu_gpu_zbc_query_table_args {
#define NVGPU_GPU_FLAGS_SUPPORT_PROFILER_V2_CONTEXT (1ULL << 47)
/* Profiling SMPC in global mode is supported */
#define NVGPU_GPU_FLAGS_SUPPORT_SMPC_GLOBAL_MODE (1ULL << 48)
/* Retrieving contents of graphics context is supported */
#define NVGPU_GPU_FLAGS_SUPPORT_GET_GR_CONTEXT (1ULL << 49)
/* SM LRF ECC is enabled */
#define NVGPU_GPU_FLAGS_ECC_ENABLED_SM_LRF (1ULL << 60)
/* SM SHM ECC is enabled */
@@ -1505,8 +1507,30 @@ struct nvgpu_dbg_gpu_set_ctx_mmu_debug_mode_args {
_IOW(NVGPU_DBG_GPU_IOCTL_MAGIC, 26, \
struct nvgpu_dbg_gpu_set_ctx_mmu_debug_mode_args)
/* Get gr context size */
struct nvgpu_dbg_gpu_get_gr_context_size_args {
__u32 size;
__u32 reserved;
};
#define NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT_SIZE \
_IOR(NVGPU_DBG_GPU_IOCTL_MAGIC, 27, \
struct nvgpu_dbg_gpu_get_gr_context_size_args)
/* Get gr context */
struct nvgpu_dbg_gpu_get_gr_context_args {
__u64 buffer; /* in/out: the output buffer containing contents of the gr context.
buffer address is given by the user */
__u32 size; /* in: size of the context buffer */
__u32 reserved;
};
#define NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT \
_IOW(NVGPU_DBG_GPU_IOCTL_MAGIC, 28, \
struct nvgpu_dbg_gpu_get_gr_context_args)
#define NVGPU_DBG_GPU_IOCTL_LAST \
_IOC_NR(NVGPU_DBG_GPU_IOCTL_SET_CTX_MMU_DEBUG_MODE)
_IOC_NR(NVGPU_DBG_GPU_IOCTL_GET_GR_CONTEXT)
#define NVGPU_DBG_GPU_IOCTL_MAX_ARG_SIZE \
sizeof(struct nvgpu_dbg_gpu_access_fb_memory_args)