Skip to content

Commit e6bc784

Browse files
xzpeterakpm00
authored andcommitted
acrn: 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: Alexander Gordeev <[email protected]> Cc: Alex Williamson <[email protected]> Cc: Aneesh Kumar K.V <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Gavin Shan <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[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: Thomas Gleixner <[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 a77f948 commit e6bc784

File tree

1 file changed

+9
-7
lines changed
  • drivers/virt/acrn

1 file changed

+9
-7
lines changed

drivers/virt/acrn/mm.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,26 +177,28 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap)
177177
vma = vma_lookup(current->mm, memmap->vma_base);
178178
if (vma && ((vma->vm_flags & VM_PFNMAP) != 0)) {
179179
unsigned long start_pfn, cur_pfn;
180-
spinlock_t *ptl;
181180
bool writable;
182-
pte_t *ptep;
183181

184182
if ((memmap->vma_base + memmap->len) > vma->vm_end) {
185183
mmap_read_unlock(current->mm);
186184
return -EINVAL;
187185
}
188186

189187
for (i = 0; i < nr_pages; i++) {
190-
ret = follow_pte(vma, memmap->vma_base + i * PAGE_SIZE,
191-
&ptep, &ptl);
188+
struct follow_pfnmap_args args = {
189+
.vma = vma,
190+
.address = memmap->vma_base + i * PAGE_SIZE,
191+
};
192+
193+
ret = follow_pfnmap_start(&args);
192194
if (ret)
193195
break;
194196

195-
cur_pfn = pte_pfn(ptep_get(ptep));
197+
cur_pfn = args.pfn;
196198
if (i == 0)
197199
start_pfn = cur_pfn;
198-
writable = !!pte_write(ptep_get(ptep));
199-
pte_unmap_unlock(ptep, ptl);
200+
writable = args.writable;
201+
follow_pfnmap_end(&args);
200202

201203
/* Disallow write access if the PTE is not writable. */
202204
if (!writable &&

0 commit comments

Comments
 (0)