Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'linux-3.17' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes

A couple of thinkos from the -next merge, some random fixes from a
coverity scan, fix for (at least) GK106 accidentally using
non-existent vram on some board configurations, and better behaviour
of the instmem allocations if vmalloc space runs out.

* 'linux-3.17' of git://anongit.freedesktop.org/git/nouveau/linux-2.6:
drm/nouveau/platform: fix compilation error
drm/nouveau/gk20a: add LTC device
drm/nouveau: warn if we fail to re-pin fb on resume
drm/nouveau/nvif: fix dac load detect method definition
drm/gf100-/gr: fix -ENOSPC detection when allocating zbc table entries
drm/nouveau/nvif: return null pointers on failure, in addition to ret != 0
drm/nouveau/ltc: fix tag base address getting truncated if above 4GiB
drm/nvc0-/fb/ram: fix use of non-existant ram if partitions aren't uniform
drm/nouveau/bar: behave better if ioremap failed
drm/nouveau/kms: nouveau_fbcon_accel_fini can be static
drm/nouveau: kill unused variable warning if !__OS_HAS_AGP
drm/nouveau/nvif: fix a number of notify thinkos

+57 -27
+2 -2
drivers/gpu/drm/nouveau/core/core/client.c
··· 132 132 if (ret == 0) { 133 133 client->notify[index] = notify; 134 134 notify->client = client; 135 - return 0; 135 + return index; 136 136 } 137 137 } 138 138 139 139 kfree(notify); 140 - return 0; 140 + return ret; 141 141 } 142 142 143 143 static int
+1
drivers/gpu/drm/nouveau/core/engine/device/nve0.c
··· 163 163 device->oclass[NVDEV_SUBDEV_BUS ] = nvc0_bus_oclass; 164 164 device->oclass[NVDEV_SUBDEV_TIMER ] = &gk20a_timer_oclass; 165 165 device->oclass[NVDEV_SUBDEV_FB ] = gk20a_fb_oclass; 166 + device->oclass[NVDEV_SUBDEV_LTC ] = gk104_ltc_oclass; 166 167 device->oclass[NVDEV_SUBDEV_IBUS ] = &gk20a_ibus_oclass; 167 168 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 168 169 device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass;
+6
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
··· 68 68 } 69 69 } 70 70 71 + if (zbc < 0) 72 + return zbc; 73 + 71 74 memcpy(priv->zbc_color[zbc].ds, ds, sizeof(priv->zbc_color[zbc].ds)); 72 75 memcpy(priv->zbc_color[zbc].l2, l2, sizeof(priv->zbc_color[zbc].l2)); 73 76 priv->zbc_color[zbc].format = format; ··· 111 108 zbc = (zbc < 0) ? i : zbc; 112 109 } 113 110 } 111 + 112 + if (zbc < 0) 113 + return zbc; 114 114 115 115 priv->zbc_depth[zbc].format = format; 116 116 priv->zbc_depth[zbc].ds = ds;
+1 -1
drivers/gpu/drm/nouveau/core/include/core/client.h
··· 14 14 void *data; 15 15 16 16 int (*ntfy)(const void *, u32, const void *, u32); 17 - struct nvkm_client_notify *notify[8]; 17 + struct nvkm_client_notify *notify[16]; 18 18 }; 19 19 20 20 static inline struct nouveau_client *
+11 -3
drivers/gpu/drm/nouveau/core/subdev/bar/base.c
··· 99 99 struct nouveau_mem *mem, struct nouveau_object **pobject) 100 100 { 101 101 struct nouveau_object *engine = nv_object(bar); 102 - return nouveau_object_ctor(parent, engine, &nouveau_barobj_oclass, 103 - mem, 0, pobject); 102 + int ret = -ENOMEM; 103 + if (bar->iomem) { 104 + ret = nouveau_object_ctor(parent, engine, 105 + &nouveau_barobj_oclass, 106 + mem, 0, pobject); 107 + } 108 + return ret; 104 109 } 105 110 106 111 int ··· 123 118 if (ret) 124 119 return ret; 125 120 126 - if (nv_device_resource_len(device, 3) != 0) 121 + if (nv_device_resource_len(device, 3) != 0) { 127 122 bar->iomem = ioremap(nv_device_resource_start(device, 3), 128 123 nv_device_resource_len(device, 3)); 124 + if (!bar->iomem) 125 + nv_warn(bar, "PRAMIN ioremap failed\n"); 126 + } 129 127 130 128 return 0; 131 129 }
+2 -2
drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c
··· 554 554 } else { 555 555 /* otherwise, address lowest common amount from 0GiB */ 556 556 ret = nouveau_mm_init(&pfb->vram, rsvd_head, 557 - (bsize << 8) * parts, 1); 557 + (bsize << 8) * parts - rsvd_head, 1); 558 558 if (ret) 559 559 return ret; 560 560 561 561 /* and the rest starting from (8GiB + common_size) */ 562 562 offset = (0x0200000000ULL >> 12) + (bsize << 8); 563 - length = (ram->size >> 12) - (bsize << 8) - rsvd_tail; 563 + length = (ram->size >> 12) - ((bsize * parts) << 8) - rsvd_tail; 564 564 565 565 ret = nouveau_mm_init(&pfb->vram, offset, length, 0); 566 566 if (ret)
+1 -1
drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
··· 156 156 if (ret) { 157 157 priv->num_tags = 0; 158 158 } else { 159 - u64 tag_base = (priv->tag_ram->offset << 12) + tag_margin; 159 + u64 tag_base = ((u64)priv->tag_ram->offset << 12) + tag_margin; 160 160 161 161 tag_base += tag_align - 1; 162 162 ret = do_div(tag_base, tag_align);
+1 -2
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 1228 1228 struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; 1229 1229 struct nouveau_drm *drm = nouveau_bdev(bdev); 1230 1230 struct nouveau_mem *node = mem->mm_node; 1231 - struct drm_device *dev = drm->dev; 1232 1231 int ret; 1233 1232 1234 1233 mem->bus.addr = NULL; ··· 1246 1247 if (drm->agp.stat == ENABLED) { 1247 1248 mem->bus.offset = mem->start << PAGE_SHIFT; 1248 1249 mem->bus.base = drm->agp.base; 1249 - mem->bus.is_iomem = !dev->agp->cant_use_aperture; 1250 + mem->bus.is_iomem = !drm->dev->agp->cant_use_aperture; 1250 1251 } 1251 1252 #endif 1252 1253 if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA || !node->memtype)
+3 -1
drivers/gpu/drm/nouveau/nouveau_display.c
··· 592 592 if (!nouveau_fb || !nouveau_fb->nvbo) 593 593 continue; 594 594 595 - nouveau_bo_pin(nouveau_fb->nvbo, TTM_PL_FLAG_VRAM); 595 + ret = nouveau_bo_pin(nouveau_fb->nvbo, TTM_PL_FLAG_VRAM); 596 + if (ret) 597 + NV_ERROR(drm, "Could not pin framebuffer\n"); 596 598 } 597 599 598 600 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+2 -2
drivers/gpu/drm/nouveau/nouveau_fbcon.c
··· 226 226 } 227 227 } 228 228 229 - void 229 + static void 230 230 nouveau_fbcon_accel_fini(struct drm_device *dev) 231 231 { 232 232 struct nouveau_drm *drm = nouveau_drm(dev); ··· 246 246 } 247 247 } 248 248 249 - void 249 + static void 250 250 nouveau_fbcon_accel_init(struct drm_device *dev) 251 251 { 252 252 struct nouveau_drm *drm = nouveau_drm(dev);
+2 -1
drivers/gpu/drm/nouveau/nouveau_platform.c
··· 149 149 static int nouveau_platform_remove(struct platform_device *pdev) 150 150 { 151 151 struct drm_device *drm_dev = platform_get_drvdata(pdev); 152 - struct nouveau_device *device = nouveau_dev(drm_dev); 152 + struct nouveau_drm *drm = nouveau_drm(drm_dev); 153 + struct nouveau_device *device = nvkm_device(&drm->device); 153 154 struct nouveau_platform_gpu *gpu = nv_device_to_platform(device)->gpu; 154 155 155 156 nouveau_drm_device_remove(drm_dev);
+2 -2
drivers/gpu/drm/nouveau/nvif/class.h
··· 428 428 struct nv50_disp_dac_load_v0 { 429 429 __u8 version; 430 430 __u8 load; 431 - __u16 data; 432 - __u8 pad04[4]; 431 + __u8 pad02[2]; 432 + __u32 data; 433 433 }; 434 434 435 435 struct nv50_disp_sor_pwr_v0 {
+20 -9
drivers/gpu/drm/nouveau/nvif/notify.c
··· 87 87 return 0; 88 88 } 89 89 90 + static inline int 91 + nvif_notify_func(struct nvif_notify *notify, bool keep) 92 + { 93 + int ret = notify->func(notify); 94 + if (ret == NVIF_NOTIFY_KEEP || 95 + !test_and_clear_bit(NVKM_NOTIFY_USER, &notify->flags)) { 96 + if (!keep) 97 + atomic_dec(&notify->putcnt); 98 + else 99 + nvif_notify_get_(notify); 100 + } 101 + return ret; 102 + } 103 + 90 104 static void 91 105 nvif_notify_work(struct work_struct *work) 92 106 { 93 107 struct nvif_notify *notify = container_of(work, typeof(*notify), work); 94 - if (notify->func(notify) == NVIF_NOTIFY_KEEP) 95 - nvif_notify_get_(notify); 108 + nvif_notify_func(notify, true); 96 109 } 97 110 98 111 int ··· 126 113 if (!WARN_ON(notify == NULL)) { 127 114 struct nvif_client *client = nvif_client(notify->object); 128 115 if (!WARN_ON(notify->size != size)) { 116 + atomic_inc(&notify->putcnt); 129 117 if (test_bit(NVIF_NOTIFY_WORK, &notify->flags)) { 130 - atomic_inc(&notify->putcnt); 131 118 memcpy((void *)notify->data, data, size); 132 119 schedule_work(&notify->work); 133 120 return NVIF_NOTIFY_DROP; 134 121 } 135 122 notify->data = data; 136 - ret = notify->func(notify); 123 + ret = nvif_notify_func(notify, client->driver->keep); 137 124 notify->data = NULL; 138 - if (ret != NVIF_NOTIFY_DROP && client->driver->keep) { 139 - atomic_inc(&notify->putcnt); 140 - nvif_notify_get_(notify); 141 - } 142 125 } 143 126 } 144 127 ··· 237 228 if (notify) { 238 229 int ret = nvif_notify_init(object, nvif_notify_del, func, work, 239 230 type, data, size, reply, notify); 240 - if (ret) 231 + if (ret) { 241 232 kfree(notify); 233 + notify = NULL; 234 + } 242 235 *pnotify = notify; 243 236 return ret; 244 237 }
+3 -1
drivers/gpu/drm/nouveau/nvif/object.c
··· 275 275 if (object) { 276 276 int ret = nvif_object_init(parent, nvif_object_del, handle, 277 277 oclass, data, size, object); 278 - if (ret) 278 + if (ret) { 279 279 kfree(object); 280 + object = NULL; 281 + } 280 282 *pobject = object; 281 283 return ret; 282 284 }