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

drm/nouveau/gr/gf100-: call FECS HALT_PIPE method before RC reset



Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 6762510b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -135,6 +135,17 @@ nvkm_gr_oneinit(struct nvkm_engine *engine)
	return 0;
}

static int
nvkm_gr_reset(struct nvkm_engine *engine)
{
	struct nvkm_gr *gr = nvkm_gr(engine);

	if (gr->func->reset)
		return gr->func->reset(gr);

	return -ENOSYS;
}

static int
nvkm_gr_init(struct nvkm_engine *engine)
{
@@ -166,6 +177,7 @@ nvkm_gr = {
	.oneinit = nvkm_gr_oneinit,
	.init = nvkm_gr_init,
	.fini = nvkm_gr_fini,
	.reset = nvkm_gr_reset,
	.intr = nvkm_gr_intr,
	.tile = nvkm_gr_tile,
	.chsw_load = nvkm_gr_chsw_load,
+33 −0
Original line number Diff line number Diff line
@@ -796,6 +796,20 @@ gf100_gr_fecs_stop_ctxsw(struct nvkm_gr *base)
	return ret;
}

static int
gf100_gr_fecs_halt_pipeline(struct gf100_gr *gr)
{
	int ret = 0;

	if (gr->firmware) {
		mutex_lock(&gr->fecs.mutex);
		ret = gf100_gr_fecs_ctrl_ctxsw(gr, 0x04);
		mutex_unlock(&gr->fecs.mutex);
	}

	return ret;
}

int
gf100_gr_fecs_wfi_golden_save(struct gf100_gr *gr, u32 inst)
{
@@ -2247,6 +2261,24 @@ gf100_gr_init_vsc_stream_master(struct gf100_gr *gr)
	nvkm_mask(device, TPC_UNIT(0, 0, 0x05c), 0x00000001, 0x00000001);
}

static int
gf100_gr_reset(struct nvkm_gr *base)
{
	struct nvkm_subdev *subdev = &base->engine.subdev;
	struct nvkm_device *device = subdev->device;
	struct gf100_gr *gr = gf100_gr(base);

	nvkm_mask(device, 0x400500, 0x00000001, 0x00000000);

	WARN_ON(gf100_gr_fecs_halt_pipeline(gr));

	subdev->func->fini(subdev, false);
	nvkm_mc_disable(device, subdev->type, subdev->inst);

	nvkm_mc_enable(device, subdev->type, subdev->inst);
	return subdev->func->init(subdev);
}

int
gf100_gr_init(struct gf100_gr *gr)
{
@@ -2392,6 +2424,7 @@ gf100_gr_ = {
	.oneinit = gf100_gr_oneinit,
	.init = gf100_gr_init_,
	.fini = gf100_gr_fini,
	.reset = gf100_gr_reset,
	.intr = gf100_gr_intr,
	.units = gf100_gr_units,
	.chan_new = gf100_gr_chan_new,
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ struct nvkm_gr_func {
	int (*oneinit)(struct nvkm_gr *);
	int (*init)(struct nvkm_gr *);
	int (*fini)(struct nvkm_gr *, bool);
	int (*reset)(struct nvkm_gr *);
	void (*intr)(struct nvkm_gr *);
	void (*tile)(struct nvkm_gr *, int region, struct nvkm_fb_tile *);
	int (*tlb_flush)(struct nvkm_gr *);