Skip to content

Commit eb1b186

Browse files
committed
mm/x86/pat: use the new follow_pfnmap API
JIRA: https://issues.redhat.com/browse/RHEL-73613 commit cbea853 Author: Peter Xu <peterx@redhat.com> Date: Mon Aug 26 16:43:46 2024 -0400 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/20240826204353.2228736-13-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Alex Williamson <alex.williamson@redhat.com> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> Cc: David Hildenbrand <david@redhat.com> Cc: Gavin Shan <gshan@redhat.com> Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Jason Gunthorpe <jgg@nvidia.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Niklas Schnelle <schnelle@linux.ibm.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Will Deacon <will@kernel.org> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Donald Dutile <ddutile@redhat.com>
1 parent 2db085e commit eb1b186

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)