Skip to content

Commit

Permalink
xen: set vma flag VM_PFNMAP in the privcmd mmap file_op
Browse files Browse the repository at this point in the history
Set VM_PFNMAP in the privcmd mmap file_op, rather than later in
xen_remap_domain_mfn_range when it is too late because
vma_wants_writenotify has already been called and vm_page_prot has
already been modified.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
  • Loading branch information
Stefano Stabellini authored and Jeremy Fitzhardinge committed Nov 11, 2010
1 parent 313e744 commit e060e7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion arch/x86/xen/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2299,7 +2299,8 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma,

prot = __pgprot(pgprot_val(prot) | _PAGE_IOMAP);

vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_RESERVED | VM_IO)) ==
(VM_PFNMAP | VM_RESERVED | VM_IO)));

rmd.mfn = mfn;
rmd.prot = prot;
Expand Down
5 changes: 3 additions & 2 deletions drivers/xen/xenfs/privcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,9 @@ static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
if (xen_feature(XENFEAT_auto_translated_physmap))
return -ENOSYS;

/* DONTCOPY is essential for Xen as copy_page_range is broken. */
vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY;
/* DONTCOPY is essential for Xen because copy_page_range doesn't know
* how to recreate these mappings */
vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PFNMAP;
vma->vm_ops = &privcmd_vm_ops;
vma->vm_private_data = NULL;

Expand Down

0 comments on commit e060e7a

Please sign in to comment.