]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/nouveau/mmu/nv04-nv4x: move global vmm to nvkm_mmu
authorBen Skeggs <bskeggs@redhat.com>
Tue, 31 Oct 2017 17:56:19 +0000 (03:56 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 2 Nov 2017 03:32:20 +0000 (13:32 +1000)
In a future commit, this will be constructed by common code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h
drivers/gpu/drm/nouveau/nouveau_ttm.c
drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv04.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv04.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv04.h
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv41.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv44.c

index d333c7668c2365f794854829a01243b6ca9e6a45..c4326772d48162243b1ee0efcc193b32e415b871 100644 (file)
@@ -58,6 +58,8 @@ struct nvkm_mmu {
        u64 limit;
        u8  dma_bits;
        u8  lpg_shift;
+
+       struct nvkm_vmm *vmm;
 };
 
 int nv04_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **);
index ffc3458c89de8b7e9ed7d771c8c18d40ab856003..65511f320a3a95c8779b86d1a8739ee21d7d18fb 100644 (file)
@@ -192,16 +192,13 @@ const struct ttm_mem_type_manager_func nouveau_gart_manager = {
        .debug = nouveau_gart_manager_debug
 };
 
-/*XXX*/
-#include <subdev/mmu/nv04.h>
 static int
 nv04_gart_manager_init(struct ttm_mem_type_manager *man, unsigned long psize)
 {
        struct nouveau_drm *drm = nouveau_bdev(man->bdev);
        struct nvkm_mmu *mmu = nvxx_mmu(&drm->client.device);
-       struct nv04_mmu *priv = (void *)mmu;
        struct nvkm_vm *vm = NULL;
-       nvkm_vm_ref(priv->vm, &vm, NULL);
+       nvkm_vm_ref(mmu->vmm, &vm, NULL);
        man->priv = vm;
        return 0;
 }
index c95942ef821675b83b76b3b002ecd06c31726bb6..acc45ce5f93ec48d01b8638c92573e66bd0d2101 100644 (file)
@@ -49,8 +49,7 @@ nv04_dmaobj_bind(struct nvkm_dmaobj *base, struct nvkm_gpuobj *parent,
        int ret;
 
        if (dmaobj->clone) {
-               struct nv04_mmu *mmu = nv04_mmu(device->mmu);
-               struct nvkm_memory *pgt = mmu->vm->pgt[0].mem[0];
+               struct nvkm_memory *pgt = device->mmu->vmm->pgt[0].mem[0];
                if (!dmaobj->base.start)
                        return nvkm_gpuobj_wrap(pgt, pgpuobj);
                nvkm_kmap(pgt);
index 37927c3fdc3e6aea35032916225a5e480ad048ee..cd16442f1a918fc892f07e8ec93d0373ded30cd9 100644 (file)
@@ -81,15 +81,15 @@ nv04_mmu_oneinit(struct nvkm_mmu *base)
        int ret;
 
        ret = nvkm_vm_create(&mmu->base, 0, NV04_PDMA_SIZE, 0, 4096, NULL,
-                            &mmu->vm);
+                            &mmu->base.vmm);
        if (ret)
                return ret;
 
        ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
                              (NV04_PDMA_SIZE / NV04_PDMA_PAGE) * 4 + 8,
                              16, true, &dma);
-       mmu->vm->pgt[0].mem[0] = dma;
-       mmu->vm->pgt[0].refcount[0] = 1;
+       mmu->base.vmm->pgt[0].mem[0] = dma;
+       mmu->base.vmm->pgt[0].refcount[0] = 1;
        if (ret)
                return ret;
 
@@ -105,9 +105,9 @@ nv04_mmu_dtor(struct nvkm_mmu *base)
 {
        struct nv04_mmu *mmu = nv04_mmu(base);
        struct nvkm_device *device = mmu->base.subdev.device;
-       if (mmu->vm) {
-               nvkm_memory_del(&mmu->vm->pgt[0].mem[0]);
-               nvkm_vm_ref(NULL, &mmu->vm, NULL);
+       if (mmu->base.vmm) {
+               nvkm_memory_del(&mmu->base.vmm->pgt[0].mem[0]);
+               nvkm_vm_ref(NULL, &mmu->base.vmm, NULL);
        }
        if (mmu->nullp) {
                dma_free_coherent(device->dev, 16 * 1024,
index 363e33b296d5647b600ac869c7c7fa16cb504494..6b8f14c6db3dc643e1550df53d83c8096194a1d5 100644 (file)
@@ -5,7 +5,6 @@
 
 struct nv04_mmu {
        struct nvkm_mmu base;
-       struct nvkm_vm *vm;
        dma_addr_t null;
        void *nullp;
 };
index c6a26f907009cc746e8276c75272b1e74f6a9fb7..9b5375c587a7f5e9d5c2270a0cf8af67b8aa6672 100644 (file)
@@ -93,14 +93,14 @@ nv41_mmu_oneinit(struct nvkm_mmu *base)
        int ret;
 
        ret = nvkm_vm_create(&mmu->base, 0, NV41_GART_SIZE, 0, 4096, NULL,
-                            &mmu->vm);
+                            &mmu->base.vmm);
        if (ret)
                return ret;
 
        ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
                              (NV41_GART_SIZE / NV41_GART_PAGE) * 4, 16, true,
-                             &mmu->vm->pgt[0].mem[0]);
-       mmu->vm->pgt[0].refcount[0] = 1;
+                             &mmu->base.vmm->pgt[0].mem[0]);
+       mmu->base.vmm->pgt[0].refcount[0] = 1;
        return ret;
 }
 
@@ -109,7 +109,7 @@ nv41_mmu_init(struct nvkm_mmu *base)
 {
        struct nv04_mmu *mmu = nv04_mmu(base);
        struct nvkm_device *device = mmu->base.subdev.device;
-       struct nvkm_memory *dma = mmu->vm->pgt[0].mem[0];
+       struct nvkm_memory *dma = mmu->base.vmm->pgt[0].mem[0];
        nvkm_wr32(device, 0x100800, 0x00000002 | nvkm_memory_addr(dma));
        nvkm_mask(device, 0x10008c, 0x00000100, 0x00000100);
        nvkm_wr32(device, 0x100820, 0x00000000);
index a648c2395545b49365eb41736f7ac5d14d36db0f..cc97500a09010779669997b6003ff3435fb474cc 100644 (file)
@@ -173,15 +173,15 @@ nv44_mmu_oneinit(struct nvkm_mmu *base)
        }
 
        ret = nvkm_vm_create(&mmu->base, 0, NV44_GART_SIZE, 0, 4096, NULL,
-                            &mmu->vm);
+                            &mmu->base.vmm);
        if (ret)
                return ret;
 
        ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
                              (NV44_GART_SIZE / NV44_GART_PAGE) * 4,
                              512 * 1024, true,
-                             &mmu->vm->pgt[0].mem[0]);
-       mmu->vm->pgt[0].refcount[0] = 1;
+                             &mmu->base.vmm->pgt[0].mem[0]);
+       mmu->base.vmm->pgt[0].refcount[0] = 1;
        return ret;
 }
 
@@ -190,7 +190,7 @@ nv44_mmu_init(struct nvkm_mmu *base)
 {
        struct nv04_mmu *mmu = nv04_mmu(base);
        struct nvkm_device *device = mmu->base.subdev.device;
-       struct nvkm_memory *gart = mmu->vm->pgt[0].mem[0];
+       struct nvkm_memory *gart = mmu->base.vmm->pgt[0].mem[0];
        u32 addr;
 
        /* calculate vram address of this PRAMIN block, object must be