nouveau_abi16.c 15.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * Copyright 2012 Red Hat Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 */

24 25 26
#include <nvif/client.h>
#include <nvif/driver.h>
#include <nvif/ioctl.h>
27
#include <nvif/class.h>
28
#include <nvif/cl0002.h>
29
#include <nvif/cla06f.h>
30
#include <nvif/unpack.h>
31

32
#include "nouveau_drv.h"
33
#include "nouveau_dma.h"
34 35
#include "nouveau_gem.h"
#include "nouveau_chan.h"
36
#include "nouveau_abi16.h"
37

38 39
static struct nouveau_abi16 *
nouveau_abi16(struct drm_file *file_priv)
40 41 42 43 44 45
{
	struct nouveau_cli *cli = nouveau_cli(file_priv);
	if (!cli->abi16) {
		struct nouveau_abi16 *abi16;
		cli->abi16 = abi16 = kzalloc(sizeof(*abi16), GFP_KERNEL);
		if (cli->abi16) {
46 47 48 49
			struct nv_device_v0 args = {
				.device = ~0ULL,
			};

50 51 52 53 54 55
			INIT_LIST_HEAD(&abi16->channels);

			/* allocate device object targeting client's default
			 * device (ie. the one that belongs to the fd it
			 * opened)
			 */
56
			if (nvif_device_init(&cli->base.object, 0, NV_DEVICE,
57
					     &args, sizeof(args),
58
					     &abi16->device) == 0)
59 60 61 62 63 64 65 66 67
				return cli->abi16;

			kfree(cli->abi16);
			cli->abi16 = NULL;
		}
	}
	return cli->abi16;
}

68 69 70 71 72 73 74 75 76 77 78
struct nouveau_abi16 *
nouveau_abi16_get(struct drm_file *file_priv)
{
	struct nouveau_cli *cli = nouveau_cli(file_priv);
	mutex_lock(&cli->mutex);
	if (nouveau_abi16(file_priv))
		return cli->abi16;
	mutex_unlock(&cli->mutex);
	return NULL;
}

79 80 81
int
nouveau_abi16_put(struct nouveau_abi16 *abi16, int ret)
{
82
	struct nouveau_cli *cli = (void *)abi16->device.object.client;
83 84 85 86
	mutex_unlock(&cli->mutex);
	return ret;
}

87
s32
88 89
nouveau_abi16_swclass(struct nouveau_drm *drm)
{
90 91
	switch (drm->device.info.family) {
	case NV_DEVICE_INFO_V0_TNT:
92
		return NVIF_CLASS_SW_NV04;
93 94 95 96
	case NV_DEVICE_INFO_V0_CELSIUS:
	case NV_DEVICE_INFO_V0_KELVIN:
	case NV_DEVICE_INFO_V0_RANKINE:
	case NV_DEVICE_INFO_V0_CURIE:
97
		return NVIF_CLASS_SW_NV10;
98
	case NV_DEVICE_INFO_V0_TESLA:
99
		return NVIF_CLASS_SW_NV50;
100 101 102
	case NV_DEVICE_INFO_V0_FERMI:
	case NV_DEVICE_INFO_V0_KEPLER:
	case NV_DEVICE_INFO_V0_MAXWELL:
103
	case NV_DEVICE_INFO_V0_PASCAL:
104
		return NVIF_CLASS_SW_GF100;
105 106 107 108 109 110 111 112 113
	}

	return 0x0000;
}

static void
nouveau_abi16_ntfy_fini(struct nouveau_abi16_chan *chan,
			struct nouveau_abi16_ntfy *ntfy)
{
114
	nvif_object_fini(&ntfy->object);
115
	nvkm_mm_free(&chan->heap, &ntfy->node);
116 117 118 119 120 121 122 123 124 125
	list_del(&ntfy->head);
	kfree(ntfy);
}

static void
nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
			struct nouveau_abi16_chan *chan)
{
	struct nouveau_abi16_ntfy *ntfy, *temp;

126 127 128 129 130
	/* wait for all activity to stop before releasing notify object, which
	 * may be still in use */
	if (chan->chan && chan->ntfy)
		nouveau_channel_idle(chan->chan);

131 132 133 134 135 136 137
	/* cleanup notifier state */
	list_for_each_entry_safe(ntfy, temp, &chan->notifiers, head) {
		nouveau_abi16_ntfy_fini(chan, ntfy);
	}

	if (chan->ntfy) {
		nouveau_bo_vma_del(chan->ntfy, &chan->ntfy_vma);
138
		nouveau_bo_unpin(chan->ntfy);
139
		drm_gem_object_unreference_unlocked(&chan->ntfy->gem);
140 141 142
	}

