<div dir="ltr">I can for this patch; I'm not really sure of the right approach for the other two though.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 3 Feb 2021 at 20:57, Hans Verkuil <<a href="mailto:hverkuil@xs4all.nl">hverkuil@xs4all.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Sam,<br>
<br>
Are you able to work on a v4?<br>
<br>
I haven't heard from you for some time now. I would be willing to take over<br>
this series if it wasn't for the fact that I do not have any hardware to test<br>
this with.<br>
<br>
Regards,<br>
<br>
        Hans<br>
<br>
On 01/02/2021 22:56, Lyude Paul wrote:<br>
> On Wed, 2020-09-23 at 12:13 +1000, Sam McNally wrote:<br>
>> Sink event notify messages are used for MST CEC IRQs. Add parsing<br>
>> support for sink event notify messages in preparation for handling MST<br>
>> CEC IRQs.<br>
>><br>
>> Signed-off-by: Sam McNally <<a href="mailto:sammc@chromium.org" target="_blank">sammc@chromium.org</a>><br>
>> ---<br>
>><br>
>> (no changes since v1)<br>
>><br>
>>  drivers/gpu/drm/drm_dp_mst_topology.c | 37 ++++++++++++++++++++++++++-<br>
>>  include/drm/drm_dp_mst_helper.h       | 14 ++++++++++<br>
>>  2 files changed, 50 insertions(+), 1 deletion(-)<br>
>><br>
>> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c<br>
>> b/drivers/gpu/drm/drm_dp_mst_topology.c<br>
>> index 17dbed0a9800..15b6cc39a754 100644<br>
>> --- a/drivers/gpu/drm/drm_dp_mst_topology.c<br>
>> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c<br>
>> @@ -1027,6 +1027,30 @@ static bool<br>
>> drm_dp_sideband_parse_resource_status_notify(struct drm_dp_sideband_<br>
>>         return false;<br>
>>  }<br>
>>  <br>
>> +static bool drm_dp_sideband_parse_sink_event_notify(<br>
>> +       struct drm_dp_sideband_msg_rx *raw,<br>
>> +       struct drm_dp_sideband_msg_req_body *msg)<br>
>> +{<br>
>> +       int idx = 1;<br>
>> +<br>
>> +       msg->u.sink_event.port_number = (raw->msg[idx] & 0xf0) >> 4;<br>
>> +       idx++;<br>
>> +       if (idx > raw->curlen)<br>
>> +               goto fail_len;<br>
>> +<br>
>> +       memcpy(msg->u.sink_event.guid, &raw->msg[idx], 16);<br>
>> +       idx += 16;<br>
>> +       if (idx > raw->curlen)<br>
>> +               goto fail_len;<br>
>> +<br>
>> +       msg->u.sink_event.event_id = (raw->msg[idx] << 8) | (raw->msg[idx +<br>
>> 1]);<br>
>> +       idx++;<br>
>> +       return true;<br>
>> +fail_len:<br>
>> +       DRM_DEBUG_KMS("sink event notify parse length fail %d %d\n", idx, raw-<br>
>>> curlen);<br>
> <br>
> Is it possible for us to use drm_dbg_kms() here?<br>
> <br>
> Also-there is an MST selftest you should update for this<br>
> <br>
>> +       return false;<br>
>> +}<br>
>> +<br>
>>  static bool drm_dp_sideband_parse_req(struct drm_dp_sideband_msg_rx *raw,<br>
>>                                       struct drm_dp_sideband_msg_req_body<br>
>> *msg)<br>
>>  {<br>
>> @@ -1038,6 +1062,8 @@ static bool drm_dp_sideband_parse_req(struct<br>
>> drm_dp_sideband_msg_rx *raw,<br>
>>                 return drm_dp_sideband_parse_connection_status_notify(raw,<br>
>> msg);<br>
>>         case DP_RESOURCE_STATUS_NOTIFY:<br>
>>                 return drm_dp_sideband_parse_resource_status_notify(raw, msg);<br>
>> +       case DP_SINK_EVENT_NOTIFY:<br>
>> +               return drm_dp_sideband_parse_sink_event_notify(raw, msg);<br>
>>         default:<br>
>>                 DRM_ERROR("Got unknown request 0x%02x (%s)\n", msg->req_type,<br>
>>                           drm_dp_mst_req_type_str(msg->req_type));<br>
>> @@ -3875,6 +3901,8 @@ drm_dp_mst_process_up_req(struct drm_dp_mst_topology_mgr<br>
>> *mgr,<br>
>>                         guid = msg->u.conn_stat.guid;<br>
>>                 else if (msg->req_type == DP_RESOURCE_STATUS_NOTIFY)<br>
>>                         guid = msg->u.resource_stat.guid;<br>
>> +               else if (msg->req_type == DP_SINK_EVENT_NOTIFY)<br>
>> +                       guid = msg->u.sink_event.guid;<br>
>>  <br>
>>                 if (guid)<br>
>>                         mstb = drm_dp_get_mst_branch_device_by_guid(mgr,<br>
>> guid);<br>
>> @@ -3948,7 +3976,8 @@ static int drm_dp_mst_handle_up_req(struct<br>
>> drm_dp_mst_topology_mgr *mgr)<br>
>>         drm_dp_sideband_parse_req(&mgr->up_req_recv, &up_req->msg);<br>
>>  <br>
>>         if (up_req->msg.req_type != DP_CONNECTION_STATUS_NOTIFY &&<br>
>> -           up_req->msg.req_type != DP_RESOURCE_STATUS_NOTIFY) {<br>
>> +           up_req->msg.req_type != DP_RESOURCE_STATUS_NOTIFY &&<br>
>> +           up_req->msg.req_type != DP_SINK_EVENT_NOTIFY) {<br>
>>                 DRM_DEBUG_KMS("Received unknown up req type, ignoring: %x\n",<br>
>>                               up_req->msg.req_type);<br>
>>                 kfree(up_req);<br>
>> @@ -3976,6 +4005,12 @@ static int drm_dp_mst_handle_up_req(struct<br>
>> drm_dp_mst_topology_mgr *mgr)<br>
>>                 DRM_DEBUG_KMS("Got RSN: pn: %d avail_pbn %d\n",<br>
>>                               res_stat->port_number,<br>
>>                               res_stat->available_pbn);<br>
>> +       } else if (up_req->msg.req_type == DP_SINK_EVENT_NOTIFY) {<br>
>> +               const struct drm_dp_sink_event_notify *sink_event =<br>
>> +                       &up_req->msg.u.sink_event;<br>
>> +<br>
>> +               DRM_DEBUG_KMS("Got SEN: pn: %d event_id %d\n",<br>
>> +                             sink_event->port_number, sink_event->event_id);<br>
>>         }<br>
>>  <br>
>>         up_req->hdr = mgr->up_req_recv.initial_hdr;<br>
>> diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h<br>
>> index 6ae5860d8644..c7c79e0ced18 100644<br>
>> --- a/include/drm/drm_dp_mst_helper.h<br>
>> +++ b/include/drm/drm_dp_mst_helper.h<br>
>> @@ -402,6 +402,19 @@ struct drm_dp_resource_status_notify {<br>
>>         u16 available_pbn;<br>
>>  };<br>
>>  <br>
>> +#define DP_SINK_EVENT_PANEL_REPLAY_ACTIVE_FRAME_CRC_ERROR      BIT(0)<br>
>> +#define DP_SINK_EVENT_PANEL_REPLAY_RFB_STORAGE_ERROR           BIT(1)<br>
>> +#define DP_SINK_EVENT_DSC_RC_BUFFER_UNDER_RUN                  BIT(2)<br>
>> +#define DP_SINK_EVENT_DSC_RC_BUFFER_OVERFLOW                   BIT(3)<br>
>> +#define DP_SINK_EVENT_DSC_CHUNK_LENGTH_ERROR                   BIT(4)<br>
>> +#define DP_SINK_EVENT_CEC_IRQ_EVENT                            BIT(5)<br>
>> +<br>
>> +struct drm_dp_sink_event_notify {<br>
>> +       u8 port_number;<br>
>> +       u8 guid[16];<br>
>> +       u16 event_id;<br>
>> +};<br>
>> +<br>
>>  struct drm_dp_query_payload_ack_reply {<br>
>>         u8 port_number;<br>
>>         u16 allocated_pbn;<br>
>> @@ -413,6 +426,7 @@ struct drm_dp_sideband_msg_req_body {<br>
>>                 struct drm_dp_connection_status_notify conn_stat;<br>
>>                 struct drm_dp_port_number_req port_num;<br>
>>                 struct drm_dp_resource_status_notify resource_stat;<br>
>> +               struct drm_dp_sink_event_notify sink_event;<br>
>>  <br>
>>                 struct drm_dp_query_payload query_payload;<br>
>>                 struct drm_dp_allocate_payload allocate_payload;<br>
> <br>
<br>
</blockquote></div>