From: Michalis Pappas Date: Mon, 14 Aug 2023 07:09:00 +0000 (+0200) Subject: plat/kvm: Enable 8250 / NS16550 X-Git-Tag: RELEASE-0.14.0~21 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e3e1cb63f0311d6c3c1ed6b7f0468f8ac51580fb;p=unikraft%2Funikraft.git plat/kvm: Enable 8250 / NS16550 Update the KVM configuration to enable the 8250 / NS16550 UART driver. This driver is selected when KVM_VMM_FIRECRACKER is selected on arm64. Signed-off-by: Michalis Pappas Reviewed-by: Sergiu Moga Reviewed-by: Maria Sfiraiala Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #1048 --- diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk index d7c30151b..47b5fb996 100644 --- a/plat/kvm/Config.uk +++ b/plat/kvm/Config.uk @@ -97,14 +97,6 @@ endchoice menu "Console Options" -config KVM_KERNEL_SERIAL_CONSOLE - bool "Serial console for the kernel prints" - default y - depends on (ARCH_X86_64 || ARCH_ARM_64) - select UART_PL011 if ARCH_ARM_64 - help - Choose serial console for the kernel printing - config KVM_KERNEL_VGA_CONSOLE bool "VGA console for the kernel prints" default y @@ -126,35 +118,66 @@ config KVM_DEBUG_VGA_CONSOLE help Choose VGA console for the debug printing +config KVM_KERNEL_SERIAL_CONSOLE + bool "Serial console for the kernel prints" + default y + depends on (ARCH_X86_64 || ARCH_ARM_64) + help + Choose serial console for the kernel printing + if (KVM_KVM_KERNEL_SERIAL_CONSOLE || KVM_DEBUG_SERIAL_CONSOLE) + +choice + prompt "Serial console driver" + depends on ARCH_ARM_64 + default UART_PL011 if KVM_VMM_QEMU + default UART_NS16550 if KVM_VMM_FIRECRACKER + +config UART_PL011 + bool "PrimeCell UART (PL011)" + +config UART_NS16550 + bool "8250 / NS16550" +endchoice + menu "Serial console configuration" - if ARCH_X86_64 - choice - prompt "Baudrate" - default KVM_SERIAL_BAUD_115200 - - config KVM_SERIAL_BAUD_115200 - bool "115200" - - config KVM_SERIAL_BAUD_57600 - bool "57600" - - config KVM_SERIAL_BAUD_38400 - bool "38400" - - config KVM_SERIAL_BAUD_19200 - bool "19200" - endchoice - endif - - if ARCH_ARM_64 - config EARLY_PRINT_PL011_UART_ADDR - hex "Early debug console pl011 serial address" - default 0x09000000 - depends on (KVM_DEBUG_SERIAL_CONSOLE && ARCH_ARM_64) - help - Pl011 serial address used by early debug console. - endif +if ARCH_X86_64 +choice + prompt "Baudrate" + default KVM_SERIAL_BAUD_115200 + + config KVM_SERIAL_BAUD_115200 + bool "115200" + + config KVM_SERIAL_BAUD_57600 + bool "57600" + + config KVM_SERIAL_BAUD_38400 + bool "38400" + + config KVM_SERIAL_BAUD_19200 + bool "19200" +endchoice +endif + +config EARLY_PRINT_PL011_UART_ADDR + hex "Early debug console pl011 serial address" + depends on UART_PL011 + default 0x09000000 + depends on (KVM_DEBUG_SERIAL_CONSOLE && ARCH_ARM_64) + help + Pl011 serial address used by early debug console. + +config EARLY_UART_NS16550 + bool "Early console" + depends on UART_NS16550 + default n + +config EARLY_UART_NS16550_BASE + hex "Early debug console ns16550 serial address" + depends on EARLY_UART_NS16550 + help + NS16550 serial address used by early debug console. endmenu endif diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk index 80c1769ac..ff2bd70a6 100644 --- a/plat/kvm/Makefile.uk +++ b/plat/kvm/Makefile.uk @@ -85,9 +85,8 @@ endif ## ## Architecture library definitions for arm64 ## -ifeq ($(findstring y,$(CONFIG_KVM_KERNEL_SERIAL_CONSOLE) $(CONFIG_KVM_DEBUG_SERIAL_CONSOLE)),y) -LIBKVMPLAT_SRCS-$(CONFIG_ARCH_ARM_64) += $(UK_PLAT_DRIVERS_BASE)/uart/pl011.c -endif +LIBKVMPLAT_SRCS-$(CONFIG_UART_NS16550) += $(UK_PLAT_DRIVERS_BASE)/uart/ns16550.c +LIBKVMPLAT_SRCS-$(CONFIG_UART_PL011) += $(UK_PLAT_DRIVERS_BASE)/uart/pl011.c ifeq ($(CONFIG_PAGING),y) LIBKVMPLAT_SRCS-$(CONFIG_ARCH_ARM_64) += $(UK_PLAT_COMMON_BASE)/paging.c|isr endif diff --git a/plat/kvm/arm/setup.c b/plat/kvm/arm/setup.c index c6af9fd59..392fbeac0 100644 --- a/plat/kvm/arm/setup.c +++ b/plat/kvm/arm/setup.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #ifdef CONFIG_RTC_PL031 #include #endif /* CONFIG_RTC_PL031 */ @@ -163,7 +163,7 @@ void __no_pauth _ukplat_entry(struct ukplat_bootinfo *bi) fdt = (void *)bi->dtb; - pl011_console_init(fdt); + kvm_console_init(fdt); rc = cmdline_init(bi); if (unlikely(rc < 0)) diff --git a/plat/kvm/include/kvm-arm64/uart.h b/plat/kvm/include/kvm-arm64/uart.h new file mode 100644 index 000000000..4998742ef --- /dev/null +++ b/plat/kvm/include/kvm-arm64/uart.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2023, Unikraft GmbH and The Unikraft Authors. + * Licensed under the BSD-3-Clause License (the "License"). + * You may not use this file except in compliance with the License. + */ +#if CONFIG_UART_NS16550 +#include +#endif /* CONFIG UART_NS16550 */ + +#if CONFIG_UART_PL011 +#include +#endif /* CONFIG_UART_PL011 */ + +static inline void kvm_console_init(void *fdt) +{ +#if CONFIG_UART_NS16550 + ns16550_console_init(fdt); +#endif /* CONFIG UART_NS16550 */ + +#if CONFIG_UART_PL011 + pl011_console_init(fdt); +#endif /* CONFIG_UART_PL011 */ +}