dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Karunika Choo" <karunika.choo@arm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v1 11/27] drm/panthor: Add AM_SYSTEM platform driver
Date: Tue, 22 Sep 2026 20:59:08 +0000	[thread overview]
Message-ID: <20260922205909.5648C1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922204535.2850094-12-karunika.choo@arm.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] gpu: out-of-bounds 64-bit access on 32-bit AM_SYS_IRQ registers
- [High] pm: missing clock re-enablement in panthor_system_suspend() error path
- [Medium] driver: missing MODULE_DEVICE_TABLE prevents module autoloading
- [Medium] pm: missing hibernation callbacks in panthor_system_pm_ops
--

commit c920f013092a669426d1524348fe769140c7f85d
Author: Karunika Choo <karunika.choo@arm.com>

drm/panthor: Add AM_SYSTEM platform driver

This commit introduces a small AM_SYSTEM platform driver for Mali v15 AM
systems. It provides GPU-wide control, managing shared clock and regulator
resources, and performs the initial GPU reset sequence during probe.

> diff --git a/drivers/gpu/drm/panthor/system/panthor_system_drv.c b/drivers/gpu/drm/panthor/system/panthor_system_drv.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/gpu/drm/panthor/system/panthor_system_drv.c
[ ... ]
> +static int __panthor_system_reset(struct panthor_system *sdev, u32 cmd)
> +{
> +	u64 val;
> +
> +	/* Clear stale RESET_COMPLETED IRQs before issuing reset */
> +	gpu_write64(sdev->iomem, AM_SYS_IRQ_CLEAR, AM_SYS_IRQ_RESET_COMPLETED);

[Severity: High]
Does this code perform an out-of-bounds access? The AM_SYS_IRQ registers
such as AM_SYS_IRQ_CLEAR (at 0x4C) appear to be 32-bit registers. Using
gpu_write64 splits the access across two 32-bit registers, which might
clobber the adjacent register at 0x50 with the upper 32 bits.

> +
> +	gpu_write(sdev->iomem, AM_SYS_COMMAND, cmd);
> +
> +	return read_poll_timeout(gpu_read64, val,
> +				 (val & AM_SYS_IRQ_RESET_COMPLETED),
> +				 AM_SYS_RESET_SLEEP_US, AM_RESET_TIMEOUT_US, false,
> +				 sdev->iomem, AM_SYS_IRQ_RAWSTAT);

[Severity: High]
Can this similarly cause unintended side-effects? AM_SYS_IRQ_RAWSTAT (at
0x40) is also a 32-bit register. Using gpu_read64 will read from both
0x40 and 0x44, which might not be safe for hardware registers.

> +}
> +
> +static int panthor_system_reset(struct panthor_system *sdev)
> +{
> +	int ret;
> +
> +	ret = __panthor_system_reset(sdev, AM_SYS_CMD_SOFT_RESET);
> +	if (ret) {
> +		dev_err(sdev->dev, "SOFT_RESET failed, attempting HARD_RESET");
> +
> +		ret = __panthor_system_reset(sdev, AM_SYS_CMD_HARD_RESET);
> +		if (ret) {
> +			dev_err(sdev->dev, "HARD_RESET failed");
> +			return -EIO;
> +		}
> +	}
> +
> +	gpu_write64(sdev->iomem, AM_SYS_IRQ_CLEAR, AM_SYS_IRQ_RESET_COMPLETED);

[Severity: High]
As mentioned above, should this use the 32-bit gpu_write instead of
gpu_write64 to avoid clobbering the register at 0x50?

> +
> +	return 0;
> +}
> +
> +static int panthor_system_suspend(struct device *dev)
> +{
> +	struct panthor_system *sdev = dev_get_drvdata(dev);
> +
> +	panthor_system_clk_suspend(sdev);
> +	return panthor_system_regulator_suspend(sdev);

[Severity: High]
What happens if the regulator suspension fails? The function will return
the error directly, but the clock has already been suspended. 

The PM core might interpret the error to mean the device is still in the
RPM_ACTIVE state, but the hardware is physically unclocked. Could this
cause bus faults or system crashes on subsequent accesses? 

Should the clock be re-enabled in the error path?

> +}
[ ... ]
> +static const struct dev_pm_ops panthor_system_pm_ops = {
> +	.suspend = pm_runtime_force_suspend,
> +	.resume = pm_runtime_force_resume,
> +	.runtime_suspend = panthor_system_suspend,
> +	.runtime_resume = panthor_system_resume,
> +};

[Severity: Medium]
Does this code handle hibernation correctly? The panthor_system_pm_ops
structure manually assigns .suspend and .resume but leaves the hibernation
callbacks (.freeze, .thaw, .poweroff, .restore) undefined. 

During system hibernation or hybrid sleep, the PM core might skip freezing
or restoring the device. Should this use DEFINE_RUNTIME_DEV_PM_OPS or
SYSTEM_SLEEP_PM_OPS to wire all required sleep callbacks?

