summaryrefslogtreecommitdiff
path: root/arch/arm/mm/ptdump_debugfs.c
diff options
context:
space:
mode:
authorJinbum Park <jinb.park7@gmail.com>2017-12-12 01:41:09 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2018-01-21 15:32:17 +0000
commit4fb69cc4566f175839615cc4ef8828ae4d5341d9 (patch)
tree6be5567a61f73980f6dae40869a8cdba1197951d /arch/arm/mm/ptdump_debugfs.c
parent6fbab054eccd14480d0c0805cab80db08e0fb3ee (diff)
ARM: 8735/1: mm: dump: make page table dumping reusable
This patch refactors the arm page table dumping code, so multiple tables may be registered with the framework. This patch refers below commits of arm64. (4674fdb9f149 ("arm64: mm: dump: make page table dumping reusable")) (4ddb9bf83349 ("arm64: dump: Make ptdump debugfs a separate option")) Reviewed-by: Kees Cook <keescook@chromium.org> Tested-by: Laura Abbott <labbott@redhat.com> Reviewed-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Jinbum Park <jinb.park7@gmail.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'arch/arm/mm/ptdump_debugfs.c')
-rw-r--r--arch/arm/mm/ptdump_debugfs.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c
new file mode 100644
index 000000000000..be8d87be4b93
--- /dev/null
+++ b/arch/arm/mm/ptdump_debugfs.c
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
+#include <asm/ptdump.h>
+
+static int ptdump_show(struct seq_file *m, void *v)
+{
+ struct ptdump_info *info = m->private;
+
+ ptdump_walk_pgd(m, info);
+ return 0;
+}
+
+static int ptdump_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, ptdump_show, inode->i_private);
+}
+
+static const struct file_operations ptdump_fops = {
+ .open = ptdump_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
+{
+ struct dentry *pe;
+
+ pe = debugfs_create_file(name, 0400, NULL, info, &ptdump_fops);
+ return pe ? 0 : -ENOMEM;
+
+}