Commit 6762510b authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/gr/gf100-: call FECS WFI_GOLDEN_SAVE method



This won't work on Ampere, and, it's questionable whether we should have
been using our FW's method of storing the golden context image with NV's
firmware to begin with.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 6c55b594
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -1496,6 +1496,7 @@ gf100_grctx_generate(struct gf100_gr *gr, struct gf100_gr_chan *chan, struct nvk

	grctx->main(chan);

	if (!gr->firmware) {
		/* Trigger a context unload by unsetting the "next channel valid" bit
		 * and faking a context switch interrupt.
		 */
@@ -1508,6 +1509,13 @@ gf100_grctx_generate(struct gf100_gr *gr, struct gf100_gr_chan *chan, struct nvk
			ret = -EBUSY;
			goto done_inst;
		}
	} else {
		ret = gf100_gr_fecs_wfi_golden_save(gr, 0x80000000 | addr);
		if (ret)
			goto done_inst;

		nvkm_mask(device, 0x409b00, 0x80000000, 0x00000000);
	}

	gr->data = kmalloc(gr->size, GFP_KERNEL);
	if (gr->data) {
+19 −0
Original line number Diff line number Diff line
@@ -796,6 +796,25 @@ gf100_gr_fecs_stop_ctxsw(struct nvkm_gr *base)
	return ret;
}

int
gf100_gr_fecs_wfi_golden_save(struct gf100_gr *gr, u32 inst)
{
	struct nvkm_device *device = gr->base.engine.subdev.device;

	nvkm_mask(device, 0x409800, 0x00000003, 0x00000000);
	nvkm_wr32(device, 0x409500, inst);
	nvkm_wr32(device, 0x409504, 0x00000009);
	nvkm_msec(device, 2000,
		u32 stat = nvkm_rd32(device, 0x409800);
		if (stat & 0x00000002)
			return -EIO;
		if (stat & 0x00000001)
			return 0;
	);

	return -ETIMEDOUT;
}

int
gf100_gr_fecs_bind_pointer(struct gf100_gr *gr, u32 inst)
{
+1 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ struct gf100_gr {
};

int gf100_gr_fecs_bind_pointer(struct gf100_gr *, u32 inst);
int gf100_gr_fecs_wfi_golden_save(struct gf100_gr *, u32 inst);

struct gf100_gr_func_zbc {
	void (*clear_color)(struct gf100_gr *, int zbc);