	if (chan->heap.block_size)
143
		nvkm_mm_fini(&chan->heap);
144 145 146

	/* destroy channel object, all children will be killed too */
	if (chan->chan) {
147
		nouveau_channel_idle(chan->chan);
148 149 150 151 152 153 154 155 156 157
		nouveau_channel_del(&chan->chan);
	}

	list_del(&chan->head);
	kfree(chan);
}

void
nouveau_abi16_fini(struct nouveau_abi16 *abi16)
{
158
	struct nouveau_cli *cli = (void *)abi16->device.object.client;
159 160 161 162 163 164 165 166
	struct nouveau_abi16_chan *chan, *temp;

	/* cleanup channels */
	list_for_each_entry_safe(chan, temp, &abi16->channels, head) {
		nouveau_abi16_chan_fini(abi16, chan);
	}

	/* destroy the device object */
167
	nvif_device_fini(&abi16->device);
168 169 170 171

	kfree(cli->abi16);
	cli->abi16 = NULL;
}
172 173 174 175

int
nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
{
176
	struct nouveau_cli *cli = nouveau_cli(file_priv);
177
	struct nouveau_drm *drm = nouveau_drm(dev);
178
	struct nvif_device *device = &drm->device;
179
	struct nvkm_gr *gr = nvxx_gr(device);
180 181 182 183
	struct drm_nouveau_getparam *getparam = data;

	switch (getparam->param) {
	case NOUVEAU_GETPARAM_CHIPSET_ID:
184
		getparam->value = device->info.chipset;
185 186
		break;
	case NOUVEAU_GETPARAM_PCI_VENDOR:
187
		if (nvxx_device(device)->func->pci)
A
Alexandre Courbot 已提交
188 189 190
			getparam->value = dev->pdev->vendor;
		else
			getparam->value = 0;
191 192
		break;
	case NOUVEAU_GETPARAM_PCI_DEVICE:
193
		if (nvxx_device(device)->func->pci)
A
Alexandre Courbot 已提交
194 195 196
			getparam->value = dev->pdev->device;
		else
			getparam->value = 0;
197 198
		break;
	case NOUVEAU_GETPARAM_BUS_TYPE:
199
		if (!nvxx_device(device)->func->pci)
A
Alexandre Courbot 已提交
200 201
			getparam->value = 3;
		else
202
		if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
203 204 205 206 207 208 209 210
			getparam->value = 0;
		else
		if (!pci_is_pcie(dev->pdev))
			getparam->value = 1;
		else
			getparam->value = 2;
		break;
	case NOUVEAU_GETPARAM_FB_SIZE:
211
		getparam->value = drm->gem.vram_available;
212 213
		break;
	case NOUVEAU_GETPARAM_AGP_SIZE:
214
		getparam->value = drm->gem.gart_available;
215 216 217 218 219
		break;
	case NOUVEAU_GETPARAM_VM_VRAM_BASE:
		getparam->value = 0; /* deprecated */
		break;
	case NOUVEAU_GETPARAM_PTIMER_TIME:
220
		getparam->value = nvif_device_time(device);
221 222 223 224 225 226 227 228
		break;
	case NOUVEAU_GETPARAM_HAS_BO_USAGE:
		getparam->value = 1;
		break;
	case NOUVEAU_GETPARAM_HAS_PAGEFLIP:
		getparam->value = 1;
		break;
	case NOUVEAU_GETPARAM_GRAPH_UNITS:
229
		getparam->value = nvkm_gr_units(gr);
230
		break;
231
	default:
B
Ben Skeggs 已提交
232
		NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
		return -EINVAL;
	}

	return 0;
}

int
nouveau_abi16_ioctl_setparam(ABI16_IOCTL_ARGS)
{
	return -EINVAL;
}

int
nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
{
	struct drm_nouveau_channel_alloc *init = data;
249 250
	struct nouveau_cli *cli = nouveau_cli(file_priv);
	struct nouveau_drm *drm = nouveau_drm(dev);
251
	struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv);
252
	struct nouveau_abi16_chan *chan;
253
	struct nvif_device *device;
254 255
	int ret;

256 257
	if (unlikely(!abi16))
		return -ENOMEM;
258 259 260 261

	if (!drm->channel)
		return nouveau_abi16_put(abi16, -ENODEV);

262
	device = &abi16->device;
263

264
	/* hack to allow channel engine type specification on kepler */
