]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/kvm: Enable 8250 / NS16550
authorMichalis Pappas <michalis@unikraft.io>
Mon, 14 Aug 2023 07:09:00 +0000 (09:09 +0200)
committerUnikraft <monkey@unikraft.io>
Tue, 15 Aug 2023 18:16:09 +0000 (18:16 +0000)
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 <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1048

plat/kvm/Config.uk
plat/kvm/Makefile.uk
plat/kvm/arm/setup.c
plat/kvm/include/kvm-arm64/uart.h [new file with mode: 0644]

index d7c30151b11371a85e7dd71e94dce279b98926b7..47b5fb996dbfd3ce23a5b5b4eb220af12c86b6cb 100644 (file)
@@ -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
 
index 80c1769acc59de1d4834edc718aac46042c33460..ff2bd70a65bb99c531abacab058f691ff5b3487f 100644 (file)
@@ -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
index c6af9fd599d21bc849c22f7cb26653e1f6381b27..392fbeac00fcdae992563b67e0a03f23f9c5e49b 100644 (file)
@@ -27,7 +27,7 @@
 #include <uk/plat/common/acpi.h>
 #include <uk/plat/lcpu.h>
 #include <uk/plat/common/lcpu.h>
-#include <uart/pl011.h>
+#include <kvm-arm64/uart.h>
 #ifdef CONFIG_RTC_PL031
 #include <rtc/pl031.h>
 #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 (file)
index 0000000..4998742
--- /dev/null
@@ -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 <uart/ns16550.h>
+#endif /* CONFIG UART_NS16550 */
+
+#if CONFIG_UART_PL011
+#include <uart/pl011.h>
+#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 */
+}