DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Linus Walleij" <linusw@kernel.org>
Cc: dmaengine@vger.kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Frank.Li@kernel.org, vkoul@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 14/18] misc: sram: Enable runtime PM
Date: Sun, 20 Sep 2026 23:02:21 +0000	[thread overview]
Message-ID: <20260920230221.A79471F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260921-ux500-power-domains-v7-1-v3-14-9352be6b86b1@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] misc: sram: Missing pm_runtime_get_sync() in sysfs read/write paths
- [Medium] misc: sram: Hardware initialization is not restored after runtime resume
--

commit b2dc9fd44cd639efd34dbecb064c4f1f3097e1eb
Author: Linus Walleij <linusw@kernel.org>

    misc: sram: Enable runtime PM
    
    Enable runtime PM for generic SRAM devices after probe has initialized
    the SRAM mappings and partitions.
    
    This lets SRAM devices with attached power domains be managed through
    runtime PM references from their consumers.

> diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
> index c8990e83a65a2..7f19dca7b818e 100644
> --- a/drivers/misc/sram.c
> +++ b/drivers/misc/sram.c

[ ... ]

> @@ -425,6 +426,10 @@ static int sram_probe(struct platform_device *pdev)
>  			goto err_free_partitions;
>  	}
>  
> +	ret = devm_pm_runtime_set_active_enabled(&pdev->dev);

[Severity: High]
Does this code allow sysfs read/write paths to access unpowered MMIO hardware?

Since runtime PM is now enabled, the SRAM device can be suspended by its
attached power domain. If userspace accesses the exported sysfs bin
attributes, sram_read() and sram_write() perform MMIO accesses without
waking the device:

drivers/misc/sram.c:sram_read() {
	...
	mutex_lock(&part->lock);
	memcpy_fromio(buf, part->base + pos, count);
	mutex_unlock(&part->lock);
	...
}

Will this cause an asynchronous external abort and crash the system if the
hardware is accessed while suspended?

[Severity: Medium]
Will hardware state be lost and not restored on resume?

Earlier in sram_probe(), hardware initialization is performed:

drivers/misc/sram.c:sram_probe() {
	...
	if (config && config->init) {
		ret = config->init();
	...
}

If the device is attached to a PM domain that powers it down, waking it up
will turn on the power but will not re-apply the config->init() callback
(such as atmel_securam_wait) because the driver lacks a runtime_resume
callback.

Can this lead to hardware faults or data corruption if the RAM is accessed
before it is ready?

> +	if (ret)
> +		goto err_free_partitions;
> +
>  	if (sram->pool)
>  		dev_dbg(sram->dev, "SRAM pool: %zu KiB @ 0x%p\n",
>  			gen_pool_size(sram->pool) / 1024, sram->virt_base);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921-ux500-power-domains-v7-1-v3-0-9352be6b86b1@kernel.org?part=14

  reply	other threads:[~2026-09-20 23:02 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20 22:48 [PATCH v3 00/18] pmdomain: st: ux500: Implement ux500 power domains Linus Walleij
2026-09-20 22:48 ` [PATCH v3 01/18] dt-bindings: power: Convert Ux500 PM domains to schema Linus Walleij
2026-09-28  5:37   ` Krzysztof Kozlowski
2026-09-20 22:48 ` [PATCH v3 02/18] dt-bindings: arm: ux500: Drop NR_DOMAINS Linus Walleij
2026-09-20 22:48 ` [PATCH v3 03/18] dt-bindings: arm: Add the actual power domains on U8500 Linus Walleij
2026-09-20 22:48 ` [PATCH v3 04/18] dt-bindings: mfd: db8500-prcmu: Deprecate EPOD regulators Linus Walleij
2026-09-20 22:48 ` [PATCH v3 05/18] dt-bindings: display: ste,mcde: Allow power domains Linus Walleij
2026-10-08 17:41   ` Rob Herring
2026-09-20 22:48 ` [PATCH v3 06/18] pmdomain: st: ux500: Implement more " Linus Walleij
2026-09-20 22:48 ` [PATCH v3 07/18] ARM: dts: ux500: Rename power domains node Linus Walleij
2026-09-20 22:48 ` [PATCH v3 08/18] dt-bindings: clock: stericsson,u8500-clks: Allow power domains Linus Walleij
2026-09-20 22:48 ` [PATCH v3 09/18] dt-bindings: timer: arm,twd-timer: " Linus Walleij
2026-09-20 22:48 ` [PATCH v3 10/18] dt-bindings: watchdog: arm,twd-wdt: " Linus Walleij
2026-09-20 22:48 ` [PATCH v3 11/18] ARM: dts: ux500: Add " Linus Walleij
2026-09-20 23:04   ` sashiko-bot
2026-09-20 22:48 ` [PATCH v3 12/18] pmdomain: st: ux500: Control DB8500 EPODs Linus Walleij
2026-09-20 23:04   ` sashiko-bot
2026-09-24 13:44   ` Ulf Hansson
2026-09-20 22:48 ` [PATCH v3 13/18] drm/mcde: Use power domain for display power Linus Walleij
2026-09-20 22:58   ` sashiko-bot
2026-09-20 22:48 ` [PATCH v3 14/18] misc: sram: Enable runtime PM Linus Walleij
2026-09-20 23:02   ` sashiko-bot [this message]
2026-09-20 22:48 ` [PATCH v3 15/18] dmaengine: ste_dma40: Use power domain for LCLA SRAM Linus Walleij
2026-09-20 23:03   ` sashiko-bot
2026-09-21 16:36   ` Frank Li
2026-09-24 13:26   ` Ulf Hansson
2026-09-30 20:15     ` Frank Li
2026-10-06 13:21     ` Vinod Koul
2026-09-20 22:48 ` [PATCH v3 16/18] mfd/regulator: db8500-prcmu: Remove EPOD regulators Linus Walleij
2026-09-20 22:48 ` [PATCH v3 17/18] dt-bindings: display: ste,mcde: Deprecate EPOD supply Linus Walleij
2026-09-20 23:00   ` sashiko-bot
2026-09-20 22:48 ` [PATCH v3 18/18] ARM: dts: ux500: Remove DB8500 EPOD regulators Linus Walleij
2026-09-20 23:05   ` sashiko-bot
2026-09-21  7:06     ` Linus Walleij
2026-10-06 10:30 ` [PATCH v3 00/18] pmdomain: st: ux500: Implement ux500 power domains 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=20260920230221.A79471F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linusw@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /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