From: Xia Fukun <xiafukun@huawei.com>
To: Claudiu <claudiu.beznea@tuxon.dev>,
<yoshihiro.shimoda.uh@renesas.com>, <vkoul@kernel.org>,
<kishon@kernel.org>, <geert+renesas@glider.be>,
<magnus.damm@gmail.com>, <horms+renesas@verge.net.au>,
<fabrizio.castro@bp.renesas.com>,
Greg KH <gregkh@linuxfoundation.org>
Cc: <linux-renesas-soc@vger.kernel.org>,
<linux-phy@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,
<stable@vger.kernel.org>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
"tanghui (C)" <tanghui20@huawei.com>,
Xia Fukun <xiafukun@huawei.com>
Subject: Re: [PATCH RESEND v3 3/5] phy: renesas: rcar-gen3-usb2: Lock around hardware registers and driver data
Date: Wed, 3 Jun 2026 21:22:42 +0800 [thread overview]
Message-ID: <e49fc109-41a2-449f-a232-d8beac2c5e08@huawei.com> (raw)
In-Reply-To: <20250507125032.565017-4-claudiu.beznea.uj@bp.renesas.com>
On 5/7/2025 8:50 PM, Claudiu wrote:
> @@ -348,6 +349,8 @@ static ssize_t role_store(struct device *dev, struct device_attribute *attr,
> bool is_b_device;
> enum phy_mode cur_mode, new_mode;
>
> + guard(spinlock_irqsave)(&ch->lock);
> +
> if (!ch->is_otg_channel || !rcar_gen3_is_any_otg_rphy_initialized(ch))
> return -EIO;
>
> @@ -415,7 +418,7 @@ static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch)
> val = readl(usb2_base + USB2_ADPCTRL);
> writel(val | USB2_ADPCTRL_IDPULLUP, usb2_base + USB2_ADPCTRL);
> }
> - msleep(20);
> + mdelay(20);
>
> writel(0xffffffff, usb2_base + USB2_OBINTSTA);
> writel(ch->obint_enable_bits, usb2_base + USB2_OBINTEN);
The fix for the rcar_gen3_init_otg function has not been backported to
the 5.10-stable branch, which leads to a "scheduling while atomic" bug
in that branch:
rcar_gen3_phy_usb2_init() ← phy_init() callback
→ guard(spinlock_irqsave)(&ch->lock) ← acquires spinlock, disabling preemption + IRQs
→ rcar_gen3_init_otg(ch)
→ msleep(20) ← BUG: scheduling while atomic!
The patch for 5.10 is available at the following link:
https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.10.y&id=0f86a559900fbe96af08a3a226a86fac27b02b8f
Perhaps the stable patch for the 5.10 branch needs to be updated to
fix this serious bug?
> @@ -456,6 +461,8 @@ static int rcar_gen3_phy_usb2_init(struct phy *p)
> void __iomem *usb2_base = channel->base;
> u32 val;
>
> + guard(spinlock_irqsave)(&channel->lock);
> +
> /* Initialize USB2 part */
> val = readl(usb2_base + USB2_INT_ENABLE);
> val |= USB2_INT_ENABLE_UCOM_INTEN | rphy->int_enable_bits;
> @@ -479,6 +486,8 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p)
> void __iomem *usb2_base = channel->base;
> u32 val;
>
> + guard(spinlock_irqsave)(&channel->lock);
> +
> rphy->initialized = false;
>
> val = readl(usb2_base + USB2_INT_ENABLE);
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-06-03 13:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 12:50 [PATCH RESEND v3 0/5] phy: renesas: rcar-gen3-usb2: Fixes for Renesas RZ/G3S Claudiu
2025-05-07 12:50 ` [PATCH RESEND v3 1/5] phy: renesas: rcar-gen3-usb2: Fix role detection on unbind/bind Claudiu
2025-05-07 12:50 ` [PATCH RESEND v3 2/5] phy: renesas: rcar-gen3-usb2: Move IRQ request in probe Claudiu
2025-05-07 12:50 ` [PATCH RESEND v3 3/5] phy: renesas: rcar-gen3-usb2: Lock around hardware registers and driver data Claudiu
2026-06-03 13:22 ` Xia Fukun [this message]
2026-06-03 13:38 ` Claudiu Beznea
2025-05-07 12:50 ` [PATCH RESEND v3 4/5] phy: renesas: rcar-gen3-usb2: Assert PLL reset on PHY power off Claudiu
2025-05-07 12:50 ` [PATCH RESEND v3 5/5] phy: renesas: rcar-gen3-usb2: Set timing registers only once Claudiu
2025-05-14 11:31 ` [PATCH RESEND v3 0/5] phy: renesas: rcar-gen3-usb2: Fixes for Renesas RZ/G3S Vinod Koul
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=e49fc109-41a2-449f-a232-d8beac2c5e08@huawei.com \
--to=xiafukun@huawei.com \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=fabrizio.castro@bp.renesas.com \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=horms+renesas@verge.net.au \
--cc=kishon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=stable@vger.kernel.org \
--cc=tanghui20@huawei.com \
--cc=vkoul@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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