linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Alexey Klimov <alexey.klimov@linaro.org>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Sean Wang <sean.wang@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Paul Cercueil <paul@crapouillou.net>, Kees Cook <kees@kernel.org>,
	Andy Shevchenko <andy@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Dong Aisheng <aisheng.dong@nxp.com>,
	Fabio Estevam <festevam@gmail.com>,
	Shawn Guo <shawnguo@kernel.org>, Jacky Bai <ping.bai@nxp.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	NXP S32 Linux Team <s32@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Tony Lindgren <tony@atomide.com>,
	Haojian Zhuang <haojian.zhuang@linaro.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Mark Brown <broonie@kernel.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,
	linux-hardening@vger.kernel.org, linux-mm@kvack.org,
	imx@lists.linux.dev, linux-omap@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Subject: Re: [PATCH v7 16/16] pinctrl: qcom: make the pinmuxing strict
Date: Wed, 3 Sep 2025 14:51:05 +0300	[thread overview]
Message-ID: <aLgrqZETNLmuMHhv@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=MdD9g4WiBCP0qYGuy5e3pnQf5MUHTqkUOnrUvcWUYK27A@mail.gmail.com>

On Wed, Sep 03, 2025 at 01:05:27PM +0200, Bartosz Golaszewski wrote:
> On Wed, Sep 3, 2025 at 12:53 PM Andy Shevchenko
> <andriy.shevchenko@intel.com> wrote:
> > On Wed, Sep 03, 2025 at 12:41:48PM +0200, Bartosz Golaszewski wrote:
> > > On Wed, Sep 3, 2025 at 12:38 PM Andy Shevchenko
> > > <andriy.shevchenko@intel.com> wrote:
> > > > On Wed, Sep 03, 2025 at 12:34:00PM +0200, Bartosz Golaszewski wrote:
> > > > > On Wed, Sep 3, 2025 at 12:22 PM Andy Shevchenko
> > > > > <andriy.shevchenko@intel.com> wrote:
> > > > > > On Wed, Sep 03, 2025 at 09:33:34AM +0200, Bartosz Golaszewski wrote:
> > > > > > > On Tue, Sep 2, 2025 at 10:46 PM Andy Shevchenko
> > > > > > > <andy.shevchenko@gmail.com> wrote:
> > > > > > > > On Tue, Sep 2, 2025 at 8:42 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > > > > > > > On Tue, Sep 2, 2025 at 4:38 PM Andy Shevchenko
> > > > > > > > > <andriy.shevchenko@intel.com> wrote:
> > > > > > > > > > On Tue, Sep 02, 2025 at 01:59:25PM +0200, Bartosz Golaszewski wrote:

...

