[v3,2/3] Kconfig: Add dependencies of POWER_RESET for x86

Message ID 0f2cbd3026357a3936c0853057ed41b63db83d59.1694687048.git.tanyuan@tinylab.org
State New
Headers
Series Kconfig: Add dependencies of POWER_RESET for x86 |

Commit Message

Yuan Tan Sept. 14, 2023, 10:36 a.m. UTC
  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(+)
  

Comments

Dave Hansen Sept. 14, 2023, 4:09 p.m. UTC | #1
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?
  
Yuan Tan Sept. 15, 2023, 1:22 a.m. UTC | #2
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.
  

Patch

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