# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID d246b79986d12e99db87339ba57bdac067950ec5
# Parent aa8ca06d209e34db5ae2573e0fcc22c602ce6510
# Parent fd5140c2854fe99e1181546383b40de6210f41ee
merge with xen-unstable.hg
---
tools/xm-test/ramdisk/configs/buildroot | 330 ---------
.hgignore | 11
linux-2.6-xen-sparse/drivers/xen/balloon/Makefile | 2
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c | 91 +-
linux-2.6-xen-sparse/drivers/xen/balloon/common.h | 58 +
linux-2.6-xen-sparse/drivers/xen/balloon/sysfs.c | 165 ++++
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c | 16
linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c | 304 +++++---
linux-2.6-xen-sparse/drivers/xen/netback/common.h | 5
linux-2.6-xen-sparse/drivers/xen/netback/interface.c | 54 -
linux-2.6-xen-sparse/drivers/xen/netback/netback.c | 43 -
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c | 2
tools/ioemu/patches/domain-timeoffset | 8
tools/ioemu/patches/hypervisor-rtc | 26
tools/ioemu/patches/ide-cd-dma | 18
tools/ioemu/patches/qemu-bootorder | 22
tools/ioemu/patches/qemu-cleanup | 33
tools/ioemu/patches/qemu-daemonize | 4
tools/ioemu/patches/qemu-logging | 3
tools/ioemu/patches/qemu-target-i386-dm | 18
tools/ioemu/patches/serial-port-rate-limit | 47 +
tools/ioemu/patches/series | 6
tools/ioemu/patches/vnc-access-monitor-vt | 8
tools/ioemu/patches/vnc-backoff-screen-scan | 42 -
tools/ioemu/patches/vnc-display-find-unused | 15
tools/ioemu/patches/vnc-fixes | 17
tools/ioemu/patches/vnc-listen-specific-interface | 142 ++++
tools/ioemu/patches/vnc-password | 119 +++
tools/ioemu/patches/vnc-protocol-fixes | 46 +
tools/ioemu/patches/vnc-start-vncviewer | 8
tools/ioemu/patches/vnc-title-domain-name | 8
tools/ioemu/patches/xen-build | 13
tools/ioemu/patches/xen-platform-device | 12
tools/ioemu/patches/xen-support-buffered-ioreqs | 8
tools/ioemu/patches/xenstore-block-device-config | 47 -
tools/ioemu/patches/xenstore-write-vnc-port | 12
tools/libxc/xc_acm.c | 6
tools/libxc/xc_domain.c | 25
tools/libxc/xc_evtchn.c | 6
tools/libxc/xc_hvm_build.c | 6
tools/libxc/xc_linux_build.c | 6
tools/libxc/xc_linux_restore.c | 8
tools/libxc/xc_linux_save.c | 16
tools/libxc/xc_misc.c | 4
tools/libxc/xc_private.c | 112 +--
tools/libxc/xc_private.h | 11
tools/libxc/xc_tbuf.c | 4
tools/libxc/xg_private.c | 16
tools/misc/xenperf.c | 26
tools/python/xen/lowlevel/acm/acm.c | 19
tools/python/xen/util/security.py | 9
tools/python/xen/xend/XendDomain.py | 3
tools/python/xen/xend/XendDomainInfo.py | 12
tools/python/xen/xm/create.py | 16
tools/python/xen/xm/opts.py | 6
tools/xm-test/README | 4
tools/xm-test/configure.ac | 4
tools/xm-test/lib/XmTestLib/Console.py | 5
tools/xm-test/lib/XmTestLib/XenDomain.py | 76 --
tools/xm-test/lib/XmTestLib/acm.py | 2
tools/xm-test/lib/XmTestLib/arch.py | 148 ++++
tools/xm-test/lib/XmTestReport/OSReport.py | 10
tools/xm-test/lib/XmTestReport/arch.py | 48 +
tools/xm-test/ramdisk/Makefile.am | 42 -
tools/xm-test/ramdisk/README-XenSource-initrd-1.0-img | 45 +
tools/xm-test/ramdisk/configs/buildroot-i386 | 346 ++++++++++
tools/xm-test/ramdisk/configs/buildroot-powerpc | 338 +++++++++
tools/xm-test/runtest.sh | 11
tools/xm-test/tests/create/11_create_concurrent_pos.py | 2
tools/xm-test/tests/create/12_create_concurrent_stress_pos.py | 9
tools/xm-test/tests/create/15_create_smallmem_pos.py | 4
tools/xm-test/tests/create/16_create_smallmem_neg.py | 8
xen/arch/ia64/linux-xen/setup.c | 2
xen/arch/ia64/vmx/mmio.c | 14
xen/arch/ia64/vmx/vmx_phy_mode.c | 8
xen/arch/ia64/vmx/vmx_vcpu.c | 2
xen/arch/ia64/vmx/vmx_virt.c | 6
xen/arch/ia64/xen/dom0_ops.c | 6
xen/arch/ia64/xen/dom_fw.c | 26
xen/arch/ia64/xen/domain.c | 14
xen/arch/ia64/xen/faults.c | 36 -
xen/arch/ia64/xen/fw_emul.c | 54 -
xen/arch/ia64/xen/hypercall.c | 12
xen/arch/ia64/xen/hyperprivop.S | 2
xen/arch/ia64/xen/irq.c | 2
xen/arch/ia64/xen/mm.c | 10
xen/arch/ia64/xen/privop.c | 22
xen/arch/ia64/xen/regionreg.c | 8
xen/arch/ia64/xen/tlb_track.c | 2
xen/arch/ia64/xen/vcpu.c | 96 +-
xen/arch/ia64/xen/vhpt.c | 6
xen/arch/ia64/xen/xencomm.c | 6
xen/arch/ia64/xen/xenmisc.c | 4
xen/arch/ia64/xen/xensetup.c | 6
xen/arch/ia64/xen/xentime.c | 2
xen/arch/powerpc/backtrace.c | 20
xen/arch/powerpc/domain.c | 8
xen/arch/powerpc/of-devwalk.c | 18
xen/arch/powerpc/powerpc64/domain.c | 6
xen/arch/x86/boot/x86_32.S | 2
xen/arch/x86/boot/x86_64.S | 2
xen/arch/x86/domain.c | 8
xen/arch/x86/hvm/hvm.c | 13
xen/arch/x86/hvm/io.c | 2
xen/arch/x86/hvm/platform.c | 9
xen/arch/x86/hvm/svm/intr.c | 2
xen/arch/x86/hvm/svm/svm.c | 38 -
xen/arch/x86/hvm/svm/vmcb.c | 36 -
xen/arch/x86/hvm/svm/x86_32/exits.S | 3
xen/arch/x86/hvm/svm/x86_64/exits.S | 2
xen/arch/x86/hvm/vmx/vmx.c | 4
xen/arch/x86/hvm/vmx/x86_32/exits.S | 3
xen/arch/x86/hvm/vmx/x86_64/exits.S | 2
xen/arch/x86/setup.c | 2
xen/arch/x86/x86_32/entry.S | 2
xen/arch/x86/x86_32/supervisor_mode_kernel.S | 2
xen/arch/x86/x86_64/entry.S | 2
xen/common/sched_sedf.c | 6
xen/drivers/char/console.c | 2
xen/include/asm-ia64/config.h | 2
xen/include/asm-ia64/vcpu.h | 2
xen/include/xen/event.h | 7
xen/include/xen/lib.h | 3
123 files changed, 2559 insertions(+), 1171 deletions(-)
diff -r aa8ca06d209e -r d246b79986d1 .hgignore
--- a/.hgignore Tue Oct 24 10:08:30 2006 -0600
+++ b/.hgignore Tue Oct 24 11:21:48 2006 -0600
@@ -184,6 +184,17 @@
^tools/xentrace/xenctx$
^tools/xentrace/xentrace$
^tools/xm-test/ramdisk/buildroot
+^tools/xm-test/aclocal.m4$
+^tools/xm-test/autom4te
+^tools/xm-test/install-sh$
+^tools/xm-test/mkinstalldirs$
+^tools/xm-test/missing$
+^tools/xm-test/config(ure|.log|.status|.guess|.sub)$
+^tools/xm-test/Makefile(.in)*$
+^tools/xm-test/.*/Makefile(.in)*$
+^tools/xm-test/lib/XmTestLib/config.py$
+^tools/xm-test/lib/XmTestReport/xmtest.py$
+^tools/xm-test/tests/.*\.test$
^xen/BLOG$
^xen/TAGS$
^xen/arch/x86/asm-offsets\.s$
diff -r aa8ca06d209e -r d246b79986d1
linux-2.6-xen-sparse/drivers/xen/balloon/Makefile
--- a/linux-2.6-xen-sparse/drivers/xen/balloon/Makefile Tue Oct 24 10:08:30
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/balloon/Makefile Tue Oct 24 11:21:48
2006 -0600
@@ -1,2 +1,2 @@
-obj-y += balloon.o
+obj-y := balloon.o sysfs.o
diff -r aa8ca06d209e -r d246b79986d1
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
--- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Tue Oct 24
10:08:30 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Tue Oct 24
11:21:48 2006 -0600
@@ -53,10 +53,8 @@
#include <asm/uaccess.h>
#include <asm/tlb.h>
#include <linux/list.h>
-
#include <xen/xenbus.h>
-
-#define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10))
+#include "common.h"
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry *balloon_pde;
@@ -71,9 +69,7 @@ static DECLARE_MUTEX(balloon_mutex);
*/
DEFINE_SPINLOCK(balloon_lock);
-/* We aim for 'current allocation' == 'target allocation'. */
-static unsigned long current_pages;
-static unsigned long target_pages;
+struct balloon_stats balloon_stats;
/* We increase/decrease in batches which fit in a page */
static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)];
@@ -81,18 +77,8 @@ static unsigned long frame_list[PAGE_SIZ
/* VM /proc information for memory */
extern unsigned long totalram_pages;
-/* We may hit the hard limit in Xen. If we do then we remember it. */
-static unsigned long hard_limit;
-
-/*
- * Drivers may alter the memory reservation independently, but they must
- * inform the balloon driver so that we can avoid hitting the hard limit.
- */
-static unsigned long driver_pages;
-
/* List of ballooned pages, threaded through the mem_map array. */
static LIST_HEAD(ballooned_pages);
-static unsigned long balloon_low, balloon_high;
/* Main work function, always executed in process context. */
static void balloon_process(void *unused);
@@ -124,10 +110,10 @@ static void balloon_append(struct page *
/* Lowmem is re-populated first, so highmem pages go at list tail. */
if (PageHighMem(page)) {
list_add_tail(PAGE_TO_LIST(page), &ballooned_pages);
- balloon_high++;
+ bs.balloon_high++;
} else {
list_add(PAGE_TO_LIST(page), &ballooned_pages);
- balloon_low++;
+ bs.balloon_low++;
}
}
@@ -143,9 +129,9 @@ static struct page *balloon_retrieve(voi
UNLIST_PAGE(page);
if (PageHighMem(page))
- balloon_high--;
+ bs.balloon_high--;
else
- balloon_low--;
+ bs.balloon_low--;
return page;
}
@@ -172,9 +158,9 @@ static void balloon_alarm(unsigned long
static unsigned long current_target(void)
{
- unsigned long target = min(target_pages, hard_limit);
- if (target > (current_pages + balloon_low + balloon_high))
- target = current_pages + balloon_low + balloon_high;
+ unsigned long target = min(bs.target_pages, bs.hard_limit);
+ if (target > (bs.current_pages + bs.balloon_low + bs.balloon_high))
+ target = bs.current_pages + bs.balloon_low + bs.balloon_high;
return target;
}
@@ -216,7 +202,8 @@ static int increase_reservation(unsigned
BUG_ON(ret != rc);
}
if (rc >= 0)
- hard_limit = current_pages + rc - driver_pages;
+ bs.hard_limit = (bs.current_pages + rc -
+ bs.driver_pages);
goto out;
}
@@ -248,8 +235,8 @@ static int increase_reservation(unsigned
__free_page(page);
}
- current_pages += nr_pages;
- totalram_pages = current_pages;
+ bs.current_pages += nr_pages;
+ totalram_pages = bs.current_pages;
out:
balloon_unlock(flags);
@@ -317,8 +304,8 @@ static int decrease_reservation(unsigned
ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation);
BUG_ON(ret != nr_pages);
- current_pages -= nr_pages;
- totalram_pages = current_pages;
+ bs.current_pages -= nr_pages;
+ totalram_pages = bs.current_pages;
balloon_unlock(flags);
@@ -339,7 +326,7 @@ static void balloon_process(void *unused
down(&balloon_mutex);
do {
- credit = current_target() - current_pages;
+ credit = current_target() - bs.current_pages;
if (credit > 0)
need_sleep = (increase_reservation(credit) != 0);
if (credit < 0)
@@ -352,18 +339,18 @@ static void balloon_process(void *unused
} while ((credit != 0) && !need_sleep);
/* Schedule more work if there is some still to be done. */
- if (current_target() != current_pages)
+ if (current_target() != bs.current_pages)
mod_timer(&balloon_timer, jiffies + HZ);
up(&balloon_mutex);
}
/* Resets the Xen limit, sets new target, and kicks off processing. */
-static void set_new_target(unsigned long target)
+void balloon_set_new_target(unsigned long target)
{
/* No need for lock. Not read-modify-write updates. */
- hard_limit = ~0UL;
- target_pages = target;
+ bs.hard_limit = ~0UL;
+ bs.target_pages = target;
schedule_work(&balloon_worker);
}
@@ -388,7 +375,7 @@ static void watch_target(struct xenbus_w
/* The given memory/target value is in KiB, so it needs converting to
* pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
*/
- set_new_target(new_target >> (PAGE_SHIFT - 10));
+ balloon_set_new_target(new_target >> (PAGE_SHIFT - 10));
}
static int balloon_init_watcher(struct notifier_block *notifier,
@@ -424,7 +411,7 @@ static int balloon_write(struct file *fi
memstring[sizeof(memstring)-1] = '\0';
target_bytes = memparse(memstring, &endchar);
- set_new_target(target_bytes >> PAGE_SHIFT);
+ balloon_set_new_target(target_bytes >> PAGE_SHIFT);
return count;
}
@@ -442,12 +429,13 @@ static int balloon_read(char *page, char
"High-mem balloon: %8lu kB\n"
"Driver pages: %8lu kB\n"
"Xen hard limit: ",
- PAGES2KB(current_pages), PAGES2KB(target_pages),
- PAGES2KB(balloon_low), PAGES2KB(balloon_high),
- PAGES2KB(driver_pages));
-
- if (hard_limit != ~0UL)
- len += sprintf(page + len, "%8lu kB\n", PAGES2KB(hard_limit));
+ PAGES2KB(bs.current_pages), PAGES2KB(bs.target_pages),
+ PAGES2KB(bs.balloon_low), PAGES2KB(bs.balloon_high),
+ PAGES2KB(bs.driver_pages));
+
+ if (bs.hard_limit != ~0UL)
+ len += sprintf(page + len, "%8lu kB\n",
+ PAGES2KB(bs.hard_limit));
else
len += sprintf(page + len, " ??? kB\n");
@@ -468,13 +456,13 @@ static int __init balloon_init(void)
IPRINTK("Initialising balloon driver.\n");
- current_pages = min(xen_start_info->nr_pages, max_pfn);
- totalram_pages = current_pages;
- target_pages = current_pages;
- balloon_low = 0;
- balloon_high = 0;
- driver_pages = 0UL;
- hard_limit = ~0UL;
+ bs.current_pages = min(xen_start_info->nr_pages, max_pfn);
+ totalram_pages = bs.current_pages;
+ bs.target_pages = bs.current_pages;
+ bs.balloon_low = 0;
+ bs.balloon_high = 0;
+ bs.driver_pages = 0UL;
+ bs.hard_limit = ~0UL;
init_timer(&balloon_timer);
balloon_timer.data = 0;
@@ -489,6 +477,7 @@ static int __init balloon_init(void)
balloon_pde->read_proc = balloon_read;
balloon_pde->write_proc = balloon_write;
#endif
+ balloon_sysfs_init();
/* Initialise the balloon with excess memory space. */
for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) {
@@ -512,7 +501,7 @@ void balloon_update_driver_allowance(lon
unsigned long flags;
balloon_lock(flags);
- driver_pages += delta;
+ bs.driver_pages += delta;
balloon_unlock(flags);
}
@@ -578,7 +567,7 @@ struct page **alloc_empty_pages_and_page
goto err;
}
- totalram_pages = --current_pages;
+ totalram_pages = --bs.current_pages;
balloon_unlock(flags);
}
@@ -624,7 +613,7 @@ void balloon_release_driver_page(struct
balloon_lock(flags);
balloon_append(page);
- driver_pages--;
+ bs.driver_pages--;
balloon_unlock(flags);
schedule_work(&balloon_worker);
diff -r aa8ca06d209e -r d246b79986d1
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Tue Oct 24
10:08:30 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Tue Oct 24
11:21:48 2006 -0600
@@ -293,7 +293,7 @@ static int do_block_io_op(blkif_t *blkif
static int do_block_io_op(blkif_t *blkif)
{
blkif_back_ring_t *blk_ring = &blkif->blk_ring;
- blkif_request_t *req;
+ blkif_request_t req;
pending_req_t *pending_req;
RING_IDX rc, rp;
int more_to_do = 0;
@@ -311,22 +311,22 @@ static int do_block_io_op(blkif_t *blkif
break;
}
- req = RING_GET_REQUEST(blk_ring, rc);
+ memcpy(&req, RING_GET_REQUEST(blk_ring, rc), sizeof(req));
blk_ring->req_cons = ++rc; /* before make_response() */
- switch (req->operation) {
+ switch (req.operation) {
case BLKIF_OP_READ:
blkif->st_rd_req++;
- dispatch_rw_block_io(blkif, req, pending_req);
+ dispatch_rw_block_io(blkif, &req, pending_req);
break;
case BLKIF_OP_WRITE:
blkif->st_wr_req++;
- dispatch_rw_block_io(blkif, req, pending_req);
+ dispatch_rw_block_io(blkif, &req, pending_req);
break;
default:
DPRINTK("error: unknown block io operation [%d]\n",
- req->operation);
- make_response(blkif, req->id, req->operation,
+ req.operation);
+ make_response(blkif, req.id, req.operation,
BLKIF_RSP_ERROR);
free_req(pending_req);
break;
@@ -375,7 +375,7 @@ static void dispatch_rw_block_io(blkif_t
req->seg[i].first_sect + 1;
if ((req->seg[i].last_sect >= (PAGE_SIZE >> 9)) ||
- (seg[i].nsec <= 0))
+ (req->seg[i].last_sect < req->seg[i].first_sect))
goto fail_response;
preq.nr_sects += seg[i].nsec;
diff -r aa8ca06d209e -r d246b79986d1
linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c Tue Oct 24 10:08:30
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c Tue Oct 24 11:21:48
2006 -0600
@@ -9,6 +9,9 @@
* Based on the blkback driver code.
*
* Copyright (c) 2004-2005, Andrew Warfield and Julian Chesterfield
+ *
+ * Clean ups and fix ups:
+ * Copyright (c) 2006, Steven Rostedt - Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@@ -51,7 +54,7 @@
#include <asm/tlbflush.h>
#include <linux/devfs_fs_kernel.h>
-#define MAX_TAP_DEV 100 /*the maximum number of tapdisk ring devices */
+#define MAX_TAP_DEV 256 /*the maximum number of tapdisk ring devices */
#define MAX_DEV_NAME 100 /*the max tapdisk ring device name e.g. blktap0 */
@@ -104,6 +107,12 @@ static int mmap_pages = MMAP_PAGES;
* have a bunch of pages reserved for shared
* memory rings.
*/
+
+/*Data struct handed back to userspace for tapdisk device to VBD mapping*/
+typedef struct domid_translate {
+ unsigned short domid;
+ unsigned short busid;
+} domid_translate_t ;
/*Data struct associated with each of the tapdisk devices*/
typedef struct tap_blkif {
@@ -123,17 +132,11 @@ typedef struct tap_blkif {
unsigned long *idx_map; /*Record the user ring id to kern
[req id, idx] tuple */
blkif_t *blkif; /*Associate blkif with tapdev */
- int sysfs_set; /*Set if it has a class device. */
+ struct domid_translate trans; /*Translation from domid to bus. */
} tap_blkif_t;
-/*Data struct handed back to userspace for tapdisk device to VBD mapping*/
-typedef struct domid_translate {
- unsigned short domid;
- unsigned short busid;
-} domid_translate_t ;
-
-static domid_translate_t translate_domid[MAX_TAP_DEV];
-static tap_blkif_t *tapfds[MAX_TAP_DEV];
+static struct tap_blkif *tapfds[MAX_TAP_DEV];
+static int blktap_next_minor;
static int __init set_blkif_reqs(char *str)
{
@@ -322,7 +325,7 @@ struct vm_operations_struct blktap_vm_op
*/
/*Function Declarations*/
-static int get_next_free_dev(void);
+static tap_blkif_t *get_next_free_dev(void);
static int blktap_open(struct inode *inode, struct file *filp);
static int blktap_release(struct inode *inode, struct file *filp);
static int blktap_mmap(struct file *filp, struct vm_area_struct *vma);
@@ -340,51 +343,96 @@ static struct file_operations blktap_fop
};
-static int get_next_free_dev(void)
+static tap_blkif_t *get_next_free_dev(void)
{
tap_blkif_t *info;
- int i = 0, ret = -1;
- unsigned long flags;
-
- spin_lock_irqsave(&pending_free_lock, flags);
-
- while (i < MAX_TAP_DEV) {
+ int minor;
+
+ /*
+ * This is called only from the ioctl, which
+ * means we should always have interrupts enabled.
+ */
+ BUG_ON(irqs_disabled());
+
+ spin_lock_irq(&pending_free_lock);
+
+ /* tapfds[0] is always NULL */
+
+ for (minor = 1; minor < blktap_next_minor; minor++) {
+ info = tapfds[minor];
+ /* we could have failed a previous attempt. */
+ if (!info ||
+ ((info->dev_inuse == 0) &&
+ (info->dev_pending == 0)) ) {
+ info->dev_pending = 1;
+ goto found;
+ }
+ }
+ info = NULL;
+ minor = -1;
+
+ /*
+ * We didn't find free device. If we can still allocate
+ * more, then we grab the next device minor that is
+ * available. This is done while we are still under
+ * the protection of the pending_free_lock.
+ */
+ if (blktap_next_minor < MAX_TAP_DEV)
+ minor = blktap_next_minor++;
+found:
+ spin_unlock_irq(&pending_free_lock);
+
+ if (!info && minor > 0) {
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (unlikely(!info)) {
+ /*
+ * If we failed here, try to put back
+ * the next minor number. But if one
+ * was just taken, then we just lose this
+ * minor. We can try to allocate this
+ * minor again later.
+ */
+ spin_lock_irq(&pending_free_lock);
+ if (blktap_next_minor == minor+1)
+ blktap_next_minor--;
+ spin_unlock_irq(&pending_free_lock);
+ goto out;
+ }
+
+ info->minor = minor;
+ /*
+ * Make sure that we have a minor before others can
+ * see us.
+ */
+ wmb();
+ tapfds[minor] = info;
+
+ class_device_create(xen_class, NULL,
+ MKDEV(blktap_major, minor), NULL,
+ "blktap%d", minor);
+ devfs_mk_cdev(MKDEV(blktap_major, minor),
+ S_IFCHR|S_IRUGO|S_IWUSR, "xen/blktap%d", minor);
+ }
+
+out:
+ return info;
+}
+
+int dom_to_devid(domid_t domid, int xenbus_id, blkif_t *blkif)
+{
+ tap_blkif_t *info;
+ int i;
+
+ for (i = 1; i < blktap_next_minor; i++) {
info = tapfds[i];
- if ( (tapfds[i] != NULL) && (info->dev_inuse == 0)
- && (info->dev_pending == 0) ) {
- info->dev_pending = 1;
- ret = i;
- goto done;
- }
- i++;
- }
-
-done:
- spin_unlock_irqrestore(&pending_free_lock, flags);
-
- /*
- * We are protected by having the dev_pending set.
- */
- if (!tapfds[i]->sysfs_set && xen_class) {
- class_device_create(xen_class, NULL,
- MKDEV(blktap_major, ret), NULL,
- "blktap%d", ret);
- tapfds[i]->sysfs_set = 1;
- }
- return ret;
-}
-
-int dom_to_devid(domid_t domid, int xenbus_id, blkif_t *blkif)
-{
- int i;
-
- for (i = 0; i < MAX_TAP_DEV; i++)
- if ( (translate_domid[i].domid == domid)
- && (translate_domid[i].busid == xenbus_id) ) {
- tapfds[i]->blkif = blkif;
- tapfds[i]->status = RUNNING;
+ if ( info &&
+ (info->trans.domid == domid) &&
+ (info->trans.busid == xenbus_id) ) {
+ info->blkif = blkif;
+ info->status = RUNNING;
return i;
}
+ }
return -1;
}
@@ -394,12 +442,16 @@ void signal_tapdisk(int idx)
struct task_struct *ptask;
info = tapfds[idx];
- if ( (idx > 0) && (idx < MAX_TAP_DEV) && (info->pid > 0) ) {
+ if ((idx < 0) || (idx > MAX_TAP_DEV) || !info)
+ return;
+
+ if (info->pid > 0) {
ptask = find_task_by_pid(info->pid);
if (ptask)
info->status = CLEANSHUTDOWN;
}
info->blkif = NULL;
+
return;
}
@@ -410,14 +462,19 @@ static int blktap_open(struct inode *ino
tap_blkif_t *info;
int i;
- if (tapfds[idx] == NULL) {
+ /* ctrl device, treat differently */
+ if (!idx)
+ return 0;
+
+ info = tapfds[idx];
+
+ if ((idx < 0) || (idx > MAX_TAP_DEV) || !info) {
WPRINTK("Unable to open device /dev/xen/blktap%d\n",
- idx);
- return -ENOMEM;
- }
+ idx);
+ return -ENODEV;
+ }
+
DPRINTK("Opening device /dev/xen/blktap%d\n",idx);
-
- info = tapfds[idx];
/*Only one process can access device at a time*/
if (test_and_set_bit(0, &info->dev_inuse))
@@ -458,12 +515,10 @@ static int blktap_release(struct inode *
{
tap_blkif_t *info = filp->private_data;
- /* can this ever happen? - sdr */
- if (!info) {
- WPRINTK("Trying to free device that doesn't exist "
- "[/dev/xen/blktap%d]\n",iminor(inode) - BLKTAP_MINOR);
- return -EBADF;
- }
+ /* check for control device */
+ if (!info)
+ return 0;
+
info->dev_inuse = 0;
DPRINTK("Freeing device [/dev/xen/blktap%d]\n",info->minor);
@@ -619,33 +674,31 @@ static int blktap_ioctl(struct inode *in
{
uint64_t val = (uint64_t)arg;
domid_translate_t *tr = (domid_translate_t *)&val;
- int newdev;
DPRINTK("NEWINTF Req for domid %d and bus id %d\n",
tr->domid, tr->busid);
- newdev = get_next_free_dev();
- if (newdev < 1) {
+ info = get_next_free_dev();
+ if (!info) {
WPRINTK("Error initialising /dev/xen/blktap - "
"No more devices\n");
return -1;
}
- translate_domid[newdev].domid = tr->domid;
- translate_domid[newdev].busid = tr->busid;
- return newdev;
+ info->trans.domid = tr->domid;
+ info->trans.busid = tr->busid;
+ return info->minor;
}
case BLKTAP_IOCTL_FREEINTF:
{
unsigned long dev = arg;
unsigned long flags;
- /* Looking at another device */
- info = NULL;
-
- if ( (dev > 0) && (dev < MAX_TAP_DEV) )
- info = tapfds[dev];
+ info = tapfds[dev];
+
+ if ((dev > MAX_TAP_DEV) || !info)
+ return 0; /* should this be an error? */
spin_lock_irqsave(&pending_free_lock, flags);
- if ( (info != NULL) && (info->dev_pending) )
+ if (info->dev_pending)
info->dev_pending = 0;
spin_unlock_irqrestore(&pending_free_lock, flags);
@@ -655,16 +708,12 @@ static int blktap_ioctl(struct inode *in
{
unsigned long dev = arg;
- /* Looking at another device */
- info = NULL;
-
- if ( (dev > 0) && (dev < MAX_TAP_DEV) )
- info = tapfds[dev];
-
- if (info != NULL)
- return info->minor;
- else
- return -1;
+ info = tapfds[dev];
+
+ if ((dev > MAX_TAP_DEV) || !info)
+ return -EINVAL;
+
+ return info->minor;
}
case BLKTAP_IOCTL_MAJOR:
return blktap_major;
@@ -683,13 +732,8 @@ static unsigned int blktap_poll(struct f
{
tap_blkif_t *info = filp->private_data;
- if (!info) {
- WPRINTK(" poll, retrieving idx failed\n");
- return 0;
- }
-
/* do not work on the control device */
- if (!info->minor)
+ if (!info)
return 0;
poll_wait(filp, &info->wait, wait);
@@ -704,13 +748,12 @@ void blktap_kick_user(int idx)
{
tap_blkif_t *info;
- if (idx == 0)
+ info = tapfds[idx];
+
+ if ((idx < 0) || (idx > MAX_TAP_DEV) || !info)
return;
-
- info = tapfds[idx];
-
- if (info != NULL)
- wake_up_interruptible(&info->wait);
+
+ wake_up_interruptible(&info->wait);
return;
}
@@ -822,8 +865,8 @@ static void free_req(pending_req_t *req)
wake_up(&pending_free_wq);
}
-static void fast_flush_area(pending_req_t *req, int k_idx, int u_idx, int
- tapidx)
+static void fast_flush_area(pending_req_t *req, int k_idx, int u_idx,
+ int tapidx)
{
struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST*2];
unsigned int i, invcount = 0;
@@ -831,13 +874,16 @@ static void fast_flush_area(pending_req_
uint64_t ptep;
int ret, mmap_idx;
unsigned long kvaddr, uvaddr;
-
- tap_blkif_t *info = tapfds[tapidx];
+ tap_blkif_t *info;
- if (info == NULL) {
+
+ info = tapfds[tapidx];
+
+ if ((tapidx < 0) || (tapidx > MAX_TAP_DEV) || !info) {
WPRINTK("fast_flush: Couldn't get info!\n");
return;
}
+
mmap_idx = req->mem_idx;
for (i = 0; i < req->nr_pages; i++) {
@@ -1042,7 +1088,7 @@ static int do_block_io_op(blkif_t *blkif
rmb(); /* Ensure we see queued requests up to 'rp'. */
/*Check blkif has corresponding UE ring*/
- if (blkif->dev_num == -1) {
+ if (blkif->dev_num < 0) {
/*oops*/
if (print_dbug) {
WPRINTK("Corresponding UE "
@@ -1053,7 +1099,8 @@ static int do_block_io_op(blkif_t *blkif
}
info = tapfds[blkif->dev_num];
- if (info == NULL || !info->dev_inuse) {
+
+ if (blkif->dev_num > MAX_TAP_DEV || !info || !info->dev_inuse) {
if (print_dbug) {
WPRINTK("Can't get UE info!\n");
print_dbug = 0;
@@ -1121,15 +1168,22 @@ static void dispatch_rw_block_io(blkif_t
struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST*2];
unsigned int nseg;
int ret, i;
- tap_blkif_t *info = tapfds[blkif->dev_num];
+ tap_blkif_t *info;
uint64_t sector;
-
blkif_request_t *target;
int pending_idx = RTN_PEND_IDX(pending_req,pending_req->mem_idx);
- int usr_idx = GET_NEXT_REQ(info->idx_map);
+ int usr_idx;
uint16_t mmap_idx = pending_req->mem_idx;
+ if (blkif->dev_num < 0 || blkif->dev_num > MAX_TAP_DEV)
+ goto fail_response;
+
+ info = tapfds[blkif->dev_num];
+ if (info == NULL)
+ goto fail_response;
+
/* Check we have space on user ring - should never fail. */
+ usr_idx = GET_NEXT_REQ(info->idx_map);
if (usr_idx == INVALID_REQ)
goto fail_response;
@@ -1330,7 +1384,6 @@ static int __init blkif_init(void)
static int __init blkif_init(void)
{
int i,ret,blktap_dir;
- tap_blkif_t *info;
if (!is_running_on_xen())
return -ENODEV;
@@ -1349,9 +1402,6 @@ static int __init blkif_init(void)
alloc_pending_reqs = 0;
tap_blkif_xenbus_init();
-
- /*Create the blktap devices, but do not map memory or waitqueue*/
- for(i = 0; i < MAX_TAP_DEV; i++) translate_domid[i].domid = 0xFFFF;
/* Dynamically allocate a major for this device */
ret = register_chrdev(0, "blktap", &blktap_fops);
@@ -1364,24 +1414,17 @@ static int __init blkif_init(void)
blktap_major = ret;
- for(i = 0; i < MAX_TAP_DEV; i++ ) {
- info = tapfds[i] = kzalloc(sizeof(tap_blkif_t),GFP_KERNEL);
- if(tapfds[i] == NULL)
- return -ENOMEM;
- info->minor = i;
- info->pid = 0;
- info->blkif = NULL;
-
- ret = devfs_mk_cdev(MKDEV(blktap_major, i),
- S_IFCHR|S_IRUGO|S_IWUSR, "xen/blktap%d", i);
-
- if(ret != 0)
- return -ENOMEM;
- info->dev_pending = info->dev_inuse = 0;
-
- DPRINTK("Created misc_dev [/dev/xen/blktap%d]\n",i);
- }
-
+ /* tapfds[0] is always NULL */
+ blktap_next_minor++;
+
+ ret = devfs_mk_cdev(MKDEV(blktap_major, i),
+ S_IFCHR|S_IRUGO|S_IWUSR, "xen/blktap%d", i);
+
+ if(ret != 0)
+ return -ENOMEM;
+
+ DPRINTK("Created misc_dev [/dev/xen/blktap%d]\n",i);
+
/* Make sure the xen class exists */
if (!setup_xen_class()) {
/*
@@ -1394,7 +1437,6 @@ static int __init blkif_init(void)
class_device_create(xen_class, NULL,
MKDEV(blktap_major, 0), NULL,
"blktap0");
- tapfds[0]->sysfs_set = 1;
} else {
/* this is bad, but not fatal */
WPRINTK("blktap: sysfs xen_class not created\n");
diff -r aa8ca06d209e -r d246b79986d1
linux-2.6-xen-sparse/drivers/xen/netback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h Tue Oct 24 10:08:30
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h Tue Oct 24 11:21:48
2006 -0600
@@ -92,6 +92,9 @@ typedef struct netif_st {
unsigned long remaining_credit;
struct timer_list credit_timeout;
+ /* Enforce draining of the transmit queue. */
+ struct timer_list tx_queue_timeout;
+
/* Miscellaneous private stuff. */
struct list_head list; /* scheduling list */
atomic_t refcnt;
@@ -119,6 +122,8 @@ int netif_map(netif_t *netif, unsigned l
void netif_xenbus_init(void);
+#define netif_schedulable(dev) (netif_running(dev) && netif_carrier_ok(dev))
+
void netif_schedule_work(netif_t *netif);
void netif_deschedule_work(netif_t *netif);
diff -r aa8ca06d209e -r d246b79986d1
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Tue Oct 24
10:08:30 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Tue Oct 24
11:21:48 2006 -0600
@@ -44,12 +44,11 @@
* For example, consider a packet that holds onto resources belonging to the
* guest for which it is queued (e.g., packet received on vif1.0, destined for
* vif1.1 which is not activated in the guest): in this situation the guest
- * will never be destroyed, unless vif1.1 is taken down (which flushes the
- * 'tx_queue').
- *
- * Only set this parameter to non-zero value if you know what you are doing!
+ * will never be destroyed, unless vif1.1 is taken down. To avoid this, we
+ * run a timer (tx_queue_timeout) to drain the queue when the interface is
+ * blocked.
*/
-static unsigned long netbk_queue_length = 0;
+static unsigned long netbk_queue_length = 32;
module_param_named(queue_length, netbk_queue_length, ulong, 0);
static void __netif_up(netif_t *netif)
@@ -62,7 +61,6 @@ static void __netif_down(netif_t *netif)
{
disable_irq(netif->irq);
netif_deschedule_work(netif);
- del_timer_sync(&netif->credit_timeout);
}
static int net_open(struct net_device *dev)
@@ -153,7 +151,10 @@ netif_t *netif_alloc(domid_t domid, unsi
netif->credit_bytes = netif->remaining_credit = ~0UL;
netif->credit_usec = 0UL;
init_timer(&netif->credit_timeout);
+ /* Initialize 'expires' now: it's used to track the credit window. */
netif->credit_timeout.expires = jiffies;
+
+ init_timer(&netif->tx_queue_timeout);
dev->hard_start_xmit = netif_be_start_xmit;
dev->get_stats = netif_be_get_stats;
@@ -319,25 +320,6 @@ err_rx:
return err;
}
-static void netif_free(netif_t *netif)
-{
- atomic_dec(&netif->refcnt);
- wait_event(netif->waiting_to_free, atomic_read(&netif->refcnt) == 0);
-
- if (netif->irq)
- unbind_from_irqhandler(netif->irq, netif);
-
- unregister_netdev(netif->dev);
-
- if (netif->tx.sring) {
- unmap_frontend_pages(netif);
- free_vm_area(netif->tx_comms_area);
- free_vm_area(netif->rx_comms_area);
- }
-
- free_netdev(netif->dev);
-}
-
void netif_disconnect(netif_t *netif)
{
if (netif_carrier_ok(netif->dev)) {
@@ -348,5 +330,23 @@ void netif_disconnect(netif_t *netif)
rtnl_unlock();
netif_put(netif);
}
- netif_free(netif);
-}
+
+ atomic_dec(&netif->refcnt);
+ wait_event(netif->waiting_to_free, atomic_read(&netif->refcnt) == 0);
+
+ del_timer_sync(&netif->credit_timeout);
+ del_timer_sync(&netif->tx_queue_timeout);
+
+ if (netif->irq)
+ unbind_from_irqhandler(netif->irq, netif);
+
+ unregister_netdev(netif->dev);
+
+ if (netif->tx.sring) {
+ unmap_frontend_pages(netif);
+ free_vm_area(netif->tx_comms_area);
+ free_vm_area(netif->rx_comms_area);
+ }
+
+ free_netdev(netif->dev);
+}
diff -r aa8ca06d209e -r d246b79986d1
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Tue Oct 24
10:08:30 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Tue Oct 24
11:21:48 2006 -0600
@@ -264,6 +264,13 @@ static inline int netbk_queue_full(netif
((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) < needed);
}
+static void tx_queue_callback(unsigned long data)
+{
+ netif_t *netif = (netif_t *)data;
+ if (netif_schedulable(netif->dev))
+ netif_wake_queue(netif->dev);
+}
+
int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
netif_t *netif = netdev_priv(dev);
@@ -271,20 +278,13 @@ int netif_be_start_xmit(struct sk_buff *
BUG_ON(skb->dev != dev);
/* Drop the packet if the target domain has no receive buffers. */
- if (unlikely(!netif_running(dev) || !netif_carrier_ok(dev)))
+ if (unlikely(!netif_schedulable(dev) || netbk_queue_full(netif)))
goto drop;
- if (unlikely(netbk_queue_full(netif))) {
- /* Not a BUG_ON() -- misbehaving netfront can trigger this. */
- if (netbk_can_queue(dev))
- DPRINTK("Queue full but not stopped!\n");
- goto drop;
- }
-
- /* Copy the packet here if it's destined for a flipping
- interface but isn't flippable (e.g. extra references to
- data)
- */
+ /*
+ * Copy the packet here if it's destined for a flipping interface
+ * but isn't flippable (e.g. extra references to data).
+ */
if (!netif->copying_receiver && !is_flippable_skb(skb)) {
struct sk_buff *nskb = netbk_copy_skb(skb);
if ( unlikely(nskb == NULL) )
@@ -305,8 +305,19 @@ int netif_be_start_xmit(struct sk_buff *
netif->rx.sring->req_event = netif->rx_req_cons_peek +
netbk_max_required_rx_slots(netif);
mb(); /* request notification /then/ check & stop the queue */
- if (netbk_queue_full(netif))
+ if (netbk_queue_full(netif)) {
netif_stop_queue(dev);
+ /*
+ * Schedule 500ms timeout to restart the queue, thus
+ * ensuring that an inactive queue will be drained.
+ * Packets will be immediately be dropped until more
+ * receive buffers become available (see
+ * netbk_queue_full() check above).
+ */
+ netif->tx_queue_timeout.data = (unsigned long)netif;
+ netif->tx_queue_timeout.function = tx_queue_callback;
+ __mod_timer(&netif->tx_queue_timeout, jiffies + HZ/2);
+ }
}
skb_queue_tail(&rx_queue, skb);
@@ -706,6 +717,7 @@ static void net_rx_action(unsigned long
}
if (netif_queue_stopped(netif->dev) &&
+ netif_schedulable(netif->dev) &&
!netbk_queue_full(netif))
netif_wake_queue(netif->dev);
@@ -763,8 +775,7 @@ static void add_to_net_schedule_list_tai
spin_lock_irq(&net_schedule_list_lock);
if (!__on_net_schedule_list(netif) &&
- likely(netif_running(netif->dev) &&
- netif_carrier_ok(netif->dev))) {
+ likely(netif_schedulable(netif->dev))) {
list_add_tail(&netif->list, &net_schedule_list);
netif_get(netif);
}
@@ -1358,7 +1369,7 @@ irqreturn_t netif_be_int(int irq, void *
add_to_net_schedule_list_tail(netif);
maybe_schedule_tx_action();
- if (netif_queue_stopped(netif->dev) && !netbk_queue_full(netif))
+ if (netif_schedulable(netif->dev) && !netbk_queue_full(netif))
netif_wake_queue(netif->dev);
return IRQ_HANDLED;
diff -r aa8ca06d209e -r d246b79986d1
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Tue Oct 24 10:08:30
2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Tue Oct 24 11:21:48
2006 -0600
@@ -328,7 +328,7 @@ static void connect(struct backend_info
/* May not get a kick from the frontend, so start the tx_queue now. */
if (!netbk_can_queue(be->netif->dev))
- netif_start_queue(be->netif->dev);
+ netif_wake_queue(be->netif->dev);
}
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/domain-timeoffset
--- a/tools/ioemu/patches/domain-timeoffset Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/domain-timeoffset Tue Oct 24 11:21:48 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/hw/mc146818rtc.c
Index: ioemu/hw/mc146818rtc.c
===================================================================
---- ioemu.orig/hw/mc146818rtc.c 2006-09-21 19:33:25.000000000 +0100
-+++ ioemu/hw/mc146818rtc.c 2006-09-21 19:33:30.000000000 +0100
+--- ioemu.orig/hw/mc146818rtc.c 2006-10-24 14:45:21.000000000 +0100
++++ ioemu/hw/mc146818rtc.c 2006-10-24 14:45:39.000000000 +0100
@@ -178,10 +178,27 @@
}
}
@@ -46,8 +46,8 @@ Index: ioemu/hw/mc146818rtc.c
static void rtc_copy_date(RTCState *s)
Index: ioemu/hw/pc.c
===================================================================
---- ioemu.orig/hw/pc.c 2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/hw/pc.c 2006-09-21 19:33:30.000000000 +0100
+--- ioemu.orig/hw/pc.c 2006-10-24 14:45:38.000000000 +0100
++++ ioemu/hw/pc.c 2006-10-24 14:45:39.000000000 +0100
@@ -159,7 +159,7 @@
}
@@ -117,8 +117,8 @@ Index: ioemu/hw/pc.c
QEMUMachine pc_machine = {
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:30.000000000 +0100
+--- ioemu.orig/vl.c 2006-10-24 14:45:38.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:45:39.000000000 +0100
@@ -163,6 +163,8 @@
int xc_handle;
@@ -174,8 +174,8 @@ Index: ioemu/vl.c
if (usb_enabled) {
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:30.000000000 +0100
+--- ioemu.orig/vl.h 2006-10-24 14:45:38.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:45:39.000000000 +0100
@@ -576,7 +576,7 @@
int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/qemu-bootorder
--- a/tools/ioemu/patches/qemu-bootorder Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/qemu-bootorder Tue Oct 24 11:21:48 2006 -0600
@@ -1,9 +1,9 @@ Index: ioemu/vl.c
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:32.000000000 +0100
-@@ -124,7 +124,7 @@
- int vncunused;
+--- ioemu.orig/vl.c 2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:47.000000000 +0100
+@@ -125,7 +125,7 @@
+ struct sockaddr_in vnclisten_addr;
const char* keyboard_layout = NULL;
int64_t ticks_per_sec;
-int boot_device = 'c';
@@ -11,7 +11,7 @@ Index: ioemu/vl.c
uint64_t ram_size;
int pit_min_timer_count = 0;
int nb_nics;
-@@ -6063,14 +6063,14 @@
+@@ -6075,14 +6075,14 @@
break;
#endif /* !CONFIG_DM */
case QEMU_OPTION_boot:
@@ -32,7 +32,7 @@ Index: ioemu/vl.c
exit(1);
}
break;
-@@ -6334,6 +6334,7 @@
+@@ -6349,6 +6349,7 @@
fd_filename[0] == '\0')
help();
@@ -40,7 +40,7 @@ Index: ioemu/vl.c
/* boot to cd by default if no hard disk */
if (hd_filename[0] == '\0' && boot_device == 'c') {
if (fd_filename[0] != '\0')
-@@ -6341,6 +6342,7 @@
+@@ -6356,6 +6357,7 @@
else
boot_device = 'd';
}
@@ -48,7 +48,7 @@ Index: ioemu/vl.c
#endif /* !CONFIG_DM */
setvbuf(stdout, NULL, _IOLBF, 0);
-@@ -6599,6 +6601,7 @@
+@@ -6614,6 +6616,7 @@
ds, fd_filename, snapshot,
kernel_filename, kernel_cmdline, initrd_filename,
timeoffset);
@@ -58,9 +58,9 @@ Index: ioemu/vl.c
if (usb_enabled) {
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:32.000000000 +0100
-@@ -576,7 +576,7 @@
+--- ioemu.orig/vl.h 2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:47.000000000 +0100
+@@ -578,7 +578,7 @@
#ifndef QEMU_TOOL
typedef void QEMUMachineInitFunc(uint64_t ram_size, int vga_ram_size,
@@ -69,7 +69,7 @@ Index: ioemu/vl.h
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, time_t timeoffset);
-@@ -1021,7 +1021,7 @@
+@@ -1023,7 +1023,7 @@
uint32_t start, uint32_t count);
int PPC_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
const unsigned char *arch,
@@ -80,8 +80,8 @@ Index: ioemu/vl.h
uint32_t initrd_image, uint32_t initrd_size,
Index: ioemu/hw/pc.c
===================================================================
---- ioemu.orig/hw/pc.c 2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/hw/pc.c 2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/hw/pc.c 2006-10-24 14:33:47.000000000 +0100
++++ ioemu/hw/pc.c 2006-10-24 14:33:47.000000000 +0100
@@ -158,8 +158,23 @@
rtc_set_memory(s, info_ofs + 8, sectors);
}
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/qemu-cleanup
--- a/tools/ioemu/patches/qemu-cleanup Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/qemu-cleanup Tue Oct 24 11:21:48 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/hw/vga.c
Index: ioemu/hw/vga.c
===================================================================
---- ioemu.orig/hw/vga.c 2006-08-06 02:03:51.906765409 +0100
-+++ ioemu/hw/vga.c 2006-08-06 02:15:10.364150665 +0100
+--- ioemu.orig/hw/vga.c 2006-10-24 14:44:03.000000000 +0100
++++ ioemu/hw/vga.c 2006-10-24 14:45:22.000000000 +0100
@@ -1622,7 +1622,9 @@
static void vga_save(QEMUFile *f, void *opaque)
{
@@ -26,8 +26,8 @@ Index: ioemu/hw/vga.c
return -EINVAL;
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-08-06 02:15:01.774108287 +0100
-+++ ioemu/vl.c 2006-08-06 02:15:31.040845624 +0100
+--- ioemu.orig/vl.c 2006-10-24 14:44:08.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:45:29.000000000 +0100
@@ -39,6 +39,7 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
@@ -36,6 +36,24 @@ Index: ioemu/vl.c
#include <dirent.h>
#include <netdb.h>
#ifdef _BSD
+@@ -2932,7 +2933,7 @@
+ }
+
+ /* XXX: better tmp dir construction */
+- snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
++ snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%ld", (long)getpid());
+ if (mkdir(smb_dir, 0700) < 0) {
+ fprintf(stderr, "qemu: could not create samba server dir '%s'\n",
smb_dir);
+ exit(1);
+@@ -3893,7 +3894,7 @@
+ perror("Opening pidfile");
+ exit(1);
+ }
+- fprintf(f, "%d\n", getpid());
++ fprintf(f, "%ld\n", (long)getpid());
+ fclose(f);
+ pid_filename = qemu_strdup(filename);
+ if (!pid_filename) {
@@ -5308,7 +5309,9 @@
QEMU_OPTION_d,
QEMU_OPTION_hdachs,
@@ -70,8 +88,8 @@ Index: ioemu/vl.c
fprintf(stderr, "qemu: too many network clients\n");
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-08-06 02:15:01.775108175 +0100
-+++ ioemu/vl.h 2006-08-06 02:15:10.368150219 +0100
+--- ioemu.orig/vl.h 2006-10-24 14:44:08.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:45:22.000000000 +0100
@@ -957,7 +957,7 @@
unsigned long vram_offset, int vram_size, int width, int height);
@@ -81,3 +99,18 @@ Index: ioemu/vl.h
void slavio_intctl_set_cpu(void *opaque, unsigned int cpu, CPUState *env);
void slavio_pic_info(void *opaque);
void slavio_irq_info(void *opaque);
+Index: ioemu/usb-linux.c
+===================================================================
+--- ioemu.orig/usb-linux.c 2006-10-24 14:44:03.000000000 +0100
++++ ioemu/usb-linux.c 2006-10-24 14:44:08.000000000 +0100
+@@ -26,7 +26,9 @@
+ #if defined(__linux__)
+ #include <dirent.h>
+ #include <sys/ioctl.h>
+-#include <linux/compiler.h>
++/* Some versions of usbdevice_fs.h need __user to be defined for them. */
++/* This may (harmlessly) conflict with a definition in linux/compiler.h. */
++#define __user
+ #include <linux/usbdevice_fs.h>
+ #include <linux/version.h>
+
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/qemu-daemonize
--- a/tools/ioemu/patches/qemu-daemonize Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/qemu-daemonize Tue Oct 24 11:21:48 2006 -0600
@@ -2,9 +2,9 @@ Changes required because qemu-dm runs da
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:32.000000000 +0100
-@@ -6042,10 +6042,11 @@
+--- ioemu.orig/vl.c 2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:47.000000000 +0100
+@@ -6054,10 +6054,11 @@
}
break;
case QEMU_OPTION_nographic:
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/qemu-logging
--- a/tools/ioemu/patches/qemu-logging Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/qemu-logging Tue Oct 24 11:21:48 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-08-06 02:15:48.550893605 +0100
-+++ ioemu/vl.c 2006-08-06 02:16:31.246133963 +0100
+--- ioemu.orig/vl.c 2006-10-24 14:36:58.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:37:03.000000000 +0100
@@ -5234,7 +5234,7 @@
"-S freeze CPU at startup (use 'c' to start
execution)\n"
"-s wait gdb connection to port %d\n"
@@ -43,7 +43,7 @@ Index: ioemu/vl.c
/* default mac address of the first network interface */
+ /* init debug */
-+ sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%d.log", getpid());
++ sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%ld.log",
(long)getpid());
+ cpu_set_log_filename(qemu_dm_logfilename);
+ cpu_set_log(0);
+
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/qemu-target-i386-dm
--- a/tools/ioemu/patches/qemu-target-i386-dm Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/qemu-target-i386-dm Tue Oct 24 11:21:48 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/Makefile.target
Index: ioemu/Makefile.target
===================================================================
---- ioemu.orig/Makefile.target 2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/Makefile.target 2006-09-21 18:54:22.000000000 +0100
+--- ioemu.orig/Makefile.target 2006-10-24 13:47:23.000000000 +0100
++++ ioemu/Makefile.target 2006-10-24 14:30:56.000000000 +0100
@@ -62,6 +62,8 @@
QEMU_SYSTEM=qemu-fast
endif
@@ -32,8 +32,8 @@ Index: ioemu/Makefile.target
DEFINES += -DHAS_AUDIO
Index: ioemu/configure
===================================================================
---- ioemu.orig/configure 2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/configure 2006-09-21 18:54:21.000000000 +0100
+--- ioemu.orig/configure 2006-10-24 13:47:23.000000000 +0100
++++ ioemu/configure 2006-10-24 14:29:34.000000000 +0100
@@ -373,6 +373,8 @@
if [ "$user" = "yes" ] ; then
target_list="i386-user arm-user armeb-user sparc-user ppc-user
mips-user mipsel-user $target_list"
@@ -45,8 +45,8 @@ Index: ioemu/configure
fi
Index: ioemu/monitor.c
===================================================================
---- ioemu.orig/monitor.c 2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/monitor.c 2006-09-21 18:54:23.000000000 +0100
+--- ioemu.orig/monitor.c 2006-10-24 13:47:23.000000000 +0100
++++ ioemu/monitor.c 2006-10-24 14:30:56.000000000 +0100
@@ -1262,6 +1262,10 @@
"", "show profiling information", },
{ "capture", "", do_info_capture,
@@ -60,8 +60,8 @@ Index: ioemu/monitor.c
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 18:54:23.000000000 +0100
+--- ioemu.orig/vl.c 2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:30:56.000000000 +0100
@@ -87,7 +87,7 @@
#include "exec-all.h"
@@ -98,8 +98,8 @@ Index: ioemu/vl.c
{
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 11:30:11.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 18:54:23.000000000 +0100
+--- ioemu.orig/vl.h 2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:30:56.000000000 +0100
@@ -37,6 +37,8 @@
#include <unistd.h>
#include <fcntl.h>
@@ -132,7 +132,7 @@ Index: ioemu/target-i386-dm/cpu.h
Index: ioemu/target-i386-dm/cpu.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/cpu.h 2006-09-21 18:54:22.000000000 +0100
++++ ioemu/target-i386-dm/cpu.h 2006-10-24 14:30:56.000000000 +0100
@@ -0,0 +1,86 @@
+/*
+ * i386 virtual CPU header
@@ -223,7 +223,7 @@ Index: ioemu/target-i386-dm/exec-dm.c
Index: ioemu/target-i386-dm/exec-dm.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/exec-dm.c 2006-09-21 18:54:22.000000000 +0100
++++ ioemu/target-i386-dm/exec-dm.c 2006-10-24 14:30:56.000000000 +0100
@@ -0,0 +1,516 @@
+/*
+ * virtual page mapping and translated block handling
@@ -744,7 +744,7 @@ Index: ioemu/target-i386-dm/helper2.c
Index: ioemu/target-i386-dm/helper2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/helper2.c 2006-09-21 18:55:31.000000000 +0100
++++ ioemu/target-i386-dm/helper2.c 2006-10-24 14:31:01.000000000 +0100
@@ -0,0 +1,469 @@
+/*
+ * i386 helpers (without register variable usage)
@@ -1205,8 +1205,8 @@ Index: ioemu/target-i386-dm/helper2.c
+ break;
+ }
+
-+ /* Wait up to 100 msec. */
-+ main_loop_wait(100);
++ /* Wait up to 10 msec. */
++ main_loop_wait(10);
+
+ if (env->send_event) {
+ env->send_event = 0;
@@ -1218,7 +1218,7 @@ Index: ioemu/target-i386-dm/i8259-dm.c
Index: ioemu/target-i386-dm/i8259-dm.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/i8259-dm.c 2006-09-21 11:30:11.000000000 +0100
++++ ioemu/target-i386-dm/i8259-dm.c 2006-10-24 13:47:23.000000000 +0100
@@ -0,0 +1,107 @@
+/* Xen 8259 stub for interrupt controller emulation
+ *
@@ -1330,7 +1330,7 @@ Index: ioemu/target-i386-dm/qemu-dm.debu
Index: ioemu/target-i386-dm/qemu-dm.debug
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/qemu-dm.debug 2006-09-21 11:30:11.000000000 +0100
++++ ioemu/target-i386-dm/qemu-dm.debug 2006-10-24 13:47:23.000000000 +0100
@@ -0,0 +1,5 @@
+#!/bin/sh
+
@@ -1340,7 +1340,7 @@ Index: ioemu/target-i386-dm/qemu-ifup
Index: ioemu/target-i386-dm/qemu-ifup
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/qemu-ifup 2006-09-21 11:30:11.000000000 +0100
++++ ioemu/target-i386-dm/qemu-ifup 2006-10-24 13:47:23.000000000 +0100
@@ -0,0 +1,10 @@
+#!/bin/sh
+
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/series
--- a/tools/ioemu/patches/series Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/series Tue Oct 24 11:21:48 2006 -0600
@@ -32,10 +32,12 @@ fix-vga-scanning-code-overflow
fix-vga-scanning-code-overflow
vnc-cleanup
vnc-fixes
+vnc-protocol-fixes
vnc-start-vncviewer
vnc-title-domain-name
vnc-access-monitor-vt
vnc-display-find-unused
+vnc-listen-specific-interface
vnc-backoff-screen-scan
xenstore-block-device-config
xenstore-write-vnc-port
@@ -47,3 +49,7 @@ qemu-bootorder
qemu-bootorder
qemu-tunable-ide-write-cache
qemu-pci
+serial-port-rate-limit
+hypervisor-rtc
+ide-cd-dma
+vnc-password
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/vnc-access-monitor-vt
--- a/tools/ioemu/patches/vnc-access-monitor-vt Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/vnc-access-monitor-vt Tue Oct 24 11:21:48 2006 -0600
@@ -1,8 +1,8 @@ Index: ioemu/vnc.c
Index: ioemu/vnc.c
===================================================================
---- ioemu.orig/vnc.c 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vnc.c 2006-09-21 19:33:31.000000000 +0100
-@@ -32,6 +32,10 @@
+--- ioemu.orig/vnc.c 2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vnc.c 2006-10-24 14:33:46.000000000 +0100
+@@ -33,6 +33,10 @@
#include "vnc_keysym.h"
#include "keymaps.c"
@@ -13,7 +13,7 @@ Index: ioemu/vnc.c
typedef struct Buffer
{
size_t capacity;
-@@ -95,6 +99,8 @@
+@@ -96,6 +100,8 @@
int visible_h;
int slow_client;
@@ -22,7 +22,7 @@ Index: ioemu/vnc.c
};
#define DIRTY_PIXEL_BITS 64
-@@ -791,16 +797,80 @@
+@@ -794,16 +800,80 @@
static void do_key_event(VncState *vs, int down, uint32_t sym)
{
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/vnc-backoff-screen-scan
--- a/tools/ioemu/patches/vnc-backoff-screen-scan Tue Oct 24 10:08:30
2006 -0600
+++ b/tools/ioemu/patches/vnc-backoff-screen-scan Tue Oct 24 11:21:48
2006 -0600
@@ -1,10 +1,10 @@ Index: ioemu/vnc.c
Index: ioemu/vnc.c
===================================================================
---- ioemu.orig/vnc.c 2006-09-21 19:31:03.000000000 +0100
-+++ ioemu/vnc.c 2006-09-21 19:32:23.000000000 +0100
-@@ -27,7 +27,19 @@
- #include "vl.h"
+--- ioemu.orig/vnc.c 2006-10-24 14:33:17.000000000 +0100
++++ ioemu/vnc.c 2006-10-24 14:33:24.000000000 +0100
+@@ -28,7 +28,19 @@
#include "qemu_socket.h"
+ #include <assert.h>
-#define VNC_REFRESH_INTERVAL (1000 / 30)
+/* The refresh interval starts at BASE. If we scan the buffer and
@@ -23,7 +23,7 @@ Index: ioemu/vnc.c
#include "vnc_keysym.h"
#include "keymaps.c"
-@@ -64,10 +76,11 @@
+@@ -65,10 +77,11 @@
struct VncState
{
QEMUTimer *timer;
@@ -36,7 +36,7 @@ Index: ioemu/vnc.c
int width;
int height;
uint64_t *dirty_row; /* screen regions which are possibly dirty */
-@@ -98,8 +111,6 @@
+@@ -99,8 +112,6 @@
int visible_w;
int visible_h;
@@ -45,7 +45,7 @@ Index: ioemu/vnc.c
int ctl_keys; /* Ctrl+Alt starts calibration */
};
-@@ -380,7 +391,7 @@
+@@ -381,7 +392,7 @@
int y = 0;
int pitch = ds->linesize;
VncState *vs = ds->opaque;
@@ -54,19 +54,19 @@ Index: ioemu/vnc.c
if (src_x < vs->visible_x || src_y < vs->visible_y ||
dst_x < vs->visible_x || dst_y < vs->visible_y ||
-@@ -390,11 +401,6 @@
+@@ -391,10 +402,8 @@
(dst_y + h) > (vs->visible_y + vs->visible_h))
updating_client = 0;
- if (updating_client) {
- vs->need_update = 1;
-- _vnc_update_client(vs);
++ if (updating_client)
+ _vnc_update_client(vs);
- }
--
+
if (dst_y > src_y) {
y = h - 1;
- pitch = -pitch;
-@@ -445,110 +451,145 @@
+@@ -446,110 +455,149 @@
static void _vnc_update_client(void *opaque)
{
VncState *vs = opaque;
@@ -279,12 +279,16 @@ Index: ioemu/vnc.c
+ interested (e.g. minimised) it'll ignore this, and we
+ can stop scanning the buffer until it sends another
+ update request. */
-+ /* Note that there are bugs in xvncviewer which prevent
-+ this from actually working. Leave the code in place
-+ for correct clients. */
++ /* It turns out that there's a bug in realvncviewer 4.1.2
++ which means that if you send a proper null update (with
++ no update rectangles), it gets a bit out of sync and
++ never sends any further requests, regardless of whether
++ it needs one or not. Fix this by sending a single 1x1
++ update rectangle instead. */
+ vnc_write_u8(vs, 0);
+ vnc_write_u8(vs, 0);
-+ vnc_write_u16(vs, 0);
++ vnc_write_u16(vs, 1);
++ send_framebuffer_update(vs, 0, 0, 1, 1);
+ vnc_flush(vs);
+ vs->last_update_time = now;
+ return;
@@ -295,7 +299,7 @@ Index: ioemu/vnc.c
}
static void vnc_update_client(void *opaque)
-@@ -561,8 +602,10 @@
+@@ -562,8 +610,10 @@
static void vnc_timer_init(VncState *vs)
{
@@ -307,7 +311,7 @@ Index: ioemu/vnc.c
}
static void vnc_dpy_refresh(DisplayState *ds)
-@@ -622,7 +665,6 @@
+@@ -623,7 +673,6 @@
vs->csock = -1;
buffer_reset(&vs->input);
buffer_reset(&vs->output);
@@ -315,7 +319,7 @@ Index: ioemu/vnc.c
return 0;
}
return ret;
-@@ -892,7 +934,6 @@
+@@ -895,7 +944,6 @@
int x_position, int y_position,
int w, int h)
{
@@ -323,7 +327,7 @@ Index: ioemu/vnc.c
if (!incremental)
framebuffer_set_updated(vs, x_position, y_position, w, h);
vs->visible_x = x_position;
-@@ -1015,6 +1056,7 @@
+@@ -1018,6 +1066,7 @@
{
int i;
uint16_t limit;
@@ -331,7 +335,7 @@ Index: ioemu/vnc.c
switch (data[0]) {
case 0:
-@@ -1054,12 +1096,18 @@
+@@ -1061,12 +1110,18 @@
if (len == 1)
return 8;
@@ -352,15 +356,15 @@ Index: ioemu/vnc.c
case 6:
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:31:03.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:32:23.000000000 +0100
-@@ -725,6 +725,12 @@
+--- ioemu.orig/vl.c 2006-10-24 14:33:17.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:24.000000000 +0100
+@@ -726,6 +726,12 @@
}
}
+void qemu_advance_timer(QEMUTimer *ts, int64_t expire_time)
+{
-+ if (ts->expire_time > expire_time)
++ if (ts->expire_time > expire_time || !qemu_timer_pending(ts))
+ qemu_mod_timer(ts, expire_time);
+}
+
@@ -369,9 +373,9 @@ Index: ioemu/vl.c
void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time)
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 19:31:03.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:32:23.000000000 +0100
-@@ -405,6 +405,7 @@
+--- ioemu.orig/vl.h 2006-10-24 14:33:17.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:24.000000000 +0100
+@@ -407,6 +407,7 @@
void qemu_free_timer(QEMUTimer *ts);
void qemu_del_timer(QEMUTimer *ts);
void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/vnc-display-find-unused
--- a/tools/ioemu/patches/vnc-display-find-unused Tue Oct 24 10:08:30
2006 -0600
+++ b/tools/ioemu/patches/vnc-display-find-unused Tue Oct 24 11:21:48
2006 -0600
@@ -1,8 +1,8 @@ Index: ioemu/vnc.c
Index: ioemu/vnc.c
===================================================================
---- ioemu.orig/vnc.c 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vnc.c 2006-09-21 19:33:31.000000000 +0100
-@@ -1182,7 +1182,7 @@
+--- ioemu.orig/vnc.c 2006-10-24 14:31:09.000000000 +0100
++++ ioemu/vnc.c 2006-10-24 14:31:36.000000000 +0100
+@@ -1195,7 +1195,7 @@
}
}
@@ -11,7 +11,7 @@ Index: ioemu/vnc.c
{
struct sockaddr_in addr;
int reuse_addr, ret;
-@@ -1213,10 +1213,6 @@
+@@ -1226,10 +1226,6 @@
exit(1);
}
@@ -22,7 +22,7 @@ Index: ioemu/vnc.c
reuse_addr = 1;
ret = setsockopt(vs->lsock, SOL_SOCKET, SO_REUSEADDR,
(const char *)&reuse_addr, sizeof(reuse_addr));
-@@ -1225,7 +1221,16 @@
+@@ -1238,7 +1234,16 @@
exit(1);
}
@@ -39,7 +39,7 @@ Index: ioemu/vnc.c
fprintf(stderr, "bind() failed\n");
exit(1);
}
-@@ -1246,6 +1251,8 @@
+@@ -1259,6 +1264,8 @@
vs->ds->dpy_refresh = vnc_dpy_refresh;
vnc_dpy_resize(vs->ds, 640, 400);
@@ -50,8 +50,8 @@ Index: ioemu/vnc.c
int vnc_start_viewer(int port)
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/vl.c 2006-10-24 14:31:09.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:31:41.000000000 +0100
@@ -121,6 +121,7 @@
static DisplayState display_state;
int nographic;
@@ -99,7 +99,7 @@ Index: ioemu/vl.c
+ case QEMU_OPTION_vncunused:
+ vncunused++;
+ if (vnc_display == -1)
-+ vnc_display = -2;
++ vnc_display = 0;
+ break;
}
}
@@ -115,8 +115,8 @@ Index: ioemu/vl.c
} else {
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/vl.h 2006-10-24 14:31:09.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:31:36.000000000 +0100
@@ -785,7 +785,7 @@
void cocoa_display_init(DisplayState *ds, int full_screen);
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/vnc-fixes
--- a/tools/ioemu/patches/vnc-fixes Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/vnc-fixes Tue Oct 24 11:21:48 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:08:18.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:26:24.000000000 +0100
+--- ioemu.orig/vl.c 2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:19:36.000000000 +0100
@@ -6534,8 +6534,10 @@
}
}
@@ -17,8 +17,8 @@ Index: ioemu/vl.c
if (use_gdbstub) {
Index: ioemu/vnc.c
===================================================================
---- ioemu.orig/vnc.c 2006-09-21 19:08:18.000000000 +0100
-+++ ioemu/vnc.c 2006-09-21 19:26:38.000000000 +0100
+--- ioemu.orig/vnc.c 2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vnc.c 2006-10-24 14:20:00.000000000 +0100
@@ -3,6 +3,7 @@
*
* Copyright (C) 2006 Anthony Liguori <anthony@xxxxxxxxxxxxx>
@@ -483,7 +483,16 @@ Index: ioemu/vnc.c
vga_hw_invalidate();
vga_hw_update();
-@@ -1010,11 +1101,11 @@
+@@ -924,6 +1015,8 @@
+ {
+ char pad[3] = { 0, 0, 0 };
+
++ vga_hw_update();
++
+ vs->width = vs->ds->width;
+ vs->height = vs->ds->height;
+ vnc_write_u16(vs, vs->ds->width);
+@@ -1010,11 +1103,11 @@
vnc_write(vs, "RFB 003.003\n", 12);
vnc_flush(vs);
vnc_read_when(vs, protocol_version, 12);
@@ -497,7 +506,7 @@ Index: ioemu/vnc.c
}
}
-@@ -1071,17 +1162,15 @@
+@@ -1071,17 +1164,15 @@
exit(1);
}
@@ -520,8 +529,8 @@ Index: ioemu/vnc.c
}
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 19:00:48.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:26:24.000000000 +0100
+--- ioemu.orig/vl.h 2006-10-24 13:47:23.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:19:36.000000000 +0100
@@ -319,6 +319,7 @@
int is_graphic_console(void);
CharDriverState *text_console_init(DisplayState *ds);
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/vnc-start-vncviewer
--- a/tools/ioemu/patches/vnc-start-vncviewer Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/vnc-start-vncviewer Tue Oct 24 11:21:48 2006 -0600
@@ -1,8 +1,8 @@ Index: ioemu/vnc.c
Index: ioemu/vnc.c
===================================================================
---- ioemu.orig/vnc.c 2006-09-21 19:26:38.000000000 +0100
-+++ ioemu/vnc.c 2006-09-21 19:29:58.000000000 +0100
-@@ -1174,3 +1174,25 @@
+--- ioemu.orig/vnc.c 2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vnc.c 2006-10-24 14:33:46.000000000 +0100
+@@ -1187,3 +1187,25 @@
vnc_dpy_resize(vs->ds, 640, 400);
}
@@ -30,8 +30,8 @@ Index: ioemu/vnc.c
+}
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:26:24.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:29:50.000000000 +0100
+--- ioemu.orig/vl.c 2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:46.000000000 +0100
@@ -120,6 +120,7 @@
int bios_size;
static DisplayState display_state;
@@ -93,8 +93,8 @@ Index: ioemu/vl.c
sdl_display_init(ds, full_screen);
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 19:26:24.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:29:50.000000000 +0100
+--- ioemu.orig/vl.h 2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:46.000000000 +0100
@@ -786,6 +786,7 @@
/* vnc.c */
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/vnc-title-domain-name
--- a/tools/ioemu/patches/vnc-title-domain-name Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/vnc-title-domain-name Tue Oct 24 11:21:48 2006 -0600
@@ -1,16 +1,16 @@ Index: ioemu/vnc.c
Index: ioemu/vnc.c
===================================================================
---- ioemu.orig/vnc.c 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vnc.c 2006-09-21 19:33:31.000000000 +0100
-@@ -1013,6 +1013,7 @@
+--- ioemu.orig/vnc.c 2006-10-24 14:33:46.000000000 +0100
++++ ioemu/vnc.c 2006-10-24 14:33:46.000000000 +0100
+@@ -1024,6 +1024,7 @@
static int protocol_client_init(VncState *vs, char *data, size_t len)
{
+ size_t l;
char pad[3] = { 0, 0, 0 };
- vs->width = vs->ds->width;
-@@ -1058,8 +1059,10 @@
+ vga_hw_update();
+@@ -1071,8 +1072,10 @@
vnc_write(vs, pad, 3); /* padding */
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/xen-build
--- a/tools/ioemu/patches/xen-build Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/xen-build Tue Oct 24 11:21:48 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/Makefile
Index: ioemu/Makefile
===================================================================
---- ioemu.orig/Makefile 2006-08-28 20:19:23.000000000 +0100
-+++ ioemu/Makefile 2006-08-28 20:20:08.000000000 +0100
+--- ioemu.orig/Makefile 2006-10-24 14:37:25.000000000 +0100
++++ ioemu/Makefile 2006-10-24 14:37:28.000000000 +0100
@@ -1,11 +1,14 @@
# Makefile for QEMU.
@@ -85,8 +85,8 @@ Index: ioemu/Makefile
info: qemu-doc.info qemu-tech.info
Index: ioemu/Makefile.target
===================================================================
---- ioemu.orig/Makefile.target 2006-08-28 20:19:23.000000000 +0100
-+++ ioemu/Makefile.target 2006-08-28 20:19:47.000000000 +0100
+--- ioemu.orig/Makefile.target 2006-10-24 14:37:25.000000000 +0100
++++ ioemu/Makefile.target 2006-10-24 14:40:25.000000000 +0100
@@ -1,5 +1,8 @@
include config.mak
@@ -112,7 +112,7 @@ Index: ioemu/Makefile.target
endif
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
+CFLAGS+=-Wall -O2 -g -fno-strict-aliasing
-+SSE2 := $(call test-gcc-flag,$(CC),-msse2)
++SSE2 := $(call cc-option,$(CC),-msse2,)
+ifeq ($(SSE2),-msse2)
+CFLAGS += -DUSE_SSE2=1 -msse2
+endif
@@ -149,17 +149,18 @@ Index: ioemu/Makefile.target
install: all
+ mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configdir)"
ifneq ($(PROGS),)
- $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
- endif
-+ install -m 755 $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
-+ install -m 755 $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
+- $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
++ $(INSTALL_PROG) $(PROGS) "$(DESTDIR)$(bindir)"
+ endif
++ $(INSTALL_PROG) $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
++ $(INSTALL_PROG) $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
ifneq ($(wildcard .depend),)
include .depend
Index: ioemu/configure
===================================================================
---- ioemu.orig/configure 2006-08-28 20:19:23.000000000 +0100
-+++ ioemu/configure 2006-08-28 20:19:47.000000000 +0100
+--- ioemu.orig/configure 2006-10-24 14:37:25.000000000 +0100
++++ ioemu/configure 2006-10-24 14:40:20.000000000 +0100
@@ -18,8 +18,8 @@
# default parameters
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/xen-platform-device
--- a/tools/ioemu/patches/xen-platform-device Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/ioemu/patches/xen-platform-device Tue Oct 24 11:21:48 2006 -0600
@@ -3,8 +3,8 @@ will come later.
Index: ioemu/Makefile.target
===================================================================
---- ioemu.orig/Makefile.target 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/Makefile.target 2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/Makefile.target 2006-10-24 14:41:01.000000000 +0100
++++ ioemu/Makefile.target 2006-10-24 14:41:01.000000000 +0100
@@ -359,6 +359,7 @@
VL_OBJS+= usb-uhci.o
VL_OBJS+= piix4acpi.o
@@ -15,8 +15,8 @@ Index: ioemu/Makefile.target
ifeq ($(TARGET_BASE_ARCH), ppc)
Index: ioemu/hw/pc.c
===================================================================
---- ioemu.orig/hw/pc.c 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/hw/pc.c 2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/hw/pc.c 2006-10-24 14:41:00.000000000 +0100
++++ ioemu/hw/pc.c 2006-10-24 14:41:01.000000000 +0100
@@ -823,6 +823,9 @@
}
#endif /* !CONFIG_DM */
@@ -30,8 +30,8 @@ Index: ioemu/hw/xen_platform.c
Index: ioemu/hw/xen_platform.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/hw/xen_platform.c 2006-09-21 19:33:32.000000000 +0100
-@@ -0,0 +1,138 @@
++++ ioemu/hw/xen_platform.c 2006-10-24 14:41:04.000000000 +0100
+@@ -0,0 +1,144 @@
+/*
+ * XEN platform fake pci device, formerly known as the event channel device
+ *
@@ -131,7 +131,8 @@ Index: ioemu/hw/xen_platform.c
+ uint8_t bist; /* Built in self test */
+ uint32_t base_address_regs[6];
+ uint32_t reserved1;
-+ uint32_t reserved2;
++ uint16_t subsystem_vendor_id;
++ uint16_t subsystem_id;
+ uint32_t rom_addr;
+ uint32_t reserved3;
+ uint32_t reserved4;
@@ -160,6 +161,11 @@ Index: ioemu/hw/xen_platform.c
+ pch->header_type = 0;
+ pch->interrupt_pin = 1;
+
++ /* Microsoft WHQL requires non-zero subsystem IDs. */
++ /* http://www.pcisig.com/reflector/msg02205.html. */
++ pch->subsystem_vendor_id = pch->vendor_id; /* Duplicate vendor id. */
++ pch->subsystem_id = 0x0001; /* Hardcode sub-id as 1. */
++
+ pci_register_io_region(d, 0, 0x100, PCI_ADDRESS_SPACE_IO,
+ platform_ioport_map);
+
@@ -172,9 +178,9 @@ Index: ioemu/hw/xen_platform.c
+}
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:32.000000000 +0100
-@@ -1210,6 +1210,9 @@
+--- ioemu.orig/vl.h 2006-10-24 14:41:01.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:41:01.000000000 +0100
+@@ -1212,6 +1212,9 @@
void xenstore_check_new_media_present(int timeout);
void xenstore_write_vncport(int vnc_display);
diff -r aa8ca06d209e -r d246b79986d1
tools/ioemu/patches/xen-support-buffered-ioreqs
--- a/tools/ioemu/patches/xen-support-buffered-ioreqs Tue Oct 24 10:08:30
2006 -0600
+++ b/tools/ioemu/patches/xen-support-buffered-ioreqs Tue Oct 24 11:21:48
2006 -0600
@@ -1,8 +1,8 @@ Index: ioemu/vl.c
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:33:32.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:32.000000000 +0100
-@@ -5844,6 +5844,7 @@
+--- ioemu.orig/vl.c 2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:47.000000000 +0100
+@@ -5854,6 +5854,7 @@
unsigned long nr_pages, tmp_nr_pages, shared_page_nr;
xen_pfn_t *page_array;
extern void *shared_page;
@@ -10,7 +10,7 @@ Index: ioemu/vl.c
char qemu_dm_logfilename[64];
-@@ -6425,6 +6426,18 @@
+@@ -6440,6 +6441,18 @@
fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n",
shared_page_nr, (uint64_t)(page_array[shared_page_nr]));
@@ -31,8 +31,8 @@ Index: ioemu/vl.c
#elif defined(__ia64__)
Index: ioemu/target-i386-dm/helper2.c
===================================================================
---- ioemu.orig/target-i386-dm/helper2.c 2006-09-21 19:33:30.000000000
+0100
-+++ ioemu/target-i386-dm/helper2.c 2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/target-i386-dm/helper2.c 2006-10-24 14:33:45.000000000
+0100
++++ ioemu/target-i386-dm/helper2.c 2006-10-24 14:33:47.000000000 +0100
@@ -76,6 +76,10 @@
shared_iopage_t *shared_page = NULL;
diff -r aa8ca06d209e -r d246b79986d1
tools/ioemu/patches/xenstore-block-device-config
--- a/tools/ioemu/patches/xenstore-block-device-config Tue Oct 24 10:08:30
2006 -0600
+++ b/tools/ioemu/patches/xenstore-block-device-config Tue Oct 24 11:21:48
2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/Makefile.target
Index: ioemu/Makefile.target
===================================================================
---- ioemu.orig/Makefile.target 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/Makefile.target 2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/Makefile.target 2006-10-24 14:31:36.000000000 +0100
++++ ioemu/Makefile.target 2006-10-24 14:33:28.000000000 +0100
@@ -358,6 +358,7 @@
VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o
VL_OBJS+= usb-uhci.o
@@ -13,7 +13,7 @@ Index: ioemu/xenstore.c
Index: ioemu/xenstore.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/xenstore.c 2006-09-21 19:33:31.000000000 +0100
++++ ioemu/xenstore.c 2006-10-24 14:33:28.000000000 +0100
@@ -0,0 +1,187 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General
@@ -204,9 +204,9 @@ Index: ioemu/xenstore.c
+}
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:31.000000000 +0100
-@@ -5249,9 +5249,11 @@
+--- ioemu.orig/vl.c 2006-10-24 14:33:24.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:28.000000000 +0100
+@@ -5256,9 +5256,11 @@
"Standard options:\n"
"-M machine select emulated machine (-M ? for list)\n"
"-fda/-fdb file use 'file' as floppy disk 0/1 image\n"
@@ -218,7 +218,7 @@ Index: ioemu/vl.c
"-boot [a|c|d] boot on floppy (a), hard disk (c) or CD-ROM (d)\n"
"-snapshot write to temporary files instead of disk image
files\n"
#ifdef TARGET_I386
-@@ -5378,11 +5380,13 @@
+@@ -5386,11 +5388,13 @@
QEMU_OPTION_M,
QEMU_OPTION_fda,
QEMU_OPTION_fdb,
@@ -232,7 +232,7 @@ Index: ioemu/vl.c
QEMU_OPTION_boot,
QEMU_OPTION_snapshot,
#ifdef TARGET_I386
-@@ -5454,11 +5458,13 @@
+@@ -5463,11 +5467,13 @@
{ "M", HAS_ARG, QEMU_OPTION_M },
{ "fda", HAS_ARG, QEMU_OPTION_fda },
{ "fdb", HAS_ARG, QEMU_OPTION_fdb },
@@ -246,7 +246,7 @@ Index: ioemu/vl.c
{ "boot", HAS_ARG, QEMU_OPTION_boot },
{ "snapshot", 0, QEMU_OPTION_snapshot },
#ifdef TARGET_I386
-@@ -5807,10 +5813,16 @@
+@@ -5817,10 +5823,16 @@
#ifdef CONFIG_GDBSTUB
int use_gdbstub, gdbstub_port;
#endif
@@ -265,7 +265,7 @@ Index: ioemu/vl.c
const char *kernel_filename, *kernel_cmdline;
DisplayState *ds = &display_state;
int cyls, heads, secs, translation;
-@@ -5871,8 +5883,10 @@
+@@ -5881,8 +5893,10 @@
initrd_filename = NULL;
for(i = 0; i < MAX_FD; i++)
fd_filename[i] = NULL;
@@ -276,7 +276,7 @@ Index: ioemu/vl.c
ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
vga_ram_size = VGA_RAM_SIZE;
bios_size = BIOS_SIZE;
-@@ -5886,11 +5900,13 @@
+@@ -5896,11 +5910,13 @@
vncunused = 0;
kernel_filename = NULL;
kernel_cmdline = "";
@@ -290,7 +290,7 @@ Index: ioemu/vl.c
cyls = heads = secs = 0;
translation = BIOS_ATA_TRANSLATION_AUTO;
pstrcpy(monitor_device, sizeof(monitor_device), "vc");
-@@ -5923,7 +5939,11 @@
+@@ -5935,7 +5951,11 @@
break;
r = argv[optind];
if (r[0] != '-') {
@@ -302,7 +302,7 @@ Index: ioemu/vl.c
} else {
const QEMUOption *popt;
-@@ -5967,6 +5987,7 @@
+@@ -5979,6 +5999,7 @@
case QEMU_OPTION_initrd:
initrd_filename = optarg;
break;
@@ -310,7 +310,7 @@ Index: ioemu/vl.c
case QEMU_OPTION_hda:
case QEMU_OPTION_hdb:
case QEMU_OPTION_hdc:
-@@ -5979,6 +6000,7 @@
+@@ -5991,6 +6012,7 @@
cdrom_index = -1;
}
break;
@@ -318,7 +318,7 @@ Index: ioemu/vl.c
case QEMU_OPTION_snapshot:
snapshot = 1;
break;
-@@ -6031,11 +6053,13 @@
+@@ -6043,11 +6065,13 @@
case QEMU_OPTION_append:
kernel_cmdline = optarg;
break;
@@ -332,7 +332,7 @@ Index: ioemu/vl.c
case QEMU_OPTION_boot:
boot_device = optarg[0];
if (boot_device != 'a' &&
-@@ -6290,12 +6314,18 @@
+@@ -6305,12 +6329,18 @@
}
}
@@ -351,7 +351,7 @@ Index: ioemu/vl.c
if (!linux_boot &&
hd_filename[0] == '\0' &&
(cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
-@@ -6309,6 +6339,7 @@
+@@ -6324,6 +6354,7 @@
else
boot_device = 'd';
}
@@ -359,7 +359,7 @@ Index: ioemu/vl.c
setvbuf(stdout, NULL, _IOLBF, 0);
-@@ -6441,6 +6472,7 @@
+@@ -6456,6 +6487,7 @@
#endif /* !CONFIG_DM */
@@ -367,7 +367,7 @@ Index: ioemu/vl.c
/* we always create the cdrom drive, even if no disk is there */
bdrv_init();
if (cdrom_index >= 0) {
-@@ -6467,6 +6499,7 @@
+@@ -6482,6 +6514,7 @@
}
}
}
@@ -375,7 +375,7 @@ Index: ioemu/vl.c
/* we always create at least one floppy disk */
fd_table[0] = bdrv_new("fda");
-@@ -6545,6 +6578,8 @@
+@@ -6560,6 +6593,8 @@
}
}
@@ -386,8 +386,8 @@ Index: ioemu/vl.c
kernel_filename, kernel_cmdline, initrd_filename,
Index: ioemu/monitor.c
===================================================================
---- ioemu.orig/monitor.c 2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/monitor.c 2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/monitor.c 2006-10-24 14:31:36.000000000 +0100
++++ ioemu/monitor.c 2006-10-24 14:33:28.000000000 +0100
@@ -24,6 +24,7 @@
#include "vl.h"
#include "disas.h"
@@ -416,8 +416,8 @@ Index: ioemu/monitor.c
int i;
Index: ioemu/block.c
===================================================================
---- ioemu.orig/block.c 2006-09-21 19:33:25.000000000 +0100
-+++ ioemu/block.c 2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/block.c 2006-10-24 14:31:36.000000000 +0100
++++ ioemu/block.c 2006-10-24 14:33:28.000000000 +0100
@@ -758,6 +758,7 @@
static void raw_close(BlockDriverState *bs)
{
@@ -428,9 +428,9 @@ Index: ioemu/block.c
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:31.000000000 +0100
-@@ -1189,6 +1189,8 @@
+--- ioemu.orig/vl.h 2006-10-24 14:33:24.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:28.000000000 +0100
+@@ -1191,6 +1191,8 @@
void term_print_help(void);
void monitor_readline(const char *prompt, int is_password,
char *buf, int buf_size);
@@ -439,7 +439,7 @@ Index: ioemu/vl.h
/* readline.c */
typedef void ReadLineFunc(void *opaque, const char *str);
-@@ -1201,6 +1203,13 @@
+@@ -1203,6 +1205,13 @@
void readline_start(const char *prompt, int is_password,
ReadLineFunc *readline_func, void *opaque);
@@ -455,8 +455,8 @@ Index: ioemu/vl.h
extern char domain_name[];
Index: ioemu/hw/ide.c
===================================================================
---- ioemu.orig/hw/ide.c 2006-09-21 19:33:30.000000000 +0100
-+++ ioemu/hw/ide.c 2006-09-21 19:33:31.000000000 +0100
+--- ioemu.orig/hw/ide.c 2006-10-24 14:31:36.000000000 +0100
++++ ioemu/hw/ide.c 2006-10-24 14:33:28.000000000 +0100
@@ -1158,6 +1158,7 @@
} else {
ide_atapi_cmd_error(s, SENSE_NOT_READY,
diff -r aa8ca06d209e -r d246b79986d1 tools/ioemu/patches/xenstore-write-vnc-port
--- a/tools/ioemu/patches/xenstore-write-vnc-port Tue Oct 24 10:08:30
2006 -0600
+++ b/tools/ioemu/patches/xenstore-write-vnc-port Tue Oct 24 11:21:48
2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/xenstore.c
Index: ioemu/xenstore.c
===================================================================
---- ioemu.orig/xenstore.c 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/xenstore.c 2006-09-21 19:33:32.000000000 +0100
+--- ioemu.orig/xenstore.c 2006-10-24 14:33:47.000000000 +0100
++++ ioemu/xenstore.c 2006-10-24 14:33:47.000000000 +0100
@@ -185,3 +185,31 @@
free(image);
free(vec);
@@ -36,10 +36,10 @@ Index: ioemu/xenstore.c
+}
Index: ioemu/vl.c
===================================================================
---- ioemu.orig/vl.c 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.c 2006-09-21 19:33:32.000000000 +0100
-@@ -6535,6 +6535,7 @@
- vnc_display = vnc_display_init(ds, vnc_display, vncunused);
+--- ioemu.orig/vl.c 2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.c 2006-10-24 14:33:47.000000000 +0100
+@@ -6550,6 +6550,7 @@
+ vnc_display = vnc_display_init(ds, vnc_display, vncunused,
&vnclisten_addr);
if (vncviewer)
vnc_start_viewer(vnc_display);
+ xenstore_write_vncport(vnc_display);
@@ -48,9 +48,9 @@ Index: ioemu/vl.c
sdl_display_init(ds, full_screen);
Index: ioemu/vl.h
===================================================================
---- ioemu.orig/vl.h 2006-09-21 19:33:31.000000000 +0100
-+++ ioemu/vl.h 2006-09-21 19:33:32.000000000 +0100
-@@ -1208,6 +1208,7 @@
+--- ioemu.orig/vl.h 2006-10-24 14:33:47.000000000 +0100
++++ ioemu/vl.h 2006-10-24 14:33:47.000000000 +0100
+@@ -1210,6 +1210,7 @@
int xenstore_fd(void);
void xenstore_process_event(void *opaque);
void xenstore_check_new_media_present(int timeout);
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_acm.c
--- a/tools/libxc/xc_acm.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_acm.c Tue Oct 24 11:21:48 2006 -0600
@@ -24,12 +24,12 @@ int xc_acm_op(int xc_handle, int cmd, vo
hypercall.arg[0] = cmd;
hypercall.arg[1] = (unsigned long) arg;
- if (mlock(arg, arg_size) != 0) {
- PERROR("xc_acm_op: arg mlock failed");
+ if (lock_pages(arg, arg_size) != 0) {
+ PERROR("xc_acm_op: arg lock failed");
goto out;
}
ret = do_xen_hypercall(xc_handle, &hypercall);
- safe_munlock(arg, arg_size);
+ unlock_pages(arg, arg_size);
out:
return ret;
}
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_domain.c Tue Oct 24 11:21:48 2006 -0600
@@ -72,7 +72,7 @@ int xc_domain_shutdown(int xc_handle,
arg.domain_id = domid;
arg.reason = reason;
- if ( mlock(&arg, sizeof(arg)) != 0 )
+ if ( lock_pages(&arg, sizeof(arg)) != 0 )
{
PERROR("Could not lock memory for Xen hypercall");
goto out1;
@@ -80,7 +80,7 @@ int xc_domain_shutdown(int xc_handle,
ret = do_xen_hypercall(xc_handle, &hypercall);
- safe_munlock(&arg, sizeof(arg));
+ unlock_pages(&arg, sizeof(arg));
out1:
return ret;
@@ -103,7 +103,7 @@ int xc_vcpu_setaffinity(int xc_handle,
(uint8_t *)&cpumap);
domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
- if ( mlock(&cpumap, sizeof(cpumap)) != 0 )
+ if ( lock_pages(&cpumap, sizeof(cpumap)) != 0 )
{
PERROR("Could not lock memory for Xen hypercall");
goto out;
@@ -111,7 +111,7 @@ int xc_vcpu_setaffinity(int xc_handle,
ret = do_domctl(xc_handle, &domctl);
- safe_munlock(&cpumap, sizeof(cpumap));
+ unlock_pages(&cpumap, sizeof(cpumap));
out:
return ret;
@@ -134,7 +134,7 @@ int xc_vcpu_getaffinity(int xc_handle,
(uint8_t *)cpumap);
domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(*cpumap) * 8;
- if ( mlock(cpumap, sizeof(*cpumap)) != 0 )
+ if ( lock_pages(cpumap, sizeof(*cpumap)) != 0 )
{
PERROR("Could not lock memory for Xen hypercall");
goto out;
@@ -142,7 +142,7 @@ int xc_vcpu_getaffinity(int xc_handle,
ret = do_domctl(xc_handle, &domctl);
- safe_munlock(cpumap, sizeof(*cpumap));
+ unlock_pages(cpumap, sizeof(*cpumap));
out:
return ret;
@@ -213,7 +213,7 @@ int xc_domain_getinfolist(int xc_handle,
int ret = 0;
DECLARE_SYSCTL;
- if ( mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
+ if ( lock_pages(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
return -1;
sysctl.cmd = XEN_SYSCTL_getdomaininfolist;
@@ -226,8 +226,7 @@ int xc_domain_getinfolist(int xc_handle,
else
ret = sysctl.u.getdomaininfolist.num_domains;
- if ( munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
- ret = -1;
+ unlock_pages(info, max_domains*sizeof(xc_domaininfo_t));
return ret;
}
@@ -245,12 +244,12 @@ int xc_vcpu_getcontext(int xc_handle,
domctl.u.vcpucontext.vcpu = (uint16_t)vcpu;
set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
- if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 )
+ if ( (rc = lock_pages(ctxt, sizeof(*ctxt))) != 0 )
return rc;
rc = do_domctl(xc_handle, &domctl);
- safe_munlock(ctxt, sizeof(*ctxt));
+ unlock_pages(ctxt, sizeof(*ctxt));
return rc;
}
@@ -512,12 +511,12 @@ int xc_vcpu_setcontext(int xc_handle,
domctl.u.vcpucontext.vcpu = vcpu;
set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
- if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 )
+ if ( (rc = lock_pages(ctxt, sizeof(*ctxt))) != 0 )
return rc;
rc = do_domctl(xc_handle, &domctl);
- safe_munlock(ctxt, sizeof(*ctxt));
+ unlock_pages(ctxt, sizeof(*ctxt));
return rc;
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_evtchn.c
--- a/tools/libxc/xc_evtchn.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_evtchn.c Tue Oct 24 11:21:48 2006 -0600
@@ -18,16 +18,16 @@ static int do_evtchn_op(int xc_handle, i
hypercall.arg[0] = cmd;
hypercall.arg[1] = (unsigned long)arg;
- if ( mlock(arg, arg_size) != 0 )
+ if ( lock_pages(arg, arg_size) != 0 )
{
- PERROR("do_evtchn_op: arg mlock failed");
+ PERROR("do_evtchn_op: arg lock failed");
goto out;
}
if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0)
ERROR("do_evtchn_op: HYPERVISOR_event_channel_op failed: %d", ret);
- safe_munlock(arg, arg_size);
+ unlock_pages(arg, arg_size);
out:
return ret;
}
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_hvm_build.c Tue Oct 24 11:21:48 2006 -0600
@@ -38,13 +38,13 @@ static void xc_set_hvm_param(int handle,
arg.domid = dom;
arg.index = param;
arg.value = value;
- if ( mlock(&arg, sizeof(arg)) != 0 )
+ if ( lock_pages(&arg, sizeof(arg)) != 0 )
{
PERROR("Could not lock memory for set parameter");
return;
}
rc = do_xen_hypercall(handle, &hypercall);
- safe_munlock(&arg, sizeof(arg));
+ unlock_pages(&arg, sizeof(arg));
if (rc < 0)
PERROR("set HVM parameter failed (%d)", rc);
}
@@ -403,7 +403,7 @@ static int xc_hvm_build_internal(int xc_
goto error_out;
}
- if ( mlock(&st_ctxt, sizeof(st_ctxt) ) )
+ if ( lock_pages(&st_ctxt, sizeof(st_ctxt) ) )
{
PERROR("%s: ctxt mlock failed", __func__);
return 1;
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_linux_build.c Tue Oct 24 11:21:48 2006 -0600
@@ -1140,9 +1140,9 @@ static int xc_linux_build_internal(int x
memset(&st_ctxt, 0, sizeof(st_ctxt));
#endif
- if ( mlock(&st_ctxt, sizeof(st_ctxt) ) )
- {
- PERROR("%s: ctxt mlock failed", __func__);
+ if ( lock_pages(&st_ctxt, sizeof(st_ctxt) ) )
+ {
+ PERROR("%s: ctxt lock failed", __func__);
return 1;
}
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_linux_restore.c Tue Oct 24 11:21:48 2006 -0600
@@ -162,9 +162,9 @@ int xc_linux_restore(int xc_handle, int
return 1;
}
- if (mlock(&ctxt, sizeof(ctxt))) {
+ if (lock_pages(&ctxt, sizeof(ctxt))) {
/* needed for build domctl, but might as well do early */
- ERROR("Unable to mlock ctxt");
+ ERROR("Unable to lock ctxt");
return 1;
}
@@ -251,8 +251,8 @@ int xc_linux_restore(int xc_handle, int
goto out;
}
- if (mlock(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE)) {
- ERROR("Could not mlock region_mfn");
+ if (lock_pages(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE)) {
+ ERROR("Could not lock region_mfn");
goto out;
}
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_linux_save.c Tue Oct 24 11:21:48 2006 -0600
@@ -628,8 +628,8 @@ int xc_linux_save(int xc_handle, int io_
return 1;
}
- if (mlock(&ctxt, sizeof(ctxt))) {
- ERROR("Unable to mlock ctxt");
+ if (lock_pages(&ctxt, sizeof(ctxt))) {
+ ERROR("Unable to lock ctxt");
return 1;
}
@@ -767,14 +767,14 @@ int xc_linux_save(int xc_handle, int io_
memset(to_send, 0xff, BITMAP_SIZE);
- if (mlock(to_send, BITMAP_SIZE)) {
- ERROR("Unable to mlock to_send");
+ if (lock_pages(to_send, BITMAP_SIZE)) {
+ ERROR("Unable to lock to_send");
return 1;
}
/* (to fix is local only) */
- if (mlock(to_skip, BITMAP_SIZE)) {
- ERROR("Unable to mlock to_skip");
+ if (lock_pages(to_skip, BITMAP_SIZE)) {
+ ERROR("Unable to lock to_skip");
return 1;
}
@@ -790,8 +790,8 @@ int xc_linux_save(int xc_handle, int io_
goto out;
}
- if (mlock(pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type))) {
- ERROR("Unable to mlock");
+ if (lock_pages(pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type))) {
+ ERROR("Unable to lock");
goto out;
}
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_misc.c Tue Oct 24 11:21:48 2006 -0600
@@ -21,13 +21,13 @@ int xc_readconsolering(int xc_handle,
sysctl.u.readconsole.count = nr_chars;
sysctl.u.readconsole.clear = clear;
- if ( (ret = mlock(buffer, nr_chars)) != 0 )
+ if ( (ret = lock_pages(buffer, nr_chars)) != 0 )
return ret;
if ( (ret = do_sysctl(xc_handle, &sysctl)) == 0 )
*pnr_chars = sysctl.u.readconsole.count;
- safe_munlock(buffer, nr_chars);
+ unlock_pages(buffer, nr_chars);
return ret;
}
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_private.c Tue Oct 24 11:21:48 2006 -0600
@@ -7,7 +7,23 @@
#include <inttypes.h>
#include "xc_private.h"
-/* NB: arr must be mlock'ed */
+int lock_pages(void *addr, size_t len)
+{
+ int e = 0;
+#ifndef __sun__
+ e = mlock(addr, len);
+#endif
+ return (e);
+}
+
+void unlock_pages(void *addr, size_t len)
+{
+#ifndef __sun__
+ safe_munlock(addr, len);
+#endif
+}
+
+/* NB: arr must be locked */
int xc_get_pfn_type_batch(int xc_handle,
uint32_t dom, int num, unsigned long *arr)
{
@@ -51,7 +67,7 @@ int xc_mmuext_op(
hypercall.arg[2] = (unsigned long)0;
hypercall.arg[3] = (unsigned long)dom;
- if ( mlock(op, nr_ops*sizeof(*op)) != 0 )
+ if ( lock_pages(op, nr_ops*sizeof(*op)) != 0 )
{
PERROR("Could not lock memory for Xen hypercall");
goto out1;
@@ -59,7 +75,7 @@ int xc_mmuext_op(
ret = do_xen_hypercall(xc_handle, &hypercall);
- safe_munlock(op, nr_ops*sizeof(*op));
+ unlock_pages(op, nr_ops*sizeof(*op));
out1:
return ret;
@@ -79,9 +95,9 @@ static int flush_mmu_updates(int xc_hand
hypercall.arg[2] = 0;
hypercall.arg[3] = mmu->subject;
- if ( mlock(mmu->updates, sizeof(mmu->updates)) != 0 )
- {
- PERROR("flush_mmu_updates: mmu updates mlock failed");
+ if ( lock_pages(mmu->updates, sizeof(mmu->updates)) != 0 )
+ {
+ PERROR("flush_mmu_updates: mmu updates lock_pages failed");
err = 1;
goto out;
}
@@ -94,7 +110,7 @@ static int flush_mmu_updates(int xc_hand
mmu->idx = 0;
- safe_munlock(mmu->updates, sizeof(mmu->updates));
+ unlock_pages(mmu->updates, sizeof(mmu->updates));
out:
return err;
@@ -149,62 +165,62 @@ int xc_memory_op(int xc_handle,
case XENMEM_increase_reservation:
case XENMEM_decrease_reservation:
case XENMEM_populate_physmap:
- if ( mlock(reservation, sizeof(*reservation)) != 0 )
- {
- PERROR("Could not mlock");
+ if ( lock_pages(reservation, sizeof(*reservation)) != 0 )
+ {
+ PERROR("Could not lock");
goto out1;
}
get_xen_guest_handle(extent_start, reservation->extent_start);
if ( (extent_start != NULL) &&
- (mlock(extent_start,
+ (lock_pages(extent_start,
reservation->nr_extents * sizeof(xen_pfn_t)) != 0) )
{
- PERROR("Could not mlock");
- safe_munlock(reservation, sizeof(*reservation));
+ PERROR("Could not lock");
+ unlock_pages(reservation, sizeof(*reservation));
goto out1;
}
break;
case XENMEM_machphys_mfn_list:
- if ( mlock(xmml, sizeof(*xmml)) != 0 )
- {
- PERROR("Could not mlock");
+ if ( lock_pages(xmml, sizeof(*xmml)) != 0 )
+ {
+ PERROR("Could not lock");
goto out1;
}
get_xen_guest_handle(extent_start, xmml->extent_start);
- if ( mlock(extent_start,
+ if ( lock_pages(extent_start,
xmml->max_extents * sizeof(xen_pfn_t)) != 0 )
{
- PERROR("Could not mlock");
- safe_munlock(xmml, sizeof(*xmml));
+ PERROR("Could not lock");
+ unlock_pages(xmml, sizeof(*xmml));
goto out1;
}
break;
case XENMEM_add_to_physmap:
- if ( mlock(arg, sizeof(struct xen_add_to_physmap)) )
- {
- PERROR("Could not mlock");
+ if ( lock_pages(arg, sizeof(struct xen_add_to_physmap)) )
+ {
+ PERROR("Could not lock");
goto out1;
}
break;
case XENMEM_translate_gpfn_list:
- if ( mlock(trans, sizeof(*trans)) != 0 )
- {
- PERROR("Could not mlock");
+ if ( lock_pages(trans, sizeof(*trans)) != 0 )
+ {
+ PERROR("Could not lock");
goto out1;
}
get_xen_guest_handle(gpfn_list, trans->gpfn_list);
- if ( mlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
- {
- PERROR("Could not mlock");
- safe_munlock(trans, sizeof(*trans));
+ if ( lock_pages(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
+ {
+ PERROR("Could not lock");
+ unlock_pages(trans, sizeof(*trans));
goto out1;
}
get_xen_guest_handle(mfn_list, trans->mfn_list);
- if ( mlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
- {
- PERROR("Could not mlock");
- safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
- safe_munlock(trans, sizeof(*trans));
+ if ( lock_pages(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
+ {
+ PERROR("Could not lock");
+ unlock_pages(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
+ unlock_pages(trans, sizeof(*trans));
goto out1;
}
break;
@@ -217,27 +233,27 @@ int xc_memory_op(int xc_handle,
case XENMEM_increase_reservation:
case XENMEM_decrease_reservation:
case XENMEM_populate_physmap:
- safe_munlock(reservation, sizeof(*reservation));
+ unlock_pages(reservation, sizeof(*reservation));
get_xen_guest_handle(extent_start, reservation->extent_start);
if ( extent_start != NULL )
- safe_munlock(extent_start,
+ unlock_pages(extent_start,
reservation->nr_extents * sizeof(xen_pfn_t));
break;
case XENMEM_machphys_mfn_list:
- safe_munlock(xmml, sizeof(*xmml));
+ unlock_pages(xmml, sizeof(*xmml));
get_xen_guest_handle(extent_start, xmml->extent_start);
- safe_munlock(extent_start,
+ unlock_pages(extent_start,
xmml->max_extents * sizeof(xen_pfn_t));
break;
case XENMEM_add_to_physmap:
- safe_munlock(arg, sizeof(struct xen_add_to_physmap));
+ unlock_pages(arg, sizeof(struct xen_add_to_physmap));
break;
case XENMEM_translate_gpfn_list:
get_xen_guest_handle(mfn_list, trans->mfn_list);
- safe_munlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
+ unlock_pages(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
get_xen_guest_handle(gpfn_list, trans->gpfn_list);
- safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
- safe_munlock(trans, sizeof(*trans));
+ unlock_pages(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
+ unlock_pages(trans, sizeof(*trans));
break;
}
@@ -279,15 +295,15 @@ int xc_get_pfn_list(int xc_handle,
memset(pfn_buf, 0, max_pfns * sizeof(xen_pfn_t));
#endif
- if ( mlock(pfn_buf, max_pfns * sizeof(xen_pfn_t)) != 0 )
- {
- PERROR("xc_get_pfn_list: pfn_buf mlock failed");
+ if ( lock_pages(pfn_buf, max_pfns * sizeof(xen_pfn_t)) != 0 )
+ {
+ PERROR("xc_get_pfn_list: pfn_buf lock failed");
return -1;
}
ret = do_domctl(xc_handle, &domctl);
- safe_munlock(pfn_buf, max_pfns * sizeof(xen_pfn_t));
+ unlock_pages(pfn_buf, max_pfns * sizeof(xen_pfn_t));
#if 0
#ifdef DEBUG
@@ -419,7 +435,7 @@ int xc_version(int xc_handle, int cmd, v
break;
}
- if ( (argsize != 0) && (mlock(arg, argsize) != 0) )
+ if ( (argsize != 0) && (lock_pages(arg, argsize) != 0) )
{
PERROR("Could not lock memory for version hypercall");
return -ENOMEM;
@@ -433,7 +449,7 @@ int xc_version(int xc_handle, int cmd, v
rc = do_xen_version(xc_handle, cmd, arg);
if ( argsize != 0 )
- safe_munlock(arg, argsize);
+ unlock_pages(arg, argsize);
return rc;
}
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_private.h Tue Oct 24 11:21:48 2006 -0600
@@ -66,6 +66,9 @@ do {
errno = __saved_errno; \
} while (0)
+int lock_pages(void *addr, size_t len);
+void unlock_pages(void *addr, size_t len);
+
#define PERROR(_m, _a...) \
do { \
int __saved_errno = errno; \
@@ -104,7 +107,7 @@ static inline int do_domctl(int xc_handl
hypercall.op = __HYPERVISOR_domctl;
hypercall.arg[0] = (unsigned long)domctl;
- if ( mlock(domctl, sizeof(*domctl)) != 0 )
+ if ( lock_pages(domctl, sizeof(*domctl)) != 0 )
{
PERROR("Could not lock memory for Xen hypercall");
goto out1;
@@ -117,7 +120,7 @@ static inline int do_domctl(int xc_handl
" rebuild the user-space tool set?\n");
}
- safe_munlock(domctl, sizeof(*domctl));
+ unlock_pages(domctl, sizeof(*domctl));
out1:
return ret;
@@ -133,7 +136,7 @@ static inline int do_sysctl(int xc_handl
hypercall.op = __HYPERVISOR_sysctl;
hypercall.arg[0] = (unsigned long)sysctl;
- if ( mlock(sysctl, sizeof(*sysctl)) != 0 )
+ if ( lock_pages(sysctl, sizeof(*sysctl)) != 0 )
{
PERROR("Could not lock memory for Xen hypercall");
goto out1;
@@ -146,7 +149,7 @@ static inline int do_sysctl(int xc_handl
" rebuild the user-space tool set?\n");
}
- safe_munlock(sysctl, sizeof(*sysctl));
+ unlock_pages(sysctl, sizeof(*sysctl));
out1:
return ret;
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xc_tbuf.c
--- a/tools/libxc/xc_tbuf.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xc_tbuf.c Tue Oct 24 11:21:48 2006 -0600
@@ -104,7 +104,7 @@ int xc_tbuf_set_cpu_mask(int xc_handle,
set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, (uint8_t *)&mask);
sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(mask) * 8;
- if ( mlock(&mask, sizeof(mask)) != 0 )
+ if ( lock_pages(&mask, sizeof(mask)) != 0 )
{
PERROR("Could not lock memory for Xen hypercall");
goto out;
@@ -112,7 +112,7 @@ int xc_tbuf_set_cpu_mask(int xc_handle,
ret = do_sysctl(xc_handle, &sysctl);
- safe_munlock(&mask, sizeof(mask));
+ unlock_pages(&mask, sizeof(mask));
out:
return ret;
diff -r aa8ca06d209e -r d246b79986d1 tools/libxc/xg_private.c
--- a/tools/libxc/xg_private.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/libxc/xg_private.c Tue Oct 24 11:21:48 2006 -0600
@@ -10,6 +10,22 @@
#include <strings.h>
#include "xg_private.h"
+
+int lock_pages(void *addr, size_t len)
+{
+ int e = 0;
+#ifndef __sun__
+ e = mlock(addr, len);
+#endif
+ return (e);
+}
+
+void unlock_pages(void *addr, size_t len)
+{
+#ifndef __sun__
+ safe_munlock(addr, len);
+#endif
+}
char *xc_read_image(const char *filename, unsigned long *size)
{
diff -r aa8ca06d209e -r d246b79986d1 tools/misc/xenperf.c
--- a/tools/misc/xenperf.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/misc/xenperf.c Tue Oct 24 11:21:48 2006 -0600
@@ -17,6 +17,22 @@
#include <sys/mman.h>
#include <errno.h>
#include <string.h>
+
+int lock_pages(void *addr, size_t len)
+{
+ int e = 0;
+#ifndef __sun__
+ e = mlock(addr, len);
+#endif
+ return (e);
+}
+
+void unlock_pages(void *addr, size_t len)
+{
+#ifndef __sun__
+ munlock(addr, len);
+#endif
+}
int main(int argc, char *argv[])
{
@@ -87,11 +103,11 @@ int main(int argc, char *argv[])
pcv = malloc(sizeof(*pcv) * num_val);
if ( pcd == NULL
- || mlock(pcd, sizeof(*pcd) * num_desc) != 0
+ || lock_pages(pcd, sizeof(*pcd) * num_desc) != 0
|| pcv == NULL
- || mlock(pcd, sizeof(*pcv) * num_val) != 0)
+ || lock_pages(pcd, sizeof(*pcv) * num_val) != 0)
{
- fprintf(stderr, "Could not alloc or mlock buffers: %d (%s)\n",
+ fprintf(stderr, "Could not alloc or lock buffers: %d (%s)\n",
errno, strerror(errno));
exit(-1);
}
@@ -104,8 +120,8 @@ int main(int argc, char *argv[])
return 1;
}
- munlock(pcd, sizeof(*pcd) * num_desc);
- munlock(pcv, sizeof(*pcv) * num_val);
+ unlock_pages(pcd, sizeof(*pcd) * num_desc);
+ unlock_pages(pcv, sizeof(*pcv) * num_val);
val = pcv;
for ( i = 0; i < num_desc; i++ )
diff -r aa8ca06d209e -r d246b79986d1 tools/python/xen/lowlevel/acm/acm.c
--- a/tools/python/xen/lowlevel/acm/acm.c Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/python/xen/lowlevel/acm/acm.c Tue Oct 24 11:21:48 2006 -0600
@@ -147,9 +147,10 @@ static PyObject *getdecision(PyObject *
{
char *arg1_name, *arg1, *arg2_name, *arg2, *decision = NULL;
struct acm_getdecision getdecision;
- int xc_handle;
-
- if (!PyArg_ParseTuple(args, "ssss", &arg1_name, &arg1, &arg2_name, &arg2))
{
+ int xc_handle, rc;
+
+ if (!PyArg_ParseTuple(args, "ssss", &arg1_name,
+ &arg1, &arg2_name, &arg2)) {
return NULL;
}
@@ -179,12 +180,16 @@ static PyObject *getdecision(PyObject *
getdecision.id2.ssidref = atol(arg2);
}
- if (xc_acm_op(xc_handle, ACMOP_getdecision, &getdecision,
sizeof(getdecision)) < 0) {
+ rc = xc_acm_op(xc_handle, ACMOP_getdecision,
+ &getdecision, sizeof(getdecision));
+
+ xc_interface_close(xc_handle);
+
+ if (rc < 0) {
if (errno == EACCES)
PERROR("ACM operation failed.");
- }
-
- xc_interface_close(xc_handle);
+ return NULL;
+ }
if (getdecision.acm_decision == ACM_ACCESS_PERMITTED)
decision = "PERMITTED";
diff -r aa8ca06d209e -r d246b79986d1 tools/python/xen/util/security.py
--- a/tools/python/xen/util/security.py Tue Oct 24 10:08:30 2006 -0600
+++ b/tools/python/xen/util/security.py Tue Oct 24 11:21:48 2006 -0600
@@ -601,8 +601,15 @@ def unify_resname(resource):
"""Makes all resource locations absolute. In case of physical
resources, '/dev/' is added to local file names"""
+ if not resource:
+ return resource
+
# sanity check on resource name
- (type, resfile) = resource.split(":")
+ try:
+ (type, resfile) = resource.split(":")
+ except:
+ err("Resource spec '%s' contains no ':' delimiter" % resource)
+
if type == "phy":
if not resfile.startswith("/"):
resfile = "/dev/" + resfile
diff -r aa8ca06d209e -r d246b79986d1 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Tue Oct 24 10:08:30 2006 -0600
+++ |