[PATCH RESEND v9 0/6] MHDP8546 fixes related to DRM_BRIDGE_ATTACH_NO_CONNECTOR usecase

Harikrishna Shenoy posted 6 patches 1 week, 4 days ago
.../drm/bridge/cadence/cdns-mhdp8546-core.c   | 258 +++++-------------
.../drm/bridge/cadence/cdns-mhdp8546-core.h   |   2 +-
.../drm/bridge/cadence/cdns-mhdp8546-hdcp.c   |   8 +-
3 files changed, 72 insertions(+), 196 deletions(-)
[PATCH RESEND v9 0/6] MHDP8546 fixes related to DRM_BRIDGE_ATTACH_NO_CONNECTOR usecase
Posted by Harikrishna Shenoy 1 week, 4 days ago
With the DRM_BRIDGE_ATTACH_NO_CONNECTOR framework, the connector is 
no longer initialized in  bridge_attach() when the display controller 
sets the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag. 
This causes a null pointer dereference in cdns_mhdp_modeset_retry_fn() 
when trying to access &conn->dev->mode_config.mutex. 
Observed on a board where EDID read failed. 
(log: https://gist.github.com/Jayesh2000/233f87f9becdf1e66f1da6fd53f77429)

Patch 1 adds a connector_ptr which takes care of both 
DRM_BRIDGE_ATTACH_NO_CONNECTOR and !DRM_BRIDGE_ATTACH_NO_CONNECTOR 
case by setting the pointer in appropriate hooks and checking for pointer 
validity before accessing the connector.
Patch 2 adds mode validation hook to bridge fucntions.
Patch 3 fixes HDCP to work with both DRM_BRIDGE_ATTACH_NO_CONNECTOR 
and !DRM_BRIDGE_ATTACH_NO_CONNECTOR case by moving HDCP state handling 
into the bridge atomic check inline with the 
DRM_BRIDGE_ATTACH_NO_CONNECTOR model.
Patches 4,5 do necessary cleanup and alignment for using
connector pointer.

The rationale behind the sequence of commits is we can cleanly 
switch to drm_connector pointer after removal of connector helper 
code blocks, which are anyways not touch after 
DRM_BRIDGE_ATTACH_NO_CONNECTOR has been enabled in driver.

The last patch make smaller adjustment: lowering the log level for
noisy DPCD transfer errors.

v8 patch link:
<https://lore.kernel.org/all/20251014094527.3916421-1-h-shenoy@ti.com/>

Changelog v8-v9:
-Move the patch 6 in v8 related to HDCP to patch 3 and add fixes tag.
-Update to connector_ptr in HDCP code in patch 1.
-Rebased on next-20251114.

v7 patch link:
<https://lore.kernel.org/all/20250929083936.1575685-1-h-shenoy@ti.com/>

Changelog v7-v8:
-Move patches with firxes tag to top of series with appropriate changes
to them.
-Add R/B tag to patch 
https://lore.kernel.org/all/ae3snoap64r252sbqhsshsadxfmlqdfn6b4o5fgfcmxppglkqf@2lsstfsghzwb/

v6 patch link:
<https://lore.kernel.org/all/20250909090824.1655537-1-h-shenoy@ti.com/>

Changelog v6-v7:
-Update cover letter to explain the series.
-Add R/B tag in PATCH 1 and drop fixes tag as suggested.
-Drop fixes tag in PATCH 2.
-Update the commit messages for clear understanding of changes done in patches.

v5 patch link:
<https://lore.kernel.org/all/20250811075904.1613519-1-h-shenoy@ti.com/>

Changelog v5 -> v6:
-Update cover letter to clarify the series in better way.
-Add Reviewed-by tag to relevant patches.
 
v4 patch link: 
<https://lore.kernel.org/all/20250624054448.192801-1-j-choudhary@ti.com>

Changelog v4->v5:
- Handle HDCP state in bridge atomic check instead of connector 
atomic check
 
v3 patch link:
<https://lore.kernel.org/all/20250529142517.188786-1-j-choudhary@ti.com/>

Changelog v3->v4:
- Fix kernel test robot build warning:
  <https://lore.kernel.org/all/202505300201.2s6r12yc-lkp@intel.com/>

v2 patch link:
<https://lore.kernel.org/all/20250521073237.366463-1-j-choudhary@ti.com/>

Changelog v2->v3:
- Add mode_valid in drm_bridge_funcs to a separate patch
- Remove "if (mhdp->connector.dev)" conditions that were missed in v2
- Split out the move of drm_atomic_get_new_connector_for_encoder()
  to a separate patch
- Drop "R-by" considering the changes in v2[1/3]
- Add Fixes tag to first 4 patches:
  commit c932ced6b585 ("drm/tidss: Update encoder/bridge chain connect model")
  This added DBANC flag in tidss while attaching bridge to the encoder
- Drop RFC prefix

v1 patch link:
<https://lore.kernel.org/all/20250116111636.157641-1-j-choudhary@ti.com/>

Changelog v1->v2:
- Remove !DRM_BRIDGE_ATTACH_NO_CONNECTOR entirely
- Add mode_valid in drm_bridge_funcs[0]
- Fix NULL POINTER differently since we cannot access atomic_state
- Reduce log level in cdns_mhdp_transfer call

[0]: https://lore.kernel.org/all/20240530091757.433106-1-j-choudhary@ti.com/

Harikrishna Shenoy (1):
  drm/bridge: cadence: cdns-mhdp8546-core: Handle HDCP state in bridge
    atomic check

Jayesh Choudhary (5):
  drm/bridge: cadence: cdns-mhdp8546-core: Set the mhdp connector
    earlier in atomic_enable()
  drm/bridge: cadence: cdns-mhdp8546-core: Add mode_valid hook to
    drm_bridge_funcs
  drm/bridge: cadence: cdns-mhdp8546-core: Remove legacy support for
    connector initialisation in bridge
  drm/bridge: cadence: cdns-mhdp8546*: Change drm_connector from
    structure to pointer
  drm/bridge: cadence: cdns-mhdp8546-core: Reduce log level for DPCD
    read/write

 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 258 +++++-------------
 .../drm/bridge/cadence/cdns-mhdp8546-core.h   |   2 +-
 .../drm/bridge/cadence/cdns-mhdp8546-hdcp.c   |   8 +-
 3 files changed, 72 insertions(+), 196 deletions(-)

-- 
2.34.1
Re: [PATCH RESEND v9 0/6] MHDP8546 fixes related to DRM_BRIDGE_ATTACH_NO_CONNECTOR usecase
Posted by Tomi Valkeinen 1 week, 3 days ago
Hi,

On 20/11/2025 14:14, Harikrishna Shenoy wrote:
> With the DRM_BRIDGE_ATTACH_NO_CONNECTOR framework, the connector is 
> no longer initialized in  bridge_attach() when the display controller 
> sets the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag. 
> This causes a null pointer dereference in cdns_mhdp_modeset_retry_fn() 
> when trying to access &conn->dev->mode_config.mutex. 
> Observed on a board where EDID read failed. 
> (log: https://gist.github.com/Jayesh2000/233f87f9becdf1e66f1da6fd53f77429)
> 
> Patch 1 adds a connector_ptr which takes care of both 
> DRM_BRIDGE_ATTACH_NO_CONNECTOR and !DRM_BRIDGE_ATTACH_NO_CONNECTOR 
> case by setting the pointer in appropriate hooks and checking for pointer 
> validity before accessing the connector.
> Patch 2 adds mode validation hook to bridge fucntions.
> Patch 3 fixes HDCP to work with both DRM_BRIDGE_ATTACH_NO_CONNECTOR 
> and !DRM_BRIDGE_ATTACH_NO_CONNECTOR case by moving HDCP state handling 
> into the bridge atomic check inline with the 
> DRM_BRIDGE_ATTACH_NO_CONNECTOR model.
> Patches 4,5 do necessary cleanup and alignment for using
> connector pointer.
> 
> The rationale behind the sequence of commits is we can cleanly 
> switch to drm_connector pointer after removal of connector helper 
> code blocks, which are anyways not touch after 
> DRM_BRIDGE_ATTACH_NO_CONNECTOR has been enabled in driver.
> 
> The last patch make smaller adjustment: lowering the log level for
> noisy DPCD transfer errors.
> 
> v8 patch link:
> <https://lore.kernel.org/all/20251014094527.3916421-1-h-shenoy@ti.com/>
> 
> Changelog v8-v9:
> -Move the patch 6 in v8 related to HDCP to patch 3 and add fixes tag.
> -Update to connector_ptr in HDCP code in patch 1.
> -Rebased on next-20251114.

Don't base on linux-next, except in some quite special circumstances.
Base on latest major version from Linus, or -rc from Linus, or
drm-misc-next. Usually drm-misc-next is a safe choice for DRM patches.

And if you make changes to a series, it's not a "resend" but a new version.

 Tomi

> 
> v7 patch link:
> <https://lore.kernel.org/all/20250929083936.1575685-1-h-shenoy@ti.com/>
> 
> Changelog v7-v8:
> -Move patches with firxes tag to top of series with appropriate changes
> to them.
> -Add R/B tag to patch 
> https://lore.kernel.org/all/ae3snoap64r252sbqhsshsadxfmlqdfn6b4o5fgfcmxppglkqf@2lsstfsghzwb/
> 
> v6 patch link:
> <https://lore.kernel.org/all/20250909090824.1655537-1-h-shenoy@ti.com/>
> 
> Changelog v6-v7:
> -Update cover letter to explain the series.
> -Add R/B tag in PATCH 1 and drop fixes tag as suggested.
> -Drop fixes tag in PATCH 2.
> -Update the commit messages for clear understanding of changes done in patches.
> 
> v5 patch link:
> <https://lore.kernel.org/all/20250811075904.1613519-1-h-shenoy@ti.com/>
> 
> Changelog v5 -> v6:
> -Update cover letter to clarify the series in better way.
> -Add Reviewed-by tag to relevant patches.
>  
> v4 patch link: 
> <https://lore.kernel.org/all/20250624054448.192801-1-j-choudhary@ti.com>
> 
> Changelog v4->v5:
> - Handle HDCP state in bridge atomic check instead of connector 
> atomic check
>  
> v3 patch link:
> <https://lore.kernel.org/all/20250529142517.188786-1-j-choudhary@ti.com/>
> 
> Changelog v3->v4:
> - Fix kernel test robot build warning:
>   <https://lore.kernel.org/all/202505300201.2s6r12yc-lkp@intel.com/>
> 
> v2 patch link:
> <https://lore.kernel.org/all/20250521073237.366463-1-j-choudhary@ti.com/>
> 
> Changelog v2->v3:
> - Add mode_valid in drm_bridge_funcs to a separate patch
> - Remove "if (mhdp->connector.dev)" conditions that were missed in v2
> - Split out the move of drm_atomic_get_new_connector_for_encoder()
>   to a separate patch
> - Drop "R-by" considering the changes in v2[1/3]
> - Add Fixes tag to first 4 patches:
>   commit c932ced6b585 ("drm/tidss: Update encoder/bridge chain connect model")
>   This added DBANC flag in tidss while attaching bridge to the encoder
> - Drop RFC prefix
> 
> v1 patch link:
> <https://lore.kernel.org/all/20250116111636.157641-1-j-choudhary@ti.com/>
> 
> Changelog v1->v2:
> - Remove !DRM_BRIDGE_ATTACH_NO_CONNECTOR entirely
> - Add mode_valid in drm_bridge_funcs[0]
> - Fix NULL POINTER differently since we cannot access atomic_state
> - Reduce log level in cdns_mhdp_transfer call
> 
> [0]: https://lore.kernel.org/all/20240530091757.433106-1-j-choudhary@ti.com/
> 
> Harikrishna Shenoy (1):
>   drm/bridge: cadence: cdns-mhdp8546-core: Handle HDCP state in bridge
>     atomic check
> 
> Jayesh Choudhary (5):
>   drm/bridge: cadence: cdns-mhdp8546-core: Set the mhdp connector
>     earlier in atomic_enable()
>   drm/bridge: cadence: cdns-mhdp8546-core: Add mode_valid hook to
>     drm_bridge_funcs
>   drm/bridge: cadence: cdns-mhdp8546-core: Remove legacy support for
>     connector initialisation in bridge
>   drm/bridge: cadence: cdns-mhdp8546*: Change drm_connector from
>     structure to pointer
>   drm/bridge: cadence: cdns-mhdp8546-core: Reduce log level for DPCD
>     read/write
> 
>  .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 258 +++++-------------
>  .../drm/bridge/cadence/cdns-mhdp8546-core.h   |   2 +-
>  .../drm/bridge/cadence/cdns-mhdp8546-hdcp.c   |   8 +-
>  3 files changed, 72 insertions(+), 196 deletions(-)
>
Re: [PATCH RESEND v9 0/6] MHDP8546 fixes related to DRM_BRIDGE_ATTACH_NO_CONNECTOR usecase
Posted by Harikrishna shenoy 1 week ago

On 21/11/25 17:37, Tomi Valkeinen wrote:
> Hi,
> 
> On 20/11/2025 14:14, Harikrishna Shenoy wrote:
>> With the DRM_BRIDGE_ATTACH_NO_CONNECTOR framework, the connector is
>> no longer initialized in  bridge_attach() when the display controller
>> sets the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag.
>> This causes a null pointer dereference in cdns_mhdp_modeset_retry_fn()
>> when trying to access &conn->dev->mode_config.mutex.
>> Observed on a board where EDID read failed.
>> (log: https://gist.github.com/Jayesh2000/233f87f9becdf1e66f1da6fd53f77429)
>>
>> Patch 1 adds a connector_ptr which takes care of both
>> DRM_BRIDGE_ATTACH_NO_CONNECTOR and !DRM_BRIDGE_ATTACH_NO_CONNECTOR
>> case by setting the pointer in appropriate hooks and checking for pointer
>> validity before accessing the connector.
>> Patch 2 adds mode validation hook to bridge fucntions.
>> Patch 3 fixes HDCP to work with both DRM_BRIDGE_ATTACH_NO_CONNECTOR
>> and !DRM_BRIDGE_ATTACH_NO_CONNECTOR case by moving HDCP state handling
>> into the bridge atomic check inline with the
>> DRM_BRIDGE_ATTACH_NO_CONNECTOR model.
>> Patches 4,5 do necessary cleanup and alignment for using
>> connector pointer.
>>
>> The rationale behind the sequence of commits is we can cleanly
>> switch to drm_connector pointer after removal of connector helper
>> code blocks, which are anyways not touch after
>> DRM_BRIDGE_ATTACH_NO_CONNECTOR has been enabled in driver.
>>
>> The last patch make smaller adjustment: lowering the log level for
>> noisy DPCD transfer errors.
>>
>> v8 patch link:
>> <https://lore.kernel.org/all/20251014094527.3916421-1-h-shenoy@ti.com/>
>>
>> Changelog v8-v9:
>> -Move the patch 6 in v8 related to HDCP to patch 3 and add fixes tag.
>> -Update to connector_ptr in HDCP code in patch 1.
>> -Rebased on next-20251114.
> 
> Don't base on linux-next, except in some quite special circumstances.
> Base on latest major version from Linus, or -rc from Linus, or
> drm-misc-next. Usually drm-misc-next is a safe choice for DRM patches.
> 
> And if you make changes to a series, it's not a "resend" but a new version.
> 
>   Tomi
> 
Hi Tomi,

Thanks for pointing it out, will re-spin next version v10 and base it on 
drm-misc-next.

Regards.

>>
>> v7 patch link:
>> <https://lore.kernel.org/all/20250929083936.1575685-1-h-shenoy@ti.com/>
>>
>> Changelog v7-v8:
>> -Move patches with firxes tag to top of series with appropriate changes
>> to them.
>> -Add R/B tag to patch
>> https://lore.kernel.org/all/ae3snoap64r252sbqhsshsadxfmlqdfn6b4o5fgfcmxppglkqf@2lsstfsghzwb/
>>
>> v6 patch link:
>> <https://lore.kernel.org/all/20250909090824.1655537-1-h-shenoy@ti.com/>
>>
>> Changelog v6-v7:
>> -Update cover letter to explain the series.
>> -Add R/B tag in PATCH 1 and drop fixes tag as suggested.
>> -Drop fixes tag in PATCH 2.
>> -Update the commit messages for clear understanding of changes done in patches.
>>
>> v5 patch link:
>> <https://lore.kernel.org/all/20250811075904.1613519-1-h-shenoy@ti.com/>
>>
>> Changelog v5 -> v6:
>> -Update cover letter to clarify the series in better way.
>> -Add Reviewed-by tag to relevant patches.
>>   
>> v4 patch link:
>> <https://lore.kernel.org/all/20250624054448.192801-1-j-choudhary@ti.com>
>>
>> Changelog v4->v5:
>> - Handle HDCP state in bridge atomic check instead of connector
>> atomic check
>>   
>> v3 patch link:
>> <https://lore.kernel.org/all/20250529142517.188786-1-j-choudhary@ti.com/>
>>
>> Changelog v3->v4:
>> - Fix kernel test robot build warning:
>>    <https://lore.kernel.org/all/202505300201.2s6r12yc-lkp@intel.com/>
>>
>> v2 patch link:
>> <https://lore.kernel.org/all/20250521073237.366463-1-j-choudhary@ti.com/>
>>
>> Changelog v2->v3:
>> - Add mode_valid in drm_bridge_funcs to a separate patch
>> - Remove "if (mhdp->connector.dev)" conditions that were missed in v2
>> - Split out the move of drm_atomic_get_new_connector_for_encoder()
>>    to a separate patch
>> - Drop "R-by" considering the changes in v2[1/3]
>> - Add Fixes tag to first 4 patches:
>>    commit c932ced6b585 ("drm/tidss: Update encoder/bridge chain connect model")
>>    This added DBANC flag in tidss while attaching bridge to the encoder
>> - Drop RFC prefix
>>
>> v1 patch link:
>> <https://lore.kernel.org/all/20250116111636.157641-1-j-choudhary@ti.com/>
>>
>> Changelog v1->v2:
>> - Remove !DRM_BRIDGE_ATTACH_NO_CONNECTOR entirely
>> - Add mode_valid in drm_bridge_funcs[0]
>> - Fix NULL POINTER differently since we cannot access atomic_state
>> - Reduce log level in cdns_mhdp_transfer call
>>
>> [0]: https://lore.kernel.org/all/20240530091757.433106-1-j-choudhary@ti.com/
>>
>> Harikrishna Shenoy (1):
>>    drm/bridge: cadence: cdns-mhdp8546-core: Handle HDCP state in bridge
>>      atomic check
>>
>> Jayesh Choudhary (5):
>>    drm/bridge: cadence: cdns-mhdp8546-core: Set the mhdp connector
>>      earlier in atomic_enable()
>>    drm/bridge: cadence: cdns-mhdp8546-core: Add mode_valid hook to
>>      drm_bridge_funcs
>>    drm/bridge: cadence: cdns-mhdp8546-core: Remove legacy support for
>>      connector initialisation in bridge
>>    drm/bridge: cadence: cdns-mhdp8546*: Change drm_connector from
>>      structure to pointer
>>    drm/bridge: cadence: cdns-mhdp8546-core: Reduce log level for DPCD
>>      read/write
>>
>>   .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 258 +++++-------------
>>   .../drm/bridge/cadence/cdns-mhdp8546-core.h   |   2 +-
>>   .../drm/bridge/cadence/cdns-mhdp8546-hdcp.c   |   8 +-
>>   3 files changed, 72 insertions(+), 196 deletions(-)
>>
>