OBS User unknown 2008-03-06 01:36:51 +00:00 committed by Git OBS Bridge
parent 3c15755877
commit 3a23990c80
60 changed files with 11208 additions and 891 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201096764 0
# Node ID 7f940c605893749225a5605fb8a1fa38972bdeb6
# Parent c364f80eb4b591f8ecd9dd803081923b94a8c688
x86_emulate: Fix CLTS emulation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/x86_emulate.c
+++ xen-3.2-testing/xen/arch/x86/x86_emulate.c
@@ -177,7 +177,7 @@ static uint8_t opcode_table[256] = {
static uint8_t twobyte_table[256] = {
/* 0x00 - 0x07 */
- 0, ImplicitOps|ModRM, 0, 0, 0, ImplicitOps, 0, 0,
+ 0, ImplicitOps|ModRM, 0, 0, 0, 0, ImplicitOps, 0,
/* 0x08 - 0x0F */
ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps|ModRM, 0, 0,
/* 0x10 - 0x17 */

View File

@ -0,0 +1,26 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201607262 0
# Node ID 128f7bc0a277375571b4817fc65bfcd14e00a7ec
# Parent 7aa2149a3b0e94eb01b39ae8cf4a41bc225be94e
x86: Fix HVM hypercall preemption causing guest crash.
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Index: xen-3.2-testing/xen/arch/x86/domain.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/domain.c
+++ xen-3.2-testing/xen/arch/x86/domain.c
@@ -1507,7 +1507,12 @@ unsigned long hypercall_create_continuat
{
regs = guest_cpu_user_regs();
regs->eax = op;
- regs->eip -= 2; /* re-execute 'syscall' / 'int 0x82' */
+ /*
+ * For PV guest, we update EIP to re-execute 'syscall' / 'int 0x82';
+ * HVM does not need this since 'vmcall' / 'vmmcall' is fault-like.
+ */
+ if ( !is_hvm_vcpu(current) )
+ regs->eip -= 2; /* re-execute 'syscall' / 'int 0x82' */
#ifdef __x86_64__
if ( !is_hvm_vcpu(current) ?

View File

@ -0,0 +1,34 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201607430 0
# Node ID 193afcdb85b211d72f940e086397490ce72f06e6
# Parent 128f7bc0a277375571b4817fc65bfcd14e00a7ec
x86: Fix shadow pinning logic (for PV live relo).
From: Tim Deegan <Tim.Deegan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm/shadow/multi.c
+++ xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
@@ -3518,8 +3518,18 @@ sh_set_toplevel_shadow(struct vcpu *v,
v->arch.shadow_table[slot] = new_entry;
/* Decrement the refcount of the old contents of this slot */
- if ( !pagetable_is_null(old_entry) )
- sh_put_ref(v, pagetable_get_mfn(old_entry), 0);
+ if ( !pagetable_is_null(old_entry) ) {
+ mfn_t old_smfn = pagetable_get_mfn(old_entry);
+ /* Need to repin the old toplevel shadow if it's been unpinned
+ * by shadow_prealloc(): in PV mode we're still running on this
+ * shadow and it's not safe to free it yet. */
+ if ( !mfn_to_shadow_page(old_smfn)->pinned && !sh_pin(v, old_smfn) )
+ {
+ SHADOW_ERROR("can't re-pin %#lx\n", mfn_x(old_smfn));
+ domain_crash(v->domain);
+ }
+ sh_put_ref(v, old_smfn, 0);
+ }
}

View File

@ -0,0 +1,87 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201619751 0
# Node ID 04e24b9dcc1649e86d3e94a81489dab9c6ec82bc
# Parent 98c2665056ea4fe63e02c943536db686fcedc459
xend: Obey localtime config option for HVM guests as well as PV guests.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: xen-3.2-testing/tools/python/xen/lowlevel/xc/xc.c
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/lowlevel/xc/xc.c
+++ xen-3.2-testing/tools/python/xen/lowlevel/xc/xc.c
@@ -1154,23 +1154,13 @@ static PyObject *pyxc_domain_iomem_permi
static PyObject *pyxc_domain_set_time_offset(XcObject *self, PyObject *args)
{
uint32_t dom;
- int32_t time_offset_seconds;
- time_t calendar_time;
- struct tm local_time;
- struct tm utc_time;
+ int32_t offset;
- if (!PyArg_ParseTuple(args, "i", &dom))
+ if (!PyArg_ParseTuple(args, "ii", &dom, &offset))
return NULL;
- calendar_time = time(NULL);
- localtime_r(&calendar_time, &local_time);
- gmtime_r(&calendar_time, &utc_time);
- /* set up to get calendar time based on utc_time, with local dst setting */
- utc_time.tm_isdst = local_time.tm_isdst;
- time_offset_seconds = (int32_t)difftime(calendar_time, mktime(&utc_time));
-
- if (xc_domain_set_time_offset(self->xc_handle, dom, time_offset_seconds) != 0)
- return NULL;
+ if (xc_domain_set_time_offset(self->xc_handle, dom, offset) != 0)
+ return pyxc_error_to_exception();
Py_INCREF(zero);
return zero;
@@ -1619,6 +1609,7 @@ static PyMethodDef pyxc_methods[] = {
METH_VARARGS, "\n"
"Set a domain's time offset to Dom0's localtime\n"
" dom [int]: Domain whose time offset is being set.\n"
+ " offset [int]: Time offset from UTC in seconds.\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_send_trigger",
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1708,10 +1708,14 @@ class XendDomainInfo:
self._configureBootloader()
try:
- self.image = image.create(self, self.info)
-
if self.info['platform'].get('localtime', 0):
- xc.domain_set_time_offset(self.domid)
+ t = time.time()
+ loc = time.localtime(t)
+ utc = time.gmtime(t)
+ timeoffset = int(time.mktime(loc) - time.mktime(utc))
+ self.info['platform']['rtc_timeoffset'] = timeoffset
+
+ self.image = image.create(self, self.info)
xc.domain_setcpuweight(self.domid, \
self.info['vcpus_params']['weight'])
Index: xen-3.2-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/image.py
+++ xen-3.2-testing/tools/python/xen/xend/image.py
@@ -342,6 +342,12 @@ class LinuxImageHandler(ImageHandler):
flags = 0
vhpt = 0
+ def configure(self, vmConfig):
+ ImageHandler.configure(self, vmConfig)
+ rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset')
+ if rtc_timeoffset is not None:
+ xc.domain_set_time_offset(self.vm.getDomid(), rtc_timeoffset)
+
def buildDomain(self):
store_evtchn = self.vm.getStorePort()
console_evtchn = self.vm.getConsolePort()

View File

@ -1,8 +1,8 @@
Index: xen-3.2-testing/tools/ioemu/xenstore.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/xenstore.c 2008-01-31 07:52:20.000000000 -0700
+++ xen-3.2-testing/tools/ioemu/xenstore.c 2008-01-31 07:56:00.000000000 -0700
@@ -478,7 +478,7 @@
--- xen-3.2-testing.orig/tools/ioemu/xenstore.c
+++ xen-3.2-testing/tools/ioemu/xenstore.c
@@ -418,7 +418,7 @@ void xenstore_record_dm_state(char *stat
void xenstore_process_event(void *opaque)
{
@ -11,7 +11,7 @@ Index: xen-3.2-testing/tools/ioemu/xenstore.c
unsigned int len, num, hd_index;
vec = xs_read_watch(xsh, &num);
@@ -505,8 +505,23 @@
@@ -440,8 +440,23 @@ void xenstore_process_event(void *opaque
goto out;
hd_index = vec[XS_WATCH_TOKEN][2] - 'a';
image = xs_read(xsh, XBT_NULL, vec[XS_WATCH_PATH], &len);
@ -21,12 +21,12 @@ Index: xen-3.2-testing/tools/ioemu/xenstore.c
+ goto out; /* gone */
+
+ /* Strip off blktap sub-type prefix */
+ bpath = strdup(vec[XS_WATCH_PATH]);
+ bpath = strdup(vec[XS_WATCH_PATH]);
+ if (bpath == NULL)
+ goto out;
+ if ((offset = strrchr(bpath, '/')) != NULL)
+ if ((offset = strrchr(bpath, '/')) != NULL)
+ *offset = '\0';
+ if (pasprintf(&buf, "%s/type", bpath) == -1)
+ if (pasprintf(&buf, "%s/type", bpath) == -1)
+ goto out;
+ drv = xs_read(xsh, XBT_NULL, buf, &len);
+ if (drv && !strcmp(drv, "tap") && ((offset = strchr(image, ':')) != NULL))
@ -37,7 +37,7 @@ Index: xen-3.2-testing/tools/ioemu/xenstore.c
do_eject(0, vec[XS_WATCH_TOKEN]);
bs_table[hd_index]->filename[0] = 0;
@@ -521,6 +536,9 @@
@@ -456,6 +471,9 @@ void xenstore_process_event(void *opaque
}
out:

View File

@ -0,0 +1,69 @@
Index: xen-3.2-testing/tools/ioemu/hw/xen_machine_fv.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/hw/xen_machine_fv.c
+++ xen-3.2-testing/tools/ioemu/hw/xen_machine_fv.c
@@ -205,6 +205,8 @@ static void xen_init_fv(uint64_t ram_siz
}
#endif
+ xenstore_parse_domain_config(domid);
+
xc_get_hvm_param(xc_handle, domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn);
fprintf(logfile, "shared page at pfn %lx\n", ioreq_pfn);
shared_page = xc_map_foreign_range(xc_handle, domid, XC_PAGE_SIZE,
Index: xen-3.2-testing/tools/ioemu/vl.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/vl.c
+++ xen-3.2-testing/tools/ioemu/vl.c
@@ -7593,7 +7593,7 @@ int main(int argc, char **argv)
#ifdef CONFIG_DM
bdrv_init();
xc_handle = xc_interface_open();
- xenstore_parse_domain_config(domid);
+ xenstore_daemon_open();
#endif /* CONFIG_DM */
#ifdef USE_KQEMU
Index: xen-3.2-testing/tools/ioemu/vl.h
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/vl.h
+++ xen-3.2-testing/tools/ioemu/vl.h
@@ -1454,6 +1454,7 @@ void readline_start(const char *prompt,
ReadLineFunc *readline_func, void *opaque);
/* xenstore.c */
+void xenstore_daemon_open(void);
void xenstore_parse_domain_config(int domid);
int xenstore_fd(void);
void xenstore_process_event(void *opaque);
Index: xen-3.2-testing/tools/ioemu/xenstore.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/xenstore.c
+++ xen-3.2-testing/tools/ioemu/xenstore.c
@@ -77,6 +77,13 @@ static void waitForDevice(char *fn)
return;
}
+void xenstore_daemon_open(void)
+{
+ xsh = xs_daemon_open();
+ if (xsh == NULL)
+ fprintf(logfile, "Could not contact xenstore for domain config\n");
+}
+
void xenstore_parse_domain_config(int domid)
{
char **e = NULL;
@@ -89,12 +96,6 @@ void xenstore_parse_domain_config(int do
for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++)
media_filename[i] = NULL;
- xsh = xs_daemon_open();
- if (xsh == NULL) {
- fprintf(logfile, "Could not contact xenstore for domain config\n");
- return;
- }
-
path = xs_get_domain_path(xsh, domid);
if (path == NULL) {
fprintf(logfile, "xs_get_domain_path() error\n");

View File

@ -0,0 +1,21 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201864887 0
# Node ID 3787e70b2ab219de50dff7417917fd9f9ccfcc35
# Parent 396ab902b02daf14deed0f3261c1c179b7378b4d
x86 shadow: Fix cross-page write emulation failure.
Signed-off-by: Disheng Su <disheng.su@intel.com>
Index: xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm/shadow/multi.c
+++ xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
@@ -4076,7 +4076,7 @@ static void *emulate_map_dest(struct vcp
sh_ctxt->mfn2 = emulate_gva_to_mfn(v, (vaddr + bytes - 1) & PAGE_MASK,
sh_ctxt);
if ( !mfn_valid(sh_ctxt->mfn2) )
- return ((mfn_x(sh_ctxt->mfn1) == BAD_GVA_TO_GFN) ?
+ return ((mfn_x(sh_ctxt->mfn2) == BAD_GVA_TO_GFN) ?
MAPPING_EXCEPTION : MAPPING_UNHANDLEABLE);
/* Cross-page writes mean probably not a pagetable */

24
16965-xend-leak.patch Normal file
View File

@ -0,0 +1,24 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201949604 0
# Node ID b1b93caa7d8e2414af06f06c3a9734675f715bad
# Parent 5d84464dc1fc013110c25dc0ff1f99585e699fa3
xend: Fix grow of the LEGACY_UNSUPPORTED_BY_XENAPI_CFG list each time
we instantiate a new XendConfig.
Signed-off-by: Pascal Bouchareine <pascal@gandi.net>
Index: xen-3.2-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-3.2-testing/tools/python/xen/xend/XendConfig.py
@@ -501,8 +501,8 @@ class XendConfig(dict):
int(sxp.child_value(sxp_cfg, "cpu_cap", 0))
# Only extract options we know about.
- extract_keys = LEGACY_UNSUPPORTED_BY_XENAPI_CFG
- extract_keys += XENAPI_CFG_TO_LEGACY_CFG.values()
+ extract_keys = LEGACY_UNSUPPORTED_BY_XENAPI_CFG + \
+ XENAPI_CFG_TO_LEGACY_CFG.values()
for key in extract_keys:
val = sxp.child_value(sxp_cfg, key)

View File

@ -0,0 +1,22 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1202207359 0
# Node ID 32e9c52fc6d9a6104afb2dbd84a89395b16f0e34
# Parent 99b8ffe250888d0c3fe86b726edf18f620072045
x86_emulate: Fix SAHF emulation.
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/x86_emulate.c
+++ xen-3.2-testing/xen/arch/x86/x86_emulate.c
@@ -2176,7 +2176,7 @@ x86_emulate(
}
case 0x9e: /* sahf */
- *(uint8_t *)_regs.eflags = (((uint8_t *)&_regs.eax)[1] & 0xd7) | 0x02;
+ *(uint8_t *)&_regs.eflags = (((uint8_t *)&_regs.eax)[1] & 0xd7) | 0x02;
break;
case 0x9f: /* lahf */

View File

@ -0,0 +1,61 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1202207975 0
# Node ID def2adbce510a31711f22cf15f5afe51f875e3ea
# Parent 32e9c52fc6d9a6104afb2dbd84a89395b16f0e34
xend: Restore values of /vm/uuid/xend/* to recreated domains.
When guest domains are restarted, previous values of /vm/uuid/xend/*
in xenstore are lost. (e.g. previous_restart_time,
last_shutdown_reason). This patch restores them to restarting domains.
And we should update /vm/uuid/xend/restart_count of restarting
domains, not previous domains.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -880,6 +880,9 @@ class XendDomainInfo:
def _gatherVm(self, *args):
return xstransact.Gather(self.vmpath, *args)
+ def _listRecursiveVm(self, *args):
+ return xstransact.ListRecursive(self.vmpath, *args)
+
def storeVm(self, *args):
return xstransact.Store(self.vmpath, *args)
@@ -1387,6 +1390,7 @@ class XendDomainInfo:
self._writeVm('xend/previous_restart_time', str(now))
+ prev_vm_xend = self._listRecursiveVm('xend')
new_dom_info = self.info
try:
if rename:
@@ -1405,8 +1409,13 @@ class XendDomainInfo:
try:
new_dom = XendDomain.instance().domain_create_from_dict(
new_dom_info)
+ for x in prev_vm_xend[0][1]:
+ new_dom._writeVm('xend/%s' % x[0], x[1])
new_dom.waitForDevices()
new_dom.unpause()
+ rst_cnt = new_dom._readVm('xend/restart_count')
+ rst_cnt = int(rst_cnt) + 1
+ new_dom._writeVm('xend/restart_count', str(rst_cnt))
new_dom._removeVm(RESTART_IN_PROGRESS)
except:
if new_dom:
@@ -1442,9 +1451,6 @@ class XendDomainInfo:
self.vmpath = XS_VMROOT + new_uuid
# Write out new vm node to xenstore
self._storeVmDetails()
- rst_cnt = self._readVm('xend/restart_count')
- rst_cnt = int(rst_cnt) + 1
- self._writeVm('xend/restart_count', str(rst_cnt))
self._preserve()
return new_dom_info

View File

@ -0,0 +1,36 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1202226659 0
# Node ID bf4a24c172d23ae9839ee564225d49ed95167de3
# Parent 92734271810aaa32d27fce777684649995fb1665
x86_emulate: fix side-effect macro call.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/x86_emulate.c
+++ xen-3.2-testing/xen/arch/x86/x86_emulate.c
@@ -546,7 +546,8 @@ do {
#define jmp_rel(rel) \
do { \
- _regs.eip += (int)(rel); \
+ int _rel = (int)(rel); \
+ _regs.eip += _rel; \
if ( !mode_64bit() ) \
_regs.eip = ((op_bytes == 2) \
? (uint16_t)_regs.eip : (uint32_t)_regs.eip); \
@@ -2543,9 +2544,11 @@ x86_emulate(
break;
}
- case 0xeb: /* jmp (short) */
- jmp_rel(insn_fetch_type(int8_t));
+ case 0xeb: /* jmp (short) */ {
+ int rel = insn_fetch_type(int8_t);
+ jmp_rel(rel);
break;
+ }
case 0xf1: /* int1 (icebp) */
src.val = EXC_DB;

62
16988-xm-reboot.patch Normal file
View File

@ -0,0 +1,62 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1202376466 0
# Node ID d04593aa1605fd337423b2c1296e275424e06656
# Parent 45b2e7d59e3a1895e903cbb7939e79c2f1f351d6
xm reboot: Fix wait option of xm reboot command
When I rebooted a domain by xm reboot command with wait option,
I saw the following message. But, rebooting the domain succeeded.
Domain vm1 destroyed for failed in rebooting
The cause why the message was shown is the domain is destroyed
temporarily by processing of xm reboot command. The domain
information is not gotten from Xend by server.xend.domains()
function till recreating the domain is completed.
This patch fixes processing of xm reboot command in Xm side.
It waits just a bit till recreating the domain is completed,
then it measures the success or failure of the reboot of the
domain.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
diff -r 45b2e7d59e3a -r d04593aa1605 tools/python/xen/xm/shutdown.py
--- a/tools/python/xen/xm/shutdown.py Thu Feb 07 09:21:19 2008 +0000
+++ b/tools/python/xen/xm/shutdown.py Thu Feb 07 09:27:46 2008 +0000
@@ -23,6 +23,8 @@ from opts import *
from opts import *
from main import server, serverType, SERVER_XEN_API, get_single_vm
from xen.xend.XendAPIConstants import *
+
+RECREATING_TIMEOUT = 30
gopts = Opts(use="""[options] [DOM]
@@ -53,6 +55,7 @@ def wait_reboot(opts, doms, rcs):
if serverType == SERVER_XEN_API:
opts.err("Cannot wait for reboot w/ XenAPI (yet)")
+ recreating = {}
while doms:
alive = server.xend.domains(0)
reboot = []
@@ -61,9 +64,17 @@ def wait_reboot(opts, doms, rcs):
rc = server.xend.domain.getRestartCount(d)
if rc == rcs[d]: continue
reboot.append(d)
+
+ # Probably the domain is being recreated now.
+ # We have to wait just a bit for recreating the domain.
+ elif not recreating.has_key(d):
+ recreating[d] = 0
else:
- opts.info("Domain %s destroyed for failed in rebooting" % d)
- doms.remove(d)
+ recreating[d] += 1
+ if recreating[d] > RECREATING_TIMEOUT:
+ opts.info("Domain %s destroyed for failing to reboot" % d)
+ doms.remove(d)
+
for d in reboot:
opts.info("Domain %s rebooted" % d)
doms.remove(d)

250
16989-xend-coredump.patch Normal file
View File

@ -0,0 +1,250 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1202376535 0
# Node ID 58e5e9ae0f8dcc4abb390d46d89e49c65e62607b
# Parent d04593aa1605fd337423b2c1296e275424e06656
Add 'coredump-destroy' and 'coredump-restart' actions for crashed domains.
Xen-API already specifies these actions for the 'on_crash' domain exit
event. This patch makes them available for use in traditional domU
config files and through the xm tool as well.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.2-testing/docs/man/xmdomain.cfg.pod.5
===================================================================
--- xen-3.2-testing.orig/docs/man/xmdomain.cfg.pod.5
+++ xen-3.2-testing/docs/man/xmdomain.cfg.pod.5
@@ -298,6 +298,22 @@ it holds, so that the new one may take t
=back
+=over 4
+
+Additionally, the "on_crash" event can also take:
+
+=item B<coredump-destroy>
+
+Dump the crashed domain's core and then destroy it.
+
+=back
+
+=item B<coredump-restart>
+
+Dump the crashed domain's core and then restart it.
+
+=back
+
=head1 EXAMPLES
The following are quick examples of ways that domains might be
Index: xen-3.2-testing/tools/examples/xmexample.hvm
===================================================================
--- xen-3.2-testing.orig/tools/examples/xmexample.hvm
+++ xen-3.2-testing/tools/examples/xmexample.hvm
@@ -87,6 +87,11 @@ disk = [ 'file:/var/images/min-el3-i386.
# "rename-restart", meaning that the old domain is not cleaned up, but is
# renamed and a new domain started in its place.
#
+# In the event a domain stops due to a crash, you have the additional options:
+#
+# "coredump-destroy", meaning dump the crashed domain's core and then destroy;
+# "coredump-restart', meaning dump the crashed domain's core and the restart.
+#
# The default is
#
# on_poweroff = 'destroy'
Index: xen-3.2-testing/tools/examples/xmexample1
===================================================================
--- xen-3.2-testing.orig/tools/examples/xmexample1
+++ xen-3.2-testing/tools/examples/xmexample1
@@ -155,6 +155,11 @@ extra = "4"
# "rename-restart", meaning that the old domain is not cleaned up, but is
# renamed and a new domain started in its place.
#
+# In the event a domain stops due to a crash, you have the additional options:
+#
+# "coredump-destroy", meaning dump the crashed domain's core and then destroy;
+# "coredump-restart', meaning dump the crashed domain's core and the restart.
+#
# The default is
#
# on_poweroff = 'destroy'
Index: xen-3.2-testing/tools/examples/xmexample2
===================================================================
--- xen-3.2-testing.orig/tools/examples/xmexample2
+++ xen-3.2-testing/tools/examples/xmexample2
@@ -191,6 +191,11 @@ extra = "4 VMID=%d usr=/dev/sda6" % vmid
# "rename-restart", meaning that the old domain is not cleaned up, but is
# renamed and a new domain started in its place.
#
+# In the event a domain stops due to a crash, you have the additional options:
+#
+# "coredump-destroy", meaning dump the crashed domain's core and then destroy;
+# "coredump-restart', meaning dump the crashed domain's core and the restart.
+#
# The default is
#
# on_poweroff = 'destroy'
Index: xen-3.2-testing/tools/examples/xmexample3
===================================================================
--- xen-3.2-testing.orig/tools/examples/xmexample3
+++ xen-3.2-testing/tools/examples/xmexample3
@@ -177,6 +177,11 @@ extra = "4 VMID=%d" % vmid
# "rename-restart", meaning that the old domain is not cleaned up, but is
# renamed and a new domain started in its place.
#
+# In the event a domain stops due to a crash, you have the additional options:
+#
+# "coredump-destroy", meaning dump the crashed domain's core and then destroy;
+# "coredump-restart', meaning dump the crashed domain's core and the restart.
+#
# The default is
#
# on_poweroff = 'destroy'
Index: xen-3.2-testing/tools/python/xen/xend/XendAPIConstants.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendAPIConstants.py
+++ xen-3.2-testing/tools/python/xen/xend/XendAPIConstants.py
@@ -51,6 +51,18 @@ XEN_API_ON_CRASH_BEHAVIOUR = [
'rename_restart'
]
+XEN_API_ON_CRASH_BEHAVIOUR_FILTER = {
+ 'destroy' : 'destroy',
+ 'coredump-destroy' : 'coredump_and_destroy',
+ 'coredump_and_destroy' : 'coredump_and_destroy',
+ 'restart' : 'restart',
+ 'coredump-restart' : 'coredump_and_restart',
+ 'coredump_and_restart' : 'coredump_and_restart',
+ 'preserve' : 'preserve',
+ 'rename-restart' : 'rename_restart',
+ 'rename_restart' : 'rename_restart',
+}
+
XEN_API_VBD_MODE = ['RO', 'RW']
XEN_API_VDI_TYPE = ['system', 'user', 'ephemeral']
XEN_API_VBD_TYPE = ['CD', 'Disk']
Index: xen-3.2-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-3.2-testing/tools/python/xen/xend/XendConfig.py
@@ -241,7 +241,8 @@ LEGACY_XENSTORE_VM_PARAMS = [
## Config Choices
##
-CONFIG_RESTART_MODES = ('restart', 'destroy', 'preserve', 'rename-restart')
+CONFIG_RESTART_MODES = ('restart', 'destroy', 'preserve', 'rename-restart',
+ 'coredump-destroy', 'coredump-restart')
CONFIG_OLD_DOM_STATES = ('running', 'blocked', 'paused', 'shutdown',
'crashed', 'dying')
Index: xen-3.2-testing/tools/python/xen/xend/XendConstants.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendConstants.py
+++ xen-3.2-testing/tools/python/xen/xend/XendConstants.py
@@ -52,7 +52,9 @@ restart_modes = [
"restart",
"destroy",
"preserve",
- "rename-restart"
+ "rename-restart",
+ "coredump-destroy",
+ "coredump-restart"
]
DOM_STATES = [
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1257,14 +1257,6 @@ class XendDomainInfo:
self.info['name_label'], self.domid)
self._writeVm(LAST_SHUTDOWN_REASON, 'crash')
- if xoptions.get_enable_dump():
- try:
- self.dumpCore()
- except XendError:
- # This error has been logged -- there's nothing more
- # we can do in this context.
- pass
-
restart_reason = 'crash'
self._stateSet(DOM_STATE_HALTED)
@@ -1332,14 +1324,30 @@ class XendDomainInfo:
def _clearRestart(self):
self._removeDom("xend/shutdown_start_time")
+ def _maybeDumpCore(self, reason):
+ if reason == 'crash':
+ if xoptions.get_enable_dump() or self.get_on_crash() \
+ in ['coredump_and_destroy', 'coredump_and_restart']:
+ try:
+ self.dumpCore()
+ except XendError:
+ # This error has been logged -- there's nothing more
+ # we can do in this context.
+ pass
def _maybeRestart(self, reason):
+ # Before taking configured action, dump core if configured to do so.
+ #
+ self._maybeDumpCore(reason)
+
# Dispatch to the correct method based upon the configured on_{reason}
# behaviour.
actions = {"destroy" : self.destroy,
"restart" : self._restart,
"preserve" : self._preserve,
- "rename-restart" : self._renameRestart}
+ "rename-restart" : self._renameRestart,
+ "coredump-destroy" : self.destroy,
+ "coredump-restart" : self._restart}
action_conf = {
'poweroff': 'actions_after_shutdown',
@@ -2551,9 +2559,10 @@ class XendDomainInfo:
def get_on_crash(self):
after_crash = self.info.get('actions_after_crash')
- if not after_crash or after_crash not in XEN_API_ON_CRASH_BEHAVIOUR:
+ if not after_crash or after_crash not in \
+ XEN_API_ON_CRASH_BEHAVIOUR + restart_modes:
return XEN_API_ON_CRASH_BEHAVIOUR[0]
- return after_crash
+ return XEN_API_ON_CRASH_BEHAVIOUR_FILTER[after_crash]
def get_dev_config_by_uuid(self, dev_class, dev_uuid):
""" Get's a device configuration either from XendConfig or
Index: xen-3.2-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xm/create.py
+++ xen-3.2-testing/tools/python/xen/xm/create.py
@@ -260,15 +260,17 @@ gopts.var('on_reboot', val='destroy|rest
renamed and a new domain started in its place.
""")
-gopts.var('on_crash', val='destroy|restart|preserve|rename-restart',
+gopts.var('on_crash', val='destroy|restart|preserve|rename-restart|coredump-destroy|ciredump-restart',
fn=set_value, default=None,
- use="""Behaviour when a domain exits with reason 'crash'.
- - destroy: the domain is cleaned up as normal;
- - restart: a new domain is started in place of the old one;
- - preserve: no clean-up is done until the domain is manually
- destroyed (using xm destroy, for example);
- - rename-restart: the old domain is not cleaned up, but is
- renamed and a new domain started in its place.
+ use="""Behaviour when a domain exits with reason 'crash'.
+ - destroy: the domain is cleaned up as normal;
+ - restart: a new domain is started in place of the old one;
+ - preserve: no clean-up is done until the domain is manually
+ destroyed (using xm destroy, for example);
+ - rename-restart: the old domain is not cleaned up, but is
+ renamed and a new domain started in its place.
+ - coredump-destroy: dump the domain's core, followed by destroy
+ - coredump-restart: dump the domain's core, followed by restart
""")
gopts.var('blkif', val='no|yes',

View File

@ -0,0 +1,35 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1202407244 0
# Node ID 445edf4089a3ccaca977665423e903b5300832cb
# Parent e6cf98edf0c573d86c59863c6b861f9a4d6350c3
x86_emulate: Fix MUL emulation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/x86_emulate.c
+++ xen-3.2-testing/xen/arch/x86/x86_emulate.c
@@ -1547,11 +1547,14 @@ x86_emulate(
switch ( src.bytes )
{
case 1:
+ dst.val = (uint8_t)dst.val;
dst.val *= src.val;
if ( (uint8_t)dst.val != (uint16_t)dst.val )
_regs.eflags |= EFLG_OF|EFLG_CF;
+ dst.bytes = 2;
break;
case 2:
+ dst.val = (uint16_t)dst.val;
dst.val *= src.val;
if ( (uint16_t)dst.val != (uint32_t)dst.val )
_regs.eflags |= EFLG_OF|EFLG_CF;
@@ -1559,6 +1562,7 @@ x86_emulate(
break;
#ifdef __x86_64__
case 4:
+ dst.val = (uint32_t)dst.val;
dst.val *= src.val;
if ( (uint32_t)dst.val != dst.val )
_regs.eflags |= EFLG_OF|EFLG_CF;

View File

@ -0,0 +1,20 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1202412636 0
# Node ID 1b750b9cf4319c076bb831d26dcdcffbd5cfb913
# Parent 8e4cd0658c4152a02576892e895e63772bd9df1c
x86_emulate: Fix IMUL r/m8 emulation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/x86_emulate.c
+++ xen-3.2-testing/xen/arch/x86/x86_emulate.c
@@ -1592,6 +1592,7 @@ x86_emulate(
(uint16_t)(int8_t)dst.val);
if ( (int8_t)dst.val != (uint16_t)dst.val )
_regs.eflags |= EFLG_OF|EFLG_CF;
+ dst.bytes = 2;
break;
case 2:
dst.val = ((uint32_t)(int16_t)src.val *

View File

@ -0,0 +1,197 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1202723858 0
# Node ID 96b418cf047e6d869740efd3660ab175303a3148
# Parent c68ce89542c7fbba9d00fd3a7d4e190476554e55
qemu: Queue mouse clicks.
qemu doesn't enqueue mouse events, just records the latest mouse
state. This can cause some lost mouse double clicks if the events are
not processed fast enought. This patch implements a simple queue for
left mouse click events.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
diff -r c68ce89542c7 -r 96b418cf047e tools/ioemu/hw/usb-hid.c
--- a/tools/ioemu/hw/usb-hid.c Mon Feb 11 09:47:19 2008 +0000
+++ b/tools/ioemu/hw/usb-hid.c Mon Feb 11 09:57:38 2008 +0000
@@ -224,15 +224,37 @@ static const uint8_t qemu_tablet_hid_rep
0xC0, /* End Collection */
};
+static int currentbutton = 0;
+typedef struct _mouseclick {
+ int button_state;
+ struct _mouseclick *next;
+} mouseclick;
+static mouseclick mousequeue[20];
+static mouseclick *head = mousequeue;
+static mouseclick *tail = mousequeue;
+
static void usb_mouse_event(void *opaque,
int dx1, int dy1, int dz1, int buttons_state)
{
USBMouseState *s = opaque;
+
+ if (s->status_changed == 1){
+ //A mouse event is lost
+ if (buttons_state != currentbutton && tail->next != head) {
+ //A left click event is lost: let's add it to the queue
+ //counter++;
+ tail->button_state = buttons_state;
+ tail = tail->next;
+ }
+ }
+ else {
+ s->buttons_state = buttons_state;
+ }
s->dx += dx1;
s->dy += dy1;
s->dz += dz1;
- s->buttons_state = buttons_state;
+ currentbutton = buttons_state;
s->status_changed = 1;
}
@@ -240,11 +262,24 @@ static void usb_tablet_event(void *opaqu
int x, int y, int dz, int buttons_state)
{
USBMouseState *s = opaque;
+
+ if (s->status_changed == 1){
+ //A mouse event is lost
+ if (buttons_state != currentbutton && tail->next != head) {
+ //A left click event is lost: let's add it to the queue
+ //counter++;
+ tail->button_state = buttons_state;
+ tail = tail->next;
+ }
+ }
+ else {
+ s->buttons_state = buttons_state;
+ }
s->x = x;
s->y = y;
s->dz += dz;
- s->buttons_state = buttons_state;
+ currentbutton = buttons_state;
s->status_changed = 1;
}
@@ -493,10 +528,17 @@ static int usb_mouse_handle_data(USBDevi
else if (s->kind == USB_TABLET)
ret = usb_tablet_poll(s, p->data, p->len);
- if (!s->status_changed)
+ if (!s->status_changed) {
ret = USB_RET_NAK;
- else
- s->status_changed = 0;
+ } else {
+ if (head != tail) {
+ s->buttons_state = head->button_state;
+ head = head->next;
+ }
+ else {
+ s->status_changed = 0;
+ }
+ }
} else {
goto fail;
@@ -567,6 +609,14 @@ USBDevice *usb_tablet_init(void)
USBDevice *usb_tablet_init(void)
{
USBMouseState *s;
+ int i;
+
+ for (i = 0; i < 19; i++) {
+ mousequeue[i].button_state = 0;
+ mousequeue[i].next = &(mousequeue[i + 1]);
+ }
+ mousequeue[i].button_state = 0;
+ mousequeue[i].next = mousequeue;
s = qemu_mallocz(sizeof(USBMouseState));
if (!s)
@@ -591,6 +641,14 @@ USBDevice *usb_mouse_init(void)
USBDevice *usb_mouse_init(void)
{
USBMouseState *s;
+ int i;
+
+ for (i = 0; i < 19; i++) {
+ mousequeue[i].button_state = 0;
+ mousequeue[i].next = &(mousequeue[i + 1]);
+ }
+ mousequeue[i].button_state = 0;
+ mousequeue[i].next = mousequeue;
s = qemu_mallocz(sizeof(USBMouseState));
if (!s)
diff -r c68ce89542c7 -r 96b418cf047e tools/ioemu/sdl.c
--- a/tools/ioemu/sdl.c Mon Feb 11 09:47:19 2008 +0000
+++ b/tools/ioemu/sdl.c Mon Feb 11 09:57:38 2008 +0000
@@ -259,11 +259,9 @@ static void sdl_grab_end(void)
sdl_update_caption();
}
-static void sdl_send_mouse_event(int dz)
-{
- int dx, dy, state, buttons;
- state = SDL_GetRelativeMouseState(&dx, &dy);
- buttons = 0;
+static void sdl_send_mouse_event(int dx, int dy, int dz, int state)
+{
+ int buttons = 0;
if (state & SDL_BUTTON(SDL_BUTTON_LEFT))
buttons |= MOUSE_EVENT_LBUTTON;
if (state & SDL_BUTTON(SDL_BUTTON_RIGHT))
@@ -425,11 +423,19 @@ static void sdl_refresh(DisplayState *ds
case SDL_MOUSEMOTION:
if (gui_grab || kbd_mouse_is_absolute() ||
absolute_enabled) {
- sdl_send_mouse_event(0);
+ int dx, dy, state;
+ state = SDL_GetRelativeMouseState(&dx, &dy);
+ sdl_send_mouse_event(dx, dy, 0, state);
+ }
+ break;
+ case SDL_MOUSEBUTTONUP:
+ if (gui_grab || kbd_mouse_is_absolute()) {
+ int dx, dy, state;
+ state = SDL_GetRelativeMouseState(&dx, &dy);
+ sdl_send_mouse_event(dx, dy, 0, state);
}
break;
case SDL_MOUSEBUTTONDOWN:
- case SDL_MOUSEBUTTONUP:
{
SDL_MouseButtonEvent *bev = &ev->button;
if (!gui_grab && !kbd_mouse_is_absolute()) {
@@ -439,16 +445,19 @@ static void sdl_refresh(DisplayState *ds
sdl_grab_start();
}
} else {
- int dz;
+ int dx, dy, dz, state;
dz = 0;
+ state = SDL_GetRelativeMouseState(&dx, &dy);
#ifdef SDL_BUTTON_WHEELUP
- if (bev->button == SDL_BUTTON_WHEELUP && ev->type == SDL_MOUSEBUTTONDOWN) {
+ if (bev->button == SDL_BUTTON_WHEELUP) {
dz = -1;
- } else if (bev->button == SDL_BUTTON_WHEELDOWN && ev->type == SDL_MOUSEBUTTONDOWN) {
+ } else if (bev->button == SDL_BUTTON_WHEELDOWN) {
dz = 1;
+ } else {
+ state = bev->button | state;
}
#endif
- sdl_send_mouse_event(dz);
+ sdl_send_mouse_event(dx, dy, dz, state);
}
}
break;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,235 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1202899393 0
# Node ID 0164d924cebacfef62673a49c2f4ad395df5444b
# Parent 27314cfbcefe8ee261da3ea827eb8336c32ad987
Tools: fix save/restore of 32-bit PV guests with 64-bit tools
by removing some obvious typos, handling CR3 folding and hvirt_start
based on guest word-size, and understanding 32-bit INVALID_MFN.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Index: xen-3.2-testing/tools/libxc/xc_domain_restore.c
===================================================================
--- xen-3.2-testing.orig/tools/libxc/xc_domain_restore.c
+++ xen-3.2-testing/tools/libxc/xc_domain_restore.c
@@ -251,7 +251,7 @@ static xen_pfn_t *load_p2m_frame_list(
/* Now that we know the guest's word-size, can safely allocate
* the p2m frame list */
- if ( (p2m_frame_list = malloc(P2M_FL_SIZE)) == NULL )
+ if ( (p2m_frame_list = malloc(P2M_TOOLS_FL_SIZE)) == NULL )
{
ERROR("Couldn't allocate p2m_frame_list array");
return NULL;
@@ -1040,7 +1040,7 @@ int xc_domain_restore(int xc_handle, int
SET_FIELD(&ctxt, gdt_frames[j], p2m[pfn]);
}
/* Uncanonicalise the page table base pointer. */
- pfn = xen_cr3_to_pfn(GET_FIELD(&ctxt, ctrlreg[3]));
+ pfn = UNFOLD_CR3(GET_FIELD(&ctxt, ctrlreg[3]));
if ( pfn >= p2m_size )
{
@@ -1057,12 +1057,12 @@ int xc_domain_restore(int xc_handle, int
(unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT);
goto out;
}
- SET_FIELD(&ctxt, ctrlreg[3], xen_pfn_to_cr3(p2m[pfn]));
+ SET_FIELD(&ctxt, ctrlreg[3], FOLD_CR3(p2m[pfn]));
/* Guest pagetable (x86/64) stored in otherwise-unused CR1. */
if ( (pt_levels == 4) && (ctxt.x64.ctrlreg[1] & 1) )
{
- pfn = xen_cr3_to_pfn(ctxt.x64.ctrlreg[1] & ~1);
+ pfn = UNFOLD_CR3(ctxt.x64.ctrlreg[1] & ~1);
if ( pfn >= p2m_size )
{
ERROR("User PT base is bad: pfn=%lu p2m_size=%lu",
@@ -1077,7 +1077,7 @@ int xc_domain_restore(int xc_handle, int
(unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT);
goto out;
}
- ctxt.x64.ctrlreg[1] = xen_pfn_to_cr3(p2m[pfn]);
+ ctxt.x64.ctrlreg[1] = FOLD_CR3(p2m[pfn]);
}
domctl.cmd = XEN_DOMCTL_setvcpucontext;
domctl.domain = (domid_t)dom;
@@ -1158,7 +1158,7 @@ int xc_domain_restore(int xc_handle, int
if ( guest_width > sizeof (xen_pfn_t) )
for ( i = p2m_size - 1; i >= 0; i-- )
((uint64_t *)p2m)[i] = p2m[i];
- else if ( guest_width > sizeof (xen_pfn_t) )
+ else if ( guest_width < sizeof (xen_pfn_t) )
for ( i = 0; i < p2m_size; i++ )
((uint32_t *)p2m)[i] = p2m[i];
Index: xen-3.2-testing/tools/libxc/xc_domain_save.c
===================================================================
--- xen-3.2-testing.orig/tools/libxc/xc_domain_save.c
+++ xen-3.2-testing/tools/libxc/xc_domain_save.c
@@ -61,10 +61,11 @@ unsigned int guest_width;
#define mfn_to_pfn(_mfn) (live_m2p[(_mfn)])
-#define pfn_to_mfn(_pfn) \
- ((xen_pfn_t) ((guest_width==8) \
- ? (((uint64_t *)live_p2m)[(_pfn)]) \
- : (((uint32_t *)live_p2m)[(_pfn)])))
+#define pfn_to_mfn(_pfn) \
+ ((xen_pfn_t) ((guest_width==8) \
+ ? (((uint64_t *)live_p2m)[(_pfn)]) \
+ : ((((uint32_t *)live_p2m)[(_pfn)]) == 0xffffffffU \
+ ? (-1UL) : (((uint32_t *)live_p2m)[(_pfn)]))))
/*
* Returns TRUE if the given machine frame number has a unique mapping
@@ -496,10 +497,9 @@ static int canonicalize_pagetable(unsign
xen_start = L3_PAGETABLE_ENTRIES_PAE;
/*
- ** in PAE only the L2 mapping the top 1GB contains Xen mappings.
- ** We can spot this by looking for the guest linear mapping which
- ** Xen always ensures is present in that L2. Guests must ensure
- ** that this check will fail for other L2s.
+ ** In PAE only the L2 mapping the top 1GB contains Xen mappings.
+ ** We can spot this by looking for the guest's mappingof the m2p.
+ ** Guests must ensure that this check will fail for other L2s.
*/
if ( (pt_levels == 3) && (type == XEN_DOMCTL_PFINFO_L2TAB) )
{
@@ -555,7 +555,13 @@ static int canonicalize_pagetable(unsign
/* This will happen if the type info is stale which
is quite feasible under live migration */
pfn = 0; /* zap it - we'll retransmit this page later */
- race = 1; /* inform the caller of race; fatal if !live */
+ /* XXX: We can't spot Xen mappings in compat-mode L2es
+ * from 64-bit tools, but the only thing in them is the
+ * compat m2p, so we quietly zap them. This doesn't
+ * count as a race, so don't report it. */
+ if ( !(type == XEN_DOMCTL_PFINFO_L2TAB
+ && sizeof (unsigned long) > guest_width) )
+ race = 1; /* inform the caller; fatal if !live */
}
else
pfn = mfn_to_pfn(mfn);
@@ -690,7 +696,7 @@ static xen_pfn_t *map_and_save_p2m_table
else
p2m_frame_list_list[i] = 0;
else if ( guest_width < sizeof(unsigned long) )
- for ( i = PAGE_SIZE/sizeof(unsigned long) - 1; i >= 0; i++ )
+ for ( i = PAGE_SIZE/sizeof(unsigned long) - 1; i >= 0; i-- )
p2m_frame_list_list[i] = ((uint32_t *)p2m_frame_list_list)[i];
live_p2m_frame_list =
@@ -704,19 +710,20 @@ static xen_pfn_t *map_and_save_p2m_table
}
/* Get a local copy of the live_P2M_frame_list */
- if ( !(p2m_frame_list = malloc(P2M_FL_SIZE)) )
+ if ( !(p2m_frame_list = malloc(P2M_TOOLS_FL_SIZE)) )
{
ERROR("Couldn't allocate p2m_frame_list array");
goto out;
}
- memcpy(p2m_frame_list, live_p2m_frame_list, P2M_FL_SIZE);
+ memset(p2m_frame_list, 0, P2M_TOOLS_FL_SIZE);
+ memcpy(p2m_frame_list, live_p2m_frame_list, P2M_GUEST_FL_SIZE);
/* Canonicalize guest's unsigned long vs ours */
if ( guest_width > sizeof(unsigned long) )
for ( i = 0; i < P2M_FL_ENTRIES; i++ )
p2m_frame_list[i] = ((uint64_t *)p2m_frame_list)[i];
else if ( guest_width < sizeof(unsigned long) )
- for ( i = P2M_FL_ENTRIES - 1; i >= 0; i++ )
+ for ( i = P2M_FL_ENTRIES - 1; i >= 0; i-- )
p2m_frame_list[i] = ((uint32_t *)p2m_frame_list)[i];
@@ -1559,31 +1566,26 @@ int xc_domain_save(int xc_handle, int io
}
/* Canonicalise the page table base pointer. */
- if ( !MFN_IS_IN_PSEUDOPHYS_MAP(xen_cr3_to_pfn(
- GET_FIELD(&ctxt, ctrlreg[3]))) )
+ if ( !MFN_IS_IN_PSEUDOPHYS_MAP(UNFOLD_CR3(
+ GET_FIELD(&ctxt, ctrlreg[3]))) )
{
ERROR("PT base is not in range of pseudophys map");
goto out;
}
SET_FIELD(&ctxt, ctrlreg[3],
- xen_pfn_to_cr3(
- mfn_to_pfn(
- xen_cr3_to_pfn(
- GET_FIELD(&ctxt, ctrlreg[3])))));
+ FOLD_CR3(mfn_to_pfn(UNFOLD_CR3(GET_FIELD(&ctxt, ctrlreg[3])))));
/* Guest pagetable (x86/64) stored in otherwise-unused CR1. */
if ( (pt_levels == 4) && ctxt.x64.ctrlreg[1] )
{
- if ( !MFN_IS_IN_PSEUDOPHYS_MAP(
- xen_cr3_to_pfn(ctxt.x64.ctrlreg[1])) )
+ if ( !MFN_IS_IN_PSEUDOPHYS_MAP(UNFOLD_CR3(ctxt.x64.ctrlreg[1])) )
{
ERROR("PT base is not in range of pseudophys map");
goto out;
}
/* Least-significant bit means 'valid PFN'. */
ctxt.x64.ctrlreg[1] = 1 |
- xen_pfn_to_cr3(
- mfn_to_pfn(xen_cr3_to_pfn(ctxt.x64.ctrlreg[1])));
+ FOLD_CR3(mfn_to_pfn(UNFOLD_CR3(ctxt.x64.ctrlreg[1])));
}
if ( write_exact(io_fd, &ctxt, ((guest_width==8)
Index: xen-3.2-testing/tools/libxc/xg_private.h
===================================================================
--- xen-3.2-testing.orig/tools/libxc/xg_private.h
+++ xen-3.2-testing/tools/libxc/xg_private.h
@@ -155,7 +155,9 @@ typedef l4_pgentry_64_t l4_pgentry_t;
#define P2M_FL_ENTRIES (((p2m_size)+FPP-1)/FPP)
/* Size in bytes of the pfn_to_mfn_frame_list */
-#define P2M_FL_SIZE ((P2M_FL_ENTRIES)*(guest_width))
+#define P2M_GUEST_FL_SIZE ((P2M_FL_ENTRIES) * (guest_width))
+#define P2M_TOOLS_FL_SIZE ((P2M_FL_ENTRIES) * \
+ MAX((sizeof (xen_pfn_t)), guest_width))
/* Masks for PTE<->PFN conversions */
#define MADDR_BITS_X86 ((guest_width == 8) ? 52 : 44)
Index: xen-3.2-testing/tools/libxc/xg_save_restore.h
===================================================================
--- xen-3.2-testing.orig/tools/libxc/xg_save_restore.h
+++ xen-3.2-testing/tools/libxc/xg_save_restore.h
@@ -68,6 +68,13 @@ static inline int get_platform_info(int
*guest_width = domctl.u.address_size.size / 8;
+ /* 64-bit tools will see the 64-bit hvirt_start, but 32-bit guests
+ * will be using the compat one. */
+ if ( *guest_width < sizeof (unsigned long) )
+ /* XXX need to fix up a way of extracting this value from Xen if
+ * XXX it becomes variable for domU */
+ *hvirt_start = 0xf5800000;
+
if (strstr(xen_caps, "xen-3.0-x86_64"))
/* Depends on whether it's a compat 32-on-64 guest */
*pt_levels = ( (*guest_width == 8) ? 4 : 3 );
@@ -136,6 +143,16 @@ typedef union
(_p)->x32._f = (_v); \
} while (0)
+#define UNFOLD_CR3(_c) \
+ ((uint64_t)((guest_width == 8) \
+ ? ((_c) >> 12) \
+ : (((uint32_t)(_c) >> 12) | ((uint32_t)(_c) << 20))))
+
+#define FOLD_CR3(_c) \
+ ((uint64_t)((guest_width == 8) \
+ ? ((uint64_t)(_c)) << 12 \
+ : (((uint32_t)(_c) << 12) | ((uint32_t)(_c) >> 20))))
+
#define MEMCPY_FIELD(_d, _s, _f) do { \
if (guest_width == 8) \
memcpy(&(_d)->x64._f, &(_s)->x64._f,sizeof((_d)->x64._f)); \

27
17113-xend-restore.patch Normal file
View File

@ -0,0 +1,27 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1204036539 0
# Node ID 9dd235d6174d1944caf53798a07ecf509678eead
# Parent b6323bf8dae0116a206a303b66b8fa539ba7c52d
Fix restore of saved image containing rtc_timeoffset
Saved images contain rtc_timeoffset as a string value, resulting in a
TypeError exception when calling xc.domain_set_time_offset() on
restore. Cast rtc_timeoffset to int before calling
xc.domain_set_time_offset().
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.2-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/image.py
+++ xen-3.2-testing/tools/python/xen/xend/image.py
@@ -346,7 +346,7 @@ class LinuxImageHandler(ImageHandler):
ImageHandler.configure(self, vmConfig)
rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset')
if rtc_timeoffset is not None:
- xc.domain_set_time_offset(self.vm.getDomid(), rtc_timeoffset)
+ xc.domain_set_time_offset(self.vm.getDomid(), int(rtc_timeoffset))
def buildDomain(self):
store_evtchn = self.vm.getStorePort()

View File

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

View File

@ -5,7 +5,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2078,7 +2078,7 @@ class XendDomainInfo:
@@ -2102,7 +2102,7 @@ class XendDomainInfo:
(fn, BOOTLOADER_LOOPBACK_DEVICE))
vbd = {
@ -18,7 +18,7 @@ Index: xen-3.2-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
@@ -88,9 +88,9 @@ void xenstore_parse_domain_config(int do
{
char **e = NULL;
char *buf = NULL, *path;
@ -30,7 +30,7 @@ Index: xen-3.2-testing/tools/ioemu/xenstore.c
unsigned int len, num, hd_index;
for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++)
@@ -116,6 +116,14 @@ void xenstore_parse_domain_config(int do
@@ -117,6 +117,14 @@ void xenstore_parse_domain_config(int do
bpath = xs_read(xsh, XBT_NULL, buf, &len);
if (bpath == NULL)
continue;
@ -45,7 +45,7 @@ Index: xen-3.2-testing/tools/ioemu/xenstore.c
/* read the name of the device */
if (pasprintf(&buf, "%s/dev", bpath) == -1)
continue;
@@ -250,6 +258,7 @@ void xenstore_parse_domain_config(int do
@@ -251,6 +259,7 @@ void xenstore_parse_domain_config(int do
free(type);
free(params);
free(dev);

View File

@ -10,58 +10,36 @@
# open-iscsi database below /var/lib/open-iscsi/node.db
#
# (c) Kurt Garloff <kurt@garloff.de>, 2006-09-04, GNU GPL
# Contributors: Jim Fehlig <jfehlig@novell.com>
# Stefan de Konink <skinkie@xs4all.nl>
dir=$(dirname "$0")
. "$dir/block-common.sh"
#command=$1
#echo "DBG:xen/scripts/block-iscsi $1 $2 XENBUS_PATH=$XENBUS_PATH $par $node"
# echo "DBG:xen/scripts/block-iscsi $1 $2 XENBUS_PATH=$XENBUS_PATH $par $node"
#write_dev()
#{
# echo "$1"
#}
sess_lun_to_bdev()
{
unset dev
cnt=`ls -d $1/device/target*/*:0:*:$2/block* | wc -l`
nm=`ls -d $1/device/target*/*:0:*:$2/block*`
for n in $nm; do
d=`readlink $n`
d=${d##*/}
if test -z "$dev"; then dev=$d; else dev="$dev $d"; fi
done
}
# Arguments: IQN name, LUN
find_sdev()
{
unset dev
lun=${2:-0}
for session in /sys/class/iscsi_session/session*; do
if ! test -e $session; then return; fi
if test $1 = `cat $session/targetname`; then
sess_lun_to_bdev $session $lun
#echo "fs: $1[$lun] ($cnt) -> $dev" 1>&2
if [ "$1" = "`cat $session/targetname`" ]; then
dev=`readlink $session/device/target*/*:0:*/block*`
dev=${dev##*/}
return
fi
done
}
}
find_sdev_rev()
{
unset tgt
for session in /sys/class/iscsi_session/session*; do
if ! test -e $session; then return; fi
sess_lun_to_bdev $session "*"
for d in $dev; do
if test "$d" = "$1"; then
tgt=`cat $session/targetname`
#echo "fsr: $2 -> $tgt ($cnt)" 1>&2
return
fi
done
dev=`readlink $session/device/target*/*:0:*/block*`
dev=${dev##*/}
if [ "$dev" = "$1" ]; then
tgt=`cat $session/targetname`
return
fi
done
}
@ -71,42 +49,32 @@ case "$command" in
/etc/init.d/open-iscsi status >/dev/null 2>&1 ||
{ /etc/init.d/open-iscsi start >/dev/null 2>&1; sleep 1; }
# list of targets on node
/sbin/iscsiadm -m discovery | sed "s/ .*//g" | while read line; do /sbin/iscsiadm -m discovery -t sendtargets -p $line; done >/dev/null
par=`xenstore-read $XENBUS_PATH/params` || true
TGTID=$par; TGTID=${TGTID//@/:}
LUN=${TGTID##*,}; TGTID=${TGTID%,*}
if test $LUN = $TGTID; then unset LUN; fi
#echo "add $TGTID lun $LUN" 1>&2
while read rec port uuid; do
rec=${rec%]}; rec=${rec#[}
if test $uuid = $TGTID; then
find_sdev $TGTID $LUN
if test -z "$dev"; then
#echo iscsiadm -m node -T $uuid -p $port -l 1>&2
iscsiadm -m node -r $rec -l || exit 2
usleep 100000
find_sdev $TGTID $LUN
fi
xenstore-write $XENBUS_PATH/node /dev/$dev
TGTID=`echo $par | sed "s/\/\///g"`
while read rec uuid; do
if [ "$uuid" = "$TGTID" ]; then
find_sdev $TGTID
if [ -z "$dev" ]; then
/sbin/iscsiadm -m node -T $uuid -p $rec --login || exit 2
sleep 4
find_sdev $TGTID
fi
xenstore-write $XENBUS_PATH/node /dev/$dev
write_dev /dev/$dev
exit 0
exit 0
fi
done < <(iscsiadm -m node)
done < <(/sbin/iscsiadm -m node)
exit 1
;;
remove)
node=`xenstore-read $XENBUS_PATH/node` || true
dev=$node; dev=${dev#/dev/}
find_sdev_rev $dev
#echo "remove $dev:$tgt" 1>&2
if test -x /sbin/blockdev -a -n "$node"; then blockdev --flushbufs $node; fi
if [ -x /sbin/blockdev -a -n "$node" ]; then blockdev --flushbufs "$node"; fi
test -z "$tgt" && exit 2
while read rec port uuid; do
if test $uuid = $tgt; then
rec=${rec%]}; rec=${rec#[}
iscsiadm -m node -r $rec -u
exit 0
fi
done < <(iscsiadm -m node)
/sbin/iscsiadm -m node -T $tgt --logout
exit 1
;;
esac

View File

@ -1,7 +1,7 @@
Index: xen-3.2-testing/tools/python/xen/xend/server/HalDaemon.py
===================================================================
--- /dev/null
+++ xen-3.2-testing/tools/python/xen/xend/server/HalDaemon.py
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.2-testing/tools/python/xen/xend/server/HalDaemon.py 2008-02-29 08:11:00.000000000 -0700
@@ -0,0 +1,238 @@
+#!/usr/bin/env python
+# -*- mode: python; -*-
@ -243,8 +243,8 @@ Index: xen-3.2-testing/tools/python/xen/xend/server/HalDaemon.py
+
Index: xen-3.2-testing/tools/python/xen/xend/server/Hald.py
===================================================================
--- /dev/null
+++ xen-3.2-testing/tools/python/xen/xend/server/Hald.py
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.2-testing/tools/python/xen/xend/server/Hald.py 2008-02-29 08:11:00.000000000 -0700
@@ -0,0 +1,125 @@
+#============================================================================
+# This library is free software; you can redistribute it and/or
@ -373,9 +373,9 @@ Index: xen-3.2-testing/tools/python/xen/xend/server/Hald.py
+ watcher.shutdown()
Index: xen-3.2-testing/tools/python/xen/xend/server/SrvServer.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/server/SrvServer.py
+++ xen-3.2-testing/tools/python/xen/xend/server/SrvServer.py
@@ -56,6 +56,7 @@ from xen.web.SrvDir import SrvDir
--- xen-3.2-testing.orig/tools/python/xen/xend/server/SrvServer.py 2008-01-16 13:19:05.000000000 -0700
+++ xen-3.2-testing/tools/python/xen/xend/server/SrvServer.py 2008-02-29 08:11:00.000000000 -0700
@@ -56,6 +56,7 @@
from SrvRoot import SrvRoot
from XMLRPCServer import XMLRPCServer
@ -383,7 +383,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/server/SrvServer.py
xoptions = XendOptions.instance()
@@ -245,6 +246,8 @@ def _loadConfig(servers, root, reload):
@@ -245,6 +246,8 @@
if xoptions.get_xend_unix_xmlrpc_server():
servers.add(XMLRPCServer(XendAPI.AUTH_PAM, False))
@ -394,9 +394,9 @@ Index: xen-3.2-testing/tools/python/xen/xend/server/SrvServer.py
root = SrvDir()
Index: xen-3.2-testing/tools/ioemu/xenstore.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/xenstore.c
+++ xen-3.2-testing/tools/ioemu/xenstore.c
@@ -215,6 +215,13 @@ void xenstore_parse_domain_config(int do
--- xen-3.2-testing.orig/tools/ioemu/xenstore.c 2008-02-29 08:10:59.000000000 -0700
+++ xen-3.2-testing/tools/ioemu/xenstore.c 2008-02-29 08:11:38.000000000 -0700
@@ -216,6 +216,13 @@
bdrv_set_type_hint(bs_table[hd_index], BDRV_TYPE_CDROM);
if (pasprintf(&buf, "%s/params", bpath) != -1)
xs_watch(xsh, buf, dev);
@ -410,7 +410,7 @@ Index: xen-3.2-testing/tools/ioemu/xenstore.c
}
/* open device now if media present */
if (params[0]) {
@@ -416,6 +423,50 @@ void xenstore_record_dm_state(char *stat
@@ -417,6 +424,50 @@
free(path);
}
@ -460,8 +460,8 @@ Index: xen-3.2-testing/tools/ioemu/xenstore.c
+
void xenstore_process_event(void *opaque)
{
char **vec, *image = NULL;
@@ -435,6 +486,11 @@ void xenstore_process_event(void *opaque
char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = NULL;
@@ -436,6 +487,11 @@
goto out;
}
@ -473,3 +473,31 @@ Index: xen-3.2-testing/tools/ioemu/xenstore.c
if (strncmp(vec[XS_WATCH_TOKEN], "hd", 2) ||
strlen(vec[XS_WATCH_TOKEN]) != 3)
goto out;
Index: xen-3.2-testing/tools/ioemu/hw/ide.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/hw/ide.c 2008-02-29 08:11:33.000000000 -0700
+++ xen-3.2-testing/tools/ioemu/hw/ide.c 2008-02-29 08:16:50.000000000 -0700
@@ -350,6 +350,7 @@
uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4];
QEMUTimer *sector_write_timer; /* only used for win2k instal hack */
uint32_t irq_count; /* counts IRQs when using win2k install hack */
+ uint8_t send_ua; /* send SENSE_UNIT_ATTENTION on next ready */
} IDEState;
#define BM_STATUS_DMAING 0x01
@@ -1403,8 +1404,15 @@
switch(s->io_buffer[0]) {
case GPCMD_TEST_UNIT_READY:
if (bdrv_is_inserted(s->bs)) {
+ if (s->send_ua) {
+ ide_atapi_cmd_error(s, SENSE_UNIT_ATTENTION,
+ ASC_MEDIUM_NOT_PRESENT);
+ s->send_ua = 0;
+ break;
+ }
ide_atapi_cmd_ok(s);
} else {
+ s->send_ua = 1;
ide_atapi_cmd_error(s, SENSE_NOT_READY,
ASC_MEDIUM_NOT_PRESENT);
xenstore_check_new_media_present(1000);

View File

@ -1,20 +0,0 @@
Disable the emulated devices when we are loading PV drivers.
Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com>
Index: xen-unstable/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
===================================================================
--- xen-unstable.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
+++ xen-unstable/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
@@ -247,6 +247,11 @@ static int __devinit platform_pci_init(s
platform_mmio = mmio_addr;
platform_mmiolen = mmio_len;
+ /*
+ * Disconnect the emulated devices.
+ */
+ outl(1, (ioaddr + 4));
+
ret = get_hypercall_stubs();
if (ret < 0)
goto out;

1021
ept-novell-x64.patch Normal file

File diff suppressed because it is too large Load Diff

7
etc_pam.d_xen-api Normal file
View File

@ -0,0 +1,7 @@
#%PAM-1.0
auth required pam_listfile.so onerr=fail item=user \
sense=allow file=/etc/xen/xenapiusers
auth include common-auth
account include common-account
password include common-password
session include common-session

View File

@ -0,0 +1,18 @@
Index: xen-3.2-testing/tools/ioemu/hw/ide.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/hw/ide.c
+++ xen-3.2-testing/tools/ioemu/hw/ide.c
@@ -1023,12 +1023,12 @@ static void ide_write_dma_cb(void *opaqu
/* end of transfer ? */
if (s->nsector == 0) {
+ eot:
/* Ensure the data hit disk before telling the guest OS so. */
if (!s->write_cache)
bdrv_flush(s->bs);
s->status = READY_STAT | SEEK_STAT;
ide_set_irq(s);
- eot:
bm->status &= ~BM_STATUS_DMAING;
bm->status |= BM_STATUS_INT;
bm->dma_cb = NULL;

View File

@ -321,47 +321,31 @@ stop()
rc_status -v
continue
fi
# HVM domains currently can't migrate or save so don't even try.
hvm=0
vmpath=`xenstore-read /local/domain/$id/vm 2> /dev/null`
if [ $? = 0 ]; then
[ `xenstore-read "$vmpath/image/ostype" 2> /dev/null` = hvm ] && hvm=1
fi
if [ -n "$XENDOMAINS_MIGRATE" ]; then
echo -n " $name: "
echo -n "migrating... "
if [ $hvm != 0 ]; then
echo -n "(unsupported for fully virtualized)"
rc_status -s
migrate_with_watchdog $id "$XENDOMAINS_MIGRATE"
if [ $? -ne 0 ]; then
rc_failed
rc_status -v
else
migrate_with_watchdog $id "$XENDOMAINS_MIGRATE"
if [ $? -ne 0 ]; then
rc_failed
rc_status -v
else
rc_reset
rc_status -v
continue
fi
rc_reset
rc_status -v
continue
fi
fi
if [ -n "$XENDOMAINS_SAVE" ]; then
echo -n " $name: "
echo -n "saving... "
if [ $hvm != 0 ]; then
echo -n "(unsupported for fully virtualized)"
rc_status -s
save_with_watchdog $id "$XENDOMAINS_SAVE/$name"
if [ $? -ne 0 ]; then
rm -f "$XENDOMAINS_SAVE/$name"
rc_failed
rc_status -v
else
save_with_watchdog $id "$XENDOMAINS_SAVE/$name"
if [ $? -ne 0 ]; then
rm -f "$XENDOMAINS_SAVE/$name"
rc_failed
rc_status -v
else
rc_reset
rc_status -v
continue
fi
rc_reset
rc_status -v
continue
fi
fi
if [ -n "$XENDOMAINS_SHUTDOWN" ]; then

View File

@ -0,0 +1,209 @@
Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vmx.c
+++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vmx.c
@@ -50,6 +50,7 @@
#include <asm/hvm/vpt.h>
#include <public/hvm/save.h>
#include <asm/hvm/trace.h>
+#include <asm/hap.h>
enum handler_return { HNDL_done, HNDL_unhandled, HNDL_exception_raised };
@@ -2854,9 +2855,44 @@ void vmx_wbinvd_intercept(void)
static void ept_handle_violation(unsigned long qualification, paddr_t gpa)
{
- if ( unlikely(((qualification >> 7) & 0x3) != 0x3) )
+ unsigned long gla_validity = qualification & EPT_GLA_VALIDITY_MASK;
+ struct domain *d = current->domain;
+ u64 gfn = gpa >> PAGE_SHIFT;
+ mfn_t mfn;
+ p2m_type_t t;
+
+ /* GPA exceeds GAW. */
+ if ( unlikely(qualification & EPT_GAW_VIOLATION) )
{
- domain_crash(current->domain);
+ printk("EPT violation: guest physical address %"PRIpaddr" exceeded "
+ "its width limit.\n", gpa);
+ domain_crash(d);
+ }
+
+ if ( gla_validity == EPT_GLA_VALIDITY_RSVD ||
+ gla_validity == EPT_GLA_VALIDITY_PDPTR_LOAD )
+ {
+ printk("ept violation: reserved bit or pdptr load violation.\n");
+ domain_crash(d);
+ }
+
+ mfn = gfn_to_mfn(d, gfn, &t);
+
+ if ( unlikely( gla_validity != EPT_GLA_VALIDITY_MATCH) )
+ {
+ if ( p2m_is_ram(t) && paging_mode_log_dirty(d) )
+ goto mark_dirty;
+ domain_crash(d);
+ return;
+ }
+
+mark_dirty:
+
+ if ( p2m_is_ram(t) && paging_mode_log_dirty(d) )
+ {
+ paging_mark_dirty(d, mfn_x(mfn));
+ p2m_change_type(d, gfn, p2m_ram_logdirty, p2m_ram_rw);
+ flush_tlb_mask(d->domain_dirty_cpumask);
return;
}
Index: xen-3.2-testing/xen/arch/x86/mm/hap/hap.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm/hap/hap.c
+++ xen-3.2-testing/xen/arch/x86/mm/hap/hap.c
@@ -61,7 +61,7 @@ int hap_enable_log_dirty(struct domain *
hap_unlock(d);
/* set l1e entries of P2M table to be read-only. */
- p2m_change_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
+ p2m_change_entry_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
flush_tlb_mask(d->domain_dirty_cpumask);
return 0;
}
@@ -73,14 +73,14 @@ int hap_disable_log_dirty(struct domain
hap_unlock(d);
/* set l1e entries of P2M table with normal mode */
- p2m_change_type_global(d, p2m_ram_logdirty, p2m_ram_rw);
+ p2m_change_entry_type_global(d, p2m_ram_logdirty, p2m_ram_rw);
return 0;
}
void hap_clean_dirty_bitmap(struct domain *d)
{
/* set l1e entries of P2M table to be read-only. */
- p2m_change_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
+ p2m_change_entry_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
flush_tlb_mask(d->domain_dirty_cpumask);
}
Index: xen-3.2-testing/xen/arch/x86/mm/p2m.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-3.2-testing/xen/arch/x86/mm/p2m.c
@@ -279,11 +279,19 @@ void p2m_init(struct domain *d)
d->arch.p2m.set_entry = p2m_set_entry;
d->arch.p2m.get_entry = p2m_gfn_to_mfn;
d->arch.p2m.get_entry_fast = p2m_gfn_to_mfn_fast;
+ d->arch.p2m.change_entry_type_global = p2m_change_type_global;
if ( is_hvm_domain(d) )
hvm_p2m_init(d);
}
+void p2m_change_entry_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt)
+{
+ p2m_lock(d);
+ d->arch.p2m.change_entry_type_global(d, ot, nt);
+ p2m_unlock(d);
+}
+
static inline
int set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt)
{
@@ -806,8 +814,6 @@ void p2m_change_type_global(struct domai
if ( pagetable_get_pfn(d->arch.phys_table) == 0 )
return;
- p2m_lock(d);
-
#if CONFIG_PAGING_LEVELS == 4
l4e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table)));
#elif CONFIG_PAGING_LEVELS == 3
@@ -878,7 +884,6 @@ void p2m_change_type_global(struct domai
unmap_domain_page(l2e);
#endif
- p2m_unlock(d);
}
/* Modify the p2m type of a single gfn from ot to nt, returning the
Index: xen-3.2-testing/xen/include/asm-x86/domain.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/domain.h
+++ xen-3.2-testing/xen/include/asm-x86/domain.h
@@ -171,6 +171,8 @@ struct p2m_domain {
p2m_type_t *p2mt);
mfn_t (*get_entry_fast)(unsigned long gfn, p2m_type_t *p2mt);
+ void (*change_entry_type_global)(struct domain *d,
+ p2m_type_t ot, p2m_type_t nt);
/* Highest guest frame that's ever been mapped in the p2m */
unsigned long max_mapped_pfn;
};
Index: xen-3.2-testing/xen/include/asm-x86/hap.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/hap.h
+++ xen-3.2-testing/xen/include/asm-x86/hap.h
@@ -97,6 +97,49 @@ extern struct paging_mode hap_paging_pro
extern struct paging_mode hap_paging_pae_mode;
extern struct paging_mode hap_paging_long_mode;
+/* EPT violation qualifications definitions */
+/* bit offset 0 in exit qualification */
+#define _EPT_READ_VIOLATION 0
+#define EPT_READ_VIOLATION (1UL<<_EPT_READ_VIOLATION)
+/* bit offset 1 in exit qualification */
+#define _EPT_WRITE_VIOLATION 1
+#define EPT_WRITE_VIOLATION (1UL<<_EPT_WRITE_VIOLATION)
+/* bit offset 2 in exit qualification */
+#define _EPT_EXEC_VIOLATION 2
+#define EPT_EXEC_VIOLATION (1UL<<_EPT_EXEC_VIOLATION)
+
+/* bit offset 3 in exit qualification */
+#define _EPT_EFFECTIVE_READ 3
+#define EPT_EFFECTIVE_READ (1UL<<_EPT_EFFECTIVE_READ)
+/* bit offset 4 in exit qualification */
+#define _EPT_EFFECTIVE_WRITE 4
+#define EPT_EFFECTIVE_WRITE (1UL<<_EPT_EFFECTIVE_WRITE)
+/* bit offset 5 in exit qualification */
+#define _EPT_EFFECTIVE_EXEC 5
+#define EPT_EFFECTIVE_EXEC (1UL<<_EPT_EFFECTIVE_EXEC)
+
+/* bit offset 6 in exit qualification */
+#define _EPT_GAW_VIOLATION 6
+#define EPT_GAW_VIOLATION (1UL<<_EPT_GAW_VIOLATION)
+
+/* bits offset 7 & 8 in exit qualification */
+#define _EPT_GLA_VALIDITY 7
+#define EPT_GLA_VALIDITY_MASK (3UL<<_EPT_GLA_VALIDITY)
+/* gla != gpa, when load PDPTR */
+#define EPT_GLA_VALIDITY_PDPTR_LOAD (0UL<<_EPT_GLA_VALIDITY)
+/* gla != gpa, during guest page table walking */
+#define EPT_GLA_VALIDITY_GPT_WALK (1UL<<_EPT_GLA_VALIDITY)
+/* reserved */
+#define EPT_GLA_VALIDITY_RSVD (2UL<<_EPT_GLA_VALIDITY)
+/* gla == gpa, normal case */
+#define EPT_GLA_VALIDITY_MATCH (3UL<<_EPT_GLA_VALIDITY)
+
+#define EPT_EFFECTIVE_MASK (EPT_EFFECTIVE_READ | \
+ EPT_EFFECTIVE_WRITE | \
+ EPT_EFFECTIVE_EXEC)
+
+#define EPT_PAGETABLE_ENTRIES 512
+
#endif /* XEN_HAP_H */
/*
Index: xen-3.2-testing/xen/include/asm-x86/p2m.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/p2m.h
+++ xen-3.2-testing/xen/include/asm-x86/p2m.h
@@ -209,6 +209,7 @@ void guest_physmap_remove_page(struct do
/* Change types across all p2m entries in a domain */
void p2m_change_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt);
+void p2m_change_entry_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt);
/* Compare-exchange the type of a single p2m entry */
p2m_type_t p2m_change_type(struct domain *d, unsigned long gfn,

View File

@ -0,0 +1,331 @@
Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vmx.c
+++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vmx.c
@@ -50,6 +50,7 @@
#include <asm/hvm/vpt.h>
#include <public/hvm/save.h>
#include <asm/hvm/trace.h>
+#include <asm/hap.h>
enum handler_return { HNDL_done, HNDL_unhandled, HNDL_exception_raised };
@@ -2854,9 +2855,44 @@ void vmx_wbinvd_intercept(void)
static void ept_handle_violation(unsigned long qualification, paddr_t gpa)
{
- if ( unlikely(((qualification >> 7) & 0x3) != 0x3) )
+ unsigned long gla_validity = qualification & EPT_GLA_VALIDITY_MASK;
+ struct domain *d = current->domain;
+ u64 gfn = gpa >> PAGE_SHIFT;
+ mfn_t mfn;
+ p2m_type_t t;
+
+ /* GPA exceeds GAW. */
+ if ( unlikely(qualification & EPT_GAW_VIOLATION) )
{
- domain_crash(current->domain);
+ printk("EPT violation: guest physical address %"PRIpaddr" exceeded "
+ "its width limit.\n", gpa);
+ domain_crash(d);
+ }
+
+ if ( gla_validity == EPT_GLA_VALIDITY_RSVD ||
+ gla_validity == EPT_GLA_VALIDITY_PDPTR_LOAD )
+ {
+ printk("ept violation: reserved bit or pdptr load violation.\n");
+ domain_crash(d);
+ }
+
+ mfn = gfn_to_mfn(d, gfn, &t);
+
+ if ( unlikely( gla_validity != EPT_GLA_VALIDITY_MATCH) )
+ {
+ if ( p2m_is_ram(t) && paging_mode_log_dirty(d) )
+ goto mark_dirty;
+ domain_crash(d);
+ return;
+ }
+
+mark_dirty:
+
+ if ( p2m_is_ram(t) && paging_mode_log_dirty(d) )
+ {
+ paging_mark_dirty(d, mfn_x(mfn));
+ p2m_change_type(d, gfn, p2m_ram_logdirty, p2m_ram_rw);
+ flush_tlb_mask(d->domain_dirty_cpumask);
return;
}
Index: xen-3.2-testing/xen/arch/x86/mm/hap/hap.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm/hap/hap.c
+++ xen-3.2-testing/xen/arch/x86/mm/hap/hap.c
@@ -61,7 +61,7 @@ int hap_enable_log_dirty(struct domain *
hap_unlock(d);
/* set l1e entries of P2M table to be read-only. */
- p2m_change_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
+ p2m_change_entry_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
flush_tlb_mask(d->domain_dirty_cpumask);
return 0;
}
@@ -73,14 +73,14 @@ int hap_disable_log_dirty(struct domain
hap_unlock(d);
/* set l1e entries of P2M table with normal mode */
- p2m_change_type_global(d, p2m_ram_logdirty, p2m_ram_rw);
+ p2m_change_entry_type_global(d, p2m_ram_logdirty, p2m_ram_rw);
return 0;
}
void hap_clean_dirty_bitmap(struct domain *d)
{
/* set l1e entries of P2M table to be read-only. */
- p2m_change_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
+ p2m_change_entry_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
flush_tlb_mask(d->domain_dirty_cpumask);
}
Index: xen-3.2-testing/xen/arch/x86/mm/p2m-ept.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm/p2m-ept.c
+++ xen-3.2-testing/xen/arch/x86/mm/p2m-ept.c
@@ -23,6 +23,27 @@
#include <asm/types.h>
#include <asm/domain.h>
#include <asm/hvm/vmx/vmx.h>
+#include <asm/hap.h>
+
+static void ept_p2m_type_to_flags(ept_entry_t *entry, p2m_type_t type)
+{
+ switch(type)
+ {
+ case p2m_invalid:
+ case p2m_mmio_dm:
+ default:
+ return;
+ case p2m_ram_rw:
+ case p2m_mmio_direct:
+ entry->r = entry->w = entry->x = 1;
+ return;
+ case p2m_ram_logdirty:
+ case p2m_ram_ro:
+ entry->r = entry->x = 1;
+ entry->w = 0;
+ return;
+ }
+}
static int ept_next_level(struct domain *d, bool_t read_only,
ept_entry_t **table, unsigned long *gfn_remainder,
@@ -100,6 +121,7 @@ ept_set_entry(struct domain *d, unsigned
ept_entry->avail2 = 0;
/* last step */
ept_entry->r = ept_entry->w = ept_entry->x = 1;
+ ept_p2m_type_to_flags(ept_entry, p2mt);
}
else
ept_entry->epte = 0;
@@ -140,13 +162,10 @@ static mfn_t ept_get_entry(struct domain
index = gfn_remainder;
ept_entry = table + index;
- if ( (ept_entry->epte & 0x7) == 0x7 )
+ if ( ept_entry->avail1 != p2m_invalid )
{
- if ( ept_entry->avail1 != p2m_invalid )
- {
- *t = ept_entry->avail1;
- mfn = _mfn(ept_entry->mfn);
- }
+ *t = ept_entry->avail1;
+ mfn = _mfn(ept_entry->mfn);
}
out:
@@ -159,11 +178,64 @@ static mfn_t ept_get_entry_fast(unsigned
return ept_get_entry(current->domain, gfn, t);
}
+/* Walk the whole p2m table, changing any entries of the old type
+ * to the new type. This is used in hardware-assisted paging to
+ * quickly enable or diable log-dirty tracking */
+
+static void ept_change_entry_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt)
+{
+ if ( pagetable_get_pfn(d->arch.phys_table) == 0 )
+ return;
+
+ if ( EPT_DEFAULT_GAW == 3 )
+ {
+ ept_entry_t *l4e, *l3e, *l2e, *l1e;
+ int i4, i3, i2, i1;
+
+ l4e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table)));
+ for (i4 = 0; i4 < EPT_PAGETABLE_ENTRIES; i4++ )
+ {
+ if ( !(l4e+i4)->epte || (l4e+i4)->sp_avail)
+ continue;
+ l3e = map_domain_page((l4e+i4)->mfn);
+ for ( i3 = 0; i3 < EPT_PAGETABLE_ENTRIES; i3++ )
+ {
+ if ( !(l3e+i3)->epte || (l3e+i3)->sp_avail )
+ continue;
+ l2e = map_domain_page((l3e+i3)->mfn);
+ for ( i2 = 0; i2 < EPT_PAGETABLE_ENTRIES; i2++ )
+ {
+ if ( !(l2e+i2)->epte || (l2e+i2)->sp_avail )
+ continue;
+ l1e = map_domain_page((l2e+i2)->mfn);
+ for ( i1 = 0; i1 < EPT_PAGETABLE_ENTRIES; i1++ )
+ {
+ if ( !(l1e+i1)->epte )
+ continue;
+ if ( (l1e+i1)->avail1 != ot )
+ continue;
+ (l1e+i1)->avail1 = nt;
+ ept_p2m_type_to_flags(l1e+i1, nt);
+ }
+ unmap_domain_page(l1e);
+ }
+ unmap_domain_page(l2e);
+ }
+ unmap_domain_page(l3e);
+ }
+ unmap_domain_page(l4e);
+
+ if ( d->vcpu[0] )
+ ept_sync_domain(d->vcpu[0]);
+ }
+}
+
void ept_p2m_init(struct domain *d)
{
d->arch.p2m.set_entry = ept_set_entry;
d->arch.p2m.get_entry = ept_get_entry;
d->arch.p2m.get_entry_fast = ept_get_entry_fast;
+ d->arch.p2m.change_entry_type_global = ept_change_entry_type_global;
}
/*
Index: xen-3.2-testing/xen/arch/x86/mm/p2m.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-3.2-testing/xen/arch/x86/mm/p2m.c
@@ -279,11 +279,19 @@ void p2m_init(struct domain *d)
d->arch.p2m.set_entry = p2m_set_entry;
d->arch.p2m.get_entry = p2m_gfn_to_mfn;
d->arch.p2m.get_entry_fast = p2m_gfn_to_mfn_fast;
+ d->arch.p2m.change_entry_type_global = p2m_change_type_global;
if ( is_hvm_domain(d) )
hvm_p2m_init(d);
}
+void p2m_change_entry_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt)
+{
+ p2m_lock(d);
+ d->arch.p2m.change_entry_type_global(d, ot, nt);
+ p2m_unlock(d);
+}
+
static inline
int set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt)
{
@@ -806,8 +814,6 @@ void p2m_change_type_global(struct domai
if ( pagetable_get_pfn(d->arch.phys_table) == 0 )
return;
- p2m_lock(d);
-
#if CONFIG_PAGING_LEVELS == 4
l4e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table)));
#elif CONFIG_PAGING_LEVELS == 3
@@ -878,7 +884,6 @@ void p2m_change_type_global(struct domai
unmap_domain_page(l2e);
#endif
- p2m_unlock(d);
}
/* Modify the p2m type of a single gfn from ot to nt, returning the
Index: xen-3.2-testing/xen/include/asm-x86/domain.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/domain.h
+++ xen-3.2-testing/xen/include/asm-x86/domain.h
@@ -171,6 +171,8 @@ struct p2m_domain {
p2m_type_t *p2mt);
mfn_t (*get_entry_fast)(unsigned long gfn, p2m_type_t *p2mt);
+ void (*change_entry_type_global)(struct domain *d,
+ p2m_type_t ot, p2m_type_t nt);
/* Highest guest frame that's ever been mapped in the p2m */
unsigned long max_mapped_pfn;
};
Index: xen-3.2-testing/xen/include/asm-x86/hap.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/hap.h
+++ xen-3.2-testing/xen/include/asm-x86/hap.h
@@ -97,6 +97,49 @@ extern struct paging_mode hap_paging_pro
extern struct paging_mode hap_paging_pae_mode;
extern struct paging_mode hap_paging_long_mode;
+/* EPT violation qualifications definitions */
+/* bit offset 0 in exit qualification */
+#define _EPT_READ_VIOLATION 0
+#define EPT_READ_VIOLATION (1UL<<_EPT_READ_VIOLATION)
+/* bit offset 1 in exit qualification */
+#define _EPT_WRITE_VIOLATION 1
+#define EPT_WRITE_VIOLATION (1UL<<_EPT_WRITE_VIOLATION)
+/* bit offset 2 in exit qualification */
+#define _EPT_EXEC_VIOLATION 2
+#define EPT_EXEC_VIOLATION (1UL<<_EPT_EXEC_VIOLATION)
+
+/* bit offset 3 in exit qualification */
+#define _EPT_EFFECTIVE_READ 3
+#define EPT_EFFECTIVE_READ (1UL<<_EPT_EFFECTIVE_READ)
+/* bit offset 4 in exit qualification */
+#define _EPT_EFFECTIVE_WRITE 4
+#define EPT_EFFECTIVE_WRITE (1UL<<_EPT_EFFECTIVE_WRITE)
+/* bit offset 5 in exit qualification */
+#define _EPT_EFFECTIVE_EXEC 5
+#define EPT_EFFECTIVE_EXEC (1UL<<_EPT_EFFECTIVE_EXEC)
+
+/* bit offset 6 in exit qualification */
+#define _EPT_GAW_VIOLATION 6
+#define EPT_GAW_VIOLATION (1UL<<_EPT_GAW_VIOLATION)
+
+/* bits offset 7 & 8 in exit qualification */
+#define _EPT_GLA_VALIDITY 7
+#define EPT_GLA_VALIDITY_MASK (3UL<<_EPT_GLA_VALIDITY)
+/* gla != gpa, when load PDPTR */
+#define EPT_GLA_VALIDITY_PDPTR_LOAD (0UL<<_EPT_GLA_VALIDITY)
+/* gla != gpa, during guest page table walking */
+#define EPT_GLA_VALIDITY_GPT_WALK (1UL<<_EPT_GLA_VALIDITY)
+/* reserved */
+#define EPT_GLA_VALIDITY_RSVD (2UL<<_EPT_GLA_VALIDITY)
+/* gla == gpa, normal case */
+#define EPT_GLA_VALIDITY_MATCH (3UL<<_EPT_GLA_VALIDITY)
+
+#define EPT_EFFECTIVE_MASK (EPT_EFFECTIVE_READ | \
+ EPT_EFFECTIVE_WRITE | \
+ EPT_EFFECTIVE_EXEC)
+
+#define EPT_PAGETABLE_ENTRIES 512
+
#endif /* XEN_HAP_H */
/*
Index: xen-3.2-testing/xen/include/asm-x86/p2m.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/p2m.h
+++ xen-3.2-testing/xen/include/asm-x86/p2m.h
@@ -209,6 +209,7 @@ void guest_physmap_remove_page(struct do
/* Change types across all p2m entries in a domain */
void p2m_change_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt);
+void p2m_change_entry_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt);
/* Compare-exchange the type of a single p2m entry */
p2m_type_t p2m_change_type(struct domain *d, unsigned long gfn,

View File

@ -2,8 +2,8 @@
#============================================================================
# multinet-common.sh
#
# Version = 3.0.0
# Date = 2008-01-30
# Version = 3.0.1
# Date = 2008-02-07
#
# Maintainer(s) = Ron Terry - ron (at) pronetworkconsulting (dot) com
#
@ -16,7 +16,7 @@
# Function library for network-multinet and all other multinet related
# network scripts
#
# Vars (should not require modification):
# Vars (should not need to be changed):
#
# BRIDGE_NAME -Name of bridged networks
# HOSTONLY_NAME -Name of hostonly networks
@ -598,21 +598,6 @@ manage_firewall() {
#***** Traditional Bridge Helper Functions ********************************
setup_bridge_port() {
# This function configures a network interface to be a port on
# a bridge by removing any IP addresses bound to it.
#
# Usage: setup_bridge_port <interface>
local DEV="$1"
# take interface down ...
ip link set ${DEV} down
# ... and configure it
ip addr flush ${DEV} > /dev/null 2>&1
}
create_bridge() {
# This function creates a bridge.
#
@ -630,15 +615,7 @@ create_bridge() {
brctl addbr ${BRIDGE}
brctl stp ${BRIDGE} off
brctl setfd ${BRIDGE} 0
# Create an ifcfg file for the bridge
#echo "Creating $IFCFG_FILE_DIR/ifcfg-${BRIDGE}";read
echo "NAME='Xen Virtual - ${BRIDGE}'" > $IFCFG_FILE_DIR/ifcfg-${BRIDGE}
fi
# Bring the bridge up
#echo "Bridge $BRIDGE up";read
ip link set ${BRIDGE} up
}
delete_bridge() {
@ -671,10 +648,6 @@ delete_bridge() {
# Remove the bridge
#echo "Removing $BRIDGE";read
brctl delbr ${BRIDGE}
# Remove the bridge's ifcfg file
#echo "Removing $IFCFG_FILE_DIR/ifcfg-${BRIDGE}";read
rm -f $IFCFG_FILE_DIR/ifcfg-${BRIDGE}
fi
}
@ -691,7 +664,6 @@ add_to_bridge() {
# Don't add $dev to $bridge if it's already on a bridge.
if [ -e "/sys/class/net/${BRIDGE}/brif/${DEV}" ]; then
ip link set ${DEV} up || true
return
fi
brctl addif ${BRIDGE} ${DEV}
@ -713,6 +685,8 @@ add_to_bridge2() {
echo -n " Waiting for ${DEV} to negotiate link."
ip link set ${DEV} up
for i in `seq ${MAXTRIES}` ; do
if ifconfig ${DEV} | grep -q RUNNING ; then
break
@ -730,56 +704,6 @@ add_to_bridge2() {
add_to_bridge ${BRIDGE} ${DEV}
}
rename_interfaces() {
# This function renames network interface DST SRC
#
# Usage: rename_interfaces $SRC $DST
#
# Vars: SRC -Name of the sourec interface
# DST -Name of the destination interface
local DEV=$1
local NEW_DEV=$2
# Bring down interface
#echo "Bring down ${DEV}";read
ip link set ${DEV} down
# Rename physical and virtual interfaces
#echo "Rename ${DEV} to ${NEW_DEV}";read
ip link set ${DEV} name ${NEW_DEV}
# Bring interface back up
#echo "Bring ${NEW_DEV} back up";read
ip link set ${NEW_DEV} up
}
transfer_mac() {
# This function transfers the mac address from one network interface
# to another
#
# Usage: transfer_mac $SRC $DST
#
# Vars: SRC -Name of the sourec interface
# DST -Name of the destination interface
# MAC -MAC address to transfer
local SRC=$1
local DST=$2
# Find MAC Address
#echo "Find MAC address of ${SRC}";read
local MAC=`ip link show ${SRC} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'`
# Assign the physical MAC to the new interface
#echo "Assign the physical MAC to ${DST}";echo "ip link set ${DST} down";echo "ip link set ${DST} addr ${MAC}";echo "ip link set ${DST} arp on";echo "ip link set ${DST} up";read
ip link set ${DST} down
ip link set ${DST} addr ${MAC}
ip link set ${DST} arp on
ip link set ${DST} multicast on
ip link set ${DST} up
}
transfer_addrs() {
# This function transfers all IP addresses (including aliases) from one
# network interface to another
@ -787,26 +711,27 @@ transfer_addrs() {
# Usage: transfer_addrs $DEV $BRIDGE
# transfer_addrs $BRIDGE $DEV
#
# Vars: $DEV/$SRC -Source interface
# Vars: $DEV/$SRC -Source interface
# $BRIDGE/$DST -Destination interface
local SRC=$1
local DST=$2
# Ensure their is an address to transfer
# Ensure there is an address to transfer
# echo "Ensure there is an address to transfer";echo "ifup ${SRC}";echo "ip link set ${DST} up";read
ifup $SRC > /dev/null 2>&1
ip link set $DST up
if ! ip addr show $SRC| grep -qw "UP"
then
ip link set $SRC up
#ifup $SRC > /dev/null 2>&1
fi
# Don't bother if $DST already has IP addresses.
if ip addr show dev ${DST} | egrep -q '^ *inet ' ; then
return
fi
# Find the IP Address and Subnet Mask
#echo "Find the IP address and Subnet Mask";read
local IPADDR="`ip addr show dev ${SRC} | grep 'inet ' | sed 's/^ *//g' | cut -d ' ' -f 2 | cut -d '/' -f 1`"
local SNM="`ipcalc $IPADDR | grep Netmask | sed 's/Netmask: *//g' | cut -d ' ' -f 1`"
# Record default route on ${SRC}
DEFAULT_GW=`ip route show dev ${SRC} | fgrep default | sed 's/default via //'`
# Address lines start with 'inet' and have the device in them.
# Replace 'inet' with 'ip addr add' and change the device name $SRC
@ -824,25 +749,6 @@ s/secondary//
p
}" | sh -e
# Remove IP address and Subnet Mask from SRC ifcfg file
#echo "Remove IP Address and Subnet Mask from $IFCFG_FILE_DIR/ifcfg-${SRC}";read
#sed -i '/^IPADDR=.*/d' $IFCFG_FILE_DIR/ifcfg-${SRC}
#sed -i '/^NETMASK=.*/d' $IFCFG_FILE_DIR/ifcfg-${SRC}
# Write IP Address and Subnet mask out to ifcfg file
#echo "Write out IP Address and Subnet Mask to $IFCFG_FILE_DIR/ifcfg-${DST}";read
if [ -e $IFCFG_FILE_DIR/ifcfg-${DST} ]
then
grep -q "IPADDR=" $IFCFG_FILE_DIR/ifcfg-${DST} || echo "IPADDR='$IPADDR'" >> $IFCFG_FILE_DIR/ifcfg-${DST}
grep -q "NETMASK=" $IFCFG_FILE_DIR/ifcfg-${DST} || echo "NETMASK='$SNM'" >> $IFCFG_FILE_DIR/ifcfg-${DST}
grep -q "BOOTPROTO=" $IFCFG_FILE_DIR/ifcfg-${DST} || echo "BOOTPROTO='static'" >> $IFCFG_FILE_DIR/ifcfg-${DST}
grep -q "STARTMODE=" $IFCFG_FILE_DIR/ifcfg-${DST} || echo "STARTMODE='manual'" >> $IFCFG_FILE_DIR/ifcfg-${DST}
fi
# Bring the interface down and back up again
#echo "Bring ${DST} down and back up again";read
ip link set ${DST} down
ifup ${DST} > /dev/null 2>&1
}
transfer_routes() {
@ -930,37 +836,22 @@ find_active_vlans() {
echo "$VLANS"
}
find_bridged_netdev() {
# This function finds the network interface ($netdev) that is associated
# with the bridge by matching MAC addresses.
#
# Usage: find_bridges_netdev <bridge>
local bridge=$1
bmac=`ip link show ${bridge} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'`
for i in `ls /sys/class/net/${bridge}/brif` ; do
mac=`ip link show ${i} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'`
if [ "${bmac}" = "$MAC" ] && [ ! "${bridge}" = "${i}" ] ; then
netdev=${i}
return 0
fi
done
return 1
}
create_normal_bridge() {
# This fuction creates a bridge on a normal network interface
#
# Usage: create_normal_bridge start|stop $DEV $PDEV $BRIDGE
# Usage: create_normal_bridge start|stop $DEV $BRIDGE
#
# Vars: $DEV -Network interface name
# $PDEV -Name interface will be renamed to
# $BRIDGE -Name of the bridge
local DEV="$2"
local PDEV="$3"
local BRIDGE="$4"
local BRIDGE="$3"
local BONDED="no"
if [ -e /sys/class/net/$DEV/bonding ]
then
BONDED="yes"
fi
# Find and bring down any active VLANs
local VLANS=$(find_active_vlans "${DEV}")
@ -971,52 +862,61 @@ create_normal_bridge() {
case $1 in
start)
# Ensure there is a bridge to transfer to
# Create ${BRIDGE}
#echo "Create the bridge. \(create_bridge ${BRIDGE}\)";read
create_bridge ${BRIDGE}
# Transfer the IP address to the virtual interface
# Transfer IP address from ${DEV} to the ${BRIDGE}
#echo "Transfer the IP address from ${DEV} to ${BRIDGE}";read
transfer_addrs ${DEV} ${BRIDGE}
# Rename physical and virtual interfaces
#echo "Rename ${DEV} to ${PDEV}";read
rename_interfaces ${DEV} ${PDEV}
# Flush addresses from ${DEV}
#echo "Flush addresses from ${DEV}";read
ip addr flush ${DEV} > /dev/null 2>&1
# Configure $PDEV as a bridge port
#echo "Configure ${PDEV} as a bridge port";read
setup_bridge_port ${PDEV}
# Add ${DEV} to ${BRIDGE}
#echo "Add ${DEV} to ${BRIDGE}";read
brctl addif ${BRIDGE} ${DEV}
# Bring up ${BRIDGE}
#echo "Bring up ${BRIDGE}";read
ip link set dev ${BRIDGE} up
# If default route was on ${DEV}, then transfer it to ${BRIDGE}
#echo "Add gw ${DEFAULT_GW}";read
[ -n "${DEFAULT_GW}" ] && ip route add default dev ${BRIDGE} via ${DEFAULT_GW}
# Bring bridge up and add interfaces to it
#echo "Bring ${BRIDGE} up and add ${PDEV} to it";read
ip link set ${BRIDGE} up
add_to_bridge2 ${BRIDGE} ${PDEV}
;;
stop)
# Remove interface from bridge
#echo "Remove interface ${PDEV} from ${BRIDGE}";read
brctl delif ${BRIDGE} ${PDEV}
brctl delif ${BRIDGE} ${DEV}
# If interface is a bond, use ifdown and don't transfer addresses.
# Addresses will be reassigned when ifup'ing the bond.
#echo "Remove interface ${DEV} from ${BRIDGE}";read
if [ "x${BONDED}" = "xyes" ]
then
ifdown ${DEV}
else
ip link set ${DEV} down
# Transfer IP address back to original interface
#echo "Transfer IP address from ${BRIDGE} to ${DEV}";read
transfer_addrs ${BRIDGE} ${DEV}
fi
# Transfer IP address back to original interface
#echo "Transfer IP address from ${BRIDGE} to ${PDEV}";read
transfer_addrs ${BRIDGE} ${PDEV}
# Configure $PDEV as a bridge port
#echo "Configure ${BRIDGE} as a bridge port";read
#setup_bridge_port ${BRIDGE}
# Remove bridge ${BRIDGE}
#echo "Remove the bridge";read
delete_bridge ${BRIDGE}
# Rename physical and virtual network interfaces
#echo "Rename ${PDEV} to ${DEV}";read
#ip link set ${PDEV} name ${DEV}
rename_interfaces ${PDEV} ${DEV}
# Bring renamed physical interface up
#echo "Bring up ${DEV}";read
ifup ${DEV} > /dev/null 2>&1
# If bonded, just ifup the bond. Otherwise use ip to bring up the interface
# and if default route was on ${BRIDGE} transfer it back to ${DEV}
if [ "x${BONDED}" = "xyes" ]
then
ifup ${DEV}
else
ip link set ${DEV} up
[ -n "${DEFAULT_GW}" ] && ip route add default dev ${DEV} via ${DEFAULT_GW}
fi
;;
esac
@ -1032,18 +932,16 @@ create_normal_bridge() {
#***** NAT/HostOnly Helper Functions **************************************
configure_bridge_as_dom0_interface() {
# This function configures the MAC and IP address of a bridge to be a
# This function configures the IP address of a bridge to be a
# network interface in Dom0.
#
# Usage: configure_dom0_bridge_interface $BRIDGE $IPADDR $MAC
# Usage: configure_dom0_bridge_interface $BRIDGE $IPADDR
#
# Vars: $BRIDGE -bridge name
# $IPADDR -IP address to assign to the bridge
# $MAC -MAC address to assign to the bridge
local BRIDGE="$1"
local IPADDR="$2"
local MAC="$3"
case $CMD_OPT in
start)
@ -1051,16 +949,12 @@ configure_bridge_as_dom0_interface() {
#echo "Taking the $BRIDGE down";read
ip link set $BRIDGE down
# Assifge bridge a MAC address
#echo "Assign $BRIDGE a MAC address";read
ip link set $BRIDGE addr $MAC
# Assign the bridge an IP address
#echo"Assign $BRIDGE the IP address: $IPADDR";read
ip addr flush $BRIDGE > /dev/null 2>&1
ip addr add $IPADDR brd + dev $BRIDGE
# Bring the brisge back up
# Bring the bridge back up
#echo "Bridge $BRIDGE back up";read
ip link set $BRIDGE up
@ -1073,12 +967,8 @@ configure_bridge_as_dom0_interface() {
#echo "Taking $BRIDGE down";read
ip link set $BRIDGE down
# Remove MAC address from bridge
#echo "Remove MAC address from $BRIDGE";read
ip link set $BRIDGE addr fe:ff:ff:ff:ff:ff
# Remove IP address from the bridge
#echo "Remove teh IP address from $BRIDGE";read
#echo "Remove the IP address from $BRIDGE";read
ip addr flush $BRIDGE > /dev/null 2>&1
;;
status)
@ -1097,15 +987,11 @@ configure_bridged_networks() {
# Vars: $DEV -Network device to create the bridge on
# $NUMBER -Number of the bridge being created/removed
# $BRIDGE -Name of the bridge
# $PDEV -What to rename the interface attached to the bridge to
# Set local function variables
local DEV=$2
local NUMBER=$3
local BRIDGE=$BRIDGE_NAME$NUMBER
local PDEV="p$DEV"
local BRIDGE_IFCFG_FILE="ifcfg-$BRIDGE"
# Test if $BRIDGE is set
if [ "$BRIDGE" = "null" ]
@ -1116,10 +1002,15 @@ configure_bridged_networks() {
case $1 in
start)
# Test if $BRIDGE already exists
if [ -e "/sys/class/net/${BRIDGE}/bridge" ]; then
if [ -e "/sys/class/net/$BRIDGE/bridge" ]
then
# Skip this bridge
#------------------------------------------------------------------
echo " $BRIDGE exists and is already configured."
echo " Skipping $BRIDGE"
return
fi
if /sbin/ip link show $DEV | grep -qw UP
then
echo ""
@ -1131,8 +1022,8 @@ configure_bridged_networks() {
echo ""
# Create bridge
create_normal_bridge start $DEV $PDEV $BRIDGE
create_normal_bridge start $DEV $BRIDGE
if [ "${antispoof}" = "yes" ]
then
antispoofing
@ -1140,7 +1031,7 @@ configure_bridged_networks() {
# Write entry into networktab
#---------------------------------------------------------------------
echo "$BRIDGE,bridge,$NUMBER,$DEV,,,dhcp-off" >> $NETWORKTAB
echo "$BRIDGE,bridge,$NUMBER,$DEV,dhcp-off" >> $NETWORKTAB
echo ""
else
echo " Physical Interface $DEV is not up. Skipping $BRIDGE"
@ -1163,7 +1054,7 @@ configure_bridged_networks() {
echo ""
# Remove bridge with normal network interface (i.e. ethX)
create_normal_bridge stop $DEV $PDEV $BRIDGE
create_normal_bridge stop $DEV $BRIDGE
# Remove entry from networktab file
#---------------------------------------------------------------------
@ -1203,7 +1094,6 @@ configure_local_networks() {
local BRIDGE=$ROUTE_NAME$NUMBER
;;
esac
#local MAC=$5
local IPADDR=$5
local DHCP_SRV=$6
@ -1229,7 +1119,7 @@ configure_local_networks() {
#---- do start or stop --------------------------------------------
case $1 in
start)
if ! brctl show | grep -qw $BRIDGE || /sbin/ip address show $BRIDGE > /dev/null
if ! [ -e "/sys/class/net/$BRIDGE/bridge" ]
then
# Create the network
#------------------------------------------------------------------
@ -1242,7 +1132,7 @@ configure_local_networks() {
create_bridge $BRIDGE > /dev/null 2>&1
# Configure the bridge as a Dom0 network interface
configure_bridge_as_dom0_interface $BRIDGE $IPADDR $MAC > /dev/null 2>&1
configure_bridge_as_dom0_interface $BRIDGE $IPADDR > /dev/null 2>&1
# Set up the bridge as a hostonly / NAT / Routed network
case $TYPE in
@ -1306,14 +1196,6 @@ configure_local_networks() {
;;
esac
# Write out new ifcfg file for the bridge
#---------------------------------------------------------------------
echo "NAME='XEN Virtual Network - $BRIDGE'" > $IFCFG_FILE_DIR/ifcfg-$BRIDGE
grep -q "IPADDR=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "IPADDR='$IP'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE
grep -q "NETMASK=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "NETMASK='$SNM'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE
grep -q "BOOTPROTO=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "BOOTPROTO='static'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE
grep -q "STARTMODE=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "STARTMODE='manual'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE
# Configure DHCP for the network
#---------------------------------------------------------------------
#if ! [ "$DHCP_SRV" = "dhcp-on" ]
@ -1329,13 +1211,13 @@ configure_local_networks() {
# write entry into networktab
#---------------------------------------------------------------------
echo "$BRIDGE,$TYPE,$NUMBER,$DEV,,$IPADDR,$DHCP_SRV" >> $NETWORKTAB
echo "$BRIDGE,$TYPE,$NUMBER,$IPADDR,$DHCP_SRV" >> $NETWORKTAB
echo "============================================================"
else
# Skip this bridge
#------------------------------------------------------------------
echo " Virtual Interface $BRIDGE exists and is already configured."
echo " $BRIDGE exists and is already configured."
echo " Skipping $BRIDGE"
fi
;;
@ -1409,16 +1291,12 @@ configure_local_networks() {
echo "============================================================"
# unconfigure the veth
configure_bridge_as_dom0_interface $DEV $IPADDR $MAC > /dev/null 2>&1
configure_bridge_as_dom0_interface $DEV $IPADDR > /dev/null 2>&1
# Remove the bridge
#echo "Removing $BRIDGE";read
delete_bridge $BRIDGE
# Remove network ifcfg config file
#---------------------------------------------------------------------
rm -f $IFCFG_FILE_DIR/ifcfg-$BRIDGE
# Remove entry from networktab file
#---------------------------------------------------------------------
sed -i "/$BRIDGE/d" $NETWORKTAB
@ -1458,14 +1336,13 @@ configure_nohost_networks() {
echo ""
echo "============================================================"
local DEV=$2
local PDEV="p${DEV}"
local MAC=`ip link show ${DEV} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'`
local NUMBER=$3
local BRIDGE=${NOHOST_NAME}${NUMBER}
case $1 in
start)
if ! brctl show | grep -qw "^${BRIDGE}"
if ! [ -e "/sys/class/net/${BRIDGE}/bridge" ]
then
echo ""
echo "============================================================"
@ -1480,28 +1357,24 @@ configure_nohost_networks() {
#echo "Create the bridge. \(create_bridge ${BRIDGE}\)";read
create_bridge ${BRIDGE}
# Rename physical and virtual interfaces
#echo "Rename ${DEV} to ${PDEV}";read
rename_interfaces ${DEV} ${PDEV}
# Configure $PDEV as a bridge port
#echo "Configure ${PDEV} as a bridge port";read
setup_bridge_port ${PDEV}
# Configure $DEV as a bridge port
#echo "Configure ${DEV} as a bridge port";read
setup_bridge_port ${DEV}
# Bring bridge up and add interfaces to it
#echo "Bring ${BRIDGE} up and add ${PDEV} to it";read
#echo "Bring ${BRIDGE} up and add ${DEV} to it";read
ip link set ${BRIDGE} up
add_to_bridge2 ${BRIDGE} ${PDEV}
# Write out new ifcfg file for the bridge
#---------------------------------------------------------------------
#echo "NAME='XEN Virtual Network - $BRIDGE'" > $IFCFG_FILE_DIR/ifcfg-$BRIDGE
grep -q "STARTMODE=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "STARTMODE='manual'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE
#add_to_bridge2 ${BRIDGE} ${DEV}
add_to_bridge ${BRIDGE} ${DEV}
# Write entry into networktab file
#---------------------------------------------------------------------
echo "${BRIDGE},nohost,${NUMBER},${DEV},,,," >> ${NETWORKTAB}
echo "${BRIDGE},nohost,${NUMBER},${DEV},,," >> ${NETWORKTAB}
else
# Skip this bridge
#------------------------------------------------------------------
echo " $BRIDGE exists and is already configured."
echo " Skipping $BRIDGE"
fi
;;
stop)
@ -1516,18 +1389,13 @@ configure_nohost_networks() {
#---------------------------------------------------------------------
# Remove interface from bridge
#echo "Remove interface ${PDEV} from ${BRIDGE}";read
brctl delif ${BRIDGE} ${PDEV}
#echo "Remove interface ${DEV} from ${BRIDGE}";read
brctl delif ${BRIDGE} ${DEV}
# Remove bridge ${BRIDGE}
#echo "Remove the bridge";read
delete_bridge ${BRIDGE}
# Rename physical and virtual network interfaces
#echo "Rename ${PDEV} to ${DEV}";read
#ip link set ${PDEV} name ${DEV}
rename_interfaces ${PDEV} ${DEV}
# Bring renamed physical interface up
#echo "Bring up ${DEV}";read
ifup ${DEV} > /dev/null 2>&1
@ -1562,7 +1430,7 @@ configure_empty_networks() {
case $1 in
start)
if ! brctl show | grep -qw "^$BRIDGE"
if ! [ -e "/sys/class/net/${BRIDGE}/bridge" ]
then
echo "Configuring Virtual Network: $BRIDGE"
echo " of type: empty"
@ -1573,15 +1441,14 @@ configure_empty_networks() {
# create the bridge
create_bridge $BRIDGE
# Write out new ifcfg file for the bridge
#---------------------------------------------------------------------
#echo "NAME='XEN Virtual Network - $BRIDGE'" > $IFCFG_FILE_DIR/ifcfg-$BRIDGE
grep -q "STARTMODE=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "STARTMODE='manual'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE
# Write entry into networktab file
#---------------------------------------------------------------------
echo "$BRIDGE,empty,$NUMBER,,,,," >> $NETWORKTAB
echo "$BRIDGE,empty,$NUMBER,,,," >> $NETWORKTAB
else
# Skip this bridge
#------------------------------------------------------------------
echo " $BRIDGE exists and is already configured."
echo " Skipping $BRIDGE"
fi
;;
stop)
@ -1645,7 +1512,7 @@ remove_all_networks() {
configure_bridged_networks stop $NET_DEV $NET_NUMBER
;;
nat|hostonly|route)
configure_local_networks stop $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_MAC $NET_DEV_IP $NET_DHCP_SRV
configure_local_networks stop $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_IP $NET_DHCP_SRV
;;
nohost)
configure_nohost_networks stop $NET_DEV $NET_NUMBER
@ -1655,15 +1522,6 @@ remove_all_networks() {
;;
esac
done
# Remove any remaining networks
#---------------------------------------------------------------------
local LEFTOVER_NETS="`find /sys/class/net/ -name brif | cut -d '/' -f 5`"
for NET in $LEFTOVER_NETS
do
delete_bridge $NET
done
}
#***** DHCP Functions *****************************************************

View File

@ -37,16 +37,16 @@
# -This type of network is similiar to a VMware "HOST ONLY"
# network.
#
# nat: -Networks that are connected to Dom0 and are private from the
# nat: -Networks that are connected to Dom0 and are privet from the
# physical network but VMs can get out to the physical network
# -This type of network will allow VMs connected to it to access
# Dom0, the "outside world" via NAT and other VMs connected to it.
# Dom0,the "outside world" via NAT and other VMs connected to it.
# -This type of network is similiar to a VMware "NAT" network.
#
# routed: -Networks that are not directly connected to the physical network
# but who's traffic is directly routed to other networks
# but whi's traffic is directly routed to other networks
# -This type of network will allow VMs connected to it to access
# Dom0, the "outside world" via routing through Dom0 and other VMs
# Dom0,the "outside world" via routing through Dom0 and other VMs
# connected to it.
#
# empty: -Networks that are not connected to either Dom0 or the physical
@ -60,12 +60,13 @@
# This script requires that the vif-bridge script be used as the vif
# creation script (as opposed to vif-nat/vif-route).
#
# This script will verify that a requested physical interface is present and
# up before creating the network and connecting the physical interface to it.
# This script will test for the presence of the physical interfaces
# configured to be connected to bridged networks and only attempt to
# create networks on the ones that are present and up.
#
# 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
# active network interface.
# interface active network interface.
#
# To enable this script edit the network-script field in the
# /etc/xen/xend-config.sxp file.
@ -112,7 +113,7 @@ SCRIPT_PATH="/etc/xen/scripts"
#### Script Functions #####################################################
usage() {
# Gives hlep about usage parameters
# Gives help about usage parameters
echo "Usage: $0 {start|stop|restart|status}"
exit 1
}
@ -129,6 +130,8 @@ get_option() {
esac
}
. $SCRIPT_PATH/multinet-common.sh
make_config_dirs() {
# Create temporary storage directory if needed.
if ! [ -d "$NETWORK_SAVE_PATH" ]
@ -138,16 +141,13 @@ make_config_dirs() {
}
. $SCRIPT_PATH/multinet-common.sh
#***** Network Creation Main Function *************************************
create_networks() {
VIF_COUNT=0
for NETWORK in $NETWORK_LIST
do
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`
@ -204,7 +204,7 @@ run_prestart_scripts() {
echo "Running pre-start scripts"
echo
test -d $PLUGIN_DIR/pre-start || mkdir -p $PLUGIN_DIR/pre-start
if ls $PLUGIN_DIR/pre-start/*.sh > /dev/null 2&>1
if ls $PLUGIN_DIR/pre-start/*.sh > /dev/null 2>&1
then
for SCRIPT in `ls $PLUGIN_DIR/pre-start/*.sh`
do
@ -228,7 +228,7 @@ run_poststart_scripts() {
echo "Running post-start scripts"
echo
test -d $PLUGIN_DIR/post-start || mkdir -p $PLUGIN_DIR/post-start
if ls $PLUGIN_DIR/post-start/*.sh > /dev/null 2&>1
if ls $PLUGIN_DIR/post-start/*.sh > /dev/null 2>&1
then
for SCRIPT in `ls $PLUGIN_DIR/post-start/*.sh`
do
@ -253,7 +253,7 @@ run_prestop_scripts() {
echo "Running pre-stop scripts"
echo
test -d $PLUGIN_DIR/pre-stop || mkdir -p $PLUGIN_DIR/pre-stop
if ls $PLUGIN_DIR/pre-stop/*.sh > /dev/null 2&>1
if ls $PLUGIN_DIR/pre-stop/*.sh > /dev/null 2>&1
then
for SCRIPT in `ls $PLUGIN_DIR/pre-stop/*.sh`
do
@ -277,7 +277,7 @@ run_poststop_scripts() {
echo "Running post-stop scripts"
echo
test -d $PLUGIN_DIR/post-stop || mkdir -p $PLUGIN_DIR/post-stop
if ls $PLUGIN_DIR/post-stop/*.sh > /dev/null 2&>1
if ls $PLUGIN_DIR/post-stop/*.sh > /dev/null 2>&1
then
for SCRIPT in `ls $PLUGIN_DIR/post-stop/*.sh`
do

96
ns_tools.patch Normal file
View File

@ -0,0 +1,96 @@
Index: xen-3.2-testing/tools/python/xen/lowlevel/xc/xc.c
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/lowlevel/xc/xc.c
+++ xen-3.2-testing/tools/python/xen/lowlevel/xc/xc.c
@@ -632,14 +632,14 @@ static PyObject *pyxc_hvm_build(XcObject
int i;
#endif
char *image;
- int memsize, vcpus = 1, acpi = 0, apic = 1;
+ int memsize, vcpus = 1, acpi = 0, apic = 1, extid = 0;
static char *kwd_list[] = { "domid",
- "memsize", "image", "vcpus", "acpi",
+ "memsize", "image", "vcpus", "extid", "acpi",
"apic", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|iii", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|iiii", kwd_list,
&dom, &memsize,
- &image, &vcpus, &acpi, &apic) )
+ &image, &vcpus, &extid, &acpi, &apic) )
return NULL;
if ( xc_hvm_build(self->xc_handle, dom, memsize, image) != 0 )
@@ -664,6 +664,7 @@ static PyObject *pyxc_hvm_build(XcObject
va_hvm->checksum = -sum;
munmap(va_map, XC_PAGE_SIZE);
#endif
+ xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_EXTEND_HYPERVISOR, extid);
return Py_BuildValue("{}");
}
Index: xen-3.2-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-3.2-testing/tools/python/xen/xend/XendConfig.py
@@ -126,7 +126,7 @@ LEGACY_CFG_TO_XENAPI_CFG = reverse_dict(
# Platform configuration keys.
XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'boot', 'device_model', 'display',
'fda', 'fdb', 'keymap', 'isa', 'localtime', 'monitor',
- 'nographic', 'pae', 'rtc_timeoffset', 'serial', 'sdl',
+ 'nographic', 'pae', 'extid', 'rtc_timeoffset', 'serial', 'sdl',
'soundhw','stdvga', 'usb', 'usbdevice', 'hpet', 'vnc',
'vncconsole', 'vncdisplay', 'vnclisten', 'timer_mode',
'vncpasswd', 'vncunused', 'xauthority', 'pci', 'vhpt',
Index: xen-3.2-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/image.py
+++ xen-3.2-testing/tools/python/xen/xend/image.py
@@ -432,6 +432,7 @@ class HVMImageHandler(ImageHandler):
self.apic = int(vmConfig['platform'].get('apic', 0))
self.acpi = int(vmConfig['platform'].get('acpi', 0))
+ self.extid = int(vmConfig['platform'].get('extid', 0))
self.guest_os_type = vmConfig['platform'].get('guest_os_type')
# Return a list of cmd line args to the device models based on the
@@ -522,6 +523,7 @@ class HVMImageHandler(ImageHandler):
log.debug("store_evtchn = %d", store_evtchn)
log.debug("memsize = %d", mem_mb)
log.debug("vcpus = %d", self.vm.getVCpuCount())
+ log.debug("extid = %d", self.extid)
log.debug("acpi = %d", self.acpi)
log.debug("apic = %d", self.apic)
@@ -529,6 +531,7 @@ class HVMImageHandler(ImageHandler):
image = self.kernel,
memsize = mem_mb,
vcpus = self.vm.getVCpuCount(),
+ extid = self.extid,
acpi = self.acpi,
apic = self.apic)
rc['notes'] = { 'SUSPEND_CANCEL': 1 }
Index: xen-3.2-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xm/create.py
+++ xen-3.2-testing/tools/python/xen/xm/create.py
@@ -203,6 +203,10 @@ gopts.var('timer_mode', val='TIMER_MODE'
use="""Timer mode (0=delay virtual time when ticks are missed;
1=virtual time is always wallclock time.""")
+gopts.var('extid', val='EXTID',
+ fn=set_int, default=0,
+ use="Specify extention ID for a HVM domain.")
+
gopts.var('acpi', val='ACPI',
fn=set_int, default=1,
use="Disable or enable ACPI of HVM domain.")
@@ -729,7 +733,7 @@ def configure_vifs(config_devs, vals):
def configure_hvm(config_image, vals):
"""Create the config for HVM devices.
"""
- args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb', 'timer_mode',
+ args = [ 'device_model', 'pae', 'extid', 'vcpus', 'boot', 'fda', 'fdb', 'timer_mode',
'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',

425
ns_xen_base.patch Normal file
View File

@ -0,0 +1,425 @@
%patch
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
@@ -50,6 +50,7 @@
#include <asm/hvm/vpt.h>
#include <asm/hvm/trace.h>
#include <asm/hap.h>
+#include <asm/hvm/hvm_extensions.h>
u32 svm_feature_flags;
@@ -73,6 +74,7 @@ static void *hsa[NR_CPUS] __read_mostly;
/* vmcb used for extended host state */
static void *root_vmcb[NR_CPUS] __read_mostly;
+
static void inline __update_guest_eip(
struct cpu_user_regs *regs, unsigned int inst_len)
{
@@ -882,7 +884,7 @@ static struct hvm_function_table svm_fun
.set_tsc_offset = svm_set_tsc_offset,
.inject_exception = svm_inject_exception,
.init_hypercall_page = svm_init_hypercall_page,
- .event_pending = svm_event_pending
+ .event_pending = svm_event_pending,
};
int start_svm(struct cpuinfo_x86 *c)
@@ -1044,6 +1046,7 @@ static void svm_vmexit_do_cpuid(struct v
HVMTRACE_3D(CPUID, v, input,
((uint64_t)eax << 32) | ebx, ((uint64_t)ecx << 32) | edx);
+ ext_intercept_do_cpuid(input, regs);
inst_len = __get_instruction_length(v, INSTR_CPUID, NULL);
__update_guest_eip(regs, inst_len);
}
@@ -1739,6 +1742,11 @@ static void svm_do_msr_access(
/* is it a read? */
if (vmcb->exitinfo1 == 0)
{
+ if (ext_intercept_do_msr_read(ecx, regs))
+ {
+ goto done;
+ }
+
switch (ecx) {
case MSR_IA32_TSC:
msr_content = hvm_get_guest_time(v);
@@ -1829,6 +1837,11 @@ static void svm_do_msr_access(
}
else
{
+ if (ext_intercept_do_msr_write(ecx, regs))
+ {
+ goto done_1;
+ }
+
msr_content = (u32)regs->eax | ((u64)regs->edx << 32);
hvmtrace_msr_write(v, ecx, msr_content);
@@ -1889,6 +1902,7 @@ static void svm_do_msr_access(
}
break;
}
+done_1:
inst_len = __get_instruction_length(v, INSTR_WRMSR, NULL);
}
Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vmx.c
+++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vmx.c
@@ -50,6 +50,7 @@
#include <asm/hvm/vpt.h>
#include <public/hvm/save.h>
#include <asm/hvm/trace.h>
+#include <asm/hvm/hvm_extensions.h>
#include <asm/hap.h>
enum handler_return { HNDL_done, HNDL_unhandled, HNDL_exception_raised };
@@ -65,6 +66,7 @@ static void vmx_install_vlapic_mapping(s
static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr);
static void vmx_update_guest_efer(struct vcpu *v);
+
static int vmx_domain_initialise(struct domain *d)
{
if ( vmx_alloc_vpid(d) == 0 )
@@ -1362,7 +1364,8 @@ void vmx_cpuid_intercept(
unsigned int count = *ecx;
#ifdef VMXASSIST
- if ( input == 0x40000003 )
+ if (( input == 0x40000003 ) &&
+ (vmx_guest_x86_mode(current) == 0))
{
/*
* NB. Unsupported interface for private use of VMXASSIST only.
@@ -1443,12 +1446,13 @@ void vmx_cpuid_intercept(
static void vmx_do_cpuid(struct cpu_user_regs *regs)
{
- unsigned int eax, ebx, ecx, edx;
+ unsigned int eax, ebx, ecx, edx, input;
eax = regs->eax;
ebx = regs->ebx;
ecx = regs->ecx;
edx = regs->edx;
+ input = eax;
vmx_cpuid_intercept(&eax, &ebx, &ecx, &edx);
@@ -1456,6 +1460,7 @@ static void vmx_do_cpuid(struct cpu_user
regs->ebx = ebx;
regs->ecx = ecx;
regs->edx = edx;
+ ext_intercept_do_cpuid(input, regs);
}
#define CASE_GET_REG_P(REG, reg) \
@@ -2440,6 +2445,9 @@ static int vmx_do_msr_read(struct cpu_us
HVM_DBG_LOG(DBG_LEVEL_1, "ecx=%x", ecx);
+ if (ext_intercept_do_msr_read(ecx, regs))
+ goto done;
+
switch ( ecx )
{
case MSR_IA32_TSC:
@@ -2662,6 +2670,9 @@ static int vmx_do_msr_write(struct cpu_u
HVM_DBG_LOG(DBG_LEVEL_1, "ecx=%x, eax=%x, edx=%x",
ecx, (u32)regs->eax, (u32)regs->edx);
+ if (ext_intercept_do_msr_write(ecx, regs))
+ return 1;
+
msr_content = (u32)regs->eax | ((u64)regs->edx << 32);
hvmtrace_msr_write(v, ecx, msr_content);
Index: xen-3.2-testing/xen/include/asm-x86/hvm/domain.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/hvm/domain.h
+++ xen-3.2-testing/xen/include/asm-x86/hvm/domain.h
@@ -74,6 +74,10 @@ struct hvm_domain {
/* Pass-through */
struct hvm_iommu hvm_iommu;
+ /* Hvm extension handle */
+ void *ext_handle; /* will be NULL on creation (memset)*/
+ struct extension_intercept_vector *ext_vector;
+
};
#endif /* __ASM_X86_HVM_DOMAIN_H__ */
Index: xen-3.2-testing/xen/include/public/hvm/params.h
===================================================================
--- xen-3.2-testing.orig/xen/include/public/hvm/params.h
+++ xen-3.2-testing/xen/include/public/hvm/params.h
@@ -50,10 +50,12 @@
#define HVM_PARAM_BUFIOREQ_PFN 6
+#define HVM_PARAM_EXTEND_HYPERVISOR 7
+
#ifdef __ia64__
-#define HVM_PARAM_NVRAM_FD 7
-#define HVM_PARAM_VHPT_SIZE 8
-#define HVM_PARAM_BUFPIOREQ_PFN 9
+#define HVM_PARAM_NVRAM_FD 8
+#define HVM_PARAM_VHPT_SIZE 9
+#define HVM_PARAM_BUFPIOREQ_PFN 10
#endif
/*
@@ -75,7 +77,8 @@
* Missed interrupts are collapsed together and delivered as one 'late tick'.
* Guest time always tracks wallclock (i.e., real) time.
*/
-#define HVM_PARAM_TIMER_MODE 10
+//KYS Check the modifications done to this file
+#define HVM_PARAM_TIMER_MODE 11
#define HVM_PARAM_IDENT_PT 12
#define HVMPTM_delay_for_missed_ticks 0
#define HVMPTM_no_delay_for_missed_ticks 1
@@ -83,8 +86,8 @@
#define HVMPTM_one_missed_tick_pending 3
/* Boolean: Enable virtual HPET (high-precision event timer)? (x86-only) */
-#define HVM_PARAM_HPET_ENABLED 11
+#define HVM_PARAM_HPET_ENABLED 12
-#define HVM_NR_PARAMS 13
+#define HVM_NR_PARAMS 14
#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
Index: xen-3.2-testing/xen/arch/x86/hvm/Makefile
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/Makefile
+++ xen-3.2-testing/xen/arch/x86/hvm/Makefile
@@ -1,5 +1,6 @@
subdir-y += svm
subdir-y += vmx
+subdir-y += hvm_ext
obj-y += hvm.o
obj-y += i8254.o
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
@@ -42,6 +42,7 @@
#include <asm/mc146818rtc.h>
#include <asm/spinlock.h>
#include <asm/hvm/hvm.h>
+#include <asm/hvm/hvm_extensions.h>
#include <asm/hvm/vpt.h>
#include <asm/hvm/support.h>
#include <asm/hvm/cacheattr.h>
@@ -118,6 +119,7 @@ void hvm_migrate_timers(struct vcpu *v)
rtc_migrate_timers(v);
hpet_migrate_timers(v);
pt_migrate(v);
+ ext_intercept_do_migrate_timers(v);
}
void hvm_do_resume(struct vcpu *v)
@@ -281,6 +283,7 @@ void hvm_domain_relinquish_resources(str
void hvm_domain_destroy(struct domain *d)
{
+ ext_intercept_domain_destroy(d);
hvm_funcs.domain_destroy(d);
vioapic_deinit(d);
hvm_destroy_cacheattr_region_list(d);
@@ -449,8 +452,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
{
int rc;
+ if ((rc = ext_intercept_vcpu_initialize(v)) != 0)
+ goto fail1;
+
if ( (rc = vlapic_init(v)) != 0 )
+ {
+ ext_intercept_vcpu_destroy(v);
goto fail1;
+ }
if ( (rc = hvm_funcs.vcpu_initialise(v)) != 0 )
goto fail2;
@@ -498,12 +507,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
hvm_funcs.vcpu_destroy(v);
fail2:
vlapic_destroy(v);
+ ext_intercept_vcpu_destroy(v);
fail1:
return rc;
}
void hvm_vcpu_destroy(struct vcpu *v)
{
+ ext_intercept_vcpu_destroy(v);
vlapic_destroy(v);
hvm_funcs.vcpu_destroy(v);
@@ -1575,6 +1586,10 @@ int hvm_do_hypercall(struct cpu_user_reg
case 0:
break;
}
+ if (ext_intercept_do_hypercall(regs))
+ {
+ return HVM_HCALL_completed;
+ }
if ( (eax >= NR_hypercalls) || !hvm_hypercall32_table[eax] )
{
@@ -1729,6 +1744,7 @@ int hvm_bringup_ap(int vcpuid, int tramp
vcpu_wake(v);
gdprintk(XENLOG_INFO, "AP %d bringup succeeded.\n", vcpuid);
+ ext_intercept_vcpu_up(v);
return 0;
}
@@ -1966,6 +1982,9 @@ long do_hvm_op(unsigned long op, XEN_GUE
if ( a.value > HVMPTM_one_missed_tick_pending )
goto param_fail;
break;
+ case HVM_PARAM_EXTEND_HYPERVISOR:
+ if (hvm_ext_bind(d, (int)a.value))
+ goto param_fail;
}
d->arch.hvm_domain.params[a.index] = a.value;
rc = 0;
Index: xen-3.2-testing/xen/arch/x86/x86_64/asm-offsets.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/x86_64/asm-offsets.c
+++ xen-3.2-testing/xen/arch/x86/x86_64/asm-offsets.c
@@ -146,4 +146,7 @@ void __dummy__(void)
BLANK();
OFFSET(CPUINFO_ext_features, struct cpuinfo_x86, x86_capability[1]);
+ BLANK();
+
+ OFFSET(DOM_ext_vector, struct domain, arch.hvm_domain.ext_vector);
}
Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/x86_64/exits.S
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/x86_64/exits.S
+++ xen-3.2-testing/xen/arch/x86/hvm/vmx/x86_64/exits.S
@@ -112,6 +112,14 @@ vmx_process_softirqs:
ALIGN
ENTRY(vmx_asm_do_vmentry)
GET_CURRENT(%rbx)
+ mov VCPU_domain(%rbx),%rax
+ mov DOM_ext_vector(%rax),%rdx
+ test %rdx,%rdx
+ je vmx_no_ext_vector
+ sti
+ callq *(%rdx)
+vmx_no_ext_vector:
+
cli # tests must not race interrupts
movl VCPU_processor(%rbx),%eax
Index: xen-3.2-testing/xen/arch/x86/hvm/svm/x86_64/exits.S
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/svm/x86_64/exits.S
+++ xen-3.2-testing/xen/arch/x86/hvm/svm/x86_64/exits.S
@@ -37,6 +37,14 @@
ENTRY(svm_asm_do_resume)
GET_CURRENT(%rbx)
+ mov VCPU_domain(%rbx),%rax
+ mov DOM_ext_vector(%rax),%rdx
+ test %rdx,%rdx
+ je svm_no_ext_vector
+ sti
+ callq *(%rdx)
+svm_no_ext_vector:
+
CLGI
movl VCPU_processor(%rbx),%eax
Index: xen-3.2-testing/xen/arch/x86/hvm/save.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/save.c
+++ xen-3.2-testing/xen/arch/x86/hvm/save.c
@@ -23,6 +23,8 @@
#include <asm/hvm/support.h>
#include <public/hvm/save.h>
+#include <public/hvm/params.h>
+#include <asm/hvm/hvm_extensions.h>
void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
{
@@ -31,8 +33,7 @@ void arch_hvm_save(struct domain *d, str
/* Save some CPUID bits */
cpuid(1, &eax, &ebx, &ecx, &edx);
hdr->cpuid = eax;
-
- hdr->pad0 = 0;
+ hdr->ext_id = d->arch.hvm_domain.params[HVM_PARAM_EXTEND_HYPERVISOR];
}
int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
@@ -61,6 +62,9 @@ int arch_hvm_load(struct domain *d, stru
/* VGA state is not saved/restored, so we nobble the cache. */
d->arch.hvm_domain.stdvga.cache = 0;
+ d->arch.hvm_domain.params[HVM_PARAM_EXTEND_HYPERVISOR] = hdr->ext_id;
+ if (hvm_ext_bind(d, hdr->ext_id))
+ return -1;
return 0;
}
Index: xen-3.2-testing/xen/include/public/arch-x86/hvm/save.h
===================================================================
--- xen-3.2-testing.orig/xen/include/public/arch-x86/hvm/save.h
+++ xen-3.2-testing/xen/include/public/arch-x86/hvm/save.h
@@ -38,7 +38,7 @@ struct hvm_save_header {
uint32_t version; /* File format version */
uint64_t changeset; /* Version of Xen that saved this file */
uint32_t cpuid; /* CPUID[0x01][%eax] on the saving machine */
- uint32_t pad0;
+ uint32_t ext_id; /* extension ID */
};
DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header);
@@ -422,9 +422,30 @@ struct hvm_hw_mtrr {
DECLARE_HVM_SAVE_TYPE(MTRR, 14, struct hvm_hw_mtrr);
+struct hvm_ns_veridian_dom {
+ uint64_t guestid_msr;
+ uint64_t hypercall_msr;
+ uint32_t long_mode;
+ uint32_t pad0;
+};
+DECLARE_HVM_SAVE_TYPE(NS_VERIDIAN_DOM, 15, struct hvm_ns_veridian_dom);
+
+struct hvm_ns_veridian_cpu {
+ uint64_t control_msr;
+ uint64_t version_msr;
+ uint64_t sief_msr;
+ uint64_t simp_msr;
+ uint64_t eom_msr;
+ uint64_t int_msr[16];
+ struct {
+ uint64_t config;
+ uint64_t count;
+ } timers[4];
+};
+DECLARE_HVM_SAVE_TYPE(NS_VERIDIAN_CPU, 16, struct hvm_ns_veridian_cpu);
/*
* Largest type-code in use
*/
-#define HVM_SAVE_CODE_MAX 14
+#define HVM_SAVE_CODE_MAX 16
#endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */

4645
ns_xen_extension.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -24,3 +24,18 @@ Index: xen-3.2-testing/unmodified_drivers/linux-2.6/compat-include/xen/platform-
#define setup_xen_features xen_setup_features
#endif
Index: xen-3.2-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
===================================================================
--- xen-3.2-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
+++ xen-3.2-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
-#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, ...)
{

View File

@ -0,0 +1,39 @@
Index: xen-3.2-testing/tools/ioemu/hw/xenfb.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/hw/xenfb.c 2008-02-26 07:38:20.000000000 -0700
+++ xen-3.2-testing/tools/ioemu/hw/xenfb.c 2008-02-26 07:43:56.000000000 -0700
@@ -1103,6 +1103,25 @@
} \
}
+/* 32 bit to 16 bit pixel munging, dst algo came from RealVNC transInitTempl.h */
+#define BLT_32_16(SRC_T,DST_T,RRS,GRS,BRS,RLS,GLS,BLS,RIM,GIM,BIM,ROM,GOM,BOM) \
+ for (line = y ; line < h ; line++) { \
+ SRC_T *src = (SRC_T *)(xenfb->pixels \
+ + (line * xenfb->row_stride) \
+ + (x * xenfb->depth / 8)); \
+ DST_T *dst = (DST_T *)(xenfb->ds->data \
+ + (line * xenfb->ds->linesize) \
+ + (x * xenfb->ds->depth / 8)); \
+ int col; \
+ for (col = x ; col < w ; col++) { \
+ *dst = ((((*src >> RRS & RIM) * ROM + RIM/2) / RIM) << RLS) | \
+ ((((*src >> GRS & GIM) * GOM + GIM/2) / GIM) << GLS ) | \
+ ((((*src >> BRS & BIM) * BOM + BIM/2) / BIM) << BLS); \
+ src++; \
+ dst++; \
+ } \
+ }
+
/* This copies data from the guest framebuffer region, into QEMU's copy
* NB. QEMU's copy is stored in the pixel format of a) the local X
@@ -1139,7 +1158,7 @@
if (xenfb->ds->depth == 8) {
BLT(uint32_t, uint8_t, 16, 8, 0, 5, 2, 0, 255, 255, 255);
} else if (xenfb->ds->depth == 16) {
- BLT(uint32_t, uint16_t, 16, 8, 0, 11, 5, 0, 255, 255, 255);
+ BLT_32_16(uint32_t, uint16_t, 16, 8, 0, 11, 5, 0, 255, 255, 255, 31, 63, 31);
}
}
}

View File

@ -0,0 +1,24 @@
Index: xen-3.2-testing/tools/ioemu/hw/xen_platform.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/hw/xen_platform.c
+++ xen-3.2-testing/tools/ioemu/hw/xen_platform.c
@@ -57,6 +57,19 @@ static void platform_ioport_write(void *
net_tap_shutdown_all();
fprintf(logfile, "Done.\n");
break;
+ case 8:
+ if (val ==1 ) {
+ fprintf(logfile, "Disconnect IDE hard disk...\n");
+ ide_unplug_harddisks();
+ fprintf(logfile, "Done.\n");
+ } else if (val == 2) {
+ fprintf(logfile, "Disconnect netifs...\n");
+ pci_unplug_netifs();
+ fprintf(logfile, "Shutdown taps...\n");
+ net_tap_shutdown_all();
+ fprintf(logfile, "Done.\n");
+ }
+ break;
default:
fprintf(logfile, "Write to bad port %x (base %x) on evtchn device.\n",
addr, ioport_base);

View File

@ -1,85 +0,0 @@
[SVM] Greatly reduce total number of CR8 intercepts
This patch reduces the number of CR8 intercept to a fraction of the
number of CR8 intercepts without. First, CR8 read intercepts are
completely disabled since the SVM vTPR is kept kept in sync with the HVM
vLAPIC. Second, CR8 write intercepts are enabled and disabled based
upon certain conditions. Most of the time, CR8 write intercepts are
disabled. They are enabled only when there is a pending interrupt that
can't be delivered because of either the current ISR or TPR (aka PPR)
because this is the only time the TPR matters.
With this patch, the number of CR8 intercepts dropped from around
10,000,000 to around 6,000 during boot of Windows 2003 Server 64-bit
(this is a rough estimate).
Signed-off-by: Travis Betak <travis.betak@amd.com>
Index: xen-3.1-testing/xen/arch/x86/hvm/svm/intr.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/svm/intr.c
+++ xen-3.1-testing/xen/arch/x86/hvm/svm/intr.c
@@ -63,9 +63,20 @@ static inline int svm_inject_extint(stru
asmlinkage void svm_intr_assist(void)
{
struct vcpu *v = current;
+ struct vlapic *vlapic = vcpu_vlapic(v);
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
int intr_type = APIC_DM_EXTINT;
int intr_vector = -1;
+ vintr_t *intr = &vmcb->vintr;
+
+ /*
+ * Before doing anything else, we need to sync up the VLAPIC's TPR with
+ * SVM's vTPR if CR8 writes are currently disabled. It's OK if the
+ * guest doesn't touch the CR8 (e.g. 32-bit Windows) because we update
+ * the vTPR on MMIO writes to the TPR
+ */
+ if ( !(vmcb->cr_intercepts & CR_INTERCEPT_CR8_WRITE) )
+ vlapic_set_reg(vlapic, APIC_TASKPRI, (intr->fields.tpr & 0x0F) << 4);
/*
* Previous Interrupt delivery caused this intercept?
@@ -98,7 +109,22 @@ asmlinkage void svm_intr_assist(void)
pt_update_irq(v);
hvm_set_callback_irq_level();
if ( !cpu_has_pending_irq(v) )
+ {
+ /*
+ * Before we return, let's check if there is a pending interrupt
+ * that just happens to be blocked (either ISR or TPR aka PPR).
+ * Enable CR8 write intercepts in case the guest unmasks the
+ * pending interrupt.
+ */
+ if ( vlapic_enabled(vlapic)
+ && (vlapic_find_highest_irr(vlapic) != -1) )
+ vmcb->cr_intercepts |= CR_INTERCEPT_CR8_WRITE;
+
return;
+ }
+
+ /* It should be fairly safe to disable CR8 write intercepts here */
+ vmcb->cr_intercepts &= ~CR_INTERCEPT_CR8_WRITE;
/*
* If the guest can't take an interrupt right now, create a 'fake'
Index: xen-3.1-testing/xen/arch/x86/hvm/svm/vmcb.c
===================================================================
--- xen-3.1-testing.orig/xen/arch/x86/hvm/svm/vmcb.c
+++ xen-3.1-testing/xen/arch/x86/hvm/svm/vmcb.c
@@ -130,8 +130,13 @@ static int construct_vmcb(struct vcpu *v
/* Intercept all debug-register writes. */
vmcb->dr_intercepts = DR_INTERCEPT_ALL_WRITES;
- /* Intercept all control-register accesses, except to CR2. */
- vmcb->cr_intercepts = ~(CR_INTERCEPT_CR2_READ | CR_INTERCEPT_CR2_WRITE);
+ /*
+ * Intercept all control-register accesses except for CR2 reads/writes
+ * and CR8 reads (and actually CR8 writes, but that's a special case
+ * that's handled in svm/intr.c).
+ */
+ vmcb->cr_intercepts = ~(CR_INTERCEPT_CR2_READ | CR_INTERCEPT_CR2_WRITE
+ | CR_INTERCEPT_CR8_READ);
/* I/O and MSR permission bitmaps. */
arch_svm->msrpm = alloc_xenheap_pages(get_order_from_bytes(MSRPM_SIZE));

View File

@ -61,7 +61,7 @@
#
# Used by network-multinet v3.x only
#
NETWORK_LIST="bridge,0,default,default,dhcp-off nat,0,none,172.22.0.1/16,dhcp-off hostonly,0,none,172.23.0.1/16,dhcp-off empty,0,none,,"
NETWORK_LIST="bridge,0,default,default,dhcp-off hostonly,0,none,172.23.0.1/16,dhcp-off"
## Type: string(eth0,eth1,eth2,eth3)
## Default: "eth0"

View File

@ -48,7 +48,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1542,6 +1542,9 @@ class XendDomainInfo:
@@ -1556,6 +1556,9 @@ class XendDomainInfo:
if devclass in XendDevices.valid_devices():
log.info("createDevice: %s : %s" % (devclass, scrub_password(config)))
dev_uuid = config.get('uuid')

341
vpid-novell.patch Normal file
View File

@ -0,0 +1,341 @@
Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vmcs.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vmcs.c
+++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vmcs.c
@@ -38,6 +38,9 @@
#include <asm/shadow.h>
#include <asm/tboot.h>
+static int opt_vpid_enabled = 1;
+boolean_param("vpid", opt_vpid_enabled);
+
/* Dynamic (run-time adjusted) execution control flags. */
u32 vmx_pin_based_exec_control __read_mostly;
u32 vmx_cpu_based_exec_control __read_mostly;
@@ -110,6 +113,8 @@ static void vmx_init_vmcs_config(void)
opt2 = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
SECONDARY_EXEC_WBINVD_EXITING |
SECONDARY_EXEC_ENABLE_EPT;
+ if ( opt_vpid_enabled )
+ opt2 |= SECONDARY_EXEC_ENABLE_VPID;
_vmx_secondary_exec_control = adjust_vmx_controls(
min2, opt2, MSR_IA32_VMX_PROCBASED_CTLS2);
@@ -315,6 +320,8 @@ int vmx_cpu_up(void)
ept_sync_all();
+ vpid_sync_all();
+
return 1;
}
@@ -628,6 +635,13 @@ static int construct_vmcs(struct vcpu *v
#endif
}
+ if ( cpu_has_vmx_vpid )
+ {
+ v->arch.hvm_vmx.vpid = v->vcpu_id +
+ v->domain->arch.hvm_domain.vmx_vpid_base;
+ __vmwrite(VIRTUAL_PROCESSOR_ID, v->arch.hvm_vmx.vpid);
+ }
+
vmx_vmcs_exit(v);
paging_update_paging_modes(v); /* will update HOST & GUEST_CR3 as reqd */
@@ -821,6 +835,7 @@ void vmx_do_resume(struct vcpu *v)
vmx_load_vmcs(v);
hvm_migrate_timers(v);
vmx_set_host_env(v);
+ vpid_sync_vcpu_all(v);
}
debug_state = v->domain->debugger_attached;
@@ -975,6 +990,8 @@ void vmcs_dump_vcpu(struct vcpu *v)
(uint32_t)vmr(TPR_THRESHOLD));
printk("EPT pointer = 0x%08x%08x\n",
(uint32_t)vmr(EPT_POINTER_HIGH), (uint32_t)vmr(EPT_POINTER));
+ printk("virtual processor ID = 0x%04x\n",
+ (uint32_t)vmr(VIRTUAL_PROCESSOR_ID));
vmx_vmcs_exit(v);
}
Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vmx.c
+++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vmx.c
@@ -58,18 +58,23 @@ static void vmx_ctxt_switch_to(struct vc
static int vmx_alloc_vlapic_mapping(struct domain *d);
static void vmx_free_vlapic_mapping(struct domain *d);
+static int vmx_alloc_vpid(struct domain *d);
+static void vmx_free_vpid(struct domain *d);
static void vmx_install_vlapic_mapping(struct vcpu *v);
static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr);
static void vmx_update_guest_efer(struct vcpu *v);
static int vmx_domain_initialise(struct domain *d)
{
- return vmx_alloc_vlapic_mapping(d);
+ if ( vmx_alloc_vpid(d) == 0 )
+ return vmx_alloc_vlapic_mapping(d);
+ return -EBUSY;
}
static void vmx_domain_destroy(struct domain *d)
{
vmx_free_vlapic_mapping(d);
+ vmx_free_vpid(d);
}
static int vmx_vcpu_initialise(struct vcpu *v)
@@ -1122,6 +1127,7 @@ static void vmx_update_guest_cr(struct v
vmx_load_pdptrs(v);
}
__vmwrite(GUEST_CR3, v->arch.hvm_vcpu.hw_cr[3]);
+ vpid_sync_vcpu_all(v);
break;
case 4:
v->arch.hvm_vcpu.hw_cr[4] = HVM_CR4_HOST_MASK;
@@ -1170,9 +1176,14 @@ static void vmx_update_guest_efer(struct
static void vmx_flush_guest_tlbs(void)
{
- /* No tagged TLB support on VMX yet. The fact that we're in Xen
- * at all means any guest will have a clean TLB when it's next run,
- * because VMRESUME will flush it for us. */
+ /* If VPID (i.e. tagged TLB support) is not enabled, the fact that
+ * we're in Xen at all means any guest will have a clean TLB when
+ * it's next run, because VMRESUME will flush it for us.
+ *
+ * If enabled, we invalidate all translations associated with all
+ * VPID values */
+ if (0)
+ vpid_sync_all();
}
static void vmx_inject_exception(
@@ -1226,6 +1237,11 @@ static struct hvm_function_table vmx_fun
.cpu_down = vmx_cpu_down,
};
+static int vpid_bitmap_size;
+static int vpid_bitmap_bytes;
+static void *vpid_bitmap;
+static spinlock_t vpid_lock;
+
void start_vmx(void)
{
static int bootstrapped;
@@ -1265,6 +1281,26 @@ void start_vmx(void)
vmx_function_table.hap_supported = 1;
}
+ if ( cpu_has_vmx_vpid )
+ {
+ printk("VMX: VPID is available.\n");
+
+ vpid_bitmap_size = (1 << VMCS_VPID_WIDTH) / MAX_VIRT_CPUS;
+ vpid_bitmap_bytes = vpid_bitmap_size / (BITS_PER_LONG / BYTES_PER_LONG);
+ vpid_bitmap = xmalloc_bytes(vpid_bitmap_bytes);
+ memset(vpid_bitmap, 0, vpid_bitmap_bytes);
+ if ( vpid_bitmap == NULL )
+ {
+ printk("VMX: failed to allocate VPID bitmap.\n");
+ return;
+ }
+
+ /* vpid 0 is used by hypervisor itself */
+ set_bit(0, vpid_bitmap);
+
+ spin_lock_init(&vpid_lock);
+ }
+
setup_vmcs_dump();
hvm_enable(&vmx_function_table);
@@ -2534,6 +2570,45 @@ static void vmx_free_vlapic_mapping(stru
free_xenheap_page(mfn_to_virt(mfn));
}
+static int vmx_alloc_vpid(struct domain *d)
+{
+ int vpid;
+
+ if ( !cpu_has_vmx_vpid )
+ return 0;
+
+ spin_lock(&vpid_lock);
+
+ vpid = find_first_zero_bit(vpid_bitmap, vpid_bitmap_size);
+ if ( vpid >= vpid_bitmap_size )
+ {
+ spin_unlock(&vpid_lock);
+ printk("VPID is used up.\n");
+ return -EBUSY;
+ }
+ if ( test_and_set_bit(vpid, vpid_bitmap) )
+ {
+ spin_unlock(&vpid_lock);
+ printk("VPID allocation bug, fix your code!\n");
+ return -EBUSY;
+ }
+
+ spin_unlock(&vpid_lock);
+
+ d->arch.hvm_domain.vmx_vpid_base = vpid * MAX_VIRT_CPUS;
+ return 0;
+}
+
+static void vmx_free_vpid(struct domain *d)
+{
+ if ( !cpu_has_vmx_vpid )
+ return;
+
+ spin_lock(&vpid_lock);
+ clear_bit(d->arch.hvm_domain.vmx_vpid_base / MAX_VIRT_CPUS, vpid_bitmap);
+ spin_unlock(&vpid_lock);
+}
+
static void vmx_install_vlapic_mapping(struct vcpu *v)
{
paddr_t virt_page_ma, apic_page_ma;
Index: xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm/shadow/multi.c
+++ xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
@@ -35,6 +35,7 @@
#include <asm/hvm/hvm.h>
#include <asm/hvm/cacheattr.h>
#include <asm/mtrr.h>
+#include <asm/hvm/vmx/vmx.h>
#include "private.h"
#include "types.h"
@@ -3106,6 +3107,7 @@ sh_invlpg(struct vcpu *v, unsigned long
== SH_type_fl1_shadow )
{
flush_tlb_local();
+ vpid_sync_vcpu_all(v);
return 0;
}
Index: xen-3.2-testing/xen/include/asm-x86/hvm/domain.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/hvm/domain.h
+++ xen-3.2-testing/xen/include/asm-x86/hvm/domain.h
@@ -61,6 +61,7 @@ struct hvm_domain {
uint64_t params[HVM_NR_PARAMS];
unsigned long vmx_apic_access_mfn;
+ unsigned long vmx_vpid_base;
/* Memory ranges with pinned cache attributes. */
struct list_head pinned_cacheattr_ranges;
Index: xen-3.2-testing/xen/include/asm-x86/hvm/vmx/vmcs.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ xen-3.2-testing/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -90,6 +90,8 @@ struct arch_vmx_struct {
u32 exec_control;
u32 secondary_exec_control;
+ u16 vpid;
+
#ifdef __x86_64__
struct vmx_msr_state msr_state;
unsigned long shadow_gs;
@@ -156,6 +158,7 @@ extern u32 vmx_vmentry_control;
#define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001
#define SECONDARY_EXEC_ENABLE_EPT 0x00000002
+#define SECONDARY_EXEC_ENABLE_VPID 0x00000020
#define SECONDARY_EXEC_WBINVD_EXITING 0x00000040
extern u32 vmx_secondary_exec_control;
@@ -175,6 +178,8 @@ extern bool_t cpu_has_vmx_ins_outs_instr
(vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)
#define cpu_has_vmx_ept \
(vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
+#define cpu_has_vmx_vpid \
+ (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID)
/* GUEST_INTERRUPTIBILITY_INFO flags. */
#define VMX_INTR_SHADOW_STI 0x00000001
@@ -184,6 +189,7 @@ extern bool_t cpu_has_vmx_ins_outs_instr
/* VMCS field encodings. */
enum vmcs_field {
+ VIRTUAL_PROCESSOR_ID = 0x00000000,
GUEST_ES_SELECTOR = 0x00000800,
GUEST_CS_SELECTOR = 0x00000802,
GUEST_SS_SELECTOR = 0x00000804,
@@ -323,6 +329,8 @@ enum vmcs_field {
HOST_RIP = 0x00006c16,
};
+#define VMCS_VPID_WIDTH (16)
+
void vmx_disable_intercept_for_msr(struct vcpu *v, u32 msr);
int vmx_read_guest_msr(struct vcpu *v, u32 msr, u64 *val);
int vmx_write_guest_msr(struct vcpu *v, u32 msr, u64 val);
Index: xen-3.2-testing/xen/include/asm-x86/hvm/vmx/vmx.h
===================================================================
--- xen-3.2-testing.orig/xen/include/asm-x86/hvm/vmx/vmx.h
+++ xen-3.2-testing/xen/include/asm-x86/hvm/vmx/vmx.h
@@ -172,6 +172,7 @@ int vmx_realmode_io_complete(void);
#define VMRESUME_OPCODE ".byte 0x0f,0x01,0xc3\n"
#define VMWRITE_OPCODE ".byte 0x0f,0x79\n"
#define INVEPT_OPCODE ".byte 0x66,0x0f,0x38,0x80\n" /* m128,r64/32 */
+#define INVVPID_OPCODE ".byte 0x66,0x0f,0x38,0x81\n" /* m128,r64/32 */
#define VMXOFF_OPCODE ".byte 0x0f,0x01,0xc4\n"
#define VMXON_OPCODE ".byte 0xf3,0x0f,0xc7\n"
@@ -277,6 +278,23 @@ static inline void __invept(int ext, u64
: "memory");
}
+static inline void __invvpid(int ext, u16 vpid, u64 gva)
+{
+ struct {
+ u64 vpid:16;
+ u64 rsvd:48;
+ u64 gva;
+ } __attribute__ ((packed)) operand = {vpid, 0, gva};
+
+ __asm__ __volatile__ ( INVVPID_OPCODE
+ MODRM_EAX_08
+ /* CF==1 or ZF==1 --> rc = -1 */
+ "ja 1f ; ud2 ; 1:\n"
+ :
+ : "a" (&operand), "c" (ext)
+ : "memory");
+}
+
static inline void __vmxoff(void)
{
asm volatile (
@@ -329,6 +347,22 @@ static inline void ept_sync_all(void)
__invept(2, 0, 0);
}
+static inline void vpid_sync_vcpu_all(struct vcpu *v)
+{
+ if ( !cpu_has_vmx_vpid )
+ return;
+
+ __invvpid(1, v->arch.hvm_vmx.vpid, 0);
+}
+
+static inline void vpid_sync_all(void)
+{
+ if ( !cpu_has_vmx_vpid )
+ return;
+
+ __invvpid(2, 0, 0);
+}
+
static inline void __vmx_inject_exception(
struct vcpu *v, int trap, int type, int error_code)
{

View File

@ -101,7 +101,7 @@ Index: xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm/shadow/multi.c
+++ xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
@@ -4244,7 +4244,8 @@ sh_x86_emulate_cmpxchg(struct vcpu *v, u
@@ -4254,7 +4254,8 @@ sh_x86_emulate_cmpxchg(struct vcpu *v, u
return rv;
}
@ -111,7 +111,7 @@ Index: xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
sh_x86_emulate_cmpxchg8b(struct vcpu *v, unsigned long vaddr,
unsigned long old_lo, unsigned long old_hi,
unsigned long new_lo, unsigned long new_hi,
@@ -4280,6 +4281,7 @@ sh_x86_emulate_cmpxchg8b(struct vcpu *v,
@@ -4290,6 +4291,7 @@ sh_x86_emulate_cmpxchg8b(struct vcpu *v,
shadow_unlock(v->domain);
return rv;
}
@ -119,7 +119,7 @@ Index: xen-3.2-testing/xen/arch/x86/mm/shadow/multi.c
/**************************************************************************/
@@ -4566,7 +4568,9 @@ struct paging_mode sh_paging_mode = {
@@ -4576,7 +4578,9 @@ struct paging_mode sh_paging_mode = {
.shadow.detach_old_tables = sh_detach_old_tables,
.shadow.x86_emulate_write = sh_x86_emulate_write,
.shadow.x86_emulate_cmpxchg = sh_x86_emulate_cmpxchg,
@ -144,7 +144,7 @@ Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
#endif
#include <asm-x86/x86_emulate.h>
@@ -2978,60 +2981,64 @@ x86_emulate(
@@ -2986,60 +2989,64 @@ x86_emulate(
src.val = x86_seg_gs;
goto pop_seg;
@ -253,7 +253,7 @@ Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
case 0xc8 ... 0xcf: /* bswap */
dst.type = OP_REG;
@@ -3041,7 +3048,7 @@ x86_emulate(
@@ -3049,7 +3056,7 @@ x86_emulate(
{
default: /* case 2: */
/* Undefined behaviour. Writes zero on all tested CPUs. */

12
xen-api-auth.patch Normal file
View File

@ -0,0 +1,12 @@
diff -r 854b4e5a009f tools/python/xen/xend/XendAuthSessions.py
--- a/tools/python/xen/xend/XendAuthSessions.py Tue Feb 05 16:42:18 2008 -0700
+++ b/tools/python/xen/xend/XendAuthSessions.py Fri Feb 22 17:24:01 2008 -0700
@@ -84,7 +84,7 @@ class XendAuthSessions:
# if PAM doesn't exist, let's ignore it
return False
- pam_auth.start("login")
+ pam_auth.start("xen-api")
pam_auth.set_item(PAM.PAM_USER, username)
def _pam_conv(auth, query_list, user_data = None):

View File

@ -147,7 +147,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
from xen.xend.XendError import XendError, VmError
from xen.xend.XendDevices import XendDevices
from xen.xend.XendTask import XendTask
@@ -1498,6 +1498,10 @@ class XendDomainInfo:
@@ -1512,6 +1512,10 @@ class XendDomainInfo:
deviceClass, config = self.info['devices'].get(dev_uuid)
self._waitForDevice(deviceClass, config['devid'])
@ -158,7 +158,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
def _waitForDevice_destroy(self, deviceClass, devid, backpath):
return self.getDeviceController(deviceClass).waitForDevice_destroy(
devid, backpath)
@@ -2026,8 +2030,11 @@ class XendDomainInfo:
@@ -2050,8 +2054,11 @@ class XendDomainInfo:
blexec = osdep.pygrub_path
blcfg = None
@ -172,7 +172,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
if not disks:
msg = "Had a bootloader specified, but no disks are bootable"
@@ -2038,13 +2045,10 @@ class XendDomainInfo:
@@ -2062,13 +2069,10 @@ class XendDomainInfo:
devtype = devinfo[0]
disk = devinfo[1]['uname']
@ -189,7 +189,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
log.info("Mounting %s on %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))
@@ -2056,7 +2060,9 @@ class XendDomainInfo:
@@ -2080,7 +2084,9 @@ class XendDomainInfo:
from xen.xend import XendDomain
dom0 = XendDomain.instance().privilegedDomain()
@ -200,3 +200,12 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
fn = BOOTLOADER_LOOPBACK_DEVICE
try:
@@ -2091,7 +2097,7 @@ class XendDomainInfo:
log.info("Unmounting %s from %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))
- dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE)
+ dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE, rm_cfg = True)
if blcfg is None:
msg = "Had a bootloader specified, but can't find disk"

View File

@ -1,152 +1,8 @@
diff -r 15cfd1f8fa38 tools/ioemu/hw/xenfb.c
--- a/tools/ioemu/hw/xenfb.c Tue Jan 08 16:45:08 2008 +0000
+++ b/tools/ioemu/hw/xenfb.c Thu Jan 17 12:16:49 2008 -0700
@@ -8,6 +8,7 @@
#include <xen/io/fbif.h>
#include <xen/io/kbdif.h>
#include <xen/io/protocols.h>
+#include <xen/grant_table.h>
#include <stdbool.h>
#include <xen/event_channel.h>
#include <sys/mman.h>
@@ -45,6 +46,7 @@ struct xenfb {
struct xs_handle *xsh; /* xs daemon handle */
struct xenfb_device fb, kbd;
void *pixels; /* guest framebuffer data */
+ void *old_pixels; /* guest FB data before remapping to extended */
size_t fb_len; /* size of framebuffer */
int row_stride; /* width of one row in framebuffer */
int depth; /* colour depth of guest framebuffer */
@@ -52,7 +54,9 @@ struct xenfb {
int height; /* pixel height of guest framebuffer */
int abs_pointer_wanted; /* Whether guest supports absolute pointer */
int button_state; /* Last seen pointer button state */
- char protocol[64]; /* frontend protocol */
+ char protocol[64]; /* frontend protocol */
+ int otherend_bsize; /* frontend bit size */
+ int gnttabdev;
};
/* Functions for frontend/backend state machine*/
@@ -78,6 +82,9 @@ static void xenfb_invalidate(void *opaqu
static void xenfb_invalidate(void *opaque);
static void xenfb_screen_dump(void *opaque, const char *name);
static int xenfb_register_console(struct xenfb *xenfb);
+static int xenfb_send_resize(struct xenfb *xenfb, int width, int height);
+static void xenfb_map_extended_fb(struct xenfb *xenfb, int, int, int);
+static int xenfb_send_map_extended_done(struct xenfb *xenfb);
/*
* Tables to map from scancode to Linux input layer keycode.
@@ -261,9 +268,19 @@ struct xenfb *xenfb_new(int domid, Displ
if (!xenfb->xsh)
goto fail;
+ xenfb->gnttabdev = xc_gnttab_open();
+ if (xenfb->gnttabdev == -1) {
+ fprintf(stderr, "FB: Can't open gnttab device\n");
+ }
+
xenfb->ds = ds;
xenfb_device_set_domain(&xenfb->fb, domid);
xenfb_device_set_domain(&xenfb->kbd, domid);
+
+ /* Indicate we have the frame buffer resize feature, requires grant tables */
+ if (xenfb->gnttabdev > 0) {
+ xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "feature-resize", "1");
+ }
fprintf(stderr, "FB: Waiting for KBD backend creation\n");
xenfb_wait_for_backend(&xenfb->kbd, xenfb_backend_created_kbd);
@@ -320,6 +337,58 @@ static void xenfb_copy_mfns(int mode, in
for (i = 0; i < count; i++)
dst[i] = (mode == 32) ? src32[i] : src64[i];
+}
+
+static void xenfb_map_extended_fb(struct xenfb *xenfb, int extended_mem_length,
+ int gref_cnt, int gref)
+{
+ int n_fbmfns;
+ unsigned long *fbmfns = NULL;
+ void *page;
+ int i;
+ int ep_gref;
+ int amt;
+ int index;
+ void *pixels;
+ int *grefs;
+
+ grefs = xc_gnttab_map_grant_ref (xenfb->gnttabdev,
+ xenfb->fb.otherend_id,
+ gref, 0);
+ if (NULL == grefs) {
+ fprintf(stderr,"FB: Can't map to grant refs\n");
+ return;
+ }
+ n_fbmfns = (extended_mem_length + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE;
+ fbmfns = malloc(sizeof(unsigned long) * n_fbmfns);
+ if (fbmfns) {
+ ep_gref = PAGE_SIZE/(xenfb->otherend_bsize/8);
+ amt = index = 0;
+ for(i = 0; i < gref_cnt; i++) {
+ page = xc_gnttab_map_grant_ref (xenfb->gnttabdev,
+ xenfb->fb.otherend_id,
+ grefs[i], 0);
+ if (page) {
+ index = i * ep_gref;
+ amt = ep_gref;
+ if (n_fbmfns - index < ep_gref)
+ amt = n_fbmfns - index;
+ xenfb_copy_mfns(xenfb->otherend_bsize, amt, &fbmfns[index], page);
+ xc_gnttab_munmap(xenfb->gnttabdev, page, 1);
+ }
+ else
+ goto gref_error;
+ }
+ pixels = xc_map_foreign_pages(xenfb->xc, xenfb->fb.otherend_id,
+ PROT_READ | PROT_WRITE, fbmfns, n_fbmfns);
+ if (pixels) {
+ xenfb->old_pixels = xenfb->pixels;
+ xenfb->pixels = pixels;
+ }
+ free(fbmfns);
+ }
+gref_error:
+ xc_gnttab_munmap(xenfb->gnttabdev, grefs, 1);
}
static int xenfb_map_fb(struct xenfb *xenfb, int domid)
@@ -377,6 +446,7 @@ static int xenfb_map_fb(struct xenfb *xe
#endif
}
+ xenfb->otherend_bsize = mode;
n_fbmfns = (xenfb->fb_len + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE;
n_fbdirs = n_fbmfns * mode / 8;
n_fbdirs = (n_fbdirs + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE;
@@ -456,6 +526,10 @@ static void xenfb_detach_dom(struct xenf
munmap(xenfb->pixels, xenfb->fb_len);
xenfb->pixels = NULL;
}
+ if (xenfb->old_pixels) {
+ munmap(xenfb->old_pixels, xenfb->fb_len);
+ xenfb->old_pixels = NULL;
+ }
}
/* Remove the backend area in xenbus since the framebuffer really is
@@ -473,6 +547,9 @@ void xenfb_shutdown(struct xenfb *xenfb)
xc_evtchn_close(xenfb->evt_xch);
if (xenfb->xsh)
xs_daemon_close(xenfb->xsh);
+ if (xenfb->gnttabdev > 0)
+ xc_gnttab_close(xenfb->gnttabdev);
+
free(xenfb);
}
@@ -510,6 +587,22 @@ static void xenfb_on_fb_event(struct xen
Index: xen-3.2-testing/tools/ioemu/hw/xenfb.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/hw/xenfb.c
+++ xen-3.2-testing/tools/ioemu/hw/xenfb.c
@@ -510,6 +510,12 @@ static void xenfb_on_fb_event(struct xen
}
xenfb_guest_copy(xenfb, x, y, w, h);
break;
@ -155,98 +11,60 @@ diff -r 15cfd1f8fa38 tools/ioemu/hw/xenfb.c
+ xenfb->height = event->resize.height;
+ xenfb->row_stride = event->resize.stride;
+ dpy_resize(xenfb->ds, xenfb->width, xenfb->height);
+ xenfb_send_resize(xenfb, xenfb->width, xenfb->height);
+ break;
+ case XENFB_TYPE_MAP_EXTENDED:
+ if (xenfb->gnttabdev > 0) {
+ xenfb_map_extended_fb(xenfb,
+ event->map_extended.extended_mem_length,
+ event->map_extended.gref_cnt,
+ event->map_extended.gref);
+ }
+ xenfb_send_map_extended_done(xenfb);
+ break;
}
}
mb(); /* ensure we're done with ring contents */
@@ -555,6 +648,41 @@ static int xenfb_on_state_change(struct
return 0;
}
@@ -672,6 +678,7 @@ static void xenfb_dispatch_store(void *o
static int xenfb_read_frontend_fb_config(struct xenfb *xenfb) {
struct xenfb_page *fb_page;
int val;
+ int videoram;
+/* Send an event to the framebuffer frontend driver */
+static int xenfb_fb_event(struct xenfb *xenfb,
+ union xenfb_in_event *event)
+{
+ uint32_t prod;
+ struct xenfb_page *page = xenfb->fb.page;
+
+ if (xenfb->fb.state != XenbusStateConnected)
+ return 0;
+
+ prod = page->in_prod;
+ if (prod - page->in_cons == XENFB_IN_RING_LEN) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ mb(); /* ensure ring space available */
+ XENFB_IN_RING_REF(page, prod) = *event;
+ wmb(); /* ensure ring contents visible */
+ page->in_prod = prod + 1;
+ return xc_evtchn_notify(xenfb->evt_xch, xenfb->fb.port);
+}
+
+/* Send a extended memory map done event to kbd driver */
+static int xenfb_send_map_extended_done(struct xenfb *xenfb)
+{
+ union xenfb_in_event event;
+
+ memset(&event, 0, XENFB_IN_EVENT_SIZE);
+ event.type = XENFB_TYPE_MAP_EXTENDED_DONE;
+
+ return xenfb_fb_event(xenfb, &event);
+}
+
+
/* Send an event to the keyboard frontend driver */
static int xenfb_kbd_event(struct xenfb *xenfb,
union xenkbd_in_event *event)
@@ -601,6 +729,19 @@ static int xenfb_send_motion(struct xenf
event.motion.rel_x = rel_x;
event.motion.rel_y = rel_y;
event.motion.rel_z = rel_z;
+
+ return xenfb_kbd_event(xenfb, &event);
+}
+
+/* Send a resize event to kbd driver */
+static int xenfb_send_resize(struct xenfb *xenfb, int width, int height)
+{
+ union xenkbd_in_event event;
+
+ memset(&event, 0, XENKBD_IN_EVENT_SIZE);
+ event.type = XENKBD_TYPE_FBRESIZE;
+ event.fbresize.width = width;
+ event.fbresize.height = height;
if (xenfb_xs_scanf1(xenfb->xsh, xenfb->fb.otherend, "feature-update",
"%d", &val) < 0)
@@ -686,19 +693,34 @@ static int xenfb_read_frontend_fb_config
xenfb->protocol[0] = '\0';
xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "request-update", "1");
return xenfb_kbd_event(xenfb, &event);
}
diff -r 15cfd1f8fa38 xen/include/public/io/fbif.h
--- a/xen/include/public/io/fbif.h Tue Jan 08 16:45:08 2008 +0000
+++ b/xen/include/public/io/fbif.h Thu Jan 17 08:16:28 2008 -0700
@@ -29,8 +29,9 @@
/* Out events (frontend -> backend) */
- /* TODO check for permitted ranges */
+ if (xenfb_xs_scanf1(xenfb->xsh, xenfb->fb.nodename, "videoram", "%d", &videoram) < 0)
+ videoram = 0;
+ videoram = videoram * 1024 * 1024;
+
fb_page = xenfb->fb.page;
xenfb->depth = fb_page->depth;
xenfb->width = fb_page->width;
xenfb->height = fb_page->height;
- /* TODO check for consistency with the above */
xenfb->fb_len = fb_page->mem_length;
xenfb->row_stride = fb_page->line_length;
+ /* Protect against hostile frontend, limit fb_len to configured */
+ if (videoram && xenfb->fb_len > videoram) {
+ xenfb->fb_len = videoram;
+ if (xenfb->row_stride * xenfb->height > xenfb->fb_len)
+ xenfb->height = xenfb->fb_len / xenfb->row_stride;
+ }
fprintf(stderr, "Framebuffer depth %d width %d height %d line %d\n",
fb_page->depth, fb_page->width, fb_page->height, fb_page->line_length);
if (xenfb_map_fb(xenfb, xenfb->fb.otherend_id) < 0)
return -1;
/*
- * Out events may be sent only when requested by backend, and receipt
- * of an unknown out event is an error.
+ * Out event update is sent only when requested by backend
+ * Events resize and map_extended are frontend generated
+ * It is an error to send any unknown event types
*/
/* Event type 1 currently not used */
@@ -50,12 +51,44 @@ struct xenfb_update
+ /* Indicate we have the frame buffer resize feature */
+ xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "feature-resize", "1");
+
+ /* Tell kbd the screen res */
+ xenfb_xs_printf(xenfb->xsh, xenfb->kbd.nodename, "width", "%d", xenfb->width);
+ xenfb_xs_printf(xenfb->xsh, xenfb->kbd.nodename, "height", "%d", xenfb->height);
+
if (xenfb_switch_state(&xenfb->fb, XenbusStateConnected))
return -1;
if (xenfb_switch_state(&xenfb->kbd, XenbusStateConnected))
Index: xen-3.2-testing/xen/include/public/io/fbif.h
===================================================================
--- xen-3.2-testing.orig/xen/include/public/io/fbif.h
+++ xen-3.2-testing/xen/include/public/io/fbif.h
@@ -50,12 +50,28 @@ struct xenfb_update
int32_t height; /* rect height */
};
@ -261,23 +79,8 @@ diff -r 15cfd1f8fa38 xen/include/public/io/fbif.h
+ uint8_t type; /* XENFB_TYPE_RESIZE */
+ int32_t width; /* width in pixels */
+ int32_t height; /* height in pixels */
+ int32_t stride; /* stride in pixels */
+ int32_t depth; /* future */
+};
+
+/*
+ * Framebuffer map extended memory event
+ * Causes backend to map extended frame buffer memory
+ * for larger screen resolution support
+ */
+#define XENFB_TYPE_MAP_EXTENDED 4
+
+struct xenfb_map_extended
+{
+ uint8_t type; /* XENFB_TYPE_MAP_EXTENDED */
+ int32_t extended_mem_length; /* extended frame buffer len (in bytes) */
+ int32_t gref_cnt; /* number of mapping refernces used */
+ int32_t gref; /* reference to mapping references */
+ int32_t stride; /* stride in bytes */
+ int32_t depth; /* depth in bits */
+};
+
#define XENFB_OUT_EVENT_SIZE 40
@ -287,84 +90,66 @@ diff -r 15cfd1f8fa38 xen/include/public/io/fbif.h
uint8_t type;
struct xenfb_update update;
+ struct xenfb_resize resize;
+ struct xenfb_map_extended map_extended;
char pad[XENFB_OUT_EVENT_SIZE];
};
@@ -63,14 +96,26 @@ union xenfb_out_event
/*
* Frontends should ignore unknown in events.
- * No in events currently defined.
*/
+
+/*
+ * Framebuffer map extended memory done event
+ * Causes fronted to end foreign access to extended memory
+ * grant table references
+ */
+#define XENFB_TYPE_MAP_EXTENDED_DONE 1
+
+struct xenfb_map_extended_done
+{
+ uint8_t type; /* XENFB_TYPE_MAP_EXTENDED_DONE */
+};
#define XENFB_IN_EVENT_SIZE 40
union xenfb_in_event
{
uint8_t type;
+ struct xenfb_map_extended_done map_extended_done;
char pad[XENFB_IN_EVENT_SIZE];
};
@@ -116,8 +161,9 @@ struct xenfb_page
@@ -109,15 +125,17 @@ struct xenfb_page
* Each directory page holds PAGE_SIZE / sizeof(*pd)
* framebuffer pages, and can thus map up to PAGE_SIZE *
* PAGE_SIZE / sizeof(*pd) bytes. With PAGE_SIZE == 4096 and
- * sizeof(unsigned long) == 4, that's 4 Megs. Two directory
- * pages should be enough for a while.
+ * sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2 Megs
+ * 64 bit. 256 directories give enough room for a 512 Meg
+ * framebuffer with a max resolution of 12,800x10,240. Should
+ * be enough for a while with room leftover for expansion.
*/
- unsigned long pd[2];
+ unsigned long pd[256];
};
/*
- * Wart: xenkbd needs to know resolution. Put it here until a better
- * solution is found, but don't leak it to the backend.
+ * Wart: xenkbd needs to know resolution of initial frame buffer. Put
+ * it here until a better solution is found, but don't leak it to
+ * the backend.
+ * Wart: xenkbd needs to know default resolution. Put it here until a
+ * better solution is found, but don't leak it to the backend.
*/
#ifdef __KERNEL__
#define XENFB_WIDTH 800
diff -r 15cfd1f8fa38 xen/include/public/io/kbdif.h
--- a/xen/include/public/io/kbdif.h Tue Jan 08 16:45:08 2008 +0000
+++ b/xen/include/public/io/kbdif.h Thu Jan 17 10:43:35 2008 -0700
@@ -44,6 +44,12 @@
* request-abs-update in xenstore.
*/
#define XENKBD_TYPE_POS 4
+/*
+ * Frame buffer resize event. Adjusts absolute max X and Y axis
+ * values in input ptr device. Necessary for proper scaling
+ * when the screen resolution changes
+ */
+#define XENKBD_TYPE_FBRESIZE 5
Index: xen-3.2-testing/tools/python/xen/xend/server/vfbif.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/server/vfbif.py
+++ xen-3.2-testing/tools/python/xen/xend/server/vfbif.py
@@ -6,7 +6,7 @@ import xen.xend
import os
struct xenkbd_motion
{
@@ -68,6 +74,12 @@ struct xenkbd_position
int32_t abs_z; /* absolute Z position (wheel) */
};
CONFIG_ENTRIES = ['type', 'vncdisplay', 'vnclisten', 'vncpasswd', 'vncunused',
- 'display', 'xauthority', 'keymap',
+ 'videoram', 'display', 'xauthority', 'keymap',
'uuid', 'location', 'protocol']
+struct xenkbd_fbresize
+{
+ uint8_t type; /* XENKBD_TYPE_FBRESIZE */
+ int32_t width; /* frame buffer width in pixels */
+ int32_t height; /* frame buffer height in pixels */
+};
#define XENKBD_IN_EVENT_SIZE 40
union xenkbd_in_event
@@ -76,6 +88,7 @@ union xenkbd_in_event
struct xenkbd_motion motion;
struct xenkbd_key key;
struct xenkbd_position pos;
+ struct xenkbd_fbresize fbresize;
char pad[XENKBD_IN_EVENT_SIZE];
};
class VfbifController(DevController):
Index: xen-3.2-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xm/create.py
+++ xen-3.2-testing/tools/python/xen/xm/create.py
@@ -496,6 +496,10 @@ gopts.var('vncunused', val='',
use="""Try to find an unused port for the VNC server.
Only valid when vnc=1.""")
+gopts.var('videoram', val='',
+ fn=set_value, default=None,
+ use="""Amount of videoram PV guest can allocate for frame buffer.""")
+
gopts.var('sdl', val='',
fn=set_value, default=None,
use="""Should the device model use SDL?""")
@@ -626,7 +630,7 @@ def configure_vfbs(config_devs, vals):
d['type'] = 'sdl'
for (k,v) in d.iteritems():
if not k in [ 'vnclisten', 'vncunused', 'vncdisplay', 'display',
- 'xauthority', 'type', 'vncpasswd' ]:
+ 'videoram', 'xauthority', 'type', 'vncpasswd' ]:
err("configuration option %s unknown to vfbs" % k)
config.append([k,v])
if not d.has_key("keymap"):

View File

@ -44,7 +44,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/image.py
+++ xen-3.2-testing/tools/python/xen/xend/image.py
@@ -485,13 +485,16 @@ class HVMImageHandler(ImageHandler):
@@ -491,13 +491,16 @@ class HVMImageHandler(ImageHandler):
mac = devinfo.get('mac')
if mac is None:
raise VmError("MAC address not specified or generated.")

View File

@ -4,7 +4,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/image.py
+++ xen-3.2-testing/tools/python/xen/xend/image.py
@@ -580,7 +580,7 @@ class X86_HVM_ImageHandler(HVMImageHandl
@@ -586,7 +586,7 @@ class X86_HVM_ImageHandler(HVMImageHandl
def configure(self, vmConfig):
HVMImageHandler.configure(self, vmConfig)

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/tools/ioemu/hw/ide.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/hw/ide.c
+++ xen-3.2-testing/tools/ioemu/hw/ide.c
@@ -394,6 +394,9 @@ typedef struct PCIIDEState {
@@ -395,6 +395,9 @@ typedef struct PCIIDEState {
int type; /* see IDE_TYPE_xxx */
} PCIIDEState;
@ -12,7 +12,7 @@ Index: xen-3.2-testing/tools/ioemu/hw/ide.c
#if defined(__ia64__)
#include <xen/hvm/ioreq.h>
@@ -2237,6 +2240,27 @@ static void ide_reset(IDEState *s)
@@ -2245,6 +2248,27 @@ static void ide_reset(IDEState *s)
ide_dummy_transfer_stop(s);
}
@ -40,7 +40,7 @@ Index: xen-3.2-testing/tools/ioemu/hw/ide.c
struct partition {
uint8_t boot_ind; /* 0x80 - active */
uint8_t head; /* starting head */
@@ -2638,6 +2662,9 @@ void pci_cmd646_ide_init(PCIBus *bus, Bl
@@ -2646,6 +2670,9 @@ void pci_cmd646_ide_init(PCIBus *bus, Bl
sizeof(PCIIDEState),
-1,
NULL, NULL);
@ -50,12 +50,22 @@ Index: xen-3.2-testing/tools/ioemu/hw/ide.c
d->type = IDE_TYPE_CMD646;
pci_conf = d->dev.config;
pci_conf[0x00] = 0x95; // CMD646
@@ -2812,6 +2839,9 @@ void pci_piix_ide_init(PCIBus *bus, Bloc
@@ -2820,6 +2847,9 @@ void pci_piix_ide_init(PCIBus *bus, Bloc
NULL, NULL);
d->type = IDE_TYPE_PIIX3;
+ if (principal_ide_controller)
+ abort();
+ principal_ide_controller = d;
pci_conf = d->dev.config;
pci_conf[0x00] = 0x86; // Intel
pci_conf[0x01] = 0x80;
@@ -2866,6 +2896,9 @@ void pci_piix3_ide_init(PCIBus *bus, Blo
NULL, NULL);
d->type = IDE_TYPE_PIIX3;
+ if (principal_ide_controller)
+ abort();
+ principal_ide_controller = d;
pci_conf = d->dev.config;
pci_conf[0x00] = 0x86; // Intel
@ -64,7 +74,7 @@ Index: xen-3.2-testing/tools/ioemu/hw/pci.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/hw/pci.c
+++ xen-3.2-testing/tools/ioemu/hw/pci.c
@@ -571,6 +571,28 @@ void pci_nic_init(PCIBus *bus, NICInfo *
@@ -573,6 +573,28 @@ void pci_nic_init(PCIBus *bus, NICInfo *
}
}
@ -97,20 +107,17 @@ Index: xen-3.2-testing/tools/ioemu/hw/xen_platform.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/hw/xen_platform.c
+++ xen-3.2-testing/tools/ioemu/hw/xen_platform.c
@@ -28,10 +28,47 @@
@@ -23,15 +23,53 @@
* THE SOFTWARE.
*/
#include "vl.h"
+#include <xc_private.h>
#include <xenguest.h>
extern FILE *logfile;
+static uint32_t ioport_base;
+
static void platform_ioport_map(PCIDevice *pci_dev, int region_num,
uint32_t addr, uint32_t size, int type)
{
- /* nothing yet */
+ ioport_base = addr;
+
+ register_ioport_write(addr, 1, 1, platform_ioport_write, NULL);
+}
+
+static void platform_ioport_write(void *opaque, uint32_t addr, uint32_t val)
+{
@ -143,6 +150,15 @@ Index: xen-3.2-testing/tools/ioemu/hw/xen_platform.c
+ addr, ioport_base);
+ break;
+ }
+}
+
static void platform_ioport_map(PCIDevice *pci_dev, int region_num,
uint32_t addr, uint32_t size, int type)
{
- /* nothing yet */
+ ioport_base = addr;
+
+ register_ioport_write(addr, 16, 4, platform_ioport_write, NULL);
}
static uint32_t platform_mmio_read(void *opaque, target_phys_addr_t addr)
@ -150,7 +166,7 @@ Index: xen-3.2-testing/tools/ioemu/vl.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/vl.c
+++ xen-3.2-testing/tools/ioemu/vl.c
@@ -194,6 +194,19 @@ int xc_handle;
@@ -197,6 +197,20 @@ int xc_handle;
char domain_name[64] = "Xen-no-name";
extern int domid;
@ -159,6 +175,7 @@ Index: xen-3.2-testing/tools/ioemu/vl.c
+ IOCanRWHandler *fd_read_poll;
+ IOHandler *fd_read;
+ IOHandler *fd_write;
+ int deleted;
+ void *opaque;
+ /* temporary data */
+ struct pollfd *ufd;
@ -170,7 +187,7 @@ Index: xen-3.2-testing/tools/ioemu/vl.c
/***********************************************************/
/* x86 ISA bus support */
@@ -3333,6 +3346,7 @@ void net_slirp_smb(const char *exported_
@@ -3404,6 +3418,7 @@ void net_slirp_smb(const char *exported_
typedef struct TAPState {
VLANClientState *vc;
int fd;
@ -178,7 +195,7 @@ Index: xen-3.2-testing/tools/ioemu/vl.c
} TAPState;
static void tap_receive(void *opaque, const uint8_t *buf, int size)
@@ -3360,6 +3374,36 @@ static void tap_send(void *opaque)
@@ -3431,6 +3446,36 @@ static void tap_send(void *opaque)
}
}
@ -215,7 +232,7 @@ Index: xen-3.2-testing/tools/ioemu/vl.c
/* fd support */
static TAPState *net_tap_fd_init(VLANState *vlan, int fd)
@@ -3371,6 +3415,8 @@ static TAPState *net_tap_fd_init(VLANSta
@@ -3442,6 +3487,8 @@ static TAPState *net_tap_fd_init(VLANSta
return NULL;
s->fd = fd;
s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s);
@ -224,7 +241,7 @@ Index: xen-3.2-testing/tools/ioemu/vl.c
qemu_set_fd_handler(s->fd, tap_send, NULL, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", fd);
return s;
@@ -4332,20 +4378,6 @@ void dumb_display_init(DisplayState *ds)
@@ -4412,20 +4459,6 @@ void dumb_display_init(DisplayState *ds)
#define MAX_IO_HANDLERS 64
@ -249,7 +266,7 @@ Index: xen-3.2-testing/tools/ioemu/vl.h
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/vl.h
+++ xen-3.2-testing/tools/ioemu/vl.h
@@ -1492,6 +1492,8 @@ void kqemu_record_dump(void);
@@ -1497,6 +1497,8 @@ void kqemu_record_dump(void);
extern char domain_name[];
void destroy_hvm_domain(void);

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xm/create.py
+++ xen-3.2-testing/tools/python/xen/xm/create.py
@@ -886,9 +886,8 @@ def preprocess_access_control(vals):
@@ -892,9 +892,8 @@ def preprocess_access_control(vals):
def preprocess_ip(vals):
if vals.ip or vals.dhcp != 'off':

View File

@ -0,0 +1,13 @@
Index: xen-3.2-testing/tools/blktap/drivers/block-qcow.c
===================================================================
--- xen-3.2-testing.orig/tools/blktap/drivers/block-qcow.c
+++ xen-3.2-testing/tools/blktap/drivers/block-qcow.c
@@ -1223,7 +1223,7 @@ int qcow_create(const char *filename, ui
int shift, length, adjust, flags = 0, ret = 0;
QCowHeader header;
QCowHeader_ext exthdr;
- char backing_filename[1024], *ptr;
+ char backing_filename[PATH_MAX], *ptr;
uint64_t tmp, size, total_length;
struct stat st;

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xm/create.py
+++ xen-3.2-testing/tools/python/xen/xm/create.py
@@ -980,8 +980,7 @@ def spawn_vnc(display):
@@ -986,8 +986,7 @@ def spawn_vnc(display):
returns the port that the vncviewer is listening on and sets the global
vncpid. On failure, returns 0. Note that vncviewer is daemonized.
"""

View File

@ -142,7 +142,7 @@ Index: xen-3.2-testing/docs/man/xmdomain.cfg.pod.5
many Linux distros you will not need a ramdisk if using the default
xen kernel.
@@ -307,14 +307,14 @@ configured. They should not be consider
@@ -323,14 +323,14 @@ configured. They should not be consider
=item I<A Loopback File as Root>

View File

@ -1,24 +1,115 @@
-------------------------------------------------------------------
Fri Feb 29 09:58:06 MST 2008 - carnold@novell.com
- bnc#357966 - VT-D dosen't work for HVM guest.
-------------------------------------------------------------------
Fri Feb 29 08:35:11 MST 2008 - plc@novell.com
- Send UNIT_ATTENTION when CD drive has newly inserted media and
becomes ready. bnc#365386
-------------------------------------------------------------------
Thu Feb 28 16:42:16 MST 2008 - jfehlig@novell.com
- Updated block-iscsi script and xen-domUloader patch, bnc #365385
-------------------------------------------------------------------
Thu Feb 28 11:34:52 MST 2008 - carnold@novell.com
- Add support for Intel EPT / VPID.
-------------------------------------------------------------------
Tue Feb 26 14:12:17 MST 2008 - carnold@novell.com
- bnc#362415 - SLE-based installs 32-bit fully-virtualized have
network problems during installs.
- bnc#358244 - Time remaining does not change properly for FV SLES10
SP2 guest.
- bnc#363053 - Install remaining time always shows 2:00:00
-------------------------------------------------------------------
Tue Feb 26 10:37:11 MST 2008 - carnold@novell.com
- bnc#359457 - Xen full virt has data integrity issue.
-------------------------------------------------------------------
Tue Feb 26 08:34:17 MST 2008 - plc@novell.com
- Tranlate colors from 32 bit to 16 bit when viewing a 32 bit PV
VM from a 16 bit client. bnc#351470
Also includes upstream mouse queue patch.
-------------------------------------------------------------------
Fri Feb 22 17:57:38 MST 2008 - jfehlig@novell.com
- Added PAM configuration files for remote authentication via
Xen API. bnc #353464
-------------------------------------------------------------------
Tue Feb 19 13:22:32 MST 2008 - carnold@novell.com
- Fix PV drivers for HVM guests.
-------------------------------------------------------------------
Fri Feb 15 14:08:35 MST 2008 - carnold@novell.com
- Support for pxe booting fully virtualized guests in vm-install is
complete.
-------------------------------------------------------------------
Thu Feb 14 11:47:50 MST 2008 - carnold@novell.com
- Added upstream changesets that fix various bugs.
16859 16929 16930 16945 16947 16962 16976 16980 16995 16998 17036
-------------------------------------------------------------------
Wed Feb 13 17:42:17 MST 2008 - jfehlig@novell.com
- Updated network-multinet
- Simplify bridge creation
- Create traditional bridge and hostonly networks by default
-------------------------------------------------------------------
Fri Feb 8 11:01:49 MST 2008 - jfehlig@novell.com
- Added upstream changesets 16932, 16965, 16977, and 16988 to fix
various bugs in tool stack
- Also added upstream changeset 16989 to complete fate #302941.
-------------------------------------------------------------------
Mon Feb 4 14:01:56 MST 2008 - plc@novell.com
- Replaced xen-blktab-subtype-strip.patch with official upstream
changeset for bnc#353065.
-------------------------------------------------------------------
Fri Feb 1 16:11:59 MST 2008 - carnold@novell.com
- Update to xen 3.2 FCS. Changeset 16718
- Merge xen-tools and xen-tools-ioemu into xen-tools.
-------------------------------------------------------------------
Sat Jan 12 00:37:41 CET 2008 - carnold@suse.de
- Update to xen 3.2 RC5. Changeset 16701
-------------------------------------------------------------------
Wed Dec 19 16:16:36 MST 2007 - carnold@novell.com
- Update to xen 3.2 RC2. Changeset 16646
-------------------------------------------------------------------
Thu Dec 13 15:37:09 MST 2007 - carnold@novell.com
- Added agent support for HP Proliant hardware.
-------------------------------------------------------------------
Wed Dec 5 13:04:17 MST 2007 - carnold@novell.com
- #338108 - VUL-0: Xen security issues in SLE10
- #279062 - Timer ISR/1: Time went backwards
-------------------------------------------------------------------
Thu Nov 29 13:44:29 MST 2007 - carnold@novell.com
- Added part of upstream c/s 15211. Fixed open call with O_CREAT
because it had no mode flags.
because it had no mode flags (15211-fix-open-mode.patch).
-------------------------------------------------------------------
Mon Nov 5 09:38:14 MST 2007 - jfehlig@novell.com
@ -29,7 +120,7 @@ Mon Nov 5 09:38:14 MST 2007 - jfehlig@novell.com
-------------------------------------------------------------------
Thu Nov 1 13:17:46 MDT 2007 - carnold@novell.com
- 334445: xenbaked: Fix security vulnerability CVE-2007-3919.
- #334445: xenbaked: Fix security vulnerability CVE-2007-3919.
-------------------------------------------------------------------
Thu Nov 1 11:30:35 MDT 2007 - carnold@novell.com

204
xen.spec
View File

@ -1,5 +1,5 @@
#
# spec file for package xen (Version 3.2.0_16718_02)
# spec file for package xen (Version 3.2.0_16718_06)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@ -10,6 +10,7 @@
# norootforbuild
Name: xen
%define xvers 3.2
%define xvermaj 3
@ -20,7 +21,7 @@ Name: xen
%else
%define with_kmp 0
%endif
BuildRequires: LibVNCServer-devel SDL-devel autoconf automake bin86 curl-devel dev86 graphviz latex2html libjpeg-devel libxml2-devel openssl openssl-devel python-devel transfig
BuildRequires: LibVNCServer-devel SDL-devel autoconf automake bin86 curl-devel dev86 graphviz latex2html libjpeg-devel libxml2-devel openssl openssl-devel pciutils-devel python-devel transfig
%if %suse_version >= 1030
BuildRequires: texlive texlive-latex
%else
@ -32,7 +33,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit
%if %{?with_kmp}0
BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11
%endif
Version: 3.2.0_16718_02
Version: 3.2.0_16718_06
Release: 1
License: GPL v2 only
Group: System/Kernel
@ -60,17 +61,40 @@ Source19: network-multinet
Source20: multinet-common.sh
Source21: multinet-include.template
Source22: xend-network
# Xen API remote authentication sources
Source23: etc_pam.d_xen-api
Source24: xenapiusers
# Upstream patches
Patch0: 16716-xend-version.patch
Patch1: 16718-batched-mmu-updates.patch
Patch2: 16777-xend-block-attach.patch
Patch3: 16873-net-nat.patch
Patch4: 16877-blktap.patch
Patch5: 16883-xend-crashed-state.patch
Patch6: 16884-xend-rename-restart.patch
Patch7: 16885-xend-config-comments.patch
Patch8: 16886-xenstore-leak.patch
Patch9: 16890-xenapi-version.patch
Patch2: 16769-pci-high-memory-resource.patch
Patch3: 16777-xend-block-attach.patch
Patch4: 16859-x86_emulate-clts-fix.patch
Patch5: 16873-net-nat.patch
Patch6: 16877-blktap.patch
Patch7: 16883-xend-crashed-state.patch
Patch8: 16884-xend-rename-restart.patch
Patch9: 16885-xend-config-comments.patch
Patch10: 16886-xenstore-leak.patch
Patch11: 16890-xenapi-version.patch
Patch12: 16929-hvm-guest-crash-fix.patch
Patch13: 16930-shadow-pinning-logic-fix.patch
Patch14: 16932-xend-hvm-localtime.patch
Patch15: 16945-blktap-strip.patch
Patch16: 16947-fvmachine-xenstore.patch
Patch17: 16962-cross-page-write-failure.patch
Patch18: 16965-xend-leak.patch
Patch19: 16976-x86_emulate-sahf-fix.patch
Patch20: 16977-xend-restart-count.patch
Patch21: 16980-x86_emulate-macro-fix.patch
Patch22: 16988-xm-reboot.patch
Patch23: 16989-xend-coredump.patch
Patch24: 16995-x86_emulate-mul-fix.patch
Patch25: 16998-x86_emulate-imul-fix.patch
Patch26: 17003-qemu-queue-mouse.patch
Patch27: 17017-hpet-configuration.patch
Patch28: 17036-mismatched-save-rest-fix.patch
Patch29: 17113-xend-restore.patch
# Our patches
Patch100: xen-config.diff
Patch101: xend-config.diff
@ -99,25 +123,25 @@ Patch130: xen-generate-foreign-headers.diff
Patch131: tools-xc_kexec.diff
Patch132: tools-kboot.diff
Patch133: libxen_permissive.patch
Patch134: xen-ioemu-hvm-pv-support.diff
Patch135: xenapi-console-protocol.patch
Patch136: xen-disable-qemu-monitor.diff
Patch137: supported_module.diff
Patch138: disable_emulated_device.diff
Patch140: qemu-security-etch1.diff
Patch141: vnc-i18n-keys.diff
Patch142: rpmlint.diff
Patch143: cdrom-removable.patch
Patch134: xenapi-console-protocol.patch
Patch135: xen-disable-qemu-monitor.diff
Patch136: supported_module.diff
Patch137: qemu-security-etch1.diff
Patch138: vnc-i18n-keys.diff
Patch139: rpmlint.diff
Patch140: cdrom-removable.patch
Patch150: bridge-suse.diff
Patch151: bridge-bonding.diff
Patch152: bridge-hostonly.diff
Patch153: bridge-vlan.diff
Patch154: keymap_nl-be.patch
Patch155: svm-cr8-performance.diff
Patch156: xen-fbback-resize.patch
Patch157: xend-core-dump-loc.diff
Patch158: blktap.patch
Patch159: xen-blktab-subtype-strip.patch
Patch155: xen-fbback-resize.patch
Patch156: xend-core-dump-loc.diff
Patch157: blktap.patch
Patch158: xen-qcow-realpath-buffer-overflow.patch
Patch159: xen-api-auth.patch
Patch160: pv_32_16_color_trans.patch
Patch161: hvm-ide-flush-o_direct.patch
# Patches from Jan
Patch240: xenctx.patch
Patch241: const-callback-arg.patch
@ -127,8 +151,21 @@ Patch244: pv-drv-mkbuildtree.patch
Patch245: x86_emulate.patch
Patch246: x86-extra-trap-info.patch
Patch247: 32on64-extra-mem.patch
# Ky PV Driver Patches
# PV Driver Patches
Patch350: pv-driver-build.patch
Patch351: xen-ioemu-hvm-pv-support.diff
Patch352: pvdrv_emulation_control.patch
# Intel EPT / VPID patches
Patch400: ept-novell-x64.patch
Patch401: vpid-novell.patch
Patch402: livemig-ept-novell-x64.patch
Patch403: livemig-ept-novell-i386.patch
%ifarch x86_64
# novell_shim patches
Patch500: ns_tools.patch
Patch501: ns_xen_base.patch
Patch502: ns_xen_extension.patch
%endif
Url: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define pysite %(python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()")
@ -243,7 +280,8 @@ Authors:
Summary: Xen Virtualization: Control tools for domain 0
Group: System/Kernel
Requires: xen-libs = %{version}
Requires: bridge-utils multipath-tools python python-curses python-xml pyxml
Requires: bridge-utils ipcalc multipath-tools python python-curses python-pam python-xml pyxml
Obsoletes: xen-tools-ioemu
AutoReqProv: on
%description tools
@ -458,6 +496,26 @@ Authors:
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
@ -485,25 +543,25 @@ Authors:
%patch131 -p1
%patch132 -p1
%patch133 -p1
#%patch134 -p1 # 3.1 disabled - re-port
%patch134 -p1
%patch135 -p1
%patch136 -p1
%patch137 -p1
#%patch138 -p1 # 3.1 disabled - Currently not disabling FV devices when loading PV drivers
%patch138 -p1
%patch139 -p1
%patch140 -p1
%patch141 -p1
%patch142 -p1
%patch143 -p1
%patch150 -p1
#%patch151 -p1 # dump if all goes well with defaulting to network-multinet
#%patch152 -p1 # dump if all goes well with defaulting to network-multinet
#%patch153 -p1 # dump if all goes well with defaulting to network-multinet
%patch154 -p1
#%patch155 -p1 # AMD CR8 Performance - not clean for unstable
%patch155 -p1
%patch156 -p1
%patch157 -p1
%patch158 -p1
%patch159 -p1
%patch159 -p1
%patch160 -p1
%patch161 -p1
%patch240 -p1
%patch241 -p1
%patch242 -p1
@ -513,6 +571,20 @@ Authors:
%patch246 -p1
%patch247 -p1
%patch350 -p1
%patch351 -p1
%patch352 -p1
%patch400 -p1
%patch401 -p1
%ifarch x86_64
%patch402 -p1
%else
%patch403 -p1
%endif
%ifarch x86_64
%patch500 -p1
%patch501 -p1
%patch502 -p1
%endif
%build
XEN_EXTRAVERSION=%version-%release
@ -627,6 +699,10 @@ install -m644 %SOURCE18 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.xend
install -m755 %SOURCE19 %SOURCE20 $RPM_BUILD_ROOT/etc/xen/scripts/
install -m644 %SOURCE21 $RPM_BUILD_ROOT/etc/xen/scripts/multinet.d/
install -m755 %SOURCE22 $RPM_BUILD_ROOT/usr/sbin/
# Xen API remote authentication files
install -d $RPM_BUILD_ROOT/etc/pam.d
install -m644 %SOURCE23 $RPM_BUILD_ROOT/etc/pam.d/xen-api
install -m644 %SOURCE24 $RPM_BUILD_ROOT/etc/xen/
# logrotate
install -m644 -D %SOURCE7 $RPM_BUILD_ROOT/etc/logrotate.d/xen
# directories
@ -686,7 +762,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info
%defattr(-,root,root)
%{_libdir}/fs/
%{_libdir}/libblktap.so.*
%{_libdir}/libflask.so*
%{_libdir}/libflask.so.*
%{_libdir}/libfsimage.so.*
%{_libdir}/libxen*.so.*
@ -747,6 +823,8 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info
%config /etc/xen/vm
%config /etc/xen/*.sxp
%config /etc/xen/*.xml
%config(noreplace) /etc/xen/xenapiusers
%config /etc/pam.d/xen-api
%dir /etc/udev
%dir /etc/udev/rules.d
/etc/udev/rules.d/40-xen.rules
@ -783,7 +861,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info
%{_libdir}/libblktap.a
%{_libdir}/libblktap.so
%{_libdir}/libflask.a
%{_libdir}/libflask.so*
%{_libdir}/libflask.so
%{_libdir}/libfsimage.so
%{_libdir}/libxen*.a
%{_libdir}/libxen*.so
@ -826,21 +904,67 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info
/sbin/ldconfig
%changelog
* Fri Feb 29 2008 carnold@novell.com
- bnc#357966 - VT-D dosen't work for HVM guest.
* Fri Feb 29 2008 plc@novell.com
- Send UNIT_ATTENTION when CD drive has newly inserted media and
becomes ready. bnc#365386
* Thu Feb 28 2008 jfehlig@novell.com
- Updated block-iscsi script and xen-domUloader patch, bnc #365385
* Thu Feb 28 2008 carnold@novell.com
- Add support for Intel EPT / VPID.
* Tue Feb 26 2008 carnold@novell.com
- bnc#362415 - SLE-based installs 32-bit fully-virtualized have
network problems during installs.
- bnc#358244 - Time remaining does not change properly for FV SLES10
SP2 guest.
- bnc#363053 - Install remaining time always shows 2:00:00
* Tue Feb 26 2008 carnold@novell.com
- bnc#359457 - Xen full virt has data integrity issue.
* Tue Feb 26 2008 plc@novell.com
- Tranlate colors from 32 bit to 16 bit when viewing a 32 bit PV
VM from a 16 bit client. bnc#351470
Also includes upstream mouse queue patch.
* Fri Feb 22 2008 jfehlig@novell.com
- Added PAM configuration files for remote authentication via
Xen API. bnc #353464
* Tue Feb 19 2008 carnold@novell.com
- Fix PV drivers for HVM guests.
* Fri Feb 15 2008 carnold@novell.com
- Support for pxe booting fully virtualized guests in vm-install is
complete.
* Thu Feb 14 2008 carnold@novell.com
- Added upstream changesets that fix various bugs.
16859 16929 16930 16945 16947 16962 16976 16980 16995 16998 17036
* Wed Feb 13 2008 jfehlig@novell.com
- Updated network-multinet
- Simplify bridge creation
- Create traditional bridge and hostonly networks by default
* Fri Feb 08 2008 jfehlig@novell.com
- Added upstream changesets 16932, 16965, 16977, and 16988 to fix
various bugs in tool stack
- Also added upstream changeset 16989 to complete fate #302941.
* Mon Feb 04 2008 plc@novell.com
- Replaced xen-blktab-subtype-strip.patch with official upstream
changeset for bnc#353065.
* Fri Feb 01 2008 carnold@novell.com
- Update to xen 3.2 FCS. Changeset 16718
- Merge xen-tools and xen-tools-ioemu into xen-tools.
* Fri Jan 11 2008 carnold@suse.de
- Update to xen 3.2 RC5. Changeset 16701
* Wed Dec 19 2007 carnold@novell.com
- Update to xen 3.2 RC2. Changeset 16646
* Thu Dec 13 2007 carnold@novell.com
- Added agent support for HP Proliant hardware.
* Wed Dec 05 2007 carnold@novell.com
- #338108 - VUL-0: Xen security issues in SLE10
- #279062 - Timer ISR/1: Time went backwards
* Thu Nov 29 2007 carnold@novell.com
- Added part of upstream c/s 15211. Fixed open call with O_CREAT
because it had no mode flags.
because it had no mode flags (15211-fix-open-mode.patch).
* Mon Nov 05 2007 jfehlig@novell.com
- Added upstream c/s 15434 to allow access to serial devices.
Bug #338486.
* Thu Nov 01 2007 carnold@novell.com
- 334445: xenbaked: Fix security vulnerability CVE-2007-3919.
- #334445: xenbaked: Fix security vulnerability CVE-2007-3919.
* Thu Nov 01 2007 carnold@novell.com
- #310279: Kernel Panic while booting Xen
* Tue Oct 02 2007 ccoffing@novell.com

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2707,6 +2707,14 @@ class XendDomainInfo:
@@ -2732,6 +2732,14 @@ class XendDomainInfo:
if not config.has_key('backend'):
config['backend'] = "00000000-0000-0000-0000-000000000000"

1
xenapiusers Normal file
View File

@ -0,0 +1 @@
root

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1490,7 +1490,7 @@ class XendDomainInfo:
@@ -1504,7 +1504,7 @@ class XendDomainInfo:
try:
if not corefile:
this_time = time.strftime("%Y-%m%d-%H%M.%S", time.localtime())

View File

@ -567,7 +567,7 @@ else # Deal with block devices
fi
echo "Copying from source block device ($BOOTIMAGE) to the new target device ($DOMU_ROOTDEV)"
echo "(This may take a few minutes!)"
if ! dd if=$BOOTIMAGE of=$DOMU_ROOTDEV
if ! dd if=$BOOTIMAGE of=$DOMU_ROOTDEV bs=4K
then
echo "Failed to copy from $BOOTIMAGE to $DOMU_ROOTDEV" >&2
exit 1