Lines Matching refs:vma
327 struct vm_area_struct *vma = vm_area_alloc(mm); in mm_create_vma() local
328 if (unlikely(vma == NULL)) in mm_create_vma()
330 vma->vm_ops = vm_ops; in mm_create_vma()
331 vma->vm_flags = vm_flags; in mm_create_vma()
332 vma->vm_start = vaddr; in mm_create_vma()
333 vma->vm_end = vaddr + length; in mm_create_vma()
335 retval = vma_insert(mm, vma); in mm_create_vma()
338 *res_vma = vma_find(mm, vma->vm_start); in mm_create_vma()
339 kfree(vma); in mm_create_vma()
347 *res_vma = vma; in mm_create_vma()
360 int mm_map_vma(struct vm_area_struct *vma, uint64_t paddr, uint64_t offset, uint64_t length) in mm_map_vma() argument
369 if (vma->vm_flags & VM_IO) // 对于mmio的内存,创建新的page结构体 in mm_map_vma()
372 if (unlikely(vma->anon_vma == NULL || vma->anon_vma->page == NULL)) in mm_map_vma()
375 pg = vma->anon_vma->page; in mm_map_vma()
389 __anon_vma_add(pg->anon_vma, vma); in mm_map_vma()
392 BUG_ON(vma->vm_start + offset + length > vma->vm_end); in mm_map_vma()
401 len_4k = PAGE_2M_ALIGN(vma->vm_start + offset) - (vma->vm_start + offset); in mm_map_vma()
406 if (vma->vm_flags & VM_USER) in mm_map_vma()
412 …retval = mm_map_proc_page_table((uint64_t)vma->vm_mm->pgd, true, vma->vm_start + offset, paddr, le… in mm_map_vma()
426 if (vma->vm_flags & VM_USER) in mm_map_vma()
431 …retval = mm_map_proc_page_table((uint64_t)vma->vm_mm->pgd, true, vma->vm_start + offset + mapped, … in mm_map_vma()
441 if (vma->vm_flags & VM_USER) in mm_map_vma()
447 …retval = mm_map_proc_page_table((uint64_t)vma->vm_mm->pgd, true, vma->vm_start + offset + mapped, … in mm_map_vma()
454 if (vma->vm_flags & VM_IO) in mm_map_vma()
455 vma->page_offset = 0; in mm_map_vma()
480 struct vm_area_struct *vma = vma_find(mm, vaddr + mapped); in mm_map() local
481 if (unlikely(vma == NULL)) in mm_map()
493 offset = vaddr + mapped - vma->vm_start; in mm_map()
494 uint64_t m_len = vma->vm_end - vma->vm_start - offset; in mm_map()
496 retval = mm_map_vma(vma, paddr + mapped, offset, m_len); in mm_map()
516 int mm_unmap_vma(struct mm_struct *mm, struct vm_area_struct *vma, uint64_t *paddr) in mm_unmap_vma() argument
519 if (unlikely(vma->vm_mm != mm)) in mm_unmap_vma()
521 struct anon_vma_t *anon = vma->anon_vma; in mm_unmap_vma()
523 *paddr = __mm_get_paddr(mm, vma->vm_start); in mm_unmap_vma()
528 mm_unmap_proc_table((uint64_t)mm->pgd, true, vma->vm_start, vma->vm_end - vma->vm_start); in mm_unmap_vma()
529 __anon_vma_del(vma); in mm_unmap_vma()
534 list_init(&vma->anon_vma_list); in mm_unmap_vma()
555 struct vm_area_struct *vma = vma_find(mm, vaddr + unmapped); in mm_unmap() local
556 if (unlikely(vma == NULL)) in mm_unmap()
562 if (unlikely(vma->vm_start != (vaddr + unmapped))) in mm_unmap()
567 if (vma->anon_vma != NULL) in mm_unmap()
568 mm_unmap_vma(mm, vma, NULL); in mm_unmap()
570 unmapped += vma->vm_end - vma->vm_start; in mm_unmap()
574 vm_area_del(vma); in mm_unmap()
575 vm_area_free(vma); in mm_unmap()