aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_abi16.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-08-09 14:10:24 -0400
committerBen Skeggs <bskeggs@redhat.com>2014-08-09 15:13:24 -0400
commit4acfd707e28c820ba8ed8c12b497413a133d8c8f (patch)
tree4c2bd62829b85c31bc5ad656e7140ed599038163 /drivers/gpu/drm/nouveau/nouveau_abi16.c
parentb2c817031bc99d6e809fa10dcd8bf709b61d088d (diff)
drm/nouveau/dma: audit and version NV_DMA classes
The full object interfaces are about to be exposed to userspace, so we need to check for any security-related issues and version the structs to make it easier to handle any changes we may need in the future. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_abi16.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 1e312feb12e4..0325db93a7d5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -413,7 +413,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
413 struct { 413 struct {
414 struct nvif_ioctl_v0 ioctl; 414 struct nvif_ioctl_v0 ioctl;
415 struct nvif_ioctl_new_v0 new; 415 struct nvif_ioctl_new_v0 new;
416 struct nv_dma_class ctxdma; 416 struct nv_dma_v0 ctxdma;
417 } args = { 417 } args = {
418 .ioctl.owner = NVIF_IOCTL_V0_OWNER_ANY, 418 .ioctl.owner = NVIF_IOCTL_V0_OWNER_ANY,
419 .ioctl.type = NVIF_IOCTL_V0_NEW, 419 .ioctl.type = NVIF_IOCTL_V0_NEW,
@@ -423,7 +423,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
423 .ioctl.path[0] = NOUVEAU_ABI16_CHAN(info->channel), 423 .ioctl.path[0] = NOUVEAU_ABI16_CHAN(info->channel),
424 .new.route = NVDRM_OBJECT_ABI16, 424 .new.route = NVDRM_OBJECT_ABI16,
425 .new.handle = info->handle, 425 .new.handle = info->handle,
426 .new.oclass = NV_DMA_IN_MEMORY_CLASS, 426 .new.oclass = NV_DMA_IN_MEMORY,
427 }; 427 };
428 struct nouveau_drm *drm = nouveau_drm(dev); 428 struct nouveau_drm *drm = nouveau_drm(dev);
429 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); 429 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
@@ -460,17 +460,20 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
460 args.ctxdma.start = ntfy->node->offset; 460 args.ctxdma.start = ntfy->node->offset;
461 args.ctxdma.limit = ntfy->node->offset + ntfy->node->length - 1; 461 args.ctxdma.limit = ntfy->node->offset + ntfy->node->length - 1;
462 if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) { 462 if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
463 args.ctxdma.flags = NV_DMA_TARGET_VM | NV_DMA_ACCESS_VM; 463 args.ctxdma.target = NV_DMA_V0_TARGET_VM;
464 args.ctxdma.access = NV_DMA_V0_ACCESS_VM;
464 args.ctxdma.start += chan->ntfy_vma.offset; 465 args.ctxdma.start += chan->ntfy_vma.offset;
465 args.ctxdma.limit += chan->ntfy_vma.offset; 466 args.ctxdma.limit += chan->ntfy_vma.offset;
466 } else 467 } else
467 if (drm->agp.stat == ENABLED) { 468 if (drm->agp.stat == ENABLED) {
468 args.ctxdma.flags = NV_DMA_TARGET_AGP | NV_DMA_ACCESS_RDWR; 469 args.ctxdma.target = NV_DMA_V0_TARGET_AGP;
470 args.ctxdma.access = NV_DMA_V0_ACCESS_RDWR;
469 args.ctxdma.start += drm->agp.base + chan->ntfy->bo.offset; 471 args.ctxdma.start += drm->agp.base + chan->ntfy->bo.offset;
470 args.ctxdma.limit += drm->agp.base + chan->ntfy->bo.offset; 472 args.ctxdma.limit += drm->agp.base + chan->ntfy->bo.offset;
471 client->super = true; 473 client->super = true;
472 } else { 474 } else {
473 args.ctxdma.flags = NV_DMA_TARGET_VM | NV_DMA_ACCESS_RDWR; 475 args.ctxdma.target = NV_DMA_V0_TARGET_VM;
476 args.ctxdma.access = NV_DMA_V0_ACCESS_RDWR;
474 args.ctxdma.start += chan->ntfy->bo.offset; 477 args.ctxdma.start += chan->ntfy->bo.offset;
475 args.ctxdma.limit += chan->ntfy->bo.offset; 478 args.ctxdma.limit += chan->ntfy->bo.offset;
476 } 479 }