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 <[email protected]> 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/[email protected]?part=1
