From: Boris Brezillon <boris.brezillon@collabora.com>
To: Marek Vasut <marek.vasut@mailbox.org>
Cc: linux-arm-kernel@lists.infradead.org,
Conor Dooley <conor+dt@kernel.org>,
David Airlie <airlied@gmail.com>,
Fabio Estevam <festevam@gmail.com>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Liviu Dudau <liviu.dudau@arm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Philipp Zabel <p.zabel@pengutronix.de>,
Rob Herring <robh@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Sebastian Reichel <sre@kernel.org>,
Shawn Guo <shawnguo@kernel.org>, Simona Vetter <simona@ffwll.ch>,
Steven Price <steven.price@arm.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
imx@lists.linux.dev
Subject: Re: [PATCH v2 4/9] drm/panthor: Implement optional reset
Date: Thu, 4 Sep 2025 08:22:24 +0200 [thread overview]
Message-ID: <20250904082224.113d0cd1@fedora> (raw)
In-Reply-To: <838a0c6b-845b-428d-86b3-1480e5b8080f@mailbox.org>
Hello Marek,
On Wed, 3 Sep 2025 23:44:59 +0200
Marek Vasut <marek.vasut@mailbox.org> wrote:
> On 3/25/25 3:52 PM, Boris Brezillon wrote:
>
> Hello Boris,
>
> sorry for the late reply.
>
> >>>>>>> Hm, that might be the cause of the fast reset issue (which is a fast
> >>>>>>> resume more than a fast reset BTW): if you re-assert the reset line on
> >>>>>>> runtime suspend, I guess this causes a full GPU reset, and the MCU ends
> >>>>>>> up in a state where it needs a slow reset (all data sections reset to
> >>>>>>> their initial state). Can you try to move the reset_control_[de]assert
> >>>>>>> to the unplug/init functions?
> >>>>>> Is it correct to assume , that if I remove all reset_control_assert()
> >>>>>> calls (and keep only the _deassert() calls), the slow resume problem
> >>>>>> should go away too ?
> >>>>>
> >>>>> Yeah, dropping the _assert()s should do the trick.
> >>>> Hmmm, no, that does not help. I was hoping maybe NXP can chime in and
> >>>> suggest something too ?
> >>>
> >>> Can you try keep all the clks/regulators/power-domains/... on after
> >>> init, and see if the fast resume works with that. If it does,
> >>> re-introduce one resource at a time to find out which one causes the
> >>> MCU to lose its state.
> >>
> >> I already tried that too . I spent quite a while until I reached that L2
> >> workaround in fact.
> >
> > So, with your RPM suspend/resume being NOPs, it still doesn't work?
> > Unless the FW is doing something behind our back, I don't really see
> > why this would fail on your platform, but not on the rk3588. Are you
> > sure the power domains are kept on at all times. I'm asking, because if
> > you linked all the PDs, the on/off sequence is automatically handled by
> > the RPM core at suspend/resume time.
>
> I revisited this now.
>
> Can you please test the following patch (also attached) on one of your
> devices, and tell me what the status is at the end . The diff sets the
> GLB_HALT bit and then clears it again, which I suspect should first halt
> the GPU and (this is what I am unsure about) then again un-halt/resume
> the GPU ?
It doesn't work like that. What you're describing is like executing
"shutdown" on your terminal and then typing "boot" on the keyboard
after your computer has been shut down.
>
> "
> diff --git a/drivers/gpu/drm/panthor/panthor_fw.c
> b/drivers/gpu/drm/panthor/panthor_fw.c
> index 9bf06e55eaeea..57c0d4fd29aa2 100644
> --- a/drivers/gpu/drm/panthor/panthor_fw.c
> +++ b/drivers/gpu/drm/panthor/panthor_fw.c
> @@ -1087,8 +1087,16 @@ void panthor_fw_pre_reset(struct panthor_device
> *ptdev, bool on_hang)
> struct panthor_fw_global_iface *glb_iface =
> panthor_fw_get_glb_iface(ptdev);
> u32 status;
>
> +pr_err("%s[%d] pre-halt status=%x\n", __func__, __LINE__,
> gpu_read(ptdev, MCU_STATUS));
> +
> panthor_fw_update_reqs(glb_iface, req, GLB_HALT, GLB_HALT);
> gpu_write(ptdev, CSF_DOORBELL(CSF_GLB_DOORBELL_ID), 1);
> +mdelay(100);
> +pr_err("%s[%d] likely-halted status=%x\n", __func__, __LINE__,
> gpu_read(ptdev, MCU_STATUS));
> + panthor_fw_update_reqs(glb_iface, req, 0, GLB_HALT);
> +mdelay(100);
> +pr_err("%s[%d] likely-running ? status=%x\n", __func__, __LINE__,
> gpu_read(ptdev, MCU_STATUS));
> +
> if (!gpu_read_poll_timeout(ptdev, MCU_STATUS, status,
> status == MCU_STATUS_HALT, 10,
> 100000)) {
> "
>
> In my case, the relevant output looks like this:
>
> "
> [ 3.326805] panthor_fw_pre_reset[1090] pre-halt status=1
> [ 3.432151] panthor_fw_pre_reset[1095] likely-halted status=2
> [ 3.542179] panthor_fw_pre_reset[1098] likely-running ? status=2
> "
>
> That means, the GPU remains halted at the end, even if the "GLB_HALT"
> bit is cleared before the last print. The clearing of GLB_HALT is also
> what panthor_fw_post_reset() does.
After the halt has been processed by the FW, the memory region where
you check the halt status again is inert, since the micro-controller
(MCU) supposed to update those bits is off at this point. The FW
interface is really just a shared memory region between the CPU and
MCU, nothing more.
>
> I suspect the extra soft reset I did before "un-halted" the GPU and
> allowed it to proceed.
Hm, not quite. I mean, you still need to explicitly boot the MCU after
a reset, which is what the write to MCU_CONTROL [1] does. What the
soft-reset does though, is reset all GPU blocks, including the MCU.
This means the MCU starts from a fresh state when you reach [1].
If I had to guess, I'd say something is messed up when the GPU is
halted, and you need a soft-reset to recover from that. Unfortunately,
I don't know enough about what your FW is doing to help. Maybe
Arm/Freescale could...
>
> I wonder if there is some way to un-halt the GPU using some gpu_write()
> direct register access, is there ?
That's MCU_CONTROL, yes. And it's done here [1] already.
> Maybe the GPU remains halted because
> setting the GLB_HALT stops command stream processing, and the GPU never
> samples the clearing of GLB_HALT and therefore remains halted forever ?
Exactly that, and that's expected.
Regards,
Boris
[1]https://elixir.bootlin.com/linux/v6.16.4/source/drivers/gpu/drm/panthor/panthor_fw.c#L1034
next prev parent reply other threads:[~2025-09-04 6:22 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 20:05 [PATCH v2 0/9] arm64: dts: imx95: Add support for Mali G310 GPU Marek Vasut
2025-03-21 20:05 ` [PATCH v2 1/9] dt-bindings: reset: imx95-gpu-blk-ctrl: Document Freescale i.MX95 GPU reset Marek Vasut
2025-03-21 21:40 ` Rob Herring (Arm)
2025-03-21 20:05 ` [PATCH v2 2/9] reset: simple: Add support for " Marek Vasut
2025-03-21 20:05 ` [PATCH v2 3/9] dt-bindings: gpu: mali-valhall-csf: Document optional reset Marek Vasut
2025-04-03 12:53 ` Liviu Dudau
2025-03-21 20:05 ` [PATCH v2 4/9] drm/panthor: Implement " Marek Vasut
2025-03-24 8:43 ` Boris Brezillon
2025-03-24 19:05 ` Marek Vasut
2025-03-25 14:12 ` Philipp Zabel
2025-03-25 14:27 ` Marek Vasut
2025-03-25 15:00 ` Philipp Zabel
2025-03-24 23:37 ` Marek Vasut
2025-03-25 7:43 ` Boris Brezillon
2025-03-25 13:50 ` Marek Vasut
2025-03-25 14:35 ` Boris Brezillon
2025-03-25 14:37 ` Marek Vasut
2025-03-25 14:52 ` Boris Brezillon
2025-09-03 21:44 ` Marek Vasut
2025-09-04 6:22 ` Boris Brezillon [this message]
2025-09-04 6:36 ` Alexander Stein
2025-09-04 13:52 ` Marek Vasut
2025-09-04 14:39 ` Alexander Stein
2025-09-04 14:46 ` Marek Vasut
2025-09-04 13:49 ` Marek Vasut
2025-09-04 14:04 ` Boris Brezillon
2025-09-04 14:54 ` Marek Vasut
2025-09-04 15:20 ` Boris Brezillon
2025-09-04 15:29 ` Marek Vasut
2025-09-16 10:06 ` Rain Yang
2025-09-16 17:34 ` Marek Vasut
2025-09-17 1:49 ` Rain Yang
2025-09-17 2:17 ` Marek Vasut
2025-09-17 14:18 ` Rain Yang
2025-09-25 20:41 ` Marek Vasut
2025-09-26 9:18 ` Rain Yang
2025-09-26 13:32 ` Marek Vasut
2025-09-28 8:24 ` Rain Yang
2025-09-28 16:56 ` Marek Vasut
2025-03-21 20:05 ` [PATCH v2 5/9] drm/panthor: Implement support for multiple power domains Marek Vasut
2025-03-26 15:07 ` Steven Price
2025-03-21 20:05 ` [PATCH v2 6/9] drm/panthor: Reset GPU after L2 cache power off Marek Vasut
2025-03-21 20:05 ` [PATCH v2 7/9] dt-bindings: gpu: mali-valhall-csf: Document i.MX95 support Marek Vasut
2025-03-24 16:31 ` Rob Herring (Arm)
2025-03-21 20:05 ` [PATCH v2 8/9] drm/panthor: Add " Marek Vasut
2025-03-21 20:05 ` [PATCH v2 9/9] arm64: dts: imx95: Describe Mali G310 GPU Marek Vasut
2025-03-24 7:02 ` Alexander Stein
2025-03-24 23:35 ` Marek Vasut
2025-03-25 7:00 ` Alexander Stein
2025-09-04 9:54 ` Peng Fan
2025-09-04 13:22 ` Marek Vasut
2025-09-09 0:52 ` Peng Fan
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=20250904082224.113d0cd1@fedora \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marek.vasut@mailbox.org \
--cc=mripard@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=simona@ffwll.ch \
--cc=sre@kernel.org \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
/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