Re: [PATCH v3 1/3] powerpc/config: Cleanup pmac32_defconfig

2023-09-14 Thread Yuan Tan

Hi Michael

On 9/14/2023 9:10 PM, Michael Ellerman wrote:

Yuan Tan  writes:

Use 'make savedefconfig' to cleanup pmac32_defconfig, based on Linux
7.6-rc1

Thanks but I don't like doing these updates in a single commit like
this, it's easy to accidentally lose a symbol.

Yeah I have the same concerns too.


I prefer an explanation for what's changing for each symbol. See
1ce7fda142af ("powerpc/configs/64s: Drop IPV6 which is default y") and
the commits leading up to it, to see what I mean.

But I suspect you probably don't want to go to all that effort, which is
fine :)


I am not familiar with other options, so I'd better not do that. :)

By the way, just to be cautious, since the defconfig can only be updated 
by 'savedefconfig'[1], how can we write an explanation for a single 
change in an option?


I mean, when I change one option, the value of the other undetermined 
option will be set just like in patch 1.


[1]: 
https://lore.kernel.org/all/54da2376-dc65-0a96-55df-7a5acfbb9...@csgroup.eu/


So I won't take patch 1, but patch 2 and 3 look fine. No need to resend,
I'll deal with any merge fixup needed.

cheers

Thank you :)


[PATCH v3 3/3] powerpc/config: Simplify pmac32_defconfig

2023-09-14 Thread Yuan Tan
Simplify pmac32_defconfig with POWER_RESET dependences.

Regenerate pmac32_defconfig with 'make savedefconfig'.

Suggested-by: Philippe Mathieu-Daudé 
Suggested-by: Christophe Leroy 
Signed-off-by: Yuan Tan 
---
 arch/powerpc/configs/pmac32_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/configs/pmac32_defconfig 
b/arch/powerpc/configs/pmac32_defconfig
index 11d489c2c3e0..17df965be099 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -138,7 +138,6 @@ CONFIG_DM_SNAPSHOT=m
 CONFIG_DM_MIRROR=m
 CONFIG_DM_ZERO=m
 CONFIG_ADB=y
-CONFIG_ADB_CUDA=y
 CONFIG_ADB_PMU=y
 CONFIG_ADB_PMU_LED=y
 CONFIG_ADB_PMU_LED_DISK=y
@@ -180,6 +179,7 @@ CONFIG_SERIAL_PMACZILOG=y
 CONFIG_SERIAL_PMACZILOG_TTYS=y
 CONFIG_SERIAL_PMACZILOG_CONSOLE=y
 CONFIG_I2C_CHARDEV=m
+CONFIG_POWER_RESET=y
 CONFIG_APM_POWER=y
 CONFIG_BATTERY_PMU=y
 CONFIG_HWMON=m
-- 
2.34.1



[PATCH v3 2/3] Kconfig: Add dependencies of POWER_RESET for pmac32

2023-09-14 Thread Yuan Tan
pmac32's power off depends on ADB_CUDA to work. Enable it when
POWER_RESET is set for convenience.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
 arch/powerpc/platforms/powermac/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/powermac/Kconfig 
b/arch/powerpc/platforms/powermac/Kconfig
index 130707ec9f99..8bdae0caf21e 100644
--- a/arch/powerpc/platforms/powermac/Kconfig
+++ b/arch/powerpc/platforms/powermac/Kconfig
@@ -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 && PPC32
select MPIC
select FORCE_PCI
select PPC_INDIRECT_PCI if PPC32
-- 
2.34.1




[PATCH v3 1/3] powerpc/config: Cleanup pmac32_defconfig

2023-09-14 Thread Yuan Tan
Use 'make savedefconfig' to cleanup pmac32_defconfig, based on Linux
7.6-rc1

Suggested-by: Philippe Mathieu-Daudé 
Suggested-by: Christophe Leroy 
Signed-off-by: Yuan Tan 
---
 arch/powerpc/configs/pmac32_defconfig | 44 ---
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/configs/pmac32_defconfig 
b/arch/powerpc/configs/pmac32_defconfig
index a205da9ee5f2..11d489c2c3e0 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -1,4 +1,3 @@
-CONFIG_ALTIVEC=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
@@ -8,12 +7,8 @@ CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_BLK_DEV_INITRD=y
-# CONFIG_COMPAT_BRK is not set
 CONFIG_PROFILING=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_PARTITION_ADVANCED=y
