Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0a49bac authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Ben Skeggs
Browse files

drm/nouveau/ltc/gf100: add flush/invalidate functions



Allow clients to manually flush and invalidate L2. This will be useful
for Tegra systems for which we want to write instmem using the CPU.

Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 38a8fc78
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35,5 +35,6 @@ void nvkm_ltc_flush(struct nvkm_ltc *);

int gf100_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
int gk104_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
int gk20a_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
int gm107_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
#endif
+32 −0
Original line number Diff line number Diff line
@@ -122,6 +122,36 @@ gf100_ltc_intr(struct nvkm_ltc *ltc)
	}
}

void
gf100_ltc_invalidate(struct nvkm_ltc *ltc)
{
	struct nvkm_device *device = ltc->subdev.device;
	s64 taken;

	nvkm_wr32(device, 0x70004, 0x00000001);
	taken = nvkm_wait_msec(device, 2, 0x70004, 0x00000003, 0x00000000);
	if (taken < 0)
		nvkm_warn(&ltc->subdev, "LTC invalidate timeout\n");

	if (taken > 0)
		nvkm_debug(&ltc->subdev, "LTC invalidate took %lld ns\n", taken);
}

void
gf100_ltc_flush(struct nvkm_ltc *ltc)
{
	struct nvkm_device *device = ltc->subdev.device;
	s64 taken;

	nvkm_wr32(device, 0x70010, 0x00000001);
	taken = nvkm_wait_msec(device, 2, 0x70010, 0x00000003, 0x00000000);
	if (taken < 0)
		nvkm_warn(&ltc->subdev, "LTC flush timeout\n");

	if (taken > 0)
		nvkm_debug(&ltc->subdev, "LTC flush took %lld ns\n", taken);
}

/* TODO: Figure out tag memory details and drop the over-cautious allocation.
 */
int
@@ -215,6 +245,8 @@ gf100_ltc = {
	.zbc = 16,
	.zbc_clear_color = gf100_ltc_zbc_clear_color,
	.zbc_clear_depth = gf100_ltc_zbc_clear_depth,
	.invalidate = gf100_ltc_invalidate,
	.flush = gf100_ltc_flush,
};

int
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ gk104_ltc = {
	.zbc = 16,
	.zbc_clear_color = gf100_ltc_zbc_clear_color,
	.zbc_clear_depth = gf100_ltc_zbc_clear_depth,
	.invalidate = gf100_ltc_invalidate,
	.flush = gf100_ltc_flush,
};

int
+2 −0
Original line number Diff line number Diff line
@@ -138,6 +138,8 @@ gm107_ltc = {
	.zbc = 16,
	.zbc_clear_color = gm107_ltc_zbc_clear_color,
	.zbc_clear_depth = gm107_ltc_zbc_clear_depth,
	.invalidate = gf100_ltc_invalidate,
	.flush = gf100_ltc_flush,
};

int
+2 −0
Original line number Diff line number Diff line
@@ -29,4 +29,6 @@ void gf100_ltc_cbc_clear(struct nvkm_ltc *, u32, u32);
void gf100_ltc_cbc_wait(struct nvkm_ltc *);
void gf100_ltc_zbc_clear_color(struct nvkm_ltc *, int, const u32[4]);
void gf100_ltc_zbc_clear_depth(struct nvkm_ltc *, int, const u32);
void gf100_ltc_invalidate(struct nvkm_ltc *);
void gf100_ltc_flush(struct nvkm_ltc *);
#endif