Lines Matching refs:st
132 static void dump_flag_info(struct pg_state *st, const struct flag_info in dump_flag_info() argument
149 pt_dump_seq_printf(st->seq, " %s:%llx", flag->set, val); in dump_flag_info()
156 pt_dump_seq_printf(st->seq, " %s", s); in dump_flag_info()
158 st->current_flags &= ~flag->mask; in dump_flag_info()
160 if (st->current_flags != 0) in dump_flag_info()
161 pt_dump_seq_printf(st->seq, " unknown flags:%llx", st->current_flags); in dump_flag_info()
164 static void dump_addr(struct pg_state *st, unsigned long addr) in dump_addr() argument
174 pt_dump_seq_printf(st->seq, REG "-" REG " ", st->start_address, addr - 1); in dump_addr()
175 if (st->start_pa == st->last_pa && st->start_address + st->page_size != addr) { in dump_addr()
176 pt_dump_seq_printf(st->seq, "[" REG "]", st->start_pa); in dump_addr()
177 delta = st->page_size >> 10; in dump_addr()
179 pt_dump_seq_printf(st->seq, " " REG " ", st->start_pa); in dump_addr()
180 delta = (addr - st->start_address) >> 10; in dump_addr()
182 pt_dump_size(st->seq, delta); in dump_addr()
185 static void note_prot_wx(struct pg_state *st, unsigned long addr) in note_prot_wx() argument
187 pte_t pte = __pte(st->current_flags); in note_prot_wx()
189 if (!IS_ENABLED(CONFIG_PPC_DEBUG_WX) || !st->check_wx) in note_prot_wx()
196 (void *)st->start_address, (void *)st->start_address); in note_prot_wx()
198 st->wx_pages += (addr - st->start_address) / PAGE_SIZE; in note_prot_wx()
201 static void note_page_update_state(struct pg_state *st, unsigned long addr, in note_page_update_state() argument
207 st->level = level; in note_page_update_state()
208 st->current_flags = flag; in note_page_update_state()
209 st->start_address = addr; in note_page_update_state()
210 st->start_pa = pa; in note_page_update_state()
211 st->page_size = page_size; in note_page_update_state()
213 while (addr >= st->marker[1].start_address) { in note_page_update_state()
214 st->marker++; in note_page_update_state()
215 pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); in note_page_update_state()
219 static void note_page(struct pg_state *st, unsigned long addr, in note_page() argument
226 if (!st->level) { in note_page()
227 pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); in note_page()
228 note_page_update_state(st, addr, level, val, page_size); in note_page()
237 } else if (flag != st->current_flags || level != st->level || in note_page()
238 addr >= st->marker[1].start_address || in note_page()
239 (pa != st->last_pa + st->page_size && in note_page()
240 (pa != st->start_pa || st->start_pa != st->last_pa))) { in note_page()
243 if (st->current_flags) { in note_page()
244 note_prot_wx(st, addr); in note_page()
245 dump_addr(st, addr); in note_page()
248 if (pg_level[st->level].flag) in note_page()
249 dump_flag_info(st, pg_level[st->level].flag, in note_page()
250 st->current_flags, in note_page()
251 pg_level[st->level].num); in note_page()
253 pt_dump_seq_putc(st->seq, '\n'); in note_page()
260 note_page_update_state(st, addr, level, val, page_size); in note_page()
262 st->last_pa = pa; in note_page()
265 static void walk_pte(struct pg_state *st, pmd_t *pmd, unsigned long start) in walk_pte() argument
273 note_page(st, addr, 4, pte_val(*pte), PAGE_SIZE); in walk_pte()
278 static void walk_hugepd(struct pg_state *st, hugepd_t *phpd, unsigned long start, in walk_hugepd() argument
293 note_page(st, addr, level + 1, pte_val(*pte), 1 << shift); in walk_hugepd()
298 static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) in walk_pmd() argument
308 walk_pte(st, pmd, addr); in walk_pmd()
310 note_page(st, addr, 3, pmd_val(*pmd), PMD_SIZE); in walk_pmd()
314 static void walk_pud(struct pg_state *st, p4d_t *p4d, unsigned long start) in walk_pud() argument
324 walk_pmd(st, pud, addr); in walk_pud()
326 note_page(st, addr, 2, pud_val(*pud), PUD_SIZE); in walk_pud()
330 static void walk_pagetables(struct pg_state *st) in walk_pagetables() argument
333 unsigned long addr = st->start_address & PGDIR_MASK; in walk_pagetables()
344 note_page(st, addr, 1, p4d_val(*p4d), PGDIR_SIZE); in walk_pagetables()
346 walk_hugepd(st, (hugepd_t *)p4d, addr, PGDIR_SHIFT, 1); in walk_pagetables()
349 walk_pud(st, p4d, addr); in walk_pagetables()
399 struct pg_state st = { in ptdump_show() local
407 st.start_address = KERN_VIRT_START; in ptdump_show()
411 walk_pagetables(&st); in ptdump_show()
412 note_page(&st, 0, 0, 0, 0); in ptdump_show()
442 struct pg_state st = { in ptdump_check_wx() local
451 st.start_address = KERN_VIRT_START; in ptdump_check_wx()
454 walk_pagetables(&st); in ptdump_check_wx()
456 if (st.wx_pages) in ptdump_check_wx()
458 st.wx_pages); in ptdump_check_wx()