From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Arnd Bergmann <arnd@arndb.de>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Keerthy <j-keerthy@ti.com>, Russell King <linux@armlinux.org.uk>,
Jonathan Corbet <corbet@lwn.net>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
Linux-Arch <linux-arch@vger.kernel.org>,
Linux Documentation List <linux-doc@vger.kernel.org>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>
Subject: Re: [PATCH v1 4/8] gpiolib: Get rid of ARCH_NR_GPIOS
Date: Fri, 2 Sep 2022 10:21:21 +0000 [thread overview]
Message-ID: <b11eed9d-719d-cdf3-0efd-3d44425b9372@csgroup.eu> (raw)
In-Reply-To: <1d548a19-feec-42b9-944d-890d6dde2fb8@www.fastmail.com>
Le 31/08/2022 à 22:55, Arnd Bergmann a écrit :
> On Wed, Aug 31, 2022, at 7:49 AM, Christophe Leroy wrote:
>> Le 30/08/2022 à 22:18, Andy Shevchenko a écrit :
>>> On Mon, Aug 29, 2022 at 7:19 PM Christophe Leroy
>>> <christophe.leroy@csgroup.eu> wrote:
>>>>
>>>> Since commit 14e85c0e69d5 ("gpio: remove gpio_descs global array")
>>>> there is no limitation on the number of GPIOs that can be allocated
>>>> in the system since the allocation is fully dynamic.
>>>>
>>>> ARCH_NR_GPIOS is today only used in order to provide downwards
>>>> gpiobase allocation from that value, while static allocation is
>>>> performed upwards from 0. However that has the disadvantage of
>>>> limiting the number of GPIOs that can be registered in the system.
>>>>
>>>> To overcome this limitation without requiring each and every
>>>> platform to provide its 'best-guess' maximum number, rework the
>>>> allocation to allocate upwards, allowing approx 2 millions of
>>>> GPIOs.
>>>>
>>>> In order to still allow static allocation for legacy drivers, define
>>>> GPIO_DYNAMIC_BASE with the value 256 as the start for dynamic
>>>> allocation.
>>>
>>> Not sure about 256, but I understand that this can only be the best guess.
>>>
>>
>> Well, it's already just a precaution. Linus W's expectation is that
>> static ones are allocated at first, they should already be allocated
>> when we start doing dynamic allocations so he was even thinking that we
>> could have started at 0 already.
>>
>> But I can start higher if you think it is safer, maybe at 512 which is
>> the default ARCH_NR_GPIOS today.
>
> FWIW, I went through the drivers that set the base to a value other than
> zero or -1, to see what they use:
>
> arch/arm/mach-s3c/gpio-samsung.c: .base = S3C2410_GPM(0), // 384
> arch/arm/mach-s3c/mach-h1940.c: .base = H1940_LATCH_GPIO(0), // 384 + 22
> drivers/mfd/asic3.c: asic->gpio.base = pdata->gpio_base; // 300 + 100
> drivers/mfd/htc-i2cpld.c: gpio_chip->base = plat_chip_data->gpio_in_base; // 192 + 16 + 8*8
Ok, so 256 is not enough, have to go to 512.
Christophe
next prev parent reply other threads:[~2022-09-02 10:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-29 16:15 [PATCH v1 0/8] gpio: Get rid of ARCH_NR_GPIOS (v1) Christophe Leroy
2022-08-29 16:15 ` [PATCH v1 1/8] gpio: aggregator: Stop using ARCH_NR_GPIOS Christophe Leroy
2022-08-30 7:51 ` Geert Uytterhoeven
2022-08-29 16:15 ` [PATCH v1 2/8] gpio: davinci: " Christophe Leroy
2022-08-29 16:15 ` [PATCH v1 3/8] gpiolib: Warn on drivers still using static gpiobase allocation Christophe Leroy
2022-08-30 20:14 ` Andy Shevchenko
2022-08-31 5:39 ` Christophe Leroy
2022-08-31 8:00 ` Geert Uytterhoeven
2022-08-29 16:15 ` [PATCH v1 4/8] gpiolib: Get rid of ARCH_NR_GPIOS Christophe Leroy
2022-08-30 20:18 ` Andy Shevchenko
2022-08-31 5:49 ` Christophe Leroy
2022-08-31 20:55 ` Arnd Bergmann
2022-09-02 10:21 ` Christophe Leroy [this message]
2022-09-02 10:52 ` Andy Shevchenko
2022-09-02 11:02 ` Geert Uytterhoeven
2022-09-02 11:39 ` Nuno Sá
2022-09-02 12:00 ` Arnd Bergmann
2022-08-29 16:15 ` [PATCH v1 5/8] Documentation: gpio: Remove text about ARCH_NR_GPIOS Christophe Leroy
2022-08-29 16:15 ` [PATCH v1 6/8] x86: Remove CONFIG_ARCH_NR_GPIO Christophe Leroy
2022-08-29 16:15 ` [PATCH v1 7/8] arm: " Christophe Leroy
2022-08-29 16:15 ` [PATCH v1 8/8] arm64: " Christophe Leroy
2022-08-30 20:20 ` [PATCH v1 0/8] gpio: Get rid of ARCH_NR_GPIOS (v1) Andy Shevchenko
2022-08-30 20:21 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b11eed9d-719d-cdf3-0efd-3d44425b9372@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=andy.shevchenko@gmail.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=brgl@bgdev.pl \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=geert+renesas@glider.be \
--cc=hpa@zytor.com \
--cc=j-keerthy@ti.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®