From patchwork Tue Oct 28 17:30:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 39687 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6B5C024026 for ; Tue, 28 Oct 2014 17:33:14 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf995341eek.1 for ; Tue, 28 Oct 2014 10:33:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:references:in-reply-to:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=Sjv4wLvpj8OIoXCJQQAJzeLxaPcYtNMBFeIe34gRGJ4=; b=R1Q7Pj8uGgQVXTTvXAiDegeDoZJ1PvVfQm0PCHxSCQNNkVG3ecQ1y8CbsHInZmK8h4 VOhrGYKq8mA2c83msZ8UkihgVXtR1g08s4fQsDs22RqrBOSWGSESIQfQT+O0VBkVs6no BAvz27L+9Xx/OnuDzADMMKbGKeqmr8tfetAVYXkxAMzixvPNM7oIKdeIqTPv6YVG2p5l edId7mDKmCrHpXSuGS2G7x/LceO9ilzLxIxKXiaMZkGonF6nD65om8U0B33Bo2P6H7tu 21vhza2YJJ2XFezXpL4sKO5RFP2aN9kUI19yfszaUtSsRo9W4o3S8q13ToiW60HSVbEc bcTg== X-Gm-Message-State: ALoCoQmgVaUizTCKhiNY1YKdDtL9xMVE+rrrivbkVhfW+JEYm+7wX8vrjOodlzljxvt/lRs1ZjVS X-Received: by 10.180.182.164 with SMTP id ef4mr987467wic.0.1414517593423; Tue, 28 Oct 2014 10:33:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.133 with SMTP id am5ls94887lac.54.gmail; Tue, 28 Oct 2014 10:33:13 -0700 (PDT) X-Received: by 10.112.63.70 with SMTP id e6mr5410976lbs.93.1414517593261; Tue, 28 Oct 2014 10:33:13 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id xo10si3553812lbb.74.2014.10.28.10.33.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 10:33:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id w7so1046497lbi.38 for ; Tue, 28 Oct 2014 10:33:13 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr5579712lbw.66.1414517592990; Tue, 28 Oct 2014 10:33:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp523104lbz; Tue, 28 Oct 2014 10:33:12 -0700 (PDT) X-Received: by 10.170.202.196 with SMTP id t187mr5109383yke.36.1414517591437; Tue, 28 Oct 2014 10:33:11 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id b66si3301940qga.118.2014.10.28.10.33.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 28 Oct 2014 10:33:11 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XjAbh-00050E-CU; Tue, 28 Oct 2014 17:30:57 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XjAbg-000509-6t for xen-devel@lists.xen.org; Tue, 28 Oct 2014 17:30:56 +0000 Received: from [85.158.143.35] by server-1.bemta-4.messagelabs.com id 78/9C-02952-FC2DF445; Tue, 28 Oct 2014 17:30:55 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-3.tower-21.messagelabs.com!1414517455!12898582!1 X-Originating-IP: [209.85.212.181] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31422 invoked from network); 28 Oct 2014 17:30:55 -0000 Received: from mail-wi0-f181.google.com (HELO mail-wi0-f181.google.com) (209.85.212.181) by server-3.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 28 Oct 2014 17:30:55 -0000 Received: by mail-wi0-f181.google.com with SMTP id n3so2365955wiv.2 for ; Tue, 28 Oct 2014 10:30:54 -0700 (PDT) X-Received: by 10.181.13.77 with SMTP id ew13mr24043263wid.45.1414517454469; Tue, 28 Oct 2014 10:30:54 -0700 (PDT) Received: from [10.80.2.139] ([185.25.64.249]) by mx.google.com with ESMTPSA id t9sm2523523wjf.41.2014.10.28.10.30.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 10:30:53 -0700 (PDT) Message-ID: <544FD2C7.2020207@linaro.org> Date: Tue, 28 Oct 2014 17:30:47 +0000 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.8.1 MIME-Version: 1.0 To: Iurii Konovalenko , xen-devel@lists.xen.org, Ian Campbell , Stefano Stabellini References: In-Reply-To: Subject: Re: [Xen-devel] Question on hvc console init X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: On 10/28/2014 03:53 PM, Iurii Konovalenko wrote: > Hello, all! Hello Iurii, > I try to bring up Xen on Renesas Lager board (r8a7790 SoC - R-Car H2). > Xen revision is 4.4. > I try to run Linux (kernel 3.14 + LTSI patches) as Dom0. > In kernel I've found strange behaviour in hvc console init function. > In file drivers/tty/hvc/hvc_xen.c in function xen_cons_init(void) sources are: > > if (!xen_domain()) > return 0; > > if (xen_initial_domain()) > ops = &dom0_hvc_ops; > else { > > xen_domain() and xen_initial_domain() are defined to check > xen_domain_type variable. This variable is defined and initialized to > XEN_NATIVE in arch/arm/xen/enlighten.c. The real value of this > variable is set in same file function xen_guest_init(), that is > early_initcall. But eraly_initcall is called later, than > console_initcall, that's why in time of running xen_cons_init(void) > xen_domain_type is not initialized to correct value and > xen_cons_init() does not initialize console, as returns on first check > "if (!xen_domain())". > It is not critical in normal operation, because we have > device_initcall xen_hvc_init() that is called after xen_guest_init(), > it initialize hvc. But in case of kernel falls before > device_initcall's, we can't see any printouts, that could be useful. > > Could you please explain, may be using some configs or arguments in > command line for kernel, how to enable this early console? AFAIK, this part of the HVC console has never been tested on Xen on ARM. When the kernel is hanging before the console is effectively setup, I usually use the hacky patch below. In any case, you are welcome to send a patch for fixing the early console ;). I guess the best solution would be to call xen_guest_init earlier. Regards, diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c index f1e5742..644fd65 100644 --- a/drivers/tty/hvc/hvc_xen.c +++ b/drivers/tty/hvc/hvc_xen.c @@ -306,6 +306,7 @@ void xen_console_resume(void) rebind_evtchn_irq(info->evtchn, info->irq); } +#ifdef CONFIG_HVC_XEN_FRONTEND static void xencons_disconnect_backend(struct xencons_info *info) { if (info->irq > 0) @@ -346,7 +347,8 @@ static int xen_console_remove(struct xencons_info *info) return 0; } -#ifdef CONFIG_HVC_XEN_FRONTEND +static struct xenbus_driver xencons_driver; + static int xencons_remove(struct xenbus_device *dev) { return xen_console_remove(dev_get_drvdata(&dev->dev)); @@ -626,7 +628,6 @@ void xen_raw_console_write(const char *str) ssize_t len = strlen(str); int rc = 0; - if (xen_domain()) { rc = dom0_write_console(0, str, len); #ifdef CONFIG_X86 if (rc == -ENOSYS && xen_hvm_domain()) @@ -638,7 +639,6 @@ outb_print: for (i = 0; i < len; i++) outb(str[i], 0xe9); #endif - } } void xen_raw_printk(const char *fmt, ...) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ced2b84..6c7b960 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1613,6 +1613,8 @@ static size_t cont_print_text(char *text, size_t size) return textlen; } +#include + asmlinkage int vprintk_emit(int facility, int level, const char *dict, size_t dictlen, const char *fmt, va_list args) @@ -1680,6 +1682,8 @@ asmlinkage int vprintk_emit(int facility, int level, * prefix which might be passed-in as a parameter. */ text_len = vscnprintf(text, sizeof(textbuf), fmt, args); + xen_raw_console_write(text); + /* mark and strip a trailing newline */ if (text_len && text[text_len-1] == '\n') {