From fde0bcc1cebf0e72ec6bf915d8252e8f3d6b585a Mon Sep 17 00:00:00 2001 From: Minggui Cao Date: Mon, 24 Dec 2018 21:27:04 +0800 Subject: [PATCH] HV: disable vuart when dbg uart is disabled vuart it used for SOS to output log to HV console, so if dbg uart is disabled, it need be disabled too: just unregister its PIO. Tracked-On: 2170 Signed-off-by: Minggui Cao Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vm.c | 10 ++++++---- hypervisor/debug/uart16550.c | 5 +++++ hypervisor/include/debug/console.h | 1 + hypervisor/release/console.c | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index 14b936382..e1aa43122 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -149,14 +149,16 @@ int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm) register_pm1ab_handler(vm); } - /* Create virtual uart */ - vuart_init(vm); + /* Create virtual uart; just when uart enabled, vuart can work */ + if (is_dbg_uart_enabled()) { + vuart_init(vm); + } } vpic_init(vm); #ifdef CONFIG_PARTITION_MODE - /* Create virtual uart */ - if (vm_desc->vm_vuart) { + /* Create virtual uart; just when uart enabled, vuart can work */ + if (vm_desc->vm_vuart && is_dbg_uart_enabled()) { vuart_init(vm); } vrtc_init(vm); diff --git a/hypervisor/debug/uart16550.c b/hypervisor/debug/uart16550.c index a023f1157..c0560eebc 100644 --- a/hypervisor/debug/uart16550.c +++ b/hypervisor/debug/uart16550.c @@ -235,3 +235,8 @@ bool is_pci_dbg_uart(union pci_bdf bdf_value) return ret; } + +bool is_dbg_uart_enabled(void) +{ + return uart_enabled; +} diff --git a/hypervisor/include/debug/console.h b/hypervisor/include/debug/console.h index ede919699..2841ee5ea 100644 --- a/hypervisor/include/debug/console.h +++ b/hypervisor/include/debug/console.h @@ -38,6 +38,7 @@ char console_getc(void); void console_setup_timer(void); void uart16550_set_property(bool enabled, bool port_mapped, uint64_t base_addr); bool is_pci_dbg_uart(union pci_bdf bdf_value); +bool is_dbg_uart_enabled(void); void shell_init(void); void shell_kick(void); diff --git a/hypervisor/release/console.c b/hypervisor/release/console.c index 71878b76a..2d4f21176 100644 --- a/hypervisor/release/console.c +++ b/hypervisor/release/console.c @@ -26,6 +26,7 @@ void resume_console(void) {} void uart16550_set_property(__unused bool enabled, __unused bool port_mapped, __unused uint64_t base_addr) {} bool is_pci_dbg_uart(__unused union pci_bdf bdf_value) { return false; } +bool is_dbg_uart_enabled(void) { return false; } void shell_init(void) {} void shell_kick(void) {}