// SPDX-License-Identifier: GPL-2.0-only/* * This kernel test validates architecture page table helpers and * accessors and helps in verifying their continued compliance with * expected generic MM semantics. * * Copyright (C) 2019 ARM Ltd. * * Author: Anshuman Khandual <anshuman.khandual@arm.com> */#define pr_fmt(fmt) "debug_vm_pgtable: [%-25s]: " fmt, __func__#include<linux/gfp.h>#include<linux/highmem.h>#include<linux/hugetlb.h>#include<linux/kernel.h>#include<linux/kconfig.h>#include<linux/memblock.h>#include<linux/mm.h>#include<linux/mman.h>#include<linux/mm_types.h>#include<linux/module.h>#include<linux/pfn_t.h>#include<linux/printk.h>#include<linux/pgtable.h>#include<linux/random.h>#include<linux/spinlock.h>#include<linux/swap.h>#include<linux/swapops.h>#include<linux/start_kernel.h>#include<linux/sched/mm.h>#include<linux/io.h>#include<linux/vmalloc.h>#include<asm/cacheflush.h>#include<asm/pgalloc.h>#include<asm/tlbflush.h>/* * Please refer Documentation/mm/arch_pgtable_helpers.rst for the semantics * expectations that are being validated here. All future changes in here * or the documentation need to be in sync. */#define RANDOM_NZVALUE GENMASK(7, 0)structpgtable_debug_args{structmm_struct*mm;structvm_area_struct*vma;pgd_t*pgdp;p4d_t*p4dp;pud_t*pudp;pmd_t*pmdp;pte_t*ptep;p4d_t*start_p4dp;pud_t*start_pudp;pmd_t*start_pmdp;pgtable_tstart_ptep;unsignedlongvaddr;pgprot_tpage_prot;pgprot_tpage_prot_none;boolis_contiguous_page;unsignedlongpud_pfn;unsignedlongpmd_pfn;unsignedlongpte_pfn;unsignedlongfixed_alignment;unsignedlongfixed_pgd_pfn;unsignedlongfixed_p4d_pfn;unsignedlongfixed_pud_pfn;unsignedlongfixed_pmd_pfn;unsignedlongfixed_pte_pfn;