diff options
author | Laura Abbott <labbott@redhat.com> | 2016-10-27 18:27:31 +0200 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2016-11-07 19:15:04 +0100 |
commit | 4ddb9bf83349b4f4f8178e58c3654ac7ec7edbc6 (patch) | |
tree | 6d5ee3eb03f7afda1a006bda20bfa094c57df037 /arch/arm64/mm/ptdump_debugfs.c | |
parent | arm64: mm: set the contiguous bit for kernel mappings where appropriate (diff) | |
download | linux-4ddb9bf83349b4f4f8178e58c3654ac7ec7edbc6.tar.xz linux-4ddb9bf83349b4f4f8178e58c3654ac7ec7edbc6.zip |
arm64: dump: Make ptdump debugfs a separate option
ptdump_register currently initializes a set of page table information and
registers debugfs. There are uses for the ptdump option without wanting the
debugfs options. Split this out to make it a separate option.
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/mm/ptdump_debugfs.c')
-rw-r--r-- | arch/arm64/mm/ptdump_debugfs.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm64/mm/ptdump_debugfs.c b/arch/arm64/mm/ptdump_debugfs.c new file mode 100644 index 000000000000..eee4d864350c --- /dev/null +++ b/arch/arm64/mm/ptdump_debugfs.c @@ -0,0 +1,31 @@ +#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; + +} |