From e478425bec930e9368c6efdc78d2e5d85eadc18e Mon Sep 17 00:00:00 2001 From: Ralph Campbell Date: Wed, 1 Jul 2020 15:53:52 -0700 Subject: mm/hmm: add tests for hmm_pfn_to_map_order() Add a sanity test for hmm_range_fault() returning the page mapping size order. Link: https://lore.kernel.org/r/20200701225352.9649-6-rcampbell@nvidia.com Signed-off-by: Ralph Campbell Signed-off-by: Jason Gunthorpe --- lib/test_hmm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/test_hmm.c') diff --git a/lib/test_hmm.c b/lib/test_hmm.c index a2a82262b97b..9aa577afc269 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -766,6 +766,10 @@ static void dmirror_mkentry(struct dmirror *dmirror, struct hmm_range *range, *perm |= HMM_DMIRROR_PROT_WRITE; else *perm |= HMM_DMIRROR_PROT_READ; + if (hmm_pfn_to_map_order(entry) + PAGE_SHIFT == PMD_SHIFT) + *perm |= HMM_DMIRROR_PROT_PMD; + else if (hmm_pfn_to_map_order(entry) + PAGE_SHIFT == PUD_SHIFT) + *perm |= HMM_DMIRROR_PROT_PUD; } static bool dmirror_snapshot_invalidate(struct mmu_interval_notifier *mni, -- cgit