On 17/03/2025 06:18, Anshuman Khandual wrote:
> Page table entry's value, mask and protection are represented with pteval_t
> data type format not u64 that has been assumed while dumping the page table
> entries. Replace all such u64 instances with pteval_t instead as required.
> 
> Cc: Catalin Marinas <catalin.mari...@arm.com>
> Cc: Will Deacon <w...@kernel.org>
> Cc: Marc Zyngier <m...@kernel.org>
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-ker...@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khand...@arm.com>
> ---
>  arch/arm64/include/asm/ptdump.h | 8 ++++----
>  arch/arm64/mm/ptdump.c          | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h
> index e5da9ce8a515..476a870489b9 100644
> --- a/arch/arm64/include/asm/ptdump.h
> +++ b/arch/arm64/include/asm/ptdump.h
> @@ -24,8 +24,8 @@ struct ptdump_info {
>  };
>  
>  struct ptdump_prot_bits {
> -     u64             mask;
> -     u64             val;
> +     pteval_t        mask;
> +     pteval_t        val;

Given Ard's suggestion of using "ptdesc" as a generic term for PTDESC_SHIFT (or
PTDESC_ORDER, or whatever we ended up calling it), I wonder if it would be
cleaner to do the same with the types? We could have a ptdesc_t, which is
typedef'ed as u64 (or u128), then pteval_t, pmdval_t, ..., could all be
typedef'ed as ptdesc_t. Then for code that just wants a generic pgtable
descriptor value, we can use that type to indicate that it can be at any level.

Thanks,
Ryan

>       const char      *set;
>       const char      *clear;
>  };
> @@ -34,7 +34,7 @@ struct ptdump_pg_level {
>       const struct ptdump_prot_bits *bits;
>       char name[4];
>       int num;
> -     u64 mask;
> +     pteval_t mask;
>  };
>  
>  /*
> @@ -51,7 +51,7 @@ struct ptdump_pg_state {
>       const struct mm_struct *mm;
>       unsigned long start_address;
>       int level;
> -     u64 current_prot;
> +     pteval_t current_prot;
>       bool check_wx;
>       unsigned long wx_pages;
>       unsigned long uxn_pages;
> diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c
> index fd1610b4fd15..a5651be95868 100644
> --- a/arch/arm64/mm/ptdump.c
> +++ b/arch/arm64/mm/ptdump.c
> @@ -194,7 +194,7 @@ void note_page(struct ptdump_state *pt_st, unsigned long 
> addr, int level,
>       struct ptdump_pg_state *st = container_of(pt_st, struct 
> ptdump_pg_state, ptdump);
>       struct ptdump_pg_level *pg_level = st->pg_level;
>       static const char units[] = "KMGTPE";
> -     u64 prot = 0;
> +     pteval_t prot = 0;
>  
>       /* check if the current level has been folded dynamically */
>       if (st->mm && ((level == 1 && mm_p4d_folded(st->mm)) ||


Reply via email to