drm/nvc0-/fb/ram: fix use of non-existant ram if partitions aren't uniform
authorBen Skeggs <bskeggs@redhat.com>
Mon, 11 Aug 2014 23:17:41 +0000 (09:17 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 14 Aug 2014 21:58:38 +0000 (07:58 +1000)
Likely a large part of the GK106 woes..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c

index 946518572346adf5d6cc0675c11552300308c8b2..2b284b19276330aabd6b584c55b21eb727232662 100644 (file)
@@ -554,13 +554,13 @@ nvc0_ram_create_(struct nouveau_object *parent, struct nouveau_object *engine,
        } else {
                /* otherwise, address lowest common amount from 0GiB */
                ret = nouveau_mm_init(&pfb->vram, rsvd_head,
-                                     (bsize << 8) * parts, 1);
+                                     (bsize << 8) * parts - rsvd_head, 1);
                if (ret)
                        return ret;
 
                /* and the rest starting from (8GiB + common_size) */
                offset = (0x0200000000ULL >> 12) + (bsize << 8);
-               length = (ram->size >> 12) - (bsize << 8) - rsvd_tail;
+               length = (ram->size >> 12) - ((bsize * parts) << 8) - rsvd_tail;
 
                ret = nouveau_mm_init(&pfb->vram, offset, length, 0);
                if (ret)