[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] direct_remap_pfn_range() takes a vm_area_struct rather than
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID e1cc553059e168baa594c8a855b05570a901198c # Parent 0f851f965df9a3037949b3eeb60a01a4069ab624 direct_remap_pfn_range() takes a vm_area_struct rather than an mm_struct. Also it sets VM_RESERVED and VM_IO, just like generic remap_pfn_range() in mm/memory.c. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 0f851f965df9 -r e1cc553059e1 linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c Fri Sep 16 09:16:24 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c Fri Sep 16 10:57:31 2005 @@ -45,12 +45,12 @@ return 0; } -int direct_remap_pfn_range(struct mm_struct *mm, - unsigned long address, - unsigned long mfn, - unsigned long size, - pgprot_t prot, - domid_t domid) +static int __direct_remap_pfn_range(struct mm_struct *mm, + unsigned long address, + unsigned long mfn, + unsigned long size, + pgprot_t prot, + domid_t domid) { int i; unsigned long start_address; @@ -98,6 +98,20 @@ return 0; } +int direct_remap_pfn_range(struct vm_area_struct *vma, + unsigned long address, + unsigned long mfn, + unsigned long size, + pgprot_t prot, + domid_t domid) +{ + /* Same as remap_pfn_range(). */ + vma->vm_flags |= VM_IO | VM_RESERVED; + + return __direct_remap_pfn_range( + vma->vm_mm, address, mfn, size, prot, domid); +} + EXPORT_SYMBOL(direct_remap_pfn_range); @@ -221,8 +235,9 @@ #ifdef __x86_64__ flags |= _PAGE_USER; #endif - if (direct_remap_pfn_range(&init_mm, (unsigned long) addr, phys_addr>>PAGE_SHIFT, - size, __pgprot(flags), domid)) { + if (__direct_remap_pfn_range(&init_mm, (unsigned long)addr, + phys_addr>>PAGE_SHIFT, + size, __pgprot(flags), domid)) { vunmap((void __force *) addr); return NULL; } diff -r 0f851f965df9 -r e1cc553059e1 linux-2.6-xen-sparse/arch/xen/i386/pci/i386.c --- a/linux-2.6-xen-sparse/arch/xen/i386/pci/i386.c Fri Sep 16 09:16:24 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/pci/i386.c Fri Sep 16 10:57:31 2005 @@ -295,7 +295,7 @@ /* Write-combine setting is ignored, it is changed via the mtrr * interfaces on this platform. */ - if (direct_remap_pfn_range(vma->vm_mm, vma->vm_start, vma->vm_pgoff, + if (direct_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, vma->vm_end - vma->vm_start, vma->vm_page_prot, DOMID_IO)) return -EAGAIN; diff -r 0f851f965df9 -r e1cc553059e1 linux-2.6-xen-sparse/arch/xen/kernel/devmem.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c Fri Sep 16 09:16:24 2005 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c Fri Sep 16 10:57:31 2005 @@ -90,22 +90,10 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma) { - int uncached; - - uncached = uncached_access(file); - if (uncached) + if (uncached_access(file)) vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - /* Don't try to swap out physical pages.. */ - vma->vm_flags |= VM_RESERVED; - - /* - * Don't dump addresses that are not real memory to a core file. - */ - if (uncached) - vma->vm_flags |= VM_IO; - - if (direct_remap_pfn_range(vma->vm_mm, vma->vm_start, vma->vm_pgoff, + if (direct_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, vma->vm_end - vma->vm_start, vma->vm_page_prot, DOMID_IO)) return -EAGAIN; diff -r 0f851f965df9 -r e1cc553059e1 linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Fri Sep 16 09:16:24 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Fri Sep 16 10:57:31 2005 @@ -130,12 +130,12 @@ if ( (msg[j].va + (msg[j].npages<<PAGE_SHIFT)) > vma->vm_end ) return -EINVAL; - if ( (rc = direct_remap_pfn_range(vma->vm_mm, - msg[j].va&PAGE_MASK, - msg[j].mfn, - msg[j].npages<<PAGE_SHIFT, - vma->vm_page_prot, - mmapcmd.dom)) < 0 ) + if ( (rc = direct_remap_pfn_range(vma, + msg[j].va&PAGE_MASK, + msg[j].mfn, + msg[j].npages<<PAGE_SHIFT, + vma->vm_page_prot, + mmapcmd.dom)) < 0 ) return rc; } } diff -r 0f851f965df9 -r e1cc553059e1 linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h Fri Sep 16 09:16:24 2005 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h Fri Sep 16 10:57:31 2005 @@ -460,7 +460,7 @@ #define kern_addr_valid(addr) (1) #endif /* !CONFIG_DISCONTIGMEM */ -int direct_remap_pfn_range(struct mm_struct *mm, +int direct_remap_pfn_range(struct vm_area_struct *vma, unsigned long address, unsigned long mfn, unsigned long size, @@ -474,10 +474,10 @@ unsigned long size); #define io_remap_page_range(vma,from,phys,size,prot) \ -direct_remap_pfn_range(vma->vm_mm,from,phys>>PAGE_SHIFT,size,prot,DOMID_IO) +direct_remap_pfn_range(vma,from,(phys)>>PAGE_SHIFT,size,prot,DOMID_IO) #define io_remap_pfn_range(vma,from,pfn,size,prot) \ -direct_remap_pfn_range(vma->vm_mm,from,pfn,size,prot,DOMID_IO) +direct_remap_pfn_range(vma,from,pfn,size,prot,DOMID_IO) #define MK_IOSPACE_PFN(space, pfn) (pfn) #define GET_IOSPACE(pfn) 0 diff -r 0f851f965df9 -r e1cc553059e1 linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Fri Sep 16 09:16:24 2005 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Fri Sep 16 10:57:31 2005 @@ -526,7 +526,7 @@ #define DOMID_LOCAL (0xFFFFU) -int direct_remap_pfn_range(struct mm_struct *mm, +int direct_remap_pfn_range(struct vm_area_struct *vma, unsigned long address, unsigned long mfn, unsigned long size, @@ -542,10 +542,10 @@ unsigned long size); #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ - direct_remap_pfn_range((vma)->vm_mm,vaddr,paddr>>PAGE_SHIFT,size,prot,DOMID_IO) + direct_remap_pfn_range(vma,vaddr,(paddr)>>PAGE_SHIFT,size,prot,DOMID_IO) #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ - direct_remap_pfn_range((vma)->vm_mm,vaddr,pfn,size,prot,DOMID_IO) + direct_remap_pfn_range(vma,vaddr,pfn,size,prot,DOMID_IO) #define MK_IOSPACE_PFN(space, pfn) (pfn) #define GET_IOSPACE(pfn) 0 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |