OBS User unknown 2007-05-22 23:45:46 +00:00 committed by Git OBS Bridge
parent 0a63222b01
commit 4246413f13
16 changed files with 2102 additions and 590 deletions

View File

@ -1,56 +0,0 @@
## Path:
## Description:
## Type: list(eth0 eth1 eth2 eth3)
## Default: "eth0 eth1 eth2"
## Config:
#
# Space delimited list of physical network
# devices to create traditional bridges on
#
NETDEV_LIST="eth0 eth1 eth2"
## Path:
## Description:
## Type: list(0 1 2 3)
## Default: "4 5 6 7"
## Config:
#
# Space delimited list of bridge numbers to
# create empty bridges on.
#
EMPTY_BRIDGE_LIST="4 5 6 7"
## Path:
## Description:
## Type: string(xenbr)
## Default: "xenbr"
## Config:
#
# Name of bridge to create (example: xenbr)
#
BRIDGE_NAME="xenbr"
## Path:
## Description:
## Type: list(veth1,00:16:3E:01:00:01,172.16.0.1/16 veth2,00:16:3E:01:00:02,172.17.0.1/16)
## Default: "veth3,00:16:3E:01:00:03,172.16.0.1/16"
## Config:
#
# Space delimited list of virtual network devices,mac addresses
# and IP addresses to create host bridges on using the
# following format:
#
# <virtual network device>,<mac address>,<IP address/CIDR NetMask>
#
HOST_BRIDGE_LIST="veth3,00:16:3E:01:00:03,172.16.0.1/16"
## Path:
## Type: string(/etc/xen/scripts)
## Default: "/etc/xen/scripts"
## Config:
#
# Path to the directory containing the xen
# network-bridge script (typically /etc/xen/scripts)
#
SCRIPT_PATH="/etc/xen/scripts"

View File

@ -1,6 +1,6 @@
Index: 2007-05-14/xen/arch/x86/mm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm.c 2007-05-14 13:44:25.000000000 +0200
--- 2007-05-14.orig/xen/arch/x86/mm.c 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm.c 2007-05-14 14:33:33.000000000 +0200
@@ -2896,7 +2896,7 @@ long do_set_gdt(XEN_GUEST_HANDLE(ulong)
if ( entries > FIRST_RESERVED_GDT_ENTRY )
@ -49,7 +49,7 @@ Index: 2007-05-14/xen/arch/x86/mm.c
.max_mfn = MACH2PHYS_NR_ENTRIES - 1
Index: 2007-05-14/xen/arch/x86/traps.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/traps.c 2007-05-14 13:43:46.000000000 +0200
--- 2007-05-14.orig/xen/arch/x86/traps.c 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/arch/x86/traps.c 2007-05-14 14:33:33.000000000 +0200
@@ -1117,7 +1117,7 @@ static inline int guest_io_okay(
* read as 0xff (no access allowed).
@ -62,7 +62,7 @@ Index: 2007-05-14/xen/arch/x86/traps.c
default: x.bytes[0] = ~0;
Index: 2007-05-14/xen/common/domctl.c
===================================================================
--- 2007-05-14.orig/xen/common/domctl.c 2007-04-26 09:25:12.000000000 +0200
--- 2007-05-14.orig/xen/common/domctl.c 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/common/domctl.c 2007-05-14 14:33:33.000000000 +0200
@@ -43,7 +43,7 @@ void cpumask_to_xenctl_cpumap(
@ -84,7 +84,7 @@ Index: 2007-05-14/xen/common/domctl.c
}
Index: 2007-05-14/xen/common/kernel.c
===================================================================
--- 2007-05-14.orig/xen/common/kernel.c 2007-05-14 13:43:09.000000000 +0200
--- 2007-05-14.orig/xen/common/kernel.c 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/common/kernel.c 2007-05-14 14:33:33.000000000 +0200
@@ -142,7 +142,7 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
{
@ -126,7 +126,7 @@ Index: 2007-05-14/xen/common/kernel.c
}
Index: 2007-05-14/xen/common/perfc.c
===================================================================
--- 2007-05-14.orig/xen/common/perfc.c 2007-04-26 09:25:12.000000000 +0200
--- 2007-05-14.orig/xen/common/perfc.c 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/common/perfc.c 2007-05-14 14:33:33.000000000 +0200
@@ -227,7 +227,7 @@ static int perfc_copy_info(XEN_GUEST_HAN
}
@ -139,7 +139,7 @@ Index: 2007-05-14/xen/common/perfc.c
return -EFAULT;
Index: 2007-05-14/xen/drivers/char/console.c
===================================================================
--- 2007-05-14.orig/xen/drivers/char/console.c 2007-04-23 10:01:44.000000000 +0200
--- 2007-05-14.orig/xen/drivers/char/console.c 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/drivers/char/console.c 2007-05-14 14:33:33.000000000 +0200
@@ -326,7 +326,7 @@ static long guest_console_write(XEN_GUES
CONSOLEIO_write, count, buffer);
@ -150,10 +150,57 @@ Index: 2007-05-14/xen/drivers/char/console.c
return -EFAULT;
kbuf[kcount] = '\0';
Index: 2007-05-14/xen/include/asm-ia64/guest_access.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-ia64/guest_access.h 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/include/asm-ia64/guest_access.h 2007-05-15 12:23:53.000000000 +0200
@@ -76,28 +76,31 @@ extern int xencomm_handle_is_null(void *
__copy_field_from_guest(ptr, hnd, field)
#define __copy_to_guest_offset(hnd, idx, ptr, nr) ({ \
- const typeof(ptr) _d = (hnd).p; \
- const typeof(ptr) _s = (ptr); \
+ const typeof(*(ptr)) *_s = (ptr); \
+ void *_d = (hnd).p; \
+ ((void)((hnd).p == (ptr))); \
xencomm_copy_to_guest(_d, _s, sizeof(*_s)*(nr), sizeof(*_s)*(idx)); \
})
#define __copy_field_to_guest(hnd, ptr, field) ({ \
- const int _off = offsetof(typeof(*ptr), field); \
- const typeof(ptr) _d = (hnd).p; \
+ unsigned int _off = offsetof(typeof(*(hnd).p), field); \
const typeof(&(ptr)->field) _s = &(ptr)->field; \
+ void *_d = (hnd).p; \
+ ((void)(&(hnd).p->field == &(ptr)->field)); \
xencomm_copy_to_guest(_d, _s, sizeof(*_s), _off); \
})
-#define __copy_from_guest_offset(ptr, hnd, idx, nr) ({ \
- const typeof(ptr) _s = (hnd).p; \
- const typeof(ptr) _d = (ptr); \
- xencomm_copy_from_guest(_d, _s, sizeof(*_s)*(nr), sizeof(*_s)*(idx)); \
+#define __copy_from_guest_offset(ptr, hnd, idx, nr) ({ \
+ const typeof(*(ptr)) *_s = (hnd).p; \
+ typeof(*(ptr)) *_d = (ptr); \
+ xencomm_copy_from_guest(_d, _s, sizeof(*_d)*(nr), sizeof(*_d)*(idx)); \
})
#define __copy_field_from_guest(ptr, hnd, field) ({ \
- const int _off = offsetof(typeof(*ptr), field); \
- const typeof(ptr) _s = (hnd).p; \
- const typeof(&(ptr)->field) _d = &(ptr)->field; \
+ unsigned int _off = offsetof(typeof(*(hnd).p), field); \
+ const void *_s = (hnd).p; \
+ typeof(&(ptr)->field) _d = &(ptr)->field; \
+ ((void)(&(hnd).p->field == &(ptr)->field)); \
xencomm_copy_from_guest(_d, _s, sizeof(*_d), _off); \
})
Index: 2007-05-14/xen/include/asm-x86/guest_access.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/guest_access.h 2007-04-23 10:01:46.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/guest_access.h 2007-05-14 14:33:33.000000000 +0200
--- 2007-05-14.orig/xen/include/asm-x86/guest_access.h 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/guest_access.h 2007-05-15 12:15:25.000000000 +0200
@@ -32,11 +32,12 @@
* specifying an offset into the guest array.
*/
@ -171,7 +218,7 @@ Index: 2007-05-14/xen/include/asm-x86/guest_access.h
})
/*
@@ -44,29 +45,31 @@
@@ -44,29 +45,30 @@
* specifying an offset into the guest array.
*/
#define copy_from_guest_offset(ptr, hnd, off, nr) ({ \
@ -192,7 +239,7 @@ Index: 2007-05-14/xen/include/asm-x86/guest_access.h
- const typeof(&(ptr)->field) _y = &(ptr)->field; \
+ const typeof(&(ptr)->field) _s = &(ptr)->field; \
+ void *_d = &(hnd).p->field; \
+ ((void)((hnd).p == (ptr))); \
+ ((void)(&(hnd).p->field == &(ptr)->field)); \
is_hvm_vcpu(current) ? \
- copy_to_user_hvm(_x, _y, sizeof(*_x)) : \
- copy_to_user(_x, _y, sizeof(*_x)); \
@ -204,9 +251,8 @@ Index: 2007-05-14/xen/include/asm-x86/guest_access.h
#define copy_field_from_guest(ptr, hnd, field) ({ \
- const typeof(&(ptr)->field) _x = &(hnd).p->field; \
- typeof(&(ptr)->field) _y = &(ptr)->field; \
+ const void *_s = &(hnd).p->field; \
+ const typeof(&(ptr)->field) _s = &(hnd).p->field; \
+ typeof(&(ptr)->field) _d = &(ptr)->field; \
+ ((void)((hnd).p == (ptr))); \
is_hvm_vcpu(current) ? \
- copy_from_user_hvm(_y, _x, sizeof(*_x)) : \
- copy_from_user(_y, _x, sizeof(*_x)); \
@ -215,7 +261,7 @@ Index: 2007-05-14/xen/include/asm-x86/guest_access.h
})
/*
@@ -78,35 +81,37 @@
@@ -78,35 +80,37 @@
array_access_ok((hnd).p, (nr), sizeof(*(hnd).p)))
#define __copy_to_guest_offset(hnd, off, ptr, nr) ({ \
@ -271,8 +317,8 @@ Index: 2007-05-14/xen/include/asm-x86/guest_access.h
#endif /* __ASM_X86_GUEST_ACCESS_H__ */
Index: 2007-05-14/xen/include/xen/compat.h
===================================================================
--- 2007-05-14.orig/xen/include/xen/compat.h 2007-04-23 10:01:47.000000000 +0200
+++ 2007-05-14/xen/include/xen/compat.h 2007-05-14 14:33:33.000000000 +0200
--- 2007-05-14.orig/xen/include/xen/compat.h 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/include/xen/compat.h 2007-05-15 12:18:41.000000000 +0200
@@ -44,9 +44,10 @@
* specifying an offset into the guest array.
*/
@ -300,7 +346,7 @@ Index: 2007-05-14/xen/include/xen/compat.h
})
#define copy_to_compat(hnd, ptr, nr) \
@@ -67,16 +68,18 @@
@@ -67,16 +68,17 @@
/* Copy sub-field of a structure to guest context via a compat handle. */
#define copy_field_to_compat(hnd, ptr, field) ({ \
@ -309,7 +355,7 @@ Index: 2007-05-14/xen/include/xen/compat.h
- copy_to_user(_x, _y, sizeof(*_x)); \
+ const typeof(&(ptr)->field) _s = &(ptr)->field; \
+ void *_d = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
+ ((void)((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c == (ptr))); \
+ ((void)(&((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field == &(ptr)->field)); \
+ copy_to_user(_d, _s, sizeof(*_s)); \
})
@ -318,14 +364,13 @@ Index: 2007-05-14/xen/include/xen/compat.h
- typeof((ptr)->field) *const _x = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
- typeof((ptr)->field) *const _y = &(ptr)->field; \
- copy_from_user(_y, _x, sizeof(*_x)); \
+ const void *_s = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
+ const typeof(&(ptr)->field) _s = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
+ typeof(&(ptr)->field) _d = &(ptr)->field; \
+ ((void)((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c == (ptr))); \
+ copy_from_user(_d, _s, sizeof(*_d)); \
})
/*
@@ -87,15 +90,16 @@
@@ -87,15 +89,16 @@
compat_array_access_ok((void *)(full_ptr_t)(hnd).c, (nr), sizeof(**(hnd)._))
#define __copy_to_compat_offset(hnd, off, ptr, nr) ({ \
@ -348,7 +393,7 @@ Index: 2007-05-14/xen/include/xen/compat.h
})
#define __copy_to_compat(hnd, ptr, nr) \
@@ -105,15 +109,17 @@
@@ -105,15 +108,16 @@
__copy_from_compat_offset(ptr, hnd, 0, nr)
#define __copy_field_to_compat(hnd, ptr, field) ({ \
@ -357,7 +402,7 @@ Index: 2007-05-14/xen/include/xen/compat.h
- __copy_to_user(_x, _y, sizeof(*_x)); \
+ const typeof(&(ptr)->field) _s = &(ptr)->field; \
+ void *_d = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
+ ((void)((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c == (ptr))); \
+ ((void)(&((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field == &(ptr)->field)); \
+ __copy_to_user(_d, _s, sizeof(*_s)); \
})
@ -365,10 +410,60 @@ Index: 2007-05-14/xen/include/xen/compat.h
- typeof((ptr)->field) *const _x = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
- typeof((ptr)->field) *const _y = &(ptr)->field; \
- __copy_from_user(_y, _x, sizeof(*_x)); \
+ const void *_s = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
+ const typeof(&(ptr)->field) _s = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
+ typeof(&(ptr)->field) _d = &(ptr)->field; \
+ ((void)((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c == (ptr))); \
+ __copy_from_user(_d, _s, sizeof(*_d)); \
})
Index: 2007-05-14/xen/include/xen/xencomm.h
===================================================================
--- 2007-05-14.orig/xen/include/xen/xencomm.h 2007-05-15 12:07:55.000000000 +0200
+++ 2007-05-14/xen/include/xen/xencomm.h 2007-05-15 12:25:21.000000000 +0200
@@ -87,29 +87,32 @@ static inline unsigned long xencomm_inli
__copy_field_from_guest(ptr, hnd, field)
#define __copy_to_guest_offset(hnd, idx, ptr, nr) ({ \
- const typeof(ptr) _x = (hnd).p; \
- const typeof(ptr) _y = (ptr); \
- xencomm_copy_to_guest(_x, _y, sizeof(*_x)*(nr), sizeof(*_x)*(idx)); \
+ const typeof(*(ptr)) *_s = (ptr); \
+ void *_d = (hnd).p; \
+ ((void)((hnd).p == (ptr))); \
+ xencomm_copy_to_guest(_d, _s, sizeof(*_s)*(nr), sizeof(*_s)*(idx)); \
})
#define __copy_field_to_guest(hnd, ptr, field) ({ \
- const int _off = offsetof(typeof(*ptr), field); \
- const typeof(&(ptr)->field) _x = &(hnd).p->field; \
- const typeof(&(ptr)->field) _y = &(ptr)->field; \
- xencomm_copy_to_guest(_x, _y, sizeof(*_x), sizeof(*_x)*(_off)); \
+ unsigned int _off = offsetof(typeof(*(hnd).p), field); \
+ const typeof(&(ptr)->field) _s = &(ptr)->field; \
+ void *_d = (hnd).p; \
+ ((void)(&(hnd).p->field == &(ptr)->field)); \
+ xencomm_copy_to_guest(_d, _s, sizeof(*_s), _off); \
})
#define __copy_from_guest_offset(ptr, hnd, idx, nr) ({ \
- const typeof(ptr) _x = (hnd).p; \
- const typeof(ptr) _y = (ptr); \
- xencomm_copy_from_guest(_y, _x, sizeof(*_x)*(nr), sizeof(*_x)*(idx)); \
+ const typeof(*(ptr)) *_s = (hnd).p; \
+ typeof(*(ptr)) *_d = (ptr); \
+ xencomm_copy_from_guest(_d, _s, sizeof(*_d)*(nr), sizeof(*_d)*(idx)); \
})
#define __copy_field_from_guest(ptr, hnd, field) ({ \
- const int _off = offsetof(typeof(*ptr), field); \
- const typeof(&(ptr)->field) _x = &(hnd).p->field; \
- const typeof(&(ptr)->field) _y = &(ptr)->field; \
- xencomm_copy_to_guest(_y, _x, sizeof(*_x), sizeof(*_x)*(_off)); \
+ unsigned int _off = offsetof(typeof(*(hnd).p), field); \
+ const void *_s = (hnd).p; \
+ typeof(&(ptr)->field) _d = &(ptr)->field; \
+ ((void)(&(hnd).p->field == &(ptr)->field)); \
+ xencomm_copy_from_guest(_d, _s, sizeof(*_d), _off); \
})
#endif /* __XENCOMM_H__ */

