On Thu, Jul 31, 2025 at 05:10:12PM -0700, Stefano Stabellini wrote:
> On Thu, 31 Jul 2025, dm...@proton.me wrote:
> > From: Denis Mukhin <dmuk...@ford.com>
> >
> > It may be useful to enforce console forwarding over the virtual UART. E.g.
> > hardware domain uses PV console by default, but it may be necessary to have
> > console forwarded to the hardware domain via emulated UART.
> >
> > Add CONFIG_VUART_CONSOLE_FOCUS to enforce such behavior.
> >
> > Signed-off-by: Denis Mukhin <dmuk...@ford.com>
> 
> I realize that hyperlaunch is not merged yet, but I think this one would
> be best as a hyperlaunch configuration option rather than a kconfig. But
> it is certainly useful for testing until Hyperlaunch is merged!

Yep, I used that to test PVH dom0 w/ emulator.

re: configuration option: I agree and, initially I wanted to hook a flag to xl
/ dom0 command line opton which will say that emulated UART can accept
physical input.

But then decided to hook such capability via Kconfig for simplicity.

> 
> 
> > ---
> > Changes since v3:
> > - new patch
> > ---
> >  xen/arch/x86/domain.c         | 6 ++++++
> >  xen/common/emul/vuart/Kconfig | 5 +++++
> >  xen/drivers/char/console.c    | 2 +-
> >  3 files changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> > index 39b0c0b199b9..40ff92ad6c61 100644
> > --- a/xen/arch/x86/domain.c
> > +++ b/xen/arch/x86/domain.c
> > @@ -848,6 +848,12 @@ int arch_domain_create(struct domain *d,
> >      if ( is_hardware_domain(d) && is_pv_domain(d) )
> >          emflags |= XEN_X86_EMU_PIT;
> >
> > +    if ( IS_ENABLED(CONFIG_VUART_CONSOLE_FOCUS) &&
> > +         IS_ENABLED(CONFIG_VUART_NS16550) &&
> > +         is_hardware_domain(d) &&
> > +         is_hvm_domain(d) )
> > +        emflags |= XEN_X86_EMU_NS16550;
> > +
> >      if ( emflags & ~XEN_X86_EMU_ALL )
> >      {
> >          printk(XENLOG_G_ERR
> > diff --git a/xen/common/emul/vuart/Kconfig b/xen/common/emul/vuart/Kconfig
> > index ebefd90d913e..1069ca95f2db 100644
> > --- a/xen/common/emul/vuart/Kconfig
> > +++ b/xen/common/emul/vuart/Kconfig
> > @@ -51,4 +51,9 @@ config VUART_NS16550_DEBUG
> >     help
> >       Enable development debugging.
> >
> > +config VUART_CONSOLE_FOCUS
> > +   bool "Console input forwarding via UART emulator"
> > +   help
> > +     Enable physical console input forwarding to guest OS via emulated 
> > UART.
> > +
> >  endmenu
> > diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
> > index 93254979817b..d142f5511d61 100644
> > --- a/xen/drivers/char/console.c
> > +++ b/xen/drivers/char/console.c
> > @@ -597,7 +597,7 @@ static void __serial_rx(char c)
> >      if ( !d )
> >          return;
> >
> > -    if ( is_hardware_domain(d) )
> > +    if ( !IS_ENABLED(CONFIG_VUART_CONSOLE_FOCUS) && is_hardware_domain(d) )
> >      {
> >          /*
> >           * Deliver input to the hardware domain buffer, unless it is
> > --
> > 2.34.1
> >
> >


Reply via email to