From: "Maíra Canal" <mcanal@igalia.com>
To: Stefan Wahren <wahrenst@gmx.net>, Melissa Wen <mwen@igalia.com>,
Iago Toral <itoral@igalia.com>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Nicolas Saenz Julienne <nsaenz@kernel.org>,
Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Phil Elwell <phil@raspberrypi.com>,
dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
kernel-dev@igalia.com
Subject: Re: [PATCH v6 5/5] drm/v3d: Use V3D_SMS registers for power on/off and reset on V3D 7.x
Date: Thu, 27 Mar 2025 10:52:38 -0300 [thread overview]
Message-ID: <f85dc2d3-a601-4caf-9ddb-c3256423f001@igalia.com> (raw)
In-Reply-To: <bffb4df1-1171-4a9b-9b73-af33136c620a@gmx.net>
Hi Stefan,
On 27/03/25 07:57, Stefan Wahren wrote:
> Hi Maíra,
>
> Am 18.03.25 um 02:01 schrieb Maíra Canal:
>> In addition to the standard reset controller, V3D 7.x requires
>> configuring
>> the V3D_SMS registers for proper power on/off and reset. Add the new
>> registers to `v3d_regs.h` and ensure they are properly configured during
>> device probing, removal, and reset.
>>
>> This change fixes GPU reset issues on the Raspberry Pi 5 (BCM2712).
>> Without exposing these registers, a GPU reset causes the GPU to hang,
>> stopping any further job execution and freezing the desktop GUI. The same
>> issue occurs when unloading and loading the v3d driver.
>>
>> Link: https://github.com/raspberrypi/linux/issues/6660
>> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
>> Signed-off-by: Maíra Canal <mcanal@igalia.com>
>> ---
>> drivers/gpu/drm/v3d/v3d_drv.c | 40 ++++++++++++++++++++++++++++++++
>> ++++++++
>> drivers/gpu/drm/v3d/v3d_drv.h | 11 +++++++++++
>> drivers/gpu/drm/v3d/v3d_gem.c | 17 +++++++++++++++++
>> drivers/gpu/drm/v3d/v3d_regs.h | 26 ++++++++++++++++++++++++++
>> 4 files changed, 94 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/
>> v3d_drv.c
>> index
>> c63f0ed1bd8a3d5511085e76ed2fbd6ee7df6f80..122848cdccc4a02039d9ea2e77aa2f377886b5d6 100644
>> --- a/drivers/gpu/drm/v3d/v3d_drv.c
>> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
>> @@ -263,6 +263,36 @@ static const struct of_device_id v3d_of_match[] = {
>> };
>> MODULE_DEVICE_TABLE(of, v3d_of_match);
>>
>> +static void
>> +v3d_idle_sms(struct v3d_dev *v3d)
>> +{
>> + if (v3d->ver < V3D_GEN_71)
>> + return;
>> +
>> + V3D_SMS_WRITE(V3D_SMS_TEE_CS, V3D_SMS_CLEAR_POWER_OFF);
>> +
>> + if (wait_for((V3D_GET_FIELD(V3D_SMS_READ(V3D_SMS_TEE_CS),
>> + V3D_SMS_STATE) == V3D_SMS_IDLE), 100)) {
>> + DRM_ERROR("Failed to power up SMS\n");
>> + }
>> +
>> + v3d_reset_sms(v3d);
>> +}
>> +
>> +static void
>> +v3d_power_off_sms(struct v3d_dev *v3d)
>> +{
>> + if (v3d->ver < V3D_GEN_71)
>> + return;
>> +
>> + V3D_SMS_WRITE(V3D_SMS_TEE_CS, V3D_SMS_POWER_OFF);
>> +
>> + if (wait_for((V3D_GET_FIELD(V3D_SMS_READ(V3D_SMS_TEE_CS),
>> + V3D_SMS_STATE) == V3D_SMS_POWER_OFF_STATE), 100)) {
>> + DRM_ERROR("Failed to power off SMS\n");
>> + }
>> +}
>> +
>> static int
>> map_regs(struct v3d_dev *v3d, void __iomem **regs, const char *name)
>> {
>> @@ -300,6 +330,12 @@ static int v3d_platform_drm_probe(struct
>> platform_device *pdev)
>> if (ret)
>> return ret;
>>
>> + if (v3d->ver >= V3D_GEN_71) {
>> + ret = map_regs(v3d, &v3d->sms_regs, "sms");
>> + if (ret)
>> + return ret;
> Is it correct, that BCM2712 now requires the SMS register and otherwise
> the driver doesn't probe?
Hum, yeah, it is correct, but I can send a patch to ensure backwards
compatibility. But keep in mind that you won't be able to reset the GPU
or unload/load (power on/off).
>
> Just a note for the future: the devicetree is considered as an ABI [1],
> so new kernels should still work with old DTB (no regression). For
> Raspberry Pi OS, the kernel and DTB are always updated, but this doesn't
> apply for Linux Mainline. AFAIK V3D doesn't work with Linux Mainline on
> Raspberry Pi 5 yet, so this is just a theoretical problem.
Yeah, I had that in mind, but due to the reason pointed in the end of
your comment, it was okay to do so and ensure that reset and power on/
off will work when RPi 5 reach upstream support.
But, I'm open to send a patch removing the requirement.
Best Regards,
- Maíra
>
> Best regards
>
> [1] - https://docs.kernel.org/devicetree/bindings/ABI.html
next prev parent reply other threads:[~2025-03-27 13:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 1:01 [PATCH v6 0/5] drm/v3d: Fix GPU reset issues on the Raspberry Pi 5 Maíra Canal
2025-03-18 1:01 ` [PATCH v6 1/5] drm/v3d: Associate a V3D tech revision to all supported devices Maíra Canal
2025-03-18 16:44 ` Stefan Wahren
2025-03-18 20:03 ` kernel test robot
2025-03-18 1:01 ` [PATCH v6 2/5] dt-bindings: gpu: v3d: Add per-compatible register restrictions Maíra Canal
2025-03-18 8:03 ` Krzysztof Kozlowski
2025-03-18 1:01 ` [PATCH v6 3/5] dt-bindings: gpu: v3d: Add SMS register to BCM2712 compatible Maíra Canal
2025-03-19 11:07 ` Stefan Wahren
2025-03-18 1:01 ` [PATCH v6 4/5] dt-bindings: gpu: v3d: Add V3D driver maintainer as DT maintainer Maíra Canal
2025-03-18 1:01 ` [PATCH v6 5/5] drm/v3d: Use V3D_SMS registers for power on/off and reset on V3D 7.x Maíra Canal
2025-03-27 10:57 ` Stefan Wahren
2025-03-27 13:52 ` Maíra Canal [this message]
2025-03-27 15:19 ` Stefan Wahren
2025-03-23 14:45 ` [PATCH v6 0/5] drm/v3d: Fix GPU reset issues on the Raspberry Pi 5 Maíra Canal
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=f85dc2d3-a601-4caf-9ddb-c3256423f001@igalia.com \
--to=mcanal@igalia.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=florian.fainelli@broadcom.com \
--cc=itoral@igalia.com \
--cc=kernel-dev@igalia.com \
--cc=krzk+dt@kernel.org \
--cc=mwen@igalia.com \
--cc=nsaenz@kernel.org \
--cc=phil@raspberrypi.com \
--cc=wahrenst@gmx.net \
/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