1b886d83cSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2e66c3209SChristophe Leroy /*
3e66c3209SChristophe Leroy * Copyright 2016, Rashmica Gupta, IBM Corp.
4e66c3209SChristophe Leroy *
5e66c3209SChristophe Leroy * This traverses the kernel pagetables and dumps the
6e66c3209SChristophe Leroy * information about the used sections of memory to
7e66c3209SChristophe Leroy * /sys/kernel/debug/kernel_pagetables.
8e66c3209SChristophe Leroy *
9e66c3209SChristophe Leroy * Derived from the arm64 implementation:
10e66c3209SChristophe Leroy * Copyright (c) 2014, The Linux Foundation, Laura Abbott.
11e66c3209SChristophe Leroy * (C) Copyright 2008 Intel Corporation, Arjan van de Ven.
12e66c3209SChristophe Leroy */
13e66c3209SChristophe Leroy #include <linux/debugfs.h>
14e66c3209SChristophe Leroy #include <linux/fs.h>
15e66c3209SChristophe Leroy #include <linux/hugetlb.h>
16e66c3209SChristophe Leroy #include <linux/io.h>
17e66c3209SChristophe Leroy #include <linux/mm.h>
18e66c3209SChristophe Leroy #include <linux/highmem.h>
19e0847283SChristophe Leroy #include <linux/ptdump.h>
20e66c3209SChristophe Leroy #include <linux/sched.h>
21e66c3209SChristophe Leroy #include <linux/seq_file.h>
22e66c3209SChristophe Leroy #include <asm/fixmap.h>
23e66c3209SChristophe Leroy #include <linux/const.h>
24*41b7a347SDaniel Axtens #include <linux/kasan.h>
25e66c3209SChristophe Leroy #include <asm/page.h>
266b789a26SChristophe Leroy #include <asm/hugetlb.h>
27e66c3209SChristophe Leroy
281e1c8b2cSChristophe Leroy #include <mm/mmu_decl.h>
291e1c8b2cSChristophe Leroy
30e66c3209SChristophe Leroy #include "ptdump.h"
31e66c3209SChristophe Leroy
32e66c3209SChristophe Leroy /*
33e66c3209SChristophe Leroy * To visualise what is happening,
34e66c3209SChristophe Leroy *
35e66c3209SChristophe Leroy * - PTRS_PER_P** = how many entries there are in the corresponding P**
36e66c3209SChristophe Leroy * - P**_SHIFT = how many bits of the address we use to index into the
37e66c3209SChristophe Leroy * corresponding P**
38e66c3209SChristophe Leroy * - P**_SIZE is how much memory we can access through the table - not the
39e66c3209SChristophe Leroy * size of the table itself.
40e66c3209SChristophe Leroy * P**={PGD, PUD, PMD, PTE}
41e66c3209SChristophe Leroy *
42e66c3209SChristophe Leroy *
43e66c3209SChristophe Leroy * Each entry of the PGD points to a PUD. Each entry of a PUD points to a
44e66c3209SChristophe Leroy * PMD. Each entry of a PMD points to a PTE. And every PTE entry points to
45e66c3209SChristophe Leroy * a page.
46e66c3209SChristophe Leroy *
47e66c3209SChristophe Leroy * In the case where there are only 3 levels, the PUD is folded into the
48e66c3209SChristophe Leroy * PGD: every PUD has only one entry which points to the PMD.
49e66c3209SChristophe Leroy *
50e66c3209SChristophe Leroy * The page dumper groups page table entries of the same type into a single
51e66c3209SChristophe Leroy * description. It uses pg_state to track the range information while
52e66c3209SChristophe Leroy * iterating over the PTE entries. When the continuity is broken it then
53e66c3209SChristophe Leroy * dumps out a description of the range - ie PTEs that are virtually contiguous
54e66c3209SChristophe Leroy * with the same PTE flags are chunked together. This is to make it clear how
55e66c3209SChristophe Leroy * different areas of the kernel virtual memory are used.
56e66c3209SChristophe Leroy *
57e66c3209SChristophe Leroy */
58e66c3209SChristophe Leroy struct pg_state {
59e0847283SChristophe Leroy struct ptdump_state ptdump;
60e66c3209SChristophe Leroy struct seq_file *seq;
61e66c3209SChristophe Leroy const struct addr_marker *marker;
62e66c3209SChristophe Leroy unsigned long start_address;
63e66c3209SChristophe Leroy unsigned long start_pa;
64cf98d2b6SChristophe Leroy int level;
65e66c3209SChristophe Leroy u64 current_flags;
66453d87f6SRussell Currey bool check_wx;
67453d87f6SRussell Currey unsigned long wx_pages;
68e66c3209SChristophe Leroy };
69e66c3209SChristophe Leroy
70e66c3209SChristophe Leroy struct addr_marker {
71e66c3209SChristophe Leroy unsigned long start_address;
72e66c3209SChristophe Leroy const char *name;
73e66c3209SChristophe Leroy };
74e66c3209SChristophe Leroy
75e66c3209SChristophe Leroy static struct addr_marker address_markers[] = {
76e66c3209SChristophe Leroy { 0, "Start of kernel VM" },
776ca05532SChristophe Leroy #ifdef MODULES_VADDR
786ca05532SChristophe Leroy { 0, "modules start" },
796ca05532SChristophe Leroy { 0, "modules end" },
806ca05532SChristophe Leroy #endif
81e66c3209SChristophe Leroy { 0, "vmalloc() Area" },
82e66c3209SChristophe Leroy { 0, "vmalloc() End" },
83e66c3209SChristophe Leroy #ifdef CONFIG_PPC64
84e66c3209SChristophe Leroy { 0, "isa I/O start" },
85e66c3209SChristophe Leroy { 0, "isa I/O end" },
86e66c3209SChristophe Leroy { 0, "phb I/O start" },
87e66c3209SChristophe Leroy { 0, "phb I/O end" },
88e66c3209SChristophe Leroy { 0, "I/O remap start" },
89e66c3209SChristophe Leroy { 0, "I/O remap end" },
90e66c3209SChristophe Leroy { 0, "vmemmap start" },
91e66c3209SChristophe Leroy #else
92e66c3209SChristophe Leroy { 0, "Early I/O remap start" },
93e66c3209SChristophe Leroy { 0, "Early I/O remap end" },
94e66c3209SChristophe Leroy #ifdef CONFIG_HIGHMEM
95e66c3209SChristophe Leroy { 0, "Highmem PTEs start" },
96e66c3209SChristophe Leroy { 0, "Highmem PTEs end" },
97e66c3209SChristophe Leroy #endif
98e66c3209SChristophe Leroy { 0, "Fixmap start" },
99e66c3209SChristophe Leroy { 0, "Fixmap end" },
100e66c3209SChristophe Leroy #endif
101b4abe38fSChristophe Leroy #ifdef CONFIG_KASAN
102b4abe38fSChristophe Leroy { 0, "kasan shadow mem start" },
103b4abe38fSChristophe Leroy { 0, "kasan shadow mem end" },
104b4abe38fSChristophe Leroy #endif
105e66c3209SChristophe Leroy { -1, NULL },
106e66c3209SChristophe Leroy };
107e66c3209SChristophe Leroy
108e0847283SChristophe Leroy static struct ptdump_range ptdump_range[] __ro_after_init = {
109e0847283SChristophe Leroy {TASK_SIZE_MAX, ~0UL},
110e0847283SChristophe Leroy {0, 0}
111e0847283SChristophe Leroy };
112e0847283SChristophe Leroy
1135f18cbdbSRussell Currey #define pt_dump_seq_printf(m, fmt, args...) \
1145f18cbdbSRussell Currey ({ \
1155f18cbdbSRussell Currey if (m) \
1165f18cbdbSRussell Currey seq_printf(m, fmt, ##args); \
1175f18cbdbSRussell Currey })
1185f18cbdbSRussell Currey
1195f18cbdbSRussell Currey #define pt_dump_seq_putc(m, c) \
1205f18cbdbSRussell Currey ({ \
1215f18cbdbSRussell Currey if (m) \
1225f18cbdbSRussell Currey seq_putc(m, c); \
1235f18cbdbSRussell Currey })
1245f18cbdbSRussell Currey
pt_dump_size(struct seq_file * m,unsigned long size)1256b30830eSChristophe Leroy void pt_dump_size(struct seq_file *m, unsigned long size)
1266b30830eSChristophe Leroy {
1276b30830eSChristophe Leroy static const char units[] = " KMGTPE";
1286b30830eSChristophe Leroy const char *unit = units;
1296b30830eSChristophe Leroy
1306b30830eSChristophe Leroy /* Work out what appropriate unit to use */
1316b30830eSChristophe Leroy while (!(size & 1023) && unit[1]) {
1326b30830eSChristophe Leroy size >>= 10;
1336b30830eSChristophe Leroy unit++;
1346b30830eSChristophe Leroy }
1356b30830eSChristophe Leroy pt_dump_seq_printf(m, "%9lu%c ", size, *unit);
1366b30830eSChristophe Leroy }
1376b30830eSChristophe Leroy
dump_flag_info(struct pg_state * st,const struct flag_info * flag,u64 pte,int num)138e66c3209SChristophe Leroy static void dump_flag_info(struct pg_state *st, const struct flag_info
139e66c3209SChristophe Leroy *flag, u64 pte, int num)
140e66c3209SChristophe Leroy {
141e66c3209SChristophe Leroy unsigned int i;
142e66c3209SChristophe Leroy
143e66c3209SChristophe Leroy for (i = 0; i < num; i++, flag++) {
144e66c3209SChristophe Leroy const char *s = NULL;
145e66c3209SChristophe Leroy u64 val;
146e66c3209SChristophe Leroy
147e66c3209SChristophe Leroy /* flag not defined so don't check it */
148e66c3209SChristophe Leroy if (flag->mask == 0)
149e66c3209SChristophe Leroy continue;
150e66c3209SChristophe Leroy /* Some 'flags' are actually values */
151e66c3209SChristophe Leroy if (flag->is_val) {
152e66c3209SChristophe Leroy val = pte & flag->val;
153e66c3209SChristophe Leroy if (flag->shift)
154e66c3209SChristophe Leroy val = val >> flag->shift;
1555f18cbdbSRussell Currey pt_dump_seq_printf(st->seq, " %s:%llx", flag->set, val);
156e66c3209SChristophe Leroy } else {
157e66c3209SChristophe Leroy if ((pte & flag->mask) == flag->val)
158e66c3209SChristophe Leroy s = flag->set;
159e66c3209SChristophe Leroy else
160e66c3209SChristophe Leroy s = flag->clear;
161e66c3209SChristophe Leroy if (s)
1625f18cbdbSRussell Currey pt_dump_seq_printf(st->seq, " %s", s);
163e66c3209SChristophe Leroy }
164e66c3209SChristophe Leroy st->current_flags &= ~flag->mask;
165e66c3209SChristophe Leroy }
166e66c3209SChristophe Leroy if (st->current_flags != 0)
1675f18cbdbSRussell Currey pt_dump_seq_printf(st->seq, " unknown flags:%llx", st->current_flags);
168e66c3209SChristophe Leroy }
169e66c3209SChristophe Leroy
dump_addr(struct pg_state * st,unsigned long addr)170e66c3209SChristophe Leroy static void dump_addr(struct pg_state *st, unsigned long addr)
171e66c3209SChristophe Leroy {
172e66c3209SChristophe Leroy #ifdef CONFIG_PPC64
173e66c3209SChristophe Leroy #define REG "0x%016lx"
174e66c3209SChristophe Leroy #else
175e66c3209SChristophe Leroy #define REG "0x%08lx"
176e66c3209SChristophe Leroy #endif
177e66c3209SChristophe Leroy
1785f18cbdbSRussell Currey pt_dump_seq_printf(st->seq, REG "-" REG " ", st->start_address, addr - 1);
1795f18cbdbSRussell Currey pt_dump_seq_printf(st->seq, " " REG " ", st->start_pa);
180cdc81aecSChristophe Leroy pt_dump_size(st->seq, addr - st->start_address);
181e66c3209SChristophe Leroy }
182e66c3209SChristophe Leroy
note_prot_wx(struct pg_state * st,unsigned long addr)183453d87f6SRussell Currey static void note_prot_wx(struct pg_state *st, unsigned long addr)
184453d87f6SRussell Currey {
185d80ae83fSChristophe Leroy pte_t pte = __pte(st->current_flags);
186d80ae83fSChristophe Leroy
1878d84fca4SMichael Ellerman if (!IS_ENABLED(CONFIG_DEBUG_WX) || !st->check_wx)
188453d87f6SRussell Currey return;
189453d87f6SRussell Currey
190d80ae83fSChristophe Leroy if (!pte_write(pte) || !pte_exec(pte))
191453d87f6SRussell Currey return;
192453d87f6SRussell Currey
193453d87f6SRussell Currey WARN_ONCE(1, "powerpc/mm: Found insecure W+X mapping at address %p/%pS\n",
194453d87f6SRussell Currey (void *)st->start_address, (void *)st->start_address);
195453d87f6SRussell Currey
196453d87f6SRussell Currey st->wx_pages += (addr - st->start_address) / PAGE_SIZE;
197453d87f6SRussell Currey }
198453d87f6SRussell Currey
note_page_update_state(struct pg_state * st,unsigned long addr,int level,u64 val)199cf98d2b6SChristophe Leroy static void note_page_update_state(struct pg_state *st, unsigned long addr, int level, u64 val)
200e54e30bcSChristophe Leroy {
201cf98d2b6SChristophe Leroy u64 flag = level >= 0 ? val & pg_level[level].mask : 0;
202e54e30bcSChristophe Leroy u64 pa = val & PTE_RPN_MASK;
203e54e30bcSChristophe Leroy
204e54e30bcSChristophe Leroy st->level = level;
205e54e30bcSChristophe Leroy st->current_flags = flag;
206e54e30bcSChristophe Leroy st->start_address = addr;
207e54e30bcSChristophe Leroy st->start_pa = pa;
208e54e30bcSChristophe Leroy
209e54e30bcSChristophe Leroy while (addr >= st->marker[1].start_address) {
210e54e30bcSChristophe Leroy st->marker++;
211e54e30bcSChristophe Leroy pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
212e54e30bcSChristophe Leroy }
213e54e30bcSChristophe Leroy }
214e54e30bcSChristophe Leroy
note_page(struct ptdump_state * pt_st,unsigned long addr,int level,u64 val)215e0847283SChristophe Leroy static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, u64 val)
216e66c3209SChristophe Leroy {
217cf98d2b6SChristophe Leroy u64 flag = level >= 0 ? val & pg_level[level].mask : 0;
218e0847283SChristophe Leroy struct pg_state *st = container_of(pt_st, struct pg_state, ptdump);
219e66c3209SChristophe Leroy
220e66c3209SChristophe Leroy /* At first no level is set */
221cf98d2b6SChristophe Leroy if (st->level == -1) {
2225f18cbdbSRussell Currey pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
22364b87b0cSChristophe Leroy note_page_update_state(st, addr, level, val);
224e66c3209SChristophe Leroy /*
225e66c3209SChristophe Leroy * Dump the section of virtual memory when:
226e66c3209SChristophe Leroy * - the PTE flags from one entry to the next differs.
227e66c3209SChristophe Leroy * - we change levels in the tree.
228e66c3209SChristophe Leroy * - the address is in a different section of memory and is thus
229e66c3209SChristophe Leroy * used for a different purpose, regardless of the flags.
230e66c3209SChristophe Leroy */
231e66c3209SChristophe Leroy } else if (flag != st->current_flags || level != st->level ||
2326ca6512cSChristophe Leroy addr >= st->marker[1].start_address) {
233e66c3209SChristophe Leroy
234e66c3209SChristophe Leroy /* Check the PTE flags */
235e66c3209SChristophe Leroy if (st->current_flags) {
236453d87f6SRussell Currey note_prot_wx(st, addr);
237e66c3209SChristophe Leroy dump_addr(st, addr);
238e66c3209SChristophe Leroy
239e66c3209SChristophe Leroy /* Dump all the flags */
240e66c3209SChristophe Leroy if (pg_level[st->level].flag)
241e66c3209SChristophe Leroy dump_flag_info(st, pg_level[st->level].flag,
242e66c3209SChristophe Leroy st->current_flags,
243e66c3209SChristophe Leroy pg_level[st->level].num);
244e66c3209SChristophe Leroy
2455f18cbdbSRussell Currey pt_dump_seq_putc(st->seq, '\n');
246e66c3209SChristophe Leroy }
247e66c3209SChristophe Leroy
248e66c3209SChristophe Leroy /*
249e66c3209SChristophe Leroy * Address indicates we have passed the end of the
250e66c3209SChristophe Leroy * current section of virtual memory
251e66c3209SChristophe Leroy */
25264b87b0cSChristophe Leroy note_page_update_state(st, addr, level, val);
253e66c3209SChristophe Leroy }
254e66c3209SChristophe Leroy }
255e66c3209SChristophe Leroy
populate_markers(void)256e66c3209SChristophe Leroy static void populate_markers(void)
257e66c3209SChristophe Leroy {
258e66c3209SChristophe Leroy int i = 0;
259e66c3209SChristophe Leroy
260b6be1bb7SChristophe Leroy #ifdef CONFIG_PPC64
261e66c3209SChristophe Leroy address_markers[i++].start_address = PAGE_OFFSET;
262b6be1bb7SChristophe Leroy #else
263b6be1bb7SChristophe Leroy address_markers[i++].start_address = TASK_SIZE;
264b6be1bb7SChristophe Leroy #endif
2656ca05532SChristophe Leroy #ifdef MODULES_VADDR
2666ca05532SChristophe Leroy address_markers[i++].start_address = MODULES_VADDR;
2676ca05532SChristophe Leroy address_markers[i++].start_address = MODULES_END;
2686ca05532SChristophe Leroy #endif
269e66c3209SChristophe Leroy address_markers[i++].start_address = VMALLOC_START;
270e66c3209SChristophe Leroy address_markers[i++].start_address = VMALLOC_END;
271e66c3209SChristophe Leroy #ifdef CONFIG_PPC64
272e66c3209SChristophe Leroy address_markers[i++].start_address = ISA_IO_BASE;
273e66c3209SChristophe Leroy address_markers[i++].start_address = ISA_IO_END;
274e66c3209SChristophe Leroy address_markers[i++].start_address = PHB_IO_BASE;
275e66c3209SChristophe Leroy address_markers[i++].start_address = PHB_IO_END;
276e66c3209SChristophe Leroy address_markers[i++].start_address = IOREMAP_BASE;
277e66c3209SChristophe Leroy address_markers[i++].start_address = IOREMAP_END;
2780034d395SAneesh Kumar K.V /* What is the ifdef about? */
279e66c3209SChristophe Leroy #ifdef CONFIG_PPC_BOOK3S_64
2800034d395SAneesh Kumar K.V address_markers[i++].start_address = H_VMEMMAP_START;
281e66c3209SChristophe Leroy #else
282e66c3209SChristophe Leroy address_markers[i++].start_address = VMEMMAP_BASE;
283e66c3209SChristophe Leroy #endif
284e66c3209SChristophe Leroy #else /* !CONFIG_PPC64 */
285e66c3209SChristophe Leroy address_markers[i++].start_address = ioremap_bot;
286e66c3209SChristophe Leroy address_markers[i++].start_address = IOREMAP_TOP;
287e66c3209SChristophe Leroy #ifdef CONFIG_HIGHMEM
288e66c3209SChristophe Leroy address_markers[i++].start_address = PKMAP_BASE;
289e66c3209SChristophe Leroy address_markers[i++].start_address = PKMAP_ADDR(LAST_PKMAP);
290e66c3209SChristophe Leroy #endif
291e66c3209SChristophe Leroy address_markers[i++].start_address = FIXADDR_START;
292e66c3209SChristophe Leroy address_markers[i++].start_address = FIXADDR_TOP;
293*41b7a347SDaniel Axtens #endif /* CONFIG_PPC64 */
294b4abe38fSChristophe Leroy #ifdef CONFIG_KASAN
295b4abe38fSChristophe Leroy address_markers[i++].start_address = KASAN_SHADOW_START;
296b4abe38fSChristophe Leroy address_markers[i++].start_address = KASAN_SHADOW_END;
297b4abe38fSChristophe Leroy #endif
298e66c3209SChristophe Leroy }
299e66c3209SChristophe Leroy
ptdump_show(struct seq_file * m,void * v)300e66c3209SChristophe Leroy static int ptdump_show(struct seq_file *m, void *v)
301e66c3209SChristophe Leroy {
302e66c3209SChristophe Leroy struct pg_state st = {
303e66c3209SChristophe Leroy .seq = m,
304e66c3209SChristophe Leroy .marker = address_markers,
305cf98d2b6SChristophe Leroy .level = -1,
306e0847283SChristophe Leroy .ptdump = {
307e0847283SChristophe Leroy .note_page = note_page,
308e0847283SChristophe Leroy .range = ptdump_range,
309e0847283SChristophe Leroy }
310e66c3209SChristophe Leroy };
311e66c3209SChristophe Leroy
312e66c3209SChristophe Leroy /* Traverse kernel page tables */
313e0847283SChristophe Leroy ptdump_walk_pgd(&st.ptdump, &init_mm, NULL);
314e66c3209SChristophe Leroy return 0;
315e66c3209SChristophe Leroy }
316e66c3209SChristophe Leroy
31711f27a7fSChristophe Leroy DEFINE_SHOW_ATTRIBUTE(ptdump);
318e66c3209SChristophe Leroy
build_pgtable_complete_mask(void)319c13f2b2bSNick Child static void __init build_pgtable_complete_mask(void)
320e66c3209SChristophe Leroy {
321e66c3209SChristophe Leroy unsigned int i, j;
322e66c3209SChristophe Leroy
323e66c3209SChristophe Leroy for (i = 0; i < ARRAY_SIZE(pg_level); i++)
324e66c3209SChristophe Leroy if (pg_level[i].flag)
325e66c3209SChristophe Leroy for (j = 0; j < pg_level[i].num; j++)
326e66c3209SChristophe Leroy pg_level[i].mask |= pg_level[i].flag[j].mask;
327e66c3209SChristophe Leroy }
328e66c3209SChristophe Leroy
329e0847283SChristophe Leroy #ifdef CONFIG_DEBUG_WX
ptdump_check_wx(void)330453d87f6SRussell Currey void ptdump_check_wx(void)
331453d87f6SRussell Currey {
332453d87f6SRussell Currey struct pg_state st = {
333453d87f6SRussell Currey .seq = NULL,
334e0847283SChristophe Leroy .marker = (struct addr_marker[]) {
335e0847283SChristophe Leroy { 0, NULL},
336e0847283SChristophe Leroy { -1, NULL},
337e0847283SChristophe Leroy },
338cf98d2b6SChristophe Leroy .level = -1,
339453d87f6SRussell Currey .check_wx = true,
340e0847283SChristophe Leroy .ptdump = {
341e0847283SChristophe Leroy .note_page = note_page,
342e0847283SChristophe Leroy .range = ptdump_range,
343e0847283SChristophe Leroy }
344453d87f6SRussell Currey };
345453d87f6SRussell Currey
346e0847283SChristophe Leroy ptdump_walk_pgd(&st.ptdump, &init_mm, NULL);
347453d87f6SRussell Currey
348453d87f6SRussell Currey if (st.wx_pages)
349453d87f6SRussell Currey pr_warn("Checked W+X mappings: FAILED, %lu W+X pages found\n",
350453d87f6SRussell Currey st.wx_pages);
351453d87f6SRussell Currey else
352453d87f6SRussell Currey pr_info("Checked W+X mappings: passed, no W+X pages found\n");
353453d87f6SRussell Currey }
354453d87f6SRussell Currey #endif
355453d87f6SRussell Currey
ptdump_init(void)356e0847283SChristophe Leroy static int __init ptdump_init(void)
357e66c3209SChristophe Leroy {
358e0847283SChristophe Leroy #ifdef CONFIG_PPC64
359e0847283SChristophe Leroy if (!radix_enabled())
360e0847283SChristophe Leroy ptdump_range[0].start = KERN_VIRT_START;
361e0847283SChristophe Leroy else
362e0847283SChristophe Leroy ptdump_range[0].start = PAGE_OFFSET;
363b14b8b1eSMichael Ellerman
364b14b8b1eSMichael Ellerman ptdump_range[0].end = PAGE_OFFSET + (PGDIR_SIZE * PTRS_PER_PGD);
365e0847283SChristophe Leroy #endif
366e0847283SChristophe Leroy
367e66c3209SChristophe Leroy populate_markers();
368e66c3209SChristophe Leroy build_pgtable_complete_mask();
369e0847283SChristophe Leroy
370e0847283SChristophe Leroy if (IS_ENABLED(CONFIG_PTDUMP_DEBUGFS))
371e0847283SChristophe Leroy debugfs_create_file("kernel_page_tables", 0400, NULL, NULL, &ptdump_fops);
372e0847283SChristophe Leroy
373f3c05201SGreg Kroah-Hartman return 0;
374e66c3209SChristophe Leroy }
375e66c3209SChristophe Leroy device_initcall(ptdump_init);
376