Skip to content

Commit 7aa275c

Browse files
committed
drm/nouveau: Grab payload lock in nv50_msto_payload()
Going through the currently programmed payloads isn't safe without holding mgr->payload_lock, so actually do that and warn if anyone tries calling nv50_msto_payload() in the future without grabbing the right locks. Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Ben Skeggs <bskeggs@redhat.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@redhat.com> Cc: Jerry Zuo <Jerry.Zuo@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Juston Li <juston.li@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190111005343.17443-17-lyude@redhat.com
1 parent d79a3c5 commit 7aa275c

File tree

1 file changed

+6
-0
lines changed
  • drivers/gpu/drm/nouveau/dispnv50

1 file changed

+6
-0
lines changed

drivers/gpu/drm/nouveau/dispnv50/disp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,8 @@ nv50_msto_payload(struct nv50_msto *msto)
672672
struct nv50_mstm *mstm = mstc->mstm;
673673
int vcpi = mstc->port->vcpi.vcpi, i;
674674

675+
WARN_ON(!mutex_is_locked(&mstm->mgr.payload_lock));
676+
675677
NV_ATOMIC(drm, "%s: vcpi %d\n", msto->encoder.name, vcpi);
676678
for (i = 0; i < mstm->mgr.max_payloads; i++) {
677679
struct drm_dp_payload *payload = &mstm->mgr.payloads[i];
@@ -725,6 +727,8 @@ nv50_msto_prepare(struct nv50_msto *msto)
725727
(0x0100 << msto->head->base.index),
726728
};
727729

730+
mutex_lock(&mstm->mgr.payload_lock);
731+
728732
NV_ATOMIC(drm, "%s: msto prepare\n", msto->encoder.name);
729733
if (mstc->port->vcpi.vcpi > 0) {
730734
struct drm_dp_payload *payload = nv50_msto_payload(msto);
@@ -740,7 +744,9 @@ nv50_msto_prepare(struct nv50_msto *msto)
740744
msto->encoder.name, msto->head->base.base.name,
741745
args.vcpi.start_slot, args.vcpi.num_slots,
742746
args.vcpi.pbn, args.vcpi.aligned_pbn);
747+
743748
nvif_mthd(&drm->display->disp.object, 0, &args, sizeof(args));
749+
mutex_unlock(&mstm->mgr.payload_lock);
744750
}
745751

746752
static int

0 commit comments

Comments
 (0)