* [PATCH] drm/nouveau/fb/ramnv50: Fixed DDR2 reclocking on NV50 architectures
@ 2026-11-24 20:58 ` Mahdi Salimi via B4 Relay
0 siblings, 0 replies; 3+ messages in thread
From: Mahdi Salimi @ 2026-11-24 20:58 UTC (permalink / raw)
To: Lyude Paul, Danilo Krummrich, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, nouveau, Jonathan Fouquart, Karol Herbst, Mahdi Salimi
From: Jonathan Fouquart <jfouquart@hotmail.fr>
Call nvkm_sddr2_calc when calculating the DDR2 memory clock frequency on
NV50 architectures. With this change, there are no more errors when
reclocking, the DDR2 memory frequency is correctly calculated, and there
are a performance gain of around 30% on glxgears.
Signed-off-by: Jonathan Fouquart <jfouquart@hotmail.fr>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/23
Tested-by: Mahdi Salimi <mahdisalimikingmallo@gmail.com>
Signed-off-by: Mahdi Salimi <mahdisalimikingmallo@gmail.com>
---
Forwarding Jonathan's reviewed patch from GitLab MR !23 as Lyude
requested. Tested on an NVIDIA G96 with DDR2 memory (reclocking works
without errors).
---
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
index be15519d0..d013a2fd2 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
@@ -288,6 +288,9 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq)
ram->base.mr[2] = ram_rd32(hwsq, mr[2]);
switch (ram->base.type) {
+ case NVKM_RAM_TYPE_DDR2:
+ ret = nvkm_sddr2_calc(&ram->base);
+ break;
case NVKM_RAM_TYPE_GDDR3:
ret = nvkm_gddr3_calc(&ram->base);
break;
---
base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
change-id: 20261125-ramnv50-ddr2-reclock-b30ca9d5eded
Best regards,
--
Mahdi Salimi <mahdisalimikingmallo@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] drm/nouveau/fb/ramnv50: Fixed DDR2 reclocking on NV50 architectures
@ 2026-11-24 20:58 ` Mahdi Salimi via B4 Relay
0 siblings, 0 replies; 3+ messages in thread
From: Mahdi Salimi via B4 Relay @ 2026-11-24 20:58 UTC (permalink / raw)
To: Lyude Paul, Danilo Krummrich, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: dri-devel, nouveau, Jonathan Fouquart, Karol Herbst, Mahdi Salimi
From: Jonathan Fouquart <jfouquart@hotmail.fr>
Call nvkm_sddr2_calc when calculating the DDR2 memory clock frequency on
NV50 architectures. With this change, there are no more errors when
reclocking, the DDR2 memory frequency is correctly calculated, and there
are a performance gain of around 30% on glxgears.
Signed-off-by: Jonathan Fouquart <jfouquart@hotmail.fr>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/23
Tested-by: Mahdi Salimi <mahdisalimikingmallo@gmail.com>
Signed-off-by: Mahdi Salimi <mahdisalimikingmallo@gmail.com>
---
Forwarding Jonathan's reviewed patch from GitLab MR !23 as Lyude
requested. Tested on an NVIDIA G96 with DDR2 memory (reclocking works
without errors).
---
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
index be15519d0..d013a2fd2 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
@@ -288,6 +288,9 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq)
ram->base.mr[2] = ram_rd32(hwsq, mr[2]);
switch (ram->base.type) {
+ case NVKM_RAM_TYPE_DDR2:
+ ret = nvkm_sddr2_calc(&ram->base);
+ break;
case NVKM_RAM_TYPE_GDDR3:
ret = nvkm_gddr3_calc(&ram->base);
break;
---
base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
change-id: 20261125-ramnv50-ddr2-reclock-b30ca9d5eded
Best regards,
--
Mahdi Salimi <mahdisalimikingmallo@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/nouveau/fb/ramnv50: Fixed DDR2 reclocking on NV50 architectures
2026-11-24 20:58 ` Mahdi Salimi via B4 Relay
(?)
@ 2026-11-24 21:06 ` sashiko-bot
-1 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-24 21:06 UTC (permalink / raw)
To: Mahdi Salimi; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/nouveau/fb: nv50_ram_calc() does not write calculated
DDR2 mr[0]
--
commit 2fb9a17101350a18953857e40ee356852e576655
Author: Jonathan Fouquart <jfouquart@hotmail.fr>
drm/nouveau/fb/ramnv50: Fixed DDR2 reclocking on NV50 architectures
This commit adds the NVKM_RAM_TYPE_DDR2 case to nv50_ram_calc() to call
nvkm_sddr2_calc() when calculating DDR2 mode register values during
memory reclocking.
Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/23
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
> index be15519d0c969..d013a2fd2b2e7 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
> @@ -288,6 +288,9 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq)
> ram->base.mr[2] = ram_rd32(hwsq, mr[2]);
>
> switch (ram->base.type) {
> + case NVKM_RAM_TYPE_DDR2:
> + ret = nvkm_sddr2_calc(&ram->base);
> + break;
> case NVKM_RAM_TYPE_GDDR3:
> ret = nvkm_gddr3_calc(&ram->base);
> break;
[Severity: Medium]
Should the second switch on ram->base.type in nv50_ram_calc() also write
ram->base.mr[0] to mr[0] for NVKM_RAM_TYPE_DDR2?
nvkm_sddr2_calc() updates the CL and WR fields in ram->base.mr[0], and
nv50_ram_calc() later writes ram->base.mr[1] and the new memory
controller timing registers, but the MR0 update for DDR2 still uses a
no-op mask:
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c:nv50_ram_calc() {
...
switch (ram->base.type) {
case NVKM_RAM_TYPE_DDR2:
ram_nuke(hwsq, mr[0]); /* force update */
ram_mask(hwsq, mr[0], 0x000, 0x000);
break;
case NVKM_RAM_TYPE_GDDR3:
ram_nuke(hwsq, mr[1]); /* force update */
ram_wr32(hwsq, mr[1], ram->base.mr[1]);
ram_nuke(hwsq, mr[0]); /* force update */
ram_wr32(hwsq, mr[0], ram->base.mr[0]);
break;
...
}
Because ram_mask(hwsq, mr[0], 0x000, 0x000) re-emits the pre-reclock
value cached in hwsq->r_mr[0].data rather than ram->base.mr[0],
reclocking between performance states with different CL or WR values
leaves the DDR2 chips programmed with the old MR0 timings while the
memory controller uses the new timings, which can corrupt VRAM or hang
the GPU.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-ramnv50-ddr2-reclock-v1-1-64f046c1c95d@gmail.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-24 21:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 20:58 [PATCH] drm/nouveau/fb/ramnv50: Fixed DDR2 reclocking on NV50 architectures Mahdi Salimi
2026-11-24 20:58 ` Mahdi Salimi via B4 Relay
2026-11-24 21:06 ` sashiko-bot
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.