drm/nouveau/pmu: serialise send() 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:
parent
5ec69c91e7
commit
5a479d4565
@ -18,6 +18,7 @@ struct nvkm_pmu {
|
||||
struct completion wpr_ready;
|
||||
|
||||
struct {
|
||||
struct mutex mutex;
|
||||
u32 base;
|
||||
u32 size;
|
||||
} send;
|
||||
|
@ -148,6 +148,7 @@ nvkm_pmu_dtor(struct nvkm_subdev *subdev)
|
||||
nvkm_falcon_cmdq_del(&pmu->hpq);
|
||||
nvkm_falcon_qmgr_del(&pmu->qmgr);
|
||||
nvkm_falcon_dtor(&pmu->falcon);
|
||||
mutex_destroy(&pmu->send.mutex);
|
||||
return nvkm_pmu(subdev);
|
||||
}
|
||||
|
||||
@ -168,6 +169,8 @@ nvkm_pmu_ctor(const struct nvkm_pmu_fwif *fwif, struct nvkm_device *device,
|
||||
|
||||
nvkm_subdev_ctor(&nvkm_pmu, device, index, &pmu->subdev);
|
||||
|
||||
mutex_init(&pmu->send.mutex);
|
||||
|
||||
INIT_WORK(&pmu->recv.work, nvkm_pmu_recv);
|
||||
init_waitqueue_head(&pmu->recv.wait);
|
||||
|
||||
|
@ -34,7 +34,7 @@ gt215_pmu_send(struct nvkm_pmu *pmu, u32 reply[2],
|
||||
struct nvkm_device *device = subdev->device;
|
||||
u32 addr;
|
||||
|
||||
mutex_lock(&subdev->mutex);
|
||||
mutex_lock(&pmu->send.mutex);
|
||||
/* wait for a free slot in the fifo */
|
||||
addr = nvkm_rd32(device, 0x10a4a0);
|
||||
if (nvkm_msec(device, 2000,
|
||||
@ -42,7 +42,7 @@ gt215_pmu_send(struct nvkm_pmu *pmu, u32 reply[2],
|
||||
if (tmp != (addr ^ 8))
|
||||
break;
|
||||
) < 0) {
|
||||
mutex_unlock(&subdev->mutex);
|
||||
mutex_unlock(&pmu->send.mutex);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ gt215_pmu_send(struct nvkm_pmu *pmu, u32 reply[2],
|
||||
reply[1] = pmu->recv.data[1];
|
||||
}
|
||||
|
||||
mutex_unlock(&subdev->mutex);
|
||||
mutex_unlock(&pmu->send.mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user