Commit d3e7a439 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/fifo: add RAMIN info to nvkm_chan_func



Currently provided by {chan,dma,gpfifo}*.c, and those are going away.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent b084fff2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ struct nvkm_chan {
	struct nvkm_cgrp *cgrp;
	int runq;

	struct nvkm_gpuobj *inst;
	struct nvkm_vmm *vmm;
	union { int id; int chid; }; /*FIXME: remove later */

	spinlock_t lock;
@@ -31,9 +33,7 @@ struct nvkm_chan {
	struct nvkm_object object;

	struct list_head head;
	struct nvkm_gpuobj *inst;
	struct nvkm_gpuobj *push;
	struct nvkm_vmm *vmm;
	u64 addr;
	u32 size;

+23 −18
Original line number Diff line number Diff line
@@ -602,39 +602,44 @@ nvkm_fifo_chan_ctor(const struct nvkm_fifo_chan_func *fn,
		chan->cgrp = nvkm_cgrp_ref(cgrp);
	}

	/* instance memory */
	ret = nvkm_gpuobj_new(device, size, align, zero, NULL, &chan->inst);
	if (ret)
		return ret;

	/* allocate push buffer ctxdma instance */
	if (push) {
		dmaobj = nvkm_dmaobj_search(client, push);
		if (IS_ERR(dmaobj))
			return PTR_ERR(dmaobj);

		ret = nvkm_object_bind(&dmaobj->object, chan->inst, -16,
				       &chan->push);
		if (ret)
	/* Allocate instance block. */
	ret = nvkm_gpuobj_new(device, func->inst->size, 0x1000, func->inst->zero, NULL,
			      &chan->inst);
	if (ret) {
		RUNL_DEBUG(runl, "inst %d", ret);
		return ret;
	}

	/* channel address space */
	if (hvmm) {
	/* Initialise virtual address-space. */
	if (func->inst->vmm) {
		struct nvkm_vmm *vmm = nvkm_uvmm_search(client, hvmm);
		if (IS_ERR(vmm))
			return PTR_ERR(vmm);

		if (vmm->mmu != device->mmu)
		if (WARN_ON(vmm->mmu != device->mmu))
			return -EINVAL;

		ret = nvkm_vmm_join(vmm, chan->inst->memory);
		if (ret)
		if (ret) {
			RUNL_DEBUG(runl, "vmm %d", ret);
			return ret;
		}

		chan->vmm = nvkm_vmm_ref(vmm);
	}

	/* allocate push buffer ctxdma instance */
	if (push) {
		dmaobj = nvkm_dmaobj_search(client, push);
		if (IS_ERR(dmaobj))
			return PTR_ERR(dmaobj);

		ret = nvkm_object_bind(&dmaobj->object, chan->inst, -16,
				       &chan->push);
		if (ret)
			return ret;
	}

	/* Allocate channel ID. */
	chan->id = nvkm_chid_get(runl->chid, chan);
	if (chan->id < 0) {
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,12 @@ struct nvkm_cctx {
};

struct nvkm_chan_func {
	const struct nvkm_chan_func_inst {
		u32 size;
		bool zero;
		bool vmm;
	} *inst;

	void (*bind)(struct nvkm_chan *);
	void (*unbind)(struct nvkm_chan *);
	void (*start)(struct nvkm_chan *);
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ g84_chan_bind(struct nvkm_chan *chan)

const struct nvkm_chan_func
g84_chan = {
	.inst = &nv50_chan_inst,
	.bind = g84_chan_bind,
	.unbind = nv50_chan_unbind,
	.start = nv50_chan_start,
+8 −0
Original line number Diff line number Diff line
@@ -82,8 +82,16 @@ gf100_chan_bind(struct nvkm_chan *chan)
	nvkm_wr32(device, 0x003000 + (chan->id * 8), 0xc0000000 | chan->inst->addr >> 12);
}

const struct nvkm_chan_func_inst
gf100_chan_inst = {
	.size = 0x1000,
	.zero = true,
	.vmm = true,
};

static const struct nvkm_chan_func
gf100_chan = {
	.inst = &gf100_chan_inst,
	.bind = gf100_chan_bind,
	.unbind = gf100_chan_unbind,
	.start = gf100_chan_start,
Loading