summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nouveau_drm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drm.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 22cdd987dd2f..316f7877047d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -206,6 +206,7 @@ nouveau_cli_fini(struct nouveau_cli *cli)
nouveau_vmm_fini(&cli->svm);
nouveau_vmm_fini(&cli->vmm);
nvif_mmu_dtor(&cli->mmu);
+ cli->device.object.map.ptr = NULL;
nvif_device_dtor(&cli->device);
if (cli != &cli->drm->master) {
mutex_lock(&cli->drm->master.lock);
@@ -267,6 +268,8 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
goto done;
}
+ cli->device.object.map.ptr = drm->device.object.map.ptr;
+
ret = nvif_mclass(&cli->device.object, mmus);
if (ret < 0) {
NV_PRINTK(err, cli, "No supported MMU class\n");
@@ -715,6 +718,7 @@ nouveau_drm_device_del(struct nouveau_drm *drm)
if (drm->dev)
drm_dev_put(drm->dev);
+ nvif_device_dtor(&drm->device);
nvif_client_dtor(&drm->master.base);
nvif_parent_dtor(&drm->parent);
@@ -751,6 +755,18 @@ nouveau_drm_device_new(const struct drm_driver *drm_driver, struct device *paren
if (ret)
goto done;
+ ret = nvif_device_ctor(&drm->master.base, "drmDevice", &drm->device);
+ if (ret) {
+ NV_ERROR(drm, "Device allocation failed: %d\n", ret);
+ goto done;
+ }
+
+ ret = nvif_device_map(&drm->device);
+ if (ret) {
+ NV_ERROR(drm, "Failed to map PRI: %d\n", ret);
+ goto done;
+ }
+
done:
if (ret) {
nouveau_drm_device_del(drm);