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

drm/nouveau/ltc: serialise cbc operations with private mutex



nvkm_subdev.mutex is going away.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent e5bf9a5c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ struct nvkm_ltc {
	u32 ltc_nr;
	u32 lts_nr;

	struct mutex mutex; /* serialises CBC operations */
	u32 num_tags;
	u32 tag_base;
	struct nvkm_memory *tag_ram;
+4 −2
Original line number Diff line number Diff line
@@ -33,10 +33,10 @@ nvkm_ltc_tags_clear(struct nvkm_device *device, u32 first, u32 count)

	BUG_ON((first > limit) || (limit >= ltc->num_tags));

	mutex_lock(&ltc->subdev.mutex);
	mutex_lock(&ltc->mutex);
	ltc->func->cbc_clear(ltc, first, limit);
	ltc->func->cbc_wait(ltc);
	mutex_unlock(&ltc->subdev.mutex);
	mutex_unlock(&ltc->mutex);
}

int
@@ -113,6 +113,7 @@ nvkm_ltc_dtor(struct nvkm_subdev *subdev)
{
	struct nvkm_ltc *ltc = nvkm_ltc(subdev);
	nvkm_memory_unref(&ltc->tag_ram);
	mutex_destroy(&ltc->mutex);
	return ltc;
}

@@ -135,6 +136,7 @@ nvkm_ltc_new_(const struct nvkm_ltc_func *func, struct nvkm_device *device,

	nvkm_subdev_ctor(&nvkm_ltc, device, index, &ltc->subdev);
	ltc->func = func;
	mutex_init(&ltc->mutex);
	ltc->zbc_min = 1; /* reserve 0 for disabled */
	ltc->zbc_max = min(func->zbc, NVKM_LTC_MAX_ZBC_CNT) - 1;
	return 0;