ia64/xen-unstable

changeset 19511:19919f01f2c5

merge with xen-unstable.hg
author Isaku Yamahata <yamahata@valinux.co.jp>
date Tue Apr 07 11:32:24 2009 +0900 (2009-04-07)
parents 22fe8c499431 accf139b2eb9
children 8c806c66a597
files tools/misc/fakei386xen tools/misc/netfix tools/misc/xen-clone.README
line diff
     1.1 --- a/Config.mk	Tue Apr 07 11:29:44 2009 +0900
     1.2 +++ b/Config.mk	Tue Apr 07 11:32:24 2009 +0900
     1.3 @@ -19,8 +19,6 @@ HOSTCFLAGS += -fno-strict-aliasing
     1.4  
     1.5  DISTDIR     ?= $(XEN_ROOT)/dist
     1.6  DESTDIR     ?= /
     1.7 -DOCDIR      ?= /usr/share/doc/xen
     1.8 -MANDIR      ?= /usr/share/man
     1.9  
    1.10  # Allow phony attribute to be listed as dependency rather than fake target
    1.11  .PHONY: .phony
    1.12 @@ -28,6 +26,10 @@ MANDIR      ?= /usr/share/man
    1.13  include $(XEN_ROOT)/config/$(XEN_OS).mk
    1.14  include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
    1.15  
    1.16 +SHAREDIR    ?= $(PREFIX)/share
    1.17 +DOCDIR      ?= $(SHAREDIR)/doc/xen
    1.18 +MANDIR      ?= $(SHAREDIR)/man
    1.19 +
    1.20  ifneq ($(EXTRA_PREFIX),)
    1.21  EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
    1.22  EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
     2.1 --- a/config/StdGNU.mk	Tue Apr 07 11:29:44 2009 +0900
     2.2 +++ b/config/StdGNU.mk	Tue Apr 07 11:32:24 2009 +0900
     2.3 @@ -31,7 +31,8 @@ LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
     2.4  LIBDIR_x86_32 = $(PREFIX)/$(LIBLEAFDIR_x86_32)
     2.5  LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
     2.6  LIBEXEC = $(LIBDIR_x86_32)/xen/bin
     2.7 -MANDIR = $(PREFIX)/share/man
     2.8 +SHAREDIR = $(PREFIX)/share
     2.9 +MANDIR = $(SHAREDIR)/man
    2.10  MAN1DIR = $(MANDIR)/man1
    2.11  MAN8DIR = $(MANDIR)/man8
    2.12  SBINDIR = $(PREFIX)/sbin
     3.1 --- a/extras/mini-os/include/blkfront.h	Tue Apr 07 11:29:44 2009 +0900
     3.2 +++ b/extras/mini-os/include/blkfront.h	Tue Apr 07 11:32:24 2009 +0900
     3.3 @@ -8,6 +8,8 @@ struct blkfront_aiocb
     3.4      uint8_t *aio_buf;
     3.5      size_t aio_nbytes;
     3.6      off_t aio_offset;
     3.7 +    size_t total_bytes;
     3.8 +    uint8_t is_write;
     3.9      void *data;
    3.10  
    3.11      grant_ref_t gref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/extras/mini-os/lib/stack_chk_fail.c	Tue Apr 07 11:32:24 2009 +0900
     4.3 @@ -0,0 +1,8 @@
     4.4 +#include <kernel.h>
     4.5 +#include <console.h>
     4.6 +
     4.7 +void __stack_chk_fail(void)
     4.8 +{
     4.9 +    printk("stack smashing detected\n");
    4.10 +    do_exit();
    4.11 +}
     5.1 --- a/stubdom/Makefile	Tue Apr 07 11:29:44 2009 +0900
     5.2 +++ b/stubdom/Makefile	Tue Apr 07 11:32:24 2009 +0900
     5.3 @@ -91,6 +91,7 @@ newlib-$(NEWLIB_VERSION).tar.gz:
     5.4  newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
     5.5  	tar xzf $<
     5.6  	patch -d $@ -p0 < newlib.patch
     5.7 +	patch -d $@ -p0 < newlib-chk.patch
     5.8  	touch $@
     5.9  
    5.10  NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/stubdom/newlib-chk.patch	Tue Apr 07 11:32:24 2009 +0900
     6.3 @@ -0,0 +1,155 @@
     6.4 +--- newlib/libc/stdio/fprintf_chk.c	1969-12-31 19:00:00.000000000 -0500
     6.5 ++++ newlib/libc/stdio/fprintf_chk.c	2009-02-26 19:02:53.000000000 -0500
     6.6 +@@ -0,0 +1,21 @@
     6.7 ++#include <stdarg.h>
     6.8 ++#include <stdio.h>
     6.9 ++
    6.10 ++/*
    6.11 ++ * Stub implementation of __fprintf_chk adapted from glibc 2.7.  This 
    6.12 ++ * doesn't actually implement any buffer overflow protection.  It just makes
    6.13 ++ * the linker happy :)
    6.14 ++*/
    6.15 ++int
    6.16 ++__fprintf_chk (FILE *fp, int flag, const char *format, ...)
    6.17 ++{
    6.18 ++  va_list ap;
    6.19 ++  int done;
    6.20 ++
    6.21 ++  va_start (ap, format);
    6.22 ++  done = vfprintf (fp, format, ap);
    6.23 ++  va_end (ap);
    6.24 ++
    6.25 ++  return done;
    6.26 ++}
    6.27 ++
    6.28 +--- newlib/libc/stdio/Makefile.am	2007-08-02 16:23:06.000000000 -0400
    6.29 ++++ newlib/libc/stdio/Makefile.am	2009-02-26 18:14:53.000000000 -0500
    6.30 +@@ -20,6 +20,7 @@
    6.31 + 	flags.c			\
    6.32 + 	fopen.c			\
    6.33 + 	fprintf.c			\
    6.34 ++	fprintf_chk.c		\
    6.35 + 	fputc.c			\
    6.36 + 	fputs.c			\
    6.37 + 	fread.c			\
    6.38 +@@ -65,6 +66,7 @@
    6.39 + 	sniprintf.c			\
    6.40 + 	snprintf.c			\
    6.41 + 	sprintf.c			\
    6.42 ++	sprintf_chk.c			\
    6.43 + 	sscanf.c			\
    6.44 + 	stdio.c			\
    6.45 + 	tmpfile.c			\
    6.46 +--- newlib/libc/stdio/Makefile.in	2007-12-19 17:36:38.000000000 -0500
    6.47 ++++ newlib/libc/stdio/Makefile.in	2009-02-26 18:43:52.000000000 -0500
    6.48 +@@ -63,7 +63,8 @@
    6.49 + 	lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
    6.50 + 	lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
    6.51 + 	lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
    6.52 +-	lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
    6.53 ++	lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \
    6.54 ++	lib_a-fputc.$(OBJEXT) \
    6.55 + 	lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
    6.56 + 	lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
    6.57 + 	lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
    6.58 +@@ -86,6 +87,7 @@
    6.59 + 	lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
    6.60 + 	lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
    6.61 + 	lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
    6.62 ++	lib_a-sprintf_chk.$(OBJEXT) \
    6.63 + 	lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
    6.64 + 	lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
    6.65 + 	lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \
    6.66 +@@ -122,15 +124,15 @@
    6.67 + LTLIBRARIES = $(noinst_LTLIBRARIES)
    6.68 + am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \
    6.69 + 	fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
    6.70 +-	fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \
    6.71 +-	fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
    6.72 ++	fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo fputc.lo \
    6.73 ++	fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
    6.74 + 	ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
    6.75 + 	getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
    6.76 + 	iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \
    6.77 + 	putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
    6.78 + 	rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
    6.79 + 	setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \
    6.80 +-	sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
    6.81 ++	sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo stdio.lo \
    6.82 + 	tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \
    6.83 + 	viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \
    6.84 + 	vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
    6.85 +@@ -344,6 +346,7 @@
    6.86 + 	flags.c			\
    6.87 + 	fopen.c			\
    6.88 + 	fprintf.c			\
    6.89 ++	fprintf_chk.c			\
    6.90 + 	fputc.c			\
    6.91 + 	fputs.c			\
    6.92 + 	fread.c			\
    6.93 +@@ -389,6 +392,7 @@
    6.94 + 	sniprintf.c			\
    6.95 + 	snprintf.c			\
    6.96 + 	sprintf.c			\
    6.97 ++	sprintf_chk.c			\
    6.98 + 	sscanf.c			\
    6.99 + 	stdio.c			\
   6.100 + 	tmpfile.c			\
   6.101 +@@ -508,6 +512,7 @@
   6.102 + 	siprintf.def		\
   6.103 + 	siscanf.def		\
   6.104 + 	sprintf.def		\
   6.105 ++	sprintf_chk.def		\
   6.106 + 	sscanf.def		\
   6.107 + 	tmpfile.def		\
   6.108 + 	tmpnam.def		\
   6.109 +@@ -678,6 +683,12 @@
   6.110 + lib_a-fprintf.obj: fprintf.c
   6.111 + 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi`
   6.112 + 
   6.113 ++lib_a-fprintf_chk.o: fprintf_chk.c
   6.114 ++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o `test -f 'fprintf_chk.c' || echo '$(srcdir)/'`fprintf_chk.c
   6.115 ++
   6.116 ++lib_a-fprintf_chk.obj: fprintf_chk.c
   6.117 ++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj `if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi`
   6.118 ++
   6.119 + lib_a-fputc.o: fputc.c
   6.120 + 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c
   6.121 + 
   6.122 +@@ -948,6 +959,12 @@
   6.123 + lib_a-sprintf.obj: sprintf.c
   6.124 + 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi`
   6.125 + 
   6.126 ++lib_a-sprintf_chk.o: sprintf_chk.c
   6.127 ++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o `test -f 'sprintf_chk.c' || echo '$(srcdir)/'`sprintf_chk.c
   6.128 ++
   6.129 ++lib_a-sprintf_chk.obj: sprintf_chk.c
   6.130 ++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj `if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi`
   6.131 ++
   6.132 + lib_a-sscanf.o: sscanf.c
   6.133 + 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.c' || echo '$(srcdir)/'`sscanf.c
   6.134 + 
   6.135 +--- newlib/libc/stdio/sprintf_chk.c	1969-12-31 19:00:00.000000000 -0500
   6.136 ++++ newlib/libc/stdio/sprintf_chk.c	2009-02-26 19:02:26.000000000 -0500
   6.137 +@@ -0,0 +1,21 @@
   6.138 ++#include <stdarg.h>
   6.139 ++#include <stdio.h>
   6.140 ++
   6.141 ++/*
   6.142 ++ * Stub implementation of __sprintf_chk adapted from glibc 2.7.  This 
   6.143 ++ * doesn't actually implement any buffer overflow protection.  It just makes
   6.144 ++ * the linker happy :)
   6.145 ++*/
   6.146 ++int
   6.147 ++__sprintf_chk (char *s, int flags, size_t slen, const char *format, ...)
   6.148 ++{
   6.149 ++  va_list arg;
   6.150 ++  int done;
   6.151 ++
   6.152 ++  va_start (arg, format);
   6.153 ++  done = vsprintf (s, format, arg);
   6.154 ++  va_end (arg);
   6.155 ++
   6.156 ++  return done;
   6.157 ++}
   6.158 ++
     7.1 --- a/tools/Rules.mk	Tue Apr 07 11:29:44 2009 +0900
     7.2 +++ b/tools/Rules.mk	Tue Apr 07 11:32:24 2009 +0900
     7.3 @@ -33,10 +33,12 @@ CFLAGS += -D__XEN_TOOLS__
     7.4  CFLAGS += -MMD -MF .$(@F).d
     7.5  DEPS = .*.d
     7.6  
     7.7 +ifneq ($(XEN_OS),NetBSD)
     7.8  # Enable implicit LFS support *and* explicit LFS names.
     7.9  CFLAGS  += $(shell getconf LFS_CFLAGS)
    7.10  CFLAGS  += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
    7.11  LDFLAGS += $(shell getconf LFS_LDFLAGS)
    7.12 +endif
    7.13  
    7.14  # 32-bit x86 does not perform well with -ve segment accesses on Xen.
    7.15  CFLAGS-$(CONFIG_X86_32) += $(call cc-option,$(CC),-mno-tls-direct-seg-refs)
     8.1 --- a/tools/firmware/hvmloader/acpi/dsdt.asl	Tue Apr 07 11:29:44 2009 +0900
     8.2 +++ b/tools/firmware/hvmloader/acpi/dsdt.asl	Tue Apr 07 11:32:24 2009 +0900
     8.3 @@ -123,7 +123,7 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, 
     8.4             Name (_BBN, 0x00)
     8.5  
     8.6             /*
     8.7 -            * Reserve the IO port ranges [0x10c0, 0x10c2] and [0xb044, 0xb047].
     8.8 +            * Reserve the IO port ranges [0x10c0, 0x10e1] and [0xb044, 0xb047].
     8.9              * Or else, for a hotplugged-in device, the port IO BAR assigned
    8.10              * by guest OS may conflict with the ranges here.
    8.11              */
    8.12 @@ -131,7 +131,7 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, 
    8.13             {
    8.14                 Name(_HID, EISAID("PNP0C02"))
    8.15                 Name(_CRS, ResourceTemplate() {
    8.16 -                   IO (Decode16, 0x10c0, 0x10c0, 0x00, 0x03)
    8.17 +                   IO (Decode16, 0x10c0, 0x10c0, 0x00, 0x22)
    8.18                     IO (Decode16, 0xb044, 0xb044, 0x00, 0x04)
    8.19                 })
    8.20             }
    8.21 @@ -2067,104 +2067,133 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, 
    8.22              Store (SLT, DPT1)
    8.23              Store (EVT, DPT2)
    8.24  
    8.25 -            Switch (SLT)
    8.26 +            If ( LEqual(SLT, 0x00) )
    8.27              {
    8.28 -                Case (0x00) {
    8.29 -                    Notify (\_SB.PCI0.S00, EVT)
    8.30 -                }
    8.31 -                Case (0x01) {
    8.32 -                    Notify (\_SB.PCI0.S01, EVT)
    8.33 -                }
    8.34 -                Case (0x02) {
    8.35 -                    Notify (\_SB.PCI0.S02, EVT)
    8.36 -                }
    8.37 -                Case (0x03) {
    8.38 -                    Notify (\_SB.PCI0.S03, EVT)
    8.39 -                }
    8.40 -                Case (0x04) {
    8.41 -                    Notify (\_SB.PCI0.S04, EVT)
    8.42 -                }
    8.43 -                Case (0x05) {
    8.44 -                    Notify (\_SB.PCI0.S05, EVT)
    8.45 -                }
    8.46 -                Case (0x06) {
    8.47 -                    Notify (\_SB.PCI0.S06, EVT)
    8.48 -                }
    8.49 -                Case (0x07) {
    8.50 -                    Notify (\_SB.PCI0.S07, EVT)
    8.51 -                }
    8.52 -                Case (0x08) {
    8.53 -                    Notify (\_SB.PCI0.S08, EVT)
    8.54 -                }
    8.55 -                Case (0x09) {
    8.56 -                    Notify (\_SB.PCI0.S09, EVT)
    8.57 -                }
    8.58 -                Case (0x0a) {
    8.59 -                    Notify (\_SB.PCI0.S0A, EVT)
    8.60 -                }
    8.61 -                Case (0x0b) {
    8.62 -                    Notify (\_SB.PCI0.S0B, EVT)
    8.63 -                }
    8.64 -                Case (0x0c) {
    8.65 -                    Notify (\_SB.PCI0.S0C, EVT)
    8.66 -                }
    8.67 -                Case (0x0d) {
    8.68 -                    Notify (\_SB.PCI0.S0D, EVT)
    8.69 -                }
    8.70 -                Case (0x0e) {
    8.71 -                    Notify (\_SB.PCI0.S0E, EVT)
    8.72 -                }
    8.73 -                Case (0x0f) {
    8.74 -                    Notify (\_SB.PCI0.S0F, EVT)
    8.75 -                }
    8.76 -                Case (0x10) {
    8.77 -                    Notify (\_SB.PCI0.S10, EVT)
    8.78 -                }
    8.79 -                Case (0x11) {
    8.80 -                    Notify (\_SB.PCI0.S11, EVT)
    8.81 -                }
    8.82 -                Case (0x12) {
    8.83 -                    Notify (\_SB.PCI0.S12, EVT)
    8.84 -                }
    8.85 -                Case (0x13) {
    8.86 -                    Notify (\_SB.PCI0.S13, EVT)
    8.87 -                }
    8.88 -                Case (0x14) {
    8.89 -                    Notify (\_SB.PCI0.S14, EVT)
    8.90 -                }
    8.91 -                Case (0x15) {
    8.92 -                    Notify (\_SB.PCI0.S15, EVT)
    8.93 -                }
    8.94 -                Case (0x16) {
    8.95 -                    Notify (\_SB.PCI0.S16, EVT)
    8.96 -                }
    8.97 -                Case (0x17) {
    8.98 -                    Notify (\_SB.PCI0.S17, EVT)
    8.99 -                }
   8.100 -                Case (0x18) {
   8.101 -                    Notify (\_SB.PCI0.S18, EVT)
   8.102 -                }
   8.103 -                Case (0x19) {
   8.104 -                    Notify (\_SB.PCI0.S19, EVT)
   8.105 -                }
   8.106 -                Case (0x1a) {
   8.107 -                    Notify (\_SB.PCI0.S1A, EVT)
   8.108 -                }
   8.109 -                Case (0x1b) {
   8.110 -                    Notify (\_SB.PCI0.S1B, EVT)
   8.111 -                }
   8.112 -                Case (0x1c) {
   8.113 -                    Notify (\_SB.PCI0.S1C, EVT)
   8.114 -                }
   8.115 -                Case (0x1d) {
   8.116 -                    Notify (\_SB.PCI0.S1D, EVT)
   8.117 -                }
   8.118 -                Case (0x1e) {
   8.119 -                    Notify (\_SB.PCI0.S1E, EVT)
   8.120 -                }
   8.121 -                Case (0x1f) {
   8.122 -                    Notify (\_SB.PCI0.S1F, EVT)
   8.123 -                }
   8.124 +                Notify (\_SB.PCI0.S00, EVT)
   8.125 +            }
   8.126 +            ElseIf ( LEqual(SLT, 0x01) )
   8.127 +            {
   8.128 +                Notify (\_SB.PCI0.S01, EVT)
   8.129 +            }
   8.130 +            ElseIf ( LEqual(SLT, 0x02) )
   8.131 +            {
   8.132 +                Notify (\_SB.PCI0.S02, EVT)
   8.133 +            }
   8.134 +            ElseIf ( LEqual(SLT, 0x03) )
   8.135 +            {
   8.136 +                Notify (\_SB.PCI0.S03, EVT)
   8.137 +            }
   8.138 +            ElseIf ( LEqual(SLT, 0x04) )
   8.139 +            {
   8.140 +                Notify (\_SB.PCI0.S04, EVT)
   8.141 +            }
   8.142 +            ElseIf ( LEqual(SLT, 0x05) )
   8.143 +            {
   8.144 +                Notify (\_SB.PCI0.S05, EVT)
   8.145 +            }
   8.146 +            ElseIf ( LEqual(SLT, 0x06) )
   8.147 +            {
   8.148 +                Notify (\_SB.PCI0.S06, EVT)
   8.149 +            }
   8.150 +            ElseIf ( LEqual(SLT, 0x07) )
   8.151 +            {
   8.152 +                Notify (\_SB.PCI0.S07, EVT)
   8.153 +            }
   8.154 +            ElseIf ( LEqual(SLT, 0x08) )
   8.155 +            {
   8.156 +                Notify (\_SB.PCI0.S08, EVT)
   8.157 +            }
   8.158 +            ElseIf ( LEqual(SLT, 0x09) )
   8.159 +            {
   8.160 +                Notify (\_SB.PCI0.S09, EVT)
   8.161 +            }
   8.162 +            ElseIf ( LEqual(SLT, 0x0a) )
   8.163 +            {
   8.164 +                Notify (\_SB.PCI0.S0A, EVT)
   8.165 +            }
   8.166 +            ElseIf ( LEqual(SLT, 0x0b) )
   8.167 +            {
   8.168 +                Notify (\_SB.PCI0.S0B, EVT)
   8.169 +            }
   8.170 +            ElseIf ( LEqual(SLT, 0x0c) )
   8.171 +            {
   8.172 +                Notify (\_SB.PCI0.S0C, EVT)
   8.173 +            }
   8.174 +            ElseIf ( LEqual(SLT, 0x0d) )
   8.175 +            {
   8.176 +                Notify (\_SB.PCI0.S0D, EVT)
   8.177 +            }
   8.178 +            ElseIf ( LEqual(SLT, 0x0e) )
   8.179 +            {
   8.180 +                Notify (\_SB.PCI0.S0E, EVT)
   8.181 +            }
   8.182 +            ElseIf ( LEqual(SLT, 0x0f) )
   8.183 +            {
   8.184 +                Notify (\_SB.PCI0.S0F, EVT)
   8.185 +            }
   8.186 +            ElseIf ( LEqual(SLT, 0x10) )
   8.187 +            {
   8.188 +                Notify (\_SB.PCI0.S10, EVT)
   8.189 +            }
   8.190 +            ElseIf ( LEqual(SLT, 0x11) )
   8.191 +            {
   8.192 +                Notify (\_SB.PCI0.S11, EVT)
   8.193 +            }
   8.194 +            ElseIf ( LEqual(SLT, 0x12) )
   8.195 +            {
   8.196 +                Notify (\_SB.PCI0.S12, EVT)
   8.197 +            }
   8.198 +            ElseIf ( LEqual(SLT, 0x13) )
   8.199 +            {
   8.200 +                Notify (\_SB.PCI0.S13, EVT)
   8.201 +            }
   8.202 +            ElseIf ( LEqual(SLT, 0x14) )
   8.203 +            {
   8.204 +                Notify (\_SB.PCI0.S14, EVT)
   8.205 +            }
   8.206 +            ElseIf ( LEqual(SLT, 0x15) )
   8.207 +            {
   8.208 +                Notify (\_SB.PCI0.S15, EVT)
   8.209 +            }
   8.210 +            ElseIf ( LEqual(SLT, 0x16) )
   8.211 +            {
   8.212 +                Notify (\_SB.PCI0.S16, EVT)
   8.213 +            }
   8.214 +            ElseIf ( LEqual(SLT, 0x17) )
   8.215 +            {
   8.216 +                Notify (\_SB.PCI0.S17, EVT)
   8.217 +            }
   8.218 +            ElseIf ( LEqual(SLT, 0x18) )
   8.219 +            {
   8.220 +                Notify (\_SB.PCI0.S18, EVT)
   8.221 +            }
   8.222 +            ElseIf ( LEqual(SLT, 0x19) )
   8.223 +            {
   8.224 +                Notify (\_SB.PCI0.S19, EVT)
   8.225 +            }
   8.226 +            ElseIf ( LEqual(SLT, 0x1a) )
   8.227 +            {
   8.228 +                Notify (\_SB.PCI0.S1A, EVT)
   8.229 +            }
   8.230 +            ElseIf ( LEqual(SLT, 0x1b) )
   8.231 +            {
   8.232 +                Notify (\_SB.PCI0.S1B, EVT)
   8.233 +            }
   8.234 +            ElseIf ( LEqual(SLT, 0x1c) )
   8.235 +            {
   8.236 +                Notify (\_SB.PCI0.S1C, EVT)
   8.237 +            }
   8.238 +            ElseIf ( LEqual(SLT, 0x1d) )
   8.239 +            {
   8.240 +                Notify (\_SB.PCI0.S1D, EVT)
   8.241 +            }
   8.242 +            ElseIf ( LEqual(SLT, 0x1e) )
   8.243 +            {
   8.244 +                Notify (\_SB.PCI0.S1E, EVT)
   8.245 +            }
   8.246 +            ElseIf ( LEqual(SLT, 0x1f) )
   8.247 +            {
   8.248 +                Notify (\_SB.PCI0.S1F, EVT)
   8.249              }
   8.250          }
   8.251      }
     9.1 --- a/tools/firmware/hvmloader/acpi/dsdt.c	Tue Apr 07 11:29:44 2009 +0900
     9.2 +++ b/tools/firmware/hvmloader/acpi/dsdt.c	Tue Apr 07 11:32:24 2009 +0900
     9.3 @@ -1,22 +1,22 @@
     9.4  /*
     9.5   * 
     9.6   * Intel ACPI Component Architecture
     9.7 - * ASL Optimizing Compiler version 20090220 [Mar  9 2009]
     9.8 - * Copyright (C) 2000 - 2009 Intel Corporation
     9.9 + * ASL Optimizing Compiler version 20081204 [Jan 23 2009]
    9.10 + * Copyright (C) 2000 - 2008 Intel Corporation
    9.11   * Supports ACPI Specification Revision 3.0a
    9.12   * 
    9.13 - * Compilation of "dsdt.asl" - Tue Mar 17 10:44:21 2009
    9.14 + * Compilation of "dsdt.asl" - Tue Mar 31 13:24:51 2009
    9.15   * 
    9.16   * C source code output
    9.17   *
    9.18   */
    9.19  unsigned char AmlCode[] =
    9.20  {
    9.21 -    0x44,0x53,0x44,0x54,0x02,0x32,0x00,0x00,  /* 00000000    "DSDT.2.." */
    9.22 -    0x02,0xC6,0x58,0x65,0x6E,0x00,0x00,0x00,  /* 00000008    "..Xen..." */
    9.23 +    0x44,0x53,0x44,0x54,0xF3,0x31,0x00,0x00,  /* 00000000    "DSDT.1.." */
    9.24 +    0x02,0x12,0x58,0x65,0x6E,0x00,0x00,0x00,  /* 00000008    "..Xen..." */
    9.25      0x48,0x56,0x4D,0x00,0x00,0x00,0x00,0x00,  /* 00000010    "HVM....." */
    9.26      0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
    9.27 -    0x20,0x02,0x09,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    " .. .PMB" */
    9.28 +    0x04,0x12,0x08,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    "... .PMB" */
    9.29      0x53,0x0B,0x00,0x0C,0x08,0x50,0x4D,0x4C,  /* 00000028    "S....PML" */
    9.30      0x4E,0x0A,0x08,0x08,0x49,0x4F,0x42,0x31,  /* 00000030    "N...IOB1" */
    9.31      0x00,0x08,0x49,0x4F,0x4C,0x31,0x00,0x08,  /* 00000038    "..IOL1.." */
    9.32 @@ -81,7 +81,7 @@ unsigned char AmlCode[] =
    9.33      0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000210    "._HID.A." */
    9.34      0x0C,0x02,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000218    "..._CRS." */
    9.35      0x15,0x0A,0x12,0x47,0x01,0xC0,0x10,0xC0,  /* 00000220    "...G...." */
    9.36 -    0x10,0x00,0x03,0x47,0x01,0x44,0xB0,0x44,  /* 00000228    "...G.D.D" */
    9.37 +    0x10,0x00,0x22,0x47,0x01,0x44,0xB0,0x44,  /* 00000228    ".."G.D.D" */
    9.38      0xB0,0x00,0x04,0x79,0x00,0x14,0x4E,0x0C,  /* 00000230    "...y..N." */
    9.39      0x5F,0x43,0x52,0x53,0x00,0x08,0x50,0x52,  /* 00000238    "_CRS..PR" */
    9.40      0x54,0x30,0x11,0x42,0x07,0x0A,0x6E,0x88,  /* 00000240    "T0.B..n." */
    9.41 @@ -1446,7 +1446,7 @@ unsigned char AmlCode[] =
    9.42      0x44,0x50,0x54,0x31,0x70,0x0A,0x89,0x5C,  /* 00002CB8    "DPT1p..\" */
    9.43      0x2E,0x5F,0x47,0x50,0x45,0x44,0x50,0x54,  /* 00002CC0    "._GPEDPT" */
    9.44      0x32,0xA4,0x5C,0x2E,0x5F,0x47,0x50,0x45,  /* 00002CC8    "2.\._GPE" */
    9.45 -    0x50,0x48,0x31,0x46,0x10,0x4D,0x52,0x5F,  /* 00002CD0    "PH1F.MR_" */
    9.46 +    0x50,0x48,0x31,0x46,0x10,0x4E,0x51,0x5F,  /* 00002CD0    "PH1F.NQ_" */
    9.47      0x47,0x50,0x45,0x5B,0x80,0x50,0x48,0x50,  /* 00002CD8    "GPE[.PHP" */
    9.48      0x5F,0x01,0x0B,0xC0,0x10,0x0A,0x22,0x5B,  /* 00002CE0    "_....."[" */
    9.49      0x81,0x41,0x0B,0x50,0x48,0x50,0x5F,0x01,  /* 00002CE8    ".A.PHP_." */
    9.50 @@ -1475,143 +1475,141 @@ unsigned char AmlCode[] =
    9.51      0x01,0x0B,0x44,0xB0,0x0A,0x04,0x5B,0x81,  /* 00002DA0    "..D...[." */
    9.52      0x10,0x44,0x47,0x31,0x5F,0x01,0x44,0x50,  /* 00002DA8    ".DG1_.DP" */
    9.53      0x54,0x31,0x08,0x44,0x50,0x54,0x32,0x08,  /* 00002DB0    "T1.DPT2." */
    9.54 -    0x14,0x49,0x44,0x5F,0x4C,0x30,0x33,0x08,  /* 00002DB8    ".ID_L03." */
    9.55 -    0x08,0x5F,0x54,0x5F,0x30,0x00,0x08,0x53,  /* 00002DC0    "._T_0..S" */
    9.56 -    0x4C,0x54,0x5F,0x00,0x08,0x45,0x56,0x54,  /* 00002DC8    "LT_..EVT" */
    9.57 -    0x5F,0x00,0x70,0x50,0x53,0x54,0x41,0x61,  /* 00002DD0    "_.pPSTAa" */
    9.58 -    0x7B,0x61,0x0A,0x0F,0x45,0x56,0x54,0x5F,  /* 00002DD8    "{a..EVT_" */
    9.59 -    0x70,0x50,0x53,0x54,0x42,0x61,0x7B,0x61,  /* 00002DE0    "pPSTBa{a" */
    9.60 -    0x0A,0xFF,0x53,0x4C,0x54,0x5F,0x70,0x53,  /* 00002DE8    "..SLT_pS" */
    9.61 -    0x4C,0x54,0x5F,0x44,0x50,0x54,0x31,0x70,  /* 00002DF0    "LT_DPT1p" */
    9.62 -    0x45,0x56,0x54,0x5F,0x44,0x50,0x54,0x32,  /* 00002DF8    "EVT_DPT2" */
    9.63 -    0x70,0x53,0x4C,0x54,0x5F,0x5F,0x54,0x5F,  /* 00002E00    "pSLT__T_" */
    9.64 -    0x30,0xA0,0x1B,0x93,0x5F,0x54,0x5F,0x30,  /* 00002E08    "0..._T_0" */
    9.65 -    0x00,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002E10    "..\/._SB" */
    9.66 -    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x30,  /* 00002E18    "_PCI0S00" */
    9.67 -    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4C,0x3D,  /* 00002E20    "_EVT_.L=" */
    9.68 -    0xA0,0x1B,0x93,0x5F,0x54,0x5F,0x30,0x01,  /* 00002E28    "..._T_0." */
    9.69 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002E30    ".\/._SB_" */
    9.70 -    0x50,0x43,0x49,0x30,0x53,0x30,0x31,0x5F,  /* 00002E38    "PCI0S01_" */
    9.71 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x3B,0xA0,  /* 00002E40    "EVT_.M;." */
    9.72 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x02,  /* 00002E48    ".._T_0.." */
    9.73 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002E50    ".\/._SB_" */
    9.74 -    0x50,0x43,0x49,0x30,0x53,0x30,0x32,0x5F,  /* 00002E58    "PCI0S02_" */
    9.75 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x39,0xA0,  /* 00002E60    "EVT_.M9." */
    9.76 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x03,  /* 00002E68    ".._T_0.." */
    9.77 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002E70    ".\/._SB_" */
    9.78 -    0x50,0x43,0x49,0x30,0x53,0x30,0x33,0x5F,  /* 00002E78    "PCI0S03_" */
    9.79 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x37,0xA0,  /* 00002E80    "EVT_.M7." */
    9.80 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x04,  /* 00002E88    ".._T_0.." */
    9.81 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002E90    ".\/._SB_" */
    9.82 -    0x50,0x43,0x49,0x30,0x53,0x30,0x34,0x5F,  /* 00002E98    "PCI0S04_" */
    9.83 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x35,0xA0,  /* 00002EA0    "EVT_.M5." */
    9.84 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x05,  /* 00002EA8    ".._T_0.." */
    9.85 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002EB0    ".\/._SB_" */
    9.86 -    0x50,0x43,0x49,0x30,0x53,0x30,0x35,0x5F,  /* 00002EB8    "PCI0S05_" */
    9.87 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x33,0xA0,  /* 00002EC0    "EVT_.M3." */
    9.88 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x06,  /* 00002EC8    ".._T_0.." */
    9.89 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002ED0    ".\/._SB_" */
    9.90 -    0x50,0x43,0x49,0x30,0x53,0x30,0x36,0x5F,  /* 00002ED8    "PCI0S06_" */
    9.91 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x31,0xA0,  /* 00002EE0    "EVT_.M1." */
    9.92 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x07,  /* 00002EE8    ".._T_0.." */
    9.93 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002EF0    ".\/._SB_" */
    9.94 -    0x50,0x43,0x49,0x30,0x53,0x30,0x37,0x5F,  /* 00002EF8    "PCI0S07_" */
    9.95 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x2F,0xA0,  /* 00002F00    "EVT_.M/." */
    9.96 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x08,  /* 00002F08    ".._T_0.." */
    9.97 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002F10    ".\/._SB_" */
    9.98 -    0x50,0x43,0x49,0x30,0x53,0x30,0x38,0x5F,  /* 00002F18    "PCI0S08_" */
    9.99 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x2D,0xA0,  /* 00002F20    "EVT_.M-." */
   9.100 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x09,  /* 00002F28    ".._T_0.." */
   9.101 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002F30    ".\/._SB_" */
   9.102 -    0x50,0x43,0x49,0x30,0x53,0x30,0x39,0x5F,  /* 00002F38    "PCI0S09_" */
   9.103 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x2B,0xA0,  /* 00002F40    "EVT_.M+." */
   9.104 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x0A,  /* 00002F48    ".._T_0.." */
   9.105 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002F50    ".\/._SB_" */
   9.106 -    0x50,0x43,0x49,0x30,0x53,0x30,0x41,0x5F,  /* 00002F58    "PCI0S0A_" */
   9.107 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x29,0xA0,  /* 00002F60    "EVT_.M)." */
   9.108 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x0B,  /* 00002F68    ".._T_0.." */
   9.109 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002F70    ".\/._SB_" */
   9.110 -    0x50,0x43,0x49,0x30,0x53,0x30,0x42,0x5F,  /* 00002F78    "PCI0S0B_" */
   9.111 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x27,0xA0,  /* 00002F80    "EVT_.M'." */
   9.112 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x0C,  /* 00002F88    ".._T_0.." */
   9.113 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002F90    ".\/._SB_" */
   9.114 -    0x50,0x43,0x49,0x30,0x53,0x30,0x43,0x5F,  /* 00002F98    "PCI0S0C_" */
   9.115 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x25,0xA0,  /* 00002FA0    "EVT_.M%." */
   9.116 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x0D,  /* 00002FA8    ".._T_0.." */
   9.117 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002FB0    ".\/._SB_" */
   9.118 -    0x50,0x43,0x49,0x30,0x53,0x30,0x44,0x5F,  /* 00002FB8    "PCI0S0D_" */
   9.119 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x23,0xA0,  /* 00002FC0    "EVT_.M#." */
   9.120 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x0E,  /* 00002FC8    ".._T_0.." */
   9.121 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002FD0    ".\/._SB_" */
   9.122 -    0x50,0x43,0x49,0x30,0x53,0x30,0x45,0x5F,  /* 00002FD8    "PCI0S0E_" */
   9.123 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x21,0xA0,  /* 00002FE0    "EVT_.M!." */
   9.124 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x0F,  /* 00002FE8    ".._T_0.." */
   9.125 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00002FF0    ".\/._SB_" */
   9.126 -    0x50,0x43,0x49,0x30,0x53,0x30,0x46,0x5F,  /* 00002FF8    "PCI0S0F_" */
   9.127 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x1F,0xA0,  /* 00003000    "EVT_.M.." */
   9.128 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x10,  /* 00003008    ".._T_0.." */
   9.129 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003010    ".\/._SB_" */
   9.130 -    0x50,0x43,0x49,0x30,0x53,0x31,0x30,0x5F,  /* 00003018    "PCI0S10_" */
   9.131 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x1D,0xA0,  /* 00003020    "EVT_.M.." */
   9.132 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x11,  /* 00003028    ".._T_0.." */
   9.133 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003030    ".\/._SB_" */
   9.134 -    0x50,0x43,0x49,0x30,0x53,0x31,0x31,0x5F,  /* 00003038    "PCI0S11_" */
   9.135 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x1B,0xA0,  /* 00003040    "EVT_.M.." */
   9.136 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x12,  /* 00003048    ".._T_0.." */
   9.137 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003050    ".\/._SB_" */
   9.138 -    0x50,0x43,0x49,0x30,0x53,0x31,0x32,0x5F,  /* 00003058    "PCI0S12_" */
   9.139 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x19,0xA0,  /* 00003060    "EVT_.M.." */
   9.140 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x13,  /* 00003068    ".._T_0.." */
   9.141 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003070    ".\/._SB_" */
   9.142 -    0x50,0x43,0x49,0x30,0x53,0x31,0x33,0x5F,  /* 00003078    "PCI0S13_" */
   9.143 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x17,0xA0,  /* 00003080    "EVT_.M.." */
   9.144 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x14,  /* 00003088    ".._T_0.." */
   9.145 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003090    ".\/._SB_" */
   9.146 -    0x50,0x43,0x49,0x30,0x53,0x31,0x34,0x5F,  /* 00003098    "PCI0S14_" */
   9.147 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x15,0xA0,  /* 000030A0    "EVT_.M.." */
   9.148 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x15,  /* 000030A8    ".._T_0.." */
   9.149 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 000030B0    ".\/._SB_" */
   9.150 -    0x50,0x43,0x49,0x30,0x53,0x31,0x35,0x5F,  /* 000030B8    "PCI0S15_" */
   9.151 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x13,0xA0,  /* 000030C0    "EVT_.M.." */
   9.152 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x16,  /* 000030C8    ".._T_0.." */
   9.153 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 000030D0    ".\/._SB_" */
   9.154 -    0x50,0x43,0x49,0x30,0x53,0x31,0x36,0x5F,  /* 000030D8    "PCI0S16_" */
   9.155 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x11,0xA0,  /* 000030E0    "EVT_.M.." */
   9.156 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x17,  /* 000030E8    ".._T_0.." */
   9.157 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 000030F0    ".\/._SB_" */
   9.158 -    0x50,0x43,0x49,0x30,0x53,0x31,0x37,0x5F,  /* 000030F8    "PCI0S17_" */
   9.159 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x0F,0xA0,  /* 00003100    "EVT_.M.." */
   9.160 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x18,  /* 00003108    ".._T_0.." */
   9.161 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003110    ".\/._SB_" */
   9.162 -    0x50,0x43,0x49,0x30,0x53,0x31,0x38,0x5F,  /* 00003118    "PCI0S18_" */
   9.163 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x0D,0xA0,  /* 00003120    "EVT_.M.." */
   9.164 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x19,  /* 00003128    ".._T_0.." */
   9.165 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003130    ".\/._SB_" */
   9.166 -    0x50,0x43,0x49,0x30,0x53,0x31,0x39,0x5F,  /* 00003138    "PCI0S19_" */
   9.167 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x0B,0xA0,  /* 00003140    "EVT_.M.." */
   9.168 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x1A,  /* 00003148    ".._T_0.." */
   9.169 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003150    ".\/._SB_" */
   9.170 -    0x50,0x43,0x49,0x30,0x53,0x31,0x41,0x5F,  /* 00003158    "PCI0S1A_" */
   9.171 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x09,0xA0,  /* 00003160    "EVT_.M.." */
   9.172 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x1B,  /* 00003168    ".._T_0.." */
   9.173 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003170    ".\/._SB_" */
   9.174 -    0x50,0x43,0x49,0x30,0x53,0x31,0x42,0x5F,  /* 00003178    "PCI0S1B_" */
   9.175 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x07,0xA0,  /* 00003180    "EVT_.M.." */
   9.176 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x1C,  /* 00003188    ".._T_0.." */
   9.177 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 00003190    ".\/._SB_" */
   9.178 -    0x50,0x43,0x49,0x30,0x53,0x31,0x43,0x5F,  /* 00003198    "PCI0S1C_" */
   9.179 -    0x45,0x56,0x54,0x5F,0xA1,0x4D,0x05,0xA0,  /* 000031A0    "EVT_.M.." */
   9.180 -    0x1C,0x93,0x5F,0x54,0x5F,0x30,0x0A,0x1D,  /* 000031A8    ".._T_0.." */
   9.181 -    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 000031B0    ".\/._SB_" */
   9.182 -    0x50,0x43,0x49,0x30,0x53,0x31,0x44,0x5F,  /* 000031B8    "PCI0S1D_" */
   9.183 -    0x45,0x56,0x54,0x5F,0xA1,0x3D,0xA0,0x1C,  /* 000031C0    "EVT_.=.." */
   9.184 -    0x93,0x5F,0x54,0x5F,0x30,0x0A,0x1E,0x86,  /* 000031C8    "._T_0..." */
   9.185 -    0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,0x50,  /* 000031D0    "\/._SB_P" */
   9.186 -    0x43,0x49,0x30,0x53,0x31,0x45,0x5F,0x45,  /* 000031D8    "CI0S1E_E" */
   9.187 -    0x56,0x54,0x5F,0xA1,0x1E,0xA0,0x1C,0x93,  /* 000031E0    "VT_....." */
   9.188 -    0x5F,0x54,0x5F,0x30,0x0A,0x1F,0x86,0x5C,  /* 000031E8    "_T_0...\" */
   9.189 -    0x2F,0x03,0x5F,0x53,0x42,0x5F,0x50,0x43,  /* 000031F0    "/._SB_PC" */
   9.190 -    0x49,0x30,0x53,0x31,0x46,0x5F,0x45,0x56,  /* 000031F8    "I0S1F_EV" */
   9.191 -    0x54,0x5F,
   9.192 +    0x14,0x4A,0x43,0x5F,0x4C,0x30,0x33,0x08,  /* 00002DB8    ".JC_L03." */
   9.193 +    0x08,0x53,0x4C,0x54,0x5F,0x00,0x08,0x45,  /* 00002DC0    ".SLT_..E" */
   9.194 +    0x56,0x54,0x5F,0x00,0x70,0x50,0x53,0x54,  /* 00002DC8    "VT_.pPST" */
   9.195 +    0x41,0x61,0x7B,0x61,0x0A,0x0F,0x45,0x56,  /* 00002DD0    "Aa{a..EV" */
   9.196 +    0x54,0x5F,0x70,0x50,0x53,0x54,0x42,0x61,  /* 00002DD8    "T_pPSTBa" */
   9.197 +    0x7B,0x61,0x0A,0xFF,0x53,0x4C,0x54,0x5F,  /* 00002DE0    "{a..SLT_" */
   9.198 +    0x70,0x53,0x4C,0x54,0x5F,0x44,0x50,0x54,  /* 00002DE8    "pSLT_DPT" */
   9.199 +    0x31,0x70,0x45,0x56,0x54,0x5F,0x44,0x50,  /* 00002DF0    "1pEVT_DP" */
   9.200 +    0x54,0x32,0xA0,0x1B,0x93,0x53,0x4C,0x54,  /* 00002DF8    "T2...SLT" */
   9.201 +    0x5F,0x00,0x86,0x5C,0x2F,0x03,0x5F,0x53,  /* 00002E00    "_..\/._S" */
   9.202 +    0x42,0x5F,0x50,0x43,0x49,0x30,0x53,0x30,  /* 00002E08    "B_PCI0S0" */
   9.203 +    0x30,0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4C,  /* 00002E10    "0_EVT_.L" */
   9.204 +    0x3D,0xA0,0x1B,0x93,0x53,0x4C,0x54,0x5F,  /* 00002E18    "=...SLT_" */
   9.205 +    0x01,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002E20    "..\/._SB" */
   9.206 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x31,  /* 00002E28    "_PCI0S01" */
   9.207 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x3B,  /* 00002E30    "_EVT_.M;" */
   9.208 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002E38    "...SLT_." */
   9.209 +    0x02,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002E40    "..\/._SB" */
   9.210 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x32,  /* 00002E48    "_PCI0S02" */
   9.211 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x39,  /* 00002E50    "_EVT_.M9" */
   9.212 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002E58    "...SLT_." */
   9.213 +    0x03,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002E60    "..\/._SB" */
   9.214 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x33,  /* 00002E68    "_PCI0S03" */
   9.215 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x37,  /* 00002E70    "_EVT_.M7" */
   9.216 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002E78    "...SLT_." */
   9.217 +    0x04,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002E80    "..\/._SB" */
   9.218 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x34,  /* 00002E88    "_PCI0S04" */
   9.219 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x35,  /* 00002E90    "_EVT_.M5" */
   9.220 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002E98    "...SLT_." */
   9.221 +    0x05,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002EA0    "..\/._SB" */
   9.222 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x35,  /* 00002EA8    "_PCI0S05" */
   9.223 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x33,  /* 00002EB0    "_EVT_.M3" */
   9.224 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002EB8    "...SLT_." */
   9.225 +    0x06,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002EC0    "..\/._SB" */
   9.226 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x36,  /* 00002EC8    "_PCI0S06" */
   9.227 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x31,  /* 00002ED0    "_EVT_.M1" */
   9.228 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002ED8    "...SLT_." */
   9.229 +    0x07,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002EE0    "..\/._SB" */
   9.230 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x37,  /* 00002EE8    "_PCI0S07" */
   9.231 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x2F,  /* 00002EF0    "_EVT_.M/" */
   9.232 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002EF8    "...SLT_." */
   9.233 +    0x08,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002F00    "..\/._SB" */
   9.234 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x38,  /* 00002F08    "_PCI0S08" */
   9.235 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x2D,  /* 00002F10    "_EVT_.M-" */
   9.236 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002F18    "...SLT_." */
   9.237 +    0x09,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002F20    "..\/._SB" */
   9.238 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x39,  /* 00002F28    "_PCI0S09" */
   9.239 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x2B,  /* 00002F30    "_EVT_.M+" */
   9.240 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002F38    "...SLT_." */
   9.241 +    0x0A,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002F40    "..\/._SB" */
   9.242 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x41,  /* 00002F48    "_PCI0S0A" */
   9.243 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x29,  /* 00002F50    "_EVT_.M)" */
   9.244 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002F58    "...SLT_." */
   9.245 +    0x0B,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002F60    "..\/._SB" */
   9.246 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x42,  /* 00002F68    "_PCI0S0B" */
   9.247 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x27,  /* 00002F70    "_EVT_.M'" */
   9.248 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002F78    "...SLT_." */
   9.249 +    0x0C,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002F80    "..\/._SB" */
   9.250 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x43,  /* 00002F88    "_PCI0S0C" */
   9.251 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x25,  /* 00002F90    "_EVT_.M%" */
   9.252 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002F98    "...SLT_." */
   9.253 +    0x0D,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002FA0    "..\/._SB" */
   9.254 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x44,  /* 00002FA8    "_PCI0S0D" */
   9.255 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x23,  /* 00002FB0    "_EVT_.M#" */
   9.256 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002FB8    "...SLT_." */
   9.257 +    0x0E,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002FC0    "..\/._SB" */
   9.258 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x45,  /* 00002FC8    "_PCI0S0E" */
   9.259 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x21,  /* 00002FD0    "_EVT_.M!" */
   9.260 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002FD8    "...SLT_." */
   9.261 +    0x0F,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00002FE0    "..\/._SB" */
   9.262 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x30,0x46,  /* 00002FE8    "_PCI0S0F" */
   9.263 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x1F,  /* 00002FF0    "_EVT_.M." */
   9.264 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00002FF8    "...SLT_." */
   9.265 +    0x10,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003000    "..\/._SB" */
   9.266 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x30,  /* 00003008    "_PCI0S10" */
   9.267 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x1D,  /* 00003010    "_EVT_.M." */
   9.268 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003018    "...SLT_." */
   9.269 +    0x11,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003020    "..\/._SB" */
   9.270 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x31,  /* 00003028    "_PCI0S11" */
   9.271 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x1B,  /* 00003030    "_EVT_.M." */
   9.272 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003038    "...SLT_." */
   9.273 +    0x12,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003040    "..\/._SB" */
   9.274 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x32,  /* 00003048    "_PCI0S12" */
   9.275 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x19,  /* 00003050    "_EVT_.M." */
   9.276 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003058    "...SLT_." */
   9.277 +    0x13,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003060    "..\/._SB" */
   9.278 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x33,  /* 00003068    "_PCI0S13" */
   9.279 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x17,  /* 00003070    "_EVT_.M." */
   9.280 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003078    "...SLT_." */
   9.281 +    0x14,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003080    "..\/._SB" */
   9.282 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x34,  /* 00003088    "_PCI0S14" */
   9.283 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x15,  /* 00003090    "_EVT_.M." */
   9.284 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003098    "...SLT_." */
   9.285 +    0x15,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 000030A0    "..\/._SB" */
   9.286 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x35,  /* 000030A8    "_PCI0S15" */
   9.287 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x13,  /* 000030B0    "_EVT_.M." */
   9.288 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 000030B8    "...SLT_." */
   9.289 +    0x16,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 000030C0    "..\/._SB" */
   9.290 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x36,  /* 000030C8    "_PCI0S16" */
   9.291 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x11,  /* 000030D0    "_EVT_.M." */
   9.292 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 000030D8    "...SLT_." */
   9.293 +    0x17,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 000030E0    "..\/._SB" */
   9.294 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x37,  /* 000030E8    "_PCI0S17" */
   9.295 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x0F,  /* 000030F0    "_EVT_.M." */
   9.296 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 000030F8    "...SLT_." */
   9.297 +    0x18,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003100    "..\/._SB" */
   9.298 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x38,  /* 00003108    "_PCI0S18" */
   9.299 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x0D,  /* 00003110    "_EVT_.M." */
   9.300 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003118    "...SLT_." */
   9.301 +    0x19,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003120    "..\/._SB" */
   9.302 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x39,  /* 00003128    "_PCI0S19" */
   9.303 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x0B,  /* 00003130    "_EVT_.M." */
   9.304 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003138    "...SLT_." */
   9.305 +    0x1A,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003140    "..\/._SB" */
   9.306 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x41,  /* 00003148    "_PCI0S1A" */
   9.307 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x09,  /* 00003150    "_EVT_.M." */
   9.308 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003158    "...SLT_." */
   9.309 +    0x1B,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003160    "..\/._SB" */
   9.310 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x42,  /* 00003168    "_PCI0S1B" */
   9.311 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x07,  /* 00003170    "_EVT_.M." */
   9.312 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003178    "...SLT_." */
   9.313 +    0x1C,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 00003180    "..\/._SB" */
   9.314 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x43,  /* 00003188    "_PCI0S1C" */
   9.315 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x4D,0x05,  /* 00003190    "_EVT_.M." */
   9.316 +    0xA0,0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,  /* 00003198    "...SLT_." */
   9.317 +    0x1D,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,  /* 000031A0    "..\/._SB" */
   9.318 +    0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x44,  /* 000031A8    "_PCI0S1D" */
   9.319 +    0x5F,0x45,0x56,0x54,0x5F,0xA1,0x3D,0xA0,  /* 000031B0    "_EVT_.=." */
   9.320 +    0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,0x1E,  /* 000031B8    "..SLT_.." */
   9.321 +    0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,  /* 000031C0    ".\/._SB_" */
   9.322 +    0x50,0x43,0x49,0x30,0x53,0x31,0x45,0x5F,  /* 000031C8    "PCI0S1E_" */
   9.323 +    0x45,0x56,0x54,0x5F,0xA1,0x1E,0xA0,0x1C,  /* 000031D0    "EVT_...." */
   9.324 +    0x93,0x53,0x4C,0x54,0x5F,0x0A,0x1F,0x86,  /* 000031D8    ".SLT_..." */
   9.325 +    0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,0x50,  /* 000031E0    "\/._SB_P" */
   9.326 +    0x43,0x49,0x30,0x53,0x31,0x46,0x5F,0x45,  /* 000031E8    "CI0S1F_E" */
   9.327 +    0x56,0x54,0x5F,
   9.328  };
   9.329  int DsdtLen=sizeof(AmlCode);
    10.1 --- a/tools/firmware/hvmloader/acpi/static_tables.c	Tue Apr 07 11:29:44 2009 +0900
    10.2 +++ b/tools/firmware/hvmloader/acpi/static_tables.c	Tue Apr 07 11:32:24 2009 +0900
    10.3 @@ -69,7 +69,7 @@ struct acpi_20_fadt Fadt = {
    10.4      .p_lvl3_lat = 0x0fff, /* >1000, means we do not support C3 state */
    10.5      .iapc_boot_arch = ACPI_8042,
    10.6      .flags = (ACPI_PROC_C1 | ACPI_SLP_BUTTON |
    10.7 -              ACPI_WBINVD | ACPI_PWR_BUTTON |
    10.8 +              ACPI_WBINVD |
    10.9                ACPI_FIX_RTC | ACPI_TMR_VAL_EXT),
   10.10  
   10.11      .reset_reg = {
    11.1 --- a/tools/firmware/hvmloader/hvmloader.c	Tue Apr 07 11:29:44 2009 +0900
    11.2 +++ b/tools/firmware/hvmloader/hvmloader.c	Tue Apr 07 11:32:24 2009 +0900
    11.3 @@ -88,8 +88,8 @@ asm (
    11.4      "    .align 8                    \n"
    11.5      "gdt:                            \n"
    11.6      "    .quad 0x0000000000000000    \n"
    11.7 -    "    .quad 0x00009a000000ffff    \n" /* Ring 0 code, base 0 limit 0xffff */
    11.8 -    "    .quad 0x000092000000ffff    \n" /* Ring 0 data, base 0 limit 0xffff */
    11.9 +    "    .quad 0x008f9a000000ffff    \n" /* Ring 0 16b code, base 0 limit 4G */
   11.10 +    "    .quad 0x008f92000000ffff    \n" /* Ring 0 16b data, base 0 limit 4G */
   11.11      "gdt_end:                        \n"
   11.12      "                                \n"
   11.13      "    .bss                        \n"
    12.1 --- a/tools/firmware/rombios/32bitgateway.c	Tue Apr 07 11:29:44 2009 +0900
    12.2 +++ b/tools/firmware/rombios/32bitgateway.c	Tue Apr 07 11:32:24 2009 +0900
    12.3 @@ -56,13 +56,13 @@ gdt_entry_pm_32bit_cs:
    12.4      .byte 0x00, 0x9b, 0xcf, 0x00
    12.5  gdt_entry_pm_16bit_cs:
    12.6      .word 0xffff, 0x0000
    12.7 -    .byte REAL_MODE_CODE_OFFSET >> 16, 0x9b, 0x0, 0x0
    12.8 +    .byte REAL_MODE_CODE_OFFSET >> 16, 0x9b, 0x8f, 0x0
    12.9  gdt_entry_pm_32bit_ds:
   12.10      .word 0xffff, 0x0000
   12.11      .byte 0x0, 0x93, 0xcf, 0x0
   12.12  gdt_entry_pm_16bit_ds:
   12.13      .word 0xffff, 0x0000
   12.14 -    .byte 0x0, 0x93, 0x0, 0x0
   12.15 +    .byte 0x0, 0x93, 0x8f, 0x0
   12.16  gdt_entry_end:
   12.17  
   12.18  protmode_gdtdesc:
    13.1 --- a/tools/hotplug/Linux/network-bridge	Tue Apr 07 11:29:44 2009 +0900
    13.2 +++ b/tools/hotplug/Linux/network-bridge	Tue Apr 07 11:32:24 2009 +0900
    13.3 @@ -106,7 +106,7 @@ get_ip_info() {
    13.4  }
    13.5      
    13.6  do_ifup() {
    13.7 -    if ! ifup $1 ; then
    13.8 +    if [ $1 != "${netdev}" ] || ! ifup $1 ; then
    13.9          if [ -n "$addr_pfx" ] ; then
   13.10              # use the info from get_ip_info()
   13.11              ip addr flush $1
   13.12 @@ -223,9 +223,9 @@ op_start () {
   13.13  
   13.14      preiftransfer ${netdev}
   13.15      transfer_addrs ${netdev} ${tdev}
   13.16 +    # Remember the IP details for do_ifup.
   13.17 +    get_ip_info ${netdev}
   13.18      if ! ifdown ${netdev}; then
   13.19 -	# If ifdown fails, remember the IP details.
   13.20 -	get_ip_info ${netdev}
   13.21  	ip link set ${netdev} down
   13.22  	ip addr flush ${netdev}
   13.23      fi
    14.1 --- a/tools/hotplug/Linux/xend.rules	Tue Apr 07 11:29:44 2009 +0900
    14.2 +++ b/tools/hotplug/Linux/xend.rules	Tue Apr 07 11:32:24 2009 +0900
    14.3 @@ -1,3 +1,3 @@
    14.4  SUBSYSTEM=="pci", RUN+="socket:/org/xen/xend/udev_event"
    14.5 -#SUBSYSTEM=="scsi", RUN+="socket:/org/xen/xend/udev_event"
    14.6 +SUBSYSTEM=="scsi", RUN+="socket:/org/xen/xend/udev_event"
    14.7  #SUBSYSTEM=="net", KERNEL!="vif[0-9]*.[0-9]*|tap[0-9]*.[0-9]*", RUN+="socket:/org/xen/xend/udev_event"
    15.1 --- a/tools/libxc/xc_pagetab.c	Tue Apr 07 11:29:44 2009 +0900
    15.2 +++ b/tools/libxc/xc_pagetab.c	Tue Apr 07 11:32:24 2009 +0900
    15.3 @@ -32,7 +32,7 @@ unsigned long xc_translate_foreign_addre
    15.4                                               &ctx, sizeof ctx) != 0)
    15.5              return 0;
    15.6          if (!(ctx.cr0 & CR0_PG))
    15.7 -            return virt;
    15.8 +            return virt >> PAGE_SHIFT;
    15.9          pt_levels = (ctx.msr_efer&EFER_LMA) ? 4 : (ctx.cr4&CR4_PAE) ? 3 : 2;
   15.10          paddr = ctx.cr3 & ((pt_levels == 3) ? ~0x1full : ~0xfffull);
   15.11      } else {
    16.1 --- a/tools/libxc/xc_pm.c	Tue Apr 07 11:29:44 2009 +0900
    16.2 +++ b/tools/libxc/xc_pm.c	Tue Apr 07 11:32:24 2009 +0900
    16.3 @@ -362,3 +362,66 @@ int xc_set_sched_opt_smt(int xc_handle, 
    16.4     return rc;
    16.5  }
    16.6  
    16.7 +int xc_set_vcpu_migration_delay(int xc_handle, uint32_t value)
    16.8 +{
    16.9 +   int rc;
   16.10 +   DECLARE_SYSCTL;
   16.11 +
   16.12 +   sysctl.cmd = XEN_SYSCTL_pm_op;
   16.13 +   sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_set_vcpu_migration_delay;
   16.14 +   sysctl.u.pm_op.cpuid = 0;
   16.15 +   sysctl.u.pm_op.set_vcpu_migration_delay = value;
   16.16 +   rc = do_sysctl(xc_handle, &sysctl);
   16.17 +
   16.18 +   return rc;
   16.19 +}
   16.20 +
   16.21 +int xc_get_vcpu_migration_delay(int xc_handle, uint32_t *value)
   16.22 +{
   16.23 +   int rc;
   16.24 +   DECLARE_SYSCTL;
   16.25 +
   16.26 +   sysctl.cmd = XEN_SYSCTL_pm_op;
   16.27 +   sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_get_vcpu_migration_delay;
   16.28 +   sysctl.u.pm_op.cpuid = 0;
   16.29 +   rc = do_sysctl(xc_handle, &sysctl);
   16.30 +
   16.31 +   if (!rc && value)
   16.32 +       *value = sysctl.u.pm_op.get_vcpu_migration_delay;
   16.33 +
   16.34 +   return rc;
   16.35 +}
   16.36 +
   16.37 +int xc_get_cpuidle_max_cstate(int xc_handle, uint32_t *value)
   16.38 +{
   16.39 +    int rc;
   16.40 +    DECLARE_SYSCTL;
   16.41 +
   16.42 +    if ( xc_handle < 0 || !value )
   16.43 +        return -EINVAL;
   16.44 +
   16.45 +    sysctl.cmd = XEN_SYSCTL_pm_op;
   16.46 +    sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_get_max_cstate;
   16.47 +    sysctl.u.pm_op.cpuid = 0;
   16.48 +    sysctl.u.pm_op.get_max_cstate = 0;
   16.49 +    rc = do_sysctl(xc_handle, &sysctl);
   16.50 +    *value = sysctl.u.pm_op.get_max_cstate;
   16.51 +
   16.52 +    return rc;
   16.53 +}
   16.54 +
   16.55 +int xc_set_cpuidle_max_cstate(int xc_handle, uint32_t value)
   16.56 +{
   16.57 +    DECLARE_SYSCTL;
   16.58 +
   16.59 +    if ( xc_handle < 0 )
   16.60 +        return -EINVAL;
   16.61 +
   16.62 +    sysctl.cmd = XEN_SYSCTL_pm_op;
   16.63 +    sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_set_max_cstate;
   16.64 +    sysctl.u.pm_op.cpuid = 0;
   16.65 +    sysctl.u.pm_op.set_max_cstate = value;
   16.66 +
   16.67 +    return do_sysctl(xc_handle, &sysctl);
   16.68 +}
   16.69 +
    17.1 --- a/tools/libxc/xenctrl.h	Tue Apr 07 11:29:44 2009 +0900
    17.2 +++ b/tools/libxc/xenctrl.h	Tue Apr 07 11:32:24 2009 +0900
    17.3 @@ -1261,5 +1261,10 @@ struct xc_get_cputopo {
    17.4  int xc_get_cputopo(int xc_handle, struct xc_get_cputopo *info);
    17.5  
    17.6  int xc_set_sched_opt_smt(int xc_handle, uint32_t value);
    17.7 +int xc_set_vcpu_migration_delay(int xc_handle, uint32_t value);
    17.8 +int xc_get_vcpu_migration_delay(int xc_handle, uint32_t *value);
    17.9 +
   17.10 +int xc_get_cpuidle_max_cstate(int xc_handle, uint32_t *value);
   17.11 +int xc_set_cpuidle_max_cstate(int xc_handle, uint32_t value);
   17.12  
   17.13  #endif /* XENCTRL_H */
    18.1 --- a/tools/misc/Makefile	Tue Apr 07 11:29:44 2009 +0900
    18.2 +++ b/tools/misc/Makefile	Tue Apr 07 11:32:24 2009 +0900
    18.3 @@ -22,7 +22,7 @@ INSTALL_BIN-y := xencons
    18.4  INSTALL_BIN-$(CONFIG_X86) += xen-detect
    18.5  INSTALL_BIN := $(INSTALL_BIN-y)
    18.6  
    18.7 -INSTALL_SBIN-y := netfix xm xen-bugtool xen-python-path xend xenperf xsview xenpm
    18.8 +INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm
    18.9  INSTALL_SBIN := $(INSTALL_SBIN-y)
   18.10  
   18.11  DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
    19.1 --- a/tools/misc/fakei386xen	Tue Apr 07 11:29:44 2009 +0900
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,32 +0,0 @@
    19.4 -#!/bin/bash
    19.5 -
    19.6 -cln () {
    19.7 -while [ $# -gt 0 ]; do
    19.8 -  (
    19.9 -    test -f "$1" || { echo "$1: No such file or directory" 1>&2; exit 1; }
   19.10 -    { cp $1 cln$$ && rm $1 && mv cln$$ $1; } || { rm -f cln$$; exit 1; }
   19.11 -  )
   19.12 -  shift
   19.13 -done
   19.14 -}
   19.15 -
   19.16 -
   19.17 -for i in `find include/asm-xen arch/xen -type l | xargs ls -l | egrep '../(asm-)?i386/' | awk '{print $9}'`
   19.18 -do
   19.19 -  echo $i
   19.20 -  cln $i
   19.21 -done
   19.22 -
   19.23 -mv include/asm-i386 include/asm-Xi386
   19.24 -mv include/asm-xen include/asm-i386
   19.25 -ln -s asm-i386 include/asm-xen
   19.26 -rm include/asm
   19.27 -ln -s asm-i386 include/asm
   19.28 -mv arch/i386 arch/Xi386
   19.29 -mv arch/xen arch/i386
   19.30 -ln -s i386 arch/xen
   19.31 -
   19.32 -mv Makefile XMakefile
   19.33 -#sed -e 's/^EXTRAVERSION =.*/EXTRAVERSION = -xen/' <XMakefile >Makefile
   19.34 -echo ARCH=i386 >Makefile ; cat XMakefile >>Makefile
   19.35 -
    20.1 --- a/tools/misc/netfix	Tue Apr 07 11:29:44 2009 +0900
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,69 +0,0 @@
    20.4 -#!/usr/bin/env python
    20.5 -#  -*- mode: python; -*-
    20.6 -#============================================================================
    20.7 -# Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
    20.8 -#============================================================================
    20.9 -# Move the IP address from eth0 onto the Xen bridge (xenbr0).
   20.10 -# Only works if the bridge control utils (brctl) have been installed.
   20.11 -#============================================================================
   20.12 -
   20.13 -from getopt import getopt
   20.14 -
   20.15 -# add fallback path for non-native python path installs if needed
   20.16 -sys.path.append('/usr/lib/python')
   20.17 -sys.path.append('/usr/lib64/python')
   20.18 -from xen.util.Brctl import *
   20.19 -
   20.20 -short_options = 'hvqni:b:c'
   20.21 -long_options  = ['help', 'verbose', 'quiet',
   20.22 -                 'interface=', 'bridge=', 'create']
   20.23 -
   20.24 -defaults['interface'] = 'eth0'
   20.25 -defaults['bridge'] = 'xenbr0'
   20.26 -
   20.27 -def usage():
   20.28 -    print """Usage:
   20.29 -    %s [options]
   20.30 -
   20.31 -    Reconfigure routing so that <bridge> has the IP address from
   20.32 -    <interface>. This lets IP carry on working when <interface>
   20.33 -    is attached to <bridge> for virtual networking.
   20.34 -    Uses brctl to add <interface> to <bridge>,
   20.35 -    so this can be run before any domains have been created.
   20.36 -    """ % sys.argv[0]
   20.37 -    print """
   20.38 -    -i, --interface <interface>    interface, default %(interface)s.
   20.39 -    -b, --bridge <bridge>          bridge, default %(bridge)s.
   20.40 -    -c, --create                   create the bridge.
   20.41 -    -v, --verbose                  Print commands.
   20.42 -    -q, --quiet                    Don't print commands.
   20.43 -    -n, --dry-run                  Don't execute commands.
   20.44 -    -h, --help                     Print this help.
   20.45 -    """ % defaults
   20.46 -    sys.exit(1)
   20.47 -
   20.48 -
   20.49 -def main():
   20.50 -    lopts = set_opts(Opts(defaults))
   20.51 -    lopts.dryrun = 0
   20.52 -    (options, args) = getopt(sys.argv[1:], short_options, long_options)
   20.53 -    if args: usage()
   20.54 -    for k, v in options:
   20.55 -        if k in ['-h', '--help']:
   20.56 -            usage()
   20.57 -        elif k in ['-c', '--create']:
   20.58 -            lopts.create = 1
   20.59 -        elif k in ['-i', '--interface']:
   20.60 -            lopts.interface = v
   20.61 -        elif k in ['-b', '--bridge']:
   20.62 -            lopts.bridge = v
   20.63 -        elif k in ['-q', '--quiet']:
   20.64 -            lopts.verbose = 0
   20.65 -        elif k in ['-v', '--verbose']:
   20.66 -            lopts.verbose = 1
   20.67 -        elif k in ['-n', '--dry-run']:
   20.68 -            lopts.dryrun = 1
   20.69 -    reconfigure(lopts.interface, lopts.bridge)
   20.70 -
   20.71 -if __name__ == '__main__':
   20.72 -    main()
    21.1 --- a/tools/misc/xen-clone.README	Tue Apr 07 11:29:44 2009 +0900
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,23 +0,0 @@
    21.4 -
    21.5 -xen-clone
    21.6 -
    21.7 -usage: xen-clone <bk_repository> <dest_dir> <orig_linux_dir>
    21.8 -
    21.9 -This script can be used to 'bk clone' and build a xen and xenolinux image 
   21.10 -from the master BK repository, either from a local copy, or from the
   21.11 -public repository bk://xen.bkbits.net/xeno.bk
   21.12 -
   21.13 -In many circumstances, it can be invoked without any arguments and
   21.14 -just `does the right thing'.
   21.15 -
   21.16 -The default dest_dir is 'xeno-clone', relative to the current directory.
   21.17 -
   21.18 -To build xenolinux, the script needs a pristine copy of the equivalent 
   21.19 -linux tree. The script looks in a couple of places on the local filesystem, 
   21.20 -then tries a download from from ftp://ftp.kernel.org/pub/linux/kernel/v2.4/
   21.21 -
   21.22 -The script also tries a number of optional UCCL site-specific operations
   21.23 -that configure the test machine booting infrastructure to boot the 
   21.24 -resultant image.
   21.25 -
   21.26 -
    22.1 --- a/tools/misc/xenpm.c	Tue Apr 07 11:29:44 2009 +0900
    22.2 +++ b/tools/misc/xenpm.c	Tue Apr 07 11:32:24 2009 +0900
    22.3 @@ -57,6 +57,9 @@ void show_help(void)
    22.4              "                                     it is used in ondemand governor.\n"
    22.5              " get-cpu-topology                    get thread/core/socket topology info\n"
    22.6              " set-sched-smt           enable|disable enable/disable scheduler smt power saving\n"
    22.7 +            " set-vcpu-migration-delay      <num> set scheduler vcpu migration delay in us\n"
    22.8 +            " get-vcpu-migration-delay            get scheduler vcpu migration delay\n"
    22.9 +            " set-max-cstate        <num>         set the C-State limitation (<num> >= 0)\n"
   22.10              " start [seconds]                     start collect Cx/Px statistics,\n"
   22.11              "                                     output after CTRL-C or SIGINT or several seconds.\n"
   22.12              );
   22.13 @@ -122,6 +125,18 @@ static int get_cxstat_by_cpuid(int xc_fd
   22.14      return 0;
   22.15  }
   22.16  
   22.17 +static int show_max_cstate(int xc_fd)
   22.18 +{
   22.19 +    int ret = 0;
   22.20 +    uint32_t value;
   22.21 +
   22.22 +    if ( (ret = xc_get_cpuidle_max_cstate(xc_fd, &value)) )
   22.23 +        return ret;
   22.24 +
   22.25 +    printf("Max C-state: C%d\n\n", value);
   22.26 +    return 0;
   22.27 +}
   22.28 +
   22.29  static int show_cxstat_by_cpuid(int xc_fd, int cpuid)
   22.30  {
   22.31      int ret = 0;
   22.32 @@ -148,6 +163,8 @@ void cxstat_func(int argc, char *argv[])
   22.33      if ( cpuid >= max_cpu_nr )
   22.34          cpuid = -1;
   22.35  
   22.36 +    show_max_cstate(xc_fd);
   22.37 +
   22.38      if ( cpuid < 0 )
   22.39      {
   22.40          /* show cxstates on all cpus */
   22.41 @@ -864,7 +881,72 @@ void set_sched_smt_func(int argc, char *
   22.42  
   22.43      rc = xc_set_sched_opt_smt(xc_fd, value);
   22.44      printf("%s sched_smt_power_savings %s\n", argv[0],
   22.45 -                    rc? "failed":"successeed" );
   22.46 +                    rc? "failed":"succeeded" );
   22.47 +
   22.48 +    return;
   22.49 +}
   22.50 +
   22.51 +void set_vcpu_migration_delay_func(int argc, char *argv[])
   22.52 +{
   22.53 +    int value;
   22.54 +    int rc;
   22.55 +
   22.56 +    if (argc != 1){
   22.57 +        show_help();
   22.58 +        exit(-1);
   22.59 +    }
   22.60 +
   22.61 +    value = atoi(argv[0]);
   22.62 +
   22.63 +    if (value < 0)
   22.64 +    {
   22.65 +        printf("Please try non-negative vcpu migration delay\n");
   22.66 +        exit(-1);
   22.67 +    }
   22.68 +
   22.69 +    rc = xc_set_vcpu_migration_delay(xc_fd, value);
   22.70 +    printf("%s to set vcpu migration delay to %d us\n",
   22.71 +                    rc? "Fail":"Succeed", value );
   22.72 +
   22.73 +    return;
   22.74 +}
   22.75 +
   22.76 +void get_vcpu_migration_delay_func(int argc, char *argv[])
   22.77 +{
   22.78 +    uint32_t value;
   22.79 +    int rc;
   22.80 +
   22.81 +    if (argc != 0){
   22.82 +        show_help();
   22.83 +        exit(-1);
   22.84 +    }
   22.85 +
   22.86 +    rc = xc_get_vcpu_migration_delay(xc_fd, &value);
   22.87 +    if (!rc)
   22.88 +    {
   22.89 +        printf("Schduler vcpu migration delay is %d us\n", value);
   22.90 +    }
   22.91 +    else
   22.92 +    {
   22.93 +        printf("Failed to get scheduler vcpu migration delay, errno=%d\n", errno);
   22.94 +    }
   22.95 +
   22.96 +    return;
   22.97 +}
   22.98 +
   22.99 +void set_max_cstate_func(int argc, char *argv[])
  22.100 +{
  22.101 +    int value, rc;
  22.102 +
  22.103 +    if ( argc != 1 || sscanf(argv[0], "%d", &value) != 1 || value < 0 )
  22.104 +    {
  22.105 +        show_help();
  22.106 +        exit(-1);
  22.107 +    }
  22.108 +
  22.109 +    rc = xc_set_cpuidle_max_cstate(xc_fd, (uint32_t)value);
  22.110 +    printf("set max_cstate to C%d %s\n", value,
  22.111 +                    rc? "failed":"succeeded" );
  22.112  
  22.113      return;
  22.114  }
  22.115 @@ -886,6 +968,9 @@ struct {
  22.116      { "set-up-threshold", scaling_up_threshold_func },
  22.117      { "get-cpu-topology", cpu_topology_func},
  22.118      { "set-sched-smt", set_sched_smt_func},
  22.119 +    { "get-vcpu-migration-delay", get_vcpu_migration_delay_func},
  22.120 +    { "set-vcpu-migration-delay", set_vcpu_migration_delay_func},
  22.121 +    { "set-max-cstate", set_max_cstate_func},
  22.122  };
  22.123  
  22.124  int main(int argc, char *argv[])
    23.1 --- a/tools/pygrub/Makefile	Tue Apr 07 11:29:44 2009 +0900
    23.2 +++ b/tools/pygrub/Makefile	Tue Apr 07 11:32:24 2009 +0900
    23.3 @@ -12,7 +12,7 @@ build:
    23.4  ifndef XEN_PYTHON_NATIVE_INSTALL
    23.5  install: LIBPATH=$(shell PYTHONPATH=../python/xen/util python -c "import auxbin; print auxbin.libpath()")
    23.6  install: all
    23.7 -	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" --install-lib="$(DESTDIR)$(LIBPATH)/python"
    23.8 +	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)$(PREFIX)" --prefix="" --install-lib="$(DESTDIR)$(LIBDIR)/python"
    23.9  	$(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot
   23.10  else
   23.11  install: all
    24.1 --- a/tools/pygrub/src/pygrub	Tue Apr 07 11:29:44 2009 +0900
    24.2 +++ b/tools/pygrub/src/pygrub	Tue Apr 07 11:32:24 2009 +0900
    24.3 @@ -316,7 +316,11 @@ class Grub:
    24.4                  curline = len(img.lines) - 1
    24.5  
    24.6          if self.isdone:
    24.7 -            origimg.reset(img.lines)
    24.8 +           # Fix to allow pygrub command-line editing in Lilo bootloader (used by IA64)
    24.9 +           if platform.machine() == 'ia64':
   24.10 +              origimg.reset(img.lines, img.path)
   24.11 +           else:
   24.12 +              origimg.reset(img.lines)
   24.13  
   24.14      def edit_line(self, line):
   24.15          self.screen.erase()
   24.16 @@ -532,7 +536,7 @@ def run_grub(file, entry, fs, arg):
   24.17  
   24.18      try:
   24.19          img = g.cf.images[sel]
   24.20 -    except:
   24.21 +    except IndexError:
   24.22          log.debug("PyGrub: Default selection is not valid, using first boot configuration...")
   24.23          img = g.cf.images[0]
   24.24  
    25.1 --- a/tools/python/Makefile	Tue Apr 07 11:29:44 2009 +0900
    25.2 +++ b/tools/python/Makefile	Tue Apr 07 11:32:24 2009 +0900
    25.3 @@ -12,7 +12,7 @@ PODIR := xen/xm/messages
    25.4  POTFILE := $(PODIR)/xen-xm.pot
    25.5  I18NSRCFILES = $(shell find xen/xm/ -name '*.py')
    25.6  CATALOGS = $(patsubst %,xen/xm/messages/%.mo,$(LINGUAS))
    25.7 -NLSDIR = /usr/share/locale
    25.8 +NLSDIR = $(SHAREDIR)/locale
    25.9  
   25.10  .PHONY: build buildpy
   25.11  buildpy: 
   25.12 @@ -57,19 +57,19 @@ refresh-po: $(POTFILE)
   25.13  ifndef XEN_PYTHON_NATIVE_INSTALL
   25.14  install: LIBPATH=$(shell PYTHONPATH=xen/util python -c "import auxbin; print auxbin.libpath()")
   25.15  install: install-messages install-dtd
   25.16 -	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" --force --install-lib="$(DESTDIR)$(LIBPATH)/python"
   25.17 +	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)$(PREFIX)" --prefix="" --force --install-lib="$(DESTDIR)$(LIBDIR)/python"
   25.18  else
   25.19  install: install-messages install-dtd
   25.20  	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" --force
   25.21  endif
   25.22  
   25.23  install-dtd: all
   25.24 -	$(INSTALL_DIR) $(DESTDIR)/usr/share/xen
   25.25 -	$(INSTALL_DATA) xen/xm/create.dtd $(DESTDIR)/usr/share/xen
   25.26 +	$(INSTALL_DIR) $(DESTDIR)$(DOCDIR)
   25.27 +	$(INSTALL_DATA) xen/xm/create.dtd $(DESTDIR)$(DOCDIR)
   25.28  
   25.29  install-messages: all
   25.30  	set -e; if which $(MSGFMT) >/dev/null ; then \
   25.31 -		mkdir -p $(DESTDIR)$(NLSDIR); \
   25.32 +		$(INSTALL_DIR) $(DESTDIR)$(NLSDIR); \
   25.33  		for l in $(LINGUAS); do \
   25.34  			$(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l; \
   25.35  			$(INSTALL_DIR) $(DESTDIR)$(NLSDIR)/$$l/LC_MESSAGES; \
    26.1 --- a/tools/python/README.XendConfig	Tue Apr 07 11:29:44 2009 +0900
    26.2 +++ b/tools/python/README.XendConfig	Tue Apr 07 11:32:24 2009 +0900
    26.3 @@ -25,6 +25,7 @@ name_label                      name
    26.4  name_description
    26.5  user_version
    26.6  is_a_template
    26.7 +auto_power_on
    26.8  resident_on
    26.9  memory_static_min               memory
   26.10  memory_static_max               maxmem
    27.1 --- a/tools/python/xen/util/acmpolicy.py	Tue Apr 07 11:29:44 2009 +0900
    27.2 +++ b/tools/python/xen/util/acmpolicy.py	Tue Apr 07 11:32:24 2009 +0900
    27.3 @@ -216,7 +216,7 @@ ACM_SCHEMA="""<?xml version="1.0" encodi
    27.4  		<xsd:complexType>
    27.5  			<xsd:sequence>
    27.6  				<xsd:element name="Name" type="NameWithFrom"></xsd:element>
    27.7 -				<xsd:element ref="SimpleTypeEnforcementTypes" minOccurs="0" maxOccurs="unbounded" />
    27.8 +				<xsd:element ref="SimpleTypeEnforcementTypes" minOccurs="0" maxOccurs="1" />
    27.9  				<xsd:element ref="ChineseWallTypes" minOccurs="0" maxOccurs="unbounded" />
   27.10  			</xsd:sequence>
   27.11  		</xsd:complexType>
    28.1 --- a/tools/python/xen/util/blkif.py	Tue Apr 07 11:29:44 2009 +0900
    28.2 +++ b/tools/python/xen/util/blkif.py	Tue Apr 07 11:32:24 2009 +0900
    28.3 @@ -75,7 +75,7 @@ def _parse_uname(uname):
    28.4      fn = taptype = None
    28.5      if uname.find(":") != -1:
    28.6          (typ, fn) = uname.split(":", 1)
    28.7 -        if typ == "phy" and not fn.startswith("/"):
    28.8 +        if typ in ("phy", "drbd") and not fn.startswith("/"):
    28.9              fn = "/dev/%s" %(fn,)
   28.10          if typ == "tap":
   28.11              (taptype, fn) = fn.split(":", 1)
    29.1 --- a/tools/python/xen/util/pci.py	Tue Apr 07 11:29:44 2009 +0900
    29.2 +++ b/tools/python/xen/util/pci.py	Tue Apr 07 11:32:24 2009 +0900
    29.3 @@ -417,7 +417,10 @@ class PciDevice:
    29.4  
    29.5      def find_the_uppermost_pci_bridge(self):
    29.6          # Find the uppermost PCI/PCI-X bridge
    29.7 -        (dom, b, d, f) = self.find_parent()
    29.8 +        dev = self.find_parent()
    29.9 +        if dev is None:
   29.10 +            return None
   29.11 +        (dom, b, d, f) = dev
   29.12          dev = dev_parent = PciDevice(dom, b, d, f)
   29.13          while dev_parent.dev_type != DEV_TYPE_PCIe_BRIDGE:
   29.14              parent = dev_parent.find_parent()
   29.15 @@ -463,6 +466,11 @@ class PciDevice:
   29.16                  element,  the caller itself can remove it explicitly.
   29.17          '''
   29.18          dev = self.find_the_uppermost_pci_bridge()
   29.19 +
   29.20 +        # The 'self' device is on bus0.
   29.21 +        if dev is None:
   29.22 +            return [self.name]
   29.23 +
   29.24          dev_list = dev.find_all_devices_behind_the_bridge(ignore_bridge)
   29.25          dev_list = re.findall(PCI_DEV_REG_EXPRESS_STR, '%s' % dev_list)
   29.26          return dev_list
   29.27 @@ -559,7 +567,8 @@ class PciDevice:
   29.28              return self.find_all_the_multi_functions()
   29.29          elif self.dev_type == DEV_TYPE_PCI and not self.pci_af_flr:
   29.30              coassigned_pci_list = self.find_coassigned_pci_devices(True)
   29.31 -            del coassigned_pci_list[0]
   29.32 +            if len(coassigned_pci_list) > 1:
   29.33 +                del coassigned_pci_list[0]
   29.34              return coassigned_pci_list
   29.35          else:
   29.36              return [self.name]
    30.1 --- a/tools/python/xen/util/vscsi_util.py	Tue Apr 07 11:29:44 2009 +0900
    30.2 +++ b/tools/python/xen/util/vscsi_util.py	Tue Apr 07 11:32:24 2009 +0900
    30.3 @@ -36,6 +36,11 @@ SYSFS_SCSI_DEV_TYPEID_PATH = '/type'
    30.4  SYSFS_SCSI_DEV_REVISION_PATH = '/rev'
    30.5  SYSFS_SCSI_DEV_SCSILEVEL_PATH = '/scsi_level'
    30.6  
    30.7 +SCSI_ID_COMMANDS = [
    30.8 +    "/lib/udev/scsi_id -gu --sg-version 3 -d /dev/%s 2>/dev/null",
    30.9 +    "/sbin/scsi_id -gu -s /class/scsi_generic/%s 2>/dev/null"
   30.10 +]
   30.11 +
   30.12  def _vscsi_get_devname_by(name, scsi_devices):
   30.13      """A device name is gotten by the HCTL.
   30.14      (e.g., '0:0:0:0' to '/dev/sda')
   30.15 @@ -79,9 +84,10 @@ def _vscsi_get_hctl_by(phyname, scsi_dev
   30.16  
   30.17  
   30.18  def _vscsi_get_scsiid(sg):
   30.19 -    scsi_id = os.popen('/sbin/scsi_id -gu -s /class/scsi_generic/' + sg).read().split()
   30.20 -    if len(scsi_id):
   30.21 -        return scsi_id[0]
   30.22 +    for scsi_id_command in SCSI_ID_COMMANDS:
   30.23 +        scsi_id = os.popen(scsi_id_command % sg).read().split()
   30.24 +        if len(scsi_id):
   30.25 +            return scsi_id[0]
   30.26      return None
   30.27  
   30.28  
   30.29 @@ -225,40 +231,50 @@ def get_scsi_scsilevel(pHCTL):
   30.30      except:
   30.31          return None
   30.32  
   30.33 -def get_all_scsi_devices():
   30.34 -
   30.35 -    scsi_devs = []
   30.36 -
   30.37 -    for scsi_info in vscsi_get_scsidevices():
   30.38 -        scsi_dev = {
   30.39 -            'physical_HCTL': scsi_info[0],
   30.40 -            'dev_name': None,
   30.41 -            'sg_name': scsi_info[2],
   30.42 -            'scsi_id': None
   30.43 -        }
   30.44 -        if scsi_info[1] is not None:
   30.45 -            scsi_dev['dev_name'] = scsi_info[1] 
   30.46 -        if scsi_info[3] is not None:
   30.47 -            scsi_dev['scsi_id'] = scsi_info[3] 
   30.48 +def _make_scsi_record(scsi_info):
   30.49 +    scsi_rec = {
   30.50 +        'physical_HCTL': scsi_info[0],
   30.51 +        'dev_name': None,
   30.52 +        'sg_name': scsi_info[2],
   30.53 +        'scsi_id': None
   30.54 +    }
   30.55 +    if scsi_info[1] is not None:
   30.56 +        scsi_rec['dev_name'] = scsi_info[1] 
   30.57 +    if scsi_info[3] is not None:
   30.58 +        scsi_rec['scsi_id'] = scsi_info[3] 
   30.59  
   30.60 -        scsi_dev['vendor_name'] = \
   30.61 -            get_scsi_vendor(scsi_dev['physical_HCTL'])
   30.62 -        scsi_dev['model'] = \
   30.63 -            get_scsi_model(scsi_dev['physical_HCTL'])
   30.64 -        scsi_dev['type_id'] = \
   30.65 -            get_scsi_typeid(scsi_dev['physical_HCTL'])
   30.66 -        scsi_dev['revision'] = \
   30.67 -            get_scsi_revision(scsi_dev['physical_HCTL'])
   30.68 -        scsi_dev['scsi_level'] = \
   30.69 -            get_scsi_scsilevel(scsi_dev['physical_HCTL'])
   30.70 +    scsi_rec['vendor_name'] = \
   30.71 +        get_scsi_vendor(scsi_rec['physical_HCTL'])
   30.72 +    scsi_rec['model'] = \
   30.73 +        get_scsi_model(scsi_rec['physical_HCTL'])
   30.74 +    scsi_rec['type_id'] = \
   30.75 +        get_scsi_typeid(scsi_rec['physical_HCTL'])
   30.76 +    scsi_rec['revision'] = \
   30.77 +        get_scsi_revision(scsi_rec['physical_HCTL'])
   30.78 +    scsi_rec['scsi_level'] = \
   30.79 +        get_scsi_scsilevel(scsi_rec['physical_HCTL'])
   30.80  
   30.81 -        try:
   30.82 -            lsscsi_info = os.popen('lsscsi %s 2>/dev/null' % scsi_dev['physical_HCTL']).read().split()
   30.83 -            scsi_dev['type'] = lsscsi_info[1]
   30.84 -        except:
   30.85 -            scsi_dev['type'] = None
   30.86 +    try:
   30.87 +        lsscsi_info = os.popen('lsscsi %s 2>/dev/null' % scsi_rec['physical_HCTL']).read().split()
   30.88 +        scsi_rec['type'] = lsscsi_info[1]
   30.89 +    except:
   30.90 +        scsi_rec['type'] = None
   30.91  
   30.92 -        scsi_devs.append(scsi_dev)
   30.93 +    return scsi_rec
   30.94  
   30.95 -    return scsi_devs
   30.96 +def get_scsi_device(pHCTL):
   30.97 +    scsis_info = _vscsi_get_scsidevices_by_lsscsi(pHCTL)
   30.98 +    if not scsis_info:
   30.99 +        scsis_info = _vscsi_get_scsidevices_by_sysfs()
  30.100 +    for scsi_info in scsis_info:
  30.101 +        if scsi_info[0] == pHCTL:
  30.102 +            return _make_scsi_record(scsi_info)
  30.103 +    return None
  30.104  
  30.105 +def get_all_scsi_devices():
  30.106 +    scsi_records = []
  30.107 +    for scsi_info in vscsi_get_scsidevices():
  30.108 +        scsi_record = _make_scsi_record(scsi_info)
  30.109 +        scsi_records.append(scsi_record)
  30.110 +    return scsi_records
  30.111 +
    31.1 --- a/tools/python/xen/web/connection.py	Tue Apr 07 11:29:44 2009 +0900
    31.2 +++ b/tools/python/xen/web/connection.py	Tue Apr 07 11:32:24 2009 +0900
    31.3 @@ -317,6 +317,8 @@ class SocketDgramListener:
    31.4  
    31.5      def main(self):
    31.6          try:
    31.7 +            fcntl.fcntl(self.sock.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC)
    31.8 +
    31.9              while True:
   31.10                  try:
   31.11                      data = self.sock.recv(BUFFER_SIZE)
    32.1 --- a/tools/python/xen/xend/XendAPI.py	Tue Apr 07 11:29:44 2009 +0900
    32.2 +++ b/tools/python/xen/xend/XendAPI.py	Tue Apr 07 11:32:24 2009 +0900
    32.3 @@ -1352,6 +1352,9 @@ class XendAPI(object):
    32.4      def VM_get_is_a_template(self, session, ref):
    32.5          return self.VM_get('is_a_template', session, ref)
    32.6      
    32.7 +    def VM_get_auto_power_on(self, session, vm_ref):
    32.8 +        return self.VM_get('auto_power_on', session, vm_ref)
    32.9 +    
   32.10      def VM_get_memory_dynamic_max(self, session, vm_ref):
   32.11          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   32.12          return xen_api_success(dom.get_memory_dynamic_max())
   32.13 @@ -1441,6 +1444,9 @@ class XendAPI(object):
   32.14          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   32.15          return xen_api_todo()
   32.16      
   32.17 +    def VM_set_auto_power_on(self, session, vm_ref, val):
   32.18 +        return self.VM_set('auto_power_on', session, vm_ref, val)
   32.19 +    
   32.20      def VM_set_memory_dynamic_max(self, session, vm_ref, mem):
   32.21          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   32.22          dom.set_memory_dynamic_max(int(mem))
   32.23 @@ -1682,7 +1688,7 @@ class XendAPI(object):
   32.24              'name_description': xeninfo.getName(),
   32.25              'user_version': 1,
   32.26              'is_a_template': xeninfo.info['is_a_template'],
   32.27 -            'auto_power_on': False,
   32.28 +            'auto_power_on': xeninfo.info['auto_power_on'],
   32.29              'resident_on': XendNode.instance().uuid,
   32.30              'memory_static_min': xeninfo.get_memory_static_min(),
   32.31              'memory_static_max': xeninfo.get_memory_static_max(),
    33.1 --- a/tools/python/xen/xend/XendConfig.py	Tue Apr 07 11:29:44 2009 +0900
    33.2 +++ b/tools/python/xen/xend/XendConfig.py	Tue Apr 07 11:32:24 2009 +0900
    33.3 @@ -187,6 +187,7 @@ XENAPI_CFG_TYPES = {
    33.4      'name_description': str,
    33.5      'user_version': str,
    33.6      'is_a_template': bool0,
    33.7 +    'auto_power_on': bool0,
    33.8      'resident_on': str,
    33.9      'memory_static_min': int,  # note these are stored in bytes, not KB!
   33.10      'memory_static_max': int,
   33.11 @@ -361,6 +362,7 @@ class XendConfig(dict):
   33.12              'actions_after_crash': 'restart',
   33.13              'actions_after_suspend': '',
   33.14              'is_a_template': False,
   33.15 +            'auto_power_on': False,
   33.16              'is_control_domain': False,
   33.17              'features': '',
   33.18              'PV_bootloader': '',
   33.19 @@ -1410,6 +1412,21 @@ class XendConfig(dict):
   33.20                  if dev_uuid not in target['console_refs']:
   33.21                      target['console_refs'].append(dev_uuid)
   33.22  
   33.23 +		# Cope with old-format save files which say under vfb
   33.24 +		# (type vfb) rather than (vfb 1)
   33.25 +		try:
   33.26 +		    vfb_type = dev_info['type']
   33.27 +		except KeyError:
   33.28 +		    vfb_type = None
   33.29 +		log.debug("iwj dev_type=%s vfb type %s" %
   33.30 +			(dev_type, `vfb_type`))
   33.31 +
   33.32 +		if vfb_type == 'vnc' or vfb_type == 'sdl':
   33.33 +		    dev_info[vfb_type] = 1
   33.34 +		    del dev_info['type']
   33.35 +		    log.debug("iwj dev_type=%s vfb setting dev_info['%s']" %
   33.36 +				(dev_type, vfb_type))
   33.37 +                
   33.38              elif dev_type == 'console':
   33.39                  if 'console_refs' not in target:
   33.40                      target['console_refs'] = []
   33.41 @@ -1895,6 +1912,7 @@ class XendConfig(dict):
   33.42              for key, val in cfg_xenapi.items():
   33.43                  dev_info[key] = val
   33.44              self['devices'][dev_uuid] = (dev_type, dev_info)
   33.45 +            return True
   33.46  
   33.47          return False
   33.48  
    34.1 --- a/tools/python/xen/xend/XendConstants.py	Tue Apr 07 11:29:44 2009 +0900
    34.2 +++ b/tools/python/xen/xend/XendConstants.py	Tue Apr 07 11:32:24 2009 +0900
    34.3 @@ -105,13 +105,15 @@ LAST_SHUTDOWN_REASON = 'xend/last_shutdo
    34.4  TRIGGER_NMI   = 0
    34.5  TRIGGER_RESET = 1
    34.6  TRIGGER_INIT  = 2
    34.7 -TRIGGER_S3RESUME = 3
    34.8 +TRIGGER_POWER = 3
    34.9 +TRIGGER_S3RESUME = 4
   34.10  
   34.11  TRIGGER_TYPE = {
   34.12      "nmi"   : TRIGGER_NMI,
   34.13      "reset" : TRIGGER_RESET,
   34.14      "init"  : TRIGGER_INIT,
   34.15 -    "s3resume": TRIGGER_S3RESUME
   34.16 +    "s3resume": TRIGGER_S3RESUME,
   34.17 +    "power": TRIGGER_POWER
   34.18  }
   34.19  
   34.20  #
    35.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Apr 07 11:29:44 2009 +0900
    35.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Apr 07 11:32:24 2009 +0900
    35.3 @@ -144,6 +144,7 @@ def recreate(info, priv):
    35.4      xeninfo = XendConfig.XendConfig(dominfo = info)
    35.5      xeninfo['is_control_domain'] = priv
    35.6      xeninfo['is_a_template'] = False
    35.7 +    xeninfo['auto_power_on'] = False
    35.8      domid = xeninfo['domid']
    35.9      uuid1 = uuid.fromString(xeninfo['uuid'])
   35.10      needs_reinitialising = False
   35.11 @@ -619,7 +620,7 @@ class XendDomainInfo:
   35.12              pci_devs = pci_conf['devs']
   35.13              for x in pci_devs:
   35.14                  if (int(x['vslt'], 16) == int(new_dev['vslt'], 16) and
   35.15 -                   int(x['vslt'], 16) != 0 ):
   35.16 +                   int(x['vslt'], 16) != AUTO_PHP_SLOT):
   35.17                      raise VmError("vslot %s already have a device." % (new_dev['vslt']))
   35.18  
   35.19                  if (int(x['domain'], 16) == int(new_dev['domain'], 16) and
   35.20 @@ -723,6 +724,13 @@ class XendDomainInfo:
   35.21          dev_config_dict = self.info['devices'][dev_uuid][1]
   35.22          log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
   35.23  
   35.24 +        if dev_type == 'vif':
   35.25 +            for x in dev_config:
   35.26 +                if x != 'vif' and x[0] == 'mac':
   35.27 +                    if not re.match('^([0-9a-f]{2}:){5}[0-9a-f]{2}$', x[1], re.I):
   35.28 +                        log.error("Virtual network interface creation error - invalid MAC Address entered: %s", x[1])
   35.29 +                        raise VmError("Cannot create a new virtual network interface - MAC address is not valid!");
   35.30 +
   35.31          if self.domid is not None:
   35.32              try:
   35.33                  dev_config_dict['devid'] = devid = \
   35.34 @@ -1045,7 +1053,7 @@ class XendDomainInfo:
   35.35          if devnum >= pci_len:
   35.36              raise VmError("Device @ vslot 0x%x doesn't exist." % (vslot))
   35.37  
   35.38 -        if vslot == 0:
   35.39 +        if vslot == AUTO_PHP_SLOT:
   35.40              raise VmError("Device @ vslot 0x%x do not support hotplug." % (vslot))
   35.41  
   35.42          # Check the co-assignment.
   35.43 @@ -1597,9 +1605,6 @@ class XendDomainInfo:
   35.44          # convert two lists into a python dictionary
   35.45          vm_details = dict(zip(cfg_vm, vm_details))
   35.46  
   35.47 -        if vm_details['rtc/timeoffset'] == None:
   35.48 -            vm_details['rtc/timeoffset'] = "0"
   35.49 -
   35.50          for arg, val in vm_details.items():
   35.51              if arg in XendConfig.LEGACY_CFG_TO_XENAPI_CFG:
   35.52                  xapiarg = XendConfig.LEGACY_CFG_TO_XENAPI_CFG[arg]
   35.53 @@ -1621,10 +1626,10 @@ class XendDomainInfo:
   35.54              self.info.update_with_image_sxp(sxp.from_string(image_sxp))
   35.55              changed = True
   35.56  
   35.57 -        # Check if the rtc offset has changes
   35.58 -        if vm_details.get("rtc/timeoffset", "0") != self.info["platform"].get("rtc_timeoffset", "0"):
   35.59 -            self.info["platform"]["rtc_timeoffset"] = vm_details.get("rtc/timeoffset", 0)
   35.60 -            changed = True
   35.61 +        # Update the rtc_timeoffset to be preserved across reboot.
   35.62 +        # NB. No need to update xenstore domain section.
   35.63 +        val = int(vm_details.get("rtc/timeoffset", 0))
   35.64 +        self.info["platform"]["rtc_timeoffset"] = val
   35.65   
   35.66          if changed:
   35.67              # Update the domain section of the store, as this contains some
   35.68 @@ -2245,8 +2250,9 @@ class XendDomainInfo:
   35.69          # There is an implicit memory overhead for any domain creation. This
   35.70          # overhead is greater for some types of domain than others. For
   35.71          # example, an x86 HVM domain will have a default shadow-pagetable
   35.72 -        # allocation of 1MB. We free up 2MB here to be on the safe side.
   35.73 -        balloon.free(2*1024, self) # 2MB should be plenty
   35.74 +        # allocation of 1MB. We free up 4MB here to be on the safe side.
   35.75 +        # 2MB memory allocation was not enough in some cases, so it's 4MB now
   35.76 +        balloon.free(4*1024, self) # 4MB should be plenty
   35.77  
   35.78          ssidref = 0
   35.79          if security.on() == xsconstants.XS_POLICY_USE:
   35.80 @@ -2305,6 +2311,21 @@ class XendDomainInfo:
   35.81          # Set maximum number of vcpus in domain
   35.82          xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
   35.83  
   35.84 +        # Check for cpu_{cap|weight} validity for credit scheduler
   35.85 +        if XendNode.instance().xenschedinfo() == 'credit':
   35.86 +            cap = self.getCap()
   35.87 +            weight = self.getWeight()
   35.88 +
   35.89 +            assert type(weight) == int
   35.90 +            assert type(cap) == int
   35.91 +
   35.92 +            if weight < 1 or weight > 65535:
   35.93 +                raise VmError("Cpu weight out of range, valid values are within range from 1 to 65535")
   35.94 +
   35.95 +            if cap < 0 or cap > self.getVCpuCount() * 100:
   35.96 +                raise VmError("Cpu cap out of range, valid range is from 0 to %s for specified number of vcpus" %
   35.97 +                              (self.getVCpuCount() * 100))
   35.98 +
   35.99          # Test whether the devices can be assigned with VT-d
  35.100          pci = self.info["platform"].get("pci")
  35.101          pci_str = ''
  35.102 @@ -2416,12 +2437,6 @@ class XendDomainInfo:
  35.103          self._configureBootloader()
  35.104  
  35.105          try:
  35.106 -            if self.info['platform'].get('localtime', 0):
  35.107 -                if time.localtime(time.time())[8]:
  35.108 -                    self.info['platform']['rtc_timeoffset'] = -time.altzone
  35.109 -                else:
  35.110 -                    self.info['platform']['rtc_timeoffset'] = -time.timezone
  35.111 -
  35.112              self.image = image.create(self, self.info)
  35.113  
  35.114              # repin domain vcpus if a restricted cpus list is provided
    36.1 --- a/tools/python/xen/xend/XendNode.py	Tue Apr 07 11:29:44 2009 +0900
    36.2 +++ b/tools/python/xen/xend/XendNode.py	Tue Apr 07 11:32:24 2009 +0900
    36.3 @@ -363,6 +363,8 @@ class XendNode:
    36.4          ppci_uuid = saved_ppci_table.get(pci_dev.name, uuid.createString())
    36.5          XendPPCI(ppci_uuid, ppci_record)
    36.6  
    36.7 +        self.save_PPCIs()
    36.8 +
    36.9  
   36.10      def remove_PPCI(self, pci_name):
   36.11          # Update lspci info
   36.12 @@ -373,15 +375,41 @@ class XendNode:
   36.13          ppci_ref = XendPPCI.get_by_sbdf(domain, bus, slot, func)
   36.14          XendAPIStore.get(ppci_ref, "PPCI").destroy()
   36.15  
   36.16 -
   36.17 -    def add_PSCSI(self):
   36.18 -        # TODO
   36.19 -        log.debug("add_network(): Not implemented.")
   36.20 +        self.save_PPCIs()
   36.21  
   36.22  
   36.23 -    def remove_PSCSI(self):
   36.24 -        # TODO
   36.25 -        log.debug("add_network(): Not implemented.")
   36.26 +    def add_PSCSI(self, add_HCTL):
   36.27 +        saved_pscsis = self.state_store.load_state('pscsi')
   36.28 +        saved_pscsi_table = {}
   36.29 +        if saved_pscsis:
   36.30 +            for saved_uuid, saved_record in saved_pscsis.items():
   36.31 +                try:
   36.32 +                    saved_pscsi_table[saved_record['scsi_id']] = saved_uuid
   36.33 +                except KeyError:
   36.34 +                    pass
   36.35 +
   36.36 +        # Initialise the PSCSI
   36.37 +        pscsi_record = vscsi_util.get_scsi_device(add_HCTL)
   36.38 +        if pscsi_record and pscsi_record['scsi_id']:
   36.39 +            pscsi_uuid = saved_pscsi_table.get(pscsi_record['scsi_id'], None)
   36.40 +            if pscsi_uuid is None:
   36.41 +                pscsi_uuid = uuid.createString()
   36.42 +                XendPSCSI(pscsi_uuid, pscsi_record)
   36.43 +                self.save_PSCSIs()
   36.44 +
   36.45 +
   36.46 +    def remove_PSCSI(self, rem_HCTL):
   36.47 +        saved_pscsis = self.state_store.load_state('pscsi')
   36.48 +        if not saved_pscsis:
   36.49 +            return
   36.50 +
   36.51 +        # Remove the PSCSI
   36.52 +        for pscsi_record in saved_pscsis.values():
   36.53 +            if rem_HCTL == pscsi_record['physical_HCTL']:
   36.54 +                pscsi_ref = XendPSCSI.get_by_HCTL(rem_HCTL)
   36.55 +                XendAPIStore.get(pscsi_ref, "PSCSI").destroy()
   36.56 +                self.save_PSCSIs()
   36.57 +                return
   36.58  
   36.59  
   36.60  ##    def network_destroy(self, net_uuid):
   36.61 @@ -802,6 +830,43 @@ class XendNode:
   36.62  
   36.63          return [[k, info[k]] for k in ITEM_ORDER]
   36.64  
   36.65 +
   36.66 +    def pciinfo(self):
   36.67 +        # Each element of dev_list is a PciDevice
   36.68 +        dev_list = PciUtil.find_all_devices_owned_by_pciback()
   36.69 + 
   36.70 +        # Each element of devs_list is a list of PciDevice
   36.71 +        devs_list = PciUtil.check_FLR_capability(dev_list)
   36.72 + 
   36.73 +        devs_list = PciUtil.check_mmio_bar(devs_list)
   36.74 + 
   36.75 +        # Check if the devices have been assigned to guests.
   36.76 +        final_devs_list = []
   36.77 +        for dev_list in devs_list:
   36.78 +            available = True
   36.79 +            for d in dev_list:
   36.80 +                pci_str = '0x%x,0x%x,0x%x,0x%x' %(d.domain, d.bus, d.slot, d.func)
   36.81 +                # Xen doesn't care what the domid is, so we pass 0 here...
   36.82 +                domid = 0
   36.83 +                bdf = self.xc.test_assign_device(domid, pci_str)
   36.84 +                if bdf != 0:
   36.85 +                    available = False
   36.86 +                    break
   36.87 +            if available:
   36.88 +                final_devs_list = final_devs_list + [dev_list]
   36.89 +
   36.90 +        pci_sxp_list = []
   36.91 +        for dev_list in final_devs_list:
   36.92 +            for d in dev_list:
   36.93 +                pci_sxp = ['dev', ['domain', '0x%04x' % d.domain],
   36.94 +                                  ['bus', '0x%02x' % d.bus],
   36.95 +                                  ['slot', '0x%02x' % d.slot],
   36.96 +                                  ['func', '0x%x' % d.func]]
   36.97 +                pci_sxp_list.append(pci_sxp)
   36.98 +
   36.99 +        return pci_sxp_list
  36.100 + 
  36.101 +
  36.102      def xenschedinfo(self):
  36.103          sched_id = self.xc.sched_id_get()
  36.104          if sched_id == xen.lowlevel.xc.XEN_SCHEDULER_SEDF:
    37.1 --- a/tools/python/xen/xend/image.py	Tue Apr 07 11:29:44 2009 +0900
    37.2 +++ b/tools/python/xen/xend/image.py	Tue Apr 07 11:32:24 2009 +0900
    37.3 @@ -119,9 +119,14 @@ class ImageHandler:
    37.4          self.vncconsole = int(vmConfig['platform'].get('vncconsole', 0))
    37.5          self.dmargs = self.parseDeviceModelArgs(vmConfig)
    37.6          self.pid = None
    37.7 -        rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset')
    37.8 -        if rtc_timeoffset is not None:
    37.9 -            xc.domain_set_time_offset(self.vm.getDomid(), int(rtc_timeoffset))
   37.10 +        rtc_timeoffset = int(vmConfig['platform'].get('rtc_timeoffset', 0))
   37.11 +        if vmConfig['platform'].get('localtime', 0):
   37.12 +            if time.localtime(time.time())[8]:
   37.13 +                rtc_timeoffset -= time.altzone
   37.14 +            else:
   37.15 +                rtc_timeoffset -= time.timezone
   37.16 +        if rtc_timeoffset != 0:
   37.17 +            xc.domain_set_time_offset(self.vm.getDomid(), rtc_timeoffset)
   37.18  
   37.19          self.cpuid = None
   37.20          self.cpuid_check = None
   37.21 @@ -488,7 +493,10 @@ class ImageHandler:
   37.22  
   37.23      def _dmfailed(self, message):
   37.24          log.warning("domain %s: %s", self.vm.getName(), message)
   37.25 -        xc.domain_shutdown(self.vm.getDomid(), DOMAIN_CRASH)
   37.26 +        try:
   37.27 +            xc.domain_shutdown(self.vm.getDomid(), DOMAIN_CRASH)
   37.28 +        except:
   37.29 +            pass
   37.30  
   37.31      def recreate(self):
   37.32          if self.device_model is None:
   37.33 @@ -526,8 +534,8 @@ class ImageHandler:
   37.34          try: self.sentinel_fifo.read(1)
   37.35          except OSError, e: pass
   37.36          self.sentinel_lock.acquire()
   37.37 -        try:
   37.38 -            if self.pid:
   37.39 +        if self.pid:
   37.40 +            try:
   37.41                  (p,st) = os.waitpid(self.pid, os.WNOHANG)
   37.42                  if p == self.pid:
   37.43                      message = oshelp.waitstatus_description(st)
   37.44 @@ -539,15 +547,15 @@ class ImageHandler:
   37.45                      except:
   37.46                          message = "malfunctioning or died ?"
   37.47                  message = "pid %d: %s" % (self.pid, message)
   37.48 -            else:
   37.49 -                message = "no longer running"
   37.50 -        except Exception, e:
   37.51 -            message = "waitpid failed: %s" % utils.exception_string(e)
   37.52 -        message = "device model failure: %s" % message
   37.53 -        try: message += "; see %s " % self.logfile
   37.54 -        except: pass
   37.55 -        self._dmfailed(message)
   37.56 -        self.pid = None
   37.57 +            except Exception, e:
   37.58 +                message = "waitpid failed: %s" % utils.exception_string(e)
   37.59 +            message = "device model failure: %s" % message
   37.60 +            try: message += "; see %s " % self.logfile
   37.61 +            except: pass
   37.62 +            self._dmfailed(message)
   37.63 +            self.pid = None
   37.64 +        else:
   37.65 +            log.info("%s device model terminated", self.vm.getName())
   37.66          self.sentinel_lock.release()
   37.67  
   37.68      def destroyDeviceModel(self):
   37.69 @@ -778,6 +786,14 @@ class HVMImageHandler(ImageHandler):
   37.70                      if v: ret.append("-%s" % a)
   37.71                  except (ValueError, TypeError):
   37.72                      pass # if we can't convert it to a sane type, ignore it
   37.73 +            elif a == 'serial':
   37.74 +                if v:
   37.75 +                    if type(v) == str:
   37.76 +                        v = [v]
   37.77 +                    for s in v:
   37.78 +                        if s:
   37.79 +                            ret.append("-serial")
   37.80 +                            ret.append("%s" % s)
   37.81              else:
   37.82                  if v:
   37.83                      ret.append("-%s" % a)
    38.1 --- a/tools/python/xen/xend/server/XMLRPCServer.py	Tue Apr 07 11:29:44 2009 +0900
    38.2 +++ b/tools/python/xen/xend/server/XMLRPCServer.py	Tue Apr 07 11:32:24 2009 +0900
    38.3 @@ -198,7 +198,8 @@ class XMLRPCServer:
    38.4                      self.server.register_function(fn, "xend.domain.%s" % name[7:])
    38.5  
    38.6          # Functions in XendNode and XendDmesg
    38.7 -        for type, lst, n in [(XendNode, ['info', 'send_debug_keys'], 'node'),
    38.8 +        for type, lst, n in [(XendNode, ['info', 'pciinfo', 'send_debug_keys'],
    38.9 +                             'node'),
   38.10                               (XendDmesg, ['info', 'clear'], 'node.dmesg')]:
   38.11              inst = type.instance()
   38.12              for name in lst:
    39.1 --- a/tools/python/xen/xend/server/pciif.py	Tue Apr 07 11:29:44 2009 +0900
    39.2 +++ b/tools/python/xen/xend/server/pciif.py	Tue Apr 07 11:32:24 2009 +0900
    39.3 @@ -90,6 +90,7 @@ class PciController(DevController):
    39.4              back['dev-%i' % pcidevid] = "%04x:%02x:%02x.%01x" % \
    39.5                                          (domain, bus, slot, func)
    39.6              back['uuid-%i' % pcidevid] = pci_config.get('uuid', '')
    39.7 +            back['vslot-%i' % pcidevid] = "%02x" % vslot
    39.8              pcidevid += 1
    39.9  
   39.10          if vslots != "":
    40.1 --- a/tools/python/xen/xend/server/udevevent.py	Tue Apr 07 11:29:44 2009 +0900
    40.2 +++ b/tools/python/xen/xend/server/udevevent.py	Tue Apr 07 11:32:24 2009 +0900
    40.3 @@ -40,13 +40,25 @@ class UdevEventProtocol(protocol.Protoco
    40.4                      log.info("Removing pci device %s", pci_name)
    40.5                      XendNode.instance().remove_PPCI(pci_name)
    40.6  
    40.7 -            elif (udev_event.get('SUBSYSTEMS', None) == 'scsi'):
    40.8 +            elif (udev_event.get('SUBSYSTEM', None) == 'scsi'):
    40.9 +                hctl = None
   40.10 +                devpath = udev_event.get('DEVPATH', None)
   40.11 +                if devpath:
   40.12 +                    hctl = devpath.split('/')[-1]
   40.13 +                    if len(hctl.split(':')) != 4:
   40.14 +                        hctl = None
   40.15 +                if hctl is None:
   40.16 +                    # By any possibility, if an HCTL isn't gotten from
   40.17 +                    # the udev event, the udev event is ignored.
   40.18 +                    log.warn("Invalid udev event about scsi received")
   40.19 +                    return
   40.20 +
   40.21                  if (udev_event['ACTION'] == 'add'):
   40.22 -                    log.info("Adding scsi device")
   40.23 -                    XendNode.instance().add_PSCSI()
   40.24 +                    log.info("Adding scsi device %s", hctl)
   40.25 +                    XendNode.instance().add_PSCSI(hctl)
   40.26                  elif (udev_event['ACTION'] == 'remove'):
   40.27 -                    log.info("Removing scci device")
   40.28 -                    XendNode.instance().remove_PSCSI()
   40.29 +                    log.info("Removing scsi device %s", hctl)
   40.30 +                    XendNode.instance().remove_PSCSI(hctl)
   40.31  
   40.32              elif (udev_event.get('SUBSYSTEM', None) == 'net'):
   40.33                  interface = udev_event.get('INTERFACE', None)
    41.1 --- a/tools/python/xen/xend/server/vfbif.py	Tue Apr 07 11:29:44 2009 +0900
    41.2 +++ b/tools/python/xen/xend/server/vfbif.py	Tue Apr 07 11:32:24 2009 +0900
    41.3 @@ -6,7 +6,7 @@ import xen.xend
    41.4  import os
    41.5  
    41.6  CONFIG_ENTRIES = ['type', 'vncdisplay', 'vnclisten', 'vncpasswd', 'vncunused',
    41.7 -                  'videoram', 'display', 'xauthority', 'keymap',
    41.8 +                  'videoram', 'display', 'xauthority', 'keymap', 'vnc', 'sdl',
    41.9                    'uuid', 'location', 'protocol', 'opengl']
   41.10  
   41.11  class VfbifController(DevController):
    42.1 --- a/tools/python/xen/xm/create.py	Tue Apr 07 11:29:44 2009 +0900
    42.2 +++ b/tools/python/xen/xm/create.py	Tue Apr 07 11:32:24 2009 +0900
    42.3 @@ -204,7 +204,7 @@ gopts.var('cpus', val='CPUS',
    42.4            use="CPUS to run the domain on.")
    42.5  
    42.6  gopts.var('rtc_timeoffset', val='RTC_TIMEOFFSET',
    42.7 -          fn=set_value, default="0",
    42.8 +          fn=set_int, default=0,
    42.9            use="Set RTC offset.")
   42.10  
   42.11  gopts.var('pae', val='PAE',
   42.12 @@ -1057,7 +1057,7 @@ def preprocess_pci(vals):
   42.13                  r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \
   42.14                  r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + \
   42.15                  r"(?P<func>[0-7])" + \
   42.16 -                r"(@(?P<vslot>[0-9a-fA-F]))?" + \
   42.17 +                r"(@(?P<vslot>[01]?[0-9a-fA-F]))?" + \
   42.18                  r"(,(?P<opts>.*))?$", \
   42.19                  pci_dev_str)
   42.20          if pci_match!=None:
   42.21 @@ -1081,7 +1081,7 @@ def preprocess_vscsi(vals):
   42.22      if not vals.vscsi: return
   42.23      scsi = []
   42.24      for scsi_str in vals.vscsi:
   42.25 -        d = scsi_str.split(',')
   42.26 +        d = [tmp.strip() for tmp in scsi_str.split(',')]
   42.27          n = len(d)
   42.28          if n == 2:
   42.29              tmp = d[1].split(':')
    43.1 --- a/tools/python/xen/xm/main.py	Tue Apr 07 11:29:44 2009 +0900
    43.2 +++ b/tools/python/xen/xm/main.py	Tue Apr 07 11:32:24 2009 +0900
    43.3 @@ -58,13 +58,6 @@ from xen.util.acmpolicy import ACM_LABEL
    43.4  
    43.5  import XenAPI
    43.6  
    43.7 -import xen.lowlevel.xc
    43.8 -try:
    43.9 -    xc = xen.lowlevel.xc.xc()
   43.10 -except Exception, ex:
   43.11 -    print >>sys.stderr, ("Is xen kernel running?")
   43.12 -    sys.exit(1)
   43.13 -
   43.14  import inspect
   43.15  from xen.xend import XendOptions
   43.16  xoptions = XendOptions.instance()
   43.17 @@ -158,7 +151,7 @@ SUBCOMMAND_HELP = {
   43.18                       'Get/set credit scheduler parameters.'),
   43.19      'sysrq'       : ('<Domain> <letter>', 'Send a sysrq to a domain.'),
   43.20      'debug-keys'  : ('<Keys>', 'Send debug keys to Xen.'),
   43.21 -    'trigger'     : ('<Domain> <nmi|reset|init|s3resume> [<VCPU>]',
   43.22 +    'trigger'     : ('<Domain> <nmi|reset|init|s3resume|power> [<VCPU>]',
   43.23                       'Send a trigger to a domain.'),
   43.24      'vcpu-list'   : ('[Domain, ...]',
   43.25                       'List the VCPUs for all/some domains.'),
   43.26 @@ -2188,34 +2181,28 @@ def xm_pci_list(args):
   43.27              hdr = 1
   43.28          print ( fmt_str % x )
   43.29  
   43.30 +
   43.31 +def parse_pci_info(info):
   43.32 +    def get_info(n, t, d):
   43.33 +        return t(sxp.child_value(info, n, d))
   43.34 +    return {
   43.35 +        'domain' : get_info('domain', parse_hex, 0),
   43.36 +        'bus'    : get_info('bus', parse_hex, -1),
   43.37 +        'slot'   : get_info('slot', parse_hex, -1),
   43.38 +        'func'   : get_info('func', parse_hex, -1)
   43.39 +        }
   43.40 +
   43.41  def xm_pci_list_assignable_devices(args):
   43.42 -    # Each element of dev_list is a PciDevice
   43.43 -    dev_list = find_all_devices_owned_by_pciback()
   43.44 -
   43.45 -    # Each element of devs_list is a list of PciDevice
   43.46 -    devs_list = check_FLR_capability(dev_list)
   43.47 -
   43.48 -    devs_list = check_mmio_bar(devs_list)
   43.49 -
   43.50 -    # Check if the devices have been assigned to guests.
   43.51 -    final_devs_list = []
   43.52 -    for dev_list in devs_list:
   43.53 -        available = True
   43.54 -        for d in dev_list:
   43.55 -            pci_str = '0x%x,0x%x,0x%x,0x%x' %(d.domain, d.bus, d.slot, d.func)
   43.56 -            # Xen doesn't care what the domid is, so we pass 0 here...
   43.57 -            domid = 0
   43.58 -            bdf = xc.test_assign_device(domid, pci_str)
   43.59 -            if bdf != 0:
   43.60 -                available = False
   43.61 -                break
   43.62 -        if available:
   43.63 -            final_devs_list = final_devs_list + [dev_list]
   43.64 -
   43.65 -    for dev_list in final_devs_list:
   43.66 -        for d in dev_list:
   43.67 -            print d.name,
   43.68 -        print
   43.69 +    xenapi_unsupported()
   43.70 +    arg_check(args, "pci-list-assignable-devices", 0)
   43.71 +
   43.72 +    devs =  server.xend.node.pciinfo()
   43.73 + 
   43.74 +    fmt_str = "%(domain)04x:%(bus)02x:%(slot)02x:%(func)01x"
   43.75 +    for x in devs:
   43.76 +        pci = parse_pci_info(x)
   43.77 +        print fmt_str % pci
   43.78 +
   43.79  
   43.80  def vscsi_sort(devs):
   43.81      def sort_hctl(ds, l):
    44.1 --- a/tools/python/xen/xm/xenapi_create.py	Tue Apr 07 11:29:44 2009 +0900
    44.2 +++ b/tools/python/xen/xm/xenapi_create.py	Tue Apr 07 11:32:24 2009 +0900
    44.3 @@ -218,8 +218,8 @@ class xenapi_create:
    44.4              "SR":               self.DEFAULT_STORAGE_REPOSITORY,  
    44.5              "virtual_size":     vdi.attributes["size"].value,
    44.6              "type":             vdi.attributes["type"].value,
    44.7 -            "sharable":         bool(vdi.attributes["sharable"].value),
    44.8 -            "read_only":        bool(vdi.attributes["read_only"].value),
    44.9 +            "sharable":         vdi.attributes["sharable"].value == "True",
   44.10 +            "read_only":        vdi.attributes["read_only"].value == "True",
   44.11              "other_config":     {"location":
   44.12                  vdi.attributes["src"].value}
   44.13              }
   44.14 @@ -804,6 +804,7 @@ class sxp2xml:
   44.15  
   44.16      def extract_vbd(self, vbd_sxp, document):
   44.17          src = get_child_by_name(vbd_sxp, "uname")
   44.18 +        mode = get_child_by_name(vbd_sxp, "mode")
   44.19          name = str(src.__hash__())
   44.20  
   44.21          vbd = document.createElement("vbd")
   44.22 @@ -811,8 +812,7 @@ class sxp2xml:
   44.23          vbd.attributes["name"] = "vdb" + name
   44.24          vbd.attributes["vdi"] = "vdi" + name
   44.25          vbd.attributes["mode"] \
   44.26 -            = get_child_by_name(vbd_sxp, "mode") != "w" \
   44.27 -              and "RO" or "RW"
   44.28 +            = re.search("^w!{0,1}$", mode) and "RW" or "RO"
   44.29          vbd.attributes["device"] \
   44.30              = re.sub(":cdrom$", "", get_child_by_name(vbd_sxp, "dev"))
   44.31          vbd.attributes["bootable"] = "1"
   44.32 @@ -825,17 +825,18 @@ class sxp2xml:
   44.33  
   44.34      def extract_vdi(self, vbd_sxp, document):
   44.35          src = get_child_by_name(vbd_sxp, "uname")
   44.36 +        mode = get_child_by_name(vbd_sxp, "mode")
   44.37          name = "vdi" + str(src.__hash__())
   44.38  
   44.39          vdi = document.createElement("vdi")
   44.40  
   44.41          vdi.attributes["src"] = src
   44.42          vdi.attributes["read_only"] \
   44.43 -            = (get_child_by_name(vbd_sxp, "mode") != "w") \
   44.44 -               and "True" or "False"
   44.45 +            = re.search("^w!{0,1}$", mode) and "False" or "True"
   44.46          vdi.attributes["size"] = '-1'
   44.47          vdi.attributes["type"] = "system"
   44.48 -        vdi.attributes["sharable"] = "False"
   44.49 +        vdi.attributes["sharable"] \
   44.50 +            = re.search("^w!$", mode) and "True" or "False"
   44.51          vdi.attributes["name"] = name
   44.52  
   44.53          vdi.appendChild(self.make_name_tag(name, document))
    45.1 --- a/tools/xentrace/xenctx.c	Tue Apr 07 11:29:44 2009 +0900
    45.2 +++ b/tools/xentrace/xenctx.c	Tue Apr 07 11:32:24 2009 +0900
    45.3 @@ -42,6 +42,7 @@ typedef unsigned long long guest_word_t;
    45.4  int guest_word_size = sizeof (unsigned long);
    45.5  /* Word-length of the context record we get from xen */
    45.6  int ctxt_word_size = sizeof (unsigned long);
    45.7 +int guest_protected_mode = 1;
    45.8  #elif defined (__ia64__)
    45.9  /* On ia64, we can't translate virtual address to physical address.  */
   45.10  #define NO_TRANSLATION
   45.11 @@ -206,6 +207,7 @@ static void read_symbol_table(const char
   45.12  }
   45.13  
   45.14  #if defined(__i386__) || defined(__x86_64__)
   45.15 +#define CR0_PE  0x1
   45.16  char *flag_values[22][2] =
   45.17  {/*  clear,     set,       bit# */
   45.18      { NULL,     "c"    }, // 0        Carry
   45.19 @@ -371,20 +373,38 @@ static void print_ctx(vcpu_guest_context
   45.20          print_ctx_64(&ctx->x64);
   45.21  }
   45.22  
   45.23 +#define NONPROT_MODE_SEGMENT_SHIFT 4
   45.24 +
   45.25  static guest_word_t instr_pointer(vcpu_guest_context_any_t *ctx)
   45.26  {
   45.27 -    if (ctxt_word_size == 4) 
   45.28 -        return ctx->x32.user_regs.eip;
   45.29 +    guest_word_t r;
   45.30 +    if (ctxt_word_size == 4)
   45.31 +    {
   45.32 +        r = ctx->x32.user_regs.eip;
   45.33 +
   45.34 +        if ( !guest_protected_mode )
   45.35 +            r += ctx->x32.user_regs.cs << NONPROT_MODE_SEGMENT_SHIFT;
   45.36 +    }
   45.37      else 
   45.38 -        return ctx->x64.user_regs.rip;
   45.39 +        r = ctx->x64.user_regs.rip;
   45.40 +
   45.41 +    return r;
   45.42  }
   45.43  
   45.44  static guest_word_t stack_pointer(vcpu_guest_context_any_t *ctx)
   45.45  {
   45.46 -    if (ctxt_word_size == 4) 
   45.47 -        return ctx->x32.user_regs.esp;
   45.48 +    guest_word_t r;
   45.49 +    if (ctxt_word_size == 4)
   45.50 +    {
   45.51 +        r = ctx->x32.user_regs.esp;
   45.52 +
   45.53 +        if ( !guest_protected_mode )
   45.54 +            r += ctx->x32.user_regs.ss << NONPROT_MODE_SEGMENT_SHIFT;
   45.55 +    }
   45.56      else 
   45.57 -        return ctx->x64.user_regs.rsp;
   45.58 +        r = ctx->x64.user_regs.rsp;
   45.59 +    
   45.60 +    return r;
   45.61  }
   45.62  
   45.63  static guest_word_t frame_pointer(vcpu_guest_context_any_t *ctx)
   45.64 @@ -683,12 +703,31 @@ static void print_stack_word(guest_word_
   45.65          printf(FMT_64B_WORD, word);
   45.66  }
   45.67  
   45.68 +static void print_code(vcpu_guest_context_any_t *ctx, int vcpu)
   45.69 +{
   45.70 +    guest_word_t instr;
   45.71 +    int i;
   45.72 +
   45.73 +    instr = instr_pointer(ctx);
   45.74 +    printf("Code (instr addr %08llx)\n", instr);
   45.75 +    instr -= 21;
   45.76 +    for(i=0; i<32; i++) {
   45.77 +        unsigned char *c = map_page(ctx, vcpu, instr+i);
   45.78 +        if (instr+i == instr_pointer(ctx))
   45.79 +            printf("<%02x> ", *c);
   45.80 +        else
   45.81 +            printf("%02x ", *c);
   45.82 +    }
   45.83 +    printf("\n");
   45.84 +
   45.85 +    printf("\n");
   45.86 +}
   45.87 +
   45.88  static void print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width)
   45.89  {
   45.90      guest_word_t stack = stack_pointer(ctx);
   45.91      guest_word_t stack_limit;
   45.92      guest_word_t frame;
   45.93 -    guest_word_t instr;
   45.94      guest_word_t word;
   45.95      guest_word_t *p;
   45.96      int i;
   45.97 @@ -709,19 +748,6 @@ static void print_stack(vcpu_guest_conte
   45.98      }
   45.99      printf("\n");
  45.100  
  45.101 -    printf("Code:\n");
  45.102 -    instr = instr_pointer(ctx) - 21;
  45.103 -    for(i=0; i<32; i++) {
  45.104 -        unsigned char *c = map_page(ctx, vcpu, instr+i);
  45.105 -        if (instr+i == instr_pointer(ctx))
  45.106 -            printf("<%02x> ", *c);
  45.107 -        else
  45.108 -            printf("%02x ", *c);
  45.109 -    }
  45.110 -    printf("\n");
  45.111 -
  45.112 -    printf("\n");
  45.113 -
  45.114      if(stack_trace)
  45.115          printf("Stack Trace:\n");
  45.116      else
  45.117 @@ -830,6 +856,7 @@ static void dump_ctx(int vcpu)
  45.118                  exit(-1);
  45.119              }
  45.120              guest_word_size = (cpuctx.msr_efer & 0x400) ? 8 : 4;
  45.121 +            guest_protected_mode = (cpuctx.cr0 & CR0_PE);
  45.122              /* HVM guest context records are always host-sized */
  45.123              if (xc_version(xc_handle, XENVER_capabilities, &xen_caps) != 0) {
  45.124                  perror("xc_version");
  45.125 @@ -849,6 +876,7 @@ static void dump_ctx(int vcpu)
  45.126  
  45.127      print_ctx(&ctx);
  45.128  #ifndef NO_TRANSLATION
  45.129 +    print_code(&ctx, vcpu);
  45.130      if (is_kernel_text(instr_pointer(&ctx)))
  45.131          print_stack(&ctx, vcpu, guest_word_size);
  45.132  #endif
    46.1 --- a/xen/arch/ia64/linux-xen/acpi.c	Tue Apr 07 11:29:44 2009 +0900
    46.2 +++ b/xen/arch/ia64/linux-xen/acpi.c	Tue Apr 07 11:32:24 2009 +0900
    46.3 @@ -76,11 +76,7 @@ unsigned int acpi_cpei_phys_cpuid;
    46.4  unsigned long acpi_wakeup_address = 0;
    46.5  
    46.6  #ifdef CONFIG_IA64_GENERIC
    46.7 -#ifndef XEN
    46.8  static unsigned long __init acpi_find_rsdp(void)
    46.9 -#else
   46.10 -unsigned long __init acpi_find_rsdp(void)
   46.11 -#endif
   46.12  {
   46.13  	unsigned long rsdp_phys = 0;
   46.14  
    47.1 --- a/xen/arch/x86/Rules.mk	Tue Apr 07 11:29:44 2009 +0900
    47.2 +++ b/xen/arch/x86/Rules.mk	Tue Apr 07 11:32:24 2009 +0900
    47.3 @@ -42,7 +42,7 @@ x86_64 := n
    47.4  endif
    47.5  
    47.6  ifeq ($(TARGET_SUBARCH),x86_64)
    47.7 -CFLAGS += -mno-red-zone -fpic -fno-reorder-blocks
    47.8 +CFLAGS += -mno-red-zone -fpic
    47.9  CFLAGS += -fno-asynchronous-unwind-tables
   47.10  # -fvisibility=hidden reduces -fpic cost, if it's available
   47.11  ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n)
    48.1 --- a/xen/arch/x86/acpi/boot.c	Tue Apr 07 11:29:44 2009 +0900
    48.2 +++ b/xen/arch/x86/acpi/boot.c	Tue Apr 07 11:32:24 2009 +0900
    48.3 @@ -283,25 +283,6 @@ acpi_parse_nmi_src(struct acpi_subtable_
    48.4  
    48.5  #endif /* CONFIG_X86_IO_APIC */
    48.6  
    48.7 -static unsigned long __init
    48.8 -acpi_scan_rsdp(unsigned long start, unsigned long length)
    48.9 -{
   48.10 -	unsigned long offset = 0;
   48.11 -	unsigned long sig_len = sizeof("RSD PTR ") - 1;
   48.12 -
   48.13 -	/*
   48.14 -	 * Scan all 16-byte boundaries of the physical memory region for the
   48.15 -	 * RSDP signature.
   48.16 -	 */
   48.17 -	for (offset = 0; offset < length; offset += 16) {
   48.18 -		if (strncmp((char *)(start + offset), "RSD PTR ", sig_len))
   48.19 -			continue;
   48.20 -		return (start + offset);
   48.21 -	}
   48.22 -
   48.23 -	return 0;
   48.24 -}
   48.25 -
   48.26  static int __init acpi_parse_sbf(struct acpi_table_header *table)
   48.27  {
   48.28  	struct acpi_table_boot *sb;
   48.29 @@ -371,16 +352,9 @@ extern u32 pmtmr_ioport;
   48.30  static void __init
   48.31  acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
   48.32  {
   48.33 -	struct acpi_table_rsdp *rsdp;
   48.34 -	unsigned long rsdp_phys;
   48.35  	struct acpi_table_facs *facs = NULL;
   48.36  	uint64_t facs_pa;
   48.37  
   48.38 -	rsdp_phys = acpi_find_rsdp();
   48.39 -	if (!rsdp_phys || acpi_disabled)
   48.40 -		goto bad;
   48.41 -	rsdp = __va(rsdp_phys);
   48.42 -
   48.43  	acpi_fadt_copy_address(pm1a_cnt, pm1a_control, pm1_control);
   48.44  	acpi_fadt_copy_address(pm1b_cnt, pm1b_control, pm1_control);
   48.45  	acpi_fadt_copy_address(pm1a_evt, pm1a_event, pm1_event);
   48.46 @@ -483,29 +457,6 @@ static int __init acpi_parse_fadt(struct
   48.47  	return 0;
   48.48  }
   48.49  
   48.50 -unsigned long __init acpi_find_rsdp(void)
   48.51 -{
   48.52 -	unsigned long rsdp_phys = 0;
   48.53 -
   48.54 -#if 0
   48.55 -	if (efi_enabled) {
   48.56 -		if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
   48.57 -			return efi.acpi20;
   48.58 -		else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
   48.59 -			return efi.acpi;
   48.60 -	}
   48.61 -#endif
   48.62 -	/*
   48.63 -	 * Scan memory looking for the RSDP signature. First search EBDA (low
   48.64 -	 * memory) paragraphs and then search upper memory (E0000-FFFFF).
   48.65 -	 */
   48.66 -	rsdp_phys = acpi_scan_rsdp(0, 0x400);
   48.67 -	if (!rsdp_phys)
   48.68 -		rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000);
   48.69 -
   48.70 -	return rsdp_phys;
   48.71 -}
   48.72 -
   48.73  #ifdef	CONFIG_X86_LOCAL_APIC
   48.74  /*
   48.75   * Parse LAPIC entries in MADT
    49.1 --- a/xen/arch/x86/acpi/cpu_idle.c	Tue Apr 07 11:29:44 2009 +0900
    49.2 +++ b/xen/arch/x86/acpi/cpu_idle.c	Tue Apr 07 11:32:24 2009 +0900
    49.3 @@ -195,6 +195,15 @@ static void acpi_processor_idle(void)
    49.4      int sleep_ticks = 0;
    49.5      u32 t1, t2 = 0;
    49.6  
    49.7 +    sched_tick_suspend();
    49.8 +    /*
    49.9 +     * sched_tick_suspend may raise TIMER_SOFTIRQ by __stop_timer,
   49.10 +     * which will break the later assumption of no sofirq pending,
   49.11 +     * so add do_softirq
   49.12 +     */
   49.13 +    if ( softirq_pending(smp_processor_id()) )
   49.14 +        do_softirq();
   49.15 +
   49.16      /*
   49.17       * Interrupts must be disabled during bus mastering calculations and
   49.18       * for C2/C3 transitions.
   49.19 @@ -204,6 +213,7 @@ static void acpi_processor_idle(void)
   49.20      if ( softirq_pending(smp_processor_id()) )
   49.21      {
   49.22          local_irq_enable();
   49.23 +        sched_tick_resume();
   49.24          return;
   49.25      }
   49.26  
   49.27 @@ -223,6 +233,7 @@ static void acpi_processor_idle(void)
   49.28              pm_idle_save();
   49.29          else
   49.30              acpi_safe_halt();
   49.31 +        sched_tick_resume();
   49.32          return;
   49.33      }
   49.34  
   49.35 @@ -329,6 +340,7 @@ static void acpi_processor_idle(void)
   49.36  
   49.37      default:
   49.38          local_irq_enable();
   49.39 +        sched_tick_resume();
   49.40          return;
   49.41      }
   49.42  
   49.43 @@ -339,6 +351,8 @@ static void acpi_processor_idle(void)
   49.44          cx->time += sleep_ticks;
   49.45      }
   49.46  
   49.47 +    sched_tick_resume();
   49.48 +
   49.49      if ( cpuidle_current_governor->reflect )
   49.50          cpuidle_current_governor->reflect(power);
   49.51  }
    50.1 --- a/xen/arch/x86/acpi/suspend.c	Tue Apr 07 11:29:44 2009 +0900
    50.2 +++ b/xen/arch/x86/acpi/suspend.c	Tue Apr 07 11:32:24 2009 +0900
    50.3 @@ -16,6 +16,7 @@
    50.4  
    50.5  #if defined(CONFIG_X86_64)
    50.6  static unsigned long saved_lstar, saved_cstar;
    50.7 +static unsigned long saved_sysenter_esp, saved_sysenter_eip;
    50.8  #endif
    50.9  
   50.10  void save_rest_processor_state(void)
   50.11 @@ -26,6 +27,11 @@ void save_rest_processor_state(void)
   50.12  #if defined(CONFIG_X86_64)
   50.13      rdmsrl(MSR_CSTAR, saved_cstar);
   50.14      rdmsrl(MSR_LSTAR, saved_lstar);
   50.15 +    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
   50.16 +    {
   50.17 +        rdmsrl(MSR_IA32_SYSENTER_ESP, saved_sysenter_esp);
   50.18 +        rdmsrl(MSR_IA32_SYSENTER_EIP, saved_sysenter_eip);
   50.19 +    }
   50.20  #endif
   50.21  }
   50.22  
   50.23 @@ -41,6 +47,14 @@ void restore_rest_processor_state(void)
   50.24      wrmsrl(MSR_CSTAR, saved_cstar);
   50.25      wrmsr(MSR_STAR, 0, (FLAT_RING3_CS32<<16) | __HYPERVISOR_CS);
   50.26      wrmsr(MSR_SYSCALL_MASK, EF_VM|EF_RF|EF_NT|EF_DF|EF_IE|EF_TF, 0U);    
   50.27 +
   50.28 +    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
   50.29 +    {
   50.30 +        /* Recover sysenter MSRs */
   50.31 +        wrmsrl(MSR_IA32_SYSENTER_ESP, saved_sysenter_esp);
   50.32 +        wrmsrl(MSR_IA32_SYSENTER_EIP, saved_sysenter_eip);
   50.33 +        wrmsr(MSR_IA32_SYSENTER_CS, __HYPERVISOR_CS, 0);
   50.34 +    }
   50.35  #else /* !defined(CONFIG_X86_64) */
   50.36      if ( supervisor_mode_kernel && cpu_has_sep )
   50.37          wrmsr(MSR_IA32_SYSENTER_ESP, &init_tss[smp_processor_id()].esp1, 0);
    51.1 --- a/xen/arch/x86/apic.c	Tue Apr 07 11:29:44 2009 +0900
    51.2 +++ b/xen/arch/x86/apic.c	Tue Apr 07 11:32:24 2009 +0900
    51.3 @@ -1303,8 +1303,10 @@ int __init APIC_init_uniprocessor (void)
    51.4      if (enable_local_apic < 0)
    51.5          clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
    51.6  
    51.7 -    if (!smp_found_config && !cpu_has_apic)
    51.8 +    if (!smp_found_config && !cpu_has_apic) {
    51.9 +        skip_ioapic_setup = 1;
   51.10          return -1;
   51.11 +    }
   51.12  
   51.13      /*
   51.14       * Complain if the BIOS pretends there is one.
   51.15 @@ -1313,6 +1315,7 @@ int __init APIC_init_uniprocessor (void)
   51.16          printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
   51.17                 boot_cpu_physical_apicid);
   51.18          clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
   51.19 +        skip_ioapic_setup = 1;
   51.20          return -1;
   51.21      }
   51.22  
    52.1 --- a/xen/arch/x86/cpu/mcheck/mce.c	Tue Apr 07 11:29:44 2009 +0900
    52.2 +++ b/xen/arch/x86/cpu/mcheck/mce.c	Tue Apr 07 11:32:24 2009 +0900
    52.3 @@ -577,6 +577,7 @@ void mcheck_init(struct cpuinfo_x86 *c)
    52.4  		break;
    52.5  	}
    52.6  
    52.7 +    set_poll_bankmask(c);
    52.8  	if (!inited)
    52.9  		printk(XENLOG_INFO "CPU%i: No machine check initialization\n",
   52.10  		    smp_processor_id());
   52.11 @@ -984,14 +985,76 @@ static void x86_mc_mceinject(void *data)
   52.12  #error BITS_PER_LONG definition absent
   52.13  #endif
   52.14  
   52.15 +#ifdef CONFIG_COMPAT
   52.16 +# include <compat/arch-x86/xen-mca.h>
   52.17 +
   52.18 +# define xen_mcinfo_msr              mcinfo_msr
   52.19 +CHECK_mcinfo_msr;
   52.20 +# undef xen_mcinfo_msr
   52.21 +# undef CHECK_mcinfo_msr
   52.22 +# define CHECK_mcinfo_msr            struct mcinfo_msr
   52.23 +
   52.24 +# define xen_mcinfo_common           mcinfo_common
   52.25 +CHECK_mcinfo_common;
   52.26 +# undef xen_mcinfo_common
   52.27 +# undef CHECK_mcinfo_common
   52.28 +# define CHECK_mcinfo_common         struct mcinfo_common
   52.29 +
   52.30 +CHECK_FIELD_(struct, mc_fetch, flags);
   52.31 +CHECK_FIELD_(struct, mc_fetch, fetch_id);
   52.32 +# define CHECK_compat_mc_fetch       struct mc_fetch
   52.33 +
   52.34 +CHECK_FIELD_(struct, mc_physcpuinfo, ncpus);
   52.35 +# define CHECK_compat_mc_physcpuinfo struct mc_physcpuinfo
   52.36 +
   52.37 +CHECK_mc;
   52.38 +# undef CHECK_compat_mc_fetch
   52.39 +# undef CHECK_compat_mc_physcpuinfo
   52.40 +
   52.41 +# define xen_mc_info                 mc_info
   52.42 +CHECK_mc_info;
   52.43 +# undef xen_mc_info
   52.44 +
   52.45 +# define xen_mcinfo_global           mcinfo_global
   52.46 +CHECK_mcinfo_global;
   52.47 +# undef xen_mcinfo_global
   52.48 +
   52.49 +# define xen_mcinfo_bank             mcinfo_bank
   52.50 +CHECK_mcinfo_bank;
   52.51 +# undef xen_mcinfo_bank
   52.52 +
   52.53 +# define xen_mcinfo_extended         mcinfo_extended
   52.54 +CHECK_mcinfo_extended;
   52.55 +# undef xen_mcinfo_extended
   52.56 +
   52.57 +# define xen_mcinfo_recovery         mcinfo_recovery
   52.58 +# define xen_cpu_offline_action      cpu_offline_action
   52.59 +# define xen_page_offline_action     page_offline_action
   52.60 +CHECK_mcinfo_recovery;
   52.61 +# undef xen_cpu_offline_action
   52.62 +# undef xen_page_offline_action
   52.63 +# undef xen_mcinfo_recovery
   52.64 +#else
   52.65 +# define compat_mc_fetch xen_mc_fetch
   52.66 +# define compat_mc_physcpuinfo xen_mc_physcpuinfo
   52.67 +# define compat_handle_is_null guest_handle_is_null
   52.68 +# define copy_to_compat copy_to_guest
   52.69 +#endif
   52.70 +
   52.71  /* Machine Check Architecture Hypercall */
   52.72  long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u_xen_mc)
   52.73  {
   52.74  	long ret = 0;
   52.75  	struct xen_mc curop, *op = &curop;
   52.76  	struct vcpu *v = current;
   52.77 -	struct xen_mc_fetch *mc_fetch;
   52.78 -	struct xen_mc_physcpuinfo *mc_physcpuinfo;
   52.79 +	union {
   52.80 +		struct xen_mc_fetch *nat;
   52.81 +		struct compat_mc_fetch *cmp;
   52.82 +	} mc_fetch;
   52.83 +	union {
   52.84 +		struct xen_mc_physcpuinfo *nat;
   52.85 +		struct compat_mc_physcpuinfo *cmp;
   52.86 +	} mc_physcpuinfo;
   52.87  	uint32_t flags, cmdflags;
   52.88  	int nlcpu;
   52.89  	xen_mc_logical_cpu_t *log_cpus = NULL;
   52.90 @@ -1009,8 +1072,8 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
   52.91  
   52.92  	switch (op->cmd) {
   52.93  	case XEN_MC_fetch:
   52.94 -		mc_fetch = &op->u.mc_fetch;
   52.95 -		cmdflags = mc_fetch->flags;
   52.96 +		mc_fetch.nat = &op->u.mc_fetch;
   52.97 +		cmdflags = mc_fetch.nat->flags;
   52.98  
   52.99  		/* This hypercall is for Dom0 only */
  52.100  		if (!IS_PRIV(v->domain) )
  52.101 @@ -1032,30 +1095,35 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
  52.102  		flags = XEN_MC_OK;
  52.103  
  52.104  		if (cmdflags & XEN_MC_ACK) {
  52.105 -			mctelem_cookie_t cookie = ID2COOKIE(mc_fetch->fetch_id);
  52.106 +			mctelem_cookie_t cookie = ID2COOKIE(mc_fetch.nat->fetch_id);
  52.107  			mctelem_ack(which, cookie);
  52.108  		} else {
  52.109 -			if (guest_handle_is_null(mc_fetch->data))
  52.110 +			if (!is_pv_32on64_vcpu(v)
  52.111 +			    ? guest_handle_is_null(mc_fetch.nat->data)
  52.112 +			    : compat_handle_is_null(mc_fetch.cmp->data))
  52.113  				return x86_mcerr("do_mca fetch: guest buffer "
  52.114  				    "invalid", -EINVAL);
  52.115  
  52.116  			if ((mctc = mctelem_consume_oldest_begin(which))) {
  52.117  				struct mc_info *mcip = mctelem_dataptr(mctc);
  52.118 -				if (copy_to_guest(mc_fetch->data, mcip, 1)) {
  52.119 +				if (!is_pv_32on64_vcpu(v)
  52.120 +				    ? copy_to_guest(mc_fetch.nat->data, mcip, 1)
  52.121 +				    : copy_to_compat(mc_fetch.cmp->data,
  52.122 +						     mcip, 1)) {
  52.123  					ret = -EFAULT;
  52.124  					flags |= XEN_MC_FETCHFAILED;
  52.125 -					mc_fetch->fetch_id = 0;
  52.126 +					mc_fetch.nat->fetch_id = 0;
  52.127  				} else {
  52.128 -					mc_fetch->fetch_id = COOKIE2ID(mctc);
  52.129 +					mc_fetch.nat->fetch_id = COOKIE2ID(mctc);
  52.130  				}
  52.131  				mctelem_consume_oldest_end(mctc);
  52.132  			} else {
  52.133  				/* There is no data */
  52.134  				flags |= XEN_MC_NODATA;
  52.135 -				mc_fetch->fetch_id = 0;
  52.136 +				mc_fetch.nat->fetch_id = 0;
  52.137  			}
  52.138  
  52.139 -			mc_fetch->flags = flags;
  52.140 +			mc_fetch.nat->flags = flags;
  52.141  			if (copy_to_guest(u_xen_mc, op, 1) != 0)
  52.142  				ret = -EFAULT;
  52.143  		}
  52.144 @@ -1069,14 +1137,16 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
  52.145  		if ( !IS_PRIV(v->domain) )
  52.146  			return x86_mcerr("do_mca cpuinfo", -EPERM);
  52.147  
  52.148 -		mc_physcpuinfo = &op->u.mc_physcpuinfo;
  52.149 +		mc_physcpuinfo.nat = &op->u.mc_physcpuinfo;
  52.150  		nlcpu = num_online_cpus();
  52.151  
  52.152 -		if (!guest_handle_is_null(mc_physcpuinfo->info)) {
  52.153 -			if (mc_physcpuinfo->ncpus <= 0)
  52.154 +		if (!is_pv_32on64_vcpu(v)
  52.155 +		    ? !guest_handle_is_null(mc_physcpuinfo.nat->info)
  52.156 +		    : !compat_handle_is_null(mc_physcpuinfo.cmp->info)) {
  52.157 +			if (mc_physcpuinfo.nat->ncpus <= 0)
  52.158  				return x86_mcerr("do_mca cpuinfo: ncpus <= 0",
  52.159  				    -EINVAL);
  52.160 -			nlcpu = min(nlcpu, (int)mc_physcpuinfo->ncpus);
  52.161 +			nlcpu = min(nlcpu, (int)mc_physcpuinfo.nat->ncpus);
  52.162  			log_cpus = xmalloc_array(xen_mc_logical_cpu_t, nlcpu);
  52.163  			if (log_cpus == NULL)
  52.164  				return x86_mcerr("do_mca cpuinfo", -ENOMEM);
  52.165 @@ -1086,22 +1156,20 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
  52.166  				xfree(log_cpus);
  52.167  				return x86_mcerr("do_mca cpuinfo", -EIO);
  52.168  			}
  52.169 -		}
  52.170 -
  52.171 -		mc_physcpuinfo->ncpus = nlcpu;
  52.172 -
  52.173 -		if (copy_to_guest(u_xen_mc, op, 1)) {
  52.174 -			if (log_cpus != NULL)
  52.175 -				xfree(log_cpus);
  52.176 -			return x86_mcerr("do_mca cpuinfo", -EFAULT);
  52.177 -		}
  52.178 -
  52.179 -		if (!guest_handle_is_null(mc_physcpuinfo->info)) {
  52.180 -			if (copy_to_guest(mc_physcpuinfo->info,
  52.181 -			    log_cpus, nlcpu))
  52.182 +			if (!is_pv_32on64_vcpu(v)
  52.183 +			    ? copy_to_guest(mc_physcpuinfo.nat->info,
  52.184 +					    log_cpus, nlcpu)
  52.185 +			    : copy_to_compat(mc_physcpuinfo.cmp->info,
  52.186 +					    log_cpus, nlcpu))
  52.187  				ret = -EFAULT;
  52.188  			xfree(log_cpus);
  52.189  		}
  52.190 +
  52.191 +		mc_physcpuinfo.nat->ncpus = nlcpu;
  52.192 +
  52.193 +		if (copy_to_guest(u_xen_mc, op, 1))
  52.194 +			return x86_mcerr("do_mca cpuinfo", -EFAULT);
  52.195 +
  52.196  		break;
  52.197  
  52.198  	case XEN_MC_msrinject:
  52.199 @@ -1163,7 +1231,19 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u
  52.200  
  52.201  	return ret;
  52.202  }
  52.203 +void set_poll_bankmask(struct cpuinfo_x86 *c)
  52.204 +{
  52.205  
  52.206 +    if (cmci_support && !mce_disabled) {
  52.207 +        memcpy(&(__get_cpu_var(poll_bankmask)),
  52.208 +                &(__get_cpu_var(no_cmci_banks)), sizeof(cpu_banks_t));
  52.209 +    }
  52.210 +    else {
  52.211 +        memcpy(&(get_cpu_var(poll_bankmask)), &mca_allbanks, sizeof(cpu_banks_t));
  52.212 +        if (mce_firstbank(c))
  52.213 +            clear_bit(0, get_cpu_var(poll_bankmask));
  52.214 +    }
  52.215 +}
  52.216  void mc_panic(char *s)
  52.217  {
  52.218      console_start_sync();
    53.1 --- a/xen/arch/x86/cpu/mcheck/mce.h	Tue Apr 07 11:29:44 2009 +0900
    53.2 +++ b/xen/arch/x86/cpu/mcheck/mce.h	Tue Apr 07 11:32:24 2009 +0900
    53.3 @@ -88,6 +88,10 @@ struct mca_summary {
    53.4  };
    53.5  
    53.6  extern cpu_banks_t mca_allbanks;
    53.7 +void set_poll_bankmask(struct cpuinfo_x86 *c);
    53.8 +DECLARE_PER_CPU(cpu_banks_t, poll_bankmask);
    53.9 +DECLARE_PER_CPU(cpu_banks_t, no_cmci_banks);
   53.10 +extern int cmci_support;
   53.11  
   53.12  extern mctelem_cookie_t mcheck_mca_logout(enum mca_source, cpu_banks_t,
   53.13      struct mca_summary *);
    54.1 --- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Tue Apr 07 11:29:44 2009 +0900
    54.2 +++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Tue Apr 07 11:32:24 2009 +0900
    54.3 @@ -12,9 +12,10 @@
    54.4  #include "x86_mca.h"
    54.5  
    54.6  DEFINE_PER_CPU(cpu_banks_t, mce_banks_owned);
    54.7 +DEFINE_PER_CPU(cpu_banks_t, no_cmci_banks);
    54.8 +int cmci_support = 0;
    54.9  
   54.10  static int nr_intel_ext_msrs = 0;
   54.11 -static int cmci_support = 0;
   54.12  static int firstbank;
   54.13  
   54.14  #ifdef CONFIG_X86_MCE_THERMAL
   54.15 @@ -117,6 +118,16 @@ static void intel_init_thermal(struct cp
   54.16  }
   54.17  #endif /* CONFIG_X86_MCE_THERMAL */
   54.18  
   54.19 +static inline void intel_get_extended_msr(struct mcinfo_extended *ext, u32 msr)
   54.20 +{
   54.21 +    if ( ext->mc_msrs < ARRAY_SIZE(ext->mc_msr)
   54.22 +         && msr < MSR_IA32_MCG_EAX + nr_intel_ext_msrs ) {
   54.23 +        ext->mc_msr[ext->mc_msrs].reg = msr;
   54.24 +        rdmsrl(msr, ext->mc_msr[ext->mc_msrs].value);
   54.25 +        ++ext->mc_msrs;
   54.26 +    }
   54.27 +}
   54.28 +
   54.29  static enum mca_extinfo
   54.30  intel_get_extended_msrs(struct mc_info *mci, uint16_t bank, uint64_t status)
   54.31  {
   54.32 @@ -129,30 +140,29 @@ intel_get_extended_msrs(struct mc_info *
   54.33      memset(&mc_ext, 0, sizeof(struct mcinfo_extended));
   54.34      mc_ext.common.type = MC_TYPE_EXTENDED;
   54.35      mc_ext.common.size = sizeof(mc_ext);
   54.36 -    mc_ext.mc_msrs = 10;
   54.37 -
   54.38 -    mc_ext.mc_msr[0].reg = MSR_IA32_MCG_EAX;
   54.39 -    rdmsrl(MSR_IA32_MCG_EAX, mc_ext.mc_msr[0].value);
   54.40 -    mc_ext.mc_msr[1].reg = MSR_IA32_MCG_EBX;
   54.41 -    rdmsrl(MSR_IA32_MCG_EBX, mc_ext.mc_msr[1].value);
   54.42 -    mc_ext.mc_msr[2].reg = MSR_IA32_MCG_ECX;
   54.43 -    rdmsrl(MSR_IA32_MCG_ECX, mc_ext.mc_msr[2].value);
   54.44  
   54.45 -    mc_ext.mc_msr[3].reg = MSR_IA32_MCG_EDX;
   54.46 -    rdmsrl(MSR_IA32_MCG_EDX, mc_ext.mc_msr[3].value);
   54.47 -    mc_ext.mc_msr[4].reg = MSR_IA32_MCG_ESI;
   54.48 -    rdmsrl(MSR_IA32_MCG_ESI, mc_ext.mc_msr[4].value);
   54.49 -    mc_ext.mc_msr[5].reg = MSR_IA32_MCG_EDI;
   54.50 -    rdmsrl(MSR_IA32_MCG_EDI, mc_ext.mc_msr[5].value);
   54.51 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_EAX);
   54.52 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_EBX);
   54.53 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_ECX);
   54.54 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_EDX);
   54.55 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_ESI);
   54.56 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_EDI);
   54.57 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_EBP);
   54.58 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_ESP);
   54.59 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_EFLAGS);
   54.60 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_EIP);
   54.61 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_MISC);
   54.62  
   54.63 -    mc_ext.mc_msr[6].reg = MSR_IA32_MCG_EBP;
   54.64 -    rdmsrl(MSR_IA32_MCG_EBP, mc_ext.mc_msr[6].value);
   54.65 -    mc_ext.mc_msr[7].reg = MSR_IA32_MCG_ESP;
   54.66 -    rdmsrl(MSR_IA32_MCG_ESP, mc_ext.mc_msr[7].value);
   54.67 -    mc_ext.mc_msr[8].reg = MSR_IA32_MCG_EFLAGS;
   54.68 -    rdmsrl(MSR_IA32_MCG_EFLAGS, mc_ext.mc_msr[8].value);
   54.69 -    mc_ext.mc_msr[9].reg = MSR_IA32_MCG_EIP;
   54.70 -    rdmsrl(MSR_IA32_MCG_EIP, mc_ext.mc_msr[9].value);
   54.71 +#ifdef __x86_64__
   54.72 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_R8);
   54.73 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_R9);
   54.74 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_R10);
   54.75 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_R11);
   54.76 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_R12);
   54.77 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_R13);
   54.78 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_R14);
   54.79 +    intel_get_extended_msr(&mc_ext, MSR_IA32_MCG_R15);
   54.80 +#endif
   54.81  
   54.82      x86_mcinfo_add(mci, &mc_ext);
   54.83  
   54.84 @@ -426,7 +436,7 @@ static void severity_scan(void)
   54.85       * recovered, we need to RESET for avoiding DOM0 LOG missing
   54.86       */
   54.87      for ( i = 0; i < nr_mce_banks; i++) {
   54.88 -        rdmsrl(MSR_IA32_MC0_STATUS + 4 * i , status);
   54.89 +        mca_rdmsrl(MSR_IA32_MC0_STATUS + 4 * i , status);
   54.90          if ( !(status & MCi_STATUS_VAL) )
   54.91              continue;
   54.92          /* MCE handler only handles UC error */
   54.93 @@ -434,7 +444,12 @@ static void severity_scan(void)
   54.94              continue;
   54.95          if ( !(status & MCi_STATUS_EN) )
   54.96              continue;
   54.97 -        if (status & MCi_STATUS_PCC)
   54.98 +        /*
   54.99 +         * If this was an injected error, keep going, since the
  54.100 +         * interposed value will be lost at reboot.
  54.101 +         */
  54.102 +        if (status & MCi_STATUS_PCC && intpose_lookup(smp_processor_id(),
  54.103 +          MSR_IA32_MC0_STATUS + 4 * i, NULL) == NULL)
  54.104              mc_panic("pcc = 1, cpu unable to continue\n");
  54.105      }
  54.106  
  54.107 @@ -519,8 +534,8 @@ static void intel_machine_check(struct c
  54.108  
  54.109      /* Pick one CPU to clear MCIP */
  54.110      if (!test_and_set_bool(mce_process_lock)) {
  54.111 -        rdmsrl(MSR_IA32_MCG_STATUS, gstatus);
  54.112 -        wrmsrl(MSR_IA32_MCG_STATUS, gstatus & ~MCG_STATUS_MCIP);
  54.113 +        mca_rdmsrl(MSR_IA32_MCG_STATUS, gstatus);
  54.114 +        mca_wrmsrl(MSR_IA32_MCG_STATUS, gstatus & ~MCG_STATUS_MCIP);
  54.115  
  54.116          if (worst >= 3) {
  54.117              printk(KERN_WARNING "worst=3 should have caused RESET\n");
  54.118 @@ -534,7 +549,6 @@ static void intel_machine_check(struct c
  54.119  }
  54.120  
  54.121  static DEFINE_SPINLOCK(cmci_discover_lock);
  54.122 -static DEFINE_PER_CPU(cpu_banks_t, no_cmci_banks);
  54.123  
  54.124  /*
  54.125   * Discover bank sharing using the algorithm recommended in the SDM.
  54.126 @@ -728,7 +742,7 @@ void mce_intel_feature_init(struct cpuin
  54.127      intel_init_cmci(c);
  54.128  }
  54.129  
  54.130 -uint64_t g_mcg_cap;
  54.131 +static uint64_t g_mcg_cap;
  54.132  static void mce_cap_init(struct cpuinfo_x86 *c)
  54.133  {
  54.134      u32 l, h;
  54.135 @@ -740,9 +754,12 @@ static void mce_cap_init(struct cpuinfo_
  54.136      if ((l & MCG_CMCI_P) && cpu_has_apic)
  54.137          cmci_support = 1;
  54.138  
  54.139 -    nr_mce_banks = l & 0xff;
  54.140 +    nr_mce_banks = l & MCG_CAP_COUNT;
  54.141      if (nr_mce_banks > MAX_NR_BANKS)
  54.142 +    {
  54.143          printk(KERN_WARNING "MCE: exceed max mce banks\n");
  54.144 +        g_mcg_cap = (g_mcg_cap & ~MCG_CAP_COUNT) | MAX_NR_BANKS;
  54.145 +    }
  54.146      if (l & MCG_EXT_P)
  54.147      {
  54.148          nr_intel_ext_msrs = (l >> MCG_EXT_CNT) & 0xff;
  54.149 @@ -814,11 +831,22 @@ int intel_mcheck_init(struct cpuinfo_x86
  54.150  }
  54.151  
  54.152  /* Guest vMCE# MSRs virtualization ops (rdmsr/wrmsr) */
  54.153 -int intel_mce_wrmsr(u32 msr, u32 lo, u32 hi)
  54.154 +void intel_mce_init_msr(struct domain *d)
  54.155 +{
  54.156 +    d->arch.vmca_msrs.mcg_status = 0x0;
  54.157 +    d->arch.vmca_msrs.mcg_cap = g_mcg_cap;
  54.158 +    d->arch.vmca_msrs.mcg_ctl = (uint64_t)~0x0;
  54.159 +    d->arch.vmca_msrs.nr_injection = 0;
  54.160 +    memset(d->arch.vmca_msrs.mci_ctl, ~0,
  54.161 +           sizeof(d->arch.vmca_msrs.mci_ctl));
  54.162 +    INIT_LIST_HEAD(&d->arch.vmca_msrs.impact_header);
  54.163 +}
  54.164 +
  54.165 +int intel_mce_wrmsr(u32 msr, u64 value)
  54.166  {
  54.167      struct domain *d = current->domain;
  54.168      struct bank_entry *entry = NULL;
  54.169 -    uint64_t value = (u64)hi << 32 | lo;
  54.170 +    unsigned int bank;
  54.171      int ret = 1;
  54.172  
  54.173      spin_lock(&mce_locks);
  54.174 @@ -826,86 +854,71 @@ int intel_mce_wrmsr(u32 msr, u32 lo, u32
  54.175      {
  54.176      case MSR_IA32_MCG_CTL:
  54.177          if (value != (u64)~0x0 && value != 0x0) {
  54.178 -            gdprintk(XENLOG_WARNING, "MCE: value writen to MCG_CTL"
  54.179 +            gdprintk(XENLOG_WARNING, "MCE: value written to MCG_CTL"
  54.180                       "should be all 0s or 1s\n");
  54.181              ret = -1;
  54.182              break;
  54.183          }
  54.184 -        if (!d || is_idle_domain(d)) {
  54.185 -            gdprintk(XENLOG_WARNING, "MCE: wrmsr not in DOM context, skip\n");
  54.186 -            break;
  54.187 -        }
  54.188          d->arch.vmca_msrs.mcg_ctl = value;
  54.189          break;
  54.190      case MSR_IA32_MCG_STATUS:
  54.191 -        if (!d || is_idle_domain(d)) {
  54.192 -            gdprintk(XENLOG_WARNING, "MCE: wrmsr not in DOM context, skip\n");
  54.193 -            break;
  54.194 -        }
  54.195          d->arch.vmca_msrs.mcg_status = value;
  54.196          gdprintk(XENLOG_DEBUG, "MCE: wrmsr MCG_CTL %"PRIx64"\n", value);
  54.197          break;
  54.198 -    case MSR_IA32_MC0_CTL2:
  54.199 -    case MSR_IA32_MC1_CTL2:
  54.200 -    case MSR_IA32_MC2_CTL2:
  54.201 -    case MSR_IA32_MC3_CTL2:
  54.202 -    case MSR_IA32_MC4_CTL2:
  54.203 -    case MSR_IA32_MC5_CTL2:
  54.204 -    case MSR_IA32_MC6_CTL2:
  54.205 -    case MSR_IA32_MC7_CTL2:
  54.206 -    case MSR_IA32_MC8_CTL2:
  54.207 +    case MSR_IA32_MCG_CAP:
  54.208 +        gdprintk(XENLOG_WARNING, "MCE: MCG_CAP is read-only\n");
  54.209 +        ret = -1;
  54.210 +        break;
  54.211 +    case MSR_IA32_MC0_CTL2 ... MSR_IA32_MC0_CTL2 + MAX_NR_BANKS - 1:
  54.212          gdprintk(XENLOG_WARNING, "We have disabled CMCI capability, "
  54.213                   "Guest should not write this MSR!\n");
  54.214          break;
  54.215 -    case MSR_IA32_MC0_CTL:
  54.216 -    case MSR_IA32_MC1_CTL:
  54.217 -    case MSR_IA32_MC2_CTL:
  54.218 -    case MSR_IA32_MC3_CTL:
  54.219 -    case MSR_IA32_MC4_CTL:
  54.220 -    case MSR_IA32_MC5_CTL:
  54.221 -    case MSR_IA32_MC6_CTL:
  54.222 -    case MSR_IA32_MC7_CTL:
  54.223 -    case MSR_IA32_MC8_CTL:
  54.224 -        if (value != (u64)~0x0 && value != 0x0) {
  54.225 -            gdprintk(XENLOG_WARNING, "MCE: value writen to MCi_CTL"
  54.226 -                     "should be all 0s or 1s\n");
  54.227 +    case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * MAX_NR_BANKS - 1:
  54.228 +        bank = (msr - MSR_IA32_MC0_CTL) / 4;
  54.229 +        if (bank >= (d->arch.vmca_msrs.mcg_cap & MCG_CAP_COUNT)) {
  54.230 +            gdprintk(XENLOG_WARNING, "MCE: bank %u does not exist\n", bank);
  54.231              ret = -1;
  54.232              break;
  54.233          }
  54.234 -        if (!d || is_idle_domain(d)) {
  54.235 -            gdprintk(XENLOG_WARNING, "MCE: wrmsr not in DOM context, skip\n");
  54.236 +        switch (msr & (MSR_IA32_MC0_CTL | 3))
  54.237 +        {
  54.238 +        case MSR_IA32_MC0_CTL:
  54.239 +            if (value != (u64)~0x0 && value != 0x0) {
  54.240 +                gdprintk(XENLOG_WARNING, "MCE: value written to MC%u_CTL"
  54.241 +                         "should be all 0s or 1s (is %"PRIx64")\n",
  54.242 +                         bank, value);
  54.243 +                ret = -1;
  54.244 +                break;
  54.245 +            }
  54.246 +            d->arch.vmca_msrs.mci_ctl[(msr - MSR_IA32_MC0_CTL)/4] = value;
  54.247 +            break;
  54.248 +        case MSR_IA32_MC0_STATUS:
  54.249 +            /* Give the first entry of the list, it corresponds to current
  54.250 +             * vMCE# injection. When vMCE# is finished processing by the
  54.251 +             * the guest, this node will be deleted.
  54.252 +             * Only error bank is written. Non-error banks simply return.
  54.253 +             */
  54.254 +            if (!list_empty(&d->arch.vmca_msrs.impact_header)) {
  54.255 +                entry = list_entry(d->arch.vmca_msrs.impact_header.next,
  54.256 +                                   struct bank_entry, list);
  54.257 +                if ( entry->bank == bank )
  54.258 +                    entry->mci_status = value;
  54.259 +                gdprintk(XENLOG_DEBUG,
  54.260 +                         "MCE: wr MC%u_STATUS %"PRIx64" in vMCE#\n",
  54.261 +                         bank, value);
  54.262 +            } else
  54.263 +                gdprintk(XENLOG_DEBUG,
  54.264 +                         "MCE: wr MC%u_STATUS %"PRIx64"\n", bank, value);
  54.265 +            break;
  54.266 +        case MSR_IA32_MC0_ADDR:
  54.267 +            gdprintk(XENLOG_WARNING, "MCE: MC%u_ADDR is read-only\n", bank);
  54.268 +            ret = -1;
  54.269 +            break;
  54.270 +        case MSR_IA32_MC0_MISC:
  54.271 +            gdprintk(XENLOG_WARNING, "MCE: MC%u_MISC is read-only\n", bank);
  54.272 +            ret = -1;
  54.273              break;
  54.274          }
  54.275 -        d->arch.vmca_msrs.mci_ctl[(msr - MSR_IA32_MC0_CTL)/4] = value;
  54.276 -        break;
  54.277 -    case MSR_IA32_MC0_STATUS:
  54.278 -    case MSR_IA32_MC1_STATUS:
  54.279 -    case MSR_IA32_MC2_STATUS:
  54.280 -    case MSR_IA32_MC3_STATUS:
  54.281 -    case MSR_IA32_MC4_STATUS:
  54.282 -    case MSR_IA32_MC5_STATUS:
  54.283 -    case MSR_IA32_MC6_STATUS:
  54.284 -    case MSR_IA32_MC7_STATUS:
  54.285 -    case MSR_IA32_MC8_STATUS:
  54.286 -        if (!d || is_idle_domain(d)) {
  54.287 -            /* Just skip */
  54.288 -            gdprintk(XENLOG_WARNING, "mce wrmsr: not in domain context!\n");
  54.289 -            break;
  54.290 -        }
  54.291 -        /* Give the first entry of the list, it corresponds to current
  54.292 -         * vMCE# injection. When vMCE# is finished processing by the
  54.293 -         * the guest, this node will be deleted.
  54.294 -         * Only error bank is written. Non-error bank simply return.
  54.295 -         */
  54.296 -        if ( !list_empty(&d->arch.vmca_msrs.impact_header) ) {
  54.297 -            entry = list_entry(d->arch.vmca_msrs.impact_header.next,
  54.298 -                               struct bank_entry, list);
  54.299 -            if ( entry->bank == (msr - MSR_IA32_MC0_STATUS)/4 ) {
  54.300 -                entry->mci_status = value;
  54.301 -            }
  54.302 -            gdprintk(XENLOG_DEBUG, "MCE: wmrsr mci_status in vMCE# context\n");
  54.303 -        }
  54.304 -        gdprintk(XENLOG_DEBUG, "MCE: wrmsr mci_status val:%"PRIx64"\n", value);
  54.305          break;
  54.306      default:
  54.307          ret = 0;
  54.308 @@ -919,6 +932,7 @@ int intel_mce_rdmsr(u32 msr, u32 *lo, u3
  54.309  {
  54.310      struct domain *d = current->domain;
  54.311      int ret = 1;
  54.312 +    unsigned int bank;
  54.313      struct bank_entry *entry = NULL;
  54.314  
  54.315      *lo = *hi = 0x0;
  54.316 @@ -926,142 +940,82 @@ int intel_mce_rdmsr(u32 msr, u32 *lo, u3
  54.317      switch(msr)
  54.318      {
  54.319      case MSR_IA32_MCG_STATUS:
  54.320 -        if (!d || is_idle_domain(d)) {
  54.321 -            gdprintk(XENLOG_WARNING, "MCE: rdmsr not in domain context!\n");
  54.322 -            *lo = *hi = 0x0;
  54.323 -            break;
  54.324 -        }
  54.325          *lo = (u32)d->arch.vmca_msrs.mcg_status;
  54.326          *hi = (u32)(d->arch.vmca_msrs.mcg_status >> 32);
  54.327          gdprintk(XENLOG_DEBUG, "MCE: rd MCG_STATUS lo %x hi %x\n", *lo, *hi);
  54.328          break;
  54.329      case MSR_IA32_MCG_CAP:
  54.330 -        if (!d || is_idle_domain(d)) {
  54.331 -            gdprintk(XENLOG_WARNING, "MCE: rdmsr not in domain context!\n");
  54.332 -            *lo = *hi = 0x0;
  54.333 -            break;
  54.334 -        }
  54.335          *lo = (u32)d->arch.vmca_msrs.mcg_cap;
  54.336          *hi = (u32)(d->arch.vmca_msrs.mcg_cap >> 32);
  54.337          gdprintk(XENLOG_DEBUG, "MCE: rdmsr MCG_CAP lo %x hi %x\n", *lo, *hi);
  54.338          break;
  54.339      case MSR_IA32_MCG_CTL:
  54.340 -        if (!d || is_idle_domain(d)) {
  54.341 -            gdprintk(XENLOG_WARNING, "MCE: rdmsr not in domain context!\n");
  54.342 -            *lo = *hi = 0x0;
  54.343 -            break;
  54.344 -        }
  54.345          *lo = (u32)d->arch.vmca_msrs.mcg_ctl;
  54.346          *hi = (u32)(d->arch.vmca_msrs.mcg_ctl >> 32);
  54.347          gdprintk(XENLOG_DEBUG, "MCE: rdmsr MCG_CTL lo %x hi %x\n", *lo, *hi);
  54.348          break;
  54.349 -    case MSR_IA32_MC0_CTL2:
  54.350 -    case MSR_IA32_MC1_CTL2:
  54.351 -    case MSR_IA32_MC2_CTL2:
  54.352 -    case MSR_IA32_MC3_CTL2:
  54.353 -    case MSR_IA32_MC4_CTL2:
  54.354 -    case MSR_IA32_MC5_CTL2:
  54.355 -    case MSR_IA32_MC6_CTL2:
  54.356 -    case MSR_IA32_MC7_CTL2:
  54.357 -    case MSR_IA32_MC8_CTL2:
  54.358 +    case MSR_IA32_MC0_CTL2 ... MSR_IA32_MC0_CTL2 + MAX_NR_BANKS - 1:
  54.359          gdprintk(XENLOG_WARNING, "We have disabled CMCI capability, "
  54.360                   "Guest should not read this MSR!\n");
  54.361          break;
  54.362 -    case MSR_IA32_MC0_CTL:
  54.363 -    case MSR_IA32_MC1_CTL:
  54.364 -    case MSR_IA32_MC2_CTL:
  54.365 -    case MSR_IA32_MC3_CTL:
  54.366 -    case MSR_IA32_MC4_CTL:
  54.367 -    case MSR_IA32_MC5_CTL:
  54.368 -    case MSR_IA32_MC6_CTL:
  54.369 -    case MSR_IA32_MC7_CTL:
  54.370 -    case MSR_IA32_MC8_CTL:
  54.371 -        if (!d || is_idle_domain(d)) {
  54.372 -            gdprintk(XENLOG_WARNING, "MCE: rdmsr not in domain context!\n");
  54.373 -            *lo = *hi = 0x0;
  54.374 -            break;
  54.375 -        }
  54.376 -        *lo = (u32)d->arch.vmca_msrs.mci_ctl[(msr - MSR_IA32_MC0_CTL)/4];
  54.377 -        *hi =
  54.378 -            (u32)(d->arch.vmca_msrs.mci_ctl[(msr - MSR_IA32_MC0_CTL)/4]
  54.379 -                  >> 32);
  54.380 -        gdprintk(XENLOG_DEBUG, "MCE: rdmsr MCi_CTL lo %x hi %x\n", *lo, *hi);
  54.381 -        break;
  54.382 -    case MSR_IA32_MC0_STATUS:
  54.383 -    case MSR_IA32_MC1_STATUS:
  54.384 -    case MSR_IA32_MC2_STATUS:
  54.385 -    case MSR_IA32_MC3_STATUS:
  54.386 -    case MSR_IA32_MC4_STATUS:
  54.387 -    case MSR_IA32_MC5_STATUS:
  54.388 -    case MSR_IA32_MC6_STATUS:
  54.389 -    case MSR_IA32_MC7_STATUS:
  54.390 -    case MSR_IA32_MC8_STATUS:
  54.391 -        /* Only error bank is read. Non-error bank simply return */
  54.392 -        *lo = *hi = 0x0;
  54.393 -        gdprintk(XENLOG_DEBUG, "MCE: rdmsr mci_status\n");
  54.394 -        if (!d || is_idle_domain(d)) {
  54.395 -            gdprintk(XENLOG_WARNING, "mce_rdmsr: not in domain context!\n");
  54.396 +    case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * MAX_NR_BANKS - 1:
  54.397 +        bank = (msr - MSR_IA32_MC0_CTL) / 4;
  54.398 +        if (bank >= (d->arch.vmca_msrs.mcg_cap & MCG_CAP_COUNT)) {
  54.399 +            gdprintk(XENLOG_WARNING, "MCE: bank %u does not exist\n", bank);
  54.400 +            ret = -1;
  54.401              break;
  54.402          }
  54.403 -        if (!list_empty(&d->arch.vmca_msrs.impact_header)) {
  54.404 -            entry = list_entry(d->arch.vmca_msrs.impact_header.next,
  54.405 -                               struct bank_entry, list);
  54.406 -            if ( entry->bank == (msr - MSR_IA32_MC0_STATUS)/4 ) {
  54.407 -                *lo = entry->mci_status;
  54.408 -                *hi = entry->mci_status >> 32;
  54.409 -                gdprintk(XENLOG_DEBUG, "MCE: rdmsr MCi_STATUS in vmCE# context "
  54.410 -                         "lo %x hi %x\n", *lo, *hi);
  54.411 -            }
  54.412 -        }
  54.413 -        break;
  54.414 -    case MSR_IA32_MC0_ADDR:
  54.415 -    case MSR_IA32_MC1_ADDR:
  54.416 -    case MSR_IA32_MC2_ADDR:
  54.417 -    case MSR_IA32_MC3_ADDR:
  54.418 -    case MSR_IA32_MC4_ADDR:
  54.419 -    case MSR_IA32_MC5_ADDR:
  54.420 -    case MSR_IA32_MC6_ADDR:
  54.421 -    case MSR_IA32_MC7_ADDR:
  54.422 -    case MSR_IA32_MC8_ADDR:
  54.423 -        *lo = *hi = 0x0;
  54.424 -        if (!d || is_idle_domain(d)) {
  54.425 -            gdprintk(XENLOG_WARNING, "mce_rdmsr: not in domain context!\n");
  54.426 +        switch (msr & (MSR_IA32_MC0_CTL | 3))
  54.427 +        {
  54.428 +        case MSR_IA32_MC0_CTL:
  54.429 +            *lo = (u32)d->arch.vmca_msrs.mci_ctl[bank];
  54.430 +            *hi = (u32)(d->arch.vmca_msrs.mci_ctl[bank] >> 32);
  54.431 +            gdprintk(XENLOG_DEBUG, "MCE: rd MC%u_CTL lo %x hi %x\n",
  54.432 +                     bank, *lo, *hi);
  54.433              break;
  54.434 -        }
  54.435 -        if (!list_empty(&d->arch.vmca_msrs.impact_header)) {
  54.436 -            entry = list_entry(d->arch.vmca_msrs.impact_header.next,
  54.437 -                               struct bank_entry, list);
  54.438 -            if ( entry->bank == (msr - MSR_IA32_MC0_ADDR)/4 ) {
  54.439 -                *lo = entry->mci_addr;
  54.440 -                *hi = entry->mci_addr >> 32;
  54.441 -                gdprintk(XENLOG_DEBUG, "MCE: rdmsr MCi_ADDR in vMCE# context "
  54.442 -                         "lo %x hi %x\n", *lo, *hi);
  54.443 +        case MSR_IA32_MC0_STATUS:
  54.444 +            /* Only error bank is read. Non-error banks simply return. */
  54.445 +            if (!list_empty(&d->arch.vmca_msrs.impact_header)) {
  54.446 +                entry = list_entry(d->arch.vmca_msrs.impact_header.next,
  54.447 +                                   struct bank_entry, list);
  54.448 +                if (entry->bank == bank) {
  54.449 +                    *lo = entry->mci_status;
  54.450 +                    *hi = entry->mci_status >> 32;
  54.451 +                    gdprintk(XENLOG_DEBUG,
  54.452 +                             "MCE: rd MC%u_STATUS in vmCE# context "
  54.453 +                             "lo %x hi %x\n", bank, *lo, *hi);
  54.454 +                } else
  54.455 +                    entry = NULL;
  54.456              }
  54.457 -        }
  54.458 -        break;
  54.459 -    case MSR_IA32_MC0_MISC:
  54.460 -    case MSR_IA32_MC1_MISC:
  54.461 -    case MSR_IA32_MC2_MISC:
  54.462 -    case MSR_IA32_MC3_MISC:
  54.463 -    case MSR_IA32_MC4_MISC:
  54.464 -    case MSR_IA32_MC5_MISC:
  54.465 -    case MSR_IA32_MC6_MISC:
  54.466 -    case MSR_IA32_MC7_MISC:
  54.467 -    case MSR_IA32_MC8_MISC:
  54.468 -        *lo = *hi = 0x0;
  54.469 -        if (!d || is_idle_domain(d)) {
  54.470 -            gdprintk(XENLOG_WARNING, "MCE: rdmsr not in domain context!\n");
  54.471 +            if (!entry)
  54.472 +                gdprintk(XENLOG_DEBUG, "MCE: rd MC%u_STATUS\n", bank);
  54.473              break;
  54.474 -        }
  54.475 -        if (!list_empty(&d->arch.vmca_msrs.impact_header)) {
  54.476 -            entry = list_entry(d->arch.vmca_msrs.impact_header.next,
  54.477 -                               struct bank_entry, list);
  54.478 -            if ( entry->bank == (msr - MSR_IA32_MC0_MISC)/4 ) {
  54.479 -                *lo = entry->mci_misc;
  54.480 -                *hi = entry->mci_misc >> 32;
  54.481 -                gdprintk(XENLOG_DEBUG, "MCE: rdmsr MCi_MISC in vMCE# context "
  54.482 -                         " lo %x hi %x\n", *lo, *hi);
  54.483 +        case MSR_IA32_MC0_ADDR:
  54.484 +            if (!list_empty(&d->arch.vmca_msrs.impact_header)) {
  54.485 +                entry = list_entry(d->arch.vmca_msrs.impact_header.next,
  54.486 +                                   struct bank_entry, list);
  54.487 +                if (entry->bank == bank) {
  54.488 +                    *lo = entry->mci_addr;
  54.489 +                    *hi = entry->mci_addr >> 32;
  54.490 +                    gdprintk(XENLOG_DEBUG,
  54.491 +                             "MCE: rd MC%u_ADDR in vMCE# context lo %x hi %x\n",
  54.492 +                             bank, *lo, *hi);
  54.493 +                }
  54.494              }
  54.495 +            break;
  54.496 +        case MSR_IA32_MC0_MISC:
  54.497 +            if (!list_empty(&d->arch.vmca_msrs.impact_header)) {
  54.498 +                entry = list_entry(d->arch.vmca_msrs.impact_header.next,
  54.499 +                                   struct bank_entry, list);
  54.500 +                if (entry->bank == bank) {
  54.501 +                    *lo = entry->mci_misc;
  54.502 +                    *hi = entry->mci_misc >> 32;
  54.503 +                    gdprintk(XENLOG_DEBUG,
  54.504 +                             "MCE: rd MC%u_MISC in vMCE# context lo %x hi %x\n",
  54.505 +                             bank, *lo, *hi);
  54.506 +                }
  54.507 +            }
  54.508 +            break;
  54.509          }
  54.510          break;
  54.511      default:
    55.1 --- a/xen/arch/x86/cpu/mcheck/non-fatal.c	Tue Apr 07 11:29:44 2009 +0900
    55.2 +++ b/xen/arch/x86/cpu/mcheck/non-fatal.c	Tue Apr 07 11:32:24 2009 +0900
    55.3 @@ -22,7 +22,7 @@
    55.4  
    55.5  #include "mce.h"
    55.6  
    55.7 -static cpu_banks_t bankmask;
    55.8 +DEFINE_PER_CPU(cpu_banks_t, poll_bankmask);
    55.9  static struct timer mce_timer;
   55.10  
   55.11  #define MCE_PERIOD MILLISECS(8000)
   55.12 @@ -39,7 +39,7 @@ static void mce_checkregs (void *info)
   55.13  	struct mca_summary bs;
   55.14  	static uint64_t dumpcount = 0;
   55.15  
   55.16 -	mctc = mcheck_mca_logout(MCA_POLLER, bankmask, &bs);
   55.17 +	mctc = mcheck_mca_logout(MCA_POLLER, __get_cpu_var(poll_bankmask), &bs);
   55.18  
   55.19  	if (bs.errcnt && mctc != NULL) {
   55.20  		adjust++;
   55.21 @@ -94,10 +94,6 @@ static int __init init_nonfatal_mce_chec
   55.22  	if (!mce_available(c))
   55.23  		return -ENODEV;
   55.24  
   55.25 -	memcpy(&bankmask, &mca_allbanks, sizeof (cpu_banks_t));
   55.26 -	if (mce_firstbank(c) == 1)
   55.27 -		clear_bit(0, bankmask);
   55.28 -
   55.29  	/*
   55.30  	 * Check for non-fatal errors every MCE_RATE s
   55.31  	 */
    56.1 --- a/xen/arch/x86/cpu/mcheck/x86_mca.h	Tue Apr 07 11:29:44 2009 +0900
    56.2 +++ b/xen/arch/x86/cpu/mcheck/x86_mca.h	Tue Apr 07 11:32:24 2009 +0900
    56.3 @@ -18,9 +18,9 @@
    56.4   */
    56.5  
    56.6  #ifndef X86_MCA_H
    56.7 -
    56.8  #define X86_MCA_H
    56.9  
   56.10 +#include <public/arch-x86/xen-mca.h>
   56.11  
   56.12  /* The MCA/MCE MSRs should not be used anywhere else.
   56.13   * They are cpu family/model specific and are only for use
    57.1 --- a/xen/arch/x86/domain.c	Tue Apr 07 11:29:44 2009 +0900
    57.2 +++ b/xen/arch/x86/domain.c	Tue Apr 07 11:32:24 2009 +0900
    57.3 @@ -46,6 +46,7 @@
    57.4  #include <asm/hvm/support.h>
    57.5  #include <asm/debugreg.h>
    57.6  #include <asm/msr.h>
    57.7 +#include <asm/traps.h>
    57.8  #include <asm/nmi.h>
    57.9  #include <xen/numa.h>
   57.10  #include <xen/iommu.h>
   57.11 @@ -373,7 +374,6 @@ void vcpu_destroy(struct vcpu *v)
   57.12          hvm_vcpu_destroy(v);
   57.13  }
   57.14  
   57.15 -extern uint64_t g_mcg_cap;
   57.16  int arch_domain_create(struct domain *d, unsigned int domcr_flags)
   57.17  {
   57.18  #ifdef __x86_64__
   57.19 @@ -458,14 +458,8 @@ int arch_domain_create(struct domain *d,
   57.20              goto fail;
   57.21  
   57.22          /* For Guest vMCE MSRs virtualization */
   57.23 -        d->arch.vmca_msrs.mcg_status = 0x0;
   57.24 -        d->arch.vmca_msrs.mcg_cap = g_mcg_cap;
   57.25 -        d->arch.vmca_msrs.mcg_ctl = (uint64_t)~0x0;
   57.26 -        d->arch.vmca_msrs.nr_injection = 0;
   57.27 -        memset(d->arch.vmca_msrs.mci_ctl, 0x1,
   57.28 -            sizeof(d->arch.vmca_msrs.mci_ctl));
   57.29 -        INIT_LIST_HEAD(&d->arch.vmca_msrs.impact_header);
   57.30 -
   57.31 +        if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
   57.32 +            intel_mce_init_msr(d);
   57.33      }
   57.34  
   57.35      if ( is_hvm_domain(d) )
    58.1 --- a/xen/arch/x86/domctl.c	Tue Apr 07 11:29:44 2009 +0900
    58.2 +++ b/xen/arch/x86/domctl.c	Tue Apr 07 11:32:24 2009 +0900
    58.3 @@ -587,6 +587,19 @@ long arch_do_domctl(
    58.4          }
    58.5          break;
    58.6  
    58.7 +        case XEN_DOMCTL_SENDTRIGGER_POWER:
    58.8 +        {
    58.9 +            extern void hvm_acpi_power_button(struct domain *d);
   58.10 +
   58.11 +            ret = -EINVAL;
   58.12 +            if ( is_hvm_domain(d) ) 
   58.13 +            {
   58.14 +                ret = 0;
   58.15 +                hvm_acpi_power_button(d);
   58.16 +            }
   58.17 +        }
   58.18 +        break;
   58.19 +
   58.20          default:
   58.21              ret = -ENOSYS;
   58.22          }
   58.23 @@ -1148,9 +1161,9 @@ void arch_get_info_guest(struct vcpu *v,
   58.24              c.nat->ctrlreg[3] = xen_pfn_to_cr3(
   58.25                  pagetable_get_pfn(v->arch.guest_table));
   58.26  #ifdef __x86_64__
   58.27 -            if ( !pagetable_is_null(v->arch.guest_table_user) )
   58.28 -                c.nat->ctrlreg[1] = xen_pfn_to_cr3(
   58.29 -                    pagetable_get_pfn(v->arch.guest_table_user));
   58.30 +            c.nat->ctrlreg[1] =
   58.31 +                pagetable_is_null(v->arch.guest_table_user) ? 0
   58.32 +                : xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table_user));
   58.33  #endif
   58.34  
   58.35              /* Merge shadow DR7 bits into real DR7. */
    59.1 --- a/xen/arch/x86/hpet.c	Tue Apr 07 11:29:44 2009 +0900
    59.2 +++ b/xen/arch/x86/hpet.c	Tue Apr 07 11:32:24 2009 +0900
    59.3 @@ -45,7 +45,7 @@ static unsigned int num_hpets_used; /* m
    59.4  
    59.5  DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
    59.6  
    59.7 -static int vector_channel[NR_IRQS] = {[0 ... NR_IRQS-1] = -1};
    59.8 +static int vector_channel[NR_VECTORS] = {[0 ... NR_VECTORS-1] = -1};
    59.9  
   59.10  #define vector_to_channel(vector)   vector_channel[vector]
   59.11  
   59.12 @@ -343,20 +343,19 @@ static int hpet_setup_msi_irq(unsigned i
   59.13  
   59.14  static int hpet_assign_irq(struct hpet_event_channel *ch)
   59.15  {
   59.16 -    unsigned int vector;
   59.17 +    int vector;
   59.18  
   59.19 -    vector = assign_irq_vector(AUTO_ASSIGN_IRQ);
   59.20 -    if ( !vector )
   59.21 -        return -EINVAL;
   59.22 +    if ( ch->vector )
   59.23 +        return 0;
   59.24  
   59.25 -    irq_vector[vector] = vector;
   59.26 -    vector_irq[vector] = vector;
   59.27 +    if ( (vector = assign_irq_vector(AUTO_ASSIGN_IRQ)) < 0 )
   59.28 +        return vector;
   59.29 +
   59.30      vector_channel[vector] = ch - &hpet_events[0];
   59.31  
   59.32      if ( hpet_setup_msi_irq(vector) )
   59.33      {
   59.34 -        irq_vector[vector] = 0;
   59.35 -        vector_irq[vector] = FREE_TO_ASSIGN_IRQ;
   59.36 +        free_irq_vector(vector);
   59.37          vector_channel[vector] = -1;
   59.38          return -EINVAL;
   59.39      }
    60.1 --- a/xen/arch/x86/hvm/intercept.c	Tue Apr 07 11:29:44 2009 +0900
    60.2 +++ b/xen/arch/x86/hvm/intercept.c	Tue Apr 07 11:32:24 2009 +0900
    60.3 @@ -100,8 +100,11 @@ static int hvm_mmio_access(struct vcpu *
    60.4          }
    60.5      }
    60.6  
    60.7 -    if ( (p->count = i) != 0 )
    60.8 +    if ( i != 0 )
    60.9 +    {
   60.10 +        p->count = i;
   60.11          rc = X86EMUL_OKAY;
   60.12 +    }
   60.13  
   60.14      return rc;
   60.15  }
   60.16 @@ -165,8 +168,11 @@ static int process_portio_intercept(port
   60.17          }
   60.18      }
   60.19  
   60.20 -    if ( (p->count = i) != 0 )
   60.21 +    if ( i != 0 )
   60.22 +    {
   60.23 +        p->count = i;
   60.24          rc = X86EMUL_OKAY;
   60.25 +    }
   60.26  
   60.27      return rc;
   60.28  }
    61.1 --- a/xen/arch/x86/hvm/pmtimer.c	Tue Apr 07 11:29:44 2009 +0900
    61.2 +++ b/xen/arch/x86/hvm/pmtimer.c	Tue Apr 07 11:32:24 2009 +0900
    61.3 @@ -29,18 +29,15 @@
    61.4  
    61.5  /* The interesting bits of the PM1a_STS register */
    61.6  #define TMR_STS    (1 << 0)
    61.7 -#define PWRBTN_STS (1 << 5)
    61.8 -#define GBL_STS    (1 << 8)
    61.9 +#define GBL_STS    (1 << 5)
   61.10 +#define PWRBTN_STS (1 << 8)
   61.11  
   61.12  /* The same in PM1a_EN */
   61.13  #define TMR_EN     (1 << 0)
   61.14 -#define PWRBTN_EN  (1 << 5)
   61.15 -#define GBL_EN     (1 << 8)
   61.16 +#define GBL_EN     (1 << 5)
   61.17 +#define PWRBTN_EN  (1 << 8)
   61.18  
   61.19 -/* Mask of bits in PM1a_STS that can generate an SCI.  Although the ACPI
   61.20 - * spec lists other bits, the PIIX4, which we are emulating, only
   61.21 - * supports these three.  For now, we only use TMR_STS; in future we
   61.22 - * will let qemu set the other bits */
   61.23 +/* Mask of bits in PM1a_STS that can generate an SCI. */
   61.24  #define SCI_MASK (TMR_STS|PWRBTN_STS|GBL_STS) 
   61.25  
   61.26  /* SCI IRQ number (must match SCI_INT number in ACPI FADT in hvmloader) */
   61.27 @@ -61,6 +58,15 @@ static void pmt_update_sci(PMTState *s)
   61.28          hvm_isa_irq_deassert(s->vcpu->domain, SCI_IRQ);
   61.29  }
   61.30  
   61.31 +void hvm_acpi_power_button(struct domain *d)
   61.32 +{
   61.33 +    PMTState *s = &d->arch.hvm_domain.pl_time.vpmt;
   61.34 +    spin_lock(&s->lock);
   61.35 +    s->pm.pm1a_sts |= PWRBTN_STS;
   61.36 +    pmt_update_sci(s);
   61.37 +    spin_unlock(&s->lock);
   61.38 +}
   61.39 +
   61.40  /* Set the correct value in the timer, accounting for time elapsed
   61.41   * since the last time we did that. */
   61.42  static void pmt_update_time(PMTState *s)
    62.1 --- a/xen/arch/x86/irq.c	Tue Apr 07 11:29:44 2009 +0900
    62.2 +++ b/xen/arch/x86/irq.c	Tue Apr 07 11:32:24 2009 +0900
    62.3 @@ -1069,7 +1069,7 @@ extern void dump_ioapic_irq_info(void);
    62.4  
    62.5  static void dump_irqs(unsigned char key)
    62.6  {
    62.7 -    int i, irq, vector;
    62.8 +    int i, glob_irq, irq, vector;
    62.9      irq_desc_t *desc;
   62.10      irq_guest_action_t *action;
   62.11      struct domain *d;
   62.12 @@ -1077,41 +1077,47 @@ static void dump_irqs(unsigned char key)
   62.13  
   62.14      printk("Guest interrupt information:\n");
   62.15  
   62.16 -    for ( irq = 0; irq < NR_IRQS; irq++ )
   62.17 +    for ( vector = 0; vector < NR_VECTORS; vector++ )
   62.18      {
   62.19 -        vector = irq_to_vector(irq);
   62.20 -        if ( vector == 0 )
   62.21 -            continue;
   62.22 +
   62.23 +        glob_irq = vector_to_irq(vector);
   62.24  
   62.25          desc = &irq_desc[vector];
   62.26 +        if ( desc == NULL || desc->handler == &no_irq_type )
   62.27 +            continue;
   62.28  
   62.29          spin_lock_irqsave(&desc->lock, flags);
   62.30  
   62.31 -        if ( desc->status & IRQ_GUEST )
   62.32 +        if ( !(desc->status & IRQ_GUEST) )
   62.33 +            printk("   Vec%3d IRQ%3d: type=%-15s status=%08x "
   62.34 +                   "mapped, unbound\n",
   62.35 +                   vector, glob_irq, desc->handler->typename, desc->status);
   62.36 +        else
   62.37          {
   62.38              action = (irq_guest_action_t *)desc->action;
   62.39  
   62.40 -            printk("    IRQ%3d Vec%3d: type=%-15s status=%08x "
   62.41 +            printk("   Vec%3d IRQ%3d: type=%-15s status=%08x "
   62.42                     "in-flight=%d domain-list=",
   62.43 -                   irq, vector, desc->handler->typename,
   62.44 +                   vector, glob_irq, desc->handler->typename,
   62.45                     desc->status, action->in_flight);
   62.46  
   62.47              for ( i = 0; i < action->nr_guests; i++ )
   62.48              {
   62.49                  d = action->guest[i];
   62.50 -                printk("%u(%c%c%c%c)",
   62.51 -                       d->domain_id,
   62.52 -                       (test_bit(d->pirq_to_evtchn[irq],
   62.53 +                irq = domain_vector_to_irq(d, vector);
   62.54 +                printk("%u:%3d(%c%c%c%c)",
   62.55 +                       d->domain_id, irq,
   62.56 +                       (test_bit(d->pirq_to_evtchn[glob_irq],
   62.57                                   &shared_info(d, evtchn_pending)) ?
   62.58                          'P' : '-'),
   62.59 -                       (test_bit(d->pirq_to_evtchn[irq] /
   62.60 +                       (test_bit(d->pirq_to_evtchn[glob_irq] /
   62.61                                   BITS_PER_EVTCHN_WORD(d),
   62.62                                   &vcpu_info(d->vcpu[0], evtchn_pending_sel)) ?
   62.63                          'S' : '-'),
   62.64 -                       (test_bit(d->pirq_to_evtchn[irq],
   62.65 +                       (test_bit(d->pirq_to_evtchn[glob_irq],
   62.66                                   &shared_info(d, evtchn_mask)) ?
   62.67                          'M' : '-'),
   62.68 -                       (test_bit(irq, d->pirq_mask) ?
   62.69 +                       (test_bit(glob_irq, d->pirq_mask) ?
   62.70                          'M' : '-'));
   62.71                  if ( i != action->nr_guests )
   62.72                      printk(",");
    63.1 --- a/xen/arch/x86/mm/paging.c	Tue Apr 07 11:29:44 2009 +0900
    63.2 +++ b/xen/arch/x86/mm/paging.c	Tue Apr 07 11:32:24 2009 +0900
    63.3 @@ -385,13 +385,14 @@ int paging_log_dirty_op(struct domain *d
    63.4      }
    63.5  
    63.6      pages = 0;
    63.7 -    l4 = map_domain_page(mfn_x(d->arch.paging.log_dirty.top));
    63.8 +    l4 = (mfn_valid(d->arch.paging.log_dirty.top) ?
    63.9 +          map_domain_page(mfn_x(d->arch.paging.log_dirty.top)) : NULL);
   63.10  
   63.11      for ( i4 = 0;
   63.12            (pages < sc->pages) && (i4 < LOGDIRTY_NODE_ENTRIES);
   63.13            i4++ )
   63.14      {
   63.15 -        l3 = mfn_valid(l4[i4]) ? map_domain_page(mfn_x(l4[i4])) : NULL;
   63.16 +        l3 = (l4 && mfn_valid(l4[i4])) ? map_domain_page(mfn_x(l4[i4])) : NULL;
   63.17          for ( i3 = 0;
   63.18                (pages < sc->pages) && (i3 < LOGDIRTY_NODE_ENTRIES);
   63.19                i3++ )
   63.20 @@ -429,7 +430,8 @@ int paging_log_dirty_op(struct domain *d
   63.21          if ( l3 )
   63.22              unmap_domain_page(l3);
   63.23      }
   63.24 -    unmap_domain_page(l4);
   63.25 +    if ( l4 )
   63.26 +        unmap_domain_page(l4);
   63.27  
   63.28      if ( pages < sc->pages )
   63.29          sc->pages = pages;
    64.1 --- a/xen/arch/x86/time.c	Tue Apr 07 11:29:44 2009 +0900
    64.2 +++ b/xen/arch/x86/time.c	Tue Apr 07 11:32:24 2009 +0900
    64.3 @@ -35,6 +35,13 @@
    64.4  static char opt_clocksource[10];
    64.5  string_param("clocksource", opt_clocksource);
    64.6  
    64.7 +/*
    64.8 + * opt_consistent_tscs: All TSCs tick at the exact same rate, allowing
    64.9 + * simplified system time handling.
   64.10 + */
   64.11 +static int opt_consistent_tscs;
   64.12 +boolean_param("consistent_tscs", opt_consistent_tscs);
   64.13 +
   64.14  unsigned long cpu_khz;  /* CPU clock frequency in kHz. */
   64.15  DEFINE_SPINLOCK(rtc_lock);
   64.16  unsigned long pit0_ticks;
   64.17 @@ -959,7 +966,7 @@ static void local_time_calibration(void)
   64.18      /* The overall calibration scale multiplier. */
   64.19      u32 calibration_mul_frac;
   64.20  
   64.21 -    if ( boot_cpu_has(X86_FEATURE_CONSTANT_TSC) )
   64.22 +    if ( opt_consistent_tscs )
   64.23      {
   64.24          /* Atomically read cpu_calibration struct and write cpu_time struct. */
   64.25          local_irq_disable();
   64.26 @@ -1087,64 +1094,53 @@ static void local_time_calibration(void)
   64.27   */
   64.28  struct calibration_rendezvous {
   64.29      cpumask_t cpu_calibration_map;
   64.30 -    atomic_t count_start;
   64.31 -    atomic_t count_end;
   64.32 +    atomic_t semaphore;
   64.33      s_time_t master_stime;
   64.34      u64 master_tsc_stamp;
   64.35  };
   64.36  
   64.37 -#define NR_LOOPS 5
   64.38 -
   64.39 -static void time_calibration_rendezvous(void *_r)
   64.40 +static void time_calibration_tsc_rendezvous(void *_r)
   64.41  {
   64.42      int i;
   64.43      struct cpu_calibration *c = &this_cpu(cpu_calibration);
   64.44      struct calibration_rendezvous *r = _r;
   64.45      unsigned int total_cpus = cpus_weight(r->cpu_calibration_map);
   64.46  
   64.47 -    /* 
   64.48 -     * Loop is used here to get rid of the cache's side effect to enlarge
   64.49 -     * the TSC difference among CPUs.
   64.50 -     */
   64.51 -    for ( i = 0; i < NR_LOOPS; i++ )
   64.52 +    /* Loop to get rid of cache effects on TSC skew. */
   64.53 +    for ( i = 4; i >= 0; i-- )
   64.54      {
   64.55          if ( smp_processor_id() == 0 )
   64.56          {
   64.57 -            while ( atomic_read(&r->count_start) != (total_cpus - 1) )
   64.58 +            while ( atomic_read(&r->semaphore) != (total_cpus - 1) )
   64.59                  mb();
   64.60 -   
   64.61 +
   64.62              if ( r->master_stime == 0 )
   64.63              {
   64.64                  r->master_stime = read_platform_stime();
   64.65 -                if ( boot_cpu_has(X86_FEATURE_CONSTANT_TSC) )
   64.66 -                    rdtscll(r->master_tsc_stamp);
   64.67 +                rdtscll(r->master_tsc_stamp);
   64.68              }
   64.69 -            atomic_set(&r->count_end, 0);
   64.70 -            wmb();
   64.71 -            atomic_inc(&r->count_start);
   64.72 -    
   64.73 -            if ( boot_cpu_has(X86_FEATURE_CONSTANT_TSC) && 
   64.74 -                 i == NR_LOOPS - 1 )
   64.75 -                write_tsc((u32)r->master_tsc_stamp, (u32)(r->master_tsc_stamp >> 32));
   64.76 -    
   64.77 -            while (atomic_read(&r->count_end) != total_cpus - 1)
   64.78 +            atomic_inc(&r->semaphore);
   64.79 +
   64.80 +            if ( i == 0 )
   64.81 +                write_tsc((u32)r->master_tsc_stamp,
   64.82 +                          (u32)(r->master_tsc_stamp >> 32));
   64.83 +
   64.84 +            while ( atomic_read(&r->semaphore) != (2*total_cpus - 1) )
   64.85                  mb();
   64.86 -            atomic_set(&r->count_start, 0);
   64.87 -            wmb();
   64.88 -            atomic_inc(&r->count_end);
   64.89 +            atomic_set(&r->semaphore, 0);
   64.90          }
   64.91          else
   64.92          {
   64.93 -            atomic_inc(&r->count_start);
   64.94 -            while ( atomic_read(&r->count_start) != total_cpus )
   64.95 +            atomic_inc(&r->semaphore);
   64.96 +            while ( atomic_read(&r->semaphore) < total_cpus )
   64.97                  mb();
   64.98 -    
   64.99 -            if ( boot_cpu_has(X86_FEATURE_CONSTANT_TSC) && 
  64.100 -                 i == NR_LOOPS - 1 )
  64.101 -                write_tsc((u32)r->master_tsc_stamp, (u32)(r->master_tsc_stamp >> 32));
  64.102 -    
  64.103 -            atomic_inc(&r->count_end);
  64.104 -            while (atomic_read(&r->count_end) != total_cpus)
  64.105 +
  64.106 +            if ( i == 0 )
  64.107 +                write_tsc((u32)r->master_tsc_stamp,
  64.108 +                          (u32)(r->master_tsc_stamp >> 32));
  64.109 +
  64.110 +            atomic_inc(&r->semaphore);
  64.111 +            while ( atomic_read(&r->semaphore) > total_cpus )
  64.112                  mb();
  64.113          }
  64.114      }
  64.115 @@ -1156,18 +1152,48 @@ static void time_calibration_rendezvous(
  64.116      raise_softirq(TIME_CALIBRATE_SOFTIRQ);
  64.117  }
  64.118  
  64.119 +static void time_calibration_std_rendezvous(void *_r)
  64.120 +{
  64.121 +    struct cpu_calibration *c = &this_cpu(cpu_calibration);
  64.122 +    struct calibration_rendezvous *r = _r;
  64.123 +    unsigned int total_cpus = cpus_weight(r->cpu_calibration_map);
  64.124 +
  64.125 +    if ( smp_processor_id() == 0 )
  64.126 +    {
  64.127 +        while ( atomic_read(&r->semaphore) != (total_cpus - 1) )
  64.128 +            cpu_relax();
  64.129 +        r->master_stime = read_platform_stime();
  64.130 +        mb(); /* write r->master_stime /then/ signal */
  64.131 +        atomic_inc(&r->semaphore);
  64.132 +    }
  64.133 +    else
  64.134 +    {
  64.135 +        atomic_inc(&r->semaphore);
  64.136 +        while ( atomic_read(&r->semaphore) != total_cpus )
  64.137 +            cpu_relax();
  64.138 +        mb(); /* receive signal /then/ read r->master_stime */
  64.139 +    }
  64.140 +
  64.141 +    rdtscll(c->local_tsc_stamp);
  64.142 +    c->stime_local_stamp = get_s_time();
  64.143 +    c->stime_master_stamp = r->master_stime;
  64.144 +
  64.145 +    raise_softirq(TIME_CALIBRATE_SOFTIRQ);
  64.146 +}
  64.147 +
  64.148  static void time_calibration(void *unused)
  64.149  {
  64.150      struct calibration_rendezvous r = {
  64.151          .cpu_calibration_map = cpu_online_map,
  64.152 -        .count_start = ATOMIC_INIT(0),
  64.153 -        .count_end = ATOMIC_INIT(0),
  64.154 -        .master_stime = 0
  64.155 +        .semaphore = ATOMIC_INIT(0)
  64.156      };
  64.157  
  64.158      /* @wait=1 because we must wait for all cpus before freeing @r. */
  64.159      on_selected_cpus(r.cpu_calibration_map,
  64.160 -                     time_calibration_rendezvous, &r, 0, 1);
  64.161 +                     opt_consistent_tscs
  64.162 +                     ? time_calibration_tsc_rendezvous
  64.163 +                     : time_calibration_std_rendezvous,
  64.164 +                     &r, 0, 1);
  64.165  }
  64.166  
  64.167  void init_percpu_time(void)
  64.168 @@ -1194,8 +1220,11 @@ void init_percpu_time(void)
  64.169  /* Late init function (after all CPUs are booted). */
  64.170  int __init init_xen_time(void)
  64.171  {
  64.172 +    if ( !boot_cpu_has(X86_FEATURE_CONSTANT_TSC) )
  64.173 +        opt_consistent_tscs = 0;
  64.174 +
  64.175      /* If we have constant TSCs then scale factor can be shared. */
  64.176 -    if ( boot_cpu_has(X86_FEATURE_CONSTANT_TSC) )
  64.177 +    if ( opt_consistent_tscs )
  64.178      {
  64.179          int cpu;
  64.180          for_each_cpu ( cpu )
    65.1 --- a/xen/arch/x86/traps.c	Tue Apr 07 11:29:44 2009 +0900
    65.2 +++ b/xen/arch/x86/traps.c	Tue Apr 07 11:32:24 2009 +0900
    65.3 @@ -841,7 +841,7 @@ asmlinkage void do_invalid_op(struct cpu
    65.4  {
    65.5      struct bug_frame bug;
    65.6      struct bug_frame_str bug_str;
    65.7 -    char *filename, *predicate, *eip = (char *)regs->eip;
    65.8 +    const char *filename, *predicate, *eip = (char *)regs->eip;
    65.9      unsigned long fixup;
   65.10      int id, lineno;
   65.11  
   65.12 @@ -873,11 +873,13 @@ asmlinkage void do_invalid_op(struct cpu
   65.13      /* WARN, BUG or ASSERT: decode the filename pointer and line number. */
   65.14      if ( !is_kernel(eip) ||
   65.15           __copy_from_user(&bug_str, eip, sizeof(bug_str)) ||
   65.16 -         memcmp(bug_str.mov, BUG_MOV_STR, sizeof(bug_str.mov)) )
   65.17 +         (bug_str.mov != 0xbc) )
   65.18          goto die;
   65.19 +    filename = bug_str(bug_str, eip);
   65.20      eip += sizeof(bug_str);
   65.21  
   65.22 -    filename = is_kernel(bug_str.str) ? (char *)bug_str.str : "<unknown>";
   65.23 +    if ( !is_kernel(filename) )
   65.24 +        filename = "<unknown>";
   65.25      lineno   = bug.id >> 2;
   65.26  
   65.27      if ( id == BUGFRAME_warn )
   65.28 @@ -900,11 +902,13 @@ asmlinkage void do_invalid_op(struct cpu
   65.29      ASSERT(id == BUGFRAME_assert);
   65.30      if ( !is_kernel(eip) ||
   65.31           __copy_from_user(&bug_str, eip, sizeof(bug_str)) ||
   65.32 -         memcmp(bug_str.mov, BUG_MOV_STR, sizeof(bug_str.mov)) )
   65.33 +         (bug_str.mov != 0xbc) )
   65.34          goto die;
   65.35 +    predicate = bug_str(bug_str, eip);
   65.36      eip += sizeof(bug_str);
   65.37  
   65.38 -    predicate = is_kernel(bug_str.str) ? (char *)bug_str.str : "<unknown>";
   65.39 +    if ( !is_kernel(predicate) )
   65.40 +        predicate = "<unknown>";
   65.41      printk("Assertion '%s' failed at %.50s:%d\n",
   65.42             predicate, filename, lineno);
   65.43      DEBUGGER_trap_fatal(TRAP_invalid_op, regs);
   65.44 @@ -1637,10 +1641,6 @@ static int is_cpufreq_controller(struct 
   65.45              (d->domain_id == 0));
   65.46  }
   65.47  
   65.48 -/*Intel vMCE MSRs virtualization*/
   65.49 -extern int intel_mce_wrmsr(u32 msr, u32 lo,  u32 hi);
   65.50 -extern int intel_mce_rdmsr(u32 msr, u32 *lo,  u32 *hi);
   65.51 -
   65.52  static int emulate_privileged_op(struct cpu_user_regs *regs)
   65.53  {
   65.54      struct vcpu *v = current;
   65.55 @@ -2210,10 +2210,10 @@ static int emulate_privileged_op(struct 
   65.56                  break;
   65.57              if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
   65.58              {
   65.59 -                int rc = intel_mce_wrmsr(regs->ecx, eax, edx);
   65.60 -                if ( rc == -1 )
   65.61 +                int rc = intel_mce_wrmsr(regs->ecx, res);
   65.62 +                if ( rc < 0 )
   65.63                      goto fail;
   65.64 -                if ( rc == 0 )
   65.65 +                if ( rc )
   65.66                      break;
   65.67              }
   65.68  
   65.69 @@ -2291,25 +2291,27 @@ static int emulate_privileged_op(struct 
   65.70          default:
   65.71              if ( rdmsr_hypervisor_regs(regs->ecx, &l, &h) )
   65.72              {
   65.73 + rdmsr_writeback:
   65.74                  regs->eax = l;
   65.75                  regs->edx = h;
   65.76                  break;
   65.77              }
   65.78 +
   65.79 +            if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
   65.80 +            {
   65.81 +                int rc = intel_mce_rdmsr(regs->ecx, &l, &h);
   65.82 +
   65.83 +                if ( rc < 0 )
   65.84 +                    goto fail;
   65.85 +                if ( rc )
   65.86 +                    goto rdmsr_writeback;
   65.87 +            }
   65.88 +
   65.89              /* Everyone can read the MSR space. */
   65.90              /* gdprintk(XENLOG_WARNING,"Domain attempted RDMSR %p.\n",
   65.91                          _p(regs->ecx));*/
   65.92              if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) )
   65.93                  goto fail;
   65.94 -
   65.95 -            if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
   65.96 -            {
   65.97 -                int rc = intel_mce_rdmsr(regs->ecx, &eax, &edx);
   65.98 -                if ( rc == -1 )
   65.99 -                    goto fail;
  65.100 -                if ( rc == 0 )
  65.101 -                    break;
  65.102 -            }
  65.103 -
  65.104              break;
  65.105          }
  65.106          break;
  65.107 @@ -3048,8 +3050,8 @@ void load_TR(void)
  65.108  
  65.109      /* Switch to non-compat GDT (which has B bit clear) to execute LTR. */
  65.110      asm volatile (
  65.111 -        "sgdt %1; lgdt %2; ltr %%ax; lgdt %1"
  65.112 -        : : "a" (TSS_ENTRY << 3), "m" (old_gdt), "m" (tss_gdt) : "memory" );
  65.113 +        "sgdt %0; lgdt %2; ltr %w1; lgdt %0"
  65.114 +        : "=m" (old_gdt) : "rm" (TSS_ENTRY << 3), "m" (tss_gdt) : "memory" );
  65.115  }
  65.116  
  65.117  void __devinit percpu_traps_init(void)
    66.1 --- a/xen/common/page_alloc.c	Tue Apr 07 11:29:44 2009 +0900
    66.2 +++ b/xen/common/page_alloc.c	Tue Apr 07 11:32:24 2009 +0900
    66.3 @@ -302,7 +302,8 @@ static unsigned long init_node_heap(int 
    66.4                (mfn + needed) <= (virt_to_mfn(DIRECTMAP_VIRT_END - 1) + 1) )
    66.5      {
    66.6          _heap[node] = mfn_to_virt(mfn);
    66.7 -        avail[node] = mfn_to_virt(mfn + needed) - sizeof(**avail) * NR_ZONES;
    66.8 +        avail[node] = mfn_to_virt(mfn + needed - 1) +
    66.9 +                      PAGE_SIZE - sizeof(**avail) * NR_ZONES;
   66.10      }
   66.11  #endif
   66.12      else if ( get_order_from_bytes(sizeof(**_heap)) ==
    67.1 --- a/xen/common/sched_credit.c	Tue Apr 07 11:29:44 2009 +0900
    67.2 +++ b/xen/common/sched_credit.c	Tue Apr 07 11:32:24 2009 +0900
    67.3 @@ -154,6 +154,7 @@ struct csched_private {
    67.4      spinlock_t lock;
    67.5      struct list_head active_sdom;
    67.6      uint32_t ncpus;
    67.7 +    struct timer  master_ticker;
    67.8      unsigned int master;
    67.9      cpumask_t idlers;
   67.10      uint32_t weight;
   67.11 @@ -325,6 +326,16 @@ static inline void
   67.12  static unsigned int vcpu_migration_delay;
   67.13  integer_param("vcpu_migration_delay", vcpu_migration_delay);
   67.14  
   67.15 +void set_vcpu_migration_delay(unsigned int delay)
   67.16 +{
   67.17 +    vcpu_migration_delay = delay;
   67.18 +}
   67.19 +
   67.20 +unsigned int get_vcpu_migration_delay(void)
   67.21 +{
   67.22 +    return vcpu_migration_delay;
   67.23 +}
   67.24 +
   67.25  static inline int
   67.26  __csched_vcpu_is_cache_hot(struct vcpu *v)
   67.27  {
   67.28 @@ -757,7 +768,7 @@ csched_runq_sort(unsigned int cpu)
   67.29  }
   67.30  
   67.31  static void
   67.32 -csched_acct(void)
   67.33 +csched_acct(void* dummy)
   67.34  {
   67.35      unsigned long flags;
   67.36      struct list_head *iter_vcpu, *next_vcpu;
   67.37 @@ -792,7 +803,7 @@ csched_acct(void)
   67.38          csched_priv.credit_balance = 0;
   67.39          spin_unlock_irqrestore(&csched_priv.lock, flags);
   67.40          CSCHED_STAT_CRANK(acct_no_work);
   67.41 -        return;
   67.42 +        goto out;
   67.43      }
   67.44  
   67.45      CSCHED_STAT_CRANK(acct_run);
   67.46 @@ -950,6 +961,10 @@ csched_acct(void)
   67.47  
   67.48      /* Inform each CPU that its runq needs to be sorted */
   67.49      csched_priv.runq_sort++;
   67.50 +
   67.51 +out:
   67.52 +    set_timer( &csched_priv.master_ticker, NOW() +
   67.53 +            MILLISECS(CSCHED_MSECS_PER_TICK) * CSCHED_TICKS_PER_ACCT );
   67.54  }
   67.55  
   67.56  static void
   67.57 @@ -967,18 +982,6 @@ csched_tick(void *_cpu)
   67.58          csched_vcpu_acct(cpu);
   67.59  
   67.60      /*
   67.61 -     * Host-wide accounting duty
   67.62 -     *
   67.63 -     * Note: Currently, this is always done by the master boot CPU. Eventually,
   67.64 -     * we could distribute or at the very least cycle the duty.
   67.65 -     */
   67.66 -    if ( (csched_priv.master == cpu) &&
   67.67 -         (spc->tick % CSCHED_TICKS_PER_ACCT) == 0 )
   67.68 -    {
   67.69 -        csched_acct();
   67.70 -    }
   67.71 -
   67.72 -    /*
   67.73       * Check if runq needs to be sorted
   67.74       *
   67.75       * Every physical CPU resorts the runq after the accounting master has
   67.76 @@ -1153,7 +1156,8 @@ csched_schedule(s_time_t now)
   67.77      /*
   67.78       * Return task to run next...
   67.79       */
   67.80 -    ret.time = MILLISECS(CSCHED_MSECS_PER_TSLICE);
   67.81 +    ret.time = (is_idle_vcpu(snext->vcpu) ?
   67.82 +                -1 : MILLISECS(CSCHED_MSECS_PER_TSLICE));
   67.83      ret.task = snext->vcpu;
   67.84  
   67.85      CSCHED_VCPU_CHECK(ret.task);
   67.86 @@ -1310,10 +1314,35 @@ static __init int csched_start_tickers(v
   67.87          set_timer(&spc->ticker, NOW() + MILLISECS(CSCHED_MSECS_PER_TICK));
   67.88      }
   67.89  
   67.90 +    init_timer( &csched_priv.master_ticker, csched_acct, NULL,
   67.91 +                    csched_priv.master);
   67.92 +
   67.93 +    set_timer( &csched_priv.master_ticker, NOW() +
   67.94 +            MILLISECS(CSCHED_MSECS_PER_TICK) * CSCHED_TICKS_PER_ACCT );
   67.95 +
   67.96      return 0;
   67.97  }
   67.98  __initcall(csched_start_tickers);
   67.99  
  67.100 +static void csched_tick_suspend(void)
  67.101 +{
  67.102 +    struct csched_pcpu *spc;
  67.103 +
  67.104 +    spc = CSCHED_PCPU(smp_processor_id());
  67.105 +
  67.106 +    stop_timer(&spc->ticker);
  67.107 +}
  67.108 +
  67.109 +static void csched_tick_resume(void)
  67.110 +{
  67.111 +    struct csched_pcpu *spc;
  67.112 +    uint64_t now = NOW();
  67.113 +
  67.114 +    spc = CSCHED_PCPU(smp_processor_id());
  67.115 +
  67.116 +    set_timer(&spc->ticker, now + MILLISECS(CSCHED_MSECS_PER_TICK)
  67.117 +            - now % MILLISECS(CSCHED_MSECS_PER_TICK) );
  67.118 +}
  67.119  
  67.120  struct scheduler sched_credit_def = {
  67.121      .name           = "SMP Credit Scheduler",
  67.122 @@ -1337,4 +1366,7 @@ struct scheduler sched_credit_def = {
  67.123      .dump_cpu_state = csched_dump_pcpu,
  67.124      .dump_settings  = csched_dump,
  67.125      .init           = csched_init,
  67.126 +
  67.127 +    .tick_suspend   = csched_tick_suspend,
  67.128 +    .tick_resume    = csched_tick_resume,
  67.129  };
    68.1 --- a/xen/common/schedule.c	Tue Apr 07 11:29:44 2009 +0900
    68.2 +++ b/xen/common/schedule.c	Tue Apr 07 11:32:24 2009 +0900
    68.3 @@ -798,7 +798,6 @@ static void schedule(void)
    68.4      s_time_t              now = NOW();
    68.5      struct schedule_data *sd;
    68.6      struct task_slice     next_slice;
    68.7 -    s32                   r_time;     /* time for new dom to run */
    68.8  
    68.9      ASSERT(!in_irq());
   68.10      ASSERT(this_cpu(mc_state).flags == 0);
   68.11 @@ -814,12 +813,12 @@ static void schedule(void)
   68.12      /* get policy-specific decision on scheduling... */
   68.13      next_slice = ops.do_schedule(now);
   68.14  
   68.15 -    r_time = next_slice.time;
   68.16      next = next_slice.task;
   68.17  
   68.18      sd->curr = next;
   68.19 -    
   68.20 -    set_timer(&sd->s_timer, now + r_time);
   68.21 +
   68.22 +    if ( next_slice.time >= 0 ) /* -ve means no limit */
   68.23 +        set_timer(&sd->s_timer, now + next_slice.time);
   68.24  
   68.25      if ( unlikely(prev == next) )
   68.26      {
   68.27 @@ -835,7 +834,7 @@ static void schedule(void)
   68.28               next->domain->domain_id,
   68.29               (next->runstate.state == RUNSTATE_runnable) ?
   68.30               (now - next->runstate.state_entry_time) : 0,
   68.31 -             r_time);
   68.32 +             next_slice.time);
   68.33  
   68.34      ASSERT(prev->runstate.state == RUNSTATE_running);
   68.35      vcpu_runstate_change(
   68.36 @@ -964,6 +963,16 @@ void dump_runq(unsigned char key)
   68.37      local_irq_restore(flags);
   68.38  }
   68.39  
   68.40 +void sched_tick_suspend(void)
   68.41 +{
   68.42 +    SCHED_OP(tick_suspend);
   68.43 +}
   68.44 +
   68.45 +void sched_tick_resume(void)
   68.46 +{
   68.47 +    SCHED_OP(tick_resume);
   68.48 +}
   68.49 +
   68.50  #ifdef CONFIG_COMPAT
   68.51  #include "compat/schedule.c"
   68.52  #endif
    69.1 --- a/xen/common/spinlock.c	Tue Apr 07 11:29:44 2009 +0900
    69.2 +++ b/xen/common/spinlock.c	Tue Apr 07 11:32:24 2009 +0900
    69.3 @@ -2,6 +2,7 @@
    69.4  #include <xen/irq.h>
    69.5  #include <xen/smp.h>
    69.6  #include <xen/spinlock.h>
    69.7 +#include <asm/processor.h>
    69.8  
    69.9  #ifndef NDEBUG
   69.10  
   69.11 @@ -43,7 +44,9 @@ void spin_debug_disable(void)
   69.12  void _spin_lock(spinlock_t *lock)
   69.13  {
   69.14      check_lock(&lock->debug);
   69.15 -    _raw_spin_lock(&lock->raw);
   69.16 +    while ( unlikely(!_raw_spin_trylock(&lock->raw)) )
   69.17 +        while ( likely(_raw_spin_is_locked(&lock->raw)) )
   69.18 +            cpu_relax();
   69.19  }
   69.20  
   69.21  void _spin_lock_irq(spinlock_t *lock)
   69.22 @@ -51,7 +54,13 @@ void _spin_lock_irq(spinlock_t *lock)
   69.23      ASSERT(local_irq_is_enabled());
   69.24      local_irq_disable();
   69.25      check_lock(&lock->debug);
   69.26 -    _raw_spin_lock(&lock->raw);
   69.27 +    while ( unlikely(!_raw_spin_trylock(&lock->raw)) )
   69.28 +    {
   69.29 +        local_irq_enable();
   69.30 +        while ( likely(_raw_spin_is_locked(&lock->raw)) )
   69.31 +            cpu_relax();
   69.32 +        local_irq_disable();
   69.33 +    }
   69.34  }
   69.35  
   69.36  unsigned long _spin_lock_irqsave(spinlock_t *lock)
   69.37 @@ -59,7 +68,13 @@ unsigned long _spin_lock_irqsave(spinloc
   69.38      unsigned long flags;
   69.39      local_irq_save(flags);
   69.40      check_lock(&lock->debug);
   69.41 -    _raw_spin_lock(&lock->raw);
   69.42 +    while ( unlikely(!_raw_spin_trylock(&lock->raw)) )
   69.43 +    {
   69.44 +        local_irq_restore(flags);
   69.45 +        while ( likely(_raw_spin_is_locked(&lock->raw)) )
   69.46 +            cpu_relax();
   69.47 +        local_irq_save(flags);
   69.48 +    }
   69.49      return flags;
   69.50  }
   69.51  
    70.1 --- a/xen/common/sysctl.c	Tue Apr 07 11:29:44 2009 +0900
    70.2 +++ b/xen/common/sysctl.c	Tue Apr 07 11:32:24 2009 +0900
    70.3 @@ -206,6 +206,10 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
    70.4  
    70.5      case XEN_SYSCTL_get_pmstat:
    70.6      {
    70.7 +        ret = xsm_get_pmstat();
    70.8 +        if ( ret )
    70.9 +            break;
   70.10 +
   70.11          ret = do_get_pm_info(&op->u.get_pmstat);
   70.12          if ( ret )
   70.13              break;
   70.14 @@ -220,6 +224,10 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
   70.15  
   70.16      case XEN_SYSCTL_pm_op:
   70.17      {
   70.18 +        ret = xsm_pm_op();
   70.19 +        if ( ret )
   70.20 +            break;
   70.21 +
   70.22          ret = do_pm_op(&op->u.pm_op);
   70.23          if ( ret && (ret != -EAGAIN) )
   70.24              break;
    71.1 --- a/xen/drivers/acpi/pmstat.c	Tue Apr 07 11:29:44 2009 +0900
    71.2 +++ b/xen/drivers/acpi/pmstat.c	Tue Apr 07 11:32:24 2009 +0900
    71.3 @@ -37,6 +37,7 @@
    71.4  #include <asm/processor.h>
    71.5  #include <xen/percpu.h>
    71.6  #include <xen/domain.h>
    71.7 +#include <xen/acpi.h>
    71.8  
    71.9  #include <public/sysctl.h>
   71.10  #include <acpi/cpufreq/cpufreq.h>
   71.11 @@ -527,6 +528,30 @@ int do_pm_op(struct xen_sysctl_pm_op *op
   71.12          break;
   71.13      }
   71.14  
   71.15 +    case XEN_SYSCTL_pm_op_set_vcpu_migration_delay:
   71.16 +    {
   71.17 +        set_vcpu_migration_delay(op->set_vcpu_migration_delay);
   71.18 +        break;
   71.19 +    }
   71.20 +
   71.21 +    case XEN_SYSCTL_pm_op_get_vcpu_migration_delay:
   71.22 +    {
   71.23 +        op->get_vcpu_migration_delay = get_vcpu_migration_delay();
   71.24 +        break;
   71.25 +    }
   71.26 +
   71.27 +    case XEN_SYSCTL_pm_op_get_max_cstate:
   71.28 +    {
   71.29 +        op->get_max_cstate = acpi_get_cstate_limit();
   71.30 +        break;
   71.31 +    }
   71.32 +
   71.33 +    case XEN_SYSCTL_pm_op_set_max_cstate:
   71.34 +    {
   71.35 +        acpi_set_cstate_limit(op->set_max_cstate);
   71.36 +        break;
   71.37 +    }
   71.38 +
   71.39      default:
   71.40          printk("not defined sub-hypercall @ do_pm_op\n");
   71.41          ret = -ENOSYS;
    72.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Tue Apr 07 11:29:44 2009 +0900
    72.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Tue Apr 07 11:32:24 2009 +0900
    72.3 @@ -911,6 +911,8 @@ static int iommu_alloc(struct acpi_drhd_
    72.4          return -ENOMEM;
    72.5      memset(iommu, 0, sizeof(struct iommu));
    72.6  
    72.7 +    iommu->vector = -1; /* No vector assigned yet. */
    72.8 +
    72.9      iommu->intel = alloc_intel_iommu();
   72.10      if ( iommu->intel == NULL )
   72.11      {
   72.12 @@ -1666,15 +1668,18 @@ static int init_vtd_hw(void)
   72.13              return -EIO;
   72.14          }
   72.15  
   72.16 -        vector = iommu_set_interrupt(iommu);
   72.17 -        if ( vector < 0 )
   72.18 +        if ( iommu->vector < 0 )
   72.19          {
   72.20 -            gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: interrupt setup failed\n");
   72.21 -            return vector;
   72.22 +            vector = iommu_set_interrupt(iommu);
   72.23 +            if ( vector < 0 )
   72.24 +            {
   72.25 +                gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: interrupt setup failed\n");
   72.26 +                return vector;
   72.27 +            }
   72.28 +            iommu->vector = vector;
   72.29          }
   72.30 -        dma_msi_data_init(iommu, vector);
   72.31 +        dma_msi_data_init(iommu, iommu->vector);
   72.32          dma_msi_addr_init(iommu, cpu_physical_id(first_cpu(cpu_online_map)));
   72.33 -        iommu->vector = vector;
   72.34          clear_fault_bits(iommu);
   72.35          dmar_writel(iommu->reg, DMAR_FECTL_REG, 0);
   72.36  
   72.37 @@ -1948,16 +1953,34 @@ void iommu_resume(void)
   72.38  {
   72.39      struct acpi_drhd_unit *drhd;
   72.40      struct iommu *iommu;
   72.41 +    struct iommu_flush *flush;
   72.42      u32 i;
   72.43  
   72.44      if ( !vtd_enabled )
   72.45          return;
   72.46  
   72.47 +    /* Re-initialize the register-based flush functions.
   72.48 +     * In iommu_flush_all(), we invoke iommu_flush_{context,iotlb}_global(),
   72.49 +     * but at this point, on hosts that support QI(Queued Invalidation), QI
   72.50 +     * hasn't been re-enabed yet, so for now let's use the register-based
   72.51 +     * invalidation method before invoking init_vtd_hw().
   72.52 +     */
   72.53 +    if ( iommu_qinval )
   72.54 +    {
   72.55 +        for_each_drhd_unit ( drhd )
   72.56 +        {
   72.57 +            iommu = drhd->iommu;
   72.58 +            flush = iommu_get_flush(iommu);
   72.59 +            flush->context = flush_context_reg;
   72.60 +            flush->iotlb = flush_iotlb_reg;
   72.61 +        }
   72.62 +    }
   72.63 +
   72.64      /* Not sure whether the flush operation is required to meet iommu
   72.65       * specification. Note that BIOS also executes in S3 resume and iommu may
   72.66       * be touched again, so let us do the flush operation for safety.
   72.67       */
   72.68 -    flush_all_cache();
   72.69 +    iommu_flush_all();
   72.70  
   72.71      if ( init_vtd_hw() != 0  && force_iommu )
   72.72           panic("IOMMU setup failed, crash Xen for security purpose!\n");
    73.1 --- a/xen/drivers/passthrough/vtd/qinval.c	Tue Apr 07 11:29:44 2009 +0900
    73.2 +++ b/xen/drivers/passthrough/vtd/qinval.c	Tue Apr 07 11:32:24 2009 +0900
    73.3 @@ -432,10 +432,11 @@ int enable_qinval(struct iommu *iommu)
    73.4                      "Cannot allocate memory for qi_ctrl->qinval_maddr\n");
    73.5              return -ENOMEM;
    73.6          }
    73.7 -        flush->context = flush_context_qi;
    73.8 -        flush->iotlb = flush_iotlb_qi;
    73.9      }
   73.10  
   73.11 +    flush->context = flush_context_qi;
   73.12 +    flush->iotlb = flush_iotlb_qi;
   73.13 +
   73.14      /* Setup Invalidation Queue Address(IQA) register with the
   73.15       * address of the page we just allocated.  QS field at
   73.16       * bits[2:0] to indicate size of queue is one 4KB page.
    74.1 --- a/xen/include/asm-ia64/linux-xen/asm/spinlock.h	Tue Apr 07 11:29:44 2009 +0900
    74.2 +++ b/xen/include/asm-ia64/linux-xen/asm/spinlock.h	Tue Apr 07 11:32:24 2009 +0900
    74.3 @@ -21,111 +21,9 @@
    74.4  
    74.5  typedef struct {
    74.6  	volatile unsigned int lock;
    74.7 -#ifdef CONFIG_PREEMPT
    74.8 -	unsigned int break_lock;
    74.9 -#endif
   74.10 -#ifdef DEBUG_SPINLOCK
   74.11 -	void *locker;
   74.12 -#endif
   74.13  } raw_spinlock_t;
   74.14  
   74.15 -#ifdef XEN
   74.16 -#ifdef DEBUG_SPINLOCK
   74.17 -#define _RAW_SPIN_LOCK_UNLOCKED	/*(raw_spinlock_t)*/ { 0, NULL }
   74.18 -#else
   74.19 -#define _RAW_SPIN_LOCK_UNLOCKED	/*(raw_spinlock_t)*/ { 0 }
   74.20 -#endif
   74.21 -#else
   74.22  #define _RAW_SPIN_LOCK_UNLOCKED	/*(raw_spinlock_t)*/ { 0 }
   74.23 -#endif
   74.24 -
   74.25 -#ifdef ASM_SUPPORTED
   74.26 -/*
   74.27 - * Try to get the lock.  If we fail to get the lock, make a non-standard call to
   74.28 - * ia64_spinlock_contention().  We do not use a normal call because that would force all
   74.29 - * callers of spin_lock() to be non-leaf routines.  Instead, ia64_spinlock_contention() is
   74.30 - * carefully coded to touch only those registers that spin_lock() marks "clobbered".
   74.31 - */
   74.32 -
   74.33 -#define IA64_SPINLOCK_CLOBBERS "ar.ccv", "ar.pfs", "p14", "p15", "r27", "r28", "r29", "r30", "b6", "memory"
   74.34 -
   74.35 -static inline void
   74.36 -_raw_spin_lock_flags (raw_spinlock_t *lock, unsigned long flags)
   74.37 -{
   74.38 -	register volatile unsigned int *ptr asm ("r31") = &lock->lock;
   74.39 -
   74.40 -#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
   74.41 -# ifdef CONFIG_ITANIUM
   74.42 -	/* don't use brl on Itanium... */
   74.43 -	asm volatile ("{\n\t"
   74.44 -		      "  mov ar.ccv = r0\n\t"
   74.45 -		      "  mov r28 = ip\n\t"
   74.46 -		      "  mov r30 = 1;;\n\t"
   74.47 -		      "}\n\t"
   74.48 -		      "cmpxchg4.acq r30 = [%1], r30, ar.ccv\n\t"
   74.49 -		      "movl r29 = ia64_spinlock_contention_pre3_4;;\n\t"
   74.50 -		      "cmp4.ne p14, p0 = r30, r0\n\t"
   74.51 -		      "mov b6 = r29;;\n\t"
   74.52 -		      "mov r27=%2\n\t"
   74.53 -		      "(p14) br.cond.spnt.many b6"
   74.54 -		      : "=r"(ptr) : "r"(ptr), "r" (flags) : IA64_SPINLOCK_CLOBBERS);
   74.55 -# else
   74.56 -	asm volatile ("{\n\t"
   74.57 -		      "  mov ar.ccv = r0\n\t"
   74.58 -		      "  mov r28 = ip\n\t"
   74.59 -		      "  mov r30 = 1;;\n\t"
   74.60 -		      "}\n\t"
   74.61 -		      "cmpxchg4.acq r30 = [%1], r30, ar.ccv;;\n\t"
   74.62 -		      "cmp4.ne p14, p0 = r30, r0\n\t"
   74.63 -		      "mov r27=%2\n\t"
   74.64 -		      "(p14) brl.cond.spnt.many ia64_spinlock_contention_pre3_4;;"
   74.65 -		      : "=r"(ptr) : "r"(ptr), "r" (flags) : IA64_SPINLOCK_CLOBBERS);
   74.66 -# endif /* CONFIG_MCKINLEY */
   74.67 -#else
   74.68 -# ifdef CONFIG_ITANIUM
   74.69 -	/* don't use brl on Itanium... */
   74.70 -	/* mis-declare, so we get the entry-point, not it's function descriptor: */
   74.71 -	asm volatile ("mov r30 = 1\n\t"
   74.72 -		      "mov r27=%2\n\t"
   74.73 -		      "mov ar.ccv = r0;;\n\t"
   74.74 -		      "cmpxchg4.acq r30 = [%0], r30, ar.ccv\n\t"
   74.75 -		      "movl r29 = ia64_spinlock_contention;;\n\t"
   74.76 -		      "cmp4.ne p14, p0 = r30, r0\n\t"
   74.77 -		      "mov b6 = r29;;\n\t"
   74.78 -		      "(p14) br.call.spnt.many b6 = b6"
   74.79 -		      : "=r"(ptr) : "r"(ptr), "r" (flags) : IA64_SPINLOCK_CLOBBERS);
   74.80 -# else
   74.81 -	asm volatile ("mov r30 = 1\n\t"
   74.82 -		      "mov r27=%2\n\t"
   74.83 -		      "mov ar.ccv = r0;;\n\t"
   74.84 -		      "cmpxchg4.acq r30 = [%0], r30, ar.ccv;;\n\t"
   74.85 -		      "cmp4.ne p14, p0 = r30, r0\n\t"
   74.86 -		      "(p14) brl.call.spnt.many b6=ia64_spinlock_contention;;"
   74.87 -		      : "=r"(ptr) : "r"(ptr), "r" (flags) : IA64_SPINLOCK_CLOBBERS);
   74.88 -# endif /* CONFIG_MCKINLEY */
   74.89 -#endif
   74.90 -
   74.91 -#ifdef DEBUG_SPINLOCK
   74.92 -	asm volatile ("mov %0=ip" : "=r" (lock->locker));
   74.93 -#endif
   74.94 -}
   74.95 -#define _raw_spin_lock(lock) _raw_spin_lock_flags(lock, 0)
   74.96 -#else /* !ASM_SUPPORTED */
   74.97 -#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
   74.98 -# define _raw_spin_lock(x)								\
   74.99 -do {											\
  74.100 -	__u32 *ia64_spinlock_ptr = (__u32 *) (x);					\
  74.101 -	__u64 ia64_spinlock_val;							\
  74.102 -	ia64_spinlock_val = ia64_cmpxchg4_acq(ia64_spinlock_ptr, 1, 0);			\
  74.103 -	if (unlikely(ia64_spinlock_val)) {						\
  74.104 -		do {									\
  74.105 -			while (*ia64_spinlock_ptr)					\
  74.106 -				ia64_barrier();						\
  74.107 -			ia64_spinlock_val = ia64_cmpxchg4_acq(ia64_spinlock_ptr, 1, 0);	\
  74.108 -		} while (ia64_spinlock_val);						\
  74.109 -	}										\
  74.110 -} while (0)
  74.111 -#endif /* !ASM_SUPPORTED */
  74.112  
  74.113  #define _raw_spin_is_locked(x)	((x)->lock != 0)
  74.114  #define _raw_spin_unlock(x)	do { barrier(); (x)->lock = 0; } while (0)
  74.115 @@ -134,9 +32,6 @@ do {											\
  74.116  typedef struct {
  74.117  	volatile unsigned int read_counter	: 31;
  74.118  	volatile unsigned int write_lock	:  1;
  74.119 -#ifdef CONFIG_PREEMPT
  74.120 -	unsigned int break_lock;
  74.121 -#endif
  74.122  } raw_rwlock_t;
  74.123  #define _RAW_RW_LOCK_UNLOCKED /*(raw_rwlock_t)*/ { 0, 0 }
  74.124  
    75.1 --- a/xen/include/asm-x86/atomic.h	Tue Apr 07 11:29:44 2009 +0900
    75.2 +++ b/xen/include/asm-x86/atomic.h	Tue Apr 07 11:32:24 2009 +0900
    75.3 @@ -23,8 +23,7 @@ typedef struct { int counter; } atomic_t
    75.4   * atomic_read - read atomic variable
    75.5   * @v: pointer of type atomic_t
    75.6   * 
    75.7 - * Atomically reads the value of @v.  Note that the guaranteed
    75.8 - * useful range of an atomic_t is only 24 bits.
    75.9 + * Atomically reads the value of @v.
   75.10   */
   75.11  #define _atomic_read(v)		((v).counter)
   75.12  #define atomic_read(v)		(*(volatile int *)&((v)->counter))
   75.13 @@ -34,8 +33,7 @@ typedef struct { int counter; } atomic_t
   75.14   * @v: pointer of type atomic_t
   75.15   * @i: required value
   75.16   * 
   75.17 - * Atomically sets the value of @v to @i.  Note that the guaranteed
   75.18 - * useful range of an atomic_t is only 24 bits.
   75.19 + * Atomically sets the value of @v to @i.
   75.20   */ 
   75.21  #define _atomic_set(v,i)	(((v).counter) = (i))
   75.22  #define atomic_set(v,i)		(*(volatile int *)&((v)->counter) = (i))
   75.23 @@ -45,12 +43,11 @@ typedef struct { int counter; } atomic_t
   75.24   * @i: integer value to add
   75.25   * @v: pointer of type atomic_t
   75.26   * 
   75.27 - * Atomically adds @i to @v.  Note that the guaranteed useful range
   75.28 - * of an atomic_t is only 24 bits.
   75.29 + * Atomically adds @i to @v.
   75.30   */
   75.31  static __inline__ void atomic_add(int i, atomic_t *v)
   75.32  {
   75.33 -	__asm__ __volatile__(
   75.34 +	asm volatile(
   75.35  		LOCK "addl %1,%0"
   75.36  		:"=m" (*(volatile int *)&v->counter)
   75.37  		:"ir" (i), "m" (*(volatile int *)&v->counter));
   75.38 @@ -61,12 +58,11 @@ static __inline__ void atomic_add(int i,
   75.39   * @i: integer value to subtract
   75.40   * @v: pointer of type atomic_t
   75.41   * 
   75.42 - * Atomically subtracts @i from @v.  Note that the guaranteed
   75.43 - * useful range of an atomic_t is only 24 bits.
   75.44 + * Atomically subtracts @i from @v.
   75.45   */
   75.46  static __inline__ void atomic_sub(int i, atomic_t *v)
   75.47  {
   75.48 -	__asm__ __volatile__(
   75.49 +	asm volatile(
   75.50  		LOCK "subl %1,%0"
   75.51  		:"=m" (*(volatile int *)&v->counter)
   75.52  		:"ir" (i), "m" (*(volatile int *)&v->counter));
   75.53 @@ -79,14 +75,13 @@ static __inline__ void atomic_sub(int i,
   75.54   * 
   75.55   * Atomically subtracts @i from @v and returns
   75.56   * true if the result is zero, or false for all
   75.57 - * other cases.  Note that the guaranteed
   75.58 - * useful range of an atomic_t is only 24 bits.
   75.59 + * other cases.
   75.60   */
   75.61  static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
   75.62  {
   75.63  	unsigned char c;
   75.64  
   75.65 -	__asm__ __volatile__(
   75.66 +	asm volatile(
   75.67  		LOCK "subl %2,%0; sete %1"
   75.68  		:"=m" (*(volatile int *)&v->counter), "=qm" (c)
   75.69  		:"ir" (i), "m" (*(volatile int *)&v->counter) : "memory");
   75.70 @@ -97,12 +92,11 @@ static __inline__ int atomic_sub_and_tes
   75.71   * atomic_inc - increment atomic variable
   75.72   * @v: pointer of type atomic_t
   75.73   * 
   75.74 - * Atomically increments @v by 1.  Note that the guaranteed
   75.75 - * useful range of an atomic_t is only 24 bits.
   75.76 + * Atomically increments @v by 1.
   75.77   */ 
   75.78  static __inline__ void atomic_inc(atomic_t *v)
   75.79  {
   75.80 -	__asm__ __volatile__(
   75.81 +	asm volatile(
   75.82  		LOCK "incl %0"
   75.83  		:"=m" (*(volatile int *)&v->counter)
   75.84  		:"m" (*(volatile int *)&v->counter));
   75.85 @@ -112,12 +106,11 @@ static __inline__ void atomic_inc(atomic
   75.86   * atomic_dec - decrement atomic variable
   75.87   * @v: pointer of type atomic_t
   75.88   * 
   75.89 - * Atomically decrements @v by 1.  Note that the guaranteed
   75.90 - * useful range of an atomic_t is only 24 bits.
   75.91 + * Atomically decrements @v by 1.
   75.92   */ 
   75.93  static __inline__ void atomic_dec(atomic_t *v)
   75.94  {
   75.95 -	__asm__ __volatile__(
   75.96 +	asm volatile(
   75.97  		LOCK "decl %0"
   75.98  		:"=m" (*(volatile int *)&v->counter)
   75.99  		:"m" (*(volatile int *)&v->counter));
  75.100 @@ -129,14 +122,13 @@ static __inline__ void atomic_dec(atomic
  75.101   * 
  75.102   * Atomically decrements @v by 1 and
  75.103   * returns true if the result is 0, or false for all other
  75.104 - * cases.  Note that the guaranteed
  75.105 - * useful range of an atomic_t is only 24 bits.
  75.106 + * cases.
  75.107   */ 
  75.108  static __inline__ int atomic_dec_and_test(atomic_t *v)
  75.109  {
  75.110  	unsigned char c;
  75.111  
  75.112 -	__asm__ __volatile__(
  75.113 +	asm volatile(
  75.114  		LOCK "decl %0; sete %1"
  75.115  		:"=m" (*(volatile int *)&v->counter), "=qm" (c)
  75.116  		:"m" (*(volatile int *)&v->counter) : "memory");
  75.117 @@ -149,14 +141,13 @@ static __inline__ int atomic_dec_and_tes
  75.118   * 
  75.119   * Atomically increments @v by 1
  75.120   * and returns true if the result is zero, or false for all
  75.121 - * other cases.  Note that the guaranteed
  75.122 - * useful range of an atomic_t is only 24 bits.
  75.123 + * other cases.
  75.124   */ 
  75.125  static __inline__ int atomic_inc_and_test(atomic_t *v)
  75.126  {
  75.127  	unsigned char c;
  75.128  
  75.129 -	__asm__ __volatile__(
  75.130 +	asm volatile(
  75.131  		LOCK "incl %0; sete %1"
  75.132  		:"=m" (*(volatile int *)&v->counter), "=qm" (c)
  75.133  		:"m" (*(volatile int *)&v->counter) : "memory");
  75.134 @@ -170,14 +161,13 @@ static __inline__ int atomic_inc_and_tes
  75.135   * 
  75.136   * Atomically adds @i to @v and returns true
  75.137   * if the result is negative, or false when
  75.138 - * result is greater than or equal to zero.  Note that the guaranteed
  75.139 - * useful range of an atomic_t is only 24 bits.
  75.140 + * result is greater than or equal to zero.
  75.141   */ 
  75.142  static __inline__ int atomic_add_negative(int i, atomic_t *v)
  75.143  {
  75.144  	unsigned char c;
  75.145  
  75.146 -	__asm__ __volatile__(
  75.147 +	asm volatile(
  75.148  		LOCK "addl %2,%0; sets %1"
  75.149  		:"=m" (*(volatile int *)&v->counter), "=qm" (c)
  75.150  		:"ir" (i), "m" (*(volatile int *)&v->counter) : "memory");
    76.1 --- a/xen/include/asm-x86/bug.h	Tue Apr 07 11:29:44 2009 +0900
    76.2 +++ b/xen/include/asm-x86/bug.h	Tue Apr 07 11:32:24 2009 +0900
    76.3 @@ -18,4 +18,28 @@ struct bug_frame {
    76.4  #define BUGFRAME_bug    2
    76.5  #define BUGFRAME_assert 3
    76.6  
    76.7 +#define dump_execution_state()                     \
    76.8 +    asm volatile (                                 \
    76.9 +        "ud2 ; ret $0"                             \
   76.10 +        : : "i" (BUGFRAME_dump) )
   76.11 +
   76.12 +#define WARN()                                     \
   76.13 +    asm volatile (                                 \
   76.14 +        "ud2 ; ret %0" BUG_STR(1)                  \
   76.15 +        : : "i" (BUGFRAME_warn | (__LINE__<<2)),   \
   76.16 +            "i" (__FILE__) )
   76.17 +
   76.18 +#define BUG()                                      \
   76.19 +    asm volatile (                                 \
   76.20 +        "ud2 ; ret %0" BUG_STR(1)                  \
   76.21 +        : : "i" (BUGFRAME_bug | (__LINE__<<2)),    \
   76.22 +            "i" (__FILE__) )
   76.23 +
   76.24 +#define assert_failed(p)                           \
   76.25 +    asm volatile (                                 \
   76.26 +        "ud2 ; ret %0" BUG_STR(1) BUG_STR(2)       \
   76.27 +        : : "i" (BUGFRAME_assert | (__LINE__<<2)), \
   76.28 +            "i" (__FILE__), "i" (#p) )
   76.29 +
   76.30 +
   76.31  #endif /* __X86_BUG_H__ */
    77.1 --- a/xen/include/asm-x86/config.h	Tue Apr 07 11:29:44 2009 +0900
    77.2 +++ b/xen/include/asm-x86/config.h	Tue Apr 07 11:32:24 2009 +0900
    77.3 @@ -35,6 +35,7 @@
    77.4  #define CONFIG_ACPI_SLEEP 1
    77.5  #define CONFIG_ACPI_NUMA 1
    77.6  #define CONFIG_ACPI_SRAT 1
    77.7 +#define CONFIG_ACPI_CSTATE 1
    77.8  
    77.9  #define CONFIG_VGA 1
   77.10  
    78.1 --- a/xen/include/asm-x86/msr-index.h	Tue Apr 07 11:29:44 2009 +0900
    78.2 +++ b/xen/include/asm-x86/msr-index.h	Tue Apr 07 11:32:24 2009 +0900
    78.3 @@ -326,7 +326,15 @@
    78.4  #define MSR_IA32_MCG_ESP		0x00000187
    78.5  #define MSR_IA32_MCG_EFLAGS		0x00000188
    78.6  #define MSR_IA32_MCG_EIP		0x00000189
    78.7 -#define MSR_IA32_MCG_RESERVED		0x0000018a
    78.8 +#define MSR_IA32_MCG_MISC		0x0000018a
    78.9 +#define MSR_IA32_MCG_R8			0x00000190
   78.10 +#define MSR_IA32_MCG_R9			0x00000191
   78.11 +#define MSR_IA32_MCG_R10		0x00000192
   78.12 +#define MSR_IA32_MCG_R11		0x00000193
   78.13 +#define MSR_IA32_MCG_R12		0x00000194
   78.14 +#define MSR_IA32_MCG_R13		0x00000195
   78.15 +#define MSR_IA32_MCG_R14		0x00000196
   78.16 +#define MSR_IA32_MCG_R15		0x00000197
   78.17  
   78.18  /* Pentium IV performance counter MSRs */
   78.19  #define MSR_P4_BPU_PERFCTR0		0x00000300
    79.1 --- a/xen/include/asm-x86/spinlock.h	Tue Apr 07 11:29:44 2009 +0900
    79.2 +++ b/xen/include/asm-x86/spinlock.h	Tue Apr 07 11:32:24 2009 +0900
    79.3 @@ -13,19 +13,6 @@ typedef struct {
    79.4  
    79.5  #define _raw_spin_is_locked(x) ((x)->lock <= 0)
    79.6  
    79.7 -static always_inline void _raw_spin_lock(raw_spinlock_t *lock)
    79.8 -{
    79.9 -    asm volatile (
   79.10 -        "1:  lock; decw %0         \n"
   79.11 -        "    jns 3f                \n"
   79.12 -        "2:  rep; nop              \n"
   79.13 -        "    cmpw $0,%0            \n"
   79.14 -        "    jle 2b                \n"
   79.15 -        "    jmp 1b                \n"
   79.16 -        "3:"
   79.17 -        : "=m" (lock->lock) : : "memory" );
   79.18 -}
   79.19 -
   79.20  static always_inline void _raw_spin_unlock(raw_spinlock_t *lock)
   79.21  {
   79.22      ASSERT(_raw_spin_is_locked(lock));
    80.1 --- a/xen/include/asm-x86/traps.h	Tue Apr 07 11:29:44 2009 +0900
    80.2 +++ b/xen/include/asm-x86/traps.h	Tue Apr 07 11:32:24 2009 +0900
    80.3 @@ -47,4 +47,9 @@ extern int guest_has_trap_callback(struc
    80.4  extern int send_guest_trap(struct domain *d, uint16_t vcpuid,
    80.5  				unsigned int trap_nr);
    80.6  
    80.7 +/* Intel vMCE MSRs virtualization */
    80.8 +extern void intel_mce_init_msr(struct domain *d);
    80.9 +extern int intel_mce_wrmsr(u32 msr, u64 value);
   80.10 +extern int intel_mce_rdmsr(u32 msr, u32 *lo, u32 *hi);
   80.11 +
   80.12  #endif /* ASM_TRAP_H */
    81.1 --- a/xen/include/asm-x86/x86_32/bug.h	Tue Apr 07 11:29:44 2009 +0900
    81.2 +++ b/xen/include/asm-x86/x86_32/bug.h	Tue Apr 07 11:32:24 2009 +0900
    81.3 @@ -2,33 +2,10 @@
    81.4  #define __X86_32_BUG_H__
    81.5  
    81.6  struct bug_frame_str {
    81.7 -    unsigned char mov[1];
    81.8 +    unsigned char mov;
    81.9      unsigned long str;
   81.10  } __attribute__((packed));
   81.11 -#define BUG_MOV_STR "\xbc"
   81.12 -
   81.13 -#define dump_execution_state()                          \
   81.14 -    asm volatile (                                      \
   81.15 -        "ud2 ; ret $%c0"                                \
   81.16 -        : : "i" (BUGFRAME_dump) )
   81.17 -
   81.18 -#define WARN()                                          \
   81.19 -    asm volatile (                                      \
   81.20 -        "ud2 ; ret $%c0 ; .byte 0xbc ; .long %c1"       \
   81.21 -        : : "i" (BUGFRAME_warn | (__LINE__<<2)),        \
   81.22 -            "i" (__FILE__) )
   81.23 -
   81.24 -#define BUG()                                           \
   81.25 -    asm volatile (                                      \
   81.26 -        "ud2 ; ret $%c0 ; .byte 0xbc ; .long %c1"       \
   81.27 -        : : "i" (BUGFRAME_bug | (__LINE__<<2)),         \
   81.28 -            "i" (__FILE__) )
   81.29 -
   81.30 -#define assert_failed(p)                                \
   81.31 -    asm volatile (                                      \
   81.32 -        "ud2 ; ret $%c0 ; .byte 0xbc ; .long %c1"       \
   81.33 -        " ; .byte 0xbc ; .long %c2"                     \
   81.34 -        : : "i" (BUGFRAME_assert | (__LINE__<<2)),      \
   81.35 -            "i" (__FILE__), "i" (#p) )
   81.36 +#define bug_str(b, eip) ((const char *)(b).str)
   81.37 +#define BUG_STR(n) "; movl %" #n ", %%esp"
   81.38  
   81.39  #endif /* __X86_32_BUG_H__ */
    82.1 --- a/xen/include/asm-x86/x86_32/page.h	Tue Apr 07 11:29:44 2009 +0900
    82.2 +++ b/xen/include/asm-x86/x86_32/page.h	Tue Apr 07 11:32:24 2009 +0900
    82.3 @@ -27,9 +27,6 @@
    82.4  #define __PAGE_OFFSET           (0xFF000000)
    82.5  #define __XEN_VIRT_START        __PAGE_OFFSET
    82.6  
    82.7 -#define virt_to_maddr(va) ((unsigned long)(va)-DIRECTMAP_VIRT_START)
    82.8 -#define maddr_to_virt(ma) ((void *)((unsigned long)(ma)+DIRECTMAP_VIRT_START))
    82.9 -
   82.10  #define VADDR_BITS              32
   82.11  #define VADDR_MASK              (~0UL)
   82.12  
   82.13 @@ -44,6 +41,22 @@
   82.14  #include <xen/config.h>
   82.15  #include <asm/types.h>
   82.16  
   82.17 +static inline unsigned long __virt_to_maddr(unsigned long va)
   82.18 +{
   82.19 +    ASSERT(va >= DIRECTMAP_VIRT_START && va < DIRECTMAP_VIRT_END);
   82.20 +    return va - DIRECTMAP_VIRT_START;
   82.21 +}
   82.22 +#define virt_to_maddr(va)       \
   82.23 +    (__virt_to_maddr((unsigned long)(va)))
   82.24 +
   82.25 +static inline void *__maddr_to_virt(unsigned long ma)
   82.26 +{
   82.27 +    ASSERT(ma < DIRECTMAP_VIRT_END - DIRECTMAP_VIRT_START);
   82.28 +    return (void *)(ma + DIRECTMAP_VIRT_START);
   82.29 +}
   82.30 +#define maddr_to_virt(ma)       \
   82.31 +    (__maddr_to_virt((unsigned long)(ma)))
   82.32 +
   82.33  /* read access (should only be used for debug printk's) */
   82.34  typedef u64 intpte_t;
   82.35  #define PRIpte "016llx"
    83.1 --- a/xen/include/asm-x86/x86_64/bug.h	Tue Apr 07 11:29:44 2009 +0900
    83.2 +++ b/xen/include/asm-x86/x86_64/bug.h	Tue Apr 07 11:32:24 2009 +0900
    83.3 @@ -2,33 +2,10 @@
    83.4  #define __X86_64_BUG_H__
    83.5  
    83.6  struct bug_frame_str {
    83.7 -    unsigned char mov[2];
    83.8 -    unsigned long str;
    83.9 +    unsigned char mov;
   83.10 +    signed int str_disp;
   83.11  } __attribute__((packed));
   83.12 -#define BUG_MOV_STR "\x48\xbc"
   83.13 -
   83.14 -#define dump_execution_state()                          \
   83.15 -    asm volatile (                                      \
   83.16 -        "ud2 ; ret $%c0"                                \
   83.17 -        : : "i" (BUGFRAME_dump) )
   83.18 -
   83.19 -#define WARN()                                          \
   83.20 -    asm volatile (                                      \
   83.21 -        "ud2 ; ret $%c0 ; .byte 0x48,0xbc ; .quad %c1"  \
   83.22 -        : : "i" (BUGFRAME_warn | (__LINE__<<2)),        \
   83.23 -            "i" (__FILE__) )
   83.24 -
   83.25 -#define BUG()                                           \
   83.26 -    asm volatile (                                      \
   83.27 -        "ud2 ; ret $%c0 ; .byte 0x48,0xbc ; .quad %c1"  \
   83.28 -        : : "i" (BUGFRAME_bug | (__LINE__<<2)),         \
   83.29 -            "i" (__FILE__) )
   83.30 -
   83.31 -#define assert_failed(p)                                \
   83.32 -    asm volatile (                                      \
   83.33 -        "ud2 ; ret $%c0 ; .byte 0x48,0xbc ; .quad %c1"  \
   83.34 -        " ; .byte 0x48,0xbc ; .quad %c2"                \
   83.35 -        : : "i" (BUGFRAME_assert | (__LINE__<<2)),      \
   83.36 -            "i" (__FILE__), "i" (#p) )
   83.37 +#define bug_str(b, rip) ((const char *)(rip) + (b).str_disp)
   83.38 +#define BUG_STR(n) "; movl %" #n " - ., %%esp"
   83.39  
   83.40  #endif /* __X86_64_BUG_H__ */
    84.1 --- a/xen/include/asm-x86/x86_64/page.h	Tue Apr 07 11:29:44 2009 +0900
    84.2 +++ b/xen/include/asm-x86/x86_64/page.h	Tue Apr 07 11:32:24 2009 +0900
    84.3 @@ -46,8 +46,14 @@ static inline unsigned long __virt_to_ma
    84.4  }
    84.5  #define virt_to_maddr(va)       \
    84.6      (__virt_to_maddr((unsigned long)(va)))
    84.7 +
    84.8 +static inline void *__maddr_to_virt(unsigned long ma)
    84.9 +{
   84.10 +    ASSERT(ma < DIRECTMAP_VIRT_END - DIRECTMAP_VIRT_START);
   84.11 +    return (void *)(ma + DIRECTMAP_VIRT_START);
   84.12 +}
   84.13  #define maddr_to_virt(ma)       \
   84.14 -    ((void *)((unsigned long)(ma)+DIRECTMAP_VIRT_START))
   84.15 +    (__maddr_to_virt((unsigned long)(ma)))
   84.16  
   84.17  /* read access (should only be used for debug printk's) */
   84.18  typedef u64 intpte_t;
    85.1 --- a/xen/include/public/arch-x86/xen-mca.h	Tue Apr 07 11:29:44 2009 +0900
    85.2 +++ b/xen/include/public/arch-x86/xen-mca.h	Tue Apr 07 11:32:24 2009 +0900
    85.3 @@ -62,7 +62,7 @@
    85.4   * choose a different version number range that is numerically less
    85.5   * than that used in xen-unstable.
    85.6   */
    85.7 -#define XEN_MCA_INTERFACE_VERSION 0x01ecc002
    85.8 +#define XEN_MCA_INTERFACE_VERSION 0x01ecc003
    85.9  
   85.10  /* IN: Dom0 calls hypercall to retrieve nonurgent telemetry */
   85.11  #define XEN_MC_NONURGENT  0x0001
   85.12 @@ -125,13 +125,13 @@ struct mcinfo_global {
   85.13  
   85.14      /* running domain at the time in error (most likely the impacted one) */
   85.15      uint16_t mc_domid;
   85.16 +    uint16_t mc_vcpuid; /* virtual cpu scheduled for mc_domid */
   85.17      uint32_t mc_socketid; /* physical socket of the physical core */
   85.18      uint16_t mc_coreid; /* physical impacted core */
   85.19 -    uint32_t mc_apicid;
   85.20      uint16_t mc_core_threadid; /* core thread of physical core */
   85.21 -    uint16_t mc_vcpuid; /* virtual cpu scheduled for mc_domid */
   85.22 +    uint32_t mc_apicid;
   85.23 +    uint32_t mc_flags;
   85.24      uint64_t mc_gstatus; /* global status */
   85.25 -    uint32_t mc_flags;
   85.26  };
   85.27  
   85.28  /* contains bank local x86 mc information */
   85.29 @@ -166,11 +166,11 @@ struct mcinfo_extended {
   85.30  
   85.31      uint32_t mc_msrs; /* Number of msr with valid values. */
   85.32      /*
   85.33 -     * Currently Intel extended MSR (32/64) including all gp registers
   85.34 -     * and E(R)DI, E(R)BP, E(R)SP, E(R)FLAGS, E(R)IP, E(R)MISC, only 10
   85.35 -     * of them might be useful. So expend this array to 10.
   85.36 -    */
   85.37 -    struct mcinfo_msr mc_msr[10];
   85.38 +     * Currently Intel extended MSR (32/64) include all gp registers
   85.39 +     * and E(R)FLAGS, E(R)IP, E(R)MISC, up to 11/19 of them might be
   85.40 +     * useful at present. So expand this array to 16/32 to leave room.
   85.41 +     */
   85.42 +    struct mcinfo_msr mc_msr[sizeof(void *) * 4];
   85.43  };
   85.44  
   85.45  /* Recovery Action flags. Giving recovery result information to DOM0 */
   85.46 @@ -216,8 +216,9 @@ struct cpu_offline_action
   85.47  };
   85.48  
   85.49  #define MAX_UNION_SIZE 16
   85.50 -struct mc_recovery
   85.51 +struct mcinfo_recovery
   85.52  {
   85.53 +    struct mcinfo_common common;
   85.54      uint16_t mc_bank; /* bank nr */
   85.55      uint8_t action_flags;
   85.56      uint8_t action_types;
   85.57 @@ -228,12 +229,6 @@ struct mc_recovery
   85.58      } action_info;
   85.59  };
   85.60  
   85.61 -struct mcinfo_recovery
   85.62 -{
   85.63 -    struct mcinfo_common common;
   85.64 -    struct mc_recovery mc_action;
   85.65 -};
   85.66 -
   85.67  
   85.68  #define MCINFO_HYPERCALLSIZE	1024
   85.69  #define MCINFO_MAXSIZE		768
   85.70 @@ -241,8 +236,8 @@ struct mcinfo_recovery
   85.71  struct mc_info {
   85.72      /* Number of mcinfo_* entries in mi_data */
   85.73      uint32_t mi_nentries;
   85.74 -
   85.75 -    uint8_t mi_data[MCINFO_MAXSIZE - sizeof(uint32_t)];
   85.76 +    uint32_t _pad0;
   85.77 +    uint64_t mi_data[(MCINFO_MAXSIZE - 1) / 8];
   85.78  };
   85.79  typedef struct mc_info mc_info_t;
   85.80  DEFINE_XEN_GUEST_HANDLE(mc_info_t);
   85.81 @@ -258,7 +253,7 @@ DEFINE_XEN_GUEST_HANDLE(mc_info_t);
   85.82  #define MC_CAPS_VIA	5	/* cpuid level 0xc0000001 */
   85.83  #define MC_CAPS_AMD_ECX	6	/* cpuid level 0x80000001 (%ecx) */
   85.84  
   85.85 -typedef struct mcinfo_logical_cpu {
   85.86 +struct mcinfo_logical_cpu {
   85.87      uint32_t mc_cpunr;          
   85.88      uint32_t mc_chipid; 
   85.89      uint16_t mc_coreid;
   85.90 @@ -280,7 +275,8 @@ typedef struct mcinfo_logical_cpu {
   85.91      uint32_t mc_cache_alignment;
   85.92      int32_t mc_nmsrvals;
   85.93      struct mcinfo_msr mc_msrvalues[__MC_MSR_ARRAYSIZE];
   85.94 -} xen_mc_logical_cpu_t;
   85.95 +};
   85.96 +typedef struct mcinfo_logical_cpu xen_mc_logical_cpu_t;
   85.97  DEFINE_XEN_GUEST_HANDLE(xen_mc_logical_cpu_t);
   85.98  
   85.99  
  85.100 @@ -299,12 +295,12 @@ DEFINE_XEN_GUEST_HANDLE(xen_mc_logical_c
  85.101   *    struct mcinfo_common *x86_mcinfo_first(struct mc_info *mi);
  85.102   */
  85.103  #define x86_mcinfo_first(_mi)       \
  85.104 -    (struct mcinfo_common *)((_mi)->mi_data)
  85.105 +    ((struct mcinfo_common *)(_mi)->mi_data)
  85.106  /* Prototype:
  85.107   *    struct mcinfo_common *x86_mcinfo_next(struct mcinfo_common *mic);
  85.108   */
  85.109  #define x86_mcinfo_next(_mic)       \
  85.110 -    (struct mcinfo_common *)((uint8_t *)(_mic) + (_mic)->size)
  85.111 +    ((struct mcinfo_common *)((uint8_t *)(_mic) + (_mic)->size))
  85.112  
  85.113  /* Prototype:
  85.114   *    void x86_mcinfo_lookup(void *ret, struct mc_info *mi, uint16_t type);
  85.115 @@ -350,6 +346,7 @@ struct xen_mc_fetch {
  85.116                             XEN_MC_ACK if ack'ing an earlier fetch */
  85.117  			/* OUT: XEN_MC_OK, XEN_MC_FETCHFAILED,
  85.118  			   XEN_MC_NODATA, XEN_MC_NOMATCH */
  85.119 +    uint32_t _pad0;
  85.120      uint64_t fetch_id;	/* OUT: id for ack, IN: id we are ack'ing */
  85.121  
  85.122      /* OUT variables. */
  85.123 @@ -382,7 +379,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_mc_notifydom
  85.124  struct xen_mc_physcpuinfo {
  85.125  	/* IN/OUT */
  85.126  	uint32_t ncpus;
  85.127 -	uint32_t pad0;
  85.128 +	uint32_t _pad0;
  85.129  	/* OUT */
  85.130  	XEN_GUEST_HANDLE(xen_mc_logical_cpu_t) info;
  85.131  };
  85.132 @@ -391,10 +388,10 @@ struct xen_mc_physcpuinfo {
  85.133  #define MC_MSRINJ_MAXMSRS       8
  85.134  struct xen_mc_msrinject {
  85.135         /* IN */
  85.136 -	unsigned int mcinj_cpunr;       /* target processor id */
  85.137 +	uint32_t mcinj_cpunr;           /* target processor id */
  85.138  	uint32_t mcinj_flags;           /* see MC_MSRINJ_F_* below */
  85.139  	uint32_t mcinj_count;           /* 0 .. count-1 in array are valid */
  85.140 -	uint32_t mcinj_pad0;
  85.141 +	uint32_t _pad0;
  85.142  	struct mcinfo_msr mcinj_msr[MC_MSRINJ_MAXMSRS];
  85.143  };
  85.144  
  85.145 @@ -406,18 +403,16 @@ struct xen_mc_mceinject {
  85.146  	unsigned int mceinj_cpunr;      /* target processor id */
  85.147  };
  85.148  
  85.149 -typedef union {
  85.150 -    struct xen_mc_fetch        mc_fetch;
  85.151 -    struct xen_mc_notifydomain mc_notifydomain;
  85.152 -    struct xen_mc_physcpuinfo  mc_physcpuinfo;
  85.153 -    struct xen_mc_msrinject    mc_msrinject;
  85.154 -    struct xen_mc_mceinject    mc_mceinject;
  85.155 -} xen_mc_arg_t;
  85.156 -
  85.157  struct xen_mc {
  85.158      uint32_t cmd;
  85.159      uint32_t interface_version; /* XEN_MCA_INTERFACE_VERSION */
  85.160 -    xen_mc_arg_t u;
  85.161 +    union {
  85.162 +        struct xen_mc_fetch        mc_fetch;
  85.163 +        struct xen_mc_notifydomain mc_notifydomain;
  85.164 +        struct xen_mc_physcpuinfo  mc_physcpuinfo;
  85.165 +        struct xen_mc_msrinject    mc_msrinject;
  85.166 +        struct xen_mc_mceinject    mc_mceinject;
  85.167 +    } u;
  85.168  };
  85.169  typedef struct xen_mc xen_mc_t;
  85.170  DEFINE_XEN_GUEST_HANDLE(xen_mc_t);
    86.1 --- a/xen/include/public/arch-x86/xen.h	Tue Apr 07 11:29:44 2009 +0900
    86.2 +++ b/xen/include/public/arch-x86/xen.h	Tue Apr 07 11:32:24 2009 +0900
    86.3 @@ -76,10 +76,6 @@ typedef unsigned long xen_pfn_t;
    86.4  /* Maximum number of virtual CPUs in multi-processor guests. */
    86.5  #define MAX_VIRT_CPUS 32
    86.6  
    86.7 -
    86.8 -/* Machine check support */
    86.9 -#include "xen-mca.h"
   86.10 -
   86.11  #ifndef __ASSEMBLY__
   86.12  
   86.13  typedef unsigned long xen_ulong_t;
    87.1 --- a/xen/include/public/domctl.h	Tue Apr 07 11:29:44 2009 +0900
    87.2 +++ b/xen/include/public/domctl.h	Tue Apr 07 11:32:24 2009 +0900
    87.3 @@ -433,6 +433,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_
    87.4  #define XEN_DOMCTL_SENDTRIGGER_NMI    0
    87.5  #define XEN_DOMCTL_SENDTRIGGER_RESET  1
    87.6  #define XEN_DOMCTL_SENDTRIGGER_INIT   2
    87.7 +#define XEN_DOMCTL_SENDTRIGGER_POWER  3
    87.8  struct xen_domctl_sendtrigger {
    87.9      uint32_t  trigger;  /* IN */
   87.10      uint32_t  vcpu;     /* IN */
    88.1 --- a/xen/include/public/sysctl.h	Tue Apr 07 11:29:44 2009 +0900
    88.2 +++ b/xen/include/public/sysctl.h	Tue Apr 07 11:32:24 2009 +0900
    88.3 @@ -382,6 +382,14 @@ struct xen_sysctl_pm_op {
    88.4      /* set/reset scheduler power saving option */
    88.5      #define XEN_SYSCTL_pm_op_set_sched_opt_smt    0x21
    88.6  
    88.7 +    /* cpuidle max_cstate access command */
    88.8 +    #define XEN_SYSCTL_pm_op_get_max_cstate       0x22
    88.9 +    #define XEN_SYSCTL_pm_op_set_max_cstate       0x23
   88.10 +
   88.11 +    /* set scheduler migration cost value */
   88.12 +    #define XEN_SYSCTL_pm_op_set_vcpu_migration_delay   0x24
   88.13 +    #define XEN_SYSCTL_pm_op_get_vcpu_migration_delay   0x25
   88.14 +
   88.15      uint32_t cmd;
   88.16      uint32_t cpuid;
   88.17      union {
   88.18 @@ -391,6 +399,10 @@ struct xen_sysctl_pm_op {
   88.19          uint64_t get_avgfreq;
   88.20          struct xen_get_cputopo      get_topo;
   88.21          uint32_t                    set_sched_opt_smt;
   88.22 +        uint32_t                    get_max_cstate;
   88.23 +        uint32_t                    set_max_cstate;
   88.24 +        uint32_t                    get_vcpu_migration_delay;
   88.25 +        uint32_t                    set_vcpu_migration_delay;
   88.26      };
   88.27  };
   88.28  
    89.1 --- a/xen/include/xen/acpi.h	Tue Apr 07 11:29:44 2009 +0900
    89.2 +++ b/xen/include/xen/acpi.h	Tue Apr 07 11:32:24 2009 +0900
    89.3 @@ -282,7 +282,6 @@ typedef int (*acpi_table_entry_handler) 
    89.4  
    89.5  unsigned int acpi_get_processor_id (unsigned int cpu);
    89.6  char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
    89.7 -unsigned long acpi_find_rsdp (void);
    89.8  int acpi_boot_init (void);
    89.9  int acpi_boot_table_init (void);
   89.10  int acpi_numa_init (void);
   89.11 @@ -403,9 +402,7 @@ static inline int acpi_blacklisted(void)
   89.12  
   89.13  #endif /*!CONFIG_ACPI_INTERPRETER*/
   89.14  
   89.15 -#define	ACPI_CSTATE_LIMIT_DEFINED	/* for driver builds */
   89.16 -#ifdef	CONFIG_ACPI
   89.17 -
   89.18 +#ifdef	CONFIG_ACPI_CSTATE
   89.19  /*
   89.20   * Set highest legal C-state
   89.21   * 0: C0 okay, but not C1
    90.1 --- a/xen/include/xen/iommu.h	Tue Apr 07 11:29:44 2009 +0900
    90.2 +++ b/xen/include/xen/iommu.h	Tue Apr 07 11:32:24 2009 +0900
    90.3 @@ -55,7 +55,7 @@ struct iommu {
    90.4      spinlock_t lock; /* protect context, domain ids */
    90.5      spinlock_t register_lock; /* protect iommu register handling */
    90.6      u64 root_maddr; /* root entry machine address */
    90.7 -    unsigned int vector;
    90.8 +    int vector;
    90.9      struct intel_iommu *intel;
   90.10  };
   90.11  
    91.1 --- a/xen/include/xen/lib.h	Tue Apr 07 11:29:44 2009 +0900
    91.2 +++ b/xen/include/xen/lib.h	Tue Apr 07 11:32:24 2009 +0900
    91.3 @@ -12,8 +12,8 @@
    91.4  void __bug(char *file, int line) __attribute__((noreturn));
    91.5  void __warn(char *file, int line);
    91.6  
    91.7 -#define BUG_ON(p)  do { if (p) BUG();  } while (0)
    91.8 -#define WARN_ON(p) do { if (p) WARN(); } while (0)
    91.9 +#define BUG_ON(p)  do { if (unlikely(p)) BUG();  } while (0)
   91.10 +#define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
   91.11  
   91.12  /* Force a compilation error if condition is true */
   91.13  #define BUILD_BUG_ON(condition) ((void)sizeof(struct { int:-!!(condition); }))
    92.1 --- a/xen/include/xen/sched-if.h	Tue Apr 07 11:29:44 2009 +0900
    92.2 +++ b/xen/include/xen/sched-if.h	Tue Apr 07 11:32:24 2009 +0900
    92.3 @@ -77,6 +77,9 @@ struct scheduler {
    92.4                                      struct xen_domctl_scheduler_op *);
    92.5      void         (*dump_settings)  (void);
    92.6      void         (*dump_cpu_state) (int);
    92.7 +
    92.8 +    void         (*tick_suspend)    (void);
    92.9 +    void         (*tick_resume)     (void);
   92.10  };
   92.11  
   92.12  #endif /* __XEN_SCHED_IF_H__ */
    93.1 --- a/xen/include/xen/sched.h	Tue Apr 07 11:29:44 2009 +0900
    93.2 +++ b/xen/include/xen/sched.h	Tue Apr 07 11:32:24 2009 +0900
    93.3 @@ -428,6 +428,8 @@ int  sched_init_domain(struct domain *d)
    93.4  void sched_destroy_domain(struct domain *d);
    93.5  long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *);
    93.6  int  sched_id(void);
    93.7 +void sched_tick_suspend(void);
    93.8 +void sched_tick_resume(void);
    93.9  void vcpu_wake(struct vcpu *d);
   93.10  void vcpu_sleep_nosync(struct vcpu *d);
   93.11  void vcpu_sleep_sync(struct vcpu *d);
   93.12 @@ -550,6 +552,9 @@ uint64_t get_cpu_idle_time(unsigned int 
   93.13  #define is_hvm_vcpu(v)   (is_hvm_domain(v->domain))
   93.14  #define need_iommu(d)    ((d)->need_iommu && !(d)->is_hvm)
   93.15  
   93.16 +void set_vcpu_migration_delay(unsigned int delay);
   93.17 +unsigned int get_vcpu_migration_delay(void);
   93.18 +
   93.19  extern int sched_smt_power_savings;
   93.20  
   93.21  extern enum cpufreq_controller {
    94.1 --- a/xen/include/xlat.lst	Tue Apr 07 11:29:44 2009 +0900
    94.2 +++ b/xen/include/xlat.lst	Tue Apr 07 11:32:24 2009 +0900
    94.3 @@ -10,6 +10,22 @@
    94.4  !	cpu_user_regs			arch-x86/xen-@arch@.h
    94.5  !	trap_info			arch-x86/xen.h
    94.6  !	vcpu_guest_context		arch-x86/xen.h
    94.7 +?	cpu_offline_action		arch-x86/xen-mca.h
    94.8 +?	mc				arch-x86/xen-mca.h
    94.9 +?	mcinfo_bank			arch-x86/xen-mca.h
   94.10 +?	mcinfo_common			arch-x86/xen-mca.h
   94.11 +?	mcinfo_extended			arch-x86/xen-mca.h
   94.12 +?	mcinfo_global			arch-x86/xen-mca.h
   94.13 +?	mcinfo_logical_cpu		arch-x86/xen-mca.h
   94.14 +?	mcinfo_msr			arch-x86/xen-mca.h
   94.15 +?	mcinfo_recovery			arch-x86/xen-mca.h
   94.16 +!	mc_fetch			arch-x86/xen-mca.h
   94.17 +?	mc_info				arch-x86/xen-mca.h
   94.18 +?	mc_mceinject			arch-x86/xen-mca.h
   94.19 +?	mc_msrinject			arch-x86/xen-mca.h
   94.20 +?	mc_notifydomain			arch-x86/xen-mca.h
   94.21 +!	mc_physcpuinfo			arch-x86/xen-mca.h
   94.22 +?	page_offline_action		arch-x86/xen-mca.h
   94.23  ?	evtchn_alloc_unbound		event_channel.h
   94.24  ?	evtchn_bind_interdomain		event_channel.h
   94.25  ?	evtchn_bind_ipi			event_channel.h
    95.1 --- a/xen/include/xsm/xsm.h	Tue Apr 07 11:29:44 2009 +0900
    95.2 +++ b/xen/include/xsm/xsm.h	Tue Apr 07 11:32:24 2009 +0900
    95.3 @@ -75,6 +75,8 @@ struct xsm_operations {
    95.4      int (*debug_keys) (void);
    95.5      int (*getcpuinfo) (void);
    95.6      int (*availheap) (void);
    95.7 +    int (*get_pmstat) (void);
    95.8 +    int (*pm_op) (void);
    95.9  
   95.10      int (*evtchn_unbound) (struct domain *d, struct evtchn *chn, domid_t id2);
   95.11      int (*evtchn_interdomain) (struct domain *d1, struct evtchn *chn1,
   95.12 @@ -282,6 +284,16 @@ static inline int xsm_getcpuinfo (void)
   95.13      return xsm_call(getcpuinfo());
   95.14  }
   95.15  
   95.16 +static inline int xsm_get_pmstat(void)
   95.17 +{
   95.18 +    return xsm_call(get_pmstat());
   95.19 +}
   95.20 +
   95.21 +static inline int xsm_pm_op(void)
   95.22 +{
   95.23 +    return xsm_call(pm_op());
   95.24 +}
   95.25 +
   95.26  static inline int xsm_evtchn_unbound (struct domain *d1, struct evtchn *chn,
   95.27                                                                      domid_t id2)
   95.28  {
    96.1 --- a/xen/tools/get-fields.sh	Tue Apr 07 11:29:44 2009 +0900
    96.2 +++ b/xen/tools/get-fields.sh	Tue Apr 07 11:32:24 2009 +0900
    96.3 @@ -328,7 +328,7 @@ check_field ()
    96.4  				struct|union)
    96.5  					;;
    96.6  				[a-zA-Z_]*)
    96.7 -					echo -n "    CHECK_$n"
    96.8 +					echo -n "    CHECK_${n#xen_}"
    96.9  					break
   96.10  					;;
   96.11  				*)
    97.1 --- a/xen/xsm/dummy.c	Tue Apr 07 11:29:44 2009 +0900
    97.2 +++ b/xen/xsm/dummy.c	Tue Apr 07 11:32:24 2009 +0900
    97.3 @@ -134,6 +134,16 @@ static int dummy_getcpuinfo (void)
    97.4      return 0;
    97.5  }
    97.6  
    97.7 +static int dummy_get_pmstat (void)
    97.8 +{
    97.9 +    return 0;
   97.10 +}
   97.11 +
   97.12 +static int dummy_pm_op (void)
   97.13 +{
   97.14 +    return 0;
   97.15 +}
   97.16 +
   97.17  static int dummy_availheap (void)
   97.18  {
   97.19      return 0;