hvc_xen: fix xenboot for DomUs
The xenboot early console has been partially broken for DomU for a long time: the output would only go to the hypervisor via hypercall (HYPERVISOR_console_io), while it wouldn't actually go to the DomU console. The reason is that domU_write_console would return early as no xencons structs are configured for it. Add an appropriate xencons struct for xenboot from the xenboot setup callback. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
This commit is contained in:
parent
16e506efc0
commit
5de738b3fb
@ -246,6 +246,18 @@ err:
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int xencons_info_pv_init(struct xencons_info *info, int vtermno)
|
||||||
|
{
|
||||||
|
info->evtchn = xen_start_info->console.domU.evtchn;
|
||||||
|
/* GFN == MFN for PV guest */
|
||||||
|
info->intf = gfn_to_virt(xen_start_info->console.domU.mfn);
|
||||||
|
info->vtermno = vtermno;
|
||||||
|
|
||||||
|
list_add_tail(&info->list, &xenconsoles);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int xen_pv_console_init(void)
|
static int xen_pv_console_init(void)
|
||||||
{
|
{
|
||||||
struct xencons_info *info;
|
struct xencons_info *info;
|
||||||
@ -265,13 +277,8 @@ static int xen_pv_console_init(void)
|
|||||||
/* already configured */
|
/* already configured */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
info->evtchn = xen_start_info->console.domU.evtchn;
|
|
||||||
/* GFN == MFN for PV guest */
|
|
||||||
info->intf = gfn_to_virt(xen_start_info->console.domU.mfn);
|
|
||||||
info->vtermno = HVC_COOKIE;
|
|
||||||
|
|
||||||
spin_lock(&xencons_lock);
|
spin_lock(&xencons_lock);
|
||||||
list_add_tail(&info->list, &xenconsoles);
|
xencons_info_pv_init(info, HVC_COOKIE);
|
||||||
spin_unlock(&xencons_lock);
|
spin_unlock(&xencons_lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -599,6 +606,18 @@ static int xen_cons_init(void)
|
|||||||
console_initcall(xen_cons_init);
|
console_initcall(xen_cons_init);
|
||||||
|
|
||||||
#ifdef CONFIG_EARLY_PRINTK
|
#ifdef CONFIG_EARLY_PRINTK
|
||||||
|
static int __init xenboot_setup_console(struct console *console, char *string)
|
||||||
|
{
|
||||||
|
static struct xencons_info xenboot;
|
||||||
|
|
||||||
|
if (xen_initial_domain())
|
||||||
|
return 0;
|
||||||
|
if (!xen_pv_domain())
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
return xencons_info_pv_init(&xenboot, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void xenboot_write_console(struct console *console, const char *string,
|
static void xenboot_write_console(struct console *console, const char *string,
|
||||||
unsigned len)
|
unsigned len)
|
||||||
{
|
{
|
||||||
@ -629,6 +648,7 @@ static void xenboot_write_console(struct console *console, const char *string,
|
|||||||
struct console xenboot_console = {
|
struct console xenboot_console = {
|
||||||
.name = "xenboot",
|
.name = "xenboot",
|
||||||
.write = xenboot_write_console,
|
.write = xenboot_write_console,
|
||||||
|
.setup = xenboot_setup_console,
|
||||||
.flags = CON_PRINTBUFFER | CON_BOOT | CON_ANYTIME,
|
.flags = CON_PRINTBUFFER | CON_BOOT | CON_ANYTIME,
|
||||||
.index = -1,
|
.index = -1,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user