Commit 5a479d45 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/pmu: serialise send() 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 5ec69c91
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment