2023-09-16 12:08:24

by Yuan Tan

[permalink] [raw]
Subject: [PATCH v4 0/2] Kconfig: Add dependencies of POWER_RESET for MIPS Malta

These patches are to add dependencies of POWER_RESET for MIPS Malta.

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[1] there after a 'poweroff' command,
which is a very bad experience for the automatical tests.

However, CONFIG_POWER_RESET is ineffective if there are no
dependencies that enable certain devices in Kconfig.

Currently, based on tinyconfig, it is very hard to find the exact
poweroff related option[2]. 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.
Additionally, 'make savedefconfig' simplifies the defconfig
automatically.

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.

We hope every device's CONFIG_POWER_RESET will have proper dependencies. :)

---
[1]: https://lore.kernel.org/lkml/511b2f6009fb830b3f32b4be3dca99596c684fa3.1689759351.git.falcon@tinylab.org/
[2]: https://lore.kernel.org/all/983843582e52e83fba79ad45cea6c79e1f62ec6c.1690489039.git.falcon@tinylab.org/

v1: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v3: https://lore.kernel.org/all/[email protected]/

---
Changes in v2:
- Fix the mistake of using spaces instead of tabs in kconfig.

Changes in v3:
- Enable POWER_RESET and simplify the deconfig.
- Select ADB_CUDA in PPC_PMAC32 only.

Changes in v4:
- Squash last two commits.

Yuan Tan (2):
MIPS: Cleanup malta_defconfig
Kconfig: add dependencies of POWER_RESET for mips malta

arch/mips/Kconfig | 3 +++
arch/mips/configs/malta_defconfig | 39 ++++++-------------------------
2 files changed, 10 insertions(+), 32 deletions(-)


base-commit: e7513eccb7d7f82e28f4730210b42da71edaa6a6
--
2.34.1


2023-09-16 12:08:52

by Yuan Tan

[permalink] [raw]
Subject: [PATCH v4 1/2] MIPS: Cleanup malta_defconfig

Use 'make savedefconfig' to cleanup malta_defconfig.

Suggested-by: Philippe Mathieu-Daudé <[email protected]>
Suggested-by: Christophe Leroy <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Yuan Tan <[email protected]>
---
arch/mips/configs/malta_defconfig | 39 +++++++------------------------
1 file changed, 8 insertions(+), 31 deletions(-)

diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index ae1a7793e810..7ae07d57b79a 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -6,18 +6,17 @@ CONFIG_NAMESPACES=y
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EXPERT=y
-# CONFIG_COMPAT_BRK is not set
CONFIG_MIPS_MALTA=y
CONFIG_CPU_LITTLE_ENDIAN=y
CONFIG_CPU_MIPS32_R2=y
CONFIG_PAGE_SIZE_16KB=y
CONFIG_NR_CPUS=8
CONFIG_HZ_100=y
-CONFIG_PCI=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
+# CONFIG_COMPAT_BRK is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
@@ -133,19 +132,6 @@ CONFIG_IP_NF_RAW=m
CONFIG_IP_NF_ARPTABLES=m
CONFIG_IP_NF_ARPFILTER=m
CONFIG_IP_NF_ARP_MANGLE=m
-CONFIG_IP6_NF_MATCH_AH=m
-CONFIG_IP6_NF_MATCH_EUI64=m
-CONFIG_IP6_NF_MATCH_FRAG=m
-CONFIG_IP6_NF_MATCH_OPTS=m
-CONFIG_IP6_NF_MATCH_HL=m
-CONFIG_IP6_NF_MATCH_IPV6HEADER=m
-CONFIG_IP6_NF_MATCH_MH=m
-CONFIG_IP6_NF_MATCH_RT=m
-CONFIG_IP6_NF_TARGET_HL=m
-CONFIG_IP6_NF_FILTER=m
-CONFIG_IP6_NF_TARGET_REJECT=m
-CONFIG_IP6_NF_MANGLE=m
-CONFIG_IP6_NF_RAW=m
CONFIG_BRIDGE_NF_EBTABLES=m
CONFIG_BRIDGE_EBT_BROUTE=m
CONFIG_BRIDGE_EBT_T_FILTER=m
@@ -177,7 +163,6 @@ CONFIG_IPDDP=m
CONFIG_IPDDP_ENCAP=y
CONFIG_PHONET=m
CONFIG_NET_SCHED=y
-CONFIG_NET_SCH_CBQ=m
CONFIG_NET_SCH_HTB=m
CONFIG_NET_SCH_HFSC=m
CONFIG_NET_SCH_PRIO=m
@@ -186,16 +171,12 @@ CONFIG_NET_SCH_SFQ=m
CONFIG_NET_SCH_TEQL=m
CONFIG_NET_SCH_TBF=m
CONFIG_NET_SCH_GRED=m
-CONFIG_NET_SCH_DSMARK=m
CONFIG_NET_SCH_NETEM=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_CLS_BASIC=m
-CONFIG_NET_CLS_TCINDEX=m
CONFIG_NET_CLS_ROUTE4=m
CONFIG_NET_CLS_FW=m
CONFIG_NET_CLS_U32=m
-CONFIG_NET_CLS_RSVP=m
-CONFIG_NET_CLS_RSVP6=m
CONFIG_NET_CLS_FLOW=m
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_POLICE=y
@@ -211,6 +192,7 @@ CONFIG_CFG80211=m
CONFIG_MAC80211=m
CONFIG_MAC80211_MESH=y
CONFIG_RFKILL=m
+CONFIG_PCI=y
CONFIG_DEVTMPFS=y
CONFIG_CONNECTOR=m
CONFIG_MTD=y
@@ -220,7 +202,6 @@ CONFIG_MTD_CFI=y
CONFIG_MTD_CFI_INTELEXT=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_STAA=y
-CONFIG_MTD_PHYSMAP_OF=y
CONFIG_MTD_UBI=m
CONFIG_MTD_UBI_GLUEBI=m
CONFIG_BLK_DEV_FD=m
@@ -396,20 +377,16 @@ CONFIG_NLS_ISO8859_15=m
CONFIG_NLS_KOI8_R=m
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
CONFIG_CRYPTO_CAST5=m
CONFIG_CRYPTO_CAST6=m
CONFIG_CRYPTO_FCRYPT=m
-CONFIG_CRYPTO_KHAZAD=m
CONFIG_CRYPTO_SERPENT=m
-CONFIG_CRYPTO_TEA=m
CONFIG_CRYPTO_TWOFISH=m
+CONFIG_CRYPTO_LRW=m
+CONFIG_CRYPTO_PCBC=m
+CONFIG_CRYPTO_HMAC=y
+CONFIG_CRYPTO_MD4=m
+CONFIG_CRYPTO_WP512=m
+CONFIG_CRYPTO_XCBC=m
--
2.34.1

