Skip to contentSkip to conversation

Increase ARCH_NR_GPIO for ARCH_ASPEED?

DISCUSSION Tao Ren 2 participants 15 messages Feb 14, 2019 – Feb 26, 2019

lore
Share & tools
lore

Tao Ren

author
#0 lore raw

Hi,

I got following error while booting up openbmc linux 4.18 on Facebook YAMP BMC (ast2500 based), and it's because total 594 GPIO pins are provided by aspeed soc and i/o expanders on YAMP board:

gpiochip_find_base: cannot find free range gpiochip_add_data_with_key: GPIOs 0..15 (pca9555) failed to register

I'm wondering if it's good idea to increase ARCH_NR_GPIO default value to the "next level" (1024) for ARCH_ASPEED? If not, any other suggestions for this problem?

Thanks,

Tao

author
#1 lore raw
Quoted 8 lines · Tao Ren

Hi,

I got following error while booting up openbmc linux 4.18 on Facebook YAMP BMC (ast2500 based), and it's because total 594 GPIO pins are provided by aspeed soc and i/o expanders on YAMP board:

gpiochip_find_base: cannot find free range gpiochip_add_data_with_key: GPIOs 0..15 (pca9555) failed to register

I'm wondering if it's good idea to increase ARCH_NR_GPIO default value to the "next level" (1024) for ARCH_ASPEED? If not, any other suggestions for this problem?

I forgot to mention the current value of ARCH_NR_GPIO for ARCH_ASPEED: it's 512 (but YAMP BMC provides 594 GPIO pins).

- Tao

#2 lore raw
Quoted 9 lines · Tao Ren
Quoted 8 lines · Tao Ren

Hi,

I got following error while booting up openbmc linux 4.18 on Facebook YAMP BMC (ast2500 based), and it's because total 594 GPIO pins are provided by aspeed soc and i/o expanders on YAMP board:

gpiochip_find_base: cannot find free range gpiochip_add_data_with_key: GPIOs 0..15 (pca9555) failed to register

I'm wondering if it's good idea to increase ARCH_NR_GPIO default value to the "next level" (1024) for ARCH_ASPEED? If not, any other suggestions for this problem?

I don't know that there's much other choice, but beware that changing the value will impact userspace if you're using the sysfs interface (which you ideally you shouldn't be, as it's deprecated), as the base addresses of the gpiochips will change.

Andrew

author
#3 lore raw
Quoted 6 lines · Andrew Jeffery

I don't know that there's much other choice, but beware that changing the value will impact userspace if you're using the sysfs interface (which you ideally you shouldn't be, as it's deprecated), as the base addresses of the gpiochips will change.

Andrew

Thank you Andrew for the comments. Hopefully nobody in the community will be impacted by the patch; if unfortunately some apps are broken (due to the dependency on sysfs-gpio), I'm happy to help with the fix.

Thanks,

- Tao

#4 lore raw
Quoted 11 lines · Tao Ren
Quoted 6 lines · Andrew Jeffery

I don't know that there's much other choice, but beware that changing the value will impact userspace if you're using the sysfs interface (which you ideally you shouldn't be, as it's deprecated), as the base addresses of the gpiochips will change.

Andrew

Thank you Andrew for the comments. Hopefully nobody in the community will be impacted by the patch; if unfortunately some apps are broken (due to the dependency on sysfs-gpio), I'm happy to help with the fix.

It's not necessarily an easy thing to fix if userspace is relying on fixed numbering (which isn't ideal, but it may). You can't fix netbooting a new kernel containing the change with an old userspace that isn't aware of it.

However, there's no reason you can't narrow the change to only apply to your system (rather than do it in the base defconfig and affect all systems).

Andrew

Quoted 4 lines

Thanks,

- Tao

author
#5 lore raw

Hi Andrew,

Quoted 3 lines · Andrew Jeffery

However, there's no reason you can't narrow the change to only apply to your system (rather than do it in the base defconfig and affect all systems).

Perhaps it's my lack of greater knowledge on kconfig; I actually tried a few options but couldn't find a nice way to apply the change to my system only.

At first, I tried to customize ARCH_NR_GPIO in my <old.config> file, but the value was set to default (or ignored) by running "make olddefconfig".

Then I added "input prompt" for ARCH_NR_GPIO option: customized value in <old.config> was applied while running "make olddefconfig", but my concern is the approach may impact more users?

My third approach is what I proposed in this email thread (setting default ARCH_NR_GPIO to 1024 for ARCH_ASPEED).

I'm looking forward for your suggestions. Thank you again.

Best regards,

