aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@hp.com>2007-10-22 13:57:08 -0600
committerAlex Williamson <alex.williamson@hp.com>2007-10-22 13:57:08 -0600
commit4924c08f4a38e4eda2b7ba5bb6a6a8b297e8d78a (patch)
tree6785fb86e8e57b40b2555f704b32d12dc8334caf /tools
parent985a9ce9dc643acb194f76169439ba449ee2a790 (diff)
parentde91f88afe9c50141f681469fbed357571f1c3eb (diff)
downloadxen-4924c08f4a38e4eda2b7ba5bb6a6a8b297e8d78a.tar.gz
xen-4924c08f4a38e4eda2b7ba5bb6a6a8b297e8d78a.tar.bz2
xen-4924c08f4a38e4eda2b7ba5bb6a6a8b297e8d78a.zip
merge with xen-unstable.hg (staging)
Diffstat (limited to 'tools')
-rw-r--r--tools/ioemu/hw/ide.c63
-rw-r--r--tools/ioemu/hw/pass-through.c8
-rw-r--r--tools/ioemu/target-i386-dm/helper2.c1
-rw-r--r--tools/ioemu/vl.h3
-rw-r--r--tools/libxc/xc_dom.h1
-rw-r--r--tools/libxc/xc_dom_ia64.c2
-rw-r--r--tools/python/xen/lowlevel/xc/xc.c18
-rw-r--r--tools/python/xen/xend/XendConstants.py1
-rw-r--r--tools/python/xen/xend/image.py7
-rw-r--r--tools/xenstore/xs_lib.c8
10 files changed, 88 insertions, 24 deletions
diff --git a/tools/ioemu/hw/ide.c b/tools/ioemu/hw/ide.c
index f5e796171f..6faeb4dfce 100644
--- a/tools/ioemu/hw/ide.c
+++ b/tools/ioemu/hw/ide.c
@@ -431,16 +431,21 @@ buffered_pio_init(void)
}
static inline void
+__buffered_pio_flush(struct pio_buffer *piobuf, IDEState *s, uint32_t pointer)
+{
+ uint8_t *buf = (uint8_t *)buffered_pio_page + piobuf->page_offset;
+ memcpy(s->data_ptr, buf, pointer);
+ s->data_ptr += pointer;
+}
+
+static inline void
buffered_pio_flush(struct pio_buffer *piobuf)
{
IDEState *s = piobuf->opaque;
uint32_t pointer = piobuf->pointer;
- if (s != NULL && pointer > 0) {
- uint8_t *buf = (uint8_t *)buffered_pio_page + piobuf->page_offset;
- memcpy(s->data_ptr, buf, pointer);
- s->data_ptr += pointer;
- }
+ if (s != NULL && pointer > 0)
+ __buffered_pio_flush(piobuf, s, pointer);
}
static inline void
@@ -502,6 +507,54 @@ buffered_pio_read(IDEState *s, uint32_t addr, int size)
piobuf->opaque = NULL;
}
+/*
+ * buffered pio reads are undone. It results in normal pio when the domain
+ * is restored.
+ * buffered pio writes are handled before saving domain.
+ * However currently pci_ide_save/load() just discards a pending transfer. XXX
+ */
+static void
+__handle_buffered_pio(struct pio_buffer *piobuf)
+{
+ IDEState *s = piobuf->opaque;
+ uint32_t pointer = piobuf->pointer;
+
+
+ if (pointer == 0)
+ return;/* no buffered pio */
+
+ if (s != NULL) {
+ /* written data are pending in pio_buffer. process it */
+ __buffered_pio_flush(piobuf, s, pointer);
+ } else {
+ /* data are buffered for pio read in pio_buffer.
+ * undone buffering by buffered_pio_read()
+ */
+ if (pointer > s->data_ptr - s->io_buffer)
+ pointer = s->data_ptr - s->io_buffer;
+ s->data_ptr -= pointer;
+ }
+
+ piobuf->pointer = 0;
+ piobuf->data_end = 0;
+ piobuf->opaque = NULL;
+}
+
+void
+handle_buffered_pio(void)
+{
+ struct pio_buffer *p1, *p2;
+
+ if (!buffered_pio_page)
+ return;
+
+ p1 = &buffered_pio_page->pio[PIO_BUFFER_IDE_PRIMARY];
+ p2 = &buffered_pio_page->pio[PIO_BUFFER_IDE_SECONDARY];
+
+ __handle_buffered_pio(p1);
+ __handle_buffered_pio(p2);
+}
+
#else /* !__ia64__ */
#define buffered_pio_init() do {} while (0)
#define buffered_pio_reset(I) do {} while (0)
diff --git a/tools/ioemu/hw/pass-through.c b/tools/ioemu/hw/pass-through.c
index b445291874..7dd9588ba0 100644
--- a/tools/ioemu/hw/pass-through.c
+++ b/tools/ioemu/hw/pass-through.c
@@ -39,11 +39,10 @@ static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
{
char *token;
- token = strchr(*str, ',');
- if ( !token )
+ if ( !(*str) || !strchr(*str, ',') )
return 0;
- token++;
+ token = *str;
*seg = token_value(token);
token = strchr(token, ',') + 1;
*bus = token_value(token);
@@ -51,8 +50,9 @@ static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
*dev = token_value(token);
token = strchr(token, ',') + 1;
*func = token_value(token);
+ token = strchr(token, ',');
+ *str = token ? token + 1 : NULL;
- *str = token;
return 1;
}
diff --git a/tools/ioemu/target-i386-dm/helper2.c b/tools/ioemu/target-i386-dm/helper2.c
index 070109a6cd..cc37867de6 100644
--- a/tools/ioemu/target-i386-dm/helper2.c
+++ b/tools/ioemu/target-i386-dm/helper2.c
@@ -635,6 +635,7 @@ int main_loop(void)
fprintf(logfile, "device model saving state\n");
/* Pull all outstanding ioreqs through the system */
+ handle_buffered_pio();
handle_buffered_io(env);
main_loop_wait(1); /* For the select() on events */
diff --git a/tools/ioemu/vl.h b/tools/ioemu/vl.h
index b087e20c00..fd80d023c7 100644
--- a/tools/ioemu/vl.h
+++ b/tools/ioemu/vl.h
@@ -1494,8 +1494,11 @@ static inline void xc_domain_shutdown_hook(int xc_handle, uint32_t domid)
{
xc_ia64_save_to_nvram(xc_handle, domid);
}
+
+void handle_buffered_pio(void);
#else
#define xc_domain_shutdown_hook(xc_handle, domid) do {} while (0)
+#define handle_buffered_pio() do {} while (0)
#endif
#endif /* VL_H */
diff --git a/tools/libxc/xc_dom.h b/tools/libxc/xc_dom.h
index 2a42b874fe..30111c98e2 100644
--- a/tools/libxc/xc_dom.h
+++ b/tools/libxc/xc_dom.h
@@ -95,6 +95,7 @@ struct xc_dom_image {
int guest_xc;
domid_t guest_domid;
+ int8_t vhpt_size_log2; /* for IA64 */
int shadow_enabled;
int xen_version;
diff --git a/tools/libxc/xc_dom_ia64.c b/tools/libxc/xc_dom_ia64.c
index 1211eead52..fa2c9e61f7 100644
--- a/tools/libxc/xc_dom_ia64.c
+++ b/tools/libxc/xc_dom_ia64.c
@@ -260,7 +260,7 @@ int arch_setup_bootearly(struct xc_dom_image *dom)
domctl.u.arch_setup.bp = (dom->start_info_pfn << PAGE_SHIFT)
+ sizeof(start_info_t);
domctl.u.arch_setup.maxmem = dom->total_pages << PAGE_SHIFT;
- domctl.u.arch_setup.vhpt_size_log2 = dom->flags;
+ domctl.u.arch_setup.vhpt_size_log2 = dom->vhpt_size_log2;
rc = do_domctl(dom->guest_xc, &domctl);
return rc;
}
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 2cf5c5bb73..6a2e848b0b 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -413,6 +413,7 @@ static PyObject *pyxc_linux_build(XcObject *self,
char *image, *ramdisk = NULL, *cmdline = "", *features = NULL;
int flags = 0;
int store_evtchn, console_evtchn;
+ int vhpt = 0;
unsigned int mem_mb;
unsigned long store_mfn = 0;
unsigned long console_mfn = 0;
@@ -425,20 +426,23 @@ static PyObject *pyxc_linux_build(XcObject *self,
"console_evtchn", "image",
/* optional */
"ramdisk", "cmdline", "flags",
- "features", NULL };
+ "features", "vhpt", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiis|ssis", kwd_list,
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiis|ssisi", kwd_list,
&domid, &store_evtchn, &mem_mb,
&console_evtchn, &image,
/* optional */
&ramdisk, &cmdline, &flags,
- &features) )
+ &features, &vhpt) )
return NULL;
xc_dom_loginit();
if (!(dom = xc_dom_allocate(cmdline, features)))
return pyxc_error_to_exception();
+ /* for IA64 */
+ dom->vhpt_size_log2 = vhpt;
+
if ( xc_dom_linux_build(self->xc_handle, dom, domid, mem_mb, image,
ramdisk, flags, store_evtchn, &store_mfn,
console_evtchn, &console_mfn) != 0 ) {
@@ -539,11 +543,10 @@ static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
{
char *token;
- token = strchr(*str, ',');
- if ( !token )
+ if ( !(*str) || !strchr(*str, ',') )
return 0;
- token++;
+ token = *str;
*seg = token_value(token);
token = strchr(token, ',') + 1;
*bus = token_value(token);
@@ -551,8 +554,9 @@ static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
*dev = token_value(token);
token = strchr(token, ',') + 1;
*func = token_value(token);
+ token = strchr(token, ',');
+ *str = token ? token + 1 : NULL;
- *str = token;
return 1;
}
diff --git a/tools/python/xen/xend/XendConstants.py b/tools/python/xen/xend/XendConstants.py
index 751e4487f6..befabb4e16 100644
--- a/tools/python/xen/xend/XendConstants.py
+++ b/tools/python/xen/xend/XendConstants.py
@@ -45,6 +45,7 @@ HVM_PARAM_IOREQ_PFN = 5
HVM_PARAM_BUFIOREQ_PFN = 6
HVM_PARAM_NVRAM_FD = 7
HVM_PARAM_VHPT_SIZE = 8
+HVM_PARAM_BUFPIOREQ_PFN = 9
restart_modes = [
"restart",
diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py
index 0cd8fa4a07..16e842bddd 100644
--- a/tools/python/xen/xend/image.py
+++ b/tools/python/xen/xend/image.py
@@ -198,6 +198,7 @@ class LinuxImageHandler(ImageHandler):
ostype = "linux"
flags = 0
+ vhpt = 0
def buildDomain(self):
store_evtchn = self.vm.getStorePort()
@@ -225,7 +226,8 @@ class LinuxImageHandler(ImageHandler):
cmdline = self.cmdline,
ramdisk = self.ramdisk,
features = self.vm.getFeatures(),
- flags = self.flags)
+ flags = self.flags,
+ vhpt = self.vhpt)
class PPC_LinuxImageHandler(LinuxImageHandler):
@@ -533,9 +535,6 @@ class IA64_Linux_ImageHandler(LinuxImageHandler):
LinuxImageHandler.configure(self, vmConfig)
self.vhpt = int(vmConfig['platform'].get('vhpt', 0))
- def buildDomain(self):
- self.flags = self.vhpt
- return LinuxImageHandler.buildDomain(self)
class X86_HVM_ImageHandler(HVMImageHandler):
diff --git a/tools/xenstore/xs_lib.c b/tools/xenstore/xs_lib.c
index 8375f15f0c..77cd64f3ca 100644
--- a/tools/xenstore/xs_lib.c
+++ b/tools/xenstore/xs_lib.c
@@ -44,7 +44,7 @@ static const char *xs_daemon_path(void)
char *s = getenv("XENSTORED_PATH");
if (s)
return s;
- if (snprintf(buf, PATH_MAX, "%s/socket",
+ if (snprintf(buf, sizeof(buf), "%s/socket",
xs_daemon_rundir()) >= PATH_MAX)
return NULL;
return buf;
@@ -68,7 +68,7 @@ const char *xs_daemon_socket_ro(void)
const char *s = xs_daemon_path();
if (s == NULL)
return NULL;
- if (snprintf(buf, PATH_MAX, "%s_ro", s) >= PATH_MAX)
+ if (snprintf(buf, sizeof(buf), "%s_ro", s) >= PATH_MAX)
return NULL;
return buf;
}
@@ -79,8 +79,10 @@ const char *xs_domain_dev(void)
if (s)
return s;
-#ifdef __linux__
+#if defined(__linux__)
return "/proc/xen/xenbus";
+#elif defined(__NetBSD__)
+ return "/kern/xen/xenbus";
#else
return "/dev/xen/xenbus";
#endif