From 6ab80d4c175f87a6aaeb201e01a39a65de5b9727 Mon Sep 17 00:00:00 2001 From: Dai Xin Date: Wed, 15 Feb 2023 16:41:21 +0000 Subject: [PATCH] sw64: implement a new policy of power management Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5XTK7 -------------------------------- In the previous commit, we prefer to use efi runtime function hooks as default power management ops, it may raise unexpected errors at virtual machine application. So in this commit we make the legacy power management module built in the kernel, which may be used by some guest os kernel under some circumstances when running without efi loader support. Signed-off-by: Dai Xin Reviewed-by: He Sheng Signed-off-by: Gu Zitao --- arch/sw_64/Kconfig | 7 ------- arch/sw_64/include/asm/platform.h | 1 + arch/sw_64/kernel/dup_print.c | 2 +- drivers/platform/sw64/Makefile | 2 +- drivers/platform/sw64/legacy_xuelang.c | 8 +++++--- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/sw_64/Kconfig b/arch/sw_64/Kconfig index 3b9b13209e35..0d85536419e2 100644 --- a/arch/sw_64/Kconfig +++ b/arch/sw_64/Kconfig @@ -255,13 +255,6 @@ config PLATFORM_XUELANG endchoice -config LEGACY_XUELANG - bool "Xuelang Reset Interface" - depends on SW64_CHIP3 - help - This enables the legacy reset driver for SW64 chip3 CRBs. This interface - as a temporary solution will be deprecated in the future. - config MIGHT_HAVE_PC_SERIO bool "Use PC serio device i8042" select ARCH_MIGHT_HAVE_PC_SERIO diff --git a/arch/sw_64/include/asm/platform.h b/arch/sw_64/include/asm/platform.h index c52e7fd7a039..9f146c579446 100644 --- a/arch/sw_64/include/asm/platform.h +++ b/arch/sw_64/include/asm/platform.h @@ -15,6 +15,7 @@ struct sw64_platform_ops { extern struct sw64_platform_ops *sw64_platform; extern struct sw64_platform_ops xuelang_ops; +extern struct boot_params *sunway_boot_params; extern void sw64_halt(void); extern void sw64_poweroff(void); diff --git a/arch/sw_64/kernel/dup_print.c b/arch/sw_64/kernel/dup_print.c index 3a32c444207d..e28e0053239c 100644 --- a/arch/sw_64/kernel/dup_print.c +++ b/arch/sw_64/kernel/dup_print.c @@ -3,7 +3,7 @@ #include #include -#include +#include #include #ifdef CONFIG_SW64_RRK diff --git a/drivers/platform/sw64/Makefile b/drivers/platform/sw64/Makefile index 8d166464e4c9..28922224fb17 100644 --- a/drivers/platform/sw64/Makefile +++ b/drivers/platform/sw64/Makefile @@ -1,2 +1,2 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_LEGACY_XUELANG) += legacy_xuelang.o +obj-$(CONFIG_PLATFORM_XUELANG) += legacy_xuelang.o diff --git a/drivers/platform/sw64/legacy_xuelang.c b/drivers/platform/sw64/legacy_xuelang.c index 803bea946730..59ecd3ea8e5e 100644 --- a/drivers/platform/sw64/legacy_xuelang.c +++ b/drivers/platform/sw64/legacy_xuelang.c @@ -51,9 +51,11 @@ void sw64_restart(void) static int sw64_reset_init(void) { - pm_restart = sw64_restart; - pm_power_off = sw64_poweroff; - pm_halt = sw64_halt; + if (!sunway_boot_params->efi_systab) { + pm_restart = sw64_restart; + pm_power_off = sw64_poweroff; + pm_halt = sw64_halt; + } return 0; } -- GitLab