ia64/xen-unstable

changeset 2426:0811d135075f

bitkeeper revision 1.1159.69.8 (413960891Us2H0wgOni9gC4Dvk3uCw)

Fix I/O mapping in Xen/Linux.
author kaf24@freefall.cl.cam.ac.uk
date Sat Sep 04 06:28:25 2004 +0000 (2004-09-04)
parents 417427e14fbb
children 6f9bf6379bbd
files linux-2.6.8.1-xen-sparse/arch/xen/Kconfig linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/io.h
line diff
     1.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig	Sat Sep 04 04:36:41 2004 +0000
     1.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig	Sat Sep 04 06:28:25 2004 +0000
     1.3 @@ -26,13 +26,12 @@ menu "XEN"
     1.4  config XEN_PRIVILEGED_GUEST
     1.5  	bool "Privileged Guest (domain 0)"
     1.6  	default n
     1.7 +        select XEN_PHYSDEV_ACCESS
     1.8  	help
     1.9  	  Support for privileged operation (domain 0)
    1.10  
    1.11  config XEN_PHYSDEV_ACCESS
    1.12  	bool "Device-driver domain (physical device access)"
    1.13 -	default y if XEN_PRIVILEGED_GUEST
    1.14 -	default n
    1.15  	help
    1.16  	  Device-driver domain (physical device access)
    1.17  
     2.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c	Sat Sep 04 04:36:41 2004 +0000
     2.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c	Sat Sep 04 06:28:25 2004 +0000
     2.3 @@ -17,6 +17,25 @@
     2.4  #include <asm/tlbflush.h>
     2.5  #include <asm/pgtable.h>
     2.6  
     2.7 +#ifndef CONFIG_XEN_PHYSDEV_ACCESS
     2.8 +
     2.9 +void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
    2.10 +{ return NULL; }
    2.11 +
    2.12 +void *ioremap_nocache (unsigned long phys_addr, unsigned long size)
    2.13 +{ return NULL; }
    2.14 +
    2.15 +void iounmap(void *addr)
    2.16 +{ }
    2.17 +
    2.18 +void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
    2.19 +{ return NULL; }
    2.20 +
    2.21 +void __init bt_iounmap(void *addr, unsigned long size)
    2.22 +{ }
    2.23 +
    2.24 +#else
    2.25 +
    2.26  static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
    2.27  	unsigned long phys_addr, unsigned long flags)
    2.28  {
    2.29 @@ -133,11 +152,11 @@ void * __ioremap(unsigned long phys_addr
    2.30  	/*
    2.31  	 * Don't allow anybody to remap normal RAM that we're using..
    2.32  	 */
    2.33 -	if (phys_addr < virt_to_phys(high_memory)) {
    2.34 +	if (machine_to_phys(phys_addr) < virt_to_phys(high_memory)) {
    2.35  		char *t_addr, *t_end;
    2.36  		struct page *page;
    2.37  
    2.38 -		t_addr = __va(phys_addr);
    2.39 +		t_addr = bus_to_virt(phys_addr);
    2.40  		t_end = t_addr + (size - 1);
    2.41  	   
    2.42  		for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
    2.43 @@ -200,8 +219,8 @@ void *ioremap_nocache (unsigned long phy
    2.44  	/* Guaranteed to be > phys_addr, as per __ioremap() */
    2.45  	last_addr = phys_addr + size - 1;
    2.46  
    2.47 -	if (last_addr < virt_to_phys(high_memory)) { 
    2.48 -		struct page *ppage = virt_to_page(__va(phys_addr));		
    2.49 +	if (machine_to_phys(last_addr) < virt_to_phys(high_memory)) { 
    2.50 +		struct page *ppage = virt_to_page(bus_to_virt(phys_addr));
    2.51  		unsigned long npages;
    2.52  
    2.53  		phys_addr &= PAGE_MASK;
    2.54 @@ -237,8 +256,8 @@ void iounmap(void *addr)
    2.55  		return;
    2.56  	} 
    2.57  
    2.58 -	if (p->flags && p->phys_addr < virt_to_phys(high_memory)) { 
    2.59 -		change_page_attr(virt_to_page(__va(p->phys_addr)),
    2.60 +	if (p->flags && machine_to_phys(p->phys_addr) < virt_to_phys(high_memory)) { 
    2.61 +		change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)),
    2.62  				 p->size >> PAGE_SHIFT,
    2.63  				 PAGE_KERNEL); 				 
    2.64  		global_flush_tlb();
    2.65 @@ -316,6 +335,7 @@ void __init bt_iounmap(void *addr, unsig
    2.66  	}
    2.67  }
    2.68  
    2.69 +#endif /* CONFIG_XEN_PHYSDEV_ACCESS */
    2.70  
    2.71  #if defined(CONFIG_XEN_PRIVILEGED_GUEST)
    2.72  
     3.1 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/io.h	Sat Sep 04 04:36:41 2004 +0000
     3.2 +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/io.h	Sat Sep 04 06:28:25 2004 +0000
     3.3 @@ -128,12 +128,12 @@ extern void bt_iounmap(void *addr, unsig
     3.4  /*
     3.5   * ISA I/O bus memory addresses are 1:1 with the physical address.
     3.6   */
     3.7 -#define isa_virt_to_bus(_x) BUG() // should be (void *)((FIX_ISAMAP_BEGIN - __virt_to_fix((_x))) << PAGE_SHIFT)
     3.8 -#define isa_page_to_bus(_x) BUG()  // page_to_phys(_x)
     3.9 +#define isa_virt_to_bus(_x) isa_virt_to_bus_is_UNSUPPORTED->x
    3.10 +#define isa_page_to_bus(_x) isa_page_to_bus_is_UNSUPPORTED->x
    3.11  #ifdef CONFIG_XEN_PRIVILEGED_GUEST
    3.12  #define isa_bus_to_virt(_x) (void *)__fix_to_virt(FIX_ISAMAP_BEGIN - ((_x) >> PAGE_SHIFT))
    3.13  #else
    3.14 -#define isa_bus_to_virt(_x) (void *)0L /* XXXcl */
    3.15 +#define isa_bus_to_virt(_x) isa_bus_to_virt_needs_PRIVILEGED_BUILD
    3.16  #endif
    3.17  
    3.18  /*