Add dependencies of POWER_RESET for MIPS Malta, x86, and PowerMac
Subsystems (4)
v2 cover Add dependencies of POWER_RESET for MIPS Malta, x86, and PowerMac
These patches are to add dependencies of POWER_RESET for MIPS Malta, x86, and PowerMac.
I am really sorry I forget to use --thread in v1[1] as I stayed up too late. So here I am resending v2 patch with a mirror fix and consolidating them into a thread.
To simplify the enablement of the poweroff support, selecting the required options for CONFIG_POWER_RESET=y may make many people happy especially when they are using a customized config (maybe tinyconfig based) for a target qemu board. Without normal poweroff support from the kernel side, qemu will simply hang[2] there after a 'poweroff' command, which is a very bad experience for the automatical tests.
Currently, based on tinyconfig, it is very hard to find the exact poweroff options[3]. Some architectures' poweroff works well without any dependence, the others' poweroff options are hidden deeply, which make things hard.
After multiple verifications, these options have been identified as the minimum dependencies required for poweroff to function normally.
Zhangjin and I invested a significant amount of time in searching for the current options on these devices. We hope that this set of patches will save time for others. If community like it, we will consider adding dependencies for POWER_RESET on other devices.
---
[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://lore.kernel.org/lkml/511b2f6009fb830b3f32b4be3dca99596c684fa3.1689759351.git.falcon@tinylab.org/
[3]: https://lore.kernel.org/all/983843582e52e83fba79ad45cea6c79e1f62ec6c.1690489039.git.falcon@tinylab.org/
---
Changes since v1:
- Fix the mistake of using spaces instead of tabs in kconfig.
Yuan Tan (3):
kconfig: add dependencies of POWER_RESET for mips malta
kconfig: add dependencies of POWER_RESET for x86
kconfig: add dependencies of POWER_RESET for PowerMac
arch/mips/Kconfig | 3 +++ arch/powerpc/platforms/powermac/Kconfig | 1 + arch/x86/Kconfig | 2 ++ 3 files changed, 6 insertions(+)
Signature · 1 line
2.34.1
PATCH v2 1/3 kconfig: add dependencies of POWER_RESET for mips malta
MIPS Malta's power off depends on PCI, PCI_QUIRKS, and POWER_RESET_PIIX4_POWEROFF to work. Enable them when POWER_RESET is set for convenience.
--- arch/mips/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
arch/mips/Kconfig +3 -0
@@ -547,6 +547,9 @@ config MIPS_MALTA select MIPS_L1_CACHE_SHIFT_6 select MIPS_MSC select PCI_GT64XXX_PCI0 + select PCI if POWER_RESET + select PCI_QUIRKS if POWER_RESET + select POWER_RESET_PIIX4_POWEROFF if POWER_RESET select SMP_UP if SMP select SWAP_IO_SPACE select SYS_HAS_CPU_MIPS32_R1
Signature · 1 line
2.34.1
PATCH v2 2/3 kconfig: add dependencies of POWER_RESET for x86
In reply to Yuan Tanx86 and x86_64's power off depends on ACPI and PCI to work. Enable them when POWER_RESET is set for convenience.
--- arch/x86/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/Kconfig +2 -0
@@ -58,6 +58,7 @@ config X86 # # Note: keep this list sorted alphabetically # + select ACPI if POWER_RESET select ACPI_LEGACY_TABLES_LOOKUP if ACPI select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI select ARCH_32BIT_OFF_T if X86_32
@@ -286,6 +287,7 @@ config X86 select NEED_PER_CPU_EMBED_FIRST_CHUNK select NEED_PER_CPU_PAGE_FIRST_CHUNK select NEED_SG_DMA_LENGTH + select PCI if POWER_RESET select PCI_DOMAINS if PCI select PCI_LOCKLESS_CONFIG if PCI select PERF_EVENTS
Signature · 1 line
2.34.1
PATCH v2 3/3 kconfig: add dependencies of POWER_RESET for PowerMac
In reply to Yuan TanPowerMac's power off depends on ADB_CUDA to work. Enable it when POWER_RESET is set for convenience.
--- arch/powerpc/platforms/powermac/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/powermac/Kconfig +1 -0
@@ -2,6 +2,7 @@ config PPC_PMAC bool "Apple PowerMac based machines" depends on PPC_BOOK3S && CPU_BIG_ENDIAN + select ADB_CUDA if POWER_RESET select MPIC select FORCE_PCI select PPC_INDIRECT_PCI if PPC32
Signature · 1 line
2.34.1
Re: [PATCH v2 3/3] kconfig: add dependencies of POWER_RESET for PowerMac
Le 01/09/2023 à 04:43, Yuan Tan a écrit :
Quoted 14 lines
PowerMac's power off depends on
ADB_CUDAto work. Enable it whenPOWER_RESETis set for convenience.Suggested-by Zhangjin Wu <[email protected]>Signed-off-by Yuan Tan <[email protected]>--- arch/powerpc/platforms/powermac/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/powerpc/platforms/powermac/Kconfig +0
-0
arch/powerpc/platforms/powermac/Kconfig line 5
Quoted 4 lines
arch/powerpc/platforms/powermac/Kconfig +1
-0@@ -2,6 +2,7 @@ config PPC_PMAC bool "Apple PowerMac based machines" depends on PPC_BOOK3S && CPU_BIG_ENDIAN + select ADB_CUDA if POWER_RESET
ADB_CUDA depends on !PPC_PMAC64.
What will happen if PPC_PMAC64 is selected ?
Quoted 3 lines
arch/powerpc/platforms/powermac/Kconfig +0
-0select MPIC select FORCE_PCI select PPC_INDIRECT_PCI if PPC32
Re: [PATCH v2 3/3] kconfig: add dependencies of POWER_RESET for PowerMac
Hi,
Quoted 22 lines · Christophe Leroy
Le 01/09/2023 à 04:43, Yuan Tan a écrit :
Quoted 14 lines
PowerMac's power off depends on
ADB_CUDAto work. Enable it whenPOWER_RESETis set for convenience.Suggested-by Zhangjin Wu <[email protected]>Signed-off-by Yuan Tan <[email protected]>--- arch/powerpc/platforms/powermac/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/powerpc/platforms/powermac/Kconfig +0
-0arch/powerpc/platforms/powermac/Kconfig line 5
Quoted 4 lines
arch/powerpc/platforms/powermac/Kconfig +1
-0@@ -2,6 +2,7 @@ config PPC_PMAC bool "Apple PowerMac based machines" depends on PPC_BOOK3S && CPU_BIG_ENDIAN + select ADB_CUDA if POWER_RESET
ADB_CUDAdepends on !PPC_PMAC64.
Quoted 5 lines
What will happen if
PPC_PMAC64is selected ?Quoted 3 lines
arch/powerpc/platforms/powermac/Kconfig +0
-0select MPIC select FORCE_PCI select PPC_INDIRECT_PCI if PPC32
I didn't notice that ADB_CUDA depends on !PPC_PMAC64. In the case where PPC_PMAC64 is set, ADB_CUDA indeed should not be enabled. Thank you for pointing that out.
I will fix it in v3 and check again in x86 and mips :)
Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta
In reply to Yuan TanHi,
Quoted 15 lines · Yuan Tan
MIPS Malta's power off depends on PCI,
PCI_QUIRKS, andPOWER_RESET_PIIX4_POWEROFFto work. Enable them whenPOWER_RESETis set for convenience.Suggested-by Zhangjin Wu <[email protected]>Signed-off-by Yuan Tan <[email protected]>--- arch/mips/Kconfig | 3 +++ 1 file changed, 3 insertions(+)arch/mips/Kconfig +0
-0
arch/mips/Kconfig config MIPS_MALTA · line 555
Quoted 9 lines
arch/mips/Kconfig +3
-0@@ -547,6 +547,9 @@ config MIPS_MALTA select MIPS_L1_CACHE_SHIFT_6 select MIPS_MSC select PCI_GT64XXX_PCI0 + select PCI if POWER_RESET + select PCI_QUIRKS if POWER_RESET + select POWER_RESET_PIIX4_POWEROFF if POWER_RESET select SMP_UP if SMP select SWAP_IO_SPACE select SYS_HAS_CPU_MIPS32_R1
Shouldn't we also update the _defconfig files?
Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta
In reply to Yuan TanQuoted 33 lines · Yuan Tan
Hi,
Quoted 13 lines · Philippe Mathieu-Daudé
Hi,
Quoted 10 lines · Yuan Tan
MIPS Malta's power off depends on PCI,
PCI_QUIRKS, andPOWER_RESET_PIIX4_POWEROFFto work. Enable them whenPOWER_RESETis set for convenience.Suggested-by Zhangjin Wu <[email protected]>Signed-off-by Yuan Tan <[email protected]>---
arch/mips/Kconfig| 3 +++1 file changed, 3 insertions(+)Quoted 17 lines
Quoted 6 lines
arch/mips/Kconfig +0
-0@@ -547,6 +547,9 @@ config MIPS_MALTAselect
MIPS_L1_CACHE_SHIFT_6Quoted 8 lines
select
MIPS_MSC
selectPCI_GT64XXX_PCI0
+ select PCI ifPOWER_RESET
+ selectPCI_QUIRKSifPOWER_RESET
+ selectPOWER_RESET_PIIX4_POWEROFFifPOWER_RESETselectSMP_UPif SMP
selectSWAP_IO_SPACE
selectSYS_HAS_CPU_MIPS32_R1Shouldn't we also update the
_defconfigfiles?
Quoted 5 lines
Sorry, in my last email, I forgot to reply to all. So I am now resending this email.
In
malta_defconfig, PCI andPOWER_RESET_PIIX4_POWEROFFhave already been set andPCI_QUIRKSis also selected byFSL_PCI[=n].So shutdown and reboot with
malta_defconfigis working and there is no need to update themalta_defconfig🙂
Since the dependency is now enforced by Kconfig, the defconfig can be simplified:
arch/mips/configs/malta_defconfig +0 -1
@@ -306,3 +306,2 @@ CONFIG_SERIAL_8250_CONSOLE=y CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_PIIX4_POWEROFF=y CONFIG_POWER_RESET_SYSCON=y
But maybe we don't care, I don't know.
Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta
Le 04/09/2023 à 12:51, Philippe Mathieu-Daudé a écrit :
Quoted 53 lines · Yuan Tan
Quoted 33 lines
Hi,
Quoted 13 lines · Philippe Mathieu-Daudé
Hi,
Quoted 10 lines · Yuan Tan
MIPS Malta's power off depends on PCI,
PCI_QUIRKS, andPOWER_RESET_PIIX4_POWEROFFto work. Enable them whenPOWER_RESETis set for convenience.Suggested-by Zhangjin Wu <[email protected]>Signed-off-by Yuan Tan <[email protected]>---
arch/mips/Kconfig| 3 +++1 file changed, 3 insertions(+)Quoted 17 lines
Quoted 6 lines
arch/mips/Kconfig +0
-0@@ -547,6 +547,9 @@ config MIPS_MALTAselect
MIPS_L1_CACHE_SHIFT_6Quoted 8 lines
select
MIPS_MSC
selectPCI_GT64XXX_PCI0
+ select PCI ifPOWER_RESET
+ selectPCI_QUIRKSifPOWER_RESET
+ selectPOWER_RESET_PIIX4_POWEROFFifPOWER_RESETselectSMP_UPif SMP
selectSWAP_IO_SPACE
selectSYS_HAS_CPU_MIPS32_R1Shouldn't we also update the
_defconfigfiles?Quoted 8 lines
Sorry, in my last email, I forgot to reply to all. So I am now resending this email.
In
malta_defconfig, PCI andPOWER_RESET_PIIX4_POWEROFFhave already been set andPCI_QUIRKSis also selected byFSL_PCI[=n].So shutdown and reboot with
malta_defconfigis working and there is no need to update themalta_defconfig🙂Since the dependency is now enforced by
Kconfig, the defconfig can be simplified:arch/mips/configs/malta_defconfig +0
-1@@ -306,3 +306,2 @@ CONFIG_SERIAL_8250_CONSOLE=y CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_PIIX4_POWEROFF=y CONFIG_POWER_RESET_SYSCON=y
Quoted 1 line
But maybe we don't care, I don't know.
I understand from what you say that you update malta_defconfig manually ?
defconfigs shouldn't be updated manually.
Once you have the new .config you should use "make savedefconfig" then replace your file by the newly generated defconfig file.
Christophe
Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta
Quoted 56 lines · Christophe Leroy
Le 04/09/2023 à 12:51, Philippe Mathieu-Daudé a écrit :
Quoted 51 lines · Yuan Tan
Quoted 32 lines
Hi,
Quoted 13 lines · Philippe Mathieu-Daudé
Hi,
Quoted 10 lines · Yuan Tan
MIPS Malta's power off depends on PCI,
PCI_QUIRKS, andPOWER_RESET_PIIX4_POWEROFFto work. Enable them whenPOWER_RESETis set for convenience.Suggested-by Zhangjin Wu <[email protected]>Signed-off-by Yuan Tan <[email protected]>--- arch/mips/Kconfig | 3 +++ 1 file changed, 3 insertions(+)Quoted 16 lines
Quoted 5 lines
arch/mips/Kconfig +0
-0arch/mips/Kconfig config MIPS_MALTA · line 555
Quoted 9 lines
arch/mips/Kconfig +3
-0@@ -547,6 +547,9 @@ config MIPS_MALTA select MIPS_L1_CACHE_SHIFT_6 select MIPS_MSC select PCI_GT64XXX_PCI0 + select PCI if POWER_RESET + select PCI_QUIRKS if POWER_RESET + select POWER_RESET_PIIX4_POWEROFF if POWER_RESET select SMP_UP if SMP select SWAP_IO_SPACE select SYS_HAS_CPU_MIPS32_R1Shouldn't we also update the
_defconfigfiles?Quoted 8 lines
Sorry, in my last email, I forgot to reply to all. So I am now resending this email.
In
malta_defconfig, PCI andPOWER_RESET_PIIX4_POWEROFFhave already been set andPCI_QUIRKSis also selected byFSL_PCI[=n].So shutdown and reboot with
malta_defconfigis working and there is no need to update themalta_defconfig🙂Since the dependency is now enforced by
Kconfig, the defconfig can be simplified:arch/mips/configs/malta_defconfig +0
-1@@ -306,3 +306,2 @@ CONFIG_SERIAL_8250_CONSOLE=y CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_PIIX4_POWEROFF=y CONFIG_POWER_RESET_SYSCON=yQuoted 1 line
But maybe we don't care, I don't know.
I understand from what you say that you update
malta_defconfigmanually ?
Quoted 6 lines
defconfigs shouldn't be updated manually.
Once you have the new .config you should use "make savedefconfig" then replace your file by the newly generated defconfig file.
Christophe
To do so, I just unset CONFIG_POWER_RESET and set it again in menuconfig, then "make savedefconfig". The POWER_RESET part is simplified.
CONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_PIIX4_POWEROFF=y
-CONFIG_POWER_RESET_SYSCON=y
However, I found that there's other changes in this new malta_defconfig, for example
CONFIG_NLS_KOI8_U=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_LRW=m -CONFIG_CRYPTO_PCBC=m -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_XCBC=m -CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_WP512=m -CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAMELLIA=m
Should I import all these changes in a commit? Or only POWER_RESET part.
Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta
Quoted 79 lines · Yuan Tan
Quoted 56 lines · Christophe Leroy
Le 04/09/2023 à 12:51, Philippe Mathieu-Daudé a écrit :
Quoted 51 lines · Yuan Tan
Quoted 32 lines
Hi,
Quoted 13 lines · Philippe Mathieu-Daudé
Hi,
Quoted 10 lines · Yuan Tan
MIPS Malta's power off depends on PCI,
PCI_QUIRKS, andPOWER_RESET_PIIX4_POWEROFFto work. Enable them whenPOWER_RESETis set for convenience.Suggested-by Zhangjin Wu <[email protected]>Signed-off-by Yuan Tan <[email protected]>---
arch/mips/Kconfig| 3 +++1 file changed, 3 insertions(+)Quoted 16 lines
Quoted 6 lines
arch/mips/Kconfig +0
-0@@ -547,6 +547,9 @@ config MIPS_MALTAselect
MIPS_L1_CACHE_SHIFT_6Quoted 8 lines
select
MIPS_MSC
selectPCI_GT64XXX_PCI0
+ select PCI ifPOWER_RESET
+ selectPCI_QUIRKSifPOWER_RESET
+ selectPOWER_RESET_PIIX4_POWEROFFifPOWER_RESETselectSMP_UPif SMP
selectSWAP_IO_SPACE
selectSYS_HAS_CPU_MIPS32_R1Shouldn't we also update the
_defconfigfiles?Quoted 8 lines
Sorry, in my last email, I forgot to reply to all. So I am now resending this email.
In
malta_defconfig, PCI andPOWER_RESET_PIIX4_POWEROFFhave already been set andPCI_QUIRKSis also selected byFSL_PCI[=n].So shutdown and reboot with
malta_defconfigis working and there is no need to update themalta_defconfig🙂Since the dependency is now enforced by
Kconfig, the defconfig can be simplified:arch/mips/configs/malta_defconfig +0
-0@@ -306,3 +306,2 @@ CONFIG_SERIAL_8250_CONSOLE=yCONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_PIIX4_POWEROFF=y
CONFIG_POWER_RESET_SYSCON=yQuoted 1 line
But maybe we don't care, I don't know.
I understand from what you say that you update
malta_defconfigmanually ?Quoted 6 lines
defconfigs shouldn't be updated manually.
Once you have the new .config you should use "make savedefconfig" then replace your file by the newly generated defconfig file.
Christophe
To do so, I just unset
CONFIG_POWER_RESETand set it again in menuconfig, then "make savedefconfig". ThePOWER_RESETpart is simplified.CONFIG_POWER_RESET=y
(quoted diff) +0
-2-CONFIG_POWER_RESET_PIIX4_POWEROFF=y -CONFIG_POWER_RESET_SYSCON=y However, I found that there's other changes in this new
malta_defconfig, for example
CONFIG_NLS_KOI8_U=mCONFIG_CRYPTO_CRYPTD=m-CONFIG_CRYPTO_LRW=m(quoted diff) +0
-3-CONFIG_CRYPTO_PCBC=m -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_XCBC=m -CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_WP512=m -CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAMELLIA=m
Quoted 1 line
Should I import all these changes in a commit? Or only
POWER_RESETpart.
I'd first update the defconfigs with mainline (as a cleanup) then apply your series on top, re-running 'make savedefconfig' you should get only the changes relevant to your work.
Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta
In reply to Philippe Mathieu-DaudéHi,
Quoted 13 lines · Philippe Mathieu-Daudé
Hi,
Quoted 10 lines · Yuan Tan
MIPS Malta's power off depends on PCI,
PCI_QUIRKS, andPOWER_RESET_PIIX4_POWEROFFto work. Enable them whenPOWER_RESETis set for convenience.Suggested-by Zhangjin Wu <[email protected]>Signed-off-by Yuan Tan <[email protected]>---
arch/mips/Kconfig| 3 +++1 file changed, 3 insertions(+)
Quoted 17 lines
Quoted 6 lines
arch/mips/Kconfig +0
-0@@ -547,6 +547,9 @@ config MIPS_MALTAselect
MIPS_L1_CACHE_SHIFT_6Quoted 8 lines
select
MIPS_MSC
selectPCI_GT64XXX_PCI0
+ select PCI ifPOWER_RESET
+ selectPCI_QUIRKSifPOWER_RESET
+ selectPOWER_RESET_PIIX4_POWEROFFifPOWER_RESETselectSMP_UPif SMP
selectSWAP_IO_SPACE
selectSYS_HAS_CPU_MIPS32_R1Shouldn't we also update the
_defconfigfiles?
Sorry, in my last email, I forgot to reply to all. So I am now resending this email.
In malta_defconfig, PCI and POWER_RESET_PIIX4_POWEROFF have already been set and PCI_QUIRKS is also selected by FSL_PCI [=n].
So shutdown and reboot with malta_defconfig is working and there is no need to update the malta_defconfig 🙂
Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta
In reply to Philippe Mathieu-DaudéQuoted 50 lines · Philippe Mathieu-Daudé
Quoted 33 lines · Yuan Tan
Hi,
Quoted 13 lines · Philippe Mathieu-Daudé
Hi,
Quoted 10 lines · Yuan Tan
MIPS Malta's power off depends on PCI,
PCI_QUIRKS, andPOWER_RESET_PIIX4_POWEROFFto work. Enable them whenPOWER_RESETis set for convenience.Suggested-by Zhangjin Wu <[email protected]>Signed-off-by Yuan Tan <[email protected]>---
arch/mips/Kconfig| 3 +++1 file changed, 3 insertions(+)Quoted 17 lines
Quoted 6 lines
arch/mips/Kconfig +0
-0@@ -547,6 +547,9 @@ config MIPS_MALTAselect
MIPS_L1_CACHE_SHIFT_6Quoted 8 lines
select
MIPS_MSC
selectPCI_GT64XXX_PCI0
+ select PCI ifPOWER_RESET
+ selectPCI_QUIRKSifPOWER_RESET
+ selectPOWER_RESET_PIIX4_POWEROFFifPOWER_RESETselectSMP_UPif SMP
selectSWAP_IO_SPACE
selectSYS_HAS_CPU_MIPS32_R1Shouldn't we also update the
_defconfigfiles?Quoted 5 lines
Sorry, in my last email, I forgot to reply to all. So I am now resending this email.
In
malta_defconfig, PCI andPOWER_RESET_PIIX4_POWEROFFhave already been set andPCI_QUIRKSis also selected byFSL_PCI[=n].So shutdown and reboot with
malta_defconfigis working and there is no need to update themalta_defconfig🙂Since the dependency is now enforced by
Kconfig, the defconfig can be simplified:arch/mips/configs/malta_defconfig +0
-0@@ -306,3 +306,2 @@ CONFIG_SERIAL_8250_CONSOLE=yCONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_PIIX4_POWEROFF=y
CONFIG_POWER_RESET_SYSCON=y
Quoted 1 line
But maybe we don't care, I don't know.
After testing, I found that "savedefconfig" will automatically generate the simplified configuration.
As I have to use "savedefconfig" on the latest branch of the three architectures, in v3, I will send a separate patch for each architecture.
Thanks to your advice.