mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

init() was removed from ramgp102 when reworking the memory detection, as
it was thought that the code was only necessary when the driver performs
mclk changes, which nouveau doesn't support on pascal.
However, it turns out that we still need to execute this on some GPUs to
restore settings after DEVINIT, so revert to the original behaviour.
v2: fix tags in commit message, cc stable
Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/319
Fixes: 2c0c15a22f
("drm/nouveau/fb/gp102-ga100: switch to simpler vram size detection method")
Cc: stable@vger.kernel.org # 6.6+
Signed-off-by: Ben Skeggs <bskeggs@nvidia.com>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240904232418.8590-1-bskeggs@nvidia.com
31 lines
733 B
C
31 lines
733 B
C
// SPDX-License-Identifier: MIT
|
|
#include "ram.h"
|
|
|
|
#include <subdev/bios.h>
|
|
|
|
static const struct nvkm_ram_func
|
|
gp102_ram = {
|
|
.init = gp100_ram_init,
|
|
};
|
|
|
|
int
|
|
gp102_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
|
|
{
|
|
enum nvkm_ram_type type = nvkm_fb_bios_memtype(fb->subdev.device->bios);
|
|
const u32 rsvd_head = ( 256 * 1024); /* vga memory */
|
|
const u32 rsvd_tail = (1024 * 1024); /* vbios etc */
|
|
u64 size = fb->func->vidmem.size(fb);
|
|
int ret;
|
|
|
|
ret = nvkm_ram_new_(&gp102_ram, fb, type, size, pram);
|
|
if (ret)
|
|
return ret;
|
|
|
|
nvkm_mm_fini(&(*pram)->vram);
|
|
|
|
return nvkm_mm_init(&(*pram)->vram, NVKM_RAM_MM_NORMAL,
|
|
rsvd_head >> NVKM_RAM_MM_SHIFT,
|
|
(size - rsvd_head - rsvd_tail) >> NVKM_RAM_MM_SHIFT,
|
|
1);
|
|
|
|
}
|