drm/nouveau/ltc: serialise cbc operations with private mutex
nvkm_subdev.mutex is going away. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
This commit is contained in:
@@ -13,6 +13,7 @@ struct nvkm_ltc {
|
|||||||
u32 ltc_nr;
|
u32 ltc_nr;
|
||||||
u32 lts_nr;
|
u32 lts_nr;
|
||||||
|
|
||||||
|
struct mutex mutex; /* serialises CBC operations */
|
||||||
u32 num_tags;
|
u32 num_tags;
|
||||||
u32 tag_base;
|
u32 tag_base;
|
||||||
struct nvkm_memory *tag_ram;
|
struct nvkm_memory *tag_ram;
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ nvkm_ltc_tags_clear(struct nvkm_device *device, u32 first, u32 count)
|
|||||||
|
|
||||||
BUG_ON((first > limit) || (limit >= ltc->num_tags));
|
BUG_ON((first > limit) || (limit >= ltc->num_tags));
|
||||||
|
|
||||||
mutex_lock(<c->subdev.mutex);
|
mutex_lock(<c->mutex);
|
||||||
ltc->func->cbc_clear(ltc, first, limit);
|
ltc->func->cbc_clear(ltc, first, limit);
|
||||||
ltc->func->cbc_wait(ltc);
|
ltc->func->cbc_wait(ltc);
|
||||||
mutex_unlock(<c->subdev.mutex);
|
mutex_unlock(<c->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -113,6 +113,7 @@ nvkm_ltc_dtor(struct nvkm_subdev *subdev)
|
|||||||
{
|
{
|
||||||
struct nvkm_ltc *ltc = nvkm_ltc(subdev);
|
struct nvkm_ltc *ltc = nvkm_ltc(subdev);
|
||||||
nvkm_memory_unref(<c->tag_ram);
|
nvkm_memory_unref(<c->tag_ram);
|
||||||
|
mutex_destroy(<c->mutex);
|
||||||
return ltc;
|
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, <c->subdev);
|
nvkm_subdev_ctor(&nvkm_ltc, device, index, <c->subdev);
|
||||||
ltc->func = func;
|
ltc->func = func;
|
||||||
|
mutex_init(<c->mutex);
|
||||||
ltc->zbc_min = 1; /* reserve 0 for disabled */
|
ltc->zbc_min = 1; /* reserve 0 for disabled */
|
||||||
ltc->zbc_max = min(func->zbc, NVKM_LTC_MAX_ZBC_CNT) - 1;
|
ltc->zbc_max = min(func->zbc, NVKM_LTC_MAX_ZBC_CNT) - 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user