@@ -203,6 +203,44 @@ nouveau_debugfs_pstate_open(struct inode *inode, struct file *file)
203203 return single_open (file , nouveau_debugfs_pstate_get , inode -> i_private );
204204}
205205
206+ static void
207+ nouveau_debugfs_gpuva_regions (struct seq_file * m , struct nouveau_uvmm * uvmm )
208+ {
209+ MA_STATE (mas , & uvmm -> region_mt , 0 , 0 );
210+ struct nouveau_uvma_region * reg ;
211+
212+ seq_puts (m , " VA regions | start | range | end \n" );
213+ seq_puts (m , "----------------------------------------------------------------------------\n" );
214+ mas_for_each (& mas , reg , ULONG_MAX )
215+ seq_printf (m , " | 0x%016llx | 0x%016llx | 0x%016llx\n" ,
216+ reg -> va .addr , reg -> va .range , reg -> va .addr + reg -> va .range );
217+ }
218+
219+ static int
220+ nouveau_debugfs_gpuva (struct seq_file * m , void * data )
221+ {
222+ struct drm_info_node * node = (struct drm_info_node * ) m -> private ;
223+ struct nouveau_drm * drm = nouveau_drm (node -> minor -> dev );
224+ struct nouveau_cli * cli ;
225+
226+ mutex_lock (& drm -> clients_lock );
227+ list_for_each_entry (cli , & drm -> clients , head ) {
228+ struct nouveau_uvmm * uvmm = nouveau_cli_uvmm (cli );
229+
230+ if (!uvmm )
231+ continue ;
232+
233+ nouveau_uvmm_lock (uvmm );
234+ drm_debugfs_gpuva_info (m , & uvmm -> umgr );
235+ seq_puts (m , "\n" );
236+ nouveau_debugfs_gpuva_regions (m , uvmm );
237+ nouveau_uvmm_unlock (uvmm );
238+ }
239+ mutex_unlock (& drm -> clients_lock );
240+
241+ return 0 ;
242+ }
243+
206244static const struct file_operations nouveau_pstate_fops = {
207245 .owner = THIS_MODULE ,
208246 .open = nouveau_debugfs_pstate_open ,
@@ -214,6 +252,7 @@ static const struct file_operations nouveau_pstate_fops = {
214252static struct drm_info_list nouveau_debugfs_list [] = {
215253 { "vbios.rom" , nouveau_debugfs_vbios_image , 0 , NULL },
216254 { "strap_peek" , nouveau_debugfs_strap_peek , 0 , NULL },
255+ DRM_DEBUGFS_GPUVA_INFO (nouveau_debugfs_gpuva , NULL ),
217256};
218257#define NOUVEAU_DEBUGFS_ENTRIES ARRAY_SIZE(nouveau_debugfs_list)
219258
0 commit comments