> +
> +static const struct of_device_id panthor_system_dt_match[] = {
> +	{ .compatible = "arm,mali-gen5-am-system" },
> +	{}
> +};

[Severity: Medium]
Is the MODULE_DEVICE_TABLE declaration missing here? Without exporting
the match table via MODULE_DEVICE_TABLE(of, panthor_system_dt_match),
the module will not have the necessary aliases generated, which prevents
udev from automatically loading the module when the compatible hardware
is detected.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260922204535.2850094-1-karunika.choo@arm.com?part=11

  reply	other threads:[~2026-09-22 20:59 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 20:44 [PATCH v1 00/27] drm/panthor: Add Mali v15 virtualization support Karunika Choo
2026-09-22 20:44 ` [PATCH v1 01/27] drm/panthor: Ignore -EOPNOTSUPP for shader-present nvmem lookup Karunika Choo
2026-09-22 20:44 ` [PATCH v1 02/27] drm/panthor: Move register access helpers out of panthor_device.h Karunika Choo
2026-09-22 20:54   ` sashiko-bot
2026-09-22 20:44 ` [PATCH v1 03/27] drm/panthor: Parse and store GPU_ID fields Karunika Choo
2026-09-22 20:56   ` sashiko-bot
2026-09-22 20:44 ` [PATCH v1 04/27] drm/panthor: Add 64-bit GPU_ID decoding for v15 GPUs Karunika Choo
2026-09-22 21:01   ` sashiko-bot
2026-09-22 23:23   ` Deborah Brouwer
2026-09-22 20:44 ` [PATCH v1 05/27] drm/panthor: Move register base offsets to the HW description Karunika Choo
2026-09-22 20:45 ` [PATCH v1 06/27] drm/panthor: Derive MMU AS register addresses from base and stride Karunika Choo
2026-09-22 21:00   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 07/27] dt-bindings: gpu: mali-valhall-csf: Add Mali Gen5 AM compatible Karunika Choo
2026-09-28 10:02   ` Krzysztof Kozlowski
2026-09-22 20:45 ` [PATCH v1 08/27] drm/panthor: Add Mali v15 hardware support Karunika Choo
2026-09-22 20:58   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 09/27] drm/panthor: Skip devfreq when no OPP table is present Karunika Choo
2026-09-22 20:45 ` [PATCH v1 10/27] dt-bindings: gpu: panthor: Document panthor-system bindings Karunika Choo
2026-09-22 20:56   ` sashiko-bot
2026-09-28 10:05   ` Krzysztof Kozlowski
2026-09-22 20:45 ` [PATCH v1 11/27] drm/panthor: Add AM_SYSTEM platform driver Karunika Choo
2026-09-22 20:59   ` sashiko-bot [this message]
2026-09-22 20:45 ` [PATCH v1 12/27] dt-bindings: gpu: panthor: Document panthor-arbitration bindings Karunika Choo
2026-09-22 20:59   ` sashiko-bot
2026-09-28 10:06   ` Krzysztof Kozlowski
2026-09-22 20:45 ` [PATCH v1 13/27] drm/panthor: Add AM_PARTITION_CONTROL support Karunika Choo
2026-09-22 20:57   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 14/27] drm/panthor: Add AM message helpers Karunika Choo
2026-09-22 20:58   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 15/27] drm/panthor: Add AM_RESOURCE_GROUP support Karunika Choo
2026-09-22 20:56   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 16/27] drm/panthor: Add arbitration scheduler Karunika Choo
2026-09-22 21:00   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 17/27] drm/panthor: Route arbitration events Karunika Choo
2026-09-22 21:04   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 18/27] dt-bindings: gpu: panthor: Document AW assignment DT property Karunika Choo
2026-09-22 20:57   ` sashiko-bot
2026-09-28 10:06   ` Krzysztof Kozlowski
2026-09-22 20:45 ` [PATCH v1 19/27] drm/panthor: Add AW assignment tracking Karunika Choo
2026-09-22 20:45 ` [PATCH v1 20/27] drm/panthor: Handle partition control INVALID_COMMAND interrupt Karunika Choo
2026-09-22 21:04   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 21/27] drm/panthor: Request AW to yield GPU access on idle Karunika Choo
2026-09-22 21:07   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 22/27] drm/panthor: Add access-window support Karunika Choo
2026-09-22 21:05   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 23/27] drm/panthor: Synchronize HW component PM transitions Karunika Choo
2026-09-22 20:45 ` [PATCH v1 24/27] drm/panthor: Route HW component PM through access windows Karunika Choo
2026-09-22 21:06   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 25/27] drm/panthor: Tolerate access-window loss during HW waits Karunika Choo
2026-09-22 21:14   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 26/27] drm/panthor: Prevent missed post-yield cleanup due to reset Karunika Choo
2026-09-22 21:12   ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 27/27] drm/panthor: Release GPU access immediately for out-of-band grants Karunika Choo
2026-09-22 21:06   ` 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=20260922205909.5648C1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karunika.choo@arm.com \
    --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