Commit 55e1a599 authored by Ben Skeggs's avatar Ben Skeggs Committed by Karol Herbst
Browse files

drm/nouveau/fifo/ga100-: add per-runlist nonstall intr handling



GSP-RM will enforce this, so implement on HW too so we can share code.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarKarol Herbst <kherbst@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230525003106.3853741-8-skeggsb@gmail.com
parent 84ab065e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ struct nvkm_engine_func {
	int (*init)(struct nvkm_engine *);
	int (*fini)(struct nvkm_engine *, bool suspend);
	int (*reset)(struct nvkm_engine *);
	int (*nonstall)(struct nvkm_engine *);
	void (*intr)(struct nvkm_engine *);
	void (*tile)(struct nvkm_engine *, int region, struct nvkm_fb_tile *);
	bool (*chsw_load)(struct nvkm_engine *);
+10 −0
Original line number Diff line number Diff line
@@ -35,6 +35,15 @@ ga100_ce_intr(struct nvkm_inth *inth)
	return IRQ_NONE;
}

int
ga100_ce_nonstall(struct nvkm_engine *engine)
{
	struct nvkm_subdev *subdev = &engine->subdev;
	struct nvkm_device *device = subdev->device;

	return nvkm_rd32(device, 0x104424 + (subdev->inst * 0x80)) & 0x00000fff;
}

int
ga100_ce_fini(struct nvkm_engine *engine, bool suspend)
{
@@ -67,6 +76,7 @@ ga100_ce = {
	.oneinit = ga100_ce_oneinit,
	.init = ga100_ce_init,
	.fini = ga100_ce_fini,
	.nonstall = ga100_ce_nonstall,
	.cclass = &gv100_ce_cclass,
	.sclass = {
		{ -1, -1, AMPERE_DMA_COPY_A },
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ ga102_ce = {
	.oneinit = ga100_ce_oneinit,
	.init = ga100_ce_init,
	.fini = ga100_ce_fini,
	.nonstall = ga100_ce_nonstall,
	.cclass = &gv100_ce_cclass,
	.sclass = {
		{ -1, -1, AMPERE_DMA_COPY_A },
+1 −0
Original line number Diff line number Diff line
@@ -12,4 +12,5 @@ extern const struct nvkm_object_func gv100_ce_cclass;
int ga100_ce_oneinit(struct nvkm_engine *);
int ga100_ce_init(struct nvkm_engine *);
int ga100_ce_fini(struct nvkm_engine *, bool);
int ga100_ce_nonstall(struct nvkm_engine *);
#endif
+15 −17
Original line number Diff line number Diff line
@@ -283,11 +283,21 @@ nvkm_fifo_oneinit(struct nvkm_engine *engine)
	}

	/* Initialise non-stall intr handling. */
	if (fifo->func->nonstall) {
		if (fifo->func->nonstall_ctor) {
			ret = fifo->func->nonstall_ctor(fifo);
		if (ret) {
			if (ret < 0) {
				nvkm_error(subdev, "nonstall %d\n", ret);
				return ret;
			}
		} else {
			ret = 1;
		}

		ret = nvkm_event_init(fifo->func->nonstall, &fifo->engine.subdev, 1, ret,
				      &fifo->nonstall.event);
		if (ret)
			return ret;
	}

	/* Allocate USERD + BAR1 polling area. */
@@ -358,7 +368,6 @@ nvkm_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device,
	       enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo)
{
	struct nvkm_fifo *fifo;
	int ret;

	if (!(fifo = *pfifo = kzalloc(sizeof(*fifo), GFP_KERNEL)))
		return -ENOMEM;
@@ -374,16 +383,5 @@ nvkm_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device,
	spin_lock_init(&fifo->lock);
	mutex_init(&fifo->mutex);

	ret = nvkm_engine_ctor(&nvkm_fifo, device, type, inst, true, &fifo->engine);
	if (ret)
		return ret;

	if (func->nonstall) {
		ret = nvkm_event_init(func->nonstall, &fifo->engine.subdev, 1, 1,
				      &fifo->nonstall.event);
		if (ret)
			return ret;
	}

	return 0;
	return nvkm_engine_ctor(&nvkm_fifo, device, type, inst, true, &fifo->engine);
}
Loading