linux-loongson/include/linux/ptdump.h
Anshuman Khandual 08978fc3b0 mm/ptdump: split effective_prot() into level specific callbacks
Last argument in effective_prot() is u64 assuming pxd_val() returned value
(all page table levels) is 64 bit.  pxd_val() is very platform specific
and its type should not be assumed in generic MM.

Split effective_prot() into individual page table level specific callbacks
which accepts corresponding pxd_t argument instead and then the
subscribing platform (only x86) just derive pxd_val() from the entries as
required and proceed as earlier.

Link: https://lkml.kernel.org/r/20250407053113.746295-3-anshuman.khandual@arm.com
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-05-11 17:48:19 -07:00

41 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_PTDUMP_H
#define _LINUX_PTDUMP_H
#include <linux/mm_types.h>
struct ptdump_range {
unsigned long start;
unsigned long end;
};
struct ptdump_state {
void (*note_page_pte)(struct ptdump_state *st, unsigned long addr, pte_t pte);
void (*note_page_pmd)(struct ptdump_state *st, unsigned long addr, pmd_t pmd);
void (*note_page_pud)(struct ptdump_state *st, unsigned long addr, pud_t pud);
void (*note_page_p4d)(struct ptdump_state *st, unsigned long addr, p4d_t p4d);
void (*note_page_pgd)(struct ptdump_state *st, unsigned long addr, pgd_t pgd);
void (*note_page_flush)(struct ptdump_state *st);
void (*effective_prot_pte)(struct ptdump_state *st, pte_t pte);
void (*effective_prot_pmd)(struct ptdump_state *st, pmd_t pmd);
void (*effective_prot_pud)(struct ptdump_state *st, pud_t pud);
void (*effective_prot_p4d)(struct ptdump_state *st, p4d_t p4d);
void (*effective_prot_pgd)(struct ptdump_state *st, pgd_t pgd);
const struct ptdump_range *range;
};
bool ptdump_walk_pgd_level_core(struct seq_file *m,
struct mm_struct *mm, pgd_t *pgd,
bool checkwx, bool dmesg);
void ptdump_walk_pgd(struct ptdump_state *st, struct mm_struct *mm, pgd_t *pgd);
bool ptdump_check_wx(void);
static inline void debug_checkwx(void)
{
if (IS_ENABLED(CONFIG_DEBUG_WX))
ptdump_check_wx();
}
#endif /* _LINUX_PTDUMP_H */