Skip to contentSkip to conversation

drm/nouveau: replace "ioctl" interface between drm/nvkm

PATCH In review Ben Skeggs 4 participants 163 messages Apr 16, 2024 – Apr 22, 2024 Page 3 of 3

Subsystems (4)
lore
Share & tools
lore
author
#136 lore raw

PATCH 135/156 drm/nouveau/nvif: rework device "new ctxdma" api

In reply to Ben Skeggs

- transition from "ioctl" interface

---
 drivers/gpu/drm/nouveau/include/nvif/device.h |  4 ++
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  6 +++
 drivers/gpu/drm/nouveau/nouveau_chan.c        | 11 +++--
 drivers/gpu/drm/nouveau/nouveau_chan.h        |  3 +-
 drivers/gpu/drm/nouveau/nvif/device.c         | 17 ++++++++
 drivers/gpu/drm/nouveau/nvkm/device/user.c    | 41 ++++++++++++++++++-
 6 files changed, 73 insertions(+), 9 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/device.h +4 -0
index fa8402e575da..5fb71e6da7cd 100644
@@ -5,6 +5,7 @@
 #include <nvif/cl0080.h>
 #include <nvif/driverif.h>
 #include <nvif/user.h>
+struct nvif_ctxdma;
 
 struct nvif_device {
 	const struct nvif_device_impl *impl;
@@ -22,6 +23,9 @@ void nvif_device_dtor(struct nvif_device *);
 int  nvif_device_map(struct nvif_device *);
 u64  nvif_device_time(struct nvif_device *);
 
+int nvif_device_ctxdma_ctor(struct nvif_device *, const char *name, s32 oclass,
+			    void *argv, u32 argc, struct nvif_ctxdma *);
+
 /*XXX*/
 #include <subdev/bios.h>
 #include <subdev/fb.h>
drivers/gpu/drm/nouveau/include/nvif/driverif.h +6 -0
index 75168621427a..c1971b85d927 100644
@@ -507,6 +507,12 @@ struct nvif_device_impl {
 			   const struct nvif_disp_impl **, struct nvif_disp_priv **);
 	} disp;
 
+	struct {
+		int (*new)(struct nvif_device_priv *, s32 oclass, void *argv, u32 argc,
+			   const struct nvif_ctxdma_impl **, struct nvif_ctxdma_priv **,
+			   u64 handle);
+	} ctxdma;
+
 	struct nvif_device_impl_fifo {
 		u8  engine_nr;
 		u8  runl_nr;
drivers/gpu/drm/nouveau/nouveau_chan.c +5 -6
index 771a4b4b3f1d..7c57bc48a8af 100644
@@ -106,7 +106,7 @@ nouveau_channel_del(struct nouveau_channel **pchan)
 		nvif_object_unmap_cpu(&chan->userd.map);
 		nvif_object_dtor(&chan->user);
 		nvif_mem_dtor(&chan->userd.mem);
-		nvif_object_dtor(&chan->push.ctxdma);
+		nvif_ctxdma_dtor(&chan->push.ctxdma);
 		nouveau_vma_del(&chan->push.vma);
 		nouveau_bo_unmap(chan->push.buffer);
 		if (chan->push.buffer && chan->push.buffer->bo.pin_count)
@@ -242,9 +242,8 @@ nouveau_channel_prep(struct nouveau_cli *cli,
 		}
 	}
 
-	ret = nvif_object_ctor(&device->object, "abi16PushCtxDma", 0,
-			       NV_DMA_FROM_MEMORY, &args, sizeof(args),
-			       &chan->push.ctxdma);
+	ret = nvif_device_ctxdma_ctor(device, "abi16PushCtxDma", NV_DMA_FROM_MEMORY,
+				      &args, sizeof(args), &chan->push.ctxdma);
 	if (ret) {
 		nouveau_channel_del(pchan);
 		return ret;
@@ -315,13 +314,13 @@ nouveau_channel_ctor(struct nouveau_cli *cli, bool priv, u64 runm,
 	args.chan.devm = BIT(0);
 	if (oclass < NV50_CHANNEL_GPFIFO) {
 		args.chan.vmm = 0;
-		args.chan.ctxdma = nvif_handle(&chan->push.ctxdma);
+		args.chan.ctxdma = nvif_handle(&chan->push.ctxdma.object);
 		args.chan.offset = chan->push.addr;
 		args.chan.length = 0;
 	} else {
 		args.chan.vmm = nvif_handle(&chan->vmm->vmm.object);
 		if (oclass < FERMI_CHANNEL_GPFIFO)
-			args.chan.ctxdma = nvif_handle(&chan->push.ctxdma);
+			args.chan.ctxdma = nvif_handle(&chan->push.ctxdma.object);
 		else
 			args.chan.ctxdma = 0;
 		args.chan.offset = ioffset + chan->push.addr;
drivers/gpu/drm/nouveau/nouveau_chan.h +2 -1
index 811271ae6fe1..786c929843d1 100644
@@ -2,6 +2,7 @@
 #ifndef __NOUVEAU_CHAN_H__
 #define __NOUVEAU_CHAN_H__
 #include <nvif/object.h>
+#include <nvif/ctxdma.h>
 #include <nvif/event.h>
 #include <nvif/push.h>
 struct nvif_device;
@@ -31,7 +32,7 @@ struct nouveau_channel {
 	struct {
 		struct nouveau_bo *buffer;
 		struct nouveau_vma *vma;
-		struct nvif_object ctxdma;
+		struct nvif_ctxdma ctxdma;
 		u64 addr;
 	} push;
 
drivers/gpu/drm/nouveau/nvif/device.c +17 -0
index 7d057691600f..555c63e96660 100644
@@ -23,8 +23,25 @@
  */
 #include <nvif/device.h>
 #include <nvif/client.h>
+#include <nvif/ctxdma.h>
 #include <nvif/printf.h>
 
+int
+nvif_device_ctxdma_ctor(struct nvif_device *device, const char *name, s32 oclass,
+			void *argv, u32 argc, struct nvif_ctxdma *ctxdma)
+{
+	int ret;
+
+	ret = device->impl->ctxdma.new(device->priv, oclass, argv, argc,
+				       &ctxdma->impl, &ctxdma->priv, nvif_handle(&ctxdma->object));
+	NVIF_ERRON(ret, &device->object, "[NEW ctxdma%04x]", oclass);
+	if (ret)
+		return ret;
+
+	nvif_ctxdma_ctor(&device->object, name ?: "nvifDeviceCtxDma", 0, oclass, ctxdma);
+	return 0;
+}
+
 u64
 nvif_device_time(struct nvif_device *device)
 {
drivers/gpu/drm/nouveau/nvkm/device/user.c +39 -2

59 lines not on this page · raw message

Signature · 1 line
2.41.0
author
#137 lore raw

PATCH 136/156 drm/nouveau/nvif: rework device/cgrp "new chan" apis

In reply to Ben Skeggs

- transition from "ioctl" interfaces

---
 drivers/gpu/drm/nouveau/include/nvif/chan.h   |  25 ++++
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  31 +++++
 drivers/gpu/drm/nouveau/include/nvif/if0020.h |  32 -----
 drivers/gpu/drm/nouveau/nouveau_abi16.c       |  14 +--
 drivers/gpu/drm/nouveau/nouveau_bo.c          |   2 +-
 drivers/gpu/drm/nouveau/nouveau_chan.c        |  75 +++++------
 drivers/gpu/drm/nouveau/nouveau_chan.h        |   8 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         |   6 +-
 drivers/gpu/drm/nouveau/nouveau_fence.c       |   3 +-
 drivers/gpu/drm/nouveau/nv17_fence.c          |   2 +-
 drivers/gpu/drm/nouveau/nv50_fence.c          |   2 +-
 drivers/gpu/drm/nouveau/nvif/Kbuild           |   1 +
 drivers/gpu/drm/nouveau/nvif/chan.c           |  45 +++++++
 drivers/gpu/drm/nouveau/nvkm/device/user.c    |  24 ++++
 .../gpu/drm/nouveau/nvkm/engine/fifo/base.c   |  39 ------
 .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h   |   3 -
 .../gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.c  |  40 +++---
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 116 ++++++++++--------
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.h  |  11 ++
 19 files changed, 268 insertions(+), 211 deletions(-)
 create mode 100644 drivers/gpu/drm/nouveau/include/nvif/chan.h
 create mode 100644 drivers/gpu/drm/nouveau/nvif/chan.c
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.h
drivers/gpu/drm/nouveau/include/nvif/chan.h new file +25 -0
new file mode 100644
index 000000000000..80f7ea8c7268
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: MIT */
+#ifndef __NVIF_CHAN_H__
+#define __NVIF_CHAN_H__
+#include <nvif/object.h>
+#include <nvif/driverif.h>
+#include <nvif/push.h>
+struct nvif_cgrp;
+struct nvif_device;
+
+struct nvif_chan {
+	const struct nvif_chan_impl *impl;
+	struct nvif_chan_priv *priv;
+	struct nvif_object object;
+
+	struct nvif_device *device;
+	u8 runl;
+	u8 runq;
+
+	struct nvif_push push;
+};
+
+void nvif_chan_ctor(struct nvif_device *, struct nvif_cgrp *, const char *name, u8 runl, u8 runq,
+		    struct nvif_chan *);
+void nvif_chan_dtor(struct nvif_chan *);
+#endif
drivers/gpu/drm/nouveau/include/nvif/driverif.h +31 -0
index c1971b85d927..cc858955a97b 100644
@@ -20,6 +20,7 @@ struct nvif_head_priv;
 struct nvif_disp_chan_priv;
 struct nvif_ctxdma_priv;
 struct nvif_cgrp_priv;
+struct nvif_chan_priv;
 
 struct nvif_driver {
 	const char *name;
@@ -431,10 +432,34 @@ struct nvif_disp_impl {
 	} chan;
 };
 
+struct nvif_chan_impl {
+	void (*del)(struct nvif_chan_priv *);
+
+	u16 id;
+	u32 doorbell_token;
+
+	struct {
+		enum {
+			NVIF_CHAN_INST_APER_INST,
+			NVIF_CHAN_INST_APER_VRAM,
+			NVIF_CHAN_INST_APER_HOST,
+			NVIF_CHAN_INST_APER_NCOH,
+		} aper;
+		u64 addr;
+	} inst;
+};
+
 struct nvif_cgrp_impl {
 	void (*del)(struct nvif_cgrp_priv *);
 
 	u16 id;
+
+	struct {
+		int (*new)(struct nvif_cgrp_priv *, u8 runq, bool priv, u16 devm,
+			   u64 gpfifo_offset, u64 gpfifo_length,
+			   struct nvif_mem_priv *userd, u16 userd_offset, const char *name,
+			   const struct nvif_chan_impl **, struct nvif_chan_priv **);
+	} chan;
 };
 
 struct nvif_device_impl {
@@ -566,6 +591,12 @@ struct nvif_device_impl {
 
 		struct {
 			s32 oclass;
+			int (*new)(struct nvif_device_priv *, u8 runl, u8 runq, bool priv, u16 devm,
+				   struct nvif_vmm_priv *, struct nvif_ctxdma_priv *push,
+				   u64 offset, u64 length, struct nvif_mem_priv *userd,
+				   u16 userd_offset, const char *name,
+				   const struct nvif_chan_impl **, struct nvif_chan_priv **,
+				   u64 handle);
 		} chan;
 	} fifo;
 };
drivers/gpu/drm/nouveau/include/nvif/if0020.h +0 -32
index 085e0ae8a450..1893b8aa0abb 100644
@@ -2,38 +2,6 @@
 #ifndef __NVIF_IF0020_H__
 #define __NVIF_IF0020_H__
 
-union nvif_chan_args {
-	struct nvif_chan_v0 {
-		__u8  version;
-		__u8  namelen;
-		__u8  runlist;
-		__u8  runq;
-		__u8  priv;
-		__u8  pad05;
-		__u16 devm;
-		__u64 vmm;
-
-		__u64 ctxdma;
-		__u64 offset;
-		__u64 length;
-
-		__u64 huserd;
-		__u64 ouserd;
-
-		__u32 token;
-		__u16 chid;
-		__u8  pad3e;
-#define NVIF_CHAN_V0_INST_APER_VRAM 0
-#define NVIF_CHAN_V0_INST_APER_HOST 1
-#define NVIF_CHAN_V0_INST_APER_NCOH 2
-#define NVIF_CHAN_V0_INST_APER_INST 0xff
-		__u8  aper;
-		__u64 inst;
-
-		__u8  name[];
-	} v0;
-};
-
 union nvif_chan_event_args {
 	struct nvif_chan_event_v0 {
 		__u8 version;
drivers/gpu/drm/nouveau/nouveau_abi16.c +7 -7
index fdbc982ea566..d7db5c0eeaea 100644
@@ -430,13 +430,13 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
 	 */
 	switch (device->info.family) {
 	case NV_DEVICE_INFO_V0_VOLTA:
-		ret = nvif_object_ctor(&chan->chan->user, "abi16CeWar", 0, VOLTA_DMA_COPY_A,
+		ret = nvif_object_ctor(&chan->chan->chan.object, "abi16CeWar", 0, VOLTA_DMA_COPY_A,
 				       NULL, 0, &chan->ce);
 		if (ret)
 			goto done;
 		break;
 	case NV_DEVICE_INFO_V0_TURING:
-		ret = nvif_object_ctor(&chan->chan->user, "abi16CeWar", 0, TURING_DMA_COPY_A,
+		ret = nvif_object_ctor(&chan->chan->chan.object, "abi16CeWar", 0, TURING_DMA_COPY_A,
 				       NULL, 0, &chan->ce);
 		if (ret)
 			goto done;
@@ -524,7 +524,7 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
 	if (!chan)
 		return nouveau_abi16_put(abi16, -ENOENT);
 
-	ret = nvif_object_sclass_get(&chan->chan->user, &sclass);
+	ret = nvif_object_sclass_get(&chan->chan->chan.object, &sclass);
 	if (ret < 0)
 		return nouveau_abi16_put(abi16, ret);
 
@@ -583,7 +583,7 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
 
 	list_add(&ntfy->head, &chan->notifiers);
 
-	ret = nvif_object_ctor(&chan->chan->user, "abi16EngObj", init->handle,
+	ret = nvif_object_ctor(&chan->chan->chan.object, "abi16EngObj", init->handle,
 			       oclass, NULL, 0, &ntfy->object);
 
 	if (ret)
@@ -645,7 +645,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
 		args.limit += chan->ntfy->offset;
 	}
 
-	ret = nvif_object_ctor(&chan->chan->user, "abi16Ntfy", info->handle,
+	ret = nvif_object_ctor(&chan->chan->chan.object, "abi16Ntfy", info->handle,
 			       NV_DMA_IN_MEMORY, &args, sizeof(args),
 			       &ntfy->object);
 	if (ret)
@@ -768,7 +768,7 @@ nouveau_abi16_ioctl_new(struct nouveau_abi16 *abi16, struct nvif_ioctl_v0 *ioctl
 	if (IS_ERR(obj))
 		return PTR_ERR(obj);
 
-	ret = nvif_object_ctor(&chan->chan->user, "abi16EngObj", args->handle, args->oclass,
+	ret = nvif_object_ctor(&chan->chan->chan.object, "abi16EngObj", args->handle, args->oclass,
 			       NULL, 0, &obj->engobj.object);
 	if (ret)
 		nouveau_abi16_obj_del(obj);
@@ -796,7 +796,7 @@ nouveau_abi16_ioctl_sclass(struct nouveau_abi16 *abi16, struct nvif_ioctl_v0 *io
 	if (!chan)
 		return -EINVAL;
 
-	ret = nvif_object_sclass_get(&chan->chan->user, &sclass);
+	ret = nvif_object_sclass_get(&chan->chan->chan.object, &sclass);
 	if (ret < 0)
 		return ret;
 
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -1
index 7db05d6699d8..6c5426fe2007 100644
@@ -965,7 +965,7 @@ nouveau_bo_move_init(struct nouveau_drm *drm)
 		if (chan == NULL)
 			continue;
 
-		ret = nvif_object_ctor(&chan->user, "ttmBoMove",
+		ret = nvif_object_ctor(&chan->chan.object, "ttmBoMove",
 				       mthd->oclass | (mthd->engine << 16),
 				       mthd->oclass, NULL, 0,
 				       &drm->ttm.copy);
drivers/gpu/drm/nouveau/nouveau_chan.c +34 -41

168 lines not on this page · raw message

drivers/gpu/drm/nouveau/nouveau_chan.h +3 -5
index 786c929843d1..8f71492e2df3 100644
@@ -4,13 +4,12 @@
 #include <nvif/object.h>
 #include <nvif/ctxdma.h>
 #include <nvif/event.h>
-#include <nvif/push.h>
+#include <nvif/chan.h>
 struct nvif_device;
 
 struct nouveau_channel {
-	struct {
-		struct nvif_push push;
-	} chan;
+	char name[TASK_COMM_LEN+16];
+	struct nvif_chan chan;
 
 	struct nouveau_cli *cli;
 	struct nouveau_vmm *vmm;
@@ -53,7 +52,6 @@ struct nouveau_channel {
 	u32 user_get;
 	u32 user_put;
 
-	struct nvif_object user;
 	struct nvif_object blit;
 
 	struct nvif_event kill;
drivers/gpu/drm/nouveau/nouveau_drm.c +3 -3
index 8ab6b9e03eb5..a2c9e8fa4ebd 100644
@@ -316,12 +316,12 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 	 * on TNT/TNT2 HW that lacks any kind of support in host.
 	 */
 	if (!drm->channel->nvsw.client && device->info.family < NV_DEVICE_INFO_V0_TESLA) {
-		ret = nvif_object_ctor(&drm->channel->user, "drmNvsw",
+		ret = nvif_object_ctor(&drm->channel->chan.object, "drmNvsw",
 				       NVDRM_NVSW, nouveau_abi16_swclass(drm),
 				       NULL, 0, &drm->channel->nvsw);
 
 		if (ret == 0 && device->info.chipset >= 0x11) {
-			ret = nvif_object_ctor(&drm->channel->user, "drmBlit",
+			ret = nvif_object_ctor(&drm->channel->chan.object, "drmBlit",
 					       0x005f, 0x009f,
 					       NULL, 0, &drm->channel->blit);
 		}
@@ -361,7 +361,7 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 			return;
 		}
 
-		ret = nvif_object_ctor(&drm->channel->user, "drmM2mfNtfy",
+		ret = nvif_object_ctor(&drm->channel->chan.object, "drmM2mfNtfy",
 				       NvNotify0, NV_DMA_IN_MEMORY,
 				       (&(struct nv_dma_v0) {
 						.target = NV_DMA_V0_TARGET_VRAM,
drivers/gpu/drm/nouveau/nouveau_fence.c +2 -1
index 09686d038d60..ff31784effeb 100644
@@ -210,7 +210,8 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha
 	args.host.version = 0;
 	args.host.type = NVIF_CHAN_EVENT_V0_NON_STALL_INTR;
 
-	ret = nvif_event_ctor(&chan->user, "fenceNonStallIntr", (chan->runlist << 16) | chan->chid,
+	ret = nvif_event_ctor(&chan->chan.object, "fenceNonStallIntr",
+			      (chan->runlist << 16) | chan->chid,
 			      nouveau_fence_wait_uevent_handler, false,
 			      &args.base, sizeof(args), &fctx->event);
 
drivers/gpu/drm/nouveau/nv17_fence.c +1 -1
index 5b4ceac49225..17ff00b22e9e 100644
@@ -92,7 +92,7 @@ nv17_fence_context_new(struct nouveau_channel *chan)
 	fctx->base.read = nv10_fence_read;
 	fctx->base.sync = nv17_fence_sync;
 
-	ret = nvif_object_ctor(&chan->user, "fenceCtxDma", NvSema,
+	ret = nvif_object_ctor(&chan->chan.object, "fenceCtxDma", NvSema,
 			       NV_DMA_FROM_MEMORY,
 			       (&(struct nv_dma_v0) {
 					.target = NV_DMA_V0_TARGET_VRAM,
drivers/gpu/drm/nouveau/nv50_fence.c +1 -1
index 1d8792fdd89b..b418439e6bb1 100644
@@ -51,7 +51,7 @@ nv50_fence_context_new(struct nouveau_channel *chan)
 	fctx->base.read = nv10_fence_read;
 	fctx->base.sync = nv17_fence_sync;
 
-	ret = nvif_object_ctor(&chan->user, "fenceCtxDma", NvSema,
+	ret = nvif_object_ctor(&chan->chan.object, "fenceCtxDma", NvSema,
 			       NV_DMA_IN_MEMORY,
 			       (&(struct nv_dma_v0) {
 					.target = NV_DMA_V0_TARGET_VRAM,
drivers/gpu/drm/nouveau/nvif/Kbuild +1 -0
index 50489933655c..757e10e8dce5 100644
@@ -2,6 +2,7 @@
 nvif-y := nvif/object.o
 nvif-y += nvif/client.o
 nvif-y += nvif/cgrp.o
+nvif-y += nvif/chan.o
 nvif-y += nvif/conn.o
 nvif-y += nvif/device.o
 nvif-y += nvif/disp.o
drivers/gpu/drm/nouveau/nvif/chan.c new file +45 -0

45 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/device/user.c +24 -0
index fc81d595bdb7..c1ccb75db3c1 100644
@@ -31,11 +31,13 @@
 #include <subdev/instmem.h>
 #include <subdev/timer.h>
 #include <subdev/mmu/ummu.h>
+#include <subdev/mmu/uvmm.h>
 #include <subdev/vfn/uvfn.h>
 #include <engine/disp/priv.h>
 #include <engine/disp/udisp.h>
 #include <engine/fifo/ufifo.h>
 #include <engine/fifo/ucgrp.h>
+#include <engine/fifo/uchan.h>
 
 struct nvif_device_priv {
 	struct nvkm_object object;
@@ -95,6 +97,27 @@ nvkm_udevice_time(struct nvif_device_priv *udev)
 	return nvkm_timer_read(udev->device->timer);
 }
 
+static int
+nvkm_udevice_chan_new(struct nvif_device_priv *udev, u8 runl, u8 runq, bool priv, u16 devm,
+		      struct nvif_vmm_priv *uvmm, struct nvif_ctxdma_priv *push,
+		      u64 offset, u64 length, struct nvif_mem_priv *userd, u16 userd_offset,
+		      const char *name, const struct nvif_chan_impl **pimpl,
+		      struct nvif_chan_priv **ppriv, u64 handle)
+{
+	struct nvkm_vmm *vmm = nvkm_uvmm_ref(uvmm);
+	struct nvkm_object *object;
+	int ret;
+
+	ret = nvkm_uchan_new(udev->device, NULL, runl, runq, priv, devm, vmm,
+			     push, offset, length, userd, userd_offset, name,
+			     pimpl, ppriv, &object);
+	nvkm_vmm_unref(&vmm);
+	if (ret)
+		return ret;
+
+	return nvkm_object_link_rb(udev->object.client, &udev->object, handle, object);
+}
+
 static int
 nvkm_udevice_cgrp_new(struct nvif_device_priv *udev, u8 runl, struct nvif_vmm_priv *uvmm,
 		      const char *name, const struct nvif_cgrp_impl **pimpl,
@@ -394,6 +417,7 @@ nvkm_udevice_new(struct nvkm_device *device,
 			nvkm_ufifo_ctor(device->fifo, &udev->impl.fifo);
 
 			udev->impl.fifo.cgrp.new = nvkm_udevice_cgrp_new;
+			udev->impl.fifo.chan.new = nvkm_udevice_chan_new;
 		}
 	}
 
drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +0 -39
index 1894a2075079..181c8cf426ab 100644
@@ -69,44 +69,6 @@ nvkm_fifo_fault(struct nvkm_fifo *fifo, struct nvkm_fault_data *info)
 	return fifo->func->mmu_fault->recover(fifo, info);
 }
 
-static int
-nvkm_fifo_class_new(struct nvkm_device *device, const struct nvkm_oclass *oclass,
-		    void *argv, u32 argc, struct nvkm_object **pobject)
-{
-	struct nvkm_fifo *fifo = nvkm_fifo(oclass->engine);
-
-	if (oclass->engn == &fifo->func->chan.user)
-		return nvkm_uchan_new(fifo, NULL, oclass, argv, argc, pobject);
-
-	WARN_ON(1);
-	return -ENOSYS;
-}
-
-static const struct nvkm_device_oclass
-nvkm_fifo_class = {
-	.ctor = nvkm_fifo_class_new,
-};
-
-static int
-nvkm_fifo_class_get(struct nvkm_oclass *oclass, int index, const struct nvkm_device_oclass **class)
-{
-	struct nvkm_fifo *fifo = nvkm_fifo(oclass->engine);
-	const struct nvkm_fifo_func_chan *chan = &fifo->func->chan;
-	int c = 0;
-
-	/* *_CHANNEL_DMA, *_CHANNEL_GPFIFO_* */
-	if (chan->user.oclass) {
-		if (c++ == index) {
-			oclass->base = chan->user;
-			oclass->engn = &fifo->func->chan.user;
-			*class = &nvkm_fifo_class;
-			return 0;
-		}
-	}
-
-	return c;
-}
-
 static int
 nvkm_fifo_fini(struct nvkm_engine *engine, bool suspend)
 {
@@ -281,7 +243,6 @@ nvkm_fifo = {
 	.oneinit = nvkm_fifo_oneinit,
 	.init = nvkm_fifo_init,
 	.fini = nvkm_fifo_fini,
-	.base.sclass = nvkm_fifo_class_get,
 };
 
 int
drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h +0 -3
index d1386d00fc36..cd02f31b601a 100644
@@ -205,7 +205,4 @@ extern const struct nvkm_engn_func ga100_engn;
 extern const struct nvkm_engn_func ga100_engn_ce;
 extern const struct nvkm_cgrp_func ga100_cgrp;
 extern const struct nvkm_chan_func ga100_chan;
-
-int nvkm_uchan_new(struct nvkm_fifo *, struct nvkm_cgrp *, const struct nvkm_oclass *,
-		   void *argv, u32 argc, struct nvkm_object **);
 #endif
drivers/gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.c +16 -24
index 8acfd85cee53..90a85c1c0b56 100644
@@ -25,6 +25,7 @@
 #include "runl.h"
 
 #include <subdev/mmu/uvmm.h>
+#include <engine/fifo/uchan.h>
 
 struct nvif_cgrp_priv {
 	struct nvkm_object object;
@@ -34,32 +35,23 @@ struct nvif_cgrp_priv {
 };
 
 static int
-nvkm_ucgrp_chan_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
-		    struct nvkm_object **pobject)
+nvkm_ucgrp_chan_new(struct nvif_cgrp_priv *ucgrp, u8 runq, bool priv, u16 devm,
+		    u64 gpfifo_offset, u64 gpfifo_length,
+		    struct nvif_mem_priv *userd, u16 userd_offset, const char *name,
+		    const struct nvif_chan_impl **pimpl, struct nvif_chan_priv **ppriv)
 {
-	struct nvkm_cgrp *cgrp = container_of(oclass->parent, struct nvif_cgrp_priv, object)->cgrp;
-
-	return nvkm_uchan_new(cgrp->runl->fifo, cgrp, oclass, argv, argc, pobject);
-}
+	struct nvkm_cgrp *cgrp = ucgrp->cgrp;
+	struct nvkm_object *object;
+	int ret;
 
-static int
-nvkm_ucgrp_sclass(struct nvkm_object *object, int index, struct nvkm_oclass *oclass)
-{
-	struct nvkm_cgrp *cgrp = container_of(object, struct nvif_cgrp_priv, object)->cgrp;
-	struct nvkm_fifo *fifo = cgrp->runl->fifo;
-	const struct nvkm_fifo_func_chan *chan = &fifo->func->chan;
-	int c = 0;
-
-	/* *_CHANNEL_GPFIFO_* */
-	if (chan->user.oclass) {
-		if (c++ == index) {
-			oclass->base = chan->user;
-			oclass->ctor = nvkm_ucgrp_chan_new;
-			return 0;
-		}
-	}
+	ret = nvkm_uchan_new(cgrp->runl->fifo->engine.subdev.device, cgrp, cgrp->runl->id,
+			     runq, priv, devm, cgrp->vmm, NULL, gpfifo_offset, gpfifo_length,
+			     userd, userd_offset, name, pimpl, ppriv, &object);
+	if (ret)
+		return ret;
 
-	return -EINVAL;
+	nvkm_object_link(&ucgrp->object, object);
+	return 0;
 }
 
 static void
@@ -73,6 +65,7 @@ nvkm_ucgrp_del(struct nvif_cgrp_priv *ucgrp)
 static const struct nvif_cgrp_impl
 nvkm_ucgrp_impl = {
 	.del = nvkm_ucgrp_del,
+	.chan.new = nvkm_ucgrp_chan_new,
 };
 
 static void *
@@ -87,7 +80,6 @@ nvkm_ucgrp_dtor(struct nvkm_object *object)
 static const struct nvkm_object_func
 nvkm_ucgrp = {
 	.dtor = nvkm_ucgrp_dtor,
-	.sclass = nvkm_ucgrp_sclass,
 };
 
 int
drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +63 -53

177 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.h new file +11 -0
new file mode 100644
index 000000000000..1ab4047644ef
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: MIT */
+#ifndef __NVKM_UCHAN_H__
+#define __NVKM_UCHAN_H__
+#include <engine/fifo.h>
+#include <nvif/driverif.h>
+
+int nvkm_uchan_new(struct nvkm_device *, struct nvkm_cgrp *, u8 runl, u8 runq, bool priv, u16 devm,
+		   struct nvkm_vmm *, struct nvif_ctxdma_priv *push, u64 offset, u64 length,
+		   struct nvif_mem_priv *userd, u16 userd_offset, const char *name,
+		   const struct nvif_chan_impl **, struct nvif_chan_priv **, struct nvkm_object **);
+#endif
Signature · 1 line
2.41.0
author
#138 lore raw

PATCH 137/156 drm/nouveau/nvif: remove mem from object rb

In reply to Ben Skeggs

- also removes umem list hack
- no more users

---
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  2 +-
 .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |  4 ---
 drivers/gpu/drm/nouveau/nvif/mem.c            |  3 +-
 .../gpu/drm/nouveau/nvkm/subdev/mmu/base.c    |  2 --
 .../gpu/drm/nouveau/nvkm/subdev/mmu/umem.c    | 36 -------------------
 .../gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c    |  5 +--
 6 files changed, 5 insertions(+), 47 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/driverif.h +1 -1
index cc858955a97b..0a460eaaf76b 100644
@@ -202,7 +202,7 @@ struct nvif_mmu_impl {
 	struct {
 		s32 oclass;
 		int (*new)(struct nvif_mmu_priv *, u8 type, u8 page, u64 size, void *argv, u32 argc,
-			   const struct nvif_mem_impl **, struct nvif_mem_priv **, u64 handle);
+			   const struct nvif_mem_impl **, struct nvif_mem_priv **);
 	} mem;
 
 	struct {
drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h +0 -4
index f2d23bfdf29a..6a1472b9499f 100644
@@ -109,7 +109,6 @@ int nvkm_vmm_map(struct nvkm_vmm *, struct nvkm_vma *, void *argv, u32 argc,
 		 struct nvkm_vmm_map *);
 void nvkm_vmm_unmap(struct nvkm_vmm *, struct nvkm_vma *);
 
-struct nvkm_memory *nvkm_umem_search(struct nvkm_mmu *, struct nvkm_client *, u64);
 struct nvkm_vmm *nvkm_uvmm_search(struct nvkm_client *, u64 handle);
 
 struct nvkm_mmu {
@@ -148,9 +147,6 @@ struct nvkm_mmu {
 	struct mutex mutex; /* serialises mmu invalidations */
 
 	struct nvkm_device_oclass user;
-
-	spinlock_t umem_lock;
-	struct list_head umem;
 };
 
 int nv04_mmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_mmu **);
drivers/gpu/drm/nouveau/nvif/mem.c +1 -2
index 91faecc4c080..3aa04ed651c8 100644
@@ -105,8 +105,7 @@ nvif_mem_ctor_type(struct nvif_mmu *mmu, const char *name,
 	if (type < 0)
 		return -EINVAL;
 
-	ret = mmu->impl->mem.new(mmu->priv, type, page, size, argv, argc, &mem->impl, &mem->priv,
-				 nvif_handle(&mem->object));
+	ret = mmu->impl->mem.new(mmu->priv, type, page, size, argv, argc, &mem->impl, &mem->priv);
 	NVIF_DEBUG(&mmu->object, "[NEW mem%08x] (ret:%d)", oclass, ret);
 	if (ret)
 		return ret;
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c +0 -2
index 08ad3ed84631..c7fe7222c3a3 100644
@@ -427,8 +427,6 @@ nvkm_mmu_ctor(const struct nvkm_mmu_func *func, struct nvkm_device *device,
 	nvkm_mmu_ptc_init(mmu);
 	mutex_init(&mmu->mutex);
 	mmu->user.base = func->mmu.user;
-	spin_lock_init(&mmu->umem_lock);
-	INIT_LIST_HEAD(&mmu->umem);
 }
 
 int
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c +0 -36
index 0676615093bb..93324d4f9d22 100644
@@ -57,35 +57,6 @@ nvkm_umem_ref(struct nvif_mem_priv *umem)
 	return NULL;
 }
 
-static const struct nvkm_object_func nvkm_umem;
-struct nvkm_memory *
-nvkm_umem_search(struct nvkm_mmu *mmu, struct nvkm_client *client, u64 handle)
-{
-	struct nvkm_client *master = client->object.client;
-	struct nvkm_memory *memory = NULL;
-	struct nvkm_object *object;
-	struct nvif_mem_priv *umem;
-
-	object = nvkm_object_search(client, handle, &nvkm_umem);
-	if (IS_ERR(object)) {
-		if (client != master) {
-			spin_lock(&mmu->umem_lock);
-			list_for_each_entry(umem, &mmu->umem, head) {
-				if (umem->object.object == handle) {
-					memory = nvkm_memory_ref(umem->memory);
-					break;
-				}
-			}
-			spin_unlock(&mmu->umem_lock);
-		}
-	} else {
-		umem = container_of(object, typeof(*umem), object);
-		memory = nvkm_memory_ref(umem->memory);
-	}
-
-	return memory ? memory : ERR_PTR(-ENOENT);
-}
-
 static int
 nvkm_umem_unmap(struct nvif_mem_priv *umem)
 {
@@ -163,9 +134,6 @@ nvkm_umem_dtor(struct nvkm_object *object)
 {
 	struct nvif_mem_priv *umem = container_of(object, typeof(*umem), object);
 
-	spin_lock(&umem->mmu->umem_lock);
-	list_del_init(&umem->head);
-	spin_unlock(&umem->mmu->umem_lock);
 	nvkm_memory_unref(&umem->memory);
 	return umem;
 }
@@ -203,10 +171,6 @@ nvkm_umem_new(struct nvkm_mmu *mmu, u8 type, u8 page, u64 size, void *argv, u32
 	if (ret)
 		return ret;
 
-	spin_lock(&mmu->umem_lock);
-	list_add(&umem->head, &mmu->umem);
-	spin_unlock(&mmu->umem_lock);
-
 	umem->impl = nvkm_umem_impl;
 	umem->impl.page = nvkm_memory_page(umem->memory);
 	umem->impl.addr = nvkm_memory_addr(umem->memory);
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c +3 -2
index 7afb68dc4bed..b3883758828d 100644
@@ -42,7 +42,7 @@ nvkm_ummu_vmm_new(struct nvif_mmu_priv *ummu, enum nvif_vmm_type type, u64 addr,
 
 static int
 nvkm_ummu_mem_new(struct nvif_mmu_priv *ummu, u8 type, u8 page, u64 size, void *argv, u32 argc,
-		  const struct nvif_mem_impl **pimpl, struct nvif_mem_priv **ppriv, u64 handle)
+		  const struct nvif_mem_impl **pimpl, struct nvif_mem_priv **ppriv)
 {
 	struct nvkm_object *object;
 	int ret;
@@ -51,7 +51,8 @@ nvkm_ummu_mem_new(struct nvif_mmu_priv *ummu, u8 type, u8 page, u64 size, void *
 	if (ret)
 		return ret;
 
-	return nvkm_object_link_rb(ummu->object.client, &ummu->object, handle, object);
+	nvkm_object_link(&ummu->object, object);
+	return 0;
 }
 
 static void
Signature · 1 line
2.41.0
author
#139 lore raw

PATCH 138/156 drm/nouveau/nvif: remove vmm from object rb

In reply to Ben Skeggs

- no more users

---
 drivers/gpu/drm/nouveau/include/nvif/driverif.h   |  3 +--
 drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h |  2 --
 drivers/gpu/drm/nouveau/nvif/vmm.c                |  3 +--
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c    |  5 +++--
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    | 13 -------------
 5 files changed, 5 insertions(+), 21 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/driverif.h +1 -2
index 0a460eaaf76b..de9c55dea9bf 100644
@@ -208,8 +208,7 @@ struct nvif_mmu_impl {
 	struct {
 		s32 oclass;
 		int (*new)(struct nvif_mmu_priv *, enum nvif_vmm_type type, u64 addr, u64 size,
-			   void *, u32, const struct nvif_vmm_impl **, struct nvif_vmm_priv **,
-			   u64 handle);
+			   void *, u32, const struct nvif_vmm_impl **, struct nvif_vmm_priv **);
 	} vmm;
 };
 
drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h +0 -2
index 6a1472b9499f..4e68fb5b2d2e 100644
@@ -109,8 +109,6 @@ int nvkm_vmm_map(struct nvkm_vmm *, struct nvkm_vma *, void *argv, u32 argc,
 		 struct nvkm_vmm_map *);
 void nvkm_vmm_unmap(struct nvkm_vmm *, struct nvkm_vma *);
 
-struct nvkm_vmm *nvkm_uvmm_search(struct nvkm_client *, u64 handle);
-
 struct nvkm_mmu {
 	const struct nvkm_mmu_func *func;
 	struct nvkm_subdev subdev;
drivers/gpu/drm/nouveau/nvif/vmm.c +1 -2
index fe342828ce8c..c12c79e7d9bd 100644
@@ -113,8 +113,7 @@ nvif_vmm_ctor(struct nvif_mmu *mmu, const char *name,
 	const u32 oclass = mmu->impl->vmm.oclass;
 	int ret;
 
-	ret = mmu->impl->vmm.new(mmu->priv, type, addr, size, argv, argc, &vmm->impl, &vmm->priv,
-				 nvif_handle(&vmm->object));
+	ret = mmu->impl->vmm.new(mmu->priv, type, addr, size, argv, argc, &vmm->impl, &vmm->priv);
 	NVIF_ERRON(ret, &mmu->object, "[NEW vmm%08x]", oclass);
 	if (ret)
 		return ret;
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c +3 -2
index b3883758828d..2734b75b34f3 100644
@@ -28,7 +28,7 @@
 static int
 nvkm_ummu_vmm_new(struct nvif_mmu_priv *ummu, enum nvif_vmm_type type, u64 addr, u64 size,
 		  void *argv, u32 argc, const struct nvif_vmm_impl **pimpl,
-		  struct nvif_vmm_priv **ppriv, u64 handle)
+		  struct nvif_vmm_priv **ppriv)
 {
 	struct nvkm_object *object;
 	int ret;
@@ -37,7 +37,8 @@ nvkm_ummu_vmm_new(struct nvif_mmu_priv *ummu, enum nvif_vmm_type type, u64 addr,
 	if (ret)
 		return ret;
 
-	return nvkm_object_link_rb(ummu->object.client, &ummu->object, handle, object);
+	nvkm_object_link(&ummu->object, object);
+	return 0;
 }
 
 static int
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c +0 -13
index 5fac19738815..571f79b90fd3 100644
@@ -42,19 +42,6 @@ nvkm_uvmm_ref(struct nvif_vmm_priv *uvmm)
 	return NULL;
 }
 
-static const struct nvkm_object_func nvkm_uvmm;
-struct nvkm_vmm *
-nvkm_uvmm_search(struct nvkm_client *client, u64 handle)
-{
-	struct nvkm_object *object;
-
-	object = nvkm_object_search(client, handle, &nvkm_uvmm);
-	if (IS_ERR(object))
-		return (void *)object;
-
-	return nvkm_vmm_ref(container_of(object, struct nvif_vmm_priv, object)->vmm);
-}
-
 static void
 nvkm_uvmm_fault_cancel(struct nvif_vmm_priv *uvmm, u64 inst, u8 hub, u8 gpc, u8 client)
 {
Signature · 1 line
2.41.0
author
#140 lore raw

PATCH 139/156 drm/nouveau/nvif: remove ctxdma from object rb

In reply to Ben Skeggs

- no more users

---
 drivers/gpu/drm/nouveau/include/nvif/driverif.h   |  3 +--
 drivers/gpu/drm/nouveau/include/nvkm/engine/dma.h |  2 --
 drivers/gpu/drm/nouveau/nvif/device.c             |  2 +-
 drivers/gpu/drm/nouveau/nvkm/device/user.c        |  6 +++---
 drivers/gpu/drm/nouveau/nvkm/engine/dma/user.c    | 13 -------------
 5 files changed, 5 insertions(+), 21 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/driverif.h +1 -2
index de9c55dea9bf..fac23a6ddc6d 100644
@@ -533,8 +533,7 @@ struct nvif_device_impl {
 
 	struct {
 		int (*new)(struct nvif_device_priv *, s32 oclass, void *argv, u32 argc,
-			   const struct nvif_ctxdma_impl **, struct nvif_ctxdma_priv **,
-			   u64 handle);
+			   const struct nvif_ctxdma_impl **, struct nvif_ctxdma_priv **);
 	} ctxdma;
 
 	struct nvif_device_impl_fifo {
drivers/gpu/drm/nouveau/include/nvkm/engine/dma.h +0 -2
index a003da39fd13..5a7ccdf8ae5c 100644
@@ -21,8 +21,6 @@ struct nvkm_dma {
 	struct nvkm_engine engine;
 };
 
-struct nvkm_dmaobj *nvkm_dmaobj_search(struct nvkm_client *, u64 object);
-
 int nv04_dma_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_dma **);
 int nv50_dma_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_dma **);
 int gf100_dma_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_dma **);
drivers/gpu/drm/nouveau/nvif/device.c +1 -1
index 555c63e96660..40bb0dd518e9 100644
@@ -33,7 +33,7 @@ nvif_device_ctxdma_ctor(struct nvif_device *device, const char *name, s32 oclass
 	int ret;
 
 	ret = device->impl->ctxdma.new(device->priv, oclass, argv, argc,
-				       &ctxdma->impl, &ctxdma->priv, nvif_handle(&ctxdma->object));
+				       &ctxdma->impl, &ctxdma->priv);
 	NVIF_ERRON(ret, &device->object, "[NEW ctxdma%04x]", oclass);
 	if (ret)
 		return ret;
drivers/gpu/drm/nouveau/nvkm/device/user.c +3 -3
index c1ccb75db3c1..efa675c8098f 100644
@@ -152,8 +152,7 @@ nvkm_udevice_ctxdma_impl = {
 
 static int
 nvkm_udevice_ctxdma_new(struct nvif_device_priv *udev, s32 oclass, void *argv, u32 argc,
-			const struct nvif_ctxdma_impl **pimpl, struct nvif_ctxdma_priv **ppriv,
-			u64 handle)
+			const struct nvif_ctxdma_impl **pimpl, struct nvif_ctxdma_priv **ppriv)
 {
 	struct nvkm_dma *dma = udev->device->dma;
 	struct nvkm_dmaobj *dmaobj;
@@ -167,7 +166,8 @@ nvkm_udevice_ctxdma_new(struct nvif_device_priv *udev, s32 oclass, void *argv, u
 	*pimpl = &nvkm_udevice_ctxdma_impl;
 	*ppriv = (void *)dmaobj;
 
-	return nvkm_object_link_rb(udev->object.client, &udev->object, handle, &dmaobj->object);
+	nvkm_object_link(&udev->object, &dmaobj->object);
+	return 0;
 }
 
 static int
drivers/gpu/drm/nouveau/nvkm/engine/dma/user.c +0 -13
index 463600e4f368..96634f503310 100644
@@ -30,19 +30,6 @@
 #include <nvif/cl0002.h>
 #include <nvif/unpack.h>
 
-static const struct nvkm_object_func nvkm_dmaobj_func;
-struct nvkm_dmaobj *
-nvkm_dmaobj_search(struct nvkm_client *client, u64 handle)
-{
-	struct nvkm_object *object;
-
-	object = nvkm_object_search(client, handle, &nvkm_dmaobj_func);
-	if (IS_ERR(object))
-		return (void *)object;
-
-	return nvkm_dmaobj(object);
-}
-
 static int
 nvkm_dmaobj_bind(struct nvkm_object *base, struct nvkm_gpuobj *gpuobj,
 		 int align, struct nvkm_gpuobj **pgpuobj)
Signature · 1 line
2.41.0
author
#141 lore raw

PATCH 140/156 drm/nouveau/nvif: remove device from object rb

In reply to Ben Skeggs

- no more users

---
 drivers/gpu/drm/nouveau/include/nvif/driverif.h | 3 +--
 drivers/gpu/drm/nouveau/nvif/device.c           | 3 +--
 drivers/gpu/drm/nouveau/nvkm/core/client.c      | 6 +++---
 3 files changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/driverif.h +1 -2
index fac23a6ddc6d..7dd2b187e6d6 100644
@@ -609,8 +609,7 @@ struct nvif_client_impl {
 
 	struct {
 		int (*new)(struct nvif_client_priv *,
-			   const struct nvif_device_impl **, struct nvif_device_priv **,
-			   u64 handle);
+			   const struct nvif_device_impl **, struct nvif_device_priv **);
 	} device;
 };
 #endif
drivers/gpu/drm/nouveau/nvif/device.c +1 -2
index 40bb0dd518e9..480034b5563b 100644
@@ -78,8 +78,7 @@ nvif_device_ctor(struct nvif_client *client, const char *name, struct nvif_devic
 
 	device->user.func = NULL;
 
-	ret = client->impl->device.new(client->priv, &device->impl, &device->priv,
-				       nvif_handle(&device->object));
+	ret = client->impl->device.new(client->priv, &device->impl, &device->priv);
 	NVIF_ERRON(ret, &client->object, "[NEW device]");
 	if (ret)
 		return ret;
drivers/gpu/drm/nouveau/nvkm/core/client.c +3 -3
index a77014b342c0..bcd375a8bc2a 100644
@@ -33,8 +33,7 @@
 
 static int
 nvkm_client_new_device(struct nvif_client_priv *client,
-		       const struct nvif_device_impl **pimpl, struct nvif_device_priv **ppriv,
-		       u64 handle)
+		       const struct nvif_device_impl **pimpl, struct nvif_device_priv **ppriv)
 {
 	struct nvkm_object *object;
 	int ret;
@@ -43,7 +42,8 @@ nvkm_client_new_device(struct nvif_client_priv *client,
 	if (ret)
 		return ret;
 
-	return nvkm_object_link_rb(client, &client->object, handle, object);
+	nvkm_object_link_(client, &client->object, object);
+	return 0;
 }
 
 static int
Signature · 1 line
2.41.0
author
#142 lore raw

PATCH 141/156 drm/nouveau/nvif: rework chan "map" api

In reply to Ben Skeggs

- transition from "ioctl" interface

---
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  2 +
 drivers/gpu/drm/nouveau/include/nvif/ioctl.h  | 17 ----
 drivers/gpu/drm/nouveau/include/nvif/object.h |  5 --
 .../drm/nouveau/include/nvkm/core/object.h    | 11 ---
 drivers/gpu/drm/nouveau/nouveau_chan.c        |  7 +-
 drivers/gpu/drm/nouveau/nvif/object.c         | 77 -------------------
 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c     | 62 ---------------
 drivers/gpu/drm/nouveau/nvkm/core/object.c    | 18 -----
 drivers/gpu/drm/nouveau/nvkm/core/oproxy.c    | 21 -----
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 26 ++-----
 10 files changed, 12 insertions(+), 234 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/driverif.h +2 -0
index 7dd2b187e6d6..75861e0327ac 100644
@@ -446,6 +446,8 @@ struct nvif_chan_impl {
 		} aper;
 		u64 addr;
 	} inst;
+
+	struct nvif_mapinfo map;
 };
 
 struct nvif_cgrp_impl {
drivers/gpu/drm/nouveau/include/nvif/ioctl.h +0 -17
index e825c8a1d9ca..0eb479695c0a 100644
@@ -8,8 +8,6 @@ struct nvif_ioctl_v0 {
 #define NVIF_IOCTL_V0_NEW                                                  0x02
 #define NVIF_IOCTL_V0_DEL                                                  0x03
 #define NVIF_IOCTL_V0_MTHD                                                 0x04
-#define NVIF_IOCTL_V0_MAP                                                  0x07
-#define NVIF_IOCTL_V0_UNMAP                                                0x08
 	__u8  type;
 	__u8  pad02[4];
 #define NVIF_IOCTL_V0_OWNER_NVIF                                           0x00
@@ -57,19 +55,4 @@ struct nvif_ioctl_mthd_v0 {
 	__u8  pad02[6];
 	__u8  data[];		/* method data (class.h) */
 };
-
-struct nvif_ioctl_map_v0 {
-	/* nvif_ioctl ... */
-	__u8  version;
-#define NVIF_IOCTL_MAP_V0_IO                                               0x00
-#define NVIF_IOCTL_MAP_V0_VA                                               0x01
-	__u8  type;
-	__u8  pad02[6];
-	__u64 handle;
-	__u64 length;
-	__u8  data[];
-};
-
-struct nvif_ioctl_unmap {
-};
 #endif
drivers/gpu/drm/nouveau/include/nvif/object.h +0 -5
index 10a8f3e1ea81..d52d59d9805d 100644
@@ -51,11 +51,6 @@ void nvif_object_sclass_put(struct nvif_sclass **);
 int  nvif_object_mthd(struct nvif_object *, u32, void *, u32);
 int nvif_object_map_cpu(struct nvif_object *, const struct nvif_mapinfo *, struct nvif_map *);
 int nvif_object_unmap_cpu(struct nvif_map *);
-int  nvif_object_map_handle(struct nvif_object *, void *, u32,
-			    u64 *handle, u64 *length);
-void nvif_object_unmap_handle(struct nvif_object *);
-int  nvif_object_map(struct nvif_object *, void *, u32);
-void nvif_object_unmap(struct nvif_object *);
 
 #define nvif_handle(a) (unsigned long)(void *)(a)
 #define nvif_object(a) (a)->object
drivers/gpu/drm/nouveau/include/nvkm/core/object.h +0 -11
index 9ab163d9a4d0..69972b0836e4 100644
@@ -19,20 +19,12 @@ struct nvkm_object {
 	struct rb_node node;
 };
 
-enum nvkm_object_map {
-	NVKM_OBJECT_MAP_IO,
-	NVKM_OBJECT_MAP_VA
-};
-
 struct nvkm_object_func {
 	void *(*dtor)(struct nvkm_object *);
 	int (*init)(struct nvkm_object *);
 	int (*fini)(struct nvkm_object *, bool suspend);
 	int (*mthd)(struct nvkm_object *, u32 mthd, void *data, u32 size);
 	int (*ntfy)(struct nvkm_object *, u32 mthd, struct nvkm_event **);
-	int (*map)(struct nvkm_object *, void *argv, u32 argc,
-		   enum nvkm_object_map *, u64 *addr, u64 *size);
-	int (*unmap)(struct nvkm_object *);
 	int (*bind)(struct nvkm_object *, struct nvkm_gpuobj *, int align,
 		    struct nvkm_gpuobj **);
 	int (*sclass)(struct nvkm_object *, int index, struct nvkm_oclass *);
@@ -52,9 +44,6 @@ int nvkm_object_init(struct nvkm_object *);
 int nvkm_object_fini(struct nvkm_object *, bool suspend);
 int nvkm_object_mthd(struct nvkm_object *, u32 mthd, void *data, u32 size);
 int nvkm_object_ntfy(struct nvkm_object *, u32 mthd, struct nvkm_event **);
-int nvkm_object_map(struct nvkm_object *, void *argv, u32 argc,
-		    enum nvkm_object_map *, u64 *addr, u64 *size);
-int nvkm_object_unmap(struct nvkm_object *);
 int nvkm_object_bind(struct nvkm_object *, struct nvkm_gpuobj *, int align,
 		     struct nvkm_gpuobj **);
 
drivers/gpu/drm/nouveau/nouveau_chan.c +2 -5
index 21927b817fa8..60be87d5fd59 100644
@@ -101,8 +101,6 @@ nouveau_channel_del(struct nouveau_channel **pchan)
 		nvif_object_dtor(&chan->gart);
 		nvif_object_dtor(&chan->vram);
 		nvif_event_dtor(&chan->kill);
-		if (!chan->userd.map.impl)
-			chan->userd.map.ptr = NULL;
 		nvif_object_unmap_cpu(&chan->userd.map);
 		nvif_chan_dtor(&chan->chan);
 		nvif_mem_dtor(&chan->userd.mem);
@@ -359,11 +357,10 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 	int ret, i;
 
 	if (!chan->userd.mem.impl) {
-		ret = nvif_object_map(&chan->chan.object, NULL, 0);
+		ret = nvif_object_map_cpu(&chan->chan.object, &chan->chan.impl->map,
+					  &chan->userd.map);
 		if (ret)
 			return ret;
-
-		chan->userd.map.ptr = chan->chan.object.map.ptr;
 	} else {
 		ret = nvif_mem_map(&chan->userd.mem, NULL, 0, &chan->userd.map);
 		if (ret)
drivers/gpu/drm/nouveau/nvif/object.c +0 -77

95 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +0 -62

74 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/core/object.c +0 -18
index d34a8ee1a0ae..8ad1aff9b8c7 100644
@@ -115,23 +115,6 @@ nvkm_object_ntfy(struct nvkm_object *object, u32 mthd,
 	return -ENODEV;
 }
 
-int
-nvkm_object_map(struct nvkm_object *object, void *argv, u32 argc,
-		enum nvkm_object_map *type, u64 *addr, u64 *size)
-{
-	if (likely(object->func->map))
-		return object->func->map(object, argv, argc, type, addr, size);
-	return -ENODEV;
-}
-
-int
-nvkm_object_unmap(struct nvkm_object *object)
-{
-	if (likely(object->func->unmap))
-		return object->func->unmap(object);
-	return -ENODEV;
-}
-
 int
 nvkm_object_bind(struct nvkm_object *object, struct nvkm_gpuobj *gpuobj,
 		 int align, struct nvkm_gpuobj **pgpuobj)
@@ -234,7 +217,6 @@ nvkm_object_dtor(struct nvkm_object *object)
 	}
 
 	nvif_debug(object, "destroy running...\n");
-	nvkm_object_unmap(object);
 	if (object->func->dtor)
 		data = object->func->dtor(object);
 	nvkm_engine_unref(&object->engine);
drivers/gpu/drm/nouveau/nvkm/core/oproxy.c +0 -21
index 5db80d1780f0..690131104d7b 100644
@@ -36,25 +36,6 @@ nvkm_oproxy_ntfy(struct nvkm_object *object, u32 mthd,
 	return nvkm_object_ntfy(nvkm_oproxy(object)->object, mthd, pevent);
 }
 
-static int
-nvkm_oproxy_map(struct nvkm_object *object, void *argv, u32 argc,
-		enum nvkm_object_map *type, u64 *addr, u64 *size)
-{
-	struct nvkm_oproxy *oproxy = nvkm_oproxy(object);
-	return nvkm_object_map(oproxy->object, argv, argc, type, addr, size);
-}
-
-static int
-nvkm_oproxy_unmap(struct nvkm_object *object)
-{
-	struct nvkm_oproxy *oproxy = nvkm_oproxy(object);
-
-	if (unlikely(!oproxy->object))
-		return 0;
-
-	return nvkm_object_unmap(oproxy->object);
-}
-
 static int
 nvkm_oproxy_bind(struct nvkm_object *object, struct nvkm_gpuobj *parent,
 		 int align, struct nvkm_gpuobj **pgpuobj)
@@ -159,8 +140,6 @@ nvkm_oproxy_func = {
 	.fini = nvkm_oproxy_fini,
 	.mthd = nvkm_oproxy_mthd,
 	.ntfy = nvkm_oproxy_ntfy,
-	.map = nvkm_oproxy_map,
-	.unmap = nvkm_oproxy_unmap,
 	.bind = nvkm_oproxy_bind,
 	.sclass = nvkm_oproxy_sclass,
 	.uevent = nvkm_oproxy_uevent,
drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +8 -18
index f21cd52d5ae3..e9279902c472 100644
@@ -254,23 +254,6 @@ nvkm_uchan_sclass(struct nvkm_object *object, int index, struct nvkm_oclass *ocl
 	return -EINVAL;
 }
 
-static int
-nvkm_uchan_map(struct nvkm_object *object, void *argv, u32 argc,
-	       enum nvkm_object_map *type, u64 *addr, u64 *size)
-{
-	struct nvkm_chan *chan = container_of(object, struct nvif_chan_priv, object)->chan;
-	struct nvkm_device *device = chan->cgrp->runl->fifo->engine.subdev.device;
-
-	if (chan->func->userd->bar < 0)
-		return -ENOSYS;
-
-	*type = NVKM_OBJECT_MAP_IO;
-	*addr = device->func->resource_addr(device, chan->func->userd->bar) +
-		chan->func->userd->base + chan->userd.base;
-	*size = chan->func->userd->size;
-	return 0;
-}
-
 static void
 nvkm_uchan_del(struct nvif_chan_priv *uchan)
 {
@@ -329,7 +312,6 @@ nvkm_uchan = {
 	.dtor = nvkm_uchan_dtor,
 	.init = nvkm_uchan_init,
 	.fini = nvkm_uchan_fini,
-	.map = nvkm_uchan_map,
 	.sclass = nvkm_uchan_sclass,
 	.uevent = nvkm_uchan_uevent,
 };
@@ -414,6 +396,14 @@ nvkm_uchan_new(struct nvkm_device *device, struct nvkm_cgrp *cgrp, u8 runi, u8 r
 
 	uchan->impl.inst.addr = nvkm_memory_addr(chan->inst->memory);
 
+	if (chan->func->userd->bar >= 0) {
+		uchan->impl.map.type = NVIF_MAP_IO;
+		uchan->impl.map.handle =
+			device->func->resource_addr(device, chan->func->userd->bar) +
+			chan->func->userd->base + chan->userd.base;
+		uchan->impl.map.length = chan->func->userd->size;
+	}
+
 	*pimpl = &uchan->impl;
 	*ppriv = uchan;
 	*pobject = &uchan->object;
Signature · 1 line
2.41.0
author
#143 lore raw

PATCH 142/156 drm/nouveau/nvif: rework chan "sclass" api

In reply to Ben Skeggs

- transition from "ioctl" interfaces

---
 drivers/gpu/drm/nouveau/include/nvif/fifo.h   |  2 +
 drivers/gpu/drm/nouveau/include/nvif/object.h |  8 --
 drivers/gpu/drm/nouveau/nouveau_abi16.c       | 91 +++++--------------
 drivers/gpu/drm/nouveau/nvif/fifo.c           | 13 +++
 drivers/gpu/drm/nouveau/nvif/object.c         | 51 -----------
 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c     | 27 +-----
 6 files changed, 40 insertions(+), 152 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/fifo.h +2 -0
index 4e9663848291..1a47cf96509f 100644
@@ -16,4 +16,6 @@ nvif_fifo_runlist_ce(struct nvif_device *device)
 		runmce = runmgr;
 	return runmce;
 }
+
+s32 nvif_fifo_engine_oclass(struct nvif_device *, enum nvif_engine_type);
 #endif
drivers/gpu/drm/nouveau/include/nvif/object.h +0 -8
index d52d59d9805d..56308333ef86 100644
@@ -3,12 +3,6 @@
 #define __NVIF_OBJECT_H__
 #include <nvif/os.h>
 
-struct nvif_sclass {
-	s32 oclass;
-	int minver;
-	int maxver;
-};
-
 struct nvif_object {
 	struct nvif_parent *parent;
 	struct nvif_client *client;
@@ -46,8 +40,6 @@ void nvif_object_ctor_1(struct nvif_object *parent, const char *name, u32 handle
 
 void nvif_object_dtor(struct nvif_object *);
 int  nvif_object_ioctl(struct nvif_object *, void *, u32, void **);
-int  nvif_object_sclass_get(struct nvif_object *, struct nvif_sclass **);
-void nvif_object_sclass_put(struct nvif_sclass **);
 int  nvif_object_mthd(struct nvif_object *, u32, void *, u32);
 int nvif_object_map_cpu(struct nvif_object *, const struct nvif_mapinfo *, struct nvif_map *);
 int nvif_object_unmap_cpu(struct nvif_map *);
drivers/gpu/drm/nouveau/nouveau_abi16.c +24 -67

142 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvif/fifo.c +13 -0
index 34e6fec0f0a3..6bf2c663583f 100644
@@ -21,6 +21,19 @@
  */
 #include <nvif/fifo.h>
 
+s32
+nvif_fifo_engine_oclass(struct nvif_device *device, enum nvif_engine_type type)
+{
+	const struct nvif_device_impl_fifo *impl = &device->impl->fifo;
+
+	for (int i = 0; i < impl->engine_nr; i++) {
+		if (impl->engine[i].type == type)
+			return impl->engine[i].oclass[0];
+	}
+
+	return 0;
+}
+
 u64
 nvif_fifo_runlist(struct nvif_device *device, enum nvif_engine_type type)
 {
drivers/gpu/drm/nouveau/nvif/object.c +0 -51

57 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +1 -26
index 66f843cac37d..b34ed158aa63 100644
@@ -60,32 +60,7 @@ static int
 nvkm_ioctl_sclass(struct nvkm_client *client,
 		  struct nvkm_object *object, void *data, u32 size)
 {
-	union {
-		struct nvif_ioctl_sclass_v0 v0;
-	} *args = data;
-	struct nvkm_oclass oclass = { .client = client };
-	int ret = -ENOSYS, i = 0;
-
-	nvif_ioctl(object, "sclass size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
-		nvif_ioctl(object, "sclass vers %d count %d\n",
-			   args->v0.version, args->v0.count);
-		if (size != args->v0.count * sizeof(args->v0.oclass[0]))
-			return -EINVAL;
-
-		while (nvkm_ioctl_sclass_(object, i, &oclass) >= 0) {
-			if (i < args->v0.count) {
-				args->v0.oclass[i].oclass = oclass.base.oclass;
-				args->v0.oclass[i].minver = oclass.base.minver;
-				args->v0.oclass[i].maxver = oclass.base.maxver;
-			}
-			i++;
-		}
-
-		args->v0.count = i;
-	}
-
-	return ret;
+	return -ENODEV;
 }
 
 static int
Signature · 1 line
2.41.0
author
#144 lore raw

PATCH 143/156 drm/nouveau/nvif: rework chan "new event" apis

In reply to Ben Skeggs

- transition from "ioctl" interfaces

---
 drivers/gpu/drm/nouveau/include/nvif/chan.h   |  6 +++
 drivers/gpu/drm/nouveau/include/nvif/class.h  |  1 -
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  7 +++
 drivers/gpu/drm/nouveau/include/nvif/if0020.h | 13 -----
 drivers/gpu/drm/nouveau/nouveau_chan.c        | 15 ++----
 drivers/gpu/drm/nouveau/nouveau_fence.c       | 17 ++----
 drivers/gpu/drm/nouveau/nvif/chan.c           | 17 ++++++
 .../gpu/drm/nouveau/nvkm/engine/fifo/chan.c   |  2 -
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 53 +++++++++----------
 9 files changed, 60 insertions(+), 71 deletions(-)
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0020.h
drivers/gpu/drm/nouveau/include/nvif/chan.h +6 -0
index 80f7ea8c7268..45c82cef6b1d 100644
@@ -3,6 +3,7 @@
 #define __NVIF_CHAN_H__
 #include <nvif/object.h>
 #include <nvif/driverif.h>
+#include <nvif/event.h>
 #include <nvif/push.h>
 struct nvif_cgrp;
 struct nvif_device;
@@ -22,4 +23,9 @@ struct nvif_chan {
 void nvif_chan_ctor(struct nvif_device *, struct nvif_cgrp *, const char *name, u8 runl, u8 runq,
 		    struct nvif_chan *);
 void nvif_chan_dtor(struct nvif_chan *);
+
+int nvif_chan_event_ctor(struct nvif_chan *, const char *name,
+			 int (*ctor)(struct nvif_chan_priv *, u64 token,
+				     const struct nvif_event_impl **, struct nvif_event_priv **),
+			 nvif_event_func, struct nvif_event *);
 #endif
drivers/gpu/drm/nouveau/include/nvif/class.h +0 -1
index 6174999eacd3..517bac332797 100644
@@ -33,7 +33,6 @@
 #define NVIF_CLASS_HEAD                              /* if0013.h */  0x80000013
 #define NVIF_CLASS_DISP_CHAN                         /* if0014.h */  0x80000014
 
-#define NVIF_CLASS_CHAN                              /* if0020.h */  0x80000020
 #define NVIF_CLASS_CGRP                              /* if0021.h */  0x80000021
 
 /* the below match nvidia-assigned (either in hw, or sw) class numbers */
drivers/gpu/drm/nouveau/include/nvif/driverif.h +7 -0
index 75861e0327ac..6e109da67bbe 100644
@@ -448,6 +448,13 @@ struct nvif_chan_impl {
 	} inst;
 
 	struct nvif_mapinfo map;
+
+	struct {
+		int (*killed)(struct nvif_chan_priv *, u64 token,
+			      const struct nvif_event_impl **, struct nvif_event_priv **);
+		int (*nonstall)(struct nvif_chan_priv *, u64 token,
+				const struct nvif_event_impl **, struct nvif_event_priv **);
+	} event;
 };
 
 struct nvif_cgrp_impl {
drivers/gpu/drm/nouveau/include/nvif/if0020.h deleted +0 -13
deleted file mode 100644
index 1893b8aa0abb..000000000000
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-#ifndef __NVIF_IF0020_H__
-#define __NVIF_IF0020_H__
-
-union nvif_chan_event_args {
-	struct nvif_chan_event_v0 {
-		__u8 version;
-#define NVIF_CHAN_EVENT_V0_NON_STALL_INTR 0x00
-#define NVIF_CHAN_EVENT_V0_KILLED         0x01
-		__u8 type;
-	} v0;
-};
-#endif
drivers/gpu/drm/nouveau/nouveau_chan.c +3 -12
index 60be87d5fd59..7116d61535f8 100644
@@ -25,7 +25,6 @@
 
 #include <nvif/class.h>
 #include <nvif/cl0002.h>
-#include <nvif/if0020.h>
 
 #include "nouveau_drv.h"
 #include "nouveau_dma.h"
@@ -368,17 +367,9 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 	}
 
 	if (chan->chan.object.oclass >= FERMI_CHANNEL_GPFIFO) {
-		struct {
-			struct nvif_event_v0 base;
-			struct nvif_chan_event_v0 host;
-		} args;
-
-		args.host.version = 0;
-		args.host.type = NVIF_CHAN_EVENT_V0_KILLED;
-
-		ret = nvif_event_ctor(&chan->chan.object, "abi16ChanKilled", chan->chid,
-				      nouveau_channel_killed, false,
-				      &args.base, sizeof(args), &chan->kill);
+		ret = nvif_chan_event_ctor(&chan->chan, "abi16ChanKilled",
+					   chan->chan.impl->event.killed,
+					   nouveau_channel_killed, &chan->kill);
 		if (ret == 0)
 			ret = nvif_event_allow(&chan->kill);
 		if (ret) {
drivers/gpu/drm/nouveau/nouveau_fence.c +3 -14
index ff31784effeb..9443cbaa8cff 100644
@@ -29,8 +29,6 @@
 #include <linux/sched/signal.h>
 #include <trace/events/dma_fence.h>
 
-#include <nvif/if0020.h>
-
 #include "nouveau_drv.h"
 #include "nouveau_dma.h"
 #include "nouveau_fence.h"
@@ -184,10 +182,6 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha
 	struct nouveau_cli *cli = chan->cli;
 	struct nouveau_drm *drm = cli->drm;
 	struct nouveau_fence_priv *priv = (void*)drm->fence;
-	struct {
-		struct nvif_event_v0 base;
-		struct nvif_chan_event_v0 host;
-	} args;
 	int ret;
 
 	INIT_WORK(&fctx->uevent_work, nouveau_fence_uevent_work);
@@ -207,14 +201,9 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha
 	if (!priv->uevent)
 		return;
 
-	args.host.version = 0;
-	args.host.type = NVIF_CHAN_EVENT_V0_NON_STALL_INTR;
-
-	ret = nvif_event_ctor(&chan->chan.object, "fenceNonStallIntr",
-			      (chan->runlist << 16) | chan->chid,
-			      nouveau_fence_wait_uevent_handler, false,
-			      &args.base, sizeof(args), &fctx->event);
-
+	ret = nvif_chan_event_ctor(&chan->chan, "fenceNonStallIntr",
+				   chan->chan.impl->event.nonstall,
+				   nouveau_fence_wait_uevent_handler, &fctx->event);
 	WARN_ON(ret);
 }
 
drivers/gpu/drm/nouveau/nvif/chan.c +17 -0
index cfca4dac5388..e8ade9a64d97 100644
@@ -23,6 +23,23 @@
 #include <nvif/cgrp.h>
 #include <nvif/device.h>
 
+int
+nvif_chan_event_ctor(struct nvif_chan *chan, const char *name,
+		     int (*ctor)(struct nvif_chan_priv *, u64,
+				 const struct nvif_event_impl **, struct nvif_event_priv **),
+		     nvif_event_func func, struct nvif_event *event)
+{
+	int ret;
+
+	ret = ctor(chan->priv, nvif_handle(&event->object), &event->impl, &event->priv);
+	NVIF_ERRON(ret, &chan->object, "[NEW EVENT]");
+	if (ret)
+		return ret;
+
+	nvif_event_ctor(&chan->object, name ?: "nvifChanEvent", 0, func, event);
+	return 0;
+}
+
 void
 nvif_chan_dtor(struct nvif_chan *chan)
 {
drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c +0 -2
index 7d4716dcd512..920e012d169b 100644
@@ -31,8 +31,6 @@
 #include <subdev/mmu.h>
 #include <engine/dma.h>
 
-#include <nvif/if0020.h>
-
 const struct nvkm_event_func
 nvkm_chan_event = {
 };
drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +24 -29

89 lines not on this page · raw message

Signature · 1 line
2.41.0
author
#145 lore raw

PATCH 144/156 drm/nouveau/nvif: rework chan "new ctxdma" api

In reply to Ben Skeggs

- transition from "ioctl" interface

---
 drivers/gpu/drm/nouveau/include/nvif/chan.h   |  4 ++
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  5 ++
 drivers/gpu/drm/nouveau/nouveau_abi16.c       | 15 +++---
 drivers/gpu/drm/nouveau/nouveau_abi16.h       |  3 +-
 drivers/gpu/drm/nouveau/nouveau_bo0039.c      |  4 +-
 drivers/gpu/drm/nouveau/nouveau_bo5039.c      |  6 +--
 drivers/gpu/drm/nouveau/nouveau_chan.c        | 16 +++---
 drivers/gpu/drm/nouveau/nouveau_chan.h        |  4 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         | 12 ++---
 drivers/gpu/drm/nouveau/nouveau_drv.h         |  3 +-
 drivers/gpu/drm/nouveau/nv10_fence.c          |  2 +-
 drivers/gpu/drm/nouveau/nv10_fence.h          |  2 +-
 drivers/gpu/drm/nouveau/nv17_fence.c          | 13 +++--
 drivers/gpu/drm/nouveau/nv50_fence.c          |  9 ++--
 drivers/gpu/drm/nouveau/nv84_fence.c          |  4 +-
 drivers/gpu/drm/nouveau/nvif/chan.c           | 17 +++++++
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 51 +++++++++++++++++++
 17 files changed, 125 insertions(+), 45 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/chan.h +4 -0
index 45c82cef6b1d..1115318f8b9d 100644
@@ -6,6 +6,7 @@
 #include <nvif/event.h>
 #include <nvif/push.h>
 struct nvif_cgrp;
+struct nvif_ctxdma;
 struct nvif_device;
 
 struct nvif_chan {
@@ -28,4 +29,7 @@ int nvif_chan_event_ctor(struct nvif_chan *, const char *name,
 			 int (*ctor)(struct nvif_chan_priv *, u64 token,
 				     const struct nvif_event_impl **, struct nvif_event_priv **),
 			 nvif_event_func, struct nvif_event *);
+
+int nvif_chan_ctxdma_ctor(struct nvif_chan *, const char *name, u32 handle, s32 oclass,
+			  void *argv, u32 argc, struct nvif_ctxdma *);
 #endif
drivers/gpu/drm/nouveau/include/nvif/driverif.h +5 -0
index 6e109da67bbe..8e805633ded5 100644
@@ -455,6 +455,11 @@ struct nvif_chan_impl {
 		int (*nonstall)(struct nvif_chan_priv *, u64 token,
 				const struct nvif_event_impl **, struct nvif_event_priv **);
 	} event;
+
+	struct {
+		int (*new)(struct nvif_chan_priv *, u32 handle, s32 oclass, void *argv, u32 argc,
+			   const struct nvif_ctxdma_impl **, struct nvif_ctxdma_priv **);
+	} ctxdma;
 };
 
 struct nvif_cgrp_impl {
drivers/gpu/drm/nouveau/nouveau_abi16.c +9 -6
index 36cf7b035973..ff310b48fa34 100644
@@ -138,7 +138,10 @@ static void
 nouveau_abi16_ntfy_fini(struct nouveau_abi16_chan *chan,
 			struct nouveau_abi16_ntfy *ntfy)
 {
-	nvif_object_dtor(&ntfy->object);
+	if (ntfy->ctxdma.impl)
+		nvif_ctxdma_dtor(&ntfy->ctxdma);
+	else
+		nvif_object_dtor(&ntfy->engobj);
 	nvkm_mm_free(&chan->heap, &ntfy->node);
 	list_del(&ntfy->head);
 	kfree(ntfy);
@@ -534,7 +537,7 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
 	list_add(&ntfy->head, &chan->notifiers);
 
 	ret = nvif_object_ctor(&chan->chan->chan.object, "abi16EngObj", init->handle,
-			       oclass, NULL, 0, &ntfy->object);
+			       oclass, NULL, 0, &ntfy->engobj);
 
 	if (ret)
 		nouveau_abi16_ntfy_fini(chan, ntfy);
@@ -595,9 +598,9 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
 		args.limit += chan->ntfy->offset;
 	}
 
-	ret = nvif_object_ctor(&chan->chan->chan.object, "abi16Ntfy", info->handle,
-			       NV_DMA_IN_MEMORY, &args, sizeof(args),
-			       &ntfy->object);
+	ret = nvif_chan_ctxdma_ctor(&chan->chan->chan, "abi16Ntfy", info->handle,
+				    NV_DMA_IN_MEMORY, &args, sizeof(args),
+				    &ntfy->ctxdma);
 	if (ret)
 		goto done;
 
@@ -628,7 +631,7 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS)
 	nouveau_channel_idle(chan->chan);
 
 	list_for_each_entry(ntfy, &chan->notifiers, head) {
-		if (ntfy->object.handle == fini->handle) {
+		if (ntfy->ctxdma.object.handle == fini->handle) {
 			nouveau_abi16_ntfy_fini(chan, ntfy);
 			ret = 0;
 			break;
drivers/gpu/drm/nouveau/nouveau_abi16.h +2 -1
index af6b4e1cefd2..fdf239545c41 100644
@@ -13,7 +13,8 @@ int nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS);
 int nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS);
 
 struct nouveau_abi16_ntfy {
-	struct nvif_object object;
+	struct nvif_ctxdma ctxdma;
+	struct nvif_object engobj;
 	struct list_head head;
 	struct nvkm_mm_node *node;
 };
drivers/gpu/drm/nouveau/nouveau_bo0039.c +2 -2
index 0b6758e024a1..a69fc865bfcd 100644
@@ -40,7 +40,7 @@ nouveau_bo_mem_ctxdma(struct ttm_buffer_object *bo,
 {
 	if (reg->mem_type == TTM_PL_TT)
 		return NvDmaTT;
-	return chan->vram.handle;
+	return chan->vram.object.handle;
 }
 
 int
@@ -104,6 +104,6 @@ nv04_bo_move_init(struct nouveau_channel *chan, u32 handle)
 		return ret;
 
 	PUSH_MTHD(push, NV039, SET_OBJECT, handle);
-	PUSH_MTHD(push, NV039, SET_CONTEXT_DMA_NOTIFIES, chan->cli->drm->ntfy.handle);
+	PUSH_MTHD(push, NV039, SET_CONTEXT_DMA_NOTIFIES, chan->cli->drm->ntfy.object.handle);
 	return 0;
 }
drivers/gpu/drm/nouveau/nouveau_bo5039.c +3 -3
index c3de17548d97..9fd03b68d56d 100644
@@ -144,8 +144,8 @@ nv50_bo_move_init(struct nouveau_channel *chan, u32 handle)
 		return ret;
 
 	PUSH_MTHD(push, NV5039, SET_OBJECT, handle);
-	PUSH_MTHD(push, NV5039, SET_CONTEXT_DMA_NOTIFY, chan->cli->drm->ntfy.handle,
-				SET_CONTEXT_DMA_BUFFER_IN, chan->vram.handle,
-				SET_CONTEXT_DMA_BUFFER_OUT, chan->vram.handle);
+	PUSH_MTHD(push, NV5039, SET_CONTEXT_DMA_NOTIFY, chan->cli->drm->ntfy.object.handle,
+				SET_CONTEXT_DMA_BUFFER_IN, chan->vram.object.handle,
+				SET_CONTEXT_DMA_BUFFER_OUT, chan->vram.object.handle);
 	return 0;
 }
drivers/gpu/drm/nouveau/nouveau_chan.c +8 -8
index 7116d61535f8..5ac0756714c1 100644
@@ -97,8 +97,8 @@ nouveau_channel_del(struct nouveau_channel **pchan)
 
 		nvif_object_dtor(&chan->blit);
 		nvif_object_dtor(&chan->nvsw);
-		nvif_object_dtor(&chan->gart);
-		nvif_object_dtor(&chan->vram);
+		nvif_ctxdma_dtor(&chan->gart);
+		nvif_ctxdma_dtor(&chan->vram);
 		nvif_event_dtor(&chan->kill);
 		nvif_object_unmap_cpu(&chan->userd.map);
 		nvif_chan_dtor(&chan->chan);
@@ -393,9 +393,9 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 			args.limit = device->info.ram_user - 1;
 		}
 
-		ret = nvif_object_ctor(&chan->chan.object, "abi16ChanVramCtxDma", vram,
-				       NV_DMA_IN_MEMORY, &args, sizeof(args),
-				       &chan->vram);
+		ret = nvif_chan_ctxdma_ctor(&chan->chan, "abi16ChanVramCtxDma", vram,
+					    NV_DMA_IN_MEMORY, &args, sizeof(args),
+					    &chan->vram);
 		if (ret)
 			return ret;
 
@@ -417,9 +417,9 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 			args.limit = chan->vmm->vmm.impl->limit - 1;
 		}
 
-		ret = nvif_object_ctor(&chan->chan.object, "abi16ChanGartCtxDma", gart,
-				       NV_DMA_IN_MEMORY, &args, sizeof(args),
-				       &chan->gart);
+		ret = nvif_chan_ctxdma_ctor(&chan->chan, "abi16ChanGartCtxDma", gart,
+					    NV_DMA_IN_MEMORY, &args, sizeof(args),
+					    &chan->gart);
 		if (ret)
 			return ret;
 	}
drivers/gpu/drm/nouveau/nouveau_chan.h +2 -2
index 8f71492e2df3..1340c64c4357 100644
@@ -24,8 +24,8 @@ struct nouveau_channel {
 	u64 inst;
 	u32 token;
 
-	struct nvif_object vram;
-	struct nvif_object gart;
+	struct nvif_ctxdma vram;
+	struct nvif_ctxdma gart;
 	struct nvif_object nvsw;
 
 	struct {
drivers/gpu/drm/nouveau/nouveau_drm.c +6 -6
index a2c9e8fa4ebd..28347aa056b8 100644
@@ -285,7 +285,7 @@ static void
 nouveau_accel_gr_fini(struct nouveau_drm *drm)
 {
 	nouveau_channel_idle(drm->channel);
-	nvif_object_dtor(&drm->ntfy);
+	nvif_ctxdma_dtor(&drm->ntfy);
 	nvkm_gpuobj_del(&drm->notify);
 	nouveau_channel_del(&drm->channel);
 }
@@ -361,15 +361,15 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 			return;
 		}
 
-		ret = nvif_object_ctor(&drm->channel->chan.object, "drmM2mfNtfy",
-				       NvNotify0, NV_DMA_IN_MEMORY,
-				       (&(struct nv_dma_v0) {
+		ret = nvif_chan_ctxdma_ctor(&drm->channel->chan, "drmM2mfNtfy",
+					    NvNotify0, NV_DMA_IN_MEMORY,
+					    &(struct nv_dma_v0) {
 						.target = NV_DMA_V0_TARGET_VRAM,
 						.access = NV_DMA_V0_ACCESS_RDWR,
 						.start = drm->notify->addr,
 						.limit = drm->notify->addr + 31
-				       }), sizeof(struct nv_dma_v0),
-				       &drm->ntfy);
+					    }, sizeof(struct nv_dma_v0),
+					    &drm->ntfy);
 		if (ret) {
 			nouveau_accel_gr_fini(drm);
 			return;
drivers/gpu/drm/nouveau/nouveau_drv.h +2 -1
index 823fa6d87690..3d661148943c 100644
@@ -41,6 +41,7 @@
 #include <linux/notifier.h>
 
 #include <nvif/client.h>
+#include <nvif/ctxdma.h>
 #include <nvif/device.h>
 #include <nvif/ioctl.h>
 #include <nvif/mmu.h>
@@ -271,7 +272,7 @@ struct nouveau_drm {
 	struct nouveau_channel *cechan;
 	struct nouveau_channel *channel;
 	struct nvkm_gpuobj *notify;
-	struct nvif_object ntfy;
+	struct nvif_ctxdma ntfy;
 
 	/* nv10-nv40 tiling regions */
 	struct {
drivers/gpu/drm/nouveau/nv10_fence.c +1 -1
index cbef6ef4bfb7..3e9f184dd4e8 100644
@@ -60,7 +60,7 @@ nv10_fence_context_del(struct nouveau_channel *chan)
 {
 	struct nv10_fence_chan *fctx = chan->fence;
 	nouveau_fence_context_del(&fctx->base);
-	nvif_object_dtor(&fctx->sema);
+	nvif_ctxdma_dtor(&fctx->sema);
 	chan->fence = NULL;
 	nouveau_fence_context_free(&fctx->base);
 }
drivers/gpu/drm/nouveau/nv10_fence.h +1 -1
index 300cf3fdbb46..414dfb81e812 100644
@@ -7,7 +7,7 @@
 
 struct nv10_fence_chan {
 	struct nouveau_fence_chan base;
-	struct nvif_object sema;
+	struct nvif_ctxdma sema;
 };
 
 struct nv10_fence_priv {
drivers/gpu/drm/nouveau/nv17_fence.c +6 -7
index 17ff00b22e9e..ba499dfb621d 100644
@@ -54,7 +54,7 @@ nv17_fence_sync(struct nouveau_fence *fence,
 
 	ret = PUSH_WAIT(ppush, 5);
 	if (!ret) {
-		PUSH_MTHD(ppush, NV176E, SET_CONTEXT_DMA_SEMAPHORE, fctx->sema.handle,
+		PUSH_MTHD(ppush, NV176E, SET_CONTEXT_DMA_SEMAPHORE, fctx->sema.object.handle,
 					 SEMAPHORE_OFFSET, 0,
 					 SEMAPHORE_ACQUIRE, value + 0,
 					 SEMAPHORE_RELEASE, value + 1);
@@ -62,7 +62,7 @@ nv17_fence_sync(struct nouveau_fence *fence,
 	}
 
 	if (!ret && !(ret = PUSH_WAIT(npush, 5))) {
-		PUSH_MTHD(npush, NV176E, SET_CONTEXT_DMA_SEMAPHORE, fctx->sema.handle,
+		PUSH_MTHD(npush, NV176E, SET_CONTEXT_DMA_SEMAPHORE, fctx->sema.object.handle,
 					 SEMAPHORE_OFFSET, 0,
 					 SEMAPHORE_ACQUIRE, value + 1,
 					 SEMAPHORE_RELEASE, value + 2);
@@ -92,15 +92,14 @@ nv17_fence_context_new(struct nouveau_channel *chan)
 	fctx->base.read = nv10_fence_read;
 	fctx->base.sync = nv17_fence_sync;
 
-	ret = nvif_object_ctor(&chan->chan.object, "fenceCtxDma", NvSema,
-			       NV_DMA_FROM_MEMORY,
-			       (&(struct nv_dma_v0) {
+	ret = nvif_chan_ctxdma_ctor(&chan->chan, "fenceCtxDma", NvSema, NV_DMA_FROM_MEMORY,
+				    &(struct nv_dma_v0) {
 					.target = NV_DMA_V0_TARGET_VRAM,
 					.access = NV_DMA_V0_ACCESS_RDWR,
 					.start = start,
 					.limit = limit,
-			       }), sizeof(struct nv_dma_v0),
-			       &fctx->sema);
+				    }, sizeof(struct nv_dma_v0),
+				    &fctx->sema);
 	if (ret)
 		nv10_fence_context_del(chan);
 	return ret;
drivers/gpu/drm/nouveau/nv50_fence.c +4 -5
index b418439e6bb1..405a3f8ff4d4 100644
@@ -51,15 +51,14 @@ nv50_fence_context_new(struct nouveau_channel *chan)
 	fctx->base.read = nv10_fence_read;
 	fctx->base.sync = nv17_fence_sync;
 
-	ret = nvif_object_ctor(&chan->chan.object, "fenceCtxDma", NvSema,
-			       NV_DMA_IN_MEMORY,
-			       (&(struct nv_dma_v0) {
+	ret = nvif_chan_ctxdma_ctor(&chan->chan, "fenceCtxDma", NvSema, NV_DMA_IN_MEMORY,
+				    &(struct nv_dma_v0) {
 					.target = NV_DMA_V0_TARGET_VRAM,
 					.access = NV_DMA_V0_ACCESS_RDWR,
 					.start = start,
 					.limit = limit,
-			       }), sizeof(struct nv_dma_v0),
-			       &fctx->sema);
+				    }, sizeof(struct nv_dma_v0),
+				    &fctx->sema);
 	if (ret)
 		nv10_fence_context_del(chan);
 	return ret;
drivers/gpu/drm/nouveau/nv84_fence.c +2 -2
index a9cbea2d1cc0..0626c24ca065 100644
@@ -38,7 +38,7 @@ nv84_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
 	struct nvif_push *push = &chan->chan.push;
 	int ret = PUSH_WAIT(push, 8);
 	if (ret == 0) {
-		PUSH_MTHD(push, NV826F, SET_CONTEXT_DMA_SEMAPHORE, chan->vram.handle);
+		PUSH_MTHD(push, NV826F, SET_CONTEXT_DMA_SEMAPHORE, chan->vram.object.handle);
 
 		PUSH_MTHD(push, NV826F, SEMAPHOREA,
 			  NVVAL(NV826F, SEMAPHOREA, OFFSET_UPPER, upper_32_bits(virtual)),
@@ -61,7 +61,7 @@ nv84_fence_sync32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
 	struct nvif_push *push = &chan->chan.push;
 	int ret = PUSH_WAIT(push, 7);
 	if (ret == 0) {
-		PUSH_MTHD(push, NV826F, SET_CONTEXT_DMA_SEMAPHORE, chan->vram.handle);
+		PUSH_MTHD(push, NV826F, SET_CONTEXT_DMA_SEMAPHORE, chan->vram.object.handle);
 
 		PUSH_MTHD(push, NV826F, SEMAPHOREA,
 			  NVVAL(NV826F, SEMAPHOREA, OFFSET_UPPER, upper_32_bits(virtual)),
drivers/gpu/drm/nouveau/nvif/chan.c +17 -0
index e8ade9a64d97..78f380ef01b7 100644
@@ -21,8 +21,25 @@
  */
 #include <nvif/chan.h>
 #include <nvif/cgrp.h>
+#include <nvif/ctxdma.h>
 #include <nvif/device.h>
 
+int
+nvif_chan_ctxdma_ctor(struct nvif_chan *chan, const char *name, u32 handle, s32 oclass,
+		      void *argv, u32 argc, struct nvif_ctxdma *ctxdma)
+{
+	int ret;
+
+	ret = chan->impl->ctxdma.new(chan->priv, handle, oclass, argv, argc,
+				     &ctxdma->impl, &ctxdma->priv);
+	NVIF_ERRON(ret, &chan->object, "[NEW ctxdma%04x handle:%08x]", oclass, handle);
+	if (ret)
+		return ret;
+
+	nvif_ctxdma_ctor(&chan->object, name ?: "nvifChanCtxDma", handle, oclass, ctxdma);
+	return 0;
+}
+
 int
 nvif_chan_event_ctor(struct nvif_chan *chan, const char *name,
 		     int (*ctor)(struct nvif_chan_priv *, u64,
drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +51 -0

63 lines not on this page · raw message

Signature · 1 line
2.41.0
author
#146 lore raw

PATCH 145/156 drm/nouveau/nvif: rework chan "new engobj" apis

In reply to Ben Skeggs

- transition from "ioctl" interfaces

---
 drivers/gpu/drm/nouveau/dispnv04/disp.c       |   2 +-
 drivers/gpu/drm/nouveau/include/nvif/chan.h   |  10 ++
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  11 ++
 drivers/gpu/drm/nouveau/nouveau_abi16.c       |  31 ++---
 drivers/gpu/drm/nouveau/nouveau_abi16.h       |   4 +-
 drivers/gpu/drm/nouveau/nouveau_bo.c          |   9 +-
 drivers/gpu/drm/nouveau/nouveau_chan.c        |  11 +-
 drivers/gpu/drm/nouveau/nouveau_chan.h        |   4 +-
 drivers/gpu/drm/nouveau/nouveau_dmem.c        |   2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         |  18 ++-
 drivers/gpu/drm/nouveau/nouveau_drv.h         |   3 +-
 drivers/gpu/drm/nouveau/nv04_fence.c          |   2 +-
 drivers/gpu/drm/nouveau/nvif/chan.c           |  51 +++++++
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 124 ++++++++++++------
 14 files changed, 200 insertions(+), 82 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/disp.c +1 -1
index e8b27bb135e7..3e10ba2ed20f 100644
@@ -236,7 +236,7 @@ nv04_display_create(struct drm_device *dev)
 
 	/* Request page flip completion event. */
 	if (drm->channel) {
-		ret = nvif_event_ctor(&drm->channel->nvsw, "kmsFlip", 0, nv04_flip_complete,
+		ret = nvif_event_ctor(&drm->channel->nvsw.object, "kmsFlip", 0, nv04_flip_complete,
 				      true, NULL, 0, &disp->flip);
 		if (ret)
 			return ret;
drivers/gpu/drm/nouveau/include/nvif/chan.h +10 -0
index 1115318f8b9d..d43c6ba2a35e 100644
@@ -32,4 +32,14 @@ int nvif_chan_event_ctor(struct nvif_chan *, const char *name,
 
 int nvif_chan_ctxdma_ctor(struct nvif_chan *, const char *name, u32 handle, s32 oclass,
 			  void *argv, u32 argc, struct nvif_ctxdma *);
+
+struct nvif_engobj {
+	const struct nvif_engobj_impl *impl;
+	struct nvif_engobj_priv *priv;
+	struct nvif_object object;
+};
+
+int nvif_engobj_ctor(struct nvif_chan *chan, const char *name, u32 handle, s32 oclass,
+		     struct nvif_engobj *);
+void nvif_engobj_dtor(struct nvif_engobj *);
 #endif
drivers/gpu/drm/nouveau/include/nvif/driverif.h +11 -0
index 8e805633ded5..69428a879c37 100644
@@ -21,6 +21,7 @@ struct nvif_disp_chan_priv;
 struct nvif_ctxdma_priv;
 struct nvif_cgrp_priv;
 struct nvif_chan_priv;
+struct nvif_engobj_priv;
 
 struct nvif_driver {
 	const char *name;
@@ -431,6 +432,10 @@ struct nvif_disp_impl {
 	} chan;
 };
 
+struct nvif_engobj_impl {
+	void (*del)(struct nvif_engobj_priv *);
+};
+
 struct nvif_chan_impl {
 	void (*del)(struct nvif_chan_priv *);
 
@@ -460,6 +465,12 @@ struct nvif_chan_impl {
 		int (*new)(struct nvif_chan_priv *, u32 handle, s32 oclass, void *argv, u32 argc,
 			   const struct nvif_ctxdma_impl **, struct nvif_ctxdma_priv **);
 	} ctxdma;
+
+	struct {
+		int (*new)(struct nvif_chan_priv *, u32 handle, u8 engi, s32 oclass,
+			   const struct nvif_engobj_impl **, struct nvif_engobj_priv **,
+			   u64 object);
+	} engobj;
 };
 
 struct nvif_cgrp_impl {
drivers/gpu/drm/nouveau/nouveau_abi16.c +16 -15
index ff310b48fa34..8cc7b2410a04 100644
@@ -81,9 +81,7 @@ struct nouveau_abi16_obj {
 	u64 object;
 
 	union {
-		struct {
-			struct nvif_object object;
-		} engobj;
+		struct nvif_engobj engobj;
 	};
 
 	struct list_head head;
@@ -141,7 +139,7 @@ nouveau_abi16_ntfy_fini(struct nouveau_abi16_chan *chan,
 	if (ntfy->ctxdma.impl)
 		nvif_ctxdma_dtor(&ntfy->ctxdma);
 	else
-		nvif_object_dtor(&ntfy->engobj);
+		nvif_engobj_dtor(&ntfy->engobj);
 	nvkm_mm_free(&chan->heap, &ntfy->node);
 	list_del(&ntfy->head);
 	kfree(ntfy);
@@ -179,7 +177,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
 
 	/* destroy channel object, all children will be killed too */
 	if (chan->chan) {
-		nvif_object_dtor(&chan->ce);
+		nvif_engobj_dtor(&chan->ce);
 		nouveau_channel_del(&chan->chan);
 	}
 
@@ -400,7 +398,7 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
 	if (device->info.family < NV_DEVICE_INFO_V0_CELSIUS) {
 		init->subchan[0].handle = 0x00000000;
 		init->subchan[0].grclass = 0x0000;
-		init->subchan[1].handle = chan->chan->nvsw.handle;
+		init->subchan[1].handle = chan->chan->nvsw.object.handle;
 		init->subchan[1].grclass = 0x506e;
 		init->nr_subchan = 2;
 	}
@@ -415,14 +413,14 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
 	 */
 	switch (device->info.family) {
 	case NV_DEVICE_INFO_V0_VOLTA:
-		ret = nvif_object_ctor(&chan->chan->chan.object, "abi16CeWar", 0, VOLTA_DMA_COPY_A,
-				       NULL, 0, &chan->ce);
+		ret = nvif_engobj_ctor(&chan->chan->chan, "abi16CeWar", 0, VOLTA_DMA_COPY_A,
+				       &chan->ce);
 		if (ret)
 			goto done;
 		break;
 	case NV_DEVICE_INFO_V0_TURING:
-		ret = nvif_object_ctor(&chan->chan->chan.object, "abi16CeWar", 0, TURING_DMA_COPY_A,
-				       NULL, 0, &chan->ce);
+		ret = nvif_engobj_ctor(&chan->chan->chan, "abi16CeWar", 0, TURING_DMA_COPY_A,
+				       &chan->ce);
 		if (ret)
 			goto done;
 		break;
@@ -536,8 +534,8 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
 
 	list_add(&ntfy->head, &chan->notifiers);
 
-	ret = nvif_object_ctor(&chan->chan->chan.object, "abi16EngObj", init->handle,
-			       oclass, NULL, 0, &ntfy->engobj);
+	ret = nvif_engobj_ctor(&chan->chan->chan, "abi16EngObj", init->handle, oclass,
+			       &ntfy->engobj);
 
 	if (ret)
 		nouveau_abi16_ntfy_fini(chan, ntfy);
@@ -680,8 +678,11 @@ nouveau_abi16_ioctl_del(struct nouveau_abi16 *abi16, struct nvif_ioctl_v0 *ioctl
 		return -EINVAL;
 
 	obj = nouveau_abi16_obj_find(abi16, ioctl->object);
-	if (obj)
+	if (obj) {
+		if (obj->type == ENGOBJ)
+			nvif_engobj_dtor(&obj->engobj);
 		nouveau_abi16_obj_del(obj);
+	}
 
 	return 0;
 }
@@ -721,8 +722,8 @@ nouveau_abi16_ioctl_new(struct nouveau_abi16 *abi16, struct nvif_ioctl_v0 *ioctl
 	if (IS_ERR(obj))
 		return PTR_ERR(obj);
 
-	ret = nvif_object_ctor(&chan->chan->chan.object, "abi16EngObj", args->handle, args->oclass,
-			       NULL, 0, &obj->engobj.object);
+	ret = nvif_engobj_ctor(&chan->chan->chan, "abi16EngObj", args->handle, args->oclass,
+			       &obj->engobj);
 	if (ret)
 		nouveau_abi16_obj_del(obj);
 
drivers/gpu/drm/nouveau/nouveau_abi16.h +2 -2
index fdf239545c41..c37d304e3f5f 100644
@@ -14,7 +14,7 @@ int nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS);
 
 struct nouveau_abi16_ntfy {
 	struct nvif_ctxdma ctxdma;
-	struct nvif_object engobj;
+	struct nvif_engobj engobj;
 	struct list_head head;
 	struct nvkm_mm_node *node;
 };
@@ -22,7 +22,7 @@ struct nouveau_abi16_ntfy {
 struct nouveau_abi16_chan {
 	struct list_head head;
 	struct nouveau_channel *chan;
-	struct nvif_object ce;
+	struct nvif_engobj ce;
 	struct list_head notifiers;
 	struct nouveau_bo *ntfy;
 	struct nouveau_vma *ntfy_vma;
drivers/gpu/drm/nouveau/nouveau_bo.c +4 -5
index 6c5426fe2007..a94735ec3a9e 100644
@@ -965,14 +965,13 @@ nouveau_bo_move_init(struct nouveau_drm *drm)
 		if (chan == NULL)
 			continue;
 
-		ret = nvif_object_ctor(&chan->chan.object, "ttmBoMove",
-				       mthd->oclass | (mthd->engine << 16),
-				       mthd->oclass, NULL, 0,
+		ret = nvif_engobj_ctor(&chan->chan, "ttmBoMove",
+				       (mthd->engine << 16) | mthd->oclass, mthd->oclass,
 				       &drm->ttm.copy);
 		if (ret == 0) {
-			ret = mthd->init(chan, drm->ttm.copy.handle);
+			ret = mthd->init(chan, drm->ttm.copy.object.handle);
 			if (ret) {
-				nvif_object_dtor(&drm->ttm.copy);
+				nvif_engobj_dtor(&drm->ttm.copy);
 				continue;
 			}
 
drivers/gpu/drm/nouveau/nouveau_chan.c +5 -6
index 5ac0756714c1..80099dfcd3d5 100644
@@ -95,8 +95,8 @@ nouveau_channel_del(struct nouveau_channel **pchan)
 		if (chan->chan.impl)
 			nouveau_svmm_part(chan->vmm->svmm, chan->inst);
 
-		nvif_object_dtor(&chan->blit);
-		nvif_object_dtor(&chan->nvsw);
+		nvif_engobj_dtor(&chan->blit);
+		nvif_engobj_dtor(&chan->nvsw);
 		nvif_ctxdma_dtor(&chan->gart);
 		nvif_ctxdma_dtor(&chan->vram);
 		nvif_event_dtor(&chan->kill);
@@ -459,9 +459,8 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 
 	/* allocate software object class (used for fences on <= nv05) */
 	if (device->info.family < NV_DEVICE_INFO_V0_CELSIUS) {
-		ret = nvif_object_ctor(&chan->chan.object, "abi16NvswFence", 0x006e,
-				       NVIF_CLASS_SW_NV04,
-				       NULL, 0, &chan->nvsw);
+		ret = nvif_engobj_ctor(&chan->chan, "abi16NvswFence", 0x006e,
+				       NVIF_CLASS_SW_NV04, &chan->nvsw);
 		if (ret)
 			return ret;
 
@@ -469,7 +468,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 		if (ret)
 			return ret;
 
-		PUSH_NVSQ(&chan->chan.push, NV_SW, 0x0000, chan->nvsw.handle);
+		PUSH_NVSQ(&chan->chan.push, NV_SW, 0x0000, chan->nvsw.object.handle);
 		PUSH_KICK(&chan->chan.push);
 	}
 
drivers/gpu/drm/nouveau/nouveau_chan.h +2 -2
index 1340c64c4357..b1dbffd93894 100644
@@ -26,7 +26,7 @@ struct nouveau_channel {
 
 	struct nvif_ctxdma vram;
 	struct nvif_ctxdma gart;
-	struct nvif_object nvsw;
+	struct nvif_engobj nvsw;
 
 	struct {
 		struct nouveau_bo *buffer;
@@ -52,7 +52,7 @@ struct nouveau_channel {
 	u32 user_get;
 	u32 user_put;
 
-	struct nvif_object blit;
+	struct nvif_engobj blit;
 
 	struct nvif_event kill;
 	atomic_t killed;
drivers/gpu/drm/nouveau/nouveau_dmem.c +1 -1
index fed91756846f..a0c24456e031 100644
@@ -570,7 +570,7 @@ nvc0b5_migrate_clear(struct nouveau_drm *drm, u32 length,
 static int
 nouveau_dmem_migrate_init(struct nouveau_drm *drm)
 {
-	switch (drm->ttm.copy.oclass) {
+	switch (drm->ttm.copy.object.oclass) {
 	case PASCAL_DMA_COPY_A:
 	case PASCAL_DMA_COPY_B:
 	case  VOLTA_DMA_COPY_A:
drivers/gpu/drm/nouveau/nouveau_drm.c +8 -10
index 28347aa056b8..ae6b992c32f9 100644
@@ -257,7 +257,7 @@ static void
 nouveau_accel_ce_fini(struct nouveau_drm *drm)
 {
 	nouveau_channel_idle(drm->cechan);
-	nvif_object_dtor(&drm->ttm.copy);
+	nvif_engobj_dtor(&drm->ttm.copy);
 	nouveau_channel_del(&drm->cechan);
 }
 
@@ -315,15 +315,13 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 	 * synchronisation of page flips, as well as to implement fences
 	 * on TNT/TNT2 HW that lacks any kind of support in host.
 	 */
-	if (!drm->channel->nvsw.client && device->info.family < NV_DEVICE_INFO_V0_TESLA) {
-		ret = nvif_object_ctor(&drm->channel->chan.object, "drmNvsw",
-				       NVDRM_NVSW, nouveau_abi16_swclass(drm),
-				       NULL, 0, &drm->channel->nvsw);
+	if (device->info.family < NV_DEVICE_INFO_V0_TESLA) {
+		ret = nvif_engobj_ctor(&drm->channel->chan, "drmNvSw", NVDRM_NVSW,
+				       nouveau_abi16_swclass(drm), &drm->channel->nvsw);
 
 		if (ret == 0 && device->info.chipset >= 0x11) {
-			ret = nvif_object_ctor(&drm->channel->chan.object, "drmBlit",
-					       0x005f, 0x009f,
-					       NULL, 0, &drm->channel->blit);
+			ret = nvif_engobj_ctor(&drm->channel->chan, "drmBlit", 0x005f, 0x009f,
+					       &drm->channel->blit);
 		}
 
 		if (ret == 0) {
@@ -332,12 +330,12 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 			ret = PUSH_WAIT(push, 8);
 			if (ret == 0) {
 				if (device->info.chipset >= 0x11) {
-					PUSH_NVSQ(push, NV05F, 0x0000, drm->channel->blit.handle);
+					PUSH_NVSQ(push, NV05F, 0x0000, 0x005f);
 					PUSH_NVSQ(push, NV09F, 0x0120, 0,
 							       0x0124, 1,
 							       0x0128, 2);
 				}
-				PUSH_NVSQ(push, NV_SW, 0x0000, drm->channel->nvsw.handle);
+				PUSH_NVSQ(push, NV_SW, 0x0000, drm->channel->nvsw.object.handle);
 			}
 		}
 
drivers/gpu/drm/nouveau/nouveau_drv.h +2 -1
index 3d661148943c..e40416c884a8 100644
@@ -40,6 +40,7 @@
 
 #include <linux/notifier.h>
 
+#include <nvif/chan.h>
 #include <nvif/client.h>
 #include <nvif/ctxdma.h>
 #include <nvif/device.h>
@@ -237,7 +238,7 @@ struct nouveau_drm {
 			    struct ttm_buffer_object *,
 			    struct ttm_resource *, struct ttm_resource *);
 		struct nouveau_channel *chan;
-		struct nvif_object copy;
+		struct nvif_engobj copy;
 		int mtrr;
 		int type_vram;
 		int type_host[2];
drivers/gpu/drm/nouveau/nv04_fence.c +1 -1
index fa5c6029f783..802a051428e2 100644
@@ -59,7 +59,7 @@ static u32
 nv04_fence_read(struct nouveau_channel *chan)
 {
 	struct nv04_nvsw_get_ref_v0 args = {};
-	WARN_ON(nvif_object_mthd(&chan->nvsw, NV04_NVSW_GET_REF,
+	WARN_ON(nvif_object_mthd(&chan->nvsw.object, NV04_NVSW_GET_REF,
 				 &args, sizeof(args)));
 	return args.ref;
 }
drivers/gpu/drm/nouveau/nvif/chan.c +51 -0

57 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +86 -38

166 lines not on this page · raw message

Signature · 1 line
2.41.0
author
#147 lore raw

PATCH 146/156 drm/nouveau/nvif: remove chan from object rb

In reply to Ben Skeggs

- no more users

---
 drivers/gpu/drm/nouveau/include/nvif/driverif.h | 3 +--
 drivers/gpu/drm/nouveau/nouveau_chan.c          | 3 +--
 drivers/gpu/drm/nouveau/nvkm/device/user.c      | 5 +++--
 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/driverif.h +1 -2
index 69428a879c37..b25c91542e66 100644
@@ -618,8 +618,7 @@ struct nvif_device_impl {
 				   struct nvif_vmm_priv *, struct nvif_ctxdma_priv *push,
 				   u64 offset, u64 length, struct nvif_mem_priv *userd,
 				   u16 userd_offset, const char *name,
-				   const struct nvif_chan_impl **, struct nvif_chan_priv **,
-				   u64 handle);
+				   const struct nvif_chan_impl **, struct nvif_chan_priv **);
 		} chan;
 	} fifo;
 };
drivers/gpu/drm/nouveau/nouveau_chan.c +1 -2
index 80099dfcd3d5..54816bcca14c 100644
@@ -333,8 +333,7 @@ nouveau_channel_ctor(struct nouveau_cli *cli, bool priv, u64 runm,
 	ret = device->impl->fifo.chan.new(device->priv, device->impl->fifo.runl[chan->runlist].id,
 					  0, priv, BIT(0), vmm, ctxdma, offset, length,
 					  userd, userd_offset, chan->name,
-					  &chan->chan.impl, &chan->chan.priv,
-					  nvif_handle(&chan->chan.object));
+					  &chan->chan.impl, &chan->chan.priv);
 	if (ret) {
 		nouveau_channel_del(pchan);
 		return ret;
drivers/gpu/drm/nouveau/nvkm/device/user.c +3 -2
index efa675c8098f..d7b41b990d56 100644
@@ -102,7 +102,7 @@ nvkm_udevice_chan_new(struct nvif_device_priv *udev, u8 runl, u8 runq, bool priv
 		      struct nvif_vmm_priv *uvmm, struct nvif_ctxdma_priv *push,
 		      u64 offset, u64 length, struct nvif_mem_priv *userd, u16 userd_offset,
 		      const char *name, const struct nvif_chan_impl **pimpl,
-		      struct nvif_chan_priv **ppriv, u64 handle)
+		      struct nvif_chan_priv **ppriv)
 {
 	struct nvkm_vmm *vmm = nvkm_uvmm_ref(uvmm);
 	struct nvkm_object *object;
@@ -115,7 +115,8 @@ nvkm_udevice_chan_new(struct nvif_device_priv *udev, u8 runl, u8 runq, bool priv
 	if (ret)
 		return ret;
 
-	return nvkm_object_link_rb(udev->object.client, &udev->object, handle, object);
+	nvkm_object_link(&udev->object, object);
+	return 0;
 }
 
 static int
Signature · 1 line
2.41.0
author
#148 lore raw

PATCH 147/156 drm/nouveau/nvif: rework engobj "mthd" api

In reply to Ben Skeggs

- transition from "ioctl" interface

---
 drivers/gpu/drm/nouveau/include/nvif/driverif.h  | 1 +
 drivers/gpu/drm/nouveau/nv04_fence.c             | 7 +++++--
 drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c | 9 +++++++++
 drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c   | 1 -
 4 files changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/driverif.h +1 -0
index b25c91542e66..d8a30af9eae7 100644
@@ -434,6 +434,7 @@ struct nvif_disp_impl {
 
 struct nvif_engobj_impl {
 	void (*del)(struct nvif_engobj_priv *);
+	int (*mthd)(struct nvif_engobj_priv *, u32 mthd, void *argv, u32 argc);
 };
 
 struct nvif_chan_impl {
drivers/gpu/drm/nouveau/nv04_fence.c +5 -2
index 802a051428e2..45398b3a825e 100644
@@ -59,8 +59,11 @@ static u32
 nv04_fence_read(struct nouveau_channel *chan)
 {
 	struct nv04_nvsw_get_ref_v0 args = {};
-	WARN_ON(nvif_object_mthd(&chan->nvsw.object, NV04_NVSW_GET_REF,
-				 &args, sizeof(args)));
+	int ret;
+
+	ret = chan->nvsw.impl->mthd(chan->nvsw.priv, NV04_NVSW_GET_REF, &args, sizeof(args));
+	WARN_ON(ret);
+
 	return args.ref;
 }
 
drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +9 -0
index 6e5a0d980446..6682245e4928 100644
@@ -46,6 +46,14 @@ struct nvkm_uobj {
 	int hash;
 };
 
+static int
+nvkm_uchan_object_mthd(struct nvif_engobj_priv *priv, u32 mthd, void *argv, u32 argc)
+{
+	struct nvkm_uobj *uobj = (void *)priv;
+
+	return nvkm_object_mthd(&uobj->oproxy.base, mthd, argv, argc);
+}
+
 static void
 nvkm_uchan_object_del(struct nvif_engobj_priv *priv)
 {
@@ -59,6 +67,7 @@ nvkm_uchan_object_del(struct nvif_engobj_priv *priv)
 static const struct nvif_engobj_impl
 nvkm_uchan_object_impl = {
 	.del = nvkm_uchan_object_del,
+	.mthd = nvkm_uchan_object_mthd,
 };
 
 static int
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +0 -1
index 986e8d547c94..8ecc53ff6487 100644
@@ -230,7 +230,6 @@ gf100_fermi_mthd_zbc_depth(struct nvkm_object *object, void *data, u32 size)
 static int
 gf100_fermi_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
 {
-	nvif_ioctl(object, "fermi mthd %08x\n", mthd);
 	switch (mthd) {
 	case FERMI_A_ZBC_COLOR:
 		return gf100_fermi_mthd_zbc_color(object, data, size);
Signature · 1 line
2.41.0
author
#149 lore raw

PATCH 148/156 drm/nouveau/nvif: rework engobj "new event" api

In reply to Ben Skeggs

- transition from "ioctl" interface

---
 drivers/gpu/drm/nouveau/dispnv04/disp.c       |  8 ++-
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  5 ++
 drivers/gpu/drm/nouveau/include/nvif/event.h  | 21 +------
 drivers/gpu/drm/nouveau/include/nvif/if000e.h | 26 --------
 drivers/gpu/drm/nouveau/include/nvif/object.h |  3 -
 .../gpu/drm/nouveau/include/nvkm/core/event.h |  1 -
 .../drm/nouveau/include/nvkm/core/object.h    |  6 +-
 .../gpu/drm/nouveau/include/nvkm/core/os.h    |  1 -
 drivers/gpu/drm/nouveau/nvif/event.c          | 46 +-------------
 drivers/gpu/drm/nouveau/nvif/object.c         | 29 ---------
 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c     | 32 +---------
 drivers/gpu/drm/nouveau/nvkm/core/oproxy.c    | 13 ----
 drivers/gpu/drm/nouveau/nvkm/core/uevent.c    | 62 -------------------
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 13 ++++
 drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c | 14 ++---
 15 files changed, 36 insertions(+), 244 deletions(-)
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if000e.h
drivers/gpu/drm/nouveau/dispnv04/disp.c +6 -2
index 3e10ba2ed20f..3d564512b0f6 100644
@@ -236,10 +236,14 @@ nv04_display_create(struct drm_device *dev)
 
 	/* Request page flip completion event. */
 	if (drm->channel) {
-		ret = nvif_event_ctor(&drm->channel->nvsw.object, "kmsFlip", 0, nv04_flip_complete,
-				      true, NULL, 0, &disp->flip);
+		ret = drm->channel->nvsw.impl->event.new(drm->channel->nvsw.priv,
+							 nvif_handle(&disp->flip.object),
+							 &disp->flip.impl, &disp->flip.priv);
 		if (ret)
 			return ret;
+
+		nvif_event_ctor(&drm->channel->nvsw.object, "kmsFlip", 0, nv04_flip_complete,
+				&disp->flip);
 	}
 
 	nouveau_hw_save_vga_fonts(dev, 1);
drivers/gpu/drm/nouveau/include/nvif/driverif.h +5 -0
index d8a30af9eae7..244024c19206 100644
@@ -435,6 +435,11 @@ struct nvif_disp_impl {
 struct nvif_engobj_impl {
 	void (*del)(struct nvif_engobj_priv *);
 	int (*mthd)(struct nvif_engobj_priv *, u32 mthd, void *argv, u32 argc);
+
+	struct {
+		int (*new)(struct nvif_engobj_priv *, u64 token,
+			   const struct nvif_event_impl **, struct nvif_event_priv **);
+	} event;
 };
 
 struct nvif_chan_impl {
drivers/gpu/drm/nouveau/include/nvif/event.h +2 -19
index 338082bdc67c..42c2d0b5f66b 100644
@@ -2,7 +2,6 @@
 #ifndef __NVIF_EVENT_H__
 #define __NVIF_EVENT_H__
 #include <nvif/object.h>
-#include <nvif/if000e.h>
 struct nvif_event;
 
 #define NVIF_EVENT_KEEP 0
@@ -23,30 +22,14 @@ nvif_event_constructed(struct nvif_event *event)
 	return nvif_object_constructed(&event->object);
 }
 
-int nvif_event_ctor_(struct nvif_object *, const char *, u32, nvif_event_func, bool,
-		     struct nvif_event_v0 *, u32, bool, struct nvif_event *);
-
-static inline int
-nvif_event_ctor_0(struct nvif_object *parent, const char *name, u32 handle, nvif_event_func func,
-		  bool wait, struct nvif_event_v0 *args, u32 argc, struct nvif_event *event)
-{
-	return nvif_event_ctor_(parent, name, handle, func, wait, args, argc, true, event);
-}
-
 static inline void
-nvif_event_ctor_1(struct nvif_object *parent, const char *name, u32 handle,
-		  nvif_event_func func, struct nvif_event *event)
+nvif_event_ctor(struct nvif_object *parent, const char *name, u32 handle,
+		nvif_event_func func, struct nvif_event *event)
 {
 	nvif_object_ctor(parent, name ?: "nvifEvent", handle, 0, &event->object);
 	event->func = func;
 }
 
-#define nvif_event_ctor__(A,B,C,D,E,F,G,H,IMPL,...) IMPL
-#define nvif_event_ctor(A...) nvif_event_ctor__(A, nvif_event_ctor_0, \
-						   nvif_event_ctor__, \
-						   nvif_event_ctor__, \
-						   nvif_event_ctor_1)(A)
-
 void nvif_event_dtor(struct nvif_event *);
 int nvif_event_allow(struct nvif_event *);
 int nvif_event_block(struct nvif_event *);
drivers/gpu/drm/nouveau/include/nvif/if000e.h deleted +0 -26
deleted file mode 100644
index 90a936cb1766..000000000000
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-#ifndef __NVIF_IF000E_H__
-#define __NVIF_IF000E_H__
-
-union nvif_event_args {
-	struct nvif_event_v0 {
-		__u8 version;
-		__u8 wait;
-		__u8 pad02[6];
-		__u8 data[];
-	} v0;
-};
-
-#define NVIF_EVENT_V0_ALLOW 0x00
-#define NVIF_EVENT_V0_BLOCK 0x01
-
-union nvif_event_allow_args {
-	struct nvif_event_allow_vn {
-	} vn;
-};
-
-union nvif_event_block_args {
-	struct nvif_event_block_vn {
-	} vn;
-};
-#endif
drivers/gpu/drm/nouveau/include/nvif/object.h +0 -3
index 56308333ef86..98a8bba8f0ee 100644
@@ -40,7 +40,6 @@ void nvif_object_ctor_1(struct nvif_object *parent, const char *name, u32 handle
 
 void nvif_object_dtor(struct nvif_object *);
 int  nvif_object_ioctl(struct nvif_object *, void *, u32, void **);
-int  nvif_object_mthd(struct nvif_object *, u32, void *, u32);
 int nvif_object_map_cpu(struct nvif_object *, const struct nvif_mapinfo *, struct nvif_map *);
 int nvif_object_unmap_cpu(struct nvif_map *);
 
@@ -67,8 +66,6 @@ int nvif_object_unmap_cpu(struct nvif_map *);
 	_data;                                                                 \
 })
 
-#define nvif_mthd(a,b,c,d) nvif_object_mthd((a), (b), (c), (d))
-
 #define NVIF_RD32_(p,o,dr)   nvif_rd32((p), (o) + (dr))
 #define NVIF_WR32_(p,o,dr,f) nvif_wr32((p), (o) + (dr), (f))
 #define NVIF_RD32(p,A...) DRF_RD(NVIF_RD32_,                  (p), 0, ##A)
drivers/gpu/drm/nouveau/include/nvkm/core/event.h +0 -1
index f31f0f30732a..76e05c8da979 100644
@@ -76,7 +76,6 @@ struct nvif_event_priv;
 int nvkm_uevent_new_(struct nvkm_object *parent, u64 handle, struct nvkm_event *event,
 		     bool wait, int id, u32 bits, nvkm_uevent_func,
 		     const struct nvif_event_impl **, struct nvif_event_priv **);
-int nvkm_uevent_new(const struct nvkm_oclass *, void *argv, u32 argc, struct nvkm_object **);
 int nvkm_uevent_add(struct nvif_event_priv *, struct nvkm_event *, int id, u32 bits,
 		    nvkm_uevent_func);
 #endif
drivers/gpu/drm/nouveau/include/nvkm/core/object.h +4 -2
index 69972b0836e4..de8bf1cc95d8 100644
@@ -4,7 +4,8 @@
 #include <core/oclass.h>
 struct nvkm_event;
 struct nvkm_gpuobj;
-struct nvkm_uevent;
+struct nvif_event_impl;
+struct nvif_event_priv;
 
 struct nvkm_object {
 	const struct nvkm_object_func *func;
@@ -28,7 +29,8 @@ struct nvkm_object_func {
 	int (*bind)(struct nvkm_object *, struct nvkm_gpuobj *, int align,
 		    struct nvkm_gpuobj **);
 	int (*sclass)(struct nvkm_object *, int index, struct nvkm_oclass *);
-	int (*uevent)(struct nvkm_object *, void *argv, u32 argc, struct nvkm_uevent *);
+	int (*uevent)(struct nvkm_object *, u64 token,
+		      const struct nvif_event_impl **, struct nvif_event_priv **);
 };
 
 void nvkm_object_ctor(const struct nvkm_object_func *,
drivers/gpu/drm/nouveau/include/nvkm/core/os.h +0 -1
index 9d16413239d4..056f182d9b0b 100644
@@ -31,6 +31,5 @@ nvkm_blob_dtor(struct nvkm_blob *blob)
 #define nvkm_list_foreach(p,h,m,c)                                                           \
 	for (p = nvkm_list_find(p, (h), m, (c)); p; p = nvkm_list_find_next(p, (h), m, (c)))
 
-#define nvkm_uevent nvif_event_priv
 #define nvkm_client nvif_client_priv
 #endif
drivers/gpu/drm/nouveau/nvif/event.c +1 -45

71 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvif/object.c +0 -29
index 9887241c5200..3379580463e6 100644
@@ -46,35 +46,6 @@ nvif_object_ioctl(struct nvif_object *object, void *data, u32 size, void **hack)
 	return client->driver->ioctl(client->object.priv, data, size, hack);
 }
 
-int
-nvif_object_mthd(struct nvif_object *object, u32 mthd, void *data, u32 size)
-{
-	struct {
-		struct nvif_ioctl_v0 ioctl;
-		struct nvif_ioctl_mthd_v0 mthd;
-	} *args;
-	u8 stack[128];
-	int ret;
-
-	if (sizeof(*args) + size > sizeof(stack)) {
-		if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL)))
-			return -ENOMEM;
-	} else {
-		args = (void *)stack;
-	}
-	args->ioctl.version = 0;
-	args->ioctl.type = NVIF_IOCTL_V0_MTHD;
-	args->mthd.version = 0;
-	args->mthd.method = mthd;
-
-	memcpy(args->mthd.data, data, size);
-	ret = nvif_object_ioctl(object, args, sizeof(*args) + size, NULL);
-	memcpy(data, args->mthd.data, size);
-	if (args != (void *)stack)
-		kfree(args);
-	return ret;
-}
-
 int
 nvif_object_unmap_cpu(struct nvif_map *map)
 {
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +1 -31
index b34ed158aa63..50e9a6d51c05 100644
@@ -24,7 +24,6 @@
 #include <core/ioctl.h>
 #include <core/client.h>
 #include <core/engine.h>
-#include <core/event.h>
 
 #include <nvif/unpack.h>
 #include <nvif/ioctl.h>
@@ -41,15 +40,6 @@ nvkm_ioctl_nop(struct nvkm_client *client,
 static int
 nvkm_ioctl_sclass_(struct nvkm_object *object, int index, struct nvkm_oclass *oclass)
 {
-	if ( object->func->uevent &&
-	    !object->func->uevent(object, NULL, 0, NULL) && index-- == 0) {
-		oclass->ctor = nvkm_uevent_new;
-		oclass->base.minver = 0;
-		oclass->base.maxver = 0;
-		oclass->base.oclass = NVIF_CLASS_EVENT;
-		return 0;
-	}
-
 	if (object->func->sclass)
 		return object->func->sclass(object, index, oclass);
 
@@ -82,7 +72,7 @@ nvkm_ioctl_new(struct nvkm_client *client,
 	} else
 		return ret;
 
-	if (!parent->func->sclass && !parent->func->uevent) {
+	if (!parent->func->sclass) {
 		nvif_ioctl(parent, "cannot have children\n");
 		return -EINVAL;
 	}
@@ -142,25 +132,6 @@ nvkm_ioctl_del(struct nvkm_client *client,
 	return ret ? ret : 1;
 }
 
-static int
-nvkm_ioctl_mthd(struct nvkm_client *client,
-		struct nvkm_object *object, void *data, u32 size)
-{
-	union {
-		struct nvif_ioctl_mthd_v0 v0;
-	} *args = data;
-	int ret = -ENOSYS;
-
-	nvif_ioctl(object, "mthd size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
-		nvif_ioctl(object, "mthd vers %d mthd %02x\n",
-			   args->v0.version, args->v0.method);
-		ret = nvkm_object_mthd(object, args->v0.method, data, size);
-	}
-
-	return ret;
-}
-
 static struct {
 	int version;
 	int (*func)(struct nvkm_client *, struct nvkm_object *, void *, u32);
@@ -170,7 +141,6 @@ nvkm_ioctl_v0[] = {
 	{ 0x00, nvkm_ioctl_sclass },
 	{ 0x00, nvkm_ioctl_new },
 	{ 0x00, nvkm_ioctl_del },
-	{ 0x00, nvkm_ioctl_mthd },
 };
 
 static int
drivers/gpu/drm/nouveau/nvkm/core/oproxy.c +0 -13
index 690131104d7b..890532836c03 100644
@@ -55,18 +55,6 @@ nvkm_oproxy_sclass(struct nvkm_object *object, int index,
 	return oproxy->object->func->sclass(oproxy->object, index, oclass);
 }
 
-static int
-nvkm_oproxy_uevent(struct nvkm_object *object, void *argv, u32 argc,
-		   struct nvkm_uevent *uevent)
-{
-	struct nvkm_oproxy *oproxy = nvkm_oproxy(object);
-
-	if (!oproxy->object->func->uevent)
-		return -ENOSYS;
-
-	return oproxy->object->func->uevent(oproxy->object, argv, argc, uevent);
-}
-
 static int
 nvkm_oproxy_fini(struct nvkm_object *object, bool suspend)
 {
@@ -142,7 +130,6 @@ nvkm_oproxy_func = {
 	.ntfy = nvkm_oproxy_ntfy,
 	.bind = nvkm_oproxy_bind,
 	.sclass = nvkm_oproxy_sclass,
-	.uevent = nvkm_oproxy_uevent,
 };
 
 void
drivers/gpu/drm/nouveau/nvkm/core/uevent.c +0 -62

86 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +13 -0
index 6682245e4928..281994235c5f 100644
@@ -46,6 +46,18 @@ struct nvkm_uobj {
 	int hash;
 };
 
+static int
+nvkm_uchan_object_event_new(struct nvif_engobj_priv *priv, u64 token,
+			    const struct nvif_event_impl **pimpl, struct nvif_event_priv **ppriv)
+{
+	struct nvkm_uobj *uobj = (void *)priv;
+
+	if (!uobj->oproxy.object->func->uevent)
+		return -ENODEV;
+
+	return uobj->oproxy.object->func->uevent(uobj->oproxy.object, token, pimpl, ppriv);
+}
+
 static int
 nvkm_uchan_object_mthd(struct nvif_engobj_priv *priv, u32 mthd, void *argv, u32 argc)
 {
@@ -68,6 +80,7 @@ static const struct nvif_engobj_impl
 nvkm_uchan_object_impl = {
 	.del = nvkm_uchan_object_del,
 	.mthd = nvkm_uchan_object_mthd,
+	.event.new = nvkm_uchan_object_event_new,
 };
 
 static int
drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c +4 -10
index f5affa1c8f34..6786882b5f7f 100644
@@ -27,17 +27,11 @@
 #include <nvif/if0004.h>
 
 static int
-nvkm_nvsw_uevent(struct nvkm_object *object, void *argv, u32 argc, struct nvkm_uevent *uevent)
+nvkm_nvsw_uevent(struct nvkm_object *object, u64 token,
+		 const struct nvif_event_impl **pimpl, struct nvif_event_priv **ppriv)
 {
-	union nv04_nvsw_event_args *args = argv;
-
-	if (!uevent)
-		return 0;
-	if (argc != sizeof(args->vn))
-		return -ENOSYS;
-
-	return nvkm_uevent_add(uevent, &nvkm_nvsw(object)->chan->event, 0,
-			       NVKM_SW_CHAN_EVENT_PAGE_FLIP, NULL);
+	return nvkm_uevent_new_(object, token, &nvkm_nvsw(object)->chan->event, true, 0,
+				NVKM_SW_CHAN_EVENT_PAGE_FLIP, NULL, pimpl, ppriv);
 }
 
 static int
Signature · 1 line
2.41.0
author
#150 lore raw

PATCH 149/156 drm/nouveau/nvif: remove engobj from object rb

In reply to Ben Skeggs

- no more users

---
 .../gpu/drm/nouveau/include/nvif/driverif.h   |   4 +-
 drivers/gpu/drm/nouveau/include/nvif/object.h |  13 +-
 .../drm/nouveau/include/nvkm/core/client.h    |   1 -
 .../gpu/drm/nouveau/include/nvkm/core/ioctl.h |   8 -
 .../drm/nouveau/include/nvkm/core/object.h    |   8 -
 drivers/gpu/drm/nouveau/nvif/chan.c           |   2 +-
 drivers/gpu/drm/nouveau/nvif/client.c         |   1 -
 drivers/gpu/drm/nouveau/nvif/driver.c         |   1 -
 drivers/gpu/drm/nouveau/nvif/object.c         |  78 +------
 drivers/gpu/drm/nouveau/nvkm/core/Kbuild      |   1 -
 drivers/gpu/drm/nouveau/nvkm/core/driver.c    |   8 -
 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c     | 196 ------------------
 drivers/gpu/drm/nouveau/nvkm/core/object.c    |  92 --------
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  |   7 +-
 14 files changed, 8 insertions(+), 412 deletions(-)
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/ioctl.h
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
drivers/gpu/drm/nouveau/include/nvif/driverif.h +1 -3
index 244024c19206..04d488eb3ad5 100644
@@ -27,7 +27,6 @@ struct nvif_driver {
 	const char *name;
 	int (*suspend)(struct nvif_client_priv *);
 	int (*resume)(struct nvif_client_priv *);
-	int (*ioctl)(void *priv, void *data, u32 size, void **hack);
 	void __iomem *(*map)(struct nvif_client_priv *, u64 handle, u32 size);
 	void (*unmap)(struct nvif_client_priv *, void __iomem *ptr, u32 size);
 };
@@ -474,8 +473,7 @@ struct nvif_chan_impl {
 
 	struct {
 		int (*new)(struct nvif_chan_priv *, u32 handle, u8 engi, s32 oclass,
-			   const struct nvif_engobj_impl **, struct nvif_engobj_priv **,
-			   u64 object);
+			   const struct nvif_engobj_impl **, struct nvif_engobj_priv **);
 	} engobj;
 };
 
drivers/gpu/drm/nouveau/include/nvif/object.h +2 -11
index 98a8bba8f0ee..94722ded1d68 100644
@@ -28,18 +28,9 @@ nvif_object_constructed(struct nvif_object *object)
 	return object->client != NULL;
 }
 
-int nvif_object_ctor_0(struct nvif_object *, const char *name, u32 handle,
-		       s32 oclass, void *, u32, struct nvif_object *);
-void nvif_object_ctor_1(struct nvif_object *parent, const char *name, u32 handle, s32 oclass,
-			struct nvif_object *);
-
-#define nvif_object_ctor_(A,B,C,D,E,F,G,IMPL,...) IMPL
-#define nvif_object_ctor(A...) nvif_object_ctor_(A, nvif_object_ctor_0, \
-						    nvif_object_ctor__, \
-						    nvif_object_ctor_1)(A)
-
+void nvif_object_ctor(struct nvif_object *parent, const char *name, u32 handle, s32 oclass,
+		      struct nvif_object *);
 void nvif_object_dtor(struct nvif_object *);
-int  nvif_object_ioctl(struct nvif_object *, void *, u32, void **);
 int nvif_object_map_cpu(struct nvif_object *, const struct nvif_mapinfo *, struct nvif_map *);
 int nvif_object_unmap_cpu(struct nvif_map *);
 
drivers/gpu/drm/nouveau/include/nvkm/core/client.h +0 -1
index e35aea7a751f..21d75783c258 100644
@@ -36,5 +36,4 @@ extern const struct nvif_client_impl nvkm_client_impl;
 #define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a)
 #define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a)
 #define nvif_info(o,f,a...)  nvif_printk((o),  INFO, INFO, f, ##a)
-#define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a)
 #endif
drivers/gpu/drm/nouveau/include/nvkm/core/ioctl.h deleted +0 -8
deleted file mode 100644
index f52918a43246..000000000000
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-#ifndef __NVKM_IOCTL_H__
-#define __NVKM_IOCTL_H__
-#include <core/os.h>
-struct nvkm_client;
-
-int nvkm_ioctl(struct nvkm_client *, void *, u32, void **);
-#endif
drivers/gpu/drm/nouveau/include/nvkm/core/object.h +0 -8
index de8bf1cc95d8..18d56fd3de72 100644
@@ -17,7 +17,6 @@ struct nvkm_object {
 	struct list_head head;
 	struct list_head tree;
 	u64 object;
-	struct rb_node node;
 };
 
 struct nvkm_object_func {
@@ -50,17 +49,10 @@ int nvkm_object_bind(struct nvkm_object *, struct nvkm_gpuobj *, int align,
 		     struct nvkm_gpuobj **);
 
 void nvkm_object_link_(struct nvif_client_priv *, struct nvkm_object *parent, struct nvkm_object *);
-int nvkm_object_link_rb(struct nvif_client_priv *, struct nvkm_object *parent, u64 handle,
-		        struct nvkm_object *);
 
 static inline void
 nvkm_object_link(struct nvkm_object *parent, struct nvkm_object *object)
 {
 	nvkm_object_link_(parent->client, parent, object);
 }
-
-bool nvkm_object_insert(struct nvkm_object *);
-void nvkm_object_remove(struct nvkm_object *);
-struct nvkm_object *nvkm_object_search(struct nvkm_client *, u64 object,
-				       const struct nvkm_object_func *);
 #endif
drivers/gpu/drm/nouveau/nvif/chan.c +1 -1
index ff4485ed0e89..79c40bb2cbb6 100644
@@ -66,7 +66,7 @@ nvif_engobj_ctor(struct nvif_chan *chan, const char *name, u32 handle, s32 oclas
 		return ret;
 
 	ret = chan->impl->engobj.new(chan->priv, handle, engi, oclass, &engobj->impl,
-				     &engobj->priv, nvif_handle(&engobj->object));
+				     &engobj->priv);
 	NVIF_ERRON(ret, &chan->object, "[NEW engobj handle:%08x oclass:%08x]", handle, oclass);
 	if (ret)
 		return ret;
drivers/gpu/drm/nouveau/nvif/client.c +0 -1
index 6b3c7b28b212..2a66b23c9d1d 100644
@@ -60,7 +60,6 @@ nvif_client_ctor(struct nvif_client *parent, const char *name, struct nvif_clien
 		return ret;
 
 	nvif_object_ctor(&parent->object, name ?: "nvifClient", 0, 0, &client->object);
-	client->object.priv = client->priv;
 	client->driver = parent->driver;
 	return 0;
 }
drivers/gpu/drm/nouveau/nvif/driver.c +0 -1
index 95515f2023f4..54263ff7c7e6 100644
@@ -34,7 +34,6 @@ nvif_driver_ctor(struct nvif_parent *parent, const struct nvif_driver *driver, c
 	client->object.client = client;
 
 	nvif_object_ctor(&client->object, name ?: "nvifDriver", 0, 0, &client->object);
-	client->object.priv = priv;
 	client->driver = driver;
 	client->impl = impl;
 	client->priv = priv;
drivers/gpu/drm/nouveau/nvif/object.c +2 -76

100 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/core/Kbuild +0 -1
index 7d111a5481d3..50ff041ecdf0 100644
@@ -7,7 +7,6 @@ nvkm-y += nvkm/core/event.o
 nvkm-y += nvkm/core/firmware.o
 nvkm-y += nvkm/core/gpuobj.o
 nvkm-y += nvkm/core/intr.o
-nvkm-y += nvkm/core/ioctl.o
 nvkm-y += nvkm/core/memory.o
 nvkm-y += nvkm/core/mm.o
 nvkm-y += nvkm/core/object.o
drivers/gpu/drm/nouveau/nvkm/core/driver.c +0 -8
index ea00b8724f24..37d7fa8f9760 100644
@@ -28,7 +28,6 @@
 #include <core/client.h>
 #include <core/driver.h>
 #include <core/event.h>
-#include <core/ioctl.h>
 
 #include <nvif/driverif.h>
 #include <nvif/event.h>
@@ -45,12 +44,6 @@ nvkm_driver_map(struct nvif_client_priv *client, u64 handle, u32 size)
 	return ioremap(handle, size);
 }
 
-static int
-nvkm_driver_ioctl(void *priv, void *data, u32 size, void **hack)
-{
-	return nvkm_ioctl(priv, data, size, hack);
-}
-
 static int
 nvkm_driver_resume(struct nvif_client_priv *client)
 {
@@ -80,7 +73,6 @@ nvkm_driver = {
 	.name = "nvkm",
 	.suspend = nvkm_driver_suspend,
 	.resume = nvkm_driver_resume,
-	.ioctl = nvkm_driver_ioctl,
 	.map = nvkm_driver_map,
 	.unmap = nvkm_driver_unmap,
 };
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c deleted +0 -196

196 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/core/object.c +0 -92

113 lines not on this page · raw message

drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +2 -5
index 281994235c5f..e691853000fb 100644
@@ -214,8 +214,7 @@ nvkm_uchan_object_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
 
 static int
 nvkm_uchan_engobj_new(struct nvif_chan_priv *uchan, u32 handle, u8 engi, s32 oclass,
-		      const struct nvif_engobj_impl **pimpl, struct nvif_engobj_priv **ppriv,
-		      u64 _handle)
+		      const struct nvif_engobj_impl **pimpl, struct nvif_engobj_priv **ppriv)
 {
 	struct nvkm_chan *chan = uchan->chan;
 	struct nvkm_runl *runl = chan->cgrp->runl;
@@ -285,9 +284,7 @@ nvkm_uchan_engobj_new(struct nvif_chan_priv *uchan, u32 handle, u8 engi, s32 ocl
 	*pimpl = &nvkm_uchan_object_impl;
 	*ppriv = (void *)container_of(object, struct nvkm_uobj, oproxy.base);
 
-	ret = nvkm_object_link_rb(uchan->object.client, &uchan->object, _handle, object);
-	if (ret)
-		nvkm_object_fini(object, false);
+	nvkm_object_link(&uchan->object, object);
 
 done:
 	if (ret)
Signature · 1 line
2.41.0
author
#151 lore raw

PATCH 150/156 drm/nouveau/nvkm: switch nvkm_object to non-irqsafe spinlock

In reply to Ben Skeggs

- nvkm_object_search() no longer exists to be called from irq context

---
 drivers/gpu/drm/nouveau/nvkm/core/object.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/nvkm/core/object.c +4 -4
index 5645dd51abd5..f3cf39fb3567 100644
@@ -160,9 +160,9 @@ nvkm_object_del(struct nvkm_object **pobject)
 	if (object && !WARN_ON(!object->func)) {
 		*pobject = nvkm_object_dtor(object);
 
-		spin_lock_irq(&object->client->obj_lock);
+		spin_lock(&object->client->obj_lock);
 		list_del(&object->head);
-		spin_unlock_irq(&object->client->obj_lock);
+		spin_unlock(&object->client->obj_lock);
 
 		kfree(*pobject);
 		*pobject = NULL;
@@ -217,7 +217,7 @@ nvkm_object_link_(struct nvif_client_priv *client, struct nvkm_object *parent,
 {
 	object->client = client;
 
-	spin_lock_irq(&client->obj_lock);
+	spin_lock(&client->obj_lock);
 	list_add_tail(&object->head, &parent->tree);
-	spin_unlock_irq(&client->obj_lock);
+	spin_unlock(&client->obj_lock);
 }
Signature · 1 line
2.41.0
author
#152 lore raw

PATCH 151/156 drm/nouveau: remove client_mutex

In reply to Ben Skeggs

- this protected the drm.master object rb, which no longer exists

---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 7 -------
 drivers/gpu/drm/nouveau/nouveau_drv.h | 1 -
 drivers/gpu/drm/nouveau/nouveau_mem.c | 6 ------
 3 files changed, 14 deletions(-)
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -7
index ae6b992c32f9..aac9e57d0204 100644
@@ -185,9 +185,7 @@ nouveau_cli_fini(struct nouveau_cli *cli)
 	nvif_mmu_dtor(&cli->mmu);
 	cli->device.object.map.ptr = NULL;
 	nvif_device_dtor(&cli->device);
-	mutex_lock(&cli->drm->client_mutex);
 	nvif_client_dtor(&cli->base);
-	mutex_unlock(&cli->drm->client_mutex);
 }
 
 static int
@@ -204,9 +202,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
 	INIT_LIST_HEAD(&cli->worker);
 	mutex_init(&cli->lock);
 
-	mutex_lock(&drm->client_mutex);
 	ret = nvif_client_ctor(&drm->_client, cli->name, &cli->base);
-	mutex_unlock(&drm->client_mutex);
 	if (ret) {
 		NV_PRINTK(err, cli, "Client allocation failed: %d\n", ret);
 		goto done;
@@ -505,7 +501,6 @@ nouveau_drm_device_init(struct drm_device *dev, struct nvkm_device *nvkm)
 
 	nvif_parent_ctor(&nouveau_parent, &drm->parent);
 
-	mutex_init(&drm->client_mutex);
 	drm->_client.object.parent = &drm->parent;
 
 	ret = nvkm_driver_ctor(drm->nvkm, &driver, &impl, &priv);
@@ -641,7 +636,6 @@ nouveau_drm_device_init(struct drm_device *dev, struct nvkm_device *nvkm)
 	nvif_device_dtor(&drm->device);
 	nvif_client_dtor(&drm->_client);
 fail_alloc:
-	mutex_destroy(&drm->client_mutex);
 	nvif_parent_dtor(&drm->parent);
 	kfree(drm);
 	return ret;
@@ -696,7 +690,6 @@ nouveau_drm_device_fini(struct drm_device *dev)
 	destroy_workqueue(drm->sched_wq);
 	nvif_mmu_dtor(&drm->mmu);
 	nvif_device_dtor(&drm->device);
-	mutex_destroy(&drm->client_mutex);
 	nvif_parent_dtor(&drm->parent);
 	mutex_destroy(&drm->clients_lock);
 	kfree(drm);
drivers/gpu/drm/nouveau/nouveau_drv.h +0 -1
index e40416c884a8..046f219328bc 100644
@@ -203,7 +203,6 @@ u_memcpya(uint64_t user, unsigned int nmemb, unsigned int size)
 struct nouveau_drm {
 	struct nvkm_device *nvkm;
 	struct nvif_parent parent;
-	struct mutex client_mutex;
 	struct nvif_client _client;
 	struct nvif_device device;
 	struct nvif_mmu mmu;
drivers/gpu/drm/nouveau/nouveau_mem.c +0 -6
index ff67f00c93c5..aa0503d13cbe 100644
@@ -80,9 +80,7 @@ nouveau_mem_fini(struct nouveau_mem *mem)
 {
 	nvif_vmm_put(&mem->drm->cli.vmm.vmm, &mem->vma[1]);
 	nvif_vmm_put(&mem->drm->cli.vmm.vmm, &mem->vma[0]);
-	mutex_lock(&mem->drm->client_mutex);
 	nvif_mem_dtor(&mem->mem);
-	mutex_unlock(&mem->drm->client_mutex);
 }
 
 int
@@ -113,11 +111,9 @@ nouveau_mem_host(struct ttm_resource *reg, struct ttm_tt *tt)
 	else
 		args.dma = tt->dma_address;
 
-	mutex_lock(&drm->client_mutex);
 	ret = nvif_mem_ctor_type(mmu, "ttmHostMem", type, PAGE_SHIFT,
 				 reg->size,
 				 &args, sizeof(args), &mem->mem);
-	mutex_unlock(&drm->client_mutex);
 	return ret;
 }
 
@@ -130,7 +126,6 @@ nouveau_mem_vram(struct ttm_resource *reg, bool contig, u8 page)
 	u64 size = ALIGN(reg->size, 1 << page);
 	int ret;
 
-	mutex_lock(&drm->client_mutex);
 	switch (drm->mmu.impl->mem.oclass) {
 	case NVIF_CLASS_MEM_GF100:
 		ret = nvif_mem_ctor_type(mmu, "ttmVram",
@@ -154,7 +149,6 @@ nouveau_mem_vram(struct ttm_resource *reg, bool contig, u8 page)
 		WARN_ON(1);
 		break;
 	}
-	mutex_unlock(&drm->client_mutex);
 
 	reg->start = mem->mem.impl->addr >> PAGE_SHIFT;
 	return ret;
Signature · 1 line
2.41.0
author
#153 lore raw

PATCH 152/156 drm/nouveau: move nvxx_* definitions to nouveau_drv.h

In reply to Ben Skeggs

- move out of nvif

---
 drivers/gpu/drm/nouveau/include/nvif/device.h | 33 -------------------
 drivers/gpu/drm/nouveau/nouveau_bios.h        |  1 +
 drivers/gpu/drm/nouveau/nouveau_drv.h         | 32 ++++++++++++++++++
 3 files changed, 33 insertions(+), 33 deletions(-)
drivers/gpu/drm/nouveau/include/nvif/device.h +0 -33
index 5fb71e6da7cd..0ec8d80133c7 100644
@@ -25,37 +25,4 @@ u64  nvif_device_time(struct nvif_device *);
 
 int nvif_device_ctxdma_ctor(struct nvif_device *, const char *name, s32 oclass,
 			    void *argv, u32 argc, struct nvif_ctxdma *);
-
-/*XXX*/
-#include <subdev/bios.h>
-#include <subdev/fb.h>
-#include <subdev/bar.h>
-#include <subdev/gpio.h>
-#include <subdev/clk.h>
-#include <subdev/i2c.h>
-#include <subdev/timer.h>
-#include <subdev/therm.h>
-#include <subdev/pci.h>
-
-#define nvxx_device(a) ({                                                      \
-	struct nvif_device *_device = (a);                                     \
-	struct {                                                               \
-		struct nvkm_object object;                                     \
-		struct nvkm_device *device;                                    \
-	} *_udevice = _device->object.priv;                                    \
-	_udevice->device;                                                      \
-})
-#define nvxx_bios(a) nvxx_device(a)->bios
-#define nvxx_fb(a) nvxx_device(a)->fb
-#define nvxx_gpio(a) nvxx_device(a)->gpio
-#define nvxx_clk(a) nvxx_device(a)->clk
-#define nvxx_i2c(a) nvxx_device(a)->i2c
-#define nvxx_iccsense(a) nvxx_device(a)->iccsense
-#define nvxx_therm(a) nvxx_device(a)->therm
-#define nvxx_volt(a) nvxx_device(a)->volt
-
-#include <engine/fifo.h>
-#include <engine/gr.h>
-
-#define nvxx_gr(a) nvxx_device(a)->gr
 #endif
drivers/gpu/drm/nouveau/nouveau_bios.h +1 -0
index 18eb061ccafb..62b5f5889041 100644
@@ -48,6 +48,7 @@ struct bit_entry {
 
 int bit_table(struct drm_device *, u8 id, struct bit_entry *);
 
+#include <subdev/bios.h>
 #include <subdev/bios/dcb.h>
 #include <subdev/bios/conn.h>
 
drivers/gpu/drm/nouveau/nouveau_drv.h +32 -0
index 046f219328bc..b4069d2b31f9 100644
@@ -362,4 +362,36 @@ void nouveau_drm_device_remove(struct drm_device *dev);
 
 extern int nouveau_modeset;
 
+/*XXX*/
+#include <subdev/bios.h>
+#include <subdev/fb.h>
+#include <subdev/bar.h>
+#include <subdev/gpio.h>
+#include <subdev/clk.h>
+#include <subdev/i2c.h>
+#include <subdev/timer.h>
+#include <subdev/therm.h>
+#include <subdev/pci.h>
+
+#define nvxx_device(a) ({                        \
+	struct nvif_device *_device = (a);       \
+	struct {                                 \
+		struct nvkm_object object;       \
+		struct nvkm_device *device;      \
+	} *_udevice = _device->object.priv;      \
+	_udevice->device;                        \
+})
+#define nvxx_bios(a) nvxx_device(a)->bios
+#define nvxx_fb(a) nvxx_device(a)->fb
+#define nvxx_gpio(a) nvxx_device(a)->gpio
+#define nvxx_clk(a) nvxx_device(a)->clk
+#define nvxx_i2c(a) nvxx_device(a)->i2c
+#define nvxx_iccsense(a) nvxx_device(a)->iccsense
+#define nvxx_therm(a) nvxx_device(a)->therm
+#define nvxx_volt(a) nvxx_device(a)->volt
+
+#include <engine/fifo.h>
+#include <engine/gr.h>
+
+#define nvxx_gr(a) nvxx_device(a)->gr
 #endif
Signature · 1 line
2.41.0
author
#154 lore raw

PATCH 153/156 drm/nouveau: pass nouveau_drm to nvxx_*

In reply to Ben Skeggs

- removes usage of nvif_object.priv

---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  4 +-
 drivers/gpu/drm/nouveau/dispnv04/dac.c        |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/dfp.c        |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/disp.c       |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/disp.h       |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/hw.c         |  9 ++--
 drivers/gpu/drm/nouveau/dispnv04/tvnv04.c     |  4 +-
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c     |  6 +--
 drivers/gpu/drm/nouveau/dispnv50/disp.c       |  6 +--
 drivers/gpu/drm/nouveau/include/nvif/object.h |  1 -
 drivers/gpu/drm/nouveau/nouveau_abi16.c       |  4 +-
 drivers/gpu/drm/nouveau/nouveau_bios.c        |  4 +-
 drivers/gpu/drm/nouveau/nouveau_bo.c          |  8 ++--
 drivers/gpu/drm/nouveau/nouveau_chan.c        |  3 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         |  3 +-
 drivers/gpu/drm/nouveau/nouveau_drv.h         |  4 +-
 drivers/gpu/drm/nouveau/nouveau_hwmon.c       | 46 +++++++++----------
 drivers/gpu/drm/nouveau/nouveau_led.c         |  2 +-
 drivers/gpu/drm/nouveau/nouveau_ttm.c         |  4 +-
 drivers/gpu/drm/nouveau/nvif/device.c         |  1 -
 drivers/gpu/drm/nouveau/nvif/object.c         |  1 -
 21 files changed, 56 insertions(+), 62 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/crtc.c +2 -2
index 8e8a43b28f71..90e549541981 100644
@@ -118,8 +118,8 @@ static void nv_crtc_calc_state_ext(struct drm_crtc *crtc, struct drm_display_mod
 {
 	struct drm_device *dev = crtc->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_bios *bios = nvxx_bios(&drm->client.device);
-	struct nvkm_clk *clk = nvxx_clk(&drm->client.device);
+	struct nvkm_bios *bios = nvxx_bios(drm);
+	struct nvkm_clk *clk = nvxx_clk(drm);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
 	struct nv04_mode_state *state = &nv04_display(dev)->mode_reg;
 	struct nv04_crtc_reg *regp = &state->crtc_reg[nv_crtc->index];
drivers/gpu/drm/nouveau/dispnv04/dac.c +1 -1
index d6b8e0cce2ac..2e12bf136607 100644
@@ -237,7 +237,7 @@ uint32_t nv17_dac_sample_load(struct drm_encoder *encoder)
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
-	struct nvkm_gpio *gpio = nvxx_gpio(&drm->client.device);
+	struct nvkm_gpio *gpio = nvxx_gpio(drm);
 	struct dcb_output *dcb = nouveau_encoder(encoder)->dcb;
 	uint32_t sample, testval, regoffset = nv04_dac_output_offset(encoder);
 	uint32_t saved_powerctrl_2 = 0, saved_powerctrl_4 = 0, saved_routput,
drivers/gpu/drm/nouveau/dispnv04/dfp.c +1 -1
index d5b129dc623b..504c421aa176 100644
@@ -626,7 +626,7 @@ static void nv04_tmds_slave_init(struct drm_encoder *encoder)
 	struct drm_device *dev = encoder->dev;
 	struct dcb_output *dcb = nouveau_encoder(encoder)->dcb;
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device);
+	struct nvkm_i2c *i2c = nvxx_i2c(drm);
 	struct nvkm_i2c_bus *bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_PRI);
 	struct nvkm_i2c_bus_probe info[] = {
 		{
drivers/gpu/drm/nouveau/dispnv04/disp.c +1 -1
index 3d564512b0f6..1ccd78d270b3 100644
@@ -211,7 +211,7 @@ int
 nv04_display_create(struct drm_device *dev)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device);
+	struct nvkm_i2c *i2c = nvxx_i2c(drm);
 	struct dcb_table *dcb = &drm->vbios.dcb;
 	struct drm_connector *connector, *ct;
 	struct drm_encoder *encoder;
drivers/gpu/drm/nouveau/dispnv04/disp.h +1 -1
index 11a6663758ec..85ec0f534392 100644
@@ -176,7 +176,7 @@ static inline void
 nouveau_bios_run_init_table(struct drm_device *dev, u16 table,
 			    struct dcb_output *outp, int crtc)
 {
-	nvbios_init(&nvxx_bios(&nouveau_drm(dev)->client.device)->subdev, table,
+	nvbios_init(&nvxx_bios(nouveau_drm(dev))->subdev, table,
 		init.outp = outp;
 		init.head = crtc;
 	);
drivers/gpu/drm/nouveau/dispnv04/hw.c +4 -5
index f7d35657aa64..8b376f9c8746 100644
@@ -166,7 +166,7 @@ nouveau_hw_get_pllvals(struct drm_device *dev, enum nvbios_pll_type plltype,
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nvif_object *device = &drm->client.device.object;
-	struct nvkm_bios *bios = nvxx_bios(&drm->client.device);
+	struct nvkm_bios *bios = nvxx_bios(drm);
 	uint32_t reg1, pll1, pll2 = 0;
 	struct nvbios_pll pll_lim;
 	int ret;
@@ -258,9 +258,8 @@ nouveau_hw_fix_bad_vpll(struct drm_device *dev, int head)
 	 */
 
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvif_device *device = &drm->client.device;
-	struct nvkm_clk *clk = nvxx_clk(device);
-	struct nvkm_bios *bios = nvxx_bios(device);
+	struct nvkm_clk *clk = nvxx_clk(drm);
+	struct nvkm_bios *bios = nvxx_bios(drm);
 	struct nvbios_pll pll_lim;
 	struct nvkm_pll_vals pv;
 	enum nvbios_pll_type pll = head ? PLL_VPLL1 : PLL_VPLL0;
@@ -470,7 +469,7 @@ nv_load_state_ramdac(struct drm_device *dev, int head,
 		     struct nv04_mode_state *state)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_clk *clk = nvxx_clk(&drm->client.device);
+	struct nvkm_clk *clk = nvxx_clk(drm);
 	struct nv04_crtc_reg *regp = &state->crtc_reg[head];
 	uint32_t pllreg = head ? NV_RAMDAC_VPLL2 : NV_PRAMDAC_VPLL_COEFF;
 	int i;
drivers/gpu/drm/nouveau/dispnv04/tvnv04.c +2 -2
index de3ea731d6e6..d3014027a812 100644
@@ -53,7 +53,7 @@ static struct nvkm_i2c_bus_probe nv04_tv_encoder_info[] = {
 int nv04_tv_identify(struct drm_device *dev, int i2c_index)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device);
+	struct nvkm_i2c *i2c = nvxx_i2c(drm);
 	struct nvkm_i2c_bus *bus = nvkm_i2c_bus_find(i2c, i2c_index);
 	if (bus) {
 		return nvkm_i2c_bus_probe(bus, "TV encoder",
@@ -205,7 +205,7 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry)
 	struct drm_encoder *encoder;
 	struct drm_device *dev = connector->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device);
+	struct nvkm_i2c *i2c = nvxx_i2c(drm);
 	struct nvkm_i2c_bus *bus = nvkm_i2c_bus_find(i2c, entry->i2c_index);
 	int type, ret;
 
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +3 -3
index 670c9739e5e1..c11f58033018 100644
@@ -47,7 +47,7 @@ static uint32_t nv42_tv_sample_load(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_gpio *gpio = nvxx_gpio(&drm->client.device);
+	struct nvkm_gpio *gpio = nvxx_gpio(drm);
 	uint32_t testval, regoffset = nv04_dac_output_offset(encoder);
 	uint32_t gpio0, gpio1, fp_htotal, fp_hsync_start, fp_hsync_end,
 		fp_control, test_ctrl, dacclk, ctv_14, ctv_1c, ctv_6c;
@@ -131,7 +131,7 @@ static bool
 get_tv_detect_quirks(struct drm_device *dev, uint32_t *pin_mask)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_device *device = nvxx_device(&drm->client.device);
+	struct nvkm_device *device = nvxx_device(drm);
 
 	if (device->quirk && device->quirk->tv_pin_mask) {
 		*pin_mask = device->quirk->tv_pin_mask;
@@ -363,7 +363,7 @@ static void  nv17_tv_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_gpio *gpio = nvxx_gpio(&drm->client.device);
+	struct nvkm_gpio *gpio = nvxx_gpio(drm);
 	struct nv17_tv_state *regs = &to_tv_enc(encoder)->state;
 	struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
 
drivers/gpu/drm/nouveau/dispnv50/disp.c +3 -3
index 7762469af47b..a23e1d264294 100644
@@ -318,7 +318,7 @@ nv50_dac_create(struct nouveau_encoder *nv_encoder)
 {
 	struct drm_connector *connector = &nv_encoder->conn->base;
 	struct nouveau_drm *drm = nouveau_drm(connector->dev);
-	struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device);
+	struct nvkm_i2c *i2c = nvxx_i2c(drm);
 	struct nvkm_i2c_bus *bus;
 	struct drm_encoder *encoder;
 	struct dcb_output *dcbe = nv_encoder->dcb;
@@ -1638,7 +1638,7 @@ nv50_sor_create(struct nouveau_encoder *nv_encoder)
 	struct drm_connector *connector = &nv_encoder->conn->base;
 	struct nouveau_connector *nv_connector = nouveau_connector(connector);
 	struct nouveau_drm *drm = nouveau_drm(connector->dev);
-	struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device);
+	struct nvkm_i2c *i2c = nvxx_i2c(drm);
 	struct drm_encoder *encoder;
 	struct dcb_output *dcbe = nv_encoder->dcb;
 	struct nv50_disp *disp = nv50_disp(connector->dev);
@@ -1805,7 +1805,7 @@ nv50_pior_create(struct nouveau_encoder *nv_encoder)
 	struct drm_device *dev = connector->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nv50_disp *disp = nv50_disp(dev);
-	struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device);
+	struct nvkm_i2c *i2c = nvxx_i2c(drm);
 	struct nvkm_i2c_bus *bus = NULL;
 	struct nvkm_i2c_aux *aux = NULL;
 	struct i2c_adapter *ddc;
drivers/gpu/drm/nouveau/include/nvif/object.h +0 -1
index 94722ded1d68..7a90eab48eec 100644
@@ -9,7 +9,6 @@ struct nvif_object {
 	const char *name;
 	u32 handle;
 	s32 oclass;
-	void *priv; /*XXX: hack */
 	struct {
 		void __iomem *ptr;
 		u64 size;
drivers/gpu/drm/nouveau/nouveau_abi16.c +2 -2
index 8cc7b2410a04..ef668f20111a 100644
@@ -212,8 +212,8 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
 	struct nouveau_cli *cli = nouveau_cli(file_priv);
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nvif_device *device = &drm->client.device;
-	struct nvkm_device *nvkm_device = nvxx_device(&drm->client.device);
-	struct nvkm_gr *gr = nvxx_gr(device);
+	struct nvkm_device *nvkm_device = nvxx_device(drm);
+	struct nvkm_gr *gr = nvxx_gr(drm);
 	struct drm_nouveau_getparam *getparam = data;
 	struct pci_dev *pdev = to_pci_dev(dev->dev);
 
drivers/gpu/drm/nouveau/nouveau_bios.c +2 -2
index 479effcf607e..829e98da56d0 100644
@@ -2019,7 +2019,7 @@ uint8_t *nouveau_bios_embedded_edid(struct drm_device *dev)
 static bool NVInitVBIOS(struct drm_device *dev)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_bios *bios = nvxx_bios(&drm->client.device);
+	struct nvkm_bios *bios = nvxx_bios(drm);
 	struct nvbios *legacy = &drm->vbios;
 
 	memset(legacy, 0, sizeof(struct nvbios));
@@ -2090,7 +2090,7 @@ nouveau_bios_init(struct drm_device *dev)
 
 	/* only relevant for PCI devices */
 	if (!dev_is_pci(dev->dev) ||
-	    nvkm_gsp_rm(nvxx_device(&drm->client.device)->gsp))
+	    nvkm_gsp_rm(nvxx_device(drm)->gsp))
 		return 0;
 
 	if (!NVInitVBIOS(dev))
drivers/gpu/drm/nouveau/nouveau_bo.c +4 -4
index a94735ec3a9e..60ce4b46a3a4 100644
@@ -58,7 +58,7 @@ nv10_bo_update_tile_region(struct drm_device *dev, struct nouveau_drm_tile *reg,
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	int i = reg - drm->tile.reg;
-	struct nvkm_fb *fb = nvxx_fb(&drm->client.device);
+	struct nvkm_fb *fb = nvxx_fb(drm);
 	struct nvkm_fb_tile *tile = &fb->tile.region[i];
 
 	nouveau_fence_unref(&reg->fence);
@@ -109,7 +109,7 @@ nv10_bo_set_tiling(struct drm_device *dev, u32 addr,
 		   u32 size, u32 pitch, u32 zeta)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_fb *fb = nvxx_fb(&drm->client.device);
+	struct nvkm_fb *fb = nvxx_fb(drm);
 	struct nouveau_drm_tile *tile, *found = NULL;
 	int i;
 
@@ -1176,7 +1176,7 @@ static int
 nouveau_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resource *reg)
 {
 	struct nouveau_drm *drm = nouveau_bdev(bdev);
-	struct nvkm_device *device = nvxx_device(&drm->client.device);
+	struct nvkm_device *device = nvxx_device(drm);
 	struct nouveau_mem *mem = nouveau_mem(reg);
 	struct nvif_mmu *mmu = &drm->mmu;
 	int ret;
@@ -1297,7 +1297,7 @@ vm_fault_t nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo)
 {
 	struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
 	struct nouveau_bo *nvbo = nouveau_bo(bo);
-	struct nvkm_device *device = nvxx_device(&drm->client.device);
+	struct nvkm_device *device = nvxx_device(drm);
 	u32 mappable = device->func->resource_size(device, 1) >> PAGE_SHIFT;
 	int i, ret;
 
drivers/gpu/drm/nouveau/nouveau_chan.c +1 -2
index 54816bcca14c..1cd8953740f5 100644
@@ -216,8 +216,7 @@ nouveau_channel_prep(struct nouveau_cli *cli,
 			 */
 			args.target = NV_DMA_V0_TARGET_PCI;
 			args.access = NV_DMA_V0_ACCESS_RDWR;
-			args.start = nvxx_device(device)->func->
-				resource_addr(nvxx_device(device), 1);
+			args.start = nvxx_device(drm)->func->resource_addr(nvxx_device(drm), 1);
 			args.limit = args.start + device->info.ram_user - 1;
 		} else {
 			args.target = NV_DMA_V0_TARGET_VRAM;
drivers/gpu/drm/nouveau/nouveau_drm.c +1 -2
index aac9e57d0204..fb01f51fd689 100644
@@ -347,8 +347,7 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 	 * any GPU where it's possible we'll end up using M2MF for BO moves.
 	 */
 	if (device->info.family < NV_DEVICE_INFO_V0_FERMI) {
-		ret = nvkm_gpuobj_new(nvxx_device(device), 32, 0, false, NULL,
-				      &drm->notify);
+		ret = nvkm_gpuobj_new(nvxx_device(drm), 32, 0, false, NULL, &drm->notify);
 		if (ret) {
 			NV_ERROR(drm, "failed to allocate notifier, %d\n", ret);
 			nouveau_accel_gr_fini(drm);
drivers/gpu/drm/nouveau/nouveau_drv.h +2 -2
index b4069d2b31f9..12c9ac68a23e 100644
@@ -374,11 +374,11 @@ extern int nouveau_modeset;
 #include <subdev/pci.h>
 
 #define nvxx_device(a) ({                        \
-	struct nvif_device *_device = (a);       \
+	struct nouveau_drm *_drm = (a);          \
 	struct {                                 \
 		struct nvkm_object object;       \
 		struct nvkm_device *device;      \
-	} *_udevice = _device->object.priv;      \
+	} *_udevice = (void *)_drm->device.priv; \
 	_udevice->device;                        \
 })
 #define nvxx_bios(a) nvxx_device(a)->bios
drivers/gpu/drm/nouveau/nouveau_hwmon.c +23 -23

172 lines not on this page · raw message

drivers/gpu/drm/nouveau/nouveau_led.c +1 -1
index 2c5e0628da12..ac950518a820 100644
@@ -78,7 +78,7 @@ int
 nouveau_led_init(struct drm_device *dev)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvkm_gpio *gpio = nvxx_gpio(&drm->client.device);
+	struct nvkm_gpio *gpio = nvxx_gpio(drm);
 	struct dcb_gpio_func logo_led;
 	int ret;
 
drivers/gpu/drm/nouveau/nouveau_ttm.c +2 -2
index fc1d6fd94480..36f5be963851 100644
@@ -261,7 +261,7 @@ nouveau_ttm_fini_gtt(struct nouveau_drm *drm)
 int
 nouveau_ttm_init(struct nouveau_drm *drm)
 {
-	struct nvkm_device *device = nvxx_device(&drm->client.device);
+	struct nvkm_device *device = nvxx_device(drm);
 	struct nvkm_pci *pci = device->pci;
 	struct nvif_mmu *mmu = &drm->client.mmu;
 	struct drm_device *dev = drm->dev;
@@ -348,7 +348,7 @@ nouveau_ttm_init(struct nouveau_drm *drm)
 void
 nouveau_ttm_fini(struct nouveau_drm *drm)
 {
-	struct nvkm_device *device = nvxx_device(&drm->client.device);
+	struct nvkm_device *device = nvxx_device(drm);
 
 	nouveau_ttm_fini_vram(drm);
 	nouveau_ttm_fini_gtt(drm);
drivers/gpu/drm/nouveau/nvif/device.c +0 -1
index 480034b5563b..131286239b51 100644
@@ -85,7 +85,6 @@ nvif_device_ctor(struct nvif_client *client, const char *name, struct nvif_devic
 
 	nvif_object_ctor(&client->object, name ?: "nvifDevice", 0, 0, &device->object);
 	device->object.client = client;
-	device->object.priv = device->priv; /*FIXME: used by nvxx_device() */
 
 	if (ret == 0) {
 		/*FIXME: remove after moving users to device->impl */
drivers/gpu/drm/nouveau/nvif/object.c +0 -1
index 6044634f20b8..8d4d7a93b92f 100644
@@ -90,7 +90,6 @@ nvif_object_ctor(struct nvif_object *parent, const char *name, u32 handle, s32 o
 	object->name = name ?: "nvifObject";
 	object->handle = handle;
 	object->oclass = oclass;
-	object->priv = NULL;
 	object->map.ptr = NULL;
 	object->map.size = 0;
 }
Signature · 1 line
2.41.0
author
#155 lore raw

PATCH 154/156 drm/nouveau: remove remaining usage of nvif_device.info

In reply to Ben Skeggs

- complete the switch to nvif_device.impl

---
 drivers/gpu/drm/nouveau/dispnv04/arb.c        |  7 +-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c       | 34 +++++-----
 drivers/gpu/drm/nouveau/dispnv04/cursor.c     |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/dac.c        |  6 +-
 drivers/gpu/drm/nouveau/dispnv04/dfp.c        |  8 +--
 drivers/gpu/drm/nouveau/dispnv04/disp.h       |  4 +-
 drivers/gpu/drm/nouveau/dispnv04/hw.c         | 66 +++++++++----------
 drivers/gpu/drm/nouveau/dispnv04/hw.h         | 25 ++++---
 drivers/gpu/drm/nouveau/dispnv04/overlay.c    | 13 ++--
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c     | 10 +--
 drivers/gpu/drm/nouveau/dispnv50/disp.c       |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/wndw.c       | 12 ++--
 drivers/gpu/drm/nouveau/include/nvif/device.h |  3 -
 drivers/gpu/drm/nouveau/nouveau_abi16.c       | 50 ++++++++------
 drivers/gpu/drm/nouveau/nouveau_backlight.c   | 22 +++----
 drivers/gpu/drm/nouveau/nouveau_bios.c        | 12 ++--
 drivers/gpu/drm/nouveau/nouveau_bo.c          | 38 +++++------
 drivers/gpu/drm/nouveau/nouveau_chan.c        | 20 +++---
 drivers/gpu/drm/nouveau/nouveau_connector.c   | 22 +++----
 drivers/gpu/drm/nouveau/nouveau_display.c     | 27 ++++----
 drivers/gpu/drm/nouveau/nouveau_dmem.c        |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         | 14 ++--
 drivers/gpu/drm/nouveau/nouveau_gem.c         | 13 ++--
 drivers/gpu/drm/nouveau/nouveau_sgdma.c       |  2 +-
 drivers/gpu/drm/nouveau/nouveau_svm.c         |  2 +-
 drivers/gpu/drm/nouveau/nouveau_ttm.c         | 21 +++---
 drivers/gpu/drm/nouveau/nouveau_vga.c         |  8 +--
 drivers/gpu/drm/nouveau/nv84_fence.c          |  2 +-
 drivers/gpu/drm/nouveau/nvif/device.c         | 14 ----
 29 files changed, 224 insertions(+), 237 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/arb.c +3 -4
index 1d3542d6006b..8a56b0868128 100644
@@ -193,8 +193,7 @@ static void
 nv04_update_arb(struct drm_device *dev, int VClk, int bpp,
 		int *burst, int *lwm)
 {
-	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	struct nv_fifo_info fifo_data;
 	struct nv_sim_state sim_data;
 	int MClk = nouveau_hw_get_clock(dev, PLL_MEMORY);
@@ -226,7 +225,7 @@ nv04_update_arb(struct drm_device *dev, int VClk, int bpp,
 		sim_data.mem_page_miss = ((cfg1 >> 4) & 0xf) + ((cfg1 >> 31) & 0x1);
 	}
 
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_TNT)
+	if (device->impl->family == NVIF_DEVICE_TNT)
 		nv04_calc_arb(&fifo_data, &sim_data);
 	else
 		nv10_calc_arb(&fifo_data, &sim_data);
@@ -254,7 +253,7 @@ nouveau_calc_arb(struct drm_device *dev, int vclk, int bpp, int *burst, int *lwm
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct pci_dev *pdev = to_pci_dev(dev->dev);
 
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_KELVIN)
+	if (drm->device.impl->family < NVIF_DEVICE_KELVIN)
 		nv04_update_arb(dev, vclk, bpp, burst, lwm);
 	else if ((pdev->device & 0xfff0) == 0x0240 /*CHIPSET_C51*/ ||
 		 (pdev->device & 0xfff0) == 0x03d0 /*CHIPSET_C512*/) {
drivers/gpu/drm/nouveau/dispnv04/crtc.c +17 -17
index 90e549541981..7f83927ddf96 100644
@@ -143,7 +143,7 @@ static void nv_crtc_calc_state_ext(struct drm_crtc *crtc, struct drm_display_mod
 	 * has yet been observed in allowing the use a single stage pll on all
 	 * nv43 however.  the behaviour of single stage use is untested on nv40
 	 */
-	if (drm->client.device.info.chipset > 0x40 && dot_clock <= (pll_lim.vco1.max_freq / 2))
+	if (drm->device.impl->chipset > 0x40 && dot_clock <= (pll_lim.vco1.max_freq / 2))
 		memset(&pll_lim.vco2, 0, sizeof(pll_lim.vco2));
 
 
@@ -153,10 +153,10 @@ static void nv_crtc_calc_state_ext(struct drm_crtc *crtc, struct drm_display_mod
 	state->pllsel &= PLLSEL_VPLL1_MASK | PLLSEL_VPLL2_MASK | PLLSEL_TV_MASK;
 
 	/* The blob uses this always, so let's do the same */
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
+	if (drm->device.impl->family == NVIF_DEVICE_CURIE)
 		state->pllsel |= NV_PRAMDAC_PLL_COEFF_SELECT_USE_VPLL2_TRUE;
 	/* again nv40 and some nv43 act more like nv3x as described above */
-	if (drm->client.device.info.chipset < 0x41)
+	if (drm->device.impl->chipset < 0x41)
 		state->pllsel |= NV_PRAMDAC_PLL_COEFF_SELECT_SOURCE_PROG_MPLL |
 				 NV_PRAMDAC_PLL_COEFF_SELECT_SOURCE_PROG_NVPLL;
 	state->pllsel |= nv_crtc->index ? PLLSEL_VPLL2_MASK : PLLSEL_VPLL1_MASK;
@@ -275,7 +275,7 @@ nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode)
 		horizEnd = horizTotal - 2;
 		horizBlankEnd = horizTotal + 4;
 #if 0
-		if (dev->overlayAdaptor && drm->client.device.info.family >= NV_DEVICE_INFO_V0_CELSIUS)
+		if (dev->overlayAdaptor && drm->device.impl->family >= NVIF_DEVICE_CELSIUS)
 			/* This reportedly works around some video overlay bandwidth problems */
 			horizTotal += 2;
 #endif
@@ -510,7 +510,7 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode)
 	regp->cursor_cfg = NV_PCRTC_CURSOR_CONFIG_CUR_LINES_64 |
 			     NV_PCRTC_CURSOR_CONFIG_CUR_PIXELS_64 |
 			     NV_PCRTC_CURSOR_CONFIG_ADDRESS_SPACE_PNVM;
-	if (drm->client.device.info.chipset >= 0x11)
+	if (drm->device.impl->chipset >= 0x11)
 		regp->cursor_cfg |= NV_PCRTC_CURSOR_CONFIG_CUR_BPP_32;
 	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
 		regp->cursor_cfg |= NV_PCRTC_CURSOR_CONFIG_DOUBLE_SCAN_ENABLE;
@@ -551,26 +551,26 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode)
 	 * 1 << 30 on 0x60.830), for no apparent reason */
 	regp->CRTC[NV_CIO_CRE_59] = off_chip_digital;
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_RANKINE)
+	if (drm->device.impl->family >= NVIF_DEVICE_RANKINE)
 		regp->CRTC[0x9f] = off_chip_digital ? 0x11 : 0x1;
 
 	regp->crtc_830 = mode->crtc_vdisplay - 3;
 	regp->crtc_834 = mode->crtc_vdisplay - 1;
 
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
+	if (drm->device.impl->family == NVIF_DEVICE_CURIE)
 		/* This is what the blob does */
 		regp->crtc_850 = NVReadCRTC(dev, 0, NV_PCRTC_850);
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_RANKINE)
+	if (drm->device.impl->family >= NVIF_DEVICE_RANKINE)
 		regp->gpio_ext = NVReadCRTC(dev, 0, NV_PCRTC_GPIO_EXT);
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_CELSIUS)
+	if (drm->device.impl->family >= NVIF_DEVICE_CELSIUS)
 		regp->crtc_cfg = NV10_PCRTC_CONFIG_START_ADDRESS_HSYNC;
 	else
 		regp->crtc_cfg = NV04_PCRTC_CONFIG_START_ADDRESS_HSYNC;
 
 	/* Some misc regs */
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE) {
+	if (drm->device.impl->family == NVIF_DEVICE_CURIE) {
 		regp->CRTC[NV_CIO_CRE_85] = 0xFF;
 		regp->CRTC[NV_CIO_CRE_86] = 0x1;
 	}
@@ -582,7 +582,7 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode)
 
 	/* Generic PRAMDAC regs */
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_CELSIUS)
+	if (drm->device.impl->family >= NVIF_DEVICE_CELSIUS)
 		/* Only bit that bios and blob set. */
 		regp->nv10_cursync = (1 << 25);
 
@@ -591,7 +591,7 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode)
 				NV_PRAMDAC_GENERAL_CONTROL_PIXMIX_ON;
 	if (fb->format->depth == 16)
 		regp->ramdac_gen_ctrl |= NV_PRAMDAC_GENERAL_CONTROL_ALT_MODE_SEL;
-	if (drm->client.device.info.chipset >= 0x11)
+	if (drm->device.impl->chipset >= 0x11)
 		regp->ramdac_gen_ctrl |= NV_PRAMDAC_GENERAL_CONTROL_PIPE_LONG;
 
 	regp->ramdac_630 = 0; /* turn off green mode (tv test pattern?) */
@@ -655,7 +655,7 @@ nv_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
 
 	nv_crtc_mode_set_vga(crtc, adjusted_mode);
 	/* calculated in nv04_dfp_prepare, nv40 needs it written before calculating PLLs */
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
+	if (drm->device.impl->family == NVIF_DEVICE_CURIE)
 		NVWriteRAMDAC(dev, 0, NV_PRAMDAC_SEL_CLK, nv04_display(dev)->mode_reg.sel_clk);
 	nv_crtc_mode_set_regs(crtc, adjusted_mode);
 	nv_crtc_calc_state_ext(crtc, mode, adjusted_mode->clock);
@@ -716,7 +716,7 @@ static void nv_crtc_prepare(struct drm_crtc *crtc)
 
 	/* Some more preparation. */
 	NVWriteCRTC(dev, nv_crtc->index, NV_PCRTC_CONFIG, NV_PCRTC_CONFIG_START_ADDRESS_NON_VGA);
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE) {
+	if (drm->device.impl->family == NVIF_DEVICE_CURIE) {
 		uint32_t reg900 = NVReadRAMDAC(dev, nv_crtc->index, NV_PRAMDAC_900);
 		NVWriteRAMDAC(dev, nv_crtc->index, NV_PRAMDAC_900, reg900 & ~0x10000);
 	}
@@ -892,7 +892,7 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc,
 	crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_FF_INDEX);
 	crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_FFLWM__INDEX);
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_KELVIN) {
+	if (drm->device.impl->family >= NVIF_DEVICE_KELVIN) {
 		regp->CRTC[NV_CIO_CRE_47] = arb_lwm >> 8;
 		crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_47);
 	}
@@ -965,7 +965,7 @@ static void nv11_cursor_upload(struct drm_device *dev, struct nouveau_bo *src,
 		{
 			struct nouveau_drm *drm = nouveau_drm(dev);
 
-			if (drm->client.device.info.chipset == 0x11) {
+			if (drm->device.impl->chipset == 0x11) {
 				pixel = ((pixel & 0x000000ff) << 24) |
 					((pixel & 0x0000ff00) << 8) |
 					((pixel & 0x00ff0000) >> 8) |
@@ -1006,7 +1006,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 	if (ret)
 		goto out;
 
-	if (drm->client.device.info.chipset >= 0x11)
+	if (drm->device.impl->chipset >= 0x11)
 		nv11_cursor_upload(dev, cursor, nv_crtc->cursor.nvbo);
 	else
 		nv04_cursor_upload(dev, cursor, nv_crtc->cursor.nvbo);
drivers/gpu/drm/nouveau/dispnv04/cursor.c +1 -1
index 4c6440d29c3f..625c66da3367 100644
@@ -55,7 +55,7 @@ nv04_cursor_set_offset(struct nouveau_crtc *nv_crtc, uint32_t offset)
 	crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX);
 	crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_HCUR_ADDR1_INDEX);
 	crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_HCUR_ADDR2_INDEX);
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
+	if (drm->device.impl->family == NVIF_DEVICE_CURIE)
 		nv_fix_nv40_hw_cursor(dev, nv_crtc->index);
 }
 
drivers/gpu/drm/nouveau/dispnv04/dac.c +3 -3
index 2e12bf136607..4d8e34274c4e 100644
@@ -236,7 +236,7 @@ uint32_t nv17_dac_sample_load(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	struct nvkm_gpio *gpio = nvxx_gpio(drm);
 	struct dcb_output *dcb = nouveau_encoder(encoder)->dcb;
 	uint32_t sample, testval, regoffset = nv04_dac_output_offset(encoder);
@@ -288,7 +288,7 @@ uint32_t nv17_dac_sample_load(struct drm_encoder *encoder)
 	/* nv driver and nv31 use 0xfffffeee, nv34 and 6600 use 0xfffffece */
 	routput = (saved_routput & 0xfffffece) | head << 8;
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_CURIE) {
+	if (device->impl->family >= NVIF_DEVICE_CURIE) {
 		if (dcb->type == DCB_OUTPUT_TV)
 			routput |= 0x1a << 16;
 		else
@@ -403,7 +403,7 @@ static void nv04_dac_mode_set(struct drm_encoder *encoder,
 	}
 
 	/* This could use refinement for flatpanels, but it should work this way */
-	if (drm->client.device.info.chipset < 0x44)
+	if (drm->device.impl->chipset < 0x44)
 		NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + nv04_dac_output_offset(encoder), 0xf0000000);
 	else
 		NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + nv04_dac_output_offset(encoder), 0x00100000);
drivers/gpu/drm/nouveau/dispnv04/dfp.c +4 -4
index 504c421aa176..da2a759dbaab 100644
@@ -282,7 +282,7 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder,
 			      struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
 	struct nv04_crtc_reg *regp = &nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index];
@@ -418,7 +418,7 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder,
 	if ((nv_connector->dithering_mode == DITHERING_MODE_ON) ||
 	    (nv_connector->dithering_mode == DITHERING_MODE_AUTO &&
 	     fb->format->depth > connector->display_info.bpc * 3)) {
-		if (drm->client.device.info.chipset == 0x11)
+		if (device->impl->chipset == 0x11)
 			regp->dither = savep->dither | 0x00010000;
 		else {
 			int i;
@@ -429,7 +429,7 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder,
 			}
 		}
 	} else {
-		if (drm->client.device.info.chipset != 0x11) {
+		if (device->impl->chipset != 0x11) {
 			/* reset them */
 			int i;
 			for (i = 0; i < 3; i++) {
@@ -465,7 +465,7 @@ static void nv04_dfp_commit(struct drm_encoder *encoder)
 		NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL);
 
 	/* This could use refinement for flatpanels, but it should work this way */
-	if (drm->client.device.info.chipset < 0x44)
+	if (drm->device.impl->chipset < 0x44)
 		NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + nv04_dac_output_offset(encoder), 0xf0000000);
 	else
 		NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + nv04_dac_output_offset(encoder), 0x00100000);
drivers/gpu/drm/nouveau/dispnv04/disp.h +2 -2
index 85ec0f534392..8eba76ab880e 100644
@@ -135,7 +135,7 @@ nv_two_heads(struct drm_device *dev)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	const int impl = to_pci_dev(dev->dev)->device & 0x0ff0;
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_CELSIUS && impl != 0x0100 &&
+	if (drm->device.impl->family >= NVIF_DEVICE_CELSIUS && impl != 0x0100 &&
 	    impl != 0x0150 && impl != 0x01a0 && impl != 0x0200)
 		return true;
 
@@ -154,7 +154,7 @@ nv_two_reg_pll(struct drm_device *dev)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	const int impl = to_pci_dev(dev->dev)->device & 0x0ff0;
 
-	if (impl == 0x0310 || impl == 0x0340 || drm->client.device.info.family >= NV_DEVICE_INFO_V0_CURIE)
+	if (impl == 0x0310 || impl == 0x0340 || drm->device.impl->family >= NVIF_DEVICE_CURIE)
 		return true;
 	return false;
 }
drivers/gpu/drm/nouveau/dispnv04/hw.c +33 -33

224 lines not on this page · raw message

drivers/gpu/drm/nouveau/dispnv04/hw.h +11 -14
index 6987e1766cd2..b565cd34ed67 100644
@@ -164,13 +164,12 @@ static inline uint8_t NVReadVgaCrtc5758(struct drm_device *dev, int head, uint8_
 static inline uint8_t NVReadPRMVIO(struct drm_device *dev,
 					int head, uint32_t reg)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
-	struct nouveau_drm *drm = nouveau_drm(dev);
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	uint8_t val;
 
 	/* Only NV4x have two pvio ranges; other twoHeads cards MUST call
 	 * NVSetOwner for the relevant head to be programmed */
-	if (head && drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
+	if (head && device->impl->family == NVIF_DEVICE_CURIE)
 		reg += NV_PRMVIO_SIZE;
 
 	val = nvif_rd08(device, reg);
@@ -180,12 +179,11 @@ static inline uint8_t NVReadPRMVIO(struct drm_device *dev,
 static inline void NVWritePRMVIO(struct drm_device *dev,
 					int head, uint32_t reg, uint8_t value)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
-	struct nouveau_drm *drm = nouveau_drm(dev);
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 
 	/* Only NV4x have two pvio ranges; other twoHeads cards MUST call
 	 * NVSetOwner for the relevant head to be programmed */
-	if (head && drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
+	if (head && device->impl->family == NVIF_DEVICE_CURIE)
 		reg += NV_PRMVIO_SIZE;
 
 	nvif_wr08(device, reg, value);
@@ -258,10 +256,9 @@ static inline void NVVgaProtect(struct drm_device *dev, int head, bool protect)
 static inline bool
 nv_heads_tied(struct drm_device *dev)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
-	struct nouveau_drm *drm = nouveau_drm(dev);
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 
-	if (drm->client.device.info.chipset == 0x11)
+	if (device->impl->chipset == 0x11)
 		return !!(nvif_rd32(device, NV_PBUS_DEBUG_1) & (1 << 28));
 
 	return NVReadVgaCrtc(dev, 0, NV_CIO_CRE_44) & 0x4;
@@ -317,7 +314,7 @@ NVLockVgaCrtcs(struct drm_device *dev, bool lock)
 	NVWriteVgaCrtc(dev, 0, NV_CIO_SR_LOCK_INDEX,
 		       lock ? NV_CIO_SR_LOCK_VALUE : NV_CIO_SR_UNLOCK_RW_VALUE);
 	/* NV11 has independently lockable extended crtcs, except when tied */
-	if (drm->client.device.info.chipset == 0x11 && !nv_heads_tied(dev))
+	if (drm->device.impl->chipset == 0x11 && !nv_heads_tied(dev))
 		NVWriteVgaCrtc(dev, 1, NV_CIO_SR_LOCK_INDEX,
 			       lock ? NV_CIO_SR_LOCK_VALUE :
 				      NV_CIO_SR_UNLOCK_RW_VALUE);
@@ -334,7 +331,7 @@ static inline int nv_cursor_width(struct drm_device *dev)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
 
-	return drm->client.device.info.family >= NV_DEVICE_INFO_V0_CELSIUS ? NV10_CURSOR_SIZE : NV04_CURSOR_SIZE;
+	return drm->device.impl->family >= NVIF_DEVICE_CELSIUS ? NV10_CURSOR_SIZE : NV04_CURSOR_SIZE;
 }
 
 static inline void
@@ -356,7 +353,7 @@ nv_set_crtc_base(struct drm_device *dev, int head, uint32_t offset)
 
 	NVWriteCRTC(dev, head, NV_PCRTC_START, offset);
 
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_TNT) {
+	if (drm->device.impl->family == NVIF_DEVICE_TNT) {
 		/*
 		 * Hilarious, the 24th bit doesn't want to stick to
 		 * PCRTC_START...
@@ -381,7 +378,7 @@ nv_show_cursor(struct drm_device *dev, int head, bool show)
 		*curctl1 &= ~MASK(NV_CIO_CRE_HCUR_ADDR1_ENABLE);
 	NVWriteVgaCrtc(dev, head, NV_CIO_CRE_HCUR_ADDR1_INDEX, *curctl1);
 
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
+	if (drm->device.impl->family == NVIF_DEVICE_CURIE)
 		nv_fix_nv40_hw_cursor(dev, head);
 }
 
@@ -397,7 +394,7 @@ nv_pitch_align(struct drm_device *dev, uint32_t width, int bpp)
 		bpp = 8;
 
 	/* Alignment requirements taken from the Haiku driver */
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_TNT)
+	if (drm->device.impl->family == NVIF_DEVICE_TNT)
 		mask = 128 / bpp - 1;
 	else
 		mask = 512 / bpp - 1;
drivers/gpu/drm/nouveau/dispnv04/overlay.c +7 -6
index 33f29736024a..103b6dddfac4 100644
@@ -118,7 +118,7 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		  struct drm_modeset_acquire_ctx *ctx)
 {
 	struct nouveau_drm *drm = nouveau_drm(plane->dev);
-	struct nvif_object *dev = &drm->client.device.object;
+	struct nvif_device *dev = &drm->device;
 	struct nouveau_plane *nv_plane =
 		container_of(plane, struct nouveau_plane, base);
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
@@ -127,7 +127,7 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 	bool flip = nv_plane->flip;
 	int soff = NV_PCRTC0_SIZE * nv_crtc->index;
 	int soff2 = NV_PCRTC0_SIZE * !nv_crtc->index;
-	unsigned shift = drm->client.device.info.chipset >= 0x30 ? 1 : 3;
+	unsigned shift = dev->impl->chipset >= 0x30 ? 1 : 3;
 	unsigned format = 0;
 	int ret;
 
@@ -286,7 +286,7 @@ nv10_overlay_init(struct drm_device *device)
 	if (!plane)
 		return;
 
-	switch (drm->client.device.info.chipset) {
+	switch (drm->device.impl->chipset) {
 	case 0x10:
 	case 0x11:
 	case 0x15:
@@ -511,9 +511,10 @@ nv04_overlay_init(struct drm_device *device)
 void
 nouveau_overlay_init(struct drm_device *device)
 {
-	struct nvif_device *dev = &nouveau_drm(device)->client.device;
-	if (dev->info.chipset < 0x10)
+	struct nvif_device *dev = &nouveau_drm(device)->device;
+
+	if (dev->impl->chipset < 0x10)
 		nv04_overlay_init(device);
-	else if (dev->info.chipset <= 0x40)
+	else if (dev->impl->chipset <= 0x40)
 		nv10_overlay_init(device);
 }
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +5 -5
index c11f58033018..1119c087d52f 100644
@@ -155,8 +155,8 @@ nv17_tv_detect(struct drm_encoder *encoder, struct drm_connector *connector)
 		return connector_status_disconnected;
 
 	if (reliable) {
-		if (drm->client.device.info.chipset == 0x42 ||
-		    drm->client.device.info.chipset == 0x43)
+		if (drm->device.impl->chipset == 0x42 ||
+		    drm->device.impl->chipset == 0x43)
 			tv_enc->pin_mask =
 				nv42_tv_sample_load(encoder) >> 28 & 0xe;
 		else
@@ -436,7 +436,7 @@ static void nv17_tv_prepare(struct drm_encoder *encoder)
 	/* Set the DACCLK register */
 	dacclk = (NVReadRAMDAC(dev, 0, dacclk_off) & ~0x30) | 0x1;
 
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
+	if (drm->device.impl->family == NVIF_DEVICE_CURIE)
 		dacclk |= 0x1a << 16;
 
 	if (tv_norm->kind == CTV_ENC_MODE) {
@@ -493,7 +493,7 @@ static void nv17_tv_mode_set(struct drm_encoder *encoder,
 			tv_regs->ptv_614 = 0x13;
 		}
 
-		if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_RANKINE) {
+		if (drm->device.impl->family >= NVIF_DEVICE_RANKINE) {
 			tv_regs->ptv_500 = 0xe8e0;
 			tv_regs->ptv_504 = 0x1710;
 			tv_regs->ptv_604 = 0x0;
@@ -588,7 +588,7 @@ static void nv17_tv_commit(struct drm_encoder *encoder)
 	nv17_tv_state_load(dev, &to_tv_enc(encoder)->state);
 
 	/* This could use refinement for flatpanels, but it should work */
-	if (drm->client.device.info.chipset < 0x44)
+	if (drm->device.impl->chipset < 0x44)
 		NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL +
 					nv04_dac_output_offset(encoder),
 					0xf0000000);
drivers/gpu/drm/nouveau/dispnv50/disp.c +1 -1
index a23e1d264294..36547f3b6111 100644
@@ -2637,7 +2637,7 @@ nv50_display_create(struct drm_device *dev)
 	if (disp->disp->object.oclass >= TU102_DISP)
 		nouveau_display(dev)->format_modifiers = wndwc57e_modifiers;
 	else
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_FERMI)
+	if (drm->device.impl->family >= NVIF_DEVICE_FERMI)
 		nouveau_display(dev)->format_modifiers = disp90xx_modifiers;
 	else
 		nouveau_display(dev)->format_modifiers = disp50xx_modifiers;
drivers/gpu/drm/nouveau/dispnv50/wndw.c +6 -6
index 1e6e27782ce8..38853dbe57c5 100644
@@ -81,18 +81,18 @@ nv50_wndw_ctxdma_new(struct nv50_wndw *wndw, struct drm_framebuffer *fb)
 	args.base.target = NV_DMA_V0_TARGET_VRAM;
 	args.base.access = NV_DMA_V0_ACCESS_RDWR;
 	args.base.start  = 0;
-	args.base.limit  = drm->client.device.info.ram_user - 1;
+	args.base.limit  = drm->device.impl->ram_user - 1;
 
-	if (drm->client.device.info.chipset < 0x80) {
+	if (drm->device.impl->chipset < 0x80) {
 		args.nv50.part = NV50_DMA_V0_PART_256;
 		argc += sizeof(args.nv50);
 	} else
-	if (drm->client.device.info.chipset < 0xc0) {
+	if (drm->device.impl->chipset < 0xc0) {
 		args.nv50.part = NV50_DMA_V0_PART_256;
 		args.nv50.kind = kind;
 		argc += sizeof(args.nv50);
 	} else
-	if (drm->client.device.info.chipset < 0xd0) {
+	if (drm->device.impl->chipset < 0xd0) {
 		args.gf100.kind = kind;
 		argc += sizeof(args.gf100);
 	} else {
@@ -295,7 +295,7 @@ nv50_wndw_atomic_check_acquire(struct nv50_wndw *wndw, bool modeset,
 
 		if (asyw->image.kind) {
 			asyw->image.layout = NV507C_SURFACE_SET_STORAGE_MEMORY_LAYOUT_BLOCKLINEAR;
-			if (drm->client.device.info.chipset >= 0xc0)
+			if (drm->device.impl->chipset >= 0xc0)
 				asyw->image.blockh = tile_mode >> 4;
 			else
 				asyw->image.blockh = tile_mode;
@@ -666,7 +666,7 @@ static bool nv50_plane_format_mod_supported(struct drm_plane *plane,
 	struct nouveau_drm *drm = nouveau_drm(plane->dev);
 	uint8_t i;
 
-	if (drm->client.device.info.chipset < 0xc0) {
+	if (drm->device.impl->chipset < 0xc0) {
 		const struct drm_format_info *info = drm_format_info(format);
 		const uint8_t kind = (modifier >> 12) & 0xff;
 
drivers/gpu/drm/nouveau/include/nvif/device.h +0 -3
index 0ec8d80133c7..8947edd9b25b 100644
@@ -2,7 +2,6 @@
 #ifndef __NVIF_DEVICE_H__
 #define __NVIF_DEVICE_H__
 #include <nvif/object.h>
-#include <nvif/cl0080.h>
 #include <nvif/driverif.h>
 #include <nvif/user.h>
 struct nvif_ctxdma;
@@ -13,8 +12,6 @@ struct nvif_device {
 	struct nvif_object object;
 	struct nvif_map map;
 
-	struct nv_device_info_v0 info;
-
 	struct nvif_user user;
 };
 
drivers/gpu/drm/nouveau/nouveau_abi16.c +29 -21

139 lines not on this page · raw message

drivers/gpu/drm/nouveau/nouveau_backlight.c +11 -11
index d47442125fa1..925856f3b21b 100644
@@ -292,7 +292,7 @@ nouveau_backlight_init(struct drm_connector *connector)
 	struct nouveau_drm *drm = nouveau_drm(connector->dev);
 	struct nouveau_backlight *bl;
 	struct nouveau_encoder *nv_encoder = NULL;
-	struct nvif_device *device = &drm->client.device;
+	struct nvif_device *device = &drm->device;
 	char backlight_name[BL_NAME_SIZE];
 	struct backlight_properties props = {0};
 	const struct backlight_ops *ops;
@@ -317,18 +317,18 @@ nouveau_backlight_init(struct drm_connector *connector)
 	if (!bl)
 		return -ENOMEM;
 
-	switch (device->info.family) {
-	case NV_DEVICE_INFO_V0_CURIE:
+	switch (device->impl->family) {
+	case NVIF_DEVICE_CURIE:
 		ret = nv40_backlight_init(nv_encoder, &props, &ops);
 		break;
-	case NV_DEVICE_INFO_V0_TESLA:
-	case NV_DEVICE_INFO_V0_FERMI:
-	case NV_DEVICE_INFO_V0_KEPLER:
-	case NV_DEVICE_INFO_V0_MAXWELL:
-	case NV_DEVICE_INFO_V0_PASCAL:
-	case NV_DEVICE_INFO_V0_VOLTA:
-	case NV_DEVICE_INFO_V0_TURING:
-	case NV_DEVICE_INFO_V0_AMPERE: //XXX: not confirmed
+	case NVIF_DEVICE_TESLA:
+	case NVIF_DEVICE_FERMI:
+	case NVIF_DEVICE_KEPLER:
+	case NVIF_DEVICE_MAXWELL:
+	case NVIF_DEVICE_PASCAL:
+	case NVIF_DEVICE_VOLTA:
+	case NVIF_DEVICE_TURING:
+	case NVIF_DEVICE_AMPERE: //XXX: not confirmed
 		ret = nv50_backlight_init(bl, nouveau_connector(connector),
 					  nv_encoder, &props, &ops);
 		break;
drivers/gpu/drm/nouveau/nouveau_bios.c +6 -6
index 829e98da56d0..c9c68416d558 100644
@@ -322,7 +322,7 @@ static int
 get_fp_strap(struct drm_device *dev, struct nvbios *bios)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvif_object *device = &drm->client.device.object;
+	struct nvif_device *device = &drm->device;
 
 	/*
 	 * The fp strap is normally dictated by the "User Strap" in
@@ -336,10 +336,10 @@ get_fp_strap(struct drm_device *dev, struct nvbios *bios)
 	if (bios->major_version < 5 && bios->data[0x48] & 0x4)
 		return NVReadVgaCrtc5758(dev, 0, 0xf) & 0xf;
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_MAXWELL)
+	if (device->impl->family >= NVIF_DEVICE_MAXWELL)
 		return nvif_rd32(device, 0x001800) & 0x0000000f;
 	else
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)
+	if (device->impl->family >= NVIF_DEVICE_TESLA)
 		return (nvif_rd32(device, NV_PEXTDEV_BOOT_0) >> 24) & 0xf;
 	else
 		return (nvif_rd32(device, NV_PEXTDEV_BOOT_0) >> 16) & 0xf;
@@ -1255,7 +1255,7 @@ olddcb_table(struct drm_device *dev)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	u8 *dcb = NULL;
 
-	if (drm->client.device.info.family > NV_DEVICE_INFO_V0_TNT)
+	if (drm->device.impl->family > NVIF_DEVICE_TNT)
 		dcb = ROMPTR(dev, drm->vbios.data[0x36]);
 	if (!dcb) {
 		NV_WARN(drm, "No DCB data found in VBIOS\n");
@@ -2070,7 +2070,7 @@ nouveau_bios_posted(struct drm_device *dev)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	unsigned htotal;
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA)
 		return true;
 
 	htotal  = NVReadVgaCrtc(dev, 0, 0x06);
@@ -2096,7 +2096,7 @@ nouveau_bios_init(struct drm_device *dev)
 	if (!NVInitVBIOS(dev))
 		return -ENODEV;
 
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family < NVIF_DEVICE_TESLA) {
 		ret = parse_dcb_table(dev, bios);
 		if (ret)
 			return ret;
drivers/gpu/drm/nouveau/nouveau_bo.c +19 -19
index 60ce4b46a3a4..523464cfea9e 100644
@@ -175,23 +175,23 @@ static void
 nouveau_bo_fixup_align(struct nouveau_bo *nvbo, int *align, u64 *size)
 {
 	struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev);
-	struct nvif_device *device = &drm->client.device;
+	struct nvif_device *device = &drm->device;
 
-	if (device->info.family < NV_DEVICE_INFO_V0_TESLA) {
+	if (device->impl->family < NVIF_DEVICE_TESLA) {
 		if (nvbo->mode) {
-			if (device->info.chipset >= 0x40) {
+			if (device->impl->chipset >= 0x40) {
 				*align = 65536;
 				*size = roundup_64(*size, 64 * nvbo->mode);
 
-			} else if (device->info.chipset >= 0x30) {
+			} else if (device->impl->chipset >= 0x30) {
 				*align = 32768;
 				*size = roundup_64(*size, 64 * nvbo->mode);
 
-			} else if (device->info.chipset >= 0x20) {
+			} else if (device->impl->chipset >= 0x20) {
 				*align = 16384;
 				*size = roundup_64(*size, 64 * nvbo->mode);
 
-			} else if (device->info.chipset >= 0x10) {
+			} else if (device->impl->chipset >= 0x10) {
 				*align = 16384;
 				*size = roundup_64(*size, 32 * nvbo->mode);
 			}
@@ -243,7 +243,7 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
 	nvbo->contig = !(tile_flags & NOUVEAU_GEM_TILE_NONCONTIG);
 	if (!nouveau_cli_uvmm(cli) || internal) {
 		/* for BO noVM allocs, don't assign kinds */
-		if (cli->device.info.family >= NV_DEVICE_INFO_V0_FERMI) {
+		if (drm->device.impl->family >= NVIF_DEVICE_FERMI) {
 			nvbo->kind = (tile_flags & 0x0000ff00) >> 8;
 			if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
 				kfree(nvbo);
@@ -251,7 +251,7 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
 			}
 
 			nvbo->comp = mmu->impl->kind[nvbo->kind] != nvbo->kind;
-		} else if (cli->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
+		} else if (drm->device.impl->family >= NVIF_DEVICE_TESLA) {
 			nvbo->kind = (tile_flags & 0x00007f00) >> 8;
 			nvbo->comp = (tile_flags & 0x00030000) >> 16;
 			if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
@@ -272,7 +272,7 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
 			 *
 			 * Skip page sizes that can't support needed domains.
 			 */
-			if (cli->device.info.family > NV_DEVICE_INFO_V0_CURIE &&
+			if (drm->device.impl->family > NVIF_DEVICE_CURIE &&
 			    (domain & NOUVEAU_GEM_DOMAIN_VRAM) && !vmm->impl->page[i].vram)
 				continue;
 			if ((domain & NOUVEAU_GEM_DOMAIN_GART) &&
@@ -408,10 +408,10 @@ static void
 set_placement_range(struct nouveau_bo *nvbo, uint32_t domain)
 {
 	struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev);
-	u64 vram_size = drm->client.device.info.ram_size;
+	u64 vram_size = drm->device.impl->ram_size;
 	unsigned i, fpfn, lpfn;
 
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CELSIUS &&
+	if (drm->device.impl->family == NVIF_DEVICE_CELSIUS &&
 	    nvbo->mode && (domain & NOUVEAU_GEM_DOMAIN_VRAM) &&
 	    nvbo->bo.base.size < vram_size / 4) {
 		/*
@@ -476,7 +476,7 @@ int nouveau_bo_pin_locked(struct nouveau_bo *nvbo, uint32_t domain, bool contig)
 
 	dma_resv_assert_held(bo->base.resv);
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA &&
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA &&
 	    domain == NOUVEAU_GEM_DOMAIN_VRAM && contig) {
 		if (!nvbo->contig) {
 			nvbo->contig = true;
@@ -873,7 +873,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict,
 	 * old nvkm_mem node, these will get cleaned up after ttm has
 	 * destroyed the ttm_resource
 	 */
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA) {
 		ret = nouveau_bo_move_prep(drm, bo, new_reg);
 		if (ret)
 			return ret;
@@ -1034,7 +1034,7 @@ nouveau_bo_vm_bind(struct ttm_buffer_object *bo, struct ttm_resource *new_reg,
 	if (new_reg->mem_type != TTM_PL_VRAM)
 		return 0;
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_CELSIUS) {
+	if (drm->device.impl->family >= NVIF_DEVICE_CELSIUS) {
 		*new_tile = nv10_bo_set_tiling(dev, offset, bo->base.size,
 					       nvbo->mode, nvbo->zeta);
 	}
@@ -1087,7 +1087,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
 	if (ret)
 		goto out_ntfy;
 
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family < NVIF_DEVICE_TESLA) {
 		ret = nouveau_bo_vm_bind(bo, new_reg, &new_tile);
 		if (ret)
 			goto out_ntfy;
@@ -1137,7 +1137,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
 	}
 
 out:
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family < NVIF_DEVICE_TESLA) {
 		if (ret)
 			nouveau_bo_vm_cleanup(bo, NULL, &new_tile);
 		else
@@ -1210,7 +1210,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resource *reg)
 		reg->bus.is_iomem = true;
 
 		/* Some BARs do not support being ioremapped WC */
-		if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA &&
+		if (drm->device.impl->family >= NVIF_DEVICE_TESLA &&
 		    mmu->impl->type[drm->ttm.type_vram].type & NVIF_MEM_UNCACHED)
 			reg->bus.caching = ttm_uncached;
 		else
@@ -1305,7 +1305,7 @@ vm_fault_t nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo)
 	 * nothing to do here.
 	 */
 	if (bo->resource->mem_type != TTM_PL_VRAM) {
-		if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA ||
+		if (drm->device.impl->family < NVIF_DEVICE_TESLA ||
 		    !nvbo->kind)
 			return 0;
 
@@ -1316,7 +1316,7 @@ vm_fault_t nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo)
 
 	} else {
 		/* make sure bo is in mappable vram */
-		if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA ||
+		if (drm->device.impl->family >= NVIF_DEVICE_TESLA ||
 		    bo->resource->start + PFN_UP(bo->resource->size) < mappable)
 			return 0;
 
drivers/gpu/drm/nouveau/nouveau_chan.c +10 -10
index 1cd8953740f5..cb5b75bc53d5 100644
@@ -190,7 +190,7 @@ nouveau_channel_prep(struct nouveau_cli *cli,
 	 */
 	chan->push.addr = chan->push.buffer->offset;
 
-	if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
+	if (device->impl->family >= NVIF_DEVICE_TESLA) {
 		ret = nouveau_vma_new(chan->push.buffer, chan->vmm,
 				      &chan->push.vma);
 		if (ret) {
@@ -200,7 +200,7 @@ nouveau_channel_prep(struct nouveau_cli *cli,
 
 		chan->push.addr = chan->push.vma->addr;
 
-		if (device->info.family >= NV_DEVICE_INFO_V0_FERMI)
+		if (device->impl->family >= NVIF_DEVICE_FERMI)
 			return 0;
 
 		args.target = NV_DMA_V0_TARGET_VM;
@@ -209,7 +209,7 @@ nouveau_channel_prep(struct nouveau_cli *cli,
 		args.limit = chan->vmm->vmm.impl->limit - 1;
 	} else
 	if (chan->push.buffer->bo.resource->mem_type == TTM_PL_VRAM) {
-		if (device->info.family == NV_DEVICE_INFO_V0_TNT) {
+		if (device->impl->family == NVIF_DEVICE_TNT) {
 			/* nv04 vram pushbuf hack, retarget to its location in
 			 * the framebuffer bar rather than direct vram access..
 			 * nfi why this exists, it came from the -nv ddx.
@@ -217,12 +217,12 @@ nouveau_channel_prep(struct nouveau_cli *cli,
 			args.target = NV_DMA_V0_TARGET_PCI;
 			args.access = NV_DMA_V0_ACCESS_RDWR;
 			args.start = nvxx_device(drm)->func->resource_addr(nvxx_device(drm), 1);
-			args.limit = args.start + device->info.ram_user - 1;
+			args.limit = args.start + device->impl->ram_user - 1;
 		} else {
 			args.target = NV_DMA_V0_TARGET_VRAM;
 			args.access = NV_DMA_V0_ACCESS_RDWR;
 			args.start = 0;
-			args.limit = device->info.ram_user - 1;
+			args.limit = device->impl->ram_user - 1;
 		}
 	} else {
 		if (drm->agp.bridge) {
@@ -378,8 +378,8 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 	}
 
 	/* allocate dma objects to cover all allowed vram, and gart */
-	if (device->info.family < NV_DEVICE_INFO_V0_FERMI) {
-		if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
+	if (device->impl->family < NVIF_DEVICE_FERMI) {
+		if (device->impl->family >= NVIF_DEVICE_TESLA) {
 			args.target = NV_DMA_V0_TARGET_VM;
 			args.access = NV_DMA_V0_ACCESS_VM;
 			args.start = 0;
@@ -388,7 +388,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 			args.target = NV_DMA_V0_TARGET_VRAM;
 			args.access = NV_DMA_V0_ACCESS_RDWR;
 			args.start = 0;
-			args.limit = device->info.ram_user - 1;
+			args.limit = device->impl->ram_user - 1;
 		}
 
 		ret = nvif_chan_ctxdma_ctor(&chan->chan, "abi16ChanVramCtxDma", vram,
@@ -397,7 +397,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 		if (ret)
 			return ret;
 
-		if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
+		if (device->impl->family >= NVIF_DEVICE_TESLA) {
 			args.target = NV_DMA_V0_TARGET_VM;
 			args.access = NV_DMA_V0_ACCESS_VM;
 			args.start = 0;
@@ -456,7 +456,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
 		PUSH_DATA(&chan->chan.push, 0x00000000);
 
 	/* allocate software object class (used for fences on <= nv05) */
-	if (device->info.family < NV_DEVICE_INFO_V0_CELSIUS) {
+	if (device->impl->family < NVIF_DEVICE_CELSIUS) {
 		ret = nvif_engobj_ctor(&chan->chan, "abi16NvswFence", 0x006e,
 				       NVIF_CLASS_SW_NV04, &chan->nvsw);
 		if (ret)
drivers/gpu/drm/nouveau/nouveau_connector.c +11 -11
index 3063ef792023..a8e5f01ba9dd 100644
@@ -513,13 +513,13 @@ nouveau_connector_set_encoder(struct drm_connector *connector,
 		return;
 	nv_connector->detected_encoder = nv_encoder;
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA) {
 		if (nv_encoder->dcb->type == DCB_OUTPUT_DP)
 			connector->interlace_allowed =
 				nv_encoder->caps.dp_interlace;
 		else
 			connector->interlace_allowed =
-				drm->client.device.info.family < NV_DEVICE_INFO_V0_VOLTA;
+				drm->device.impl->family < NVIF_DEVICE_VOLTA;
 		connector->doublescan_allowed = true;
 	} else
 	if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS ||
@@ -528,8 +528,8 @@ nouveau_connector_set_encoder(struct drm_connector *connector,
 		connector->interlace_allowed = false;
 	} else {
 		connector->doublescan_allowed = true;
-		if (drm->client.device.info.family == NV_DEVICE_INFO_V0_KELVIN ||
-		    (drm->client.device.info.family == NV_DEVICE_INFO_V0_CELSIUS &&
+		if (drm->device.impl->family == NVIF_DEVICE_KELVIN ||
+		    (drm->device.impl->family == NVIF_DEVICE_CELSIUS &&
 		     (pdev->device & 0x0ff0) != 0x0100 &&
 		     (pdev->device & 0x0ff0) != 0x0150))
 			/* HW is broken */
@@ -1045,7 +1045,7 @@ get_tmds_link_bandwidth(struct drm_connector *connector)
 		/* Note: these limits are conservative, some Fermi's
 		 * can do 297 MHz. Unclear how this can be determined.
 		 */
-		if (drm->client.device.info.chipset >= 0x120) {
+		if (drm->device.impl->chipset >= 0x120) {
 			const int max_tmds_clock =
 				info->hdmi.scdc.scrambling.supported ?
 				594000 : 340000;
@@ -1053,18 +1053,18 @@ get_tmds_link_bandwidth(struct drm_connector *connector)
 				min(info->max_tmds_clock, max_tmds_clock) :
 				max_tmds_clock;
 		}
-		if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_KEPLER)
+		if (drm->device.impl->family >= NVIF_DEVICE_KEPLER)
 			return 297000;
-		if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_FERMI)
+		if (drm->device.impl->family >= NVIF_DEVICE_FERMI)
 			return 225000;
 	}
 
 	if (dcb->location != DCB_LOC_ON_CHIP ||
-	    drm->client.device.info.chipset >= 0x46)
+	    drm->device.impl->chipset >= 0x46)
 		return 165000 * duallink_scale;
-	else if (drm->client.device.info.chipset >= 0x40)
+	else if (drm->device.impl->chipset >= 0x40)
 		return 155000 * duallink_scale;
-	else if (drm->client.device.info.chipset >= 0x18)
+	else if (drm->device.impl->chipset >= 0x18)
 		return 135000 * duallink_scale;
 	else
 		return 112000 * duallink_scale;
@@ -1348,7 +1348,7 @@ nouveau_connector_create(struct drm_device *dev, int index)
 		 * figure out something suitable ourselves
 		 */
 		if (nv_connector->type == DCB_CONNECTOR_NONE &&
-		    !WARN_ON(drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)) {
+		    !WARN_ON(drm->device.impl->family >= NVIF_DEVICE_TESLA)) {
 			struct dcb_table *dcbt = &drm->vbios.dcb;
 			u32 encoders = 0;
 			int i;
drivers/gpu/drm/nouveau/nouveau_display.c +13 -14
index 3f75c7f33429..f6fb4e6ab4f6 100644
@@ -155,7 +155,7 @@ nouveau_decode_mod(struct nouveau_drm *drm,
 		*tile_mode = (uint32_t)(modifier & 0xF);
 		*kind = (uint8_t)((modifier >> 12) & 0xFF);
 
-		if (drm->client.device.info.chipset >= 0xc0)
+		if (drm->device.impl->chipset >= 0xc0)
 			*tile_mode <<= 4;
 	}
 }
@@ -196,9 +196,8 @@ nouveau_validate_decode_mod(struct nouveau_drm *drm,
 	struct nouveau_display *disp = nouveau_display(drm->dev);
 	int mod;
 
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family < NVIF_DEVICE_TESLA)
 		return -EINVAL;
-	}
 
 	BUG_ON(!disp->format_modifiers);
 
@@ -240,9 +239,9 @@ nouveau_get_height_in_blocks(struct nouveau_drm *drm,
 	uint32_t log_gob_height;
 	uint32_t log_block_height;
 
-	BUG_ON(drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA);
+	BUG_ON(drm->device.impl->family < NVIF_DEVICE_TESLA);
 
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_FERMI)
+	if (drm->device.impl->family < NVIF_DEVICE_FERMI)
 		log_gob_height = 2;
 	else
 		log_gob_height = 3;
@@ -260,9 +259,9 @@ nouveau_check_bl_size(struct nouveau_drm *drm, struct nouveau_bo *nvbo,
 	uint32_t gob_size, bw, bh;
 	uint64_t bl_size;
 
-	BUG_ON(drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA);
+	BUG_ON(drm->device.impl->family < NVIF_DEVICE_TESLA);
 
-	if (drm->client.device.info.chipset >= 0xc0) {
+	if (drm->device.impl->chipset >= 0xc0) {
 		if (tile_mode & 0xF)
 			return -EINVAL;
 		tile_mode >>= 4;
@@ -271,7 +270,7 @@ nouveau_check_bl_size(struct nouveau_drm *drm, struct nouveau_bo *nvbo,
 	if (tile_mode & 0xFFFFFFF0)
 		return -EINVAL;
 
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_FERMI)
+	if (drm->device.impl->family < NVIF_DEVICE_FERMI)
 		gob_size = 256;
 	else
 		gob_size = 512;
@@ -307,7 +306,7 @@ nouveau_framebuffer_new(struct drm_device *dev,
 	int ret;
 
         /* YUV overlays have special requirements pre-NV50 */
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA &&
+	if (drm->device.impl->family < NVIF_DEVICE_TESLA &&
 
 	    (mode_cmd->pixel_format == DRM_FORMAT_YUYV ||
 	     mode_cmd->pixel_format == DRM_FORMAT_UYVY ||
@@ -698,15 +697,15 @@ nouveau_display_create(struct drm_device *dev)
 
 	dev->mode_config.min_width = 0;
 	dev->mode_config.min_height = 0;
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_CELSIUS) {
+	if (drm->device.impl->family < NVIF_DEVICE_CELSIUS) {
 		dev->mode_config.max_width = 2048;
 		dev->mode_config.max_height = 2048;
 	} else
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family < NVIF_DEVICE_TESLA) {
 		dev->mode_config.max_width = 4096;
 		dev->mode_config.max_height = 4096;
 	} else
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_FERMI) {
+	if (drm->device.impl->family < NVIF_DEVICE_FERMI) {
 		dev->mode_config.max_width = 8192;
 		dev->mode_config.max_height = 8192;
 	} else {
@@ -717,7 +716,7 @@ nouveau_display_create(struct drm_device *dev)
 	dev->mode_config.preferred_depth = 24;
 	dev->mode_config.prefer_shadow = 1;
 
-	if (drm->client.device.info.chipset < 0x11)
+	if (drm->device.impl->chipset < 0x11)
 		dev->mode_config.async_page_flip = false;
 	else
 		dev->mode_config.async_page_flip = true;
@@ -854,7 +853,7 @@ nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
 	args->size = roundup(args->size, PAGE_SIZE);
 
 	/* Use VRAM if there is any ; otherwise fallback to system memory */
-	if (nouveau_drm(dev)->client.device.info.ram_size != 0)
+	if (nouveau_drm(dev)->device.impl->ram_size != 0)
 		domain = NOUVEAU_GEM_DOMAIN_VRAM;
 	else
 		domain = NOUVEAU_GEM_DOMAIN_GART;
drivers/gpu/drm/nouveau/nouveau_dmem.c +1 -1
index a0c24456e031..2cb06f0a217f 100644
@@ -591,7 +591,7 @@ nouveau_dmem_init(struct nouveau_drm *drm)
 	int ret;
 
 	/* This only make sense on PASCAL or newer */
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_PASCAL)
+	if (drm->device.impl->family < NVIF_DEVICE_PASCAL)
 		return;
 
 	if (!(drm->dmem = kzalloc(sizeof(*drm->dmem), GFP_KERNEL)))
drivers/gpu/drm/nouveau/nouveau_drm.c +7 -7
index fb01f51fd689..6c4469f31c53 100644
@@ -311,11 +311,11 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 	 * synchronisation of page flips, as well as to implement fences
 	 * on TNT/TNT2 HW that lacks any kind of support in host.
 	 */
-	if (device->info.family < NV_DEVICE_INFO_V0_TESLA) {
+	if (device->impl->family < NVIF_DEVICE_TESLA) {
 		ret = nvif_engobj_ctor(&drm->channel->chan, "drmNvSw", NVDRM_NVSW,
 				       nouveau_abi16_swclass(drm), &drm->channel->nvsw);
 
-		if (ret == 0 && device->info.chipset >= 0x11) {
+		if (ret == 0 && device->impl->chipset >= 0x11) {
 			ret = nvif_engobj_ctor(&drm->channel->chan, "drmBlit", 0x005f, 0x009f,
 					       &drm->channel->blit);
 		}
@@ -325,7 +325,7 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 
 			ret = PUSH_WAIT(push, 8);
 			if (ret == 0) {
-				if (device->info.chipset >= 0x11) {
+				if (device->impl->chipset >= 0x11) {
 					PUSH_NVSQ(push, NV05F, 0x0000, 0x005f);
 					PUSH_NVSQ(push, NV09F, 0x0120, 0,
 							       0x0124, 1,
@@ -346,7 +346,7 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 	 * even if notification is never requested, so, allocate a ctxdma on
 	 * any GPU where it's possible we'll end up using M2MF for BO moves.
 	 */
-	if (device->info.family < NV_DEVICE_INFO_V0_FERMI) {
+	if (device->impl->family < NVIF_DEVICE_FERMI) {
 		ret = nvkm_gpuobj_new(nvxx_device(drm), 32, 0, false, NULL, &drm->notify);
 		if (ret) {
 			NV_ERROR(drm, "failed to allocate notifier, %d\n", ret);
@@ -435,7 +435,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
 	}
 
 	/* Volta requires access to a doorbell register for kickoff. */
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_VOLTA) {
+	if (device->impl->family >= NVIF_DEVICE_VOLTA) {
 		ret = nvif_user_ctor(&drm->device, "drmUsermode");
 		if (ret)
 			return;
@@ -577,7 +577,7 @@ nouveau_drm_device_init(struct drm_device *dev, struct nvkm_device *nvkm)
 	 * nosnoop capability.  hopefully won't cause issues until a
 	 * better fix is found - assuming there is one...
 	 */
-	if (drm->client.device.info.chipset == 0xc1)
+	if (drm->device.impl->chipset == 0xc1)
 		nvif_mask(&drm->client.device.object, 0x00088080, 0x00000800, 0x00000000);
 
 	nouveau_vga_init(drm);
@@ -799,7 +799,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 	if (ret)
 		goto fail_drm_dev_init;
 
-	if (nouveau_drm(drm_dev)->client.device.info.ram_size <= 32 * 1024 * 1024)
+	if (nouveau_drm(drm_dev)->device.impl->ram_size <= 32 * 1024 * 1024)
 		drm_fbdev_generic_setup(drm_dev, 8);
 	else
 		drm_fbdev_generic_setup(drm_dev, 32);
drivers/gpu/drm/nouveau/nouveau_gem.c +7 -6
index 9ae2cee1c7c5..ede2bf30ebc2 100644
@@ -286,7 +286,7 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain,
 	 */
 	nvbo->valid_domains = NOUVEAU_GEM_DOMAIN_VRAM |
 			      NOUVEAU_GEM_DOMAIN_GART;
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA)
 		nvbo->valid_domains &= domain;
 
 	if (nvbo->no_share) {
@@ -305,6 +305,7 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem,
 	struct nouveau_cli *cli = nouveau_cli(file_priv);
 	struct nouveau_bo *nvbo = nouveau_gem_object(gem);
 	struct nouveau_vmm *vmm = nouveau_cli_vmm(cli);
+	struct nouveau_drm *drm = cli->drm;
 	struct nouveau_vma *vma;
 
 	if (is_power_of_2(nvbo->valid_domains))
@@ -328,10 +329,10 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem,
 	rep->map_handle = drm_vma_node_offset_addr(&nvbo->bo.base.vma_node);
 	rep->tile_mode = nvbo->mode;
 	rep->tile_flags = nvbo->contig ? 0 : NOUVEAU_GEM_TILE_NONCONTIG;
-	if (cli->device.info.family >= NV_DEVICE_INFO_V0_FERMI)
+	if (drm->device.impl->family >= NVIF_DEVICE_FERMI)
 		rep->tile_flags |= nvbo->kind << 8;
 	else
-	if (cli->device.info.family >= NV_DEVICE_INFO_V0_TESLA)
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA)
 		rep->tile_flags |= nvbo->kind << 8 | nvbo->comp << 16;
 	else
 		rep->tile_flags |= nvbo->zeta;
@@ -600,7 +601,7 @@ validate_list(struct nouveau_channel *chan,
 			return ret;
 		}
 
-		if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
+		if (drm->device.impl->family < NVIF_DEVICE_TESLA) {
 			if (nvbo->offset == b->presumed.offset &&
 			    ((nvbo->bo.resource->mem_type == TTM_PL_VRAM &&
 			      b->presumed.domain & NOUVEAU_GEM_DOMAIN_VRAM) ||
@@ -870,7 +871,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 			nv50_dma_push(chan, addr, length, no_prefetch);
 		}
 	} else
-	if (drm->client.device.info.chipset >= 0x25) {
+	if (drm->device.impl->chipset >= 0x25) {
 		ret = PUSH_WAIT(&chan->chan.push, req->nr_push * 2);
 		if (ret) {
 			NV_PRINTK(err, cli, "cal_space: %d\n", ret);
@@ -965,7 +966,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 		req->suffix0 = 0x00000000;
 		req->suffix1 = 0x00000000;
 	} else
-	if (drm->client.device.info.chipset >= 0x25) {
+	if (drm->device.impl->chipset >= 0x25) {
 		req->suffix0 = 0x00020000;
 		req->suffix1 = 0x00000000;
 	} else {
drivers/gpu/drm/nouveau/nouveau_sgdma.c +1 -1
index 172744470bd1..e90d8b47be47 100644
@@ -42,7 +42,7 @@ nouveau_sgdma_bind(struct ttm_device *bdev, struct ttm_tt *ttm, struct ttm_resou
 	if (ret)
 		return ret;
 
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family < NVIF_DEVICE_TESLA) {
 		ret = nouveau_mem_map(mem, &drm->cli.vmm.vmm, &mem->vma[0]);
 		if (ret) {
 			nouveau_mem_fini(mem);
drivers/gpu/drm/nouveau/nouveau_svm.c +1 -1
index 534448f82daa..55895e746003 100644
@@ -1048,7 +1048,7 @@ nouveau_svm_init(struct nouveau_drm *drm)
 	 * otherwise clients will have a trivial way to trash the GPU
 	 * for everyone.
 	 */
-	if (drm->client.device.info.family > NV_DEVICE_INFO_V0_PASCAL)
+	if (drm->device.impl->family > NVIF_DEVICE_PASCAL)
 		return;
 
 	switch (drm->device.impl->faultbuf.oclass) {
drivers/gpu/drm/nouveau/nouveau_ttm.c +10 -11
index 36f5be963851..5b0f78e48cc7 100644
@@ -70,7 +70,7 @@ nouveau_vram_manager_new(struct ttm_resource_manager *man,
 	struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
 	int ret;
 
-	if (drm->client.device.info.ram_size == 0)
+	if (drm->device.impl->ram_size == 0)
 		return -ENOMEM;
 
 	ret = nouveau_mem_new(drm, nvbo->kind, nvbo->comp, res);
@@ -180,7 +180,7 @@ nouveau_ttm_init_host(struct nouveau_drm *drm, u8 kind)
 static int
 nouveau_ttm_init_vram(struct nouveau_drm *drm)
 {
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA) {
 		struct ttm_resource_manager *man = kzalloc(sizeof(*man), GFP_KERNEL);
 
 		if (!man)
@@ -204,7 +204,7 @@ nouveau_ttm_fini_vram(struct nouveau_drm *drm)
 {
 	struct ttm_resource_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM);
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA) {
 		ttm_resource_manager_set_used(man, false);
 		ttm_resource_manager_evict_all(&drm->ttm.bdev, man);
 		ttm_resource_manager_cleanup(man);
@@ -221,7 +221,7 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
 	unsigned long size_pages = drm->gem.gart_available >> PAGE_SHIFT;
 	const struct ttm_resource_manager_func *func = NULL;
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA)
 		func = &nouveau_gart_manager;
 	else if (!drm->agp.bridge)
 		func = &nv04_gart_manager;
@@ -246,8 +246,7 @@ nouveau_ttm_fini_gtt(struct nouveau_drm *drm)
 {
 	struct ttm_resource_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_TT);
 
-	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA &&
-	    drm->agp.bridge)
+	if (drm->device.impl->family < NVIF_DEVICE_TESLA && drm->agp.bridge)
 		ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_TT);
 	else {
 		ttm_resource_manager_set_used(man, false);
@@ -271,15 +270,15 @@ nouveau_ttm_init(struct nouveau_drm *drm)
 	if (ret)
 		return ret;
 
-	if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA &&
-	    drm->client.device.info.chipset != 0x50) {
+	if (drm->device.impl->family >= NVIF_DEVICE_TESLA &&
+	    drm->device.impl->chipset != 0x50) {
 		ret = nouveau_ttm_init_host(drm, NVIF_MEM_KIND);
 		if (ret)
 			return ret;
 	}
 
-	if (drm->client.device.info.platform != NV_DEVICE_INFO_V0_SOC &&
-	    drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
+	if (drm->device.impl->platform != NVIF_DEVICE_SOC &&
+	    drm->device.impl->family >= NVIF_DEVICE_TESLA) {
 		typei = nvif_mmu_type(mmu, NVIF_MEM_VRAM | NVIF_MEM_MAPPABLE |
 					   NVIF_MEM_KIND |
 					   NVIF_MEM_COMP |
@@ -310,7 +309,7 @@ nouveau_ttm_init(struct nouveau_drm *drm)
 	}
 
 	/* VRAM init */
-	drm->gem.vram_available = drm->client.device.info.ram_user;
+	drm->gem.vram_available = drm->device.impl->ram_user;
 
 	arch_io_reserve_memtype_wc(device->func->resource_addr(device, 1),
 				   device->func->resource_size(device, 1));
drivers/gpu/drm/nouveau/nouveau_vga.c +4 -4
index f8bf0ec26844..ff7aeafb068b 100644
@@ -12,13 +12,13 @@ static unsigned int
 nouveau_vga_set_decode(struct pci_dev *pdev, bool state)
 {
 	struct nouveau_drm *drm = nouveau_drm(pci_get_drvdata(pdev));
-	struct nvif_object *device = &drm->client.device.object;
+	struct nvif_device *device = &drm->device;
 
-	if (drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE &&
-	    drm->client.device.info.chipset >= 0x4c)
+	if (device->impl->family == NVIF_DEVICE_CURIE &&
+	    device->impl->chipset >= 0x4c)
 		nvif_wr32(device, 0x088060, state);
 	else
-	if (drm->client.device.info.chipset >= 0x40)
+	if (device->impl->chipset >= 0x40)
 		nvif_wr32(device, 0x088054, state);
 	else
 		nvif_wr32(device, 0x001854, state);
drivers/gpu/drm/nouveau/nv84_fence.c +1 -1
index 0626c24ca065..4b107c1a5686 100644
@@ -215,7 +215,7 @@ nv84_fence_create(struct nouveau_drm *drm)
 	mutex_init(&priv->mutex);
 
 	/* Use VRAM if there is any ; otherwise fallback to system memory */
-	domain = drm->client.device.info.ram_size != 0 ?
+	domain = drm->device.impl->ram_size != 0 ?
 		NOUVEAU_GEM_DOMAIN_VRAM :
 		 /*
 		  * fences created in sysmem must be non-cached or we
drivers/gpu/drm/nouveau/nvif/device.c +0 -14
index 131286239b51..7c2b57d562a4 100644
@@ -85,19 +85,5 @@ nvif_device_ctor(struct nvif_client *client, const char *name, struct nvif_devic
 
 	nvif_object_ctor(&client->object, name ?: "nvifDevice", 0, 0, &device->object);
 	device->object.client = client;
-
-	if (ret == 0) {
-		/*FIXME: remove after moving users to device->impl */
-		device->info.version = 0;
-		device->info.platform = device->impl->platform;
-		device->info.chipset = device->impl->chipset;
-		device->info.revision = device->impl->revision;
-		device->info.family = device->impl->family;
-		device->info.ram_size = device->impl->ram_size;
-		device->info.ram_user = device->impl->ram_user;
-		strscpy(device->info.chip, device->impl->chip, sizeof(device->info.chip));
-		strscpy(device->info.name, device->impl->name, sizeof(device->info.name));
-	}
-
 	return ret;
 }
Signature · 1 line
2.41.0
author
#156 lore raw

PATCH 155/156 drm/nouveau: remove remaining usage of nvif_device.object.map

In reply to Ben Skeggs

- accesses to PRI are now via nvif_device.map

---
 drivers/gpu/drm/nouveau/dispnv04/dac.c        | 10 +++++-----
 drivers/gpu/drm/nouveau/dispnv04/dfp.c        |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/hw.c         |  8 ++++----
 drivers/gpu/drm/nouveau/dispnv04/hw.h         | 20 +++++++++----------
 drivers/gpu/drm/nouveau/dispnv04/overlay.c    |  8 ++++----
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.h     | 10 ++++++----
 drivers/gpu/drm/nouveau/dispnv50/crc.c        |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/curs507a.c   |  2 +-
 drivers/gpu/drm/nouveau/include/nvif/object.h | 10 ++++------
 drivers/gpu/drm/nouveau/nouveau_backlight.c   |  8 +++-----
 drivers/gpu/drm/nouveau/nouveau_bios.c        |  6 +++---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c     |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         |  8 ++------
 drivers/gpu/drm/nouveau/nouveau_led.c         |  4 ++--
 drivers/gpu/drm/nouveau/nouveau_svm.c         |  4 ++--
 drivers/gpu/drm/nouveau/nvif/dispchan.c       |  4 ++--
 drivers/gpu/drm/nouveau/nvif/object.c         |  4 ----
 17 files changed, 51 insertions(+), 61 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/dac.c +5 -5
index 4d8e34274c4e..c68e94de7b37 100644
@@ -66,7 +66,7 @@ int nv04_dac_output_offset(struct drm_encoder *encoder)
 static int sample_load_twice(struct drm_device *dev, bool sense[2])
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvif_object *device = &drm->client.device.object;
+	struct nvif_device *device = &drm->device;
 	int i;
 
 	for (i = 0; i < 2; i++) {
@@ -80,19 +80,19 @@ static int sample_load_twice(struct drm_device *dev, bool sense[2])
 		 * use a 10ms timeout (guards against crtc being inactive, in
 		 * which case blank state would never change)
 		 */
-		if (nvif_msec(&drm->client.device, 10,
+		if (nvif_msec(device, 10,
 			if (!(nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 1))
 				break;
 		) < 0)
 			return -EBUSY;
 
-		if (nvif_msec(&drm->client.device, 10,
+		if (nvif_msec(device, 10,
 			if ( (nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 1))
 				break;
 		) < 0)
 			return -EBUSY;
 
-		if (nvif_msec(&drm->client.device, 10,
+		if (nvif_msec(device, 10,
 			if (!(nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 1))
 				break;
 		) < 0)
@@ -133,7 +133,7 @@ static enum drm_connector_status nv04_dac_detect(struct drm_encoder *encoder,
 						 struct drm_connector *connector)
 {
 	struct drm_device *dev = encoder->dev;
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	uint8_t saved_seq1, saved_pi, saved_rpc1, saved_cr_mode;
 	uint8_t saved_palette0[3], saved_palette_mask;
drivers/gpu/drm/nouveau/dispnv04/dfp.c +1 -1
index da2a759dbaab..0eff4235cdf1 100644
@@ -487,7 +487,7 @@ static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode)
 {
 #ifdef __powerpc__
 	struct drm_device *dev = encoder->dev;
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	struct pci_dev *pdev = to_pci_dev(dev->dev);
 
 	/* BIOS scripts usually take care of the backlight, thanks
drivers/gpu/drm/nouveau/dispnv04/hw.c +4 -4
index ab240df4d85c..316d4b5265d6 100644
@@ -746,11 +746,11 @@ nv_load_state_ext(struct drm_device *dev, int head,
 		if (device->impl->family < NVIF_DEVICE_KELVIN) {
 			/* Not waiting for vertical retrace before modifying
 			   CRE_53/CRE_54 causes lockups. */
-			nvif_msec(&drm->client.device, 650,
+			nvif_msec(device, 650,
 				if ( (nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 8))
 					break;
 			);
-			nvif_msec(&drm->client.device, 650,
+			nvif_msec(device, 650,
 				if (!(nvif_rd32(device, NV_PRMCIO_INP0__COLOR) & 8))
 					break;
 			);
@@ -776,7 +776,7 @@ static void
 nv_save_state_palette(struct drm_device *dev, int head,
 		      struct nv04_mode_state *state)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	int head_offset = head * NV_PRMDIO_SIZE, i;
 
 	nvif_wr08(device, NV_PRMDIO_PIXEL_MASK + head_offset,
@@ -795,7 +795,7 @@ void
 nouveau_hw_load_state_palette(struct drm_device *dev, int head,
 			      struct nv04_mode_state *state)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	int head_offset = head * NV_PRMDIO_SIZE, i;
 
 	nvif_wr08(device, NV_PRMDIO_PIXEL_MASK + head_offset,
drivers/gpu/drm/nouveau/dispnv04/hw.h +10 -10
index b565cd34ed67..4a051b676a58 100644
@@ -59,7 +59,7 @@ extern void nouveau_calc_arb(struct drm_device *, int vclk, int bpp,
 static inline uint32_t NVReadCRTC(struct drm_device *dev,
 					int head, uint32_t reg)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	uint32_t val;
 	if (head)
 		reg += NV_PCRTC0_SIZE;
@@ -70,7 +70,7 @@ static inline uint32_t NVReadCRTC(struct drm_device *dev,
 static inline void NVWriteCRTC(struct drm_device *dev,
 					int head, uint32_t reg, uint32_t val)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	if (head)
 		reg += NV_PCRTC0_SIZE;
 	nvif_wr32(device, reg, val);
@@ -79,7 +79,7 @@ static inline void NVWriteCRTC(struct drm_device *dev,
 static inline uint32_t NVReadRAMDAC(struct drm_device *dev,
 					int head, uint32_t reg)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	uint32_t val;
 	if (head)
 		reg += NV_PRAMDAC0_SIZE;
@@ -90,7 +90,7 @@ static inline uint32_t NVReadRAMDAC(struct drm_device *dev,
 static inline void NVWriteRAMDAC(struct drm_device *dev,
 					int head, uint32_t reg, uint32_t val)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	if (head)
 		reg += NV_PRAMDAC0_SIZE;
 	nvif_wr32(device, reg, val);
@@ -119,7 +119,7 @@ static inline void nv_write_tmds(struct drm_device *dev,
 static inline void NVWriteVgaCrtc(struct drm_device *dev,
 					int head, uint8_t index, uint8_t value)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	nvif_wr08(device, NV_PRMCIO_CRX__COLOR + head * NV_PRMCIO_SIZE, index);
 	nvif_wr08(device, NV_PRMCIO_CR__COLOR + head * NV_PRMCIO_SIZE, value);
 }
@@ -127,7 +127,7 @@ static inline void NVWriteVgaCrtc(struct drm_device *dev,
 static inline uint8_t NVReadVgaCrtc(struct drm_device *dev,
 					int head, uint8_t index)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	uint8_t val;
 	nvif_wr08(device, NV_PRMCIO_CRX__COLOR + head * NV_PRMCIO_SIZE, index);
 	val = nvif_rd08(device, NV_PRMCIO_CR__COLOR + head * NV_PRMCIO_SIZE);
@@ -191,14 +191,14 @@ static inline void NVWritePRMVIO(struct drm_device *dev,
 
 static inline void NVSetEnablePalette(struct drm_device *dev, int head, bool enable)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	nvif_rd08(device, NV_PRMCIO_INP0__COLOR + head * NV_PRMCIO_SIZE);
 	nvif_wr08(device, NV_PRMCIO_ARX + head * NV_PRMCIO_SIZE, enable ? 0 : 0x20);
 }
 
 static inline bool NVGetEnablePalette(struct drm_device *dev, int head)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	nvif_rd08(device, NV_PRMCIO_INP0__COLOR + head * NV_PRMCIO_SIZE);
 	return !(nvif_rd08(device, NV_PRMCIO_ARX + head * NV_PRMCIO_SIZE) & 0x20);
 }
@@ -206,7 +206,7 @@ static inline bool NVGetEnablePalette(struct drm_device *dev, int head)
 static inline void NVWriteVgaAttr(struct drm_device *dev,
 					int head, uint8_t index, uint8_t value)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	if (NVGetEnablePalette(dev, head))
 		index &= ~0x20;
 	else
@@ -220,7 +220,7 @@ static inline void NVWriteVgaAttr(struct drm_device *dev,
 static inline uint8_t NVReadVgaAttr(struct drm_device *dev,
 					int head, uint8_t index)
 {
-	struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
+	struct nvif_device *device = &nouveau_drm(dev)->device;
 	uint8_t val;
 	if (NVGetEnablePalette(dev, head))
 		index &= ~0x20;
drivers/gpu/drm/nouveau/dispnv04/overlay.c +4 -4
index 103b6dddfac4..c367f292cfef 100644
@@ -192,7 +192,7 @@ static int
 nv10_disable_plane(struct drm_plane *plane,
 		   struct drm_modeset_acquire_ctx *ctx)
 {
-	struct nvif_object *dev = &nouveau_drm(plane->dev)->client.device.object;
+	struct nvif_device *dev = &nouveau_drm(plane->dev)->device;
 	struct nouveau_plane *nv_plane =
 		container_of(plane, struct nouveau_plane, base);
 
@@ -216,7 +216,7 @@ nv_destroy_plane(struct drm_plane *plane)
 static void
 nv10_set_params(struct nouveau_plane *plane)
 {
-	struct nvif_object *dev = &nouveau_drm(plane->base.dev)->client.device.object;
+	struct nvif_device *dev = &nouveau_drm(plane->base.dev)->device;
 	u32 luma = (plane->brightness - 512) << 16 | plane->contrast;
 	u32 chroma = ((sin_mul(plane->hue, plane->saturation) & 0xffff) << 16) |
 		(cos_mul(plane->hue, plane->saturation) & 0xffff);
@@ -368,7 +368,7 @@ nv04_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		  uint32_t src_w, uint32_t src_h,
 		  struct drm_modeset_acquire_ctx *ctx)
 {
-	struct nvif_object *dev = &nouveau_drm(plane->dev)->client.device.object;
+	struct nvif_device *dev = &nouveau_drm(plane->dev)->device;
 	struct nouveau_plane *nv_plane =
 		container_of(plane, struct nouveau_plane, base);
 	struct nouveau_bo *cur = nv_plane->cur;
@@ -443,7 +443,7 @@ static int
 nv04_disable_plane(struct drm_plane *plane,
 		   struct drm_modeset_acquire_ctx *ctx)
 {
-	struct nvif_object *dev = &nouveau_drm(plane->dev)->client.device.object;
+	struct nvif_device *dev = &nouveau_drm(plane->dev)->device;
 	struct nouveau_plane *nv_plane =
 		container_of(plane, struct nouveau_plane, base);
 
drivers/gpu/drm/nouveau/dispnv04/tvnv17.h +6 -4
index 29773b325bd9..38599435169c 100644
@@ -130,14 +130,16 @@ void nv17_ctv_update_rescaler(struct drm_encoder *encoder);
 static inline void nv_write_ptv(struct drm_device *dev, uint32_t reg,
 				uint32_t val)
 {
-	struct nvif_device *device = &nouveau_drm(dev)->client.device;
-	nvif_wr32(&device->object, reg, val);
+	struct nvif_device *device = &nouveau_drm(dev)->device;
+
+	nvif_wr32(device, reg, val);
 }
 
 static inline uint32_t nv_read_ptv(struct drm_device *dev, uint32_t reg)
 {
-	struct nvif_device *device = &nouveau_drm(dev)->client.device;
-	return nvif_rd32(&device->object, reg);
+	struct nvif_device *device = &nouveau_drm(dev)->device;
+
+	return nvif_rd32(device, reg);
 }
 
 static inline void nv_write_tv_enc(struct drm_device *dev, uint8_t reg,
drivers/gpu/drm/nouveau/dispnv50/crc.c +1 -1
index 97905ec648d0..6d1395b8c597 100644
@@ -223,7 +223,7 @@ static void nv50_crc_wait_ctx_finished(struct nv50_head *head,
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	s64 ret;
 
-	ret = nvif_msec(&drm->client.device, 50,
+	ret = nvif_msec(&drm->device, 50,
 			if (func->ctx_finished(head, ctx)) break;);
 	if (ret == -ETIMEDOUT)
 		NV_ERROR(drm,
drivers/gpu/drm/nouveau/dispnv50/curs507a.c +1 -1
index 58bfaf036bbb..bf46bca8a149 100644
@@ -33,7 +33,7 @@
 bool
 curs507a_space(struct nv50_wndw *wndw)
 {
-	nvif_msec(&nouveau_drm(wndw->plane.dev)->client.device, 100,
+	nvif_msec(&nouveau_drm(wndw->plane.dev)->device, 100,
 		if (NVIF_TV32(&wndw->wimm, NV507A, FREE, COUNT, >=, 4))
 			return true;
 	);
drivers/gpu/drm/nouveau/include/nvif/object.h +4 -6
index 7a90eab48eec..4a60156f0229 100644
@@ -9,10 +9,6 @@ struct nvif_object {
 	const char *name;
 	u32 handle;
 	s32 oclass;
-	struct {
-		void __iomem *ptr;
-		u64 size;
-	} map;
 };
 
 struct nvif_map {
@@ -37,11 +33,13 @@ int nvif_object_unmap_cpu(struct nvif_map *);
 #define nvif_object(a) (a)->object
 
 #define nvif_rd(a,f,b,c) ({                                                    \
-	u32 _data = f((u8 __iomem *)(a)->map.ptr + (c));                       \
+	struct nvif_map *_map = &(a)->map;                                     \
+	u32 _data = f((u8 __iomem *)_map->ptr + (c));                          \
 	_data;                                                                 \
 })
 #define nvif_wr(a,f,b,c,d) ({                                                  \
-	f((d), (u8 __iomem *)(a)->map.ptr + (c));                              \
+	struct nvif_map *_map = &(a)->map;                                     \
+	f((d), (u8 __iomem *)_map->ptr + (c));                                 \
 })
 #define nvif_rd08(a,b) ({ ((u8)nvif_rd((a), ioread8, 1, (b))); })
 #define nvif_rd16(a,b) ({ ((u16)nvif_rd((a), ioread16_native, 2, (b))); })
drivers/gpu/drm/nouveau/nouveau_backlight.c +3 -5
index 925856f3b21b..3d63c90247a0 100644
@@ -65,8 +65,7 @@ nv40_get_intensity(struct backlight_device *bd)
 {
 	struct nouveau_encoder *nv_encoder = bl_get_data(bd);
 	struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
-	struct nvif_object *device = &drm->client.device.object;
-	int val = (nvif_rd32(device, NV40_PMC_BACKLIGHT) &
+	int val = (nvif_rd32(&drm->device, NV40_PMC_BACKLIGHT) &
 		   NV40_PMC_BACKLIGHT_MASK) >> 16;
 
 	return val;
@@ -77,7 +76,7 @@ nv40_set_intensity(struct backlight_device *bd)
 {
 	struct nouveau_encoder *nv_encoder = bl_get_data(bd);
 	struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
-	struct nvif_object *device = &drm->client.device.object;
+	struct nvif_device *device = &drm->device;
 	int val = bd->props.brightness;
 	int reg = nvif_rd32(device, NV40_PMC_BACKLIGHT);
 
@@ -99,9 +98,8 @@ nv40_backlight_init(struct nouveau_encoder *encoder,
 		    const struct backlight_ops **ops)
 {
 	struct nouveau_drm *drm = nouveau_drm(encoder->base.base.dev);
-	struct nvif_object *device = &drm->client.device.object;
 
-	if (!(nvif_rd32(device, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK))
+	if (!(nvif_rd32(&drm->device, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK))
 		return -ENODEV;
 
 	props->max_brightness = 31;
drivers/gpu/drm/nouveau/nouveau_bios.c +3 -3
index c9c68416d558..6623aab96e25 100644
@@ -218,7 +218,7 @@ int call_lvds_script(struct drm_device *dev, struct dcb_output *dcbent, int head
 	 */
 
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvif_object *device = &drm->client.device.object;
+	struct nvif_device *device = &drm->device;
 	struct nvbios *bios = &drm->vbios;
 	uint8_t lvds_ver = bios->data[bios->fp.lvdsmanufacturerpointer];
 	uint32_t sel_clk_binding, sel_clk;
@@ -638,7 +638,7 @@ int run_tmds_table(struct drm_device *dev, struct dcb_output *dcbent, int head,
 	 */
 
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvif_object *device = &drm->client.device.object;
+	struct nvif_device *device = &drm->device;
 	struct nvbios *bios = &drm->vbios;
 	int cv = bios->chip_version;
 	uint16_t clktable = 0, scriptptr;
@@ -1925,7 +1925,7 @@ static int load_nv17_hwsq_ucode_entry(struct drm_device *dev, struct nvbios *bio
 	 */
 
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvif_object *device = &drm->client.device.object;
+	struct nvif_device *device = &drm->device;
 	uint8_t bytes_to_write;
 	uint16_t hwsq_entry_offset;
 	int i;
drivers/gpu/drm/nouveau/nouveau_debugfs.c +1 -1
index 0c744a72aff2..213a01914746 100644
@@ -58,7 +58,7 @@ nouveau_debugfs_strap_peek(struct seq_file *m, void *data)
 	}
 
 	seq_printf(m, "0x%08x\n",
-		   nvif_rd32(&drm->client.device.object, 0x101000));
+		   nvif_rd32(&drm->device, 0x101000));
 
 	pm_runtime_mark_last_busy(drm->dev->dev);
 	pm_runtime_put_autosuspend(drm->dev->dev);
drivers/gpu/drm/nouveau/nouveau_drm.c +2 -6
index 6c4469f31c53..26a89ab6d462 100644
@@ -183,7 +183,6 @@ 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);
 	nvif_client_dtor(&cli->base);
 }
@@ -214,8 +213,6 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
 		goto done;
 	}
 
-	cli->device.object.map.ptr = drm->device.object.map.ptr;
-
 	ret = nvif_mmu_ctor(&cli->device, "drmMmu", &cli->mmu);
 	if (ret) {
 		NV_PRINTK(err, cli, "MMU allocation failed: %d\n", ret);
@@ -578,7 +575,7 @@ nouveau_drm_device_init(struct drm_device *dev, struct nvkm_device *nvkm)
 	 * better fix is found - assuming there is one...
 	 */
 	if (drm->device.impl->chipset == 0xc1)
-		nvif_mask(&drm->client.device.object, 0x00088080, 0x00000800, 0x00000000);
+		nvif_mask(&drm->device, 0x00088080, 0x00000800, 0x00000000);
 
 	nouveau_vga_init(drm);
 
@@ -1037,7 +1034,6 @@ nouveau_pmops_runtime_resume(struct device *dev)
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct drm_device *drm_dev = pci_get_drvdata(pdev);
 	struct nouveau_drm *drm = nouveau_drm(drm_dev);
-	struct nvif_device *device = &nouveau_drm(drm_dev)->client.device;
 	int ret;
 
 	if (!nouveau_pmops_runtime()) {
@@ -1059,7 +1055,7 @@ nouveau_pmops_runtime_resume(struct device *dev)
 	}
 
 	/* do magic */
-	nvif_mask(&device->object, 0x088488, (1 << 25), (1 << 25));
+	nvif_mask(&drm->device, 0x088488, (1 << 25), (1 << 25));
 	drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
 
 	/* Monitors may have been connected / disconnected during suspend */
drivers/gpu/drm/nouveau/nouveau_led.c +2 -2
index ac950518a820..0a6a247a42e7 100644
@@ -38,7 +38,7 @@ nouveau_led_get_brightness(struct led_classdev *led)
 {
 	struct drm_device *drm_dev = container_of(led, struct nouveau_led, led)->dev;
 	struct nouveau_drm *drm = nouveau_drm(drm_dev);
-	struct nvif_object *device = &drm->client.device.object;
+	struct nvif_device *device = &drm->device;
 	u32 div, duty;
 
 	div =  nvif_rd32(device, 0x61c880) & 0x00ffffff;
@@ -55,7 +55,7 @@ nouveau_led_set_brightness(struct led_classdev *led, enum led_brightness value)
 {
 	struct drm_device *drm_dev = container_of(led, struct nouveau_led, led)->dev;
 	struct nouveau_drm *drm = nouveau_drm(drm_dev);
-	struct nvif_object *device = &drm->client.device.object;
+	struct nvif_device *device = &drm->device;
 
 	u32 input_clk = 27e6; /* PDISPLAY.SOR[1].PWM is connected to the crystal */
 	u32 freq = 100; /* this is what nvidia uses and it should be good-enough */
drivers/gpu/drm/nouveau/nouveau_svm.c +2 -2
index 55895e746003..5b94f6e3a39d 100644
@@ -711,7 +711,7 @@ nouveau_svm_fault(struct work_struct *work)
 {
 	struct nouveau_svm_fault_buffer *buffer = container_of(work, typeof(*buffer), work);
 	struct nouveau_svm *svm = container_of(buffer, typeof(*svm), buffer[buffer->id]);
-	struct nvif_object *device = &svm->drm->client.device.object;
+	struct nvif_device *device = &svm->drm->device;
 	struct nouveau_svmm *svmm;
 	struct {
 		struct nouveau_pfnmap_args i;
@@ -935,7 +935,7 @@ static int
 nouveau_svm_fault_buffer_init(struct nouveau_svm *svm, int id)
 {
 	struct nouveau_svm_fault_buffer *buffer = &svm->buffer[id];
-	struct nvif_object *device = &svm->drm->client.device.object;
+	struct nvif_device *device = &svm->drm->device;
 
 	buffer->get = nvif_rd32(device, buffer->getaddr);
 	buffer->put = nvif_rd32(device, buffer->putaddr);
drivers/gpu/drm/nouveau/nvif/dispchan.c +2 -2
index 03738de5d791..9b84dab6b625 100644
@@ -58,9 +58,9 @@ nvif_dispchan_kick(struct nvif_push *push)
 		if (chan->push.mem.type & NVIF_MEM_VRAM) {
 			struct nvif_device *device = chan->disp->device;
 
-			nvif_wr32(&device->object, 0x070000, 0x00000001);
+			nvif_wr32(device, 0x070000, 0x00000001);
 			nvif_msec(device, 2000,
-				if (!(nvif_rd32(&device->object, 0x070000) & 0x00000002))
+				if (!(nvif_rd32(device, 0x070000) & 0x00000002))
 					break;
 			);
 		}
drivers/gpu/drm/nouveau/nvif/object.c +0 -4
index 8d4d7a93b92f..ce2f8c30f98a 100644
@@ -67,8 +67,6 @@ nvif_object_map_cpu(struct nvif_object *object,
 	map->object = object;
 	map->impl = impl;
 	map->ptr = ptr;
-
-	object->map.ptr = map->ptr; /*FIXME: needed by nvif_rd/wr */
 	return 0;
 }
 
@@ -90,6 +88,4 @@ nvif_object_ctor(struct nvif_object *parent, const char *name, u32 handle, s32 o
 	object->name = name ?: "nvifObject";
 	object->handle = handle;
 	object->oclass = oclass;
-	object->map.ptr = NULL;
-	object->map.size = 0;
 }
Signature · 1 line
2.41.0
maintainer
#157 lore raw
In reply to Ben Skeggs
Quoted 34 lines · Ben Skeggs

This is a series of cleanups that I intended on doing after posting the initial GSP-RM support several months ago, and have now had the opportunity to work on again.

The main intention here is to replace the ioctl-like interface that sits between NVKM and the nouveau DRM driver with more direct calls, to reduce the call-chain complexity (and overhead).

This is achieved by having NVKM return structs of info and function pointers specific to each class, along with an opaque pointer to its private data. These are stored in the NVIF structs and used to call directly into an implementation without handle lookups and multiple layers of indirection.

There's room for further cleanups and API changes from here, but for now most of the API usage is exactly as it was before, as the series has gotten quite large enough already.

The first part of the series starts out by cleaning up some of the interfaces within the DRM driver, and reimplementing the subset of "ioctl" interfaces needed by userspace directly.

A number of unused interfaces/function args are then removed so that they don't need to be ported, and some initial renames/preparations are made to the NVKM's user object implementations so that diffs of the next set of patches are more straightforward to read.

I then go through each class in turn, starting from the root of the object tree (client), and working up from there. The object ctors/ dtors are ported first, followed by sclass/map/etc, followed by the class's methods, and then repeating the process with each of their children.

Quoted 6 lines

Objects remain accessible with the "ioctl" interface throughout the changes (until their last use, after which they're removed from the object rb entirely) to allow each change to be done independently.

After all classes have been ported, some final cleanups are made to the DRM driver to complete the series.

Welcome back!

Do you have a git tree with this in it, since I think at least patch 25 got stuck in moderation.

Have you tested nouveau GL and nvk on top of this?

Dave.

author
#158 lore raw
Quoted 34 lines · Dave Airlie
Quoted 33 lines · Ben Skeggs

This is a series of cleanups that I intended on doing after posting the initial GSP-RM support several months ago, and have now had the opportunity to work on again.

The main intention here is to replace the ioctl-like interface that sits between NVKM and the nouveau DRM driver with more direct calls, to reduce the call-chain complexity (and overhead).

This is achieved by having NVKM return structs of info and function pointers specific to each class, along with an opaque pointer to its private data. These are stored in the NVIF structs and used to call directly into an implementation without handle lookups and multiple layers of indirection.

There's room for further cleanups and API changes from here, but for now most of the API usage is exactly as it was before, as the series has gotten quite large enough already.

The first part of the series starts out by cleaning up some of the interfaces within the DRM driver, and reimplementing the subset of "ioctl" interfaces needed by userspace directly.

A number of unused interfaces/function args are then removed so that they don't need to be ported, and some initial renames/preparations are made to the NVKM's user object implementations so that diffs of the next set of patches are more straightforward to read.

I then go through each class in turn, starting from the root of the object tree (client), and working up from there. The object ctors/ dtors are ported first, followed by sclass/map/etc, followed by the class's methods, and then repeating the process with each of their children.

Quoted 7 lines
Quoted 6 lines

Objects remain accessible with the "ioctl" interface throughout the changes (until their last use, after which they're removed from the object rb entirely) to allow each change to be done independently.

After all classes have been ported, some final cleanups are made to the DRM driver to complete the series.

Welcome back!

Hey!  Thank you :)

Quoted 3 lines

Do you have a git tree with this in it, since I think at least patch 25 got stuck in moderation.

I've pushed a tree to https://gitlab.freedesktop.org/bskeggs/nouveau/-/tree/remove-ioctl

Quoted 2 lines

Have you tested nouveau GL and nvk on top of this?

Yes I have, nvk mostly via zink (and vkcube ;)).

Ben.

Quoted 2 lines

Dave.

#159 lore raw
In reply to Ben Skeggs

Hi Ben,

Welcome back from my side as well!

Quoted 7 lines · Ben Skeggs

This is a series of cleanups that I intended on doing after posting the initial GSP-RM support several months ago, and have now had the opportunity to work on again.

The main intention here is to replace the ioctl-like interface that sits between NVKM and the nouveau DRM driver with more direct calls, to reduce the call-chain complexity (and overhead).

That sounds like a great and welcome simplification.

Quoted 6 lines

This is achieved by having NVKM return structs of info and function pointers specific to each class, along with an opaque pointer to its private data. These are stored in the NVIF structs and used to call directly into an implementation without handle lookups and multiple layers of indirection.

I just had a very brief look on the rework of the VMM bits to get a rough idea how the new interface looks like.

I think I will get the full picture, once I can apply all the patches to a tree and don't need to look at the changes scattered throughout patches.

However, I wonder if we need another indirection (such as nvif_vmm_impl) instead of just calling the corresponding functions directly? Or even more crazy, what if we'd try to rip out nvif entirely?

Maybe it would be good to sketch up some example code of how the interface works and include it in the cover letter? This way we could see / discuss whether we can even simplify it more or why it needs the indirections you have chosen.

Quoted 20 lines

There's room for further cleanups and API changes from here, but for now most of the API usage is exactly as it was before, as the series has gotten quite large enough already.

The first part of the series starts out by cleaning up some of the interfaces within the DRM driver, and reimplementing the subset of "ioctl" interfaces needed by userspace directly.

A number of unused interfaces/function args are then removed so that they don't need to be ported, and some initial renames/preparations are made to the NVKM's user object implementations so that diffs of the next set of patches are more straightforward to read.

I then go through each class in turn, starting from the root of the object tree (client), and working up from there. The object ctors/ dtors are ported first, followed by sclass/map/etc, followed by the class's methods, and then repeating the process with each of their children.

Quoted 8 lines

Objects remain accessible with the "ioctl" interface throughout the changes (until their last use, after which they're removed from the object rb entirely) to allow each change to be done independently.

After all classes have been ported, some final cleanups are made to the DRM driver to complete the series.

Ben Skeggs (156):

Wow! That's a lot of work - very much appreciated. However, I think it would have been better to share your ideas and / or example code regarding this rework early, such that discussions can happen in advance.

We could have been discussing the (new) interface, get to an agreement and then work through it in several patch series.

This has multiple advantages:

1. It makes things much easier to review; bulky patch series, such as this one, are hard to review.
2. It potentially provides different perspectives for improvements ahead of time and potentially saves a lot of your time compared to working through the feedback afterwards.
3. It better involves the community. Wouldn't it be great if someone, due to a previous discussion, voluntarily picked up some of the effort?

Can you please resend patch 25 with a corresponding '--in-reply-to='? Also, as Dave already mentioned, I'd be great if you could provide a branch containing the patches.

- Danilo

Quoted 539 lines

drm/nouveau: add nouveau_drm.device/mmu
drm/nouveau: alias nouveau_drm.client to nouveau_drm.cli drm/nouveau: pass drm to nouveau_mem_new(), instead of cli drm/nouveau: pass drm to nv50_dmac_create(), rather than device+disp drm/nouveau: pass cli to nouveau_channel_new() instead of drm+device drm/nouveau: remove nouveau_chan.device
drm/nouveau: remove chan->drm
drm/nouveau: replace some void casts with chan->cli drm/nouveau: remove nouveau_drm.master
drm/nouveau: always map device
drm/nouveau: add nouveau_cli to nouveau_abi16
drm/nouveau: handle limited nvif in abi16
drm/nouveau: remove abi16->device
drm/nouveau: remove abi16->handles
drm/nouveau: store nvkm_device pointer in nouveau_drm drm/nouveau: create pci device once
drm/nouveau: remove push pointer from nouveau_channel drm/nouveau/kms: remove a few unused struct members and fn decls drm/nouveau/kms: remove push pointer from nv50_dmac drm/nouveau/kms: move hw ring tracking vars into nvif_push drm/nouveau/kms: move dmac sync/vram ctxdmas to core+wndws drm/nouveau/nvkm: remove detect/mmio/subdev_mask from device args drm/nouveau/nvkm: move nouveau_nvif.c to nvkm/core/driver.c drm/nouveau/nvkm: move nvkm/engine/device/ to nvkm/device/ drm/nouveau/nvkm: remove perfmon
drm/nouveau/nvkm: remove nvkm_client_search() drm/nouveau/nvif: remove support for userspace backends drm/nouveau/nvif: remove route/token
drm/nouveau/nvif: remove nvxx_object()
drm/nouveau/nvif: remove nvxx_client()
drm/nouveau/nvif: remove driver keep/fini drm/nouveau/nvif: remove client version
drm/nouveau/nvif: remove client devlist
drm/nouveau/nvif: remove client fini
drm/nouveau/nvif: remove device args
drm/nouveau/nvif: remove device rd/wr
drm/nouveau/nvif: remove disp chan rd/wr
drm/nouveau/nvkm: rename struct nvkm_uevent drm/nouveau/nvkm: remove nvkm_client()
drm/nouveau/nvkm: rename struct nvkm_udevice drm/nouveau/nvkm: rename struct nvkm_control drm/nouveau/nvkm: rename struct nvkm_uvfn drm/nouveau/nvkm: rename struct nvkm_ummu drm/nouveau/nvkm: rename struct nvkm_umem drm/nouveau/nvkm: rename struct nvkm_uvmm drm/nouveau/nvkm: detach user handling from nvkm_fault_buffer drm/nouveau/nvkm: detach user handling from nvkm_disp drm/nouveau/nvkm: detach user handling from nvkm_conn drm/nouveau/nvkm: detach user handling from nvkm_outp drm/nouveau/nvkm: detach user handling from nvkm_uhead drm/nouveau/nvkm: detach user handling from nvkm_disp_chan drm/nouveau/nvkm: rename struct nvkm_ucgrp drm/nouveau/nvkm: rename struct nvkm_uchan drm/nouveau/nvkm: move umem list to mmu
drm/nouveau/disp: simplify hw user definition drm/nouveau/nvif: output oclass id in object dbg messages drm/nouveau/nvif: add alternate version of nvif_object_ctor() drm/nouveau/nvif: add alternate version of nvif_event_ctor() drm/nouveau/nvif: move nvif<->nvkm interface definitions to driverif.h drm/nouveau/nvif: rework "new driver" api drm/nouveau/nvkm: remove device list
drm/nouveau/nvif: rework driver "new client" api drm/nouveau/nvif: rework client "new device" api drm/nouveau/nvif: remove client from object rb drm/nouveau/nvif: rework device "sclass" api drm/nouveau/nvif: rework device "map" api drm/nouveau/nvif: rework device "info v0" api drm/nouveau/nvif: rework device "info v1" api drm/nouveau/nvif: rework device "time" api drm/nouveau/nvif: rework device "new ctrl" api drm/nouveau/nvif: rework ctrl "pstate info" api drm/nouveau/nvif: rework ctrl "pstate attr" api drm/nouveau/nvif: rework ctrl "pstate user" api drm/nouveau/nvif: remove ctrl from object rb drm/nouveau/nvif: rework device "new usermode" api drm/nouveau/nvif: rework usermode "map" api drm/nouveau/nvif: remove usermode from object rb drm/nouveau/nvif: rework device "new mmu" api drm/nouveau/nvif: rework mmu "sclass" api drm/nouveau/nvif: rework mmu "heap" api
drm/nouveau/nvif: rework mmu "type" api
drm/nouveau/nvif: rework mmu "kind" api
drm/nouveau/nvif: rework mmu "new mem" api drm/nouveau/nvif: rework mem "map"/"unmap" apis drm/nouveau/nvif: rework mmu "new vmm" api drm/nouveau/nvif: remove mmu from object rb drm/nouveau/nvif: rework vmm "page" api
drm/nouveau/nvif: rework vmm "get"/"put" apis drm/nouveau/nvif: rework vmm "map"/"unmap" apis drm/nouveau/nvif: rework vmm "pfnmap"/"pfnclr" apis drm/nouveau/nvif: rework vmm "raw get"/"raw put" apis drm/nouveau/nvif: rework vmm "raw map"/"raw unmap" apis drm/nouveau/nvif: rework vmm "raw sparse" api drm/nouveau/nvif: rework vmm "fault replay"/"fault cancel" apis drm/nouveau/nvif: rework device "new fault buffer" api drm/nouveau/nvif: rework fault buffer "map" api drm/nouveau/nvif: rework fault buffer "new event" api drm/nouveau/nvif: remove fault buffer from object rb drm/nouveau/nvif: rework device "new disp" api drm/nouveau/nvif: rework disp "sclass" api drm/nouveau/nvif: rework disp "new caps" api drm/nouveau/nvif: rework disp "new conn" api drm/nouveau/nvif: rework conn "new event" api drm/nouveau/nvif: remove conn from object rb drm/nouveau/nvif: rework disp "new outp" api drm/nouveau/nvif: rework outp "detect" api drm/nouveau/nvif: rework outp "edid get" api drm/nouveau/nvif: rework outp "load detect" api drm/nouveau/nvif: rework outp "inherit" apis drm/nouveau/nvif: rework outp "acquire" api drm/nouveau/nvif: rework outp "release" api drm/nouveau/nvif: rework outp "bl get"/"bl set" apis drm/nouveau/nvif: rework outp "lvds config" api drm/nouveau/nvif: rework outp "hdmi config" api drm/nouveau/nvif: rework outp "infoframe" api drm/nouveau/nvif: rework outp "hda eld" api drm/nouveau/nvif: rework outp "dp aux pwr" api drm/nouveau/nvif: rework outp "dp aux xfer" api drm/nouveau/nvif: rework outp "dp rates" api drm/nouveau/nvif: rework outp "dp train" api drm/nouveau/nvif: rework outp "dp drive" api drm/nouveau/nvif: rework outp "dp sst" api drm/nouveau/nvif: rework outp "dp mst id get"/"dp mst id put" apis drm/nouveau/nvif: rework outp "dp mst vcpi" api drm/nouveau/nvif: remove outp from object rb drm/nouveau/nvif: rework disp "new head" api drm/nouveau/nvif: rework head "scanoutpos" api drm/nouveau/nvif: rework head "new event" api drm/nouveau/nvif: remove head from object rb drm/nouveau/nvif: rework disp "new chan" apis drm/nouveau/nvif: remove disp from object rb drm/nouveau/nvif: rework disp chan "new ctxdma" api drm/nouveau/nvif: remove disp chans from object rb drm/nouveau/nvif: rework device "new cgrp" api drm/nouveau/nvif: rework device "new ctxdma" api drm/nouveau/nvif: rework device/cgrp "new chan" apis drm/nouveau/nvif: remove mem from object rb drm/nouveau/nvif: remove vmm from object rb drm/nouveau/nvif: remove ctxdma from object rb drm/nouveau/nvif: remove device from object rb drm/nouveau/nvif: rework chan "map" api
drm/nouveau/nvif: rework chan "sclass" api drm/nouveau/nvif: rework chan "new event" apis drm/nouveau/nvif: rework chan "new ctxdma" api drm/nouveau/nvif: rework chan "new engobj" apis drm/nouveau/nvif: remove chan from object rb drm/nouveau/nvif: rework engobj "mthd" api drm/nouveau/nvif: rework engobj "new event" api drm/nouveau/nvif: remove engobj from object rb drm/nouveau/nvkm: switch nvkm_object to non-irqsafe spinlock drm/nouveau: remove client_mutex
drm/nouveau: move nvxx_* definitions to nouveau_drv.h drm/nouveau: pass nouveau_drm to nvxx_*
drm/nouveau: remove remaining usage of nvif_device.info drm/nouveau: remove remaining usage of nvif_device.object.map drm/nouveau: remove remaining usage of nouveau_drm.client

 drivers/gpu/drm/nouveau/Kbuild                |   2 -
 drivers/gpu/drm/nouveau/dispnv04/arb.c        |   7 +-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  50 +-
 drivers/gpu/drm/nouveau/dispnv04/cursor.c     |   2 +-
 drivers/gpu/drm/nouveau/dispnv04/dac.c        |  18 +-
 drivers/gpu/drm/nouveau/dispnv04/dfp.c        |  12 +-
 drivers/gpu/drm/nouveau/dispnv04/disp.c       |  15 +-
 drivers/gpu/drm/nouveau/dispnv04/disp.h       |   6 +-
 drivers/gpu/drm/nouveau/dispnv04/hw.c         |  83 +-
 drivers/gpu/drm/nouveau/dispnv04/hw.h         |  45 +-
 drivers/gpu/drm/nouveau/dispnv04/overlay.c    |  21 +-
 drivers/gpu/drm/nouveau/dispnv04/tvnv04.c     |   4 +-
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c     |  16 +-
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.h     |  10 +-
 drivers/gpu/drm/nouveau/dispnv50/base.c       |  33 +-
 drivers/gpu/drm/nouveau/dispnv50/base507c.c   |  43 +-
 drivers/gpu/drm/nouveau/dispnv50/base827c.c   |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/base907c.c   |  10 +-
 drivers/gpu/drm/nouveau/dispnv50/core.c       |  84 +-
 drivers/gpu/drm/nouveau/dispnv50/core.h       |   9 +-
 drivers/gpu/drm/nouveau/dispnv50/core507d.c   |  34 +-
 drivers/gpu/drm/nouveau/dispnv50/core907d.c   |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/corec37d.c   |  19 +-
 drivers/gpu/drm/nouveau/dispnv50/corec57d.c   |   4 +-
 drivers/gpu/drm/nouveau/dispnv50/crc.c        |  34 +-
 drivers/gpu/drm/nouveau/dispnv50/crc.h        |   4 +-
 drivers/gpu/drm/nouveau/dispnv50/crc907d.c    |  12 +-
 drivers/gpu/drm/nouveau/dispnv50/crcc37d.c    |  12 +-
 drivers/gpu/drm/nouveau/dispnv50/crcc57d.c    |   4 +-
 drivers/gpu/drm/nouveau/dispnv50/curs.c       |  35 +-
 drivers/gpu/drm/nouveau/dispnv50/curs507a.c   |  41 +-
 drivers/gpu/drm/nouveau/dispnv50/cursc37a.c   |  12 +-
 drivers/gpu/drm/nouveau/dispnv50/dac507d.c    |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/dac907d.c    |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c       | 313 +------
 drivers/gpu/drm/nouveau/dispnv50/disp.h       |  37 +-
 drivers/gpu/drm/nouveau/dispnv50/head.c       |   4 +-
 drivers/gpu/drm/nouveau/dispnv50/head507d.c   |  26 +-
 drivers/gpu/drm/nouveau/dispnv50/head827d.c   |  10 +-
 drivers/gpu/drm/nouveau/dispnv50/head907d.c   |  26 +-
 drivers/gpu/drm/nouveau/dispnv50/head917d.c   |   6 +-
 drivers/gpu/drm/nouveau/dispnv50/headc37d.c   |  18 +-
 drivers/gpu/drm/nouveau/dispnv50/headc57d.c   |  12 +-
 drivers/gpu/drm/nouveau/dispnv50/lut.c        |  12 +-
 drivers/gpu/drm/nouveau/dispnv50/lut.h        |   5 +-
 drivers/gpu/drm/nouveau/dispnv50/oimm.c       |  29 +-
 drivers/gpu/drm/nouveau/dispnv50/oimm507b.c   |  20 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly.c       |  32 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly507e.c   |  28 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly827e.c   |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly907e.c   |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/pior507d.c   |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/sor507d.c    |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/sor907d.c    |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/sorc37d.c    |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/wimm.c       |  25 +-
 drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c   |  24 +-
 drivers/gpu/drm/nouveau/dispnv50/wndw.c       | 101 +-
 drivers/gpu/drm/nouveau/dispnv50/wndw.h       |  20 +-
 drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c   |  46 +-
 drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c   |  10 +-
 drivers/gpu/drm/nouveau/dispnv50/wndwc67e.c   |   2 +-
 drivers/gpu/drm/nouveau/include/nvif/cgrp.h   |  17 +
 drivers/gpu/drm/nouveau/include/nvif/chan.h   |  45 +
 drivers/gpu/drm/nouveau/include/nvif/cl0080.h |  60 --
 drivers/gpu/drm/nouveau/include/nvif/class.h  |   8 -
 drivers/gpu/drm/nouveau/include/nvif/clb069.h |  15 -
 drivers/gpu/drm/nouveau/include/nvif/client.h |  14 +-
 drivers/gpu/drm/nouveau/include/nvif/conn.h   |  24 +-
 drivers/gpu/drm/nouveau/include/nvif/ctxdma.h |  29 +
 drivers/gpu/drm/nouveau/include/nvif/device.h |  51 +-
 drivers/gpu/drm/nouveau/include/nvif/disp.h   |  19 +-
 .../gpu/drm/nouveau/include/nvif/dispchan.h   |  25 +
 drivers/gpu/drm/nouveau/include/nvif/driver.h |  27 +-
 .../gpu/drm/nouveau/include/nvif/driverif.h   | 643 +++++++++++++
 drivers/gpu/drm/nouveau/include/nvif/event.h  |  16 +-
 drivers/gpu/drm/nouveau/include/nvif/fifo.h   |  11 +-
 drivers/gpu/drm/nouveau/include/nvif/head.h   |   2 +
 drivers/gpu/drm/nouveau/include/nvif/if0000.h |  20 -
 drivers/gpu/drm/nouveau/include/nvif/if0001.h |  47 -
 drivers/gpu/drm/nouveau/include/nvif/if0002.h |  39 -
 drivers/gpu/drm/nouveau/include/nvif/if0003.h |  34 -
 drivers/gpu/drm/nouveau/include/nvif/if0008.h |  42 -
 drivers/gpu/drm/nouveau/include/nvif/if000c.h | 117 ---
 drivers/gpu/drm/nouveau/include/nvif/if000d.h |   1 -
 drivers/gpu/drm/nouveau/include/nvif/if000e.h |  26 -
 drivers/gpu/drm/nouveau/include/nvif/if0010.h |  14 -
 drivers/gpu/drm/nouveau/include/nvif/if0011.h |  18 -
 drivers/gpu/drm/nouveau/include/nvif/if0012.h | 294 ------
 drivers/gpu/drm/nouveau/include/nvif/if0013.h |  35 -
 drivers/gpu/drm/nouveau/include/nvif/if0014.h |  13 -
 drivers/gpu/drm/nouveau/include/nvif/if0020.h |  45 -
 drivers/gpu/drm/nouveau/include/nvif/if0021.h |  16 -
 drivers/gpu/drm/nouveau/include/nvif/if500d.h |   1 -
 drivers/gpu/drm/nouveau/include/nvif/if900d.h |   1 -
 drivers/gpu/drm/nouveau/include/nvif/ifb00d.h |   1 -
 drivers/gpu/drm/nouveau/include/nvif/ifc00d.h |   1 -
 drivers/gpu/drm/nouveau/include/nvif/ioctl.h  |  44 -
 drivers/gpu/drm/nouveau/include/nvif/mem.h    |  18 +-
 drivers/gpu/drm/nouveau/include/nvif/mmu.h    |  38 +-
 drivers/gpu/drm/nouveau/include/nvif/object.h | 105 +--
 drivers/gpu/drm/nouveau/include/nvif/os.h     |  19 +
 drivers/gpu/drm/nouveau/include/nvif/outp.h   |  58 +-
 drivers/gpu/drm/nouveau/include/nvif/printf.h |   9 +-
 drivers/gpu/drm/nouveau/include/nvif/push.h   |  18 +-
 drivers/gpu/drm/nouveau/include/nvif/user.h   |   6 +-
 drivers/gpu/drm/nouveau/include/nvif/vmm.h    |  30 +-
 .../drm/nouveau/include/nvkm/core/client.h    |  16 +-
 .../drm/nouveau/include/nvkm/core/device.h    |   6 -
 .../drm/nouveau/include/nvkm/core/driver.h    |   9 +
 .../gpu/drm/nouveau/include/nvkm/core/event.h |  10 +-
 .../gpu/drm/nouveau/include/nvkm/core/ioctl.h |   8 -
 .../drm/nouveau/include/nvkm/core/layout.h    |   1 -
 .../drm/nouveau/include/nvkm/core/object.h    |  43 +-
 .../drm/nouveau/include/nvkm/core/oclass.h    |   2 -
 .../gpu/drm/nouveau/include/nvkm/core/os.h    |  21 +-
 .../gpu/drm/nouveau/include/nvkm/core/pci.h   |   1 -
 .../drm/nouveau/include/nvkm/core/subdev.h    |   2 -
 .../gpu/drm/nouveau/include/nvkm/core/tegra.h |   1 -
 .../drm/nouveau/include/nvkm/engine/disp.h    |   4 +-
 .../gpu/drm/nouveau/include/nvkm/engine/dma.h |   2 -
 .../gpu/drm/nouveau/include/nvkm/engine/pm.h  |  29 -
 .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   3 -
 drivers/gpu/drm/nouveau/nouveau_abi16.c       | 498 ++++++----
 drivers/gpu/drm/nouveau/nouveau_abi16.h       |  11 +-
 drivers/gpu/drm/nouveau/nouveau_backlight.c   |  30 +-
 drivers/gpu/drm/nouveau/nouveau_bios.c        |  22 +-
 drivers/gpu/drm/nouveau/nouveau_bios.h        |   1 +
 drivers/gpu/drm/nouveau/nouveau_bo.c          | 130 +--
 drivers/gpu/drm/nouveau/nouveau_bo0039.c      |   8 +-
 drivers/gpu/drm/nouveau/nouveau_bo5039.c      |  10 +-
 drivers/gpu/drm/nouveau/nouveau_bo74c1.c      |   2 +-
 drivers/gpu/drm/nouveau/nouveau_bo85b5.c      |   2 +-
 drivers/gpu/drm/nouveau/nouveau_bo9039.c      |   4 +-
 drivers/gpu/drm/nouveau/nouveau_bo90b5.c      |   2 +-
 drivers/gpu/drm/nouveau/nouveau_boa0b5.c      |   4 +-
 drivers/gpu/drm/nouveau/nouveau_chan.c        | 353 ++++---
 drivers/gpu/drm/nouveau/nouveau_chan.h        |  31 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c   |  30 +-
 drivers/gpu/drm/nouveau/nouveau_debugfs.c     |  47 +-
 drivers/gpu/drm/nouveau/nouveau_debugfs.h     |   2 +
 drivers/gpu/drm/nouveau/nouveau_display.c     |  50 +-
 drivers/gpu/drm/nouveau/nouveau_dma.c         |  10 +-
 drivers/gpu/drm/nouveau/nouveau_dma.h         |   2 +-
 drivers/gpu/drm/nouveau/nouveau_dmem.c        |  19 +-
 drivers/gpu/drm/nouveau/nouveau_dp.c          |   2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         | 359 +++-----
 drivers/gpu/drm/nouveau/nouveau_drv.h         |  71 +-
 drivers/gpu/drm/nouveau/nouveau_fence.c       |  33 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c         |  34 +-
 drivers/gpu/drm/nouveau/nouveau_hwmon.c       |  46 +-
 drivers/gpu/drm/nouveau/nouveau_led.c         |   6 +-
 drivers/gpu/drm/nouveau/nouveau_mem.c         |  44 +-
 drivers/gpu/drm/nouveau/nouveau_mem.h         |   4 +-
 drivers/gpu/drm/nouveau/nouveau_prime.c       |   2 +-
 drivers/gpu/drm/nouveau/nouveau_sgdma.c       |   4 +-
 drivers/gpu/drm/nouveau/nouveau_svm.c         | 174 ++--
 drivers/gpu/drm/nouveau/nouveau_ttm.c         |  43 +-
 drivers/gpu/drm/nouveau/nouveau_usif.c        | 194 ----
 drivers/gpu/drm/nouveau/nouveau_usif.h        |  10 -
 drivers/gpu/drm/nouveau/nouveau_uvmm.c        |   4 +-
 drivers/gpu/drm/nouveau/nouveau_vga.c         |   8 +-
 drivers/gpu/drm/nouveau/nouveau_vmm.c         |  14 +-
 drivers/gpu/drm/nouveau/nouveau_vmm.h         |   2 +-
 drivers/gpu/drm/nouveau/nv04_fence.c          |   9 +-
 drivers/gpu/drm/nouveau/nv10_fence.c          |   6 +-
 drivers/gpu/drm/nouveau/nv10_fence.h          |   2 +-
 drivers/gpu/drm/nouveau/nv17_fence.c          |  25 +-
 drivers/gpu/drm/nouveau/nv50_fence.c          |  13 +-
 drivers/gpu/drm/nouveau/nv84_fence.c          |  20 +-
 drivers/gpu/drm/nouveau/nvc0_fence.c          |   4 +-
 drivers/gpu/drm/nouveau/nvif/Kbuild           |   3 +
 drivers/gpu/drm/nouveau/nvif/cgrp.c           |  52 ++
 drivers/gpu/drm/nouveau/nvif/chan.c           | 130 +++
 drivers/gpu/drm/nouveau/nvif/client.c         |  54 +-
 drivers/gpu/drm/nouveau/nvif/conn.c           |  53 +-
 drivers/gpu/drm/nouveau/nvif/device.c         |  67 +-
 drivers/gpu/drm/nouveau/nvif/disp.c           | 107 ++-
 drivers/gpu/drm/nouveau/nvif/dispchan.c       | 222 +++++
 drivers/gpu/drm/nouveau/nvif/driver.c         |  40 +-
 drivers/gpu/drm/nouveau/nvif/event.c          |  63 +-
 drivers/gpu/drm/nouveau/nvif/fifo.c           |  66 +-
 drivers/gpu/drm/nouveau/nvif/head.c           |  35 +-
 drivers/gpu/drm/nouveau/nvif/mem.c            | 102 ++-
 drivers/gpu/drm/nouveau/nvif/mmu.c            | 111 +--
 drivers/gpu/drm/nouveau/nvif/object.c         | 290 +-----
 drivers/gpu/drm/nouveau/nvif/outp.c           | 353 ++-----
 drivers/gpu/drm/nouveau/nvif/user.c           |  50 +-
 drivers/gpu/drm/nouveau/nvif/userc361.c       |   8 +-
 drivers/gpu/drm/nouveau/nvif/vmm.c            | 200 +---
 drivers/gpu/drm/nouveau/nvkm/Kbuild           |   1 +
 drivers/gpu/drm/nouveau/nvkm/core/Kbuild      |   2 +-
 drivers/gpu/drm/nouveau/nvkm/core/client.c    | 150 +--
 .../{nouveau_nvif.c => nvkm/core/driver.c}    |  69 +-
 drivers/gpu/drm/nouveau/nvkm/core/engine.c    |  12 -
 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c     | 390 --------
 drivers/gpu/drm/nouveau/nvkm/core/object.c    | 159 +---
 drivers/gpu/drm/nouveau/nvkm/core/oproxy.c    |  76 --
 drivers/gpu/drm/nouveau/nvkm/core/subdev.c    |   8 -
 drivers/gpu/drm/nouveau/nvkm/core/uevent.c    |  88 +-
 drivers/gpu/drm/nouveau/nvkm/device/Kbuild    |   7 +
 .../nouveau/nvkm/{engine => }/device/acpi.c   |   0
 .../nouveau/nvkm/{engine => }/device/acpi.h   |   0
 .../nouveau/nvkm/{engine => }/device/base.c   | 552 +++++------
 drivers/gpu/drm/nouveau/nvkm/device/ctrl.c    | 172 ++++
 drivers/gpu/drm/nouveau/nvkm/device/ctrl.h    |   9 +
 .../nouveau/nvkm/{engine => }/device/pci.c    |   4 +-
 .../nouveau/nvkm/{engine => }/device/priv.h   |   2 -
 .../nouveau/nvkm/{engine => }/device/tegra.c  |   5 +-
 drivers/gpu/drm/nouveau/nvkm/device/user.c    | 434 +++++++++
 drivers/gpu/drm/nouveau/nvkm/device/user.h    |   9 +
 drivers/gpu/drm/nouveau/nvkm/engine/Kbuild    |   2 -
 .../gpu/drm/nouveau/nvkm/engine/device/Kbuild |   7 -
 .../gpu/drm/nouveau/nvkm/engine/device/ctrl.c | 212 -----
 .../gpu/drm/nouveau/nvkm/engine/device/ctrl.h |  13 -
 .../gpu/drm/nouveau/nvkm/engine/device/user.c | 431 ---------
 .../gpu/drm/nouveau/nvkm/engine/disp/Kbuild   |   1 +
 .../gpu/drm/nouveau/nvkm/engine/disp/ad102.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/base.c   |  29 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/chan.c   | 272 +++---
 .../gpu/drm/nouveau/nvkm/engine/disp/chan.h   |  15 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/conn.h   |   2 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/g84.c    |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/g94.c    |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/ga102.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gf119.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gk104.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gk110.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gm107.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gm200.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gp100.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gp102.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gt200.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gt215.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/gv100.c  |  52 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/head.h   |   2 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/mcp77.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/mcp89.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/nv04.c   |   5 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/nv50.c   |  20 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/outp.h   |   3 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/priv.h   |  31 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/r535.c   |  46 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/tu102.c  |  13 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/ucaps.c  |  70 ++
 .../gpu/drm/nouveau/nvkm/engine/disp/ucaps.h  |   9 +
 .../gpu/drm/nouveau/nvkm/engine/disp/uchan.h  |  10 +
 .../gpu/drm/nouveau/nvkm/engine/disp/uconn.c  | 176 ++--
 .../gpu/drm/nouveau/nvkm/engine/disp/uconn.h  |   9 +
 .../gpu/drm/nouveau/nvkm/engine/disp/udisp.c  | 288 ++++--
 .../gpu/drm/nouveau/nvkm/engine/disp/udisp.h  |  17 +
 .../gpu/drm/nouveau/nvkm/engine/disp/uhead.c  | 125 +--
 .../gpu/drm/nouveau/nvkm/engine/disp/uhead.h  |   9 +
 .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c  | 778 ++++++++--------
 .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.h  |   9 +
 .../gpu/drm/nouveau/nvkm/engine/dma/user.c    |  19 -
 .../drm/nouveau/nvkm/engine/dma/usergf100.c   |   5 -
 .../drm/nouveau/nvkm/engine/dma/usergf119.c   |   5 -
 .../drm/nouveau/nvkm/engine/dma/usergv100.c   |   5 -
 .../drm/nouveau/nvkm/engine/dma/usernv50.c    |   6 -
 .../gpu/drm/nouveau/nvkm/engine/fifo/Kbuild   |   1 +
 .../gpu/drm/nouveau/nvkm/engine/fifo/base.c   | 126 ---
 .../gpu/drm/nouveau/nvkm/engine/fifo/chan.c   |   2 -
 .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h   |   5 -
 .../gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.c  | 108 ++-
 .../gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.h  |   9 +
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 388 +++++---
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.h  |  11 +
 .../gpu/drm/nouveau/nvkm/engine/fifo/ufifo.c  | 129 +++
 .../gpu/drm/nouveau/nvkm/engine/fifo/ufifo.h  |   8 +
 .../gpu/drm/nouveau/nvkm/engine/gr/gf100.c    |   1 -
 drivers/gpu/drm/nouveau/nvkm/engine/pm/Kbuild |  11 -
 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c | 867 ------------------
 drivers/gpu/drm/nouveau/nvkm/engine/pm/g84.c  | 165 ----
 .../gpu/drm/nouveau/nvkm/engine/pm/gf100.c    | 243 -----
 .../gpu/drm/nouveau/nvkm/engine/pm/gf100.h    |  20 -
 .../gpu/drm/nouveau/nvkm/engine/pm/gf108.c    |  66 --
 .../gpu/drm/nouveau/nvkm/engine/pm/gf117.c    |  80 --
 .../gpu/drm/nouveau/nvkm/engine/pm/gk104.c    | 184 ----
 .../gpu/drm/nouveau/nvkm/engine/pm/gt200.c    | 157 ----
 .../gpu/drm/nouveau/nvkm/engine/pm/gt215.c    | 138 ---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c | 123 ---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.h |  15 -
 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv50.c | 175 ----
 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 105 ---
 drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c |  14 +-
 .../gpu/drm/nouveau/nvkm/subdev/fault/base.c  |   1 -
 .../gpu/drm/nouveau/nvkm/subdev/fault/priv.h  |   5 -
 .../gpu/drm/nouveau/nvkm/subdev/fault/user.c  |  99 +-
 .../gpu/drm/nouveau/nvkm/subdev/fault/user.h  |   9 +
 .../gpu/drm/nouveau/nvkm/subdev/mmu/base.c    |   1 -
 .../gpu/drm/nouveau/nvkm/subdev/mmu/umem.c    | 125 ++-
 .../gpu/drm/nouveau/nvkm/subdev/mmu/umem.h    |  24 +-
 .../gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c    | 186 ++--
 .../gpu/drm/nouveau/nvkm/subdev/mmu/ummu.h    |  13 +-
 .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    | 357 +++-----
 .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |  12 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |   8 +-
 .../drm/nouveau/nvkm/subdev/mmu/vmmgp100.c    |  68 +-
 .../drm/nouveau/nvkm/subdev/mmu/vmmgp10b.c    |   2 +-
 .../drm/nouveau/nvkm/subdev/mmu/vmmgv100.c    |   2 +-
 .../drm/nouveau/nvkm/subdev/mmu/vmmtu102.c    |   2 +-
 .../gpu/drm/nouveau/nvkm/subdev/vfn/base.c    |   1 -
 .../gpu/drm/nouveau/nvkm/subdev/vfn/priv.h    |   3 -
 .../gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c    |  44 +-
 .../gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.h    |   9 +
 306 files changed, 6653 insertions(+), 10697 deletions(-)
 create mode 100644 drivers/gpu/drm/nouveau/include/nvif/cgrp.h
 create mode 100644 drivers/gpu/drm/nouveau/include/nvif/chan.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/clb069.h
 create mode 100644 drivers/gpu/drm/nouveau/include/nvif/ctxdma.h
 create mode 100644 drivers/gpu/drm/nouveau/include/nvif/dispchan.h
 create mode 100644 drivers/gpu/drm/nouveau/include/nvif/driverif.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0000.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0001.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0002.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0003.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0008.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if000c.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if000e.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0010.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0012.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0013.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0014.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0020.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0021.h
 create mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/driver.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/ioctl.h
 delete mode 100644 drivers/gpu/drm/nouveau/include/nvkm/engine/pm.h
 delete mode 100644 drivers/gpu/drm/nouveau/nouveau_usif.c
 delete mode 100644 drivers/gpu/drm/nouveau/nouveau_usif.h
 create mode 100644 drivers/gpu/drm/nouveau/nvif/cgrp.c
 create mode 100644 drivers/gpu/drm/nouveau/nvif/chan.c
 create mode 100644 drivers/gpu/drm/nouveau/nvif/dispchan.c
 rename drivers/gpu/drm/nouveau/{nouveau_nvif.c => nvkm/core/driver.c} (65%)
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/Kbuild
 rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/acpi.c (100%)
 rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/acpi.h (100%)
 rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/base.c (89%)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/ctrl.c
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/ctrl.h
 rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/pci.c (99%)
 rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/priv.h (95%)
 rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/tegra.c (97%)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/user.c
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/user.h
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/Kbuild
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.h
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/ucaps.c
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/ucaps.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uchan.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/udisp.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uhead.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/ufifo.c
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/ufifo.h
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/Kbuild
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/g84.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.h
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf108.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf117.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gk104.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gt200.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gt215.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.h
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv50.c
 delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/fault/user.h
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.h
Signature · 1 line
2.41.0
author
#160 lore raw
Quoted 3 lines · Danilo Krummrich

Hi Ben,

Welcome back from my side as well!

Hey Danilo,

Thanks!

Quoted 19 lines · Ben Skeggs
Quoted 7 lines

This is a series of cleanups that I intended on doing after posting the initial GSP-RM support several months ago, and have now had the opportunity to work on again.

The main intention here is to replace the ioctl-like interface that sits between NVKM and the nouveau DRM driver with more direct calls, to reduce the call-chain complexity (and overhead).

That sounds like a great and welcome simplification.

Quoted 5 lines

This is achieved by having NVKM return structs of info and function pointers specific to each class, along with an opaque pointer to its private data. These are stored in the NVIF structs and used to call directly into an implementation without handle lookups and multiple layers of indirection.

I just had a very brief look on the rework of the VMM bits to get a rough idea how the new interface looks like.

Quoted 6 lines

I think I will get the full picture, once I can apply all the patches to a tree and don't need to look at the changes scattered throughout patches.

However, I wonder if we need another indirection (such as nvif_vmm_impl) instead of just calling the corresponding functions directly? Or even more crazy, what if we'd try to rip out nvif entirely?

I'm opposed to removing NVIF.  HW has always had a quite strong priv/user separation (it's been designed for usermode submission from the beginning, even before DMA channels were a thing), and many many years ago now I made the decision to split nouveau along those same boundaries.

It also happens to (basically) mirror the interface GSP-RM provides to the kernel driver.  Had I not split nouveau the way I did, and had the code to manage the priv/user parts of the GPU mingled together, adding support for GSP-RM would have been a lot more painful than it was.

Quoted 4 lines

Maybe it would be good to sketch up some example code of how the interface works and include it in the cover letter? This way we could see / discuss whether we can even simplify it more or why it needs the indirections you have chosen.

I tried to make this clear in the cover letter, but this isn't an attempt at designing a new interface.  This is the old one, and works in nearly the same way as it did before, just with a whole bunch of middle layers ripped out.

A patch series I've been pondering writing if/when this one is merged, would be to directly implement GSP-RM on top of the "new" interfaces, so that it doesn't need to awkwardly integrate with NVKM's other abstractions that are only really relevant when running on top of HW directly.

There is (almost) be a 1-1 mapping between NVIF function pointer and RM alloc/control call (this was already the case before this series).  The GSP-supporting code in NVKM could be cleaned up significantly.

Quoted 27 lines
Quoted 27 lines

There's room for further cleanups and API changes from here, but for now most of the API usage is exactly as it was before, as the series has gotten quite large enough already.

The first part of the series starts out by cleaning up some of the interfaces within the DRM driver, and reimplementing the subset of "ioctl" interfaces needed by userspace directly.

A number of unused interfaces/function args are then removed so that they don't need to be ported, and some initial renames/preparations are made to the NVKM's user object implementations so that diffs of the next set of patches are more straightforward to read.

I then go through each class in turn, starting from the root of the object tree (client), and working up from there. The object ctors/ dtors are ported first, followed by sclass/map/etc, followed by the class's methods, and then repeating the process with each of their children.

Objects remain accessible with the "ioctl" interface throughout the changes (until their last use, after which they're removed from the object rb entirely) to allow each change to be done independently.

After all classes have been ported, some final cleanups are made to the DRM driver to complete the series.

Quoted 7 lines
Quoted 1 line

Ben Skeggs (156):

Wow! That's a lot of work - very much appreciated. However, I think it would have been better to share your ideas and / or example code regarding this rework early, such that discussions can happen in advance.

We could have been discussing the (new) interface, get to an agreement and then work through it in several patch series.

I don't disagree that discussion should be had over new interfaces, but as I said above, this series isn't an attempt at that.  It's attempting to remove a whole bunch of cruft that makes it hard to make changes to the APIs, a whole bunch of memcpy(), and hacks around awkward locking problems (like the linked-list of all memory allocations to avoid object tree locking issues).

Thank you,

Ben.

Quoted 556 lines

This has multiple advantages:

1. It makes things much easier to review; bulky patch series, such as this one, are hard to review.
2. It potentially provides different perspectives for improvements ahead of time and potentially saves a lot of your time compared to working through the feedback afterwards.
3. It better involves the community. Wouldn't it be great if someone, due to a previous discussion, voluntarily picked up some of the effort?

Can you please resend patch 25 with a corresponding '--in-reply-to='? Also, as Dave already mentioned, I'd be great if you could provide a branch containing the patches.

- Danilo

Quoted 539 lines

drm/nouveau: add nouveau_drm.device/mmu
drm/nouveau: alias nouveau_drm.client to nouveau_drm.cli drm/nouveau: pass drm to nouveau_mem_new(), instead of cli drm/nouveau: pass drm to nv50_dmac_create(), rather than device+disp drm/nouveau: pass cli to nouveau_channel_new() instead of drm+device drm/nouveau: remove nouveau_chan.device
drm/nouveau: remove chan->drm
drm/nouveau: replace some void casts with chan->cli drm/nouveau: remove nouveau_drm.master
drm/nouveau: always map device
drm/nouveau: add nouveau_cli to nouveau_abi16
drm/nouveau: handle limited nvif in abi16
drm/nouveau: remove abi16->device
drm/nouveau: remove abi16->handles
drm/nouveau: store nvkm_device pointer in nouveau_drm drm/nouveau: create pci device once
drm/nouveau: remove push pointer from nouveau_channel drm/nouveau/kms: remove a few unused struct members and fn decls drm/nouveau/kms: remove push pointer from nv50_dmac drm/nouveau/kms: move hw ring tracking vars into nvif_push drm/nouveau/kms: move dmac sync/vram ctxdmas to core+wndws drm/nouveau/nvkm: remove detect/mmio/subdev_mask from device args drm/nouveau/nvkm: move nouveau_nvif.c to nvkm/core/driver.c drm/nouveau/nvkm: move nvkm/engine/device/ to nvkm/device/ drm/nouveau/nvkm: remove perfmon
drm/nouveau/nvkm: remove nvkm_client_search() drm/nouveau/nvif: remove support for userspace backends drm/nouveau/nvif: remove route/token
drm/nouveau/nvif: remove nvxx_object()
drm/nouveau/nvif: remove nvxx_client()
drm/nouveau/nvif: remove driver keep/fini drm/nouveau/nvif: remove client version
drm/nouveau/nvif: remove client devlist
drm/nouveau/nvif: remove client fini
drm/nouveau/nvif: remove device args
drm/nouveau/nvif: remove device rd/wr
drm/nouveau/nvif: remove disp chan rd/wr
drm/nouveau/nvkm: rename struct nvkm_uevent drm/nouveau/nvkm: remove nvkm_client()
drm/nouveau/nvkm: rename struct nvkm_udevice drm/nouveau/nvkm: rename struct nvkm_control drm/nouveau/nvkm: rename struct nvkm_uvfn drm/nouveau/nvkm: rename struct nvkm_ummu drm/nouveau/nvkm: rename struct nvkm_umem drm/nouveau/nvkm: rename struct nvkm_uvmm drm/nouveau/nvkm: detach user handling from nvkm_fault_buffer drm/nouveau/nvkm: detach user handling from nvkm_disp drm/nouveau/nvkm: detach user handling from nvkm_conn drm/nouveau/nvkm: detach user handling from nvkm_outp drm/nouveau/nvkm: detach user handling from nvkm_uhead drm/nouveau/nvkm: detach user handling from nvkm_disp_chan drm/nouveau/nvkm: rename struct nvkm_ucgrp drm/nouveau/nvkm: rename struct nvkm_uchan drm/nouveau/nvkm: move umem list to mmu
drm/nouveau/disp: simplify hw user definition drm/nouveau/nvif: output oclass id in object dbg messages drm/nouveau/nvif: add alternate version of nvif_object_ctor() drm/nouveau/nvif: add alternate version of nvif_event_ctor() drm/nouveau/nvif: move nvif<->nvkm interface definitions to driverif.h drm/nouveau/nvif: rework "new driver" api drm/nouveau/nvkm: remove device list
drm/nouveau/nvif: rework driver "new client" api drm/nouveau/nvif: rework client "new device" api drm/nouveau/nvif: remove client from object rb drm/nouveau/nvif: rework device "sclass" api drm/nouveau/nvif: rework device "map" api drm/nouveau/nvif: rework device "info v0" api drm/nouveau/nvif: rework device "info v1" api drm/nouveau/nvif: rework device "time" api drm/nouveau/nvif: rework device "new ctrl" api drm/nouveau/nvif: rework ctrl "pstate info" api drm/nouveau/nvif: rework ctrl "pstate attr" api drm/nouveau/nvif: rework ctrl "pstate user" api drm/nouveau/nvif: remove ctrl from object rb drm/nouveau/nvif: rework device "new usermode" api drm/nouveau/nvif: rework usermode "map" api drm/nouveau/nvif: remove usermode from object rb drm/nouveau/nvif: rework device "new mmu" api drm/nouveau/nvif: rework mmu "sclass" api drm/nouveau/nvif: rework mmu "heap" api
drm/nouveau/nvif: rework mmu "type" api
drm/nouveau/nvif: rework mmu "kind" api
drm/nouveau/nvif: rework mmu "new mem" api drm/nouveau/nvif: rework mem "map"/"unmap" apis drm/nouveau/nvif: rework mmu "new vmm" api drm/nouveau/nvif: remove mmu from object rb drm/nouveau/nvif: rework vmm "page" api
drm/nouveau/nvif: rework vmm "get"/"put" apis drm/nouveau/nvif: rework vmm "map"/"unmap" apis drm/nouveau/nvif: rework vmm "pfnmap"/"pfnclr" apis drm/nouveau/nvif: rework vmm "raw get"/"raw put" apis drm/nouveau/nvif: rework vmm "raw map"/"raw unmap" apis drm/nouveau/nvif: rework vmm "raw sparse" api drm/nouveau/nvif: rework vmm "fault replay"/"fault cancel" apis drm/nouveau/nvif: rework device "new fault buffer" api drm/nouveau/nvif: rework fault buffer "map" api drm/nouveau/nvif: rework fault buffer "new event" api drm/nouveau/nvif: remove fault buffer from object rb drm/nouveau/nvif: rework device "new disp" api drm/nouveau/nvif: rework disp "sclass" api drm/nouveau/nvif: rework disp "new caps" api drm/nouveau/nvif: rework disp "new conn" api drm/nouveau/nvif: rework conn "new event" api drm/nouveau/nvif: remove conn from object rb drm/nouveau/nvif: rework disp "new outp" api drm/nouveau/nvif: rework outp "detect" api drm/nouveau/nvif: rework outp "edid get" api drm/nouveau/nvif: rework outp "load detect" api drm/nouveau/nvif: rework outp "inherit" apis drm/nouveau/nvif: rework outp "acquire" api drm/nouveau/nvif: rework outp "release" api drm/nouveau/nvif: rework outp "bl get"/"bl set" apis drm/nouveau/nvif: rework outp "lvds config" api drm/nouveau/nvif: rework outp "hdmi config" api drm/nouveau/nvif: rework outp "infoframe" api drm/nouveau/nvif: rework outp "hda eld" api drm/nouveau/nvif: rework outp "dp aux pwr" api drm/nouveau/nvif: rework outp "dp aux xfer" api drm/nouveau/nvif: rework outp "dp rates" api drm/nouveau/nvif: rework outp "dp train" api drm/nouveau/nvif: rework outp "dp drive" api drm/nouveau/nvif: rework outp "dp sst" api drm/nouveau/nvif: rework outp "dp mst id get"/"dp mst id put" apis drm/nouveau/nvif: rework outp "dp mst vcpi" api drm/nouveau/nvif: remove outp from object rb drm/nouveau/nvif: rework disp "new head" api drm/nouveau/nvif: rework head "scanoutpos" api drm/nouveau/nvif: rework head "new event" api drm/nouveau/nvif: remove head from object rb drm/nouveau/nvif: rework disp "new chan" apis drm/nouveau/nvif: remove disp from object rb drm/nouveau/nvif: rework disp chan "new ctxdma" api drm/nouveau/nvif: remove disp chans from object rb drm/nouveau/nvif: rework device "new cgrp" api drm/nouveau/nvif: rework device "new ctxdma" api drm/nouveau/nvif: rework device/cgrp "new chan" apis drm/nouveau/nvif: remove mem from object rb drm/nouveau/nvif: remove vmm from object rb drm/nouveau/nvif: remove ctxdma from object rb drm/nouveau/nvif: remove device from object rb drm/nouveau/nvif: rework chan "map" api
drm/nouveau/nvif: rework chan "sclass" api drm/nouveau/nvif: rework chan "new event" apis drm/nouveau/nvif: rework chan "new ctxdma" api drm/nouveau/nvif: rework chan "new engobj" apis drm/nouveau/nvif: remove chan from object rb drm/nouveau/nvif: rework engobj "mthd" api drm/nouveau/nvif: rework engobj "new event" api drm/nouveau/nvif: remove engobj from object rb drm/nouveau/nvkm: switch nvkm_object to non-irqsafe spinlock drm/nouveau: remove client_mutex
drm/nouveau: move nvxx_* definitions to nouveau_drv.h drm/nouveau: pass nouveau_drm to nvxx_*
drm/nouveau: remove remaining usage of nvif_device.info drm/nouveau: remove remaining usage of nvif_device.object.map drm/nouveau: remove remaining usage of nouveau_drm.client

  drivers/gpu/drm/nouveau/Kbuild                |   2 -
  drivers/gpu/drm/nouveau/dispnv04/arb.c        |   7 +-
  drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  50 +-
  drivers/gpu/drm/nouveau/dispnv04/cursor.c     |   2 +-
  drivers/gpu/drm/nouveau/dispnv04/dac.c        |  18 +-
  drivers/gpu/drm/nouveau/dispnv04/dfp.c        |  12 +-
  drivers/gpu/drm/nouveau/dispnv04/disp.c       |  15 +-
  drivers/gpu/drm/nouveau/dispnv04/disp.h       |   6 +-
  drivers/gpu/drm/nouveau/dispnv04/hw.c         |  83 +-
  drivers/gpu/drm/nouveau/dispnv04/hw.h         |  45 +-
  drivers/gpu/drm/nouveau/dispnv04/overlay.c    |  21 +-
  drivers/gpu/drm/nouveau/dispnv04/tvnv04.c     |   4 +-
  drivers/gpu/drm/nouveau/dispnv04/tvnv17.c     |  16 +-
  drivers/gpu/drm/nouveau/dispnv04/tvnv17.h     |  10 +-
  drivers/gpu/drm/nouveau/dispnv50/base.c       |  33 +-
  drivers/gpu/drm/nouveau/dispnv50/base507c.c   |  43 +-
  drivers/gpu/drm/nouveau/dispnv50/base827c.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/base907c.c   |  10 +-
  drivers/gpu/drm/nouveau/dispnv50/core.c       |  84 +-
  drivers/gpu/drm/nouveau/dispnv50/core.h       |   9 +-
  drivers/gpu/drm/nouveau/dispnv50/core507d.c   |  34 +-
  drivers/gpu/drm/nouveau/dispnv50/core907d.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/corec37d.c   |  19 +-
  drivers/gpu/drm/nouveau/dispnv50/corec57d.c   |   4 +-
  drivers/gpu/drm/nouveau/dispnv50/crc.c        |  34 +-
  drivers/gpu/drm/nouveau/dispnv50/crc.h        |   4 +-
  drivers/gpu/drm/nouveau/dispnv50/crc907d.c    |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/crcc37d.c    |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/crcc57d.c    |   4 +-
  drivers/gpu/drm/nouveau/dispnv50/curs.c       |  35 +-
  drivers/gpu/drm/nouveau/dispnv50/curs507a.c   |  41 +-
  drivers/gpu/drm/nouveau/dispnv50/cursc37a.c   |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/dac507d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/dac907d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/disp.c       | 313 +------
  drivers/gpu/drm/nouveau/dispnv50/disp.h       |  37 +-
  drivers/gpu/drm/nouveau/dispnv50/head.c       |   4 +-
  drivers/gpu/drm/nouveau/dispnv50/head507d.c   |  26 +-
  drivers/gpu/drm/nouveau/dispnv50/head827d.c   |  10 +-
  drivers/gpu/drm/nouveau/dispnv50/head907d.c   |  26 +-
  drivers/gpu/drm/nouveau/dispnv50/head917d.c   |   6 +-
  drivers/gpu/drm/nouveau/dispnv50/headc37d.c   |  18 +-
  drivers/gpu/drm/nouveau/dispnv50/headc57d.c   |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/lut.c        |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/lut.h        |   5 +-
  drivers/gpu/drm/nouveau/dispnv50/oimm.c       |  29 +-
  drivers/gpu/drm/nouveau/dispnv50/oimm507b.c   |  20 +-
  drivers/gpu/drm/nouveau/dispnv50/ovly.c       |  32 +-
  drivers/gpu/drm/nouveau/dispnv50/ovly507e.c   |  28 +-
  drivers/gpu/drm/nouveau/dispnv50/ovly827e.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/ovly907e.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/pior507d.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/sor507d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/sor907d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/sorc37d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/wimm.c       |  25 +-
  drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c   |  24 +-
  drivers/gpu/drm/nouveau/dispnv50/wndw.c       | 101 +-
  drivers/gpu/drm/nouveau/dispnv50/wndw.h       |  20 +-
  drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c   |  46 +-
  drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c   |  10 +-
  drivers/gpu/drm/nouveau/dispnv50/wndwc67e.c   |   2 +-
  drivers/gpu/drm/nouveau/include/nvif/cgrp.h   |  17 +
  drivers/gpu/drm/nouveau/include/nvif/chan.h   |  45 +
  drivers/gpu/drm/nouveau/include/nvif/cl0080.h |  60 --
  drivers/gpu/drm/nouveau/include/nvif/class.h  |   8 -
  drivers/gpu/drm/nouveau/include/nvif/clb069.h |  15 -
  drivers/gpu/drm/nouveau/include/nvif/client.h |  14 +-
  drivers/gpu/drm/nouveau/include/nvif/conn.h   |  24 +-
  drivers/gpu/drm/nouveau/include/nvif/ctxdma.h |  29 +
  drivers/gpu/drm/nouveau/include/nvif/device.h |  51 +-
  drivers/gpu/drm/nouveau/include/nvif/disp.h   |  19 +-
  .../gpu/drm/nouveau/include/nvif/dispchan.h   |  25 +
  drivers/gpu/drm/nouveau/include/nvif/driver.h |  27 +-
  .../gpu/drm/nouveau/include/nvif/driverif.h   | 643 +++++++++++++
  drivers/gpu/drm/nouveau/include/nvif/event.h  |  16 +-
  drivers/gpu/drm/nouveau/include/nvif/fifo.h   |  11 +-
  drivers/gpu/drm/nouveau/include/nvif/head.h   |   2 +
  drivers/gpu/drm/nouveau/include/nvif/if0000.h |  20 -
  drivers/gpu/drm/nouveau/include/nvif/if0001.h |  47 -
  drivers/gpu/drm/nouveau/include/nvif/if0002.h |  39 -
  drivers/gpu/drm/nouveau/include/nvif/if0003.h |  34 -
  drivers/gpu/drm/nouveau/include/nvif/if0008.h |  42 -
  drivers/gpu/drm/nouveau/include/nvif/if000c.h | 117 ---
  drivers/gpu/drm/nouveau/include/nvif/if000d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/if000e.h |  26 -
  drivers/gpu/drm/nouveau/include/nvif/if0010.h |  14 -
  drivers/gpu/drm/nouveau/include/nvif/if0011.h |  18 -
  drivers/gpu/drm/nouveau/include/nvif/if0012.h | 294 ------
  drivers/gpu/drm/nouveau/include/nvif/if0013.h |  35 -
  drivers/gpu/drm/nouveau/include/nvif/if0014.h |  13 -
  drivers/gpu/drm/nouveau/include/nvif/if0020.h |  45 -
  drivers/gpu/drm/nouveau/include/nvif/if0021.h |  16 -
  drivers/gpu/drm/nouveau/include/nvif/if500d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/if900d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/ifb00d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/ifc00d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/ioctl.h  |  44 -
  drivers/gpu/drm/nouveau/include/nvif/mem.h    |  18 +-
  drivers/gpu/drm/nouveau/include/nvif/mmu.h    |  38 +-
  drivers/gpu/drm/nouveau/include/nvif/object.h | 105 +--
  drivers/gpu/drm/nouveau/include/nvif/os.h     |  19 +
  drivers/gpu/drm/nouveau/include/nvif/outp.h   |  58 +-
  drivers/gpu/drm/nouveau/include/nvif/printf.h |   9 +-
  drivers/gpu/drm/nouveau/include/nvif/push.h   |  18 +-
  drivers/gpu/drm/nouveau/include/nvif/user.h   |   6 +-
  drivers/gpu/drm/nouveau/include/nvif/vmm.h    |  30 +-
  .../drm/nouveau/include/nvkm/core/client.h    |  16 +-
  .../drm/nouveau/include/nvkm/core/device.h    |   6 -
  .../drm/nouveau/include/nvkm/core/driver.h    |   9 +
  .../gpu/drm/nouveau/include/nvkm/core/event.h |  10 +-
  .../gpu/drm/nouveau/include/nvkm/core/ioctl.h |   8 -
  .../drm/nouveau/include/nvkm/core/layout.h    |   1 -
  .../drm/nouveau/include/nvkm/core/object.h    |  43 +-
  .../drm/nouveau/include/nvkm/core/oclass.h    |   2 -
  .../gpu/drm/nouveau/include/nvkm/core/os.h    |  21 +-
  .../gpu/drm/nouveau/include/nvkm/core/pci.h   |   1 -
  .../drm/nouveau/include/nvkm/core/subdev.h    |   2 -
  .../gpu/drm/nouveau/include/nvkm/core/tegra.h |   1 -
  .../drm/nouveau/include/nvkm/engine/disp.h    |   4 +-
  .../gpu/drm/nouveau/include/nvkm/engine/dma.h |   2 -
  .../gpu/drm/nouveau/include/nvkm/engine/pm.h  |  29 -
  .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   3 -
  drivers/gpu/drm/nouveau/nouveau_abi16.c       | 498 ++++++----
  drivers/gpu/drm/nouveau/nouveau_abi16.h       |  11 +-
  drivers/gpu/drm/nouveau/nouveau_backlight.c   |  30 +-
  drivers/gpu/drm/nouveau/nouveau_bios.c        |  22 +-
  drivers/gpu/drm/nouveau/nouveau_bios.h        |   1 +
  drivers/gpu/drm/nouveau/nouveau_bo.c          | 130 +--
  drivers/gpu/drm/nouveau/nouveau_bo0039.c      |   8 +-
  drivers/gpu/drm/nouveau/nouveau_bo5039.c      |  10 +-
  drivers/gpu/drm/nouveau/nouveau_bo74c1.c      |   2 +-
  drivers/gpu/drm/nouveau/nouveau_bo85b5.c      |   2 +-
  drivers/gpu/drm/nouveau/nouveau_bo9039.c      |   4 +-
  drivers/gpu/drm/nouveau/nouveau_bo90b5.c      |   2 +-
  drivers/gpu/drm/nouveau/nouveau_boa0b5.c      |   4 +-
  drivers/gpu/drm/nouveau/nouveau_chan.c        | 353 ++++---
  drivers/gpu/drm/nouveau/nouveau_chan.h        |  31 +-
  drivers/gpu/drm/nouveau/nouveau_connector.c   |  30 +-
  drivers/gpu/drm/nouveau/nouveau_debugfs.c     |  47 +-
  drivers/gpu/drm/nouveau/nouveau_debugfs.h     |   2 +
  drivers/gpu/drm/nouveau/nouveau_display.c     |  50 +-
  drivers/gpu/drm/nouveau/nouveau_dma.c         |  10 +-
  drivers/gpu/drm/nouveau/nouveau_dma.h         |   2 +-
  drivers/gpu/drm/nouveau/nouveau_dmem.c        |  19 +-
  drivers/gpu/drm/nouveau/nouveau_dp.c          |   2 +-
  drivers/gpu/drm/nouveau/nouveau_drm.c         | 359 +++-----
  drivers/gpu/drm/nouveau/nouveau_drv.h         |  71 +-
  drivers/gpu/drm/nouveau/nouveau_fence.c       |  33 +-
  drivers/gpu/drm/nouveau/nouveau_gem.c         |  34 +-
  drivers/gpu/drm/nouveau/nouveau_hwmon.c       |  46 +-
  drivers/gpu/drm/nouveau/nouveau_led.c         |   6 +-
  drivers/gpu/drm/nouveau/nouveau_mem.c         |  44 +-
  drivers/gpu/drm/nouveau/nouveau_mem.h         |   4 +-
  drivers/gpu/drm/nouveau/nouveau_prime.c       |   2 +-
  drivers/gpu/drm/nouveau/nouveau_sgdma.c       |   4 +-
  drivers/gpu/drm/nouveau/nouveau_svm.c         | 174 ++--
  drivers/gpu/drm/nouveau/nouveau_ttm.c         |  43 +-
  drivers/gpu/drm/nouveau/nouveau_usif.c        | 194 ----
  drivers/gpu/drm/nouveau/nouveau_usif.h        |  10 -
  drivers/gpu/drm/nouveau/nouveau_uvmm.c        |   4 +-
  drivers/gpu/drm/nouveau/nouveau_vga.c         |   8 +-
  drivers/gpu/drm/nouveau/nouveau_vmm.c         |  14 +-
  drivers/gpu/drm/nouveau/nouveau_vmm.h         |   2 +-
  drivers/gpu/drm/nouveau/nv04_fence.c          |   9 +-
  drivers/gpu/drm/nouveau/nv10_fence.c          |   6 +-
  drivers/gpu/drm/nouveau/nv10_fence.h          |   2 +-
  drivers/gpu/drm/nouveau/nv17_fence.c          |  25 +-
  drivers/gpu/drm/nouveau/nv50_fence.c          |  13 +-
  drivers/gpu/drm/nouveau/nv84_fence.c          |  20 +-
  drivers/gpu/drm/nouveau/nvc0_fence.c          |   4 +-
  drivers/gpu/drm/nouveau/nvif/Kbuild           |   3 +
  drivers/gpu/drm/nouveau/nvif/cgrp.c           |  52 ++
  drivers/gpu/drm/nouveau/nvif/chan.c           | 130 +++
  drivers/gpu/drm/nouveau/nvif/client.c         |  54 +-
  drivers/gpu/drm/nouveau/nvif/conn.c           |  53 +-
  drivers/gpu/drm/nouveau/nvif/device.c         |  67 +-
  drivers/gpu/drm/nouveau/nvif/disp.c           | 107 ++-
  drivers/gpu/drm/nouveau/nvif/dispchan.c       | 222 +++++
  drivers/gpu/drm/nouveau/nvif/driver.c         |  40 +-
  drivers/gpu/drm/nouveau/nvif/event.c          |  63 +-
  drivers/gpu/drm/nouveau/nvif/fifo.c           |  66 +-
  drivers/gpu/drm/nouveau/nvif/head.c           |  35 +-
  drivers/gpu/drm/nouveau/nvif/mem.c            | 102 ++-
  drivers/gpu/drm/nouveau/nvif/mmu.c            | 111 +--
  drivers/gpu/drm/nouveau/nvif/object.c         | 290 +-----
  drivers/gpu/drm/nouveau/nvif/outp.c           | 353 ++-----
  drivers/gpu/drm/nouveau/nvif/user.c           |  50 +-
  drivers/gpu/drm/nouveau/nvif/userc361.c       |   8 +-
  drivers/gpu/drm/nouveau/nvif/vmm.c            | 200 +---
  drivers/gpu/drm/nouveau/nvkm/Kbuild           |   1 +
  drivers/gpu/drm/nouveau/nvkm/core/Kbuild      |   2 +-
  drivers/gpu/drm/nouveau/nvkm/core/client.c    | 150 +--
  .../{nouveau_nvif.c => nvkm/core/driver.c}    |  69 +-
  drivers/gpu/drm/nouveau/nvkm/core/engine.c    |  12 -
  drivers/gpu/drm/nouveau/nvkm/core/ioctl.c     | 390 --------
  drivers/gpu/drm/nouveau/nvkm/core/object.c    | 159 +---
  drivers/gpu/drm/nouveau/nvkm/core/oproxy.c    |  76 --
  drivers/gpu/drm/nouveau/nvkm/core/subdev.c    |   8 -
  drivers/gpu/drm/nouveau/nvkm/core/uevent.c    |  88 +-
  drivers/gpu/drm/nouveau/nvkm/device/Kbuild    |   7 +
  .../nouveau/nvkm/{engine => }/device/acpi.c   |   0
  .../nouveau/nvkm/{engine => }/device/acpi.h   |   0
  .../nouveau/nvkm/{engine => }/device/base.c   | 552 +++++------
  drivers/gpu/drm/nouveau/nvkm/device/ctrl.c    | 172 ++++
  drivers/gpu/drm/nouveau/nvkm/device/ctrl.h    |   9 +
  .../nouveau/nvkm/{engine => }/device/pci.c    |   4 +-
  .../nouveau/nvkm/{engine => }/device/priv.h   |   2 -
  .../nouveau/nvkm/{engine => }/device/tegra.c  |   5 +-
  drivers/gpu/drm/nouveau/nvkm/device/user.c    | 434 +++++++++
  drivers/gpu/drm/nouveau/nvkm/device/user.h    |   9 +
  drivers/gpu/drm/nouveau/nvkm/engine/Kbuild    |   2 -
  .../gpu/drm/nouveau/nvkm/engine/device/Kbuild |   7 -
  .../gpu/drm/nouveau/nvkm/engine/device/ctrl.c | 212 -----
  .../gpu/drm/nouveau/nvkm/engine/device/ctrl.h |  13 -
  .../gpu/drm/nouveau/nvkm/engine/device/user.c | 431 ---------
  .../gpu/drm/nouveau/nvkm/engine/disp/Kbuild   |   1 +
  .../gpu/drm/nouveau/nvkm/engine/disp/ad102.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/base.c   |  29 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/chan.c   | 272 +++---
  .../gpu/drm/nouveau/nvkm/engine/disp/chan.h   |  15 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/conn.h   |   2 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/g84.c    |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/g94.c    |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/ga102.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gf119.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gk104.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gk110.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gm107.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gm200.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gp100.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gp102.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gt200.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gt215.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gv100.c  |  52 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/head.h   |   2 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/mcp77.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/mcp89.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/nv04.c   |   5 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/nv50.c   |  20 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/outp.h   |   3 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/priv.h   |  31 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/r535.c   |  46 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/tu102.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/ucaps.c  |  70 ++
  .../gpu/drm/nouveau/nvkm/engine/disp/ucaps.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/disp/uchan.h  |  10 +
  .../gpu/drm/nouveau/nvkm/engine/disp/uconn.c  | 176 ++--
  .../gpu/drm/nouveau/nvkm/engine/disp/uconn.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/disp/udisp.c  | 288 ++++--
  .../gpu/drm/nouveau/nvkm/engine/disp/udisp.h  |  17 +
  .../gpu/drm/nouveau/nvkm/engine/disp/uhead.c  | 125 +--
  .../gpu/drm/nouveau/nvkm/engine/disp/uhead.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c  | 778 ++++++++--------
  .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/dma/user.c    |  19 -
  .../drm/nouveau/nvkm/engine/dma/usergf100.c   |   5 -
  .../drm/nouveau/nvkm/engine/dma/usergf119.c   |   5 -
  .../drm/nouveau/nvkm/engine/dma/usergv100.c   |   5 -
  .../drm/nouveau/nvkm/engine/dma/usernv50.c    |   6 -
  .../gpu/drm/nouveau/nvkm/engine/fifo/Kbuild   |   1 +
  .../gpu/drm/nouveau/nvkm/engine/fifo/base.c   | 126 ---
  .../gpu/drm/nouveau/nvkm/engine/fifo/chan.c   |   2 -
  .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h   |   5 -
  .../gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.c  | 108 ++-
  .../gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 388 +++++---
  .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.h  |  11 +
  .../gpu/drm/nouveau/nvkm/engine/fifo/ufifo.c  | 129 +++
  .../gpu/drm/nouveau/nvkm/engine/fifo/ufifo.h  |   8 +
  .../gpu/drm/nouveau/nvkm/engine/gr/gf100.c    |   1 -
  drivers/gpu/drm/nouveau/nvkm/engine/pm/Kbuild |  11 -
  drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c | 867 ------------------
  drivers/gpu/drm/nouveau/nvkm/engine/pm/g84.c  | 165 ----
  .../gpu/drm/nouveau/nvkm/engine/pm/gf100.c    | 243 -----
  .../gpu/drm/nouveau/nvkm/engine/pm/gf100.h    |  20 -
  .../gpu/drm/nouveau/nvkm/engine/pm/gf108.c    |  66 --
  .../gpu/drm/nouveau/nvkm/engine/pm/gf117.c    |  80 --
  .../gpu/drm/nouveau/nvkm/engine/pm/gk104.c    | 184 ----
  .../gpu/drm/nouveau/nvkm/engine/pm/gt200.c    | 157 ----
  .../gpu/drm/nouveau/nvkm/engine/pm/gt215.c    | 138 ---
  drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c | 123 ---
  drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.h |  15 -
  drivers/gpu/drm/nouveau/nvkm/engine/pm/nv50.c | 175 ----
  drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 105 ---
  drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c |  14 +-
  .../gpu/drm/nouveau/nvkm/subdev/fault/base.c  |   1 -
  .../gpu/drm/nouveau/nvkm/subdev/fault/priv.h  |   5 -
  .../gpu/drm/nouveau/nvkm/subdev/fault/user.c  |  99 +-
  .../gpu/drm/nouveau/nvkm/subdev/fault/user.h  |   9 +
  .../gpu/drm/nouveau/nvkm/subdev/mmu/base.c    |   1 -
  .../gpu/drm/nouveau/nvkm/subdev/mmu/umem.c    | 125 ++-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/umem.h    |  24 +-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c    | 186 ++--
  .../gpu/drm/nouveau/nvkm/subdev/mmu/ummu.h    |  13 +-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    | 357 +++-----
  .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |  12 +-
  drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |   8 +-
  .../drm/nouveau/nvkm/subdev/mmu/vmmgp100.c    |  68 +-
  .../drm/nouveau/nvkm/subdev/mmu/vmmgp10b.c    |   2 +-
  .../drm/nouveau/nvkm/subdev/mmu/vmmgv100.c    |   2 +-
  .../drm/nouveau/nvkm/subdev/mmu/vmmtu102.c    |   2 +-
  .../gpu/drm/nouveau/nvkm/subdev/vfn/base.c    |   1 -
  .../gpu/drm/nouveau/nvkm/subdev/vfn/priv.h    |   3 -
  .../gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c    |  44 +-
  .../gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.h    |   9 +
  306 files changed, 6653 insertions(+), 10697 deletions(-)

create mode 100644 drivers/gpu/drm/nouveau/include/nvif/cgrp.h create mode 100644 drivers/gpu/drm/nouveau/include/nvif/chan.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/clb069.h create mode 100644 drivers/gpu/drm/nouveau/include/nvif/ctxdma.h create mode 100644 drivers/gpu/drm/nouveau/include/nvif/dispchan.h create mode 100644 drivers/gpu/drm/nouveau/include/nvif/driverif.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0000.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0001.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0002.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0003.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0008.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if000c.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if000e.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0010.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0012.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0013.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0014.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0020.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0021.h create mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/driver.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/ioctl.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvkm/engine/pm.h delete mode 100644 drivers/gpu/drm/nouveau/nouveau_usif.c delete mode 100644 drivers/gpu/drm/nouveau/nouveau_usif.h create mode 100644 drivers/gpu/drm/nouveau/nvif/cgrp.c
create mode 100644 drivers/gpu/drm/nouveau/nvif/chan.c
create mode 100644 drivers/gpu/drm/nouveau/nvif/dispchan.c rename drivers/gpu/drm/nouveau/{nouveau_nvif.c => nvkm/core/driver.c} (65%) delete mode 100644 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/Kbuild rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/acpi.c (100%) rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/acpi.h (100%) rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/base.c (89%) create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/ctrl.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/ctrl.h rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/pci.c (99%) rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/priv.h (95%) rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/tegra.c (97%) create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/user.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/user.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/Kbuild delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/user.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/ucaps.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/ucaps.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uchan.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/udisp.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uhead.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/ufifo.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/ufifo.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/Kbuild delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/g84.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf108.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf117.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gk104.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gt200.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gt215.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv50.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/fault/user.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.h

--
2.41.0

#161 lore raw
Quoted 32 lines · Ben Skeggs
Quoted 3 lines · Danilo Krummrich

Hi Ben,

Welcome back from my side as well!

Hey Danilo,

Thanks!

Quoted 22 lines · Ben Skeggs
Quoted 7 lines

This is a series of cleanups that I intended on doing after posting the initial GSP-RM support several months ago, and have now had the opportunity to work on again.

The main intention here is to replace the ioctl-like interface that sits between NVKM and the nouveau DRM driver with more direct calls, to reduce the call-chain complexity (and overhead).

That sounds like a great and welcome simplification.

Quoted 5 lines

This is achieved by having NVKM return structs of info and function pointers specific to each class, along with an opaque pointer to its private data. These are stored in the NVIF structs and used to call directly into an implementation without handle lookups and multiple layers of indirection.

I just had a very brief look on the rework of the VMM bits to get a rough idea how the new interface looks like.

I think I will get the full picture, once I can apply all the patches to a tree and don't need to look at the changes scattered throughout patches.

Quoted 8 lines
Quoted 3 lines

However, I wonder if we need another indirection (such as nvif_vmm_impl) instead of just calling the corresponding functions directly? Or even more crazy, what if we'd try to rip out nvif entirely?

I'm opposed to removing NVIF.  HW has always had a quite strong priv/user separation (it's been designed for usermode submission from the beginning, even before DMA channels were a thing), and many many years ago now I made the decision to split nouveau along those same boundaries.

I don't see why we'd need NVIF to keep this separation. I'm also not saying we have to get rid of it either though. But I think we should simplify this as much as possible.

Quoted 5 lines

It also happens to (basically) mirror the interface GSP-RM provides to the kernel driver.  Had I not split nouveau the way I did, and had the code to manage the priv/user parts of the GPU mingled together, adding support for GSP-RM would have been a lot more painful than it was.

This wouldn't really change by ripping out NVIF and just directly call nvkm_* functions, right?

It would give us a bit more flexibility though, especially in terms of locking architecture, which, with asynchronous VM_BIND, needs to be aligned closely between layers to not break dma_fence rules.

In IRC you already mentioned you'd like to rip out the VMM parts and move them to the "DRM side" of the driver. That'd already be a huge step into this direction I think.

However, Dave and me had a brief look at how to do that as well, and it seemed quite difficult in terms of where to "draw the line". We need to avoid that the# ripped out VMM code still depends on NVKM layers that have their own (isolated) locking architecture. Having a more flexible interface, that does not hide data structures, might help.

Quoted 12 lines
Quoted 6 lines

Maybe it would be good to sketch up some example code of how the interface works and include it in the cover letter? This way we could see / discuss whether we can even simplify it more or why it needs the indirections you have chosen.

I tried to make this clear in the cover letter, but this isn't an attempt at designing a new interface.  This is the old one, and works in nearly the same way as it did before, just with a whole bunch of middle layers ripped out.

Quoted 8 lines

A patch series I've been pondering writing if/when this one is merged, would be to directly implement GSP-RM on top of the "new" interfaces, so that it doesn't need to awkwardly integrate with NVKM's other abstractions that are only really relevant when running on top of HW directly.

There is (almost) be a 1-1 mapping between NVIF function pointer and RM alloc/control call (this was already the case before this series).  The GSP-supporting code in NVKM could be cleaned up significantly.

Can you put some examples please? Afaics, most of the GSP code is called from device probe / init, isn't it?

Quoted 34 lines
Quoted 34 lines
Quoted 22 lines

There's room for further cleanups and API changes from here, but for now most of the API usage is exactly as it was before, as the series has gotten quite large enough already.

The first part of the series starts out by cleaning up some of the interfaces within the DRM driver, and reimplementing the subset of "ioctl" interfaces needed by userspace directly.

A number of unused interfaces/function args are then removed so that they don't need to be ported, and some initial renames/preparations are made to the NVKM's user object implementations so that diffs of the next set of patches are more straightforward to read.

I then go through each class in turn, starting from the root of the object tree (client), and working up from there. The object ctors/ dtors are ported first, followed by sclass/map/etc, followed by the class's methods, and then repeating the process with each of their children.

Quoted 8 lines

Objects remain accessible with the "ioctl" interface throughout the changes (until their last use, after which they're removed from the object rb entirely) to allow each change to be done independently.

After all classes have been ported, some final cleanups are made to the DRM driver to complete the series.

Ben Skeggs (156):

Wow! That's a lot of work - very much appreciated. However, I think it would have been better to share your ideas and / or example code regarding this rework early, such that discussions can happen in advance.

Quoted 8 lines
Quoted 2 lines

We could have been discussing the (new) interface, get to an agreement and then work through it in several patch series.

I don't disagree that discussion should be had over new interfaces, but as I said above, this series isn't an attempt at that.  It's attempting to remove a whole bunch of cruft that makes it hard to make changes to the APIs, a whole bunch of memcpy(), and hacks around awkward locking problems (like the linked-list of all memory allocations to avoid object tree locking issues).

Yes, I'm aware of that. But still, it's a rather huge change and all the points below still apply.

Quoted 562 lines

Thank you,

Ben.

Quoted 556 lines

This has multiple advantages:

1. It makes things much easier to review; bulky patch series, such as this one, are hard to review.
2. It potentially provides different perspectives for improvements ahead of time and potentially saves a lot of your time compared to working through the feedback afterwards.
3. It better involves the community. Wouldn't it be great if someone, due to a previous discussion, voluntarily picked up some of the effort?

Can you please resend patch 25 with a corresponding '--in-reply-to='? Also, as Dave already mentioned, I'd be great if you could provide a branch containing the patches.

- Danilo

Quoted 539 lines

drm/nouveau: add nouveau_drm.device/mmu
drm/nouveau: alias nouveau_drm.client to nouveau_drm.cli drm/nouveau: pass drm to nouveau_mem_new(), instead of cli drm/nouveau: pass drm to nv50_dmac_create(), rather than device+disp drm/nouveau: pass cli to nouveau_channel_new() instead of drm+device drm/nouveau: remove nouveau_chan.device
drm/nouveau: remove chan->drm
drm/nouveau: replace some void casts with chan->cli drm/nouveau: remove nouveau_drm.master
drm/nouveau: always map device
drm/nouveau: add nouveau_cli to nouveau_abi16
drm/nouveau: handle limited nvif in abi16
drm/nouveau: remove abi16->device
drm/nouveau: remove abi16->handles
drm/nouveau: store nvkm_device pointer in nouveau_drm drm/nouveau: create pci device once
drm/nouveau: remove push pointer from nouveau_channel drm/nouveau/kms: remove a few unused struct members and fn decls drm/nouveau/kms: remove push pointer from nv50_dmac drm/nouveau/kms: move hw ring tracking vars into nvif_push drm/nouveau/kms: move dmac sync/vram ctxdmas to core+wndws drm/nouveau/nvkm: remove detect/mmio/subdev_mask from device args drm/nouveau/nvkm: move nouveau_nvif.c to nvkm/core/driver.c drm/nouveau/nvkm: move nvkm/engine/device/ to nvkm/device/ drm/nouveau/nvkm: remove perfmon
drm/nouveau/nvkm: remove nvkm_client_search() drm/nouveau/nvif: remove support for userspace backends drm/nouveau/nvif: remove route/token
drm/nouveau/nvif: remove nvxx_object()
drm/nouveau/nvif: remove nvxx_client()
drm/nouveau/nvif: remove driver keep/fini drm/nouveau/nvif: remove client version
drm/nouveau/nvif: remove client devlist
drm/nouveau/nvif: remove client fini
drm/nouveau/nvif: remove device args
drm/nouveau/nvif: remove device rd/wr
drm/nouveau/nvif: remove disp chan rd/wr
drm/nouveau/nvkm: rename struct nvkm_uevent drm/nouveau/nvkm: remove nvkm_client()
drm/nouveau/nvkm: rename struct nvkm_udevice drm/nouveau/nvkm: rename struct nvkm_control drm/nouveau/nvkm: rename struct nvkm_uvfn drm/nouveau/nvkm: rename struct nvkm_ummu drm/nouveau/nvkm: rename struct nvkm_umem drm/nouveau/nvkm: rename struct nvkm_uvmm drm/nouveau/nvkm: detach user handling from nvkm_fault_buffer drm/nouveau/nvkm: detach user handling from nvkm_disp drm/nouveau/nvkm: detach user handling from nvkm_conn drm/nouveau/nvkm: detach user handling from nvkm_outp drm/nouveau/nvkm: detach user handling from nvkm_uhead drm/nouveau/nvkm: detach user handling from nvkm_disp_chan drm/nouveau/nvkm: rename struct nvkm_ucgrp drm/nouveau/nvkm: rename struct nvkm_uchan drm/nouveau/nvkm: move umem list to mmu
drm/nouveau/disp: simplify hw user definition drm/nouveau/nvif: output oclass id in object dbg messages drm/nouveau/nvif: add alternate version of nvif_object_ctor() drm/nouveau/nvif: add alternate version of nvif_event_ctor() drm/nouveau/nvif: move nvif<->nvkm interface definitions to driverif.h drm/nouveau/nvif: rework "new driver" api drm/nouveau/nvkm: remove device list
drm/nouveau/nvif: rework driver "new client" api drm/nouveau/nvif: rework client "new device" api drm/nouveau/nvif: remove client from object rb drm/nouveau/nvif: rework device "sclass" api drm/nouveau/nvif: rework device "map" api drm/nouveau/nvif: rework device "info v0" api drm/nouveau/nvif: rework device "info v1" api drm/nouveau/nvif: rework device "time" api drm/nouveau/nvif: rework device "new ctrl" api drm/nouveau/nvif: rework ctrl "pstate info" api drm/nouveau/nvif: rework ctrl "pstate attr" api drm/nouveau/nvif: rework ctrl "pstate user" api drm/nouveau/nvif: remove ctrl from object rb drm/nouveau/nvif: rework device "new usermode" api drm/nouveau/nvif: rework usermode "map" api drm/nouveau/nvif: remove usermode from object rb drm/nouveau/nvif: rework device "new mmu" api drm/nouveau/nvif: rework mmu "sclass" api drm/nouveau/nvif: rework mmu "heap" api
drm/nouveau/nvif: rework mmu "type" api
drm/nouveau/nvif: rework mmu "kind" api
drm/nouveau/nvif: rework mmu "new mem" api drm/nouveau/nvif: rework mem "map"/"unmap" apis drm/nouveau/nvif: rework mmu "new vmm" api drm/nouveau/nvif: remove mmu from object rb drm/nouveau/nvif: rework vmm "page" api
drm/nouveau/nvif: rework vmm "get"/"put" apis drm/nouveau/nvif: rework vmm "map"/"unmap" apis drm/nouveau/nvif: rework vmm "pfnmap"/"pfnclr" apis drm/nouveau/nvif: rework vmm "raw get"/"raw put" apis drm/nouveau/nvif: rework vmm "raw map"/"raw unmap" apis drm/nouveau/nvif: rework vmm "raw sparse" api drm/nouveau/nvif: rework vmm "fault replay"/"fault cancel" apis drm/nouveau/nvif: rework device "new fault buffer" api drm/nouveau/nvif: rework fault buffer "map" api drm/nouveau/nvif: rework fault buffer "new event" api drm/nouveau/nvif: remove fault buffer from object rb drm/nouveau/nvif: rework device "new disp" api drm/nouveau/nvif: rework disp "sclass" api drm/nouveau/nvif: rework disp "new caps" api drm/nouveau/nvif: rework disp "new conn" api drm/nouveau/nvif: rework conn "new event" api drm/nouveau/nvif: remove conn from object rb drm/nouveau/nvif: rework disp "new outp" api drm/nouveau/nvif: rework outp "detect" api drm/nouveau/nvif: rework outp "edid get" api drm/nouveau/nvif: rework outp "load detect" api drm/nouveau/nvif: rework outp "inherit" apis drm/nouveau/nvif: rework outp "acquire" api drm/nouveau/nvif: rework outp "release" api drm/nouveau/nvif: rework outp "bl get"/"bl set" apis drm/nouveau/nvif: rework outp "lvds config" api drm/nouveau/nvif: rework outp "hdmi config" api drm/nouveau/nvif: rework outp "infoframe" api drm/nouveau/nvif: rework outp "hda eld" api drm/nouveau/nvif: rework outp "dp aux pwr" api drm/nouveau/nvif: rework outp "dp aux xfer" api drm/nouveau/nvif: rework outp "dp rates" api drm/nouveau/nvif: rework outp "dp train" api drm/nouveau/nvif: rework outp "dp drive" api drm/nouveau/nvif: rework outp "dp sst" api drm/nouveau/nvif: rework outp "dp mst id get"/"dp mst id put" apis drm/nouveau/nvif: rework outp "dp mst vcpi" api drm/nouveau/nvif: remove outp from object rb drm/nouveau/nvif: rework disp "new head" api drm/nouveau/nvif: rework head "scanoutpos" api drm/nouveau/nvif: rework head "new event" api drm/nouveau/nvif: remove head from object rb drm/nouveau/nvif: rework disp "new chan" apis drm/nouveau/nvif: remove disp from object rb drm/nouveau/nvif: rework disp chan "new ctxdma" api drm/nouveau/nvif: remove disp chans from object rb drm/nouveau/nvif: rework device "new cgrp" api drm/nouveau/nvif: rework device "new ctxdma" api drm/nouveau/nvif: rework device/cgrp "new chan" apis drm/nouveau/nvif: remove mem from object rb drm/nouveau/nvif: remove vmm from object rb drm/nouveau/nvif: remove ctxdma from object rb drm/nouveau/nvif: remove device from object rb drm/nouveau/nvif: rework chan "map" api
drm/nouveau/nvif: rework chan "sclass" api drm/nouveau/nvif: rework chan "new event" apis drm/nouveau/nvif: rework chan "new ctxdma" api drm/nouveau/nvif: rework chan "new engobj" apis drm/nouveau/nvif: remove chan from object rb drm/nouveau/nvif: rework engobj "mthd" api drm/nouveau/nvif: rework engobj "new event" api drm/nouveau/nvif: remove engobj from object rb drm/nouveau/nvkm: switch nvkm_object to non-irqsafe spinlock drm/nouveau: remove client_mutex
drm/nouveau: move nvxx_* definitions to nouveau_drv.h drm/nouveau: pass nouveau_drm to nvxx_*
drm/nouveau: remove remaining usage of nvif_device.info drm/nouveau: remove remaining usage of nvif_device.object.map drm/nouveau: remove remaining usage of nouveau_drm.client

  drivers/gpu/drm/nouveau/Kbuild                |   2 -
  drivers/gpu/drm/nouveau/dispnv04/arb.c        |   7 +-
  drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  50 +-
  drivers/gpu/drm/nouveau/dispnv04/cursor.c     |   2 +-
  drivers/gpu/drm/nouveau/dispnv04/dac.c        |  18 +-
  drivers/gpu/drm/nouveau/dispnv04/dfp.c        |  12 +-
  drivers/gpu/drm/nouveau/dispnv04/disp.c       |  15 +-
  drivers/gpu/drm/nouveau/dispnv04/disp.h       |   6 +-
  drivers/gpu/drm/nouveau/dispnv04/hw.c         |  83 +-
  drivers/gpu/drm/nouveau/dispnv04/hw.h         |  45 +-
  drivers/gpu/drm/nouveau/dispnv04/overlay.c    |  21 +-
  drivers/gpu/drm/nouveau/dispnv04/tvnv04.c     |   4 +-
  drivers/gpu/drm/nouveau/dispnv04/tvnv17.c     |  16 +-
  drivers/gpu/drm/nouveau/dispnv04/tvnv17.h     |  10 +-
  drivers/gpu/drm/nouveau/dispnv50/base.c       |  33 +-
  drivers/gpu/drm/nouveau/dispnv50/base507c.c   |  43 +-
  drivers/gpu/drm/nouveau/dispnv50/base827c.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/base907c.c   |  10 +-
  drivers/gpu/drm/nouveau/dispnv50/core.c       |  84 +-
  drivers/gpu/drm/nouveau/dispnv50/core.h       |   9 +-
  drivers/gpu/drm/nouveau/dispnv50/core507d.c   |  34 +-
  drivers/gpu/drm/nouveau/dispnv50/core907d.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/corec37d.c   |  19 +-
  drivers/gpu/drm/nouveau/dispnv50/corec57d.c   |   4 +-
  drivers/gpu/drm/nouveau/dispnv50/crc.c        |  34 +-
  drivers/gpu/drm/nouveau/dispnv50/crc.h        |   4 +-
  drivers/gpu/drm/nouveau/dispnv50/crc907d.c    |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/crcc37d.c    |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/crcc57d.c    |   4 +-
  drivers/gpu/drm/nouveau/dispnv50/curs.c       |  35 +-
  drivers/gpu/drm/nouveau/dispnv50/curs507a.c   |  41 +-
  drivers/gpu/drm/nouveau/dispnv50/cursc37a.c   |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/dac507d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/dac907d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/disp.c       | 313 +------
  drivers/gpu/drm/nouveau/dispnv50/disp.h       |  37 +-
  drivers/gpu/drm/nouveau/dispnv50/head.c       |   4 +-
  drivers/gpu/drm/nouveau/dispnv50/head507d.c   |  26 +-
  drivers/gpu/drm/nouveau/dispnv50/head827d.c   |  10 +-
  drivers/gpu/drm/nouveau/dispnv50/head907d.c   |  26 +-
  drivers/gpu/drm/nouveau/dispnv50/head917d.c   |   6 +-
  drivers/gpu/drm/nouveau/dispnv50/headc37d.c   |  18 +-
  drivers/gpu/drm/nouveau/dispnv50/headc57d.c   |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/lut.c        |  12 +-
  drivers/gpu/drm/nouveau/dispnv50/lut.h        |   5 +-
  drivers/gpu/drm/nouveau/dispnv50/oimm.c       |  29 +-
  drivers/gpu/drm/nouveau/dispnv50/oimm507b.c   |  20 +-
  drivers/gpu/drm/nouveau/dispnv50/ovly.c       |  32 +-
  drivers/gpu/drm/nouveau/dispnv50/ovly507e.c   |  28 +-
  drivers/gpu/drm/nouveau/dispnv50/ovly827e.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/ovly907e.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/pior507d.c   |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/sor507d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/sor907d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/sorc37d.c    |   2 +-
  drivers/gpu/drm/nouveau/dispnv50/wimm.c       |  25 +-
  drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c   |  24 +-
  drivers/gpu/drm/nouveau/dispnv50/wndw.c       | 101 +-
  drivers/gpu/drm/nouveau/dispnv50/wndw.h       |  20 +-
  drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c   |  46 +-
  drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c   |  10 +-
  drivers/gpu/drm/nouveau/dispnv50/wndwc67e.c   |   2 +-
  drivers/gpu/drm/nouveau/include/nvif/cgrp.h   |  17 +
  drivers/gpu/drm/nouveau/include/nvif/chan.h   |  45 +
  drivers/gpu/drm/nouveau/include/nvif/cl0080.h |  60 --
  drivers/gpu/drm/nouveau/include/nvif/class.h  |   8 -
  drivers/gpu/drm/nouveau/include/nvif/clb069.h |  15 -
  drivers/gpu/drm/nouveau/include/nvif/client.h |  14 +-
  drivers/gpu/drm/nouveau/include/nvif/conn.h   |  24 +-
  drivers/gpu/drm/nouveau/include/nvif/ctxdma.h |  29 +
  drivers/gpu/drm/nouveau/include/nvif/device.h |  51 +-
  drivers/gpu/drm/nouveau/include/nvif/disp.h   |  19 +-
  .../gpu/drm/nouveau/include/nvif/dispchan.h   |  25 +
  drivers/gpu/drm/nouveau/include/nvif/driver.h |  27 +-
  .../gpu/drm/nouveau/include/nvif/driverif.h   | 643 +++++++++++++
  drivers/gpu/drm/nouveau/include/nvif/event.h  |  16 +-
  drivers/gpu/drm/nouveau/include/nvif/fifo.h   |  11 +-
  drivers/gpu/drm/nouveau/include/nvif/head.h   |   2 +
  drivers/gpu/drm/nouveau/include/nvif/if0000.h |  20 -
  drivers/gpu/drm/nouveau/include/nvif/if0001.h |  47 -
  drivers/gpu/drm/nouveau/include/nvif/if0002.h |  39 -
  drivers/gpu/drm/nouveau/include/nvif/if0003.h |  34 -
  drivers/gpu/drm/nouveau/include/nvif/if0008.h |  42 -
  drivers/gpu/drm/nouveau/include/nvif/if000c.h | 117 ---
  drivers/gpu/drm/nouveau/include/nvif/if000d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/if000e.h |  26 -
  drivers/gpu/drm/nouveau/include/nvif/if0010.h |  14 -
  drivers/gpu/drm/nouveau/include/nvif/if0011.h |  18 -
  drivers/gpu/drm/nouveau/include/nvif/if0012.h | 294 ------
  drivers/gpu/drm/nouveau/include/nvif/if0013.h |  35 -
  drivers/gpu/drm/nouveau/include/nvif/if0014.h |  13 -
  drivers/gpu/drm/nouveau/include/nvif/if0020.h |  45 -
  drivers/gpu/drm/nouveau/include/nvif/if0021.h |  16 -
  drivers/gpu/drm/nouveau/include/nvif/if500d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/if900d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/ifb00d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/ifc00d.h |   1 -
  drivers/gpu/drm/nouveau/include/nvif/ioctl.h  |  44 -
  drivers/gpu/drm/nouveau/include/nvif/mem.h    |  18 +-
  drivers/gpu/drm/nouveau/include/nvif/mmu.h    |  38 +-
  drivers/gpu/drm/nouveau/include/nvif/object.h | 105 +--
  drivers/gpu/drm/nouveau/include/nvif/os.h     |  19 +
  drivers/gpu/drm/nouveau/include/nvif/outp.h   |  58 +-
  drivers/gpu/drm/nouveau/include/nvif/printf.h |   9 +-
  drivers/gpu/drm/nouveau/include/nvif/push.h   |  18 +-
  drivers/gpu/drm/nouveau/include/nvif/user.h   |   6 +-
  drivers/gpu/drm/nouveau/include/nvif/vmm.h    |  30 +-
  .../drm/nouveau/include/nvkm/core/client.h    |  16 +-
  .../drm/nouveau/include/nvkm/core/device.h    |   6 -
  .../drm/nouveau/include/nvkm/core/driver.h    |   9 +
  .../gpu/drm/nouveau/include/nvkm/core/event.h |  10 +-
  .../gpu/drm/nouveau/include/nvkm/core/ioctl.h |   8 -
  .../drm/nouveau/include/nvkm/core/layout.h    |   1 -
  .../drm/nouveau/include/nvkm/core/object.h    |  43 +-
  .../drm/nouveau/include/nvkm/core/oclass.h    |   2 -
  .../gpu/drm/nouveau/include/nvkm/core/os.h    |  21 +-
  .../gpu/drm/nouveau/include/nvkm/core/pci.h   |   1 -
  .../drm/nouveau/include/nvkm/core/subdev.h    |   2 -
  .../gpu/drm/nouveau/include/nvkm/core/tegra.h |   1 -
  .../drm/nouveau/include/nvkm/engine/disp.h    |   4 +-
  .../gpu/drm/nouveau/include/nvkm/engine/dma.h |   2 -
  .../gpu/drm/nouveau/include/nvkm/engine/pm.h  |  29 -
  .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h |   3 -
  drivers/gpu/drm/nouveau/nouveau_abi16.c       | 498 ++++++----
  drivers/gpu/drm/nouveau/nouveau_abi16.h       |  11 +-
  drivers/gpu/drm/nouveau/nouveau_backlight.c   |  30 +-
  drivers/gpu/drm/nouveau/nouveau_bios.c        |  22 +-
  drivers/gpu/drm/nouveau/nouveau_bios.h        |   1 +
  drivers/gpu/drm/nouveau/nouveau_bo.c          | 130 +--
  drivers/gpu/drm/nouveau/nouveau_bo0039.c      |   8 +-
  drivers/gpu/drm/nouveau/nouveau_bo5039.c      |  10 +-
  drivers/gpu/drm/nouveau/nouveau_bo74c1.c      |   2 +-
  drivers/gpu/drm/nouveau/nouveau_bo85b5.c      |   2 +-
  drivers/gpu/drm/nouveau/nouveau_bo9039.c      |   4 +-
  drivers/gpu/drm/nouveau/nouveau_bo90b5.c      |   2 +-
  drivers/gpu/drm/nouveau/nouveau_boa0b5.c      |   4 +-
  drivers/gpu/drm/nouveau/nouveau_chan.c        | 353 ++++---
  drivers/gpu/drm/nouveau/nouveau_chan.h        |  31 +-
  drivers/gpu/drm/nouveau/nouveau_connector.c   |  30 +-
  drivers/gpu/drm/nouveau/nouveau_debugfs.c     |  47 +-
  drivers/gpu/drm/nouveau/nouveau_debugfs.h     |   2 +
  drivers/gpu/drm/nouveau/nouveau_display.c     |  50 +-
  drivers/gpu/drm/nouveau/nouveau_dma.c         |  10 +-
  drivers/gpu/drm/nouveau/nouveau_dma.h         |   2 +-
  drivers/gpu/drm/nouveau/nouveau_dmem.c        |  19 +-
  drivers/gpu/drm/nouveau/nouveau_dp.c          |   2 +-
  drivers/gpu/drm/nouveau/nouveau_drm.c         | 359 +++-----
  drivers/gpu/drm/nouveau/nouveau_drv.h         |  71 +-
  drivers/gpu/drm/nouveau/nouveau_fence.c       |  33 +-
  drivers/gpu/drm/nouveau/nouveau_gem.c         |  34 +-
  drivers/gpu/drm/nouveau/nouveau_hwmon.c       |  46 +-
  drivers/gpu/drm/nouveau/nouveau_led.c         |   6 +-
  drivers/gpu/drm/nouveau/nouveau_mem.c         |  44 +-
  drivers/gpu/drm/nouveau/nouveau_mem.h         |   4 +-
  drivers/gpu/drm/nouveau/nouveau_prime.c       |   2 +-
  drivers/gpu/drm/nouveau/nouveau_sgdma.c       |   4 +-
  drivers/gpu/drm/nouveau/nouveau_svm.c         | 174 ++--
  drivers/gpu/drm/nouveau/nouveau_ttm.c         |  43 +-
  drivers/gpu/drm/nouveau/nouveau_usif.c        | 194 ----
  drivers/gpu/drm/nouveau/nouveau_usif.h        |  10 -
  drivers/gpu/drm/nouveau/nouveau_uvmm.c        |   4 +-
  drivers/gpu/drm/nouveau/nouveau_vga.c         |   8 +-
  drivers/gpu/drm/nouveau/nouveau_vmm.c         |  14 +-
  drivers/gpu/drm/nouveau/nouveau_vmm.h         |   2 +-
  drivers/gpu/drm/nouveau/nv04_fence.c          |   9 +-
  drivers/gpu/drm/nouveau/nv10_fence.c          |   6 +-
  drivers/gpu/drm/nouveau/nv10_fence.h          |   2 +-
  drivers/gpu/drm/nouveau/nv17_fence.c          |  25 +-
  drivers/gpu/drm/nouveau/nv50_fence.c          |  13 +-
  drivers/gpu/drm/nouveau/nv84_fence.c          |  20 +-
  drivers/gpu/drm/nouveau/nvc0_fence.c          |   4 +-
  drivers/gpu/drm/nouveau/nvif/Kbuild           |   3 +
  drivers/gpu/drm/nouveau/nvif/cgrp.c           |  52 ++
  drivers/gpu/drm/nouveau/nvif/chan.c           | 130 +++
  drivers/gpu/drm/nouveau/nvif/client.c         |  54 +-
  drivers/gpu/drm/nouveau/nvif/conn.c           |  53 +-
  drivers/gpu/drm/nouveau/nvif/device.c         |  67 +-
  drivers/gpu/drm/nouveau/nvif/disp.c           | 107 ++-
  drivers/gpu/drm/nouveau/nvif/dispchan.c       | 222 +++++
  drivers/gpu/drm/nouveau/nvif/driver.c         |  40 +-
  drivers/gpu/drm/nouveau/nvif/event.c          |  63 +-
  drivers/gpu/drm/nouveau/nvif/fifo.c           |  66 +-
  drivers/gpu/drm/nouveau/nvif/head.c           |  35 +-
  drivers/gpu/drm/nouveau/nvif/mem.c            | 102 ++-
  drivers/gpu/drm/nouveau/nvif/mmu.c            | 111 +--
  drivers/gpu/drm/nouveau/nvif/object.c         | 290 +-----
  drivers/gpu/drm/nouveau/nvif/outp.c           | 353 ++-----
  drivers/gpu/drm/nouveau/nvif/user.c           |  50 +-
  drivers/gpu/drm/nouveau/nvif/userc361.c       |   8 +-
  drivers/gpu/drm/nouveau/nvif/vmm.c            | 200 +---
  drivers/gpu/drm/nouveau/nvkm/Kbuild           |   1 +
  drivers/gpu/drm/nouveau/nvkm/core/Kbuild      |   2 +-
  drivers/gpu/drm/nouveau/nvkm/core/client.c    | 150 +--
  .../{nouveau_nvif.c => nvkm/core/driver.c}    |  69 +-
  drivers/gpu/drm/nouveau/nvkm/core/engine.c    |  12 -
  drivers/gpu/drm/nouveau/nvkm/core/ioctl.c     | 390 --------
  drivers/gpu/drm/nouveau/nvkm/core/object.c    | 159 +---
  drivers/gpu/drm/nouveau/nvkm/core/oproxy.c    |  76 --
  drivers/gpu/drm/nouveau/nvkm/core/subdev.c    |   8 -
  drivers/gpu/drm/nouveau/nvkm/core/uevent.c    |  88 +-
  drivers/gpu/drm/nouveau/nvkm/device/Kbuild    |   7 +
  .../nouveau/nvkm/{engine => }/device/acpi.c   |   0
  .../nouveau/nvkm/{engine => }/device/acpi.h   |   0
  .../nouveau/nvkm/{engine => }/device/base.c   | 552 +++++------
  drivers/gpu/drm/nouveau/nvkm/device/ctrl.c    | 172 ++++
  drivers/gpu/drm/nouveau/nvkm/device/ctrl.h    |   9 +
  .../nouveau/nvkm/{engine => }/device/pci.c    |   4 +-
  .../nouveau/nvkm/{engine => }/device/priv.h   |   2 -
  .../nouveau/nvkm/{engine => }/device/tegra.c  |   5 +-
  drivers/gpu/drm/nouveau/nvkm/device/user.c    | 434 +++++++++
  drivers/gpu/drm/nouveau/nvkm/device/user.h    |   9 +
  drivers/gpu/drm/nouveau/nvkm/engine/Kbuild    |   2 -
  .../gpu/drm/nouveau/nvkm/engine/device/Kbuild |   7 -
  .../gpu/drm/nouveau/nvkm/engine/device/ctrl.c | 212 -----
  .../gpu/drm/nouveau/nvkm/engine/device/ctrl.h |  13 -
  .../gpu/drm/nouveau/nvkm/engine/device/user.c | 431 ---------
  .../gpu/drm/nouveau/nvkm/engine/disp/Kbuild   |   1 +
  .../gpu/drm/nouveau/nvkm/engine/disp/ad102.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/base.c   |  29 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/chan.c   | 272 +++---
  .../gpu/drm/nouveau/nvkm/engine/disp/chan.h   |  15 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/conn.h   |   2 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/g84.c    |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/g94.c    |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/ga102.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gf119.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gk104.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gk110.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gm107.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gm200.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gp100.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gp102.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gt200.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gt215.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/gv100.c  |  52 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/head.h   |   2 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/mcp77.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/mcp89.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/nv04.c   |   5 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/nv50.c   |  20 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/outp.h   |   3 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/priv.h   |  31 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/r535.c   |  46 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/tu102.c  |  13 +-
  .../gpu/drm/nouveau/nvkm/engine/disp/ucaps.c  |  70 ++
  .../gpu/drm/nouveau/nvkm/engine/disp/ucaps.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/disp/uchan.h  |  10 +
  .../gpu/drm/nouveau/nvkm/engine/disp/uconn.c  | 176 ++--
  .../gpu/drm/nouveau/nvkm/engine/disp/uconn.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/disp/udisp.c  | 288 ++++--
  .../gpu/drm/nouveau/nvkm/engine/disp/udisp.h  |  17 +
  .../gpu/drm/nouveau/nvkm/engine/disp/uhead.c  | 125 +--
  .../gpu/drm/nouveau/nvkm/engine/disp/uhead.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c  | 778 ++++++++--------
  .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/dma/user.c    |  19 -
  .../drm/nouveau/nvkm/engine/dma/usergf100.c   |   5 -
  .../drm/nouveau/nvkm/engine/dma/usergf119.c   |   5 -
  .../drm/nouveau/nvkm/engine/dma/usergv100.c   |   5 -
  .../drm/nouveau/nvkm/engine/dma/usernv50.c    |   6 -
  .../gpu/drm/nouveau/nvkm/engine/fifo/Kbuild   |   1 +
  .../gpu/drm/nouveau/nvkm/engine/fifo/base.c   | 126 ---
  .../gpu/drm/nouveau/nvkm/engine/fifo/chan.c   |   2 -
  .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h   |   5 -
  .../gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.c  | 108 ++-
  .../gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.h  |   9 +
  .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 388 +++++---
  .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.h  |  11 +
  .../gpu/drm/nouveau/nvkm/engine/fifo/ufifo.c  | 129 +++
  .../gpu/drm/nouveau/nvkm/engine/fifo/ufifo.h  |   8 +
  .../gpu/drm/nouveau/nvkm/engine/gr/gf100.c    |   1 -
  drivers/gpu/drm/nouveau/nvkm/engine/pm/Kbuild |  11 -
  drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c | 867 ------------------
  drivers/gpu/drm/nouveau/nvkm/engine/pm/g84.c  | 165 ----
  .../gpu/drm/nouveau/nvkm/engine/pm/gf100.c    | 243 -----
  .../gpu/drm/nouveau/nvkm/engine/pm/gf100.h    |  20 -
  .../gpu/drm/nouveau/nvkm/engine/pm/gf108.c    |  66 --
  .../gpu/drm/nouveau/nvkm/engine/pm/gf117.c    |  80 --
  .../gpu/drm/nouveau/nvkm/engine/pm/gk104.c    | 184 ----
  .../gpu/drm/nouveau/nvkm/engine/pm/gt200.c    | 157 ----
  .../gpu/drm/nouveau/nvkm/engine/pm/gt215.c    | 138 ---
  drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c | 123 ---
  drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.h |  15 -
  drivers/gpu/drm/nouveau/nvkm/engine/pm/nv50.c | 175 ----
  drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 105 ---
  drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c |  14 +-
  .../gpu/drm/nouveau/nvkm/subdev/fault/base.c  |   1 -
  .../gpu/drm/nouveau/nvkm/subdev/fault/priv.h  |   5 -
  .../gpu/drm/nouveau/nvkm/subdev/fault/user.c  |  99 +-
  .../gpu/drm/nouveau/nvkm/subdev/fault/user.h  |   9 +
  .../gpu/drm/nouveau/nvkm/subdev/mmu/base.c    |   1 -
  .../gpu/drm/nouveau/nvkm/subdev/mmu/umem.c    | 125 ++-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/umem.h    |  24 +-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c    | 186 ++--
  .../gpu/drm/nouveau/nvkm/subdev/mmu/ummu.h    |  13 +-
  .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c    | 357 +++-----
  .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.h    |  12 +-
  drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |   8 +-
  .../drm/nouveau/nvkm/subdev/mmu/vmmgp100.c    |  68 +-
  .../drm/nouveau/nvkm/subdev/mmu/vmmgp10b.c    |   2 +-
  .../drm/nouveau/nvkm/subdev/mmu/vmmgv100.c    |   2 +-
  .../drm/nouveau/nvkm/subdev/mmu/vmmtu102.c    |   2 +-
  .../gpu/drm/nouveau/nvkm/subdev/vfn/base.c    |   1 -
  .../gpu/drm/nouveau/nvkm/subdev/vfn/priv.h    |   3 -
  .../gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c    |  44 +-
  .../gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.h    |   9 +
  306 files changed, 6653 insertions(+), 10697 deletions(-)

create mode 100644 drivers/gpu/drm/nouveau/include/nvif/cgrp.h create mode 100644 drivers/gpu/drm/nouveau/include/nvif/chan.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/clb069.h create mode 100644 drivers/gpu/drm/nouveau/include/nvif/ctxdma.h create mode 100644 drivers/gpu/drm/nouveau/include/nvif/dispchan.h create mode 100644 drivers/gpu/drm/nouveau/include/nvif/driverif.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0000.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0001.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0002.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0003.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0008.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if000c.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if000e.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0010.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0012.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0013.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0014.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0020.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvif/if0021.h create mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/driver.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/ioctl.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvkm/engine/pm.h delete mode 100644 drivers/gpu/drm/nouveau/nouveau_usif.c delete mode 100644 drivers/gpu/drm/nouveau/nouveau_usif.h create mode 100644 drivers/gpu/drm/nouveau/nvif/cgrp.c
create mode 100644 drivers/gpu/drm/nouveau/nvif/chan.c
create mode 100644 drivers/gpu/drm/nouveau/nvif/dispchan.c rename drivers/gpu/drm/nouveau/{nouveau_nvif.c => nvkm/core/driver.c} (65%) delete mode 100644 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/Kbuild rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/acpi.c (100%) rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/acpi.h (100%) rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/base.c (89%) create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/ctrl.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/ctrl.h rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/pci.c (99%) rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/priv.h (95%) rename drivers/gpu/drm/nouveau/nvkm/{engine => }/device/tegra.c (97%) create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/user.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/device/user.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/Kbuild delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/device/user.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/ucaps.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/ucaps.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uchan.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/udisp.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uhead.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/ucgrp.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/ufifo.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/ufifo.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/Kbuild delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/g84.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf108.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf117.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gk104.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gt200.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/gt215.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv50.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/fault/user.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.h

--
2.41.0

author
#162 lore raw

PATCH 156/156 drm/nouveau: remove remaining usage of nouveau_drm.client

In reply to Ben Skeggs

- complete the switch to nouveau_drm.cli
- renames drm._client to drm.client

---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/crc.c  |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/head.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/wndw.c |  2 +-
 drivers/gpu/drm/nouveau/nouveau_bo.c    |  2 +-
 drivers/gpu/drm/nouveau/nouveau_dmem.c  |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 14 +++++++-------
 drivers/gpu/drm/nouveau/nouveau_drv.h   | 25 +++++++++++--------------
 drivers/gpu/drm/nouveau/nouveau_prime.c |  2 +-
 drivers/gpu/drm/nouveau/nouveau_ttm.c   |  4 ++--
 drivers/gpu/drm/nouveau/nv17_fence.c    |  2 +-
 drivers/gpu/drm/nouveau/nv50_fence.c    |  2 +-
 drivers/gpu/drm/nouveau/nv84_fence.c    |  2 +-
 14 files changed, 31 insertions(+), 34 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/crtc.c +1 -1
index 7f83927ddf96..225716d47c56 100644
@@ -1317,7 +1317,7 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num)
 	drm_crtc_helper_add(&nv_crtc->base, &nv04_crtc_helper_funcs);
 	drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256);
 
-	ret = nouveau_bo_new(&nouveau_drm(dev)->client, 64*64*4, 0x100,
+	ret = nouveau_bo_new(&nouveau_drm(dev)->cli, 64*64*4, 0x100,
 			     NOUVEAU_GEM_DOMAIN_VRAM, 0, 0x0000, NULL, NULL,
 			     &nv_crtc->cursor.nvbo);
 	if (!ret) {
drivers/gpu/drm/nouveau/dispnv50/crc.c +1 -1
index 6d1395b8c597..fd3360b096b4 100644
@@ -541,7 +541,7 @@ int nv50_crc_set_source(struct drm_crtc *crtc, const char *source_str)
 	struct nv50_head *head = nv50_head(crtc);
 	struct nv50_crc *crc = &head->crc;
 	const struct nv50_crc_func *func = nv50_disp(dev)->core->func->crc;
-	struct nvif_mmu *mmu = &nouveau_drm(dev)->client.mmu;
+	struct nvif_mmu *mmu = &nouveau_drm(dev)->cli.mmu;
 	struct nv50_head_atom *asyh;
 	struct drm_crtc_state *crtc_state;
 	enum nv50_crc_source source;
drivers/gpu/drm/nouveau/dispnv50/disp.c +1 -1
index 36547f3b6111..45ef47b1997d 100644
@@ -2604,7 +2604,7 @@ nv50_display_create(struct drm_device *dev)
 	dev->mode_config.normalize_zpos = true;
 
 	/* small shared memory area we use for notifiers and semaphores */
-	ret = nouveau_bo_new(&drm->client, 4096, 0x1000,
+	ret = nouveau_bo_new(&drm->cli, 4096, 0x1000,
 			     NOUVEAU_GEM_DOMAIN_VRAM,
 			     0, 0x0000, NULL, NULL, &disp->sync);
 	if (!ret) {
drivers/gpu/drm/nouveau/dispnv50/head.c +1 -1
index 3a192dd8635a..187feceb300a 100644
@@ -618,7 +618,7 @@ nv50_head_create(struct drm_device *dev, int index)
 				   head->func->olut_size);
 
 	if (head->func->olut_set) {
-		ret = nv50_lut_init(disp, &drm->client.mmu, &head->olut);
+		ret = nv50_lut_init(disp, &drm->cli.mmu, &head->olut);
 		if (ret) {
 			nv50_head_destroy(crtc);
 			return ERR_PTR(ret);
drivers/gpu/drm/nouveau/dispnv50/wndw.c +1 -1
index 38853dbe57c5..8f6f431d682a 100644
@@ -736,7 +736,7 @@ nv50_wndw_prep(const struct nv50_wndw_func *func, struct drm_device *dev,
 	       struct nv50_wndw **pwndw)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct nvif_mmu *mmu = &drm->client.mmu;
+	struct nvif_mmu *mmu = &drm->cli.mmu;
 	struct nv50_disp *disp = nv50_disp(dev);
 	struct nv50_wndw *wndw;
 	const u64 *format_modifiers;
drivers/gpu/drm/nouveau/nouveau_bo.c +1 -1
index 523464cfea9e..c4e420b9deef 100644
@@ -832,7 +832,7 @@ nouveau_bo_move_prep(struct nouveau_drm *drm, struct ttm_buffer_object *bo,
 {
 	struct nouveau_mem *old_mem = nouveau_mem(bo->resource);
 	struct nouveau_mem *new_mem = nouveau_mem(reg);
-	struct nvif_vmm *vmm = &drm->client.vmm.vmm;
+	struct nvif_vmm *vmm = &drm->cli.vmm.vmm;
 	int ret;
 
 	ret = nvif_vmm_get(vmm, NVIF_VMM_GET_LAZY, false, old_mem->mem.impl->page, 0,
drivers/gpu/drm/nouveau/nouveau_dmem.c +1 -1
index 2cb06f0a217f..43c5b583caef 100644
@@ -254,7 +254,7 @@ nouveau_dmem_chunk_alloc(struct nouveau_drm *drm, struct page **ppage)
 	chunk->pagemap.ops = &nouveau_dmem_pagemap_ops;
 	chunk->pagemap.owner = drm->dev;
 
-	ret = nouveau_bo_new(&drm->client, DMEM_CHUNK_SIZE, 0,
+	ret = nouveau_bo_new(&drm->cli, DMEM_CHUNK_SIZE, 0,
 			     NOUVEAU_GEM_DOMAIN_VRAM, 0, 0, NULL, NULL,
 			     &chunk->bo);
 	if (ret)
drivers/gpu/drm/nouveau/nouveau_drm.c +7 -7
index 26a89ab6d462..98085bb9eb78 100644
@@ -201,7 +201,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
 	INIT_LIST_HEAD(&cli->worker);
 	mutex_init(&cli->lock);
 
-	ret = nvif_client_ctor(&drm->_client, cli->name, &cli->base);
+	ret = nvif_client_ctor(&drm->client, cli->name, &cli->base);
 	if (ret) {
 		NV_PRINTK(err, cli, "Client allocation failed: %d\n", ret);
 		goto done;
@@ -497,15 +497,15 @@ nouveau_drm_device_init(struct drm_device *dev, struct nvkm_device *nvkm)
 
 	nvif_parent_ctor(&nouveau_parent, &drm->parent);
 
-	drm->_client.object.parent = &drm->parent;
+	drm->client.object.parent = &drm->parent;
 
 	ret = nvkm_driver_ctor(drm->nvkm, &driver, &impl, &priv);
 	if (ret)
 		goto fail_alloc;
 
-	nvif_driver_ctor(&drm->parent, driver, "drm", impl, priv, &drm->_client);
+	nvif_driver_ctor(&drm->parent, driver, "drm", impl, priv, &drm->client);
 
-	ret = nvif_device_ctor(&drm->_client, "drmDevice", &drm->device);
+	ret = nvif_device_ctor(&drm->client, "drmDevice", &drm->device);
 	if (ret) {
 		NV_ERROR(drm, "Device allocation failed: %d\n", ret);
 		goto fail_nvif;
@@ -630,7 +630,7 @@ nouveau_drm_device_init(struct drm_device *dev, struct nvkm_device *nvkm)
 fail_nvif:
 	nvif_mmu_dtor(&drm->mmu);
 	nvif_device_dtor(&drm->device);
-	nvif_client_dtor(&drm->_client);
+	nvif_client_dtor(&drm->client);
 fail_alloc:
 	nvif_parent_dtor(&drm->parent);
 	kfree(drm);
@@ -886,7 +886,7 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime)
 	}
 
 	NV_DEBUG(drm, "suspending object tree...\n");
-	ret = nvif_client_suspend(&drm->_client);
+	ret = nvif_client_suspend(&drm->client);
 	if (ret)
 		goto fail_client;
 
@@ -911,7 +911,7 @@ nouveau_do_resume(struct drm_device *dev, bool runtime)
 	struct nouveau_drm *drm = nouveau_drm(dev);
 
 	NV_DEBUG(drm, "resuming object tree...\n");
-	ret = nvif_client_resume(&drm->_client);
+	ret = nvif_client_resume(&drm->client);
 	if (ret) {
 		NV_ERROR(drm, "Client resume failed with error: %d\n", ret);
 		return ret;
drivers/gpu/drm/nouveau/nouveau_drv.h +11 -14
index 12c9ac68a23e..bf11f30da77c 100644
@@ -203,14 +203,11 @@ u_memcpya(uint64_t user, unsigned int nmemb, unsigned int size)
 struct nouveau_drm {
 	struct nvkm_device *nvkm;
 	struct nvif_parent parent;
-	struct nvif_client _client;
+	struct nvif_client client;
 	struct nvif_device device;
 	struct nvif_mmu mmu;
 
-	union {
-		struct nouveau_cli client;
-		struct nouveau_cli cli;
-	};
+	struct nouveau_cli cli;
 	struct drm_device *dev;
 
 	struct list_head clients;
@@ -340,25 +337,25 @@ void nouveau_drm_device_remove(struct drm_device *dev);
 	dev_##l(_cli->drm->dev->dev, "%s: "f, _cli->name, ##a);                \
 } while(0)
 
-#define NV_FATAL(drm,f,a...) NV_PRINTK(crit, &(drm)->client, f, ##a)
-#define NV_ERROR(drm,f,a...) NV_PRINTK(err, &(drm)->client, f, ##a)
-#define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->client, f, ##a)
-#define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a)
+#define NV_FATAL(drm,f,a...) NV_PRINTK(crit, &(drm)->cli, f, ##a)
+#define NV_ERROR(drm,f,a...) NV_PRINTK(err, &(drm)->cli, f, ##a)
+#define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->cli, f, ##a)
+#define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->cli, f, ##a)
 
 #define NV_DEBUG(drm,f,a...) do {                                              \
 	if (drm_debug_enabled(DRM_UT_DRIVER))                                  \
-		NV_PRINTK(info, &(drm)->client, f, ##a);                       \
+		NV_PRINTK(info, &(drm)->cli, f, ##a);                       \
 } while(0)
 #define NV_ATOMIC(drm,f,a...) do {                                             \
 	if (drm_debug_enabled(DRM_UT_ATOMIC))                                  \
-		NV_PRINTK(info, &(drm)->client, f, ##a);                       \
+		NV_PRINTK(info, &(drm)->cli, f, ##a);                       \
 } while(0)
 
 #define NV_PRINTK_ONCE(l,c,f,a...) NV_PRINTK(l##_once,c,f, ##a)
 
-#define NV_ERROR_ONCE(drm,f,a...) NV_PRINTK_ONCE(err, &(drm)->client, f, ##a)
-#define NV_WARN_ONCE(drm,f,a...) NV_PRINTK_ONCE(warn, &(drm)->client, f, ##a)
-#define NV_INFO_ONCE(drm,f,a...) NV_PRINTK_ONCE(info, &(drm)->client, f, ##a)
+#define NV_ERROR_ONCE(drm,f,a...) NV_PRINTK_ONCE(err, &(drm)->cli, f, ##a)
+#define NV_WARN_ONCE(drm,f,a...) NV_PRINTK_ONCE(warn, &(drm)->cli, f, ##a)
+#define NV_INFO_ONCE(drm,f,a...) NV_PRINTK_ONCE(info, &(drm)->cli, f, ##a)
 
 extern int nouveau_modeset;
 
drivers/gpu/drm/nouveau/nouveau_prime.c +1 -1
index b58ab595faf8..df29c6805f4e 100644
@@ -49,7 +49,7 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev,
 	int ret;
 
 	dma_resv_lock(robj, NULL);
-	nvbo = nouveau_bo_alloc(&drm->client, &size, &align,
+	nvbo = nouveau_bo_alloc(&drm->cli, &size, &align,
 				NOUVEAU_GEM_DOMAIN_GART, 0, 0, true);
 	if (IS_ERR(nvbo)) {
 		obj = ERR_CAST(nvbo);
drivers/gpu/drm/nouveau/nouveau_ttm.c +2 -2
index 5b0f78e48cc7..f4224ebb38b2 100644
@@ -159,7 +159,7 @@ const struct ttm_resource_manager_func nv04_gart_manager = {
 static int
 nouveau_ttm_init_host(struct nouveau_drm *drm, u8 kind)
 {
-	struct nvif_mmu *mmu = &drm->client.mmu;
+	struct nvif_mmu *mmu = &drm->cli.mmu;
 	int typei;
 
 	typei = nvif_mmu_type(mmu, NVIF_MEM_HOST | NVIF_MEM_MAPPABLE |
@@ -262,7 +262,7 @@ nouveau_ttm_init(struct nouveau_drm *drm)
 {
 	struct nvkm_device *device = nvxx_device(drm);
 	struct nvkm_pci *pci = device->pci;
-	struct nvif_mmu *mmu = &drm->client.mmu;
+	struct nvif_mmu *mmu = &drm->cli.mmu;
 	struct drm_device *dev = drm->dev;
 	int typei, ret;
 
drivers/gpu/drm/nouveau/nv17_fence.c +1 -1
index ba499dfb621d..94975d988002 100644
@@ -129,7 +129,7 @@ nv17_fence_create(struct nouveau_drm *drm)
 	priv->base.context_del = nv10_fence_context_del;
 	spin_lock_init(&priv->lock);
 
-	ret = nouveau_bo_new(&drm->client, 4096, 0x1000,
+	ret = nouveau_bo_new(&drm->cli, 4096, 0x1000,
 			     NOUVEAU_GEM_DOMAIN_VRAM,
 			     0, 0x0000, NULL, NULL, &priv->bo);
 	if (!ret) {
drivers/gpu/drm/nouveau/nv50_fence.c +1 -1
index 405a3f8ff4d4..f34ce93ff2ab 100644
@@ -80,7 +80,7 @@ nv50_fence_create(struct nouveau_drm *drm)
 	priv->base.context_del = nv10_fence_context_del;
 	spin_lock_init(&priv->lock);
 
-	ret = nouveau_bo_new(&drm->client, 4096, 0x1000,
+	ret = nouveau_bo_new(&drm->cli, 4096, 0x1000,
 			     NOUVEAU_GEM_DOMAIN_VRAM,
 			     0, 0x0000, NULL, NULL, &priv->bo);
 	if (!ret) {
drivers/gpu/drm/nouveau/nv84_fence.c +1 -1
index 4b107c1a5686..c4ff1d2c9823 100644
@@ -222,7 +222,7 @@ nv84_fence_create(struct nouveau_drm *drm)
 		  * will lose CPU/GPU coherency!
 		  */
 		NOUVEAU_GEM_DOMAIN_GART | NOUVEAU_GEM_DOMAIN_COHERENT;
-	ret = nouveau_bo_new(&drm->client, 16 * drm->chan_total, 0,
+	ret = nouveau_bo_new(&drm->cli, 16 * drm->chan_total, 0,
 			     domain, 0, 0, NULL, NULL, &priv->bo);
 	if (ret == 0) {
 		ret = nouveau_bo_pin(priv->bo, domain, false);
Signature · 1 line
2.41.0