2008-12-10 18:06:36 +09:00
/*
* debugfs ops for process ASIDs
*
* Copyright ( C ) 2000 , 2001 Paolo Alberelli
* Copyright ( C ) 2003 - 2008 Paul Mundt
* Copyright ( C ) 2003 , 2004 Richard Curnow
*
* Provides a debugfs file that lists out the ASIDs currently associated
* with the processes .
*
* In the SH - 5 case , if the DM . PC register is examined through the debug
* link , this shows ASID + PC . To make use of this , the PID - > ASID
* relationship needs to be known . This is primarily for debugging .
*
* This file is subject to the terms and conditions of the GNU General Public
* License . See the file " COPYING " in the main directory of this archive
* for more details .
*/
# include <linux/init.h>
# include <linux/debugfs.h>
# include <linux/seq_file.h>
# include <linux/spinlock.h>
2017-02-08 18:51:30 +01:00
# include <linux/sched/signal.h>
2017-02-08 18:51:36 +01:00
# include <linux/sched/task.h>
2017-02-08 18:51:30 +01:00
2008-12-10 18:06:36 +09:00
# include <asm/processor.h>
# include <asm/mmu_context.h>
2020-09-19 10:52:05 +08:00
static int asids_debugfs_show ( struct seq_file * file , void * iter )
2008-12-10 18:06:36 +09:00
{
struct task_struct * p ;
read_lock ( & tasklist_lock ) ;
for_each_process ( p ) {
int pid = p - > pid ;
if ( unlikely ( ! pid ) )
continue ;
if ( p - > mm )
2009-03-17 17:59:31 +09:00
seq_printf ( file , " %5d : %04lx \n " , pid ,
2008-12-10 18:06:36 +09:00
cpu_asid ( smp_processor_id ( ) , p - > mm ) ) ;
}
read_unlock ( & tasklist_lock ) ;
return 0 ;
}
2020-09-19 10:52:05 +08:00
DEFINE_SHOW_ATTRIBUTE ( asids_debugfs ) ;
2008-12-10 18:06:36 +09:00
static int __init asids_debugfs_init ( void )
{
2019-01-22 15:50:30 +01:00
debugfs_create_file ( " asids " , S_IRUSR , arch_debugfs_dir , NULL ,
& asids_debugfs_fops ) ;
return 0 ;
2008-12-10 18:06:36 +09:00
}
2016-04-22 14:07:02 -04:00
device_initcall ( asids_debugfs_init ) ;