[Intel-gfx] [RESEND 1/3] drm/i915/dsi: filter invalid backlight and CABC ports

Jani Nikula jani.nikula at intel.com
Wed Aug 17 08:29:50 UTC 2022


On Wed, 17 Aug 2022, "Lisovskiy, Stanislav" <stanislav.lisovskiy at intel.com> wrote:
> On Tue, Aug 16, 2022 at 06:37:20PM +0300, Jani Nikula wrote:
>> Avoid using ports that aren't initialized in case the VBT backlight or
>> CABC ports have invalid values. This fixes a NULL pointer dereference of
>> intel_dsi->dsi_hosts[port] in such cases.
>> 
>> Cc: stable at vger.kernel.org
>> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>
> Would be interesting to figure out which one of those actually fixed the
> https://gitlab.freedesktop.org/drm/intel/-/issues/6476 issue, this one
> or next one.

I asked to test with patch 1 alone first, and it lets them boot without
the oops. And it produces the warn added here. But this just filters
port C out of bl_ports, and doesn't fix the root cause. Patch 2 should
fix the root cause, get rid of the warn and give them functioning
backlight. I hope. There was no test results with patches 2&3. :)

> Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>

Thanks for the review!

BR,
Jani.

>
>> ---
>>  drivers/gpu/drm/i915/display/icl_dsi.c | 7 +++++++
>>  drivers/gpu/drm/i915/display/vlv_dsi.c | 7 +++++++
>>  2 files changed, 14 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
>> index 5dcfa7feffa9..885c74f60366 100644
>> --- a/drivers/gpu/drm/i915/display/icl_dsi.c
>> +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
>> @@ -2070,7 +2070,14 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
>>  	else
>>  		intel_dsi->ports = BIT(port);
>>  
>> +	if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports))
>> +		intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports;
>> +
>>  	intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports;
>> +
>> +	if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports))
>> +		intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports;
>> +
>>  	intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports;
>>  
>>  	for_each_dsi_port(port, intel_dsi->ports) {
>> diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c
>> index b9b1fed99874..35136d26e517 100644
>> --- a/drivers/gpu/drm/i915/display/vlv_dsi.c
>> +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c
>> @@ -1933,7 +1933,14 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
>>  	else
>>  		intel_dsi->ports = BIT(port);
>>  
>> +	if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports))
>> +		intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports;
>> +
>>  	intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports;
>> +
>> +	if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports))
>> +		intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports;
>> +
>>  	intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports;
>>  
>>  	/* Create a DSI host (and a device) for each port. */
>> -- 
>> 2.34.1
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list