ia64/xen-unstable

changeset 3004:2bebf77dc30e

bitkeeper revision 1.1159.175.1 (419a9b9dCZLKnt1tKvFYyV5cDeDbmQ)

Clean up drivers/char/mem.c patch.
author iap10@labyrinth.cl.cam.ac.uk
date Wed Nov 17 00:30:21 2004 +0000 (2004-11-17)
parents adea3db0783f
children d3865a06ff71 19709f876d45
files linux-2.6.9-xen-sparse/drivers/char/mem.c linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/pgtable.h
line diff
     1.1 --- a/linux-2.6.9-xen-sparse/drivers/char/mem.c	Mon Nov 15 20:36:28 2004 +0000
     1.2 +++ b/linux-2.6.9-xen-sparse/drivers/char/mem.c	Wed Nov 17 00:30:21 2004 +0000
     1.3 @@ -43,7 +43,12 @@ extern void tapechar_init(void);
     1.4   */
     1.5  static inline int uncached_access(struct file *file, unsigned long addr)
     1.6  {
     1.7 -#if defined(__i386__)
     1.8 +#ifdef CONFIG_XEN
     1.9 +        if (file->f_flags & O_SYNC)
    1.10 +                return 1;
    1.11 +        /* Xen sets correct MTRR type on non-RAM for us. */
    1.12 +        return 0;
    1.13 +#elif defined(__i386__)
    1.14  	/*
    1.15  	 * On the PPro and successors, the MTRRs are used to set
    1.16  	 * memory types for physical addresses outside main memory,
    1.17 @@ -193,7 +198,6 @@ static ssize_t write_mem(struct file * f
    1.18  
    1.19  static int mmap_mem(struct file * file, struct vm_area_struct * vma)
    1.20  {
    1.21 -#if !defined(CONFIG_XEN)
    1.22  	unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
    1.23  	int uncached;
    1.24  
    1.25 @@ -212,28 +216,16 @@ static int mmap_mem(struct file * file, 
    1.26  	if (uncached)
    1.27  		vma->vm_flags |= VM_IO;
    1.28  
    1.29 +#if defined(CONFIG_XEN)
    1.30 +	if (io_remap_page_range(vma, vma->vm_start, offset, 
    1.31 +				vma->vm_end-vma->vm_start, vma->vm_page_prot))
    1.32 +		return -EAGAIN;
    1.33 +#else
    1.34  	if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start,
    1.35  			     vma->vm_page_prot))
    1.36  		return -EAGAIN;
    1.37 +#endif
    1.38  	return 0;
    1.39 -#elif !defined(CONFIG_XEN_PRIVILEGED_GUEST)
    1.40 -	return -ENXIO;
    1.41 -#else
    1.42 -	unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
    1.43 -
    1.44 -	if (!(xen_start_info.flags & SIF_PRIVILEGED))
    1.45 -		return -ENXIO;
    1.46 -
    1.47 -	/* Currently we're not smart about setting PTE cacheability. */
    1.48 -	vma->vm_flags |= VM_RESERVED | VM_IO;
    1.49 -	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
    1.50 -
    1.51 -	if (direct_remap_area_pages(vma->vm_mm, vma->vm_start, offset, 
    1.52 -				vma->vm_end-vma->vm_start, vma->vm_page_prot,
    1.53 -				DOMID_IO))
    1.54 -		return -EAGAIN;
    1.55 -	return 0;
    1.56 -#endif
    1.57  }
    1.58  
    1.59  extern long vread(char *buf, char *addr, unsigned long count);
     2.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Mon Nov 15 20:36:28 2004 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/pgtable.h	Wed Nov 17 00:30:21 2004 +0000
     2.3 @@ -536,7 +536,8 @@ static inline unsigned long arbitrary_vi
     2.4  #define kern_addr_valid(addr)	(1)
     2.5  #endif /* !CONFIG_DISCONTIGMEM */
     2.6  
     2.7 -#define io_remap_page_range remap_page_range
     2.8 +#define io_remap_page_range(vma,from,phys,size,prot)                     \
     2.9 +        direct_remap_area_pages(vma->vm_mm,from,phys,size,prot,DOMID_IO)
    2.10  
    2.11  #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
    2.12  #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY