diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xen.h | 1 | ||||
-rw-r--r-- | hw/xen_common.h | 12 | ||||
-rw-r--r-- | hw/xen_console.c | 16 |
3 files changed, 23 insertions, 6 deletions
@@ -41,6 +41,7 @@ qemu_irq *xen_interrupt_controller_init(void); int xen_init(void); int xen_hvm_init(void); void xen_vcpu_init(void); +void xenstore_store_pv_console_info(int i, struct CharDriverState *chr); #if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY) void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size); diff --git a/hw/xen_common.h b/hw/xen_common.h index 2c79af64d0..0409ac7971 100644 --- a/hw/xen_common.h +++ b/hw/xen_common.h @@ -85,6 +85,18 @@ static inline int xc_domain_add_to_physmap(int xc_handle, uint32_t domid, return xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp); } +static inline struct xs_handle *xs_open(unsigned long flags) +{ + return xs_daemon_open(); +} + +static inline void xs_close(struct xs_handle *xsh) +{ + if (xsh != NULL) { + xs_daemon_close(xsh); + } +} + /* Xen 4.1 */ #else diff --git a/hw/xen_console.c b/hw/xen_console.c index 2d613ee6e5..bdb8540542 100644 --- a/hw/xen_console.c +++ b/hw/xen_console.c @@ -179,8 +179,9 @@ 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, label[32]; int ret = 0; + const char *output; /* setup */ dom = xs_get_domain_path(xenstore, con->xendev.dom); @@ -194,11 +195,14 @@ static int con_init(struct XenDevice *xendev) goto out; } - 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); out: qemu_free(type); |