> > > > > > > > > > > The strict flag in struct pinmux_ops disallows the usage of the same pin
> > > > > > > > > > > as a GPIO and for another function. Without it, a rouge user-space
> > > > > > > > > > > process with enough privileges (or even a buggy driver) can request a
> > > > > > > > > > > used pin as GPIO and drive it, potentially confusing devices or even
> > > > > > > > > > > crashing the system. Set it globally for all pinctrl-msm users.
> > > > > > > > > >
> > > > > > > > > > How does this keep (or allow) I²C generic recovery mechanism to work?
> > > > > > >
> > > > > > > Anyway, what is your point? I don't think it has any impact on this.
> > > > > >
> > > > > > If we have a group of pins that are marked as I²C, and we want to use recovery
> > > > > > via GPIOs, would it be still possible to request as GPIO when controller driver
> > > > > > is in the strict mode?
> > > > >
> > > > > Yes, if you mark that function as a "GPIO" function in the pin
> > > > > controller driver.
> > > >
> > > > How would it prevent from requesting from user space?
> > >
> > > It wouldn't, we don't discriminate between user-space and in-kernel
> > > GPIO users. A function either is a GPIO or isn't. Can you point me to
> > > the driver you're thinking about or is this a purely speculative
> > > question?
> >
> > The recovery mechanism is in I²C core and many drivers use that.
> > I'm not aware of Qualcomm drivers in particular. But mechanism is
> > in use in I²C DesignWare which is distributed a lot among platforms,
> > so using word 'purely' is incorrect, and word 'speculative' is a bit
> > strong, but you can think of the issue coming later on when somebody
> > does something like this.
> >
> > The same applies to the in-band wakeup UART mechanism.
> >
> > Which means that with this series we will relax it back anyway for
> > the above mentioned cases.
> >
> > (Not sure, but SPI DesignWare requires programming SPI native chip selects even
> >  if the GPIO is used for that, this might have also some implications, but here
> >  it's for real 'purely speculative'.)
> 
> The high-level answer is: yes, a pin that will be used by GPIOLIB
> needs the function it's muxed to, to be marked as "GPIOable" in its
> parent pin controller if it's strict. That's still better than the
> current situation.
> 
> I can imagine we could differentiate between in-kernel and user-space
> users of GPIOs and then make it impossible for the latter to request
> certain pins while they could still be requested in the kernel but
> that's outside of the scope of this series.
> 
> I don't see why this would stop these patches though, as they don't
> break anything unless you decide to make your pin controller strict in
> which situation you'd need to verify which functions can GPIOs anyway.

It can't anyway, Linus already applied :-)

-- 
With Best Regards,
Andy Shevchenko




  reply	other threads:[~2025-09-03 11:51 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02 11:59 [PATCH v7 00/16] pinctrl: introduce the concept of a GPIO pin function category Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 01/16] pinctrl: check the return value of pinmux_ops::get_function_name() Bartosz Golaszewski
2025-09-02 13:06   ` Andy Shevchenko
2025-09-02 13:29     ` Bartosz Golaszewski
2025-09-02 13:50       ` Andy Shevchenko
2025-09-02 14:02         ` Bartosz Golaszewski
2025-09-02 14:20           ` Andy Shevchenko
2025-09-02 11:59 ` [PATCH v7 02/16] devres: provide devm_kmemdup_const() Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 03/16] pinctrl: ingenic: use struct pinfunction instead of struct function_desc Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 04/16] pinctrl: airoha: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 05/16] pinctrl: mediatek: mt7988: use PINCTRL_PIN_FUNCTION() Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 06/16] pinctrl: mediatek: moore: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 07/16] pinctrl: imx: don't access the pin function radix tree directly Bartosz Golaszewski
2025-09-03 12:07   ` Mark Brown
2025-09-02 11:59 ` [PATCH v7 08/16] pinctrl: keembay: release allocated memory in detach path Bartosz Golaszewski
2025-09-02 13:10   ` Andy Shevchenko
2025-09-02 13:30     ` Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 09/16] pinctrl: keembay: use a dedicated structure for the pinfunction description Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 10/16] pinctrl: constify pinmux_generic_get_function() Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 11/16] pinctrl: make struct pinfunction a pointer in struct function_desc Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 12/16] pinctrl: qcom: use generic pin function helpers Bartosz Golaszewski
2025-09-02 13:15   ` Andy Shevchenko
2025-09-02 13:32     ` Bartosz Golaszewski
2025-09-02 15:12     ` Krzysztof Kozlowski
2025-09-02 15:27       ` Andy Shevchenko
2025-09-02 15:38         ` Krzysztof Kozlowski
2025-09-02 11:59 ` [PATCH v7 13/16] pinctrl: allow to mark pin functions as requestable GPIOs Bartosz Golaszewski
2025-09-02 14:31   ` Andy Shevchenko
2025-09-02 17:50     ` Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 14/16] pinctrl: qcom: add infrastructure for marking pin functions as GPIOs Bartosz Golaszewski
2025-09-02 11:59 ` [PATCH v7 15/16] pinctrl: qcom: mark the `gpio` and `egpio` pins function as non-strict functions Bartosz Golaszewski
2025-09-02 14:32   ` Andy Shevchenko
2025-09-02 11:59 ` [PATCH v7 16/16] pinctrl: qcom: make the pinmuxing strict Bartosz Golaszewski
2025-09-02 14:38   ` Andy Shevchenko
2025-09-02 17:41     ` Bartosz Golaszewski
2025-09-02 20:46       ` Andy Shevchenko
2025-09-03  7:33         ` Bartosz Golaszewski
2025-09-03 10:22           ` Andy Shevchenko
2025-09-03 10:34             ` Bartosz Golaszewski
2025-09-03 10:38               ` Andy Shevchenko
2025-09-03 10:41                 ` Bartosz Golaszewski
2025-09-03 10:53                   ` Andy Shevchenko
2025-09-03 11:05                     ` Bartosz Golaszewski
2025-09-03 11:51                       ` Andy Shevchenko [this message]
2025-09-03 12:06                         ` Bartosz Golaszewski
2025-09-03 11:06                     ` Mark Brown
2025-09-03  7:34         ` Geert Uytterhoeven
2025-09-02 14:46 ` [PATCH v7 00/16] pinctrl: introduce the concept of a GPIO pin function category Andy Shevchenko
2025-09-02 17:37   ` Bartosz Golaszewski
2025-09-02 22:18 ` Linus Walleij
2025-09-03 11:51   ` 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=aLgrqZETNLmuMHhv@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=aisheng.dong@nxp.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexey.klimov@linaro.org \
    --cc=andersson@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=david@redhat.com \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=haojian.zhuang@linaro.org \
    --cc=imx@lists.linux.dev \
    --cc=kees@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mhocko@suse.com \
    --cc=neil.armstrong@linaro.org \
    --cc=paul@crapouillou.net \
    --cc=ping.bai@nxp.com \
    --cc=rafael@kernel.org \
    --cc=rppt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s32@nxp.com \
    --cc=sean.wang@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=surenb@google.com \
    --cc=tony@atomide.com \
    --cc=vbabka@suse.cz \
    /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