[PATCH v7 2/2] xen: enable dom0less guests to use console_io hypercalls

Stefano Stabellini posted 2 patches 2 weeks, 3 days ago
There is a newer version of this series
[PATCH v7 2/2] xen: enable dom0less guests to use console_io hypercalls
Posted by Stefano Stabellini 2 weeks, 3 days ago
Enable dom0less guests on ARM to use console_io hypercalls:
- set input_allow = true for dom0less domains
- update the in-code comment in console.c
- prioritize the VUART check to retain the same behavior as today

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 xen/common/device-tree/dom0less-build.c |  2 ++
 xen/drivers/char/console.c              | 17 ++++++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
index 840d14419d..cb7026fa7e 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -829,6 +829,8 @@ static int __init construct_domU(struct kernel_info *kinfo,
 
     rangeset_destroy(kinfo->xen_reg_assigned);
 
+    d->console->input_allowed = true;
+
     return rc;
 }
 
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 09354db2e0..26de872b8d 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -612,10 +612,18 @@ static void __serial_rx(char c)
     if ( !d )
         return;
 
-    if ( is_hardware_domain(d) )
+#ifdef CONFIG_SBSA_VUART_CONSOLE
+    /* Prioritize vpl011 if enabled for this domain */
+    if ( d->arch.vpl011.base_addr )
+    {
+        /* Deliver input to the emulated UART. */
+        rc = vpl011_rx_char_xen(d, c);
+    }
+    else
+#endif
     {
         /*
-         * Deliver input to the hardware domain buffer, unless it is
+         * Deliver input to the focus domain buffer, unless it is
          * already full.
          */
         nrspin_lock_irq(&console_lock);
@@ -629,11 +637,6 @@ static void __serial_rx(char c)
          */
         send_global_virq(VIRQ_CONSOLE);
     }
-#ifdef CONFIG_SBSA_VUART_CONSOLE
-    else
-        /* Deliver input to the emulated UART. */
-        rc = vpl011_rx_char_xen(d, c);
-#endif
 
     if ( consoled_is_enabled() )
         /* Deliver input to the PV shim console. */
