From 7fda166c68c58887a90521911228ef734c7d4e4f Mon Sep 17 00:00:00 2001 From: Saman Sahebi Date: Mon, 31 Jul 2023 14:03:34 -0400 Subject: implemented GRCE to PCE mapping --- nvdebug.h | 4 +++- nvdebug_entry.c | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/nvdebug.h b/nvdebug.h index 6aa0f11..213a786 100644 --- a/nvdebug.h +++ b/nvdebug.h @@ -687,7 +687,9 @@ typedef union { Also see dev_ce.ref.txt of NVIDIA's open-gpu-doc for info. */ #define NV_PTOP_SCAL_NUM_CES 0x00022444 -//defined LCE->PCE mapping offset from nvgpu (same as ce_pce2lce_config_r(i) in nvgpu) +//defined GRCE->CE mapping offset from nvgpu +#define NV_GRCE_FOR_CE(i)(0x00104034+(i)*4) +//defined LCE->PCE mapping offset from nvgpu (same as ce_pce2lce_config_r(i) in nvgpu) #define NV_LCE_FOR_PCE(i)(0x00104040+(i)*4) /* Physical Copy Engine (PCE) information diff --git a/nvdebug_entry.c b/nvdebug_entry.c index e77b053..c444ff7 100644 --- a/nvdebug_entry.c +++ b/nvdebug_entry.c @@ -203,7 +203,7 @@ int create_tpc_mask_files(int device_id, struct proc_dir_entry *dir) { int __init nvdebug_init(void) { struct proc_dir_entry *dir, *preempt_entry, *disable_channel_entry, *enable_channel_entry, *switch_to_tsg_entry, *device_info_entry, - *num_gpcs_entry, *lce_for_pce_entry; + *num_gpcs_entry, *lce_for_pce_entry, *grce_for_pce_entry; int rl_create_err, tpc_masks_create_err; // Check that an NVIDIA GPU is present and initialize g_nvdebug_state int res = probe_and_cache_device(); @@ -275,8 +275,15 @@ int __init nvdebug_init(void) { snprintf(file_name, 20, "lce_for_pce%d",pce_id); lce_for_pce_entry = proc_create_data( file_name, 0444, dir, compat_ops(&nvdebug_read_reg32_file_ops), - (void*)(uintptr_t)NV_LCE_FOR_PCE(pce_id)); - } + (void*)(uintptr_t)NV_LCE_FOR_PCE(pce_id)); + snprintf(file_name, 20, "grce_for_pce%d",pce_id); + grce_for_pce_entry = proc_create_data( + file_name, 0444, dir, compat_ops(&nvdebug_read_reg32_file_ops), + (void*)(uintptr_t)NV_GRCE_FOR_CE(pce_id)); + + if (!lce_for_pce_entry || !grce_for_pce_entry) + return -ENOMEM; + } // TODO: Redo to num_pces num_gpcs_entry = proc_create_data( -- cgit v1.2.2