+CONFIG_ALTIVEC=y
 # CONFIG_PPC_CHRP is not set
 CONFIG_CPU_FREQ=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
@@ -21,12 +16,15 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_PMAC=y
 CONFIG_GEN_RTC=y
 CONFIG_HIGHMEM=y
-CONFIG_BINFMT_MISC=m
 CONFIG_HIBERNATION=y
 CONFIG_PM_DEBUG=y
 CONFIG_APM_EMULATION=y
-CONFIG_PCCARD=m
-CONFIG_YENTA=m
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_PARTITION_ADVANCED=y
+CONFIG_BINFMT_MISC=m
+# CONFIG_COMPAT_BRK is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -100,6 +98,8 @@ CONFIG_BT_HCIBFUSB=m
 CONFIG_CFG80211=m
 CONFIG_MAC80211=m
 CONFIG_MAC80211_LEDS=y
+CONFIG_PCCARD=m
+CONFIG_YENTA=m
 # CONFIG_STANDALONE is not set
 CONFIG_CONNECTOR=y
 CONFIG_MAC_FLOPPY=m
@@ -179,7 +179,6 @@ CONFIG_SERIAL_8250=m
 CONFIG_SERIAL_PMACZILOG=y
 CONFIG_SERIAL_PMACZILOG_TTYS=y
 CONFIG_SERIAL_PMACZILOG_CONSOLE=y
-CONFIG_NVRAM=y
 CONFIG_I2C_CHARDEV=m
 CONFIG_APM_POWER=y
 CONFIG_BATTERY_PMU=y
@@ -189,7 +188,6 @@ CONFIG_AGP_UNINORTH=m
 CONFIG_DRM=m
 CONFIG_DRM_RADEON=m
 CONFIG_DRM_LEGACY=y
-CONFIG_DRM_R128=m
 CONFIG_FB=y
 CONFIG_FB_OF=y
 CONFIG_FB_CONTROL=y
@@ -275,23 +273,19 @@ CONFIG_NFSD_V3_ACL=y
 CONFIG_NFSD_V4=y
 CONFIG_NLS_CODEPAGE_437=m
 CONFIG_NLS_ISO8859_1=m
-CONFIG_CRC_T10DIF=y
-CONFIG_MAGIC_SYSRQ=y
-CONFIG_DEBUG_KERNEL=y
-CONFIG_DETECT_HUNG_TASK=y
-CONFIG_XMON=y
-CONFIG_XMON_DEFAULT=y
-CONFIG_BOOTX_TEXT=y
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_ANUBIS=m
 CONFIG_CRYPTO_BLOWFISH=m
 CONFIG_CRYPTO_CAST5=m
 CONFIG_CRYPTO_CAST6=m
-CONFIG_CRYPTO_KHAZAD=m
 CONFIG_CRYPTO_SERPENT=m
-CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_TWOFISH=m
+CONFIG_CRYPTO_PCBC=m
+CONFIG_CRYPTO_MD4=m
+CONFIG_CRYPTO_WP512=m
 CONFIG_CRYPTO_DEFLATE=m
+CONFIG_CRC_T10DIF=y
+CONFIG_DEBUG_KERNEL=y
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_DETECT_HUNG_TASK=y
+CONFIG_XMON=y
+CONFIG_XMON_DEFAULT=y
+CONFIG_BOOTX_TEXT=y
-- 
2.34.1



[PATCH v3 0/3] Kconfig: Add dependencies of POWER_RESET for pmac32

2023-09-14 Thread Yuan Tan
These patches are to add dependencies of POWER_RESET for pmac32.

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.fal...@tinylab.org/
[2]: 
https://lore.kernel.org/all/983843582e52e83fba79ad45cea6c79e1f62ec6c.1690489039.git.fal...@tinylab.org/

v1: https://lore.kernel.org/all/20230831201727.3177853-1-tany...@tinylab.org/
v2: https://lore.kernel.org/all/cover.1693535514.git.tany...@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.
- Select ADB_CUDA in PPC_PMAC32 only.

Yuan Tan (3):
  powerpc/config: Cleanup pmac32_defconfig
  Kconfig: Add dependencies of POWER_RESET for pmac32
  powerpc/config: Simplify pmac32_defconfig

 arch/powerpc/configs/pmac32_defconfig   | 46 +++--
 arch/powerpc/platforms/powermac/Kconfig |  1 +
 2 files changed, 21 insertions(+), 26 deletions(-)


base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
-- 
2.34.1



Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta

2023-09-14 Thread Yuan Tan



