From patchwork Thu Feb 25 12:10:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 8423271 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8785E9F52D for ; Thu, 25 Feb 2016 12:14:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8E4720253 for ; Thu, 25 Feb 2016 12:14:07 +0000 (UTC) Received: from lists.xen.org (unknown [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0CB7B202E6 for ; Thu, 25 Feb 2016 12:14:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aYulm-00042w-2d; Thu, 25 Feb 2016 12:11:46 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aYulk-00042F-Eq for xen-devel@lists.xensource.com; Thu, 25 Feb 2016 12:11:44 +0000 Received: from [193.109.254.147] by server-3.bemta-14.messagelabs.com id 4B/94-03304-F7FEEC65; Thu, 25 Feb 2016 12:11:43 +0000 X-Env-Sender: prvs=856006447=Stefano.Stabellini@citrix.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1456402301!26682852!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54249 invoked from network); 25 Feb 2016 12:11:42 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 25 Feb 2016 12:11:42 -0000 X-IronPort-AV: E=Sophos;i="5.22,498,1449532800"; d="scan'208";a="334452140" From: Stefano Stabellini To: 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 X-DLP: MIA1 Cc: boris.ostrovsky@oracle.com, david.vrabel@citrix.com, linux-kernel@vger.kernel.org, Stefano Stabellini Subject: [Xen-devel] [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Boris Ostrovsky --- 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, };