linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Kconfig: Add dependencies of POWER_RESET for x86
@ 2023-09-14 10:35 Yuan Tan
  2023-09-14 10:36 ` [PATCH v3 1/3] x86/config: Cleanup i386_defconfig and x86_64_defconfig Yuan Tan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Yuan Tan @ 2023-09-14 10:35 UTC (permalink / raw)
  To: tglx, mingo; +Cc: bp, dave.hansen, linux-kernel, x86, falcon, w, linux, tanyuan

These patches are to add dependencies of POWER_RESET for x86.

I sent v1 and v2 to the wrong x86 repository and email list. Here is v3.

As I have to use "savedefconfig" on the latest branch of different
architectures, I am sending separate patches for each architecture in v3.

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/20230831201727.3177853-1-tanyuan@tinylab.org/
v2: https://lore.kernel.org/all/cover.1693535514.git.tanyuan@tinylab.org/

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

Changes in v3:
- Enable POWER_RESET and simplify the deconfig.

Yuan Tan (3):
  x86/config: Cleanup i386_defconfig and x86_64_defconfig
  Kconfig: Add dependencies of POWER_RESET for x86
  x86/config: Simplify i386_defconfig and x86_64_defconfig

 arch/x86/Kconfig                  |  2 ++
 arch/x86/configs/i386_defconfig   | 31 ++++++++++---------------------
 arch/x86/configs/x86_64_defconfig |  9 ++-------
 3 files changed, 14 insertions(+), 28 deletions(-)


base-commit: 84b81a67e9cba5466178e47c20c0628359a242b0
-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/3] x86/config: Cleanup i386_defconfig and x86_64_defconfig
  2023-09-14 10:35 [PATCH v3 0/3] Kconfig: Add dependencies of POWER_RESET for x86 Yuan Tan
@ 2023-09-14 10:36 ` Yuan Tan
  2023-09-14 10:36 ` [PATCH v3 2/3] Kconfig: Add dependencies of POWER_RESET for x86 Yuan Tan
  2023-09-14 10:36 ` [PATCH v3 3/3] x86/config: Simplify i386_defconfig and x86_64_defconfig Yuan Tan
  2 siblings, 0 replies; 6+ messages in thread
From: Yuan Tan @ 2023-09-14 10:36 UTC (permalink / raw)
  To: tglx, mingo
  Cc: bp, dave.hansen, linux-kernel, x86, falcon, w, linux, tanyuan,
	Philippe Mathieu-Daudé,
	Christophe Leroy

Use 'make savedefconfig' to cleanup i386_defconfig and x86_64_defconfig.

Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Yuan Tan <tanyuan@tinylab.org>
---
 arch/x86/configs/i386_defconfig   | 29 +++++++++--------------------
 arch/x86/configs/x86_64_defconfig |  7 +------
 2 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 1b411bbf3cb0..babd91c8091a 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -1,7 +1,6 @@
 CONFIG_WERROR=y
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
-CONFIG_USELIB=y
 CONFIG_AUDIT=y
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
@@ -28,21 +27,20 @@ CONFIG_CGROUP_DEBUG=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_KALLSYMS_ALL=y
 CONFIG_PROFILING=y
+CONFIG_CRASH_DUMP=y
 CONFIG_SMP=y
 CONFIG_HYPERVISOR_GUEST=y
 CONFIG_PARAVIRT=y
-CONFIG_NR_CPUS=8
 CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
 CONFIG_X86_MSR=y
 CONFIG_X86_CPUID=y
+CONFIG_NUMA=y
 CONFIG_X86_CHECK_BIOS_CORRUPTION=y
 # CONFIG_MTRR_SANITIZER is not set
 CONFIG_EFI=y
 CONFIG_EFI_STUB=y
+CONFIG_EFI_MIXED=y
 CONFIG_HZ_1000=y
-CONFIG_KEXEC=y
-CONFIG_CRASH_DUMP=y
-# CONFIG_RETHUNK is not set
 CONFIG_HIBERNATION=y
 CONFIG_PM_DEBUG=y
 CONFIG_PM_TRACE_RTC=y
@@ -51,9 +49,9 @@ CONFIG_ACPI_BGRT=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_ONDEMAND=y
 CONFIG_X86_ACPI_CPUFREQ=y
