mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
drm/i915/dp: Sanitize sink rate DPCD register values
If the DPCD sink rate values read from the sink are invalid, the driver will sanitize this in intel_dp_set_common_rates(), by setting a default 162000 link rate in common rates and printing a WARN(). WARN()s should only be triggered by bugs in the code and not by external factors like the above (an invalid DPCD injected maliciously or read from a buggy monitor). So fixup the invalid DPCD sink rate values already and print an error in this case (since it's still a user visible problem). Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211018094154.1407705-6-imre.deak@intel.com
This commit is contained in:
@@ -127,7 +127,7 @@ static void intel_dp_set_default_sink_rates(struct intel_dp *intel_dp)
|
||||
}
|
||||
|
||||
/* update sink rates from dpcd */
|
||||
static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
|
||||
static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
|
||||
{
|
||||
static const int dp_rates[] = {
|
||||
162000, 270000, 540000, 810000
|
||||
@@ -197,6 +197,25 @@ static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
|
||||
intel_dp->num_sink_rates = i;
|
||||
}
|
||||
|
||||
static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
|
||||
{
|
||||
struct intel_connector *connector = intel_dp->attached_connector;
|
||||
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
|
||||
struct intel_encoder *encoder = &intel_dig_port->base;
|
||||
|
||||
intel_dp_set_dpcd_sink_rates(intel_dp);
|
||||
|
||||
if (intel_dp->num_sink_rates)
|
||||
return;
|
||||
|
||||
drm_err(&dp_to_i915(intel_dp)->drm,
|
||||
"[CONNECTOR:%d:%s][ENCODER:%d:%s] Invalid DPCD with no link rates, using defaults\n",
|
||||
connector->base.base.id, connector->base.name,
|
||||
encoder->base.base.id, encoder->base.name);
|
||||
|
||||
intel_dp_set_default_sink_rates(intel_dp);
|
||||
}
|
||||
|
||||
static void intel_dp_set_default_max_sink_lane_count(struct intel_dp *intel_dp)
|
||||
{
|
||||
intel_dp->max_sink_lane_count = 1;
|
||||
|
||||
Reference in New Issue
Block a user