blob: d29d722ec3ec6e58f1ca795913a4515ae639365f [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Laura Abbott4ddb9bf2016-10-27 09:27:31 -07002#include <linux/debugfs.h>
Anshuman Khandualbf2b59f2020-03-04 09:58:42 +05303#include <linux/memory_hotplug.h>
Laura Abbott4ddb9bf2016-10-27 09:27:31 -07004#include <linux/seq_file.h>
5
6#include <asm/ptdump.h>
7
8static int ptdump_show(struct seq_file *m, void *v)
9{
10 struct ptdump_info *info = m->private;
Anshuman Khandualbf2b59f2020-03-04 09:58:42 +053011
12 get_online_mems();
Steven Price102f45f2020-02-03 17:36:29 -080013 ptdump_walk(m, info);
Anshuman Khandualbf2b59f2020-03-04 09:58:42 +053014 put_online_mems();
Laura Abbott4ddb9bf2016-10-27 09:27:31 -070015 return 0;
16}
Peng Donglin90aff8d2018-06-13 09:11:56 +080017DEFINE_SHOW_ATTRIBUTE(ptdump);
Laura Abbott4ddb9bf2016-10-27 09:27:31 -070018
Greg Kroah-Hartmane2a2e562019-01-22 15:41:11 +010019void ptdump_debugfs_register(struct ptdump_info *info, const char *name)
Laura Abbott4ddb9bf2016-10-27 09:27:31 -070020{
Greg Kroah-Hartmane2a2e562019-01-22 15:41:11 +010021 debugfs_create_file(name, 0400, NULL, info, &ptdump_fops);
Laura Abbott4ddb9bf2016-10-27 09:27:31 -070022}