* [PATCH] drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply
@ 2026-09-08 13:28 Xiao Lu
0 siblings, 0 replies; only message in thread
From: Xiao Lu @ 2026-09-08 13:28 UTC (permalink / raw)
To: maarten.lankhorst, mripard, tzimmermann, airlied, simona
Cc: dri-devel, linux-kernel, Xiao Lu
The DP MST ALLOCATE_PAYLOAD sideband message returns the payload bandwidth actually allocated by the branch in the allocated_pbn field of the down-reply. That value may differ from the requested PBN when an intermediate branch applies its own constraints, so the source should keep track of it instead of only relying on the local request.
Store the allocated_pbn returned by the ALLOCATE_PAYLOAD down-reply sideband message and use the larger of requested PBN and allocated PBN for the MST bandwidth limit checks. Also carry the value across dependent atomic commits and clear it when releasing the payload, matching the lifetime of the remote allocation state.
Signed-off-by: Xiao Lu <xiaolu.xie@intel.com>
---
drivers/gpu/drm/display/drm_dp_mst_topology.c | 17 ++++++++++++-----
include/drm/display/drm_dp_mst_helper.h | 10 ++++++++++
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
index 7ce9e2127..86a42c5e2 100644
--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
@@ -3120,6 +3120,7 @@ drm_dp_get_last_connected_port_and_mstb(struct drm_dp_mst_topology_mgr *mgr,
static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port,
+ struct drm_dp_mst_atomic_payload *payload,
int id,
int pbn)
{
@@ -3166,10 +3167,14 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
*/
ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
if (ret > 0) {
- if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
+ if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
ret = -EINVAL;
- else
+ } else {
+ if (payload)
+ payload->allocated_pbn =
+ txmsg->reply.u.allocate_payload.allocated_pbn;
ret = 0;
+ }
}
kfree(txmsg);
fail_put:
@@ -3285,7 +3290,7 @@ static int drm_dp_create_payload_to_remote(struct drm_dp_mst_topology_mgr *mgr,
if (!port)
return -EIO;
- ret = drm_dp_payload_send_msg(mgr, port, payload->vcpi, payload->pbn);
+ ret = drm_dp_payload_send_msg(mgr, port, payload, payload->vcpi, payload->pbn);
drm_dp_mst_topology_put_port(port);
return ret;
}
@@ -3298,7 +3303,7 @@ static void drm_dp_destroy_payload_at_remote_and_dfp(struct drm_dp_mst_topology_
/* it's okay for these to fail */
if (payload->payload_allocation_status == DRM_DP_MST_PAYLOAD_ALLOCATION_REMOTE) {
- drm_dp_payload_send_msg(mgr, payload->port, payload->vcpi, 0);
+ drm_dp_payload_send_msg(mgr, payload->port, NULL, payload->vcpi, 0);
payload->payload_allocation_status = DRM_DP_MST_PAYLOAD_ALLOCATION_DFP;
}
@@ -4575,6 +4580,7 @@ int drm_dp_atomic_release_time_slots(struct drm_atomic_commit *state,
drm_dbg_atomic(mgr->dev, "[MST PORT:%p] TU %d -> 0\n", port, payload->time_slots);
if (!payload->delete) {
payload->pbn = 0;
+ payload->allocated_pbn = 0;
payload->delete = true;
if (payload->vcpi > 0)
topology_state->payload_mask &= ~BIT(payload->vcpi - 1);
@@ -4670,6 +4676,7 @@ void drm_dp_mst_atomic_wait_for_dependencies(struct drm_atomic_commit *state)
new_payload = drm_atomic_get_mst_payload_state(new_mst_state,
old_payload->port);
new_payload->vc_start_slot = old_payload->vc_start_slot;
+ new_payload->allocated_pbn = old_payload->allocated_pbn;
new_payload->payload_allocation_status =
old_payload->payload_allocation_status;
}
@@ -5352,7 +5359,7 @@ drm_dp_mst_atomic_check_port_bw_limit(struct drm_dp_mst_port *port,
return -EINVAL;
}
- pbn_used = payload->pbn;
+ pbn_used = max(payload->pbn, payload->allocated_pbn);
} else {
pbn_used = drm_dp_mst_atomic_check_mstb_bw_limit(port->mstb,
state,
diff --git a/include/drm/display/drm_dp_mst_helper.h b/include/drm/display/drm_dp_mst_helper.h
index 27658bfb5..1a9430a62 100644
--- a/include/drm/display/drm_dp_mst_helper.h
+++ b/include/drm/display/drm_dp_mst_helper.h
@@ -572,6 +572,16 @@ struct drm_dp_mst_atomic_payload {
int time_slots;
/** @pbn: The payload bandwidth for this payload */
int pbn;
+ /**
+ * @allocated_pbn: The payload bandwidth actually confirmed by the
+ * branch device in the ALLOCATE_PAYLOAD reply. Each MST branch along
+ * the path overrides this field to the maximum of the requested and
+ * its own constrained value, so the value received by the source
+ * reflects the tightest bottleneck along the entire path.
+ * Used instead of @pbn for bandwidth limit checks so that the source
+ * accounts for any per-hop adjustments made by intermediate branches.
+ */
+ int allocated_pbn;
/** @delete: Whether or not we intend to delete this payload during this atomic commit */
bool delete : 1;
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-08 13:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 13:28 [PATCH] drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply Xiao Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®