Tao

#6 lore raw
Quoted 15 lines · Tao Ren

Hi Andrew,

Quoted 3 lines · Andrew Jeffery

However, there's no reason you can't narrow the change to only apply to your system (rather than do it in the base defconfig and affect all systems).

Perhaps it's my lack of greater knowledge on kconfig; I actually tried a few options but couldn't find a nice way to apply the change to my system only.

At first, I tried to customize ARCH_NR_GPIO in my <old.config> file, but the value was set to default (or ignored) by running "make olddefconfig".

Quoted 8 lines

Then I added "input prompt" for ARCH_NR_GPIO option: customized value in <old.config> was applied while running "make olddefconfig", but my concern is the approach may impact more users?

My third approach is what I proposed in this email thread (setting default ARCH_NR_GPIO to 1024 for ARCH_ASPEED).

I'm looking forward for your suggestions. Thank you again.

As an example, for Tiogapass, you should be able to define CONFIG_ARCH_NR_GPIO = 1024 in tiogapass.cfg:

https://github.com/openbmc/meta-facebook/blob/master/meta-tiogapass/recipes-kernel/linux/linux-aspeed/tiogapass.cfg

Andrew

author
#7 lore raw

Hi Andrew,

Quoted 3 lines · Andrew Jeffery

As an example, for Tiogapass, you should be able to define CONFIG_ARCH_NR_GPIO = 1024 in tiogapass.cfg:

https://github.com/openbmc/meta-facebook/blob/master/meta-tiogapass/recipes-kernel/linux/linux-aspeed/tiogapass.cfg

I tried to define 'CONFIG_ARCH_NR_GPIO=1024' in <platform>.cfg, but still, it's reset to 0 by "make olddefconfig".

Below are my steps (using the latest openbmc tree), and kindly let me know if I missed something:

1) added 'CONFIG_ARCH_NR_GPIO=1024' in meta-ibm/meta-romulus/recipes-kernel/linux/linux-aspeed/romulus.cfg
2) export TEMPLATECONF=meta-ibm/meta-romulus/conf
3) . openbmc-env
4) ran "bitbake linux-aspeed"
5) checked build/tmp/work/romulus-openbmc-linux-gnueabi/linux-aspeed/4.19.21+gitAUTOINC+d808d27f70-r0/linux-romulus-standard-build/.config: CONFIG_ARCH_NR_GPIO is reset to 0.

Thanks,

- Tao

#8 lore raw
Quoted 13 lines · Tao Ren

Hi Andrew,

Quoted 3 lines · Andrew Jeffery

As an example, for Tiogapass, you should be able to define CONFIG_ARCH_NR_GPIO = 1024 in tiogapass.cfg:

https://github.com/openbmc/meta-facebook/blob/master/meta-tiogapass/recipes-kernel/linux/linux-aspeed/tiogapass.cfg

I tried to define 'CONFIG_ARCH_NR_GPIO=1024' in <platform>.cfg, but still, it's reset to 0 by "make olddefconfig".

Below are my steps (using the latest openbmc tree), and kindly let me know if I missed something:

Quoted 7 lines

1) added 'CONFIG_ARCH_NR_GPIO=1024' in
meta-ibm/meta-romulus/recipes-kernel/linux/linux-aspeed/romulus.cfg
2) export TEMPLATECONF=meta-ibm/meta-romulus/conf
3) . openbmc-env
4) ran "bitbake linux-aspeed"
5) checked build/tmp/work/romulus-openbmc-linux-gnueabi/linux-aspeed/4.19.21+gitAUTOINC+d808d27f70-r0/linux-romulus-standard-build/.config: CONFIG_ARCH_NR_GPIO is reset to 0.

Ugh. I didn't try it myself, was just hoping that would work. Are you okay to keep digging into why?

author
#9 lore raw
Quoted 22 lines · Andrew Jeffery
Quoted 13 lines · Tao Ren

Hi Andrew,

Quoted 3 lines · Andrew Jeffery

As an example, for Tiogapass, you should be able to define CONFIG_ARCH_NR_GPIO = 1024 in tiogapass.cfg:

https://github.com/openbmc/meta-facebook/blob/master/meta-tiogapass/recipes-kernel/linux/linux-aspeed/tiogapass.cfg

I tried to define 'CONFIG_ARCH_NR_GPIO=1024' in <platform>.cfg, but still, it's reset to 0 by "make olddefconfig".

Below are my steps (using the latest openbmc tree), and kindly let me know if I missed something:

Quoted 7 lines

