From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760636AbcBYMLn (ORCPT ); Thu, 25 Feb 2016 07:11:43 -0500 Received: from smtp.citrix.com ([66.165.176.89]:29370 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760604AbcBYMLm (ORCPT ); Thu, 25 Feb 2016 07:11:42 -0500 X-IronPort-AV: E=Sophos;i="5.22,498,1449532800"; d="scan'208";a="334452140" From: Stefano Stabellini To: CC: , , , , , Stefano Stabellini Subject: [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs Date: Thu, 25 Feb 2016 12:10:38 +0000 Message-ID: <1456402239-4179-2-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v2: - add return to xenboot_setup_console --- drivers/tty/hvc/hvc_xen.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c index 68b8ec8..bf787aa 100644 --- a/drivers/tty/hvc/hvc_xen.c +++ b/drivers/tty/hvc/hvc_xen.c @@ -246,6 +246,18 @@ err: return -ENODEV; } +static int xen_early_pv_console_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) { struct xencons_info *info; @@ -265,13 +277,8 @@ static int xen_pv_console_init(void) /* already configured */ 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); - list_add_tail(&info->list, &xenconsoles); + xen_early_pv_console_init(info, HVC_COOKIE); spin_unlock(&xencons_lock); return 0; @@ -599,6 +606,18 @@ static int xen_cons_init(void) console_initcall(xen_cons_init); #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 xen_early_pv_console_init(&xenboot, 0); +} + static void xenboot_write_console(struct console *console, const char *string, unsigned len) { @@ -629,6 +648,7 @@ static void xenboot_write_console(struct console *console, const char *string, struct console xenboot_console = { .name = "xenboot", .write = xenboot_write_console, + .setup = xenboot_setup_console, .flags = CON_PRINTBUFFER | CON_BOOT | CON_ANYTIME, .index = -1, }; -- 1.7.10.4