* [PATCH v2 1/3] hvc_xen: add earlycon support
2016-02-25 12:09 [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
@ 2016-02-25 12:10 ` Stefano Stabellini
2016-02-25 15:00 ` Boris Ostrovsky
2016-02-25 12:10 ` [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs Stefano Stabellini
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Stefano Stabellini @ 2016-02-25 12:10 UTC (permalink / raw)
To: xen-devel
Cc: linux-kernel, Stefano.Stabellini, david.vrabel, konrad.wilk,
boris.ostrovsky, Stefano Stabellini
Introduce EARLYCON support in hvc_xen, useful for early debugging on arm
and arm64, where xen early_printk is not available.
It is different from xenboot_write_console on x86 in two ways:
- it does not return if !xen_pv_domain(), not only because ARM guests
are xen_hvm_domain(), but also because we want to capture all the
early boot messages, before xen support is discovered
- it does not try to print to the domU console at all, because xen
support will only be discovered at a later point
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
Changes in v2:
- do not try to print to the DomU console
---
drivers/tty/hvc/hvc_xen.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index fa816b7..68b8ec8 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>
@@ -664,3 +665,18 @@ 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);
+}
+
+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);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/3] hvc_xen: add earlycon support
2016-02-25 12:10 ` [PATCH v2 1/3] hvc_xen: add earlycon support Stefano Stabellini
@ 2016-02-25 15:00 ` Boris Ostrovsky
0 siblings, 0 replies; 12+ messages in thread
From: Boris Ostrovsky @ 2016-02-25 15:00 UTC (permalink / raw)
To: Stefano Stabellini, xen-devel; +Cc: linux-kernel, david.vrabel, konrad.wilk
On 02/25/2016 07:10 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.
>
> It is different from xenboot_write_console on x86 in two ways:
>
> - it does not return if !xen_pv_domain(), not only because ARM guests
> are xen_hvm_domain(), but also because we want to capture all the
> early boot messages, before xen support is discovered
> - it does not try to print to the domU console at all, because xen
> support will only be discovered at a later point
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs
2016-02-25 12:09 [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
2016-02-25 12:10 ` [PATCH v2 1/3] hvc_xen: add earlycon support Stefano Stabellini
@ 2016-02-25 12:10 ` Stefano Stabellini
2016-02-25 15:04 ` Boris Ostrovsky
2016-02-25 12:10 ` [PATCH v2 3/3] hvc_xen: make early_printk work with HVM guests Stefano Stabellini
2016-02-26 14:28 ` [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
3 siblings, 1 reply; 12+ messages in thread
From: Stefano Stabellini @ 2016-02-25 12:10 UTC (permalink / raw)
To: xen-devel
Cc: linux-kernel, Stefano.Stabellini, david.vrabel, konrad.wilk,
boris.ostrovsky, Stefano Stabellini
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 <stefano.stabellini@eu.citrix.com>
---
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,
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs
2016-02-25 12:10 ` [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs Stefano Stabellini
@ 2016-02-25 15:04 ` Boris Ostrovsky
2016-02-26 15:39 ` Stefano Stabellini
0 siblings, 1 reply; 12+ messages in thread
From: Boris Ostrovsky @ 2016-02-25 15:04 UTC (permalink / raw)
To: Stefano Stabellini, xen-devel; +Cc: linux-kernel, david.vrabel, konrad.wilk
On 02/25/2016 07:10 AM, Stefano Stabellini wrote:
> 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 <stefano.stabellini@eu.citrix.com>
>
> ---
> 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)
Nit: not sure whether "early" is the right word to use here: when called
from xen_pv_console_init() it's not really on the early path.
Other than that:
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> +{
> + 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,
> };
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs
2016-02-25 15:04 ` Boris Ostrovsky
@ 2016-02-26 15:39 ` Stefano Stabellini
2016-02-26 16:09 ` Boris Ostrovsky
0 siblings, 1 reply; 12+ messages in thread
From: Stefano Stabellini @ 2016-02-26 15:39 UTC (permalink / raw)
To: Boris Ostrovsky
Cc: Stefano Stabellini, xen-devel, linux-kernel, david.vrabel, konrad.wilk
On Thu, 25 Feb 2016, Boris Ostrovsky wrote:
> On 02/25/2016 07:10 AM, Stefano Stabellini wrote:
> > 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 <stefano.stabellini@eu.citrix.com>
> >
> > ---
> > 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)
>
> Nit: not sure whether "early" is the right word to use here: when called from
> xen_pv_console_init() it's not really on the early path.
What about xencons_info_pv_init?
> Other than that:
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Thanks!
> > +{
> > + 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,
> > };
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs
2016-02-26 15:39 ` Stefano Stabellini
@ 2016-02-26 16:09 ` Boris Ostrovsky
2016-02-26 16:57 ` Stefano Stabellini
0 siblings, 1 reply; 12+ messages in thread
From: Boris Ostrovsky @ 2016-02-26 16:09 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: xen-devel, linux-kernel, david.vrabel, konrad.wilk
On 02/26/2016 10:39 AM, Stefano Stabellini wrote:
> On Thu, 25 Feb 2016, Boris Ostrovsky wrote:
>> On 02/25/2016 07:10 AM, Stefano Stabellini wrote:
>>> 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 <stefano.stabellini@eu.citrix.com>
>>>
>>> ---
>>> 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)
>> Nit: not sure whether "early" is the right word to use here: when called from
>> xen_pv_console_init() it's not really on the early path.
> What about xencons_info_pv_init?
Sure, that sounds good.
(BTW, I didn't mean that my R-b was conditional on this)
-boris
>
>
>> Other than that:
>> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Thanks!
>
>
>>> +{
>>> + 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,
>>> };
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs
2016-02-26 16:09 ` Boris Ostrovsky
@ 2016-02-26 16:57 ` Stefano Stabellini
0 siblings, 0 replies; 12+ messages in thread
From: Stefano Stabellini @ 2016-02-26 16:57 UTC (permalink / raw)
To: Boris Ostrovsky
Cc: Stefano Stabellini, xen-devel, linux-kernel, david.vrabel, konrad.wilk
On Fri, 26 Feb 2016, Boris Ostrovsky wrote:
> On 02/26/2016 10:39 AM, Stefano Stabellini wrote:
> > On Thu, 25 Feb 2016, Boris Ostrovsky wrote:
> > > On 02/25/2016 07:10 AM, Stefano Stabellini wrote:
> > > > 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 <stefano.stabellini@eu.citrix.com>
> > > >
> > > > ---
> > > > 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)
> > > Nit: not sure whether "early" is the right word to use here: when called
> > > from
> > > xen_pv_console_init() it's not really on the early path.
> > What about xencons_info_pv_init?
>
> Sure, that sounds good.
>
> (BTW, I didn't mean that my R-b was conditional on this)
No problem. I made this change and committed the three patches to
for-linus-4.6, based on v4.5-rc5.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 3/3] hvc_xen: make early_printk work with HVM guests
2016-02-25 12:09 [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
2016-02-25 12:10 ` [PATCH v2 1/3] hvc_xen: add earlycon support Stefano Stabellini
2016-02-25 12:10 ` [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs Stefano Stabellini
@ 2016-02-25 12:10 ` Stefano Stabellini
2016-02-25 15:13 ` Boris Ostrovsky
2016-02-26 14:28 ` [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
3 siblings, 1 reply; 12+ messages in thread
From: Stefano Stabellini @ 2016-02-25 12:10 UTC (permalink / raw)
To: xen-devel
Cc: linux-kernel, Stefano.Stabellini, david.vrabel, konrad.wilk,
boris.ostrovsky, Stefano Stabellini
Refactor the existing code in xen_raw_console_write to get the generic
early_printk console work with HVM guests.
Take the opportunity to replace the outb loop with a single outsb call
to reduce the number of vmexit.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
drivers/tty/hvc/hvc_xen.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index bf787aa..a1c3746 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -605,6 +605,16 @@ static int xen_cons_init(void)
}
console_initcall(xen_cons_init);
+#ifdef CONFIG_X86
+static void xen_hvm_early_write(uint32_t vtermno, const char *str, int len)
+{
+ if (xen_cpuid_base())
+ outsb(0xe9, str, len);
+}
+#else
+static void xen_hvm_early_write(uint32_t vtermno, const char *str, int len) { }
+#endif
+
#ifdef CONFIG_EARLY_PRINTK
static int __init xenboot_setup_console(struct console *console, char *string)
{
@@ -624,8 +634,10 @@ static void xenboot_write_console(struct console *console, const char *string,
unsigned int linelen, off = 0;
const char *pos;
- if (!xen_pv_domain())
+ if (!xen_pv_domain()) {
+ xen_hvm_early_write(0, string, len);
return;
+ }
dom0_write_console(0, string, len);
@@ -661,17 +673,10 @@ void xen_raw_console_write(const char *str)
if (xen_domain()) {
rc = dom0_write_console(0, str, len);
-#ifdef CONFIG_X86
- if (rc == -ENOSYS && xen_hvm_domain())
- goto outb_print;
-
- } else if (xen_cpuid_base()) {
- int i;
-outb_print:
- for (i = 0; i < len; i++)
- outb(str[i], 0xe9);
-#endif
+ if (rc != -ENOSYS || !xen_hvm_domain())
+ return;
}
+ xen_hvm_early_write(0, str, len);
}
void xen_raw_printk(const char *fmt, ...)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/3] hvc_xen: make early_printk work with HVM guests
2016-02-25 12:10 ` [PATCH v2 3/3] hvc_xen: make early_printk work with HVM guests Stefano Stabellini
@ 2016-02-25 15:13 ` Boris Ostrovsky
0 siblings, 0 replies; 12+ messages in thread
From: Boris Ostrovsky @ 2016-02-25 15:13 UTC (permalink / raw)
To: Stefano Stabellini, xen-devel; +Cc: linux-kernel, david.vrabel, konrad.wilk
On 02/25/2016 07:10 AM, Stefano Stabellini wrote:
> Refactor the existing code in xen_raw_console_write to get the generic
> early_printk console work with HVM guests.
>
> Take the opportunity to replace the outb loop with a single outsb call
> to reduce the number of vmexit.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM
2016-02-25 12:09 [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
` (2 preceding siblings ...)
2016-02-25 12:10 ` [PATCH v2 3/3] hvc_xen: make early_printk work with HVM guests Stefano Stabellini
@ 2016-02-26 14:28 ` Stefano Stabellini
2016-02-26 14:41 ` David Vrabel
3 siblings, 1 reply; 12+ messages in thread
From: Stefano Stabellini @ 2016-02-26 14:28 UTC (permalink / raw)
To: Stefano Stabellini
Cc: xen-devel, linux-kernel, David Vrabel, Konrad Rzeszutek Wilk,
boris.ostrovsky
On Thu, 25 Feb 2016, Stefano Stabellini wrote:
> Hi all,
>
> this series exports xenboot on ARM and ARM64 as earlycon, and gets
> xenboot fully working again for PV DomUs on x86 (currently the xenboot
> output only goes to the hypervisor via hypercall and not to the DomU
> console).
>
> Cheers,
>
> Stefano
>
>
> Stefano Stabellini (3):
> hvc_xen: add earlycon support
> hvc_xen: fix xenboot for DomUs
> hvc_xen: make early_printk work with HVM guests
Boris has reviewed all the patches in the series. Are you all happy if I
go ahead and commit the whole series to xentip/for-linus-4.6 ?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM
2016-02-26 14:28 ` [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
@ 2016-02-26 14:41 ` David Vrabel
0 siblings, 0 replies; 12+ messages in thread
From: David Vrabel @ 2016-02-26 14:41 UTC (permalink / raw)
To: Stefano Stabellini
Cc: xen-devel, linux-kernel, Konrad Rzeszutek Wilk, boris.ostrovsky
On 26/02/16 14:28, Stefano Stabellini wrote:
> On Thu, 25 Feb 2016, Stefano Stabellini wrote:
>> Hi all,
>>
>> this series exports xenboot on ARM and ARM64 as earlycon, and gets
>> xenboot fully working again for PV DomUs on x86 (currently the xenboot
>> output only goes to the hypervisor via hypercall and not to the DomU
>> console).
>>
>> Cheers,
>>
>> Stefano
>>
>>
>> Stefano Stabellini (3):
>> hvc_xen: add earlycon support
>> hvc_xen: fix xenboot for DomUs
>> hvc_xen: make early_printk work with HVM guests
>
> Boris has reviewed all the patches in the series. Are you all happy if I
> go ahead and commit the whole series to xentip/for-linus-4.6 ?
Yes. I don't think that branch exists yet so you'll need to create it.
I usually use the latest tagged rc as a base.
David
^ permalink raw reply [flat|nested] 12+ messages in thread