drm/nouveau/fb/ram: Use Kepler implementation on Maxwell
authorKarol Herbst <karolherbst@gmail.com>
Sun, 17 Jul 2016 19:36:49 +0000 (21:36 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 12 Oct 2016 07:29:28 +0000 (17:29 +1000)
This enables memory reclocking on Maxwell. Sadly without a PMU firmware it
is useless for gm20x gpus.

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.h
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgm107.c

index b9ec0ae6723ad1c71b93802c50236d27d0bc12bc..b60068b7d8f93c271aee7b3ce0218dcb4835cabc 100644 (file)
@@ -24,6 +24,7 @@ int  gf100_ram_ctor(const struct nvkm_ram_func *, struct nvkm_fb *,
 int  gf100_ram_get(struct nvkm_ram *, u64, u32, u32, u32, struct nvkm_mem **);
 void gf100_ram_put(struct nvkm_ram *, struct nvkm_mem **);
 
+int  gk104_ram_ctor(struct nvkm_fb *, struct nvkm_ram **, u32);
 int  gk104_ram_init(struct nvkm_ram *ram);
 
 /* RAM type-specific MR calculation routines */
index 93b30d92776cc840f36e917bf6471db3578e32e3..7904fa41acef66aa86bbbe23e33cc83da160fc12 100644 (file)
@@ -1537,6 +1537,12 @@ gk104_ram_func = {
 
 int
 gk104_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
+{
+       return gk104_ram_ctor(fb, pram, 0x022554);
+}
+
+int
+gk104_ram_ctor(struct nvkm_fb *fb, struct nvkm_ram **pram, u32 maskaddr)
 {
        struct nvkm_subdev *subdev = &fb->subdev;
        struct nvkm_device *device = subdev->device;
@@ -1552,7 +1558,7 @@ gk104_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
                return -ENOMEM;
        *pram = &ram->base;
 
-       ret = gf100_ram_ctor(&gk104_ram_func, fb, 0x022554, &ram->base);
+       ret = gf100_ram_ctor(&gk104_ram_func, fb, maskaddr, &ram->base);
        if (ret)
                return ret;
 
index 43d807f6ca7185f5851df5d01cda622acf70af5b..ac862d1d77bd6a75f9eac253fd8a068e680af32c 100644 (file)
  */
 #include "ram.h"
 
-static const struct nvkm_ram_func
-gm107_ram_func = {
-       .init = gk104_ram_init,
-       .get = gf100_ram_get,
-       .put = gf100_ram_put,
-};
-
 int
 gm107_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
 {
-       if (!(*pram = kzalloc(sizeof(**pram), GFP_KERNEL)))
-               return -ENOMEM;
-
-       return gf100_ram_ctor(&gm107_ram_func, fb, 0x021c14, *pram);
+       return gk104_ram_ctor(fb, pram, 0x021c14);
 }