Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Biju <biju.das.au@gmail.com>
Cc: vkoul@kernel.org, olteanv@gmail.com, neil.armstrong@linaro.org,
	linux-phy@lists.infradead.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v3 6/9] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support
Date: Tue, 07 Jul 2026 14:51:28 +0000	[thread overview]
Message-ID: <20260707145129.137181F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707143646.245177-7-biju.das.jz@bp.renesas.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Sleep-in-atomic bug due to calling regulator_hardware_enable() inside a spinlock and from a hardirq handler.
--

--- Patch [6]: [PATCH v3 6/9] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support ---
commit 502c90feba61fdb92ccdaff21a3e226e6113ab48
Author: Biju Das <biju.das.jz@bp.renesas.com>

phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support

This commit adds support for the RZ/G3L SoC to the phy-rcar-gen3-usb2 driver
by adding the "renesas,usb2-phy-r9a08g046" compatible string. The PHY data
configuration is shared with RZ/G3S.

> diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> index 9a45d840efeb2..d06fb52ed5f1b 100644
> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> @@ -721,6 +721,10 @@ static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
>  		.compatible = "renesas,usb2-phy-r9a08g045",
>  		.data = &rz_g3s_phy_usb2_data,
>  	},
> +	{
> +		.compatible = "renesas,usb2-phy-r9a08g046",
> +		.data = &rz_g3s_phy_usb2_data,
> +	},

[Severity: High]
This is a pre-existing issue, but since this patch exposes this hardware to 
existing code paths, I wanted to ask about a potential sleep-in-atomic bug.

When a user writes to the role sysfs attribute, role_store() acquires a
spinlock and disables interrupts:

drivers/phy/renesas/phy-rcar-gen3-usb2.c:role_store() {
    guard(spinlock_irqsave)(&ch->lock);
    ...
    if (!is_b_device)    /* A-Peripheral */
        rcar_gen3_init_from_a_peri_to_a_host(ch);
}

This calls down to rcar_gen3_enable_vbus_ctrl(), which then triggers the
regulator operations:

drivers/phy/renesas/phy-rcar-gen3-usb2.c:rcar_gen3_enable_vbus_ctrl() {
    ...
    if (ch->otg_internal_reg) {
        regulator_hardware_enable(ch->vbus, vbus);
        return;
    }

    if (ch->phy_data->no_adp_ctrl || ch->phy_data->vblvl_ctrl) {
        if (ch->vbus)
            regulator_hardware_enable(ch->vbus, vbus);
    ...
}

For SoCs using the internal regulator (such as RZ/G3L), the enable callback
invokes pm_runtime_resume_and_get():

drivers/phy/renesas/phy-rcar-gen3-usb2.c:rcar_gen3_phy_usb2_regulator_endisable() {
    ...
    ret = pm_runtime_resume_and_get(dev);
    ...
}

Can this sequence cause a panic? 

If the device state is RPM_SUSPENDING, pm_runtime_resume_and_get() might sleep
waiting for the asynchronous suspend to finish, but we are inside an atomic
section holding ch->lock with interrupts disabled.

Similarly, does the rcar_gen3_phy_usb2_irq() hardirq handler also reach
this regulator_hardware_enable() path on OTG plug/unplug events? If so,
would it hit the same sleep-in-atomic issue?

>  	{
>  		.compatible = "renesas,usb2-phy-r9a09g057",
>  		.data = &rz_v2h_phy_usb2_data,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260707143646.245177-1-biju.das.jz@bp.renesas.com?part=6

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-07-07 14:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 14:36 [PATCH v3 0/9] Add RZ/G3L USB2.0 host support Biju
2026-07-07 14:36 ` [PATCH v3 2/9] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3L PHY bindings Biju
2026-07-07 14:36 ` [PATCH v3 6/9] phy: renesas: phy-rcar-gen3-usb2: Add RZ/G3L support Biju
2026-07-07 14:51   ` sashiko-bot [this message]
2026-07-07 14:36 ` [PATCH v3 7/9] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator Biju
2026-07-07 15:01   ` sashiko-bot

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=20260707145129.137181F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=biju.das.au@gmail.com \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    --cc=wsa+renesas@sang-engineering.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