Skip to contentSkip to conversation

x86/platform: Increase maximum GPIO number for X86_64

PATCH Superseded Andy Shevchenko 3 participants 7 messages Aug 6, 2021 – Aug 16, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/platform: Increase maximum GPIO number for X86_64

By default the 512 GPIOs is a maximum on any x86 platform. With, for example, Intel Tiger Lake-H the SoC based controller occupies up to 480 pins. This leaves only 32 available for GPIO expanders or other drivers, like PMIC. Hence, bump the maximum GPIO number to 1024 for X86_64 and leave 512 for X86_32.

---
 arch/x86/Kconfig | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/Kconfig +13 -0
index 45962aaf2b2c..495ed6229b52 100644
@@ -340,6 +340,19 @@ config NEED_PER_CPU_PAGE_FIRST_CHUNK
 config ARCH_HIBERNATION_POSSIBLE
 	def_bool y
 
+# The GPIO number here must be sorted by descending number. In case of
+# a multiplatform kernel, we just want the highest value required by the
+# selected platforms.
+config ARCH_NR_GPIO
+	int
+	default 1024 if X86_64
+	default 512 if X86_32
+	default 0
+	help
+	  Maximum number of GPIOs in the system.
+
+	  If unsure, leave the default value.
+
 config ARCH_SUSPEND_POSSIBLE
 	def_bool y
 
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Andy Shevchenko

By default the 512 GPIOs is a maximum on any x86 platform. With, for example, Intel Tiger Lake-H the SoC based controller occupies up to 480 pins. This leaves only 32 available for GPIO expanders or other drivers, like PMIC. Hence, bump the maximum GPIO number to 1024 for X86_64 and leave 512 for X86_32.

Looks reasonable to me.
The goal with the whole descriptor refactoring is to get this completely dynamic but it turns out to take forever. It is as it is.

Yours,
Linus Walleij

#2 lore raw
Quoted 9 lines · Linus Walleij
Quoted 6 lines · Andy Shevchenko

By default the 512 GPIOs is a maximum on any x86 platform. With, for example, Intel Tiger Lake-H the SoC based controller occupies up to 480 pins. This leaves only 32 available for GPIO expanders or other drivers, like PMIC. Hence, bump the maximum GPIO number to 1024 for X86_64 and leave 512 for X86_32.

Quoted 8 lines
Quoted 1 line

Looks reasonable to me.
The goal with the whole descriptor refactoring is to get this completely dynamic but it turns out to take forever. It is as it is.

Thanks!

Rafael, can you please review this?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
In reply to Andy Shevchenko
Quoted 18 lines · Andy Shevchenko

By default the 512 GPIOs is a maximum on any x86 platform. With, for example, Intel Tiger Lake-H the SoC based controller occupies up to 480 pins. This leaves only 32 available for GPIO expanders or other drivers, like PMIC. Hence, bump the maximum GPIO number to 1024 for X86_64 and leave 512 for X86_32.

---
 arch/x86/Kconfig | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/Kconfig +0 -0
index 45962aaf2b2c..495ed6229b52 100644
@@ -340,6 +340,19 @@ config NEED_PER_CPU_PAGE_FIRST_CHUNK
 config ARCH_HIBERNATION_POSSIBLE

arch/x86/Kconfig config NEED_PER_CPU_PAGE_FIRST_CHUNK · line 350

Quoted 10 lines
arch/x86/Kconfig +8 -0
        def_bool y
 
+# The GPIO number here must be sorted by descending number. In case of
+# a multiplatform kernel, we just want the highest value required by the
+# selected platforms.
+config ARCH_NR_GPIO
+       int
+       default 1024 if X86_64
+       default 512 if X86_32
+       default 0

Wouldn't

default 1024 if X86_64
default 512

be sufficient?

It's either X86_64 or X86_32 anyway AFAICS.

Quoted 9 lines
arch/x86/Kconfig +5 -1
+       help
+         Maximum number of GPIOs in the system.
+
+         If unsure, leave the default value.
+
 config ARCH_SUSPEND_POSSIBLE
        def_bool y
 
