All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xianwei Zhao via B4 Relay"
	<devnull+xianwei.zhao.amlogic.com@kernel.org>
Cc: linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH] pinctrl: meson: amlogic-a4: fix gpio output glitch
Date: Mon, 18 May 2026 08:44:09 +0000	[thread overview]
Message-ID: <20260518084410.74AC9C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <20260518-fix-set-value-glitch-v1-1-d350732dc934@amlogic.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Incomplete fix: The GPIO output glitch bug is identically present in the core `pinctrl-meson.c` driver, leaving other Amlogic SoCs vulnerable.
- [High] AA deadlock in `aml_pinconf_set_*` functions triggerable from userspace via GPIO character device.
--

commit 91d93a06a0e9681b94621504af7968b8a6f4f155
Author: Xianwei Zhao <xianwei.zhao@amlogic.com>

pinctrl: meson: amlogic-a4: fix gpio output glitch

This commit fixes a brief low-level glitch on GPIO lines during the
transition from bootloader to kernel. It does this by swapping the
configuration order to set the output value before switching the pin
direction to output.

> diff --git a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> index 35d27626a336b..1bd58fbbd26ac 100644
> --- a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> +++ b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> @@ -548,11 +548,11 @@ static int aml_pinconf_set_output_drive(struct aml_pinctrl *info,
>  {
>  	int ret;
>  
> -	ret = aml_pinconf_set_output(info, pin, true);
> +	ret = aml_pinconf_set_drive(info, pin, high);

Does this call chain trigger an AA deadlock when configured at runtime?

When a GPIO line's configuration is changed from userspace (for example, via
the GPIO_V2_LINE_SET_CONFIG_IOCTL), the core pinctrl_gpio_set_config()
function acquires pctldev->mutex before invoking the .pin_config_set callback.

If aml_pinconf_set_drive() calls aml_pinconf_set_gpio_bit(), and that function
still uses pinctrl_find_gpio_range_from_pin(), it will attempt to acquire the
same pctldev->mutex.

A previous commit fixed a similar deadlock for the _get functions by switching
to pinctrl_find_gpio_range_from_pin_nolock(). Do the _set functions need the
same update?

Additionally, while this resolves the glitch for the amlogic-a4 driver, does
the core pinctrl-meson.c driver have the same issue? Looking at
meson_pinconf_set_output_drive() in the core driver, it appears to still
call meson_pinconf_set_output() before meson_pinconf_set_drive(). Could
other Amlogic SoCs be vulnerable to the same regulator control glitch
unless the order is swapped there as well?

>  	if (ret)
>  		return ret;
>  
> -	return aml_pinconf_set_drive(info, pin, high);
> +	return aml_pinconf_set_output(info, pin, true);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260518-fix-set-value-glitch-v1-1-d350732dc934@amlogic.com?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-05-18  8:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  8:26 [PATCH] pinctrl: meson: amlogic-a4: fix gpio output glitch Xianwei Zhao
2026-05-18  8:26 ` Xianwei Zhao via B4 Relay
2026-05-18  8:26 ` Xianwei Zhao via B4 Relay
2026-05-18  8:44 ` sashiko-bot [this message]
2026-05-18 14:32 ` Neil Armstrong
2026-05-18 14:32   ` Neil Armstrong
2026-05-25  8:34 ` Linus Walleij
2026-05-25  8:34   ` Linus Walleij
2026-05-25 11:16   ` Xianwei Zhao
2026-05-25 11:16     ` Xianwei Zhao
2026-05-26  9:54 ` Linus Walleij
2026-05-26  9:54   ` Linus Walleij

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=20260518084410.74AC9C2BCB7@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=devnull+xianwei.zhao.amlogic.com@kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.