xref: /openbmc/linux/arch/powerpc/mm/ptdump/shared.c (revision 552a29e4)
1e66c3209SChristophe Leroy // SPDX-License-Identifier: GPL-2.0
2e66c3209SChristophe Leroy /*
3e66c3209SChristophe Leroy  * From split of dump_linuxpagetables.c
4e66c3209SChristophe Leroy  * Copyright 2016, Rashmica Gupta, IBM Corp.
5e66c3209SChristophe Leroy  *
6e66c3209SChristophe Leroy  */
7e66c3209SChristophe Leroy #include <linux/kernel.h>
8ca5999fdSMike Rapoport #include <linux/pgtable.h>
9e66c3209SChristophe Leroy 
10e66c3209SChristophe Leroy #include "ptdump.h"
11e66c3209SChristophe Leroy 
12e66c3209SChristophe Leroy static const struct flag_info flag_array[] = {
13e66c3209SChristophe Leroy 	{
14e66c3209SChristophe Leroy 		.mask	= _PAGE_USER,
15e66c3209SChristophe Leroy 		.val	= _PAGE_USER,
16e66c3209SChristophe Leroy 		.set	= "user",
17e66c3209SChristophe Leroy 		.clear	= "    ",
18e66c3209SChristophe Leroy 	}, {
19e66c3209SChristophe Leroy 		.mask	= _PAGE_RW,
20*552a29e4SChristophe Leroy 		.val	= 0,
21*552a29e4SChristophe Leroy 		.set	= "r ",
22*552a29e4SChristophe Leroy 		.clear	= "rw",
23e66c3209SChristophe Leroy 	}, {
24e66c3209SChristophe Leroy 		.mask	= _PAGE_EXEC,
25e66c3209SChristophe Leroy 		.val	= _PAGE_EXEC,
26e66c3209SChristophe Leroy 		.set	= " X ",
27e66c3209SChristophe Leroy 		.clear	= "   ",
28e66c3209SChristophe Leroy 	}, {
29e66c3209SChristophe Leroy 		.mask	= _PAGE_PRESENT,
30e66c3209SChristophe Leroy 		.val	= _PAGE_PRESENT,
31e66c3209SChristophe Leroy 		.set	= "present",
32e66c3209SChristophe Leroy 		.clear	= "       ",
33e66c3209SChristophe Leroy 	}, {
343af4786eSChristophe Leroy 		.mask	= _PAGE_COHERENT,
353af4786eSChristophe Leroy 		.val	= _PAGE_COHERENT,
363af4786eSChristophe Leroy 		.set	= "coherent",
373af4786eSChristophe Leroy 		.clear	= "        ",
383af4786eSChristophe Leroy 	}, {
39e66c3209SChristophe Leroy 		.mask	= _PAGE_GUARDED,
40e66c3209SChristophe Leroy 		.val	= _PAGE_GUARDED,
41e66c3209SChristophe Leroy 		.set	= "guarded",
42e66c3209SChristophe Leroy 		.clear	= "       ",
43e66c3209SChristophe Leroy 	}, {
44e66c3209SChristophe Leroy 		.mask	= _PAGE_DIRTY,
45e66c3209SChristophe Leroy 		.val	= _PAGE_DIRTY,
46e66c3209SChristophe Leroy 		.set	= "dirty",
47e66c3209SChristophe Leroy 		.clear	= "     ",
48e66c3209SChristophe Leroy 	}, {
49e66c3209SChristophe Leroy 		.mask	= _PAGE_ACCESSED,
50e66c3209SChristophe Leroy 		.val	= _PAGE_ACCESSED,
51e66c3209SChristophe Leroy 		.set	= "accessed",
52e66c3209SChristophe Leroy 		.clear	= "        ",
53e66c3209SChristophe Leroy 	}, {
54e66c3209SChristophe Leroy 		.mask	= _PAGE_WRITETHRU,
55e66c3209SChristophe Leroy 		.val	= _PAGE_WRITETHRU,
56e66c3209SChristophe Leroy 		.set	= "write through",
57e66c3209SChristophe Leroy 		.clear	= "             ",
58e66c3209SChristophe Leroy 	}, {
59e66c3209SChristophe Leroy 		.mask	= _PAGE_NO_CACHE,
60e66c3209SChristophe Leroy 		.val	= _PAGE_NO_CACHE,
61e66c3209SChristophe Leroy 		.set	= "no cache",
62e66c3209SChristophe Leroy 		.clear	= "        ",
63e66c3209SChristophe Leroy 	}, {
64e66c3209SChristophe Leroy 		.mask	= _PAGE_SPECIAL,
65e66c3209SChristophe Leroy 		.val	= _PAGE_SPECIAL,
66e66c3209SChristophe Leroy 		.set	= "special",
67e66c3209SChristophe Leroy 	}
68e66c3209SChristophe Leroy };
69e66c3209SChristophe Leroy 
70e66c3209SChristophe Leroy struct pgtable_level pg_level[5] = {
71cf98d2b6SChristophe Leroy 	{ /* pgd */
72cf98d2b6SChristophe Leroy 		.flag	= flag_array,
73cf98d2b6SChristophe Leroy 		.num	= ARRAY_SIZE(flag_array),
74cf98d2b6SChristophe Leroy 	}, { /* p4d */
75e66c3209SChristophe Leroy 		.flag	= flag_array,
76e66c3209SChristophe Leroy 		.num	= ARRAY_SIZE(flag_array),
77e66c3209SChristophe Leroy 	}, { /* pud */
78e66c3209SChristophe Leroy 		.flag	= flag_array,
79e66c3209SChristophe Leroy 		.num	= ARRAY_SIZE(flag_array),
80e66c3209SChristophe Leroy 	}, { /* pmd */
81e66c3209SChristophe Leroy 		.flag	= flag_array,
82e66c3209SChristophe Leroy 		.num	= ARRAY_SIZE(flag_array),
83e66c3209SChristophe Leroy 	}, { /* pte */
84e66c3209SChristophe Leroy 		.flag	= flag_array,
85e66c3209SChristophe Leroy 		.num	= ARRAY_SIZE(flag_array),
86e66c3209SChristophe Leroy 	},
87e66c3209SChristophe Leroy };
88