ia64/xen-unstable

changeset 2081:41708c9ea59d

bitkeeper revision 1.1147 (4111186968-85F4G7TCbxTsfJbMisQ)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xeno.bk-26dom0
author cl349@freefall.cl.cam.ac.uk
date Wed Aug 04 17:10:01 2004 +0000 (2004-08-04)
parents c8aef6c7b1a5 978cf09b74ff
children f04ec9f1af56
files linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6.7-xen-sparse/arch/xen/i386/mm/init.c linux-2.6.7-xen-sparse/drivers/xen/console/console.c linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/fixmap.h linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/io.h
line diff
     1.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c	Wed Aug 04 16:20:15 2004 +0000
     1.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c	Wed Aug 04 17:10:01 2004 +0000
     1.3 @@ -924,7 +924,7 @@ legacy_init_iomem_resources(struct resou
     1.4  {
     1.5  	int i;
     1.6  
     1.7 -#ifdef CONFIG_XEN_PHYSDEV_ACCESS
     1.8 +#ifdef CONFIG_XEN_PRIVILEGED_GUEST
     1.9  	probe_roms();
    1.10  #endif
    1.11  	for (i = 0; i < e820.nr_map; i++) {
    1.12 @@ -1217,15 +1217,6 @@ void __init setup_arch(char **cmdline_p)
    1.13  
    1.14  	register_memory(max_low_pfn);
    1.15  
    1.16 -#ifdef CONFIG_VT
    1.17 -#if defined(CONFIG_VGA_CONSOLE)
    1.18 -	if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
    1.19 -		conswitchp = &vga_con;
    1.20 -#elif defined(CONFIG_DUMMY_CONSOLE)
    1.21 -	conswitchp = &dummy_con;
    1.22 -#endif
    1.23 -#endif
    1.24 -
    1.25  	/* If we are a privileged guest OS then we should request IO privs. */
    1.26  	if (start_info.flags & SIF_PRIVILEGED) {
    1.27  		dom0_op_t op;
    1.28 @@ -1236,6 +1227,30 @@ void __init setup_arch(char **cmdline_p)
    1.29  			panic("Unable to obtain IOPL, despite SIF_PRIVILEGED");
    1.30  		current->thread.io_pl = 1;
    1.31  	}
    1.32 +
    1.33 +	if (start_info.flags & SIF_INITDOMAIN) {
    1.34 +		if (!(start_info.flags & SIF_PRIVILEGED))
    1.35 +			panic("Xen granted us console access "
    1.36 +			      "but not privileged status");
    1.37 +
    1.38 +#ifdef CONFIG_VT
    1.39 +#if defined(CONFIG_VGA_CONSOLE)
    1.40 +		if (!efi_enabled ||
    1.41 +		    (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
    1.42 +			conswitchp = &vga_con;
    1.43 +#elif defined(CONFIG_DUMMY_CONSOLE)
    1.44 +		conswitchp = &dummy_con;
    1.45 +#endif
    1.46 +#endif
    1.47 +	} else {
    1.48 +#if defined(CONFIG_VGA_CONSOLE)
    1.49 +		/* disable VGA driver */
    1.50 +		ORIG_VIDEO_ISVGA = VIDEO_TYPE_VLFB;
    1.51 +#endif
    1.52 +#if defined(CONFIG_DUMMY_CONSOLE)
    1.53 +		conswitchp = &dummy_con;
    1.54 +#endif
    1.55 +	}
    1.56  }
    1.57  
    1.58  #include "setup_arch_post.h"
     2.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/init.c	Wed Aug 04 16:20:15 2004 +0000
     2.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/mm/init.c	Wed Aug 04 17:10:01 2004 +0000
     2.3 @@ -502,7 +502,11 @@ void __init paging_init(void)
     2.4  #ifdef CONFIG_XEN_PRIVILEGED_GUEST
     2.5  	/* Setup mapping of lower 1st MB */
     2.6  	for (i = 0; i < NR_FIX_ISAMAPS; i++)
     2.7 -		set_fixmap_ma(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
     2.8 +		if (start_info.flags & SIF_PRIVILEGED)
     2.9 +			set_fixmap_ma(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
    2.10 +		else
    2.11 +			set_fixmap_ma_ro(FIX_ISAMAP_BEGIN - i,
    2.12 +					 virt_to_machine(empty_zero_page));
    2.13  #endif
    2.14  }
    2.15  
     3.1 --- a/linux-2.6.7-xen-sparse/drivers/xen/console/console.c	Wed Aug 04 16:20:15 2004 +0000
     3.2 +++ b/linux-2.6.7-xen-sparse/drivers/xen/console/console.c	Wed Aug 04 17:10:01 2004 +0000
     3.3 @@ -45,6 +45,10 @@ static enum { XC_OFF, XC_DEFAULT, XC_TTY
     3.4  
     3.5  static int __init xencons_setup(char *str)
     3.6  {
     3.7 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     3.8 +    if (str[0] == '=')
     3.9 +	str++;
    3.10 +#endif
    3.11      if ( !strcmp(str, "tty") )
    3.12          xc_mode = XC_TTY;
    3.13      else if ( !strcmp(str, "ttyS") )
    3.14 @@ -160,7 +164,14 @@ void xen_console_init(void)
    3.15      else
    3.16      {
    3.17          if ( xc_mode == XC_DEFAULT )
    3.18 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && defined(CONFIG_VT)
    3.19 +            /* On a kernel built with VT support, default to serial
    3.20 +             * console because the VT driver has already allocated the
    3.21 +             * /dev/tty device nodes */
    3.22 +            xc_mode = XC_SERIAL;
    3.23 +#else
    3.24              xc_mode = XC_TTY;
    3.25 +#endif
    3.26          kcons_info.write = kcons_write;
    3.27      }
    3.28  
     4.1 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/fixmap.h	Wed Aug 04 16:20:15 2004 +0000
     4.2 +++ b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/fixmap.h	Wed Aug 04 17:10:01 2004 +0000
     4.3 @@ -98,6 +98,8 @@ extern void __set_fixmap_ma (enum fixed_
     4.4  		__set_fixmap(idx, phys, PAGE_KERNEL)
     4.5  #define set_fixmap_ma(idx, phys) \
     4.6  		__set_fixmap_ma(idx, phys, PAGE_KERNEL)
     4.7 +#define set_fixmap_ma_ro(idx, phys) \
     4.8 +		__set_fixmap_ma(idx, phys, PAGE_KERNEL_RO)
     4.9  /*
    4.10   * Some hardware wants to get fixmapped without caching.
    4.11   */
     5.1 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/io.h	Wed Aug 04 16:20:15 2004 +0000
     5.2 +++ b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/io.h	Wed Aug 04 17:10:01 2004 +0000
     5.3 @@ -285,8 +285,15 @@ static inline void flush_write_buffers(v
     5.4  
     5.5  #ifdef SLOW_IO_BY_JUMPING
     5.6  #define __SLOW_DOWN_IO "jmp 1f; 1: jmp 1f; 1:"
     5.7 +#elif defined(__UNSAFE_IO__)
     5.8 +#define __SLOW_DOWN_IO "outb %%al,$0x80;"
     5.9  #else
    5.10 -#define __SLOW_DOWN_IO "outb %%al,$0x80;"
    5.11 +#define __SLOW_DOWN_IO "\n1: outb %%al,$0x80\n"		\
    5.12 +		       "2:\n"				\
    5.13 +		       ".section __ex_table,\"a\"\n\t"	\
    5.14 +		       ".align 4\n\t"			\
    5.15 +		       ".long 1b,2b\n"			\
    5.16 +		       ".previous"
    5.17  #endif
    5.18  
    5.19  static inline void slow_down_io(void) {
    5.20 @@ -320,7 +327,7 @@ static inline unsigned type in##bwl##_qu
    5.21  static inline unsigned type in##bwl(int port) { \
    5.22  	return in##bwl##_quad(port, 0); \
    5.23  }
    5.24 -#else
    5.25 +#else 
    5.26  #define __BUILDIO(bwl,bw,type) \
    5.27  static inline void out##bwl(unsigned type value, int port) { \
    5.28  	out##bwl##_local(value, port); \
    5.29 @@ -331,7 +338,8 @@ static inline unsigned type in##bwl(int 
    5.30  #endif
    5.31  
    5.32  
    5.33 -#define BUILDIO(bwl,bw,type) \
    5.34 +#if __UNSAFE_IO__
    5.35 +#define ____BUILDIO(bwl,bw,type) \
    5.36  static inline void out##bwl##_local(unsigned type value, int port) { \
    5.37  	__asm__ __volatile__("out" #bwl " %" #bw "0, %w1" : : "a"(value), "Nd"(port)); \
    5.38  } \
    5.39 @@ -339,7 +347,35 @@ static inline unsigned type in##bwl##_lo
    5.40  	unsigned type value; \
    5.41  	__asm__ __volatile__("in" #bwl " %w1, %" #bw "0" : "=a"(value) : "Nd"(port)); \
    5.42  	return value; \
    5.43 +}
    5.44 +#else
    5.45 +#define ____BUILDIO(bwl,bw,type) \
    5.46 +static inline void out##bwl##_local(unsigned type value, int port) { \
    5.47 +	__asm__ __volatile__("1: out" #bwl " %" #bw "0, %w1\n"		\
    5.48 +			     "2:\n"					\
    5.49 +			     ".section __ex_table,\"a\"\n\t"		\
    5.50 +			     ".align 4\n\t"				\
    5.51 +			     ".long 1b,2b\n"				\
    5.52 +			     ".previous" : : "a"(value), "Nd"(port));	\
    5.53  } \
    5.54 +static inline unsigned type in##bwl##_local(int port) { \
    5.55 +	unsigned type value; \
    5.56 +	__asm__ __volatile__("1:in" #bwl " %w1, %" #bw "0\n"		\
    5.57 +			     "2:\n"					\
    5.58 +			     ".section .fixup,\"ax\"\n"			\
    5.59 +			     "3: mov" #bwl " $~0,%" #bw "0\n\t"		\
    5.60 +			     "jmp 2b\n"					\
    5.61 +			     ".previous\n"				\
    5.62 +			     ".section __ex_table,\"a\"\n\t"		\
    5.63 +			     ".align 4\n\t"				\
    5.64 +			     ".long 1b,3b\n"				\
    5.65 +			     ".previous" : "=a"(value) : "Nd"(port));	\
    5.66 +	return value; \
    5.67 +}
    5.68 +#endif
    5.69 +
    5.70 +#define BUILDIO(bwl,bw,type) \
    5.71 +____BUILDIO(bwl,bw,type) \
    5.72  static inline void out##bwl##_local_p(unsigned type value, int port) { \
    5.73  	out##bwl##_local(value, port); \
    5.74  	slow_down_io(); \