[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 8/8] emul/vuart: introduce console forwarding enforcement via vUART



From: Denis Mukhin <dmukhin@xxxxxxxx> 

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 <dmukhin@xxxxxxxx>
---
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





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.