Skip to content

Commit dc8aa0c

Browse files
vsyrjalarodrigovivi
authored andcommitted
drm/i915/dmc: Clear HRR EVT_CTL/HTP to zero on ADL-S
On ADL-S the main DMC HRR event DMC_EVT_CTL/HTP are never restored to their previous values during DC6 exit. This angers assert_dmc_loaded(), and basically makes the HRR handler unusable because we don't rewrite EVT_HTP when enabling DMC events. Let's just clear the HRR EVT_CTL/HTP to zero from the beginnning so that the expected value matches the post-DC6 reality. I suppose if we ever had actual use for HRR we'd have to both, reject HRR+PSR, and reprogram EVT_HTP when enabling the event. But for now we don't care about HRR so keeping both registers zeroed is fine. Cc: [email protected] Tested-by: Petr Vorel <[email protected]> Fixes: 43175c9 ("drm/i915/dmc: Assert DMC is loaded harder") Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15153 Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Petr Vorel <[email protected]> Reviewed-by: Imre Deak <[email protected]> Tested-by: Imre Deak <[email protected]> (cherry picked from commit 4df3b340ff6e9f499735d8b52b96a9257fde3918) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent dcb6fa3 commit dc8aa0c

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

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

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,36 @@ static bool is_event_handler(struct intel_display *display,
546546
REG_FIELD_GET(DMC_EVT_CTL_EVENT_ID_MASK, data) == event_id;
547547
}
548548

549+
static bool fixup_dmc_evt(struct intel_display *display,
550+
enum intel_dmc_id dmc_id,
551+
i915_reg_t reg_ctl, u32 *data_ctl,
552+
i915_reg_t reg_htp, u32 *data_htp)
553+
{
554+
if (!is_dmc_evt_ctl_reg(display, dmc_id, reg_ctl))
555+
return false;
556+
557+
if (!is_dmc_evt_htp_reg(display, dmc_id, reg_htp))
558+
return false;
559+
560+
/* make sure reg_ctl and reg_htp are for the same event */
561+
if (i915_mmio_reg_offset(reg_ctl) - i915_mmio_reg_offset(DMC_EVT_CTL(display, dmc_id, 0)) !=
562+
i915_mmio_reg_offset(reg_htp) - i915_mmio_reg_offset(DMC_EVT_HTP(display, dmc_id, 0)))
563+
return false;
564+
565+
/*
566+
* On ADL-S the HRR event handler is not restored after DC6.
567+
* Clear it to zero from the beginning to avoid mismatches later.
568+
*/
569+
if (display->platform.alderlake_s && dmc_id == DMC_FW_MAIN &&
570+
is_event_handler(display, dmc_id, MAINDMC_EVENT_VBLANK_A, reg_ctl, *data_ctl)) {
571+
*data_ctl = 0;
572+
*data_htp = 0;
573+
return true;
574+
}
575+
576+
return false;
577+
}
578+
549579
static bool disable_dmc_evt(struct intel_display *display,
550580
enum intel_dmc_id dmc_id,
551581
i915_reg_t reg, u32 data)
@@ -1064,9 +1094,32 @@ static u32 parse_dmc_fw_header(struct intel_dmc *dmc,
10641094
for (i = 0; i < mmio_count; i++) {
10651095
dmc_info->mmioaddr[i] = _MMIO(mmioaddr[i]);
10661096
dmc_info->mmiodata[i] = mmiodata[i];
1097+
}
1098+
1099+
for (i = 0; i < mmio_count - 1; i++) {
1100+
u32 orig_mmiodata[2] = {
1101+
dmc_info->mmiodata[i],
1102+
dmc_info->mmiodata[i+1],
1103+
};
1104+
1105+
if (!fixup_dmc_evt(display, dmc_id,
1106+
dmc_info->mmioaddr[i], &dmc_info->mmiodata[i],
1107+
dmc_info->mmioaddr[i+1], &dmc_info->mmiodata[i+1]))
1108+
continue;
1109+
1110+
drm_dbg_kms(display->drm,
1111+
" mmio[%d]: 0x%x = 0x%x->0x%x (EVT_CTL)\n",
1112+
i, i915_mmio_reg_offset(dmc_info->mmioaddr[i]),
1113+
orig_mmiodata[0], dmc_info->mmiodata[i]);
1114+
drm_dbg_kms(display->drm,
1115+
" mmio[%d]: 0x%x = 0x%x->0x%x (EVT_HTP)\n",
1116+
i+1, i915_mmio_reg_offset(dmc_info->mmioaddr[i+1]),
1117+
orig_mmiodata[1], dmc_info->mmiodata[i+1]);
1118+
}
10671119

1120+
for (i = 0; i < mmio_count; i++) {
10681121
drm_dbg_kms(display->drm, " mmio[%d]: 0x%x = 0x%x%s%s\n",
1069-
i, mmioaddr[i], mmiodata[i],
1122+
i, i915_mmio_reg_offset(dmc_info->mmioaddr[i]), dmc_info->mmiodata[i],
10701123
is_dmc_evt_ctl_reg(display, dmc_id, dmc_info->mmioaddr[i]) ? " (EVT_CTL)" :
10711124
is_dmc_evt_htp_reg(display, dmc_id, dmc_info->mmioaddr[i]) ? " (EVT_HTP)" : "",
10721125
disable_dmc_evt(display, dmc_id, dmc_info->mmioaddr[i],

0 commit comments

Comments
 (0)