mm/hmm: add tests for hmm_pfn_to_map_order()
[linux-block.git] / lib / test_hmm.c
index a2a82262b97b3e0f2b6d14faedb74755e6d07883..9aa577afc269669360985b59c5dc741a0ceb80ab 100644 (file)
@@ -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,