On 9/4/2023 6:51 PM, Philippe Mathieu-Daudé wrote:

On 4/9/23 11:24, Yuan Tan wrote:

Hi,

On 9/4/2023 3:40 PM, Philippe Mathieu-Daudé wrote:

Hi,

On 1/9/23 04:42, 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.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
  arch/mips/Kconfig | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bc8421859006..13bacbd05125 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


Shouldn't we also update the _defconfig files?

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 


Since the dependency is now enforced by Kconfig, the defconfig can
be simplified:

--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -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.
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.




Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta

2023-09-05 Thread Yuan Tan

Hi,

On 9/4/2023 3:40 PM, Philippe Mathieu-Daudé wrote:

Hi,

On 1/9/23 04:42, 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.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
  arch/mips/Kconfig | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bc8421859006..13bacbd05125 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


Shouldn't we also update the _defconfig files?

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

2023-09-04 Thread Yuan Tan



On 9/4/2023 6:58 PM, Christophe Leroy wrote:


Le 04/09/2023 à 12:51, Philippe Mathieu-Daudé a écrit :

On 4/9/23 11:24, Yuan Tan wrote:

Hi,

On 9/4/2023 3:40 PM, Philippe Mathieu-Daudé wrote:

Hi,

On 1/9/23 04:42, 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.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
   arch/mips/Kconfig | 3 +++
   1 file changed, 3 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bc8421859006..13bacbd05125 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

Shouldn't we also update the _defconfig files?


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 

Since the dependency is now enforced by Kconfig, the defconfig can
be simplified:

--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -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.

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


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 3/3] kconfig: add dependencies of POWER_RESET for PowerMac

2023-09-01 Thread Yuan Tan

Hi,

On 9/1/2023 2:10 PM, Christophe Leroy wrote:


Le 01/09/2023 à 04:43, Yuan Tan a écrit :

PowerMac's power off depends on ADB_CUDA to work. Enable it when
POWER_RESET is set for convenience.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
   arch/powerpc/platforms/powermac/Kconfig | 1 +
   1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/powermac/Kconfig 
b/arch/powerpc/platforms/powermac/Kconfig
index 130707ec9f99..9e633d7e8367 100644
--- a/arch/powerpc/platforms/powermac/Kconfig
+++ b/arch/powerpc/platforms/powermac/Kconfig
@@ -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 ?


select 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 :)




[PATCH v2 3/3] kconfig: add dependencies of POWER_RESET for PowerMac

2023-08-31 Thread Yuan Tan
PowerMac's power off depends on ADB_CUDA to work. Enable it when
POWER_RESET is set for convenience.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
 arch/powerpc/platforms/powermac/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/powermac/Kconfig 
b/arch/powerpc/platforms/powermac/Kconfig
index 130707ec9f99..9e633d7e8367 100644
--- a/arch/powerpc/platforms/powermac/Kconfig
+++ b/arch/powerpc/platforms/powermac/Kconfig
@@ -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
-- 
2.34.1




[PATCH v2 2/3] kconfig: add dependencies of POWER_RESET for x86

2023-08-31 Thread Yuan Tan
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 
Signed-off-by: Yuan Tan 
---
 arch/x86/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 982b777eadc7..5c1632e40bf2 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_LOOKUPif 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



[PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta

2023-08-31 Thread Yuan Tan
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.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
 arch/mips/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bc8421859006..13bacbd05125 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
-- 
2.34.1



[PATCH v2 0/3] Add dependencies of POWER_RESET for MIPS Malta, x86, and PowerMac

2023-08-31 Thread Yuan Tan
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/20230831201727.3177853-1-tany...@tinylab.org/
[2]: 
https://lore.kernel.org/lkml/511b2f6009fb830b3f32b4be3dca99596c684fa3.1689759351.git.fal...@tinylab.org/
[3]: 
https://lore.kernel.org/all/983843582e52e83fba79ad45cea6c79e1f62ec6c.1690489039.git.fal...@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(+)

-- 
2.34.1



[PATCH v1 0/3] Add dependencies of POWER_RESET for MIPS Malta, x86, and PowerMac.

2023-08-31 Thread Yuan Tan
These patches is to add dependencies of POWER_RESET for MIPS Malta, x86,
and PowerMac.

To simplify the enablement of the poweroff support, selecting the
required options for CONFIG_POWER_RESET=y may make many people
happyespecially when they are using a customized config (maybe
tinyconfigbased) 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.

Currently, based on tinyconfig, it is very hard to find the exact
poweroff options[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.

Zhangjin and I invested a significant amount of time in searching for
the current options on these devices. We hope that this set of
patcheswill 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/511b2f6009fb830b3f32b4be3dca99596c684fa3.1689759351.git.fal...@tinylab.org/
[2]: 
https://lore.kernel.org/all/983843582e52e83fba79ad45cea6c79e1f62ec6c.1690489039.git.fal...@tinylab.org/


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(+)

-- 
2.34.1



[PATCH v1 1/3] kconfig: add dependencies of POWER_RESET for mips malta

2023-08-31 Thread Yuan Tan
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.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
 arch/mips/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bc8421859006..1d93f3fd0552 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
-- 
2.34.1



[PATCH v1 2/3] kconfig: add dependencies of POWER_RESET for x86

2023-08-31 Thread Yuan Tan
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 
Signed-off-by: Yuan Tan 
---
 arch/x86/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 982b777eadc7..5c1632e40bf2 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_LOOKUPif 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



[PATCH v1 3/3] kconfig: add dependencies of POWER_RESET for PowerMac

2023-08-31 Thread Yuan Tan
PowerMac's power off depends on ADB_CUDA to work. Enable it when
POWER_RESET is set for convenience.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
 arch/powerpc/platforms/powermac/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/powermac/Kconfig 
b/arch/powerpc/platforms/powermac/Kconfig
index 130707ec9f99..9e633d7e8367 100644
--- a/arch/powerpc/platforms/powermac/Kconfig
+++ b/arch/powerpc/platforms/powermac/Kconfig
@@ -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
-- 
2.34.1




Re: [PATCH] powerpc: pmac32: enable serial options by default in defconfig

2023-08-02 Thread Yuan Tan

Hi Christophe

On 8/2/2023 9:58 PM, Christophe Leroy wrote:


Le 02/08/2023 à 15:41, Yuan Tan a écrit :

[Vous ne recevez pas souvent de courriers de tany...@tinylab.org. Découvrez 
pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]

Serial is a critical feature for logging and debuging, and the other
architectures enable serial by default.

Let's enable CONFIG_SERIAL_PMACZILOG and CONFIG_SERIAL_PMACZILOG_CONSOLE
by default.

Signed-off-by: Yuan Tan 

Reviewed-by: Christophe Leroy 


Can this patch be merged into v6.6? There's another patch depends on it :)

Best regards,

Yuan Tan


---
   arch/powerpc/configs/pmac32_defconfig | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/configs/pmac32_defconfig 
b/arch/powerpc/configs/pmac32_defconfig
index 019163c2571e..3aae79afb9d9 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -176,8 +176,9 @@ CONFIG_MOUSE_APPLETOUCH=y
   # CONFIG_SERIO_I8042 is not set
   # CONFIG_SERIO_SERPORT is not set
   CONFIG_SERIAL_8250=m
-CONFIG_SERIAL_PMACZILOG=m
+CONFIG_SERIAL_PMACZILOG=y
   CONFIG_SERIAL_PMACZILOG_TTYS=y
+CONFIG_SERIAL_PMACZILOG_CONSOLE=y
   CONFIG_NVRAM=y
   CONFIG_I2C_CHARDEV=m
   CONFIG_APM_POWER=y
--
2.34.1



[PATCH] powerpc: pmac32: enable serial options by default in defconfig

2023-08-02 Thread Yuan Tan
Serial is a critical feature for logging and debuging, and the other
architectures enable serial by default.

Let's enable CONFIG_SERIAL_PMACZILOG and CONFIG_SERIAL_PMACZILOG_CONSOLE
by default.

Signed-off-by: Yuan Tan 
---
 arch/powerpc/configs/pmac32_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/configs/pmac32_defconfig 
b/arch/powerpc/configs/pmac32_defconfig
index 019163c2571e..3aae79afb9d9 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -176,8 +176,9 @@ CONFIG_MOUSE_APPLETOUCH=y
 # CONFIG_SERIO_I8042 is not set
 # CONFIG_SERIO_SERPORT is not set
 CONFIG_SERIAL_8250=m
-CONFIG_SERIAL_PMACZILOG=m
+CONFIG_SERIAL_PMACZILOG=y
 CONFIG_SERIAL_PMACZILOG_TTYS=y
+CONFIG_SERIAL_PMACZILOG_CONSOLE=y
 CONFIG_NVRAM=y
 CONFIG_I2C_CHARDEV=m
 CONFIG_APM_POWER=y
-- 
2.34.1