+CONFIG_IA32_EMULATION=y
 CONFIG_KPROBES=y
 CONFIG_JUMP_LABEL=y
-CONFIG_COMPAT_32BIT_TIME=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
@@ -64,9 +62,7 @@ CONFIG_BINFMT_MISC=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
-CONFIG_UNIX=y
 CONFIG_XFRM_USER=y
-CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 CONFIG_IP_ADVANCED_ROUTER=y
 CONFIG_IP_MULTIPLE_TABLES=y
@@ -127,7 +123,6 @@ CONFIG_NET_9P=y
 CONFIG_NET_9P_VIRTIO=y
 CONFIG_PCI=y
 CONFIG_PCIEPORTBUS=y
-CONFIG_PCI_MSI=y
 CONFIG_HOTPLUG_PCI=y
 CONFIG_PCCARD=y
 CONFIG_YENTA=y
@@ -135,7 +130,6 @@ CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_DEBUG_DEVRES=y
 CONFIG_CONNECTOR=y
-CONFIG_EFI_CAPSULE_LOADER=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_VIRTIO_BLK=y
 CONFIG_BLK_DEV_SD=y
@@ -150,8 +144,6 @@ CONFIG_ATA_PIIX=y
 CONFIG_PATA_AMD=y
 CONFIG_PATA_OLDPIIX=y
 CONFIG_PATA_SCH=y
-CONFIG_PATA_MPIIX=y
-CONFIG_ATA_GENERIC=y
 CONFIG_MD=y
 CONFIG_BLK_DEV_MD=y
 CONFIG_BLK_DEV_DM=y
@@ -162,17 +154,14 @@ CONFIG_MAC_EMUMOUSEBTN=y
 CONFIG_NETDEVICES=y
 CONFIG_NETCONSOLE=y
 CONFIG_VIRTIO_NET=y
-CONFIG_BNX2=y
 CONFIG_TIGON3=y
 CONFIG_NET_TULIP=y
 CONFIG_E100=y
 CONFIG_E1000=y
 CONFIG_E1000E=y
 CONFIG_SKY2=y
-CONFIG_NE2K_PCI=y
 CONFIG_FORCEDETH=y
 CONFIG_8139TOO=y
-# CONFIG_8139TOO_PIO is not set
 CONFIG_R8169=y
 CONFIG_INPUT_EVDEV=y
 CONFIG_INPUT_JOYSTICK=y
@@ -191,6 +180,8 @@ CONFIG_SERIAL_8250_RSA=y
 CONFIG_SERIAL_NONSTANDARD=y
 CONFIG_VIRTIO_CONSOLE=y
 CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_INTEL is not set
+# CONFIG_HW_RANDOM_AMD is not set
 CONFIG_NVRAM=y
 CONFIG_HPET=y
 # CONFIG_HPET_MMAP is not set
@@ -237,12 +228,14 @@ CONFIG_DMADEVICES=y
 CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO_INPUT=y
 CONFIG_EEEPC_LAPTOP=y
+CONFIG_AMD_IOMMU=y
+CONFIG_INTEL_IOMMU=y
+# CONFIG_INTEL_IOMMU_DEFAULT_ON is not set
 CONFIG_EXT4_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
 CONFIG_EXT4_FS_SECURITY=y
 CONFIG_QUOTA=y
 CONFIG_QUOTA_NETLINK_INTERFACE=y
-# CONFIG_PRINT_QUOTA_WARNING is not set
 CONFIG_QFMT_V2=y
 CONFIG_AUTOFS_FS=y
 CONFIG_ISO9660_FS=y
@@ -267,10 +260,8 @@ CONFIG_SECURITY=y
 CONFIG_SECURITY_NETWORK=y
 CONFIG_SECURITY_SELINUX=y
 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
-CONFIG_SECURITY_SELINUX_DISABLE=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_KERNEL=y
-CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_WX=y
 CONFIG_DEBUG_STACK_USAGE=y
@@ -280,5 +271,3 @@ CONFIG_BLK_DEV_IO_TRACE=y
 CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
 CONFIG_EARLY_PRINTK_DBGP=y
 CONFIG_DEBUG_BOOT_PARAMS=y
-CONFIG_UNWINDER_FRAME_POINTER=y
-# CONFIG_64BIT is not set
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index 409e9182bd29..babd91c8091a 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -27,6 +27,7 @@ CONFIG_CGROUP_DEBUG=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_KALLSYMS_ALL=y
 CONFIG_PROFILING=y
