mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ju Nan <junan76@163.com>
To: sashiko-reviews@lists.linux.dev
Cc: mfd@lists.linux.dev, linux-rt-devel@lists.linux.dev,
	lee@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pinctrl: stm32: use a raw spinlock regmap to program the EXTI mux
Date: Tue, 4 Aug 2026 11:03:47 +0800	[thread overview]
Message-ID: <c5f7df74-5a45-4bd6-b167-b4f970613d9a@163.com> (raw)
In-Reply-To: <20260803063431.205EC1F000E9@smtp.kernel.org>



On 8/3/26 2:34 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [High] Bypassing standard syscon regmap initialization leaves the syscfg clock disabled, leading to hardware bus faults on platforms where the syscfg node requires a clock.
> - [High] If another driver sharing the syscon node probes before pinctrl, the generic syscon layer will create a default regmap without `use_raw_spinlock`, causing the PREEMPT_RT sleeping-in-atomic bug to persist.

> [Severity: High]
> Does bypassing the standard syscon regmap initialization leave the syscfg
> clock disabled?
> 
> The generic syscon handling normally calls of_clk_get() and 
> regmap_mmio_attach_clk(). Since this manual initialization skips that, the
> clock is never attached to the regmap.
> 
> On platforms like STM32F4/F7/H7 where the syscfg node explicitly requires a 
> clock, could writing to the EXTI mux registers in stm32_gpio_domain_activate()
> with the clock disabled trigger an imprecise external abort (bus fault)?

That's right for STM32F4/F7, I have checked related dts files and the syscfg
node does require a clock.

>> +
>> +	/*
>> +	 * A regmap is already registered for that node, most likely by the
>> +	 * other pinctrl instance sharing it. Drop ours and use that one.
>> +	 */
>> +	if (of_syscon_register_regmap(syscfg_np, regmap)) {
>> +		regmap_exit(regmap);
>> +		iounmap(base);
>> +	}
> 
> [Severity: High]
> If another driver sharing the st,syscfg node (like Ethernet MAC, I2C, or USB)
> probes before pinctrl, won't the generic syscon layer have already
> instantiated a default regmap without use_raw_spinlock?
> 
> In that scenario, of_syscon_register_regmap() would return an error and the
> driver silently discards its raw regmap. Since the driver then falls back to
> the already registered sleeping regmap, does this cause the PREEMPT_RT 
> sleeping-in-atomic bug to persist when stm32_gpio_domain_activate() writes to
> the regmap under the raw desc->lock?
> 


True again for STM32F4/H7. But the syscfg node is shared between pinctrl and
pinctrl_z only on STM32MP series SoC, and that's the platform on which I tested
this patch.

Thanks sashiko-bot :P, I will send a V2 later.

>> +
>> +out_put:
>> +	of_node_put(syscfg_np);
>> +}
> 


  reply	other threads:[~2026-08-04  3:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  6:17 Ju Nan
2026-08-03  6:34 ` sashiko-bot
2026-08-04  3:03   ` Ju Nan [this message]
2026-08-04  3:22 ` [PATCH v2] pinctrl: stm32: program the EXTI mux from .alloc instead of .activate Ju Nan
2026-08-04  3:38   ` sashiko-bot
2026-08-04 14:14 ` [PATCH v3] " Ju Nan
2026-08-04 15:12   ` sashiko-bot
2026-08-27 15:10   ` Sebastian Andrzej Siewior
2026-08-28 11:17   ` Antonio Borneo

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=c5f7df74-5a45-4bd6-b167-b4f970613d9a@163.com \
    --to=junan76@163.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=mfd@lists.linux.dev \
    --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 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®