xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	xen-devel@lists.xensource.com
Cc: linux-kernel@vger.kernel.org, david.vrabel@citrix.com,
	konrad.wilk@oracle.com
Subject: Re: [PATCH 1/2] hvc_xen: add earlycon support
Date: Wed, 24 Feb 2016 09:43:14 -0500	[thread overview]
Message-ID: <56CDC182.9050205@oracle.com> (raw)
In-Reply-To: <1456316590-20020-1-git-send-email-stefano.stabellini@eu.citrix.com>

On 02/24/2016 07:23 AM, Stefano Stabellini wrote:
> Introduce EARLYCON support in hvc_xen, useful for early debugging on arm
> and arm64, where xen early_printk is not available. Differently from
> xenboot_write_console on x86, we won't just return if !xen_pv_domain(),
> because arm and arm64 guests are actually xen_hvm_domain() from linux
> pov, and also because we want to capture all possible writes, including
> the ones earlier than xen_early_init().
>
> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
> ---
>   drivers/tty/hvc/hvc_xen.c |   48 ++++++++++++++++++++++++++++++++++-----------
>   1 file changed, 37 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
> index fa816b7..34e8e9f 100644
> --- a/drivers/tty/hvc/hvc_xen.c
> +++ b/drivers/tty/hvc/hvc_xen.c
> @@ -25,6 +25,7 @@
>   #include <linux/init.h>
>   #include <linux/types.h>
>   #include <linux/list.h>
> +#include <linux/serial_core.h>
>   
>   #include <asm/io.h>
>   #include <asm/xen/hypervisor.h>
> @@ -597,21 +598,11 @@ static int xen_cons_init(void)
>   }
>   console_initcall(xen_cons_init);
>   
> -#ifdef CONFIG_EARLY_PRINTK
> -static void xenboot_write_console(struct console *console, const char *string,
> -				  unsigned len)
> +static void domU_write_early_console(const char *string, unsigned len)
>   {
>   	unsigned int linelen, off = 0;
>   	const char *pos;
>   
> -	if (!xen_pv_domain())
> -		return;
> -
> -	dom0_write_console(0, string, len);
> -
> -	if (xen_initial_domain())
> -		return;
> -
>   	domU_write_console(0, "(early) ", 8);
>   	while (off < len && NULL != (pos = strchr(string+off, '\n'))) {
>   		linelen = pos-string+off;
> @@ -625,6 +616,21 @@ static void xenboot_write_console(struct console *console, const char *string,
>   		domU_write_console(0, string+off, len-off);
>   }
>   
> +#ifdef CONFIG_EARLY_PRINTK
> +static void xenboot_write_console(struct console *console, const char *string,
> +				  unsigned len)
> +{
> +	if (!xen_pv_domain())
> +		return;

This, BTW, will break PVHv2 code (which is not there yet). Your patch is 
not making the code any different from what it is now but I wonder 
whether xenboot_write_console() can be made to work for HVM guests at 
this time since you making changes there anyway.

Or we can delay it until HVMlite/PVHv2 patches make it in.

> +
> +	dom0_write_console(0, string, len);
> +
> +	if (xen_initial_domain())
> +		return;
> +
> +	domU_write_early_console(string, len);
> +}
> +
>   struct console xenboot_console = {
>   	.name		= "xenboot",
>   	.write		= xenboot_write_console,
> @@ -664,3 +670,23 @@ void xen_raw_printk(const char *fmt, ...)
>   
>   	xen_raw_console_write(buf);
>   }
> +
> +static void xenboot_earlycon_write(struct console *console,
> +				  const char *string,
> +				  unsigned len)
> +{
> +	dom0_write_console(0, string, len);
> +
> +	if (xen_initial_domain())
> +		return;
> +
> +	domU_write_early_console(string, len);
> +}

xenboot_earlycon_write() and xenboot_write_console() share most of the 
code, can it be factored out?

-boris

> +
> +static int __init xenboot_earlycon_setup(struct earlycon_device *device,
> +					    const char *opt)
> +{
> +	device->con->write = xenboot_earlycon_write;
> +	return 0;
> +}
> +EARLYCON_DECLARE(xenboot, xenboot_earlycon_setup);

  reply	other threads:[~2016-02-24 14:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 12:22 [0/2] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
2016-02-24 12:23 ` [PATCH 1/2] hvc_xen: add earlycon support Stefano Stabellini
2016-02-24 14:43   ` Boris Ostrovsky [this message]
2016-02-24 15:55     ` Stefano Stabellini
2016-02-24 17:18       ` Konrad Rzeszutek Wilk
2016-02-24 17:22         ` [Xen-devel] " Andrew Cooper
2016-02-25 12:00           ` Stefano Stabellini
2016-02-25 11:53         ` Stefano Stabellini
2016-02-24 12:23 ` [PATCH 2/2] hvc_xen: fix xenboot for DomUs Stefano Stabellini
2016-02-24 12:53   ` kbuild test robot
2016-02-24 15:48     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56CDC182.9050205@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).