aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_domain_restore.c
diff options
context:
space:
mode:
authorStefano Stabellini <sstabellini@xensource.com>2010-08-05 11:36:24 +0100
committerStefano Stabellini <sstabellini@xensource.com>2010-08-05 11:36:24 +0100
commitc4ebe465294764065c85fa15d7209ab807d27e84 (patch)
treec8dd6f93b5da195064b0c606682582129ba252e2 /tools/libxc/xc_domain_restore.c
parent058f27228c5745b2a51837c6e952216054453a8b (diff)
downloadxen-c4ebe465294764065c85fa15d7209ab807d27e84.tar.gz
xen-c4ebe465294764065c85fa15d7209ab807d27e84.tar.bz2
xen-c4ebe465294764065c85fa15d7209ab807d27e84.zip
PV console for HVM domains
Creates a shared memory ring buffer and event channel in HVM domains for passing debug messages from PV drivers on HVM guests The console is used by windows pv drivers to send debug data to xenconsoled Signed-off-by: Owen Smith <owen.smith@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_domain_restore.c')
-rw-r--r--tools/libxc/xc_domain_restore.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
index 129365c42f..3fd0330714 100644
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -640,6 +640,7 @@ typedef struct {
uint64_t vcpumap;
uint64_t identpt;
uint64_t vm86_tss;
+ uint64_t console_pfn;
} pagebuf_t;
static int pagebuf_init(pagebuf_t* buf)
@@ -737,6 +738,16 @@ static int pagebuf_get_one(xc_interface *xch, struct restore_ctx *ctx,
return -1;
}
return pagebuf_get_one(xch, ctx, buf, fd, dom);
+ } else if (count == -8 ) {
+ /* Skip padding 4 bytes then read the console pfn location. */
+ if ( read_exact(fd, &buf->console_pfn, sizeof(uint32_t)) ||
+ read_exact(fd, &buf->console_pfn, sizeof(uint64_t)) )
+ {
+ PERROR("error read the address of the console pfn");
+ return -1;
+ }
+ // DPRINTF("console pfn location: %llx\n", buf->console_pfn);
+ return pagebuf_get_one(xch, ctx, buf, fd, dom);
} else if ( (count > MAX_BATCH_SIZE) || (count < 0) ) {
ERROR("Max batch size exceeded (%d). Giving up.", count);
errno = EMSGSIZE;
@@ -1055,6 +1066,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
pagebuf_t pagebuf;
tailbuf_t tailbuf, tmptail;
void* vcpup;
+ uint64_t console_pfn = 0;
static struct restore_ctx _ctx = {
.live_p2m = NULL,
@@ -1207,6 +1219,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
xc_set_hvm_param(xch, dom, HVM_PARAM_IDENT_PT, pagebuf.identpt);
if ( pagebuf.vm86_tss )
xc_set_hvm_param(xch, dom, HVM_PARAM_VM86_TSS, pagebuf.vm86_tss);
+ if ( pagebuf.console_pfn )
+ console_pfn = pagebuf.console_pfn;
break; /* our work here is done */
}
@@ -1717,6 +1731,19 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
}
*store_mfn = tailbuf.u.hvm.magicpfns[2];
+ if ( console_pfn ) {
+ if ( xc_clear_domain_page(xch, dom, console_pfn) ) {
+ PERROR("error zeroing console page");
+ goto out;
+ }
+ if ( (frc = xc_set_hvm_param(xch, dom,
+ HVM_PARAM_CONSOLE_PFN, console_pfn)) ) {
+ PERROR("error setting HVM param: %i", frc);
+ goto out;
+ }
+ *console_mfn = console_pfn;
+ }
+
frc = xc_domain_hvm_setcontext(xch, dom, tailbuf.u.hvm.hvmbuf,
tailbuf.u.hvm.reclen);
if ( frc )