All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiaxing Hu" <gahing@gahingwoo.com>
Cc: robh@kernel.org, conor+dt@kernel.org,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org
Subject: Re: [RFC PATCH v3 6/6] arm64: dts: rockchip: rk3576-rock-4d: enable NPU
Date: Fri, 31 Jul 2026 04:51:42 +0000	[thread overview]
Message-ID: <20260731045142.7B6741F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260731043507.1832277-7-gahing@gahingwoo.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] Missing cleanup of `poll_timer` and `poll_work` in `rocket_job_fini()` leads to Use-After-Free on unload.
- [High] The driver statically requires 6 clocks for RK3576, causing inevitable probe failure for `rknn_core_1`.
- [Medium] Using `regulator-always-on` for the dedicated NPU regulator prevents runtime power savings and bypasses genpd management.
- [Low] Board-level DeviceTree overrides SoC-internal NPU power domain topology, violating DT schema bindings.
--

--- Patch [6]: [RFC PATCH v3 6/6] arm64: dts: rockchip: rk3576-rock-4d: enable NPU ---
commit 317571d0650068ec684ea45a47d155fe5e0ea20c
Author: Jiaxing Hu <gahing@gahingwoo.com>

arm64: dts: rockchip: rk3576-rock-4d: enable NPU

This commit enables rknn_core_0 and its IOMMU on the Radxa ROCK 4D. It
supplies the core from vdd_npu_s0 and assigns multiple NPU power domains
to the single NPU node.

> diff --git a/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts b/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts
> --- a/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts
[ ... ]
> @@ -442,6 +442,7 @@ regulator-state-mem {
>  			};
>  
>  			vdd_npu_s0: dcdc-reg2 {
> +				regulator-always-on;

[Severity: Medium]
Does setting regulator-always-on for the dedicated NPU regulator bypass 
the generic power domain management? It appears this will prevent the 
regulator from being powered down during runtime suspend, potentially 
wasting power when the accelerator is idle.

>  				regulator-boot-on;
>  				regulator-enable-ramp-delay = <400>;
[ ... ]
> +&rknn_core_0 {
> +	npu-supply = <&vdd_npu_s0>;
> +	/*
> +	 * Power BOTH NPU domains (NPU0 + NPU1) like the vendor's single NPU node,
> +	 * even though rocket computes only on core 0: the CBUF->CMAC read path is
> +	 * only fully powered with NPU1 up. rocket attaches the multi-PD list.
> +	 */
> +	power-domains = <&power RK3576_PD_NPU0>, <&power RK3576_PD_NPU1>;

[Severity: Low]
Will this board-level override cause a device tree schema validation 
failure? The rockchip,rk3588-rknn-core.yaml binding strictly enforces a 
maximum of 1 power domain:

Documentation/devicetree/bindings/npu/rockchip,rk3588-rknn-core.yaml:
  power-domains:
    maxItems: 1

[ ... ]

[Severity: High]
Does rocket_job_fini() in drivers/accel/rocket/rocket_job.c leave 
background polling active when the memory is freed?

drivers/accel/rocket/rocket_job.c:
void rocket_job_fini(struct rocket_core *core)

If the module is unloaded while a job is actively polling, the lack of 
hrtimer_cancel() and cancel_work_sync() calls could allow the timer or 
workqueue to execute against freed struct rocket_core memory, causing a 
use-after-free.

[Severity: High]
Will rknn_core_1 fail to probe on the RK3576 SoC due to a strict clock 
requirement?

drivers/accel/rocket/rocket_drv.c:rk3576_soc_data()
	.num_clks = 6,

drivers/accel/rocket/rocket_core.c:rocket_core_init()
	err = devm_clk_bulk_get(dev, core->soc->num_clks, core->clks);
	if (err)
		return dev_err_probe(dev, err, "failed to get clocks for core %d\n", core->index);

Because num_clks is statically defined as 6 for the entire SoC, and 
rknn_core_1 does not possess the aclk_cbuf and hclk_cbuf clocks, this bulk 
request will fail with -ENOENT when rknn_core_1 is enabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260731043507.1832277-1-gahing@gahingwoo.com?part=6

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

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  4:35 [RFC PATCH v3 0/6] accel/rocket: RK3576 NPU (RKNN) enablement Jiaxing Hu
2026-07-31  4:35 ` Jiaxing Hu
2026-07-31  4:35 ` [RFC PATCH v3 1/6] dt-bindings: npu: rockchip: add rockchip,rk3576-rknn-core Jiaxing Hu
2026-07-31  4:35   ` [RFC PATCH v3 1/6] dt-bindings: npu: rockchip: add rockchip, rk3576-rknn-core Jiaxing Hu
2026-07-31  4:35   ` [RFC PATCH v3 1/6] dt-bindings: npu: rockchip: add rockchip,rk3576-rknn-core Jiaxing Hu
2026-07-31  4:35 ` [RFC PATCH v3 2/6] pmdomain/rockchip: add optional per-domain power-on settle delay Jiaxing Hu
2026-07-31  4:35   ` Jiaxing Hu
2026-07-31  4:35 ` [RFC PATCH v3 3/6] pmdomain/rockchip: cycle optional power-domain resets on power-on Jiaxing Hu
2026-07-31  4:35   ` Jiaxing Hu
2026-07-31  4:50   ` sashiko-bot
2026-07-31  4:35 ` [RFC PATCH v3 4/6] accel/rocket: add RK3576 NPU (RKNN) support Jiaxing Hu
2026-07-31  4:35   ` Jiaxing Hu
2026-07-31  4:54   ` sashiko-bot
2026-07-31  4:35 ` [RFC PATCH v3 5/6] arm64: dts: rockchip: rk3576: add NPU (RKNN) nodes Jiaxing Hu
2026-07-31  4:35   ` Jiaxing Hu
2026-07-31  4:51   ` sashiko-bot
2026-07-31  4:35 ` [RFC PATCH v3 6/6] arm64: dts: rockchip: rk3576-rock-4d: enable NPU Jiaxing Hu
2026-07-31  4:35   ` Jiaxing Hu
2026-07-31  4:51   ` sashiko-bot [this message]

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=20260731045142.7B6741F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gahing@gahingwoo.com \
    --cc=robh@kernel.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.