1) added 'CONFIG_ARCH_NR_GPIO=1024' in
meta-ibm/meta-romulus/recipes-kernel/linux/linux-aspeed/romulus.cfg
2) export TEMPLATECONF=meta-ibm/meta-romulus/conf
3) . openbmc-env
4) ran "bitbake linux-aspeed"
5) checked build/tmp/work/romulus-openbmc-linux-gnueabi/linux-aspeed/4.19.21+gitAUTOINC+d808d27f70-r0/linux-romulus-standard-build/.config: CONFIG_ARCH_NR_GPIO is reset to 0.

Quoted 2 lines

Ugh. I didn't try it myself, was just hoping that would work. Are you okay to keep digging into why?

Sure. Let me run more testing, and will share you more details later..

- Tao

author
#10 lore raw
In reply to Andrew Jeffery

Hi Andrew,

Quoted 22 lines · Andrew Jeffery
Quoted 13 lines · Tao Ren

Hi Andrew,

Quoted 3 lines · Andrew Jeffery

As an example, for Tiogapass, you should be able to define CONFIG_ARCH_NR_GPIO = 1024 in tiogapass.cfg:

https://github.com/openbmc/meta-facebook/blob/master/meta-tiogapass/recipes-kernel/linux/linux-aspeed/tiogapass.cfg

I tried to define 'CONFIG_ARCH_NR_GPIO=1024' in <platform>.cfg, but still, it's reset to 0 by "make olddefconfig".

Below are my steps (using the latest openbmc tree), and kindly let me know if I missed something:

Quoted 7 lines

1) added 'CONFIG_ARCH_NR_GPIO=1024' in
meta-ibm/meta-romulus/recipes-kernel/linux/linux-aspeed/romulus.cfg
2) export TEMPLATECONF=meta-ibm/meta-romulus/conf
3) . openbmc-env
4) ran "bitbake linux-aspeed"
5) checked build/tmp/work/romulus-openbmc-linux-gnueabi/linux-aspeed/4.19.21+gitAUTOINC+d808d27f70-r0/linux-romulus-standard-build/.config: CONFIG_ARCH_NR_GPIO is reset to 0.

Quoted 2 lines

Ugh. I didn't try it myself, was just hoping that would work. Are you okay to keep digging into why?

Manually editing "ARCH_NR_GPIO" in <platform>.cfg doesn't work because ARCH_NR_GPIO symbol is "invisible" and user defined value will be ignored by "scripts/kconfig/conf". I compared a few other ways to fix/workaround the issue, but IMHO, increasing default ARCH_NR_GPIO for ARCH_ASPEED is better than other solutions. Please suggest.

BTW, "CONFIG_GCC_PLUGINS=y" in meta-aspeed/recipes-kernel/linux/ast2500/defconfig is not included in the final .config because its dependency option PLUGIN_HOSTCC is not set.

Thanks,

- Tao

#11 lore raw
Quoted 25 lines · Tao Ren

Hi Andrew,

Quoted 22 lines · Andrew Jeffery
Quoted 20 lines · Tao Ren

Hi Andrew,

Quoted 3 lines · Andrew Jeffery

As an example, for Tiogapass, you should be able to define CONFIG_ARCH_NR_GPIO = 1024 in tiogapass.cfg:

https://github.com/openbmc/meta-facebook/blob/master/meta-tiogapass/recipes-kernel/linux/linux-aspeed/tiogapass.cfg

I tried to define 'CONFIG_ARCH_NR_GPIO=1024' in <platform>.cfg, but still, it's reset to 0 by "make olddefconfig".

Below are my steps (using the latest openbmc tree), and kindly let me know if I missed something:

1) added 'CONFIG_ARCH_NR_GPIO=1024' in
meta-ibm/meta-romulus/recipes-kernel/linux/linux-aspeed/romulus.cfg
2) export TEMPLATECONF=meta-ibm/meta-romulus/conf
3) . openbmc-env
4) ran "bitbake linux-aspeed"
5) checked build/tmp/work/romulus-openbmc-linux-gnueabi/linux-aspeed/4.19.21+gitAUTOINC+d808d27f70-r0/linux-romulus-standard-build/.config: CONFIG_ARCH_NR_GPIO is reset to 0.

Quoted 8 lines
Quoted 2 lines

Ugh. I didn't try it myself, was just hoping that would work. Are you okay to keep digging into why?

Manually editing "ARCH_NR_GPIO" in <platform>.cfg doesn't work because ARCH_NR_GPIO symbol is "invisible" and user defined value will be ignored by "scripts/kconfig/conf". I compared a few other ways to fix/workaround the issue, but IMHO, increasing default ARCH_NR_GPIO for ARCH_ASPEED is better than other solutions. Please suggest.

