WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [qemu-xen-unstable] support multiple pv consoles for hvm

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [qemu-xen-unstable] support multiple pv consoles for hvm guests too
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Mon, 16 Aug 2010 05:35:03 -0700
Delivery-date: Mon, 16 Aug 2010 05:35:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
commit 466608f3a32e1f9808acdf832a5843af37e5fcec
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date:   Mon Aug 16 13:29:36 2010 +0100

    support multiple pv consoles for hvm guests too
    
    This patch allows qemu to provide pv console backends for hvm guests too:
    
    - initialize the pv console backends when emulating a "xen_fv" machine;
    
    - separate the pv consoles and emulated serials on xenstore: pv
    consoles use the console prefix and emulated serials use the serial
    prefix;
    
    - read the "output" node on xenstore to know where the output of a pv
    console has to go.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 hw/xen_console.c    |   14 ++++++++------
 hw/xen_machine_fv.c |    7 +++++++
 xen-config-host.h   |    2 ++
 xenstore.c          |   15 +++++++++++++--
 4 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/hw/xen_console.c b/hw/xen_console.c
index a4e97ca..545caa7 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -181,7 +181,7 @@ static void xencons_send(struct XenConsole *con)
 static int con_init(struct XenDevice *xendev)
 {
     struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
-    char *type, *dom;
+    char *type, *dom, *output, label[32];
 
     /* setup */
     dom = xs_get_domain_path(xenstore, con->xendev.dom);
@@ -200,11 +200,13 @@ static int con_init(struct XenDevice *xendev)
     }
     qemu_free(type);
 
-    if (!serial_hds[con->xendev.dev])
-       xen_be_printf(xendev, 1, "WARNING: serial line %d not configured\n",
-                      con->xendev.dev);
-    else
-        con->chr = serial_hds[con->xendev.dev];
+       output = xenstore_read_str(con->console, "output");
+       /* output is a pty by default */
+       if (output == NULL)
+               output = "pty";
+       snprintf(label, sizeof(label), "xencons%d", con->xendev.dev);
+       con->chr = qemu_chr_open(label, output, NULL);
+       xenstore_store_pv_console_info(con->xendev.dev, con->chr, output);
 
     return 0;
 }
diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c
index d02e23f..79880a8 100644
--- a/hw/xen_machine_fv.c
+++ b/hw/xen_machine_fv.c
@@ -29,6 +29,7 @@
 #include "exec-all.h"
 #include "qemu-xen.h"
 #include "qemu-aio.h"
+#include "xen_backend.h"
 
 #include <xen/hvm/params.h>
 #include <sys/mman.h>
@@ -361,6 +362,12 @@ static void xen_init_fv(ram_addr_t ram_size, int 
vga_ram_size,
 
     timeoffset_get();
 
+       /* Initialize backend core & drivers */
+    if (xen_be_init() != 0) {
+        fprintf(stderr, "%s: xen backend core setup failed\n", __FUNCTION__);
+        exit(1);
+    }
+    xen_be_register("console", &xen_console_ops);
 
     pc_machine.init(ram_size, vga_ram_size, boot_device,
                    kernel_filename, kernel_cmdline, initrd_filename,
diff --git a/xen-config-host.h b/xen-config-host.h
index 9526bb9..f50c3aa 100644
--- a/xen-config-host.h
+++ b/xen-config-host.h
@@ -39,6 +39,8 @@ extern uint32_t vcpu_avail[];
 struct CharDriverState;
 void xenstore_store_serial_port_info(int i, struct CharDriverState *chr,
                                     const char *devname);
+void xenstore_store_pv_console_info(int i, struct CharDriverState *chr,
+                            const char *devname);
 
 extern unsigned int xen_logdirty_enable;
 
diff --git a/xenstore.c b/xenstore.c
index 4a35f55..6d24613 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -1567,8 +1567,19 @@ void xenstore_store_serial_port_info(int i, 
CharDriverState *chr,
 
     snprintf(buf, sizeof(buf), "/serial/%d", i);
     store_dev_info(devname, domid, chr, buf);
-    if (i == 0) /* serial 0 is also called the console */
-        store_dev_info(devname, domid, chr, "/console");
+}
+
+void xenstore_store_pv_console_info(int i, CharDriverState *chr,
+                                    const char *devname) {
+    char buf[32];
+
+    if (i == 0) {
+        snprintf(buf, sizeof(buf), "/console", i);
+        store_dev_info(devname, domid, chr, buf);
+    } else {
+        snprintf(buf, sizeof(buf), "/device/console/%d", i);
+        store_dev_info(devname, domid, chr, buf);
+    }
 }
 
 char *xenstore_dom_read(int domid, const char *key, unsigned int *len)
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [qemu-xen-unstable] support multiple pv consoles for hvm guests too, Ian Jackson <=