2023-09-16 12:08:55

by Yuan Tan

[permalink] [raw]
Subject: [PATCH v4 2/2] 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.
Then regenerate malta_defconfig with 'make savedefconfig'.

Suggested-by: Philippe Mathieu-Daudé <[email protected]>
Suggested-by: Christophe Leroy <[email protected]>
Suggested-by: Zhangjin Wu <[email protected]>
Signed-off-by: Yuan Tan <[email protected]>
---
arch/mips/Kconfig | 3 +++
arch/mips/configs/malta_defconfig | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index fc6fba925aea..b63a93e39f23 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -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
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index 7ae07d57b79a..99049e993192 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -192,7 +192,6 @@ CONFIG_CFG80211=m
CONFIG_MAC80211=m
CONFIG_MAC80211_MESH=y
CONFIG_RFKILL=m
-CONFIG_PCI=y
CONFIG_DEVTMPFS=y
CONFIG_CONNECTOR=m
CONFIG_MTD=y
@@ -284,7 +283,6 @@ CONFIG_MOUSE_PS2_ELANTECH=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_PIIX4_POWEROFF=y
CONFIG_POWER_RESET_SYSCON=y
# CONFIG_HWMON is not set
CONFIG_FB=y
--
2.34.1

2023-09-17 15:42:54

by Philippe Mathieu-Daudé

[permalink] [raw]
Subject: Re: [PATCH v4 2/2] Kconfig: add dependencies of POWER_RESET for mips malta

On 16/9/23 14:07, Yuan Tan wrote:
> 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.
> Then regenerate malta_defconfig with 'make savedefconfig'.
>
> Suggested-by: Philippe Mathieu-Daudé <[email protected]>

I haven't suggested that, just reviewed your patches, so:
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>

> Suggested-by: Christophe Leroy <[email protected]>

(I don't remember Christophe suggesting this either)

> Suggested-by: Zhangjin Wu <[email protected]>
> Signed-off-by: Yuan Tan <[email protected]>
> ---
> arch/mips/Kconfig | 3 +++
> arch/mips/configs/malta_defconfig | 2 --
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index fc6fba925aea..b63a93e39f23 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -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
> diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
> index 7ae07d57b79a..99049e993192 100644
> --- a/arch/mips/configs/malta_defconfig
> +++ b/arch/mips/configs/malta_defconfig
> @@ -192,7 +192,6 @@ CONFIG_CFG80211=m
> CONFIG_MAC80211=m
> CONFIG_MAC80211_MESH=y
> CONFIG_RFKILL=m
> -CONFIG_PCI=y
> CONFIG_DEVTMPFS=y
> CONFIG_CONNECTOR=m
> CONFIG_MTD=y
> @@ -284,7 +283,6 @@ CONFIG_MOUSE_PS2_ELANTECH=y
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_POWER_RESET=y
> -CONFIG_POWER_RESET_PIIX4_POWEROFF=y
> CONFIG_POWER_RESET_SYSCON=y
> # CONFIG_HWMON is not set
> CONFIG_FB=y