View File

@ -1,9 +1,9 @@
#!/bin/bash
#
# xend Starts and stops the Xen control daemon
# xend Starts and stops the Xen management daemon
#
# chkconfig: 35 98 01
# description: Starts and stops the Xen control daemon
# description: Starts and stops the Xen management daemon
#
### BEGIN INIT INFO
# Provides: xend
@ -13,11 +13,17 @@
# Should-Stop: $time $network $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Short-Description: Starts and stops the Xen control daemon
# Description: Starts and stops the Xen control daemon. xend is needed
# to use Xen.
# Short-Description: Starts and stops the Xen management daemon
# Description: Starts and stops the Xen management daemon. xend is needed
# to create and manage VMs on Xen.
### END INIT INFO
. /etc/rc.status
rc_reset
XEND=`ps ax | grep -w xend | grep -w python | awk '{ print $1 }'`
XEND=`echo $XEND`
await_daemons_up()
{
i=1
@ -31,9 +37,6 @@ await_daemons_up()
done
}
. /etc/rc.status
rc_reset
xend_abort()
{
echo -n "xend "
@ -48,23 +51,8 @@ cleanup()
rm -f /var/lib/xen/xenbl* 2>/dev/null
}
parseln()
check()
{
name=${1:0:$((${#1}-36))}
name=${name%% *}
rest="${1: -36}"
id=${rest:0:4}
id=`echo $id`
mem=${rest:4:6}
mem=`echo $mem`
vcpu=${rest:10:6}
vcpu=`echo $vcpu`
state=${rest:16:11}
state=`echo $state`
tm=${rest:27}
tm=`echo $tm`
}
if [ "$1" == status ]; then
if [ ! -e /proc/xen/capabilities ]; then
xend_abort 3
@ -83,12 +71,11 @@ else
fi
fi
fi
XEND=`ps ax | grep xend | grep python | awk '{ print $1 }'`
XEND=`echo $XEND`
}
case "$1" in
start)
check $1
echo -n "Starting xend "
if [ ! -z "$XEND" ]; then
echo -n "(already running pid $XEND) "
@ -111,6 +98,7 @@ case "$1" in
await_daemons_up
;;
stop)
check $1
echo -n "Stopping xend "
if [ -z "$XEND" ]; then
echo -n "(not running) "
@ -124,6 +112,7 @@ case "$1" in
fi
;;
status)
check $1
echo -n "Checking status of xend "
if [ ! -z "$XEND" ]; then
echo -n "(pid $XEND) "
@ -131,6 +120,7 @@ case "$1" in
xend status
;;
restart|reload)
check $1
echo -n "Restarting xend "
if [ -z "$XEND" ]; then
echo -n "(not running) "
@ -141,6 +131,7 @@ case "$1" in
await_daemons_up
;;
try-restart)
check $1
$0 status
if [ $? = 0 ]; then
$0 restart

View File

@ -1,9 +1,9 @@
#!/bin/bash
#
# xendomains Starts and stops secondary Xen domains
# xendomains Starts and stops Xen VMs
#
# chkconfig: 35 99 00
# description: Starts and stops secondary Xen domains
# description: Starts and stops Xen VMs
#
### BEGIN INIT INFO
# Provides: xendomains
@ -13,19 +13,19 @@
# Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Short-Description: Starts and stops secondary Xen domains
# Description: Starts and stops secondary Xen domains automatically
# when domain 0 starts and stops.
# Short-Description: Starts and stops Xen VMs
# Description: Starts and stops Xen VMs automatically when the
# host starts and stops.
### END INIT INFO
# FIXME: Watch out for domain names with invalid characters.
. /etc/rc.status
rc_reset
LOCKFILE=/var/lock/subsys/xendomains
XENDOM_CONFIG=/etc/sysconfig/xendomains
RETCODE_FILE=/var/lock/subsys/xendomains.rc.$$
RETCODE_FILE=/tmp/xendomains.rc.$$
. "$XENDOM_CONFIG"
shopt -s dotglob nullglob
@ -53,18 +53,21 @@ xendomains_abort()
rc_exit
}
check()
{
XEND=`ps ax | grep -w xend | grep -w python | awk '{ print $1 }'`
XEND=`echo $XEND`
if [ "$1" = status ]; then
if [ ! -e /proc/xen/privcmd ]; then
xendomains_abort 3
fi
if [ ! -r "$XENDOM_CONFIG" ]; then
if [ ! -e /proc/xen/capabilities ] || [ ! -r "$XENDOM_CONFIG" ] || [ -z "$XEND" ]; then
xendomains_abort 3
fi
else
if [ `id -u` != 0 ]; then
xendomains_abort 4
fi
if [ ! -e /proc/xen/privcmd ]; then
if [ ! -e /proc/xen/capabilities ] || [ -z "$XEND" ] ||
! grep control_d /proc/xen/capabilities >/dev/null 2>&1; then
if [ "$1" = stop ] ||
[ "$1" = restart ]; then
xendomains_abort 0
@ -76,8 +79,7 @@ else
xendomains_abort 6
fi
fi
. "$XENDOM_CONFIG"
}
dir_contains_something()
{
@ -88,7 +90,7 @@ dir_contains_something()
get_name_from_cfg()
{
NM=`grep '^name[ ]*=' $1 | sed -e 's/^name[ ]*=[ ]*['\''"]\([^'\''"]*\)['\''"].*$/\1/'`
NM=`grep '^name[ ]*=' "$1" | sed -e 's/^name[ ]*=[ ]*['\''"]\([^'\''"]*\)['\''"].*$/\1/'`
}
running_auto_names()
@ -120,6 +122,11 @@ parseln()
tm=`echo $tm`
}
xm_list()
{
TERM=vt100 xm list | grep -v '^Name *ID'
}
is_cfg_running()
{
get_name_from_cfg "$1"
@ -130,7 +137,7 @@ is_cfg_running()
[ -z "$state" ] && return 1
return 0
fi
done < <(xm list | grep -v '^Name *ID')
done < <(xm_list)
return 1
}
@ -204,7 +211,7 @@ any_non_zombies()
[ "$id" = 0 ] && continue
[ -z "$state" ] && continue
is_zombie_state "$state" || return 0
done < <(xm list | grep -v '^Name *ID')
done < <(xm_list)
return 1
}
@ -368,7 +375,7 @@ stop()
fi
rc_status -v
fi
done < <(xm list | grep -v '^Name *ID')
done < <(xm_list)
if [ -n "$XENDOMAINS_SHUTDOWN_ALL" ] && any_non_zombies ; then
echo -n " others: shutting down... "
@ -398,7 +405,7 @@ check_domain_up()
[ -z "$state" ] && return 1
return 0
fi
done < <(xm list | grep -v '^Name *ID')
done < <(xm_list)
return 1
}
@ -440,18 +447,22 @@ restart()
case "$1" in
start)
check $1
start
;;
stop)
check $1
stop
;;
restart|reload)
check $1
restart
;;
try-restart)
check $1
"$0" status
if [ $? = 0 ]; then
"$0" restart
@ -462,6 +473,7 @@ case "$1" in
;;
status)
check $1
echo -n "Checking status of Xen domains"
if [ ! -f "$LOCKFILE" ]; then
rc_failed 3

510
network-multi Normal file
View File

@ -0,0 +1,510 @@
#!/bin/sh
#============================================================================
# network-multi
#
# Version = 1.0.0
# Date = 2007-05-12
#
# Maintainer(s) = Ron Terry - ron (at) pronetworkconsulting (dot) com
#
# The latest version can be found at:
#
# http://pronetworkconsulting.com/linux/scripts/network-multi.html
#
# Description:
#
# Replacement for the xen network-bridge, network-nat and network-route
# scripts. This script allows for the creation of multiple bridges.
#
# This script can create 3 types of bridges:
#
# traditional bridges: -Bridges that contain both a physical network
# device (ethX) and a virtual network device (vethX)
# from Dom0.
# -This is the traditional type of network bridge
# created in xen by the network-bridge script.
#
# host bridges: -Bridges that contain only a virtual network
# device (vethX) from Dom0.
# -These bridges can be configured in the
# following ways:
#
# -hostonly: This type of bridge will allow
# VMs connected to these networks
# to access only Dom0 and other
# VMs connected to the bridge.
# This type of bridge is similiar to
# a VMware "HOST ONLY" network.
#
# -nat: This type of bridge will allow
# VMs connected to these networks
# to access the "outside world"
# via NAT and other VMs connected
# to the bridge.
# This type of bridge is similiar to
# a VMware "NAT" network.
#
# -routed: This type of bridge will allow
# to access the "outside world"
# via routing through Dom0 and
# other VMs connected to the
# bridge.
#
# empty bridges: -Bridges that do not contain any physical or
# virtual network devices from Dom0.
# -These can be used to allow VMs in DomUs to
# communicate only with other DomUs and not Dom0.
#
# This script accepts the (start|stop|status) parameters. If not specified
# it sends the start parameter.
#
# This script depends on an unmodified version of the network-bridge script
# because it uses it to create the traditional bridges. It passes the
# (start|stop|status) parameters into the network-bridge script allowing
# the user to disassemble the traditional bridges containg physical network
# devices so that they may change the network configuration of the Physical
# network interfaces.
#
# Host bridges do not need to be disassembled to change the IP address
# of the virtual interfaces because they do not contain interfaces that
# have been renamed like the traditional briges (created by the
# network-bridge script) do. The stop parameter does however cause them
# to be disassembled and removed. If these bridges are NATed or Routed
# networks the default gateway of the VMs connected to them will also need
# to be changed for them to continue accessing the "outside world".
#
# The Empty bridges do not contain interfaces from Dom0 so are not
# affected by IP address changes. The stop parameter does cause them
# to be removed as well.
#
# This script will test for the presence of the physical interfaces
# configured to be connected to traditional bridges and only attempt to
# create bridges on the ones that are present and up. It will also test
# for the presence of virtual interfaces configured to be connected to
# host bridges and only create bridges for the ones that exist and
# are not already connected to an existing bridge.
#
# Edit the NETDEV_LIST variable to define which physical interfaces
# you wish to create traditional bridges on. The default is to create a
# traditional bridge on only the first interface (eth0).
#
# Edit the HOST_BRIDGE_LIST variable to define which virtual interfaces
# you wish to create host bridges on. The default is the 3rd and 4th
# virtual interfaces (veth2, veth3). The first host bridge (on veth2) is
# configured as a NAT network and the second host bridge (on veth3) is
# configured as a hostonly network.
#
# Edit the EMPTY_BRIDGE_LIST variable to define which empty bridges to
# create. This list should contain the numbers of the bridges to
# create (4 5 6 7)
#
# To enable this script edit the network-script field in the
# /etc/xen/xen-config.sxp file.
#
# Example: (network-script network-multi)
#
# Depends on: /etc/xen/scripts/xen-network-common.sh
# /etc/xen/scripts/network-bridge
#
# Can use: /etc/sysconfig/dom0config
#
# Usage: network-multi (start|stop|status)
#
# Vars:
#
# SCRIPT_PATH -Path to the directory conaining the xen network-bridge
# script (typically /etc/xen/scripts)
#
# NETDEV_LIST -Space delimited list of physical network devices to
# create traditional bridges on
#
# HOST_BRIDGE_LIST -Space delimited list of virtual network devices to
# create host bridges on using the following format:
#
# <virtual network device>,<mac address>,<IP address/CIDR NetMask>,<nat|hostonly|routed>
#
# Example with 2 virtual devices:
#
# "veth2,00:16:3E:01:00:02,172.22.0.1/16,nat veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly"
#
# EMPTY_BRIDGE_LIST -Space delimited list of bridge numbers to create as
# empty bridges.
#
# BRIDGE_NAME -Name of bridge to create (example: xenbr)
#
# NAT_EXTIF -Network interface to use as the external interface for
# NATed and Routed networks
#
#============================================================================
#### Read config files and set variables ##################################
. /etc/xen/scripts/xen-network-common.sh
# If you do not source the /etc/sysconfig/xend file, uncomment the variables
# below.
. /etc/sysconfig/xend
#NETDEV_LIST="eth0 eth1 eth2"
#HOST_BRIDGE_LIST="veth2,00:16:3E:01:00:02,172.22.0.1/16,nat veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly"
#EMPTY_BRIDGE_LIST="4 5 6 7"
#BRIDGE_NAME="xenbr"
#SCRIPT_PATH="/etc/xen/scripts"
#NAT_EXTIF="eth0"
#### Script Functions #####################################################
help() {
echo "Usage: $0 {start|stop|status}"
exit 1
}
get_option() {
# Determine which option was passed from the command line.
case "$1" in
start|stop|status)
CMD_OPT="$1"
;;
*)
help
;;
esac
}
setup_host_interface() {
# Configure the MAC and IP address of a virtual device.
#
# This function is called by other fuctions.
#
# usage: setup_host_interface <virtual net device> <MAC Addr> <IP Addr>
local DEV="$1"
local MAC="$2"
local IPADDR="$3"
case $CMD_OPT in
start)
# take the interface down
ip link set $DEV down
# ... and configure it
ip link set $DEV addr $MAC
ip addr flush $DEV
ip addr add $IPADDR brd + dev $DEV
# bring it back up
ip link set $DEV up
;;
stop)
# take the interface down
ip link set $DEV down
# unconfigure it
ip link set $DEV addr fe:ff:ff:ff:ff:ff
ip addr flush $DEV
;;
status)
ip addr show $DEV
;;
esac
}
create_bridges() {
# Uses the network-bridge script to create bridges on physical devices in Dom0.
#
# This fuction passes the start,stop,status parameters on to the network-bridge
# script.
for NETDEVICE in $NETDEV_LIST
do
local BRIDGE_NUM=${NETDEVICE##${NETDEVICE%%[0-9]*}}
if /sbin/ip link show $NETDEVICE | grep -qw UP
then
echo ""
echo "============================================================"
echo "Configuring Virtual Bridge: $BRIDGE_NAME$BRIDGE_NUM"
echo "using- Physical Interface: $NETDEVICE"
echo " Virtual Interface: vif$BRIDGE_NUM"
echo "============================================================"
echo ""
$SCRIPT_PATH/network-bridge $CMD_OPT netdev=$NETDEVICE bridge=$BRIDGE_NAME$BRIDGE_NUM vifnum=$BRIDGE_NUM
echo ""
echo "------------------------------------------------------------"
else
echo " Physical Interface $NETDEVICE is not up. Skipping $BRIDGE_NAME$BRIDGE_NUM"
echo "------------------------------------------------------------"
fi
done
}
create_host_bridges() {
# Creates bridges attached to virtual devices in Dom0 and enables nat or routing
# on the bridges if specified.
#
# This fuction reads the start,stop,status parameter from the $CMD_OPT variable
# and responds respectively.
for IFACE in $HOST_BRIDGE_LIST
do
local DEV=`echo $IFACE|cut -d "," -f 1`
local MAC=`echo $IFACE|cut -d "," -f 2`
local IPADDR=`echo $IFACE|cut -d "," -f 3`
local BRIDGE_TYPE=`echo $IFACE|cut -d "," -f 4`
local NAT_GW_IP=`echo $IFACE|cut -d "," -f 3|cut -d "/" -f 1`
#local NAT_EXTIF=`echo $NETDEV_LIST|cut -d " " -f 1`
local NAT_INTIF=`echo $IFACE|cut -d "," -f 1`
local BRIDGE_NUM=${NAT_INTIF##${NAT_INTIF%%[0-9]*}}
local BR_NAME=$BRIDGE_NAME$BRIDGE_NUM
local VIF=vif0.$BRIDGE_NUM
# Determine the initial state of the ip_forward parameter
#####################################################################
# FIX ME: We need to make this persistant.
# Should we write it out to a file?
#####################################################################
if [ `cat /proc/sys/net/ipv4/ip_forward` -eq "0" ]
then
local INIT_IP_FWD="off"
else
local INIT_IP_FWD="on"
fi
# Determine if we need to enable ip_forward
if echo $HOST_BRIDGE_LIST | grep -qE "(nat|NAT|route|ROUTE)"
then
local IP_FWD="on"
else
local IP_FWD="off"
fi
case $CMD_OPT in
start)
if ! brctl show | grep -qw $DEV && /sbin/ip address show $DEV
then
#------------------------------------------------------------------
# Create the bridge
#------------------------------------------------------------------
echo ""
echo "============================================================"
echo "Configuring Virtual Host Bridge: $BR_NAME"
echo " As a network of type: $BRIDGE_TYPE"
echo ""
echo " using- Virtual Interface: $VIF"
echo " Virtual Device: $DEV"
create_bridge $BR_NAME
setup_bridge_port $VIF
add_to_bridge $BR_NAME $VIF
setup_host_interface $DEV $MAC $IPADDR
#------------------------------------------------------------------
# Set up the bridge as a hostonly / NAT / Routed network
#------------------------------------------------------------------
case $BRIDGE_TYPE in
NAT|nat) # Set up the bridge as NATed network
echo " Gateway: $NAT_GW_IP"
echo " External Interface: $NAT_EXTIF"
if ! [ "$NAT_DONE" = "yes" ]
then
if [ "$IP_FWD" = "on" ]
then
echo 1 > /proc/sys/net/ipv4/ip_forward
IP_FWD="done"
fi
iptables -t nat -A POSTROUTING -o $NAT_EXTIF -j MASQUERADE
sysctl -q -w net.bridge.bridge-nf-call-iptables="0"
NAT_DONE="yes"
fi
;;
ROUTE|route) # Set up the bridge as Routed network
echo " Gateway: $NAT_GW_IP"
echo " External Interface: $NAT_EXTIF"
if [ "$IP_FWD" = "off" ]
then
echo 1 > /proc/sys/net/ipv4/ip_forward
IP_FWD="on"
fi
;;
HOSTONLY|hostonly) # Set up the bridge as hostonly network
if [ "$IP_FWD" = "on" ]
then
iptables -t nat -A PREROUTING -i $NAT_INTIF -j DROP
fi
;;
esac
echo "============================================================"
echo "------------------------------------------------------------"
else
#------------------------------------------------------------------
# Skip this bridge
#------------------------------------------------------------------
echo " Virtual Interface $DEV is already attached to a bridge or it does not exist."
echo " Skipping $BR_NAME"
echo "------------------------------------------------------------"
fi
;;
stop)
#------------------------------------------------------------------
# Remove the bridge
#------------------------------------------------------------------
echo ""
echo "============================================================"
echo "Removing Virtual Host Bridge: $BR_NAME"
echo " As a network of type: $BRIDGE_TYPE"
echo ""
echo " using- Virtual Interface: $VIF"
echo " Virtual Device: $DEV"
#------------------------------------------------------------------
# First remove the hostonly / NAT / Routed configuration
#------------------------------------------------------------------
case $BRIDGE_TYPE in
NAT|nat)
#####################################################################
# FIX ME: We need to set the ip_forward value back to the state it
# was in before the Network script ran.
# How do we determine that state?
#####################################################################
# We could use this if we set the INIT_IP_FWD value from some
# persistant source.
#----------------------------------------------------------------------
#if [ "$INIT_IP_FWD" = "off" ]
#then
# echo 0 > /proc/sys/net/ipv4/ip_forward
#fi
# This would wack all nat rules. What if they were set before we
# configured Xen networking?
#----------------------------------------------------------------------
#if ! [ "$NAT_REMOVED" = "yes" ]
#then
# # Remove all nat iptables rules (host bridge nat PREROUTING DROP, etc.)
# iptables -F -t nat
# NAT_REMOVED="yes"
#fi
# Turn off routing and clean out the bridge specific nat iptables rule
echo 0 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -D POSTROUTING -o $NAT_EXTIF -j MASQUERADE
sysctl -q -w net.bridge.bridge-nf-call-iptables="1"
;;
HOSTONLY|hostonly)
# Clean out the bridge specific nat iptables rule
iptables -t nat -D PREROUTING -i $NAT_INTIF -j DROP
;;
ROUTE|route)
#####################################################################
# FIX ME: We need to set the ip_forward value back to the state it
# was in before the Network script ran.
# How do we determine that state?
#####################################################################
# Turn off routing
echo 0 > /proc/sys/net/ipv4/ip_forward
;;
esac
echo "============================================================"
#------------------------------------------------------------------
# Then unconfigure the veth
#------------------------------------------------------------------
setup_host_interface $DEV $MAC $IPADDR
#------------------------------------------------------------------
# remove vif from the bridge
#------------------------------------------------------------------
brctl delif $BR_NAME $VIF
#------------------------------------------------------------------
# unconfigure the vif
#------------------------------------------------------------------
ip link set $VIF down
ip link set $VIF addr fe:ff:ff:ff:ff:ff
ip link set $VIF multicast on
ip link set $VIF arp on
ip addr flush $VIF
#------------------------------------------------------------------
# and finaly unconfigure the bridge
#------------------------------------------------------------------
ip link set $BR_NAME down
brctl delbr $BR_NAME
echo "------------------------------------------------------------"
;;
status)
#------------------------------------------------------------------
# Show the status of the bridge
#------------------------------------------------------------------
echo ""
echo "============================================================"
echo "Status of Virtual Host Bridge: $BR_NAME"
echo " using- Virtual Interface: $VIF"
echo " Virtual Device: $DEV"
echo "------------------------------------------------------------"
echo "This Network is: $BRIDGE_TYPE"
echo "============================================================"
brctl show | grep -w "^$BR_NAME"
echo ""
ip addr show $DEV
#echo ""
#echo "ip_forward is set to: `cat /proc/sys/net/ipv4/ip_forward`"
echo "============================================================"
;;
esac
done
}
create_empty_bridges() {
# Creates bridges attached to no devices in Dom0.
#
# This function reads the start,stop,status parameter from the $CMD_OPT
# variable and responds respectively.
echo ""
echo "============================================================"
for BRIDGE in $EMPTY_BRIDGE_LIST
do
local BRIDGE_NUM=$BRIDGE
local BR_NAME=$BRIDGE_NAME$BRIDGE_NUM
case $CMD_OPT in
start)
if ! brctl show | grep -qw "^$BR_NAME"
then
echo "Configuring Virtual Empty Bridge: $BR_NAME"
create_bridge $BR_NAME
fi
;;
stop)
if brctl show | grep -qw "^$BR_NAME"
then
echo "Unconfiguring Virtual Empty Bridge: $BR_NAME"
ip link set $BR_NAME down
brctl delbr $BR_NAME
fi
;;
status)
brctl show $BR_NAME | grep -w "^$BR_NAME"
;;
esac
done
echo "============================================================"
}
#### Call Functions #######################################################
get_option "$1"
create_bridges
create_host_bridges
create_empty_bridges
exit 0