+CONFIG_CRASH_DUMP=y
 CONFIG_SMP=y
 CONFIG_HYPERVISOR_GUEST=y
 CONFIG_PARAVIRT=y
@@ -40,8 +41,6 @@ CONFIG_EFI=y
 CONFIG_EFI_STUB=y
 CONFIG_EFI_MIXED=y
 CONFIG_HZ_1000=y
-CONFIG_KEXEC=y
-CONFIG_CRASH_DUMP=y
 CONFIG_HIBERNATION=y
 CONFIG_PM_DEBUG=y
 CONFIG_PM_TRACE_RTC=y
@@ -63,9 +62,7 @@ CONFIG_BINFMT_MISC=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
-CONFIG_UNIX=y
 CONFIG_XFRM_USER=y
-CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 CONFIG_IP_ADVANCED_ROUTER=y
 CONFIG_IP_MULTIPLE_TABLES=y
@@ -239,7 +236,6 @@ CONFIG_EXT4_FS_POSIX_ACL=y
 CONFIG_EXT4_FS_SECURITY=y
 CONFIG_QUOTA=y
 CONFIG_QUOTA_NETLINK_INTERFACE=y
-# CONFIG_PRINT_QUOTA_WARNING is not set
 CONFIG_QFMT_V2=y
 CONFIG_AUTOFS_FS=y
 CONFIG_ISO9660_FS=y
@@ -264,7 +260,6 @@ CONFIG_SECURITY=y
 CONFIG_SECURITY_NETWORK=y
 CONFIG_SECURITY_SELINUX=y
 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
-CONFIG_SECURITY_SELINUX_DISABLE=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_MAGIC_SYSRQ=y
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 2/3] Kconfig: Add dependencies of POWER_RESET for x86
  2023-09-14 10:35 [PATCH v3 0/3] Kconfig: Add dependencies of POWER_RESET for x86 Yuan Tan
  2023-09-14 10:36 ` [PATCH v3 1/3] x86/config: Cleanup i386_defconfig and x86_64_defconfig Yuan Tan
@ 2023-09-14 10:36 ` Yuan Tan
  2023-09-14 16:09   ` Dave Hansen
  2023-09-14 10:36 ` [PATCH v3 3/3] x86/config: Simplify i386_defconfig and x86_64_defconfig Yuan Tan
  2 siblings, 1 reply; 6+ messages in thread
From: Yuan Tan @ 2023-09-14 10:36 UTC (permalink / raw)
  To: tglx, mingo; +Cc: bp, dave.hansen, linux-kernel, x86, falcon, w, linux, tanyuan

x86 and x86_64's power off depends on ACPI and PCI to work. Enable them
when POWER_RESET is set for convenience.

Suggested-by: Zhangjin Wu <falcon@tinylab.org>
Signed-off-by: Yuan Tan <tanyuan@tinylab.org>
---
 arch/x86/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3b3594f96330..9571507ad40f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 3/3] x86/config: Simplify i386_defconfig and x86_64_defconfig
  2023-09-14 10:35 [PATCH v3 0/3] Kconfig: Add dependencies of POWER_RESET for x86 Yuan Tan
  2023-09-14 10:36 ` [PATCH v3 1/3] x86/config: Cleanup i386_defconfig and x86_64_defconfig Yuan Tan
  2023-09-14 10:36 ` [PATCH v3 2/3] Kconfig: Add dependencies of POWER_RESET for x86 Yuan Tan
