xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] hvc_xen: introduce HVC_XEN_FRONTEND
Date: Tue, 21 Feb 2012 09:43:16 -0500	[thread overview]
Message-ID: <20120221144316.GG5652@phenom.dumpdata.com> (raw)
In-Reply-To: <1329823842-10085-1-git-send-email-stefano.stabellini@eu.citrix.com>

On Tue, Feb 21, 2012 at 11:30:42AM +0000, Stefano Stabellini wrote:
> Introduce a new config option HVC_XEN_FRONTEND to enable/disable the
> xenbus based pv console frontend.

applied.

> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>  drivers/tty/hvc/Kconfig   |    8 +++
>  drivers/tty/hvc/hvc_xen.c |  116 ++++++++++++++++++++++++---------------------
>  2 files changed, 70 insertions(+), 54 deletions(-)
> 
> diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
> index 4222035..192e21e 100644
> --- a/drivers/tty/hvc/Kconfig
> +++ b/drivers/tty/hvc/Kconfig
> @@ -76,6 +76,14 @@ config HVC_XEN
>  	help
>  	  Xen virtual console device driver
>  
> +config HVC_XEN_FRONTEND
> +	bool "Xen Hypervisor Multiple Consoles support"
> +	depends on HVC_XEN
> +	select XEN_XENBUS_FRONTEND
> +	default y
> +	help
> +	  Xen driver for secondary virtual consoles
> +
>  config HVC_UDBG
>         bool "udbg based fake hypervisor console"
>         depends on PPC && EXPERIMENTAL
> diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
> index 26090c7..83d5c88 100644
> --- a/drivers/tty/hvc/hvc_xen.c
> +++ b/drivers/tty/hvc/hvc_xen.c
> @@ -55,7 +55,6 @@ struct xencons_info {
>  
>  static LIST_HEAD(xenconsoles);
>  static DEFINE_SPINLOCK(xencons_lock);
> -static struct xenbus_driver xencons_driver;
>  
>  /* ------------------------------------------------------------------ */
>  
> @@ -298,53 +297,6 @@ static int xen_initial_domain_console_init(void)
>  	return 0;
>  }
>  
> -static int __init xen_hvc_init(void)
> -{
> -	int r;
> -	struct xencons_info *info;
> -	const struct hv_ops *ops;
> -
> -	if (!xen_domain())
> -		return -ENODEV;
> -
> -	if (xen_initial_domain()) {
> -		ops = &dom0_hvc_ops;
> -		r = xen_initial_domain_console_init();
> -		if (r < 0)
> -			return r;
> -		info = vtermno_to_xencons(HVC_COOKIE);
> -	} else {
> -		ops = &domU_hvc_ops;
> -		if (xen_hvm_domain())
> -			r = xen_hvm_console_init();
> -		else
> -			r = xen_pv_console_init();
> -		if (r < 0)
> -			return r;
> -
> -		info = vtermno_to_xencons(HVC_COOKIE);
> -		info->irq = bind_evtchn_to_irq(info->evtchn);
> -	}
> -	if (info->irq < 0)
> -		info->irq = 0; /* NO_IRQ */
> -	else
> -		irq_set_noprobe(info->irq);
> -
> -	info->hvc = hvc_alloc(HVC_COOKIE, info->irq, ops, 256);
> -	if (IS_ERR(info->hvc)) {
> -		r = PTR_ERR(info->hvc);
> -		spin_lock(&xencons_lock);
> -		list_del(&info->list);
> -		spin_unlock(&xencons_lock);
> -		if (info->irq)
> -			unbind_from_irqhandler(info->irq, NULL);
> -		kfree(info);
> -		return r;
> -	}
> -
> -	return xenbus_register_frontend(&xencons_driver);
> -}
> -
>  void xen_console_resume(void)
>  {
>  	struct xencons_info *info = vtermno_to_xencons(HVC_COOKIE);
> @@ -392,6 +344,9 @@ 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));
> @@ -543,6 +498,65 @@ static const struct xenbus_device_id xencons_ids[] = {
>  };
>  
>  
> +static DEFINE_XENBUS_DRIVER(xencons, "xenconsole",
> +	.probe = xencons_probe,
> +	.remove = xencons_remove,
> +	.resume = xencons_resume,
> +	.otherend_changed = xencons_backend_changed,
> +);
> +#endif /* CONFIG_HVC_XEN_FRONTEND */
> +
> +static int __init xen_hvc_init(void)
> +{
> +	int r;
> +	struct xencons_info *info;
> +	const struct hv_ops *ops;
> +
> +	if (!xen_domain())
> +		return -ENODEV;
> +
> +	if (xen_initial_domain()) {
> +		ops = &dom0_hvc_ops;
> +		r = xen_initial_domain_console_init();
> +		if (r < 0)
> +			return r;
> +		info = vtermno_to_xencons(HVC_COOKIE);
> +	} else {
> +		ops = &domU_hvc_ops;
> +		if (xen_hvm_domain())
> +			r = xen_hvm_console_init();
> +		else
> +			r = xen_pv_console_init();
> +		if (r < 0)
> +			return r;
> +
> +		info = vtermno_to_xencons(HVC_COOKIE);
> +		info->irq = bind_evtchn_to_irq(info->evtchn);
> +	}
> +	if (info->irq < 0)
> +		info->irq = 0; /* NO_IRQ */
> +	else
> +		irq_set_noprobe(info->irq);
> +
> +	info->hvc = hvc_alloc(HVC_COOKIE, info->irq, ops, 256);
> +	if (IS_ERR(info->hvc)) {
> +		r = PTR_ERR(info->hvc);
> +		spin_lock(&xencons_lock);
> +		list_del(&info->list);
> +		spin_unlock(&xencons_lock);
> +		if (info->irq)
> +			unbind_from_irqhandler(info->irq, NULL);
> +		kfree(info);
> +		return r;
> +	}
> +
> +	r = 0;
> +#ifdef CONFIG_HVC_XEN_FRONTEND
> +	r = xenbus_register_frontend(&xencons_driver);
> +#endif
> +	return r;
> +}
> +
>  static void __exit xen_hvc_fini(void)
>  {
>  	struct xencons_info *entry, *next;
> @@ -580,12 +594,6 @@ static int xen_cons_init(void)
>  	return 0;
>  }
>  
> -static DEFINE_XENBUS_DRIVER(xencons, "xenconsole",
> -	.probe = xencons_probe,
> -	.remove = xencons_remove,
> -	.resume = xencons_resume,
> -	.otherend_changed = xencons_backend_changed,
> -);
>  
>  module_init(xen_hvc_init);
>  module_exit(xen_hvc_fini);
> -- 
> 1.7.2.5
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xensource.com/xen-devel

  reply	other threads:[~2012-02-21 14:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21 11:30 [PATCH] hvc_xen: introduce HVC_XEN_FRONTEND Stefano Stabellini
2012-02-21 14:43 ` Konrad Rzeszutek Wilk [this message]
2012-03-04 16:06 ` Konrad Rzeszutek Wilk
2012-03-05 22:45   ` Stefano Stabellini
2012-03-13 16:29     ` Konrad Rzeszutek Wilk
2012-03-13 18:30       ` Stefano Stabellini
2012-03-13 23:20         ` Konrad Rzeszutek Wilk
2012-03-13 23:34       ` Matt Wilson

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=20120221144316.GG5652@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --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).