View File

@ -1,337 +0,0 @@
#!/bin/bash
#============================================================================
# network-multi_bridge
#
# Version = 2.0.1
# Date = 2007-03-09
#
# Maintainer(s) = Ron Terry - ron (at) pronetworkconsulting (dot) com
#
# The latest version can be found at:
#
# http://pronetworkconsulting.com/linux/scripts/network-multi_bridge.html
#
# Description:
#
# Extension to and wrapper for the xen network-bridge script that allows for
# the creation of multiple bridges.
#
# This script can create 3 types of bridges:
#
# traditional bridges: -Bridges that contain both a physical network
# device (ethX) and a virtual network device (vethX)
# from Dom0.
# -This is the traditional type of network bridge
# created in xen by the network-bridge script.
#
# host bridges: -Bridgees that contain only a virtual network
# device (vethX) from Dom0.
# -This is similar to a VMware "Host Only" network.
#
# empty bridges: -Bridges that do not contain any physical or
# virtual network devices from Dom0.
# -These can be used to allow VMs in DomUs to
# communicate only with other DomUs and not Dom0.
#
# This script accepts the (start|stop|status) parameters and passes
# them to the network-bridge script for each physical interface
# specified in the NETDEV_LIST variable. This will allow the user
# to disassemble the traditional bridges containg physical network
# devices so that they may change the network configuration of the
# Physical network interfaces. If not specified it sends the start
# parameter.
#
# Host bridges do not need to be disassembled to change the IP address
# of the virtual interfaces because they do not contain interfaces that
# have been renamed like the traditional briges created by the
# network-bridge script do. The stop parameter does however cause them
# to be disassembled and removed.
#
# The Empty bridges do not contain interfaces from Dom0 so are not
# affected by IP address changes. The stop parameter does cause them
# to be removed as well.
#
# This script will test for the presence of the physical interfaces
# configured to be connected to traditional bridges and only attempt to
# create bridges on the ones that are present and up. It will also test
# for the presence of virtual interfaces configured to be connected to
# host bridges and only create bridges for the ones that exist and
# are not already connected to an existing bridge.
#
# Edit the NETDEV_LIST variable to define which physical interfaces
# you wish to create bridges on. The default is the first 3 network
# interfaces (eth0 eth1 eth2).
#
# Edit the HOST_BRIDGE_LIST variable to define which virtual interfaces
# you wish to create host bridges on. The defaule is the 3rd virtual
# interface (veth3)
#
# Edit the EMPTY_BRIDGE_LIST variable to define which empty bridges to
# create. This list should contain the numbers of the bridges to
# create (4 5 6 7)
#
# To enable this script edit the network-script field in the
# /etc/xen/xen-config.sxp file.
#
# Example: (network-script network-multi_bridge)
#
# Depends on: /etc/xen/scripts/xen-network-common.sh
# /etc/xen/scripts/network-bridge
#
# Can use: /etc/sysconfig/dom0config
#
# Usage: network-multi_bridge (start|stop|status)
#
# Vars:
#
# NETDEV_LIST -Space delimited list of physical network devices to
# create traditional bridges on
#
# HOST_BRIDGE_LIST -Space delimited list of virtual network devices to
# create host bridges on using the following format:
#
# <virtual network device>,<mac address>,<IP address/CIDR NetMask>
#
# Example with 2 virtual devices:
#
# "veth1,00:16:3E:01:00:01,172.16.0.1/16 veth2,00:16:3E:01:00:02,172.17.0.1/16"
#
# EMPTY_BRIDGE_LIST -Space delimited list of bridge numbers to create as
# empty bridges.
#
# BRIDGE_NAME -Name of bridge to create (example: xenbr)
#
# SCRIPT_PATH -Path to the directory conaining the xen network-bridge
# script (typically /etc/xen/scripts)
#
#============================================================================
#### Read config files and set variables ##################################
. /etc/xen/scripts/xen-network-common.sh
# If you source the /etc/sysconfig/dom0config file comment out the variables
# being set in this script.
#. /etc/sysconfig/dom0config
NETDEV_LIST="eth0 eth1 eth2"
HOST_BRIDGE_LIST="veth3,00:16:3E:01:00:03,172.16.0.1/16"
EMPTY_BRIDGE_LIST="4 5 6 7"
BRIDGE_NAME="xenbr"
SCRIPT_PATH="/etc/xen/scripts"
#### Script Fuinctions ####################################################
get_option() {
# Determine which option was passed from the command line.
# If nothing is passed it defaults to start
if [ -z "$1" ]
then
CMD_OPT="start"
else
case "$1" in
start|stop|status)
CMD_OPT="$1"
;;
*)
CMD_OPT="start"
;;
esac
fi
}
setup_host_interface() {
# Configure the MAC and IP address of a virtual device.
#
# This function is called by other fuctions.
#
# usage: setup_host_interface <virtual net device> <MAC Addr> <IP Addr>
local DEV="$1"
local MAC="$2"
local IPADDR="$3"
case $CMD_OPT in
start)
# take the interface down
ip link set $DEV down
# ... and configure it
ip link set $DEV addr $MAC
ip addr flush $DEV
ip addr add $IPADDR brd + dev $DEV
# bring it back up
ip link set $DEV up
;;
stop)
# take the interface down
ip link set $DEV down
# unconfigure it
ip link set $DEV addr fe:ff:ff:ff:ff:ff
ip addr flush $DEV
;;
status)
ip addr show $DEV
;;
esac
}
create_bridges() {
# Uses the network-bridge script to create bridges on physical devices in Dom0.
#
# This fuction passes the start,stop,status parameters on to the network-bridge
# script.
for NETDEVICE in $NETDEV_LIST
do
local BRIDGE_NUM=${NETDEVICE##${NETDEVICE%%[0-9]*}}
if /sbin/ip address show $NETDEVICE | grep -q UP
then
echo ""
echo "============================================================"
echo "Configuring Virtual Bridge: $BRIDGE_NAME$BRIDGE_NUM"
echo "using- Physical Interface: $NETDEVICE"
echo " Virtual Interface: vif$BRIDGE_NUM"
echo "============================================================"
echo ""
$SCRIPT_PATH/network-bridge $CMD_OPT netdev=$NETDEVICE bridge=$BRIDGE_NAME$BRIDGE_NUM vifnum=$BRIDGE_NUM
echo ""
echo "------------------------------------------------------------"
else
echo " Physical Interface $NETDEVICE is not up. Skipping $BRIDGE_NAME$BRIDGE_NUM"
echo "------------------------------------------------------------"
fi
done
}
create_host_bridges() {
# Creates bridges attached to virtual devices in Dom0.
#
# This fuction reads the start,stop,status parameter from the $CMD_OPT variable
# and responds respectively.
for HOSTDEVICE in $HOST_BRIDGE_LIST
do
local DEV=`echo $HOSTDEVICE|cut -d "," -f 1`
local MAC=`echo $HOSTDEVICE|cut -d "," -f 2`
local IPADDR=`echo $HOSTDEVICE|cut -d "," -f 3`
local BRIDGE_NUM=`echo $DEV|cut -c 5`
local VIF=vif0.$BRIDGE_NUM
local BR_NAME=$BRIDGE_NAME$BRIDGE_NUM
case $CMD_OPT in
start)
if ! brctl show | grep -q $DEV && /sbin/ip address show $DEV
then
echo ""
echo "============================================================"
echo "Configuring Virtual Host Bridge: $BR_NAME"
echo " using- Virtual Interface: $VIF"
echo " Virtual Device: $DEV"
echo "============================================================"
create_bridge $BR_NAME
setup_bridge_port $VIF
add_to_bridge $BR_NAME $VIF
setup_host_interface $DEV $MAC $IPADDR
echo "------------------------------------------------------------"
else
echo " Virtual Interface $DEV is already attached to a bridge or it does not exist."
echo " Skipping $BR_NAME"
echo "------------------------------------------------------------"
fi
;;
stop)
echo ""
echo "============================================================"
echo "Unconfiguring Virtual Host Bridge: $BR_NAME"
echo " using- Virtual Interface: $VIF"
echo " Virtual Device: $DEV"
echo "============================================================"
# unconfigure the veth
setup_host_interface $DEV $MAC $IPADDR
# remove vif from the bridge
brctl delif $BR_NAME $VIF
# unconfigure the vif
ip link set $VIF down
ip link set $VIF addr fe:ff:ff:ff:ff:ff
ip link set $VIF multicast on
ip link set $VIF arp on
ip addr flush $VIF
# unconfigure the bridge
ip link set $BR_NAME down
brctl delbr $BR_NAME
echo "------------------------------------------------------------"
;;
status)
echo ""
echo "============================================================"
echo "Status of Virtual Host Bridge: $BR_NAME"
echo " using- Virtual Interface: $VIF"
echo " Virtual Device: $DEV"
echo "============================================================"
brctl show | grep -w "^$BR_NAME"
echo ""
ip addr show $DEV
echo "============================================================"
;;
esac
done
}
create_empty_bridges() {
# Creates bridges attached to no devices in Dom0.
#
# This function reads the start,stop,status parameter from the $CMD_OPT
# variable and respondes respectively.
echo ""
echo "============================================================"
for BRIDGE in $EMPTY_BRIDGE_LIST
do
local BRIDGE_NUM=$BRIDGE
local BR_NAME=$BRIDGE_NAME$BRIDGE_NUM
case $CMD_OPT in
start)
if ! brctl show | grep -qw "^$BR_NAME"
then
echo "Configuring Virtual Empty Bridge: $BR_NAME"
create_bridge $BR_NAME
fi
;;
stop)
if brctl show | grep -qw "^$BR_NAME"
then
echo "Unconfiguring Virtual Empty Bridge: $BR_NAME"
ip link set $BR_NAME down
brctl delbr $BR_NAME
fi
;;
status)
brctl show $BR_NAME | grep -w "^$BR_NAME"
;;
esac
done
echo "============================================================"
}
#### Call Functions #######################################################
get_option "$1"
create_bridges
create_host_bridges
create_empty_bridges

