OBS User unknown 2007-12-20 15:46:41 +00:00 committed by Git OBS Bridge
parent be29349429
commit cf62e5ae4d
135 changed files with 4018 additions and 13988 deletions

View File

@ -1,24 +0,0 @@
# HG changeset patch
# User Jim Fehlig <jfehlig@novell.com>
# Date 1178858624 21600
# Node ID 29b301382bb60ce54e0ac9dc5e5163306de577ff
# Parent 3ef0510e44d04eb837ae238203251b969fc45df9
Configuration option 'localtime = 1' is not honored for PV domains.
This patch fixes an oversight when platform_* config options were collected in a dictionary.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1472,8 +1472,7 @@ class XendDomainInfo:
try:
self.image = image.create(self, self.info)
- localtime = self.info.get('platform_localtime', False)
- if localtime:
+ if self.info['platform'].get('localtime', 0):
xc.domain_set_time_offset(self.domid)
xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])

View File

@ -1,22 +0,0 @@
# HG changeset patch
# User Steven Hand <steven@xensource.com>
# Date 1179152192 -3600
# Node ID 9c2a616722da143f8abcd0eabb45159341f3cce0
# Parent 3ecf516896719b667833183a4aa87975824b931b
HVM save/restore: handle larger domain ids.
Signed-off-by: Steven Hand <steven@xensource.com>
Index: xen-3.1-testing/tools/ioemu/target-i386-dm/helper2.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/target-i386-dm/helper2.c
+++ xen-3.1-testing/tools/ioemu/target-i386-dm/helper2.c
@@ -615,7 +615,7 @@ int main_loop(void)
extern int suspend_requested;
CPUState *env = cpu_single_env;
int evtchn_fd = xc_evtchn_fd(xce_handle);
- char qemu_file[20];
+ char qemu_file[32];
buffered_io_timer = qemu_new_timer(rt_clock, handle_buffered_io,
cpu_single_env);

View File

@ -1,29 +0,0 @@
Index: 2007-04-27/tools/check/check_libvncserver
===================================================================
--- 2007-04-27.orig/tools/check/check_libvncserver 2006-12-04 08:49:57.000000000 +0100
+++ 2007-04-27/tools/check/check_libvncserver 2007-04-27 09:31:02.000000000 +0200
@@ -10,6 +10,7 @@ fi
RC=0
LIBVNCSERVER_CONFIG="$(which libvncserver-config)"
+tmpfile=$(mktemp)
if test -z ${LIBVNCSERVER_CONFIG}; then
RC=1
@@ -22,6 +23,16 @@ if test $RC -ne 0; then
echo "FAILED"
echo " *** libvncserver-config is missing. "
echo " *** Please install libvncserver."
+elif ! ld $($LIBVNCSERVER_CONFIG --libs) -o $tmpfile >/dev/null 2>&1; then
+ echo "FAILED"
+ echo " *** dependency libraries for libvncserver are missing: "
+ RC=1
+ for i in $(ld $($LIBVNCSERVER_CONFIG --libs) -o $tmpfile 2>&1 >/dev/null); do
+ case $i in
+ -l*) echo lib${i#-l}
+ esac
+ done
fi
+rm -f $tmpfile
exit $RC

View File

@ -1,114 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1179219794 -3600
# Node ID e72e94d2987cfa20d3ac6b34972d0ce639efb1fa
# Parent e1d9d2884245461576631134db46dda67994989b
tools: check for curl-devel and libxml2-devel
when they are required for LIBXENAPI_BINDINGS.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- a/tools/check/Makefile Tue May 15 10:01:14 2007 +0100
+++ b/tools/check/Makefile Tue May 15 10:03:14 2007 +0100
@@ -7,7 +7,7 @@ all: build
# Check this machine is OK for building on.
.PHONY: build
build:
- XENFB_TOOLS=$(XENFB_TOOLS) ./chk build
+ XENFB_TOOLS=$(XENFB_TOOLS) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk build
# Check this machine is OK for installing on.
# DO NOT use this check from 'make install' in the parent
@@ -15,7 +15,7 @@ build:
# copy rather than actually installing.
.PHONY: install
install:
- XENFB_TOOLS=$(XENFB_TOOLS) ./chk install
+ XENFB_TOOLS=$(XENFB_TOOLS) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk install
.PHONY: clean
clean:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/check/check_curl Tue May 15 10:03:14 2007 +0100
@@ -0,0 +1,38 @@
+#!/bin/sh
+# CHECK-BUILD CHECK-INSTALL
+
+if [ ! "$LIBXENAPI_BINDINGS" = "y" ]
+then
+ echo -n "unused, "
+ exit 0
+fi
+
+RC=0
+
+CURL_CONFIG="$(which curl-config)"
+tmpfile=$(mktemp)
+
+if test -z ${CURL_CONFIG}; then
+ RC=1
+else
+ ${CURL_CONFIG} --libs 2>&1 > /dev/null
+ RC=$?
+fi
+
+if test $RC -ne 0; then
+ echo "FAILED"
+ echo " *** curl-config is missing. "
+ echo " *** Please install curl-devel."
+elif ! ld $($CURL_CONFIG --libs) -o $tmpfile >/dev/null 2>&1; then
+ echo "FAILED"
+ echo " *** dependency libraries for curl are missing: "
+ RC=1
+ for i in $(ld $($CURL_CONFIG --libs) -o $tmpfile 2>&1 >/dev/null); do
+ case $i in
+ -l*) echo lib${i#-l}
+ esac
+ done
+fi
+rm -f $tmpfile
+
+exit $RC
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/check/check_xml2 Tue May 15 10:03:14 2007 +0100
@@ -0,0 +1,38 @@
+#!/bin/sh
+# CHECK-BUILD CHECK-INSTALL
+
+if [ ! "$LIBXENAPI_BINDINGS" = "y" ]
+then
+ echo -n "unused, "
+ exit 0
+fi
+
+RC=0
+
+XML2_CONFIG="$(which xml2-config)"
+tmpfile=$(mktemp)
+
+if test -z ${XML2_CONFIG}; then
+ RC=1
+else
+ ${XML2_CONFIG} --libs 2>&1 > /dev/null
+ RC=$?
+fi
+
+if test $RC -ne 0; then
+ echo "FAILED"
+ echo " *** xml2-config is missing. "
+ echo " *** Please install libxml2-devel."
+elif ! ld $($XML2_CONFIG --libs) -o $tmpfile >/dev/null 2>&1; then
+ echo "FAILED"
+ echo " *** dependency libraries for xml2 are missing: "
+ RC=1
+ for i in $(ld $($XML2_CONFIG --libs) -o $tmpfile 2>&1 >/dev/null); do
+ case $i in
+ -l*) echo lib${i#-l}
+ esac
+ done
+fi
+rm -f $tmpfile
+
+exit $RC

View File

@ -1,29 +0,0 @@
Index: 2007-05-14/xen/arch/x86/mm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm.c 2007-05-14 08:39:16.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm.c 2007-05-14 08:40:14.000000000 +0200
@@ -2261,7 +2261,7 @@ int do_mmu_update(
struct vcpu *v = current;
struct domain *d = v->domain;
unsigned long type_info;
- struct domain_mmap_cache mapcache, sh_mapcache;
+ struct domain_mmap_cache mapcache;
if ( unlikely(count & MMU_UPDATE_PREEMPTED) )
{
@@ -2285,7 +2285,6 @@ int do_mmu_update(
}
domain_mmap_cache_init(&mapcache);
- domain_mmap_cache_init(&sh_mapcache);
LOCK_BIGLOCK(d);
@@ -2447,7 +2446,6 @@ int do_mmu_update(
UNLOCK_BIGLOCK(d);
domain_mmap_cache_destroy(&mapcache);
- domain_mmap_cache_destroy(&sh_mapcache);
perfc_add(num_page_updates, i);

View File

@ -1,25 +0,0 @@
# HG changeset patch
# User Steven Hand <steven@xensource.com>
# Date 1179844370 -3600
# Node ID f6928d6369999cd063edd361d592579c2483196b
# Parent 98cf6c05c32a59ad3f4fcd505ca60348589e6096
This patch fixes the issue with waiting for devices to disconnect during the end
stage of migration in Xend. The problem was cause by a deletion of the VM domain
ID which is used by testDevicecompleComplete ->deviceIDs->backendRoot() to get
the virtual backend device path. The virtual backend device path is used to
check if a device still exists in xenstore.
Signed-off-by: Yung Giang <yung.giang@gmail.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1680,7 +1680,6 @@ class XendDomainInfo:
try:
if self.domid is not None:
xc.domain_destroy(self.domid)
- self.domid = None
for state in DOM_STATES_OLD:
self.info[state] = 0
self._stateSet(DOM_STATE_HALTED)

View File

@ -1,92 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1180011729 -3600
# Node ID 853853686147c4e863551b5742ca424e2929599a
# Parent 6223d154e55f6cf7144c758979e6d3364d5d436e
xend: Fix CPU affinity reset across save/restore.
Fixes bug #936.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-3.1-testing/tools/python/xen/xend/XendConfig.py
@@ -587,30 +587,46 @@ class XendConfig(dict):
else:
cfg['cpus'] = str(cfg['cpu'])
- # convert 'cpus' string to list of ints
- # 'cpus' supports a list of ranges (0-3), seperated by
- # commas, and negation, (^1).
- # Precedence is settled by order of the string:
- # "0-3,^1" -> [0,2,3]
- # "0-3,^1,1" -> [0,1,2,3]
- try:
- if 'cpus' in cfg and type(cfg['cpus']) != list:
- cpus = []
- for c in cfg['cpus'].split(','):
- if c.find('-') != -1:
- (x, y) = c.split('-')
- for i in range(int(x), int(y)+1):
- cpus.append(int(i))
- else:
- # remove this element from the list
- if c[0] == '^':
- cpus = [x for x in cpus if x != int(c[1:])]
+ # Convert 'cpus' to list of ints
+ if 'cpus' in cfg:
+ cpus = []
+ if type(cfg['cpus']) == list:
+ # If sxp_cfg was created from config.sxp,
+ # the form of 'cpus' is list of string.
+ # Convert 'cpus' to list of ints.
+ # ['1'] -> [1]
+ # ['0','2','3'] -> [0,2,3]
+ try:
+ for c in cfg['cpus']:
+ cpus.append(int(c))
+
+ cfg['cpus'] = cpus
+ except ValueError, e:
+ raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e))
+ else:
+ # Convert 'cpus' string to list of ints
+ # 'cpus' supports a list of ranges (0-3),
+ # seperated by commas, and negation, (^1).
+ # Precedence is settled by order of the
+ # string:
+ # "0-3,^1" -> [0,2,3]
+ # "0-3,^1,1" -> [0,1,2,3]
+ try:
+ for c in cfg['cpus'].split(','):
+ if c.find('-') != -1:
+ (x, y) = c.split('-')
+ for i in range(int(x), int(y)+1):
+ cpus.append(int(i))
else:
- cpus.append(int(c))
-
- cfg['cpus'] = cpus
- except ValueError, e:
- raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e))
+ # remove this element from the list
+ if c[0] == '^':
+ cpus = [x for x in cpus if x != int(c[1:])]
+ else:
+ cpus.append(int(c))
+
+ cfg['cpus'] = cpus
+ except ValueError, e:
+ raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e))
if 'security' in cfg and isinstance(cfg['security'], str):
cfg['security'] = sxp.from_string(cfg['security'])
@@ -842,6 +858,8 @@ class XendConfig(dict):
if name in self and self[name] not in (None, []):
if typ == dict:
s = self[name].items()
+ elif typ == list:
+ s = self[name]
else:
s = str(self[name])
sxpr.append([name, s])

View File

@ -1,44 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1180011958 -3600
# Node ID f07c1bb86d6c54458ff944e71453173cbf567ed2
# Parent 853853686147c4e863551b5742ca424e2929599a
xend: Tear down domain if device hotplug fails during startup
If creating an unmanaged guest (eg xm create), if device hotplug fails
during the startup of the guest, then the guest will be torn down
again. If creating and starting a managed guest (eg xm new && xm
start), then if device hotplug fails, the still born guest gets left
in 'paused' state. This confuses users no end, who go an unpause and
then get all upset when it shortly crashes (due to lack of disk or
network devices).
The attached patch fixes XenDomain.py's domain_start() method so that
if waitForDevices() fails, then the entire domain is torn down. This
is the same approach used in xm create.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomain.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomain.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomain.py
@@ -985,10 +985,16 @@ class XendDomain:
dominfo.start(is_managed = True)
finally:
self.domains_lock.release()
- dominfo.waitForDevices()
+
+ try:
+ dominfo.waitForDevices()
+ except Exception, ex:
+ log.warn("Failed to setup devices for " + str(dominfo) + ": " + str(ex))
+ dominfo.destroy()
+ raise
+
if not start_paused:
dominfo.unpause()
-
def domain_delete(self, domid):
"""Remove a managed domain from database

View File

@ -1,104 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1180016489 -3600
# Node ID 3ef4a4d8213061fe14d905e89594c99d0b9cb605
# Parent 6a4af9502b4da269388a60416a7cca0ecadb3bb3
xend: Fix for removing devices at save/destroy domain.
The function XendDomainInfo:_releaseDevices() is called during the
save/destroy phase of a domain. It made some attempt to clean up the
devices, but wasn't complete, leaving dangling devices in the
xenstore. Not a big problem with normal use of Xen, but a buildup over
a large number of save/destroy instances, it would make the xenstore
database grow quite large, which in turn meant swap-thrashing in Dom0.
This patch makes use of the destroyDevices() function in
XendDomainInfo. This function needed some re-writing to make it work
correctly - I think it had some old code (not sure how old, as xm
annotate says that it's changeset 12071, but that, I think, is when it
was split out from XendDomain.py, rather than when it was created).
I have tested this over a few hundred save/restore cycles [two domains
constantly saved/restored with a short sleep to let them process some
work] combined with a loop of "xenstore-ls|wc". The output of the
latter is pretty much constant (it obviously varies a bit depending on
when in the save/restore cycle it hits). Previously, it would increase
by some 10 lines or so per save/restore cycle.
Signed-off-by: Mats Petersson <mats.petersson@amd.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -544,20 +544,30 @@ class XendDomainInfo:
self.getDeviceController(devclass).waitForDevices()
def destroyDevice(self, deviceClass, devid, force = False):
+ found = True # Assume devid is an integer.
try:
devid = int(devid)
except ValueError:
# devid is not a number, let's search for it in xenstore.
devicePath = '%s/device/%s' % (self.dompath, deviceClass)
+ found = False
for entry in xstransact.List(devicePath):
+ log.debug("Attempting to find devid at %s/%s", devicePath, entry)
backend = xstransact.Read('%s/%s' % (devicePath, entry),
"backend")
- devName = xstransact.Read(backend, "dev")
- if devName == devid:
- # We found the integer matching our devid, use it instead
- devid = entry
- break
-
+ if backend != None:
+ devName = '%s/%s' % (deviceClass, entry)
+ log.debug("devName=%s", devName)
+ if devName == devid:
+ # We found the integer matching our devid, use it instead
+ devid = int(entry)
+ found = True
+ break
+
+ if not found:
+ log.debug("Could not find the device %s", devid)
+ return None
+ log.debug("devid = %s", devid)
return self.getDeviceController(deviceClass).destroyDevice(devid, force)
def getDeviceSxprs(self, deviceClass):
@@ -1330,20 +1340,19 @@ class XendDomainInfo:
self.image.destroy(suspend)
return
- while True:
- t = xstransact("%s/device" % self.dompath)
- for devclass in XendDevices.valid_devices():
- for dev in t.list(devclass):
- try:
- t.remove(dev)
- except:
- # Log and swallow any exceptions in removal --
- # there's nothing more we can do.
- log.exception(
- "Device release failed: %s; %s; %s",
- self.info['name_label'], devclass, dev)
- if t.commit():
- break
+ t = xstransact("%s/device" % self.dompath)
+ for devclass in XendDevices.valid_devices():
+ for dev in t.list(devclass):
+ try:
+ log.debug("Removing %s", dev);
+ self.destroyDevice(devclass, dev, False);
+ except:
+ # Log and swallow any exceptions in removal --
+ # there's nothing more we can do.
+ log.exception("Device release failed: %s; %s; %s",
+ self.info['name_label'], devclass, dev)
+
+
def getDeviceController(self, name):
"""Get the device controller for this domain, and if it

View File

@ -1,21 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1180086787 -3600
# Node ID a717cb2fac908ba82619ba52e34a2cc77942df4f
# Parent 9073caff4b63490bc63bbe2b0b48fd06cc47d6c6
xend: Fix checkname so that it detects duplicate domains.
Signed-off-by: Mats Petersson <mats.petersson@amd.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2069,7 +2069,7 @@ class XendDomainInfo:
raise VmError('Invalid VM Name')
dom = XendDomain.instance().domain_lookup_nr(name)
- if dom and dom.info['uuid'] != self.info['uuid']:
+ if dom and dom.domid != self.domid:
raise VmError("VM name '%s' already exists%s" %
(name,
dom.domid is not None and

View File

@ -1,31 +0,0 @@
# HG changeset 15173 patch
# User Ian Campbell <ian.campbell@xensource.com>
# Node ID 88e41a91301c109b99443db3a4bf3c8e6bbad042
# Parent f2d2d5f18543de04191c1f5e22471e74d8767147
Correct 32on64 handling of VCPUOP_register_runstate_memory_area. We
were copying too many bytes from the guest so the test for
area.addr.h.c != area.addr.p was failing.
Added a WARN_ON to the kernel to catch this case. It would be a BUG_ON
but this would break the new kernel on older hypervisors and the only
real problem is that stolen time is not updated, which we can live
with.
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Index: 2007-05-14/xen/arch/x86/x86_64/domain.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_64/domain.c 2007-04-23 10:01:42.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_64/domain.c 2007-07-02 10:47:40.000000000 +0200
@@ -22,8 +22,10 @@ arch_compat_vcpu_op(
struct compat_vcpu_register_runstate_memory_area area;
struct compat_vcpu_runstate_info info;
+ area.addr.p = 0;
+
rc = -EFAULT;
- if ( copy_from_guest(&area, arg, 1) )
+ if ( copy_from_guest(&area.addr.h, arg, 1) )
break;
if ( area.addr.h.c != area.addr.p ||

View File

@ -1,82 +0,0 @@
# HG changeset 15183 patch
# User Ian Campbell <ian.campbell@xensource.com>
# Node ID 63211a8027fa994290e23be17f4de9ba3b3e953e
# Parent c4f62fe631e4a5f7ff20ec7bab0a81cd97a14974
Fix preemption of multicalls in compat mode.
mcs->call (struct multicall_entry) always needs to be translated into
mcs->compat_call (struct compat_multicall_entry) when a multicall is
preempted in compat mode. Previously this translation only occured for
those hypercalls which explicitly called hypercall_xlat_continuation()
which doesn't cover all hypercalls which could potentially be
preempted.
Change hypercall_xlat_continuation() to only translate only the
hypercall arguments themselves and not the multicall_entry
layout. Translate the layout for all hypercalls in in
compat_multicall() instead.
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Index: 2007-05-14/xen/arch/x86/domain.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/domain.c 2007-07-02 10:38:54.000000000 +0200
+++ 2007-05-14/xen/arch/x86/domain.c 2007-07-02 10:47:47.000000000 +0200
@@ -1341,13 +1341,12 @@ int hypercall_xlat_continuation(unsigned
id = NULL;
}
if ( (mask & 1) && mcs->call.args[i] == nval )
- ++rc;
- else
{
- cval = mcs->call.args[i];
- BUG_ON(mcs->call.args[i] != cval);
+ mcs->call.args[i] = cval;
+ ++rc;
}
- mcs->compat_call.args[i] = cval;
+ else
+ BUG_ON(mcs->call.args[i] != (unsigned int)mcs->call.args[i]);
}
}
else
Index: 2007-05-14/xen/common/compat/multicall.c
===================================================================
--- 2007-05-14.orig/xen/common/compat/multicall.c 2007-04-23 10:01:43.000000000 +0200
+++ 2007-05-14/xen/common/compat/multicall.c 2007-07-02 10:47:47.000000000 +0200
@@ -10,6 +10,13 @@
typedef int ret_t;
#undef do_multicall_call
+static inline void xlat_multicall_entry(struct mc_state *mcs)
+{
+ int i;
+ for (i=0; i<6; i++)
+ mcs->compat_call.args[i] = mcs->call.args[i];
+}
+
DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t);
#define multicall_entry compat_multicall_entry
#define multicall_entry_t multicall_entry_compat_t
Index: 2007-05-14/xen/common/multicall.c
===================================================================
--- 2007-05-14.orig/xen/common/multicall.c 2007-04-23 10:01:43.000000000 +0200
+++ 2007-05-14/xen/common/multicall.c 2007-07-02 10:47:47.000000000 +0200
@@ -17,6 +17,7 @@
#ifndef COMPAT
DEFINE_PER_CPU(struct mc_state, mc_state);
typedef long ret_t;
+#define xlat_multicall_entry(mcs)
#endif
ret_t
@@ -62,6 +63,9 @@ do_multicall(
if ( test_bit(_MCSF_call_preempted, &mcs->flags) )
{
+ /* Translate sub-call continuation to guest layout */
+ xlat_multicall_entry(mcs);
+
/* Copy the sub-call continuation. */
(void)__copy_to_guest(call_list, &mcs->call, 1);
goto preempted;

View File

@ -1,468 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1180540108 -3600
# Node ID 1f8fb764f843552eb4d20e9cb7b67fd8738006d7
# Parent 1f1d1b43951eb14eff8c71884b7421da2484af3c
Add VMX memory-mapped Local APIC access optimization.
Some operating systems access the local APIC TPR very frequently, and
we handle that using software-based local APIC virtualization in Xen
today. Such virtualization incurs a number of VM exits from the
memory-access instructions against the APIC page in the guest.
The attached patch enables the TPR shadow feature that provides APIC
TPR virtualization in hardware. Our tests indicate it can
significantly boost the performance of such guests including 32-bit
Windows XP/2003.
Moreover, with the patch, local APIC accesses other than TPR in guests
are intercepted directly as APIC_ACCESS VM exits rather than
PAGE_FAULT VM exits; this can lower the emulation cost of such
accesses.
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
Index: xen-3.1-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-3.1-testing/xen/arch/x86/hvm/hvm.c
@@ -226,6 +226,7 @@ int hvm_domain_initialise(struct domain
spin_lock_init(&d->arch.hvm_domain.pbuf_lock);
spin_lock_init(&d->arch.hvm_domain.irq_lock);
+ spin_lock_init(&d->arch.hvm_domain.vapic_access_lock);
rc = paging_enable(d, PG_refcounts|PG_translate|PG_external);
if ( rc != 0 )
Index: xen-3.1-testing/xen/arch/x86/hvm/vlapic.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/vlapic.c
+++ xen-3.1-testing/xen/arch/x86/hvm/vlapic.c
@@ -79,8 +79,6 @@ static unsigned int vlapic_lvt_mask[VLAP
#define vlapic_lvtt_period(vlapic) \
(vlapic_get_reg(vlapic, APIC_LVTT) & APIC_LVT_TIMER_PERIODIC)
-#define vlapic_base_address(vlapic) \
- (vlapic->hw.apic_base_msr & MSR_IA32_APICBASE_BASE)
/*
* Generic APIC bitmap vector update & search routines.
Index: xen-3.1-testing/xen/arch/x86/hvm/vmx/intr.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/vmx/intr.c
+++ xen-3.1-testing/xen/arch/x86/hvm/vmx/intr.c
@@ -67,7 +67,6 @@ static inline int is_interruptibility_st
return __vmread(GUEST_INTERRUPTIBILITY_INFO);
}
-#ifdef __x86_64__
static void update_tpr_threshold(struct vlapic *vlapic)
{
int max_irr, tpr;
@@ -75,6 +74,11 @@ static void update_tpr_threshold(struct
if ( !cpu_has_vmx_tpr_shadow )
return;
+#ifdef __i386__
+ if ( !vlapic->mmap_vtpr_enabled )
+ return;
+#endif
+
if ( !vlapic_enabled(vlapic) ||
((max_irr = vlapic_find_highest_irr(vlapic)) == -1) )
{
@@ -85,9 +89,6 @@ static void update_tpr_threshold(struct
tpr = vlapic_get_reg(vlapic, APIC_TASKPRI) & 0xF0;
__vmwrite(TPR_THRESHOLD, (max_irr > tpr) ? (tpr >> 4) : (max_irr >> 4));
}
-#else
-#define update_tpr_threshold(v) ((void)0)
-#endif
asmlinkage void vmx_intr_assist(void)
{
Index: xen-3.1-testing/xen/arch/x86/hvm/vmx/vmcs.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/vmx/vmcs.c
+++ xen-3.1-testing/xen/arch/x86/hvm/vmx/vmcs.c
@@ -40,6 +40,7 @@
/* Dynamic (run-time adjusted) execution control flags. */
u32 vmx_pin_based_exec_control __read_mostly;
u32 vmx_cpu_based_exec_control __read_mostly;
+u32 vmx_secondary_exec_control __read_mostly;
u32 vmx_vmexit_control __read_mostly;
u32 vmx_vmentry_control __read_mostly;
@@ -60,11 +61,15 @@ static u32 adjust_vmx_controls(u32 ctl_m
return ctl;
}
+#define vmx_has_secondary_exec_ctls \
+ (_vmx_cpu_based_exec_control & ACTIVATE_SECONDARY_CONTROLS)
+
void vmx_init_vmcs_config(void)
{
u32 vmx_msr_low, vmx_msr_high, min, opt;
u32 _vmx_pin_based_exec_control;
u32 _vmx_cpu_based_exec_control;
+ u32 _vmx_secondary_exec_control = 0;
u32 _vmx_vmexit_control;
u32 _vmx_vmentry_control;
@@ -80,9 +85,8 @@ void vmx_init_vmcs_config(void)
CPU_BASED_ACTIVATE_IO_BITMAP |
CPU_BASED_USE_TSC_OFFSETING);
opt = CPU_BASED_ACTIVATE_MSR_BITMAP;
-#ifdef __x86_64__
opt |= CPU_BASED_TPR_SHADOW;
-#endif
+ opt |= ACTIVATE_SECONDARY_CONTROLS;
_vmx_cpu_based_exec_control = adjust_vmx_controls(
min, opt, MSR_IA32_VMX_PROCBASED_CTLS_MSR);
#ifdef __x86_64__
@@ -92,8 +96,19 @@ void vmx_init_vmcs_config(void)
_vmx_cpu_based_exec_control = adjust_vmx_controls(
min, opt, MSR_IA32_VMX_PROCBASED_CTLS_MSR);
}
+#elif defined(__i386__)
+ if ( !vmx_has_secondary_exec_ctls )
+ _vmx_cpu_based_exec_control &= ~CPU_BASED_TPR_SHADOW;
#endif
+ if ( vmx_has_secondary_exec_ctls )
+ {
+ min = 0;
+ opt = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
+ _vmx_secondary_exec_control = adjust_vmx_controls(
+ min, opt, MSR_IA32_VMX_PROCBASED_CTLS2);
+ }
+
min = VM_EXIT_ACK_INTR_ON_EXIT;
opt = 0;
#ifdef __x86_64__
@@ -113,6 +128,8 @@ void vmx_init_vmcs_config(void)
vmcs_revision_id = vmx_msr_low;
vmx_pin_based_exec_control = _vmx_pin_based_exec_control;
vmx_cpu_based_exec_control = _vmx_cpu_based_exec_control;
+ if ( vmx_has_secondary_exec_ctls )
+ vmx_secondary_exec_control = _vmx_secondary_exec_control;
vmx_vmexit_control = _vmx_vmexit_control;
vmx_vmentry_control = _vmx_vmentry_control;
}
@@ -121,6 +138,8 @@ void vmx_init_vmcs_config(void)
BUG_ON(vmcs_revision_id != vmx_msr_low);
BUG_ON(vmx_pin_based_exec_control != _vmx_pin_based_exec_control);
BUG_ON(vmx_cpu_based_exec_control != _vmx_cpu_based_exec_control);
+ if ( vmx_has_secondary_exec_ctls )
+ BUG_ON(vmx_secondary_exec_control != _vmx_secondary_exec_control);
BUG_ON(vmx_vmexit_control != _vmx_vmexit_control);
BUG_ON(vmx_vmentry_control != _vmx_vmentry_control);
}
@@ -296,6 +315,8 @@ static void construct_vmcs(struct vcpu *
__vmwrite(VM_ENTRY_CONTROLS, vmx_vmentry_control);
__vmwrite(CPU_BASED_VM_EXEC_CONTROL, vmx_cpu_based_exec_control);
v->arch.hvm_vcpu.u.vmx.exec_control = vmx_cpu_based_exec_control;
+ if ( vmx_cpu_based_exec_control & ACTIVATE_SECONDARY_CONTROLS )
+ __vmwrite(SECONDARY_VM_EXEC_CONTROL, vmx_secondary_exec_control);
if ( cpu_has_vmx_msr_bitmap )
__vmwrite(MSR_BITMAP, virt_to_maddr(vmx_msr_bitmap));
@@ -422,7 +443,7 @@ static void construct_vmcs(struct vcpu *
__vmwrite(CR4_READ_SHADOW, v->arch.hvm_vmx.cpu_shadow_cr4);
#ifdef __x86_64__
- /* VLAPIC TPR optimisation. */
+ /* CR8 based VLAPIC TPR optimization. */
if ( cpu_has_vmx_tpr_shadow )
{
__vmwrite(VIRTUAL_APIC_PAGE_ADDR,
@@ -431,6 +452,16 @@ static void construct_vmcs(struct vcpu *
}
#endif
+ /* Memory-mapped based VLAPIC TPR optimization. */
+ if ( cpu_has_vmx_mmap_vtpr_optimization )
+ {
+ __vmwrite(VIRTUAL_APIC_PAGE_ADDR,
+ page_to_maddr(vcpu_vlapic(v)->regs_page));
+ __vmwrite(TPR_THRESHOLD, 0);
+
+ vcpu_vlapic(v)->mmap_vtpr_enabled = 1;
+ }
+
__vmwrite(GUEST_LDTR_SELECTOR, 0);
__vmwrite(GUEST_LDTR_BASE, 0);
__vmwrite(GUEST_LDTR_LIMIT, 0);
@@ -501,6 +532,18 @@ void vmx_do_resume(struct vcpu *v)
vmx_set_host_env(v);
}
+ if ( !v->arch.hvm_vmx.launched && vcpu_vlapic(v)->mmap_vtpr_enabled )
+ {
+ struct page_info *pg = change_guest_physmap_for_vtpr(v->domain, 1);
+
+ if ( pg == NULL )
+ {
+ gdprintk(XENLOG_ERR, "change_guest_physmap_for_vtpr failed!\n");
+ domain_crash_synchronous();
+ }
+ __vmwrite(APIC_ACCESS_ADDR, page_to_maddr(pg));
+ }
+
debug_state = v->domain->debugger_attached;
if ( unlikely(v->arch.hvm_vcpu.debug_state_latch != debug_state) )
{
Index: xen-3.1-testing/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/vmx/vmx.c
+++ xen-3.1-testing/xen/arch/x86/hvm/vmx/vmx.c
@@ -2416,6 +2416,114 @@ done:
return 1;
}
+struct page_info * change_guest_physmap_for_vtpr(struct domain *d,
+ int enable_vtpr)
+{
+ struct page_info *pg;
+ unsigned long pfn, mfn;
+
+ spin_lock(&d->arch.hvm_domain.vapic_access_lock);
+
+ pg = d->arch.hvm_domain.apic_access_page;
+ pfn = paddr_to_pfn(APIC_DEFAULT_PHYS_BASE);
+
+ if ( enable_vtpr )
+ {
+ if ( d->arch.hvm_domain.physmap_changed_for_vlapic_access )
+ goto out;
+
+ if ( pg == NULL )
+ pg = alloc_domheap_page(d);
+ if ( pg == NULL )
+ {
+ gdprintk(XENLOG_ERR, "alloc_domheap_pages() failed!\n");
+ goto out;
+ }
+
+ mfn = page_to_mfn(pg);
+ d->arch.hvm_domain.apic_access_page = pg;
+
+ guest_physmap_add_page(d, pfn, mfn);
+
+ d->arch.hvm_domain.physmap_changed_for_vlapic_access = 1;
+
+ goto out;
+ }
+ else
+ {
+ if ( d->arch.hvm_domain.physmap_changed_for_vlapic_access )
+ {
+ mfn = page_to_mfn(pg);
+ guest_physmap_remove_page(d, pfn, mfn);
+ flush_tlb_mask(d->domain_dirty_cpumask);
+
+ d->arch.hvm_domain.physmap_changed_for_vlapic_access = 0;
+ }
+ pg = NULL;
+ goto out;
+ }
+
+out:
+ spin_unlock(&d->arch.hvm_domain.vapic_access_lock);
+ return pg;
+}
+
+static void check_vlapic_msr_for_vtpr(struct vcpu *v)
+{
+ struct vlapic *vlapic = vcpu_vlapic(v);
+ int mmap_vtpr_enabled = vcpu_vlapic(v)->mmap_vtpr_enabled;
+ uint32_t tmp;
+
+
+ if ( vlapic_hw_disabled(vlapic) && mmap_vtpr_enabled )
+ {
+ vcpu_vlapic(v)->mmap_vtpr_enabled = 0;
+
+#ifdef __i386__
+ v->arch.hvm_vcpu.u.vmx.exec_control &= ~CPU_BASED_TPR_SHADOW;
+ __vmwrite(CPU_BASED_VM_EXEC_CONTROL,
+ v->arch.hvm_vcpu.u.vmx.exec_control);
+#elif defined(__x86_64__)
+ if ( !cpu_has_vmx_tpr_shadow )
+ {
+ v->arch.hvm_vcpu.u.vmx.exec_control &= ~CPU_BASED_TPR_SHADOW;
+ __vmwrite(CPU_BASED_VM_EXEC_CONTROL,
+ v->arch.hvm_vcpu.u.vmx.exec_control);
+ }
+#endif
+ tmp = __vmread(SECONDARY_VM_EXEC_CONTROL);
+ tmp &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
+ __vmwrite(SECONDARY_VM_EXEC_CONTROL, tmp);
+
+ change_guest_physmap_for_vtpr(v->domain, 0);
+ }
+ else if ( !vlapic_hw_disabled(vlapic) && !mmap_vtpr_enabled &&
+ cpu_has_vmx_mmap_vtpr_optimization )
+ {
+ vcpu_vlapic(v)->mmap_vtpr_enabled = 1;
+
+ v->arch.hvm_vcpu.u.vmx.exec_control |=
+ ( ACTIVATE_SECONDARY_CONTROLS | CPU_BASED_TPR_SHADOW );
+ __vmwrite(CPU_BASED_VM_EXEC_CONTROL,
+ v->arch.hvm_vcpu.u.vmx.exec_control);
+ tmp = __vmread(SECONDARY_VM_EXEC_CONTROL);
+ tmp |= SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
+ __vmwrite(SECONDARY_VM_EXEC_CONTROL, tmp);
+
+ change_guest_physmap_for_vtpr(v->domain, 1);
+ }
+
+ if ( vcpu_vlapic(v)->mmap_vtpr_enabled &&
+ !vlapic_hw_disabled(vlapic) &&
+ (vlapic_base_address(vlapic) != APIC_DEFAULT_PHYS_BASE) )
+ {
+ gdprintk(XENLOG_ERR,
+ "Local APIC base address is set to 0x%016"PRIx64"!\n",
+ vlapic_base_address(vlapic));
+ domain_crash_synchronous();
+ }
+}
+
static inline int vmx_do_msr_write(struct cpu_user_regs *regs)
{
u32 ecx = regs->ecx;
@@ -2444,6 +2552,7 @@ static inline int vmx_do_msr_write(struc
break;
case MSR_IA32_APICBASE:
vlapic_msr_set(vcpu_vlapic(v), msr_content);
+ check_vlapic_msr_for_vtpr(v);
break;
default:
if ( !long_mode_do_msr_write(regs) )
@@ -2756,6 +2865,15 @@ asmlinkage void vmx_vmexit_handler(struc
case EXIT_REASON_TPR_BELOW_THRESHOLD:
break;
+ case EXIT_REASON_APIC_ACCESS:
+ {
+ unsigned long offset;
+
+ exit_qualification = __vmread(EXIT_QUALIFICATION);
+ offset = exit_qualification & 0x0fffUL;
+ handle_mmio(APIC_DEFAULT_PHYS_BASE | offset);
+ break;
+ }
default:
exit_and_crash:
Index: xen-3.1-testing/xen/include/asm-x86/hvm/domain.h
===================================================================
--- xen-3.1-testing.orig/xen/include/asm-x86/hvm/domain.h
+++ xen-3.1-testing/xen/include/asm-x86/hvm/domain.h
@@ -41,6 +41,11 @@ struct hvm_domain {
s64 tsc_frequency;
struct pl_time pl_time;
+ /* For memory-mapped vLAPIC/vTPR access optimization */
+ spinlock_t vapic_access_lock;
+ int physmap_changed_for_vlapic_access : 1;
+ struct page_info *apic_access_page;
+
struct hvm_io_handler io_handler;
/* Lock protects access to irq, vpic and vioapic. */
Index: xen-3.1-testing/xen/include/asm-x86/hvm/vlapic.h
===================================================================
--- xen-3.1-testing.orig/xen/include/asm-x86/hvm/vlapic.h
+++ xen-3.1-testing/xen/include/asm-x86/hvm/vlapic.h
@@ -49,12 +49,17 @@
#define vlapic_disabled(vlapic) ((vlapic)->hw.disabled)
#define vlapic_enabled(vlapic) (!vlapic_disabled(vlapic))
+#define vlapic_base_address(vlapic) \
+ (vlapic->hw.apic_base_msr & MSR_IA32_APICBASE_BASE)
+
struct vlapic {
struct hvm_hw_lapic hw;
struct hvm_hw_lapic_regs *regs;
struct periodic_time pt;
s_time_t timer_last_update;
struct page_info *regs_page;
+
+ int mmap_vtpr_enabled : 1;
};
static inline uint32_t vlapic_get_reg(struct vlapic *vlapic, uint32_t reg)
Index: xen-3.1-testing/xen/include/asm-x86/hvm/vmx/vmcs.h
===================================================================
--- xen-3.1-testing.orig/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ xen-3.1-testing/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -104,6 +104,7 @@ void vmx_vmcs_exit(struct vcpu *v);
#define CPU_BASED_ACTIVATE_MSR_BITMAP 0x10000000
#define CPU_BASED_MONITOR_EXITING 0x20000000
#define CPU_BASED_PAUSE_EXITING 0x40000000
+#define ACTIVATE_SECONDARY_CONTROLS 0x80000000
extern u32 vmx_cpu_based_exec_control;
#define PIN_BASED_EXT_INTR_MASK 0x00000001
@@ -119,8 +120,16 @@ extern u32 vmx_vmexit_control;
#define VM_ENTRY_DEACT_DUAL_MONITOR 0x00000800
extern u32 vmx_vmentry_control;
+#define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001
+extern u32 vmx_secondary_exec_control;
+
+#define cpu_has_vmx_virtualize_apic_accesses \
+ (vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
#define cpu_has_vmx_tpr_shadow \
(vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)
+#define cpu_has_vmx_mmap_vtpr_optimization \
+ (cpu_has_vmx_virtualize_apic_accesses && cpu_has_vmx_tpr_shadow)
+
#define cpu_has_vmx_msr_bitmap \
(vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
extern char *vmx_msr_bitmap;
@@ -158,6 +167,8 @@ enum vmcs_field {
TSC_OFFSET_HIGH = 0x00002011,
VIRTUAL_APIC_PAGE_ADDR = 0x00002012,
VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013,
+ APIC_ACCESS_ADDR = 0x00002014,
+ APIC_ACCESS_ADDR_HIGH = 0x00002015,
VMCS_LINK_POINTER = 0x00002800,
VMCS_LINK_POINTER_HIGH = 0x00002801,
GUEST_IA32_DEBUGCTL = 0x00002802,
Index: xen-3.1-testing/xen/include/asm-x86/hvm/vmx/vmx.h
===================================================================
--- xen-3.1-testing.orig/xen/include/asm-x86/hvm/vmx/vmx.h
+++ xen-3.1-testing/xen/include/asm-x86/hvm/vmx/vmx.h
@@ -33,6 +33,9 @@ void vmx_intr_assist(void);
void vmx_do_resume(struct vcpu *);
void set_guest_time(struct vcpu *v, u64 gtime);
+extern struct page_info *change_guest_physmap_for_vtpr(struct domain *d,
+ int enable_vtpr);
+
/*
* Exit Reasons
*/
@@ -81,6 +84,7 @@ void set_guest_time(struct vcpu *v, u64
#define EXIT_REASON_MACHINE_CHECK 41
#define EXIT_REASON_TPR_BELOW_THRESHOLD 43
+#define EXIT_REASON_APIC_ACCESS 44
/*
* Interruption-information format
Index: xen-3.1-testing/xen/include/asm-x86/msr.h
===================================================================
--- xen-3.1-testing.orig/xen/include/asm-x86/msr.h
+++ xen-3.1-testing/xen/include/asm-x86/msr.h
@@ -116,6 +116,7 @@ static inline void wrmsrl(unsigned int m
#define MSR_IA32_VMX_CR0_FIXED1 0x487
#define MSR_IA32_VMX_CR4_FIXED0 0x488
#define MSR_IA32_VMX_CR4_FIXED1 0x489
+#define MSR_IA32_VMX_PROCBASED_CTLS2 0x48b
#define IA32_FEATURE_CONTROL_MSR 0x3a
#define IA32_FEATURE_CONTROL_MSR_LOCK 0x1
#define IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON 0x4

View File

@ -1,93 +0,0 @@
# HG changeset 15189 patch
# User kfraser@localhost.localdomain
# Node ID 2d7d33ac982a0720408d841b13c3b97a2190eae4
# Parent ae073ca6eb76f75a73063ba6e0f944b47b8f8954
Add support for ACPI PM Timer as platform clock source.
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: 2007-05-14/xen/arch/x86/time.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/time.c 2007-04-23 10:01:42.000000000 +0200
+++ 2007-05-14/xen/arch/x86/time.c 2007-07-02 10:47:59.000000000 +0200
@@ -511,6 +511,60 @@ static int init_cyclone(void)
}
/************************************************************
+ * PLATFORM TIMER 4: ACPI PM TIMER
+ */
+
+u32 pmtmr_ioport;
+
+/* Protected by platform_timer_lock. */
+static u64 pmtimer_counter64;
+static u32 pmtimer_stamp;
+static struct timer pmtimer_overflow_timer;
+
+/* ACPI PM timer ticks at 3.579545 MHz. */
+#define ACPI_PM_FREQUENCY 3579545
+
+/* Deltas are 24-bit unsigned values, as counter may be only 24 bits wide. */
+#define pmtimer_delta(c) ((u32)(((c) - pmtimer_stamp) & ((1U<<24)-1)))
+
+static void pmtimer_overflow(void *unused)
+{
+ u32 counter;
+
+ spin_lock_irq(&platform_timer_lock);
+ counter = inl(pmtmr_ioport);
+ pmtimer_counter64 += pmtimer_delta(counter);
+ pmtimer_stamp = counter;
+ spin_unlock_irq(&platform_timer_lock);
+
+ /* Trigger overflow avoidance roughly when counter increments 2^23. */
+ set_timer(&pmtimer_overflow_timer, NOW() + MILLISECS(2000));
+}
+
+static u64 read_pmtimer_count(void)
+{
+ return pmtimer_counter64 + pmtimer_delta(inl(pmtmr_ioport));
+}
+
+static int init_pmtimer(void)
+{
+ if ( pmtmr_ioport == 0 )
+ return 0;
+
+ read_platform_count = read_pmtimer_count;
+
+ init_timer(&pmtimer_overflow_timer, pmtimer_overflow, NULL, 0);
+ pmtimer_overflow(NULL);
+ platform_timer_stamp = pmtimer_counter64;
+ set_time_scale(&platform_timer_scale, ACPI_PM_FREQUENCY);
+
+ printk("Platform timer is %s ACPI PM Timer\n",
+ freq_string(ACPI_PM_FREQUENCY));
+
+ return 1;
+}
+
+/************************************************************
* GENERIC PLATFORM TIMER INFRASTRUCTURE
*/
@@ -549,7 +603,7 @@ static void platform_time_calibration(vo
static void init_platform_timer(void)
{
- if ( !init_cyclone() && !init_hpet() )
+ if ( !init_cyclone() && !init_hpet() && !init_pmtimer() )
init_pit();
}
Index: 2007-05-14/xen/include/asm-x86/config.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/config.h 2007-04-23 10:01:46.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/config.h 2007-07-02 10:47:59.000000000 +0200
@@ -22,6 +22,7 @@
#define CONFIG_X86_LOCAL_APIC 1
#define CONFIG_X86_GOOD_APIC 1
#define CONFIG_X86_IO_APIC 1
+#define CONFIG_X86_PM_TIMER 1
#define CONFIG_HPET_TIMER 1
#define CONFIG_X86_MCE_P4THERMAL 1
#define CONFIG_ACPI_NUMA 1

View File

@ -1,74 +0,0 @@
# HG changeset 15190 patch
# User kfraser@localhost.localdomain
# Node ID c9d66baad22b6f4cfd644b1272a8506372bb2947
# Parent 2d7d33ac982a0720408d841b13c3b97a2190eae4
Remove 'hpet_force' option. Replace with 'clocksource' option to allow
forced selection of platform clocksource, overriding the default
priority ordering.
Usage: clocksource={pit,hpet,cyclone,acpi}
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: 2007-05-14/xen/arch/x86/time.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/time.c 2007-07-02 10:47:59.000000000 +0200
+++ 2007-05-14/xen/arch/x86/time.c 2007-07-02 10:48:03.000000000 +0200
@@ -31,10 +31,9 @@
#include <asm/hpet.h>
#include <io_ports.h>
-/* opt_hpet_force: If true, force HPET configuration via PCI space. */
-/* NB. This is a gross hack. Mainly useful for HPET testing. */
-static int opt_hpet_force = 0;
-boolean_param("hpet_force", opt_hpet_force);
+/* opt_clocksource: Force clocksource to one of: pit, hpet, cyclone, acpi. */
+static char opt_clocksource[10];
+string_param("clocksource", opt_clocksource);
#define EPOCH MILLISECS(1000)
@@ -357,15 +356,6 @@ static int init_hpet(void)
u32 hpet_id, hpet_period, cfg;
int i;
- if ( (hpet_address == 0) && opt_hpet_force )
- {
- outl(0x800038a0, 0xcf8);
- outl(0xff000001, 0xcfc);
- outl(0x800038a0, 0xcf8);
- hpet_address = inl(0xcfc) & 0xfffffffe;
- printk("WARNING: Forcibly enabled HPET at %#lx.\n", hpet_address);
- }
-
if ( hpet_address == 0 )
return 0;
@@ -603,6 +593,27 @@ static void platform_time_calibration(vo
static void init_platform_timer(void)
{
+ if ( opt_clocksource[0] != '\0' )
+ {
+ int rc = -1;
+
+ if ( !strcmp(opt_clocksource, "pit") )
+ rc = (init_pit(), 1);
+ else if ( !strcmp(opt_clocksource, "hpet") )
+ rc = init_hpet();
+ else if ( !strcmp(opt_clocksource, "cyclone") )
+ rc = init_cyclone();
+ else if ( !strcmp(opt_clocksource, "acpi") )
+ rc = init_pmtimer();
+
+ if ( rc == 1 )
+ return;
+
+ printk("WARNING: %s clocksource '%s'.\n",
+ (rc == 0) ? "Could not initialise" : "Unrecognised",
+ opt_clocksource);
+ }
+
if ( !init_cyclone() && !init_hpet() && !init_pmtimer() )
init_pit();
}

View File

@ -1,13 +0,0 @@
Index: xen-3.1-testing/tools/console/daemon/utils.c
===================================================================
--- xen-3.1-testing.orig/tools/console/daemon/utils.c
+++ xen-3.1-testing/tools/console/daemon/utils.c
@@ -86,7 +86,7 @@ void daemonize(const char *pidfile)
if (chdir("/") < 0)
exit (1);
- fd = open(pidfile, O_RDWR | O_CREAT);
+ fd = open(pidfile, O_RDWR | O_CREAT, S_IRUSR|S_IWUSR);
if (fd == -1) {
exit(1);
}

View File

@ -1,31 +0,0 @@
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xensource.com>
# Date 1180973352 -3600
# Node ID 7a16a499152ce67fb36b4e101b7d2d953d1f6362
# Parent 6f13c3be08fa4c044868144672783f7b1341999a
[HVM] Save/restore: trigger FPU state save based on v->fpu_initialised
and not on the i387_valid flag, which has no meaning in this context.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
Index: xen-3.1-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-3.1-testing/xen/arch/x86/hvm/hvm.c
@@ -272,7 +272,7 @@ static int hvm_save_cpu_ctxt(struct doma
/* Other vcpu register state */
vc = &v->arch.guest_context;
- if ( vc->flags & VGCF_i387_valid )
+ if ( v->fpu_initialised )
memcpy(ctxt.fpu_regs, &vc->fpu_ctxt, sizeof(ctxt.fpu_regs));
else
memset(ctxt.fpu_regs, 0, sizeof(ctxt.fpu_regs));
@@ -364,7 +364,7 @@ static int hvm_load_cpu_ctxt(struct doma
vc->debugreg[6] = ctxt.dr6;
vc->debugreg[7] = ctxt.dr7;
- vc->flags = VGCF_i387_valid | VGCF_online;
+ vc->flags = VGCF_online;
v->fpu_initialised = 1;
/* Auxiliary processors should be woken immediately. */

View File

@ -1,74 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1181157846 -3600
# Node ID 677731eb734d8d7afa37a2e31ca2ed85fbebc2a5
# Parent f5a71c9771a81f220926ac11e4c9a2a27530c20a
[HVM] Prevent usb driver crashes in Windows
Use atomic updates to read/write usb controller data.
This can be done because:
a) word copies on x86 are atomic
b) The USB spec requires word alignment
This will need to be enhanced once USB 1.2 is supported.
Signed-off-by: Steve Ofsthun <sofsthun@virtualiron.com>
Update to copy 'longword'-sized atoms.
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/target-i386-dm/exec-dm.c
+++ xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
@@ -434,6 +434,31 @@ int iomem_index(target_phys_addr_t addr)
extern unsigned long *logdirty_bitmap;
extern unsigned long logdirty_bitmap_size;
+/*
+ * Replace the standard byte memcpy with a word memcpy for appropriately sized
+ * memory copy operations. Some users (USB-UHCI) can not tolerate the possible
+ * word tearing that can result from a guest concurrently writing a memory
+ * structure while the qemu device model is modifying the same location.
+ * Forcing a word-sized read/write prevents the guest from seeing a partially
+ * written word-sized atom.
+ */
+void memcpy_words(void *dst, void *src, size_t n)
+{
+ while (n >= sizeof(long)) {
+ *((long *)dst)++ = *((long *)src)++;
+ n -= sizeof(long);
+ }
+
+ if (n & 4)
+ *((uint32_t *)dst)++ = *((uint32_t *)src)++;
+
+ if (n & 2)
+ *((uint16_t *)dst)++ = *((uint16_t *)src)++;
+
+ if (n & 1)
+ *((uint8_t *)dst)++ = *((uint8_t *)src)++;
+}
+
void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
int len, int is_write)
{
@@ -470,7 +495,7 @@ void cpu_physical_memory_rw(target_phys_
}
} else if ((ptr = phys_ram_addr(addr)) != NULL) {
/* Writing to RAM */
- memcpy(ptr, buf, l);
+ memcpy_words(ptr, buf, l);
if (logdirty_bitmap != NULL) {
/* Record that we have dirtied this frame */
unsigned long pfn = addr >> TARGET_PAGE_BITS;
@@ -506,7 +531,7 @@ void cpu_physical_memory_rw(target_phys_
}
} else if ((ptr = phys_ram_addr(addr)) != NULL) {
/* Reading from RAM */
- memcpy(buf, ptr, l);
+ memcpy_words(buf, ptr, l);
} else {
/* Neither RAM nor known MMIO space */
memset(buf, 0xff, len);

View File

@ -1,55 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1181210543 -3600
# Node ID b090c290d9f8fc579be32ddd68f2bcd96e05aa03
# Parent 6d45351273da0b49ed328ef8077446c4ceedf3ff
tools: Fix some type issues GCC 4.1.0 warnings.
FC5's gcc 4.1.0 can't make some files in tools/ due to its stronger
type checking.
From: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/target-i386-dm/exec-dm.c
+++ xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
@@ -445,18 +445,29 @@ extern unsigned long logdirty_bitmap_siz
void memcpy_words(void *dst, void *src, size_t n)
{
while (n >= sizeof(long)) {
- *((long *)dst)++ = *((long *)src)++;
+ *((long *)dst) = *((long *)src);
+ dst = ((long *)dst) + 1;
+ src = ((long *)src) + 1;
n -= sizeof(long);
}
- if (n & 4)
- *((uint32_t *)dst)++ = *((uint32_t *)src)++;
-
- if (n & 2)
- *((uint16_t *)dst)++ = *((uint16_t *)src)++;
+ if (n & 4) {
+ *((uint32_t *)dst) = *((uint32_t *)src);
+ dst = ((uint32_t *)dst) + 1;
+ src = ((uint32_t *)src) + 1;
+ }
+
+ if (n & 2) {
+ *((uint16_t *)dst) = *((uint16_t *)src);
+ dst = ((uint16_t *)dst) + 1;
+ src = ((uint16_t *)src) + 1;
+ }
- if (n & 1)
- *((uint8_t *)dst)++ = *((uint8_t *)src)++;
+ if (n & 1) {
+ *((uint8_t *)dst) = *((uint8_t *)src);
+ dst = ((uint8_t *)dst) + 1;
+ src = ((uint8_t *)src) + 1;
+ }
}
void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,

View File

@ -1,21 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1181211324 -3600
# Node ID 1cae82505e9e11bcf47f0857917cd20b2d0bad26
# Parent 3a413f011b8f5dc53825d6882cdf95d47a4212b1
ioemu: Tiny indentation fix.
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/target-i386-dm/exec-dm.c
+++ xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
@@ -455,7 +455,7 @@ void memcpy_words(void *dst, void *src,
*((uint32_t *)dst) = *((uint32_t *)src);
dst = ((uint32_t *)dst) + 1;
src = ((uint32_t *)src) + 1;
- }
+ }
if (n & 2) {
*((uint16_t *)dst) = *((uint16_t *)src);

View File

@ -1,69 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1181553294 -3600
# Node ID a43a03d53781e159da41f79d8cc615905b95ab80
# Parent 93f77a5a8437df0b34919a6987f48e84342b4a43
xend: Fix xm block-detach regression introduced by c/s 15157.
Prior to this c/s, user was able to specify device name or id, e.g.
xm block-detach dom xvdb
xm block-detach dom 15728
Now, 'xm block-detach dom xvdb' silently fails. xend.log does contain
the following
[2007-06-07 11:39:18 xend.XendDomainInfo 3775] DEBUG
(XendDomainInfo:519) devName=vbd/51712
[2007-06-07 11:39:18 xend.XendDomainInfo 3775] DEBUG
(XendDomainInfo:527) Could not find the device xvdb
This patch restores the previous behavior but retains the bugfix
introduced by c/s 15571.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -544,31 +544,18 @@ class XendDomainInfo:
self.getDeviceController(devclass).waitForDevices()
def destroyDevice(self, deviceClass, devid, force = False):
- found = True # Assume devid is an integer.
try:
- devid = int(devid)
+ dev = int(devid)
except ValueError:
- # devid is not a number, let's search for it in xenstore.
- devicePath = '%s/device/%s' % (self.dompath, deviceClass)
- found = False
- for entry in xstransact.List(devicePath):
- log.debug("Attempting to find devid at %s/%s", devicePath, entry)
- backend = xstransact.Read('%s/%s' % (devicePath, entry),
- "backend")
- if backend != None:
- devName = '%s/%s' % (deviceClass, entry)
- log.debug("devName=%s", devName)
- if devName == devid:
- # We found the integer matching our devid, use it instead
- devid = int(entry)
- found = True
- break
+ # devid is not a number but a string containing either device
+ # name (e.g. xvda) or device_type/device_id (e.g. vbd/51728)
+ dev = type(devid) is str and devid.split('/')[-1] or None
+ if dev == None:
+ log.debug("Could not find the device %s", devid)
+ return None
- if not found:
- log.debug("Could not find the device %s", devid)
- return None
- log.debug("devid = %s", devid)
- return self.getDeviceController(deviceClass).destroyDevice(devid, force)
+ log.debug("dev = %s", dev)
+ return self.getDeviceController(deviceClass).destroyDevice(dev, force)
def getDeviceSxprs(self, deviceClass):
if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):

View File

@ -1,21 +0,0 @@
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xensource.com>
# Date 1181570210 -3600
# Node ID ed254cf78f7ca758539ba3314932fbbd808807d2
# Parent 2c8c6ca1296b82e31bb0a50fcf9f63d0bfa11176
[QEMU] Fix up ioemu timer save/restore after version changes.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
Index: xen-3.1-testing/tools/ioemu/vl.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/vl.c
+++ xen-3.1-testing/tools/ioemu/vl.c
@@ -872,7 +872,7 @@ static void timer_save(QEMUFile *f, void
static int timer_load(QEMUFile *f, void *opaque, int version_id)
{
- if (version_id != 1)
+ if (version_id != 1 && version_id != 2)
return -EINVAL;
if (cpu_ticks_enabled) {
return -EINVAL;

View File

@ -1,66 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1181730428 -3600
# Node ID 7f9362a8ae3daeb5dc7bc62069eae872c42a5a14
# Parent 30449e0e0a64618c29e47ed7774cd2b689711319
xenapi: Fix segfault in libxenapi.
When calling xen_vbd_set_mode(), libxenapi attempted to convert enum
mode parameter to a string twice - resulting in segfault. Removed
first conversion since conversion is taking place in
marshalling/demarshalling layer. Fixed similar double enum conversion
in other places as well.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
diff -r 30449e0e0a64 -r 7f9362a8ae3d tools/libxen/src/xen_vbd.c
--- a/tools/libxen/src/xen_vbd.c Wed Jun 13 11:13:11 2007 +0100
+++ b/tools/libxen/src/xen_vbd.c Wed Jun 13 11:27:08 2007 +0100
@@ -463,7 +463,7 @@ xen_vbd_set_mode(xen_session *session, x
{ .type = &abstract_type_string,
.u.string_val = vbd },
{ .type = &xen_vbd_mode_abstract_type_,
- .u.string_val = xen_vbd_mode_to_string(mode) }
+ .u.enum_val = mode }
};
xen_call_(session, "VBD.set_mode", param_values, 2, NULL, NULL);
@@ -479,7 +479,7 @@ xen_vbd_set_type(xen_session *session, x
{ .type = &abstract_type_string,
.u.string_val = vbd },
{ .type = &xen_vbd_type_abstract_type_,
- .u.string_val = xen_vbd_type_to_string(type) }
+ .u.enum_val = type }
};
xen_call_(session, "VBD.set_type", param_values, 2, NULL, NULL);
diff -r 30449e0e0a64 -r 7f9362a8ae3d tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Wed Jun 13 11:13:11 2007 +0100
+++ b/tools/libxen/src/xen_vm.c Wed Jun 13 11:27:08 2007 +0100
@@ -1142,7 +1142,7 @@ xen_vm_set_actions_after_shutdown(xen_se
{ .type = &abstract_type_string,
.u.string_val = vm },
{ .type = &xen_on_normal_exit_abstract_type_,
- .u.string_val = xen_on_normal_exit_to_string(after_shutdown) }
+ .u.enum_val = after_shutdown }
};
xen_call_(session, "VM.set_actions_after_shutdown", param_values, 2, NULL, NULL);
@@ -1158,7 +1158,7 @@ xen_vm_set_actions_after_reboot(xen_sess
{ .type = &abstract_type_string,
.u.string_val = vm },
{ .type = &xen_on_normal_exit_abstract_type_,
- .u.string_val = xen_on_normal_exit_to_string(after_reboot) }
+ .u.enum_val = after_reboot }
};
xen_call_(session, "VM.set_actions_after_reboot", param_values, 2, NULL, NULL);
@@ -1174,7 +1174,7 @@ xen_vm_set_actions_after_crash(xen_sessi
{ .type = &abstract_type_string,
.u.string_val = vm },
{ .type = &xen_on_crash_behaviour_abstract_type_,
- .u.string_val = xen_on_crash_behaviour_to_string(after_crash) }
+ .u.enum_val = after_crash }
};
xen_call_(session, "VM.set_actions_after_crash", param_values, 2, NULL, NULL);

View File

@ -1,30 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1181730467 -3600
# Node ID ffdbe8aebde21710deca4ae84bba95e38f4b089b
# Parent 7f9362a8ae3daeb5dc7bc62069eae872c42a5a14
xenapi: Implement XenAPI method VBD.set_mode in python.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.1-testing/tools/python/xen/xend/XendAPI.py
@@ -1873,6 +1873,17 @@ class XendAPI(object):
xd.managed_config_save(vm)
return xen_api_success_void()
+ def VBD_set_mode(self, session, vbd_ref, mode):
+ if mode == 'RW':
+ mode = 'w'
+ else:
+ mode = 'r'
+ xd = XendDomain.instance()
+ vm = xd.get_vm_with_dev_uuid('vbd', vbd_ref)
+ vm.set_dev_property('vbd', vbd_ref, 'mode', mode)
+ xd.managed_config_save(vm)
+ return xen_api_success_void()
+
def VBD_get_all(self, session):
xendom = XendDomain.instance()
vbds = [d.get_vbds() for d in XendDomain.instance().list('all')]

View File

@ -1,27 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1181730493 -3600
# Node ID b643179d7452a91cd874ee713c78bf30f8df3d2d
# Parent ffdbe8aebde21710deca4ae84bba95e38f4b089b
xenapi: Implement VM.set_VCPUs_at_startup and VM.set_VCPUs_max XenAPI
methods in xend.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.1-testing/tools/python/xen/xend/XendAPI.py
@@ -1474,6 +1474,12 @@ class XendAPI(object):
else:
return xen_api_success_void()
+ def VM_set_VCPUs_at_startup(self, session, vm_ref, num):
+ return self.VM_set('VCPUs_at_startup', session, vm_ref, num)
+
+ def VM_set_VCPUs_max(self, session, vm_ref, num):
+ return self.VM_set('VCPUs_max', session, vm_ref, num)
+
def VM_set_actions_after_shutdown(self, session, vm_ref, action):
if action not in XEN_API_ON_NORMAL_EXIT:
return xen_api_error(['VM_ON_NORMAL_EXIT_INVALID', vm_ref])

View File

@ -1,51 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1181832897 -3600
# Node ID 912f7e312ec2a56c89ef5a949b6ecc72f5df74a6
# Parent 4d838167960694f1b9fcaec54590aef0e1f0a7ee
hvm svm: Fix for BSOD when "migrating" from Intel to AMD.
The Intel processor driver for Windows (XP and later at least) reads
an MSR that AMD doesn't have. This causes GP-fault in kernel mode,
which causes blue-screen-of-death on Windows. This prevents a
disk-image that was installed on Intel from starting on an AMD
processor.
This patch "fixes" the problem by allowing reads from the msr,
returning all zero's (which is a valid, if not particulary
meaningful, value for this register).
Signed-off-by: Mats Petersson <mats.petersson@amd.com>
Index: xen-3.1-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-3.1-testing/xen/arch/x86/hvm/svm/svm.c
@@ -2000,6 +2000,15 @@ static inline void svm_do_msr_access(
msr_content = v->arch.hvm_svm.cpu_shadow_efer;
break;
+ case MSR_IA32_EBC_FREQUENCY_ID:
+ /*
+ * This Intel-only register may be accessed if this HVM guest
+ * has been migrated from an Intel host. The value zero is not
+ * particularly meaningful, but at least avoids the guest crashing!
+ */
+ msr_content = 0;
+ break;
+
default:
if ( rdmsr_hypervisor_regs(ecx, &eax, &edx) ||
rdmsr_safe(ecx, eax, edx) == 0 )
Index: xen-3.1-testing/xen/include/asm-x86/msr.h
===================================================================
--- xen-3.1-testing.orig/xen/include/asm-x86/msr.h
+++ xen-3.1-testing/xen/include/asm-x86/msr.h
@@ -93,6 +93,7 @@ static inline void wrmsrl(unsigned int m
#define MSR_IA32_TIME_STAMP_COUNTER 0x10
#define MSR_IA32_PLATFORM_ID 0x17
#define MSR_IA32_EBL_CR_POWERON 0x2a
+#define MSR_IA32_EBC_FREQUENCY_ID 0x2c
#define MSR_IA32_APICBASE 0x1b
#define MSR_IA32_APICBASE_BSP (1<<8)

View File

@ -1,31 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1182263948 -3600
# Node ID f1ca92bf7e0f0fc8441f9681395a09afe4617af9
# Parent 07688f8f53943cb51c965fa91923b1c4a3e87d0f
hvm svm: Log into 'xm dmesg' that SVM NPT is enabled.
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: xen-3.1-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-3.1-testing/xen/arch/x86/hvm/svm/svm.c
@@ -895,7 +895,7 @@ static struct hvm_function_table svm_fun
.event_injection_faulted = svm_event_injection_faulted
};
-void svm_npt_detect(void)
+static void svm_npt_detect(void)
{
u32 eax, ebx, ecx, edx;
@@ -956,6 +956,9 @@ int start_svm(void)
hvm_enable(&svm_function_table);
+ if ( opt_hap_enabled )
+ printk("SVM: Nested paging enabled.\n");
+
return 1;
}

View File

@ -1,72 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1182265695 -3600
# Node ID 896b536d66c9952fac4bd1c9a6e3f562debec19d
# Parent cb747a35e057ad2536fc560d21d43a1ade1faae5
ioemu: Assembler memcpy() for x86, and lowest-common-denominator
memcpy() function for all others, avoiding noisy longword copies on
ia64.
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/target-i386-dm/exec-dm.c
+++ xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
@@ -442,19 +442,40 @@ extern unsigned long logdirty_bitmap_siz
* Forcing a word-sized read/write prevents the guest from seeing a partially
* written word-sized atom.
*/
-void memcpy_words(void *dst, void *src, size_t n)
+#if defined(__x86_64__) || defined(__i386__)
+static void memcpy_words(void *dst, void *src, size_t n)
{
- while (n >= sizeof(long)) {
- *((long *)dst) = *((long *)src);
- dst = ((long *)dst) + 1;
- src = ((long *)src) + 1;
- n -= sizeof(long);
- }
-
- if (n & 4) {
+ asm (
+ " movl %%edx,%%ecx \n"
+#ifdef __x86_64
+ " shrl $3,%%ecx \n"
+ " andl $7,%%edx \n"
+ " rep movsq \n"
+ " test $4,%%edx \n"
+ " jz 1f \n"
+ " movsl \n"
+#else /* __i386__ */
+ " shrl $2,%%ecx \n"
+ " andl $3,%%edx \n"
+ " rep movsl \n"
+#endif
+ "1: test $2,%%edx \n"
+ " jz 1f \n"
+ " movsw \n"
+ "1: test $1,%%edx \n"
+ " jz 1f \n"
+ " movsb \n"
+ "1: \n"
+ : : "S" (src), "D" (dst), "d" (n) : "ecx" );
+}
+#else
+static void memcpy_words(void *dst, void *src, size_t n)
+{
+ while (n >= sizeof(uint32_t)) {
*((uint32_t *)dst) = *((uint32_t *)src);
dst = ((uint32_t *)dst) + 1;
src = ((uint32_t *)src) + 1;
+ n -= sizeof(uint32_t);
}
if (n & 2) {
@@ -469,6 +490,7 @@ void memcpy_words(void *dst, void *src,
src = ((uint8_t *)src) + 1;
}
}
+#endif
void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
int len, int is_write)

View File

@ -1,33 +0,0 @@
# HG changeset 15389 patch
# User kfraser@localhost.localdomain
# Date 1182343102 -3600
# Node ID 07be0266f6d88f2a8343b54f36301f3adac88d18
# Parent 50358c4b37f4fcaac1061f1c84a865932401c1be
32-on-64: Fix error path from memory_op() hypercall.
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: 2007-05-14/xen/common/compat/memory.c
===================================================================
--- 2007-05-14.orig/xen/common/compat/memory.c 2007-04-23 10:01:43.000000000 +0200
+++ 2007-05-14/xen/common/compat/memory.c 2007-07-02 10:48:06.000000000 +0200
@@ -258,7 +258,8 @@ int compat_memory_op(unsigned int cmd, X
compat_pfn_t pfn = nat.rsrv->extent_start.p[start_extent];
BUG_ON(pfn != nat.rsrv->extent_start.p[start_extent]);
- if ( __copy_to_compat_offset(cmp.rsrv.extent_start, start_extent, &pfn, 1) )
+ if ( __copy_to_compat_offset(cmp.rsrv.extent_start,
+ start_extent, &pfn, 1) )
{
if ( split >= 0 )
{
@@ -275,6 +276,10 @@ int compat_memory_op(unsigned int cmd, X
break;
}
}
+
+ /* Bail if there was an error. */
+ if ( (split >= 0) && (end_extent != nat.rsrv->nr_extents) )
+ split = 0;
}
else
start_extent = end_extent;

View File

@ -1,76 +0,0 @@
# HG changeset 15390 patch
# User kfraser@localhost.localdomain
# Date 1182343128 -3600
# Node ID 69658f935cc737c46d33404ccb5e9aff9842e5cb
# Parent 07be0266f6d88f2a8343b54f36301f3adac88d18
32-on-64: Fix error path where we fail to successfully switch a guest
into compat mode.
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: 2007-05-14/xen/arch/x86/domain.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/domain.c 2007-07-02 10:47:47.000000000 +0200
+++ 2007-05-14/xen/arch/x86/domain.c 2007-07-02 10:48:10.000000000 +0200
@@ -227,7 +227,7 @@ static int setup_compat_l4(struct vcpu *
l4_pgentry_t *l4tab;
int rc;
- if ( !pg )
+ if ( pg == NULL )
return -ENOMEM;
/* This page needs to look like a pagetable so that it can be shadowed */
@@ -239,8 +239,6 @@ static int setup_compat_l4(struct vcpu *
l4tab[l4_table_offset(PERDOMAIN_VIRT_START)] =
l4e_from_paddr(__pa(v->domain->arch.mm_perdomain_l3),
__PAGE_HYPERVISOR);
- v->arch.guest_table = pagetable_from_page(pg);
- v->arch.guest_table_user = v->arch.guest_table;
if ( (rc = setup_arg_xlat_area(v, l4tab)) < 0 )
{
@@ -248,6 +246,9 @@ static int setup_compat_l4(struct vcpu *
return rc;
}
+ v->arch.guest_table = pagetable_from_page(pg);
+ v->arch.guest_table_user = v->arch.guest_table;
+
return 0;
}
@@ -313,11 +314,11 @@ int switch_compat(struct domain *d)
gdt_l1e = l1e_from_page(virt_to_page(compat_gdt_table), PAGE_HYPERVISOR);
for ( vcpuid = 0; vcpuid < MAX_VIRT_CPUS; vcpuid++ )
{
+ if ( (d->vcpu[vcpuid] != NULL) &&
+ (setup_compat_l4(d->vcpu[vcpuid]) != 0) )
+ goto undo_and_fail;
d->arch.mm_perdomain_pt[((vcpuid << GDT_LDT_VCPU_SHIFT) +
FIRST_RESERVED_GDT_PAGE)] = gdt_l1e;
- if (d->vcpu[vcpuid]
- && setup_compat_l4(d->vcpu[vcpuid]) != 0)
- return -ENOMEM;
}
d->arch.physaddr_bitsize =
@@ -325,6 +326,19 @@ int switch_compat(struct domain *d)
+ (PAGE_SIZE - 2);
return 0;
+
+ undo_and_fail:
+ d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0;
+ release_arg_xlat_area(d);
+ gdt_l1e = l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
+ while ( vcpuid-- != 0 )
+ {
+ if ( d->vcpu[vcpuid] != NULL )
+ release_compat_l4(d->vcpu[vcpuid]);
+ d->arch.mm_perdomain_pt[((vcpuid << GDT_LDT_VCPU_SHIFT) +
+ FIRST_RESERVED_GDT_PAGE)] = gdt_l1e;
+ }
+ return -ENOMEM;
}
#else

View File

@ -1,20 +0,0 @@
# HG changeset 15391 patch
# User kfraser@localhost.localdomain
# Date 1182343194 -3600
# Node ID fe3df33e27615a9732f0ae73d65dae0f23afbb4d
# Parent 69658f935cc737c46d33404ccb5e9aff9842e5cb
32-on-64: First slot of hidden L4 page directory must start life as zero.
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: 2007-05-14/xen/arch/x86/domain.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/domain.c 2007-07-02 10:48:10.000000000 +0200
+++ 2007-05-14/xen/arch/x86/domain.c 2007-07-02 10:48:13.000000000 +0200
@@ -234,6 +234,7 @@ static int setup_compat_l4(struct vcpu *
pg->u.inuse.type_info = PGT_l4_page_table|PGT_validated;
l4tab = copy_page(page_to_virt(pg), idle_pg_table);
+ l4tab[0] = l4e_empty();
l4tab[l4_table_offset(LINEAR_PT_VIRT_START)] =
l4e_from_page(pg, __PAGE_HYPERVISOR);
l4tab[l4_table_offset(PERDOMAIN_VIRT_START)] =

View File

@ -1,32 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1182415659 -3600
# Node ID a83632dfbb28038ec4218e00f92ea220a85b6887
# Parent 11bf94b2d51a10980a88aa3ee0b3b8c6e14cbfe0
libxenguest: Add missing range-check on count field read from a domain
save/restore file.
Signed-off-by: Keir Fraser <keir@xensource.com>
--- a/tools/libxc/xc_domain_restore.c Wed Jun 20 19:31:37 2007 +0100
+++ b/tools/libxc/xc_domain_restore.c Thu Jun 21 09:47:39 2007 +0100
@@ -903,13 +903,14 @@ int xc_domain_restore(int xc_handle, int
/* Get the list of PFNs that are not in the psuedo-phys map */
{
- unsigned int count;
+ unsigned int count = 0;
unsigned long *pfntab;
int nr_frees, rc;
- if ( !read_exact(io_fd, &count, sizeof(count)) )
- {
- ERROR("Error when reading pfn count");
+ if ( !read_exact(io_fd, &count, sizeof(count)) ||
+ (count > (1U << 28)) ) /* up to 1TB of address space */
+ {
+ ERROR("Error when reading pfn count (= %u)", count);
goto out;
}

View File

@ -1,80 +0,0 @@
# HG changeset 15416 patch
# User kfraser@localhost.localdomain
# Date 1182445370 -3600
# Node ID b35b8053012e6b1720a392964bc7114ba30de420
# Parent 04d4b7b6f5b752a4375cbb58f6ce3efc207f708a
Fix x86/64 failsafe callback handling.
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: 2007-05-14/xen/arch/x86/x86_64/compat/entry.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_64/compat/entry.S 2007-07-02 10:37:50.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_64/compat/entry.S 2007-07-02 10:48:18.000000000 +0200
@@ -143,12 +143,12 @@ compat_restore_all_guest:
.Lft0: iretq
.section .fixup,"ax"
-.Lfx0: popq -15*8-8(%rsp) # error_code/entry_vector
- SAVE_ALL # 15*8 bytes pushed
- movq -8(%rsp),%rsi # error_code/entry_vector
- sti # after stack abuse (-1024(%rsp))
+.Lfx0: sti
+ SAVE_ALL
+ movq UREGS_error_code(%rsp),%rsi
+ movq %rsp,%rax
+ andq $~0xf,%rsp
pushq $__HYPERVISOR_DS # SS
- leaq 8(%rsp),%rax
pushq %rax # RSP
pushfq # RFLAGS
pushq $__HYPERVISOR_CS # CS
Index: 2007-05-14/xen/arch/x86/x86_64/entry.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_64/entry.S 2007-07-02 10:37:49.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_64/entry.S 2007-07-02 10:48:18.000000000 +0200
@@ -57,23 +57,23 @@ restore_all_guest:
/* No special register assumptions. */
iret_exit_to_guest:
addq $8,%rsp
-.Lft1: iretq
+.Lft0: iretq
.section .fixup,"ax"
-.Lfx1: popq -15*8-8(%rsp) # error_code/entry_vector
- SAVE_ALL # 15*8 bytes pushed
- movq -8(%rsp),%rsi # error_code/entry_vector
- sti # after stack abuse (-1024(%rsp))
+.Lfx0: sti
+ SAVE_ALL
+ movq UREGS_error_code(%rsp),%rsi
+ movq %rsp,%rax
+ andq $~0xf,%rsp
pushq $__HYPERVISOR_DS # SS
- leaq 8(%rsp),%rax
pushq %rax # RSP
- pushf # RFLAGS
+ pushfq # RFLAGS
pushq $__HYPERVISOR_CS # CS
- leaq .Ldf1(%rip),%rax
+ leaq .Ldf0(%rip),%rax
pushq %rax # RIP
pushq %rsi # error_code/entry_vector
jmp handle_exception
-.Ldf1: GET_CURRENT(%rbx)
+.Ldf0: GET_CURRENT(%rbx)
jmp test_all_events
failsafe_callback:
GET_CURRENT(%rbx)
@@ -88,10 +88,10 @@ failsafe_callback:
jmp test_all_events
.previous
.section __pre_ex_table,"a"
- .quad .Lft1,.Lfx1
+ .quad .Lft0,.Lfx0
.previous
.section __ex_table,"a"
- .quad .Ldf1,failsafe_callback
+ .quad .Ldf0,failsafe_callback
.previous
ALIGN

View File

@ -1,21 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1182786759 -3600
# Node ID 3f76b2f76c2ad605c448a5535780a17cbefd0b05
# Parent 015d9abeacfb39c73c9aa488c2def2f66ab06e2b
ioemu: Fix ifdef __x86_64__
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/target-i386-dm/exec-dm.c
+++ xen-3.1-testing/tools/ioemu/target-i386-dm/exec-dm.c
@@ -447,7 +447,7 @@ static void memcpy_words(void *dst, void
{
asm (
" movl %%edx,%%ecx \n"
-#ifdef __x86_64
+#ifdef __x86_64__
" shrl $3,%%ecx \n"
" andl $7,%%edx \n"
" rep movsq \n"

View File

@ -1,33 +0,0 @@
# HG changeset 15433 patch
# User Ian Campbell <ian.campbell@xensource.com>
# Date 1183052420 -3600
# Node ID a5360bf1866892498f4fda9fb86f96035143221d
# Parent d0608ecb56bc9dd77740096fd734332c46c737bd
Fix fixup of invalid PTE writes, broken by 13392:0fd65225e4c6.
By the time we test if addr is the upper word it has already been
aligned to the 8 byte pte size.
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Index: xen-3.1-testing/xen/arch/x86/mm.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/mm.c
+++ xen-3.1-testing/xen/arch/x86/mm.c
@@ -3194,6 +3194,7 @@ static int ptwr_emulated_update(
struct ptwr_emulate_ctxt *ptwr_ctxt)
{
unsigned long mfn;
+ unsigned long unaligned_addr = addr;
struct page_info *page;
l1_pgentry_t pte, ol1e, nl1e, *pl1e;
struct vcpu *v = current;
@@ -3247,7 +3248,7 @@ static int ptwr_emulated_update(
if ( unlikely(!get_page_from_l1e(gl1e_to_ml1e(d, nl1e), d)) )
{
if ( (CONFIG_PAGING_LEVELS >= 3) && is_pv_32bit_domain(d) &&
- (bytes == 4) && (addr & 4) && !do_cmpxchg &&
+ (bytes == 4) && (unaligned_addr & 4) && !do_cmpxchg &&
(l1e_get_flags(nl1e) & _PAGE_PRESENT) )
{
/*

View File

@ -1,20 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xensource.com>
# Date 1183059350 -3600
# Node ID b377a102f0eb1b75ec76cf230ee8f259ed01c528
# Parent a5360bf1866892498f4fda9fb86f96035143221d
xend: Fix irq-permissions setting during domain creation.
Signed-off-by: Keir Fraser <keir@xensource.com>
diff -r a5360bf18668 -r b377a102f0eb tools/python/xen/xend/server/irqif.py
--- a/tools/python/xen/xend/server/irqif.py Thu Jun 28 18:40:20 2007 +0100
+++ b/tools/python/xen/xend/server/irqif.py Thu Jun 28 20:35:50 2007 +0100
@@ -61,7 +61,7 @@ class IRQController(DevController):
pirq = get_param('irq')
- rc = xc.domain_irq_permission(dom = self.getDomid(),
+ rc = xc.domain_irq_permission(domid = self.getDomid(),
pirq = pirq,
allow_access = True)

View File

@ -1,158 +0,0 @@
# HG changeset 15444 patch
# User Keir Fraser <keir@xensource.com>
# Date 1183332299 -3600
# Node ID 93b9161fc92095241b4566f510aeb34ffff27f55
# Parent 5d7160564381eedda0853cf003b3097da0173893
Use 32bit operand and address during VMXAssist protected to real.
Signed-off-by: Xin Li <xin.b.li@intel.com>
Index: 2007-05-14/tools/firmware/vmxassist/setup.c
===================================================================
--- 2007-05-14.orig/tools/firmware/vmxassist/setup.c 2007-04-23 10:01:14.000000000 +0200
+++ 2007-05-14/tools/firmware/vmxassist/setup.c 2007-07-02 10:51:33.000000000 +0200
@@ -241,9 +241,10 @@ enter_real_mode(struct regs *regs)
}
/* go from protected to real mode */
- regs->eflags |= EFLAGS_VM;
set_mode(regs, VM86_PROTECTED_TO_REAL);
emulate(regs);
+ if (mode != VM86_REAL)
+ panic("failed to emulate between clear PE and long jump.\n");
}
/*
Index: 2007-05-14/tools/firmware/vmxassist/vm86.c
===================================================================
--- 2007-05-14.orig/tools/firmware/vmxassist/vm86.c 2007-04-23 10:01:14.000000000 +0200
+++ 2007-05-14/tools/firmware/vmxassist/vm86.c 2007-07-02 10:51:33.000000000 +0200
@@ -584,8 +584,13 @@ movr(struct regs *regs, unsigned prefix,
unsigned addr = operand(prefix, regs, modrm);
unsigned val, r = (modrm >> 3) & 7;
- if ((modrm & 0xC0) == 0xC0) /* no registers */
- return 0;
+ if ((modrm & 0xC0) == 0xC0) {
+ /*
+ * Emulate all guest instructions in protected to real mode.
+ */
+ if (mode != VM86_PROTECTED_TO_REAL)
+ return 0;
+ }
switch (opc) {
case 0x88: /* addr32 mov r8, r/m8 */
@@ -818,8 +823,13 @@ mov_to_seg(struct regs *regs, unsigned p
{
unsigned modrm = fetch8(regs);
- /* Only need to emulate segment loads in real->protected mode. */
- if (mode != VM86_REAL_TO_PROTECTED)
+ /*
+ * Emulate segment loads in:
+ * 1) real->protected mode.
+ * 2) protected->real mode.
+ */
+ if ((mode != VM86_REAL_TO_PROTECTED) &&
+ (mode != VM86_PROTECTED_TO_REAL))
return 0;
/* Register source only. */
@@ -829,6 +839,8 @@ mov_to_seg(struct regs *regs, unsigned p
switch ((modrm & 0x38) >> 3) {
case 0: /* es */
regs->ves = getreg16(regs, modrm);
+ if (mode == VM86_PROTECTED_TO_REAL)
+ return 1;
saved_rm_regs.ves = 0;
oldctx.es_sel = regs->ves;
return 1;
@@ -837,21 +849,29 @@ mov_to_seg(struct regs *regs, unsigned p
case 2: /* ss */
regs->uss = getreg16(regs, modrm);
+ if (mode == VM86_PROTECTED_TO_REAL)
+ return 1;
saved_rm_regs.uss = 0;
oldctx.ss_sel = regs->uss;
return 1;
case 3: /* ds */
regs->vds = getreg16(regs, modrm);
+ if (mode == VM86_PROTECTED_TO_REAL)
+ return 1;
saved_rm_regs.vds = 0;
oldctx.ds_sel = regs->vds;
return 1;
case 4: /* fs */
regs->vfs = getreg16(regs, modrm);
+ if (mode == VM86_PROTECTED_TO_REAL)
+ return 1;
saved_rm_regs.vfs = 0;
oldctx.fs_sel = regs->vfs;
return 1;
case 5: /* gs */
regs->vgs = getreg16(regs, modrm);
+ if (mode == VM86_PROTECTED_TO_REAL)
+ return 1;
saved_rm_regs.vgs = 0;
oldctx.gs_sel = regs->vgs;
return 1;
@@ -1063,7 +1083,8 @@ set_mode(struct regs *regs, enum vm86_mo
}
mode = newmode;
- TRACE((regs, 0, states[mode]));
+ if (mode != VM86_PROTECTED)
+ TRACE((regs, 0, states[mode]));
}
static void
@@ -1275,6 +1296,12 @@ opcode(struct regs *regs)
unsigned opc, modrm, disp;
unsigned prefix = 0;
+ if (mode == VM86_PROTECTED_TO_REAL &&
+ oldctx.cs_arbytes.fields.default_ops_size) {
+ prefix |= DATA32;
+ prefix |= ADDR32;
+ }
+
for (;;) {
switch ((opc = fetch8(regs))) {
case 0x07: /* pop %es */
@@ -1385,17 +1412,29 @@ opcode(struct regs *regs)
continue;
case 0x66:
- TRACE((regs, regs->eip - eip, "data32"));
- prefix |= DATA32;
+ if (mode == VM86_PROTECTED_TO_REAL &&
+ oldctx.cs_arbytes.fields.default_ops_size) {
+ TRACE((regs, regs->eip - eip, "data16"));
+ prefix &= ~DATA32;
+ } else {
+ TRACE((regs, regs->eip - eip, "data32"));
+ prefix |= DATA32;
+ }
continue;
case 0x67:
- TRACE((regs, regs->eip - eip, "addr32"));
- prefix |= ADDR32;
+ if (mode == VM86_PROTECTED_TO_REAL &&
+ oldctx.cs_arbytes.fields.default_ops_size) {
+ TRACE((regs, regs->eip - eip, "addr16"));
+ prefix &= ~ADDR32;
+ } else {
+ TRACE((regs, regs->eip - eip, "addr32"));
+ prefix |= ADDR32;
+ }
continue;
- case 0x88: /* addr32 mov r8, r/m8 */
- case 0x8A: /* addr32 mov r/m8, r8 */
+ case 0x88: /* mov r8, r/m8 */
+ case 0x8A: /* mov r/m8, r8 */
if (mode != VM86_REAL && mode != VM86_REAL_TO_PROTECTED)
goto invalid;
if ((prefix & ADDR32) == 0)

View File

@ -1,67 +0,0 @@
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xensource.com>
# Date 1183643173 -3600
# Node ID 936aa542053d050c246825993b1213243ea2fb00
# Parent d54d47fc8c6cdea23437476407bec05d85742760
[HVM] Shadow: avoid xen crash if guest uses special memory for pagetables
(just crash the guest and don't do any more PTE propagations).
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
Index: xen-3.1-testing/xen/arch/x86/mm/shadow/common.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/mm/shadow/common.c
+++ xen-3.1-testing/xen/arch/x86/mm/shadow/common.c
@@ -474,7 +474,9 @@ void shadow_promote(struct vcpu *v, mfn_
ASSERT(mfn_valid(gmfn));
/* We should never try to promote a gmfn that has writeable mappings */
- ASSERT(sh_remove_write_access(v, gmfn, 0, 0) == 0);
+ ASSERT((page->u.inuse.type_info & PGT_type_mask) != PGT_writable_page
+ || (page->u.inuse.type_info & PGT_count_mask) == 0
+ || v->domain->is_shutting_down);
/* Is the page already shadowed? */
if ( !test_and_set_bit(_PGC_page_table, &page->count_info) )
@@ -1818,11 +1820,12 @@ int sh_remove_write_access(struct vcpu *
perfc_incr(shadow_writeable_bf);
hash_foreach(v, callback_mask, callbacks, gmfn);
- /* If that didn't catch the mapping, something is very wrong */
+ /* If that didn't catch the mapping, then there's some non-pagetable
+ * mapping -- ioreq page, grant mapping, &c. */
if ( (mfn_to_page(gmfn)->u.inuse.type_info & PGT_count_mask) != 0 )
{
- SHADOW_ERROR("can't find all writeable mappings of mfn %lx: "
- "%lu left\n", mfn_x(gmfn),
+ SHADOW_ERROR("can't remove write access to mfn %lx: guest has "
+ "%lu special-use mappings of it\n", mfn_x(gmfn),
(mfn_to_page(gmfn)->u.inuse.type_info&PGT_count_mask));
domain_crash(v->domain);
}
Index: xen-3.1-testing/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/mm/shadow/multi.c
+++ xen-3.1-testing/xen/arch/x86/mm/shadow/multi.c
@@ -2719,10 +2719,21 @@ static int sh_page_fault(struct vcpu *v,
if ( guest_walk_tables(v, va, &gw, 1) != 0 )
{
- SHADOW_PRINTK("malformed guest pagetable!");
+ SHADOW_PRINTK("malformed guest pagetable\n");
print_gw(&gw);
}
+ /* It's possible that the guest has put pagetables in memory that it has
+ * already used for some special purpose (ioreq pages, or granted pages).
+ * If that happens we'll have killed the guest already but it's still not
+ * safe to propagate entries out of the guest PT so get out now. */
+ if ( unlikely(d->is_shutting_down) )
+ {
+ SHADOW_PRINTK("guest is shutting down\n");
+ shadow_unlock(d);
+ return 0;
+ }
+
sh_audit_gw(v, &gw);
// We do not look at the gw->l1e, as that will not exist for superpages.

View File

@ -1,34 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1183729265 -3600
# Node ID 3196b63a7301b264d45b82ac347b1bef854680b3
# Parent f20ee5bc9d28cab8a27e2bd073b72033adb7f9a7
xend: Fix xm block/network-attach command for inactive managed domain
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -500,9 +500,18 @@ class XendDomainInfo:
dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
dev_config_dict = self.info['devices'][dev_uuid][1]
log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
- dev_config_dict['devid'] = devid = \
- self._createDevice(dev_type, dev_config_dict)
- self._waitForDevice(dev_type, devid)
+
+ if self.domid is not None:
+ try:
+ dev_config_dict['devid'] = devid = \
+ self._createDevice(dev_type, dev_config_dict)
+ self._waitForDevice(dev_type, devid)
+ except VmError, ex:
+ raise ex
+ else:
+ devid = None
+
+ xen.xend.XendDomain.instance().managed_config_save(self)
return self.getDeviceController(dev_type).sxpr(devid)
def device_configure(self, dev_sxp, devid = None):

View File

@ -1,776 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1183729502 -3600
# Node ID daa07db3ca845c9b08415d19a4d888902abf8321
# Parent d49e6a814d9a4cc8b136b599b77557920abd7921
docs: update xm man page
- Fixed description of "Mem" column in "xm list" output.
- Added a bit of text for the credit scheduler.
- Described the --force option to block-detach.
- Made formatting and spelling more consistent.
- etc...
Signed-off-by: Charles Coffing <ccoffing@novell.com>
--- a/docs/man/xm.pod.1 Fri Jul 06 14:43:51 2007 +0100
+++ b/docs/man/xm.pod.1 Fri Jul 06 14:45:02 2007 +0100
@@ -4,7 +4,7 @@ xm - Xen management user interface
=head1 SYNOPSIS
-xm <subcommand> [args]
+B<xm> I<subcommand> [I<args>]
=head1 DESCRIPTION
@@ -13,46 +13,50 @@ domains. It can also be used to list cur
domains. It can also be used to list current domains, enable or pin
VCPUs, and attach or detach virtual block devices.
-The basic structure of every xm command is almost always:
-
- xm <subcommand> <domain-id> [OPTIONS]
-
-Where I<subcommand> is one of the sub commands listed below, I<domain-id>
+The basic structure of every B<xm> command is almost always:
+
+=over 2
+
+B<xm> I<subcommand> I<domain-id> [I<OPTIONS>]
+
+=back
+
+Where I<subcommand> is one of the subcommands listed below, I<domain-id>
is the numeric domain id, or the domain name (which will be internally
-translated to domain id), and I<OPTIONS> are sub command specific
+translated to domain id), and I<OPTIONS> are subcommand specific
options. There are a few exceptions to this rule in the cases where
-the sub command in question acts on all domains, the entire machine,
-or directly on the xen hypervisor. Those exceptions will be clear for
-each of those sub commands.
+the subcommand in question acts on all domains, the entire machine,
+or directly on the Xen hypervisor. Those exceptions will be clear for
+each of those subcommands.
=head1 NOTES
All B<xm> operations rely upon the Xen control daemon, aka B<xend>.
-For any xm commands to run xend must also be running. For this reason
-you should start xend as a service when your system first boots using
-xen.
+For any B<xm> commands to run, xend must also be running. For this
+reason you should start xend as a service when your system first boots
+using Xen.
Most B<xm> commands require root privileges to run due to the
communications channels used to talk to the hypervisor. Running as
non root will return an error.
Most B<xm> commands act asynchronously, so just because the B<xm>
-command returned, doesn't mean the action is complete. This is
+command returned doesn't mean the action is complete. This is
important, as many operations on domains, like create and shutdown,
can take considerable time (30 seconds or more) to bring the machine
into a fully compliant state. If you want to know when one of these
-actions has finished you must poll through xm list periodically.
+actions has finished you must poll through B<xm list> periodically.
=head1 DOMAIN SUBCOMMANDS
-The following sub commands manipulate domains directly, as stated
-previously most commands take domain-id as the first parameter.
+The following subcommands manipulate domains directly. As stated
+previously, most commands take I<domain-id> as the first parameter.
=over 4
=item B<console> I<domain-id>
-Attach to domain domain-id's console. If you've set up your Domains to
+Attach to domain I<domain-id>'s console. If you've set up your domains to
have a traditional log in console this will look much like a normal
text log in screen.
@@ -63,15 +67,15 @@ so running curses based interfaces over
so running curses based interfaces over the console B<is not
advised>. Vi tends to get very odd when using it over this interface.
-=item B<create> I<[-c]> I<configfile> I<[name=value]>..
-
-The create sub command requires a configfile and can optional take a
+=item B<create> [B<-c>] I<configfile> [I<name>=I<value>]..
+
+The create sub command requires a config file and can optionally take a
series of name value pairs that add to or override variables defined
in the config file. See L<xmdomain.cfg> for full details of that file
format, and possible options used in either the configfile or
-Name=Value combinations.
-
-Configfile can either be an absolute path to a file, or a relative
+I<name>=I<value> combinations.
+
+I<configfile> can either be an absolute path to a file, or a relative
path to a file located in /etc/xen.
Create will return B<as soon> as the domain is started. This B<does
@@ -116,10 +120,10 @@ virtual networking. (This example comes
=item B<destroy> I<domain-id>
-Immediately terminate the domain domain-id. This doesn't give the domain
-OS any chance to react, and it the equivalent of ripping the power
-cord out on a physical machine. In most cases you will want to use
-the B<shutdown> command instead.
+Immediately terminate the domain I<domain-id>. This doesn't give the
+domain OS any chance to react, and is the equivalent of ripping the
+power cord out on a physical machine. In most cases you will want to
+use the B<shutdown> command instead.
=item B<domid> I<domain-name>
@@ -129,14 +133,14 @@ Converts a domain name to a domain id us
Converts a domain id to a domain name using xend's internal mapping.
-=item B<help> I<[--long]>
+=item B<help> [B<--long>]
Displays the short help message (i.e. common commands).
-The I<--long> option prints out the complete set of B<xm> subcommands,
+The B<--long> option prints out the complete set of B<xm> subcommands,
grouped by function.
-=item B<list> I<[--long | --label]> I<[domain-id, ...]>
+=item B<list> [B<--long> | B<--label>] [I<domain-id> ...]
Prints information about one or more domains. If no domains are
specified it prints out information about all domains.
@@ -151,21 +155,23 @@ An example format for the list is as fol
Mandrake10.2 167 128 1 ------ 2.5
Suse9.2 168 100 1 ------ 1.8
-Name is the name of the domain. ID the domain numeric id. Mem is the
-size of the memory allocated to the domain. VCPUS is the number of
-VCPUS allocated to domain. State is the run state (see below). Time
-is the total run time of the domain as accounted for by Xen.
+Name is the name of the domain. ID the numeric domain id. Mem is the
+desired amount of memory to allocate to the domain (although it may
+not be the currently allocated amount). VCPUs is the number of
+virtual CPUs allocated to the domain. State is the run state (see
+below). Time is the total run time of the domain as accounted for by
+Xen.
B<STATES>
=over 4
-The State field lists 6 states for a Xen Domain, and which ones the
-current Domain is in.
+The State field lists 6 states for a Xen domain, and which ones the
+current domain is in.
=item B<r - running>
-The domain is currently running on a CPU
+The domain is currently running on a CPU.
=item B<b - blocked>
@@ -203,12 +209,12 @@ B<LONG OUTPUT>
=over 4
-If I<--long> is specified, the output for xm list is not the table
+If B<--long> is specified, the output for B<xm list> is not the table
view shown above, but instead is an S-Expression representing all
information known about all domains asked for. This is mostly only
useful for external programs to parse the data.
-B<Note:> there is no stable guarantees on the format of this data.
+B<Note:> There is no stable guarantees on the format of this data.
Use at your own risk.
=back
@@ -217,10 +223,10 @@ B<LABEL OUTPUT>
=over 4
-If I<--label> is specified, the security labels are added to the
-output of xm list and the lines are sorted by the labels (ignoring
-case). The I<--long> option prints the labels by default and cannot be
-combined with I<--label>. See the ACCESS CONTROL SUBCOMMAND section of
+If B<--label> is specified, the security labels are added to the
+output of B<xm list> and the lines are sorted by the labels (ignoring
+case). The B<--long> option prints the labels by default and cannot be
+combined with B<--label>. See the ACCESS CONTROL SUBCOMMAND section of
this man page for more information about labels.
==back
@@ -230,7 +236,7 @@ B<NOTES>
=over 4
The Time column is deceptive. Virtual IO (network and block devices)
-used by Domains requires coordination by Domain0, which means that
+used by domains requires coordination by Domain0, which means that
Domain0 is actually charged for much of the time that a DomainU is
doing IO. Use of this time value to determine relative utilizations
by domains is thus very suspect, as a high IO workload may show as
@@ -240,11 +246,11 @@ less utilized than a high CPU workload.
=item B<mem-max> I<domain-id> I<mem>
-Specify the maximum amount of memory the Domain is able to use. Mem
+Specify the maximum amount of memory the domain is able to use. I<mem>
is specified in megabytes.
The mem-max value may not correspond to the actual memory used in the
-Domain, as it may balloon down it's memory to give more back to the OS.
+domain, as it may balloon down its memory to give more back to the OS.
=item B<mem-set> I<domain-id> I<mem>
@@ -252,20 +258,20 @@ operation requires cooperation from the
operation requires cooperation from the domain operating system, there
is no guarantee that it will succeed.
-B<Warning:> there is no good way to know in advance how small of a
+B<Warning:> There is no good way to know in advance how small of a
mem-set will make a domain unstable and cause it to crash. Be very
careful when using this command on running domains.
-=item B<migrate> I<domain-id> I<host> I<[options]>
-
-Migrate a domain to another Host machine. B<Xend> must be running on
-other host machine, it must be running the same version of xen, it
+=item B<migrate> I<domain-id> I<host> [I<OPTIONS>]
+
+Migrate a domain to another host machine. Xend must be running on
+other host machine, it must be running the same version of Xen, it
must have the migration TCP port open and accepting connections from
the source host, and there must be sufficient resources for the domain
to run (memory, disk, etc).
-Migration is pretty complicated, and has many security implications,
-please read the Xen Users Guide to ensure you understand the
+Migration is pretty complicated, and has many security implications.
+Please read the Xen User's Guide to ensure you understand the
ramifications and limitations on migration before attempting it in
production.
@@ -273,13 +279,13 @@ B<OPTIONS>
=over 4
-=item B<-l, --live>
+=item B<-l>, B<--live>
Use live migration. This will migrate the domain between hosts
-without shutting down the domain. See the Xen Users Guide for more
+without shutting down the domain. See the Xen User's Guide for more
information.
-=item B<-r, --resource> I<Mbs>
+=item B<-r>, B<--resource> I<Mbs>
Set maximum Mbs allowed for migrating the domain. This ensures that
the network link is not saturated with migration traffic while
@@ -293,7 +299,7 @@ allocated resources such as memory, but
allocated resources such as memory, but will not be eligible for
scheduling by the Xen hypervisor.
-=item B<reboot> I<[options]> I<domain-id>
+=item B<reboot> [I<OPTIONS>] I<domain-id>
Reboot a domain. This acts just as if the domain had the B<reboot>
command run from the console. The command returns as soon as it has
@@ -301,18 +307,18 @@ domain actually reboots.
domain actually reboots.
The behavior of what happens to a domain when it reboots is set by the
-I<on_reboot> parameter of the xmdomain.cfg file when the domain was
+B<on_reboot> parameter of the xmdomain.cfg file when the domain was
created.
B<OPTIONS>
=over 4
-=item B<-a, --all>
-
-Reboot all domains
-
-=item B<-w, --wait>
+=item B<-a>, B<--all>
+
+Reboot all domains.
+
+=item B<-w>, B<--wait>
Wait for reboot to complete before returning. This may take a while,
as all services in the domain will have to be shut down cleanly.
@@ -321,7 +327,7 @@ as all services in the domain will have
=item B<restore> I<state-file>
-Build a domain from an B<xm save> state file. See I<save> for more info.
+Build a domain from an B<xm save> state file. See B<save> for more info.
=item B<save> I<domain-id> I<state-file>
@@ -334,16 +340,16 @@ with all the same limitations. Open net
with all the same limitations. Open network connections may be
severed upon restore, as TCP timeouts may have expired.
-=item B<shutdown> I<[options]> I<domain-id>
+=item B<shutdown> [I<OPTIONS>] I<domain-id>
Gracefully shuts down a domain. This coordinates with the domain OS
to perform graceful shutdown, so there is no guarantee that it will
succeed, and may take a variable length of time depending on what
services must be shutdown in the domain. The command returns
-immediately after signally the domain unless that I<-w> flag is used.
+immediately after signally the domain unless that B<-w> flag is used.
The behavior of what happens to a domain when it reboots is set by the
-I<on_shutdown> parameter of the xmdomain.cfg file when the domain was
+B<on_shutdown> parameter of the xmdomain.cfg file when the domain was
created.
B<OPTIONS>
@@ -386,7 +392,7 @@ configured VCPU count is an error. Tryi
configured VCPU count is an error. Trying to set VCPUs to < 1 will be
quietly ignored.
-=item B<vcpu-list> I<[domain-id]>
+=item B<vcpu-list> [I<domain-id>]
Lists VCPU information for a specific domain. If no domain is
specified, VCPU information for all domains will be provided.
@@ -394,7 +400,7 @@ specified, VCPU information for all doma
=item B<vcpu-pin> I<domain-id> I<vcpu> I<cpus>
Pins the the VCPU to only run on the specific CPUs. The keyword
-I<all> can be used to apply the I<cpus> list to all VCPUs in the
+B<all> can be used to apply the I<cpus> list to all VCPUs in the
domain.
Normally VCPUs can float between available CPUs whenever Xen deems a
@@ -408,7 +414,7 @@ CPUs.
=over 4
-=item B<dmesg> I<[-c]>
+=item B<dmesg> [B<-c>]
Reads the Xen message buffer, similar to dmesg on a Linux system. The
buffer contains informational, warning, and error messages created
@@ -419,7 +425,7 @@ B<OPTIONS>
=over 4
-=item B<-c, --clear>
+=item B<-c>, B<--clear>
Clears Xen's message buffer.
@@ -431,8 +437,8 @@ reporting a Xen bug, please provide this
reporting a Xen bug, please provide this information as part of the
bug report.
-Sample xen domain info looks as follows (lines wrapped manually to
-make the man page more readable):
+Sample output looks as follows (lines wrapped manually to make the man
+page more readable):
host : talon
release : 2.6.12.6-xen0
@@ -470,36 +476,36 @@ Not all fields will be explained here, b
Not all fields will be explained here, but some of the less obvious
ones deserve explanation:
-=item I<hw_caps>
+=item B<hw_caps>
A vector showing what hardware capabilities are supported by your
processor. This is equivalent to, though more cryptic, the flags
field in /proc/cpuinfo on a normal Linux machine.
-=item I<free_memory>
-
-Available memory (in MB) not allocated to Xen, or any other Domains.
-
-=item I<xen_caps>
-
-The xen version, architecture. Architecture values can be one of:
+=item B<free_memory>
+
+Available memory (in MB) not allocated to Xen, or any other domains.
+
+=item B<xen_caps>
+
+The Xen version and architecture. Architecture values can be one of:
x86_32, x86_32p (i.e. PAE enabled), x86_64, ia64.
-=item I<xen_changeset>
-
-The xen mercurial changeset id. Very useful for determining exactly
+=item B<xen_changeset>
+
+The Xen mercurial changeset id. Very useful for determining exactly
what version of code your Xen system was built from.
=back
=item B<log>
-Print out the B<xend> log. This log file can be found in
+Print out the xend log. This log file can be found in
/var/log/xend.log.
=item B<top>
-Executes the xentop command, which provides real time monitoring of
+Executes the B<xentop> command, which provides real time monitoring of
domains. Xentop is a curses interface, and reasonably self
explanatory.
@@ -508,12 +514,40 @@ explanatory.
=head1 SCHEDULER SUBCOMMANDS
Xen ships with a number of domain schedulers, which can be set at boot
-time with the I<sched=> parameter on the Xen command line. By
-default I<sedf> is used for scheduling.
+time with the B<sched=> parameter on the Xen command line. By
+default B<credit> is used for scheduling.
FIXME: we really need a scheduler expert to write up this section.
=over 4
+
+=item B<sched-credit> [ B<-d> I<domain-id> [ B<-w>[B<=>I<WEIGHT>] | B<-c>[B<=>I<CAP>] ] ]
+
+Set credit scheduler parameters. The credit scheduler is a
+proportional fair share CPU scheduler built from the ground up to be
+work conserving on SMP hosts.
+
+Each domain (including Domain0) is assigned a weight and a cap.
+
+B<PARAMETERS>
+
+=over 4
+
+=item I<WEIGHT>
+
+A domain with a weight of 512 will get twice as much CPU as a domain
+with a weight of 256 on a contended host. Legal weights range from 1
+to 65535 and the default is 256.
+
+=item I<CAP>
+
+The cap optionally fixes the maximum amount of CPU a domain will be
+able to consume, even if the host system has idle CPU cycles. The cap
+is expressed in percentage of one physical CPU: 100 is 1 physical CPU,
+50 is half a CPU, 400 is 4 CPUs, etc. The default, 0, means there is
+no upper cap.
+
+=back
=item B<sched-sedf> I<period> I<slice> I<latency-hint> I<extratime> I<weight>
@@ -546,7 +580,7 @@ Flag for allowing domain to run in extra
=item I<weight>
-Another way of setting cpu slice.
+Another way of setting CPU slice.
=back
@@ -591,7 +625,7 @@ event.
=over 4
-=item B<block-attach> I<domain-id> I<be-dev> I<fe-dev> I<mode> I<[bedomain-id]>
+=item B<block-attach> I<domain-id> I<be-dev> I<fe-dev> I<mode> [I<bedomain-id>]
Create a new virtual block device. This will trigger a hotplug event
for the guest.
@@ -619,7 +653,7 @@ devices, or by device id, such as 0x1400
=item I<mode>
The access mode for the device from the guest domain. Supported modes
-are I<w> (read/write) or I<r> (read-only).
+are B<w> (read/write) or B<r> (read-only).
=item I<bedomain-id>
@@ -635,62 +669,65 @@ B<EXAMPLES>
xm block-attach guestdomain file://path/to/dsl-2.0RC2.iso /dev/hdc ro
-This will mount the dsl iso as /dev/hdc in the guestdomain as a read
-only device. This will probably not be detected as a cdrom by the
+This will mount the dsl ISO as /dev/hdc in the guestdomain as a read
+only device. This will probably not be detected as a CD-ROM by the
guest, but mounting /dev/hdc manually will work.
=back
-=item B<block-detach> I<domain-id> I<devid>
-
-Destroy a domain's virtual block device. devid B<must> be the device
-id given to the device by domain 0. You will need to run I<xm
-block-list> to determine that number.
-
-FIXME: this is currently B<broken>. Even though a block device is
-removed from domU, it appears to still be allocated in the domain 0.
-
-=item B<block-list> I<[-l|--long]> I<domain-id>
+=item B<block-detach> I<domain-id> I<devid> [B<--force>]
+
+Detach a domain's virtual block device. I<devid> may be the symbolic
+name or the numeric device id given to the device by domain 0. You
+will need to run B<xm block-list> to determine that number.
+
+Detaching the device requires the cooperation of the domain. If the
+domain fails to release the device (perhaps because the domain is hung
+or is still using the device), the detach will fail. The B<--force>
+parameter will forcefully detach the device, but may cause IO errors
+in the domain.
+
+=item B<block-list> [B<-l>|B<--long>] I<domain-id>
List virtual block devices for a domain. The returned output is
-formatted as a list or as an S-Expression if the '--long' option was given.
+formatted as a list or as an S-Expression if the B<--long> option was given.
=head2 NETWORK DEVICES
-=item B<network-attach> I<domain-id> I<[script=scriptname]> I<[ip=ipaddr]>
-I<[mac=macaddr]> I<[bridge=bridge-name]> I<[backend=bedomain-id]>
-
-Creates a new network device in the domain specified by domain-id. It
+=item B<network-attach> I<domain-id> [B<script=>I<scriptname>] [B<ip=>I<ipaddr>]
+[B<mac=>I<macaddr>] [B<bridge=>I<bridge-name>] [B<backend=>I<bedomain-id>]
+
+Creates a new network device in the domain specified by I<domain-id>. It
takes the following optional options:
B<OPTIONS>
=over 4
-=item I<script=scriptname>
+=item B<script=>I<scriptname>
Use the specified script name to bring up the network. Defaults to
-the default setting in xend-config.sxp for I<vif-script>.
-
-=item I<ip=ipaddr>
+the default setting in xend-config.sxp for B<vif-script>.
+
+=item B<ip=>I<ipaddr>
Passes the specified IP Address to the adapter on creation.
FIXME: this currently appears to be B<broken>. I'm not sure under what
circumstances this should actually work.
-=item I<mac=macaddr>
+=item B<mac=>I<macaddr>
The MAC address that the domain will see on its Ethernet device. If
the device is not specified it will be randomly generated with the
00:16:3e vendor id prefix.
-=item I<bridge=bridge-name>
+=item B<bridge=>I<bridge-name>
The name of the bridge to attach the vif to, in case you have more
-than one. This defaults to
-
-=item I<backend=bedomain-id>
+than one. This defaults to xenbr0.
+
+=item B<backend=>I<bedomain-id>
The backend domain id. By default this is domain 0.
@@ -705,17 +742,17 @@ FIXME: this is currently B<broken>. Net
FIXME: this is currently B<broken>. Network devices aren't completely
removed from domain 0.
-=item B<network-list> I<[-l|--long]> I<domain-id>
+=item B<network-list> [B<-l>|B<--long>]> I<domain-id>
List virtual network interfaces for a domain. The returned output is
-formatted as a list or as an S-Expression if the '--long' option was given.
+formatted as a list or as an S-Expression if the B<--long> option was given.
=head2 VIRTUAL TPM DEVICES
-=item B<vtpm-list> I<[-l|--long]> I<domain-id>
+=item B<vtpm-list> [B<-l>|B<--long>] I<domain-id>
Show the virtual TPM device for a domain. The returned output is
-formatted as a list or as an S-Expression if the '--long' option was given.
+formatted as a list or as an S-Expression if the B<--long> option was given.
=back
@@ -728,7 +765,7 @@ out entirely.
=over 4
-=item B<vnet-list> I<[-l|--long]>
+=item B<vnet-list> [B<-l>|B<--long>]
List vnets.
@@ -762,7 +799,7 @@ interpret labels:
interpret labels:
(1) Simple Type Enforcement: Labels are interpreted to decide access
-of domains to comunication means and virtual or physical
+of domains to communication means and virtual or physical
resources. Communication between domains as well as access to
resources are forbidden by default and can only take place if they are
explicitly allowed by the security policy. The proper assignment of
@@ -796,8 +833,8 @@ time with the B<cfgbootpolicy> subcomman
=over 4
I<policy> is a dot-separated list of names. The last part is the file
-name pre-fix for the policy xml file. The preceding name parts are
-translated into the local path pointing to the policy xml file
+name pre-fix for the policy XML file. The preceding name parts are
+translated into the local path pointing to the policy XML file
relative to the global policy root directory
(/etc/xen/acm-security/policies). For example,
example.chwall_ste.client_v1 denotes the policy file
@@ -823,16 +860,16 @@ I<boot title> parameter to specify a uni
Prints the current security policy state information of Xen.
-=item B<labels> [I<policy>] [I<type>=dom|res|any]
+=item B<labels> [I<policy>] [B<type=dom>|B<res>|B<any>]
Lists all labels of a I<type> (domain, resource, or both) that are
defined in the I<policy>. Unless specified, the default I<policy> is
the currently enforced access control policy. The default for I<type>
is 'dom'. The labels are arranged in alphabetical order.
-=item B<addlabel> I<label> dom I<configfile> [I<policy>]
-
-=item B<addlabel> I<label> res I<resource> [I<policy>]
+=item B<addlabel> I<label> B<dom> I<configfile> [I<policy>]
+
+=item B<addlabel> I<label> B<res> I<resource> [I<policy>]
Adds the security label with name I<label> to a domain
I<configfile> (dom) or to the global resource label file for the
@@ -841,17 +878,17 @@ verifies that the I<policy> definition s
verifies that the I<policy> definition supports the specified I<label>
name.
-=item B<rmlabel> dom I<configfile>
-
-=item B<rmlabel> res I<resource>
-
-Works the same as the I<addlabel> command (above), except that this
+=item B<rmlabel> B<dom> I<configfile>
+
+=item B<rmlabel> B<res> I<resource>
+
+Works the same as the B<addlabel> command (above), except that this
command will remove the label from the domain I<configfile> (dom) or
the global resource label file (res).
-=item B<getlabel> dom I<configfile>
-
-=item B<getlabel> res I<resource>
+=item B<getlabel> B<dom> I<configfile>
+
+=item B<getlabel> B<res> I<resource>
Shows the label for the given I<configfile> or I<resource>
@@ -881,7 +918,7 @@ Then recompile and install xen and the s
cd xen_source_dir/xen; make clean; make; cp xen.gz /boot;
cd xen_source_dir/tools/security; make install;
- reboot into xen
+ reboot into Xen
=back
@@ -944,10 +981,10 @@ B<ATTACHING A SECURITY LABEL TO A DOMAIN
=over 4
-The I<addlabel> subcommand can attach a security label to a domain
+The B<addlabel> subcommand can attach a security label to a domain
configuration file, here a HomeBanking label. The example policy
ensures that this domain does not share information with other
-non-hombanking user domains (i.e., domains labeled as dom_Fun or
+non-homebanking user domains (i.e., domains labeled as dom_Fun or
dom_Boinc) and that it will not run simultaneously with domains
labeled as dom_Fun.
@@ -958,7 +995,7 @@ probably just a browser environment for
xm addlabel dom_HomeBanking dom myconfig.xm
The very simple configuration file might now look as printed
-below. The I<addlabel> subcommand added the B<access_control> entry at
+below. The B<addlabel> subcommand added the B<access_control> entry at
the end of the file, consisting of a label name and the policy that
specifies this label name:
@@ -986,7 +1023,7 @@ B<ATTACHING A SECURITY LABEL TO A RESOUR
=over 4
-The I<addlabel> subcommand can also be used to attach a security
+The B<addlabel> subcommand can also be used to attach a security
label to a resource. Following the home banking example from above,
we can label a disk resource (e.g., a physical partition or a file)
to make it accessible to the home banking domain. The example policy
@@ -1002,7 +1039,7 @@ attaches this disk to the domain at boot
disk = [ 'phy:hda6,sda2,w' ]
Alternatively, the resource can be attached after booting the domain
-by using the I<block-attach> subcommand.
+by using the B<block-attach> subcommand.
xm block-attach homebanking phy:hda6 sda2 w
@@ -1010,7 +1047,7 @@ off. Any attempt to use labeled resourc
off. Any attempt to use labeled resources with security turned off
will result in a failure with a corresponding error message. The
solution is to enable security or, if security is no longer desired,
-to remove the resource label using the I<rmlabel> subcommand.
+to remove the resource label using the B<rmlabel> subcommand.
=back
@@ -1048,7 +1085,7 @@ B<POLICY REPRESENTATIONS>
=over 4
We distinguish three representations of the Xen access control policy:
-the I<source XML> version, its I<binary> counterpart, and a I<mapping>
+the source XML version, its binary counterpart, and a mapping
representation that enables the tools to deterministically translate
back and forth between label names of the XML policy and label
identifiers of the binary policy. All three versions must be kept
@@ -1075,8 +1112,6 @@ their binary identifiers (ssidrefs) used
=back
-=head1 EXAMPLES
-
=head1 SEE ALSO
B<xmdomain.cfg>(5), B<xentop>(1)

View File

@ -1,35 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1184147295 -3600
# Node ID 637ff26be6ff820d185d8cdc5cc344aea6b5c9e2
# Parent ff51ff907f8cce9d10296507e6c4c666cf603876
Make QEMU consistently report write caching support for emulated IDE
drives to fix a hang during SLES 9 HVM guest installation.
Without this, the SLES 9 installer kernels (32 and 64 bit) were
getting inconsistent information from QEMU as to whether the
(emulated) IDE drives support write caching (which they do). So part
of the kernel thought write caching was enabled (and enabled the usage
of barrier writes) and part of it didn't, which triggered a bug in
which the same barrier write is submitted over and over again ...
Fixed by setting another bit in the WIN_IDENTIFY (IDE drive "identify"
command) response to indicate we really, truly support write caching.
Signed-off-by: David Lively <dlively@virtualiron.com>
Signed-off-by: Ben Guthro <bguthro@virtualiron.com>
Index: xen-3.1-testing/tools/ioemu/hw/ide.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/hw/ide.c
+++ xen-3.1-testing/tools/ioemu/hw/ide.c
@@ -676,7 +676,8 @@ static void ide_identify(IDEState *s)
/* 13=flush_cache_ext,12=flush_cache,10=lba48 */
put_le16(p + 83, (1 << 14) | (1 << 13) | (1 <<12) | (1 << 10));
put_le16(p + 84, (1 << 14));
- put_le16(p + 85, (1 << 14));
+ /* 14=nop 5=write_cache */
+ put_le16(p + 85, (1 << 14) | (1 << 5));
/* 13=flush_cache_ext,12=flush_cache,10=lba48 */
put_le16(p + 86, (1 << 14) | (1 << 13) | (1 <<12) | (1 << 10));
put_le16(p + 87, (1 << 14));

View File

@ -1,27 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1184330609 -3600
# Node ID 00fabe66d79e46de1d1318fd545ddbde734a8137
# Parent 049e4e61644d6dbdae15802dafb7db8e9c5e70fc
[Xend] Fix problem when destroying VMs using the Xen-API
When domains are destroyed/suspend-resume/migration using the Xen-API
things break due to the domid not having been reset. This patch fixes
this. This is the best place I found for fixing this problem. I could
not push this line into _stateSet() for the case of DOM_STATE_HALTED
and left a comment regarding this.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1571,6 +1571,7 @@ class XendDomainInfo:
log.exception("Removing domain path failed.")
self._stateSet(DOM_STATE_HALTED)
+ self.domid = None # Do not push into _stateSet()!
finally:
self.refresh_shutdown_lock.release()

View File

@ -1,15 +0,0 @@
Bugzilla #254646
Index: xen-3.0.4-testing/tools/ioemu/hw/rtl8139.c
===================================================================
--- xen-3.0.4-testing.orig/tools/ioemu/hw/rtl8139.c
+++ xen-3.0.4-testing/tools/ioemu/hw/rtl8139.c
@@ -754,7 +754,7 @@ static void rtl8139_write_buffer(RTL8139
int wrapped = MOD2(s->RxBufAddr + size, s->RxBufferSize);
/* write packet data */
- if (wrapped && s->RxBufferSize < 65536 && !rtl8139_RxWrap(s))
+ if (wrapped && !(s->RxBufferSize < 65536 && rtl8139_RxWrap(s)))
{
DEBUG_PRINT((">>> RTL8139: rx packet wrapped in buffer at %d\n", size-wrapped));

View File

@ -1,42 +0,0 @@
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xensource.com>
# Date 1184592534 -3600
# Node ID d99903a98ad018c9aed180480577f56ce015fd30
# Parent 1158b6115b1413aa5d92ebe5b4ab2640eded40e3
[HVM] Qemu rtl8139: correct rx CRC calculation
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
Index: xen-3.1-testing/tools/ioemu/hw/rtl8139.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/hw/rtl8139.c 2007-08-20 15:15:42.000000000 -0600
+++ xen-3.1-testing/tools/ioemu/hw/rtl8139.c 2007-08-20 15:15:43.000000000 -0600
@@ -53,9 +53,8 @@
/* debug RTL8139 card C+ mode only */
//#define DEBUG_RTL8139CP 1
-/* RTL8139 provides frame CRC with received packet, this feature seems to be
- ignored by most drivers, disabled by default */
-//#define RTL8139_CALCULATE_RXCRC 1
+/* Calculate CRCs propoerly on Rx packets */
+#define RTL8139_CALCULATE_RXCRC 1
/* Uncomment to enable on-board timer interrupts */
//#define RTL8139_ONBOARD_TIMER 1
@@ -1030,7 +1029,7 @@
/* write checksum */
#if defined (RTL8139_CALCULATE_RXCRC)
- val = cpu_to_le32(crc32(~0, buf, size));
+ val = cpu_to_le32(crc32(0, buf, size));
#else
val = 0;
#endif
@@ -1136,7 +1135,7 @@
/* write checksum */
#if defined (RTL8139_CALCULATE_RXCRC)
- val = cpu_to_le32(crc32(~0, buf, size));
+ val = cpu_to_le32(crc32(0, buf, size));
#else
val = 0;
#endif

View File

@ -1,40 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1184749804 -3600
# Node ID 2cbaa58b131172dd7b35c384cbe2027e3893e26f
# Parent 9c077fc8ccf132b5e0074e44edda83bf9152675f
[xend][xen-api] Save new memory values in domain config when calling
VM.set_memory_[dynamic|static]_[min|max] via Xen API.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.1-testing/tools/python/xen/xend/XendAPI.py
@@ -1393,22 +1393,22 @@ class XendAPI(object):
def VM_set_memory_dynamic_max(self, session, vm_ref, mem):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
dom.set_memory_dynamic_max(int(mem))
- return xen_api_success_void()
+ return self._VM_save(dom)
def VM_set_memory_dynamic_min(self, session, vm_ref, mem):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
dom.set_memory_dynamic_min(int(mem))
- return xen_api_success_void()
+ return self._VM_save(dom)
def VM_set_memory_static_max(self, session, vm_ref, mem):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
dom.set_memory_static_max(int(mem))
- return xen_api_success_void()
+ return self._VM_save(dom)
def VM_set_memory_static_min(self, session, vm_ref, mem):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
dom.set_memory_static_min(int(mem))
- return xen_api_success_void()
+ return self._VM_save(dom)
def VM_set_memory_dynamic_max_live(self, session, vm_ref, mem):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)

View File

@ -1,73 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1185296704 -3600
# Node ID 207582c8d88b532783da5c6f5839336187556f0a
# Parent d9836851a2a4cf6e506f6a8e162a4c90c9f87d82
Add domain name check and UUID check to 'xm new' command.
Add a domain name check and a UUID check to xm new command. The check
logic is as follows:
- If the UUID is not specified
- If a VM with same name exists
=> Update the config for that existing VM
- Else no vm with same name exists
=> Define a brand new VM with auto-generated UUID
- Else UUID is specified
- If a VM with same UUID exists
- If name is different
=> Error
- Else if name is same
=> Update the config for that existing VM
- Else no VM with same UUID exists
- If name is different
=> Define a branch new VM with that name
- Else if name is same
=> Error
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomain.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomain.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomain.py
@@ -51,6 +51,7 @@ from xen.xend.xenstore.xstransact import
from xen.xend.xenstore.xswatch import xswatch
from xen.util import mkdir, security
from xen.xend import uuid
+from xen.xend import sxp
xc = xen.lowlevel.xc.xc()
xoptions = XendOptions.instance()
@@ -946,6 +947,31 @@ class XendDomain:
try:
try:
domconfig = XendConfig.XendConfig(sxp_obj = config)
+
+ domains = self.list('all')
+ domains = map(lambda dom: dom.sxpr(), domains)
+ for dom in domains:
+ if sxp.child_value(config, 'uuid', None):
+ if domconfig['uuid'] == sxp.child_value(dom, 'uuid'):
+ if domconfig['name_label'] != sxp.child_value(dom, 'name'):
+ raise XendError("Domain UUID '%s' is already used." % \
+ domconfig['uuid'])
+ else:
+ # Update the config for that existing domain
+ # because it is same name and same UUID.
+ break
+ else:
+ if domconfig['name_label'] == sxp.child_value(dom, 'name'):
+ raise XendError("Domain name '%s' is already used." % \
+ domconfig['name_label'])
+ else:
+ if domconfig['name_label'] == sxp.child_value(dom, 'name'):
+ # Overwrite the auto-generated UUID by the UUID
+ # of the existing domain. And update the config
+ # for that existing domain.
+ domconfig['uuid'] = sxp.child_value(dom, 'uuid')
+ break
+
dominfo = XendDomainInfo.createDormant(domconfig)
log.debug("Creating new managed domain: %s" %
dominfo.getName())

View File

@ -1,62 +0,0 @@
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xensource.com>
# Date 1185447632 -3600
# Node ID 07655ed2fe58ebf883b8a4b5c2dccf15576f4778
# Parent 3ec3e2840a29bb6d4c64b8094248381712370f17
[HVM] Save/restore: don't leak shared-memory segments after HVM live-migrate.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
Index: xen-3.1-testing/tools/xcutils/xc_save.c
===================================================================
--- xen-3.1-testing.orig/tools/xcutils/xc_save.c
+++ xen-3.1-testing/tools/xcutils/xc_save.c
@@ -54,8 +54,18 @@ static int suspend(int domid)
static char *qemu_active_path;
static char *qemu_next_active_path;
+static int qemu_shmid = -1;
static struct xs_handle *xs;
+
+/* Mark the shared-memory segment for destruction */
+static void qemu_destroy_buffer(void)
+{
+ if (qemu_shmid != -1)
+ shmctl(qemu_shmid, IPC_RMID, NULL);
+ qemu_shmid = -1;
+}
+
/* Get qemu to change buffers. */
static void qemu_flip_buffer(int domid, int next_active)
{
@@ -97,22 +107,23 @@ static void * init_qemu_maps(int domid,
{
key_t key;
char key_ascii[17] = {0,};
- int shmid = -1;
void *seg;
char *path, *p;
/* Make a shared-memory segment */
- while (shmid == -1)
- {
+ do {
key = rand(); /* No security, just a sequence of numbers */
- shmid = shmget(key, 2 * bitmap_size,
+ qemu_shmid = shmget(key, 2 * bitmap_size,
IPC_CREAT|IPC_EXCL|S_IRUSR|S_IWUSR);
- if (shmid == -1 && errno != EEXIST)
+ if (qemu_shmid == -1 && errno != EEXIST)
errx(1, "can't get shmem to talk to qemu-dm");
- }
+ } while (qemu_shmid == -1);
+
+ /* Remember to tidy up after ourselves */
+ atexit(qemu_destroy_buffer);
/* Map it into our address space */
- seg = shmat(shmid, NULL, 0);
+ seg = shmat(qemu_shmid, NULL, 0);
if (seg == (void *) -1)
errx(1, "can't map shmem to talk to qemu-dm");
memset(seg, 0, 2 * bitmap_size);

View File

@ -1,26 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1185523570 -3600
# Node ID e63b331d869892fed2c6f582642a6771c1bda613
# Parent f035c4d9880a453d8c309fdf0e06dedefd96684c
Fix Xen API console methods that use undefined variables.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.1-testing/tools/python/xen/xend/XendAPI.py
@@ -2291,11 +2291,13 @@ class XendAPI(object):
return xen_api_success(cons)
def console_get_location(self, session, console_ref):
+ xendom = XendDomain.instance()
return xen_api_success(xendom.get_dev_property_by_uuid('console',
console_ref,
'location'))
def console_get_protocol(self, session, console_ref):
+ xendom = XendDomain.instance()
return xen_api_success(xendom.get_dev_property_by_uuid('console',
console_ref,
'protocol'))

View File

@ -1,25 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1185523590 -3600
# Node ID 2450743f51b2b2a41d4cd112c1cc635c81d912e4
# Parent e63b331d869892fed2c6f582642a6771c1bda613
Implement missing Xen API method Console.get_other_config.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.1-testing/tools/python/xen/xend/XendAPI.py
@@ -2307,6 +2307,12 @@ class XendAPI(object):
vm = xendom.get_vm_with_dev_uuid('console', console_ref)
return xen_api_success(vm.get_uuid())
+ def console_get_other_config(self, session, console_ref):
+ xendom = XendDomain.instance()
+ return xen_api_success(xendom.get_dev_property_by_uuid('console',
+ console_ref,
+ 'other_config'))
+
# object methods
def console_get_record(self, session, console_ref):
xendom = XendDomain.instance()

View File

@ -1,81 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1185523618 -3600
# Node ID 5682f899c7ae7fa945085aaded75cd1220fd8d17
# Parent 2450743f51b2b2a41d4cd112c1cc635c81d912e4
Implement Xen API method Console.set_other_config.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.1-testing/tools/python/xen/xend/XendAPI.py
@@ -2351,6 +2351,13 @@ class XendAPI(object):
except XendError, exn:
return xen_api_error(['INTERNAL_ERROR', str(exn)])
+ def console_set_other_config(self, session, console_ref, other_config):
+ xd = XendDomain.instance()
+ vm = xd.get_vm_with_dev_uuid('console', console_ref)
+ vm.set_console_other_config(console_ref, other_config)
+ xd.managed_config_save(vm)
+ return xen_api_success_void()
+
# Xen API: Class SR
# ----------------------------------------------------------------
SR_attr_ro = ['VDIs',
Index: xen-3.1-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-3.1-testing/tools/python/xen/xend/XendConfig.py
@@ -124,6 +124,11 @@ XENAPI_PLATFORM_CFG = [ 'acpi', 'apic',
'vncconsole', 'vncdisplay', 'vnclisten',
'vncpasswd', 'vncunused', 'xauthority']
+# Xen API console 'other_config' keys.
+XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten',
+ 'vncpasswd', 'type', 'display', 'xauthority',
+ 'keymap']
+
# List of XendConfig configuration keys that have no direct equivalent
# in the old world.
@@ -1023,9 +1028,7 @@ class XendConfig(dict):
# with vfb
other_config = {}
- for key in ['vncunused', 'vncdisplay', 'vnclisten',
- 'vncpasswd', 'type', 'display', 'xauthority',
- 'keymap']:
+ for key in XENAPI_CONSOLE_OTHER_CFG:
if key in dev_info:
other_config[key] = dev_info[key]
target['devices'][dev_uuid][1]['other_config'] = other_config
@@ -1208,6 +1211,13 @@ class XendConfig(dict):
for dev_uuid, (dev_type, dev_info) in self['devices'].items():
if dev_uuid == console_uuid:
dev_info[key] = value
+ # collapse other_config into dev_info for things
+ # such as vncpasswd, vncunused, etc.
+ if key == 'other_config':
+ for k in XENAPI_CONSOLE_OTHER_CFG:
+ if k in dev_info and k not in value:
+ del dev_info[k]
+ dev_info.update(value)
break
def console_get_all(self, protocol):
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2488,6 +2488,9 @@ class XendDomainInfo:
return dev_uuid
+ def set_console_other_config(self, console_uuid, other_config):
+ self.info.console_update(console_uuid, 'other_config', other_config)
+
def destroy_device_by_uuid(self, dev_type, dev_uuid):
if dev_uuid not in self.info['devices']:
raise XendError('Device does not exist')

View File

@ -1,198 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1186391554 -3600
# Node ID f8d5c509f156cbe3a6a1683f21a75e560e7ba369
# Parent 92e43b36d211606435587420d08b6b949911ce18
Fix/cleanup destroyDevice code path in xend.
When calling destroyDevice code path (e.g. xm block-detach dom devid),
allow specifying an integer device id or a device name such as xvdN or
/dev/xvdN. Allowing the /dev/xvdN form is useful when detaching
devices from dom0. Bootloaders may do this to unmount a disk
previously mounted in dom0.
Move examination of device ID format into the DevController,
permitting device controllers to determine a valid device ID instead
of higher level code.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -553,18 +553,8 @@ class XendDomainInfo:
self.getDeviceController(devclass).waitForDevices()
def destroyDevice(self, deviceClass, devid, force = False):
- try:
- dev = int(devid)
- except ValueError:
- # devid is not a number but a string containing either device
- # name (e.g. xvda) or device_type/device_id (e.g. vbd/51728)
- dev = type(devid) is str and devid.split('/')[-1] or None
- if dev == None:
- log.debug("Could not find the device %s", devid)
- return None
-
- log.debug("dev = %s", dev)
- return self.getDeviceController(deviceClass).destroyDevice(dev, force)
+ log.debug("dev = %s", devid)
+ return self.getDeviceController(deviceClass).destroyDevice(devid, force)
def getDeviceSxprs(self, deviceClass):
if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
Index: xen-3.1-testing/tools/python/xen/xend/server/DevController.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/server/DevController.py
+++ xen-3.1-testing/tools/python/xen/xend/server/DevController.py
@@ -203,27 +203,32 @@ class DevController:
The implementation here simply deletes the appropriate paths from the
store. This may be overridden by subclasses who need to perform other
- tasks on destruction. Further, the implementation here can only
- accept integer device IDs, or values that can be converted to
- integers. Subclasses may accept other values and convert them to
- integers before passing them here.
+ tasks on destruction. The implementation here accepts integer device
+ IDs or paths containg integer deviceIDs, e.g. vfb/0. Subclasses may
+ accept other values and convert them to integers before passing them
+ here.
"""
- devid = int(devid)
+ try:
+ dev = int(devid)
+ except ValueError:
+ # Does devid contain devicetype/deviceid?
+ # Propogate exception if unable to find an integer devid
+ dev = int(type(devid) is str and devid.split('/')[-1] or None)
# Modify online status /before/ updating state (latter is watched by
# drivers, so this ordering avoids a race).
- self.writeBackend(devid, 'online', "0")
- self.writeBackend(devid, 'state', str(xenbusState['Closing']))
+ self.writeBackend(dev, 'online', "0")
+ self.writeBackend(dev, 'state', str(xenbusState['Closing']))
if force:
- frontpath = self.frontendPath(devid)
+ frontpath = self.frontendPath(dev)
backpath = xstransact.Read(frontpath, "backend")
if backpath:
xstransact.Remove(backpath)
xstransact.Remove(frontpath)
- self.vm._removeVm("device/%s/%d" % (self.deviceClass, devid))
+ self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev))
def configurations(self):
return map(self.configuration, self.deviceIDs())
Index: xen-3.1-testing/tools/python/xen/xend/server/blkif.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/server/blkif.py
+++ xen-3.1-testing/tools/python/xen/xend/server/blkif.py
@@ -137,13 +137,16 @@ class BlkifController(DevController):
def destroyDevice(self, devid, force):
"""@see DevController.destroyDevice"""
- # If we are given a device name, then look up the device ID from it,
- # and destroy that ID instead. If what we are given is an integer,
- # then assume it's a device ID and pass it straight through to our
- # superclass's method.
-
+ # vbd device IDs can be either string or integer. Further, the
+ # following string values are possible:
+ # - devicetype/deviceid (vbd/51728)
+ # - devicetype/devicename (/dev/xvdb)
+ # - devicename (xvdb)
+ # Let our superclass handle integer or devicetype/deviceid forms.
+ # If we are given a device name form, then look up the device ID
+ # from it, and destroy that ID instead.
try:
- DevController.destroyDevice(self, int(devid), force)
+ DevController.destroyDevice(self, devid, force)
except ValueError:
devid_end = type(devid) is str and devid.split('/')[-1] or None
Index: xen-3.1-testing/tools/security/policies/default-security_policy.xml
===================================================================
--- /dev/null
+++ xen-3.1-testing/tools/security/policies/default-security_policy.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" ?>
+<SecurityPolicyDefinition xmlns="http://www.ibm.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com ../../security_policy.xsd">
+ <PolicyHeader>
+ <PolicyName>DEFAULT</PolicyName>
+ <Version>1.0</Version>
+ </PolicyHeader>
+ <SimpleTypeEnforcement>
+ <SimpleTypeEnforcementTypes>
+ <Type>SystemManagement</Type>
+ </SimpleTypeEnforcementTypes>
+ </SimpleTypeEnforcement>
+ <ChineseWall>
+ <ChineseWallTypes>
+ <Type>SystemManagement</Type>
+ </ChineseWallTypes>
+ </ChineseWall>
+ <SecurityLabelTemplate>
+ <SubjectLabels bootstrap="SystemManagement">
+ <VirtualMachineLabel>
+ <Name>SystemManagement</Name>
+ <SimpleTypeEnforcementTypes>
+ <Type>SystemManagement</Type>
+ </SimpleTypeEnforcementTypes>
+ <ChineseWallTypes>
+ <Type/>
+ </ChineseWallTypes>
+ </VirtualMachineLabel>
+ </SubjectLabels>
+ </SecurityLabelTemplate>
+</SecurityPolicyDefinition>
Index: xen-3.1-testing/tools/security/policies/default-ul-security_policy.xml
===================================================================
--- /dev/null
+++ xen-3.1-testing/tools/security/policies/default-ul-security_policy.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" ?>
+<SecurityPolicyDefinition xmlns="http://www.ibm.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com ../../security_policy.xsd">
+ <PolicyHeader>
+ <PolicyName>DEFAULT-UL</PolicyName>
+ <Version>1.0</Version>
+ </PolicyHeader>
+ <SimpleTypeEnforcement>
+ <SimpleTypeEnforcementTypes>
+ <Type>SystemManagement</Type>
+ <Type>__UNLABELED__</Type>
+ </SimpleTypeEnforcementTypes>
+ </SimpleTypeEnforcement>
+ <ChineseWall>
+ <ChineseWallTypes>
+ <Type>SystemManagement</Type>
+ </ChineseWallTypes>
+ </ChineseWall>
+ <SecurityLabelTemplate>
+ <SubjectLabels bootstrap="SystemManagement">
+ <VirtualMachineLabel>
+ <Name>SystemManagement</Name>
+ <SimpleTypeEnforcementTypes>
+ <Type>SystemManagement</Type>
+ <Type>__UNLABELED__</Type>
+ </SimpleTypeEnforcementTypes>
+ <ChineseWallTypes>
+ <Type/>
+ </ChineseWallTypes>
+ </VirtualMachineLabel>
+ <VirtualMachineLabel>
+ <Name>__UNLABELED__</Name>
+ <SimpleTypeEnforcementTypes>
+ <Type>__UNLABELED__</Type>
+ </SimpleTypeEnforcementTypes>
+ <ChineseWallTypes>
+ <Type/>
+ </ChineseWallTypes>
+ </VirtualMachineLabel>
+ </SubjectLabels>
+ </SecurityLabelTemplate>
+</SecurityPolicyDefinition>

View File

@ -1,49 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1186394937 -3600
# Node ID e1435c1f3382069ca5044808b3233bda8b09d150
# Parent fd20c1333e3ee8f58e879aed79d74a75bc1969e6
hvm: Fix save/restore when callback_via line is routed through a PCI
INTx wire.
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: xen-3.1-testing/xen/arch/x86/hvm/irq.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/irq.c
+++ xen-3.1-testing/xen/arch/x86/hvm/irq.c
@@ -388,9 +388,33 @@ static void irq_dump(struct domain *d)
static int irq_save_pci(struct domain *d, hvm_domain_context_t *h)
{
struct hvm_irq *hvm_irq = &d->arch.hvm_domain.irq;
+ unsigned int asserted, pdev, pintx;
+ int rc;
+
+ spin_lock(&d->arch.hvm_domain.irq_lock);
+
+ pdev = hvm_irq->callback_via.pci.dev;
+ pintx = hvm_irq->callback_via.pci.intx;
+ asserted = (hvm_irq->callback_via_asserted &&
+ (hvm_irq->callback_via_type == HVMIRQ_callback_pci_intx));
+
+ /*
+ * Deassert virtual interrupt via PCI INTx line. The virtual interrupt
+ * status is not save/restored, so the INTx line must be deasserted in
+ * the restore context.
+ */
+ if ( asserted )
+ __hvm_pci_intx_deassert(d, pdev, pintx);
/* Save PCI IRQ lines */
- return ( hvm_save_entry(PCI_IRQ, 0, h, &hvm_irq->pci_intx) );
+ rc = hvm_save_entry(PCI_IRQ, 0, h, &hvm_irq->pci_intx);
+
+ if ( asserted )
+ __hvm_pci_intx_assert(d, pdev, pintx);
+
+ spin_unlock(&d->arch.hvm_domain.irq_lock);
+
+ return rc;
}
static int irq_save_isa(struct domain *d, hvm_domain_context_t *h)

View File

@ -1,31 +0,0 @@
# HG changeset 15693 patch
# User Ian Campbell <ian.campbell@xensource.com>
# Date 1186402784 -3600
# Node ID c229802cedbb3f43276a2ba03dfed7ef4e81ba81
# Parent b82e6818fb31c6373ccd3e840ef2f9719d5f21a3
[32on64] Copy the right grant table status code back to the guest.
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Index: 2007-05-14/xen/common/compat/grant_table.c
===================================================================
--- 2007-05-14.orig/xen/common/compat/grant_table.c 2007-05-03 09:45:09.000000000 +0200
+++ 2007-05-14/xen/common/compat/grant_table.c 2007-08-09 10:01:54.000000000 +0200
@@ -153,7 +153,7 @@ int compat_grant_table_op(unsigned int c
while ( n-- )
{
guest_handle_add_offset(xfer, -1);
- if ( __copy_field_to_guest(xfer, nat.xfer, status) )
+ if ( __copy_field_to_guest(xfer, nat.xfer + n, status) )
rc = -EFAULT;
}
}
@@ -191,7 +191,7 @@ int compat_grant_table_op(unsigned int c
while ( n-- )
{
guest_handle_add_offset(copy, -1);
- if ( __copy_field_to_guest(copy, nat.copy, status) )
+ if ( __copy_field_to_guest(copy, nat.copy + n, status) )
rc = -EFAULT;
}
}

View File

@ -1,292 +0,0 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1186672901 -3600
# Node ID 95f90f24f3b1f33f911d3e9a01cb1d7bce5b29e0
# Parent f0298301ba8b34ac3e5470cf953a3591f7730d26
Fix xm block/network-detach command.
- To remove device info, it waits for the backend path of the device
to be removed.
- It removes device info from domain info.
- It saves domain info to the config.sxp of the managed domain.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -552,9 +552,64 @@ class XendDomainInfo:
for devclass in XendDevices.valid_devices():
self.getDeviceController(devclass).waitForDevices()
- def destroyDevice(self, deviceClass, devid, force = False):
- log.debug("dev = %s", devid)
- return self.getDeviceController(deviceClass).destroyDevice(devid, force)
+ def destroyDevice(self, deviceClass, devid, force = False, rm_cfg = False):
+ log.debug("XendDomainInfo.destroyDevice: deviceClass = %s, device = %s",
+ deviceClass, devid)
+
+ if rm_cfg:
+ # Convert devid to device number. A device number is
+ # needed to remove its configuration.
+ dev = self.getDeviceController(deviceClass).convertToDeviceNumber(devid)
+
+ # Save current sxprs. A device number and a backend
+ # path are needed to remove its configuration but sxprs
+ # do not have those after calling destroyDevice.
+ sxprs = self.getDeviceSxprs(deviceClass)
+
+ rc = None
+ if self.domid is not None:
+ rc = self.getDeviceController(deviceClass).destroyDevice(devid, force)
+ if not force and rm_cfg:
+ # The backend path, other than the device itself,
+ # has to be passed because its accompanied frontend
+ # path may be void until its removal is actually
+ # issued. It is probable because destroyDevice is
+ # issued first.
+ for dev_num, dev_info in sxprs:
+ dev_num = int(dev_num)
+ if dev_num == dev:
+ for x in dev_info:
+ if x[0] == 'backend':
+ backend = x[1]
+ break
+ break
+ self._waitForDevice_destroy(deviceClass, devid, backend)
+
+ if rm_cfg:
+ if deviceClass == 'vif':
+ if self.domid is not None:
+ for dev_num, dev_info in sxprs:
+ dev_num = int(dev_num)
+ if dev_num == dev:
+ for x in dev_info:
+ if x[0] == 'mac':
+ mac = x[1]
+ break
+ break
+ dev_info = self.getDeviceInfo_vif(mac)
+ else:
+ _, dev_info = sxprs[dev]
+ else: # 'vbd' or 'tap'
+ dev_info = self.getDeviceInfo_vbd(dev)
+ if dev_info is None:
+ return rc
+
+ dev_uuid = sxp.child_value(dev_info, 'uuid')
+ del self.info['devices'][dev_uuid]
+ self.info['%s_refs' % deviceClass].remove(dev_uuid)
+ xen.xend.XendDomain.instance().managed_config_save(self)
+
+ return rc
def getDeviceSxprs(self, deviceClass):
if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
@@ -568,6 +623,23 @@ class XendDomainInfo:
dev_num += 1
return sxprs
+ def getDeviceInfo_vif(self, mac):
+ for dev_type, dev_info in self.info.all_devices_sxpr():
+ if dev_type != 'vif':
+ continue
+ if mac == sxp.child_value(dev_info, 'mac'):
+ return dev_info
+
+ def getDeviceInfo_vbd(self, devid):
+ for dev_type, dev_info in self.info.all_devices_sxpr():
+ if dev_type != 'vbd' and dev_type != 'tap':
+ continue
+ dev = sxp.child_value(dev_info, 'dev')
+ dev = dev.split(':')[0]
+ dev = self.getDeviceController(dev_type).convertToDeviceNumber(dev)
+ if devid == dev:
+ return dev_info
+
def setMemoryTarget(self, target):
"""Set the memory target of this domain.
@@ -1296,6 +1368,10 @@ class XendDomainInfo:
deviceClass, config = self.info['devices'].get(dev_uuid)
self._waitForDevice(deviceClass, config['devid'])
+ def _waitForDevice_destroy(self, deviceClass, devid, backpath):
+ return self.getDeviceController(deviceClass).waitForDevice_destroy(
+ devid, backpath)
+
def _reconfigureDevice(self, deviceClass, devid, devconfig):
return self.getDeviceController(deviceClass).reconfigureDevice(
devid, devconfig)
Index: xen-3.1-testing/tools/python/xen/xend/server/DevController.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/server/DevController.py
+++ xen-3.1-testing/tools/python/xen/xend/server/DevController.py
@@ -28,17 +28,19 @@ from xen.xend.xenstore.xswatch import xs
import os
-DEVICE_CREATE_TIMEOUT = 100
+DEVICE_CREATE_TIMEOUT = 100
+DEVICE_DESTROY_TIMEOUT = 100
HOTPLUG_STATUS_NODE = "hotplug-status"
HOTPLUG_ERROR_NODE = "hotplug-error"
HOTPLUG_STATUS_ERROR = "error"
HOTPLUG_STATUS_BUSY = "busy"
-Connected = 1
-Error = 2
-Missing = 3
-Timeout = 4
-Busy = 5
+Connected = 1
+Error = 2
+Missing = 3
+Timeout = 4
+Busy = 5
+Disconnected = 6
xenbusState = {
'Unknown' : 0,
@@ -185,6 +187,18 @@ class DevController:
(devid, self.deviceClass, err))
+ def waitForDevice_destroy(self, devid, backpath):
+ log.debug("Waiting for %s - destroyDevice.", devid)
+
+ if not self.hotplug:
+ return
+
+ status = self.waitForBackend_destroy(backpath)
+
+ if status == Timeout:
+ raise VmError("Device %s (%s) could not be disconnected. " %
+ (devid, self.deviceClass))
+
def reconfigureDevice(self, devid, config):
"""Reconfigure the specified device.
@@ -209,12 +223,7 @@ class DevController:
here.
"""
- try:
- dev = int(devid)
- except ValueError:
- # Does devid contain devicetype/deviceid?
- # Propogate exception if unable to find an integer devid
- dev = int(type(devid) is str and devid.split('/')[-1] or None)
+ dev = self.convertToDeviceNumber(devid)
# Modify online status /before/ updating state (latter is watched by
# drivers, so this ordering avoids a race).
@@ -283,6 +292,15 @@ class DevController:
all_configs[devid] = config_dict
return all_configs
+
+ def convertToDeviceNumber(self, devid):
+ try:
+ return int(devid)
+ except ValueError:
+ # Does devid contain devicetype/deviceid?
+ # Propogate exception if unable to find an integer devid
+ return int(type(devid) is str and devid.split('/')[-1] or None)
+
## protected:
def getDeviceDetails(self, config):
@@ -511,6 +529,19 @@ class DevController:
return (Missing, None)
+ def waitForBackend_destroy(self, backpath):
+
+ statusPath = backpath + '/' + HOTPLUG_STATUS_NODE
+ ev = Event()
+ result = { 'status': Timeout }
+
+ xswatch(statusPath, deviceDestroyCallback, ev, result)
+
+ ev.wait(DEVICE_DESTROY_TIMEOUT)
+
+ return result['status']
+
+
def backendPath(self, backdom, devid):
"""Construct backend path given the backend domain and device id.
@@ -559,3 +590,19 @@ def hotplugStatusCallback(statusPath, ev
ev.set()
return 0
+
+
+def deviceDestroyCallback(statusPath, ev, result):
+ log.debug("deviceDestroyCallback %s.", statusPath)
+
+ status = xstransact.Read(statusPath)
+
+ if status is None:
+ result['status'] = Disconnected
+ else:
+ return 1
+
+ log.debug("deviceDestroyCallback %d.", result['status'])
+
+ ev.set()
+ return 0
Index: xen-3.1-testing/tools/python/xen/xend/server/blkif.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/server/blkif.py
+++ xen-3.1-testing/tools/python/xen/xend/server/blkif.py
@@ -148,11 +148,23 @@ class BlkifController(DevController):
try:
DevController.destroyDevice(self, devid, force)
except ValueError:
- devid_end = type(devid) is str and devid.split('/')[-1] or None
+ dev = self.convertToDeviceNumber(devid)
for i in self.deviceIDs():
- d = self.readBackend(i, 'dev')
- if d == devid or (devid_end and d == devid_end):
+ if i == dev:
DevController.destroyDevice(self, i, force)
return
raise VmError("Device %s not connected" % devid)
+
+ def convertToDeviceNumber(self, devid):
+ try:
+ dev = int(devid)
+ except ValueError:
+ if type(devid) is not str:
+ raise VmError("devid %s is wrong type" % str(devid))
+ try:
+ dev = devid.split('/')[-1]
+ dev = int(dev)
+ except ValueError:
+ dev = blkif.blkdev_name_to_number(dev)
+ return dev
Index: xen-3.1-testing/tools/python/xen/xm/main.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xm/main.py
+++ xen-3.1-testing/tools/python/xen/xm/main.py
@@ -2129,6 +2129,7 @@ def xm_network_attach(args):
def detach(args, command, deviceClass):
arg_check(args, command, 2, 3)
+ rm_cfg = True
dom = args[0]
dev = args[1]
try:
@@ -2139,7 +2140,7 @@ def detach(args, command, deviceClass):
except IndexError:
force = None
- server.xend.domain.destroyDevice(dom, deviceClass, dev, force)
+ server.xend.domain.destroyDevice(dom, deviceClass, dev, force, rm_cfg)
def xm_block_detach(args):

View File

@ -1,46 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xensource.com>
# Date 1193128003 -3600
# Node ID b28ae5f00553ea053bd4e4576634d8ea49e77bc3
# Parent 118a21c66fd53a08d7191159e5b2888f8d9e4ad2
xenmon: Fix security vulnerability CVE-2007-3919.
The xenbaked daemon and xenmon utility communicate via a mmap'ed
shared file. Since this file is located in /tmp, unprivileged users
can cause arbitrary files to be truncated by creating a symlink from
the well-known /tmp filename to e.g., /etc/passwd.
The fix is to place the shared file in a directory to which only root
should have access (in this case /var/run/).
This bug was reported, and the fix suggested, by Steve Kemp
<skx@debian.org>. Thanks!
Signed-off-by: Keir Fraser <keir@xensource.com>
Index: xen-3.1-testing/tools/xenmon/xenbaked.c
===================================================================
--- xen-3.1-testing.orig/tools/xenmon/xenbaked.c
+++ xen-3.1-testing/tools/xenmon/xenbaked.c
@@ -593,7 +593,7 @@ error_t cmd_parser(int key, char *arg, s
return 0;
}
-#define SHARED_MEM_FILE "/tmp/xenq-shm"
+#define SHARED_MEM_FILE "/var/run/xenq-shm"
void alloc_qos_data(int ncpu)
{
int i, n, pgsize, off=0;
Index: xen-3.1-testing/tools/xenmon/xenmon.py
===================================================================
--- xen-3.1-testing.orig/tools/xenmon/xenmon.py
+++ xen-3.1-testing/tools/xenmon/xenmon.py
@@ -46,7 +46,7 @@ ST_QDATA = "%dQ" % (6*NDOMAINS + 4)
QOS_DATA_SIZE = struct.calcsize(ST_QDATA)*NSAMPLES + struct.calcsize(ST_DOM_INFO)*NDOMAINS + struct.calcsize("4i")
# location of mmaped file, hard coded right now
-SHM_FILE = "/tmp/xenq-shm"
+SHM_FILE = "/var/run/xenq-shm"
# format strings
TOTALS = 15*' ' + "%6.2f%%" + 35*' ' + "%6.2f%%"

View File

@ -1,484 +0,0 @@
Index: 2007-05-14/xen/arch/x86/traps.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/traps.c 2007-05-14 14:39:42.000000000 +0200
+++ 2007-05-14/xen/arch/x86/traps.c 2007-05-14 14:40:03.000000000 +0200
@@ -1091,6 +1091,63 @@ static int read_descriptor(unsigned int
return 1;
}
+#ifdef CONFIG_COMPAT/* XXX __x86_64__ */
+static int read_gate_descriptor(unsigned int gate_sel,
+ const struct vcpu *v,
+ unsigned int *sel,
+ unsigned long *off,
+ unsigned int *ar)
+{
+ struct desc_struct desc;
+ const struct desc_struct *pdesc;
+
+
+ pdesc = (const struct desc_struct *)(!(gate_sel & 4) ?
+ GDT_VIRT_START(v) :
+ LDT_VIRT_START(v))
+ + (gate_sel >> 3);
+ if ( gate_sel < 4 ||
+ (gate_sel >= FIRST_RESERVED_GDT_BYTE && !(gate_sel & 4)) ||
+ __get_user(desc, pdesc) )
+ return 0;
+
+ *sel = (desc.a >> 16) & 0x0000fffc;
+ *off = (desc.a & 0x0000ffff) | (desc.b & 0xffff0000);
+ *ar = desc.b & 0x0000ffff;
+ /*
+ * check_descriptor() clears the DPL field and stores the
+ * guest requested DPL in the selector's RPL field.
+ */
+ ASSERT(!(*ar & _SEGMENT_DPL));
+ *ar |= (desc.a >> (16 - 13)) & _SEGMENT_DPL;
+
+ if ( !is_pv_32on64_vcpu(v) )
+ {
+ if ( (*ar & 0x1f00) != 0x0c00 ||
+ (gate_sel >= FIRST_RESERVED_GDT_BYTE - 8 && !(gate_sel & 4)) ||
+ __get_user(desc, pdesc + 1) ||
+ (desc.b & 0x1f00) )
+ return 0;
+
+ *off |= (unsigned long)desc.a << 32;
+ return 1;
+ }
+
+ switch ( *ar & 0x1f00 )
+ {
+ case 0x0400:
+ *off &= 0xffff;
+ break;
+ case 0x0c00:
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+#endif
+
/* Has the guest requested sufficient permission for this I/O access? */
static inline int guest_io_okay(
unsigned int port, unsigned int bytes,
@@ -1158,6 +1215,8 @@ unsigned long guest_to_host_gpr_switch(u
#define insn_fetch(type, base, eip, limit) \
({ unsigned long _rc, _ptr = (base) + (eip); \
type _x; \
+ if ( ad_default < 8 ) \
+ _ptr = (unsigned int)_ptr; \
if ( (limit) < sizeof(_x) - 1 || (eip) > (limit) - (sizeof(_x) - 1) ) \
goto fail; \
if ( (_rc = copy_from_user(&_x, (type *)_ptr, sizeof(_x))) != 0 ) \
@@ -1760,6 +1819,336 @@ static int emulate_privileged_op(struct
return 0;
}
+static inline int check_stack_limit(unsigned int ar, unsigned int limit,
+ unsigned int esp, unsigned int decr)
+{
+ return esp - decr < esp - 1 &&
+ (!(ar & _SEGMENT_EC) ? esp - 1 <= limit : esp - decr > limit);
+}
+
+static int emulate_gate_op(struct cpu_user_regs *regs)
+{
+#ifdef CONFIG_COMPAT/* XXX __x86_64__ */
+ struct vcpu *v = current;
+ unsigned int sel, ar, dpl, nparm, opnd_sel;
+ unsigned int op_default, op_bytes, ad_default, ad_bytes;
+ unsigned long off, eip, opnd_off, base, limit;
+ int jump;
+
+ /* Check whether this fault is due to the use of a call gate. */
+ if ( !read_gate_descriptor(regs->error_code, v, &sel, &off, &ar) ||
+ ((ar >> 13) & 3) < (regs->cs & 3) ||
+ (ar & _SEGMENT_TYPE) != 0xc00 )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ if ( !(ar & _SEGMENT_P) )
+ return do_guest_trap(TRAP_no_segment, regs, 1);
+ dpl = (ar >> 13) & 3;
+ nparm = ar & 0x1f;
+
+ /*
+ * Decode instruction (and perhaps operand) to determine RPL,
+ * whether this is a jump or a call, and the call return offset.
+ */
+ if ( !read_descriptor(regs->cs, v, regs, &base, &limit, &ar, 0) ||
+ !(ar & _SEGMENT_S) ||
+ !(ar & _SEGMENT_P) ||
+ !(ar & _SEGMENT_CODE) )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+
+ op_bytes = op_default = ar & _SEGMENT_DB ? 4 : 2;
+ ad_default = ad_bytes = op_default;
+ opnd_sel = opnd_off = 0;
+ jump = -1;
+ for ( eip = regs->eip; eip - regs->_eip < 10; )
+ {
+ switch ( insn_fetch(u8, base, eip, limit) )
+ {
+ case 0x66: /* operand-size override */
+ op_bytes = op_default ^ 6; /* switch between 2/4 bytes */
+ continue;
+ case 0x67: /* address-size override */
+ ad_bytes = ad_default != 4 ? 4 : 2; /* switch to 2/4 bytes */
+ continue;
+ case 0x2e: /* CS override */
+ opnd_sel = regs->cs;
+ ASSERT(opnd_sel);
+ continue;
+ case 0x3e: /* DS override */
+ opnd_sel = read_sreg(regs, ds);
+ if ( !opnd_sel )
+ opnd_sel = dpl;
+ continue;
+ case 0x26: /* ES override */
+ opnd_sel = read_sreg(regs, es);
+ if ( !opnd_sel )
+ opnd_sel = dpl;
+ continue;
+ case 0x64: /* FS override */
+ opnd_sel = read_sreg(regs, fs);
+ if ( !opnd_sel )
+ opnd_sel = dpl;
+ continue;
+ case 0x65: /* GS override */
+ opnd_sel = read_sreg(regs, gs);
+ if ( !opnd_sel )
+ opnd_sel = dpl;
+ continue;
+ case 0x36: /* SS override */
+ opnd_sel = regs->ss;
+ if ( !opnd_sel )
+ opnd_sel = dpl;
+ continue;
+ case 0xea:
+ ++jump;
+ /* FALLTHROUGH */
+ case 0x9a:
+ ++jump;
+ opnd_sel = regs->cs;
+ opnd_off = eip;
+ ad_bytes = ad_default;
+ eip += op_bytes + 2;
+ break;
+ case 0xff:
+ {
+ unsigned int modrm;
+
+ switch ( (modrm = insn_fetch(u8, base, eip, limit)) & 0xf8 )
+ {
+ case 0x28: case 0x68: case 0xa8:
+ ++jump;
+ /* FALLTHROUGH */
+ case 0x18: case 0x58: case 0x98:
+ ++jump;
+ if ( ad_bytes != 2 )
+ {
+ if ( (modrm & 7) == 4 )
+ {
+ unsigned int sib = insn_fetch(u8, base, eip, limit);
+
+ modrm = (modrm & ~7) | (sib & 7);
+ if ( (sib >>= 3) != 4 )
+ opnd_off = *(unsigned long *)decode_register(sib & 7, regs, 0);
+ opnd_off <<= sib >> 3;
+ }
+ if ( (modrm & 7) != 5 || (modrm & 0xc0) )
+ opnd_off += *(unsigned long *)decode_register(modrm & 7, regs, 0);
+ else
+ modrm |= 0x87;
+ if ( !opnd_sel )
+ {
+ switch ( modrm & 7 )
+ {
+ default:
+ opnd_sel = read_sreg(regs, ds);
+ break;
+ case 4: case 5:
+ opnd_sel = regs->ss;
+ break;
+ }
+ }
+ }
+ else
+ {
+ switch ( modrm & 7 )
+ {
+ case 0: case 1: case 7:
+ opnd_off = regs->ebx;
+ break;
+ case 6:
+ if ( !(modrm & 0xc0) )
+ modrm |= 0x80;
+ else
+ case 2: case 3:
+ {
+ opnd_off = regs->ebp;
+ if ( !opnd_sel )
+ opnd_sel = regs->ss;
+ }
+ break;
+ }
+ if ( !opnd_sel )
+ opnd_sel = read_sreg(regs, ds);
+ switch ( modrm & 7 )
+ {
+ case 0: case 2: case 4:
+ opnd_off += regs->esi;
+ break;
+ case 1: case 3: case 5:
+ opnd_off += regs->edi;
+ break;
+ }
+ }
+ switch ( modrm & 0xc0 )
+ {
+ case 0x40:
+ opnd_off += insn_fetch(s8, base, eip, limit);
+ break;
+ case 0x80:
+ opnd_off += insn_fetch(s32, base, eip, limit);
+ break;
+ }
+ if ( ad_bytes == 4 )
+ opnd_off = (unsigned int)opnd_off;
+ else if ( ad_bytes == 2 )
+ opnd_off = (unsigned short)opnd_off;
+ break;
+ }
+ }
+ break;
+ }
+ break;
+ }
+
+ if ( jump < 0 )
+ {
+ fail:
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ }
+
+ if ( (opnd_sel != regs->cs &&
+ !read_descriptor(opnd_sel, v, regs, &base, &limit, &ar, 0)) ||
+ !(ar & _SEGMENT_S) ||
+ !(ar & _SEGMENT_P) ||
+ ((ar & _SEGMENT_CODE) && !(ar & _SEGMENT_WR)) )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+
+ opnd_off += op_bytes;
+#define ad_default ad_bytes
+ opnd_sel = insn_fetch(u16, base, opnd_off, limit);
+#undef ad_default
+ ASSERT((opnd_sel & ~3) == regs->error_code);
+ if ( dpl < (opnd_sel & 3) )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+
+ if ( !read_descriptor(sel, v, regs, &base, &limit, &ar, 0) ||
+ !(ar & _SEGMENT_S) ||
+ !(ar & _SEGMENT_CODE) ||
+ (!jump || (ar & _SEGMENT_EC) ?
+ ((ar >> 13) & 3) > (regs->cs & 3) :
+ ((ar >> 13) & 3) != (regs->cs & 3)) )
+ {
+ regs->error_code = sel;
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ }
+ if ( !(ar & _SEGMENT_P) )
+ {
+ regs->error_code = sel;
+ return do_guest_trap(TRAP_no_segment, regs, 1);
+ }
+ if ( off > limit )
+ {
+ regs->error_code = 0;
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ }
+
+ if ( !jump )
+ {
+ unsigned int ss, esp, *stkp;
+ int rc;
+#define push(item) do \
+ { \
+ --stkp; \
+ esp -= 4; \
+ rc = __put_user(item, stkp); \
+ if ( rc ) \
+ { \
+ propagate_page_fault((unsigned long)(stkp + 1) - rc, \
+ PFEC_write_access); \
+ return 0; \
+ } \
+ } while ( 0 )
+
+ if ( ((ar >> 13) & 3) < (regs->cs & 3) )
+ {
+ sel |= (ar >> 13) & 3;
+ /* Inner stack known only for kernel ring. */
+ if ( (sel & 3) != GUEST_KERNEL_RPL(v->domain) )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ esp = v->arch.guest_context.kernel_sp;
+ ss = v->arch.guest_context.kernel_ss;
+ if ( (ss & 3) != (sel & 3) ||
+ !read_descriptor(ss, v, regs, &base, &limit, &ar, 0) ||
+ ((ar >> 13) & 3) != (sel & 3) ||
+ !(ar & _SEGMENT_S) ||
+ (ar & _SEGMENT_CODE) ||
+ !(ar & _SEGMENT_WR) )
+ {
+ regs->error_code = ss & ~3;
+ return do_guest_trap(TRAP_invalid_tss, regs, 1);
+ }
+ if ( !(ar & _SEGMENT_P) ||
+ !check_stack_limit(ar, limit, esp, (4 + nparm) * 4) )
+ {
+ regs->error_code = ss & ~3;
+ return do_guest_trap(TRAP_stack_error, regs, 1);
+ }
+ stkp = (unsigned int *)(unsigned long)((unsigned int)base + esp);
+ if ( !compat_access_ok(stkp - 4 - nparm, (4 + nparm) * 4) )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ push(regs->ss);
+ push(regs->esp);
+ if ( nparm )
+ {
+ const unsigned int *ustkp;
+
+ if ( !read_descriptor(regs->ss, v, regs, &base, &limit, &ar, 0) ||
+ ((ar >> 13) & 3) != (regs->cs & 3) ||
+ !(ar & _SEGMENT_S) ||
+ (ar & _SEGMENT_CODE) ||
+ !(ar & _SEGMENT_WR) ||
+ !check_stack_limit(ar, limit, esp + nparm * 4, nparm * 4) )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ ustkp = (unsigned int *)(unsigned long)((unsigned int)base + regs->_esp + nparm * 4);
+ if ( !compat_access_ok(ustkp - nparm, nparm * 4) )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ do
+ {
+ unsigned int parm;
+
+ --ustkp;
+ rc = __get_user(parm, ustkp);
+ if ( rc )
+ {
+ propagate_page_fault((unsigned long)(ustkp + 1) - rc, 0);
+ return 0;
+ }
+ push(parm);
+ } while ( --nparm );
+ }
+ }
+ else
+ {
+ sel |= (regs->cs & 3);
+ esp = regs->esp;
+ ss = regs->ss;
+ if ( !read_descriptor(ss, v, regs, &base, &limit, &ar, 0) ||
+ ((ar >> 13) & 3) != (sel & 3) )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ if ( !check_stack_limit(ar, limit, esp, 2 * 4) )
+ {
+ regs->error_code = 0;
+ return do_guest_trap(TRAP_stack_error, regs, 1);
+ }
+ stkp = (unsigned int *)(unsigned long)((unsigned int)base + esp);
+ if ( !compat_access_ok(stkp - 2, 2 * 4) )
+ return do_guest_trap(TRAP_gp_fault, regs, 1);
+ }
+ push(regs->cs);
+ push(eip);
+#undef push
+ regs->esp = esp;
+ regs->ss = ss;
+ }
+ else
+ sel |= (regs->cs & 3);
+
+ regs->eip = off;
+ regs->cs = sel;
+#endif
+
+ return 0;
+}
+
asmlinkage int do_general_protection(struct cpu_user_regs *regs)
{
struct vcpu *v = current;
@@ -1805,6 +2194,8 @@ asmlinkage int do_general_protection(str
return do_guest_trap(vector, regs, 0);
}
}
+ else if ( is_pv_32on64_vcpu(v) && regs->error_code )
+ return emulate_gate_op(regs);
/* Emulate some simple privileged and I/O instructions. */
if ( (regs->error_code == 0) &&
Index: 2007-05-14/xen/arch/x86/x86_64/mm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/x86_64/mm.c 2007-05-03 09:45:09.000000000 +0200
+++ 2007-05-14/xen/arch/x86/x86_64/mm.c 2007-05-14 14:40:03.000000000 +0200
@@ -372,14 +372,16 @@ int check_descriptor(const struct domain
{
u32 a = d->a, b = d->b;
u16 cs;
+ unsigned int dpl;
/* A not-present descriptor will always fault, so is safe. */
if ( !(b & _SEGMENT_P) )
goto good;
/* Check and fix up the DPL. */
- if ( (b & _SEGMENT_DPL) < (GUEST_KERNEL_RPL(dom) << 13) )
- d->b = b = (b & ~_SEGMENT_DPL) | (GUEST_KERNEL_RPL(dom) << 13);
+ dpl = (b >> 13) & 3;
+ __fixup_guest_selector(dom, dpl);
+ b = (b & ~_SEGMENT_DPL) | (dpl << 13);
/* All code and data segments are okay. No base/limit checking. */
if ( (b & _SEGMENT_S) )
@@ -397,18 +399,33 @@ int check_descriptor(const struct domain
if ( (b & _SEGMENT_TYPE) != 0xc00 )
goto bad;
- /* Validate and fix up the target code selector. */
+ /* Validate the target code selector. */
cs = a >> 16;
- fixup_guest_code_selector(dom, cs);
if ( !guest_gate_selector_okay(dom, cs) )
goto bad;
- a = d->a = (d->a & 0xffffU) | (cs << 16);
+#ifdef __x86_64__
+ /*
+ * Force DPL to zero, causing a GP fault with its error code indicating
+ * the gate in use, allowing emulation. This is necessary because with
+ * native guests (kernel in ring 3) call gates cannot be used directly
+ * to transition from user to kernel mode (and whether a gate is used
+ * to enter the kernel can only be determined when the gate is being
+ * used), and with compat guests call gates cannot be used at all as
+ * there are only 64-bit ones.
+ * Store the original DPL in the selector's RPL field.
+ */
+ b &= ~_SEGMENT_DPL;
+ cs = (cs & ~3) | dpl;
+#endif
+ a = (a & 0xffffU) | (cs << 16);
/* Reserved bits must be zero. */
- if ( (b & 0xe0) != 0 )
+ if ( b & (CONFIG_PAGING_LEVELS < 4 || is_pv_32on64_domain(dom) ? 0xe0 : 0xff) )
goto bad;
good:
+ d->a = a;
+ d->b = b;
return 1;
bad:
return 0;

View File

@ -1,13 +0,0 @@
Index: 2007-04-27/xen/arch/x86/traps.c
===================================================================
--- 2007-04-27.orig/xen/arch/x86/traps.c 2007-04-27 11:02:48.000000000 +0200
+++ 2007-04-27/xen/arch/x86/traps.c 2007-05-09 17:56:43.000000000 +0200
@@ -594,6 +594,8 @@ static int emulate_forced_invalid_op(str
else if ( regs->eax == 0x80000001 )
{
/* Modify Feature Information. */
+ if ( is_pv_32on64_vcpu(current) )
+ clear_bit(X86_FEATURE_SYSCALL % 32, &d);
clear_bit(X86_FEATURE_RDTSCP % 32, &d);
}
else

View File

@ -1,8 +1,8 @@
Index: xen-3.0.4-testing/tools/python/xen/xend/XendDomainInfo.py
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.0.4-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1431,7 +1431,7 @@ class XendDomainInfo:
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1753,7 +1753,7 @@ class XendDomainInfo:
xc.domain_setmaxmem(self.domid, maxmem)
# Make sure there's enough RAM available for the domain

View File

@ -1,119 +0,0 @@
Index: 2007-04-27/tools/ioemu/target-i386-dm/helper2.c
===================================================================
--- 2007-04-27.orig/tools/ioemu/target-i386-dm/helper2.c 2007-04-23 12:41:32.000000000 +0200
+++ 2007-04-27/tools/ioemu/target-i386-dm/helper2.c 2007-05-09 17:58:07.000000000 +0200
@@ -322,7 +322,7 @@ void cpu_ioreq_pio(CPUState *env, ioreq_
do_outp(env, req->addr, req->size, req->data);
} else {
for (i = 0; i < req->count; i++) {
- unsigned long tmp;
+ unsigned long tmp = 0;
read_physical((target_phys_addr_t) req->data
+ (sign * i * req->size),
@@ -354,7 +354,7 @@ void cpu_ioreq_move(CPUState *env, ioreq
}
}
} else {
- unsigned long tmp;
+ target_ulong tmp;
if (req->dir == IOREQ_READ) {
for (i = 0; i < req->count; i++) {
@@ -380,14 +380,14 @@ void cpu_ioreq_move(CPUState *env, ioreq
void cpu_ioreq_and(CPUState *env, ioreq_t *req)
{
- unsigned long tmp1, tmp2;
+ target_ulong tmp1, tmp2;
if (req->data_is_ptr != 0)
hw_error("expected scalar value");
read_physical(req->addr, req->size, &tmp1);
if (req->dir == IOREQ_WRITE) {
- tmp2 = tmp1 & (unsigned long) req->data;
+ tmp2 = tmp1 & (target_ulong) req->data;
write_physical(req->addr, req->size, &tmp2);
}
req->data = tmp1;
@@ -395,14 +395,14 @@ void cpu_ioreq_and(CPUState *env, ioreq_
void cpu_ioreq_add(CPUState *env, ioreq_t *req)
{
- unsigned long tmp1, tmp2;
+ target_ulong tmp1, tmp2;
if (req->data_is_ptr != 0)
hw_error("expected scalar value");
read_physical(req->addr, req->size, &tmp1);
if (req->dir == IOREQ_WRITE) {
- tmp2 = tmp1 + (unsigned long) req->data;
+ tmp2 = tmp1 + (target_ulong) req->data;
write_physical(req->addr, req->size, &tmp2);
}
req->data = tmp1;
@@ -410,14 +410,14 @@ void cpu_ioreq_add(CPUState *env, ioreq_
void cpu_ioreq_sub(CPUState *env, ioreq_t *req)
{
- unsigned long tmp1, tmp2;
+ target_ulong tmp1, tmp2;
if (req->data_is_ptr != 0)
hw_error("expected scalar value");
read_physical(req->addr, req->size, &tmp1);
if (req->dir == IOREQ_WRITE) {
- tmp2 = tmp1 - (unsigned long) req->data;
+ tmp2 = tmp1 - (target_ulong) req->data;
write_physical(req->addr, req->size, &tmp2);
}
req->data = tmp1;
@@ -425,14 +425,14 @@ void cpu_ioreq_sub(CPUState *env, ioreq_
void cpu_ioreq_or(CPUState *env, ioreq_t *req)
{
- unsigned long tmp1, tmp2;
+ target_ulong tmp1, tmp2;
if (req->data_is_ptr != 0)
hw_error("expected scalar value");
read_physical(req->addr, req->size, &tmp1);
if (req->dir == IOREQ_WRITE) {
- tmp2 = tmp1 | (unsigned long) req->data;
+ tmp2 = tmp1 | (target_ulong) req->data;
write_physical(req->addr, req->size, &tmp2);
}
req->data = tmp1;
@@ -440,14 +440,14 @@ void cpu_ioreq_or(CPUState *env, ioreq_t
void cpu_ioreq_xor(CPUState *env, ioreq_t *req)
{
- unsigned long tmp1, tmp2;
+ target_ulong tmp1, tmp2;
if (req->data_is_ptr != 0)
hw_error("expected scalar value");
read_physical(req->addr, req->size, &tmp1);
if (req->dir == IOREQ_WRITE) {
- tmp2 = tmp1 ^ (unsigned long) req->data;
+ tmp2 = tmp1 ^ (target_ulong) req->data;
write_physical(req->addr, req->size, &tmp2);
}
req->data = tmp1;
@@ -495,8 +495,9 @@ void cpu_ioreq_xchg(CPUState *env, ioreq
void __handle_ioreq(CPUState *env, ioreq_t *req)
{
- if (!req->data_is_ptr && req->dir == IOREQ_WRITE && req->size != 4)
- req->data &= (1UL << (8 * req->size)) - 1;
+ if (!req->data_is_ptr && req->dir == IOREQ_WRITE &&
+ req->size < sizeof(target_ulong))
+ req->data &= ((target_ulong)1 << (8 * req->size)) - 1;
switch (req->type) {
case IOREQ_TYPE_PIO:

View File

@ -1,11 +1,11 @@
bug #239173
bug #242953
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1833,7 +1833,7 @@ class XendDomainInfo:
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2060,7 +2060,7 @@ class XendDomainInfo:
(fn, BOOTLOADER_LOOPBACK_DEVICE))
vbd = {
@ -14,19 +14,19 @@ Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
'device': BOOTLOADER_LOOPBACK_DEVICE,
}
Index: xen-3.1-testing/tools/ioemu/xenstore.c
Index: xen-3.2-testing/tools/ioemu/xenstore.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/xenstore.c
+++ xen-3.1-testing/tools/ioemu/xenstore.c
--- xen-3.2-testing.orig/tools/ioemu/xenstore.c
+++ xen-3.2-testing/tools/ioemu/xenstore.c
@@ -81,9 +81,9 @@ void xenstore_parse_domain_config(int do
{
char **e = NULL;
char *buf = NULL, *path;
- char *fpath = NULL, *bpath = NULL,
+ char *fpath = NULL, *bpath = NULL, *btype = NULL,
*dev = NULL, *params = NULL, *type = NULL, *media_present = NULL;
- int i, is_scsi;
+ int i, is_scsi, is_tap;
*dev = NULL, *params = NULL, *type = NULL, *drv = NULL;
- int i, is_scsi, is_hdN = 0;
+ int i, is_scsi, is_tap, is_hdN = 0;
unsigned int len, num, hd_index;
for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++)
@ -45,36 +45,7 @@ Index: xen-3.1-testing/tools/ioemu/xenstore.c
/* read the name of the device */
if (pasprintf(&buf, "%s/dev", bpath) == -1)
continue;
@@ -123,6 +131,13 @@ void xenstore_parse_domain_config(int do
dev = xs_read(xsh, XBT_NULL, buf, &len);
if (dev == NULL)
continue;
+ /* Force xvdN to look like hdN */
+ if (is_tap && !strncmp(dev, "xvd", 3)) {
+ memmove(dev, dev+1, strlen(dev));
+ dev[0] = 'h';
+ dev[1] = 'd';
+ fprintf(stderr, "Got blktap '%s'\n", dev);
+ }
is_scsi = !strncmp(dev, "sd", 2);
if ((strncmp(dev, "hd", 2) && !is_scsi) || strlen(dev) != 3 )
continue;
@@ -140,6 +155,14 @@ void xenstore_parse_domain_config(int do
params = xs_read(xsh, XBT_NULL, buf, &len);
if (params == NULL)
continue;
+ /* Strip off blktap sub-type prefix aio: etc */
+ if (is_tap) {
+ char *offset = strchr(params, ':');
+ if (!offset)
+ continue;
+ memmove(params, offset+1, strlen(offset+1)+1);
+ fprintf(stderr, "Got params '%s'\n", params);
+ }
/*
* check if device has a phantom vbd; the phantom is hooked
* to the frontend device (for ease of cleanup), so lookup
@@ -196,6 +219,7 @@ void xenstore_parse_domain_config(int do
@@ -243,6 +251,7 @@ void xenstore_parse_domain_config(int do
free(type);
free(params);
free(dev);

View File

@ -1,8 +1,8 @@
Index: xen-unstable/tools/examples/block
Index: xen-3.2-testing/tools/examples/block
===================================================================
--- xen-unstable.orig/tools/examples/block
+++ xen-unstable/tools/examples/block
@@ -259,10 +259,13 @@ case "$command" in
--- xen-3.2-testing.orig/tools/examples/block
+++ xen-3.2-testing/tools/examples/block
@@ -217,11 +217,14 @@ case "$command" in
;;
file)
@ -11,18 +11,20 @@ Index: xen-unstable/tools/examples/block
# Canonicalise the file, for sharing check comparison, and the mode
# for ease of use here.
file=$(readlink -f "$p") || fatal "$p does not exist."
test -f "$file" || fatal "$file does not exist."
mode=$(canonicalise_mode "$mode")
+ [ "$mode" = "r" ] && lo_flags="$lo_flags -r"
claim_lock "block"
@@ -370,11 +373,11 @@ mount it read-write in a guest domain."
fatal 'Failed to find an unused loop device'
fi
@@ -330,12 +333,12 @@ mount it read-write in a guest domain."
fatal 'Failed to find an unused loop device'
fi
- losetup "$loopdev" "$file" && losetup_failure="" && break
+ losetup $lo_flags "$loopdev" "$file" && losetup_failure="" && break
- losetup "$loopdev" "$file" && losetup_failure="" && break
+ losetup $lo_flags "$loopdev" "$file" && losetup_failure="" && break
done
if [ "$losetup_failure" ]
then
- fatal 'losetup $loopdev $file'

View File

@ -1,8 +1,8 @@
Index: xen-unstable/tools/examples/block
Index: xen-3.2-testing/tools/examples/block
===================================================================
--- xen-unstable.orig/tools/examples/block
+++ xen-unstable/tools/examples/block
@@ -274,9 +274,12 @@ case "$command" in
--- xen-3.2-testing.orig/tools/examples/block
+++ xen-3.2-testing/tools/examples/block
@@ -233,107 +233,111 @@ case "$command" in
mount it read-write in a guest domain."
fi
@ -11,38 +11,184 @@ Index: xen-unstable/tools/examples/block
+ losetup_failure=1
+ for do_losetup in 1 2 3
do
+ loopdev=''
+ for dev in /dev/loop*
+ do
if [ ! -b "$dev" ]
then
continue
@@ -360,14 +363,20 @@ mount it read-write in a guest domain."
loopdev="$dev"
- if [ ! -b "$dev" ]
- then
- continue
- fi
-
- f=$(losetup "$dev" 2>/dev/null) || f=''
-
- if [ "$f" ]
- then
- # $dev is in use. Check sharing.
- if [ "x$mode" = 'x!' ]
+ loopdev=''
+ for dev in /dev/loop*
+ do
+ if [ ! -b "$dev" ]
then
continue
fi
fi
- done
+ done
- f=$(echo "$f" | sed -e 's/.*(\(.*\)).*/\1/g')
+ f=$(losetup "$dev" 2>/dev/null) || f=''
- # $f is the filename, as read from losetup, but the loopback
- # driver truncates filenames at 64 characters, so we need to go
- # trawling through the store if it's longer than that. Truncation
- # is indicated by an asterisk at the end of the filename.
- if expr index "$f" '*' >/dev/null
+ if [ "$f" ]
then
- found=""
- for dom in $(xenstore-list "$XENBUS_BASE_PATH")
- do
- for domdev in $(xenstore-list "$XENBUS_BASE_PATH/$dom")
+ # $dev is in use. Check sharing.
+ if [ "x$mode" = 'x!' ]
+ then
+ continue
+ fi
+
+ if [ "$loopdev" = '' ]
+ then
+ fatal 'Failed to find an unused loop device'
+ fi
+ f=$(echo "$f" | sed -e 's/.*(\(.*\)).*/\1/g')
+
+ # $f is the filename, as read from losetup, but the loopback
+ # driver truncates filenames at 64 characters, so we need to go
+ # trawling through the store if it's longer than that. Truncation
+ # is indicated by an asterisk at the end of the filename.
+ if expr index "$f" '*' >/dev/null
+ then
+ found=""
+ for dom in $(xenstore-list "$XENBUS_BASE_PATH")
do
- d=$(xenstore_read_default \
- "$XENBUS_BASE_PATH/$dom/$domdev/node" "")
- if [ "$d" = "$dev" ]
- then
- f=$(xenstore_read "$XENBUS_BASE_PATH/$dom/$domdev/params")
- found=1
- break 2
- fi
+ for domdev in $(xenstore-list "$XENBUS_BASE_PATH/$dom")
+ do
+ d=$(xenstore_read_default \
+ "$XENBUS_BASE_PATH/$dom/$domdev/node" "")
+ if [ "$d" = "$dev" ]
+ then
+ f=$(xenstore_read "$XENBUS_BASE_PATH/$dom/$domdev/params")
+ found=1
+ break 2
+ fi
+ done
done
- done
- if [ ! "$found" ]
- then
- # This loopback device is in use by someone else, so skip it.
- log debug "Loopback sharing check skips device $dev."
- continue
+ if [ ! "$found" ]
+ then
+ # This loopback device is in use by someone else, so skip it.
+ log debug "Loopback sharing check skips device $dev."
+ continue
+ fi
fi
- fi
- # Canonicalise the filename for the comparison.
+ # Canonicalise the filename for the comparison.
- # I have seen this readlink fails because the filename given by
- # losetup is only the basename. This cannot happen when the loop
- # device is set up through this script, because file is
- # canonicalised above, but it may happen when loop devices are set
- # up some other way. This readlink may also conceivably fail if
- # the file backing this loop device has been removed.
+ # I have seen this readlink fails because the filename given by
+ # losetup is only the basename. This cannot happen when the loop
+ # device is set up through this script, because file is
+ # canonicalised above, but it may happen when loop devices are set
+ # up some other way. This readlink may also conceivably fail if
+ # the file backing this loop device has been removed.
- # For maximum safety, in the case that $f does not resolve, we
- # assume that $file and $f are in the same directory.
+ # For maximum safety, in the case that $f does not resolve, we
+ # assume that $file and $f are in the same directory.
- # If you create a loopback filesystem, remove it and continue to
- # run on it, and then create another file with the same name, then
- # this check will block that -- don't do that.
+ # If you create a loopback filesystem, remove it and continue to
+ # run on it, and then create another file with the same name, then
+ # this check will block that -- don't do that.
- # If you create loop devices through some other mechanism, use
- # relative filenames, and then use the same filename through this
- # script, then this check will block that -- don't do that either.
+ # If you create loop devices through some other mechanism, use
+ # relative filenames, and then use the same filename through this
+ # script, then this check will block that -- don't do that either.
- f=$(readlink -f "$f" || echo $(dirname "$file")/$(basename "$f"))
+ f=$(readlink -f "$f" || echo $(dirname "$file")/$(basename "$f"))
- if [ "$f" = "$file" ]
- then
- check_file_sharing "$file" "$dev" "$mode"
- fi
- else
- # $dev is not in use, so we'll remember it for use later; we want
- # to finish the sharing check first.
+ if [ "$f" = "$file" ]
+ then
+ check_file_sharing "$file" "$dev" "$mode"
+ fi
+ else
+ # $dev is not in use, so we'll remember it for use later; we want
+ # to finish the sharing check first.
- if [ "$loopdev" = '' ]
- then
- loopdev="$dev"
+ if [ "$loopdev" = '' ]
+ then
+ loopdev="$dev"
+ fi
fi
+ done
+
+ if [ "$loopdev" = '' ]
+ then
+ release_lock "block"
+ fatal 'Failed to find an unused loop device'
fi
+
+ losetup "$loopdev" "$file" && losetup_failure="" && break
done
- if [ "$loopdev" = '' ]
+ losetup "$loopdev" "$file" && losetup_failure="" && break
+ done
+ if [ "$losetup_failure" ]
then
- release_lock "block"
- fatal 'Failed to find an unused loop device'
+ fatal 'losetup $loopdev $file'
fi
- do_or_die losetup "$loopdev" "$file"
- if LANG=C losetup -h 2>&1 | grep read-only >/dev/null
- then
- roflag="-$mode"; roflag="${roflag#-w}"
- else
- roflag=''
- fi
- do_or_die losetup $roflag "$loopdev" "$file"
xenstore_write "$XENBUS_PATH/node" "$loopdev"
write_dev "$loopdev"
release_lock "block"
@@ -390,8 +399,18 @@ mount it read-write in a guest domain."
@@ -356,8 +360,18 @@ mount it read-write in a guest domain."
file)
node=$(xenstore_read "$XENBUS_PATH/node")

View File

@ -13,10 +13,10 @@ Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
tools/Makefile | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
Index: xen-3.1-testing/config/x86_32.mk
Index: xen-3.2-testing/config/x86_32.mk
===================================================================
--- xen-3.1-testing.orig/config/x86_32.mk
+++ xen-3.1-testing/config/x86_32.mk
--- xen-3.2-testing.orig/config/x86_32.mk
+++ xen-3.2-testing/config/x86_32.mk
@@ -7,8 +7,10 @@ CONFIG_MIGRATE := y
CONFIG_XCUTILS := y
CONFIG_IOEMU := y
@ -29,12 +29,12 @@ Index: xen-3.1-testing/config/x86_32.mk
+LIBDIR := lib
# Use only if calling $(LD) directly.
ifeq ($(XEN_OS),OpenBSD)
Index: xen-3.1-testing/tools/Makefile
LDFLAGS_DIRECT_OpenBSD = _obsd
Index: xen-3.2-testing/tools/Makefile
===================================================================
--- xen-3.1-testing.orig/tools/Makefile
+++ xen-3.1-testing/tools/Makefile
@@ -62,7 +62,7 @@ check_clean:
--- xen-3.2-testing.orig/tools/Makefile
+++ xen-3.2-testing/tools/Makefile
@@ -63,7 +63,7 @@ check_clean:
$(MAKE) -C check clean
.PHONY: ioemu ioemuinstall ioemuclean

View File

@ -1,160 +0,0 @@
Index: 2007-05-14/xen/arch/x86/dmi_scan.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/dmi_scan.c 2007-08-17 17:13:44.000000000 +0200
+++ 2007-05-14/xen/arch/x86/dmi_scan.c 2007-08-16 16:44:35.000000000 +0200
@@ -102,7 +102,7 @@ inline static int __init dmi_checksum(u8
return (sum==0);
}
-static int __init dmi_iterate(void (*decode)(struct dmi_header *))
+static int __init dmi_iterate(void (*decode)(struct dmi_header *), u32 *pbase)
{
u8 buf[15];
char __iomem *p, *q;
@@ -123,6 +123,11 @@ static int __init dmi_iterate(void (*dec
u16 len=buf[7]<<8|buf[6];
u32 base=buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8];
+ if (pbase)
+ *pbase = base;
+ if (!decode)
+ return len;
+
/*
* DMI version 0.0 means that the real version is taken from
* the SMBIOS version, which we don't know at this point.
@@ -436,13 +441,27 @@ static void __init dmi_decode(struct dmi
void __init dmi_scan_machine(void)
{
- int err = dmi_iterate(dmi_decode);
+ int err = dmi_iterate(dmi_decode, NULL);
if(err == 0)
dmi_check_system(dmi_blacklist);
else
printk(KERN_INFO "DMI not present.\n");
}
+int __init dmi_get_table(u32*pbase, u32*plen)
+{
+ int rc = dmi_iterate(NULL, pbase);
+
+ if (rc < 0) {
+ *pbase = *plen = 0;
+ return rc;
+ }
+
+ *plen = rc;
+
+ return 0;
+}
+
/**
* dmi_check_system - check system DMI data
Index: 2007-05-14/xen/arch/x86/setup.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/setup.c 2007-08-17 17:13:44.000000000 +0200
+++ 2007-05-14/xen/arch/x86/setup.c 2007-08-20 11:59:15.000000000 +0200
@@ -35,6 +35,7 @@
#include <xen/kexec.h>
extern void dmi_scan_machine(void);
+extern int dmi_get_table(u32 *pbase, u32 *plen);
extern void generic_apic_probe(void);
extern void numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn);
@@ -301,8 +302,9 @@ void __init __start_xen(multiboot_info_t
unsigned long _policy_len = 0;
module_t *mod = (module_t *)__va(mbi->mods_addr);
unsigned long nr_pages, modules_length;
- paddr_t s, e;
+ u64 s, e;
int i, e820_warn = 0, e820_raw_nr = 0, bytes = 0;
+ u32 dmi_table_start, dmi_table_len;
struct ns16550_defaults ns16550 = {
.data_bits = 8,
.parity = 'n',
@@ -361,7 +363,7 @@ void __init __start_xen(multiboot_info_t
if ( mbi->flags & MBI_MEMMAP )
{
- while ( bytes < mbi->mmap_length )
+ while ( bytes < mbi->mmap_length && e820_raw_nr < E820MAX )
{
memory_map_t *map = __va(mbi->mmap_addr + bytes);
@@ -411,15 +413,52 @@ void __init __start_xen(multiboot_info_t
printk("WARNING: Buggy e820 map detected and fixed "
"(truncated length fields).\n");
+ dmi_get_table(&dmi_table_start, &dmi_table_len);
+ e820_warn = 0;
+
/* Ensure that all E820 RAM regions are page-aligned and -sized. */
for ( i = 0; i < e820_raw_nr; i++ )
{
- uint64_t s, e;
if ( e820_raw[i].type != E820_RAM )
continue;
s = PFN_UP(e820_raw[i].addr);
e = PFN_DOWN(e820_raw[i].addr + e820_raw[i].size);
e820_raw[i].size = 0; /* discarded later */
+
+ /*
+ * Dom0 will want to map the DMI table, yet some BIOSes put it
+ * in RAM regions - forcibly cut off the portion that overlaps.
+ */
+ if ( s < e &&
+ dmi_table_len > 0 &&
+ (e << PAGE_SHIFT) > dmi_table_start &&
+ (s << PAGE_SHIFT) < (u64)dmi_table_start + dmi_table_len )
+ {
+ u64 dmi_table_end = (u64)dmi_table_start + dmi_table_len;
+
+ if ( (s << PAGE_SHIFT) >= dmi_table_start &&
+ (e << PAGE_SHIFT) <= dmi_table_end )
+ e = s;
+ else if ( (s << PAGE_SHIFT) >= dmi_table_start )
+ s = PFN_UP(dmi_table_end);
+ else if ( (e << PAGE_SHIFT) <= dmi_table_end )
+ e = PFN_DOWN(dmi_table_start);
+ else if ( e820_raw_nr < E820MAX )
+ {
+ e820_raw[e820_raw_nr].addr = dmi_table_end;
+ e820_raw[e820_raw_nr].size = (e << PAGE_SHIFT) - dmi_table_end;
+ e820_raw[e820_raw_nr].type = E820_RAM;
+ ++e820_raw_nr;
+ e = PFN_DOWN(dmi_table_start);
+ }
+ else if ( dmi_table_start - (s << PAGE_SHIFT) >=
+ (e << PAGE_SHIFT) - dmi_table_end )
+ e = PFN_DOWN(dmi_table_start);
+ else
+ s = PFN_UP(dmi_table_end);
+ e820_warn = 1;
+ }
+
if ( s < e )
{
e820_raw[i].addr = s << PAGE_SHIFT;
@@ -427,6 +466,19 @@ void __init __start_xen(multiboot_info_t
}
}
+ if ( e820_warn )
+ {
+ printk("WARNING: DMI table located in E820 RAM "
+ "(fixed by shrinking/splitting RAM region).\n");
+ if ( e820_raw_nr < E820MAX )
+ {
+ e820_raw[e820_raw_nr].addr = dmi_table_start;
+ e820_raw[e820_raw_nr].size = dmi_table_len;
+ e820_raw[e820_raw_nr].type = E820_RESERVED;
+ ++e820_raw_nr;
+ }
+ }
+
/* Sanitise the raw E820 map to produce a final clean version. */
max_page = init_e820(e820_raw, &e820_raw_nr);

551
edd.patch
View File

@ -1,551 +0,0 @@
Index: 2007-05-14/xen/arch/x86/Makefile
===================================================================
--- 2007-05-14.orig/xen/arch/x86/Makefile 2007-07-02 12:05:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/Makefile 2007-07-02 11:55:01.000000000 +0200
@@ -78,7 +78,7 @@ xen.lds: $(TARGET_SUBARCH)/xen.lds.S $(H
boot/mkelf32: boot/mkelf32.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
-boot/$(TARGET_SUBARCH).o: boot/realmode.S
+boot/$(TARGET_SUBARCH).o: boot/realmode.S boot/edd.S
.PHONY: clean
clean::
Index: 2007-05-14/xen/arch/x86/boot/edd.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2007-05-14/xen/arch/x86/boot/edd.S 2007-07-02 12:05:50.000000000 +0200
@@ -0,0 +1,217 @@
+/*
+ * BIOS Enhanced Disk Drive support
+ * Copyright (C) 2002, 2003, 2004 Dell, Inc.
+ * by Matt Domsch <Matt_Domsch@dell.com> October 2002
+ * conformant to T13 Committee www.t13.org
+ * projects 1572D, 1484D, 1386D, 1226DT
+ * disk signature read by Matt Domsch <Matt_Domsch@dell.com>
+ * and Andrew Wilks <Andrew_Wilks@dell.com> September 2003, June 2004
+ * legacy CHS retrieval by Patrick J. LoPresti <patl@users.sourceforge.net>
+ * March 2004
+ * Command line option parsing, Matt Domsch, November 2004
+ * Xen adoption by Jan Beulich <jbeulich@novell.com>, February 2007
+ */
+
+#include <asm/edd.h>
+
+# It is assumed that %ds == INITSEG here
+
+ movb $0, (EDD_MBR_SIG_NR_BUF)
+ movb $0, (EDDNR)
+
+# Check the command line for options:
+# edd=of disables EDD completely (edd=off)
+# edd=sk skips the MBR test (edd=skipmbr)
+# edd=on re-enables EDD (edd=on)
+
+ pushl %esi
+ movw $SYM_REAL(edd_mbr_sig_start), %di # Default to edd=on
+
+ movl %cs:SYM_REAL(cmd_line_ptr), %esi
+ andl %esi, %esi
+ jz done_cl
+
+# Convert to a real-mode pointer in fs:si
+ movl %esi, %eax
+ shrl $4, %eax
+ mov %ax, %fs
+ andw $0xf, %si
+
+# fs:si has the pointer to the command line now
+
+# Loop through kernel command line one byte at a time. Just in
+# case the loader is buggy and failed to null-terminate the command line
+# terminate if we get close enough to the end of the segment that we
+# cannot fit "edd=XX"...
+cl_atspace:
+ cmpw $-5, %si # Watch for segment wraparound
+ jae done_cl
+ movl %fs:(%si), %eax
+ andb %al, %al # End of line?
+ jz done_cl
+ cmpl $EDD_CL_EQUALS, %eax
+ jz found_edd_equals
+ cmpb $0x20, %al # <= space consider whitespace
+ ja cl_skipword
+ incw %si
+ jmp cl_atspace
+
+cl_skipword:
+ cmpw $-5, %si # Watch for segment wraparound
+ jae done_cl
+ movb %fs:(%si), %al # End of string?
+ andb %al, %al
+ jz done_cl
+ cmpb $0x20, %al
+ jbe cl_atspace
+ incw %si
+ jmp cl_skipword
+
+found_edd_equals:
+# only looking at first two characters after equals
+# late overrides early on the command line, so keep going after finding something
+ movw %fs:4(%si), %ax
+ cmpw $EDD_CL_OFF, %ax # edd=of
+ je do_edd_off
+ cmpw $EDD_CL_SKIP, %ax # edd=sk
+ je do_edd_skipmbr
+ cmpw $EDD_CL_ON, %ax # edd=on
+ je do_edd_on
+ jmp cl_skipword
+do_edd_skipmbr:
+ movw $SYM_REAL(edd_start), %di
+ jmp cl_skipword
+do_edd_off:
+ movw $SYM_REAL(edd_done), %di
+ jmp cl_skipword
+do_edd_on:
+ movw $SYM_REAL(edd_mbr_sig_start), %di
+ jmp cl_skipword
+
+done_cl:
+ popl %esi
+ jmpw *%di
+
+# Read the first sector of each BIOS disk device and store the 4-byte signature
+edd_mbr_sig_start:
+ movb $0x80, %dl # from device 80
+ movw $EDD_MBR_SIG_BUF, %bx # store buffer ptr in bx
+edd_mbr_sig_read:
+ movl $0xFFFFFFFF, %eax
+ movl %eax, (%bx) # assume failure
+ pushw %bx
+ movb $READ_SECTORS, %ah
+ movb $1, %al # read 1 sector
+ movb $0, %dh # at head 0
+ movw $1, %cx # cylinder 0, sector 0
+ pushw %es
+ pushw %ds
+ popw %es
+ movw $EDDBUF, %bx # disk's data goes into EDDBUF
+ pushw %dx # work around buggy BIOSes
+ stc # work around buggy BIOSes
+ int $0x13
+ sti # work around buggy BIOSes
+ popw %dx
+ popw %es
+ popw %bx
+ jc edd_mbr_sig_done # on failure, we're done.
+ cmpb $0, %ah # some BIOSes do not set CF
+ jne edd_mbr_sig_done # on failure, we're done.
+ movl (EDDBUF+EDD_MBR_SIG_OFFSET), %eax # read sig out of the MBR
+ movl %eax, (%bx) # store success
+ incb (EDD_MBR_SIG_NR_BUF) # note that we stored something
+ incb %dl # increment to next device
+ addw $4, %bx # increment sig buffer ptr
+ cmpb $EDD_MBR_SIG_MAX, (EDD_MBR_SIG_NR_BUF) # Out of space?
+ jb edd_mbr_sig_read # keep looping
+edd_mbr_sig_done:
+
+# Do the BIOS Enhanced Disk Drive calls
+# This consists of two calls:
+# int 13h ah=41h "Check Extensions Present"
+# int 13h ah=48h "Get Device Parameters"
+# int 13h ah=08h "Legacy Get Device Parameters"
+#
+# A buffer of size EDDMAXNR*(EDDEXTSIZE+EDDPARMSIZE) is reserved for our use
+# in the boot_params at EDDBUF. The first four bytes of which are
+# used to store the device number, interface support map and version
+# results from fn41. The next four bytes are used to store the legacy
+# cylinders, heads, and sectors from fn08. The following 74 bytes are used to
+# store the results from fn48. Starting from device 80h, fn41, then fn48
+# are called and their results stored in EDDBUF+n*(EDDEXTSIZE+EDDPARMIZE).
+# Then the pointer is incremented to store the data for the next call.
+# This repeats until either a device doesn't exist, or until EDDMAXNR
+# devices have been stored.
+# The one tricky part is that ds:si always points EDDEXTSIZE bytes into
+# the structure, and the fn41 and fn08 results are stored at offsets
+# from there. This removes the need to increment the pointer for
+# every store, and leaves it ready for the fn48 call.
+# A second one-byte buffer, EDDNR, in the boot_params stores
+# the number of BIOS devices which exist, up to EDDMAXNR.
+# In setup.c, copy_edd() stores both boot_params buffers away
+# for later use, as they would get overwritten otherwise.
+# This code is sensitive to the size of the structs in edd.h
+edd_start:
+ # %ds points to the bootsector
+ # result buffer for fn48
+ movw $EDDBUF+EDDEXTSIZE, %si # in ds:si, fn41 results
+ # kept just before that
+ movb $0x80, %dl # BIOS device 0x80
+
+edd_check_ext:
+ movb $CHECKEXTENSIONSPRESENT, %ah # Function 41
+ movw $EDDMAGIC1, %bx # magic
+ int $0x13 # make the call
+ jc edd_done # no more BIOS devices
+
+ cmpw $EDDMAGIC2, %bx # is magic right?
+ jne edd_next # nope, next...
+
+ movb %dl, %ds:-8(%si) # store device number
+ movb %ah, %ds:-7(%si) # store version
+ movw %cx, %ds:-6(%si) # store extensions
+ incb (EDDNR) # note that we stored something
+
+edd_get_device_params:
+ movw $EDDPARMSIZE, %ds:(%si) # put size
+ movw $0x0, %ds:2(%si) # work around buggy BIOSes
+ movb $GETDEVICEPARAMETERS, %ah # Function 48
+ int $0x13 # make the call
+ # Don't check for fail return
+ # it doesn't matter.
+edd_get_legacy_chs:
+ xorw %ax, %ax
+ movw %ax, %ds:-4(%si)
+ movw %ax, %ds:-2(%si)
+ # Ralf Brown's Interrupt List says to set ES:DI to
+ # 0000h:0000h "to guard against BIOS bugs"
+ pushw %es
+ movw %ax, %es
+ movw %ax, %di
+ pushw %dx # legacy call clobbers %dl
+ movb $LEGACYGETDEVICEPARAMETERS, %ah # Function 08
+ int $0x13 # make the call
+ jc edd_legacy_done # failed
+ movb %cl, %al # Low 6 bits are max
+ andb $0x3F, %al # sector number
+ movb %al, %ds:-1(%si) # Record max sect
+ movb %dh, %ds:-2(%si) # Record max head number
+ movb %ch, %al # Low 8 bits of max cyl
+ shr $6, %cl
+ movb %cl, %ah # High 2 bits of max cyl
+ movw %ax, %ds:-4(%si)
+
+edd_legacy_done:
+ popw %dx
+ popw %es
+ movw %si, %ax # increment si
+ addw $EDDPARMSIZE+EDDEXTSIZE, %ax
+ movw %ax, %si
+
+edd_next:
+ incb %dl # increment to next device
+ cmpb $EDDMAXNR, (EDDNR) # Out of space?
+ jb edd_check_ext # keep looping
+
+edd_done:
Index: 2007-05-14/xen/arch/x86/boot/realmode.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/boot/realmode.S 2007-07-02 12:05:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/boot/realmode.S 2007-07-02 11:55:01.000000000 +0200
@@ -120,3 +120,26 @@ cmd_line_ptr: .long 0
.Lgdt: .skip 2+4
.Lidt: .skip 2+4
.previous
+
+#define EDDNR SYM_REAL(eddnr)
+#define EDDBUF SYM_REAL(eddbuf)
+#define EDD_MBR_SIG_NR_BUF SYM_REAL(edd_mbr_sig_nr_buf)
+#define EDD_MBR_SIG_BUF SYM_REAL(edd_mbr_sig_buf)
+
+edd:
+#include "edd.S"
+ ret
+
+ .section .real.data
+ .globl eddnr, eddbuf, edd_mbr_sig_nr_buf, edd_mbr_sig_buf
+ .align 4
+eddbuf: .skip EDDMAXNR * (EDDEXTSIZE + EDDPARMSIZE)
+#if EDDMAXNR * (EDDEXTSIZE + EDDPARMSIZE) < 512
+/* Must have space for a full 512-byte sector */
+ .skip 512 - EDDMAXNR * (EDDEXTSIZE + EDDPARMSIZE)
+#endif
+ .align 4
+edd_mbr_sig_buf: .skip EDD_MBR_SIG_MAX * 4
+eddnr: .skip 1
+edd_mbr_sig_nr_buf: .skip 1
+ .previous
Index: 2007-05-14/xen/arch/x86/boot/x86_32.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/boot/x86_32.S 2007-07-02 12:05:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/boot/x86_32.S 2007-07-02 11:55:01.000000000 +0200
@@ -90,6 +90,9 @@ __start:
lea __PAGE_OFFSET(%ebx),%eax
push %eax
+ pushl $SYM_PHYS(edd)
+ call realmode
+
#ifdef CONFIG_X86_PAE
/* Initialize low and high mappings of all memory with 2MB pages */
mov $SYM_PHYS(idle_pg_table_l2),%edi
Index: 2007-05-14/xen/arch/x86/boot/x86_64.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/boot/x86_64.S 2007-07-02 12:05:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/boot/x86_64.S 2007-07-02 11:55:01.000000000 +0200
@@ -73,6 +73,8 @@ __start:
mov %ebx,SYM_PHYS(multiboot_ptr)
lss SYM_PHYS(.Lstack_start),%esp
+ pushl $SYM_PHYS(edd)
+ call realmode
/* We begin by interrogating the CPU for the presence of long mode. */
mov $0x80000000,%eax
Index: 2007-05-14/xen/arch/x86/platform_hypercall.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/platform_hypercall.c 2007-07-02 12:05:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/platform_hypercall.c 2007-07-02 11:55:16.000000000 +0200
@@ -20,14 +20,21 @@
#include <xen/guest_access.h>
#include <asm/current.h>
#include <public/platform.h>
+#include <asm/edd.h>
#include <asm/mtrr.h>
#include "cpu/mtrr/mtrr.h"
#ifndef COMPAT
typedef long ret_t;
DEFINE_SPINLOCK(xenpf_lock);
+struct edd edd;
+# undef copy_from_compat
+# define copy_from_compat copy_from_guest
+# undef copy_to_compat
+# define copy_to_compat copy_to_guest
#else
extern spinlock_t xenpf_lock;
+extern struct edd edd;
#endif
ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
@@ -151,6 +158,66 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
}
break;
+ case XENPF_firmware_info:
+ switch ( op->u.firmware_info.type )
+ {
+ case XEN_FW_DISK_INFO: {
+ const struct edd_info *info;
+ u16 length;
+
+ ret = -ESRCH;
+ if ( op->u.firmware_info.index >= edd.edd_info_nr )
+ break;
+
+ info = edd.edd_info + op->u.firmware_info.index;
+
+ /* Transfer the EDD info block. */
+ ret = -EFAULT;
+ if ( copy_from_compat(&length, op->u.firmware_info.u.
+ disk_info.edd_params, 1) )
+ break;
+ if ( length > info->edd_device_params.length )
+ length = info->edd_device_params.length;
+ if ( copy_to_compat(op->u.firmware_info.u.disk_info.edd_params,
+ (u8 *)&info->edd_device_params,
+ length) )
+ break;
+
+ /* Transfer miscellaneous other information values. */
+#define C(x) op->u.firmware_info.u.disk_info.x = info->x
+ C(device);
+ C(version);
+ C(interface_support);
+ C(legacy_max_cylinder);
+ C(legacy_max_head);
+ C(legacy_sectors_per_track);
+#undef C
+
+ ret = (copy_field_to_guest(u_xenpf_op, op,
+ u.firmware_info.u.disk_info)
+ ? -EFAULT : 0);
+ break;
+ }
+ case XEN_FW_DISK_MBR_SIGNATURE:
+ ret = -ESRCH;
+ if ( op->u.firmware_info.index >= edd.mbr_signature_nr )
+ break;
+
+ op->u.firmware_info.u.disk_mbr_signature.device =
+ 0x80 + op->u.firmware_info.index;
+ op->u.firmware_info.u.disk_mbr_signature.mbr_signature =
+ edd.mbr_signature[op->u.firmware_info.index];
+
+ ret = (copy_field_to_guest(u_xenpf_op, op,
+ u.firmware_info.u.disk_mbr_signature)
+ ? -EFAULT : 0);
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ break;
+
default:
ret = -ENOSYS;
break;
@@ -161,6 +228,19 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
return ret;
}
+#ifndef COMPAT
+static int __init firmware_init(void)
+{
+ memcpy(edd.mbr_signature, edd_mbr_sig_buf, sizeof(edd.mbr_signature));
+ memcpy(edd.edd_info, eddbuf, sizeof(edd.edd_info));
+ edd.mbr_signature_nr = edd_mbr_sig_nr_buf;
+ edd.edd_info_nr = eddnr;
+
+ return 0;
+}
+__initcall(firmware_init);
+#endif
+
/*
* Local variables:
* mode: C
Index: 2007-05-14/xen/include/public/platform.h
===================================================================
--- 2007-05-14.orig/xen/include/public/platform.h 2007-07-02 12:05:34.000000000 +0200
+++ 2007-05-14/xen/include/public/platform.h 2007-07-02 11:55:01.000000000 +0200
@@ -114,6 +114,37 @@ struct xenpf_platform_quirk {
typedef struct xenpf_platform_quirk xenpf_platform_quirk_t;
DEFINE_XEN_GUEST_HANDLE(xenpf_platform_quirk_t);
+#define XENPF_firmware_info 50
+#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */
+#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
+struct xenpf_firmware_info {
+ /* IN variables. */
+ uint32_t type;
+ uint32_t index;
+ /* OUT variables. */
+ union {
+ struct {
+ /* Int13, Fn48: Check Extensions Present. */
+ uint8_t device; /* %dl: bios device number */
+ uint8_t version; /* %ah: major version */
+ uint16_t interface_support; /* %cx: support bitmap */
+ /* Int13, Fn08: Legacy Get Device Parameters. */
+ uint16_t legacy_max_cylinder; /* %cl[7:6]:%ch: max cyl # */
+ uint8_t legacy_max_head; /* %dh: max head # */
+ uint8_t legacy_sectors_per_track; /* %cl[5:0]: max sector # */
+ /* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */
+ /* NB. First uint16_t of buffer must be set to buffer size. */
+ XEN_GUEST_HANDLE(void) edd_params;
+ } disk_info; /* XEN_FW_DISK_INFO */
+ struct {
+ uint8_t device; /* bios device number */
+ uint32_t mbr_signature; /* offset 0x1b8 in mbr */
+ } disk_mbr_signature; /* XEN_FW_DISK_MBR_SIGNATURE */
+ } u;
+};
+typedef struct xenpf_firmware_info xenpf_firmware_info_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_firmware_info_t);
+
struct xen_platform_op {
uint32_t cmd;
uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -124,6 +155,7 @@ struct xen_platform_op {
struct xenpf_read_memtype read_memtype;
struct xenpf_microcode_update microcode;
struct xenpf_platform_quirk platform_quirk;
+ struct xenpf_firmware_info firmware_info;
uint8_t pad[128];
} u;
};
Index: 2007-05-14/xen/include/asm-x86/edd.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2007-05-14/xen/include/asm-x86/edd.h 2007-07-02 11:27:08.000000000 +0200
@@ -0,0 +1,90 @@
+/*
+ * xen/include/linux/edd.h
+ * Copyright (C) 2002, 2003, 2004 Dell Inc.
+ * by Matt Domsch <Matt_Domsch@dell.com>
+ * Adopted for Xen (C) 2007 Novell, Inc.
+ * by Jan Beulich <jbeulich@novell.com>
+ *
+ * structures and definitions for the int 13h, ax={41,48}h
+ * BIOS Enhanced Disk Drive Services
+ * This is based on the T13 group document D1572 Revision 0 (August 14 2002)
+ * available at http://www.t13.org/docs2002/d1572r0.pdf. It is
+ * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License v2.0 as published by
+ * the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef _XEN_EDD_H
+#define _XEN_EDD_H
+
+#define EDDMAXNR 6 /* number of edd_info structs starting at eddbuf */
+#define EDDEXTSIZE 8 /* change these if you muck with the structures */
+#define EDDPARMSIZE 74
+#define CHECKEXTENSIONSPRESENT 0x41
+#define GETDEVICEPARAMETERS 0x48
+#define LEGACYGETDEVICEPARAMETERS 0x08
+#define EDDMAGIC1 0x55AA
+#define EDDMAGIC2 0xAA55
+
+
+#define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */
+#define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */
+#define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */
+#define EDD_CL_EQUALS 0x3d646465 /* "edd=" */
+#define EDD_CL_OFF 0x666f /* "of" for off */
+#define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */
+#define EDD_CL_ON 0x6e6f /* "on" for on */
+
+#ifndef __ASSEMBLY__
+
+#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0)
+#define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1)
+#define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2)
+#define EDD_EXT_64BIT_EXTENSIONS (1 << 3)
+
+#define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0)
+#define EDD_INFO_GEOMETRY_VALID (1 << 1)
+#define EDD_INFO_REMOVABLE (1 << 2)
+#define EDD_INFO_WRITE_VERIFY (1 << 3)
+#define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4)
+#define EDD_INFO_LOCKABLE (1 << 5)
+#define EDD_INFO_NO_MEDIA_PRESENT (1 << 6)
+#define EDD_INFO_USE_INT13_FN50 (1 << 7)
+
+struct edd_info {
+ /* Int13, Fn48: Check Extensions Present. */
+ u8 device; /* %dl: device */
+ u8 version; /* %ah: major version */
+ u16 interface_support; /* %cx: interface support bitmap */
+ /* Int13, Fn08: Legacy Get Device Parameters. */
+ u16 legacy_max_cylinder; /* %cl[7:6]:%ch: maximum cylinder number */
+ u8 legacy_max_head; /* %dh: maximum head number */
+ u8 legacy_sectors_per_track; /* %cl[5:0]: maximum sector number */
+ /* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */
+ struct {
+ u16 length;
+ u8 data[72];
+ } edd_device_params;
+} __attribute__ ((packed));
+
+struct edd {
+ unsigned int mbr_signature[EDD_MBR_SIG_MAX];
+ struct edd_info edd_info[EDDMAXNR];
+ unsigned char mbr_signature_nr;
+ unsigned char edd_info_nr;
+};
+
+extern unsigned char eddnr, edd_mbr_sig_nr_buf;
+extern struct edd_info eddbuf[];
+extern unsigned int edd_mbr_sig_buf[];
+
+#endif /*!__ASSEMBLY__ */
+
+#endif /* _XEN_EDD_H */

View File

@ -1,195 +0,0 @@
Index: 2007-05-14/xen/arch/x86/Makefile
===================================================================
--- 2007-05-14.orig/xen/arch/x86/Makefile 2007-07-02 12:09:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/Makefile 2007-03-19 14:07:50.000000000 +0100
@@ -78,7 +78,7 @@ xen.lds: $(TARGET_SUBARCH)/xen.lds.S $(H
boot/mkelf32: boot/mkelf32.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
-boot/$(TARGET_SUBARCH).o: boot/realmode.S boot/edd.S
+boot/$(TARGET_SUBARCH).o: boot/realmode.S boot/edd.S boot/video.S
.PHONY: clean
clean::
Index: 2007-05-14/xen/arch/x86/boot/realmode.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/boot/realmode.S 2007-07-02 12:09:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/boot/realmode.S 2007-03-21 14:35:14.000000000 +0100
@@ -142,4 +142,11 @@ eddbuf: .skip EDDMAXNR * (EDDEXTSIZE +
edd_mbr_sig_buf: .skip EDD_MBR_SIG_MAX * 4
eddnr: .skip 1
edd_mbr_sig_nr_buf: .skip 1
+
+ .globl ddc_capabilities, edid_transfer_time, edid
+ddc_capabilities: .skip 1
+edid_transfer_time: .skip 1
+edid: .skip 128
.previous
+
+#include "video.S"
Index: 2007-05-14/xen/arch/x86/boot/video.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2007-05-14/xen/arch/x86/boot/video.S 2007-03-19 14:07:50.000000000 +0100
@@ -0,0 +1,35 @@
+store_edid:
+ movl $0x13131313, %eax # memset block with 0x13
+ movw $32, %cx
+ movw $SYM_REAL(edid), %di
+ cld
+ rep
+ stosl
+
+ pushw %es # save ES
+ xorw %di, %di # Report Capability
+ movw %di, %es # ES:DI must be 0:0
+ movw $0x4f15, %ax
+ xorw %bx, %bx
+ xorw %cx, %cx
+ int $0x10
+ popw %es # restore ES
+
+ testb %ah, %ah # call successful
+ jnz no_edid
+
+ cmpb $0x4f, %al # function supported
+ jne no_edid
+
+ movb %bl, SYM_REAL(ddc_capabilities)
+ movb %bh, SYM_REAL(edid_transfer_time)
+
+ movw $0x4f15, %ax # do VBE/DDC
+ movw $0x01, %bx
+ xorw %cx, %cx
+ xorw %dx, %dx
+ movw $SYM_REAL(edid), %di
+ int $0x10
+
+no_edid:
+ ret
Index: 2007-05-14/xen/arch/x86/boot/x86_32.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/boot/x86_32.S 2007-07-02 12:09:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/boot/x86_32.S 2007-03-19 14:07:50.000000000 +0100
@@ -92,6 +92,8 @@ __start:
pushl $SYM_PHYS(edd)
call realmode
+ pushl $SYM_PHYS(store_edid)
+ call realmode
#ifdef CONFIG_X86_PAE
/* Initialize low and high mappings of all memory with 2MB pages */
Index: 2007-05-14/xen/arch/x86/boot/x86_64.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/boot/x86_64.S 2007-07-02 12:09:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/boot/x86_64.S 2007-03-19 14:07:50.000000000 +0100
@@ -75,6 +75,8 @@ __start:
lss SYM_PHYS(.Lstack_start),%esp
pushl $SYM_PHYS(edd)
call realmode
+ pushl $SYM_PHYS(store_edid)
+ call realmode
/* We begin by interrogating the CPU for the presence of long mode. */
mov $0x80000000,%eax
Index: 2007-05-14/xen/arch/x86/platform_hypercall.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/platform_hypercall.c 2007-07-02 12:09:34.000000000 +0200
+++ 2007-05-14/xen/arch/x86/platform_hypercall.c 2007-07-02 12:09:50.000000000 +0200
@@ -24,10 +24,15 @@
#include <asm/mtrr.h>
#include "cpu/mtrr/mtrr.h"
+struct ddc {
+ uint8_t capabilities, edid_transfer_time, edid[128];
+};
+
#ifndef COMPAT
typedef long ret_t;
DEFINE_SPINLOCK(xenpf_lock);
struct edd edd;
+struct ddc ddc;
# undef copy_from_compat
# define copy_from_compat copy_from_guest
# undef copy_to_compat
@@ -35,6 +40,7 @@ struct edd edd;
#else
extern spinlock_t xenpf_lock;
extern struct edd edd;
+extern struct ddc ddc;
#endif
ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
@@ -212,6 +218,27 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
u.firmware_info.u.disk_mbr_signature)
? -EFAULT : 0);
break;
+ case XEN_FW_VBEDDC_INFO:
+ ret = -ESRCH;
+ if ( op->u.firmware_info.index != 0 )
+ break;
+ if ( *(u32 *)ddc.edid == 0x13131313 )
+ break;
+
+ op->u.firmware_info.u.vbeddc_info.capabilities =
+ ddc.capabilities;
+ op->u.firmware_info.u.vbeddc_info.edid_transfer_time =
+ ddc.edid_transfer_time;
+
+ ret = 0;
+ if ( copy_field_to_guest(u_xenpf_op, op, u.firmware_info.
+ u.vbeddc_info.capabilities) ||
+ copy_field_to_guest(u_xenpf_op, op, u.firmware_info.
+ u.vbeddc_info.edid_transfer_time) ||
+ copy_to_compat(op->u.firmware_info.u.vbeddc_info.edid,
+ ddc.edid, ARRAY_SIZE(ddc.edid)) )
+ ret = -EFAULT;
+ break;
default:
ret = -EINVAL;
break;
@@ -231,11 +258,17 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
#ifndef COMPAT
static int __init firmware_init(void)
{
+ extern uint8_t ddc_capabilities, edid_transfer_time, edid[];
+
memcpy(edd.mbr_signature, edd_mbr_sig_buf, sizeof(edd.mbr_signature));
memcpy(edd.edd_info, eddbuf, sizeof(edd.edd_info));
edd.mbr_signature_nr = edd_mbr_sig_nr_buf;
edd.edd_info_nr = eddnr;
+ ddc.capabilities = ddc_capabilities;
+ ddc.edid_transfer_time = edid_transfer_time;
+ memcpy(ddc.edid, edid, sizeof(ddc.edid));
+
return 0;
}
__initcall(firmware_init);
Index: 2007-05-14/xen/include/public/platform.h
===================================================================
--- 2007-05-14.orig/xen/include/public/platform.h 2007-07-02 12:09:34.000000000 +0200
+++ 2007-05-14/xen/include/public/platform.h 2007-07-02 11:49:06.000000000 +0200
@@ -117,6 +117,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_platform_q
#define XENPF_firmware_info 50
#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */
#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
+#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */
struct xenpf_firmware_info {
/* IN variables. */
uint32_t type;
@@ -140,6 +141,13 @@ struct xenpf_firmware_info {
uint8_t device; /* bios device number */
uint32_t mbr_signature; /* offset 0x1b8 in mbr */
} disk_mbr_signature; /* XEN_FW_DISK_MBR_SIGNATURE */
+ struct {
+ /* Int10, AX=4F15: Get EDID info. */
+ uint8_t capabilities;
+ uint8_t edid_transfer_time;
+ /* must refer to 128-byte buffer */
+ XEN_GUEST_HANDLE(uint8_t) edid;
+ } vbeddc_info; /* XEN_FW_VBEDDC_INFO */
} u;
};
typedef struct xenpf_firmware_info xenpf_firmware_info_t;

View File

@ -1,547 +0,0 @@
Index: xen-3.0.4-testing/tools/ioemu/keymaps.c
===================================================================
--- xen-3.0.4-testing.orig/tools/ioemu/keymaps.c 2006-12-14 14:49:55.000000000 -0700
+++ xen-3.0.4-testing/tools/ioemu/keymaps.c 2007-09-14 08:31:29.000000000 -0600
@@ -32,19 +32,50 @@
return 0;
}
+struct key_range {
+ int start;
+ int end;
+ struct key_range *next;
+};
+
#define MAX_NORMAL_KEYCODE 512
#define MAX_EXTRA_COUNT 256
typedef struct {
uint16_t keysym2keycode[MAX_NORMAL_KEYCODE];
- int keysym2numlock[MAX_NORMAL_KEYCODE];
struct {
int keysym;
- int numlock;
uint16_t keycode;
} keysym2keycode_extra[MAX_EXTRA_COUNT];
int extra_count;
+ struct key_range *keypad_range;
+ struct key_range *numlock_range;
+ struct key_range *shift_range;
} kbd_layout_t;
+static void add_to_key_range(struct key_range **krp, int code) {
+ struct key_range *kr;
+ for (kr = *krp; kr; kr = kr->next) {
+ if (code >= kr->start && code <= kr->end)
+ break;
+ if (code == kr->start - 1) {
+ kr->start--;
+ break;
+ }
+ if (code == kr->end + 1) {
+ kr->end++;
+ break;
+ }
+ }
+ if (kr == NULL) {
+ kr = qemu_mallocz(sizeof(*kr));
+ if (kr) {
+ kr->start = kr->end = code;
+ kr->next = *krp;
+ *krp = kr;
+ }
+ }
+}
+
static kbd_layout_t *parse_keyboard_layout(const char *language,
kbd_layout_t * k)
{
@@ -52,8 +83,6 @@
char file_name[1024];
char line[1024];
int len;
- int *keycode2numlock;
- int i;
snprintf(file_name, sizeof(file_name),
"%s/keymaps/%s", bios_dir, language);
@@ -67,15 +96,6 @@
"Could not read keymap file: '%s'\n", file_name);
return 0;
}
-
- /* Allocate a temporary map tracking which keycodes change when numlock is
- set. Keycodes are 16 bit, so 65536 is safe. */
- keycode2numlock = malloc(65536 * sizeof(int));
- if (!keycode2numlock) {
- perror("Could not read keymap file");
- return 0;
- }
-
for(;;) {
if (fgets(line, 1024, f) == NULL)
break;
@@ -99,19 +119,25 @@
if (keysym == 0) {
// fprintf(stderr, "Warning: unknown keysym %s\n", line);
} else {
- char *rest = end_of_keysym + 1;
- int keycode = strtol(rest, &rest, 0);
- int numlock = (rest != NULL &&
- strstr(rest, "numlock") != NULL);
-
- keycode2numlock[keycode] = numlock;
+ const char *rest = end_of_keysym + 1;
+ char *rest2;
+ int keycode = strtol(rest, &rest2, 0);
+
+ if (rest && strstr(rest, "numlock")) {
+ add_to_key_range(&k->keypad_range, keycode);
+ add_to_key_range(&k->numlock_range, keysym);
+ fprintf(stderr, "keypad keysym %04x keycode %d\n", keysym, keycode);
+ }
+ if (rest && strstr(rest, "shift")) {
+ add_to_key_range(&k->shift_range, keysym);
+ fprintf(stderr, "shift keysym %04x keycode %d\n", keysym, keycode);
+ }
/* if(keycode&0x80)
keycode=(keycode<<8)^0x80e0; */
if (keysym < MAX_NORMAL_KEYCODE) {
//fprintf(stderr,"Setting keysym %s (%d) to %d\n",line,keysym,keycode);
k->keysym2keycode[keysym] = keycode;
- k->keysym2numlock[keysym] = numlock;
} else {
if (k->extra_count >= MAX_EXTRA_COUNT) {
fprintf(stderr,
@@ -126,8 +152,6 @@
keysym = keysym;
k->keysym2keycode_extra[k->extra_count].
keycode = keycode;
- k->keysym2keycode_extra[k->extra_count].
- numlock = numlock;
k->extra_count++;
}
}
@@ -136,22 +160,6 @@
}
}
fclose(f);
-
- for (i = 0; i < MAX_NORMAL_KEYCODE; i++) {
- if (k->keysym2numlock[i] != 1) {
- k->keysym2numlock[i] = -keycode2numlock[k->keysym2keycode[i]];
- }
- }
-
- for (i = 0; i < k->extra_count; i++) {
- if (k->keysym2keycode_extra[i].numlock != 1) {
- k->keysym2keycode_extra[i].numlock =
- -keycode2numlock[k->keysym2keycode_extra[i].keycode];
- }
- }
-
- free(keycode2numlock);
-
return k;
}
@@ -181,24 +189,35 @@
return 0;
}
-/**
- * Returns 1 if the given keysym requires numlock to be pressed, -1 if it
- * requires it to be cleared, and 0 otherwise.
- */
-static int keysym2numlock(void *kbd_layout, int keysym)
+static int keycodeIsKeypad(void *kbd_layout, int keycode)
{
kbd_layout_t *k = kbd_layout;
- if (keysym < MAX_NORMAL_KEYCODE) {
- return k->keysym2numlock[keysym];
- } else {
- int i;
-#ifdef XK_ISO_Left_Tab
- if (keysym == XK_ISO_Left_Tab)
- keysym = XK_Tab;
-#endif
- for (i = 0; i < k->extra_count; i++)
- if (k->keysym2keycode_extra[i].keysym == keysym)
- return k->keysym2keycode_extra[i].numlock;
- }
+ struct key_range *kr;
+
+ for (kr = k->keypad_range; kr; kr = kr->next)
+ if (keycode >= kr->start && keycode <= kr->end)
+ return 1;
+ return 0;
+}
+
+static int keysymIsNumlock(void *kbd_layout, int keysym)
+{
+ kbd_layout_t *k = kbd_layout;
+ struct key_range *kr;
+
+ for (kr = k->numlock_range; kr; kr = kr->next)
+ if (keysym >= kr->start && keysym <= kr->end)
+ return 1;
+ return 0;
+}
+
+static int keysymIsShift(void *kbd_layout, int keysym)
+{
+ kbd_layout_t *k = kbd_layout;
+ struct key_range *kr;
+
+ for (kr = k->shift_range; kr; kr = kr->next)
+ if (keysym >= kr->start && keysym <= kr->end)
+ return 1;
return 0;
}
Index: xen-3.0.4-testing/tools/ioemu/vnc.c
===================================================================
--- xen-3.0.4-testing.orig/tools/ioemu/vnc.c 2007-09-14 08:30:01.000000000 -0600
+++ xen-3.0.4-testing/tools/ioemu/vnc.c 2007-09-14 09:23:48.000000000 -0600
@@ -46,10 +46,6 @@
#include "keymaps.c"
#include "d3des.h"
-#define XK_MISCELLANY
-#define XK_LATIN1
-#include <X11/keysymdef.h>
-
typedef struct Buffer
{
size_t capacity;
@@ -113,9 +109,8 @@
int visible_w;
int visible_h;
- int ctl_keys; /* Ctrl+Alt starts calibration */
- int shift_keys; /* Shift / CapsLock keys */
- int numlock;
+ /* input */
+ uint8_t modifiers_state[256];
};
#define DIRTY_PIXEL_BITS 64
@@ -855,133 +850,209 @@
}
}
-static void press_key(VncState *vs, int keycode)
+static void reset_keys(VncState *vs)
+{
+ int i;
+ for(i = 0; i < 256; i++) {
+ if (vs->modifiers_state[i]) {
+ if (i & 0x80)
+ kbd_put_keycode(0xe0);
+ kbd_put_keycode(i | 0x80);
+ vs->modifiers_state[i] = 0;
+ }
+ }
+}
+
+static void press_key(VncState *vs, int keysym)
+{
+ kbd_put_keycode(keysym2scancode(vs->kbd_layout, keysym) & 0x7f);
+ kbd_put_keycode(keysym2scancode(vs->kbd_layout, keysym) | 0x80);
+}
+
+static void press_key_shift_down(VncState *vs, int down, int keycode)
{
- kbd_put_keycode(keysym2scancode(vs->kbd_layout, keycode) & 0x7f);
- kbd_put_keycode(keysym2scancode(vs->kbd_layout, keycode) | 0x80);
+ if (down)
+ kbd_put_keycode(0x2a & 0x7f);
+
+ if (keycode & 0x80)
+ kbd_put_keycode(0xe0);
+ if (down)
+ kbd_put_keycode(keycode & 0x7f);
+ else
+ kbd_put_keycode(keycode | 0x80);
+
+ if (!down)
+ kbd_put_keycode(0x2a | 0x80);
+}
+
+static void press_key_shift_up(VncState *vs, int down, int keycode)
+{
+ if (down) {
+ if (vs->modifiers_state[0x2a])
+ kbd_put_keycode(0x2a | 0x80);
+ if (vs->modifiers_state[0x36])
+ kbd_put_keycode(0x36 | 0x80);
+ }
+
+ if (keycode & 0x80)
+ kbd_put_keycode(0xe0);
+ if (down)
+ kbd_put_keycode(keycode & 0x7f);
+ else
+ kbd_put_keycode(keycode | 0x80);
+
+ if (!down) {
+ if (vs->modifiers_state[0x2a])
+ kbd_put_keycode(0x2a & 0x7f);
+ if (vs->modifiers_state[0x36])
+ kbd_put_keycode(0x36 & 0x7f);
+ }
}
static void do_key_event(VncState *vs, int down, uint32_t sym)
{
- sym &= 0xFFFF;
+ int keycode;
+ int shift_keys = 0;
+ int shift = 0;
if (is_graphic_console()) {
- int keycode;
- int numlock;
+ if (sym >= 'A' && sym <= 'Z') {
+ sym = sym - 'A' + 'a';
+ shift = 1;
+ }
+ else {
+ shift = keysymIsShift(vs->kbd_layout, sym & 0xFFFF);
+ }
+ }
+ shift_keys = vs->modifiers_state[0x2a] | vs->modifiers_state[0x36];
- keycode = keysym2scancode(vs->kbd_layout, sym);
- numlock = keysym2numlock(vs->kbd_layout, sym);
+ keycode = keysym2scancode(vs->kbd_layout, sym & 0xFFFF);
+ if (keycode == 0) {
+ fprintf(stderr, "Key lost : keysym=0x%x(%d)\n", sym, sym);
+ return;
+ }
+ /* QEMU console switch */
+ switch(keycode) {
+ case 0x2a: /* Left Shift */
+ case 0x36: /* Right Shift */
+ case 0x1d: /* Left CTRL */
+ case 0x9d: /* Right CTRL */
+ case 0x38: /* Left ALT */
+ case 0xb8: /* Right ALT */
+ if (down) {
+ vs->modifiers_state[keycode] = 1;
+ kbd_put_keycode(keycode & 0x7f);
+ }
+ else {
+ vs->modifiers_state[keycode] = 0;
+ kbd_put_keycode(keycode | 0x80);
+ }
+ return;
+ case 0x02 ... 0x0a: /* '1' to '9' keys */
+ if (down && vs->modifiers_state[0x1d] && vs->modifiers_state[0x38]) {
+ /* Reset the modifiers sent to the current console */
+ reset_keys(vs);
+ console_select(keycode - 0x02);
+ return;
+ }
+ break;
+ case 0x45: /* NumLock */
+ if (down) {
+ kbd_put_keycode(keycode & 0x7f);
+ }
+ else {
+ vs->modifiers_state[keycode] ^= 1;
+ kbd_put_keycode(keycode | 0x80);
+ }
+ return;
+ }
+
+ if (keycodeIsKeypad(vs->kbd_layout, keycode)) {
/* If the numlock state needs to change then simulate an additional
keypress before sending this one. This will happen if the user
toggles numlock away from the VNC window.
*/
- if (numlock == 1) {
- if (!vs->numlock) {
- vs->numlock = 1;
- press_key(vs, XK_Num_Lock);
- }
- }
- else if (numlock == -1) {
- if (vs->numlock) {
- vs->numlock = 0;
- press_key(vs, XK_Num_Lock);
+ if (keysymIsNumlock(vs->kbd_layout, sym & 0xFFFF)) {
+ if (!vs->modifiers_state[0x45]) {
+ vs->modifiers_state[0x45] = 1;
+ press_key(vs, 0xff7f);
}
- }
-
- if (keycode & 0x80)
- kbd_put_keycode(0xe0);
- if (down)
- kbd_put_keycode(keycode & 0x7f);
- else
- kbd_put_keycode(keycode | 0x80);
- } else if (down) {
- int qemu_keysym = 0;
-
- if (sym <= 128) { /* normal ascii */
- int shifted = vs->shift_keys == 1 || vs->shift_keys == 2;
- qemu_keysym = sym;
- if (sym >= 'a' && sym <= 'z' && shifted)
- qemu_keysym -= 'a' - 'A';
} else {
- switch (sym) {
- case XK_Up: qemu_keysym = QEMU_KEY_UP; break;
- case XK_Down: qemu_keysym = QEMU_KEY_DOWN; break;
- case XK_Left: qemu_keysym = QEMU_KEY_LEFT; break;
- case XK_Right: qemu_keysym = QEMU_KEY_RIGHT; break;
- case XK_Home: qemu_keysym = QEMU_KEY_HOME; break;
- case XK_End: qemu_keysym = QEMU_KEY_END; break;
- case XK_Page_Up: qemu_keysym = QEMU_KEY_PAGEUP; break;
- case XK_Page_Down: qemu_keysym = QEMU_KEY_PAGEDOWN; break;
- case XK_BackSpace: qemu_keysym = QEMU_KEY_BACKSPACE; break;
- case XK_Delete: qemu_keysym = QEMU_KEY_DELETE; break;
- case XK_Return:
- case XK_Linefeed: qemu_keysym = sym; break;
- default: break;
+ if (vs->modifiers_state[0x45]) {
+ vs->modifiers_state[0x45] = 0;
+ press_key(vs, 0xff7f);
}
- }
- if (qemu_keysym != 0)
- kbd_put_keysym(qemu_keysym);
+ }
}
- if (down) {
- switch (sym) {
- case XK_Control_L:
- vs->ctl_keys |= 1;
- break;
-
- case XK_Alt_L:
- vs->ctl_keys |= 2;
- break;
-
- case XK_Shift_L:
- vs->shift_keys |= 1;
- break;
+ if (is_graphic_console()) {
+ /* If the shift state needs to change then simulate an additional
+ keypress before sending this one.
+ */
+ if (shift && !shift_keys) {
+ press_key_shift_down(vs, down, keycode);
+ return;
+ }
+ else if (!shift && shift_keys) {
+ press_key_shift_up(vs, down, keycode);
+ return;
+ }
- default:
- break;
- }
+ if (keycode & 0x80)
+ kbd_put_keycode(0xe0);
+ if (down)
+ kbd_put_keycode(keycode & 0x7f);
+ else
+ kbd_put_keycode(keycode | 0x80);
} else {
- switch (sym) {
- case XK_Control_L:
- vs->ctl_keys &= ~1;
- break;
-
- case XK_Alt_L:
- vs->ctl_keys &= ~2;
- break;
-
- case XK_Shift_L:
- vs->shift_keys &= ~1;
- break;
-
- case XK_Caps_Lock:
- vs->shift_keys ^= 2;
- break;
-
- case XK_Num_Lock:
- vs->numlock = !vs->numlock;
- break;
-
- case XK_1 ... XK_9:
- if ((vs->ctl_keys & 3) != 3)
- break;
-
- console_select(sym - XK_1);
- if (is_graphic_console()) {
- /* tell the vga console to redisplay itself */
- vga_hw_invalidate();
- vnc_dpy_update(vs->ds, 0, 0, vs->ds->width, vs->ds->height);
- }
- break;
- }
+ /* QEMU console emulation */
+ if (down) {
+ switch (keycode) {
+ case 0x2a: /* Left Shift */
+ case 0x36: /* Right Shift */
+ case 0x1d: /* Left CTRL */
+ case 0x9d: /* Right CTRL */
+ case 0x38: /* Left ALT */
+ case 0xb8: /* Right ALT */
+ break;
+ case 0xc8:
+ kbd_put_keysym(QEMU_KEY_UP);
+ break;
+ case 0xd0:
+ kbd_put_keysym(QEMU_KEY_DOWN);
+ break;
+ case 0xcb:
+ kbd_put_keysym(QEMU_KEY_LEFT);
+ break;
+ case 0xcd:
+ kbd_put_keysym(QEMU_KEY_RIGHT);
+ break;
+ case 0xd3:
+ kbd_put_keysym(QEMU_KEY_DELETE);
+ break;
+ case 0xc7:
+ kbd_put_keysym(QEMU_KEY_HOME);
+ break;
+ case 0xcf:
+ kbd_put_keysym(QEMU_KEY_END);
+ break;
+ case 0xc9:
+ kbd_put_keysym(QEMU_KEY_PAGEUP);
+ break;
+ case 0xd1:
+ kbd_put_keysym(QEMU_KEY_PAGEDOWN);
+ break;
+ default:
+ kbd_put_keysym(sym);
+ break;
+ }
+ }
}
}
static void key_event(VncState *vs, int down, uint32_t sym)
{
- if (sym >= 'A' && sym <= 'Z')
- sym = sym - 'A' + 'a';
do_key_event(vs, down, sym);
}
@@ -1385,7 +1456,6 @@
vs->lsock = -1;
vs->csock = -1;
vs->depth = 4;
- vs->numlock = 0;
vs->ds = ds;

View File

@ -1,142 +0,0 @@
Index: xen-3.1-testing/tools/xenfb/vncfb.c
===================================================================
--- xen-3.1-testing.orig/tools/xenfb/vncfb.c 2007-05-17 09:51:10.000000000 -0600
+++ xen-3.1-testing/tools/xenfb/vncfb.c 2007-09-14 11:59:57.000000000 -0600
@@ -55,12 +55,47 @@
unsigned char keycode_table[512];
static void *kbd_layout;
+uint8_t modifiers_state[256];
static int btnmap[] = {
BTN_LEFT, BTN_MIDDLE, BTN_RIGHT, BTN_SIDE,
BTN_EXTRA, BTN_FORWARD, BTN_BACK, BTN_TASK
};
+static void press_key_shift_down(struct xenfb* xenfb, int down, int scancode)
+{
+ if (down)
+ xenfb_send_key(xenfb, 1, keycode_table[0x2a]);
+
+ if (xenfb_send_key(xenfb, down, keycode_table[scancode]) < 0)
+ fprintf(stderr, "Key %d %s lost (%s)\n",
+ scancode, "down", strerror(errno));
+
+ if (!down)
+ xenfb_send_key(xenfb, 0, keycode_table[0x2a]);
+}
+
+static void press_key_shift_up(struct xenfb* xenfb, int down, int scancode)
+{
+ if (down) {
+ if (modifiers_state[0x2a])
+ xenfb_send_key(xenfb, 0, keycode_table[0x2a]);
+ if (modifiers_state[0x36])
+ xenfb_send_key(xenfb, 0, keycode_table[0x36]);
+ }
+
+ if (xenfb_send_key(xenfb, down, keycode_table[scancode]) < 0)
+ fprintf(stderr, "Key %d %s lost (%s)\n",
+ scancode, "down", strerror(errno));
+
+ if (!down) {
+ if (modifiers_state[0x2a])
+ xenfb_send_key(xenfb, 1, keycode_table[0x2a]);
+ if (modifiers_state[0x36])
+ xenfb_send_key(xenfb, 1, keycode_table[0x36]);
+ }
+}
+
static void on_kbd_event(rfbBool down, rfbKeySym keycode, rfbClientPtr cl)
{
/*
@@ -75,14 +110,75 @@
rfbScreenInfoPtr server = cl->screen;
struct xenfb *xenfb = server->screenData;
int scancode;
+ int shift = 0;
+ int shift_keys = 0;
- if (keycode >= 'A' && keycode <= 'Z')
+ if (keycode >= 'A' && keycode <= 'Z') {
keycode += 'a' - 'A';
+ shift = 1;
+ }
+ else {
+ shift = keysymIsShift(kbd_layout, keycode);
+ }
+ shift_keys = modifiers_state[0x2a] | modifiers_state[0x36];
- scancode = keycode_table[keysym2scancode(kbd_layout, keycode)];
+ scancode = keysym2scancode(kbd_layout, keycode);
if (scancode == 0)
return;
- if (xenfb_send_key(xenfb, down, scancode) < 0)
+
+ switch(scancode) {
+ case 0x2a: /* Left Shift */
+ case 0x36: /* Right Shift */
+ case 0x1d: /* Left CTRL */
+ case 0x9d: /* Right CTRL */
+ case 0x38: /* Left ALT */
+ case 0xb8: /* Right ALT */
+ if (down)
+ modifiers_state[scancode] = 1;
+ else
+ modifiers_state[scancode] = 0;
+ xenfb_send_key(xenfb, down, keycode_table[scancode]);
+ return;
+ case 0x45: /* NumLock */
+ if (!down)
+ modifiers_state[scancode] ^= 1;
+ xenfb_send_key(xenfb, down, keycode_table[scancode]);
+ return;
+ }
+
+ if (keycodeIsKeypad(kbd_layout, scancode)) {
+ /* If the numlock state needs to change then simulate an additional
+ keypress before sending this one. This will happen if the user
+ toggles numlock away from the VNC window.
+ */
+ if (keysymIsNumlock(kbd_layout, keycode)) {
+ if (!modifiers_state[0x45]) {
+ modifiers_state[0x45] = 1;
+ xenfb_send_key(xenfb, 1, keycode_table[0x45]);
+ xenfb_send_key(xenfb, 0, keycode_table[0x45]);
+ }
+ } else {
+ if (modifiers_state[0x45]) {
+ modifiers_state[0x45] = 0;
+ xenfb_send_key(xenfb, 1, keycode_table[0x45]);
+ xenfb_send_key(xenfb, 0, keycode_table[0x45]);
+ }
+ }
+ }
+
+ /* If the shift state needs to change then simulate an additional
+ keypress before sending this one.
+ */
+ if (shift && !shift_keys) {
+ press_key_shift_down(xenfb, down, scancode);
+ return;
+ }
+ else if (!shift && shift_keys) {
+ press_key_shift_up(xenfb, down, scancode);
+ return;
+ }
+
+ if (xenfb_send_key(xenfb, down, keycode_table[scancode]) < 0)
fprintf(stderr, "Key %d %s lost (%s)\n",
scancode, down ? "down" : "up",
strerror(errno));
@@ -314,6 +410,10 @@
atkbd_set2_keycode[atkbd_unxlate_table[i] | 0x80];
}
+ for (i = 0; i < 256; i++ ) {
+ modifiers_state[i] = 0;
+ }
+
fake_argv[2] = portstr;
if (title != NULL)

View File

@ -1,14 +0,0 @@
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -601,6 +601,9 @@ class XendDomainInfo:
_, dev_info = sxprs[dev]
else: # 'vbd' or 'tap'
dev_info = self.getDeviceInfo_vbd(dev)
+ # To remove the UUID of the device from refs,
+ # deviceClass must be always 'vbd'.
+ deviceClass = 'vbd'
if dev_info is None:
return rc

View File

@ -1,469 +0,0 @@
Index: xen-3.1-testing/xen/arch/x86/mm.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/mm.c
+++ xen-3.1-testing/xen/arch/x86/mm.c
@@ -2896,7 +2896,7 @@ long do_set_gdt(XEN_GUEST_HANDLE(ulong)
if ( entries > FIRST_RESERVED_GDT_ENTRY )
return -EINVAL;
- if ( copy_from_guest((unsigned long *)frames, frame_list, nr_pages) )
+ if ( copy_from_guest(frames, frame_list, nr_pages) )
return -EFAULT;
LOCK_BIGLOCK(current->domain);
@@ -3077,7 +3077,7 @@ long arch_memory_op(int op, XEN_GUEST_HA
else if ( (d = rcu_lock_domain_by_id(fmap.domid)) == NULL )
return -ESRCH;
- rc = copy_from_guest(&d->arch.e820[0], fmap.map.buffer,
+ rc = copy_from_guest(d->arch.e820, fmap.map.buffer,
fmap.map.nr_entries) ? -EFAULT : 0;
d->arch.nr_e820 = fmap.map.nr_entries;
@@ -3098,7 +3098,7 @@ long arch_memory_op(int op, XEN_GUEST_HA
return -EFAULT;
map.nr_entries = min(map.nr_entries, d->arch.nr_e820);
- if ( copy_to_guest(map.buffer, &d->arch.e820[0], map.nr_entries) ||
+ if ( copy_to_guest(map.buffer, d->arch.e820, map.nr_entries) ||
copy_to_guest(arg, &map, 1) )
return -EFAULT;
@@ -3122,7 +3122,7 @@ long arch_memory_op(int op, XEN_GUEST_HA
buffer = guest_handle_cast(memmap.buffer, e820entry_t);
count = min((unsigned int)e820.nr_map, memmap.nr_entries);
- if ( copy_to_guest(buffer, &e820.map[0], count) < 0 )
+ if ( copy_to_guest(buffer, e820.map, count) < 0 )
return -EFAULT;
memmap.nr_entries = count;
@@ -3135,7 +3135,7 @@ long arch_memory_op(int op, XEN_GUEST_HA
case XENMEM_machphys_mapping:
{
- struct xen_machphys_mapping mapping = {
+ static const struct xen_machphys_mapping mapping = {
.v_start = MACH2PHYS_VIRT_START,
.v_end = MACH2PHYS_VIRT_END,
.max_mfn = MACH2PHYS_NR_ENTRIES - 1
Index: xen-3.1-testing/xen/arch/x86/traps.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/traps.c
+++ xen-3.1-testing/xen/arch/x86/traps.c
@@ -1117,7 +1117,7 @@ static inline int guest_io_okay(
* read as 0xff (no access allowed).
*/
TOGGLE_MODE();
- switch ( __copy_from_guest_offset(&x.bytes[0], v->arch.iobmp,
+ switch ( __copy_from_guest_offset(x.bytes, v->arch.iobmp,
port>>3, 2) )
{
default: x.bytes[0] = ~0;
Index: xen-3.1-testing/xen/common/domctl.c
===================================================================
--- xen-3.1-testing.orig/xen/common/domctl.c
+++ xen-3.1-testing/xen/common/domctl.c
@@ -43,7 +43,7 @@ void cpumask_to_xenctl_cpumap(
bitmap_long_to_byte(bytemap, cpus_addr(*cpumask), NR_CPUS);
- copy_to_guest(xenctl_cpumap->bitmap, &bytemap[0], copy_bytes);
+ copy_to_guest(xenctl_cpumap->bitmap, bytemap, copy_bytes);
for ( i = copy_bytes; i < guest_bytes; i++ )
copy_to_guest_offset(xenctl_cpumap->bitmap, i, &zero, 1);
@@ -63,7 +63,7 @@ void xenctl_cpumap_to_cpumask(
if ( guest_handle_is_null(xenctl_cpumap->bitmap) )
return;
- copy_from_guest(&bytemap[0], xenctl_cpumap->bitmap, copy_bytes);
+ copy_from_guest(bytemap, xenctl_cpumap->bitmap, copy_bytes);
bitmap_byte_to_long(cpus_addr(*cpumask), bytemap, NR_CPUS);
}
Index: xen-3.1-testing/xen/common/kernel.c
===================================================================
--- xen-3.1-testing.orig/xen/common/kernel.c
+++ xen-3.1-testing/xen/common/kernel.c
@@ -142,7 +142,7 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
{
xen_extraversion_t extraversion;
safe_strcpy(extraversion, xen_extra_version());
- if ( copy_to_guest(arg, (char *)extraversion, sizeof(extraversion)) )
+ if ( copy_to_guest(arg, extraversion, ARRAY_SIZE(extraversion)) )
return -EFAULT;
return 0;
}
@@ -167,7 +167,7 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
memset(info, 0, sizeof(info));
arch_get_xen_caps(&info);
- if ( copy_to_guest(arg, (char *)info, sizeof(info)) )
+ if ( copy_to_guest(arg, info, ARRAY_SIZE(info)) )
return -EFAULT;
return 0;
}
@@ -187,7 +187,7 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
{
xen_changeset_info_t chgset;
safe_strcpy(chgset, xen_changeset());
- if ( copy_to_guest(arg, (char *)chgset, sizeof(chgset)) )
+ if ( copy_to_guest(arg, chgset, ARRAY_SIZE(chgset)) )
return -EFAULT;
return 0;
}
@@ -229,8 +229,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
case XENVER_guest_handle:
{
- if ( copy_to_guest(arg, (char *)current->domain->handle,
- sizeof(current->domain->handle)) )
+ if ( copy_to_guest(arg, current->domain->handle,
+ ARRAY_SIZE(current->domain->handle)) )
return -EFAULT;
return 0;
}
Index: xen-3.1-testing/xen/common/perfc.c
===================================================================
--- xen-3.1-testing.orig/xen/common/perfc.c
+++ xen-3.1-testing/xen/common/perfc.c
@@ -227,7 +227,7 @@ static int perfc_copy_info(XEN_GUEST_HAN
}
BUG_ON(v != perfc_nbr_vals);
- if ( copy_to_guest(desc, (xen_sysctl_perfc_desc_t *)perfc_d, NR_PERFCTRS) )
+ if ( copy_to_guest(desc, perfc_d, NR_PERFCTRS) )
return -EFAULT;
if ( copy_to_guest(val, perfc_vals, perfc_nbr_vals) )
return -EFAULT;
Index: xen-3.1-testing/xen/drivers/char/console.c
===================================================================
--- xen-3.1-testing.orig/xen/drivers/char/console.c
+++ xen-3.1-testing/xen/drivers/char/console.c
@@ -326,7 +326,7 @@ static long guest_console_write(XEN_GUES
CONSOLEIO_write, count, buffer);
kcount = min_t(int, count, sizeof(kbuf)-1);
- if ( copy_from_guest((char *)kbuf, buffer, kcount) )
+ if ( copy_from_guest(kbuf, buffer, kcount) )
return -EFAULT;
kbuf[kcount] = '\0';
Index: xen-3.1-testing/xen/include/asm-ia64/guest_access.h
===================================================================
--- xen-3.1-testing.orig/xen/include/asm-ia64/guest_access.h
+++ xen-3.1-testing/xen/include/asm-ia64/guest_access.h
@@ -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: xen-3.1-testing/xen/include/asm-x86/guest_access.h
===================================================================
--- xen-3.1-testing.orig/xen/include/asm-x86/guest_access.h
+++ xen-3.1-testing/xen/include/asm-x86/guest_access.h
@@ -32,11 +32,12 @@
* specifying an offset into the guest array.
*/
#define copy_to_guest_offset(hnd, off, ptr, nr) ({ \
- typeof(ptr) _x = (hnd).p; \
- const typeof(ptr) _y = (ptr); \
+ const typeof(*(ptr)) *_s = (ptr); \
+ char (*_d)[sizeof(*_s)] = (void *)(hnd).p; \
+ ((void)((hnd).p == (ptr))); \
is_hvm_vcpu(current) ? \
- copy_to_user_hvm(_x+(off), _y, sizeof(*_x)*(nr)) : \
- copy_to_user(_x+(off), _y, sizeof(*_x)*(nr)); \
+ copy_to_user_hvm(_d+(off), _s, sizeof(*_s)*(nr)) : \
+ copy_to_user(_d+(off), _s, sizeof(*_s)*(nr)); \
})
/*
@@ -44,29 +45,30 @@
* specifying an offset into the guest array.
*/
#define copy_from_guest_offset(ptr, hnd, off, nr) ({ \
- const typeof(ptr) _x = (hnd).p; \
- typeof(ptr) _y = (ptr); \
+ const typeof(*(ptr)) *_s = (hnd).p; \
+ typeof(*(ptr)) *_d = (ptr); \
is_hvm_vcpu(current) ? \
- copy_from_user_hvm(_y, _x+(off), sizeof(*_x)*(nr)) :\
- copy_from_user(_y, _x+(off), sizeof(*_x)*(nr)); \
+ copy_from_user_hvm(_d, _s+(off), sizeof(*_d)*(nr)) :\
+ copy_from_user(_d, _s+(off), sizeof(*_d)*(nr)); \
})
/* Copy sub-field of a structure to guest context via a guest handle. */
#define copy_field_to_guest(hnd, ptr, field) ({ \
- typeof(&(ptr)->field) _x = &(hnd).p->field; \
- const typeof(&(ptr)->field) _y = &(ptr)->field; \
+ const typeof(&(ptr)->field) _s = &(ptr)->field; \
+ void *_d = &(hnd).p->field; \
+ ((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)); \
+ copy_to_user_hvm(_d, _s, sizeof(*_s)) : \
+ copy_to_user(_d, _s, sizeof(*_s)); \
})
/* Copy sub-field of a structure from guest context via a guest handle. */
#define copy_field_from_guest(ptr, hnd, field) ({ \
- const typeof(&(ptr)->field) _x = &(hnd).p->field; \
- typeof(&(ptr)->field) _y = &(ptr)->field; \
+ const typeof(&(ptr)->field) _s = &(hnd).p->field; \
+ typeof(&(ptr)->field) _d = &(ptr)->field; \
is_hvm_vcpu(current) ? \
- copy_from_user_hvm(_y, _x, sizeof(*_x)) : \
- copy_from_user(_y, _x, sizeof(*_x)); \
+ copy_from_user_hvm(_d, _s, sizeof(*_d)) : \
+ copy_from_user(_d, _s, sizeof(*_d)); \
})
/*
@@ -78,35 +80,37 @@
array_access_ok((hnd).p, (nr), sizeof(*(hnd).p)))
#define __copy_to_guest_offset(hnd, off, ptr, nr) ({ \
- typeof(ptr) _x = (hnd).p; \
- const typeof(ptr) _y = (ptr); \
+ const typeof(*(ptr)) *_s = (ptr); \
+ char (*_d)[sizeof(*_s)] = (void *)(hnd).p; \
+ ((void)((hnd).p == (ptr))); \
is_hvm_vcpu(current) ? \
- copy_to_user_hvm(_x+(off), _y, sizeof(*_x)*(nr)) : \
- __copy_to_user(_x+(off), _y, sizeof(*_x)*(nr)); \
+ copy_to_user_hvm(_d+(off), _s, sizeof(*_s)*(nr)) : \
+ __copy_to_user(_d+(off), _s, sizeof(*_s)*(nr)); \
})
#define __copy_from_guest_offset(ptr, hnd, off, nr) ({ \
- const typeof(ptr) _x = (hnd).p; \
- typeof(ptr) _y = (ptr); \
+ const typeof(*(ptr)) *_s = (hnd).p; \
+ typeof(*(ptr)) *_d = (ptr); \
is_hvm_vcpu(current) ? \
- copy_from_user_hvm(_y, _x+(off),sizeof(*_x)*(nr)) : \
- __copy_from_user(_y, _x+(off), sizeof(*_x)*(nr)); \
+ copy_from_user_hvm(_d, _s+(off), sizeof(*_d)*(nr)) :\
+ __copy_from_user(_d, _s+(off), sizeof(*_d)*(nr)); \
})
#define __copy_field_to_guest(hnd, ptr, field) ({ \
- typeof(&(ptr)->field) _x = &(hnd).p->field; \
- const typeof(&(ptr)->field) _y = &(ptr)->field; \
+ const typeof(&(ptr)->field) _s = &(ptr)->field; \
+ void *_d = &(hnd).p->field; \
+ ((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)); \
+ copy_to_user_hvm(_d, _s, sizeof(*_s)) : \
+ __copy_to_user(_d, _s, sizeof(*_s)); \
})
#define __copy_field_from_guest(ptr, hnd, field) ({ \
- const typeof(&(ptr)->field) _x = &(hnd).p->field; \
- typeof(&(ptr)->field) _y = &(ptr)->field; \
+ const typeof(&(ptr)->field) _s = &(hnd).p->field; \
+ typeof(&(ptr)->field) _d = &(ptr)->field; \
is_hvm_vcpu(current) ? \
- copy_from_user_hvm(_y, _x, sizeof(*_x)) : \
- __copy_from_user(_y, _x, sizeof(*_x)); \
+ copy_from_user_hvm(_d, _s, sizeof(*_d)) : \
+ __copy_from_user(_d, _s, sizeof(*_d)); \
})
#endif /* __ASM_X86_GUEST_ACCESS_H__ */
Index: xen-3.1-testing/xen/include/xen/compat.h
===================================================================
--- xen-3.1-testing.orig/xen/include/xen/compat.h
+++ xen-3.1-testing/xen/include/xen/compat.h
@@ -44,9 +44,10 @@
* specifying an offset into the guest array.
*/
#define copy_to_compat_offset(hnd, off, ptr, nr) ({ \
- const typeof(ptr) _x = (typeof(**(hnd)._) *)(full_ptr_t)(hnd).c; \
- const typeof(*(ptr)) *const _y = (ptr); \
- copy_to_user(_x + (off), _y, sizeof(*_x) * (nr)); \
+ const typeof(*(ptr)) *_s = (ptr); \
+ char (*_d)[sizeof(*_s)] = (void *)(full_ptr_t)(hnd).c; \
+ ((void)((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c == (ptr))); \
+ copy_to_user(_d + (off), _s, sizeof(*_s) * (nr)); \
})
/*
@@ -54,9 +55,9 @@
* specifying an offset into the guest array.
*/
#define copy_from_compat_offset(ptr, hnd, off, nr) ({ \
- const typeof(ptr) _x = (typeof(**(hnd)._) *)(full_ptr_t)(hnd).c; \
- const typeof(ptr) _y = (ptr); \
- copy_from_user(_y, _x + (off), sizeof(*_x) * (nr)); \
+ const typeof(*(ptr)) *_s = (typeof(**(hnd)._) *)(full_ptr_t)(hnd).c; \
+ typeof(*(ptr)) *_d = (ptr); \
+ copy_from_user(_d, _s + (off), sizeof(*_d) * (nr)); \
})
#define copy_to_compat(hnd, ptr, nr) \
@@ -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) ({ \
- typeof((ptr)->field) *const _x = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
- const typeof((ptr)->field) *const _y = &(ptr)->field; \
- 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)->field == &(ptr)->field)); \
+ copy_to_user(_d, _s, sizeof(*_s)); \
})
/* Copy sub-field of a structure from guest context via a compat handle. */
#define copy_field_from_compat(ptr, hnd, field) ({ \
- 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 typeof(&(ptr)->field) _s = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
+ typeof(&(ptr)->field) _d = &(ptr)->field; \
+ copy_from_user(_d, _s, sizeof(*_d)); \
})
/*
@@ -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) ({ \
- const typeof(ptr) _x = (typeof(**(hnd)._) *)(full_ptr_t)(hnd).c; \
- const typeof(*(ptr)) *const _y = (ptr); \
- __copy_to_user(_x + (off), _y, sizeof(*_x) * (nr)); \
+ const typeof(*(ptr)) *_s = (ptr); \
+ char (*_d)[sizeof(*_s)] = (void *)(full_ptr_t)(hnd).c; \
+ ((void)((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c == (ptr))); \
+ __copy_to_user(_d + (off), _s, sizeof(*_s) * (nr)); \
})
#define __copy_from_compat_offset(ptr, hnd, off, nr) ({ \
- const typeof(ptr) _x = (typeof(**(hnd)._) *)(full_ptr_t)(hnd).c; \
- const typeof(ptr) _y = (ptr); \
- __copy_from_user(_y, _x + (off), sizeof(*_x) * (nr)); \
+ const typeof(*(ptr)) *_s = (typeof(**(hnd)._) *)(full_ptr_t)(hnd).c; \
+ typeof(*(ptr)) *_d = (ptr); \
+ __copy_from_user(_d, _s + (off), sizeof(*_d) * (nr)); \
})
#define __copy_to_compat(hnd, ptr, nr) \
@@ -105,15 +108,16 @@
__copy_from_compat_offset(ptr, hnd, 0, nr)
#define __copy_field_to_compat(hnd, ptr, field) ({ \
- typeof((ptr)->field) *const _x = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
- const typeof((ptr)->field) *const _y = &(ptr)->field; \
- __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)->field == &(ptr)->field)); \
+ __copy_to_user(_d, _s, sizeof(*_s)); \
})
#define __copy_field_from_compat(ptr, hnd, field) ({ \
- 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 typeof(&(ptr)->field) _s = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field; \
+ typeof(&(ptr)->field) _d = &(ptr)->field; \
+ __copy_from_user(_d, _s, sizeof(*_d)); \
})
Index: xen-3.1-testing/xen/include/xen/xencomm.h
===================================================================
--- xen-3.1-testing.orig/xen/include/xen/xencomm.h
+++ xen-3.1-testing/xen/include/xen/xencomm.h
@@ -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,401 +0,0 @@
Index: 2007-05-14/xen/arch/x86/hvm/svm/emulate.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/svm/emulate.c 2007-04-23 10:01:41.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/svm/emulate.c 2007-05-14 14:33:28.000000000 +0200
@@ -145,9 +145,8 @@ unsigned long get_effective_addr_modrm64
struct vcpu *v = current;
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
- HVM_DBG_LOG(DBG_LEVEL_1, "get_effective_addr_modrm64(): prefix = %x, "
- "length = %d, operand[0,1] = %x %x.\n", prefix, *size, operand [0],
- operand [1]);
+ HVM_DBG_LOG(DBG_LEVEL_1, "prefix = %x, length = %d, operand[0,1] = %x %x",
+ prefix, *size, operand[0], operand[1]);
if ((NULL == size) || (NULL == operand) || (1 > *size))
{
Index: 2007-05-14/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/svm/svm.c 2007-05-14 14:33:08.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/svm/svm.c 2007-05-14 14:33:28.000000000 +0200
@@ -135,7 +135,7 @@ static inline int long_mode_do_msr_write
struct vcpu *v = current;
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
- HVM_DBG_LOG(DBG_LEVEL_1, "msr %x msr_content %"PRIx64"\n",
+ HVM_DBG_LOG(DBG_LEVEL_0, "msr %x msr_content %"PRIx64,
ecx, msr_content);
switch ( ecx )
@@ -394,7 +394,7 @@ int svm_vmcb_restore(struct vcpu *v, str
* If different, make a shadow. Check if the PDBR is valid
* first.
*/
- HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 c->cr3 = %"PRIx64"", c->cr3);
+ HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 c->cr3 = %"PRIx64, c->cr3);
mfn = gmfn_to_mfn(v->domain, c->cr3 >> PAGE_SHIFT);
if( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
goto bad_cr3;
@@ -1532,7 +1532,7 @@ static int svm_set_cr0(unsigned long val
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
unsigned long old_base_mfn;
- HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR0 value = %lx\n", value);
+ HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR0 value = %lx", value);
/* ET is reserved and should be always be 1. */
value |= X86_CR0_ET;
@@ -1557,11 +1557,11 @@ static int svm_set_cr0(unsigned long val
{
if ( !svm_cr4_pae_is_set(v) )
{
- HVM_DBG_LOG(DBG_LEVEL_1, "Enable paging before PAE enable\n");
+ HVM_DBG_LOG(DBG_LEVEL_1, "Enable paging before PAE enable");
svm_inject_exception(v, TRAP_gp_fault, 1, 0);
return 0;
}
- HVM_DBG_LOG(DBG_LEVEL_1, "Enable the Long mode\n");
+ HVM_DBG_LOG(DBG_LEVEL_1, "Enable the Long mode");
v->arch.hvm_svm.cpu_shadow_efer |= EFER_LMA;
vmcb->efer |= EFER_LMA | EFER_LME;
}
@@ -1654,7 +1654,7 @@ static void mov_from_cr(int cr, int gp,
set_reg(gp, value, regs, vmcb);
- HVM_DBG_LOG(DBG_LEVEL_VMMU, "mov_from_cr: CR%d, value = %lx,", cr, value);
+ HVM_DBG_LOG(DBG_LEVEL_VMMU, "mov_from_cr: CR%d, value = %lx", cr, value);
}
@@ -1672,8 +1672,8 @@ static int mov_to_cr(int gpreg, int cr,
HVMTRACE_2D(CR_WRITE, v, cr, value);
- HVM_DBG_LOG(DBG_LEVEL_1, "mov_to_cr: CR%d, value = %lx,", cr, value);
- HVM_DBG_LOG(DBG_LEVEL_1, "current = %lx,", (unsigned long) current);
+ HVM_DBG_LOG(DBG_LEVEL_1, "mov_to_cr: CR%d, value = %lx, current = %p",
+ cr, value, v);
switch ( cr )
{
Index: 2007-05-14/xen/arch/x86/hvm/vioapic.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vioapic.c 2007-04-23 10:01:41.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vioapic.c 2007-05-14 14:33:28.000000000 +0200
@@ -99,7 +99,7 @@ static unsigned long vioapic_read(struct
struct hvm_hw_vioapic *vioapic = domain_vioapic(v->domain);
uint32_t result;
- HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "vioapic_read addr %lx\n", addr);
+ HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "addr %lx", addr);
addr &= 0xff;
@@ -183,8 +183,7 @@ static void vioapic_write_indirect(
{
uint32_t redir_index = (vioapic->ioregsel - 0x10) >> 1;
- HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "vioapic_write_indirect "
- "change redir index %x val %lx\n",
+ HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "change redir index %x val %lx",
redir_index, val);
if ( redir_index >= VIOAPIC_NUM_PINS )
@@ -252,8 +251,7 @@ static void ioapic_inj_irq(
uint8_t trig_mode,
uint8_t delivery_mode)
{
- HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic_inj_irq "
- "irq %d trig %d delive mode %d\n",
+ HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "irq %d trig %d deliv %d",
vector, trig_mode, delivery_mode);
switch ( delivery_mode )
@@ -275,8 +273,8 @@ static uint32_t ioapic_get_delivery_bitm
uint32_t mask = 0;
struct vcpu *v;
- HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic_get_delivery_bitmask "
- "dest %d dest_mode %d\n", dest, dest_mode);
+ HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "dest %d dest_mode %d",
+ dest, dest_mode);
if ( dest_mode == 0 ) /* Physical mode. */
{
@@ -304,7 +302,7 @@ static uint32_t ioapic_get_delivery_bitm
}
out:
- HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic_get_delivery_bitmask mask %x\n",
+ HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "mask %x",
mask);
return mask;
}
@@ -331,14 +329,13 @@ static void vioapic_deliver(struct hvm_h
HVM_DBG_LOG(DBG_LEVEL_IOAPIC,
"dest=%x dest_mode=%x delivery_mode=%x "
- "vector=%x trig_mode=%x\n",
+ "vector=%x trig_mode=%x",
dest, dest_mode, delivery_mode, vector, trig_mode);
deliver_bitmask = ioapic_get_delivery_bitmask(vioapic, dest, dest_mode);
if ( !deliver_bitmask )
{
- HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic deliver "
- "no target on destination\n");
+ HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "no target on destination");
return;
}
@@ -364,7 +361,7 @@ static void vioapic_deliver(struct hvm_h
else
{
HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "null round robin: "
- "mask=%x vector=%x delivery_mode=%x\n",
+ "mask=%x vector=%x delivery_mode=%x",
deliver_bitmask, vector, dest_LowestPrio);
}
break;
@@ -412,7 +409,7 @@ void vioapic_irq_positive_edge(struct do
struct hvm_hw_vioapic *vioapic = domain_vioapic(d);
union vioapic_redir_entry *ent;
- HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic_irq_positive_edge irq %x", irq);
+ HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "irq %x", irq);
ASSERT(irq < VIOAPIC_NUM_PINS);
ASSERT(spin_is_locked(&d->arch.hvm_domain.irq_lock));
Index: 2007-05-14/xen/arch/x86/hvm/vlapic.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vlapic.c 2007-04-23 10:01:41.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vlapic.c 2007-05-14 14:33:28.000000000 +0200
@@ -171,7 +171,7 @@ uint32_t vlapic_get_ppr(struct vlapic *v
ppr = isrv & 0xf0;
HVM_DBG_LOG(DBG_LEVEL_VLAPIC_INTERRUPT,
- "vlapic %p, ppr 0x%x, isr 0x%x, isrv 0x%x.",
+ "vlapic %p, ppr 0x%x, isr 0x%x, isrv 0x%x",
vlapic, ppr, isr, isrv);
return ppr;
@@ -211,7 +211,7 @@ static int vlapic_match_dest(struct vcpu
struct vlapic *target = vcpu_vlapic(v);
HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "target %p, source %p, dest 0x%x, "
- "dest_mode 0x%x, short_hand 0x%x\n",
+ "dest_mode 0x%x, short_hand 0x%x",
target, source, dest, dest_mode, short_hand);
switch ( short_hand )
@@ -270,14 +270,14 @@ static int vlapic_accept_irq(struct vcpu
if ( vlapic_test_and_set_irr(vector, vlapic) && trig_mode )
{
HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
- "level trig mode repeatedly for vector %d\n", vector);
+ "level trig mode repeatedly for vector %d", vector);
break;
}
if ( trig_mode )
{
HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
- "level trig mode for vector %d\n", vector);
+ "level trig mode for vector %d", vector);
vlapic_set_vector(vector, &vlapic->regs->data[APIC_TMR]);
}
@@ -399,7 +399,7 @@ static void vlapic_ipi(struct vlapic *vl
HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "icr_high 0x%x, icr_low 0x%x, "
"short_hand 0x%x, dest 0x%x, trig_mode 0x%x, level 0x%x, "
- "dest_mode 0x%x, delivery_mode 0x%x, vector 0x%x.",
+ "dest_mode 0x%x, delivery_mode 0x%x, vector 0x%x",
icr_high, icr_low, short_hand, dest,
trig_mode, level, dest_mode, delivery_mode, vector);
@@ -437,7 +437,7 @@ static uint32_t vlapic_get_tmcct(struct
HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
"timer initial count %d, timer current count %d, "
- "offset %"PRId64".",
+ "offset %"PRId64,
tmict, tmcct, counter_passed);
return tmcct;
@@ -454,7 +454,7 @@ static void vlapic_set_tdcr(struct vlapi
vlapic->hw.timer_divisor = 1 << (val & 7);
HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
- "vlapic_set_tdcr timer_divisor: %d.", vlapic->hw.timer_divisor);
+ "timer_divisor: %d", vlapic->hw.timer_divisor);
}
static void vlapic_read_aligned(struct vlapic *vlapic, unsigned int offset,
@@ -493,7 +493,7 @@ static unsigned long vlapic_read(struct
/* some bugs on kernel cause read this with byte*/
if ( len != 4 )
HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
- "read with len=0x%lx, should be 4 instead.\n",
+ "read with len=0x%lx, should be 4 instead",
len);
alignment = offset & 0x3;
@@ -522,7 +522,7 @@ static unsigned long vlapic_read(struct
}
HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "offset 0x%x with length 0x%lx, "
- "and the result is 0x%lx.", offset, len, result);
+ "and the result is 0x%lx", offset, len, result);
return result;
@@ -539,7 +539,7 @@ static void vlapic_write(struct vcpu *v,
if ( offset != 0xb0 )
HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
- "offset 0x%x with length 0x%lx, and value is 0x%lx.",
+ "offset 0x%x with length 0x%lx, and value is 0x%lx",
offset, len, val);
/*
@@ -713,7 +713,7 @@ void vlapic_msr_set(struct vlapic *vlapi
vlapic->hw.apic_base_msr = value;
HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
- "apic base msr is 0x%016"PRIx64".", vlapic->hw.apic_base_msr);
+ "apic base msr is 0x%016"PRIx64, vlapic->hw.apic_base_msr);
}
int vlapic_accept_pic_intr(struct vcpu *v)
@@ -913,7 +913,7 @@ int vlapic_init(struct vcpu *v)
{
struct vlapic *vlapic = vcpu_vlapic(v);
- HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "vlapic_init %d", v->vcpu_id);
+ HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "%d", v->vcpu_id);
vlapic->regs_page = alloc_domheap_page(NULL);
if ( vlapic->regs_page == NULL )
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmx.c 2007-05-14 14:33:24.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c 2007-05-14 14:33:28.000000000 +0200
@@ -111,10 +111,11 @@ static void vmx_save_host_msrs(void)
static inline int long_mode_do_msr_read(struct cpu_user_regs *regs)
{
u64 msr_content = 0;
+ u32 ecx = regs->ecx;
struct vcpu *v = current;
struct vmx_msr_state *guest_msr_state = &v->arch.hvm_vmx.msr_state;
- switch ( (u32)regs->ecx ) {
+ switch ( ecx ) {
case MSR_EFER:
msr_content = v->arch.hvm_vmx.efer;
break;
@@ -157,7 +158,7 @@ static inline int long_mode_do_msr_read(
return 0;
}
- HVM_DBG_LOG(DBG_LEVEL_2, "msr_content: 0x%"PRIx64, msr_content);
+ HVM_DBG_LOG(DBG_LEVEL_0, "msr 0x%x content 0x%"PRIx64, ecx, msr_content);
regs->eax = (u32)(msr_content >> 0);
regs->edx = (u32)(msr_content >> 32);
@@ -173,8 +174,7 @@ static inline int long_mode_do_msr_write
struct vmx_msr_state *guest_msr_state = &v->arch.hvm_vmx.msr_state;
struct vmx_msr_state *host_msr_state = &this_cpu(host_msr_state);
- HVM_DBG_LOG(DBG_LEVEL_1, "msr 0x%x msr_content 0x%"PRIx64"\n",
- ecx, msr_content);
+ HVM_DBG_LOG(DBG_LEVEL_0, "msr 0x%x content 0x%"PRIx64, ecx, msr_content);
switch ( ecx )
{
@@ -262,7 +262,7 @@ static inline int long_mode_do_msr_write
return 1;
uncanonical_address:
- HVM_DBG_LOG(DBG_LEVEL_1, "Not cano address of msr write %x\n", ecx);
+ HVM_DBG_LOG(DBG_LEVEL_0, "Not cano address of msr write %x", ecx);
gp_fault:
vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
return 0;
@@ -577,7 +577,7 @@ int vmx_vmcs_restore(struct vcpu *v, str
* If different, make a shadow. Check if the PDBR is valid
* first.
*/
- HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 c->cr3 = %"PRIx64"", c->cr3);
+ HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 c->cr3 = %"PRIx64, c->cr3);
/* current!=vcpu as not called by arch_vmx_do_launch */
mfn = gmfn_to_mfn(v->domain, c->cr3 >> PAGE_SHIFT);
if( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain)) {
@@ -2024,7 +2024,7 @@ static int vmx_set_cr0(unsigned long val
unsigned long old_cr0;
unsigned long old_base_mfn;
- HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR0 value = %lx\n", value);
+ HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR0 value = %lx", value);
/* ET is reserved and should be always be 1. */
value |= X86_CR0_ET;
@@ -2073,12 +2073,12 @@ static int vmx_set_cr0(unsigned long val
if ( !(v->arch.hvm_vmx.cpu_shadow_cr4 & X86_CR4_PAE) )
{
HVM_DBG_LOG(DBG_LEVEL_1, "Guest enabled paging "
- "with EFER.LME set but not CR4.PAE\n");
+ "with EFER.LME set but not CR4.PAE");
vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
}
else
{
- HVM_DBG_LOG(DBG_LEVEL_1, "Enabling long mode\n");
+ HVM_DBG_LOG(DBG_LEVEL_1, "Enabling long mode");
v->arch.hvm_vmx.efer |= EFER_LMA;
vm_entry_value = __vmread(VM_ENTRY_CONTROLS);
vm_entry_value |= VM_ENTRY_IA32E_MODE;
@@ -2139,7 +2139,7 @@ static int vmx_set_cr0(unsigned long val
{
eip = __vmread(GUEST_RIP);
HVM_DBG_LOG(DBG_LEVEL_1,
- "Transfering control to vmxassist %%eip 0x%lx\n", eip);
+ "Transfering control to vmxassist %%eip 0x%lx", eip);
return 0; /* do not update eip! */
}
}
@@ -2147,12 +2147,12 @@ static int vmx_set_cr0(unsigned long val
{
eip = __vmread(GUEST_RIP);
HVM_DBG_LOG(DBG_LEVEL_1,
- "Enabling CR0.PE at %%eip 0x%lx\n", eip);
+ "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\n", eip);
+ "Restoring to %%eip 0x%lx", eip);
return 0; /* do not update eip! */
}
}
@@ -2310,7 +2310,7 @@ static int mov_to_cr(int gp, int cr, str
if ( unlikely(vmx_long_mode_enabled(v)) )
{
HVM_DBG_LOG(DBG_LEVEL_1, "Guest cleared CR4.PAE while "
- "EFER.LMA is set\n");
+ "EFER.LMA is set");
vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
}
}
@@ -2440,8 +2440,7 @@ static inline int vmx_do_msr_read(struct
u32 ecx = regs->ecx, eax, edx;
struct vcpu *v = current;
- HVM_DBG_LOG(DBG_LEVEL_1, "ecx=%x, eax=%x, edx=%x",
- ecx, (u32)regs->eax, (u32)regs->edx);
+ HVM_DBG_LOG(DBG_LEVEL_1, "ecx=%x", ecx);
switch (ecx) {
case MSR_IA32_TIME_STAMP_COUNTER:

View File

@ -1,670 +0,0 @@
Index: 2007-05-14/xen/arch/x86/domain.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/domain.c 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/arch/x86/domain.c 2007-07-02 11:19:31.000000000 +0200
@@ -47,6 +47,7 @@
#endif
DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
+DEFINE_PER_CPU(__u64, efer);
static void paravirt_ctxt_switch_from(struct vcpu *v);
static void paravirt_ctxt_switch_to(struct vcpu *v);
@@ -1150,21 +1151,18 @@ void context_switch(struct vcpu *prev, s
__context_switch();
#ifdef CONFIG_COMPAT
- if ( is_idle_vcpu(prev) ||
- (is_pv_32on64_domain(prev->domain) !=
- is_pv_32on64_domain(next->domain)) )
+ if ( !is_hvm_vcpu(next) &&
+ (is_idle_vcpu(prev) ||
+ is_hvm_vcpu(prev) ||
+ is_pv_32on64_vcpu(prev) != is_pv_32on64_vcpu(next)) )
{
- uint32_t efer_lo, efer_hi;
+ uint64_t efer = read_efer();
local_flush_tlb_one(GDT_VIRT_START(next) +
FIRST_RESERVED_GDT_BYTE);
- rdmsr(MSR_EFER, efer_lo, efer_hi);
- if ( !is_pv_32on64_domain(next->domain) == !(efer_lo & EFER_SCE) )
- {
- efer_lo ^= EFER_SCE;
- wrmsr(MSR_EFER, efer_lo, efer_hi);
- }
+ if ( !is_pv_32on64_vcpu(next) == !(efer & EFER_SCE) )
+ write_efer(efer ^ EFER_SCE);
}
#endif
Index: 2007-05-14/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/svm/svm.c 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/svm/svm.c 2007-05-14 14:28:19.000000000 +0200
@@ -96,11 +96,8 @@ static inline void svm_inject_exception(
static void stop_svm(void)
{
- u32 eax, edx;
/* We turn off the EFER_SVME bit. */
- rdmsr(MSR_EFER, eax, edx);
- eax &= ~EFER_SVME;
- wrmsr(MSR_EFER, eax, edx);
+ write_efer(read_efer() & ~EFER_SVME);
}
static void svm_store_cpu_guest_regs(
@@ -145,7 +142,13 @@ static inline int long_mode_do_msr_write
{
case MSR_EFER:
/* Offending reserved bit will cause #GP. */
- if ( msr_content & ~(EFER_LME | EFER_LMA | EFER_NX | EFER_SCE) )
+#ifdef __x86_64__
+ if ( (msr_content & ~(EFER_LME | EFER_LMA | EFER_NX | EFER_SCE)) ||
+#else
+ if ( (msr_content & ~(EFER_NX | EFER_SCE)) ||
+#endif
+ (!cpu_has_nx && (msr_content & EFER_NX)) ||
+ (!cpu_has_syscall && (msr_content & EFER_SCE)) )
{
gdprintk(XENLOG_WARNING, "Trying to set reserved bit in "
"EFER: %"PRIx64"\n", msr_content);
@@ -502,7 +505,7 @@ int svm_vmcb_restore(struct vcpu *v, str
}
-void svm_save_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
+static void svm_save_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
{
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
@@ -518,7 +521,7 @@ void svm_save_cpu_state(struct vcpu *v,
}
-void svm_load_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
+static void svm_load_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
{
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
@@ -537,13 +540,13 @@ void svm_load_cpu_state(struct vcpu *v,
hvm_set_guest_time(v, data->tsc);
}
-void svm_save_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
+static void svm_save_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
{
svm_save_cpu_state(v, ctxt);
svm_vmcb_save(v, ctxt);
}
-int svm_load_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
+static int svm_load_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
{
svm_load_cpu_state(v, ctxt);
if (svm_vmcb_restore(v, ctxt)) {
@@ -871,6 +874,7 @@ static struct hvm_function_table svm_fun
.paging_enabled = svm_paging_enabled,
.long_mode_enabled = svm_long_mode_enabled,
.pae_enabled = svm_pae_enabled,
+ .nx_enabled = svm_nx_enabled,
.interrupts_enabled = svm_interrupts_enabled,
.guest_x86_mode = svm_guest_x86_mode,
.get_guest_ctrl_reg = svm_get_ctrl_reg,
@@ -927,9 +931,7 @@ int start_svm(void)
((root_vmcb[cpu] = alloc_vmcb()) == NULL) )
return 0;
- rdmsr(MSR_EFER, eax, edx);
- eax |= EFER_SVME;
- wrmsr(MSR_EFER, eax, edx);
+ write_efer(read_efer() | EFER_SVME);
svm_npt_detect();
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmcs.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmcs.c 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmcs.c 2007-05-14 14:28:19.000000000 +0200
@@ -285,11 +285,6 @@ static void construct_vmcs(struct vcpu *
vmx_vmcs_enter(v);
- v->arch.hvm_vmx.cpu_cr2 = 0;
- v->arch.hvm_vmx.cpu_cr3 = 0;
- memset(&v->arch.hvm_vmx.msr_state, 0, sizeof(v->arch.hvm_vmx.msr_state));
- v->arch.hvm_vmx.vmxassist_enabled = 0;
-
/* VMCS controls. */
__vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_control);
__vmwrite(VM_EXIT_CONTROLS, vmx_vmexit_control);
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmx.c 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c 2007-08-09 09:58:47.000000000 +0200
@@ -89,7 +89,7 @@ static DEFINE_PER_CPU(struct vmx_msr_sta
static u32 msr_index[VMX_MSR_COUNT] =
{
MSR_LSTAR, MSR_STAR, MSR_CSTAR,
- MSR_SYSCALL_MASK, MSR_EFER,
+ MSR_SYSCALL_MASK
};
static void vmx_save_host_msrs(void)
@@ -117,8 +117,7 @@ static inline int long_mode_do_msr_read(
switch ( (u32)regs->ecx ) {
case MSR_EFER:
- HVM_DBG_LOG(DBG_LEVEL_2, "EFER msr_content 0x%"PRIx64, msr_content);
- msr_content = guest_msr_state->msrs[VMX_INDEX_MSR_EFER];
+ msr_content = v->arch.hvm_vmx.efer;
break;
case MSR_FS_BASE:
@@ -130,7 +129,7 @@ static inline int long_mode_do_msr_read(
goto check_long_mode;
case MSR_SHADOW_GS_BASE:
- msr_content = guest_msr_state->shadow_gs;
+ msr_content = v->arch.hvm_vmx.shadow_gs;
check_long_mode:
if ( !(vmx_long_mode_enabled(v)) )
{
@@ -182,7 +181,9 @@ static inline int long_mode_do_msr_write
{
case MSR_EFER:
/* offending reserved bit will cause #GP */
- if ( msr_content & ~(EFER_LME | EFER_LMA | EFER_NX | EFER_SCE) )
+ if ( (msr_content & ~(EFER_LME | EFER_LMA | EFER_NX | EFER_SCE)) ||
+ (!cpu_has_nx && (msr_content & EFER_NX)) ||
+ (!cpu_has_syscall && (msr_content & EFER_SCE)) )
{
gdprintk(XENLOG_WARNING, "Trying to set reserved bit in "
"EFER: %"PRIx64"\n", msr_content);
@@ -190,7 +191,7 @@ static inline int long_mode_do_msr_write
}
if ( (msr_content & EFER_LME)
- && !(guest_msr_state->msrs[VMX_INDEX_MSR_EFER] & EFER_LME) )
+ && !(v->arch.hvm_vmx.efer & EFER_LME) )
{
if ( unlikely(vmx_paging_enabled(v)) )
{
@@ -200,7 +201,7 @@ static inline int long_mode_do_msr_write
}
}
else if ( !(msr_content & EFER_LME)
- && (guest_msr_state->msrs[VMX_INDEX_MSR_EFER] & EFER_LME) )
+ && (v->arch.hvm_vmx.efer & EFER_LME) )
{
if ( unlikely(vmx_paging_enabled(v)) )
{
@@ -210,7 +211,11 @@ static inline int long_mode_do_msr_write
}
}
- guest_msr_state->msrs[VMX_INDEX_MSR_EFER] = msr_content;
+ if ( (msr_content ^ v->arch.hvm_vmx.efer) & (EFER_NX|EFER_SCE) )
+ write_efer((read_efer() & ~(EFER_NX|EFER_SCE)) |
+ (msr_content & (EFER_NX|EFER_SCE)));
+
+ v->arch.hvm_vmx.efer = msr_content;
break;
case MSR_FS_BASE:
@@ -228,7 +233,7 @@ static inline int long_mode_do_msr_write
__vmwrite(GUEST_GS_BASE, msr_content);
else
{
- v->arch.hvm_vmx.msr_state.shadow_gs = msr_content;
+ v->arch.hvm_vmx.shadow_gs = msr_content;
wrmsrl(MSR_SHADOW_GS_BASE, msr_content);
}
@@ -280,12 +285,14 @@ static void vmx_restore_host_msrs(void)
wrmsrl(msr_index[i], host_msr_state->msrs[i]);
clear_bit(i, &host_msr_state->flags);
}
+ if ( cpu_has_nx && !(read_efer() & EFER_NX) )
+ write_efer(read_efer() | EFER_NX);
}
static void vmx_save_guest_msrs(struct vcpu *v)
{
/* MSR_SHADOW_GS_BASE may have been changed by swapgs instruction. */
- rdmsrl(MSR_SHADOW_GS_BASE, v->arch.hvm_vmx.msr_state.shadow_gs);
+ rdmsrl(MSR_SHADOW_GS_BASE, v->arch.hvm_vmx.shadow_gs);
}
static void vmx_restore_guest_msrs(struct vcpu *v)
@@ -297,11 +304,9 @@ static void vmx_restore_guest_msrs(struc
guest_msr_state = &v->arch.hvm_vmx.msr_state;
host_msr_state = &this_cpu(host_msr_state);
- wrmsrl(MSR_SHADOW_GS_BASE, guest_msr_state->shadow_gs);
+ wrmsrl(MSR_SHADOW_GS_BASE, v->arch.hvm_vmx.shadow_gs);
guest_flags = guest_msr_state->flags;
- if ( !guest_flags )
- return;
while ( guest_flags ) {
i = find_first_set_bit(guest_flags);
@@ -313,23 +318,90 @@ static void vmx_restore_guest_msrs(struc
wrmsrl(msr_index[i], guest_msr_state->msrs[i]);
clear_bit(i, &guest_flags);
}
+
+ if ( (v->arch.hvm_vmx.efer ^ read_efer()) & (EFER_NX|EFER_SCE) )
+ {
+ HVM_DBG_LOG(DBG_LEVEL_2,
+ "restore guest's EFER with value %lx",
+ v->arch.hvm_vmx.efer);
+ write_efer((read_efer() & ~(EFER_NX|EFER_SCE)) |
+ (v->arch.hvm_vmx.efer & (EFER_NX|EFER_SCE)));
+ }
}
#else /* __i386__ */
#define vmx_save_host_msrs() ((void)0)
-#define vmx_restore_host_msrs() ((void)0)
+
+static void vmx_restore_host_msrs(void)
+{
+ if ( cpu_has_nx && !(read_efer() & EFER_NX) )
+ write_efer(read_efer() | EFER_NX);
+}
+
#define vmx_save_guest_msrs(v) ((void)0)
-#define vmx_restore_guest_msrs(v) ((void)0)
+
+static void vmx_restore_guest_msrs(struct vcpu *v)
+{
+ if ( (v->arch.hvm_vmx.efer ^ read_efer()) & EFER_NX )
+ {
+ HVM_DBG_LOG(DBG_LEVEL_2,
+ "restore guest's EFER with value %lx",
+ v->arch.hvm_vmx.efer);
+ write_efer((read_efer() & ~EFER_NX) |
+ (v->arch.hvm_vmx.efer & EFER_NX));
+ }
+}
static inline int long_mode_do_msr_read(struct cpu_user_regs *regs)
{
- return 0;
+ u64 msr_content = 0;
+ struct vcpu *v = current;
+
+ switch ( regs->ecx ) {
+ case MSR_EFER:
+ msr_content = v->arch.hvm_vmx.efer;
+ break;
+
+ default:
+ return 0;
+ }
+
+ regs->eax = msr_content >> 0;
+ regs->edx = msr_content >> 32;
+
+ return 1;
}
static inline int long_mode_do_msr_write(struct cpu_user_regs *regs)
{
- return 0;
+ u64 msr_content = regs->eax | ((u64)regs->edx << 32);
+ struct vcpu *v = current;
+
+ switch ( regs->ecx )
+ {
+ case MSR_EFER:
+ /* offending reserved bit will cause #GP */
+ if ( (msr_content & ~EFER_NX) ||
+ (!cpu_has_nx && (msr_content & EFER_NX)) )
+ {
+ gdprintk(XENLOG_WARNING, "Trying to set reserved bit in "
+ "EFER: %"PRIx64"\n", msr_content);
+ vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
+ return 0;
+ }
+
+ if ( (msr_content ^ v->arch.hvm_vmx.efer) & EFER_NX )
+ write_efer((read_efer() & ~EFER_NX) | (msr_content & EFER_NX));
+
+ v->arch.hvm_vmx.efer = msr_content;
+ break;
+
+ default:
+ return 0;
+ }
+
+ return 1;
}
#endif /* __i386__ */
@@ -637,7 +709,7 @@ int vmx_vmcs_restore(struct vcpu *v, str
return -EINVAL;
}
-#ifdef HVM_DEBUG_SUSPEND
+#if defined(__x86_64__) && defined(HVM_DEBUG_SUSPEND)
static void dump_msr_state(struct vmx_msr_state *m)
{
int i = 0;
@@ -648,17 +720,16 @@ static void dump_msr_state(struct vmx_ms
printk("\n");
}
#else
-static void dump_msr_state(struct vmx_msr_state *m)
-{
-}
+#define dump_msr_state(m) ((void)0)
#endif
-void vmx_save_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
+static void vmx_save_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
{
+#ifdef __x86_64__
struct vmx_msr_state *guest_state = &v->arch.hvm_vmx.msr_state;
unsigned long guest_flags = guest_state->flags;
- data->shadow_gs = guest_state->shadow_gs;
+ data->shadow_gs = v->arch.hvm_vmx.shadow_gs;
/* save msrs */
data->msr_flags = guest_flags;
@@ -666,15 +737,18 @@ void vmx_save_cpu_state(struct vcpu *v,
data->msr_star = guest_state->msrs[VMX_INDEX_MSR_STAR];
data->msr_cstar = guest_state->msrs[VMX_INDEX_MSR_CSTAR];
data->msr_syscall_mask = guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK];
- data->msr_efer = guest_state->msrs[VMX_INDEX_MSR_EFER];
+#endif
+
+ data->msr_efer = v->arch.hvm_vmx.efer;
data->tsc = hvm_get_guest_time(v);
dump_msr_state(guest_state);
}
-void vmx_load_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
+static void vmx_load_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
{
+#ifdef __x86_64__
struct vmx_msr_state *guest_state = &v->arch.hvm_vmx.msr_state;
/* restore msrs */
@@ -683,9 +757,11 @@ void vmx_load_cpu_state(struct vcpu *v,
guest_state->msrs[VMX_INDEX_MSR_STAR] = data->msr_star;
guest_state->msrs[VMX_INDEX_MSR_CSTAR] = data->msr_cstar;
guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK] = data->msr_syscall_mask;
- guest_state->msrs[VMX_INDEX_MSR_EFER] = data->msr_efer;
- guest_state->shadow_gs = data->shadow_gs;
+ v->arch.hvm_vmx.shadow_gs = data->shadow_gs;
+#endif
+
+ v->arch.hvm_vmx.efer = data->msr_efer;
v->arch.hvm_vmx.vmxassist_enabled = !(data->cr0 & X86_CR0_PE);
@@ -695,7 +771,7 @@ void vmx_load_cpu_state(struct vcpu *v,
}
-void vmx_save_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
+static void vmx_save_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
{
vmx_save_cpu_state(v, ctxt);
vmx_vmcs_enter(v);
@@ -703,7 +779,7 @@ void vmx_save_vmcs_ctxt(struct vcpu *v,
vmx_vmcs_exit(v);
}
-int vmx_load_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
+static int vmx_load_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
{
vmx_load_cpu_state(v, ctxt);
if (vmx_vmcs_restore(v, ctxt)) {
@@ -1017,6 +1093,11 @@ static int vmx_pae_enabled(struct vcpu *
return (vmx_paging_enabled(v) && (cr4 & X86_CR4_PAE));
}
+static int vmx_nx_enabled(struct vcpu *v)
+{
+ return v->arch.hvm_vmx.efer & EFER_NX;
+}
+
static int vmx_interrupts_enabled(struct vcpu *v)
{
unsigned long eflags = __vmread(GUEST_RFLAGS);
@@ -1097,6 +1178,7 @@ static struct hvm_function_table vmx_fun
.paging_enabled = vmx_paging_enabled,
.long_mode_enabled = vmx_long_mode_enabled,
.pae_enabled = vmx_pae_enabled,
+ .nx_enabled = vmx_nx_enabled,
.interrupts_enabled = vmx_interrupts_enabled,
.guest_x86_mode = vmx_guest_x86_mode,
.get_guest_ctrl_reg = vmx_get_ctrl_reg,
@@ -1997,8 +2079,7 @@ static int vmx_set_cr0(unsigned long val
else
{
HVM_DBG_LOG(DBG_LEVEL_1, "Enabling long mode\n");
- v->arch.hvm_vmx.msr_state.msrs[VMX_INDEX_MSR_EFER]
- |= EFER_LMA;
+ v->arch.hvm_vmx.efer |= EFER_LMA;
vm_entry_value = __vmread(VM_ENTRY_CONTROLS);
vm_entry_value |= VM_ENTRY_IA32E_MODE;
__vmwrite(VM_ENTRY_CONTROLS, vm_entry_value);
@@ -2047,8 +2128,7 @@ static int vmx_set_cr0(unsigned long val
*/
if ( vmx_long_mode_enabled(v) )
{
- v->arch.hvm_vmx.msr_state.msrs[VMX_INDEX_MSR_EFER]
- &= ~EFER_LMA;
+ v->arch.hvm_vmx.efer &= ~EFER_LMA;
vm_entry_value = __vmread(VM_ENTRY_CONTROLS);
vm_entry_value &= ~VM_ENTRY_IA32E_MODE;
__vmwrite(VM_ENTRY_CONTROLS, vm_entry_value);
@@ -2080,7 +2160,7 @@ static int vmx_set_cr0(unsigned long val
{
if ( vmx_long_mode_enabled(v) )
{
- v->arch.hvm_vmx.msr_state.msrs[VMX_INDEX_MSR_EFER] &= ~EFER_LMA;
+ v->arch.hvm_vmx.efer &= ~EFER_LMA;
vm_entry_value = __vmread(VM_ENTRY_CONTROLS);
vm_entry_value &= ~VM_ENTRY_IA32E_MODE;
__vmwrite(VM_ENTRY_CONTROLS, vm_entry_value);
Index: 2007-05-14/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm/shadow/multi.c 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm/shadow/multi.c 2007-05-14 14:28:19.000000000 +0200
@@ -181,11 +181,11 @@ guest_supports_superpages(struct vcpu *v
static inline int
guest_supports_nx(struct vcpu *v)
{
+ if ( GUEST_PAGING_LEVELS == 2 || !cpu_has_nx )
+ return 0;
if ( !is_hvm_vcpu(v) )
- return cpu_has_nx;
-
- // XXX - fix this!
- return 1;
+ return 1;
+ return hvm_nx_enabled(v);
}
Index: 2007-05-14/xen/include/asm-x86/cpufeature.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/cpufeature.h 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/cpufeature.h 2007-05-14 14:28:19.000000000 +0200
@@ -114,6 +114,7 @@
#define cpu_has_xmm2 boot_cpu_has(X86_FEATURE_XMM2)
#define cpu_has_xmm3 boot_cpu_has(X86_FEATURE_XMM3)
#define cpu_has_ht boot_cpu_has(X86_FEATURE_HT)
+#define cpu_has_syscall boot_cpu_has(X86_FEATURE_SYSCALL)
#define cpu_has_mp boot_cpu_has(X86_FEATURE_MP)
#define cpu_has_nx boot_cpu_has(X86_FEATURE_NX)
#define cpu_has_k6_mtrr boot_cpu_has(X86_FEATURE_K6_MTRR)
@@ -136,6 +137,7 @@
#define cpu_has_xmm2 1
#define cpu_has_xmm3 boot_cpu_has(X86_FEATURE_XMM3)
#define cpu_has_ht boot_cpu_has(X86_FEATURE_HT)
+#define cpu_has_syscall 1
#define cpu_has_mp 1
#define cpu_has_nx boot_cpu_has(X86_FEATURE_NX)
#define cpu_has_k6_mtrr 0
Index: 2007-05-14/xen/include/asm-x86/hvm/hvm.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/hvm.h 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/hvm.h 2007-05-14 14:28:19.000000000 +0200
@@ -93,14 +93,17 @@ struct hvm_function_table {
* 1) determine whether paging is enabled,
* 2) determine whether long mode is enabled,
* 3) determine whether PAE paging is enabled,
- * 4) determine whether interrupts are enabled or not,
- * 5) determine the mode the guest is running in,
- * 6) return the current guest control-register value
- * 7) return the current guest segment descriptor base
+ * 4) determine whether NX is enabled,
+ * 5) determine whether interrupts are enabled or not,
+ * 6) determine the mode the guest is running in,
+ * 7) return the current guest control-register value
+ * 8) return the current guest segment descriptor base
+ * 9) return the current guest segment descriptor
*/
int (*paging_enabled)(struct vcpu *v);
int (*long_mode_enabled)(struct vcpu *v);
int (*pae_enabled)(struct vcpu *v);
+ int (*nx_enabled)(struct vcpu *v);
int (*interrupts_enabled)(struct vcpu *v);
int (*guest_x86_mode)(struct vcpu *v);
unsigned long (*get_guest_ctrl_reg)(struct vcpu *v, unsigned int num);
@@ -199,6 +202,12 @@ hvm_interrupts_enabled(struct vcpu *v)
}
static inline int
+hvm_nx_enabled(struct vcpu *v)
+{
+ return hvm_funcs.nx_enabled(v);
+}
+
+static inline int
hvm_guest_x86_mode(struct vcpu *v)
{
return hvm_funcs.guest_x86_mode(v);
Index: 2007-05-14/xen/include/asm-x86/hvm/svm/svm.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/svm/svm.h 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/svm/svm.h 2007-05-14 14:28:19.000000000 +0200
@@ -62,6 +62,11 @@ static inline int svm_pae_enabled(struct
return svm_paging_enabled(v) && (guest_cr4 & X86_CR4_PAE);
}
+static inline int svm_nx_enabled(struct vcpu *v)
+{
+ return v->arch.hvm_svm.cpu_shadow_efer & EFER_NX;
+}
+
static inline int svm_pgbit_test(struct vcpu *v)
{
return v->arch.hvm_svm.cpu_shadow_cr0 & X86_CR0_PG;
Index: 2007-05-14/xen/include/asm-x86/hvm/vmx/vmcs.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/vmx/vmcs.h 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/vmx/vmcs.h 2007-05-14 14:28:19.000000000 +0200
@@ -39,7 +39,6 @@ enum {
VMX_INDEX_MSR_STAR,
VMX_INDEX_MSR_CSTAR,
VMX_INDEX_MSR_SYSCALL_MASK,
- VMX_INDEX_MSR_EFER,
VMX_MSR_COUNT
};
@@ -47,7 +46,6 @@ enum {
struct vmx_msr_state {
unsigned long flags;
unsigned long msrs[VMX_MSR_COUNT];
- unsigned long shadow_gs;
};
struct arch_vmx_struct {
@@ -76,7 +74,11 @@ struct arch_vmx_struct {
unsigned long cpu_shadow_cr4; /* copy of guest read shadow CR4 */
unsigned long cpu_cr2; /* save CR2 */
unsigned long cpu_cr3;
+#ifdef __x86_64__
struct vmx_msr_state msr_state;
+ unsigned long shadow_gs;
+#endif
+ unsigned long efer;
unsigned long vmxassist_enabled: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-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/vmx/vmx.h 2007-05-14 14:28:19.000000000 +0200
@@ -261,14 +261,12 @@ static inline int vmx_paging_enabled(str
static inline int vmx_long_mode_enabled(struct vcpu *v)
{
- u64 efer = v->arch.hvm_vmx.msr_state.msrs[VMX_INDEX_MSR_EFER];
- return efer & EFER_LMA;
+ return v->arch.hvm_vmx.efer & EFER_LMA;
}
static inline int vmx_lme_is_set(struct vcpu *v)
{
- u64 efer = v->arch.hvm_vmx.msr_state.msrs[VMX_INDEX_MSR_EFER];
- return efer & EFER_LME;
+ return v->arch.hvm_vmx.efer & EFER_LME;
}
static inline int vmx_pgbit_test(struct vcpu *v)
Index: 2007-05-14/xen/include/asm-x86/msr.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/msr.h 2007-08-09 09:57:17.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/msr.h 2007-05-14 14:28:19.000000000 +0200
@@ -3,6 +3,9 @@
#ifndef __ASSEMBLY__
+#include <xen/smp.h>
+#include <xen/percpu.h>
+
#define rdmsr(msr,val1,val2) \
__asm__ __volatile__("rdmsr" \
: "=a" (val1), "=d" (val2) \
@@ -142,6 +145,25 @@ static inline void wrmsrl(unsigned int m
#define EFER_NX (1<<_EFER_NX)
#define EFER_SVME (1<<_EFER_SVME)
+#ifndef __ASSEMBLY__
+
+DECLARE_PER_CPU(__u64, efer);
+
+static inline __u64 read_efer(void)
+{
+ if (!this_cpu(efer))
+ rdmsrl(MSR_EFER, this_cpu(efer));
+ return this_cpu(efer);
+}
+
+static inline void write_efer(__u64 val)
+{
+ this_cpu(efer) = val;
+ wrmsrl(MSR_EFER, val);
+}
+
+#endif
+
/* Intel MSRs. Some also available on other CPUs */
#define MSR_IA32_PLATFORM_ID 0x17

View File

@ -1,309 +0,0 @@
Index: 2007-05-14/xen/arch/x86/domain.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/domain.c 2007-07-02 10:48:13.000000000 +0200
+++ 2007-05-14/xen/arch/x86/domain.c 2007-07-02 11:19:12.000000000 +0200
@@ -38,6 +38,7 @@
#include <asm/mpspec.h>
#include <asm/ldt.h>
#include <asm/paging.h>
+#include <asm/hypercall.h>
#include <asm/hvm/hvm.h>
#include <asm/hvm/support.h>
#include <asm/msr.h>
@@ -1246,6 +1247,8 @@ void sync_vcpu_execstate(struct vcpu *v)
__arg; \
})
+DEFINE_PER_CPU(char, hc_preempted);
+
unsigned long hypercall_create_continuation(
unsigned int op, const char *format, ...)
{
@@ -1277,7 +1280,9 @@ unsigned long hypercall_create_continuat
regs->eip -= 2; /* re-execute 'syscall' / 'int 0x82' */
#ifdef __x86_64__
- if ( !is_pv_32on64_domain(current->domain) )
+ if ( !is_hvm_vcpu(current) ?
+ !is_pv_32on64_vcpu(current) :
+ hvm_guest_x86_mode(current) == 8 )
{
for ( i = 0; *p != '\0'; i++ )
{
@@ -1313,6 +1318,8 @@ unsigned long hypercall_create_continuat
}
}
}
+
+ this_cpu(hc_preempted) = 1;
}
va_end(args);
Index: 2007-05-14/xen/arch/x86/hvm/hvm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/hvm.c 2007-05-14 13:47:02.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/hvm.c 2007-05-14 14:21:26.000000000 +0200
@@ -663,7 +663,7 @@ typedef unsigned long hvm_hypercall_t(
#if defined(__i386__)
-static hvm_hypercall_t *hvm_hypercall_table[NR_hypercalls] = {
+static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {
HYPERCALL(memory_op),
HYPERCALL(multicall),
HYPERCALL(xen_version),
@@ -672,21 +672,6 @@ static hvm_hypercall_t *hvm_hypercall_ta
HYPERCALL(hvm_op)
};
-static void __hvm_do_hypercall(struct cpu_user_regs *pregs)
-{
- if ( (pregs->eax >= NR_hypercalls) || !hvm_hypercall_table[pregs->eax] )
- {
- if ( pregs->eax != __HYPERVISOR_grant_table_op )
- gdprintk(XENLOG_WARNING, "HVM vcpu %d:%d bad hypercall %d.\n",
- current->domain->domain_id, current->vcpu_id, pregs->eax);
- pregs->eax = -ENOSYS;
- return;
- }
-
- pregs->eax = hvm_hypercall_table[pregs->eax](
- pregs->ebx, pregs->ecx, pregs->edx, pregs->esi, pregs->edi);
-}
-
#else /* defined(__x86_64__) */
static long do_memory_op_compat32(int cmd, XEN_GUEST_HANDLE(void) arg)
@@ -746,49 +731,38 @@ static hvm_hypercall_t *hvm_hypercall32_
HYPERCALL(hvm_op)
};
-static void __hvm_do_hypercall(struct cpu_user_regs *pregs)
-{
- pregs->rax = (uint32_t)pregs->eax; /* mask in case compat32 caller */
- if ( (pregs->rax >= NR_hypercalls) || !hvm_hypercall64_table[pregs->rax] )
- {
- if ( pregs->rax != __HYPERVISOR_grant_table_op )
- gdprintk(XENLOG_WARNING, "HVM vcpu %d:%d bad hypercall %ld.\n",
- current->domain->domain_id, current->vcpu_id, pregs->rax);
- pregs->rax = -ENOSYS;
- return;
- }
-
- if ( current->arch.paging.mode->guest_levels == 4 )
- {
- pregs->rax = hvm_hypercall64_table[pregs->rax](pregs->rdi,
- pregs->rsi,
- pregs->rdx,
- pregs->r10,
- pregs->r8);
- }
- else
- {
- pregs->eax = hvm_hypercall32_table[pregs->eax]((uint32_t)pregs->ebx,
- (uint32_t)pregs->ecx,
- (uint32_t)pregs->edx,
- (uint32_t)pregs->esi,
- (uint32_t)pregs->edi);
- }
-}
-
#endif /* defined(__x86_64__) */
int hvm_do_hypercall(struct cpu_user_regs *regs)
{
- int flush, preempted;
- unsigned long old_eip;
+ int flush, mode = hvm_guest_x86_mode(current);
+ uint32_t eax = regs->eax;
- hvm_store_cpu_guest_regs(current, regs, NULL);
+ switch ( mode )
+ {
+#ifdef __x86_64__
+ case 8:
+#endif
+ case 4:
+ case 2:
+ hvm_store_cpu_guest_regs(current, regs, NULL);
+ if ( unlikely(ring_3(regs)) )
+ {
+ default:
+ regs->eax = -EPERM;
+ return HVM_HCALL_completed;
+ }
+ case 0:
+ break;
+ }
- if ( unlikely(ring_3(regs)) )
+ if ( (eax >= NR_hypercalls) || !hvm_hypercall32_table[eax] )
{
- regs->eax = -EPERM;
- return 0;
+ if ( eax != __HYPERVISOR_grant_table_op )
+ gdprintk(XENLOG_WARNING, "HVM vcpu %d:%d bad hypercall %u.\n",
+ current->domain->domain_id, current->vcpu_id, eax);
+ regs->eax = -ENOSYS;
+ return HVM_HCALL_completed;
}
/*
@@ -796,20 +770,29 @@ int hvm_do_hypercall(struct cpu_user_reg
* For now we also need to flush when pages are added, as qemu-dm is not
* yet capable of faulting pages into an existing valid mapcache bucket.
*/
- flush = ((uint32_t)regs->eax == __HYPERVISOR_memory_op);
-
- /* Check for preemption: RIP will be modified from this dummy value. */
- old_eip = regs->eip;
- regs->eip = 0xF0F0F0FF;
-
- __hvm_do_hypercall(regs);
+ flush = (eax == __HYPERVISOR_memory_op);
+ this_cpu(hc_preempted) = 0;
- preempted = (regs->eip != 0xF0F0F0FF);
- regs->eip = old_eip;
-
- hvm_load_cpu_guest_regs(current, regs);
+#ifdef __x86_64__
+ if ( mode == 8 )
+ {
+ regs->rax = hvm_hypercall64_table[eax](regs->rdi,
+ regs->rsi,
+ regs->rdx,
+ regs->r10,
+ regs->r8);
+ }
+ else
+#endif
+ {
+ regs->eax = hvm_hypercall32_table[eax]((uint32_t)regs->ebx,
+ (uint32_t)regs->ecx,
+ (uint32_t)regs->edx,
+ (uint32_t)regs->esi,
+ (uint32_t)regs->edi);
+ }
- return (preempted ? HVM_HCALL_preempted :
+ return (this_cpu(hc_preempted) ? HVM_HCALL_preempted :
flush ? HVM_HCALL_invalidate : HVM_HCALL_completed);
}
Index: 2007-05-14/xen/arch/x86/hvm/platform.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/platform.c 2007-07-02 10:37:54.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/platform.c 2007-05-14 13:47:25.000000000 +0200
@@ -1037,6 +1037,9 @@ void handle_mmio(unsigned long gpa)
df = regs->eflags & X86_EFLAGS_DF ? 1 : 0;
address_bytes = hvm_guest_x86_mode(v);
+ if (address_bytes < 2)
+ /* real or vm86 modes */
+ address_bytes = 2;
inst_addr = hvm_get_segment_base(v, x86_seg_cs) + regs->eip;
inst_len = hvm_instruction_length(inst_addr, address_bytes);
if ( inst_len <= 0 )
Index: 2007-05-14/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/svm/svm.c 2007-07-02 10:37:54.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/svm/svm.c 2007-05-14 13:47:25.000000000 +0200
@@ -563,14 +563,6 @@ static inline void svm_restore_dr(struct
}
-static int svm_realmode(struct vcpu *v)
-{
- unsigned long cr0 = v->arch.hvm_svm.cpu_shadow_cr0;
- unsigned long eflags = v->arch.hvm_svm.vmcb->rflags;
-
- return (eflags & X86_EFLAGS_VM) || !(cr0 & X86_CR0_PE);
-}
-
static int svm_interrupts_enabled(struct vcpu *v)
{
unsigned long eflags = v->arch.hvm_svm.vmcb->rflags;
@@ -581,13 +573,13 @@ static int svm_guest_x86_mode(struct vcp
{
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
- if ( svm_long_mode_enabled(v) && vmcb->cs.attr.fields.l )
+ if ( unlikely(!(v->arch.hvm_svm.cpu_shadow_cr0 & X86_CR0_PE)) )
+ return 0;
+ if ( unlikely(vmcb->rflags & X86_EFLAGS_VM) )
+ return 1;
+ if ( svm_long_mode_enabled(v) && likely(vmcb->cs.attr.fields.l) )
return 8;
-
- if ( svm_realmode(v) )
- return 2;
-
- return (vmcb->cs.attr.fields.db ? 4 : 2);
+ return (likely(vmcb->cs.attr.fields.db) ? 4 : 2);
}
void svm_update_host_cr3(struct vcpu *v)
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmx.c 2007-07-02 10:37:54.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c 2007-05-14 13:47:25.000000000 +0200
@@ -995,31 +995,20 @@ static void vmx_init_hypercall_page(stru
*(u16 *)(hypercall_page + (__HYPERVISOR_iret * 32)) = 0x0b0f; /* ud2 */
}
-static int vmx_realmode(struct vcpu *v)
-{
- unsigned long rflags;
-
- ASSERT(v == current);
-
- rflags = __vmread(GUEST_RFLAGS);
- return rflags & X86_EFLAGS_VM;
-}
-
static int vmx_guest_x86_mode(struct vcpu *v)
{
- unsigned long cs_ar_bytes;
+ unsigned int cs_ar_bytes;
ASSERT(v == current);
+ if ( unlikely(!(v->arch.hvm_vmx.cpu_shadow_cr0 & X86_CR0_PE)) )
+ return 0;
+ if ( unlikely(__vmread(GUEST_RFLAGS) & X86_EFLAGS_VM) )
+ return 1;
cs_ar_bytes = __vmread(GUEST_CS_AR_BYTES);
-
- if ( vmx_long_mode_enabled(v) && (cs_ar_bytes & (1u<<13)) )
+ if ( vmx_long_mode_enabled(v) && likely(cs_ar_bytes & (1u<<13)) )
return 8;
-
- if ( vmx_realmode(v) )
- return 2;
-
- return ((cs_ar_bytes & (1u<<14)) ? 4 : 2);
+ return (likely(cs_ar_bytes & (1u<<14)) ? 4 : 2);
}
static int vmx_pae_enabled(struct vcpu *v)
Index: 2007-05-14/xen/include/asm-x86/hypercall.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hypercall.h 2007-07-02 10:37:54.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hypercall.h 2007-05-14 14:26:36.000000000 +0200
@@ -15,6 +15,15 @@
*/
#define MMU_UPDATE_PREEMPTED (~(~0U>>1))
+/*
+ * This gets set to a non-zero value whenever hypercall_create_continuation()
+ * is used (outside of multicall context; in multicall context the second call
+ * from do_multicall() itself will have this effect). Internal callers of
+ * hypercall handlers interested in this condition must clear the flag prior
+ * to invoking the respective handler(s).
+ */
+DECLARE_PER_CPU(char, hc_preempted);
+
extern long
do_event_channel_op_compat(
XEN_GUEST_HANDLE(evtchn_op_t) uop);

View File

@ -1,58 +0,0 @@
Index: 2007-05-14/xen/arch/x86/hvm/hvm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/hvm.c 2007-05-14 14:21:26.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/hvm.c 2007-05-14 14:32:48.000000000 +0200
@@ -776,6 +776,9 @@ int hvm_do_hypercall(struct cpu_user_reg
#ifdef __x86_64__
if ( mode == 8 )
{
+ HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%u(%lx, %lx, %lx, %lx, %lx)", eax,
+ regs->rdi, regs->rsi, regs->rdx, regs->r10, regs->r8);
+
regs->rax = hvm_hypercall64_table[eax](regs->rdi,
regs->rsi,
regs->rdx,
@@ -785,6 +788,11 @@ int hvm_do_hypercall(struct cpu_user_reg
else
#endif
{
+ HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%u(%x, %x, %x, %x, %x)", eax,
+ (uint32_t)regs->ebx, (uint32_t)regs->ecx,
+ (uint32_t)regs->edx, (uint32_t)regs->esi,
+ (uint32_t)regs->edi);
+
regs->eax = hvm_hypercall32_table[eax]((uint32_t)regs->ebx,
(uint32_t)regs->ecx,
(uint32_t)regs->edx,
@@ -792,6 +800,8 @@ int hvm_do_hypercall(struct cpu_user_reg
(uint32_t)regs->edi);
}
+ HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%u -> %lx", eax, (unsigned long)regs->eax);
+
return (this_cpu(hc_preempted) ? HVM_HCALL_preempted :
flush ? HVM_HCALL_invalidate : HVM_HCALL_completed);
}
@@ -1056,6 +1066,10 @@ long do_hvm_op(unsigned long op, XEN_GUE
rc = copy_to_guest(arg, &a, 1) ? -EFAULT : 0;
}
+ HVM_DBG_LOG(DBG_LEVEL_HCALL, "%s param %u = %"PRIx64,
+ op == HVMOP_set_param ? "set" : "get",
+ a.index, a.value);
+
param_fail:
rcu_unlock_domain(d);
break;
Index: 2007-05-14/xen/include/asm-x86/hvm/support.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/support.h 2007-04-23 10:01:46.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/support.h 2007-05-14 14:31:44.000000000 +0200
@@ -62,6 +62,7 @@ static inline vcpu_iodata_t *get_ioreq(s
#define DBG_LEVEL_VLAPIC_TIMER (1 << 7)
#define DBG_LEVEL_VLAPIC_INTERRUPT (1 << 8)
#define DBG_LEVEL_IOAPIC (1 << 9)
+#define DBG_LEVEL_HCALL (1 << 10)
extern unsigned int opt_hvm_debug_level;
#define HVM_DBG_LOG(level, _f, _a...) \

View File

@ -1,37 +0,0 @@
Index: 2007-04-27/xen/arch/x86/hvm/io.c
===================================================================
--- 2007-04-27.orig/xen/arch/x86/hvm/io.c 2007-04-16 09:26:34.000000000 +0200
+++ 2007-04-27/xen/arch/x86/hvm/io.c 2007-05-09 18:00:08.000000000 +0200
@@ -418,11 +418,10 @@ static inline void set_eflags_PF(int siz
static void hvm_pio_assist(struct cpu_user_regs *regs, ioreq_t *p,
struct hvm_io_op *pio_opp)
{
- unsigned long old_eax;
- int sign = p->df ? -1 : 1;
-
if ( p->data_is_ptr || (pio_opp->flags & OVERLAP) )
{
+ int sign = p->df ? -1 : 1;
+
if ( pio_opp->flags & REPZ )
regs->ecx -= p->count;
@@ -459,14 +458,15 @@ static void hvm_pio_assist(struct cpu_us
}
else if ( p->dir == IOREQ_READ )
{
- old_eax = regs->eax;
+ unsigned long old_eax = regs->eax;
+
switch ( p->size )
{
case 1:
- regs->eax = (old_eax & 0xffffff00) | (p->data & 0xff);
+ regs->eax = (old_eax & ~0xff) | (p->data & 0xff);
break;
case 2:
- regs->eax = (old_eax & 0xffff0000) | (p->data & 0xffff);
+ regs->eax = (old_eax & ~0xffff) | (p->data & 0xffff);
break;
case 4:
regs->eax = (p->data & 0xffffffff);

View File

@ -1,34 +0,0 @@
Index: 2007-05-14/xen/arch/x86/hvm/hvm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/hvm.c 2007-05-14 08:28:38.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/hvm.c 2007-05-14 13:47:02.000000000 +0200
@@ -824,6 +824,15 @@ void hvm_update_guest_cr3(struct vcpu *v
void hvm_hypercall_page_initialise(struct domain *d,
void *hypercall_page)
{
+#ifdef __x86_64__
+ /*
+ * Since this operation is one of the very first executed by PV drivers
+ * on initialisation or after save/restore, it is a sensible point at
+ * which to sample the execution mode of the guest and latch 32- or 64-
+ * bit format for shared state.
+ */
+ d->arch.has_32bit_shinfo = (hvm_guest_x86_mode(current) != 8);
+#endif
hvm_funcs.init_hypercall_page(d, hypercall_page);
}
@@ -1053,13 +1062,6 @@ long do_hvm_op(unsigned long op, XEN_GUE
break;
case HVM_PARAM_CALLBACK_IRQ:
hvm_set_callback_via(d, a.value);
- /*
- * Since this operation is one of the very first executed
- * by PV drivers on initialisation or after save/restore, it
- * is a sensible point at which to sample the execution mode of
- * the guest and latch 32- or 64-bit format for shared state.
- */
- d->arch.has_32bit_shinfo = (hvm_guest_x86_mode(current) != 8);
break;
}
d->arch.hvm_domain.params[a.index] = a.value;

View File

@ -1,11 +0,0 @@
diff -ru a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py 2007-09-07 11:31:20.000000000 -0600
+++ b/tools/python/xen/xend/XendConfig.py 2007-09-07 14:07:50.000000000 -0600
@@ -726,6 +726,7 @@
if not has_rfb:
dev_config = ['vfb']
+ dev_config.append(['type', 'vnc'])
# copy VNC related params from platform config to vfb dev conf
for key in ['vncpasswd', 'vncunused', 'vncdisplay',
'vnclisten']:

View File

@ -1,40 +0,0 @@
Index: xen-3.1-testing/xen/arch/x86/mm.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/mm.c
+++ xen-3.1-testing/xen/arch/x86/mm.c
@@ -1017,7 +1017,7 @@ static void pae_flush_pgd(
l3tab_ptr = &cache->table[cache->inuse_idx][idx];
_ol3e = l3e_get_intpte(*l3tab_ptr);
_nl3e = l3e_get_intpte(nl3e);
- _pl3e = cmpxchg((intpte_t *)l3tab_ptr, _ol3e, _nl3e);
+ _pl3e = cmpxchg(&l3e_get_intpte(*l3tab_ptr), _ol3e, _nl3e);
BUG_ON(_pl3e != _ol3e);
}
@@ -1316,7 +1316,7 @@ static inline int update_intpte(intpte_t
/* Macro that wraps the appropriate type-changes around update_intpte().
* Arguments are: type, ptr, old, new, mfn, vcpu */
#define UPDATE_ENTRY(_t,_p,_o,_n,_m,_v) \
- update_intpte((intpte_t *)(_p), \
+ update_intpte(&_t ## e_get_intpte(*(_p)), \
_t ## e_get_intpte(_o), _t ## e_get_intpte(_n), \
(_m), (_v))
@@ -2498,7 +2498,7 @@ static int create_grant_pte_mapping(
}
ol1e = *(l1_pgentry_t *)va;
- if ( !UPDATE_ENTRY(l1, va, ol1e, nl1e, mfn, v) )
+ if ( !UPDATE_ENTRY(l1, (l1_pgentry_t *)va, ol1e, nl1e, mfn, v) )
{
put_page_type(page);
rc = GNTST_general_error;
@@ -3279,7 +3279,7 @@ static int ptwr_emulated_update(
intpte_t t = old;
ol1e = l1e_from_intpte(old);
- okay = paging_cmpxchg_guest_entry(v, (intpte_t *) pl1e,
+ okay = paging_cmpxchg_guest_entry(v, &l1e_get_intpte(*pl1e),
&t, val, _mfn(mfn));
okay = (okay && t == old);

View File

@ -1,25 +0,0 @@
Index: 2007-04-27/xen/arch/x86/mm.c
===================================================================
--- 2007-04-27.orig/xen/arch/x86/mm.c 2007-04-27 08:27:18.000000000 +0200
+++ 2007-04-27/xen/arch/x86/mm.c 2007-04-27 09:30:37.000000000 +0200
@@ -410,7 +410,7 @@ void update_cr3(struct vcpu *v)
}
-void invalidate_shadow_ldt(struct vcpu *v)
+static void invalidate_shadow_ldt(struct vcpu *v)
{
int i;
unsigned long pfn;
Index: 2007-04-27/xen/include/asm-x86/mm.h
===================================================================
--- 2007-04-27.orig/xen/include/asm-x86/mm.h 2007-04-02 12:16:27.000000000 +0200
+++ 2007-04-27/xen/include/asm-x86/mm.h 2007-04-27 09:30:37.000000000 +0200
@@ -143,7 +143,6 @@ void init_frametable(void);
int alloc_page_type(struct page_info *page, unsigned long type);
void free_page_type(struct page_info *page, unsigned long type);
-void invalidate_shadow_ldt(struct vcpu *d);
int _shadow_mode_refcounts(struct domain *d);
static inline void put_page(struct page_info *page)

View File

@ -1,8 +1,8 @@
Index: xen-3.0.4-testing/tools/ioemu/keymaps/nl-be
Index: xen-3.2-testing/tools/ioemu/keymaps/nl-be
===================================================================
--- xen-3.0.4-testing.orig/tools/ioemu/keymaps/nl-be 2006-12-14 14:49:55.000000000 -0700
+++ xen-3.0.4-testing/tools/ioemu/keymaps/nl-be 2007-08-30 07:46:28.000000000 -0600
@@ -1,3 +1,69 @@
--- xen-3.2-testing.orig/tools/ioemu/keymaps/nl-be
+++ xen-3.2-testing/tools/ioemu/keymaps/nl-be
@@ -1,6 +1,72 @@
# Dutch (Belgium)
-map 0x813
include common
@ -73,3 +73,6 @@ Index: xen-3.0.4-testing/tools/ioemu/keymaps/nl-be
+greater 0x56 shift
+backslash 0x56 altgr
+
ampersand 0x02
1 0x02 shift
bar 0x02 altgr

1214
multinet-common.sh Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,11 +2,11 @@ Read the mac address from the otherend
Signed-off-by: ksrinivasan@novell.com
Index: xen-3.1-testing/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
Index: xen-3.2-testing/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
===================================================================
--- xen-3.1-testing.orig/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
+++ xen-3.1-testing/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
@@ -375,7 +375,7 @@ static int xen_net_read_mac(struct xenbu
--- xen-3.2-testing.orig/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
+++ xen-3.2-testing/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
@@ -349,7 +349,7 @@ static int xen_net_read_mac(struct xenbu
char *s, *e, *macstr;
int i;

View File

@ -2,8 +2,8 @@
#============================================================================
# network-multinet
#
# Version = 1.3.2
# Date = 2007-09-04
# Version = 2.0.1
# Date = 2007-11-29
#
# Maintainer(s) = Ron Terry - ron (at) pronetworkconsulting (dot) com
#
@ -14,146 +14,102 @@
# Description:
#
# Replacement for the xen network-bridge, network-nat and network-route
# scripts. This script allows for the creation of multiple bridges.
# scripts. This script allows for the creation of multiple networks.
#
# This script can create 4 types of bridges:
# This script can create 4 types of networks:
#
# 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.
# bridged: -Networks that contain both a physical network device (ethX)
# and a virtual network device (vethX) from Dom0.
# -This is the traditional type of network created in xen by
# the basic network-bridge script.
# -VMs on these network(s) appear to be on the real network(s)
#
# local bridges: -Bridges that contain only a virtual network
# device (vethX) from Dom0.
# -These bridges can be configured in the
# following ways:
# nohost: -Networks that contain a physical network device but not a
# virtual network device from Dom0.
# -These can be used to allow virtual machines to communicate
# with the outside world but not with Dom0.
# (Usefull if you want to isolate traffic away from Dom0)
#
# -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.
# hostonly: -Networks that contain only a virtual network device (vethX)
# from Dom0.
# -This type of network will allow VMs connected to it to
# access only Dom0 and other VMs connected to the network.
# -This type of network 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.
# nat: -Networks that contain only a virtual network device (vethX)
# from Dom0.
# -This type of network will allow VMs connected to it to access
# Dom0,the "outside world" via NAT and other VMs connected to it.
# -This type of network 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.
# routed: -Networks that contain only a virtual network device (vethX)
# from Dom0.
# -This type of network will allow VMs connected to it to access
# Dom0,the "outside world" via routing through Dom0 and other VMs
# connected to it.
#
# 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.
# empty: -Networks 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.
#
# nohost bridges: -Bridges that contain a physical network device
# but not a virtual network device from Dom0.
# -These can be used to allow virtual machines to
# communicate with the outside world but not with
# Dom0. (Usefull if you want to isolate traffic
# away from Dom0)
#
# This script accepts the (start|stop|restart|status) parameters.
#
# 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.
#
# This script requires that the vif-bridge script be used as the vif
# creation script (as opposed to vif-nat/vif-route).
#
# Local 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
# configured to be connected to bridged networks and only attempt to
# create networks on the ones that are present and up. It will also test
# for the presence of virtual interfaces configured to be connected to
# local bridges and only create bridges for the ones that exist and
# are not already connected to an existing bridge.
# other networks and only create networks for the ones that exist and
# are not already connected to an existing network.
#
# Edit the BRIDGE_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 LOCAL_BRIDGE_LIST variable to define which virtual interfaces
# you wish to create local bridges on. The default is the 3rd and 4th
# virtual interfaces (veth2, veth3). The first local bridge (on veth2)
# is configured as a NAT network and the second host bridge (on veth3)
# is configured as a hostonly network.
#
# Edit the NOHOST_BRIDGE_LIST variable to define which bridges you would
# like to be connected to the outside world but not Dom0. These are
# usefull if you want to allow VMs to access the outside world but you
# want to isolate traffic away from Dom0.
#
# 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)
# Edit the NETWORK_LIST variable to define which networks to create on which
# interfaces. The default is to create a bridged network on the first
# interface active network interface.
#
# To enable this script edit the network-script field in the
# /etc/xen/xend-config.sxp file.
#
# Example: (network-script network-multinet)
#
# Depends on: /etc/xen/scripts/xen-network-common.sh
# /etc/xen/scripts/network-bridge
# Depends on: $SCRIPT_PATH/multinet-common.sh
#
# Config file: /etc/sysconfig/xendconfig
# Calls if present: $SCRIPT_PATH/xen-dhcpd
#
# Usage: network-multinet (start|stop|restart|status)
# Config file: /etc/sysconfig/xend
#
# Usage: network-multinet (start|stop|restart|status)
#
# Vars:
#
# SCRIPT_PATH -Path to the directory conaining the xen network-bridge
# --------------------------- In this script ----------------------------
# SCRIPT_PATH -Path to the directory containing the xen network-bridge
# script (typically /etc/xen/scripts)
#
# BRIDGE_NETDEV_LIST -Space delimited list of physical network devices to
# create traditional bridges on
# CONFIG_FILE_PATH -Path to extra config files
# (not used currently by this script)
#
# LOCAL_BRIDGE_LIST -Space delimited list of virtual network devices to
# create local bridges on using the following format:
# NETWORK_SAVE_PATH -Path to save network configuration information in
#
# <virtual network device>,<mac address>,<IP address/CIDR NetMask>,<nat|hostonly|routed>,<dhcp-on|dhcp-off>
# IPTABLES_SAVE_FILE -File in which to save backed-up iptables rules so that they
# may be restored when the script is stopped
#
# Example with 2 virtual devices:
# XEN_DHCP_SCRIPT -Script called to manage the DHCP server on the specified networks
#
# "veth2,00:16:3E:01:00:02,172.22.0.1/16,nat,dhcp-on veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly,dhcp-off"
# ------------------------- In the config file --------------------------
# NETWORK_LIST -Space delimited list of network devices to create networks
# on using the following format:
#
# NOHOST_BRIDGE_LIST -Space delimited list of bridge numbers/NICs to create
# "no-host" bridges on.
# <network type>,<number of network type>,<network device>,<mac address>,<IP address/CIDR NetMask>,<dhcp server status>
#
# <bridge number>,<physical network device>
# Example with 3 virtual devices:
#
# Example with 2 devices:
#
# "4,eth1 5.eth2"
#
# EMPTY_BRIDGE_LIST -Space delimited list of bridge numbers to create as
# empty bridges.
#
# BRIDGE_NAME -Name of bridge to create (example: xenbr)
# "bridge,0,eth0,,,dhcp-off nat,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
#
# NAT_EXTERNAL_INTERFACE -Network interface to use as the external interface
# for NATed and Routed networks
@ -162,7 +118,6 @@
#### Read config files and set variables ##################################
. /etc/xen/scripts/xen-network-common.sh
# Source the configuration File
@ -207,529 +162,55 @@ make_config_dirs() {
fi
}
manage_routing() {
# Saves and restores the ip forward and Network Address Translation state
# that exist before the script runs
#
# This function reads the start,stop parameter from the $CMD_OPT
# variable and responds respectively.
case $CMD_OPT in
start)
#------------------------------------------------------------------
# Determine the initial state of the ip_forward parameter
#------------------------------------------------------------------
case `cat /proc/sys/net/ipv4/ip_forward` in
0)
INIT_IP_FWD="off"
echo "0" > $NETWORK_SAVE_PATH/init_ip_fwd_state
;;
1)
INIT_IP_FWD="on"
echo "1" > $NETWORK_SAVE_PATH/init_ip_fwd_state
;;
esac
. $SCRIPT_PATH/multinet-common.sh
#------------------------------------------------------------------
# Determine if we need to enable ip_forward
#------------------------------------------------------------------
if echo $LOCAL_BRIDGE_LIST | grep -qE "(nat|NAT|route|ROUTE)"
then
IP_FWD="on"
echo ""
echo "============================================================"
echo "Enabling IP Forwarding"
echo "============================================================"
echo 1 > /proc/sys/net/ipv4/ip_forward
else
IP_FWD="off"
echo ""
echo "============================================================"
echo "Disabling IP Forwarding"
echo "============================================================"
echo 0 > /proc/sys/net/ipv4/ip_forward
fi
#***** Network Creation Main Function *************************************
#------------------------------------------------------------------
# Determine if we need to enable NAT
#------------------------------------------------------------------
if echo $LOCAL_BRIDGE_LIST | grep -qE "(nat|NAT)"
then
echo ""
echo "============================================================"
echo "Enabling Network Adress Translation"
echo "============================================================"
iptables -t nat -A POSTROUTING -o $NAT_EXTERNAL_INTERFACE -j MASQUERADE
sysctl -q -w net.bridge.bridge-nf-call-iptables="0"
NAT_DONE="yes"
fi
;;
stop)
#------------------------------------------------------------------
# Set the ip_forward value back to its original state
#------------------------------------------------------------------
echo ""
echo "============================================================"
echo "Restoring IP Forwarding to its original state"
echo "============================================================"
case `cat $NETWORK_SAVE_PATH/init_ip_fwd_state` in
0)
echo "ip_forward = 0"
echo "0" > /proc/sys/net/ipv4/ip_forward
;;
1)
echo "ip_forward = 0"
echo "1" > /proc/sys/net/ipv4/ip_forward
;;
*)
echo "Original state unknown. Using default value."
echo "ip_forward = 0"
echo "0" > /proc/sys/net/ipv4/ip_forward
;;
esac
create_networks() {
#------------------------------------------------------------------
# Clean up init_ip_fwd_state file
#------------------------------------------------------------------
rm $NETWORK_SAVE_PATH/init_ip_fwd_state
VIF_COUNT=0
case $NAT_EXTERNAL_INTERFACE in
default)
NAT_EXTERNAL_INTERFACE=`ip route list | awk '/^default / { print $NF }'`
;;
esac
}
manage_susefirewall2() {
case $CMD_OPT in
start)
if [ -e /etc/init.d/SuSEfirewall2_setup ] && /etc/init.d/SuSEfirewall2_setup status | grep -iwq "running"
then
echo ""
echo "============================================================"
echo "Stopping SuSEfirewall2"
echo "============================================================"
/etc/init.d/SuSEfirewall2_setup stop > /dev/null
echo "0" > $NETWORK_SAVE_PATH/sf2
return 0
else
return 1
fi
;;
stop)
if [ -e $NETWORK_SAVE_PATH/sf2 ] && grep "0" $NETWORK_SAVE_PATH/sf2
then
echo ""
echo "============================================================"
echo "Starting SuSEfirewall2"
echo "============================================================"
/etc/init.d/SuSEfirewall2_setup start > /dev/null
rm -rf $NETWORK_SAVE_PATH/sf2
return 0
else
return 1
fi
;;
esac
}
manage_iptables() {
# Saves and restores the iptables rules that exist before the script runs
#
# This function reads the start,stop parameter from the $CMD_OPT
# variable and responds respectively.
case $CMD_OPT in
start)
echo ""
echo "============================================================"
echo "Saving iptables rules"
echo "============================================================"
#----------------------------------------------------------------
# Saving iptables rules for $TABLE to a file
#----------------------------------------------------------------
for TABLE in `iptables-save |grep '*'|cut -d '*' -f 2`
do
echo "Saving table: $TABLE"
iptables-save -t $TABLE > $IPTABLES_SAVE_FILE@$TABLE
echo "Flushing table: $TABLE"
iptables -F -t $TABLE
echo "-----------------------"
done
#----------------------------------------------------------------
# Deleting any custom chain
#----------------------------------------------------------------
for CHAIN in `iptables-save |grep ^:|cut -d ":" -f 2|cut -d " " -f 1`
do
case $CHAIN in
INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING)
#do nothing
;;
*)
echo "Deteting chain: $CHAIN"
iptables -X $CHAIN
;;
esac
done
;;
stop)
echo ""
echo "============================================================"
echo "Restoring iptables rules"
echo "============================================================"
#----------------------------------------------------------------
# Restoring iptables rules for $TABLE
#----------------------------------------------------------------
for TABLE in `ls $IPTABLES_SAVE_FILE*|cut -d "@" -f 2`
do
echo "Restoring table: $TABLE"
iptables-restore < $IPTABLES_SAVE_FILE@$TABLE
rm $IPTABLES_SAVE_FILE@$TABLE
echo "-----------------------"
done
;;
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
ip link set $DEV arp on
;;
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_traditional_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 $BRIDGE_NETDEV_LIST
for NETWORK in $NETWORK_LIST
do
local BRIDGE_NUM=${NETDEVICE##${NETDEVICE%%[0-9]*}}
local NET_TYPE=`echo $NETWORK | cut -d "," -f 1`
local NET_NUMBER=`echo $NETWORK | cut -d "," -f 2`
local NET_DEV=`echo $NETWORK | cut -d "," -f 3`
local NET_DEV_MAC=`echo $NETWORK | cut -d "," -f 4`
local NET_DEV_IP=`echo $NETWORK | cut -d "," -f 5`
local NET_DHCP_SRV=`echo $NETWORK | cut -d "," -f 6`
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 ""
else
echo " Physical Interface $NETDEVICE is not up. Skipping $BRIDGE_NAME$BRIDGE_NUM"
fi
done
}
create_local_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 $LOCAL_BRIDGE_LIST
do
# Set local function variables
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_INTIF=$DEV
local ROUTE_INTIF=$DEV
local BRIDGE_NUM=${NAT_INTIF##${NAT_INTIF%%[0-9]*}}
local BR_NAME=$BRIDGE_NAME$BRIDGE_NUM
local VIF=vif0.$BRIDGE_NUM
case $CMD_OPT in
start)
if ! brctl show | grep -qw $DEV && /sbin/ip address show $DEV > /dev/null
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 > /dev/null 2>&1
setup_bridge_port $VIF > /dev/null 2>&1
add_to_bridge $BR_NAME $VIF > /dev/null 2>&1
setup_host_interface $DEV $MAC $IPADDR > /dev/null 2>&1
#------------------------------------------------------------------
# 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_EXTERNAL_INTERFACE"
;;
ROUTE|route) # Set up the bridge as Routed network
echo " Gateway: $NAT_GW_IP"
echo " External Interface: $NAT_EXTERNAL_INTERFACE"
iptables -t nat -A PREROUTING -i $ROUTE_INTIF -j ACCEPT
#iptables -t filter -A FORWARD -i $NAT_INTIF -j ACCEPT
#iptables -t filter -A FORWARD -i $NAT_INTIF -j ACCEPT
;;
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 "============================================================"
else
#------------------------------------------------------------------
# Skip this bridge
#------------------------------------------------------------------
echo " Virtual Interface $DEV is already attached to a bridge or it does not exist."
echo " Skipping $BR_NAME"
fi
case $NET_DEV in
default)
local NET_DEV=`ip route list | awk '/^default / { print $NF }'`
;;
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)
;;
ROUTE|route)
# Clean out the bridge specific routing iptables rule
iptables -t nat -D PREROUTING -i $ROUTE_INTIF -j ACCEPT
#iptables -t filter -D FORWARD -i $DEV -j ACCEPT
#iptables -t filter -D FORWARD -i $NAT_INTIF -j ACCEPT
;;
HOSTONLY|hostonly)
# Clean out the bridge specific nat iptables rule
iptables -t nat -D PREROUTING -i $NAT_INTIF -j DROP
;;
esac
esac
echo "============================================================"
#------------------------------------------------------------------
# Then unconfigure the veth
#------------------------------------------------------------------
setup_host_interface $DEV $MAC $IPADDR > /dev/null 2>&1
#------------------------------------------------------------------
# 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
case $NET_TYPE in
bridge)
create_bridged_networks $NET_DEV $NET_NUMBER
((VIF_COUNT++))
;;
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 "============================================================"
nat|route|hostonly)
create_local_networks $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_MAC $NET_DEV_IP $NET_DHCP_SRV
((VIF_COUNT++))
;;
nohost)
create_nohost_networks $NET_DEV $NET_NUMBER
;;
empty)
create_empty_networks $NET_NUMBER
;;
esac
done
}
create_nohost_bridges() {
# Creates bridges attached to an external interface but 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 $NOHOST_BRIDGE_LIST
do
local DEV=`echo $BRIDGE|cut -d "," -f 1`
local PDEV=p$DEV
local MAC=`ip link show ${i} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'`
local BRIDGE_NUM=`echo $BRIDGE|cut -d "," -f 2`
local BR_NAME=$BRIDGE_NAME$BRIDGE_NUM
case $CMD_OPT in
start)
if ! brctl show | grep -qw "^$BR_NAME"
then
echo ""
echo "============================================================"
echo "Configuring Virtual No-Host Bridge: $BR_NAME"
echo ""
echo " using- Virtual Device: $DEV"
# create the bridge
create_bridge $BR_NAME
# back up the interface's info (MAC, etc)
echo $MAC > $NETWORK_SAVE_PATH/$DEV-info
# configure the interface as a bridge port
setup_bridge_port $DEV
# rename the physical interface
ip link set $DEV name $PDEV
# add the interface to the bridge
add_to_bridge $BR_NAME $PDEV
fi
;;
stop)
if brctl show | grep -qw "^$BR_NAME"
then
echo "============================================================"
echo "Removing Virtual No-Host Bridge: $BR_NAME"
echo ""
# bring the bridge down
ip link set $BR_NAME down
# remove the interface from the bridge
brctl delif $BR_NAME $PDEV
# remove the bridge
brctl delbr $BR_NAME
# bring the interface down
ip link set down $PDEV
# reset the interface back to normal
ip link set $PDEV arp on
ip link set $PDEV multicast on
# reset the interface back to its original name and MAC
ip link set $PDEV name $DEV
ip link set $DEV addr `cat $NETWORK_SAVE_PATH/$DEV-info`
rm -f `cat $NETWORK_SAVE_PATH/$DEV-info`
# bring the interface back up
ifup $DEV
fi
;;
status)
brctl show $BR_NAME | grep -w "^$BR_NAME"
;;
esac
done
echo "============================================================"
}
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 "============================================================"
}
#### Start, Stop, Status Functions ########################################
start_xend_network() {
@ -738,12 +219,10 @@ start_xend_network() {
echo " Starting the xend network environment"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
make_config_dirs
manage_susefirewall2 || manage_iptables
create_traditional_bridges
manage_routing
create_local_bridges
create_empty_bridges
create_nohost_bridges
manage_susefirewall2 stop || manage_iptables stop
#manage_susefirewall2 start
manage_routing start
create_networks
}
stop_xend_network() {
@ -751,19 +230,14 @@ stop_xend_network() {
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo " Stopping the xend network environment"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
create_traditional_bridges
create_local_bridges
create_empty_bridges
create_nohost_bridges
manage_routing
manage_susefirewall2 || manage_iptables
manage_susefirewall2 stop
create_networks
manage_routing stop
manage_susefirewall2 start || manage_iptables start
}
show_xend_network_status() {
create_traditional_bridges
create_local_bridges
create_empty_bridges
create_nohost_bridges
create_networks
}
#### Main Code Body #######################################################

View File

@ -1,13 +0,0 @@
Index: xen-3.1-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-3.1-testing/tools/python/xen/xend/XendConfig.py
@@ -1338,7 +1338,7 @@ class XendConfig(dict):
for dev_uuid in ordered_refs:
dev_type, dev_info = self['devices'][dev_uuid]
if dev_type == 'pci': # special case for pci devices
- sxpr = [['uuid', dev_info['uuid']]]
+ sxpr = ['pci', ['uuid', dev_info['uuid']]]
for pci_dev_info in dev_info['devs']:
pci_dev_sxpr = ['dev']
for opt, val in pci_dev_info.items():

View File

@ -1,74 +0,0 @@
Index: xen-3.1-testing/xen/arch/x86/mm.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/mm.c
+++ xen-3.1-testing/xen/arch/x86/mm.c
@@ -3239,13 +3239,14 @@ static int ptwr_emulated_update(
/* We are looking only for read-only mappings of p.t. pages. */
ASSERT((l1e_get_flags(pte) & (_PAGE_RW|_PAGE_PRESENT)) == _PAGE_PRESENT);
+ ASSERT(mfn_valid(mfn));
ASSERT((page->u.inuse.type_info & PGT_type_mask) == PGT_l1_page_table);
ASSERT((page->u.inuse.type_info & PGT_count_mask) != 0);
ASSERT(page_get_owner(page) == d);
/* Check the new PTE. */
nl1e = l1e_from_intpte(val);
- if ( unlikely(!get_page_from_l1e(gl1e_to_ml1e(d, nl1e), d)) )
+ if ( unlikely(!get_page_from_l1e(nl1e, d)) )
{
if ( (CONFIG_PAGING_LEVELS >= 3) && is_pv_32bit_domain(d) &&
(bytes == 4) && (unaligned_addr & 4) && !do_cmpxchg &&
@@ -3271,7 +3272,7 @@ static int ptwr_emulated_update(
adjust_guest_l1e(nl1e, d);
/* Checked successfully: do the update (write or cmpxchg). */
- pl1e = map_domain_page(page_to_mfn(page));
+ pl1e = map_domain_page(mfn);
pl1e = (l1_pgentry_t *)((unsigned long)pl1e + (addr & ~PAGE_MASK));
if ( do_cmpxchg )
{
@@ -3286,21 +3287,21 @@ static int ptwr_emulated_update(
if ( !okay )
{
unmap_domain_page(pl1e);
- put_page_from_l1e(gl1e_to_ml1e(d, nl1e), d);
+ put_page_from_l1e(nl1e, d);
return X86EMUL_CMPXCHG_FAILED;
}
}
else
{
ol1e = *pl1e;
- if ( !UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, page_to_mfn(page), v) )
+ if ( !UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, mfn, v) )
BUG();
}
unmap_domain_page(pl1e);
/* Finally, drop the old PTE. */
- put_page_from_l1e(gl1e_to_ml1e(d, ol1e), d);
+ put_page_from_l1e(ol1e, d);
return X86EMUL_OKAY;
}
@@ -3366,17 +3367,13 @@ int ptwr_do_page_fault(struct vcpu *v, u
LOCK_BIGLOCK(d);
- /*
- * Attempt to read the PTE that maps the VA being accessed. By checking for
- * PDE validity in the L2 we avoid many expensive fixups in __get_user().
- */
+ /* Attempt to read the PTE that maps the VA being accessed. */
guest_get_eff_l1e(v, addr, &pte);
- if ( !(l1e_get_flags(pte) & _PAGE_PRESENT) )
- goto bail;
page = l1e_get_page(pte);
/* We are looking only for read-only mappings of p.t. pages. */
if ( ((l1e_get_flags(pte) & (_PAGE_PRESENT|_PAGE_RW)) != _PAGE_PRESENT) ||
+ !mfn_valid(l1e_get_pfn(pte)) ||
((page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table) ||
((page->u.inuse.type_info & PGT_count_mask) == 0) ||
(page_get_owner(page) != d) )

View File

@ -1,60 +1,46 @@
Index: xen-3.1-testing/unmodified_drivers/linux-2.6/mkbuildtree
Index: xen-3.2-testing/unmodified_drivers/linux-2.6/mkbuildtree
===================================================================
--- xen-3.1-testing.orig/unmodified_drivers/linux-2.6/mkbuildtree
+++ xen-3.1-testing/unmodified_drivers/linux-2.6/mkbuildtree
@@ -11,7 +11,12 @@ fi
C=$PWD
--- xen-3.2-testing.orig/unmodified_drivers/linux-2.6/mkbuildtree
+++ xen-3.2-testing/unmodified_drivers/linux-2.6/mkbuildtree
@@ -13,16 +13,30 @@ C=$PWD
if [ -n "$XEN" -a -d "$XEN" ]; then
XEN=$(cd $XEN && pwd)
else
- XEN=$C/../../xen
+ XEN=/usr/src/linux/include/xen
fi
XEN=$C/../../xen
-XL=$C/../../linux-2.6-xen-sparse
+if [ -n "$XL" -a -d "$XL" ]; then
+ XL=$(cd $XL && pwd)
+else
+ XL=/usr/src/linux
if [ -n "$XL" -a -d "$XL" ]; then
XL=$(cd $XL && pwd)
else
- XL=$C/../../linux-2.6.18-xen.hg
+ XL=/usr/src/linux
+fi
+cd "$(dirname "$0")"
+
+if [ -n "$ALT_KMP_OS" -a "$ALT_KMP_OS" == sles10sp1 ]; then
+ XL=$C/linux-2.6-xen-sparse
+ XEN=$C/linux-2.6-xen-sparse/include/xen
fi
for d in $(find ${XL}/drivers/xen/ -maxdepth 1 -type d | sed -e 1d); do
+ # TEMPORARY - Don't link entire directory until the accel.c fix is in the kernel cvs
+ if echo $d | egrep -q netfront; then
+ ln -sf ${XL}/drivers/xen/netfront/netfront.c netfront
+ ln -sf ${XL}/drivers/xen/netfront/netfront.h netfront
+ cp -p ../../linux-2.6-xen-sparse/drivers/xen/netfront/accel.c netfront
+ continue
+ fi
+ # END TEMPORARY
if ! echo $d | egrep -q back; then
Index: xen-3.1-testing/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
===================================================================
--- xen-3.1-testing.orig/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
+++ xen-3.1-testing/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
@@ -107,4 +107,12 @@ extern char *kasprintf(gfp_t gfp, const
#define __supported_pte_mask ((maddr_t)0)
#endif
lndir $d $(basename $d) > /dev/null 2>&1
fi
@@ -39,7 +53,7 @@ ln -sf ${XL}/drivers/xen/core/reboot.c p
mkdir -p include/asm include/xen
+/*
+ * This variable at present is referenced by netfront, but only in code that
+ * is dead when running in hvm guests. To detect potential active uses of it
+ * in the future, don't try to supply a 'valid' value here, so that any
+ * mappings created with it will fault when accessed.
+ */
+#define __supported_pte_mask ((maddr_t)0)
+
#endif
Index: xen-3.1-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
===================================================================
--- xen-3.1-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
+++ xen-3.1-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
@@ -119,7 +119,9 @@ void *kzalloc(size_t size, int flags)
EXPORT_SYMBOL(kzalloc);
#endif
lndir -silent ${XL}/include/xen include/xen
-ln -nsf ${XEN}/include/public include/xen/interface
+ln -nsf ${XEN}/interface include/xen/interface
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+#if defined(CONFIG_SUSE_KERNEL) \
+ ? LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) \
+ : LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
/* Simplified asprintf. */
char *kasprintf(gfp_t gfp, const char *fmt, ...)
{
Index: xen-3.1-testing/unmodified_drivers/linux-2.6/overrides.mk
===================================================================
--- xen-3.1-testing.orig/unmodified_drivers/linux-2.6/overrides.mk
+++ xen-3.1-testing/unmodified_drivers/linux-2.6/overrides.mk
@@ -11,4 +11,4 @@ ifeq ($(ARCH),ia64)
EXTRA_CFLAGS += -DCONFIG_VMX_GUEST
endif
-EXTRA_CFLAGS += -include $(srctree)/include/linux/autoconf.h
+#EXTRA_CFLAGS += -include $(srctree)/include/linux/autoconf.h
# Need to be quite careful here: we don't want the files we link in to
# risk overriding the native Linux ones (in particular, system.h must

View File

@ -1,23 +1,21 @@
Index: xen-3.1-testing/tools/ioemu/block.c
Index: xen-3.2-testing/tools/ioemu/block.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/block.c
+++ xen-3.1-testing/tools/ioemu/block.c
@@ -465,6 +465,11 @@ int bdrv_write(BlockDriverState *bs, int
if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
memcpy(bs->boot_sector_data, buf, 512);
}
+ {
--- xen-3.2-testing.orig/tools/ioemu/block.c
+++ xen-3.2-testing/tools/ioemu/block.c
@@ -558,6 +558,9 @@ int bdrv_write(BlockDriverState *bs, int
else
return 0;
} else {
+ unsigned int ns = sector_num * 512;
+ if (ns < 0)
+ return -1;
+ }
return bs->drv->bdrv_write(bs, sector_num, buf, nb_sectors);
return drv->bdrv_write(bs, sector_num, buf, nb_sectors);
}
}
Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
Index: xen-3.2-testing/tools/ioemu/hw/cirrus_vga.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/hw/cirrus_vga.c
+++ xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
--- xen-3.2-testing.orig/tools/ioemu/hw/cirrus_vga.c
+++ xen-3.2-testing/tools/ioemu/hw/cirrus_vga.c
@@ -220,6 +220,20 @@
#define CIRRUS_HOOK_NOT_HANDLED 0
#define CIRRUS_HOOK_HANDLED 1
@ -39,7 +37,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
struct CirrusVGAState;
typedef void (*cirrus_bitblt_rop_t) (struct CirrusVGAState *s,
uint8_t * dst, const uint8_t * src,
@@ -598,7 +612,7 @@ static void cirrus_invalidate_region(Cir
@@ -599,7 +613,7 @@ static void cirrus_invalidate_region(Cir
for (y = 0; y < lines; y++) {
off_cur = off_begin;
@ -48,7 +46,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
off_cur &= TARGET_PAGE_MASK;
while (off_cur < off_cur_end) {
cpu_physical_memory_set_dirty(s->vram_offset +
@@ -614,7 +628,11 @@ static int cirrus_bitblt_common_patternc
@@ -615,7 +629,11 @@ static int cirrus_bitblt_common_patternc
{
uint8_t *dst;
@ -61,7 +59,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
(*s->cirrus_rop) (s, dst, src,
s->cirrus_blt_dstpitch, 0,
s->cirrus_blt_width, s->cirrus_blt_height);
@@ -630,8 +648,11 @@ static int cirrus_bitblt_solidfill(Cirru
@@ -631,8 +649,11 @@ static int cirrus_bitblt_solidfill(Cirru
{
cirrus_fill_t rop_func;
@ -74,7 +72,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
s->cirrus_blt_dstpitch,
s->cirrus_blt_width, s->cirrus_blt_height);
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
@@ -650,8 +671,8 @@ static int cirrus_bitblt_solidfill(Cirru
@@ -651,8 +672,8 @@ static int cirrus_bitblt_solidfill(Cirru
static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s)
{
return cirrus_bitblt_common_patterncopy(s,
@ -85,7 +83,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
}
static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
@@ -701,8 +722,10 @@ static void cirrus_do_copy(CirrusVGAStat
@@ -702,8 +723,10 @@ static void cirrus_do_copy(CirrusVGAStat
if (notify)
vga_hw_update();
@ -98,7 +96,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
s->cirrus_blt_width, s->cirrus_blt_height);
@@ -728,8 +751,14 @@ static int cirrus_bitblt_videotovideo_co
@@ -729,8 +752,14 @@ static int cirrus_bitblt_videotovideo_co
s->cirrus_blt_srcaddr - s->start_addr,
s->cirrus_blt_width, s->cirrus_blt_height);
} else {
@ -115,7 +113,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
s->cirrus_blt_width, s->cirrus_blt_height);
@@ -761,8 +790,9 @@ static void cirrus_bitblt_cputovideo_nex
@@ -762,8 +791,9 @@ static void cirrus_bitblt_cputovideo_nex
} else {
/* at least one scan line */
do {
@ -127,7 +125,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, 0,
s->cirrus_blt_width, 1);
s->cirrus_blt_dstaddr += s->cirrus_blt_dstpitch;
@@ -1862,7 +1892,7 @@ static void cirrus_mem_writeb_mode4and5_
@@ -1879,7 +1909,7 @@ static void cirrus_mem_writeb_mode4and5_
unsigned val = mem_value;
uint8_t *dst;
@ -136,7 +134,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
for (x = 0; x < 8; x++) {
if (val & 0x80) {
*dst = s->cirrus_shadow_gr1;
@@ -1885,7 +1915,7 @@ static void cirrus_mem_writeb_mode4and5_
@@ -1902,7 +1932,7 @@ static void cirrus_mem_writeb_mode4and5_
unsigned val = mem_value;
uint8_t *dst;
@ -145,10 +143,10 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga.c
for (x = 0; x < 8; x++) {
if (val & 0x80) {
*dst = s->cirrus_shadow_gr1;
Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga_rop.h
Index: xen-3.2-testing/tools/ioemu/hw/cirrus_vga_rop.h
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/hw/cirrus_vga_rop.h
+++ xen-3.1-testing/tools/ioemu/hw/cirrus_vga_rop.h
--- xen-3.2-testing.orig/tools/ioemu/hw/cirrus_vga_rop.h
+++ xen-3.2-testing/tools/ioemu/hw/cirrus_vga_rop.h
@@ -49,6 +49,12 @@ glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(C
src = src_ - src_base;
dstpitch -= bltwidth;
@ -162,31 +160,11 @@ Index: xen-3.1-testing/tools/ioemu/hw/cirrus_vga_rop.h
for (y = 0; y < bltheight; y++) {
for (x = 0; x < bltwidth; x++) {
ROP_OP(*(dst_base + m(dst)), *(src_base + m(src)));
Index: xen-3.1-testing/tools/ioemu/hw/fdc.c
Index: xen-3.2-testing/tools/ioemu/hw/i8259.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/hw/fdc.c
+++ xen-3.1-testing/tools/ioemu/hw/fdc.c
@@ -1110,8 +1110,13 @@ static uint32_t fdctrl_read_data (fdctrl
len = fdctrl->data_len - fdctrl->data_pos;
if (len > FD_SECTOR_LEN)
len = FD_SECTOR_LEN;
- bdrv_read(cur_drv->bs, fd_sector(cur_drv),
- fdctrl->fifo, len);
+ if (cur_drv->bs) {
+ bdrv_read(cur_drv->bs, fd_sector(cur_drv),
+ fdctrl->fifo, len);
+ } else {
+ FLOPPY_ERROR("can't read data from drive\n");
+ return 0;
+ }
}
}
retval = fdctrl->fifo[pos];
Index: xen-3.1-testing/tools/ioemu/hw/i8259.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/hw/i8259.c
+++ xen-3.1-testing/tools/ioemu/hw/i8259.c
@@ -292,9 +292,11 @@ static void pic_ioport_write(void *opaqu
--- xen-3.2-testing.orig/tools/ioemu/hw/i8259.c
+++ xen-3.2-testing/tools/ioemu/hw/i8259.c
@@ -299,9 +299,11 @@ static void pic_ioport_write(void *opaqu
s->init_state = 1;
s->init4 = val & 1;
if (val & 0x02)
@ -200,10 +178,10 @@ Index: xen-3.1-testing/tools/ioemu/hw/i8259.c
} else if (val & 0x08) {
if (val & 0x04)
s->poll = 1;
Index: xen-3.1-testing/tools/ioemu/hw/ne2000.c
Index: xen-3.2-testing/tools/ioemu/hw/ne2000.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/hw/ne2000.c
+++ xen-3.1-testing/tools/ioemu/hw/ne2000.c
--- xen-3.2-testing.orig/tools/ioemu/hw/ne2000.c
+++ xen-3.2-testing/tools/ioemu/hw/ne2000.c
@@ -221,7 +221,7 @@ static int ne2000_can_receive(void *opaq
NE2000State *s = opaque;
@ -213,33 +191,11 @@ Index: xen-3.1-testing/tools/ioemu/hw/ne2000.c
return !ne2000_buffer_full(s);
}
@@ -252,7 +252,7 @@ static void ne2000_receive(void *opaque,
{
NE2000State *s = opaque;
uint8_t *p;
- int total_len, next, avail, len, index, mcast_idx;
+ unsigned int total_len, next, avail, len, index, mcast_idx;
uint8_t buf1[60];
static const uint8_t broadcast_macaddr[6] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@@ -327,7 +327,11 @@ static void ne2000_receive(void *opaque,
/* write packet data */
while (size > 0) {
- avail = s->stop - index;
+ /* taviso: this can wrap, so check its okay. */
+ if (index <= s->stop)
+ avail = s->stop - index;
+ else
+ avail = 0;
len = size;
if (len > avail)
len = avail;
Index: xen-3.1-testing/tools/ioemu/hw/pc.c
Index: xen-3.2-testing/tools/ioemu/hw/pc.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/hw/pc.c
+++ xen-3.1-testing/tools/ioemu/hw/pc.c
@@ -329,7 +329,8 @@ void bochs_bios_write(void *opaque, uint
--- xen-3.2-testing.orig/tools/ioemu/hw/pc.c
+++ xen-3.2-testing/tools/ioemu/hw/pc.c
@@ -315,7 +315,8 @@ void bochs_bios_write(void *opaque, uint
case 0x400:
case 0x401:
fprintf(stderr, "BIOS panic at rombios.c, line %d\n", val);
@ -249,7 +205,7 @@ Index: xen-3.1-testing/tools/ioemu/hw/pc.c
case 0x402:
case 0x403:
#ifdef DEBUG_BIOS
@@ -352,8 +353,9 @@ void bochs_bios_write(void *opaque, uint
@@ -338,8 +339,9 @@ void bochs_bios_write(void *opaque, uint
/* LGPL'ed VGA BIOS messages */
case 0x501:
case 0x502:
@ -260,28 +216,11 @@ Index: xen-3.1-testing/tools/ioemu/hw/pc.c
case 0x500:
case 0x503:
#ifdef DEBUG_BIOS
Index: xen-3.1-testing/tools/ioemu/hw/sb16.c
Index: xen-3.2-testing/tools/ioemu/target-i386/translate.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/hw/sb16.c
+++ xen-3.1-testing/tools/ioemu/hw/sb16.c
@@ -1235,8 +1235,10 @@ static int SB_read_DMA (void *opaque, in
s->block_size);
#endif
- while (s->left_till_irq <= 0) {
- s->left_till_irq = s->block_size + s->left_till_irq;
+ if (s->block_size) {
+ while (s->left_till_irq <= 0) {
+ s->left_till_irq = s->block_size + s->left_till_irq;
+ }
}
return dma_pos;
Index: xen-3.1-testing/tools/ioemu/target-i386/translate.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/target-i386/translate.c
+++ xen-3.1-testing/tools/ioemu/target-i386/translate.c
@@ -5244,7 +5244,12 @@ static target_ulong disas_insn(DisasCont
--- xen-3.2-testing.orig/tools/ioemu/target-i386/translate.c
+++ xen-3.2-testing/tools/ioemu/target-i386/translate.c
@@ -5326,7 +5326,12 @@ static target_ulong disas_insn(DisasCont
if (CODE64(s))
goto illegal_op;
val = ldub_code(s->pc++);
@ -295,7 +234,7 @@ Index: xen-3.1-testing/tools/ioemu/target-i386/translate.c
s->cc_op = CC_OP_LOGICB;
break;
case 0xd5: /* aad */
@@ -5292,6 +5297,7 @@ static target_ulong disas_insn(DisasCont
@@ -5374,6 +5379,7 @@ static target_ulong disas_insn(DisasCont
gen_jmp_im(pc_start - s->cs_base);
gen_op_into(s->pc - pc_start);
break;
@ -303,7 +242,7 @@ Index: xen-3.1-testing/tools/ioemu/target-i386/translate.c
case 0xf1: /* icebp (undocumented, exits to external debugger) */
#if 1
gen_debug(s, pc_start - s->cs_base);
@@ -5301,6 +5307,7 @@ static target_ulong disas_insn(DisasCont
@@ -5383,6 +5389,7 @@ static target_ulong disas_insn(DisasCont
cpu_set_log(CPU_LOG_INT | CPU_LOG_TB_IN_ASM);
#endif
break;
@ -311,11 +250,11 @@ Index: xen-3.1-testing/tools/ioemu/target-i386/translate.c
case 0xfa: /* cli */
if (!s->vm86) {
if (s->cpl <= s->iopl) {
Index: xen-3.1-testing/tools/ioemu/vl.c
Index: xen-3.2-testing/tools/ioemu/vl.c
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/vl.c
+++ xen-3.1-testing/tools/ioemu/vl.c
@@ -3302,8 +3302,8 @@ typedef struct NetSocketState {
--- xen-3.2-testing.orig/tools/ioemu/vl.c
+++ xen-3.2-testing/tools/ioemu/vl.c
@@ -3584,8 +3584,8 @@ typedef struct NetSocketState {
VLANClientState *vc;
int fd;
int state; /* 0 = getting length, 1 = getting data */
@ -326,7 +265,7 @@ Index: xen-3.1-testing/tools/ioemu/vl.c
uint8_t buf[4096];
struct sockaddr_in dgram_dst; /* contains inet host and port destination iff connectionless (SOCK_DGRAM) */
} NetSocketState;
@@ -3334,7 +3334,8 @@ static void net_socket_receive_dgram(voi
@@ -3616,7 +3616,8 @@ static void net_socket_receive_dgram(voi
static void net_socket_send(void *opaque)
{
NetSocketState *s = opaque;
@ -336,7 +275,7 @@ Index: xen-3.1-testing/tools/ioemu/vl.c
uint8_t buf1[4096];
const uint8_t *buf;
@@ -3373,7 +3374,15 @@ static void net_socket_send(void *opaque
@@ -3655,7 +3656,15 @@ static void net_socket_send(void *opaque
l = s->packet_len - s->index;
if (l > size)
l = size;

View File

@ -1,406 +0,0 @@
Index: 2007-04-27/xen/arch/x86/Makefile
===================================================================
--- 2007-04-27.orig/xen/arch/x86/Makefile 2006-12-01 10:44:36.000000000 +0100
+++ 2007-04-27/xen/arch/x86/Makefile 2007-04-27 09:31:25.000000000 +0200
@@ -78,6 +78,8 @@ xen.lds: $(TARGET_SUBARCH)/xen.lds.S $(H
boot/mkelf32: boot/mkelf32.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
+boot/$(TARGET_SUBARCH).o: boot/realmode.S
+
.PHONY: clean
clean::
rm -f asm-offsets.s xen.lds boot/*.o boot/*~ boot/core boot/mkelf32
Index: 2007-04-27/xen/arch/x86/boot/realmode.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2007-04-27/xen/arch/x86/boot/realmode.S 2007-04-27 09:31:25.000000000 +0200
@@ -0,0 +1,122 @@
+#define REALMODE_SEG 0x1000
+#define REALMODE_BASE (REALMODE_SEG << 4)
+
+ .section .init.data, "aw"
+ .align 8
+gdt16_table:
+ .quad 0
+ .quad 0x00cf9a000000ffff /* 0xe008 ring 0 4.00GB code at 0x0 */
+ .quad 0x00cf92000000ffff /* 0xe010 ring 0 4.00GB data at 0x0 */
+ /* 0xe018 ring 0 64kB 16-bit code at REALMODE_BASE */
+#define __HYPERVISOR_CS16 (__HYPERVISOR_CS + 0x10)
+ .long 0x0000ffff + ((REALMODE_BASE & 0xffff) << 16)
+ .long 0x00009a00 + (REALMODE_BASE >> 16)
+ /* 0xe020 ring 0 64kB 16-bit data at REALMODE_BASE */
+#define __HYPERVISOR_DS16 (__HYPERVISOR_DS32 + 0x10)
+ .long 0x0000ffff + ((REALMODE_BASE & 0xffff) << 16)
+ .long 0x00009200 + (REALMODE_BASE >> 16)
+#if __HYPERVISOR_CS32 != __HYPERVISOR_CS
+/* This doesn't work properly with gas up to at least 2.17.50 as of Feb 2007.
+ Using .skip or .fill also doesn't work up to 2.15 or 2.16. Use as' -K
+ option to be pointed at the problematic construct (.word with its operand
+ being the difference of two symbols) below.
+ .org gdt16_table + (__HYPERVISOR_CS32 - FIRST_RESERVED_GDT_BYTE) */
+ .rept (__HYPERVISOR_CS32 - __HYPERVISOR_DS16) / 8 - 1
+ .quad 0
+ .endr
+ .quad 0x00cf9a000000ffff /* 0xe038 ring 0 4.00GB code at 0x0 */
+#endif
+.Lgdt16_end:
+
+ .word 0
+gdt16: .word FIRST_RESERVED_GDT_BYTE + .Lgdt16_end - gdt16_table - 1
+ .long SYM_PHYS(gdt16_table) - FIRST_RESERVED_GDT_BYTE
+
+#define SYM_REAL(x) ((x) - .L__realtext)
+
+ .section .init.text, "ax"
+ .code32
+realmode:
+ pushal
+ movl %esp, %ebp
+ sgdt SYM_PHYS(.Lgdt)
+ sidt SYM_PHYS(.Lidt)
+ testl $MBI_CMDLINE, MBI_flags(%ebx)
+ movl MBI_cmdline(%ebx), %esi
+ jz 1f
+ testl %esi, %esi
+ jz 1f
+ movl $REALMODE_BASE + 0x10000, %edi
+ movl %edi, SYM_PHYS(cmd_line_ptr)
+0:
+ lodsb
+ stosb
+ testb %al, %al
+ jnz 0b
+1:
+ movl $SYM_PHYS(.L__realtext), %esi
+ movl $REALMODE_BASE, %edi
+ movl $SYM_PHYS(__end_realmode), %ecx
+ subl %esi, %ecx
+ rep movsb
+ movl 9*4(%ebp), %edi
+ subl $SYM_PHYS(.L__realtext), %edi
+ lgdt SYM_PHYS(gdt16)
+ movl $__HYPERVISOR_DS16, %ecx
+ mov %ecx, %ss
+ xorl %esp, %esp
+ mov %ecx, %ds
+ mov %ecx, %es
+ ljmpl $__HYPERVISOR_CS16, $SYM_REAL(.Ltext16)
+
+protmode:
+ movl $__HYPERVISOR_DS32, %ecx
+ mov %ecx, %ss
+ movl %ebp, %esp
+ mov %ecx, %ds
+ mov %ecx, %es
+ movl $REALMODE_BASE + SYM_PHYS(.L__realdata), %esi
+ subl $SYM_PHYS(.L__realtext), %esi
+ movl $SYM_PHYS(.L__realdata), %edi
+ movl $SYM_PHYS(__end_realmode), %ecx
+ subl %edi, %ecx
+ rep movsb
+ mov %ecx, %fs
+ mov %ecx, %gs
+ popal
+ ret $4
+
+ .section .real.text, "ax"
+.L__realtext:
+ .code16
+.Ltext16:
+ mov %cr0, %eax
+ andb $~1, %al
+ mov %eax, %cr0
+ ljmpw $REALMODE_SEG, $SYM_REAL(.Lrealmode)
+.Lrealmode:
+ mov %cs, %cx
+ mov %cx, %ss
+ mov %cx, %ds
+ mov %cx, %es
+
+ pushal
+ callw *%di
+ popal
+
+ pushw $0
+ popfw
+ lgdtl %cs:SYM_REAL(.Lgdt)
+ lidtl %cs:SYM_REAL(.Lidt)
+ mov %cr0, %eax
+ orb $1, %al
+ mov %eax, %cr0
+ ljmpl $__HYPERVISOR_CS32, $SYM_PHYS(protmode)
+
+ .section .real.data, "aw"
+.L__realdata:
+ .align 4
+cmd_line_ptr: .long 0
+.Lgdt: .skip 2+4
+.Lidt: .skip 2+4
+ .previous
Index: 2007-04-27/xen/arch/x86/boot/x86_32.S
===================================================================
--- 2007-04-27.orig/xen/arch/x86/boot/x86_32.S 2007-01-05 10:09:13.000000000 +0100
+++ 2007-04-27/xen/arch/x86/boot/x86_32.S 2007-04-27 09:31:25.000000000 +0200
@@ -10,6 +10,8 @@
.text
+#define SYM_PHYS(sym) (sym - __PAGE_OFFSET)
+
ENTRY(start)
jmp __start
@@ -28,7 +30,7 @@ ENTRY(start)
not_multiboot_msg:
.asciz "ERR: Not a Multiboot bootloader!"
not_multiboot:
- mov $not_multiboot_msg-__PAGE_OFFSET,%esi
+ mov $SYM_PHYS(not_multiboot_msg),%esi
mov $0xB8000,%edi # VGA framebuffer
1: mov (%esi),%bl
test %bl,%bl # Terminate on '\0' sentinel
@@ -47,14 +49,14 @@ not_multiboot:
__start:
/* Set up a few descriptors: on entry only CS is guaranteed good. */
- lgdt %cs:nopaging_gdt_descr-__PAGE_OFFSET
+ lgdt %cs:SYM_PHYS(nopaging_gdt_descr)
mov $(__HYPERVISOR_DS),%ecx
mov %ecx,%ds
mov %ecx,%es
mov %ecx,%fs
mov %ecx,%gs
- ljmp $(__HYPERVISOR_CS),$(1f)-__PAGE_OFFSET
-1: lss stack_start-__PAGE_OFFSET,%esp
+ ljmp $(__HYPERVISOR_CS),$SYM_PHYS(1f)
+1: lss SYM_PHYS(stack_start),%esp
add $(STACK_SIZE-CPUINFO_sizeof-__PAGE_OFFSET),%esp
/* Reset EFLAGS (subsumes CLI and CLD). */
@@ -66,7 +68,7 @@ __start:
/* Set up CR4, except global flag which Intel requires should be */
/* left until after paging is enabled (IA32 Manual Vol. 3, Sec. 2.5) */
- mov mmu_cr4_features-__PAGE_OFFSET,%ecx
+ mov SYM_PHYS(mmu_cr4_features),%ecx
and $0x7f,%cl # CR4.PGE (global enable)
mov %ecx,%cr4
@@ -78,19 +80,19 @@ __start:
jne not_multiboot
/* Initialize BSS (no nasty surprises!) */
- mov $__bss_start-__PAGE_OFFSET,%edi
- mov $_end-__PAGE_OFFSET,%ecx
+ mov $SYM_PHYS(__bss_start),%edi
+ mov $SYM_PHYS(_end),%ecx
sub %edi,%ecx
xor %eax,%eax
rep stosb
/* Save the Multiboot info structure for later use. */
- add $__PAGE_OFFSET,%ebx
- push %ebx
+ lea __PAGE_OFFSET(%ebx),%eax
+ push %eax
#ifdef CONFIG_X86_PAE
/* Initialize low and high mappings of all memory with 2MB pages */
- mov $idle_pg_table_l2-__PAGE_OFFSET,%edi
+ mov $SYM_PHYS(idle_pg_table_l2),%edi
mov $0xe3,%eax /* PRESENT+RW+A+D+2MB */
1: mov %eax,__PAGE_OFFSET>>18(%edi) /* high mapping */
stosl /* low mapping */
@@ -105,7 +107,7 @@ __start:
jne 1b
#else
/* Initialize low and high mappings of all memory with 4MB pages */
- mov $idle_pg_table-__PAGE_OFFSET,%edi
+ mov $SYM_PHYS(idle_pg_table),%edi
mov $0xe3,%eax /* PRESENT+RW+A+D+4MB */
1: mov %eax,__PAGE_OFFSET>>20(%edi) /* high mapping */
stosl /* low mapping */
@@ -123,7 +125,7 @@ __start:
mov $(__HYPERVISOR_CS << 16),%eax
mov %dx,%ax /* selector = 0x0010 = cs */
mov $0x8E00,%dx /* interrupt gate - dpl=0, present */
- lea idt_table-__PAGE_OFFSET,%edi
+ lea SYM_PHYS(idt_table),%edi
mov $256,%ecx
1: mov %eax,(%edi)
mov %edx,4(%edi)
@@ -149,7 +151,7 @@ start_paging:
no_execute_disable:
pop %ebx
#endif
- mov $idle_pg_table-__PAGE_OFFSET,%eax
+ mov $SYM_PHYS(idle_pg_table),%eax
mov %eax,%cr3
mov $0x80050033,%eax /* hi-to-lo: PG,AM,WP,NE,ET,MP,PE */
mov %eax,%cr0
@@ -212,7 +214,7 @@ gdt_descr:
.word 0
nopaging_gdt_descr:
.word LAST_RESERVED_GDT_BYTE
- .long gdt_table - FIRST_RESERVED_GDT_BYTE - __PAGE_OFFSET
+ .long SYM_PHYS(gdt_table) - FIRST_RESERVED_GDT_BYTE
.align PAGE_SIZE, 0
/* NB. Rings != 0 get access up to MACH2PHYS_VIRT_END. This allows access to */
@@ -236,10 +238,10 @@ ENTRY(gdt_table)
#ifdef CONFIG_X86_PAE
ENTRY(idle_pg_table)
ENTRY(idle_pg_table_l3)
- .long idle_pg_table_l2 + 0*PAGE_SIZE + 0x01 - __PAGE_OFFSET, 0
- .long idle_pg_table_l2 + 1*PAGE_SIZE + 0x01 - __PAGE_OFFSET, 0
- .long idle_pg_table_l2 + 2*PAGE_SIZE + 0x01 - __PAGE_OFFSET, 0
- .long idle_pg_table_l2 + 3*PAGE_SIZE + 0x01 - __PAGE_OFFSET, 0
+ .long SYM_PHYS(idle_pg_table_l2) + 0*PAGE_SIZE + 0x01, 0
+ .long SYM_PHYS(idle_pg_table_l2) + 1*PAGE_SIZE + 0x01, 0
+ .long SYM_PHYS(idle_pg_table_l2) + 2*PAGE_SIZE + 0x01, 0
+ .long SYM_PHYS(idle_pg_table_l2) + 3*PAGE_SIZE + 0x01, 0
.section ".bss.page_aligned","w"
ENTRY(idle_pg_table_l2)
.fill 4*PAGE_SIZE,1,0
@@ -253,3 +255,8 @@ ENTRY(idle_pg_table_l2)
.section ".bss.stack_aligned","w"
ENTRY(cpu0_stack)
.fill STACK_SIZE,1,0
+
+#define __HYPERVISOR_CS32 __HYPERVISOR_CS
+#define __HYPERVISOR_DS32 __HYPERVISOR_DS
+
+#include "realmode.S"
Index: 2007-04-27/xen/arch/x86/boot/x86_64.S
===================================================================
--- 2007-04-27.orig/xen/arch/x86/boot/x86_64.S 2007-01-08 14:15:31.000000000 +0100
+++ 2007-04-27/xen/arch/x86/boot/x86_64.S 2007-04-27 09:31:25.000000000 +0200
@@ -72,6 +72,8 @@ __start:
/* Save the Multiboot info structure for later use. */
mov %ebx,SYM_PHYS(multiboot_ptr)
+ lss SYM_PHYS(.Lstack_start),%esp
+
/* We begin by interrogating the CPU for the presence of long mode. */
mov $0x80000000,%eax
cpuid
@@ -200,7 +202,7 @@ multiboot_ptr:
.word 0
nopaging_gdt_descr:
.word LAST_RESERVED_GDT_BYTE
- .quad gdt_table - FIRST_RESERVED_GDT_BYTE - __PAGE_OFFSET
+ .quad SYM_PHYS(gdt_table) - FIRST_RESERVED_GDT_BYTE
cpuid_ext_features:
.long 0
@@ -217,6 +219,9 @@ idt_descr:
ENTRY(stack_start)
.quad cpu0_stack
+.Lstack_start:
+ .long SYM_PHYS(cpu0_stack) + STACK_SIZE - CPUINFO_sizeof
+ .word __HYPERVISOR_DS32
high_start:
.quad __high_start
@@ -256,14 +261,14 @@ ENTRY(compat_gdt_table)
.align PAGE_SIZE, 0
ENTRY(idle_pg_table)
ENTRY(idle_pg_table_4)
- .quad idle_pg_table_l3 - __PAGE_OFFSET + 7 # PML4[0]
+ .quad SYM_PHYS(idle_pg_table_l3) + 7 # PML4[0]
.fill 261,8,0
- .quad idle_pg_table_l3 - __PAGE_OFFSET + 7 # PML4[262]
+ .quad SYM_PHYS(idle_pg_table_l3) + 7 # PML4[262]
/* Initial PDP -- level-3 page table. */
.align PAGE_SIZE, 0
ENTRY(idle_pg_table_l3)
- .quad idle_pg_table_l2 - __PAGE_OFFSET + 7
+ .quad SYM_PHYS(idle_pg_table_l2) + 7
/* Initial PDE -- level-2 page table. Maps first 1GB physical memory. */
.align PAGE_SIZE, 0
@@ -283,3 +288,5 @@ ENTRY(idle_pg_table_l2)
.section ".bss.stack_aligned","w"
ENTRY(cpu0_stack)
.fill STACK_SIZE,1,0
+
+#include "realmode.S"
Index: 2007-04-27/xen/arch/x86/x86_32/asm-offsets.c
===================================================================
--- 2007-04-27.orig/xen/arch/x86/x86_32/asm-offsets.c 2007-04-02 12:16:26.000000000 +0200
+++ 2007-04-27/xen/arch/x86/x86_32/asm-offsets.c 2007-04-27 09:31:25.000000000 +0200
@@ -7,6 +7,7 @@
#include <xen/config.h>
#include <xen/perfc.h>
#include <xen/sched.h>
+#include <xen/multiboot.h>
#include <asm/fixmap.h>
#include <asm/hardirq.h>
@@ -99,6 +100,10 @@ void __dummy__(void)
DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
BLANK();
+ OFFSET(MBI_flags, multiboot_info_t, flags);
+ OFFSET(MBI_cmdline, multiboot_info_t, cmdline);
+ BLANK();
+
OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
Index: 2007-04-27/xen/arch/x86/x86_32/xen.lds.S
===================================================================
--- 2007-04-27.orig/xen/arch/x86/x86_32/xen.lds.S 2007-01-05 10:09:13.000000000 +0100
+++ 2007-04-27/xen/arch/x86/x86_32/xen.lds.S 2007-04-27 09:31:25.000000000 +0200
@@ -63,6 +63,10 @@ SECTIONS
__initcall_start = .;
.initcall.init : { *(.initcall1.init) } :text
__initcall_end = .;
+ . = ALIGN(16);
+ .real.text : { *(.real.text) } :text
+ .real.data : { *(.real.data) } :text
+ __end_realmode = .;
. = ALIGN(PAGE_SIZE);
__init_end = .;
Index: 2007-04-27/xen/arch/x86/x86_64/asm-offsets.c
===================================================================
--- 2007-04-27.orig/xen/arch/x86/x86_64/asm-offsets.c 2007-04-02 12:16:26.000000000 +0200
+++ 2007-04-27/xen/arch/x86/x86_64/asm-offsets.c 2007-04-27 09:31:25.000000000 +0200
@@ -7,6 +7,7 @@
#include <xen/config.h>
#include <xen/perfc.h>
#include <xen/sched.h>
+#include <xen/multiboot.h>
#ifdef CONFIG_COMPAT
#include <compat/xen.h>
#endif
@@ -112,6 +113,10 @@ void __dummy__(void)
DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
BLANK();
+ OFFSET(MBI_flags, multiboot_info_t, flags);
+ OFFSET(MBI_cmdline, multiboot_info_t, cmdline);
+ BLANK();
+
OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
Index: 2007-04-27/xen/arch/x86/x86_64/xen.lds.S
===================================================================
--- 2007-04-27.orig/xen/arch/x86/x86_64/xen.lds.S 2007-01-05 10:09:13.000000000 +0100
+++ 2007-04-27/xen/arch/x86/x86_64/xen.lds.S 2007-04-27 09:31:25.000000000 +0200
@@ -61,6 +61,10 @@ SECTIONS
__initcall_start = .;
.initcall.init : { *(.initcall1.init) } :text
__initcall_end = .;
+ . = ALIGN(16);
+ .real.text : { *(.real.text) } :text
+ .real.data : { *(.real.data) } :text
+ __end_realmode = .;
. = ALIGN(PAGE_SIZE);
__init_end = .;

View File

@ -1,24 +1,7 @@
Index: xen-3.1-testing/tools/blktap/lib/Makefile
Index: xen-3.2-testing/tools/examples/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
--- xen-3.2-testing.orig/tools/examples/Makefile
+++ xen-3.2-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

73
svm-lmsl.patch Normal file
View File

@ -0,0 +1,73 @@
Index: xen-3.2-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-3.2-testing/xen/arch/x86/hvm/hvm.c
@@ -606,10 +606,11 @@ int hvm_set_efer(uint64_t value)
value &= ~EFER_LMA;
- if ( (value & ~(EFER_FFXSE | EFER_LME | EFER_NX | EFER_SCE)) ||
+ if ( (value & ~(EFER_FFXSE | EFER_LMSLE | EFER_LME | EFER_NX | EFER_SCE)) ||
((sizeof(long) != 8) && (value & EFER_LME)) ||
(!cpu_has_nx && (value & EFER_NX)) ||
(!cpu_has_syscall && (value & EFER_SCE)) ||
+ (!cpu_has_lmsl && (value & EFER_LMSLE)) ||
(!cpu_has_ffxsr && (value & EFER_FFXSE)) )
{
gdprintk(XENLOG_WARNING, "Trying to set reserved bit in "
Index: xen-3.2-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-3.2-testing/xen/arch/x86/hvm/svm/svm.c
@@ -53,6 +53,11 @@
u32 svm_feature_flags;
+#ifdef __x86_64__
+/* indicate whether guest may use EFER.LMSLE */
+unsigned char cpu_has_lmsl = 0;
+#endif
+
#define set_segment_register(name, value) \
asm volatile ( "movw %%ax ,%%" STR(name) "" : : "a" (value) )
@@ -922,6 +927,22 @@ int start_svm(struct cpuinfo_x86 *c)
/* Initialize core's ASID handling. */
svm_asid_init(c);
+#ifdef __x86_64__
+ /*
+ * Check whether EFER.LMSLE can be written.
+ * Unfortunately there's no feature bit defined for this.
+ */
+ eax = read_efer();
+ edx = read_efer() >> 32;
+ if ( wrmsr_safe(MSR_EFER, eax | EFER_LMSLE, edx) == 0 )
+ rdmsr(MSR_EFER, eax, edx);
+ if ( eax & EFER_LMSLE )
+ {
+ cpu_has_lmsl = 1;
+ wrmsr(MSR_EFER, eax ^ EFER_LMSLE, edx);
+ }
+#endif
+
if ( cpu != 0 )
return 1;
Index: xen-3.2-testing/xen/include/asm-x86/hvm/hvm.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/hvm/hvm.h
+++ xen-3.2-testing/xen/include/asm-x86/hvm/hvm.h
@@ -127,6 +127,12 @@ struct hvm_function_table {
extern struct hvm_function_table hvm_funcs;
extern int hvm_enabled;
+#ifdef __i386__
+# define cpu_has_lmsl 0
+#else
+extern unsigned char cpu_has_lmsl;
+#endif
+
int hvm_domain_initialise(struct domain *d);
void hvm_domain_relinquish_resources(struct domain *d);
void hvm_domain_destroy(struct domain *d);

View File

@ -1,264 +0,0 @@
Index: 2007-05-14/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/svm/svm.c 2007-05-14 14:28:19.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/svm/svm.c 2007-05-14 14:33:08.000000000 +0200
@@ -747,28 +747,10 @@ static void svm_init_hypercall_page(stru
*(u16 *)(hypercall_page + (__HYPERVISOR_iret * 32)) = 0x0b0f; /* ud2 */
}
-static void save_svm_cpu_user_regs(struct vcpu *v, struct cpu_user_regs *ctxt)
-{
- struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
-
- ctxt->eax = vmcb->rax;
- ctxt->ss = vmcb->ss.sel;
- ctxt->esp = vmcb->rsp;
- ctxt->eflags = vmcb->rflags;
- ctxt->cs = vmcb->cs.sel;
- ctxt->eip = vmcb->rip;
-
- ctxt->gs = vmcb->gs.sel;
- ctxt->fs = vmcb->fs.sel;
- ctxt->es = vmcb->es.sel;
- ctxt->ds = vmcb->ds.sel;
-}
-
static void svm_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs)
{
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
- vmcb->rax = regs->eax;
vmcb->ss.sel = regs->ss;
vmcb->rsp = regs->esp;
vmcb->rflags = regs->eflags | 2UL;
@@ -1408,7 +1390,7 @@ static void svm_io_instruction(struct vc
/* Copy current guest state into io instruction state structure. */
memcpy(regs, guest_cpu_user_regs(), HVM_CONTEXT_STACK_BYTES);
- hvm_store_cpu_guest_regs(v, regs, NULL);
+ svm_store_cpu_guest_regs(v, regs, NULL);
info.bytes = vmcb->exitinfo1;
@@ -2236,7 +2218,6 @@ asmlinkage void svm_vmexit_handler(struc
int inst_len, rc;
exit_reason = vmcb->exitcode;
- save_svm_cpu_user_regs(v, regs);
HVMTRACE_2D(VMEXIT, v, vmcb->rip, exit_reason);
Index: 2007-05-14/xen/arch/x86/hvm/svm/x86_32/exits.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/svm/x86_32/exits.S 2007-04-23 10:01:41.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/svm/x86_32/exits.S 2007-05-14 14:33:08.000000000 +0200
@@ -61,8 +61,11 @@
#define HVM_SAVE_ALL_NOSEGREGS \
pushl $HVM_MONITOR_EFLAGS; \
popf; \
- subl $(NR_SKIPPED_REGS*4), %esp; \
- pushl %eax; \
+ /* \
+ * Skip %eax, we need have vmcb address in there. \
+ * Don't worry, EAX is saved during #VMEXIT. \
+ */ \
+ subl $4+(NR_SKIPPED_REGS*4), %esp; \
pushl %ebp; \
pushl %edi; \
pushl %esi; \
@@ -77,8 +80,11 @@
popl %esi; \
popl %edi; \
popl %ebp; \
- popl %eax; \
- addl $(NR_SKIPPED_REGS*4), %esp
+ /* \
+ * Skip %eax, we need to have vmcb address in there. \
+ * Don't worry, EAX is restored through the VMRUN instruction. \
+ */ \
+ addl $4+(NR_SKIPPED_REGS*4), %esp
#define VMRUN .byte 0x0F,0x01,0xD8
#define VMLOAD .byte 0x0F,0x01,0xDA
@@ -88,63 +94,53 @@
ENTRY(svm_asm_do_resume)
GET_CURRENT(%ebx)
- xorl %ecx,%ecx
- notl %ecx
+.Lresume:
cli # tests must not race interrupts
movl VCPU_processor(%ebx),%eax
shl $IRQSTAT_shift,%eax
- test %ecx,irq_stat(%eax,1)
- jnz svm_process_softirqs
+ cmpl $0,irq_stat(%eax)
+ jne svm_process_softirqs
call svm_intr_assist
call svm_load_cr2
CLGI
sti
- GET_CURRENT(%ebx)
movl VCPU_svm_vmcb(%ebx), %ecx
- movl 24(%esp), %eax
+ movl UREGS_eax(%esp), %eax
+ movl VCPU_processor(%ebx), %edx
movl %eax, VMCB_rax(%ecx)
- movl VCPU_processor(%ebx), %eax
- movl root_vmcb_pa(,%eax,8), %eax
+ movl root_vmcb_pa(,%edx,8), %eax
VMSAVE
movl VCPU_svm_vmcb_pa(%ebx), %eax
- popl %ebx
- popl %ecx
- popl %edx
- popl %esi
- popl %edi
- popl %ebp
-
- /*
- * Skip %eax, we need to have vmcb address in there.
- * Don't worry, EAX is restored through the VMRUN instruction.
- */
- addl $4, %esp
- addl $(NR_SKIPPED_REGS*4), %esp
+ HVM_RESTORE_ALL_NOSEGREGS
+
VMLOAD
VMRUN
VMSAVE
- /* eax is the only register we're allowed to touch here... */
- GET_CURRENT(%eax)
+ HVM_SAVE_ALL_NOSEGREGS
- movl VCPU_processor(%eax), %eax
- movl root_vmcb_pa(,%eax,8), %eax
+ GET_CURRENT(%ebx)
+ movl VCPU_processor(%ebx), %ecx
+ movl VCPU_svm_vmcb(%ebx), %edx
+ movl root_vmcb_pa(,%ecx,8), %eax
VMLOAD
+ movl VMCB_rax(%edx), %eax
- HVM_SAVE_ALL_NOSEGREGS
STGI
.globl svm_stgi_label;
svm_stgi_label:
+
+ movl %eax, UREGS_eax(%esp)
movl %esp,%eax
push %eax
call svm_vmexit_handler
addl $4,%esp
- jmp svm_asm_do_resume
+ jmp .Lresume
ALIGN
svm_process_softirqs:
sti
call do_softirq
- jmp svm_asm_do_resume
+ jmp .Lresume
Index: 2007-05-14/xen/arch/x86/hvm/svm/x86_64/exits.S
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/svm/x86_64/exits.S 2007-04-23 10:01:41.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/svm/x86_64/exits.S 2007-05-14 14:33:08.000000000 +0200
@@ -85,7 +85,11 @@
popq %r10; \
popq %r9; \
popq %r8; \
- popq %rax; \
+ /* \
+ * Discard %rax, we need to have vmcb address in there. \
+ * Don't worry, RAX is restored through the VMRUN instruction. \
+ */ \
+ addq $8, %rsp; \
popq %rcx; \
popq %rdx; \
popq %rsi; \
@@ -100,68 +104,54 @@
ENTRY(svm_asm_do_resume)
GET_CURRENT(%rbx)
+.Lresume:
cli # tests must not race interrupts
movl VCPU_processor(%rbx),%eax
shl $IRQSTAT_shift, %rax
leaq irq_stat(%rip), %rdx
- testl $~0, (%rdx, %rax, 1)
- jnz svm_process_softirqs
+ cmpl $0, (%rdx, %rax)
+ jne svm_process_softirqs
call svm_intr_assist
call svm_load_cr2
CLGI
sti
- GET_CURRENT(%rbx)
movq VCPU_svm_vmcb(%rbx), %rcx
movq UREGS_rax(%rsp), %rax
+ movl VCPU_processor(%rbx), %edx
movq %rax, VMCB_rax(%rcx)
leaq root_vmcb_pa(%rip), %rax
- movl VCPU_processor(%rbx), %ecx
- movq (%rax,%rcx,8), %rax
+ movq (%rax,%rdx,8), %rax
VMSAVE
movq VCPU_svm_vmcb_pa(%rbx), %rax
- popq %r15
- popq %r14
- popq %r13
- popq %r12
- popq %rbp
- popq %rbx
- popq %r11
- popq %r10
- popq %r9
- popq %r8
- /*
- * Skip %rax, we need to have vmcb address in there.
- * Don't worry, RAX is restored through the VMRUN instruction.
- */
- addq $8, %rsp
- popq %rcx
- popq %rdx
- popq %rsi
- popq %rdi
- addq $(NR_SKIPPED_REGS*8), %rsp
+ HVM_RESTORE_ALL_NOSEGREGS
VMLOAD
VMRUN
VMSAVE
+
HVM_SAVE_ALL_NOSEGREGS
GET_CURRENT(%rbx)
- leaq root_vmcb_pa(%rip), %rax
movl VCPU_processor(%rbx), %ecx
+ leaq root_vmcb_pa(%rip), %rax
+ movq VCPU_svm_vmcb(%rbx), %rdx
movq (%rax,%rcx,8), %rax
VMLOAD
+ movq VMCB_rax(%rdx), %rax
STGI
.globl svm_stgi_label;
svm_stgi_label:
+
+ movq %rax, UREGS_rax(%rsp)
movq %rsp,%rdi
call svm_vmexit_handler
- jmp svm_asm_do_resume
+ jmp .Lresume
ALIGN
svm_process_softirqs:
sti
call do_softirq
- jmp svm_asm_do_resume
+ jmp .Lresume

View File

@ -1,11 +1,67 @@
## Path: System/Virtualization
## Description:
## Type: list()
## Default: ""
## Config:
#
# Space delimited list of network types, physical/virtual network
# devices,mac addresses and IP addresses to create bridges on using
# the following format:
#
# <network type>,<number of network type>,<network device>,<mac address>,<IP address/CIDR NetMask>,<dhcp server status>
#
# Where:
# <network type> = bridge|nat|route|hostonly|nohost|empty
# <number of network type> = The network number (0,1,2,etc.) of that type of
# network (i.e. xennat0, xenbr1, xenhost3, etc.)
# <network device> = The network interface the bridge will be
# attached to (i.e. eth0, veth2, etc.)
# If set to 'default' the interface used for the
# default gateway will be used
# <mac address> = The MAC address to assign to <network device>
# <IP address/CIDR Netmask> = The IP address and Subnet Mask to assign to
# <network device> format= 1.2.3.4/24
# <dhcp server status> = dhcp-on|dhcp-off (DHCP server on/off on that net)
#
# Network Definition Examples:
# bridged "bridge,0,default,,,dhcp-off"
# "bridge,1,eth1,,,dhcp-off"
# nat "nat,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# routed "route,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# hostonly "hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# nohost "nohost,0,eth1,,,dhcp-off"
# empty "empty,0,,,dhcp-off"
#
# Example: "bridge,0,eth0,,,dhcp-off nat,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off empty,0,,,dhcp-off"
#
# The above example would create 4 networks the first being a bridged network
# (xenbr0), the second being a NATed network (xennat0), the third being a host
# only network (xenhost0) and the fourth being an empty network (xenempty0)
#
# Used by network-multinet v2.x only
#
NETWORK_LIST="bridge,0,default,,,dhcp-off nat,0,veth2,00:16:3E:01:00:02,172.22.0.1/16,dhcp-off hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off empty,0,,,dhcp-off"
## Type: string(eth0,eth1,eth2,eth3)
## Default: "eth0"
## Config:
#
# Network interface to use as the external interface for NATed
# and Routed networks
#
# If set to 'default" it will use the same interface used for the
# default route
#
NAT_EXTERNAL_INTERFACE="default"
## Type: string(xenbr)
## Default: "xenbr"
## Config:
#
# Name of bridge to create (xenbr0, xenbr1, etc.)
#
# Used by network-multinet v1.x only
#
BRIDGE_NAME="xenbr"
## Type: list()
@ -15,6 +71,8 @@ BRIDGE_NAME="xenbr"
# Space delimited list of physical network
# devices to create traditional bridges on
#
# Used by network-multinet v1.x only
#
# Example: "eth0 eth1 eth2"
#
# The above example would create 3 traditional bridges
@ -29,15 +87,39 @@ BRIDGE_NETDEV_LIST="eth0"
# Space delimited list of virtual network devices,mac addresses
# and IP addresses to create local bridges on using the following format:
#
# <virtual network device>,<mac address>,<IP address/CIDR NetMask>,<nat|hostonly|route>
# <virtual network device>,<mac address>,<IP address/CIDR NetMask>,<nat|hostonly|route>,<dhcp-on|dhcp-off>
#
# Example: "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"
# Example: "veth2,00:16:3E:01:00:02,172.22.0.1/16,nat,dhcp-on veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly,dhcp-off"
#
# The above example would create 2 local bridged the first being a NATed network
# and the second being a host only network
#
LOCAL_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"
# Used by network-multinet v1.x only
#
LOCAL_BRIDGE_LIST="veth2,00:16:3E:01:00:02,172.22.0.1/16,nat,dhcp-off veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly,dhcp-off"
## Type: list()
## Default: ""
## Config:
#
# Space delimited list of bridge numbers/NICs to
# create "no-host" bridges on.
#
# No-Host bridges are bridges that are connected to a
# physical interface but not to an interface in Domain0.
# VMs connected to them are bridged to the outside world
# but cannot communicate with Domain0
#
# Example: "eth1,4"
#
# The above example would create a single NO-Host bridge named xenbr4
# that would have the eth1 interface connected to it as a bridge port
#
# Used by network-multinet v1.x only
#
NOHOST_BRIDGE_LIST=""
## Type: string(eth
## Type: list()
## Default: ""
## Config:
@ -49,14 +131,73 @@ LOCAL_BRIDGE_LIST="veth2,00:16:3E:01:00:02,172.22.0.1/16,nat veth3,00:16:3E:01:0
#
# The above example would create two empty bridges named xenbr4 and xenbr5
#
# Used by network-multinet v1.x only
#
EMPTY_BRIDGE_LIST="4"
## Type: string(eth0,eth1,eth2,eth3)
## Default: "eth0"
## Type: string(128-249)
## Default: "128-249"
## Config:
#
# Network interface to use as the external interface for NATed
# and Routed networks
# IP address range for the dhcp server. These should be the
# beginning and ending addresses from the last octet of the
# IP address
#
NAT_EXTERNAL_INTERFACE="eth0"
XEN_DHCP_RANGE="128-249"
## Type: string(137.65.1.1,137.65.1.2)
## Default: "gateway"
## Config:
#
# IP address(es) of DNS servers for the dhcp server to give out.
# If set to "gateway" then the IP address of the gateway will be
# set as the DNS server.
#
# Examples: "137.65.1.1,137.65.1.2"
# "gateway"
#
XEN_DHCP_DNS_SERVERS="gateway"
## Type: boolean
## Default: "false"
## Config:
#
# If set to true the xend-relocation script will enable/disable
# the vm migration feature of xend..
#
ENABLE_RELOCATION="false"
## Type: list()
## 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
#
# Example: "10.0.0.1 10.0.0.2" would allow relocation to/from thos IPs
# Example: "any" would allow reloaction to/from any host
#
RELOCATION_NODELIST="any"
## Type: boolean
## Default: "false"
## Config:
#
# If set to true the xend-relocation script will attempt to
# enable/disable vm migration on all relocation nodes listed
# in the RELOCATION_LIST variable.
#
# Note: Communication with the nodes is done via ssh so
# pre-distributed ssh keys is recommended.
#
MANAGE_ALL_RELOCATION_NODES="false"
## Type: integer
## Default: "8002"
## Config:
#
# The TCP port used by Xen for VM relocation
#
XEN_RELOCATION_PORT="8002"

View File

@ -23,24 +23,16 @@ Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
tools/xcutils/xc_kexec.c | 503 +++++++++++++++
19 files changed, 4988 insertions(+), 2 deletions(-)
Index: xen-unstable/tools/xcutils/Makefile
Index: xen-3.2-testing/tools/xcutils/Makefile
===================================================================
--- xen-unstable.orig/tools/xcutils/Makefile
+++ xen-unstable/tools/xcutils/Makefile
@@ -15,14 +15,14 @@ PROGRAMS_INSTALL_DIR = /usr/$(LIBDIR)/xe
INCLUDES += -I $(XEN_LIBXC) -I $(XEN_XENSTORE)
-CFLAGS += -Werror -fno-strict-aliasing
+CFLAGS += -g -O0 -Werror -fno-strict-aliasing
CFLAGS += $(INCLUDES)
# Make gcc generate dependencies.
--- xen-3.2-testing.orig/tools/xcutils/Makefile
+++ xen-3.2-testing/tools/xcutils/Makefile
@@ -22,7 +22,7 @@ CFLAGS += $(INCLUDES)
CFLAGS += -Wp,-MD,.$(@F).d
PROG_DEP = .*.d
-PROGRAMS = xc_restore xc_save readnotes
+PROGRAMS = xc_restore xc_save readnotes xc_kexec
+PROGRAMS = xc_restore xc_save readnotes xc_kexec
LDLIBS = -L$(XEN_LIBXC) -L$(XEN_XENSTORE) -lxenguest -lxenctrl -lxenstore
@ -63,10 +55,10 @@ Index: xen-unstable/tools/xcutils/Makefile
+ make -C helper clean
-include $(PROG_DEP)
Index: xen-unstable/tools/xcutils/helper/Makefile
Index: xen-3.2-testing/tools/xcutils/helper/Makefile
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/Makefile
+++ xen-3.2-testing/tools/xcutils/helper/Makefile
@@ -0,0 +1,39 @@
+
+XEN_ROOT = ../../..
@ -107,10 +99,10 @@ Index: xen-unstable/tools/xcutils/helper/Makefile
+# dependencies
+
+$(XEN_TARGET_ARCH)/entry.o: $(XEN_TARGET_ARCH)/entry.S $(XEN_TARGET_ARCH)/offsets.h
Index: xen-unstable/tools/xcutils/helper/console.c
Index: xen-3.2-testing/tools/xcutils/helper/console.c
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/console.c
+++ xen-3.2-testing/tools/xcutils/helper/console.c
@@ -0,0 +1,69 @@
+#include <inttypes.h>
+
@ -181,10 +173,10 @@ Index: xen-unstable/tools/xcutils/helper/console.c
+
+ return printed_len;
+}
Index: xen-unstable/tools/xcutils/helper/ctype.c
Index: xen-3.2-testing/tools/xcutils/helper/ctype.c
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/ctype.c
+++ xen-3.2-testing/tools/xcutils/helper/ctype.c
@@ -0,0 +1,35 @@
+/*
+ * linux/lib/ctype.c
@ -221,10 +213,10 @@ Index: xen-unstable/tools/xcutils/helper/ctype.c
+_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */
+
+EXPORT_SYMBOL(_ctype);
Index: xen-unstable/tools/xcutils/helper/ctype.h
Index: xen-3.2-testing/tools/xcutils/helper/ctype.h
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/ctype.h
+++ xen-3.2-testing/tools/xcutils/helper/ctype.h
@@ -0,0 +1,54 @@
+#ifndef _LINUX_CTYPE_H
+#define _LINUX_CTYPE_H
@ -280,10 +272,10 @@ Index: xen-unstable/tools/xcutils/helper/ctype.h
+#define toupper(c) __toupper(c)
+
+#endif
Index: xen-unstable/tools/xcutils/helper/helper.h
Index: xen-3.2-testing/tools/xcutils/helper/helper.h
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/helper.h
+++ xen-3.2-testing/tools/xcutils/helper/helper.h
@@ -0,0 +1,107 @@
+#include <stdarg.h>
+#include <stddef.h>
@ -392,10 +384,10 @@ Index: xen-unstable/tools/xcutils/helper/helper.h
+int sprintf(char * buf, const char *fmt, ...);
+int vsscanf(const char * buf, const char * fmt, va_list args);
+int sscanf(const char * buf, const char * fmt, ...);
Index: xen-unstable/tools/xcutils/helper/main.c
Index: xen-3.2-testing/tools/xcutils/helper/main.c
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/main.c
+++ xen-3.2-testing/tools/xcutils/helper/main.c
@@ -0,0 +1,651 @@
+#include <xenctrl.h>
+#include "hypercall.h"
@ -1048,10 +1040,10 @@ Index: xen-unstable/tools/xcutils/helper/main.c
+ printk("\r\n");
+ start_kernel();
+}
Index: xen-unstable/tools/xcutils/helper/make-offsets.c
Index: xen-3.2-testing/tools/xcutils/helper/make-offsets.c
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/make-offsets.c
+++ xen-3.2-testing/tools/xcutils/helper/make-offsets.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <xenctrl.h>
@ -1081,10 +1073,10 @@ Index: xen-unstable/tools/xcutils/helper/make-offsets.c
+ vcpu_off("cr3", ctrlreg[3]);
+ return 0;
+}
Index: xen-unstable/tools/xcutils/helper/printk.c
Index: xen-3.2-testing/tools/xcutils/helper/printk.c
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/printk.c
+++ xen-3.2-testing/tools/xcutils/helper/printk.c
@@ -0,0 +1,1051 @@
+/*
+ * linux/kernel/printk.c
@ -2137,10 +2129,10 @@ Index: xen-unstable/tools/xcutils/helper/printk.c
+ printk_ratelimit_burst);
+}
+EXPORT_SYMBOL(printk_ratelimit);
Index: xen-unstable/tools/xcutils/helper/string.c
Index: xen-3.2-testing/tools/xcutils/helper/string.c
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/string.c
+++ xen-3.2-testing/tools/xcutils/helper/string.c
@@ -0,0 +1,601 @@
+/*
+ * linux/lib/string.c
@ -2743,10 +2735,10 @@ Index: xen-unstable/tools/xcutils/helper/string.c
+}
+EXPORT_SYMBOL(memchr);
+#endif
Index: xen-unstable/tools/xcutils/helper/vsprintf.c
Index: xen-3.2-testing/tools/xcutils/helper/vsprintf.c
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/vsprintf.c
+++ xen-3.2-testing/tools/xcutils/helper/vsprintf.c
@@ -0,0 +1,842 @@
+/*
+ * linux/lib/vsprintf.c
@ -3590,10 +3582,10 @@ Index: xen-unstable/tools/xcutils/helper/vsprintf.c
+}
+
+EXPORT_SYMBOL(sscanf);
Index: xen-unstable/tools/xcutils/helper/x86_32/div64.h
Index: xen-3.2-testing/tools/xcutils/helper/x86_32/div64.h
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/x86_32/div64.h
+++ xen-3.2-testing/tools/xcutils/helper/x86_32/div64.h
@@ -0,0 +1,48 @@
+#ifndef __I386_DIV64
+#define __I386_DIV64
@ -3643,10 +3635,10 @@ Index: xen-unstable/tools/xcutils/helper/x86_32/div64.h
+
+}
+#endif
Index: xen-unstable/tools/xcutils/helper/x86_32/entry.S
Index: xen-3.2-testing/tools/xcutils/helper/x86_32/entry.S
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/x86_32/entry.S
+++ xen-3.2-testing/tools/xcutils/helper/x86_32/entry.S
@@ -0,0 +1,49 @@
+#include "offsets.h"
+
@ -3697,10 +3689,10 @@ Index: xen-unstable/tools/xcutils/helper/x86_32/entry.S
+ nop
+ .align 4096
+hypercall_end:
Index: xen-unstable/tools/xcutils/helper/x86_32/hypercall.h
Index: xen-3.2-testing/tools/xcutils/helper/x86_32/hypercall.h
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/x86_32/hypercall.h
+++ xen-3.2-testing/tools/xcutils/helper/x86_32/hypercall.h
@@ -0,0 +1,359 @@
+/******************************************************************************
+ * hypercall.h
@ -4061,10 +4053,10 @@ Index: xen-unstable/tools/xcutils/helper/x86_32/hypercall.h
+
+
+#endif /* __HYPERCALL_H__ */
Index: xen-unstable/tools/xcutils/helper/x86_64/div64.h
Index: xen-3.2-testing/tools/xcutils/helper/x86_64/div64.h
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/x86_64/div64.h
+++ xen-3.2-testing/tools/xcutils/helper/x86_64/div64.h
@@ -0,0 +1,57 @@
+#ifndef _ASM_GENERIC_DIV64_H
+#define _ASM_GENERIC_DIV64_H
@ -4123,10 +4115,10 @@ Index: xen-unstable/tools/xcutils/helper/x86_64/div64.h
+#endif /* BITS_PER_LONG */
+
+#endif /* _ASM_GENERIC_DIV64_H */
Index: xen-unstable/tools/xcutils/helper/x86_64/entry.S
Index: xen-3.2-testing/tools/xcutils/helper/x86_64/entry.S
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/x86_64/entry.S
+++ xen-3.2-testing/tools/xcutils/helper/x86_64/entry.S
@@ -0,0 +1,50 @@
+#include "offsets.h"
+
@ -4178,10 +4170,10 @@ Index: xen-unstable/tools/xcutils/helper/x86_64/entry.S
+ nop
+ .align 4096
+hypercall_end:
Index: xen-unstable/tools/xcutils/helper/x86_64/hypercall.h
Index: xen-3.2-testing/tools/xcutils/helper/x86_64/hypercall.h
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/helper/x86_64/hypercall.h
+++ xen-3.2-testing/tools/xcutils/helper/x86_64/hypercall.h
@@ -0,0 +1,354 @@
+/******************************************************************************
+ * hypercall.h
@ -4537,10 +4529,10 @@ Index: xen-unstable/tools/xcutils/helper/x86_64/hypercall.h
+}
+
+#endif /* __HYPERCALL_H__ */
Index: xen-unstable/tools/xcutils/kexec-syscall.h
Index: xen-3.2-testing/tools/xcutils/kexec-syscall.h
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/kexec-syscall.h
+++ xen-3.2-testing/tools/xcutils/kexec-syscall.h
@@ -0,0 +1,80 @@
+#ifndef KEXEC_SYSCALL_H
+#define KEXEC_SYSCALL_H
@ -4622,10 +4614,10 @@ Index: xen-unstable/tools/xcutils/kexec-syscall.h
+#define KEXEC_MAX_SEGMENTS 16
+
+#endif /* KEXEC_SYSCALL_H */
Index: xen-unstable/tools/xcutils/xc_kexec.c
Index: xen-3.2-testing/tools/xcutils/xc_kexec.c
===================================================================
--- /dev/null
+++ xen-unstable/tools/xcutils/xc_kexec.c
+++ xen-3.2-testing/tools/xcutils/xc_kexec.c
@@ -0,0 +1,503 @@
+#include <stdio.h>
+#include <stdlib.h>

View File

@ -1,22 +0,0 @@
Index: xen-3.1-testing/xen/arch/x86/usercopy.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/usercopy.c
+++ xen-3.1-testing/xen/arch/x86/usercopy.c
@@ -41,7 +41,7 @@ unsigned long __copy_to_user_ll(void __u
" "__FIXUP_WORD" 0b,3b\n"
" "__FIXUP_WORD" 1b,2b\n"
".previous"
- : "=&c"(__n), "=&D" (__d0), "=&S" (__d1), "=r"(__d2)
+ : "=&c"(__n), "=&D" (__d0), "=&S" (__d1), "=&r"(__d2)
: "3"(__n), "0"(__n), "1"(to), "2"(from)
: "memory");
return (unsigned)__n;
@@ -85,7 +85,7 @@ __copy_from_user_ll(void *to, const void
" "__FIXUP_WORD" 0b,3b\n"
" "__FIXUP_WORD" 1b,6b\n"
".previous"
- : "=&c"(__n), "=&D" (__d0), "=&S" (__d1), "=r"(__d2)
+ : "=&c"(__n), "=&D" (__d0), "=&S" (__d1), "=&r"(__d2)
: "3"(__n), "0"(__n), "1"(to), "2"(from)
: "memory");
return (unsigned)__n;

View File

@ -1,13 +0,0 @@
Index: xen-3.1-testing/xen/drivers/video/vga.c
===================================================================
--- xen-3.1-testing.orig/xen/drivers/video/vga.c
+++ xen-3.1-testing/xen/drivers/video/vga.c
@@ -587,6 +587,8 @@ void vga_init(void)
keep = -1;
else if ( strncmp(p, "text-80x", 8) == 0 )
vgacon_lines = simple_strtoul(p + 8, NULL, 10);
+ else if ( strncmp(p, "text", 4) == 0 && p[4] != '-' )
+ vgacon_lines = 0;
}
video = setup_vga();

View File

@ -1,113 +0,0 @@
Index: 2007-02-07/xen/drivers/video/vga.c
===================================================================
--- 2007-02-07.orig/xen/drivers/video/vga.c 2007-01-15 09:10:11.000000000 +0100
+++ 2007-02-07/xen/drivers/video/vga.c 2007-02-07 16:31:41.000000000 +0100
@@ -556,7 +556,6 @@ static int vga_load_font(const struct fo
*/
static int vgacon_enabled = 0;
-static int vgacon_keep = 0;
static int vgacon_lines = 50;
static const struct font_desc *font;
@@ -576,13 +575,16 @@ string_param("vga", opt_vga);
void vga_init(void)
{
char *p;
+ int keep = 0;
for ( p = opt_vga; p != NULL; p = strchr(p, ',') )
{
if ( *p == ',' )
p++;
if ( strncmp(p, "keep", 4) == 0 )
- vgacon_keep = 1;
+ keep = 1;
+ else if ( strncmp(p, "yield", 5) == 0 )
+ keep = -1;
else if ( strncmp(p, "text-80x", 8) == 0 )
vgacon_lines = simple_strtoul(p + 8, NULL, 10);
}
@@ -621,21 +623,48 @@ void vga_init(void)
/* Disable cursor. */
vga_wcrt(vgabase, VGA_CRTC_CURSOR_START, 0x20);
- vgacon_enabled = 1;
+ vgacon_enabled = 3 + keep;
}
void vga_endboot(void)
{
+ static const char *const str[] =
+ {
+ "relinquishing",
+ "auto-sensing",
+ "keeping"
+ };
+
if ( !vgacon_enabled )
return;
- if ( !vgacon_keep )
- vgacon_enabled = 0;
+ vgacon_enabled -= 2;
+ BUG_ON(vgacon_enabled < 0 || vgacon_enabled > 2);
- printk("Xen is %s VGA console.\n",
- vgacon_keep ? "keeping" : "relinquishing");
+ printk("Xen is %s VGA console.\n", str[vgacon_enabled]);
}
+static int gfx_vga(void)
+{
+ unsigned char idx, data;
+
+ idx = vga_r(vgabase, VGA_GFX_I);
+ data = vga_rgfx(vgabase, VGA_GFX_MISC);
+ vga_w(vgabase, VGA_GFX_I, idx);
+
+ if ( data & 0x01 )
+ return 1;
+
+ /* Unfortunately many cards don't reflect their mode in the GDC
+ * miscellaneous register, bit 0 (and even fewer reflect it in the
+ * ATC mode control register, bit 0). Therefore we further check
+ * horizontal display width against our original setting. */
+ idx = vga_r(vgabase, VGA_CRT_IC);
+ data = vga_rcrt(vgabase, VGA_CRTC_H_DISP);
+ vga_w(vgabase, VGA_CRT_IC, idx);
+
+ return data != COLUMNS - 1;
+}
static void put_newline(void)
{
@@ -653,14 +682,25 @@ static void put_newline(void)
void vga_putchar(int c)
{
- if ( !vgacon_enabled )
+ static int vga_in_gfx = -1;
+
+ switch ( vgacon_enabled )
+ {
+ case 0:
return;
+ case 1:
+ if ( vga_in_gfx < 0 )
+ vga_in_gfx = gfx_vga();
+ break;
+ }
if ( c == '\n' )
{
- put_newline();
+ if ( vga_in_gfx <= 0 )
+ put_newline();
+ vga_in_gfx = -1;
}
- else
+ else if ( vga_in_gfx <= 0 )
{
if ( xpos >= COLUMNS )
put_newline();

View File

@ -1,25 +0,0 @@
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmx.c 2007-08-09 09:59:50.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c 2007-08-09 10:00:00.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;

View File

@ -1,78 +0,0 @@
Index: 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/vmx/vmx.c 2007-08-09 09:58:47.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c 2007-08-09 09:59:06.000000000 +0200
@@ -88,8 +88,7 @@ static DEFINE_PER_CPU(struct vmx_msr_sta
static u32 msr_index[VMX_MSR_COUNT] =
{
- MSR_LSTAR, MSR_STAR, MSR_CSTAR,
- MSR_SYSCALL_MASK
+ MSR_LSTAR, MSR_STAR, MSR_SYSCALL_MASK
};
static void vmx_save_host_msrs(void)
@@ -147,7 +146,7 @@ static inline int long_mode_do_msr_read(
break;
case MSR_CSTAR:
- msr_content = guest_msr_state->msrs[VMX_INDEX_MSR_CSTAR];
+ msr_content = v->arch.hvm_vmx.cstar;
break;
case MSR_SYSCALL_MASK:
@@ -250,7 +249,8 @@ static inline int long_mode_do_msr_write
case MSR_CSTAR:
if ( !is_canonical_address(msr_content) )
goto uncanonical_address;
- WRITE_MSR(CSTAR);
+ v->arch.hvm_vmx.cstar = msr_content;
+ break;
case MSR_SYSCALL_MASK:
WRITE_MSR(SYSCALL_MASK);
@@ -730,12 +730,12 @@ static void vmx_save_cpu_state(struct vc
unsigned long guest_flags = guest_state->flags;
data->shadow_gs = v->arch.hvm_vmx.shadow_gs;
+ data->msr_cstar = v->arch.hvm_vmx.cstar;
/* save msrs */
data->msr_flags = guest_flags;
data->msr_lstar = guest_state->msrs[VMX_INDEX_MSR_LSTAR];
data->msr_star = guest_state->msrs[VMX_INDEX_MSR_STAR];
- data->msr_cstar = guest_state->msrs[VMX_INDEX_MSR_CSTAR];
data->msr_syscall_mask = guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK];
#endif
@@ -755,9 +755,9 @@ static void vmx_load_cpu_state(struct vc
guest_state->flags = data->msr_flags;
guest_state->msrs[VMX_INDEX_MSR_LSTAR] = data->msr_lstar;
guest_state->msrs[VMX_INDEX_MSR_STAR] = data->msr_star;
- guest_state->msrs[VMX_INDEX_MSR_CSTAR] = data->msr_cstar;
guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK] = data->msr_syscall_mask;
+ v->arch.hvm_vmx.cstar = data->msr_cstar;
v->arch.hvm_vmx.shadow_gs = data->shadow_gs;
#endif
Index: 2007-05-14/xen/include/asm-x86/hvm/vmx/vmcs.h
===================================================================
--- 2007-05-14.orig/xen/include/asm-x86/hvm/vmx/vmcs.h 2007-05-14 14:28:19.000000000 +0200
+++ 2007-05-14/xen/include/asm-x86/hvm/vmx/vmcs.h 2007-05-14 14:33:24.000000000 +0200
@@ -37,7 +37,6 @@ struct vmcs_struct {
enum {
VMX_INDEX_MSR_LSTAR = 0,
VMX_INDEX_MSR_STAR,
- VMX_INDEX_MSR_CSTAR,
VMX_INDEX_MSR_SYSCALL_MASK,
VMX_MSR_COUNT
@@ -77,6 +76,7 @@ struct arch_vmx_struct {
#ifdef __x86_64__
struct vmx_msr_state msr_state;
unsigned long shadow_gs;
+ unsigned long cstar;
#endif
unsigned long efer;
unsigned long vmxassist_enabled:1;

View File

@ -1,7 +1,7 @@
Index: xen-3.1-testing/tools/ioemu/sdl_keysym.h
Index: xen-3.2-testing/tools/ioemu/sdl_keysym.h
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/sdl_keysym.h
+++ xen-3.1-testing/tools/ioemu/sdl_keysym.h
--- xen-3.2-testing.orig/tools/ioemu/sdl_keysym.h
+++ xen-3.2-testing/tools/ioemu/sdl_keysym.h
@@ -274,5 +274,27 @@ static name2keysym_t name2keysym[]={
{"Pause", SDLK_PAUSE},
{"Escape", SDLK_ESCAPE},
@ -30,53 +30,13 @@ Index: xen-3.1-testing/tools/ioemu/sdl_keysym.h
{0,0},
};
+
Index: xen-3.1-testing/tools/ioemu/vnc_keysym.h
Index: xen-3.2-testing/tools/python/xen/xend/XendOptions.py
===================================================================
--- xen-3.1-testing.orig/tools/ioemu/vnc_keysym.h
+++ xen-3.1-testing/tools/ioemu/vnc_keysym.h
@@ -291,10 +291,34 @@ static name2keysym_t name2keysym[]={
{"BackApostrophe", 0xff21},
{"Muhenkan", 0xff22},
{"Katakana", 0xff25},
-{"Zenkaku_Hankaku", 0xff29},
+{"Hankaku", 0xff29},
+{"Zenkaku_Hankaku", 0xff2a},
{"Henkan_Mode_Real", 0xff23},
{"Henkan_Mode_Ultra", 0xff3e},
{"backslash_ja", 0xffa5},
--- xen-3.2-testing.orig/tools/python/xen/xend/XendOptions.py
+++ xen-3.2-testing/tools/python/xen/xend/XendOptions.py
@@ -315,6 +315,9 @@ class XendOptions:
return self.get_config_string('vnc-x509-verify', self.xend_vnc_x509_verify)
+ /* dead keys */
+{"dead_grave", 0xfe50},
+{"dead_acute", 0xfe51},
+{"dead_circumflex", 0xfe52},
+{"dead_tilde", 0xfe53},
+{"dead_macron", 0xfe54},
+{"dead_brev", 0xfe55},
+{"dead_abovedot", 0xfe56},
+{"dead_diaeresis", 0xfe57},
+{"dead_abovering", 0xfe58},
+{"dead_doubleacute", 0xfe59},
+{"dead_caron", 0xfe5a},
+{"dead_cedilla", 0xfe5b},
+{"dead_ogonek", 0xfe5c},
+{"dead_iota", 0xfe5d},
+{"dead_voiced_sound", 0xfe5e},
+{"dead_semivoiced_sound", 0xfe5f},
+{"dead_belowdot", 0xfe60},
+{"dead_hook", 0xfe61},
+{"dead_horn", 0xfe62},
+
+
{0,0},
};
+
Index: xen-3.1-testing/tools/python/xen/xend/XendOptions.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendOptions.py
+++ xen-3.1-testing/tools/python/xen/xend/XendOptions.py
@@ -278,6 +278,9 @@ class XendOptions:
return self.get_config_string('vncpasswd',
self.vncpasswd_default)
+ def get_keymap(self):
+ return self.get_config_value('keymap', None)
@ -84,44 +44,11 @@ Index: xen-3.1-testing/tools/python/xen/xend/XendOptions.py
class XendOptionsFile(XendOptions):
"""Default path to the config file."""
Index: xen-3.1-testing/tools/python/xen/xend/XendConfig.py
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-3.1-testing/tools/python/xen/xend/XendConfig.py
@@ -27,6 +27,7 @@ from xen.xend.XendError import VmError
from xen.xend.XendDevices import XendDevices
from xen.xend.PrettyPrint import prettyprintstring
from xen.xend.XendConstants import DOM_STATE_HALTED
+from xen.xend import XendOptions
log = logging.getLogger("xend.XendConfig")
log.setLevel(logging.WARN)
@@ -389,6 +390,8 @@ class XendConfig(dict):
self['name_label'] = 'Domain-' + self['uuid']
def _platform_sanity_check(self):
+ if 'keymap' not in self['platform'] and XendOptions.instance().get_keymap():
+ self['platform']['keymap'] = XendOptions.instance().get_keymap()
if self.is_hvm():
if 'device_model' not in self['platform']:
self['platform']['device_model'] = DEFAULT_DM
Index: xen-3.1-testing/tools/examples/xend-config.sxp
===================================================================
--- xen-3.1-testing.orig/tools/examples/xend-config.sxp
+++ xen-3.1-testing/tools/examples/xend-config.sxp
@@ -197,3 +197,7 @@
# The default password for VNC console on HVM domain.
# Empty string is no authentication.
(vncpasswd '')
+
+# The default keymap to use for the VM's virtual keyboard.
+#(keymap 'en-us')
+
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1333,6 +1333,9 @@ class XendDomainInfo:
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1524,6 +1524,9 @@ class XendDomainInfo:
if devclass in XendDevices.valid_devices():
log.info("createDevice: %s : %s" % (devclass, scrub_password(config)))
dev_uuid = config.get('uuid')

View File

@ -1,131 +0,0 @@
Index: 2007-05-14/xen/arch/x86/hvm/io.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/hvm/io.c 2007-08-09 09:57:10.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-08-09 09:57:10.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-08-09 09:59:39.000000000 +0200
+++ 2007-05-14/xen/arch/x86/hvm/vmx/vmx.c 2007-08-09 09:59:50.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\n", eip);
if ( vmx_assist(v, VMX_ASSIST_RESTORE) )
{
- eip = __vmread(GUEST_RIP);
HVM_DBG_LOG(DBG_LEVEL_1,
"Restoring to %%eip 0x%lx\n", 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-08-09 09:57:10.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__ */

Some files were not shown because too many files have changed in this diff Show More