Skip to content

Commit f66d84c

Browse files
committed
Merge tag 'drm-misc-fixes-2020-01-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
virtio: maintain obj reservation lock when submitting cmds (Gerd) rockchip: increase link rate var size to accommodate rates (Tobias) mst: serialize down messages and clear timeslots are on unplug (Wayne) Cc: Gerd Hoffmann <[email protected]> Cc: Tobias Schramm <[email protected]> Cc: Wayne Lin <[email protected]> Signed-off-by: Dave Airlie <[email protected]> From: Sean Paul <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20200116162856.GA11524@art_vandelay
2 parents e33c7ba + 5a64967 commit f66d84c

File tree

4 files changed

+44
-4
lines changed

4 files changed

+44
-4
lines changed

drivers/gpu/drm/drm_dp_mst_topology.c

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,8 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
11901190
txmsg->state == DRM_DP_SIDEBAND_TX_SENT) {
11911191
mstb->tx_slots[txmsg->seqno] = NULL;
11921192
}
1193+
mgr->is_waiting_for_dwn_reply = false;
1194+
11931195
}
11941196
out:
11951197
if (unlikely(ret == -EIO) && drm_debug_enabled(DRM_UT_DP)) {
@@ -1199,6 +1201,7 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
11991201
}
12001202
mutex_unlock(&mgr->qlock);
12011203

1204+
drm_dp_mst_kick_tx(mgr);
12021205
return ret;
12031206
}
12041207

@@ -2318,7 +2321,7 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
23182321
{
23192322
struct drm_dp_mst_topology_mgr *mgr = mstb->mgr;
23202323
struct drm_dp_mst_port *port;
2321-
int old_ddps, ret;
2324+
int old_ddps, old_input, ret, i;
23222325
u8 new_pdt;
23232326
bool dowork = false, create_connector = false;
23242327

@@ -2349,6 +2352,7 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
23492352
}
23502353

23512354
old_ddps = port->ddps;
2355+
old_input = port->input;
23522356
port->input = conn_stat->input_port;
23532357
port->mcs = conn_stat->message_capability_status;
23542358
port->ldps = conn_stat->legacy_device_plug_status;
@@ -2373,6 +2377,28 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
23732377
dowork = false;
23742378
}
23752379

2380+
if (!old_input && old_ddps != port->ddps && !port->ddps) {
2381+
for (i = 0; i < mgr->max_payloads; i++) {
2382+
struct drm_dp_vcpi *vcpi = mgr->proposed_vcpis[i];
2383+
struct drm_dp_mst_port *port_validated;
2384+
2385+
if (!vcpi)
2386+
continue;
2387+
2388+
port_validated =
2389+
container_of(vcpi, struct drm_dp_mst_port, vcpi);
2390+
port_validated =
2391+
drm_dp_mst_topology_get_port_validated(mgr, port_validated);
2392+
if (!port_validated) {
2393+
mutex_lock(&mgr->payload_lock);
2394+
vcpi->num_slots = 0;
2395+
mutex_unlock(&mgr->payload_lock);
2396+
} else {
2397+
drm_dp_mst_topology_put_port(port_validated);
2398+
}
2399+
}
2400+
}
2401+
23762402
if (port->connector)
23772403
drm_modeset_unlock(&mgr->base.lock);
23782404
else if (create_connector)
@@ -2718,9 +2744,11 @@ static void process_single_down_tx_qlock(struct drm_dp_mst_topology_mgr *mgr)
27182744
ret = process_single_tx_qlock(mgr, txmsg, false);
27192745
if (ret == 1) {
27202746
/* txmsg is sent it should be in the slots now */
2747+
mgr->is_waiting_for_dwn_reply = true;
27212748
list_del(&txmsg->next);
27222749
} else if (ret) {
27232750
DRM_DEBUG_KMS("failed to send msg in q %d\n", ret);
2751+
mgr->is_waiting_for_dwn_reply = false;
27242752
list_del(&txmsg->next);
27252753
if (txmsg->seqno != -1)
27262754
txmsg->dst->tx_slots[txmsg->seqno] = NULL;
@@ -2760,7 +2788,8 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
27602788
drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
27612789
}
27622790

2763-
if (list_is_singular(&mgr->tx_msg_downq))
2791+
if (list_is_singular(&mgr->tx_msg_downq) &&
2792+
!mgr->is_waiting_for_dwn_reply)
27642793
process_single_down_tx_qlock(mgr);
27652794
mutex_unlock(&mgr->qlock);
27662795
}
@@ -3678,6 +3707,7 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
36783707
mutex_lock(&mgr->qlock);
36793708
txmsg->state = DRM_DP_SIDEBAND_TX_RX;
36803709
mstb->tx_slots[slot] = NULL;
3710+
mgr->is_waiting_for_dwn_reply = false;
36813711
mutex_unlock(&mgr->qlock);
36823712

36833713
wake_up_all(&mgr->tx_waitq);
@@ -3687,6 +3717,9 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
36873717
no_msg:
36883718
drm_dp_mst_topology_put_mstb(mstb);
36893719
clear_down_rep_recv:
3720+
mutex_lock(&mgr->qlock);
3721+
mgr->is_waiting_for_dwn_reply = false;
3722+
mutex_unlock(&mgr->qlock);
36903723
memset(&mgr->down_rep_recv, 0, sizeof(struct drm_dp_sideband_msg_rx));
36913724

36923725
return 0;
@@ -4497,7 +4530,7 @@ static void drm_dp_tx_work(struct work_struct *work)
44974530
struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, tx_work);
44984531

44994532
mutex_lock(&mgr->qlock);
4500-
if (!list_empty(&mgr->tx_msg_downq))
4533+
if (!list_empty(&mgr->tx_msg_downq) && !mgr->is_waiting_for_dwn_reply)
45014534
process_single_down_tx_qlock(mgr);
45024535
mutex_unlock(&mgr->qlock);
45034536
}

drivers/gpu/drm/rockchip/cdn-dp-core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct cdn_dp_device {
9595
struct cdn_dp_port *port[MAX_PHY];
9696
u8 ports;
9797
u8 max_lanes;
98-
u8 max_rate;
98+
unsigned int max_rate;
9999
u8 lanes;
100100
int active_port;
101101

drivers/gpu/drm/virtio/virtgpu_plane.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
232232
if (!objs)
233233
return;
234234
virtio_gpu_array_add_obj(objs, vgfb->base.obj[0]);
235+
virtio_gpu_array_lock_resv(objs);
235236
virtio_gpu_cmd_transfer_to_host_2d
236237
(vgdev, 0,
237238
plane->state->crtc_w,

include/drm/drm_dp_mst_helper.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,12 @@ struct drm_dp_mst_topology_mgr {
605605
* &drm_dp_sideband_msg_tx.state once they are queued
606606
*/
607607
struct mutex qlock;
608+
609+
/**
610+
* @is_waiting_for_dwn_reply: indicate whether is waiting for down reply
611+
*/
612+
bool is_waiting_for_dwn_reply;
613+
608614
/**
609615
* @tx_msg_downq: List of pending down replies.
610616
*/

0 commit comments

Comments
 (0)