30
rpmlint.diff Normal file
View File

@ -0,0 +1,30 @@
Index: xen-3.1-testing/tools/blktap/lib/Makefile
===================================================================
--- xen-3.1-testing.orig/tools/blktap/lib/Makefile
+++ xen-3.1-testing/tools/blktap/lib/Makefile
@@ -42,10 +42,10 @@ libblktap: libblktap.a
install: all
$(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
$(INSTALL_DIR) $(DESTDIR)/usr/include
- $(INSTALL_PROG) $(LIB) $(DESTDIR)/usr/$(LIBDIR)
+ $(INSTALL_DATA) $(LIB) $(DESTDIR)/usr/$(LIBDIR)
ln -sf libblktap.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libblktap.so.$(MAJOR)
ln -sf libblktap.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libblktap.so
- $(INSTALL_PROG) blktaplib.h $(DESTDIR)/usr/include
+ $(INSTALL_DATA) blktaplib.h $(DESTDIR)/usr/include
clean:
rm -rf *.a *.so* *.o *.rpm $(LIB) *~ $(DEPS) xen TAGS
Index: xen-3.1-testing/tools/examples/Makefile
===================================================================
--- xen-3.1-testing.orig/tools/examples/Makefile
+++ xen-3.1-testing/tools/examples/Makefile
@@ -56,7 +56,7 @@ install-initd:
[ -d $(DESTDIR)/var/adm/fillup-templates ] || $(INSTALL_DIR) $(DESTDIR)/var/adm/fillup-templates/
$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d
$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)/etc/init.d
- $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)/var/adm/fillup-templates/
+ $(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)/var/adm/fillup-templates/
.PHONY: install-configs
install-configs: $(XEN_CONFIGS)

79
sysconfig.xend Normal file
View File

@ -0,0 +1,79 @@
## Path: System/Virtualization
## Description:
## Type: list(eth0 eth1 eth2 eth3)
## Default: "eth0"
## Config:
#
# Space delimited list of physical network
# devices tocreate traditional bridges on
#
NETDEV_LIST="eth0"
## Type: list(0 1 2 3)
## Default: ""
## Config:
#
# Space delimited list of bridge numbers to
# create empty bridges on.
#
EMPTY_BRIDGE_LIST=""
## Type: string(xenbr)
## Default: "xenbr"
## Config:
#
# Name of bridge to create (example: xenbr)
#
BRIDGE_NAME="xenbr"
## Type: list(veth2,00:16:3E:01:00:02,172.22.0.1/16,nat veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly)
## Default: ""
## Config:
#
# Space delimited list of virtual network devices,mac addresses
# and IP addresses to create host bridges on using the
# following format:
#
# <virtual network device>,<mac address>,<IP address/CIDR NetMask>,<nat|hostonly|route>
#
HOST_BRIDGE_LIST=""
## Type: string(eth0)
## Default: "eth0"
## Config:
#
# Network interface to use as the external interface for NATed
# and Routed networks
#
NAT_EXTIF="eth0"
## Type: list(10.0.0.1 10.0.0.2)
## Default: "any"
## Config:
#
# Space delimited list of IP addresses/host names of machines
# that xen will accept vm migrations from. If set to 'any'
# xen will accept vm migrations from any host
#
RELOCATION_NODELIST="any"
## Type: string(no)
## Default: "no"
## Config:
#
# If set to yes the xend-relocation script will attempt to
# enable/disable vm migration on all relocation nodes.
#
# Note: Communication with the nodes is done via ssh so
# pre-distributed ssh keys is recommended.
#
MANAGE_ALL_RELOCATION_NODES="no"
## Type: string(8002)
## Default: "8002"
## Config:
#
# The TCP port used by Xen for VM relocation
#
XEN_RELOCATION_PORT="8002"

25
vmx-check-descr.patch Normal file
View File

