Skip to content

Commit e012fa3

Browse files
committed
drm/i915/uncore: Do GT FIFO checks in early sanitize and forcewake get
We're mixing up the GT FIFO debug checks (overflows and such) with RMbus unclaimed register checks. The two are quite different things as RMbus is only relevant for display registers, and the GT FIFO only relevant for GT registers. Split the GT FIFO debugs out from the unclaimed register logic and just do the checks during forcewake_get() and early init. That is still sufficient to detect if any errors have happened. Any errors would anyway be caused by overflowing the FIFO rather than accessing specific registers, so trying to figure out exactly when the error happened isn't particularly useful. To fix such issues we'd rather have to do something to slow down the rate at which registers are accessed (eg. increase GT_FIFO_NUM_RESERVED_ENTRIES or something). Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260323101609.8391-3-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com>
1 parent fde38b1 commit e012fa3

1 file changed

Lines changed: 50 additions & 22 deletions

File tree

drivers/gpu/drm/i915/intel_uncore.c

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,35 @@ static void fw_domains_get_with_thread_status(struct intel_uncore *uncore,
399399
__gen6_gt_wait_for_thread_c0(uncore);
400400
}
401401

402+
static void
403+
gen6_check_for_fifo_debug(struct intel_uncore *uncore)
404+
{
405+
u32 fifodbg;
406+
407+
fifodbg = __raw_uncore_read32(uncore, GTFIFODBG);
408+
409+
if (unlikely(fifodbg)) {
410+
drm_dbg(&uncore->i915->drm, "GTFIFODBG = 0x08%x\n", fifodbg);
411+
__raw_uncore_write32(uncore, GTFIFODBG, fifodbg);
412+
}
413+
}
414+
415+
static void
416+
fw_domains_get_normal_fifo(struct intel_uncore *uncore,
417+
enum forcewake_domains fw_domains)
418+
{
419+
gen6_check_for_fifo_debug(uncore);
420+
fw_domains_get_normal(uncore, fw_domains);
421+
}
422+
423+
static void
424+
fw_domains_get_with_thread_status_fifo(struct intel_uncore *uncore,
425+
enum forcewake_domains fw_domains)
426+
{
427+
gen6_check_for_fifo_debug(uncore);
428+
fw_domains_get_with_thread_status(uncore, fw_domains);
429+
}
430+
402431
static inline u32 fifo_free_entries(struct intel_uncore *uncore)
403432
{
404433
u32 count = __raw_uncore_read32(uncore, GTFIFOCTL);
@@ -561,21 +590,6 @@ vlv_check_for_unclaimed_mmio(struct intel_uncore *uncore)
561590
return true;
562591
}
563592

564-
static bool
565-
gen6_check_for_fifo_debug(struct intel_uncore *uncore)
566-
{
567-
u32 fifodbg;
568-
569-
fifodbg = __raw_uncore_read32(uncore, GTFIFODBG);
570-
571-
if (unlikely(fifodbg)) {
572-
drm_dbg(&uncore->i915->drm, "GTFIFODBG = 0x08%x\n", fifodbg);
573-
__raw_uncore_write32(uncore, GTFIFODBG, fifodbg);
574-
}
575-
576-
return fifodbg;
577-
}
578-
579593
static bool
580594
check_for_unclaimed_mmio(struct intel_uncore *uncore)
581595
{
@@ -592,9 +606,6 @@ check_for_unclaimed_mmio(struct intel_uncore *uncore)
592606
if (intel_uncore_has_dbg_unclaimed(uncore))
593607
ret |= vlv_check_for_unclaimed_mmio(uncore);
594608

595-
if (intel_uncore_has_fifo(uncore))
596-
ret |= gen6_check_for_fifo_debug(uncore);
597-
598609
return ret;
599610
}
600611

@@ -611,6 +622,9 @@ static void forcewake_early_sanitize(struct intel_uncore *uncore,
611622
GT_FIFO_CTL_RC6_POLICY_STALL);
612623
}
613624

