drm/nouveau: determine memory class for each client
authorBen Skeggs <bskeggs@redhat.com>
Tue, 31 Oct 2017 17:56:20 +0000 (03:56 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 2 Nov 2017 03:32:33 +0000 (13:32 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/nouveau/nouveau_drv.h

index a6aaddecd8c5ba61a760b8144863a96930fb7043..e82da06d82f024aaeff3b62f7185882e04447e8b 100644 (file)
@@ -127,6 +127,13 @@ static int
 nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
                 struct nouveau_cli *cli)
 {
+       static const struct nvif_mclass
+       mems[] = {
+               { NVIF_CLASS_MEM_GF100, -1 },
+               { NVIF_CLASS_MEM_NV50 , -1 },
+               { NVIF_CLASS_MEM_NV04 , -1 },
+               {}
+       };
        static const struct nvif_mclass
        mmus[] = {
                { NVIF_CLASS_MMU_GF100, -1 },
@@ -201,11 +208,20 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
                goto done;
        }
 
+       ret = nvif_mclass(&cli->mmu.object, mems);
+       if (ret < 0) {
+               NV_ERROR(drm, "No supported MEM class\n");
+               goto done;
+       }
+
+       cli->mem = &mems[ret];
+
        if (1) {
                cli->vm = cli->vmm.vm;
                nvxx_client(&cli->base)->vm = cli->vm;
        }
 
+       return 0;
 done:
        if (ret)
                nouveau_cli_fini(cli);
index 25e0fb73747b12cdb4c763bd4867e163b9a22582..df9d9a71dde57339c9b9a321a0678093f183ab89 100644 (file)
@@ -95,6 +95,7 @@ struct nouveau_cli {
        struct nvif_device device;
        struct nvif_mmu mmu;
        struct nouveau_vmm vmm;
+       const struct nvif_mclass *mem;
 
        struct nvkm_vm *vm;
        struct list_head head;