265
	if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) {
266
		if (init->fb_ctxdma_handle != ~0)
267 268 269 270 271 272 273 274 275 276 277 278 279
			init->fb_ctxdma_handle = NVA06F_V0_ENGINE_GR;
		else {
			init->fb_ctxdma_handle = 0;
#define _(A,B) if (init->tt_ctxdma_handle & (A)) init->fb_ctxdma_handle |= (B)
			_(0x01, NVA06F_V0_ENGINE_GR);
			_(0x02, NVA06F_V0_ENGINE_MSPDEC);
			_(0x04, NVA06F_V0_ENGINE_MSPPP);
			_(0x08, NVA06F_V0_ENGINE_MSVLD);
			_(0x10, NVA06F_V0_ENGINE_CE0);
			_(0x20, NVA06F_V0_ENGINE_CE1);
			_(0x40, NVA06F_V0_ENGINE_MSENC);
#undef _
		}
280 281 282

		/* allow flips to be executed if this is a graphics channel */
		init->tt_ctxdma_handle = 0;
283
		if (init->fb_ctxdma_handle == NVA06F_V0_ENGINE_GR)
284 285 286 287 288 289
			init->tt_ctxdma_handle = 1;
	}

	if (init->fb_ctxdma_handle == ~0 || init->tt_ctxdma_handle == ~0)
		return nouveau_abi16_put(abi16, -EINVAL);

290 291 292 293 294 295 296
	/* allocate "abi16 channel" data and make up a handle for it */
	chan = kzalloc(sizeof(*chan), GFP_KERNEL);
	if (!chan)
		return nouveau_abi16_put(abi16, -ENOMEM);

	INIT_LIST_HEAD(&chan->notifiers);
	list_add(&chan->head, &abi16->channels);
297

298
	/* create channel object and initialise dma and fence management */
299
	ret = nouveau_channel_new(drm, device, init->fb_ctxdma_handle,
300
				  init->tt_ctxdma_handle, &chan->chan);
301
	if (ret)
302 303
		goto done;

304 305
	init->channel = chan->chan->chid;

306
	if (device->info.family >= NV_DEVICE_INFO_V0_TESLA)
307 308 309 310
		init->pushbuf_domains = NOUVEAU_GEM_DOMAIN_VRAM |
					NOUVEAU_GEM_DOMAIN_GART;
	else
	if (chan->chan->push.buffer->bo.mem.mem_type == TTM_PL_VRAM)
311
		init->pushbuf_domains = NOUVEAU_GEM_DOMAIN_VRAM;
312 313
	else
		init->pushbuf_domains = NOUVEAU_GEM_DOMAIN_GART;
314

315
	if (device->info.family < NV_DEVICE_INFO_V0_CELSIUS) {
316 317
		init->subchan[0].handle = 0x00000000;
		init->subchan[0].grclass = 0x0000;
318
		init->subchan[1].handle = chan->chan->nvsw.handle;
319
		init->subchan[1].grclass = 0x506e;
320 321 322 323
		init->nr_subchan = 2;
	}

	/* Named memory object area */
324 325 326
	ret = nouveau_gem_new(dev, PAGE_SIZE, 0, NOUVEAU_GEM_DOMAIN_GART,
			      0, 0, &chan->ntfy);
	if (ret == 0)
327
		ret = nouveau_bo_pin(chan->ntfy, TTM_PL_FLAG_TT, false);
328 329 330
	if (ret)
		goto done;

331
	if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
332
		ret = nouveau_bo_vma_add(chan->ntfy, cli->vm,
333 334 335 336 337
					&chan->ntfy_vma);
		if (ret)
			goto done;
	}

338
	ret = drm_gem_handle_create(file_priv, &chan->ntfy->gem,
339
				    &init->notifier_handle);
340 341
	if (ret)
		goto done;
342

343
	ret = nvkm_mm_init(&chan->heap, 0, PAGE_SIZE, 1);
344 345 346 347
done:
	if (ret)
		nouveau_abi16_chan_fini(abi16, chan);
	return nouveau_abi16_put(abi16, ret);
348 349
}

350 351 352 353 354 355
static struct nouveau_abi16_chan *
nouveau_abi16_chan(struct nouveau_abi16 *abi16, int channel)
{
	struct nouveau_abi16_chan *chan;

	list_for_each_entry(chan, &abi16->channels, head) {
356
		if (chan->chan->chid == channel)
357 358 359 360 361
			return chan;
	}

	return NULL;
}
362

