]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
drm/nvc0: enable protection of system-use-only structures in vm
authorBen Skeggs <bskeggs@redhat.com>
Fri, 14 Jan 2011 00:27:02 +0000 (10:27 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 17 Jan 2011 01:28:50 +0000 (11:28 +1000)
Somehow missed this in the original merge of the nvc0 code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/nouveau/nv50_instmem.c
drivers/gpu/drm/nouveau/nvc0_graph.c
drivers/gpu/drm/nouveau/nvc0_vm.c

index 07a7e6ad5e3bfb7bd7e5f6cb3f38c2a76a350f95..51920321d0588a0b3c0ce02769ae7c169fefe410 100644 (file)
@@ -160,6 +160,7 @@ enum nouveau_flags {
 #define NVOBJ_FLAG_ZERO_ALLOC          (1 << 1)
 #define NVOBJ_FLAG_ZERO_FREE           (1 << 2)
 #define NVOBJ_FLAG_VM                  (1 << 3)
+#define NVOBJ_FLAG_VM_USER             (1 << 4)
 
 #define NVOBJ_CINST_GLOBAL     0xdeadbeef
 
index 2e1b1cd19a4b7f92732b7acd2eec748d5888d084..ea0041810ae3a648959f533e3fbefcc17ca508d7 100644 (file)
@@ -332,8 +332,11 @@ nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align)
        gpuobj->vinst = node->vram->offset;
 
        if (gpuobj->flags & NVOBJ_FLAG_VM) {
-               ret = nouveau_vm_get(dev_priv->chan_vm, size, 12,
-                                    NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS,
+               u32 flags = NV_MEM_ACCESS_RW;
+               if (!(gpuobj->flags & NVOBJ_FLAG_VM_USER))
+                       flags |= NV_MEM_ACCESS_SYS;
+
+               ret = nouveau_vm_get(dev_priv->chan_vm, size, 12, flags,
                                     &node->chan_vma);
                if (ret) {
                        vram->put(dev, &node->vram);
index 5feacd5d5fa4c654afce33f7d7412778ec3af61c..e6ea7d83187f9e71c4d96c9e610d142671fb9140 100644 (file)
@@ -105,7 +105,8 @@ nvc0_graph_create_context_mmio_list(struct nouveau_channel *chan)
        if (ret)
                return ret;
 
-       ret = nouveau_gpuobj_new(dev, NULL, 384 * 1024, 4096, NVOBJ_FLAG_VM,
+       ret = nouveau_gpuobj_new(dev, NULL, 384 * 1024, 4096,
+                                NVOBJ_FLAG_VM | NVOBJ_FLAG_VM_USER,
                                 &grch->unk418810);
        if (ret)
                return ret;
index 4b9251bb0ff4da45e181f12e9e9213a1a96b7916..e4e83c2caf5b655e05eaa1910438c4733c13eab0 100644 (file)
@@ -48,8 +48,8 @@ nvc0_vm_addr(struct nouveau_vma *vma, u64 phys, u32 memtype, u32 target)
        phys >>= 8;
 
        phys |= 0x00000001; /* present */
-//     if (vma->access & NV_MEM_ACCESS_SYS)
-//             phys |= 0x00000002;
+       if (vma->access & NV_MEM_ACCESS_SYS)
+               phys |= 0x00000002;
 
        phys |= ((u64)target  << 32);
        phys |= ((u64)memtype << 36);