From cb3e6667e32753dbad94c8fbcc97b6074bb57675 Mon Sep 17 00:00:00 2001 From: qinwei1 Date: Fri, 11 Aug 2023 16:35:07 +0800 Subject: [PATCH] arm64: add PSCI support for qemu platform Summary Add ARM PCSI (Power State Coordination Interface) Support for qemu. With the interface, Poweroff/PowerReset can be support Signed-off-by: qinwei1 --- arch/arm64/Kconfig | 2 ++ arch/arm64/src/goldfish/goldfish_boot.c | 4 ++++ arch/arm64/src/qemu/qemu_boot.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index d1528a38db..289c1ff8e5 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -49,6 +49,7 @@ config ARCH_CHIP_RK3399 config ARCH_CHIP_QEMU bool "QEMU virt platform (ARMv8a)" select ARCH_HAVE_ADDRENV + select ARCH_HAVE_PSCI select ARCH_NEED_ADDRENV_MAPPING ---help--- QEMU virt platform (ARMv8a) @@ -56,6 +57,7 @@ config ARCH_CHIP_QEMU config ARCH_CHIP_GOLDFISH bool "goldfish platform (ARMv8a)" select ARCH_CORTEX_A53 + select ARCH_HAVE_PSCI select ARCH_HAVE_MULTICPU select ARMV8A_HAVE_GICv2 select ARCH_HAVE_ADDRENV diff --git a/arch/arm64/src/goldfish/goldfish_boot.c b/arch/arm64/src/goldfish/goldfish_boot.c index 308b432ee6..dc6066f435 100644 --- a/arch/arm64/src/goldfish/goldfish_boot.c +++ b/arch/arm64/src/goldfish/goldfish_boot.c @@ -174,6 +174,10 @@ void arm64_chip_boot(void) arm64_mmu_init(true); +#ifdef CONFIG_ARCH_HAVE_PSCI + arm64_psci_init("smc"); +#endif + /* Perform board-specific device initialization. This would include * configuration of board specific resources such as GPIOs, LEDs, etc. */ diff --git a/arch/arm64/src/qemu/qemu_boot.c b/arch/arm64/src/qemu/qemu_boot.c index 26256befad..e9e28ec574 100644 --- a/arch/arm64/src/qemu/qemu_boot.c +++ b/arch/arm64/src/qemu/qemu_boot.c @@ -177,7 +177,7 @@ void arm64_chip_boot(void) #if defined(CONFIG_ARCH_CHIP_QEMU_WITH_HV) arm64_psci_init("hvc"); -#elif defined(CONFIG_SMP) || defined(CONFIG_ARCH_HAVE_PSCI) +#elif defined(CONFIG_ARCH_HAVE_PSCI) arm64_psci_init("smc"); #endif