363 364 365 366 367 368 369 370
int
nouveau_abi16_usif(struct drm_file *file_priv, void *data, u32 size)
{
	union {
		struct nvif_ioctl_v0 v0;
	} *args = data;
	struct nouveau_abi16_chan *chan;
	struct nouveau_abi16 *abi16;
371
	int ret = -ENOSYS;
372

373
	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
		switch (args->v0.type) {
		case NVIF_IOCTL_V0_NEW:
		case NVIF_IOCTL_V0_MTHD:
		case NVIF_IOCTL_V0_SCLASS:
			break;
		default:
			return -EACCES;
		}
	} else
		return ret;

	if (!(abi16 = nouveau_abi16(file_priv)))
		return -ENOMEM;

	if (args->v0.token != ~0ULL) {
		if (!(chan = nouveau_abi16_chan(abi16, args->v0.token)))
			return -EINVAL;
		args->v0.object = nvif_handle(&chan->chan->user);
		args->v0.owner  = NVIF_IOCTL_V0_OWNER_ANY;
		return 0;
	}

	args->v0.object = nvif_handle(&abi16->device.object);
	args->v0.owner  = NVIF_IOCTL_V0_OWNER_ANY;
	return 0;
}

401 402 403 404
int
nouveau_abi16_ioctl_channel_free(ABI16_IOCTL_ARGS)
{
	struct drm_nouveau_channel_free *req = data;
405
	struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv);
406
	struct nouveau_abi16_chan *chan;
407

408 409
	if (unlikely(!abi16))
		return -ENOMEM;
410

411 412 413 414 415
	chan = nouveau_abi16_chan(abi16, req->channel);
	if (!chan)
		return nouveau_abi16_put(abi16, -ENOENT);
	nouveau_abi16_chan_fini(abi16, chan);
	return nouveau_abi16_put(abi16, 0);
416 417 418 419 420 421
}

int
nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
{
	struct drm_nouveau_grobj_alloc *init = data;
422
	struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv);
423 424
	struct nouveau_abi16_chan *chan;
	struct nouveau_abi16_ntfy *ntfy;
425
	struct nvif_client *client;
426
	struct nvif_sclass *sclass;
427 428
	s32 oclass = 0;
	int ret, i;
429

430 431 432
	if (unlikely(!abi16))
		return -ENOMEM;

433
	if (init->handle == ~0)
434
		return nouveau_abi16_put(abi16, -EINVAL);
435
	client = abi16->device.object.client;
436

437 438 439 440
	chan = nouveau_abi16_chan(abi16, init->channel);
	if (!chan)
		return nouveau_abi16_put(abi16, -ENOENT);

441
	ret = nvif_object_sclass_get(&chan->chan->user, &sclass);
442 443 444 445 446 447
	if (ret < 0)
		return nouveau_abi16_put(abi16, ret);

	if ((init->class & 0x00ff) == 0x006e) {
		/* nvsw: compatibility with older 0x*6e class identifier */
		for (i = 0; !oclass && i < ret; i++) {
448
			switch (sclass[i].oclass) {
449 450 451 452
			case NVIF_CLASS_SW_NV04:
			case NVIF_CLASS_SW_NV10:
			case NVIF_CLASS_SW_NV50:
			case NVIF_CLASS_SW_GF100:
453
				oclass = sclass[i].oclass;
454 455 456 457 458 459 460 461 462
				break;
			default:
				break;
			}
		}
	} else
	if ((init->class & 0x00ff) == 0x00b1) {
		/* msvld: compatibility with incorrect version exposure */
		for (i = 0; i < ret; i++) {
463 464
			if ((sclass[i].oclass & 0x00ff) == 0x00b1) {
				oclass = sclass[i].oclass;
465 466 467 468 469 470 471
				break;
			}
		}
	} else
	if ((init->class & 0x00ff) == 0x00b2) { /* mspdec */
		/* mspdec: compatibility with incorrect version exposure */
		for (i = 0; i < ret; i++) {
472 473
			if ((sclass[i].oclass & 0x00ff) == 0x00b2) {
				oclass = sclass[i].oclass;
474 475 476 477 478 479 480
				break;
			}
		}
	} else
	if ((init->class & 0x00ff) == 0x00b3) { /* msppp */
		/* msppp: compatibility with incorrect version exposure */
		for (i = 0; i < ret; i++) {
481 482
			if ((sclass[i].oclass & 0x00ff) == 0x00b3) {
				oclass = sclass[i].oclass;
483 484 485 486 487 488 489
				break;
			}
		}
	} else {
		oclass = init->class;
	}

490
	nvif_object_sclass_put(&sclass);
491 492 493
	if (!oclass)
		return nouveau_abi16_put(abi16, -EINVAL);

494 495 496 497 498 499 500
	ntfy = kzalloc(sizeof(*ntfy), GFP_KERNEL);
	if (!ntfy)
		return nouveau_abi16_put(abi16, -ENOMEM);

	list_add(&ntfy->head, &chan->notifiers);

	client->route = NVDRM_OBJECT_ABI16;