@ -0,0 +1,25 @@
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmx.c 2007-05-22 13:36:08.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c 2007-05-22 13:51:26.000000000 +0200
@@ -1521,15 +1521,15 @@ static int vmx_check_descriptor(int long
limit_field = GUEST_FS_LIMIT;
break;
case x86_seg_gs:
- ar_field = GUEST_FS_AR_BYTES;
- base_field = GUEST_FS_BASE;
- limit_field = GUEST_FS_LIMIT;
- break;
- case x86_seg_ss:
ar_field = GUEST_GS_AR_BYTES;
base_field = GUEST_GS_BASE;
limit_field = GUEST_GS_LIMIT;
break;
+ case x86_seg_ss:
+ ar_field = GUEST_SS_AR_BYTES;
+ base_field = GUEST_SS_BASE;
+ limit_field = GUEST_SS_LIMIT;
+ break;
default:
BUG();
return 0;

131
x86-emul-rf.patch Normal file
View File

@ -0,0 +1,131 @@
Index: 2007-05-14/xen/arch/x86/hvm/io.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/io.c 2007-05-14 14:40:19.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/io.c 2007-05-22 13:27:31.000000000 +0200
@@ -858,6 +858,7 @@ void hvm_io_assist(void)
}
/* Copy register changes back into current guest state. */
+ regs->eflags &= ~X86_EFLAGS_RF;
hvm_load_cpu_guest_regs(v, regs);
memcpy(guest_cpu_user_regs(), regs, HVM_CONTEXT_STACK_BYTES);
Index: 2007-05-14/xen/arch/x86/hvm/platform.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/platform.c 2007-05-14 14:40:20.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/platform.c 2007-05-22 13:13:10.000000000 +0200
@@ -1065,6 +1065,7 @@ void handle_mmio(unsigned long gpa)
}
regs->eip += inst_len; /* advance %eip */
+ regs->eflags &= ~X86_EFLAGS_RF;
switch ( mmio_op->instr ) {
case INSTR_MOV:
@@ -1122,6 +1123,7 @@ void handle_mmio(unsigned long gpa)
/* IO read --> memory write */
if ( dir == IOREQ_READ ) errcode |= PFEC_write_access;
regs->eip -= inst_len; /* do not advance %eip */
+ regs->eflags |= X86_EFLAGS_RF;
hvm_inject_exception(TRAP_page_fault, errcode, addr);
return;
}
@@ -1150,6 +1152,7 @@ void handle_mmio(unsigned long gpa)
/* Failed on the page-spanning copy. Inject PF into
* the guest for the address where we failed */
regs->eip -= inst_len; /* do not advance %eip */
+ regs->eflags |= X86_EFLAGS_RF;
/* Must set CR2 at the failing address */
addr += size - rv;
gdprintk(XENLOG_DEBUG, "Pagefault on non-io side of a "
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmx.c 2007-05-15 17:56:59.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c 2007-05-22 13:36:08.000000000 +0200
@@ -1281,10 +1281,13 @@ static int __get_instruction_length(void
static void inline __update_guest_eip(unsigned long inst_len)
{
- unsigned long current_eip;
+ unsigned long curr;
- current_eip = __vmread(GUEST_RIP);
- __vmwrite(GUEST_RIP, current_eip + inst_len);
+ curr = __vmread(GUEST_RIP);
+ __vmwrite(GUEST_RIP, curr + inst_len);
+ curr = __vmread(GUEST_RFLAGS);
+ if (curr & X86_EFLAGS_RF)
+ __vmwrite(GUEST_RFLAGS, curr & ~X86_EFLAGS_RF);
__vmwrite(GUEST_INTERRUPTIBILITY_INFO, 0);
}
@@ -1558,7 +1561,7 @@ static void vmx_io_instruction(unsigned
/* Copy current guest state into io instruction state structure. */
memcpy(regs, guest_cpu_user_regs(), HVM_CONTEXT_STACK_BYTES);
- hvm_store_cpu_guest_regs(current, regs, NULL);
+ vmx_store_cpu_guest_regs(current, regs, NULL);
vm86 = regs->eflags & X86_EFLAGS_VM ? 1 : 0;
df = regs->eflags & X86_EFLAGS_DF ? 1 : 0;
@@ -1785,7 +1788,7 @@ static void vmx_world_save(struct vcpu *
c->eip += __get_instruction_length(); /* Safe: MOV Cn, LMSW, CLTS */
c->esp = __vmread(GUEST_RSP);
- c->eflags = __vmread(GUEST_RFLAGS);
+ c->eflags = __vmread(GUEST_RFLAGS) & ~X86_EFLAGS_RF;
c->cr0 = v->arch.hvm_vmx.cpu_shadow_cr0;
c->cr3 = v->arch.hvm_vmx.cpu_cr3;
@@ -2150,7 +2153,6 @@ static int vmx_set_cr0(unsigned long val
"Enabling CR0.PE at %%eip 0x%lx", eip);
if ( vmx_assist(v, VMX_ASSIST_RESTORE) )
{
- eip = __vmread(GUEST_RIP);
HVM_DBG_LOG(DBG_LEVEL_1,
"Restoring to %%eip 0x%lx", eip);
return 0; /* do not update eip! */
Index: 2007-05-14/xen/arch/x86/traps.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/traps.c 2007-05-15 15:52:58.000000000 +0200
+++ 2007-05-14/xen/arch/x86/traps.c 2007-05-22 13:05:28.000000000 +0200
@@ -608,6 +608,7 @@ static int emulate_forced_invalid_op(str
regs->ecx = c;
regs->edx = d;
regs->eip = eip;
+ regs->eflags &= ~X86_EFLAGS_RF;
return EXCRET_fault_fixed;
}
@@ -1807,6 +1808,7 @@ static int emulate_privileged_op(struct
done:
regs->eip = eip;
+ regs->eflags &= ~X86_EFLAGS_RF;
return EXCRET_fault_fixed;
fail:
Index: 2007-05-14/xen/arch/x86/x86_emulate.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_emulate.c 2007-05-14 14:40:43.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_emulate.c 2007-05-22 13:04:05.000000000 +0200
@@ -1631,6 +1631,7 @@ x86_emulate(
}
/* Commit shadow register state. */
+ _regs.eflags &= ~X86_EFLAGS_RF;
*ctxt->regs = _regs;
done:
Index: 2007-05-14/xen/include/asm-x86/hvm/svm/emulate.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/svm/emulate.h 2007-04-23 10:01:46.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/svm/emulate.h 2007-05-22 13:45:43.000000000 +0200
@@ -138,6 +138,7 @@ static void inline __update_guest_eip(
{
ASSERT(inst_len > 0);
vmcb->rip += inst_len;
+ vmcb->rflags &= ~X86_EFLAGS_RF;
}
#endif /* __ASM_X86_HVM_SVM_EMULATE_H__ */

873
x86-machine-check.patch Normal file
View File

@ -0,0 +1,873 @@
Index: 2007-05-14/xen/arch/x86/cpu/mcheck/k7.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/cpu/mcheck/k7.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/cpu/mcheck/k7.c 2007-05-15 15:56:00.000000000 +0200
@@ -16,7 +16,7 @@
#include "mce.h"
/* Machine Check Handler For AMD Athlon/Duron */
-static fastcall void k7_machine_check(struct cpu_user_regs * regs, long error_code)
+static fastcall void k7_machine_check(struct cpu_user_regs * regs)
{
int recover=1;
u32 alow, ahigh, high, low;
Index: 2007-05-14/xen/arch/x86/cpu/mcheck/mce.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/cpu/mcheck/mce.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/cpu/mcheck/mce.c 2007-05-15 15:56:16.000000000 +0200
@@ -18,13 +18,13 @@ int mce_disabled = 0;
int nr_mce_banks;
/* Handle unconfigured int18 (should never happen) */
-static fastcall void unexpected_machine_check(struct cpu_user_regs * regs, long error_code)
+static fastcall void unexpected_machine_check(struct cpu_user_regs * regs)
{
printk(KERN_ERR "CPU#%d: Unexpected int18 (Machine Check).\n", smp_processor_id());
}
/* Call the installed machine check handler for this CPU setup. */
-void fastcall (*machine_check_vector)(struct cpu_user_regs *, long error_code) = unexpected_machine_check;
+void fastcall (*machine_check_vector)(struct cpu_user_regs *) = unexpected_machine_check;
/* This has to be run for each processor */
void mcheck_init(struct cpuinfo_x86 *c)
Index: 2007-05-14/xen/arch/x86/cpu/mcheck/mce.h
===================================================================
--- 2007-05-14.orig/xen/arch/x86/cpu/mcheck/mce.h 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/cpu/mcheck/mce.h 2007-05-15 17:34:43.000000000 +0200
@@ -1,4 +1,5 @@
#include <xen/init.h>
+#include <asm/processor.h>
void amd_mcheck_init(struct cpuinfo_x86 *c);
void intel_p4_mcheck_init(struct cpuinfo_x86 *c);
@@ -6,9 +7,6 @@ void intel_p5_mcheck_init(struct cpuinfo
void intel_p6_mcheck_init(struct cpuinfo_x86 *c);
void winchip_mcheck_init(struct cpuinfo_x86 *c);
-/* Call the installed machine check handler for this CPU setup. */
-extern fastcall void (*machine_check_vector)(struct cpu_user_regs *, long error_code);
-
extern int mce_disabled __initdata;
extern int nr_mce_banks;
Index: 2007-05-14/xen/arch/x86/cpu/mcheck/p4.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/cpu/mcheck/p4.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/cpu/mcheck/p4.c 2007-05-15 15:56:31.000000000 +0200
@@ -158,7 +158,7 @@ done:
return mce_num_extended_msrs;
}
-static fastcall void intel_machine_check(struct cpu_user_regs * regs, long error_code)
+static fastcall void intel_machine_check(struct cpu_user_regs * regs)
{
int recover=1;
u32 alow, ahigh, high, low;
Index: 2007-05-14/xen/arch/x86/cpu/mcheck/p5.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/cpu/mcheck/p5.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/cpu/mcheck/p5.c 2007-05-15 15:56:39.000000000 +0200
@@ -15,7 +15,7 @@
#include "mce.h"
/* Machine check handler for Pentium class Intel */
-static fastcall void pentium_machine_check(struct cpu_user_regs * regs, long error_code)
+static fastcall void pentium_machine_check(struct cpu_user_regs * regs)
{
u32 loaddr, hi, lotype;
rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
Index: 2007-05-14/xen/arch/x86/cpu/mcheck/p6.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/cpu/mcheck/p6.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/cpu/mcheck/p6.c 2007-05-15 15:56:43.000000000 +0200
@@ -15,7 +15,7 @@
#include "mce.h"
/* Machine Check Handler For PII/PIII */
-static fastcall void intel_machine_check(struct cpu_user_regs * regs, long error_code)
+static fastcall void intel_machine_check(struct cpu_user_regs * regs)
{
int recover=1;
u32 alow, ahigh, high, low;
Index: 2007-05-14/xen/arch/x86/cpu/mcheck/winchip.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/cpu/mcheck/winchip.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/cpu/mcheck/winchip.c 2007-05-15 15:56:48.000000000 +0200
@@ -16,7 +16,7 @@
#include "mce.h"
/* Machine check handler for WinChip C6 */
-static fastcall void winchip_machine_check(struct cpu_user_regs * regs, long error_code)
+static fastcall void winchip_machine_check(struct cpu_user_regs * regs)
{
printk(KERN_EMERG "CPU0: Machine Check Exception.\n");
add_taint(TAINT_MACHINE_CHECK);
Index: 2007-05-14/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/svm/svm.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/svm/svm.c 2007-05-15 17:57:20.000000000 +0200
@@ -407,7 +407,7 @@ int svm_vmcb_restore(struct vcpu *v, str
}
skip_cr3:
- vmcb->cr4 = c->cr4 | SVM_CR4_HOST_MASK;
+ vmcb->cr4 = c->cr4 | HVM_CR4_HOST_MASK;
v->arch.hvm_svm.cpu_shadow_cr4 = c->cr4;
vmcb->idtr.limit = c->idtr_limit;
@@ -464,7 +464,8 @@ int svm_vmcb_restore(struct vcpu *v, str
/* update VMCB for nested paging restore */
if ( paging_mode_hap(v->domain) ) {
vmcb->cr0 = v->arch.hvm_svm.cpu_shadow_cr0;
- vmcb->cr4 = v->arch.hvm_svm.cpu_shadow_cr4;
+ vmcb->cr4 = v->arch.hvm_svm.cpu_shadow_cr4 |
+ (HVM_CR4_HOST_MASK & ~X86_CR4_PAE);
vmcb->cr3 = c->cr3;
vmcb->np_enable = 1;
vmcb->g_pat = 0x0007040600070406ULL; /* guest PAT */
@@ -1731,9 +1732,19 @@ static int mov_to_cr(int gpreg, int cr,
break;
case 4: /* CR4 */
+ if ( value & ~mmu_cr4_features )
+ {
+ HVM_DBG_LOG(DBG_LEVEL_1, "Guest attempts to enable unsupported "
+ "CR4 features %lx (host %lx)",
+ value, mmu_cr4_features);
+ svm_inject_exception(v, TRAP_gp_fault, 1, 0);
+ break;
+ }
+
if ( paging_mode_hap(v->domain) )
{
- vmcb->cr4 = v->arch.hvm_svm.cpu_shadow_cr4 = value;
+ v->arch.hvm_svm.cpu_shadow_cr4 = value;
+ vmcb->cr4 = value | (HVM_CR4_HOST_MASK & ~X86_CR4_PAE);
paging_update_paging_modes(v);
break;
}
@@ -1779,7 +1790,7 @@ static int mov_to_cr(int gpreg, int cr,
}
v->arch.hvm_svm.cpu_shadow_cr4 = value;
- vmcb->cr4 = value | SVM_CR4_HOST_MASK;
+ vmcb->cr4 = value | HVM_CR4_HOST_MASK;
/*
* Writing to CR4 to modify the PSE, PGE, or PAE flag invalidates
@@ -2141,12 +2152,13 @@ static int svm_reset_to_realmode(struct
vmcb->cr2 = 0;
vmcb->efer = EFER_SVME;
- vmcb->cr4 = SVM_CR4_HOST_MASK;
+ vmcb->cr4 = HVM_CR4_HOST_MASK;
v->arch.hvm_svm.cpu_shadow_cr4 = 0;
if ( paging_mode_hap(v->domain) ) {
vmcb->cr0 = v->arch.hvm_svm.cpu_shadow_cr0;
- vmcb->cr4 = v->arch.hvm_svm.cpu_shadow_cr4;
+ vmcb->cr4 = v->arch.hvm_svm.cpu_shadow_cr4 |
+ (HVM_CR4_HOST_MASK & ~X86_CR4_PAE);
}
/* This will jump to ROMBIOS */
@@ -2287,6 +2299,12 @@ asmlinkage void svm_vmexit_handler(struc
break;
}
+ case VMEXIT_EXCEPTION_MC:
+ HVMTRACE_0D(MCE, v);
+ svm_store_cpu_guest_regs(v, regs, NULL);
+ machine_check_vector(regs);
+ break;
+
case VMEXIT_VINTR:
vmcb->vintr.fields.irq = 0;
vmcb->general1_intercepts &= ~GENERAL1_INTERCEPT_VINTR;
Index: 2007-05-14/xen/arch/x86/hvm/svm/vmcb.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/svm/vmcb.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/svm/vmcb.c 2007-05-15 17:28:40.000000000 +0200
@@ -225,7 +225,7 @@ static int construct_vmcb(struct vcpu *v
/* Guest CR4. */
arch_svm->cpu_shadow_cr4 =
read_cr4() & ~(X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE);
- vmcb->cr4 = arch_svm->cpu_shadow_cr4 | SVM_CR4_HOST_MASK;
+ vmcb->cr4 = arch_svm->cpu_shadow_cr4 | HVM_CR4_HOST_MASK;
paging_update_paging_modes(v);
vmcb->cr3 = v->arch.hvm_vcpu.hw_cr3;
@@ -236,11 +236,13 @@ static int construct_vmcb(struct vcpu *v
vmcb->np_enable = 1; /* enable nested paging */
vmcb->g_pat = 0x0007040600070406ULL; /* guest PAT */
vmcb->h_cr3 = pagetable_get_paddr(v->domain->arch.phys_table);
- vmcb->cr4 = arch_svm->cpu_shadow_cr4 = 0;
+ vmcb->cr4 = arch_svm->cpu_shadow_cr4 =
+ (HVM_CR4_HOST_MASK & ~X86_CR4_PAE);
+ vmcb->exception_intercepts = HVM_TRAP_MASK;
}
else
{
- vmcb->exception_intercepts = 1U << TRAP_page_fault;
+ vmcb->exception_intercepts = HVM_TRAP_MASK | (1U << TRAP_page_fault);
}
return 0;
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmcs.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmcs.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmcs.c 2007-05-15 17:28:58.000000000 +0200
@@ -400,7 +400,7 @@ static void construct_vmcs(struct vcpu *
__vmwrite(VMCS_LINK_POINTER_HIGH, ~0UL);
#endif
- __vmwrite(EXCEPTION_BITMAP, 1U << TRAP_page_fault);
+ __vmwrite(EXCEPTION_BITMAP, HVM_TRAP_MASK | (1U << TRAP_page_fault));
/* Guest CR0. */
cr0 = read_cr0();
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmx.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c 2007-05-15 17:56:59.000000000 +0200
@@ -600,7 +600,7 @@ int vmx_vmcs_restore(struct vcpu *v, str
}
#endif
- __vmwrite(GUEST_CR4, (c->cr4 | VMX_CR4_HOST_MASK));
+ __vmwrite(GUEST_CR4, (c->cr4 | HVM_CR4_HOST_MASK));
v->arch.hvm_vmx.cpu_shadow_cr4 = c->cr4;
__vmwrite(CR4_READ_SHADOW, v->arch.hvm_vmx.cpu_shadow_cr4);
@@ -1886,7 +1886,7 @@ static int vmx_world_restore(struct vcpu
else
HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %x", c->cr3);
- __vmwrite(GUEST_CR4, (c->cr4 | VMX_CR4_HOST_MASK));
+ __vmwrite(GUEST_CR4, (c->cr4 | HVM_CR4_HOST_MASK));
v->arch.hvm_vmx.cpu_shadow_cr4 = c->cr4;
__vmwrite(CR4_READ_SHADOW, v->arch.hvm_vmx.cpu_shadow_cr4);
@@ -2275,6 +2275,14 @@ static int mov_to_cr(int gp, int cr, str
case 4: /* CR4 */
old_cr = v->arch.hvm_vmx.cpu_shadow_cr4;
+ if ( value & ~mmu_cr4_features )
+ {
+ HVM_DBG_LOG(DBG_LEVEL_1, "Guest attempts to enable unsupported "
+ "CR4 features %lx (host %lx)",
+ value, mmu_cr4_features);
+ vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
+ break;
+ }
if ( (value & X86_CR4_PAE) && !(old_cr & X86_CR4_PAE) )
{
if ( vmx_pgbit_test(v) )
@@ -2315,7 +2323,7 @@ static int mov_to_cr(int gp, int cr, str
}
}
- __vmwrite(GUEST_CR4, value| VMX_CR4_HOST_MASK);
+ __vmwrite(GUEST_CR4, value | HVM_CR4_HOST_MASK);
v->arch.hvm_vmx.cpu_shadow_cr4 = value;
__vmwrite(CR4_READ_SHADOW, v->arch.hvm_vmx.cpu_shadow_cr4);
@@ -2623,7 +2631,8 @@ static void vmx_reflect_exception(struct
}
}
-static void vmx_failed_vmentry(unsigned int exit_reason)
+static void vmx_failed_vmentry(unsigned int exit_reason,
+ struct cpu_user_regs *regs)
{
unsigned int failed_vmentry_reason = (uint16_t)exit_reason;
unsigned long exit_qualification;
@@ -2640,6 +2649,9 @@ static void vmx_failed_vmentry(unsigned
break;
case EXIT_REASON_MACHINE_CHECK:
printk("caused by machine check.\n");
+ HVMTRACE_0D(MCE, current);
+ hvm_store_cpu_guest_regs(current, regs, NULL);
+ machine_check_vector(regs);
break;
default:
printk("reason not known yet!");
@@ -2665,11 +2677,12 @@ asmlinkage void vmx_vmexit_handler(struc
perfc_incra(vmexits, exit_reason);
- if ( exit_reason != EXIT_REASON_EXTERNAL_INTERRUPT )
- local_irq_enable();
-
if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) )
- return vmx_failed_vmentry(exit_reason);
+ return vmx_failed_vmentry(exit_reason, regs);
+
+ if ( exit_reason != EXIT_REASON_EXTERNAL_INTERRUPT &&
+ exit_reason != EXIT_REASON_EXCEPTION_NMI )
+ local_irq_enable();
switch ( exit_reason )
{
@@ -2689,6 +2702,9 @@ asmlinkage void vmx_vmexit_handler(struc
perfc_incra(cause_vector, vector);
+ if ( vector != TRAP_nmi && vector != TRAP_machine_check )
+ local_irq_enable();
+
switch ( vector )
{
case TRAP_debug:
@@ -2726,6 +2742,11 @@ asmlinkage void vmx_vmexit_handler(struc
else
vmx_reflect_exception(v);
break;
+ case TRAP_machine_check:
+ HVMTRACE_0D(MCE, v);
+ hvm_store_cpu_guest_regs(v, regs, NULL);
+ machine_check_vector(regs);
+ break;
default:
goto exit_and_crash;
}
Index: 2007-05-14/xen/arch/x86/traps.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/traps.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/traps.c 2007-05-15 15:52:58.000000000 +0200
@@ -707,12 +707,6 @@ asmlinkage int do_int3(struct cpu_user_r
return do_guest_trap(TRAP_int3, regs, 0);
}
-asmlinkage int do_machine_check(struct cpu_user_regs *regs)
-{
- fatal_trap(TRAP_machine_check, regs);
- return 0;
-}
-
void propagate_page_fault(unsigned long addr, u16 error_code)
{
struct trap_info *ti;
Index: 2007-05-14/xen/arch/x86/x86_32/entry.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_32/entry.S 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_32/entry.S 2007-05-21 12:45:09.000000000 +0200
@@ -77,14 +77,29 @@
restore_all_guest:
ASSERT_INTERRUPTS_DISABLED
testl $X86_EFLAGS_VM,UREGS_eflags(%esp)
- jnz restore_all_vm86
-#ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
+#ifndef CONFIG_X86_SUPERVISOR_MODE_KERNEL
+ popl %ebx
+ popl %ecx
+ popl %edx
+ popl %esi
+ popl %edi
+ popl %ebp
+ popl %eax
+ leal 4(%esp),%esp
+ jnz .Lrestore_iret_guest
+.Lrestore_sregs_guest:
+.Lft1: mov UREGS_ds-UREGS_eip(%esp),%ds
+.Lft2: mov UREGS_es-UREGS_eip(%esp),%es
+.Lft3: mov UREGS_fs-UREGS_eip(%esp),%fs
+.Lft4: mov UREGS_gs-UREGS_eip(%esp),%gs
+.Lrestore_iret_guest:
+#else
+ jnz restore_all_vm86
testl $2,UREGS_cs(%esp)
jnz 1f
call restore_ring0_guest
jmp restore_all_vm86
1:
-#endif
.Lft1: mov UREGS_ds(%esp),%ds
.Lft2: mov UREGS_es(%esp),%es
.Lft3: mov UREGS_fs(%esp),%fs
@@ -98,6 +113,7 @@ restore_all_vm86:
popl %ebp
popl %eax
addl $4,%esp
+#endif
.Lft5: iret
.section .fixup,"ax"
.Lfx5: subl $28,%esp
@@ -109,9 +125,13 @@ restore_all_vm86:
movl %edx,UREGS_edx+4(%esp)
movl %ecx,UREGS_ecx+4(%esp)
movl %ebx,UREGS_ebx+4(%esp)
+#ifndef CONFIG_X86_SUPERVISOR_MODE_KERNEL
+.equ .Lfx1, .Lfx5
+#else
.Lfx1: SET_XEN_SEGMENTS(a)
movl %eax,%fs
movl %eax,%gs
+#endif
sti
popl %esi
pushfl # EFLAGS
@@ -169,8 +189,8 @@ restore_all_xen:
ENTRY(hypercall)
subl $4,%esp
FIXUP_RING0_GUEST_STACK
- SAVE_ALL(b)
- sti
+ SAVE_ALL(1f,1f)
+1: sti
GET_CURRENT(%ebx)
cmpl $NR_hypercalls,%eax
jae bad_hypercall
@@ -433,9 +453,13 @@ ENTRY(divide_error)
ALIGN
handle_exception:
FIXUP_RING0_GUEST_STACK
- SAVE_ALL_NOSEGREGS(a)
- SET_XEN_SEGMENTS(a)
- testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%esp)
+ SAVE_ALL(1f,2f)
+ .text 1
+1: mov %ecx,%ds
+ mov %ecx,%es
+ jmp 2f
+ .previous
+2: testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%esp)
jz exception_with_ints_disabled
sti # re-enable interrupts
1: xorl %eax,%eax
@@ -546,18 +570,14 @@ ENTRY(page_fault)
movw $TRAP_page_fault,2(%esp)
jmp handle_exception
-ENTRY(machine_check)
- pushl $TRAP_machine_check<<16
- jmp handle_exception
-
ENTRY(spurious_interrupt_bug)
pushl $TRAP_spurious_int<<16
jmp handle_exception
ENTRY(early_page_fault)
- SAVE_ALL_NOSEGREGS(a)
- movl %esp,%edx
- pushl %edx
+ SAVE_ALL(1f,1f)
+1: movl %esp,%eax
+ pushl %eax
call do_early_page_fault
addl $4,%esp
jmp restore_all_xen
@@ -568,49 +588,84 @@ ENTRY(nmi)
iret
#else
# Save state but do not trash the segment registers!
- # We may otherwise be unable to reload them or copy them to ring 1.
+ pushl $TRAP_nmi<<16
+ SAVE_ALL(.Lnmi_xen,.Lnmi_common)
+.Lnmi_common:
+ movl %esp,%eax
pushl %eax
- SAVE_ALL_NOSEGREGS(a)
-
- # We can only process the NMI if:
- # A. We are the outermost Xen activation (in which case we have
- # the selectors safely saved on our stack)
- # B. DS and ES contain sane Xen values.
- # In all other cases we bail without touching DS-GS, as we have
- # interrupted an enclosing Xen activation in tricky prologue or
- # epilogue code.
- movl UREGS_eflags(%esp),%eax
- movb UREGS_cs(%esp),%al
- testl $(3|X86_EFLAGS_VM),%eax
- jnz continue_nmi
- movl %ds,%eax
- cmpw $(__HYPERVISOR_DS),%ax
- jne defer_nmi
- movl %es,%eax
- cmpw $(__HYPERVISOR_DS),%ax
- jne defer_nmi
-
-continue_nmi:
- SET_XEN_SEGMENTS(d)
- movl %esp,%edx
- pushl %edx
call do_nmi
addl $4,%esp
jmp ret_from_intr
+.Lnmi_xen:
+ GET_GUEST_REGS(%ebx)
+ testl $X86_EFLAGS_VM,%ss:UREGS_eflags(%ebx)
+ mov %ds,%eax
+ mov %es,%edx
+ jnz .Lnmi_vm86
+ cmpw %ax,%cx
+ mov %ecx,%ds
+ cmovel UREGS_ds(%ebx),%eax
+ cmpw %dx,%cx
+ movl %eax,UREGS_ds(%ebx)
+ cmovel UREGS_es(%ebx),%edx
+ mov %ecx,%es
+ movl $.Lrestore_sregs_guest,%ecx
+ movl %edx,UREGS_es(%ebx)
+ cmpl %ecx,UREGS_eip(%esp)
+ jbe .Lnmi_common
+ cmpl $.Lrestore_iret_guest,UREGS_eip(%esp)
+ ja .Lnmi_common
+ movl %ecx,UREGS_eip(%esp)
+ jmp .Lnmi_common
+.Lnmi_vm86:
+ mov %ecx,%ds
+ mov %ecx,%es
+ jmp .Lnmi_common
+#endif /* !CONFIG_X86_SUPERVISOR_MODE_KERNEL */
-defer_nmi:
- movl $FIXMAP_apic_base,%eax
- # apic_wait_icr_idle()
-1: movl %ss:APIC_ICR(%eax),%ebx
- testl $APIC_ICR_BUSY,%ebx
- jnz 1b
- # __send_IPI_shortcut(APIC_DEST_SELF, TRAP_deferred_nmi)
- movl $(APIC_DM_FIXED | APIC_DEST_SELF | APIC_DEST_PHYSICAL | \
- TRAP_deferred_nmi),%ss:APIC_ICR(%eax)
- jmp restore_all_xen
+ENTRY(machine_check)
+ # See NMI handler for explanations.
+#ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
+ iret
+#else
+ pushl $TRAP_machine_check<<16
+ SAVE_ALL(.Lmce_xen,.Lmce_common)
+.Lmce_common:
+ movl %esp,%eax
+ pushl %eax
+ call *machine_check_vector
+ addl $4,%esp
+ jmp ret_from_intr
+.Lmce_xen:
+ GET_GUEST_REGS(%ebx)
+ testl $X86_EFLAGS_VM,%ss:UREGS_eflags(%ebx)
+ mov %ds,%eax
+ mov %es,%edx
+ jnz .Lmce_vm86
+ cmpw %ax,%cx
+ mov %ecx,%ds
+ cmovel UREGS_ds(%ebx),%eax
+ cmpw %dx,%cx
+ movl %eax,UREGS_ds(%ebx)
+ cmovel UREGS_es(%ebx),%edx
+ mov %ecx,%es
+ movl $.Lrestore_sregs_guest,%ecx
+ movl %edx,UREGS_es(%ebx)
+ cmpl %ecx,UREGS_eip(%esp)
+ jbe .Lmce_common
+ cmpl $.Lrestore_iret_guest,UREGS_eip(%esp)
+ ja .Lmce_common
+ movl %ecx,UREGS_eip(%esp)
+ jmp .Lmce_common
+.Lmce_vm86:
+ mov %ecx,%ds
+ mov %ecx,%es
+ jmp .Lmce_common
#endif /* !CONFIG_X86_SUPERVISOR_MODE_KERNEL */
ENTRY(setup_vm86_frame)
+ mov %ecx,%ds
+ mov %ecx,%es
# Copies the entire stack frame forwards by 16 bytes.
.macro copy_vm86_words count=18
.if \count
@@ -644,7 +699,7 @@ ENTRY(exception_table)
.long do_spurious_interrupt_bug
.long do_coprocessor_error
.long do_alignment_check
- .long do_machine_check
+ .long 0 # machine_check
.long do_simd_coprocessor_error
ENTRY(hypercall_table)
Index: 2007-05-14/xen/arch/x86/x86_32/traps.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_32/traps.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_32/traps.c 2007-05-21 09:00:10.000000000 +0200
@@ -235,15 +235,6 @@ unsigned long do_iret(void)
return 0;
}
-#include <asm/asm_defns.h>
-BUILD_SMP_INTERRUPT(deferred_nmi, TRAP_deferred_nmi)
-fastcall void smp_deferred_nmi(struct cpu_user_regs *regs)
-{
- asmlinkage void do_nmi(struct cpu_user_regs *);
- ack_APIC_irq();
- do_nmi(regs);
-}
-
void __init percpu_traps_init(void)
{
struct tss_struct *tss = &doublefault_tss;
@@ -258,8 +249,6 @@ void __init percpu_traps_init(void)
/* The hypercall entry vector is only accessible from ring 1. */
_set_gate(idt_table+HYPERCALL_VECTOR, 14, 1, &hypercall);
- set_intr_gate(TRAP_deferred_nmi, &deferred_nmi);
-
/*
* Make a separate task for double faults. This will get us debug output if
* we blow the kernel stack.
Index: 2007-05-14/xen/arch/x86/x86_64/entry.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_64/entry.S 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_64/entry.S 2007-05-21 11:24:15.000000000 +0200
@@ -518,11 +518,6 @@ ENTRY(page_fault)
movl $TRAP_page_fault,4(%rsp)
jmp handle_exception
-ENTRY(machine_check)
- pushq $0
- movl $TRAP_machine_check,4(%rsp)
- jmp handle_exception
-
ENTRY(spurious_interrupt_bug)
pushq $0
movl $TRAP_spurious_int,4(%rsp)
@@ -559,6 +554,23 @@ nmi_in_hypervisor_mode:
call do_nmi
jmp ret_from_intr
+ENTRY(machine_check)
+ pushq $0
+ movl $TRAP_machine_check,4(%rsp)
+ SAVE_ALL
+ testb $3,UREGS_cs(%rsp)
+ jz .Lmce_in_hypervisor_mode
+ /* Interrupted guest context. Copy the context to stack bottom. */
+ GET_GUEST_REGS(%rdi)
+ movq %rsp,%rsi
+ movl $UREGS_kernel_sizeof/8,%ecx
+ movq %rdi,%rsp
+ rep movsq
+.Lmce_in_hypervisor_mode:
+ movq %rsp,%rdi
+ call *machine_check_vector(%rip)
+ jmp ret_from_intr
+
.data
ENTRY(exception_table)
@@ -580,7 +592,7 @@ ENTRY(exception_table)
.quad do_spurious_interrupt_bug
.quad do_coprocessor_error
.quad do_alignment_check
- .quad do_machine_check
+ .quad 0 # machine_check
.quad do_simd_coprocessor_error
ENTRY(hypercall_table)
Index: 2007-05-14/xen/arch/x86/x86_64/traps.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_64/traps.c 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_64/traps.c 2007-05-15 15:46:51.000000000 +0200
@@ -260,6 +260,7 @@ void __init percpu_traps_init(void)
set_intr_gate(TRAP_double_fault, &double_fault);
idt_table[TRAP_double_fault].a |= 1UL << 32; /* IST1 */
idt_table[TRAP_nmi].a |= 2UL << 32; /* IST2 */
+ idt_table[TRAP_machine_check].a|= 3UL << 32; /* IST3 */
/*
* The 32-on-64 hypercall entry vector is only accessible from ring 1.
@@ -274,7 +275,10 @@ void __init percpu_traps_init(void)
stack_bottom = (char *)get_stack_bottom();
stack = (char *)((unsigned long)stack_bottom & ~(STACK_SIZE - 1));
- /* Double-fault handler has its own per-CPU 2kB stack. */
+ /* Machine Check handler has its own per-CPU 1kB stack. */
+ init_tss[cpu].ist[2] = (unsigned long)&stack[1024];
+
+ /* Double-fault handler has its own per-CPU 1kB stack. */
init_tss[cpu].ist[0] = (unsigned long)&stack[2048];
/* NMI handler has its own per-CPU 1kB stack. */
Index: 2007-05-14/xen/include/asm-x86/hvm/hvm.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/hvm.h 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/hvm.h 2007-05-15 17:29:10.000000000 +0200
@@ -277,4 +277,11 @@ static inline int hvm_event_injection_fa
return hvm_funcs.event_injection_faulted(v);
}
+/* These bits in the CR4 are owned by the host */
+#define HVM_CR4_HOST_MASK (mmu_cr4_features & \
+ (X86_CR4_VMXE | X86_CR4_PAE | X86_CR4_MCE))
+
+/* These exceptions must always be intercepted. */
+#define HVM_TRAP_MASK (1U << TRAP_machine_check)
+
#endif /* __ASM_X86_HVM_HVM_H__ */
Index: 2007-05-14/xen/include/asm-x86/hvm/svm/vmcb.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/svm/vmcb.h 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/svm/vmcb.h 2007-05-15 17:07:57.000000000 +0200
@@ -465,14 +465,6 @@ void svm_destroy_vmcb(struct vcpu *v);
void setup_vmcb_dump(void);
-/* These bits in the CR4 are owned by the host */
-#if CONFIG_PAGING_LEVELS >= 3
-#define SVM_CR4_HOST_MASK (X86_CR4_PAE)
-#else
-#define SVM_CR4_HOST_MASK 0
-#endif
-
-
#endif /* ASM_X86_HVM_SVM_VMCS_H__ */
/*
Index: 2007-05-14/xen/include/asm-x86/hvm/trace.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/trace.h 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/trace.h 2007-05-15 17:30:42.000000000 +0200
@@ -21,6 +21,7 @@
#define DO_TRC_HVM_CPUID 1
#define DO_TRC_HVM_INTR 1
#define DO_TRC_HVM_NMI 1
+#define DO_TRC_HVM_MCE 1
#define DO_TRC_HVM_SMI 1
#define DO_TRC_HVM_VMMCALL 1
#define DO_TRC_HVM_HLT 1
Index: 2007-05-14/xen/include/asm-x86/hvm/vmx/vmx.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/vmx/vmx.h 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/vmx/vmx.h 2007-05-15 17:08:05.000000000 +0200
@@ -128,13 +128,6 @@ void set_guest_time(struct vcpu *v, u64
#define TYPE_MOV_FROM_DR (1 << 4)
#define DEBUG_REG_ACCESS_REG 0xf00 /* 11:8, general purpose register */
-/* These bits in the CR4 are owned by the host */
-#if CONFIG_PAGING_LEVELS >= 3
-#define VMX_CR4_HOST_MASK (X86_CR4_VMXE | X86_CR4_PAE)
-#else
-#define VMX_CR4_HOST_MASK (X86_CR4_VMXE)
-#endif
-
#define VMCALL_OPCODE ".byte 0x0f,0x01,0xc1\n"
#define VMCLEAR_OPCODE ".byte 0x66,0x0f,0xc7\n" /* reg/opcode: /6 */
#define VMLAUNCH_OPCODE ".byte 0x0f,0x01,0xc2\n"
Index: 2007-05-14/xen/include/asm-x86/processor.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/processor.h 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/processor.h 2007-05-16 12:30:05.000000000 +0200
@@ -104,7 +104,6 @@
#define TRAP_alignment_check 17
#define TRAP_machine_check 18
#define TRAP_simd_error 19
-#define TRAP_deferred_nmi 31
/* Set for entry via SYSCALL. Informs return code to use SYSRETQ not IRETQ. */
/* NB. Same as VGCF_in_syscall. No bits in common with any other TRAP_ defn. */
@@ -569,6 +568,7 @@ extern void mtrr_ap_init(void);
extern void mtrr_bp_init(void);
extern void mcheck_init(struct cpuinfo_x86 *c);
+extern asmlinkage void (*machine_check_vector)(struct cpu_user_regs *);
int cpuid_hypervisor_leaves(
uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);
Index: 2007-05-14/xen/include/asm-x86/x86_32/asm_defns.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/x86_32/asm_defns.h 2007-04-23 10:01:46.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/x86_32/asm_defns.h 2007-05-21 12:44:12.000000000 +0200
@@ -22,7 +22,7 @@
#define ASSERT_INTERRUPTS_ENABLED ASSERT_INTERRUPT_STATUS(nz)
#define ASSERT_INTERRUPTS_DISABLED ASSERT_INTERRUPT_STATUS(z)
-#define __SAVE_ALL_PRE \
+#define SAVE_ALL(xen_lbl, vm86_lbl) \
cld; \
pushl %eax; \
pushl %ebp; \
@@ -33,31 +33,32 @@
pushl %ecx; \
pushl %ebx; \
testl $(X86_EFLAGS_VM),UREGS_eflags(%esp); \
- jz 2f; \
- call setup_vm86_frame; \
- jmp 3f; \
- 2:testb $3,UREGS_cs(%esp); \
- jz 1f; \
- mov %ds,UREGS_ds(%esp); \
- mov %es,UREGS_es(%esp); \
+ mov %ds,%edi; \
+ mov %es,%esi; \
+ movl $(__HYPERVISOR_DS),%ecx; \
+ jnz 86f; \
+ .text 1; \
+ 86:call setup_vm86_frame; \
+ jmp vm86_lbl; \
+ .previous; \
+ testb $3,UREGS_cs(%esp); \
+ jz xen_lbl; \
+ cmpw %cx,%di; \
+ mov %ecx,%ds; \
mov %fs,UREGS_fs(%esp); \
+ cmovel UREGS_ds(%esp),%edi; \
+ cmpw %cx,%si; \
+ mov %edi,UREGS_ds(%esp); \
+ cmovel UREGS_es(%esp),%esi; \
+ mov %ecx,%es; \
mov %gs,UREGS_gs(%esp); \
- 3:
-
-#define SAVE_ALL_NOSEGREGS(_reg) \
- __SAVE_ALL_PRE \
- 1:
+ mov %esi,UREGS_es(%esp)
#define SET_XEN_SEGMENTS(_reg) \
movl $(__HYPERVISOR_DS),%e ## _reg ## x; \
mov %e ## _reg ## x,%ds; \
mov %e ## _reg ## x,%es;
-#define SAVE_ALL(_reg) \
- __SAVE_ALL_PRE \
- SET_XEN_SEGMENTS(_reg) \
- 1:
-
#ifdef PERF_COUNTERS
#define PERFC_INCR(_name,_idx,_cur) \
pushl _cur; \
@@ -93,8 +94,8 @@ __asm__(
STR(x) ":\n\t" \
"pushl $"#v"<<16\n\t" \
STR(FIXUP_RING0_GUEST_STACK) \
- STR(SAVE_ALL(a)) \
- "movl %esp,%eax\n\t" \
+ STR(SAVE_ALL(1f,1f)) "\n\t" \
+ "1:movl %esp,%eax\n\t" \
"pushl %eax\n\t" \
"call "STR(smp_##x)"\n\t" \
"addl $4,%esp\n\t" \
@@ -105,8 +106,8 @@ __asm__(
"\n" __ALIGN_STR"\n" \
"common_interrupt:\n\t" \
STR(FIXUP_RING0_GUEST_STACK) \
- STR(SAVE_ALL(a)) \
- "movl %esp,%eax\n\t" \
+ STR(SAVE_ALL(1f,1f)) "\n\t" \
+ "1:movl %esp,%eax\n\t" \
"pushl %eax\n\t" \
"call " STR(do_IRQ) "\n\t" \
"addl $4,%esp\n\t" \
Index: 2007-05-14/xen/include/public/trace.h
===================================================================
--- 2007-05-14.orig/xen/include/public/trace.h 2007-05-21 08:58:02.000000000 +0200
+++ 2007-05-14/xen/include/public/trace.h 2007-05-15 17:55:19.000000000 +0200
@@ -88,6 +88,7 @@
#define TRC_HVM_VMMCALL (TRC_HVM_HANDLER + 0x12)
#define TRC_HVM_HLT (TRC_HVM_HANDLER + 0x13)
#define TRC_HVM_INVLPG (TRC_HVM_HANDLER + 0x14)
+#define TRC_HVM_MCE (TRC_HVM_HANDLER + 0x15)
/* This structure represents a single trace buffer record. */
struct t_rec {

View File

@ -1,7 +1,47 @@
Index: 2007-05-14/xen/arch/x86/cpu/common.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/cpu/common.c 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/arch/x86/cpu/common.c 2007-05-15 10:22:03.000000000 +0200
@@ -229,7 +229,6 @@ static void __init early_cpu_detect(void
void __devinit generic_identify(struct cpuinfo_x86 * c)
{
u32 tfms, xlvl;
- int junk;
if (have_cpuid_p()) {
/* Get vendor name */
@@ -244,8 +243,8 @@ void __devinit generic_identify(struct c
/* Intel-defined flags: level 0x00000001 */
if ( c->cpuid_level >= 0x00000001 ) {
- u32 capability, excap;
- cpuid(0x00000001, &tfms, &junk, &excap, &capability);
+ u32 capability, excap, ebx;
+ cpuid(0x00000001, &tfms, &ebx, &excap, &capability);
c->x86_capability[0] = capability;
c->x86_capability[4] = excap;
c->x86 = (tfms >> 8) & 15;
@@ -255,6 +254,8 @@ void __devinit generic_identify(struct c
c->x86_model += ((tfms >> 16) & 0xF) << 4;
}
c->x86_mask = tfms & 15;
+ if (c->x86_capability[0] & (1<<19))
+ c->x86_clflush_size = ((ebx >> 8) & 0xff) * 8;
} else {
/* Have CPUID level 0 only - unheard of */
c->x86 = 4;
@@ -313,6 +314,7 @@ void __devinit identify_cpu(struct cpuin
c->x86_vendor_id[0] = '\0'; /* Unset */
c->x86_model_id[0] = '\0'; /* Unset */
c->x86_max_cores = 1;
+ c->x86_clflush_size = 32;
memset(&c->x86_capability, 0, sizeof c->x86_capability);
if (!have_cpuid_p()) {
Index: 2007-05-14/xen/arch/x86/mm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm.c 2007-05-14 14:33:33.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm.c 2007-05-14 14:35:02.000000000 +0200
--- 2007-05-14.orig/xen/arch/x86/mm.c 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm.c 2007-05-15 10:29:55.000000000 +0200
@@ -147,6 +147,14 @@ struct page_info *frame_table;
unsigned long max_page;
unsigned long total_pages;
@ -365,7 +405,52 @@ Index: 2007-05-14/xen/arch/x86/mm.c
unmap_domain_page(pl1e);
@@ -3439,6 +3608,8 @@ int map_pages_to_xen(
@@ -3397,11 +3566,27 @@ int ptwr_do_page_fault(struct vcpu *v, u
return 0;
}
+static inline unsigned int l1f_to_l2f(unsigned int flags)
+{
+ if ( flags & _PAGE_PAT )
+ flags = (flags & ~_PAGE_PAT) | _PAGE_PSE_PAT;
+ return flags | _PAGE_PSE;
+}
+
+static inline unsigned int l2f_to_l1f(unsigned int flags)
+{
+ ASSERT(flags & _PAGE_PSE);
+ flags &= ~_PAGE_PSE;
+ if ( flags & _PAGE_PSE_PAT )
+ flags = (flags & ~_PAGE_PSE_PAT) | _PAGE_PAT;
+ return flags;
+}
+
int map_pages_to_xen(
unsigned long virt,
unsigned long mfn,
unsigned long nr_mfns,
- unsigned long flags)
+ unsigned int flags)
{
l2_pgentry_t *pl2e, ol2e;
l1_pgentry_t *pl1e, ol1e;
@@ -3420,11 +3605,14 @@ int map_pages_to_xen(
{
/* Super-page mapping. */
ol2e = *pl2e;
- l2e_write_atomic(pl2e, l2e_from_pfn(mfn, flags|_PAGE_PSE));
+ l2e_write_atomic(pl2e, l2e_from_pfn(mfn, l1f_to_l2f(flags)));
if ( (l2e_get_flags(ol2e) & _PAGE_PRESENT) )
{
local_flush_tlb_pge();
+ if ( (l2e_get_flags(ol2e) ^ l1f_to_l2f(flags)) &
+ l1f_to_l2f(PAGE_CACHE_ATTRS) )
+ wbinvd();
if ( !(l2e_get_flags(ol2e) & _PAGE_PSE) )
free_xen_pagetable(mfn_to_virt(l2e_get_pfn(ol2e)));
}
@@ -3439,6 +3627,8 @@ int map_pages_to_xen(
if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
{
pl1e = alloc_xen_pagetable();
@ -374,7 +459,7 @@ Index: 2007-05-14/xen/arch/x86/mm.c
clear_page(pl1e);
l2e_write(pl2e, l2e_from_pfn(virt_to_mfn(pl1e),
__PAGE_HYPERVISOR));
@@ -3446,6 +3617,8 @@ int map_pages_to_xen(
@@ -3446,10 +3636,12 @@ int map_pages_to_xen(
else if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
{
pl1e = alloc_xen_pagetable();
@ -383,7 +468,31 @@ Index: 2007-05-14/xen/arch/x86/mm.c
for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
l1e_write(&pl1e[i],
l1e_from_pfn(l2e_get_pfn(*pl2e) + i,
@@ -3464,6 +3637,28 @@ int map_pages_to_xen(
- l2e_get_flags(*pl2e) & ~_PAGE_PSE));
+ l2f_to_l1f(l2e_get_flags(*pl2e))));
l2e_write_atomic(pl2e, l2e_from_pfn(virt_to_mfn(pl1e),
__PAGE_HYPERVISOR));
local_flush_tlb_pge();
@@ -3459,11 +3651,47 @@ int map_pages_to_xen(
ol1e = *pl1e;
l1e_write_atomic(pl1e, l1e_from_pfn(mfn, flags));
if ( (l1e_get_flags(ol1e) & _PAGE_PRESENT) )
+ {
local_flush_tlb_one(virt);
+ if ( ((l1e_get_flags(ol1e) ^ flags) & PAGE_CACHE_ATTRS) )
+ {
+ const struct cpuinfo_x86 *c = &current_cpu_data;
+
+ if ( (flags & _PAGE_PRESENT) && cpu_has_clflush )
+ {
+ for ( i = 0; i < PAGE_SIZE; i += c->x86_clflush_size )
+ asm volatile("clflush (%0)" :: "r" (virt + i));
+ }
+ else if ( c->x86_model >= 4 )
+ wbinvd();
+ }
+ }
virt += 1UL << L1_PAGETABLE_SHIFT;
mfn += 1UL;
nr_mfns -= 1UL;
@ -404,7 +513,7 @@ Index: 2007-05-14/xen/arch/x86/mm.c
+ if ( i == L1_PAGETABLE_ENTRIES )
+ {
+ ol2e = *pl2e;
+ l2e_write(pl2e, l2e_from_pfn(base_mfn, flags|_PAGE_PSE));
+ l2e_write(pl2e, l2e_from_pfn(base_mfn, l1f_to_l2f(flags)));
+ local_flush_tlb_pge();
+ free_xen_pagetable(mfn_to_virt(l2e_get_pfn(ol2e)));
+ }
@ -414,7 +523,7 @@ Index: 2007-05-14/xen/arch/x86/mm.c
Index: 2007-05-14/xen/arch/x86/mm/shadow/common.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm/shadow/common.c 2007-05-14 08:28:38.000000000 +0200
--- 2007-05-14.orig/xen/arch/x86/mm/shadow/common.c 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm/shadow/common.c 2007-05-14 14:35:02.000000000 +0200
@@ -1320,7 +1320,7 @@ static void sh_hash_audit_bucket(struct
/* Bad shadow flags on guest page? */
@ -427,7 +536,7 @@ Index: 2007-05-14/xen/arch/x86/mm/shadow/common.c
SHADOW_ERROR("MFN %#lx shadowed (by %#"PRI_mfn")"
Index: 2007-05-14/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm/shadow/multi.c 2007-05-14 14:28:19.000000000 +0200
--- 2007-05-14.orig/xen/arch/x86/mm/shadow/multi.c 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm/shadow/multi.c 2007-05-14 14:35:02.000000000 +0200
@@ -4128,8 +4128,7 @@ audit_gfn_to_mfn(struct vcpu *v, gfn_t g
if ( !shadow_mode_translate(v->domain) )
@ -441,7 +550,7 @@ Index: 2007-05-14/xen/arch/x86/mm/shadow/multi.c
return gfn_to_mfn(v->domain, gfn_x(gfn));
Index: 2007-05-14/xen/include/asm-x86/mm.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/mm.h 2007-05-14 13:43:35.000000000 +0200
--- 2007-05-14.orig/xen/include/asm-x86/mm.h 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/mm.h 2007-05-14 14:35:02.000000000 +0200
@@ -64,24 +64,35 @@ struct page_info
};
@ -499,9 +608,41 @@ Index: 2007-05-14/xen/include/asm-x86/mm.h
void free_page_type(struct page_info *page, unsigned long type);
int _shadow_mode_refcounts(struct domain *d);
Index: 2007-05-14/xen/include/asm-x86/page.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/page.h 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/page.h 2007-05-15 08:53:37.000000000 +0200
@@ -368,13 +368,13 @@ void free_xen_pagetable(void *v);
l2_pgentry_t *virt_to_xen_l2e(unsigned long v);
/* Map machine page range in Xen virtual address space. */
-#define MAP_SMALL_PAGES (1UL<<16) /* don't use superpages for the mapping */
+#define MAP_SMALL_PAGES (1U<<31) /* don't use superpages for the mapping */
int
map_pages_to_xen(
unsigned long virt,
unsigned long mfn,
unsigned long nr_mfns,
- unsigned long flags);
+ unsigned int flags);
#endif /* !__ASSEMBLY__ */
Index: 2007-05-14/xen/include/asm-x86/processor.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/processor.h 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/processor.h 2007-05-15 10:24:15.000000000 +0200
@@ -175,6 +175,7 @@ struct cpuinfo_x86 {
unsigned char x86_max_cores; /* cpuid returned max cores value */
unsigned char booted_cores; /* number of cores as seen by OS */
unsigned char apicid;
+ unsigned short x86_clflush_size;
} __cacheline_aligned;
/*
Index: 2007-05-14/xen/include/asm-x86/x86_32/page-3level.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/x86_32/page-3level.h 2007-04-23 10:01:46.000000000 +0200
--- 2007-05-14.orig/xen/include/asm-x86/x86_32/page-3level.h 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/x86_32/page-3level.h 2007-05-14 14:35:02.000000000 +0200
@@ -85,6 +85,6 @@ typedef l3_pgentry_t root_pgentry_t;
#define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF))
@ -513,7 +654,7 @@ Index: 2007-05-14/xen/include/asm-x86/x86_32/page-3level.h
#endif /* __X86_32_PAGE_3LEVEL_H__ */
Index: 2007-05-14/xen/include/asm-x86/x86_32/page.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/x86_32/page.h 2007-04-23 10:01:46.000000000 +0200
--- 2007-05-14.orig/xen/include/asm-x86/x86_32/page.h 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/x86_32/page.h 2007-05-14 14:35:02.000000000 +0200
@@ -29,13 +29,13 @@ extern unsigned int PAGE_HYPERVISOR_NOCA
(_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_GNTTAB)
@ -533,7 +674,7 @@ Index: 2007-05-14/xen/include/asm-x86/x86_32/page.h
Index: 2007-05-14/xen/include/asm-x86/x86_64/page.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/x86_64/page.h 2007-05-03 09:45:09.000000000 +0200
--- 2007-05-14.orig/xen/include/asm-x86/x86_64/page.h 2007-05-15 10:29:20.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/x86_64/page.h 2007-05-14 14:35:02.000000000 +0200
@@ -87,18 +87,18 @@ typedef l4_pgentry_t root_pgentry_t;
#define _PAGE_NX (cpu_has_nx ? _PAGE_NX_BIT : 0U)

View File

@ -1,7 +1,7 @@
Index: 2007-05-14/xen/arch/x86/mm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm.c 2007-05-14 14:40:28.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm.c 2007-05-14 14:40:43.000000000 +0200
--- 2007-05-14.orig/xen/arch/x86/mm.c 2007-05-15 10:29:55.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm.c 2007-05-15 10:31:42.000000000 +0200
@@ -3499,6 +3499,7 @@ static int ptwr_emulated_cmpxchg(
container_of(ctxt, struct ptwr_emulate_ctxt, ctxt));
}
@ -30,7 +30,7 @@ Index: 2007-05-14/xen/arch/x86/mm.c
/* Write page fault handler: check if guest is trying to modify a PTE. */
Index: 2007-05-14/xen/arch/x86/mm/shadow/common.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm/shadow/common.c 2007-05-14 14:40:28.000000000 +0200
--- 2007-05-14.orig/xen/arch/x86/mm/shadow/common.c 2007-05-14 14:35:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm/shadow/common.c 2007-05-14 14:40:43.000000000 +0200
@@ -310,6 +310,7 @@ hvm_emulate_cmpxchg(enum x86_segment seg
v, addr, old, new, bytes, sh_ctxt);
@ -99,7 +99,7 @@ Index: 2007-05-14/xen/arch/x86/mm/shadow/common.c
Index: 2007-05-14/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm/shadow/multi.c 2007-05-14 14:40:28.000000000 +0200
--- 2007-05-14.orig/xen/arch/x86/mm/shadow/multi.c 2007-05-14 14:35:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm/shadow/multi.c 2007-05-14 14:40:43.000000000 +0200
@@ -4025,7 +4025,8 @@ sh_x86_emulate_cmpxchg(struct vcpu *v, u
return rv;
@ -131,7 +131,7 @@ Index: 2007-05-14/xen/arch/x86/mm/shadow/multi.c
#if SHADOW_OPTIMIZATIONS & SHOPT_WRITABLE_HEURISTIC
Index: 2007-05-14/xen/arch/x86/x86_emulate.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_emulate.c 2007-04-23 10:01:43.000000000 +0200
--- 2007-05-14.orig/xen/arch/x86/x86_emulate.c 2007-05-15 10:29:19.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_emulate.c 2007-05-14 14:40:43.000000000 +0200
@@ -30,6 +30,7 @@
#include <xen/types.h>
@ -259,7 +259,7 @@ Index: 2007-05-14/xen/arch/x86/x86_emulate.c
#ifdef __x86_64__
Index: 2007-05-14/xen/include/asm-x86/cpufeature.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/cpufeature.h 2007-05-14 14:40:20.000000000 +0200
--- 2007-05-14.orig/xen/include/asm-x86/cpufeature.h 2007-05-15 10:29:19.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/cpufeature.h 2007-05-14 14:40:43.000000000 +0200
@@ -121,6 +121,7 @@
#define cpu_has_cyrix_arr boot_cpu_has(X86_FEATURE_CYRIX_ARR)
@ -279,7 +279,7 @@ Index: 2007-05-14/xen/include/asm-x86/cpufeature.h
#endif /* __ASM_I386_CPUFEATURE_H */
Index: 2007-05-14/xen/include/asm-x86/x86_emulate.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/x86_emulate.h 2007-04-23 10:01:47.000000000 +0200
--- 2007-05-14.orig/xen/include/asm-x86/x86_emulate.h 2007-05-15 10:29:19.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/x86_emulate.h 2007-05-14 14:40:43.000000000 +0200
@@ -68,8 +68,9 @@ enum x86_segment {
* some out-of-band mechanism, unknown to the emulator. The memop signals
@ -318,7 +318,7 @@ Index: 2007-05-14/xen/include/asm-x86/x86_emulate.h
unsigned long old_lo,
Index: 2007-05-14/xen/include/asm-x86/paging.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/paging.h 2007-04-23 10:01:46.000000000 +0200
--- 2007-05-14.orig/xen/include/asm-x86/paging.h 2007-05-15 10:29:19.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/paging.h 2007-05-14 14:40:43.000000000 +0200
@@ -93,12 +93,14 @@ struct shadow_paging_mode {
unsigned long new,

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue May 22 09:52:50 MDT 2007 - ccoffing@novell.com
- Update Ron Terry's network-multi script.
- Drop xen-doc-ps. (#267948)
- Update init scripts.
- Tidy spec file to fix rpmlint errors.
- Updated patches from Jan.
-------------------------------------------------------------------
Mon May 21 10:41:41 MDT 2007 - ccoffing@novell.com

143
xen.spec
View File

@ -35,7 +35,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit
BuildRequires: kernel-source kernel-syms xorg-x11
%endif
Version: 3.1.0_15040
Release: 5
Release: 7
License: GNU General Public License (GPL)
Group: System/Kernel
Autoreqprov: on
@ -56,8 +56,8 @@ Source11: xmexample.nbd
Source12: block-iscsi
Source13: xmexample.iscsi
Source14: xmclone.sh
Source15: dom0config
Source16: network-multi_bridge
Source15: sysconfig.xend
Source16: network-multi
# Upstream patches
Patch0: 15048-localtime.diff
# Our patches
@ -106,6 +106,7 @@ Patch142: pv-driver-build.patch
Patch143: qemu-security-etch1.diff
Patch144: netfront_mac.patch
Patch145: vnc-i18n-keys.diff
Patch146: rpmlint.diff
# Patches from Jan
Patch170: inval-sh-ldt.patch
Patch171: 32on64-cpuid.patch
@ -124,7 +125,7 @@ Patch183: svm-reg-save.patch
Patch184: vmx-no-cstar.patch
Patch185: hvm-debug-msg.patch
Patch186: guest-copy.patch
Patch187: page-cacheability.patch
Patch187: x86-page-cacheability.patch
Patch188: realmode.patch
Patch189: edd.patch
Patch190: edid.patch
@ -134,9 +135,11 @@ Patch193: x86_emulate.patch
Patch194: vgacon-keep.patch
Patch195: vgacon-50-lines.patch
Patch196: x86-extra-trap-info.patch
Patch197: x86-machine-check.patch
Patch198: x86-emul-rf.patch
Patch199: vmx-check-descr.patch
Patch300: xen-enable-hvm-debug.diff
URL: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/
Prefix: /usr
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %ix86 x86_64 ia64
%define pysite %(python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()")
@ -505,24 +508,6 @@ xpdf/kpdf/gpdf/gv/... to read the files in
Authors:
--------
Ian Pratt <ian.pratt@cl.cam.ac.uk>
%package doc-ps
Summary: Xen Virtualization: PostScript documentation
Group: Documentation/Other
%description doc-ps
Xen is a virtual machine monitor for x86 that supports execution of
multiple guest operating systems with unprecedented levels of
performance and resource isolation.
xen-doc-ps contains the online documentation in PostScript format. Use
gv/kghostview/... to read the files in /usr/share/doc/packages/xen/ps/
Authors:
--------
Ian Pratt <ian.pratt@cl.cam.ac.uk>
@ -579,6 +564,7 @@ cd ..
%patch143 -p1
%patch144 -p1
%patch145 -p1
%patch146 -p1
%patch170 -p1
%patch171 -p1
%patch172 -p1
@ -606,10 +592,13 @@ cd ..
%patch194 -p1
%patch195 -p1
%patch196 -p1
%patch197 -p1
%patch198 -p1
%patch199 -p1
XEN_EXTRAVERSION=%version-%release
XEN_EXTRAVERSION=${XEN_EXTRAVERSION#%{xvers}}
sed -i "s/XEN_EXTRAVERSION[ ]*.=.*\$/XEN_EXTRAVERSION = $XEN_EXTRAVERSION/" xen/Makefile
sed -i "s/XEN_CHANGESET[ ]*=.*\$/XEN_CHANGESET = %{changeset}/" xen/Makefile
sed -i "s/XEN_EXTRAVERSION[\t ]*.=.*\$/XEN_EXTRAVERSION = $XEN_EXTRAVERSION/" xen/Makefile
sed -i "s/XEN_CHANGESET[\t ]*=.*\$/XEN_CHANGESET = %{changeset}/" xen/Makefile
%build
cd ..
@ -696,7 +685,7 @@ done
make -C docs install \
DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir} \
DOCDIR=%{_defaultdocdir}/xen
for name in COPYING %SOURCE2 %SOURCE3; do
for name in COPYING %SOURCE2 %SOURCE3 %SOURCE4 %SOURCE14; do
install -m 644 $name $RPM_BUILD_ROOT/%{_defaultdocdir}/xen/
done
mkdir -p $RPM_BUILD_ROOT/%{_defaultdocdir}/xen/misc
@ -714,9 +703,8 @@ mkdir -p $RPM_BUILD_ROOT/etc/xen/{vm,examples}
mv $RPM_BUILD_ROOT/etc/xen/xmexample* $RPM_BUILD_ROOT/etc/xen/examples
rm $RPM_BUILD_ROOT/etc/xen/examples/*nbd
install -m644 %SOURCE9 %SOURCE11 %SOURCE13 $RPM_BUILD_ROOT/etc/xen/examples/
install -m644 %SOURCE15 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.xen
install -m644 %SOURCE15 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.xend
# scripts
install -m755 %SOURCE4 %SOURCE14 $RPM_BUILD_ROOT/%{_defaultdocdir}/xen/
rm $RPM_BUILD_ROOT/etc/xen/scripts/block-*nbd
install -m755 %SOURCE10 %SOURCE12 %SOURCE16 $RPM_BUILD_ROOT/etc/xen/scripts/
# logrotate
@ -744,47 +732,48 @@ mv $RPM_BUILD_ROOT/etc/udev/rules.d/xen-backend.rules $RPM_BUILD_ROOT/etc/udev/r
%endif
#%find_lang xen-xm xen.lang # po files are misnamed upstream
# Clean up unpackaged files
rm $RPM_BUILD_ROOT/usr/sbin/netfix
rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu/
rm -rf $RPM_BUILD_ROOT/%{_datadir}/doc/qemu/
rm -rf $RPM_BUILD_ROOT/%{_defaultdocdir}/xen/ps
rm $RPM_BUILD_ROOT/%{_mandir}/man1/qemu.*
rm $RPM_BUILD_ROOT/usr/sbin/netfix
rm $RPM_BUILD_ROOT/usr/lib*/xen/bin/qemu-dm.debug
rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info
%suse_update_desktop_file xen-vm-install X-SuSE-YaST-Virtualization
sed -i -e 's/Categories=.*/Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Virtualization;/' $RPM_BUILD_ROOT/%{_datadir}/applications/YaST2/xen-vm-install.desktop
%files
%defattr(-,root,root)
/boot/xen-%{version}-%{release}.gz
/boot/xen-%{xvers}.gz
/boot/xen-%{xvermaj}.gz
/boot/xen.gz
/boot/xen-syms-%{version}-%{release}
/boot/xen-syms
/boot/xen-%{xvers}.gz
/boot/xen-dbg-%{version}-%{release}.gz
/boot/xen-dbg-%{xvers}.gz
/boot/xen-dbg-%{xvermaj}.gz
/boot/xen-dbg-%{xvers}.gz
/boot/xen-dbg.gz
/boot/xen-syms-dbg-%{version}-%{release}
/boot/xen-syms
/boot/xen-syms-%{version}-%{release}
/boot/xen-syms-dbg
/boot/xen-syms-dbg-%{version}-%{release}
/boot/xen.gz
%ifarch %ix86
/boot/xen-pae-%{version}-%{release}.gz
/boot/xen-pae-%{xvers}.gz
/boot/xen-pae-%{xvermaj}.gz
/boot/xen-pae.gz
/boot/xen-syms-pae-%{version}-%{release}
/boot/xen-syms-pae
/boot/xen-pae-%{xvers}.gz
/boot/xen-pae-dbg-%{version}-%{release}.gz
/boot/xen-pae-dbg-%{xvers}.gz
/boot/xen-pae-dbg-%{xvermaj}.gz
/boot/xen-pae-dbg-%{xvers}.gz
/boot/xen-pae-dbg.gz
/boot/xen-syms-pae-dbg-%{version}-%{release}
/boot/xen-pae.gz
/boot/xen-syms-pae
/boot/xen-syms-pae-%{version}-%{release}
/boot/xen-syms-pae-dbg
/boot/xen-syms-pae-dbg-%{version}-%{release}
%endif
%files libs
%defattr(-,root,root)
%{_libdir}/fs/
%{_libdir}/libfsimage*
%{_libdir}/libblktap.so.*
%{_libdir}/libfsimage.so.*
%{_libdir}/libxen*.so.*
%files tools -f ../xen.lang
@ -798,14 +787,13 @@ sed -i -e 's/Categories=.*/Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Virtualization;
/usr/sbin/img2qcow
/usr/sbin/qcow-create
/usr/sbin/qcow2raw
/usr/sbin/tapdisk
/usr/sbin/rcxend
/usr/sbin/rcxendomains
/usr/sbin/tapdisk
/usr/sbin/xen*
/usr/sbin/xm
%if %{?with_install}0
/usr/bin/vm-install*
%{_datadir}/xen/*.dtd
%{_datadir}/xen/install
%dir /var/lib/xen/vm-install
%dir %{_datadir}/applications/YaST2
@ -818,41 +806,48 @@ sed -i -e 's/Categories=.*/Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Virtualization;
%dir /usr/lib/xen/bin
%endif
%dir /usr/lib/xen/boot
%{_libdir}/libblktap.so*
%{_datadir}/xen/*.dtd
%{_libdir}/xen/bin/readnotes
%{_libdir}/xen/bin/xen-sdlfb
%{_libdir}/xen/bin/xen-vncfb
%{_libdir}/xen/bin/xc_restore
%{_libdir}/xen/bin/xc_save
%{_libdir}/xen/bin/xen-sdlfb
%{_libdir}/xen/bin/xen-vncfb
%{_libdir}/xen/bin/xenconsole
%{_libdir}/xen/bin/xenctx
%{_mandir}/man1/*.1.gz
%{_mandir}/man5/*.5.gz
%{_mandir}/man8/*.8.gz
/var/adm/fillup-templates/*
%dir /var/lib/xen
%dir /var/lib/xenstored
%dir %attr(700,root,root) /var/lib/xen/images
%dir %attr(700,root,root) /var/lib/xen/save
%dir /var/lib/xen/xend-db
%dir /var/lib/xen/xend-db/domain
%dir /var/lib/xen/xend-db/migrate
%dir /var/lib/xen/xend-db/vnet
%dir /var/lib/xenstored
%dir /var/log/xen
%dir /var/run/xenstored
%config /etc/init.d/xendomains
%config /etc/init.d/xend
/etc/init.d/xend
/etc/init.d/xendomains
%config /etc/logrotate.d/xend
/var/adm/fillup-templates/*
%dir %attr(700,root,root) /etc/xen
%config /etc/xen/*
/etc/xen/auto
%config /etc/xen/examples
/etc/xen/images
/etc/xen/qemu-ifup
/etc/xen/scripts
%config /etc/xen/vm
%config /etc/xen/*.sxp
%config /etc/xen/*.xml
%dir /etc/udev
%dir /etc/udev/rules.d
/etc/udev/rules.d/40-xen.rules
%dir %{_defaultdocdir}/xen
%{_defaultdocdir}/xen/COPYING
%{_defaultdocdir}/xen/README.SuSE
%{_defaultdocdir}/xen/boot.xen
%{_defaultdocdir}/xen/boot.local.xenU
%{_defaultdocdir}/xen/boot.xen
%{_defaultdocdir}/xen/misc
%{_defaultdocdir}/xen/xmclone.sh
%dir %pysite/xen
@ -884,16 +879,18 @@ sed -i -e 's/Categories=.*/Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Virtualization;
%files devel
%defattr(-,root,root)
%{_libdir}/libblktap.a
%{_libdir}/libblktap.so
%{_libdir}/libfsimage.so
%{_libdir}/libxen*.a
%{_libdir}/libxen*.so
/usr/include/xen/
/usr/bin/serial-split
/usr/bin/xenperf
/usr/include/blktaplib.h
/usr/include/fsimage*
/usr/include/xen*.h
/usr/include/xen/
/usr/include/xs.h
/usr/include/xs_lib.h
/usr/bin/serial-split
/usr/bin/xenperf
%files doc-html
%defattr(-,root,root)
@ -901,30 +898,36 @@ sed -i -e 's/Categories=.*/Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Virtualization;
%files doc-pdf
%defattr(-,root,root)
%dir %{_defaultdocdir}/xen/pdf
%{_defaultdocdir}/xen/pdf/*
%files doc-ps
%defattr(-,root,root)
%dir %{_defaultdocdir}/xen/ps
%{_defaultdocdir}/xen/ps/*
%{_defaultdocdir}/xen/pdf
%clean
test ! -z "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR/%xen_build_dir
#test ! -z "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT
#rm -rf $RPM_BUILD_DIR/%xen_build_dir
%post tools
%{fillup_and_insserv -y -f xend}
%{fillup_and_insserv -y -n xendomains xendomains}
%{fillup_and_insserv -n xend xend}
%{fillup_and_insserv -n xendomains xendomains}
%preun tools
%{stop_on_removal xend xendomains}
%{stop_on_removal xendomains xend}
%postun tools
%{restart_on_update xend}
%{insserv_cleanup}
%post libs
/sbin/ldconfig
%postun libs
/sbin/ldconfig
%changelog
* Tue May 22 2007 - ccoffing@novell.com
- Update Ron Terry's network-multi script.
- Drop xen-doc-ps. (#267948)
- Update init scripts.
- Tidy spec file to fix rpmlint errors.
- Updated patches from Jan.
* Mon May 21 2007 - ccoffing@novell.com
- vm-install bug fixes:
+ #211342: better progress bar

View File

@ -1,7 +1,13 @@
Index: xen-unstable/tools/examples/init.d/sysconfig.xendomains
Index: xen-3.1-testing/tools/examples/init.d/sysconfig.xendomains
===================================================================
--- xen-unstable.orig/tools/examples/init.d/sysconfig.xendomains
+++ xen-unstable/tools/examples/init.d/sysconfig.xendomains
--- xen-3.1-testing.orig/tools/examples/init.d/sysconfig.xendomains
+++ xen-3.1-testing/tools/examples/init.d/sysconfig.xendomains
@@ -1,4 +1,4 @@
-## Path: System/xen
+## Path: System/Virtualization
## Description: xen domain start/stop on boot
## Type: string
## Default:
@@ -98,7 +98,6 @@ XENDOMAINS_RESTORE=true
# Note that the script tries to be clever if both RESTORE and AUTO are
# set: It will first restore saved domains and then only start domains
@ -21,10 +27,10 @@ Index: xen-unstable/tools/examples/init.d/sysconfig.xendomains
## Type: integer
## Default: 300
Index: xen-unstable/tools/examples/xend-config.sxp
Index: xen-3.1-testing/tools/examples/xend-config.sxp
===================================================================
--- xen-unstable.orig/tools/examples/xend-config.sxp
+++ xen-unstable/tools/examples/xend-config.sxp
--- xen-3.1-testing.orig/tools/examples/xend-config.sxp
+++ xen-3.1-testing/tools/examples/xend-config.sxp
@@ -51,16 +51,19 @@
#
# (9367 pam '' /etc/xen/xen-api.key /etc/xen/xen-api.crt)