--
#4 lore raw
Quoted 8 lines · Rafael J. Wysocki
Quoted 6 lines · Andy Shevchenko

By default the 512 GPIOs is a maximum on any x86 platform. With, for example, Intel Tiger Lake-H the SoC based controller occupies up to 480 pins. This leaves only 32 available for GPIO expanders or other drivers, like PMIC. Hence, bump the maximum GPIO number to 1024 for X86_64 and leave 512 for X86_32.

Thanks for review, my answers below.

Quoted 11 lines

arch/x86/Kconfig config NEED_PER_CPU_PAGE_FIRST_CHUNK · line 350

Quoted 8 lines
arch/x86/Kconfig +8 -0
+# The GPIO number here must be sorted by descending number. In case of
+# a multiplatform kernel, we just want the highest value required by the
+# selected platforms.
+config ARCH_NR_GPIO
+       int
+       default 1024 if X86_64
+       default 512 if X86_32
+       default 0

Wouldn't

Quoted 6 lines

default 1024 if X86_64
default 512

be sufficient?

It's either X86_64 or X86_32 anyway AFAICS.

I guess so.

Quoted 4 lines

arch/x86/Kconfig config NEED_PER_CPU_PAGE_FIRST_CHUNK · line 354

Quoted 4 lines
arch/x86/Kconfig +4 -0
+       help
+         Maximum number of GPIOs in the system.
+
+         If unsure, leave the default value.

Btw, what do you think. do we need comment above and help text here? I copied these from ARM, but I'm not sure it would be useful on x86 as much.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 33 lines · Andy Shevchenko
Quoted 8 lines · Rafael J. Wysocki
Quoted 6 lines · Andy Shevchenko

By default the 512 GPIOs is a maximum on any x86 platform. With, for example, Intel Tiger Lake-H the SoC based controller occupies up to 480 pins. This leaves only 32 available for GPIO expanders or other drivers, like PMIC. Hence, bump the maximum GPIO number to 1024 for X86_64 and leave 512 for X86_32.

Thanks for review, my answers below.

Quoted 11 lines

arch/x86/Kconfig config NEED_PER_CPU_PAGE_FIRST_CHUNK · line 350

Quoted 8 lines
arch/x86/Kconfig +8 -0
+# The GPIO number here must be sorted by descending number. In case of
+# a multiplatform kernel, we just want the highest value required by the
+# selected platforms.
+config ARCH_NR_GPIO
+       int
+       default 1024 if X86_64
+       default 512 if X86_32
+       default 0

Wouldn't

Quoted 6 lines

default 1024 if X86_64
default 512

be sufficient?

It's either X86_64 or X86_32 anyway AFAICS.

I guess so.

Quoted 7 lines
Quoted 4 lines

arch/x86/Kconfig config NEED_PER_CPU_PAGE_FIRST_CHUNK · line 354

Quoted 4 lines
arch/x86/Kconfig +4 -0
+       help
+         Maximum number of GPIOs in the system.
+
+         If unsure, leave the default value.

Btw, what do you think. do we need comment above and help text here? I copied these from ARM, but I'm not sure it would be useful on x86 as much.

Both the comment and the help text aren't particularly useful IMO.

The comment is a bit confusing even, because x86 kernels are multiplatform as a rule.

#6 lore raw
Quoted 5 lines · Rafael J. Wysocki
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Rafael J. Wysocki

On Fri, Aug 6, 2021 at 4:44 PM Andy Shevchenko
<[email protected]> wrote:

...

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Wouldn't

default 1024 if X86_64
default 512

be sufficient?

It's either X86_64 or X86_32 anyway AFAICS.

Fixed in v2.

...

Quoted 7 lines
Quoted 2 lines

Btw, what do you think. do we need comment above and help text here? I copied these from ARM, but I'm not sure it would be useful on x86 as much.

Both the comment and the help text aren't particularly useful IMO.

The comment is a bit confusing even, because x86 kernels are multiplatform as a rule.

Ditto.

Signature · 2 lines
With Best Regards,
Andy Shevchenko