Hrm. That's really unfortunate. Can you patch it in on your platform for the moment? We're going to have to come up with some more long term strategy. Whether that's making the symbol visible or migrating everyone off sysfs (which they should be doing anyway) I'm not sure. If we don't do either of those then I think we're going to have to audit userspace to find what will break.

Quoted 5 lines

BTW, "CONFIG_GCC_PLUGINS=y" in meta-aspeed/recipes-kernel/linux/ast2500/defconfig is not included in the final .config because its dependency option PLUGIN_HOSTCC is not set.

Can you open an issue in https://github.com/openbmc/linux ?

Cheers,

Andrew

Quoted 6 lines

Thanks,

- Tao

author
#12 lore raw

Hi Andrew,

Thank you for looking into the issue.

Quoted 13 lines · Andrew Jeffery
Quoted 10 lines · Tao Ren

Hi Andrew,

Quoted 2 lines · Andrew Jeffery
Quoted 1 line · Tao Ren

Hi Andrew,

Manually editing "ARCH_NR_GPIO" in <platform>.cfg doesn't work because ARCH_NR_GPIO symbol is "invisible" and user defined value will be ignored by "scripts/kconfig/conf". I compared a few other ways to fix/workaround the issue, but IMHO, increasing default ARCH_NR_GPIO for ARCH_ASPEED is better than other solutions. Please suggest.

Quoted 6 lines

Hrm. That's really unfortunate. Can you patch it in on your platform for the moment? We're going to have to come up with some more long term strategy. Whether that's making the symbol visible or migrating everyone off sysfs (which they should be doing anyway) I'm not sure. If we don't do either of those then I think we're going to have to audit userspace to find what will break.

Make sense. I will keep the patch in my local tree as of now.

Quoted 6 lines
Quoted 4 lines

BTW, "CONFIG_GCC_PLUGINS=y" in meta-aspeed/recipes-kernel/linux/ast2500/defconfig is not included in the final .config because its dependency option PLUGIN_HOSTCC is not set.

Can you open an issue in https://github.com/openbmc/linux ?

Sure. Opened issue https://github.com/openbmc/linux/issues/170

Cheers,

- Tao

#13 lore raw
Quoted 18 lines · Tao Ren

Hi Andrew,

Thank you for looking into the issue.

Quoted 13 lines · Andrew Jeffery
Quoted 10 lines · Tao Ren

Hi Andrew,

Quoted 2 lines · Andrew Jeffery
Quoted 1 line · Tao Ren

Hi Andrew,

Manually editing "ARCH_NR_GPIO" in <platform>.cfg doesn't work because ARCH_NR_GPIO symbol is "invisible" and user defined value will be ignored by "scripts/kconfig/conf". I compared a few other ways to fix/workaround the issue, but IMHO, increasing default ARCH_NR_GPIO for ARCH_ASPEED is better than other solutions. Please suggest.

Quoted 8 lines
Quoted 6 lines

Hrm. That's really unfortunate. Can you patch it in on your platform for the moment? We're going to have to come up with some more long term strategy. Whether that's making the symbol visible or migrating everyone off sysfs (which they should be doing anyway) I'm not sure. If we don't do either of those then I think we're going to have to audit userspace to find what will break.

Make sense. I will keep the patch in my local tree as of now.

You can still send a patch to meta-facebook that applies your change to the kernel tree. Don't keep it to yourself :D

Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

BTW, "CONFIG_GCC_PLUGINS=y" in meta-aspeed/recipes-kernel/linux/ast2500/defconfig is not included in the final .config because its dependency option PLUGIN_HOSTCC is not set.

Can you open an issue in https://github.com/openbmc/linux ?

Sure. Opened issue https://github.com/openbmc/linux/issues/170

Thanks.

Quoted 6 lines

Cheers,

- Tao

author
#14 lore raw
Quoted 11 lines · Andrew Jeffery
Quoted 8 lines
Quoted 6 lines

Hrm. That's really unfortunate. Can you patch it in on your platform for the moment? We're going to have to come up with some more long term strategy. Whether that's making the symbol visible or migrating everyone off sysfs (which they should be doing anyway) I'm not sure. If we don't do either of those then I think we're going to have to audit userspace to find what will break.

Make sense. I will keep the patch in my local tree as of now.

You can still send a patch to meta-facebook that applies your change to the kernel tree. Don't keep it to yourself :D

Oh yes. I almost forget the option of having patch files :)

Cheers,

- Tao