Skip to content

Commit cbea853

Browse files
xzpeterakpm00
authored andcommitted
mm/x86/pat: use the new follow_pfnmap API
Use the new API that can understand huge pfn mappings. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Alex Williamson <[email protected]> Cc: Aneesh Kumar K.V <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Gavin Shan <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Niklas Schnelle <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Will Deacon <[email protected]> Cc: Zi Yan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent bd8c2d1 commit cbea853

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

arch/x86/mm/pat/memtype.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -951,23 +951,20 @@ static void free_pfn_range(u64 paddr, unsigned long size)
951951
static int follow_phys(struct vm_area_struct *vma, unsigned long *prot,
952952
resource_size_t *phys)
953953
{
954-
pte_t *ptep, pte;
955-
spinlock_t *ptl;
954+
struct follow_pfnmap_args args = { .vma = vma, .address = vma->vm_start };
956955

957-
if (follow_pte(vma, vma->vm_start, &ptep, &ptl))
956+
if (follow_pfnmap_start(&args))
958957
return -EINVAL;
959958

960-
pte = ptep_get(ptep);
961-
962959
/* Never return PFNs of anon folios in COW mappings. */
963-
if (vm_normal_folio(vma, vma->vm_start, pte)) {
964-
pte_unmap_unlock(ptep, ptl);
960+
if (!args.special) {
961+
follow_pfnmap_end(&args);
965962
return -EINVAL;
966963
}
967964

968-
*prot = pgprot_val(pte_pgprot(pte));
969-
*phys = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT;
970-
pte_unmap_unlock(ptep, ptl);
965+
*prot = pgprot_val(args.pgprot);
966+
*phys = (resource_size_t)args.pfn << PAGE_SHIFT;
967+
follow_pfnmap_end(&args);
971968
return 0;
972969
}
973970

0 commit comments

Comments
 (0)