625+
if (intel_uncore_has_fifo(uncore))
626+
gen6_check_for_fifo_debug(uncore);
627+
614628
iosf_mbi_punit_acquire();
615629
intel_uncore_forcewake_reset(uncore);
616630
if (restore_forcewake) {
@@ -2155,6 +2169,14 @@ static const struct intel_uncore_fw_get uncore_get_thread_status = {
21552169
.force_wake_get = fw_domains_get_with_thread_status
21562170
};
21572171

2172+
static const struct intel_uncore_fw_get uncore_get_normal_fifo = {
2173+
.force_wake_get = fw_domains_get_normal_fifo,
2174+
};
2175+
2176+
static const struct intel_uncore_fw_get uncore_get_thread_status_fifo = {
2177+
.force_wake_get = fw_domains_get_with_thread_status_fifo
2178+
};
2179+
21582180
static int intel_uncore_fw_domains_init(struct intel_uncore *uncore)
21592181
{
21602182
struct drm_i915_private *i915 = uncore->i915;
@@ -2218,13 +2240,19 @@ static int intel_uncore_fw_domains_init(struct intel_uncore *uncore)
22182240
fw_domain_init(uncore, FW_DOMAIN_ID_MEDIA,
22192241
FORCEWAKE_MEDIA_GEN9, FORCEWAKE_ACK_MEDIA_GEN9);
22202242
} else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) {
2221-
uncore->fw_get_funcs = &uncore_get_normal;
2243+
if (intel_uncore_has_fifo(uncore))
2244+
uncore->fw_get_funcs = &uncore_get_normal_fifo;
2245+
else
2246+
uncore->fw_get_funcs = &uncore_get_normal;
22222247
fw_domain_init(uncore, FW_DOMAIN_ID_RENDER,
22232248
FORCEWAKE_VLV, FORCEWAKE_ACK_VLV);
22242249
fw_domain_init(uncore, FW_DOMAIN_ID_MEDIA,
22252250
FORCEWAKE_MEDIA_VLV, FORCEWAKE_ACK_MEDIA_VLV);
22262251
} else if (IS_HASWELL(i915) || IS_BROADWELL(i915)) {
2227-
uncore->fw_get_funcs = &uncore_get_thread_status;
2252+
if (intel_uncore_has_fifo(uncore))
2253+
uncore->fw_get_funcs = &uncore_get_thread_status_fifo;
2254+
else
2255+
uncore->fw_get_funcs = &uncore_get_thread_status;
22282256
fw_domain_init(uncore, FW_DOMAIN_ID_RENDER,
22292257
FORCEWAKE_MT, FORCEWAKE_ACK_HSW);
22302258
} else if (IS_IVYBRIDGE(i915)) {
@@ -2239,7 +2267,7 @@ static int intel_uncore_fw_domains_init(struct intel_uncore *uncore)
22392267
* (correctly) interpreted by the test below as MT
22402268
* forcewake being disabled.
22412269
*/
2242-
uncore->fw_get_funcs = &uncore_get_thread_status;
2270+
uncore->fw_get_funcs = &uncore_get_thread_status_fifo;
22432271

22442272
/* We need to init first for ECOBUS access and then
22452273
* determine later if we want to reinit, in case of MT access is
@@ -2270,7 +2298,7 @@ static int intel_uncore_fw_domains_init(struct intel_uncore *uncore)
22702298
FORCEWAKE, FORCEWAKE_ACK);
22712299
}
22722300
} else if (GRAPHICS_VER(i915) == 6) {
2273-
uncore->fw_get_funcs = &uncore_get_thread_status;
2301+
uncore->fw_get_funcs = &uncore_get_thread_status_fifo;
22742302
fw_domain_init(uncore, FW_DOMAIN_ID_RENDER,
22752303
FORCEWAKE, FORCEWAKE_ACK);
22762304
}

0 commit comments

Comments
 (0)