-- 
2.25.1
Re: [PATCH v7 2/2] xen: enable dom0less guests to use console_io hypercalls
Posted by Jan Beulich 1 week, 5 days ago
On 23.01.2026 02:06, Stefano Stabellini wrote:
> --- a/xen/common/device-tree/dom0less-build.c
> +++ b/xen/common/device-tree/dom0less-build.c
> @@ -829,6 +829,8 @@ static int __init construct_domU(struct kernel_info *kinfo,
>  
>      rangeset_destroy(kinfo->xen_reg_assigned);
>  
> +    d->console->input_allowed = true;

Why for all of the domains? Shouldn't this be a per-domain setting?

> --- a/xen/drivers/char/console.c
> +++ b/xen/drivers/char/console.c
> @@ -612,10 +612,18 @@ static void __serial_rx(char c)
>      if ( !d )
>          return;
>  
> -    if ( is_hardware_domain(d) )

This check is fully lost; shouldn't it be replaced by ...

> +#ifdef CONFIG_SBSA_VUART_CONSOLE
> +    /* Prioritize vpl011 if enabled for this domain */
> +    if ( d->arch.vpl011.base_addr )
> +    {
> +        /* Deliver input to the emulated UART. */
> +        rc = vpl011_rx_char_xen(d, c);
> +    }
> +    else
> +#endif

...

    if ( d->input_allowed )

the latest here (not sure about the vpl011 intentions in this regard)?

>      {
>          /*
> -         * Deliver input to the hardware domain buffer, unless it is
> +         * Deliver input to the focus domain buffer, unless it is
>           * already full.
>           */

As said there, imo this change belongs in the earlier patch.

Jan
Re: [PATCH v7 2/2] xen: enable dom0less guests to use console_io hypercalls
Posted by Stefano Stabellini 1 week, 4 days ago
On Wed, 28 Jan 2026, Jan Beulich wrote:
> On 23.01.2026 02:06, Stefano Stabellini wrote:
> > --- a/xen/common/device-tree/dom0less-build.c
> > +++ b/xen/common/device-tree/dom0less-build.c
> > @@ -829,6 +829,8 @@ static int __init construct_domU(struct kernel_info *kinfo,
> >  
> >      rangeset_destroy(kinfo->xen_reg_assigned);
> >  
> > +    d->console->input_allowed = true;
> 
> Why for all of the domains? Shouldn't this be a per-domain setting?

For all dom0less domains. No, I don't think it should be a per-domain
setting. If you are running dom0less you only have two options: this
one, or vuart and both of them work the same way and require
input_allowed = true.


> > --- a/xen/drivers/char/console.c
> > +++ b/xen/drivers/char/console.c
> > @@ -612,10 +612,18 @@ static void __serial_rx(char c)
> >      if ( !d )
> >          return;
> >  
> > -    if ( is_hardware_domain(d) )
> 
> This check is fully lost; shouldn't it be replaced by ...
> 
> > +#ifdef CONFIG_SBSA_VUART_CONSOLE
> > +    /* Prioritize vpl011 if enabled for this domain */
> > +    if ( d->arch.vpl011.base_addr )
> > +    {
> > +        /* Deliver input to the emulated UART. */
> > +        rc = vpl011_rx_char_xen(d, c);
> > +    }
> > +    else
> > +#endif
> 
> ...
> 
>     if ( d->input_allowed )
> 
> the latest here (not sure about the vpl011 intentions in this regard)?

No because vuart has already input_allowed


> >      {
> >          /*
> > -         * Deliver input to the hardware domain buffer, unless it is
> > +         * Deliver input to the focus domain buffer, unless it is
> >           * already full.
> >           */
> 
> As said there, imo this change belongs in the earlier patch.

I can move them there
Re: [PATCH v7 2/2] xen: enable dom0less guests to use console_io hypercalls
Posted by Stefano Stabellini 1 week, 4 days ago
On Wed, 28 Jan 2026, Stefano Stabellini wrote:
> On Wed, 28 Jan 2026, Jan Beulich wrote:
> > On 23.01.2026 02:06, Stefano Stabellini wrote:
> > > --- a/xen/common/device-tree/dom0less-build.c
> > > +++ b/xen/common/device-tree/dom0less-build.c
> > > @@ -829,6 +829,8 @@ static int __init construct_domU(struct kernel_info *kinfo,
> > >  
> > >      rangeset_destroy(kinfo->xen_reg_assigned);
> > >  
> > > +    d->console->input_allowed = true;
> > 
> > Why for all of the domains? Shouldn't this be a per-domain setting?
> 
> For all dom0less domains. No, I don't think it should be a per-domain
> setting. If you are running dom0less you only have two options: this
> one, or vuart and both of them work the same way and require
> input_allowed = true.
> 
> 
> > > --- a/xen/drivers/char/console.c
> > > +++ b/xen/drivers/char/console.c
> > > @@ -612,10 +612,18 @@ static void __serial_rx(char c)
> > >      if ( !d )
> > >          return;
> > >  
> > > -    if ( is_hardware_domain(d) )
> > 
> > This check is fully lost; shouldn't it be replaced by ...
> > 
> > > +#ifdef CONFIG_SBSA_VUART_CONSOLE
> > > +    /* Prioritize vpl011 if enabled for this domain */
> > > +    if ( d->arch.vpl011.base_addr )
> > > +    {
> > > +        /* Deliver input to the emulated UART. */
> > > +        rc = vpl011_rx_char_xen(d, c);
> > > +    }
> > > +    else
> > > +#endif
> > 
> > ...
> > 
> >     if ( d->input_allowed )
> > 
> > the latest here (not sure about the vpl011 intentions in this regard)?
> 
> No because vuart has already input_allowed

Sorry, let me rephrase this. You are right we need a d->input_allowed
check. The check is already done as part of 

    d = console_get_domain();
    if ( !d )
        return;
Re: [PATCH v7 2/2] xen: enable dom0less guests to use console_io hypercalls
Posted by Jan Beulich 1 week, 4 days ago
On 29.01.2026 03:46, Stefano Stabellini wrote:
> On Wed, 28 Jan 2026, Stefano Stabellini wrote:
>> On Wed, 28 Jan 2026, Jan Beulich wrote:
>>>> --- a/xen/drivers/char/console.c
>>>> +++ b/xen/drivers/char/console.c
>>>> @@ -612,10 +612,18 @@ static void __serial_rx(char c)
>>>>      if ( !d )
>>>>          return;
>>>>  
>>>> -    if ( is_hardware_domain(d) )
>>>
>>> This check is fully lost; shouldn't it be replaced by ...
>>>
>>>> +#ifdef CONFIG_SBSA_VUART_CONSOLE
>>>> +    /* Prioritize vpl011 if enabled for this domain */
>>>> +    if ( d->arch.vpl011.base_addr )
>>>> +    {
>>>> +        /* Deliver input to the emulated UART. */
>>>> +        rc = vpl011_rx_char_xen(d, c);
>>>> +    }
>>>> +    else
>>>> +#endif
>>>
>>> ...
>>>
>>>     if ( d->input_allowed )
>>>
>>> the latest here (not sure about the vpl011 intentions in this regard)?
>>
>> No because vuart has already input_allowed
> 
> Sorry, let me rephrase this. You are right we need a d->input_allowed
> check. The check is already done as part of 
> 
>     d = console_get_domain();
>     if ( !d )
>         return;

Can this be said explicitly in the description then?

Jan