Skip to content

Commit 02a8ae7

Browse files
committed
Merge tag 'drm-intel-next-fixes-2023-04-20-1' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
Active port PLL MST fix for second stream, CSC plane index fix, null and oob array deref fixes and selftest memory leak fix. Signed-off-by: Dave Airlie <[email protected]> From: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents e82c98f + 2c69679 commit 02a8ae7

File tree

7 files changed

+53
-15
lines changed

7 files changed

+53
-15
lines changed

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3060,6 +3060,25 @@ void intel_ddi_update_pipe(struct intel_atomic_state *state,
30603060
intel_hdcp_update_pipe(state, encoder, crtc_state, conn_state);
30613061
}
30623062

3063+
void intel_ddi_update_active_dpll(struct intel_atomic_state *state,
3064+
struct intel_encoder *encoder,
3065+
struct intel_crtc *crtc)
3066+
{
3067+
struct drm_i915_private *i915 = to_i915(encoder->base.dev);
3068+
struct intel_crtc_state *crtc_state =
3069+
intel_atomic_get_new_crtc_state(state, crtc);
3070+
struct intel_crtc *slave_crtc;
3071+
enum phy phy = intel_port_to_phy(i915, encoder->port);
3072+
3073+
if (!intel_phy_is_tc(i915, phy))
3074+
return;
3075+
3076+
intel_update_active_dpll(state, crtc, encoder);
3077+
for_each_intel_crtc_in_pipe_mask(&i915->drm, slave_crtc,
3078+
intel_crtc_bigjoiner_slave_pipes(crtc_state))
3079+
intel_update_active_dpll(state, slave_crtc, encoder);
3080+
}
3081+
30633082
static void
30643083
intel_ddi_pre_pll_enable(struct intel_atomic_state *state,
30653084
struct intel_encoder *encoder,
@@ -3074,15 +3093,9 @@ intel_ddi_pre_pll_enable(struct intel_atomic_state *state,
30743093
if (is_tc_port) {
30753094
struct intel_crtc *master_crtc =
30763095
to_intel_crtc(crtc_state->uapi.crtc);
3077-
struct intel_crtc *slave_crtc;
30783096

30793097
intel_tc_port_get_link(dig_port, crtc_state->lane_count);
3080-
3081-
intel_update_active_dpll(state, master_crtc, encoder);
3082-
3083-
for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, slave_crtc,
3084-
intel_crtc_bigjoiner_slave_pipes(crtc_state))
3085-
intel_update_active_dpll(state, slave_crtc, encoder);
3098+
intel_ddi_update_active_dpll(state, encoder, master_crtc);
30863099
}
30873100

30883101
main_link_aux_power_domain_get(dig_port, crtc_state);

drivers/gpu/drm/i915/display/intel_ddi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,8 @@ void intel_ddi_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
7272
int intel_ddi_level(struct intel_encoder *encoder,
7373
const struct intel_crtc_state *crtc_state,
7474
int lane);
75+
void intel_ddi_update_active_dpll(struct intel_atomic_state *state,
76+
struct intel_encoder *encoder,
77+
struct intel_crtc *crtc);
7578

7679
#endif /* __INTEL_DDI_H__ */

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
959959
num_encoders++;
960960
}
961961

962-
drm_WARN(encoder->base.dev, num_encoders != 1,
962+
drm_WARN(state->base.dev, num_encoders != 1,
963963
"%d encoders for pipe %c\n",
964964
num_encoders, pipe_name(master_crtc->pipe));
965965

drivers/gpu/drm/i915/display/intel_dp_mst.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,13 @@ static void intel_mst_pre_pll_enable_dp(struct intel_atomic_state *state,
674674
if (intel_dp->active_mst_links == 0)
675675
dig_port->base.pre_pll_enable(state, &dig_port->base,
676676
pipe_config, NULL);
677+
else
678+
/*
679+
* The port PLL state needs to get updated for secondary
680+
* streams as for the primary stream.
681+
*/
682+
intel_ddi_update_active_dpll(state, &dig_port->base,
683+
to_intel_crtc(pipe_config->uapi.crtc));
677684
}
678685

679686
static void intel_mst_pre_enable_dp(struct intel_atomic_state *state,

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,25 @@ static void __force_fw_fetch_failures(struct intel_uc_fw *uc_fw, int e)
488488
}
489489
}
490490

