]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/sh/mm/asids-debugfs.c
sched/headers: Prepare for new header dependencies before moving code to <linux/sched...
[mirror_ubuntu-artful-kernel.git] / arch / sh / mm / asids-debugfs.c
CommitLineData
a99d6fde
PM
1/*
2 * debugfs ops for process ASIDs
3 *
4 * Copyright (C) 2000, 2001 Paolo Alberelli
5 * Copyright (C) 2003 - 2008 Paul Mundt
6 * Copyright (C) 2003, 2004 Richard Curnow
7 *
8 * Provides a debugfs file that lists out the ASIDs currently associated
9 * with the processes.
10 *
11 * In the SH-5 case, if the DM.PC register is examined through the debug
12 * link, this shows ASID + PC. To make use of this, the PID->ASID
13 * relationship needs to be known. This is primarily for debugging.
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/init.h>
a99d6fde
PM
20#include <linux/debugfs.h>
21#include <linux/seq_file.h>
22#include <linux/spinlock.h>
3f07c014
IM
23#include <linux/sched/signal.h>
24
a99d6fde
PM
25#include <asm/processor.h>
26#include <asm/mmu_context.h>
27
28static int asids_seq_show(struct seq_file *file, void *iter)
29{
30 struct task_struct *p;
31
32 read_lock(&tasklist_lock);
33
34 for_each_process(p) {
35 int pid = p->pid;
36
37 if (unlikely(!pid))
38 continue;
39
40 if (p->mm)
3a3b311c 41 seq_printf(file, "%5d : %04lx\n", pid,
a99d6fde 42 cpu_asid(smp_processor_id(), p->mm));
a99d6fde
PM
43 }
44
45 read_unlock(&tasklist_lock);
46
47 return 0;
48}
49
50static int asids_debugfs_open(struct inode *inode, struct file *file)
51{
52 return single_open(file, asids_seq_show, inode->i_private);
53}
54
55static const struct file_operations asids_debugfs_fops = {
56 .owner = THIS_MODULE,
57 .open = asids_debugfs_open,
58 .read = seq_read,
59 .llseek = seq_lseek,
60 .release = single_release,
61};
62
63static int __init asids_debugfs_init(void)
64{
65 struct dentry *asids_dentry;
66
3f224f4e 67 asids_dentry = debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir,
a99d6fde
PM
68 NULL, &asids_debugfs_fops);
69 if (!asids_dentry)
70 return -ENOMEM;
a99d6fde 71
88f9802c 72 return PTR_ERR_OR_ZERO(asids_dentry);
a99d6fde 73}
f15412aa 74device_initcall(asids_debugfs_init);