@ 2023-09-14 10:36 ` Yuan Tan
  2 siblings, 0 replies; 6+ messages in thread
From: Yuan Tan @ 2023-09-14 10:36 UTC (permalink / raw)
  To: tglx, mingo
  Cc: bp, dave.hansen, linux-kernel, x86, falcon, w, linux, tanyuan,
	Philippe Mathieu-Daudé,
	Christophe Leroy

Simplify i386_defconfig and x86_64_defconfig with POWER_RESET dependences.

Regenerate i386_defconfig and x86_64_defconfig with 'make savedefconfig'.

Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Yuan Tan <tanyuan@tinylab.org>
---
 arch/x86/configs/i386_defconfig   | 2 +-
 arch/x86/configs/x86_64_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index babd91c8091a..470ce962eb58 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -121,7 +121,6 @@ CONFIG_MAC80211_LEDS=y
 CONFIG_RFKILL=y
 CONFIG_NET_9P=y
 CONFIG_NET_9P_VIRTIO=y
-CONFIG_PCI=y
 CONFIG_PCIEPORTBUS=y
 CONFIG_HOTPLUG_PCI=y
 CONFIG_PCCARD=y
@@ -186,6 +185,7 @@ CONFIG_NVRAM=y
 CONFIG_HPET=y
 # CONFIG_HPET_MMAP is not set
 CONFIG_I2C_I801=y
+CONFIG_POWER_RESET=y
 CONFIG_WATCHDOG=y
 CONFIG_AGP=y
 CONFIG_AGP_AMD64=y
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index babd91c8091a..470ce962eb58 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -121,7 +121,6 @@ CONFIG_MAC80211_LEDS=y
 CONFIG_RFKILL=y
 CONFIG_NET_9P=y
 CONFIG_NET_9P_VIRTIO=y
-CONFIG_PCI=y
 CONFIG_PCIEPORTBUS=y
 CONFIG_HOTPLUG_PCI=y
 CONFIG_PCCARD=y
@@ -186,6 +185,7 @@ CONFIG_NVRAM=y
 CONFIG_HPET=y
 # CONFIG_HPET_MMAP is not set
 CONFIG_I2C_I801=y
+CONFIG_POWER_RESET=y
 CONFIG_WATCHDOG=y
 CONFIG_AGP=y
 CONFIG_AGP_AMD64=y
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 2/3] Kconfig: Add dependencies of POWER_RESET for x86
  2023-09-14 10:36 ` [PATCH v3 2/3] Kconfig: Add dependencies of POWER_RESET for x86 Yuan Tan
@ 2023-09-14 16:09   ` Dave Hansen
  2023-09-15  1:22     ` Yuan Tan
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Hansen @ 2023-09-14 16:09 UTC (permalink / raw)
  To: Yuan Tan, tglx, mingo
  Cc: bp, dave.hansen, linux-kernel, x86, falcon, w, linux

On 9/14/23 03:36, Yuan Tan wrote:
> x86 and x86_64's power off depends on ACPI and PCI to work. Enable them
> when POWER_RESET is set for convenience.

I'm a bit confused by this.

Which code is this referring to, exactly?  Are you saying that no x86
system can power off or reset unless it supports ACPI or PCI?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 2/3] Kconfig: Add dependencies of POWER_RESET for x86
  2023-09-14 16:09   ` Dave Hansen
@ 2023-09-15  1:22     ` Yuan Tan
  0 siblings, 0 replies; 6+ messages in thread
From: Yuan Tan @ 2023-09-15  1:22 UTC (permalink / raw)
  To: Dave Hansen, tglx, mingo
  Cc: bp, dave.hansen, linux-kernel, x86, falcon, w, linux


On 9/15/2023 12:09 AM, Dave Hansen wrote:
> On 9/14/23 03:36, Yuan Tan wrote:
>> x86 and x86_64's power off depends on ACPI and PCI to work. Enable them
>> when POWER_RESET is set for convenience.
> I'm a bit confused by this.
>
> Which code is this referring to, exactly?  Are you saying that no x86
> system can power off or reset unless it supports ACPI or PCI?

Yes, after testing on qemu-system-x86_64 and qemu-system-i386, I found 
that x86 can only power off when it enable ACPI and PCI.

I wanted to test nolibc based on tinyconfig and found it hard to find 
the dependence to enable poweroff.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-15  1:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-14 10:35 [PATCH v3 0/3] Kconfig: Add dependencies of POWER_RESET for x86 Yuan Tan
2023-09-14 10:36 ` [PATCH v3 1/3] x86/config: Cleanup i386_defconfig and x86_64_defconfig Yuan Tan
2023-09-14 10:36 ` [PATCH v3 2/3] Kconfig: Add dependencies of POWER_RESET for x86 Yuan Tan
2023-09-14 16:09   ` Dave Hansen
2023-09-15  1:22     ` Yuan Tan
2023-09-14 10:36 ` [PATCH v3 3/3] x86/config: Simplify i386_defconfig and x86_64_defconfig Yuan Tan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).