From c9d2fb7d406b0558ff0ae69a88f29c0e37ae387e Mon Sep 17 00:00:00 2001 From: Dmytro Firsov Date: Tue, 13 Jun 2023 13:19:18 +0300 Subject: [PATCH] xen: refactor Xen hypervisor Kconfig options Xen-related Kconfig options were highly dependand on BOARD/SOC xenvm. It is not correct because Xen support may be used on any board and SoC. So, Kconfig structure was refactored, now CONFIG_XEN is located in arch/ directory (same as in Linux kernel) and can be selected for any Cortex-A arm64 setup (no other platforms are currently supported). Also remove confusion in Domain 0 naming: Domain-0, initial domain, Dom0, privileged domain etc. Now all options related to Xen Domain 0 will be controlled by CONFIG_XEN_DOM0. Signed-off-by: Dmytro Firsov --- arch/arm64/core/CMakeLists.txt | 2 +- arch/arm64/core/Kconfig | 2 ++ arch/arm64/core/xen/Kconfig | 20 ++++++++++++++++++++ drivers/CMakeLists.txt | 2 +- drivers/serial/Kconfig.xen | 8 +++----- drivers/xen/Kconfig | 6 +++--- soc/arm64/xenvm/Kconfig.soc | 6 ------ 7 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 arch/arm64/core/xen/Kconfig diff --git a/arch/arm64/core/CMakeLists.txt b/arch/arm64/core/CMakeLists.txt index 56d6413034e..1804556c1a7 100644 --- a/arch/arm64/core/CMakeLists.txt +++ b/arch/arm64/core/CMakeLists.txt @@ -54,4 +54,4 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU") zephyr_cc_option(-moverride=tune=no_ldp_stp_qregs) endif() -add_subdirectory_ifdef(CONFIG_SOC_XENVM xen) +add_subdirectory_ifdef(CONFIG_XEN xen) diff --git a/arch/arm64/core/Kconfig b/arch/arm64/core/Kconfig index cd34eb02568..e0963211238 100644 --- a/arch/arm64/core/Kconfig +++ b/arch/arm64/core/Kconfig @@ -197,6 +197,8 @@ config ARMV8_A so that it can support some features included in the AArch64 state. It supports the T32 and A32 instruction sets. +rsource "xen/Kconfig" + endif # CPU_CORTEX_A if CPU_AARCH64_CORTEX_R diff --git a/arch/arm64/core/xen/Kconfig b/arch/arm64/core/xen/Kconfig new file mode 100644 index 00000000000..ea9489d4422 --- /dev/null +++ b/arch/arm64/core/xen/Kconfig @@ -0,0 +1,20 @@ +# Xen hypervisor configuration options + +# Copyright (c) 2023 EPAM Systems +# SPDX-License-Identifier: Apache-2.0 + +config XEN + bool + default y + depends on ARMV8_A + depends on DT_HAS_XEN_XEN_ENABLED + help + Enables support of Xen hypervisor on arm64 platform. Get enabled + when board device tree contains "hypervisor" node with "xen,xen" + compatible enabled. + +config XEN_DOM0 + bool "Zephyr as Xen Domain 0" + depends on XEN + help + Built binary will be used as Xen privileged domain (Domain 0). diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index b255b2b638e..891041f2ded 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -15,7 +15,7 @@ add_subdirectory(usb_c) add_subdirectory_ifdef(CONFIG_ADC adc) add_subdirectory_ifdef(CONFIG_AUDIO audio) add_subdirectory_ifdef(CONFIG_BBRAM bbram) -add_subdirectory_ifdef(CONFIG_BOARD_XENVM xen) +add_subdirectory_ifdef(CONFIG_XEN xen) add_subdirectory_ifdef(CONFIG_BT_DRIVERS bluetooth) add_subdirectory_ifdef(CONFIG_CACHE_MANAGEMENT cache) add_subdirectory_ifdef(CONFIG_CAN can) diff --git a/drivers/serial/Kconfig.xen b/drivers/serial/Kconfig.xen index 010541f77d1..89fe3f54194 100644 --- a/drivers/serial/Kconfig.xen +++ b/drivers/serial/Kconfig.xen @@ -1,6 +1,6 @@ # Xen hypervisor console via UART setup # -# Copyright (c) 2021 EPAM Systems +# Copyright (c) 2021-2023 EPAM Systems # SPDX-License-Identifier: Apache-2.0 # @@ -10,7 +10,7 @@ config UART_XEN_HVC depends on DT_HAS_XEN_HVC_UART_ENABLED select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT - depends on !XEN_INITIAL_DOMAIN + depends on XEN && !XEN_DOM0 help Enable Xen ring buffer based hypervisor console driver. Used for Zephyr as unprivileged domain. @@ -18,8 +18,7 @@ config UART_XEN_HVC config UART_XEN_HVC_CONSOLEIO bool "Xen hypervisor Dom0 console UART driver" select SERIAL_HAS_DRIVER - depends on BOARD_XENVM - depends on XEN_INITIAL_DOMAIN + depends on XEN_DOM0 default y help Enable Xen hypervisor console driver. Used for Zephyr as @@ -35,7 +34,6 @@ config XEN_HVC_INIT_PRIORITY config XEN_EARLY_CONSOLEIO bool "Early printk/stdout through console_io Xen interface" - depends on BOARD_XENVM depends on UART_XEN_HVC help Enable setting of console_io symbol hook for stdout and printk. diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 547b3a7f9e7..361c71a3538 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2022 EPAM Systems +# Copyright (c) 2022-2023 EPAM Systems -if SOC_XENVM +if XEN menu "Xen drivers" @@ -22,4 +22,4 @@ config XEN_GRANT_TABLE_INIT_PRIORITY endmenu -endif # SOC_XENVM +endif # XEN diff --git a/soc/arm64/xenvm/Kconfig.soc b/soc/arm64/xenvm/Kconfig.soc index 89f90ed5c7c..00f1bf0ca31 100644 --- a/soc/arm64/xenvm/Kconfig.soc +++ b/soc/arm64/xenvm/Kconfig.soc @@ -6,9 +6,3 @@ config SOC_XENVM select ARM64 select ARM_ARCH_TIMER if SYS_CLOCK_EXISTS select CPU_CORTEX_A72 - -config XEN_INITIAL_DOMAIN - bool "Zephyr as Xen Domain 0" - depends on SOC_XENVM - help - Built binary will be used as Xen privileged domain.