summaryrefslogtreecommitdiffstats
path: root/lib/test_hmm.c
diff options
context:
space:
mode:
authorRalph Campbell <rcampbell@nvidia.com>2020-07-01 15:53:52 -0700
committerJason Gunthorpe <jgg@nvidia.com>2020-07-10 16:24:28 -0300
commite478425bec930e9368c6efdc78d2e5d85eadc18e (patch)
tree59e9ec45cd3976e7ed79d083b17e379e39e62628 /lib/test_hmm.c
parent3b50a6e536d2d843857ffe5f923eff7be4222afe (diff)
downloadlinux-e478425bec930e9368c6efdc78d2e5d85eadc18e.tar.bz2
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 <rcampbell@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'lib/test_hmm.c')
-rw-r--r--lib/test_hmm.c4
1 files changed, 4 insertions, 0 deletions
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,