From patchwork Thu May 23 14:50:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 17134 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0BD6D2395B for ; Thu, 23 May 2013 14:51:19 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id o13sf4079090qaj.1 for ; Thu, 23 May 2013 07:50:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=HtJWQjuOihXm7AKjaaFkHJFbvPN97EpJJsMAezFlrZA=; b=LqV0VB5EXYbjTtgi5MMiECZe74fkXcsizqffN8OE5RM3GlQjQBBOOQvDNPEhJGfS+S qFCMOTyzJbzS8HWbbNDXFi5mv+xkYzlnMzN76sM/n98/a12mStsrOTtTPaRL1jIJEXZ0 m2VHjR3LZVFIw/VabXl3o4LvWIgBMfQWGNDpn1+lBA3ZgsNgl5uT+GE1QJRzezMqb9xG ip2/C6qyy54pxWBkXhh0KSBfZnMsfI4FGsvQDz83MgI47dWndc0Xd1YiSMkvKbhXHxzF wZj3k0KPJn0Na2LosJgx00AVV17bleCAIMz36ux9QjUkcwWStnlEDNSsCceCzr0pedud RJ9g== X-Received: by 10.224.205.138 with SMTP id fq10mr311682qab.1.1369320622204; Thu, 23 May 2013 07:50:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.15.66 with SMTP id v2ls1515961qec.98.gmail; Thu, 23 May 2013 07:50:22 -0700 (PDT) X-Received: by 10.52.29.19 with SMTP id f19mr4677011vdh.100.1369320621946; Thu, 23 May 2013 07:50:21 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id ef7si6536105vdc.111.2013.05.23.07.50.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 07:50:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ht10so2254018vcb.4 for ; Thu, 23 May 2013 07:50:21 -0700 (PDT) X-Received: by 10.52.176.65 with SMTP id cg1mr4696872vdc.1.1369320621770; Thu, 23 May 2013 07:50:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp55293vcs; Thu, 23 May 2013 07:50:17 -0700 (PDT) X-Received: by 10.180.97.106 with SMTP id dz10mr37509685wib.2.1369320616874; Thu, 23 May 2013 07:50:16 -0700 (PDT) Received: from mail-we0-x22d.google.com (mail-we0-x22d.google.com [2a00:1450:400c:c03::22d]) by mx.google.com with ESMTPS id ej4si14593900wid.29.2013.05.23.07.50.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 07:50:16 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22d is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=2a00:1450:400c:c03::22d; Received: by mail-we0-f173.google.com with SMTP id p57so2076409wes.4 for ; Thu, 23 May 2013 07:50:16 -0700 (PDT) X-Received: by 10.181.13.74 with SMTP id ew10mr25736178wid.9.1369320615447; Thu, 23 May 2013 07:50:15 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id fu14sm36185914wic.8.2013.05.23.07.50.13 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 07:50:14 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: Stefano.Stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, Julien Grall Subject: [PATCH] xen/arm: avoid lost characters with early_printk Date: Thu, 23 May 2013 15:50:11 +0100 Message-Id: <1369320611-24956-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQkmrupQHeBT5Q9O3b6zOEDU0EfM9haDxgtfaBrRrwkpPrrRe9PStJqg4EU4cQJXl3GoXJp2 X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Introduce the function early_flush to wait until the UART has finished to transfer the character. When early printk is enabled, it's possible to loose the last characters if: - the UART is initialized by the UART driver - Xen hang This is result to a truncated message. To be sure that the message is fully transfered by early_printk, add a call to early_flush. This will avoid lost characters. Signed-off-by: Julien Grall --- xen/arch/arm/arm32/debug.S | 7 +++++++ xen/arch/arm/arm64/debug.S | 7 +++++++ xen/arch/arm/early_printk.c | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/xen/arch/arm/arm32/debug.S b/xen/arch/arm/arm32/debug.S index 1bfbfc1..92f5724 100644 --- a/xen/arch/arm/arm32/debug.S +++ b/xen/arch/arm/arm32/debug.S @@ -32,6 +32,13 @@ early_putch: early_uart_transmit r1, r0 mov pc, lr +.globl early_flush +/* Flush the UART - this function is called by C */ +early_flush: + ldr r1, =FIXMAP_ADDR(FIXMAP_CONSOLE) /* r1 := VA UART base address */ + early_uart_ready r1, r2 + mov pc, lr + /* * Local variables: * mode: ASM diff --git a/xen/arch/arm/arm64/debug.S b/xen/arch/arm/arm64/debug.S index 38b7c74..c7b5e6c 100644 --- a/xen/arch/arm/arm64/debug.S +++ b/xen/arch/arm/arm64/debug.S @@ -32,6 +32,13 @@ early_putch: early_uart_transmit x15, w0 ret +.globl early_flush +/* Flush the UART - this function is called by C */ +early_flush: + ldr x15, =FIXMAP_ADDR(FIXMAP_CONSOLE) /* x15 := VA UART base address */ + early_uart_ready x15, 1 + ret + /* * Local variables: * mode: ASM diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c index 5950323..ca151a5 100644 --- a/xen/arch/arm/early_printk.c +++ b/xen/arch/arm/early_printk.c @@ -16,6 +16,7 @@ #include void early_putch(char c); +void early_flush(void); /* Early printk buffer */ static char __initdata buf[512]; @@ -34,6 +35,12 @@ static void __init early_vprintk(const char *fmt, va_list args) { vsnprintf(buf, sizeof(buf), fmt, args); early_puts(buf); + + /* + * Wait the UART has finished to transfer all characters before + * to continue. This will avoid lost characters if Xen abort. + */ + early_flush(); } void __init early_printk(const char *fmt, ...)