501
	ret = nvif_object_init(&chan->chan->user, init->handle, oclass,
502 503 504 505 506
			       NULL, 0, &ntfy->object);
	client->route = NVDRM_OBJECT_NVIF;

	if (ret)
		nouveau_abi16_ntfy_fini(chan, ntfy);
507
	return nouveau_abi16_put(abi16, ret);
508 509 510 511 512
}

int
nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
{
513 514
	struct drm_nouveau_notifierobj_alloc *info = data;
	struct nouveau_drm *drm = nouveau_drm(dev);
515
	struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv);
516
	struct nouveau_abi16_chan *chan;
517
	struct nouveau_abi16_ntfy *ntfy;
518
	struct nvif_device *device = &abi16->device;
519
	struct nvif_client *client;
520
	struct nv_dma_v0 args = {};
521 522
	int ret;

523 524 525
	if (unlikely(!abi16))
		return -ENOMEM;

526
	/* completely unnecessary for these chipsets... */
527
	if (unlikely(device->info.family >= NV_DEVICE_INFO_V0_FERMI))
528
		return nouveau_abi16_put(abi16, -EINVAL);
529
	client = abi16->device.object.client;
530

531
	chan = nouveau_abi16_chan(abi16, info->channel);
532 533 534 535 536 537 538 539 540
	if (!chan)
		return nouveau_abi16_put(abi16, -ENOENT);

	ntfy = kzalloc(sizeof(*ntfy), GFP_KERNEL);
	if (!ntfy)
		return nouveau_abi16_put(abi16, -ENOMEM);

	list_add(&ntfy->head, &chan->notifiers);

541 542
	ret = nvkm_mm_head(&chan->heap, 0, 1, info->size, info->size, 1,
			   &ntfy->node);
543 544 545
	if (ret)
		goto done;

546 547
	args.start = ntfy->node->offset;
	args.limit = ntfy->node->offset + ntfy->node->length - 1;
548
	if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
549 550 551 552
		args.target = NV_DMA_V0_TARGET_VM;
		args.access = NV_DMA_V0_ACCESS_VM;
		args.start += chan->ntfy_vma.offset;
		args.limit += chan->ntfy_vma.offset;
553
	} else
554
	if (drm->agp.bridge) {
555 556 557 558
		args.target = NV_DMA_V0_TARGET_AGP;
		args.access = NV_DMA_V0_ACCESS_RDWR;
		args.start += drm->agp.base + chan->ntfy->bo.offset;
		args.limit += drm->agp.base + chan->ntfy->bo.offset;
559
	} else {
560 561 562 563
		args.target = NV_DMA_V0_TARGET_VM;
		args.access = NV_DMA_V0_ACCESS_RDWR;
		args.start += chan->ntfy->bo.offset;
		args.limit += chan->ntfy->bo.offset;
564 565
	}

566 567 568 569 570
	client->route = NVDRM_OBJECT_ABI16;
	client->super = true;
	ret = nvif_object_init(&chan->chan->user, info->handle,
			       NV_DMA_IN_MEMORY, &args, sizeof(args),
			       &ntfy->object);
571
	client->super = false;
572
	client->route = NVDRM_OBJECT_NVIF;
573 574 575
	if (ret)
		goto done;

576
	info->offset = ntfy->node->offset;
577 578 579 580
done:
	if (ret)
		nouveau_abi16_ntfy_fini(chan, ntfy);
	return nouveau_abi16_put(abi16, ret);
581 582 583 584 585
}

int
nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS)
{
586
	struct drm_nouveau_gpuobj_free *fini = data;
587
	struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv);
588
	struct nouveau_abi16_chan *chan;
589
	struct nouveau_abi16_ntfy *ntfy;
590
	int ret = -ENOENT;
591

592 593 594
	if (unlikely(!abi16))
		return -ENOMEM;

595
	chan = nouveau_abi16_chan(abi16, fini->channel);
596
	if (!chan)
597
		return nouveau_abi16_put(abi16, -EINVAL);
598

599 600
	/* synchronize with the user channel and destroy the gpu object */
	nouveau_channel_idle(chan->chan);
601

602
	list_for_each_entry(ntfy, &chan->notifiers, head) {
603 604 605
		if (ntfy->object.handle == fini->handle) {
			nouveau_abi16_ntfy_fini(chan, ntfy);
			ret = 0;
606 607 608 609
			break;
		}
	}

610
	return nouveau_abi16_put(abi16, ret);
611
}