ia64/xen-unstable

changeset 6697:a9a78ca76cd2

Replace direct_remap_area_pages with direct_remap_pfn_range to help fix PAE domain building.
Signed-off-by: ian@xensource.com
author iap10@freefall.cl.cam.ac.uk
date Wed Sep 07 23:10:49 2005 +0000 (2005-09-07)
parents 10a3d4fbd9b4
children f0d728001aaa
files linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c linux-2.6-xen-sparse/drivers/xen/netback/interface.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/drivers/xen/usbback/interface.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c	Wed Sep 07 21:35:05 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c	Wed Sep 07 23:10:49 2005 +0000
     1.3 @@ -22,13 +22,14 @@
     1.4  #define ISA_START_ADDRESS	0x0
     1.5  #define ISA_END_ADDRESS		0x100000
     1.6  
     1.7 +#if 0 /* not PAE safe */
     1.8  /* These hacky macros avoid phys->machine translations. */
     1.9  #define __direct_pte(x) ((pte_t) { (x) } )
    1.10  #define __direct_mk_pte(page_nr,pgprot) \
    1.11    __direct_pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
    1.12  #define direct_mk_pte_phys(physpage, pgprot) \
    1.13    __direct_mk_pte((physpage) >> PAGE_SHIFT, pgprot)
    1.14 -
    1.15 +#endif
    1.16  
    1.17  static int direct_remap_area_pte_fn(pte_t *pte, 
    1.18  				    struct page *pte_page,
    1.19 @@ -37,16 +38,16 @@ static int direct_remap_area_pte_fn(pte_
    1.20  {
    1.21  	mmu_update_t **v = (mmu_update_t **)data;
    1.22  
    1.23 -	(*v)->ptr = ((maddr_t)pfn_to_mfn(page_to_pfn(pte_page)) <<
    1.24 +	(*v)->ptr = ((u64)pfn_to_mfn(page_to_pfn(pte_page)) <<
    1.25  		     PAGE_SHIFT) | ((unsigned long)pte & ~PAGE_MASK);
    1.26  	(*v)++;
    1.27  
    1.28  	return 0;
    1.29  }
    1.30  
    1.31 -int direct_remap_area_pages(struct mm_struct *mm,
    1.32 +int direct_remap_pfn_range(struct mm_struct *mm,
    1.33  			    unsigned long address, 
    1.34 -			    unsigned long machine_addr,
    1.35 +			    unsigned long mfn,
    1.36  			    unsigned long size, 
    1.37  			    pgprot_t prot,
    1.38  			    domid_t  domid)
    1.39 @@ -77,9 +78,9 @@ int direct_remap_area_pages(struct mm_st
    1.40  		 * Fill in the machine address: PTE ptr is done later by
    1.41  		 * __direct_remap_area_pages(). 
    1.42  		 */
    1.43 -		v->val = pte_val_ma(pfn_pte_ma(machine_addr >> PAGE_SHIFT, prot));
    1.44 +		v->val = pte_val_ma(pfn_pte_ma(mfn, prot));
    1.45  
    1.46 -		machine_addr += PAGE_SIZE;
    1.47 +		mfn++;
    1.48  		address += PAGE_SIZE; 
    1.49  		v++;
    1.50  	}
    1.51 @@ -97,8 +98,10 @@ int direct_remap_area_pages(struct mm_st
    1.52  	return 0;
    1.53  }
    1.54  
    1.55 -EXPORT_SYMBOL(direct_remap_area_pages);
    1.56 +EXPORT_SYMBOL(direct_remap_pfn_range);
    1.57  
    1.58 +
    1.59 +/* FIXME: This is horribly broken on PAE */ 
    1.60  static int lookup_pte_fn(
    1.61  	pte_t *pte, struct page *pte_page, unsigned long addr, void *data)
    1.62  {
    1.63 @@ -218,7 +221,7 @@ void __iomem * __ioremap(unsigned long p
    1.64  #ifdef __x86_64__
    1.65  	flags |= _PAGE_USER;
    1.66  #endif
    1.67 -	if (direct_remap_area_pages(&init_mm, (unsigned long) addr, phys_addr,
    1.68 +	if (direct_remap_pfn_range(&init_mm, (unsigned long) addr, phys_addr>>PAGE_SHIFT,
    1.69  				    size, __pgprot(flags), domid)) {
    1.70  		vunmap((void __force *) addr);
    1.71  		return NULL;
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Wed Sep 07 21:35:05 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Wed Sep 07 23:10:49 2005 +0000
     2.3 @@ -154,12 +154,12 @@ static int map_frontend_pages(netif_t *n
     2.4      pgprot_t      prot = __pgprot(_KERNPG_TABLE);
     2.5      int           err;
     2.6  
     2.7 -    err = direct_remap_area_pages(&init_mm, localaddr,
     2.8 -				  tx_ring_ref<<PAGE_SHIFT, PAGE_SIZE,
     2.9 +    err = direct_remap_pfn_range(&init_mm, localaddr,
    2.10 +				  tx_ring_ref, PAGE_SIZE,
    2.11  				  prot, netif->domid); 
    2.12      
    2.13 -    err |= direct_remap_area_pages(&init_mm, localaddr + PAGE_SIZE,
    2.14 -				  rx_ring_ref<<PAGE_SHIFT, PAGE_SIZE,
    2.15 +    err |= direct_remap_pfn_range(&init_mm, localaddr + PAGE_SIZE,
    2.16 +				  rx_ring_ref, PAGE_SIZE,
    2.17  				  prot, netif->domid);
    2.18  
    2.19      if (err)
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Wed Sep 07 21:35:05 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Wed Sep 07 23:10:49 2005 +0000
     3.3 @@ -116,9 +116,9 @@ static int privcmd_ioctl(struct inode *i
     3.4                  if ( (msg[j].va + (msg[j].npages<<PAGE_SHIFT)) > vma->vm_end )
     3.5                      return -EINVAL;
     3.6  
     3.7 -                if ( (rc = direct_remap_area_pages(vma->vm_mm, 
     3.8 +                if ( (rc = direct_remap_pfn_range(vma->vm_mm, 
     3.9                                                     msg[j].va&PAGE_MASK, 
    3.10 -                                                   msg[j].mfn<<PAGE_SHIFT, 
    3.11 +                                                   msg[j].mfn, 
    3.12                                                     msg[j].npages<<PAGE_SHIFT, 
    3.13                                                     vma->vm_page_prot,
    3.14                                                     mmapcmd.dom)) < 0 )
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/usbback/interface.c	Wed Sep 07 21:35:05 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/usbback/interface.c	Wed Sep 07 23:10:49 2005 +0000
     4.3 @@ -161,8 +161,8 @@ void usbif_connect(usbif_be_connect_t *c
     4.4      }
     4.5  
     4.6      prot = __pgprot(_KERNPG_TABLE);
     4.7 -    error = direct_remap_area_pages(&init_mm, VMALLOC_VMADDR(vma->addr),
     4.8 -                                    shmem_frame<<PAGE_SHIFT, PAGE_SIZE,
     4.9 +    error = direct_remap_pfn_range(&init_mm, VMALLOC_VMADDR(vma->addr),
    4.10 +                                    shmem_frame, PAGE_SIZE,
    4.11                                      prot, domid);
    4.12      if ( error != 0 )
    4.13      {
     5.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Wed Sep 07 21:35:05 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Wed Sep 07 23:10:49 2005 +0000
     5.3 @@ -460,9 +460,9 @@ void make_pages_writable(void *va, unsig
     5.4  #define kern_addr_valid(addr)	(1)
     5.5  #endif /* !CONFIG_DISCONTIGMEM */
     5.6  
     5.7 -int direct_remap_area_pages(struct mm_struct *mm,
     5.8 +int direct_remap_pfn_range(struct mm_struct *mm,
     5.9                              unsigned long address, 
    5.10 -                            unsigned long machine_addr,
    5.11 +                            unsigned long mfn,
    5.12                              unsigned long size, 
    5.13                              pgprot_t prot,
    5.14                              domid_t  domid);
    5.15 @@ -474,10 +474,10 @@ int touch_pte_range(struct mm_struct *mm
    5.16                      unsigned long size);
    5.17  
    5.18  #define io_remap_page_range(vma,from,phys,size,prot) \
    5.19 -direct_remap_area_pages(vma->vm_mm,from,phys,size,prot,DOMID_IO)
    5.20 +direct_remap_pfn_range(vma->vm_mm,from,phys>>PAGE_SHIFT,size,prot,DOMID_IO)
    5.21  
    5.22  #define io_remap_pfn_range(vma,from,pfn,size,prot) \
    5.23 -direct_remap_area_pages(vma->vm_mm,from,pfn<<PAGE_SHIFT,size,prot,DOMID_IO)
    5.24 +direct_remap_pfn_range(vma->vm_mm,from,pfn,size,prot,DOMID_IO)
    5.25  
    5.26  #define MK_IOSPACE_PFN(space, pfn)	(pfn)
    5.27  #define GET_IOSPACE(pfn)		0
     6.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h	Wed Sep 07 21:35:05 2005 +0000
     6.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h	Wed Sep 07 23:10:49 2005 +0000
     6.3 @@ -526,28 +526,26 @@ extern int kern_addr_valid(unsigned long
     6.4  
     6.5  #define DOMID_LOCAL (0xFFFFU)
     6.6  
     6.7 -int direct_remap_area_pages(struct mm_struct *mm,
     6.8 +int direct_remap_pfn_range(struct mm_struct *mm,
     6.9                              unsigned long address,
    6.10 -                            unsigned long machine_addr,
    6.11 +                            unsigned long mfn,
    6.12                              unsigned long size,
    6.13                              pgprot_t prot,
    6.14                              domid_t  domid);
    6.15 -int __direct_remap_area_pages(struct mm_struct *mm,
    6.16 -                              unsigned long address,
    6.17 -                              unsigned long size,
    6.18 -                              mmu_update_t *v);
    6.19 +
    6.20  int create_lookup_pte_addr(struct mm_struct *mm,
    6.21                             unsigned long address,
    6.22                             unsigned long *ptep);
    6.23 +
    6.24  int touch_pte_range(struct mm_struct *mm,
    6.25                      unsigned long address,
    6.26                      unsigned long size);
    6.27  
    6.28  #define io_remap_page_range(vma, vaddr, paddr, size, prot)		\
    6.29 -		direct_remap_area_pages((vma)->vm_mm,vaddr,paddr,size,prot,DOMID_IO)
    6.30 +		direct_remap_pfn_range((vma)->vm_mm,vaddr,paddr>>PAGE_SHIFT,size,prot,DOMID_IO)
    6.31  
    6.32  #define io_remap_pfn_range(vma, vaddr, pfn, size, prot)		\
    6.33 -		direct_remap_area_pages((vma)->vm_mm,vaddr,(pfn)<<PAGE_SHIFT,size,prot,DOMID_IO)
    6.34 +		direct_remap_pfn_range((vma)->vm_mm,vaddr,pfn,size,prot,DOMID_IO)
    6.35  
    6.36  #define MK_IOSPACE_PFN(space, pfn)	(pfn)
    6.37  #define GET_IOSPACE(pfn)		0