491-
static int check_gsc_manifest(const struct firmware *fw,
491+
static int check_gsc_manifest(struct intel_gt *gt,
492+
const struct firmware *fw,
492493
struct intel_uc_fw *uc_fw)
493494
{
494495
u32 *dw = (u32 *)fw->data;
495-
u32 version_hi = dw[HUC_GSC_VERSION_HI_DW];
496-
u32 version_lo = dw[HUC_GSC_VERSION_LO_DW];
496+
u32 version_hi, version_lo;
497+
size_t min_size;
498+
499+
/* Check the size of the blob before examining buffer contents */
500+
min_size = sizeof(u32) * (HUC_GSC_VERSION_LO_DW + 1);
501+
if (unlikely(fw->size < min_size)) {
502+
gt_warn(gt, "%s firmware %s: invalid size: %zu < %zu\n",
503+
intel_uc_fw_type_repr(uc_fw->type), uc_fw->file_selected.path,
504+
fw->size, min_size);
505+
return -ENODATA;
506+
}
507+
508+
version_hi = dw[HUC_GSC_VERSION_HI_DW];
509+
version_lo = dw[HUC_GSC_VERSION_LO_DW];
497510

498511
uc_fw->file_selected.ver.major = FIELD_GET(HUC_GSC_MAJOR_VER_HI_MASK, version_hi);
499512
uc_fw->file_selected.ver.minor = FIELD_GET(HUC_GSC_MINOR_VER_HI_MASK, version_hi);
@@ -664,7 +677,7 @@ static int check_fw_header(struct intel_gt *gt,
664677
return 0;
665678

666679
if (uc_fw->loaded_via_gsc)
667-
err = check_gsc_manifest(fw, uc_fw);
680+
err = check_gsc_manifest(gt, fw, uc_fw);
668681
else
669682
err = check_ccs_header(gt, fw, uc_fw);
670683
if (err)

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6349,8 +6349,8 @@ enum skl_power_gate {
63496349

63506350
#define _PLANE_CSC_RY_GY_1(pipe) _PIPE(pipe, _PLANE_CSC_RY_GY_1_A, \
63516351
_PLANE_CSC_RY_GY_1_B)
6352-
#define _PLANE_CSC_RY_GY_2(pipe) _PIPE(pipe, _PLANE_INPUT_CSC_RY_GY_2_A, \
6353-
_PLANE_INPUT_CSC_RY_GY_2_B)
6352+
#define _PLANE_CSC_RY_GY_2(pipe) _PIPE(pipe, _PLANE_CSC_RY_GY_2_A, \
6353+
_PLANE_CSC_RY_GY_2_B)
63546354
#define PLANE_CSC_COEFF(pipe, plane, index) _MMIO_PLANE(plane, \
63556355
_PLANE_CSC_RY_GY_1(pipe) + (index) * 4, \
63566356
_PLANE_CSC_RY_GY_2(pipe) + (index) * 4)

drivers/gpu/drm/i915/selftests/i915_gem_gtt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ static int fake_get_pages(struct drm_i915_gem_object *obj)
6969

7070
rem = round_up(obj->base.size, BIT(31)) >> 31;
7171
/* restricted by sg_alloc_table */
72-
if (overflows_type(rem, unsigned int))
72+
if (overflows_type(rem, unsigned int)) {
73+
kfree(pages);
7374
return -E2BIG;
75+
}
7476

7577
if (sg_alloc_table(pages, rem, GFP)) {
7678
kfree(pages);

0 commit comments

Comments
 (0)