Commit ce7a3d2e authored by Daniel Vetter's avatar Daniel Vetter

Merge tag 'drm-intel-fixes-2023-03-30' of...

Merge tag 'drm-intel-fixes-2023-03-30' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes

drm/i915 fixes for v6.3-rc5:
- Fix PMU support by reusing functions with sysfs
- Fix a number of issues related to color, PSR and arm/noarm
- Fix state check related to ICL PHY ownership check in TC-cold state
- Flush lmem contents after construction
- Fix hibernate oops related to DPT BO
- Fix perf stream error path wakeref balance
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87355m4gtm.fsf@intel.com
parents 197b6b60 5c95b2d5
...@@ -46,6 +46,11 @@ struct intel_color_funcs { ...@@ -46,6 +46,11 @@ struct intel_color_funcs {
* registers involved with the same commit. * registers involved with the same commit.
*/ */
void (*color_commit_arm)(const struct intel_crtc_state *crtc_state); void (*color_commit_arm)(const struct intel_crtc_state *crtc_state);
/*
* Perform any extra tasks needed after all the
* double buffered registers have been latched.
*/
void (*color_post_update)(const struct intel_crtc_state *crtc_state);
/* /*
* Load LUTs (and other single buffered color management * Load LUTs (and other single buffered color management
* registers). Will (hopefully) be called during the vblank * registers). Will (hopefully) be called during the vblank
...@@ -614,9 +619,33 @@ static void ilk_lut_12p4_pack(struct drm_color_lut *entry, u32 ldw, u32 udw) ...@@ -614,9 +619,33 @@ static void ilk_lut_12p4_pack(struct drm_color_lut *entry, u32 ldw, u32 udw)
static void icl_color_commit_noarm(const struct intel_crtc_state *crtc_state) static void icl_color_commit_noarm(const struct intel_crtc_state *crtc_state)
{ {
/*
* Despite Wa_1406463849, ICL no longer suffers from the SKL
* DC5/PSR CSC black screen issue (see skl_color_commit_noarm()).
* Possibly due to the extra sticky CSC arming
* (see icl_color_post_update()).
*
* On TGL+ all CSC arming issues have been properly fixed.
*/
icl_load_csc_matrix(crtc_state); icl_load_csc_matrix(crtc_state);
} }
static void skl_color_commit_noarm(const struct intel_crtc_state *crtc_state)
{
/*
* Possibly related to display WA #1184, SKL CSC loses the latched
* CSC coeff/offset register values if the CSC registers are disarmed
* between DC5 exit and PSR exit. This will cause the plane(s) to
* output all black (until CSC_MODE is rearmed and properly latched).
* Once PSR exit (and proper register latching) has occurred the
* danger is over. Thus when PSR is enabled the CSC coeff/offset
* register programming will be peformed from skl_color_commit_arm()
* which is called after PSR exit.
*/
if (!crtc_state->has_psr)
ilk_load_csc_matrix(crtc_state);
}
static void ilk_color_commit_noarm(const struct intel_crtc_state *crtc_state) static void ilk_color_commit_noarm(const struct intel_crtc_state *crtc_state)
{ {
ilk_load_csc_matrix(crtc_state); ilk_load_csc_matrix(crtc_state);
...@@ -659,6 +688,9 @@ static void skl_color_commit_arm(const struct intel_crtc_state *crtc_state) ...@@ -659,6 +688,9 @@ static void skl_color_commit_arm(const struct intel_crtc_state *crtc_state)
enum pipe pipe = crtc->pipe; enum pipe pipe = crtc->pipe;
u32 val = 0; u32 val = 0;
if (crtc_state->has_psr)
ilk_load_csc_matrix(crtc_state);
/* /*
* We don't (yet) allow userspace to control the pipe background color, * We don't (yet) allow userspace to control the pipe background color,
* so force it to black, but apply pipe gamma and CSC appropriately * so force it to black, but apply pipe gamma and CSC appropriately
...@@ -677,6 +709,47 @@ static void skl_color_commit_arm(const struct intel_crtc_state *crtc_state) ...@@ -677,6 +709,47 @@ static void skl_color_commit_arm(const struct intel_crtc_state *crtc_state)
crtc_state->csc_mode); crtc_state->csc_mode);
} }
static void icl_color_commit_arm(const struct intel_crtc_state *crtc_state)
{
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
enum pipe pipe = crtc->pipe;
/*
* We don't (yet) allow userspace to control the pipe background color,
* so force it to black.
*/
intel_de_write(i915, SKL_BOTTOM_COLOR(pipe), 0);
intel_de_write(i915, GAMMA_MODE(crtc->pipe),
crtc_state->gamma_mode);
intel_de_write_fw(i915, PIPE_CSC_MODE(crtc->pipe),
crtc_state->csc_mode);
}
static void icl_color_post_update(const struct intel_crtc_state *crtc_state)
{
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
/*
* Despite Wa_1406463849, ICL CSC is no longer disarmed by
* coeff/offset register *writes*. Instead, once CSC_MODE
* is armed it stays armed, even after it has been latched.
* Afterwards the coeff/offset registers become effectively
* self-arming. That self-arming must be disabled before the
* next icl_color_commit_noarm() tries to write the next set
* of coeff/offset registers. Fortunately register *reads*
* do still disarm the CSC. Naturally this must not be done
* until the previously written CSC registers have actually
* been latched.
*
* TGL+ no longer need this workaround.
*/
intel_de_read_fw(i915, PIPE_CSC_PREOFF_HI(crtc->pipe));
}
static struct drm_property_blob * static struct drm_property_blob *
create_linear_lut(struct drm_i915_private *i915, int lut_size) create_linear_lut(struct drm_i915_private *i915, int lut_size)
{ {
...@@ -1373,6 +1446,14 @@ void intel_color_commit_arm(const struct intel_crtc_state *crtc_state) ...@@ -1373,6 +1446,14 @@ void intel_color_commit_arm(const struct intel_crtc_state *crtc_state)
i915->display.funcs.color->color_commit_arm(crtc_state); i915->display.funcs.color->color_commit_arm(crtc_state);
} }
void intel_color_post_update(const struct intel_crtc_state *crtc_state)
{
struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
if (i915->display.funcs.color->color_post_update)
i915->display.funcs.color->color_post_update(crtc_state);
}
void intel_color_prepare_commit(struct intel_crtc_state *crtc_state) void intel_color_prepare_commit(struct intel_crtc_state *crtc_state)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
...@@ -3064,10 +3145,20 @@ static const struct intel_color_funcs i9xx_color_funcs = { ...@@ -3064,10 +3145,20 @@ static const struct intel_color_funcs i9xx_color_funcs = {
.lut_equal = i9xx_lut_equal, .lut_equal = i9xx_lut_equal,
}; };
static const struct intel_color_funcs tgl_color_funcs = {
.color_check = icl_color_check,
.color_commit_noarm = icl_color_commit_noarm,
.color_commit_arm = icl_color_commit_arm,
.load_luts = icl_load_luts,
.read_luts = icl_read_luts,
.lut_equal = icl_lut_equal,
};
static const struct intel_color_funcs icl_color_funcs = { static const struct intel_color_funcs icl_color_funcs = {
.color_check = icl_color_check, .color_check = icl_color_check,
.color_commit_noarm = icl_color_commit_noarm, .color_commit_noarm = icl_color_commit_noarm,
.color_commit_arm = skl_color_commit_arm, .color_commit_arm = icl_color_commit_arm,
.color_post_update = icl_color_post_update,
.load_luts = icl_load_luts, .load_luts = icl_load_luts,
.read_luts = icl_read_luts, .read_luts = icl_read_luts,
.lut_equal = icl_lut_equal, .lut_equal = icl_lut_equal,
...@@ -3075,7 +3166,7 @@ static const struct intel_color_funcs icl_color_funcs = { ...@@ -3075,7 +3166,7 @@ static const struct intel_color_funcs icl_color_funcs = {
static const struct intel_color_funcs glk_color_funcs = { static const struct intel_color_funcs glk_color_funcs = {
.color_check = glk_color_check, .color_check = glk_color_check,
.color_commit_noarm = ilk_color_commit_noarm, .color_commit_noarm = skl_color_commit_noarm,
.color_commit_arm = skl_color_commit_arm, .color_commit_arm = skl_color_commit_arm,
.load_luts = glk_load_luts, .load_luts = glk_load_luts,
.read_luts = glk_read_luts, .read_luts = glk_read_luts,
...@@ -3084,7 +3175,7 @@ static const struct intel_color_funcs glk_color_funcs = { ...@@ -3084,7 +3175,7 @@ static const struct intel_color_funcs glk_color_funcs = {
static const struct intel_color_funcs skl_color_funcs = { static const struct intel_color_funcs skl_color_funcs = {
.color_check = ivb_color_check, .color_check = ivb_color_check,
.color_commit_noarm = ilk_color_commit_noarm, .color_commit_noarm = skl_color_commit_noarm,
.color_commit_arm = skl_color_commit_arm, .color_commit_arm = skl_color_commit_arm,
.load_luts = bdw_load_luts, .load_luts = bdw_load_luts,
.read_luts = bdw_read_luts, .read_luts = bdw_read_luts,
...@@ -3180,7 +3271,9 @@ void intel_color_init_hooks(struct drm_i915_private *i915) ...@@ -3180,7 +3271,9 @@ void intel_color_init_hooks(struct drm_i915_private *i915)
else else
i915->display.funcs.color = &i9xx_color_funcs; i915->display.funcs.color = &i9xx_color_funcs;
} else { } else {
if (DISPLAY_VER(i915) >= 11) if (DISPLAY_VER(i915) >= 12)
i915->display.funcs.color = &tgl_color_funcs;
else if (DISPLAY_VER(i915) == 11)
i915->display.funcs.color = &icl_color_funcs; i915->display.funcs.color = &icl_color_funcs;
else if (DISPLAY_VER(i915) == 10) else if (DISPLAY_VER(i915) == 10)
i915->display.funcs.color = &glk_color_funcs; i915->display.funcs.color = &glk_color_funcs;
......
...@@ -21,6 +21,7 @@ void intel_color_prepare_commit(struct intel_crtc_state *crtc_state); ...@@ -21,6 +21,7 @@ void intel_color_prepare_commit(struct intel_crtc_state *crtc_state);
void intel_color_cleanup_commit(struct intel_crtc_state *crtc_state); void intel_color_cleanup_commit(struct intel_crtc_state *crtc_state);
void intel_color_commit_noarm(const struct intel_crtc_state *crtc_state); void intel_color_commit_noarm(const struct intel_crtc_state *crtc_state);
void intel_color_commit_arm(const struct intel_crtc_state *crtc_state); void intel_color_commit_arm(const struct intel_crtc_state *crtc_state);
void intel_color_post_update(const struct intel_crtc_state *crtc_state);
void intel_color_load_luts(const struct intel_crtc_state *crtc_state); void intel_color_load_luts(const struct intel_crtc_state *crtc_state);
void intel_color_get_config(struct intel_crtc_state *crtc_state); void intel_color_get_config(struct intel_crtc_state *crtc_state);
bool intel_color_lut_equal(const struct intel_crtc_state *crtc_state, bool intel_color_lut_equal(const struct intel_crtc_state *crtc_state,
......
...@@ -1209,6 +1209,9 @@ static void intel_post_plane_update(struct intel_atomic_state *state, ...@@ -1209,6 +1209,9 @@ static void intel_post_plane_update(struct intel_atomic_state *state,
if (needs_cursorclk_wa(old_crtc_state) && if (needs_cursorclk_wa(old_crtc_state) &&
!needs_cursorclk_wa(new_crtc_state)) !needs_cursorclk_wa(new_crtc_state))
icl_wa_cursorclkgating(dev_priv, pipe, false); icl_wa_cursorclkgating(dev_priv, pipe, false);
if (intel_crtc_needs_color_update(new_crtc_state))
intel_color_post_update(new_crtc_state);
} }
static void intel_crtc_enable_flip_done(struct intel_atomic_state *state, static void intel_crtc_enable_flip_done(struct intel_atomic_state *state,
...@@ -7091,6 +7094,8 @@ static void intel_update_crtc(struct intel_atomic_state *state, ...@@ -7091,6 +7094,8 @@ static void intel_update_crtc(struct intel_atomic_state *state,
intel_fbc_update(state, crtc); intel_fbc_update(state, crtc);
drm_WARN_ON(&i915->drm, !intel_display_power_is_enabled(i915, POWER_DOMAIN_DC_OFF));
if (!modeset && if (!modeset &&
intel_crtc_needs_color_update(new_crtc_state)) intel_crtc_needs_color_update(new_crtc_state))
intel_color_commit_noarm(new_crtc_state); intel_color_commit_noarm(new_crtc_state);
...@@ -7458,8 +7463,28 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) ...@@ -7458,8 +7463,28 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
drm_atomic_helper_wait_for_dependencies(&state->base); drm_atomic_helper_wait_for_dependencies(&state->base);
drm_dp_mst_atomic_wait_for_dependencies(&state->base); drm_dp_mst_atomic_wait_for_dependencies(&state->base);
if (state->modeset) /*
wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET); * During full modesets we write a lot of registers, wait
* for PLLs, etc. Doing that while DC states are enabled
* is not a good idea.
*
* During fastsets and other updates we also need to
* disable DC states due to the following scenario:
* 1. DC5 exit and PSR exit happen
* 2. Some or all _noarm() registers are written
* 3. Due to some long delay PSR is re-entered
* 4. DC5 entry -> DMC saves the already written new
* _noarm() registers and the old not yet written
* _arm() registers
* 5. DC5 exit -> DMC restores a mixture of old and
* new register values and arms the update
* 6. PSR exit -> hardware latches a mixture of old and
* new register values -> corrupted frame, or worse
* 7. New _arm() registers are finally written
* 8. Hardware finally latches a complete set of new
* register values, and subsequent frames will be OK again
*/
wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_DC_OFF);
intel_atomic_prepare_plane_clear_colors(state); intel_atomic_prepare_plane_clear_colors(state);
...@@ -7608,8 +7633,8 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) ...@@ -7608,8 +7633,8 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
* the culprit. * the culprit.
*/ */
intel_uncore_arm_unclaimed_mmio_detection(&dev_priv->uncore); intel_uncore_arm_unclaimed_mmio_detection(&dev_priv->uncore);
intel_display_power_put(dev_priv, POWER_DOMAIN_MODESET, wakeref);
} }
intel_display_power_put(dev_priv, POWER_DOMAIN_DC_OFF, wakeref);
intel_runtime_pm_put(&dev_priv->runtime_pm, state->wakeref); intel_runtime_pm_put(&dev_priv->runtime_pm, state->wakeref);
/* /*
......
...@@ -301,6 +301,7 @@ intel_dpt_create(struct intel_framebuffer *fb) ...@@ -301,6 +301,7 @@ intel_dpt_create(struct intel_framebuffer *fb)
vm->pte_encode = gen8_ggtt_pte_encode; vm->pte_encode = gen8_ggtt_pte_encode;
dpt->obj = dpt_obj; dpt->obj = dpt_obj;
dpt->obj->is_dpt = true;
return &dpt->vm; return &dpt->vm;
} }
...@@ -309,5 +310,6 @@ void intel_dpt_destroy(struct i915_address_space *vm) ...@@ -309,5 +310,6 @@ void intel_dpt_destroy(struct i915_address_space *vm)
{ {
struct i915_dpt *dpt = i915_vm_to_dpt(vm); struct i915_dpt *dpt = i915_vm_to_dpt(vm);
dpt->obj->is_dpt = false;
i915_vm_put(&dpt->vm); i915_vm_put(&dpt->vm);
} }
...@@ -418,9 +418,9 @@ static bool icl_tc_phy_is_owned(struct intel_digital_port *dig_port) ...@@ -418,9 +418,9 @@ static bool icl_tc_phy_is_owned(struct intel_digital_port *dig_port)
val = intel_de_read(i915, PORT_TX_DFLEXDPCSSS(dig_port->tc_phy_fia)); val = intel_de_read(i915, PORT_TX_DFLEXDPCSSS(dig_port->tc_phy_fia));
if (val == 0xffffffff) { if (val == 0xffffffff) {
drm_dbg_kms(&i915->drm, drm_dbg_kms(&i915->drm,
"Port %s: PHY in TCCOLD, assume safe mode\n", "Port %s: PHY in TCCOLD, assume not owned\n",
dig_port->tc_port_name); dig_port->tc_port_name);
return true; return false;
} }
return val & DP_PHY_MODE_STATUS_NOT_SAFE(dig_port->tc_phy_fia_idx); return val & DP_PHY_MODE_STATUS_NOT_SAFE(dig_port->tc_phy_fia_idx);
......
...@@ -127,7 +127,8 @@ i915_gem_object_create_lmem_from_data(struct drm_i915_private *i915, ...@@ -127,7 +127,8 @@ i915_gem_object_create_lmem_from_data(struct drm_i915_private *i915,
memcpy(map, data, size); memcpy(map, data, size);
i915_gem_object_unpin_map(obj); i915_gem_object_flush_map(obj);
__i915_gem_object_release_map(obj);
return obj; return obj;
} }
......
...@@ -303,7 +303,7 @@ i915_gem_object_never_mmap(const struct drm_i915_gem_object *obj) ...@@ -303,7 +303,7 @@ i915_gem_object_never_mmap(const struct drm_i915_gem_object *obj)
static inline bool static inline bool
i915_gem_object_is_framebuffer(const struct drm_i915_gem_object *obj) i915_gem_object_is_framebuffer(const struct drm_i915_gem_object *obj)
{ {
return READ_ONCE(obj->frontbuffer); return READ_ONCE(obj->frontbuffer) || obj->is_dpt;
} }
static inline unsigned int static inline unsigned int
......
...@@ -491,6 +491,9 @@ struct drm_i915_gem_object { ...@@ -491,6 +491,9 @@ struct drm_i915_gem_object {
*/ */
unsigned int cache_dirty:1; unsigned int cache_dirty:1;
/* @is_dpt: Object houses a display page table (DPT) */
unsigned int is_dpt:1;
/** /**
* @read_domains: Read memory domains. * @read_domains: Read memory domains.
* *
......
...@@ -2075,16 +2075,6 @@ void intel_rps_sanitize(struct intel_rps *rps) ...@@ -2075,16 +2075,6 @@ void intel_rps_sanitize(struct intel_rps *rps)
rps_disable_interrupts(rps); rps_disable_interrupts(rps);
} }
u32 intel_rps_read_rpstat_fw(struct intel_rps *rps)
{
struct drm_i915_private *i915 = rps_to_i915(rps);
i915_reg_t rpstat;
rpstat = (GRAPHICS_VER(i915) >= 12) ? GEN12_RPSTAT1 : GEN6_RPSTAT1;
return intel_uncore_read_fw(rps_to_gt(rps)->uncore, rpstat);
}
u32 intel_rps_read_rpstat(struct intel_rps *rps) u32 intel_rps_read_rpstat(struct intel_rps *rps)
{ {
struct drm_i915_private *i915 = rps_to_i915(rps); struct drm_i915_private *i915 = rps_to_i915(rps);
...@@ -2095,7 +2085,7 @@ u32 intel_rps_read_rpstat(struct intel_rps *rps) ...@@ -2095,7 +2085,7 @@ u32 intel_rps_read_rpstat(struct intel_rps *rps)
return intel_uncore_read(rps_to_gt(rps)->uncore, rpstat); return intel_uncore_read(rps_to_gt(rps)->uncore, rpstat);
} }
u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat) static u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
{ {
struct drm_i915_private *i915 = rps_to_i915(rps); struct drm_i915_private *i915 = rps_to_i915(rps);
u32 cagf; u32 cagf;
...@@ -2118,10 +2108,11 @@ u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat) ...@@ -2118,10 +2108,11 @@ u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
return cagf; return cagf;
} }
static u32 read_cagf(struct intel_rps *rps) static u32 __read_cagf(struct intel_rps *rps, bool take_fw)
{ {
struct drm_i915_private *i915 = rps_to_i915(rps); struct drm_i915_private *i915 = rps_to_i915(rps);
struct intel_uncore *uncore = rps_to_uncore(rps); struct intel_uncore *uncore = rps_to_uncore(rps);
i915_reg_t r = INVALID_MMIO_REG;
u32 freq; u32 freq;
/* /*
...@@ -2129,22 +2120,30 @@ static u32 read_cagf(struct intel_rps *rps) ...@@ -2129,22 +2120,30 @@ static u32 read_cagf(struct intel_rps *rps)
* registers will return 0 freq when GT is in RC6 * registers will return 0 freq when GT is in RC6
*/ */
if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 70)) { if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 70)) {
freq = intel_uncore_read(uncore, MTL_MIRROR_TARGET_WP1); r = MTL_MIRROR_TARGET_WP1;
} else if (GRAPHICS_VER(i915) >= 12) { } else if (GRAPHICS_VER(i915) >= 12) {
freq = intel_uncore_read(uncore, GEN12_RPSTAT1); r = GEN12_RPSTAT1;
} else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) { } else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) {
vlv_punit_get(i915); vlv_punit_get(i915);
freq = vlv_punit_read(i915, PUNIT_REG_GPU_FREQ_STS); freq = vlv_punit_read(i915, PUNIT_REG_GPU_FREQ_STS);
vlv_punit_put(i915); vlv_punit_put(i915);
} else if (GRAPHICS_VER(i915) >= 6) { } else if (GRAPHICS_VER(i915) >= 6) {
freq = intel_uncore_read(uncore, GEN6_RPSTAT1); r = GEN6_RPSTAT1;
} else { } else {
freq = intel_uncore_read(uncore, MEMSTAT_ILK); r = MEMSTAT_ILK;
} }
if (i915_mmio_reg_valid(r))
freq = take_fw ? intel_uncore_read(uncore, r) : intel_uncore_read_fw(uncore, r);
return intel_rps_get_cagf(rps, freq); return intel_rps_get_cagf(rps, freq);
} }
static u32 read_cagf(struct intel_rps *rps)
{
return __read_cagf(rps, true);
}
u32 intel_rps_read_actual_frequency(struct intel_rps *rps) u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
{ {
struct intel_runtime_pm *rpm = rps_to_uncore(rps)->rpm; struct intel_runtime_pm *rpm = rps_to_uncore(rps)->rpm;
...@@ -2157,7 +2156,12 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps) ...@@ -2157,7 +2156,12 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
return freq; return freq;
} }
u32 intel_rps_read_punit_req(struct intel_rps *rps) u32 intel_rps_read_actual_frequency_fw(struct intel_rps *rps)
{
return intel_gpu_freq(rps, __read_cagf(rps, false));
}
static u32 intel_rps_read_punit_req(struct intel_rps *rps)
{ {
struct intel_uncore *uncore = rps_to_uncore(rps); struct intel_uncore *uncore = rps_to_uncore(rps);
struct intel_runtime_pm *rpm = rps_to_uncore(rps)->rpm; struct intel_runtime_pm *rpm = rps_to_uncore(rps)->rpm;
......
...@@ -37,8 +37,8 @@ void intel_rps_mark_interactive(struct intel_rps *rps, bool interactive); ...@@ -37,8 +37,8 @@ void intel_rps_mark_interactive(struct intel_rps *rps, bool interactive);
int intel_gpu_freq(struct intel_rps *rps, int val); int intel_gpu_freq(struct intel_rps *rps, int val);
int intel_freq_opcode(struct intel_rps *rps, int val); int intel_freq_opcode(struct intel_rps *rps, int val);
u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat1);
u32 intel_rps_read_actual_frequency(struct intel_rps *rps); u32 intel_rps_read_actual_frequency(struct intel_rps *rps);
u32 intel_rps_read_actual_frequency_fw(struct intel_rps *rps);
u32 intel_rps_get_requested_frequency(struct intel_rps *rps); u32 intel_rps_get_requested_frequency(struct intel_rps *rps);
u32 intel_rps_get_min_frequency(struct intel_rps *rps); u32 intel_rps_get_min_frequency(struct intel_rps *rps);
u32 intel_rps_get_min_raw_freq(struct intel_rps *rps); u32 intel_rps_get_min_raw_freq(struct intel_rps *rps);
...@@ -49,10 +49,8 @@ int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val); ...@@ -49,10 +49,8 @@ int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val);
u32 intel_rps_get_rp0_frequency(struct intel_rps *rps); u32 intel_rps_get_rp0_frequency(struct intel_rps *rps);
u32 intel_rps_get_rp1_frequency(struct intel_rps *rps); u32 intel_rps_get_rp1_frequency(struct intel_rps *rps);
u32 intel_rps_get_rpn_frequency(struct intel_rps *rps); u32 intel_rps_get_rpn_frequency(struct intel_rps *rps);
u32 intel_rps_read_punit_req(struct intel_rps *rps);
u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps); u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps);
u32 intel_rps_read_rpstat(struct intel_rps *rps); u32 intel_rps_read_rpstat(struct intel_rps *rps);
u32 intel_rps_read_rpstat_fw(struct intel_rps *rps);
void gen6_rps_get_freq_caps(struct intel_rps *rps, struct intel_rps_freq_caps *caps); void gen6_rps_get_freq_caps(struct intel_rps *rps, struct intel_rps_freq_caps *caps);
void intel_rps_raise_unslice(struct intel_rps *rps); void intel_rps_raise_unslice(struct intel_rps *rps);
void intel_rps_lower_unslice(struct intel_rps *rps); void intel_rps_lower_unslice(struct intel_rps *rps);
......
...@@ -1592,9 +1592,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) ...@@ -1592,9 +1592,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)
/* /*
* Wa_16011777198:dg2: Unset the override of GUCRC mode to enable rc6. * Wa_16011777198:dg2: Unset the override of GUCRC mode to enable rc6.
*/ */
if (intel_uc_uses_guc_rc(&gt->uc) && if (stream->override_gucrc)
(IS_DG2_GRAPHICS_STEP(gt->i915, G10, STEP_A0, STEP_C0) ||
IS_DG2_GRAPHICS_STEP(gt->i915, G11, STEP_A0, STEP_B0)))
drm_WARN_ON(&gt->i915->drm, drm_WARN_ON(&gt->i915->drm,
intel_guc_slpc_unset_gucrc_mode(&gt->uc.guc.slpc)); intel_guc_slpc_unset_gucrc_mode(&gt->uc.guc.slpc));
...@@ -3305,8 +3303,10 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, ...@@ -3305,8 +3303,10 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
if (ret) { if (ret) {
drm_dbg(&stream->perf->i915->drm, drm_dbg(&stream->perf->i915->drm,
"Unable to override gucrc mode\n"); "Unable to override gucrc mode\n");
goto err_config; goto err_gucrc;
} }
stream->override_gucrc = true;
} }
ret = alloc_oa_buffer(stream); ret = alloc_oa_buffer(stream);
...@@ -3345,11 +3345,15 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, ...@@ -3345,11 +3345,15 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
free_oa_buffer(stream); free_oa_buffer(stream);
err_oa_buf_alloc: err_oa_buf_alloc:
free_oa_configs(stream); if (stream->override_gucrc)
intel_guc_slpc_unset_gucrc_mode(&gt->uc.guc.slpc);
err_gucrc:
intel_uncore_forcewake_put(stream->uncore, FORCEWAKE_ALL); intel_uncore_forcewake_put(stream->uncore, FORCEWAKE_ALL);
intel_engine_pm_put(stream->engine); intel_engine_pm_put(stream->engine);
free_oa_configs(stream);
err_config: err_config:
free_noa_wait(stream); free_noa_wait(stream);
......
...@@ -316,6 +316,12 @@ struct i915_perf_stream { ...@@ -316,6 +316,12 @@ struct i915_perf_stream {
* buffer should be checked for available data. * buffer should be checked for available data.
*/ */
u64 poll_oa_period; u64 poll_oa_period;
/**
* @override_gucrc: GuC RC has been overridden for the perf stream,
* and we need to restore the default configuration on release.
*/
bool override_gucrc;
}; };
/** /**
......
...@@ -393,14 +393,12 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns) ...@@ -393,14 +393,12 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
* case we assume the system is running at the intended * case we assume the system is running at the intended
* frequency. Fortunately, the read should rarely fail! * frequency. Fortunately, the read should rarely fail!
*/ */
val = intel_rps_read_rpstat_fw(rps); val = intel_rps_read_actual_frequency_fw(rps);
if (val) if (!val)
val = intel_rps_get_cagf(rps, val); val = intel_gpu_freq(rps, rps->cur_freq);
else
val = rps->cur_freq;
add_sample_mult(&pmu->sample[__I915_SAMPLE_FREQ_ACT], add_sample_mult(&pmu->sample[__I915_SAMPLE_FREQ_ACT],
intel_gpu_freq(rps, val), period_ns / 1000); val, period_ns / 1000);
} }
if (pmu->enable & config_mask(I915_PMU_REQUESTED_FREQUENCY)) { if (pmu->enable & config_mask(I915_PMU_REQUESTED_FREQUENCY)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment