Skip to content

Commit

Permalink
drm/i915: hide VLV PUNIT IOSF sideband qos handling better
Browse files Browse the repository at this point in the history
The sideband latency qos request is only used for VLV PUNIT
access. Abstract it better, and also add the request for VLV only.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/92632f64c1256bfafe7ebf49c1ad0618157d9484.1730193891.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
  • Loading branch information
Jani Nikula committed Nov 5, 2024
1 parent a72e1c1 commit ec70912
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 0 additions & 2 deletions drivers/gpu/drm/i915/i915_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
intel_sbi_init(dev_priv);
vlv_iosf_sb_init(dev_priv);
mutex_init(&dev_priv->sb_lock);
cpu_latency_qos_add_request(&dev_priv->sb_qos, PM_QOS_DEFAULT_VALUE);

i915_memcpy_init_early(dev_priv);
intel_runtime_pm_init_early(&dev_priv->runtime_pm);
Expand Down Expand Up @@ -294,7 +293,6 @@ static void i915_driver_late_release(struct drm_i915_private *dev_priv)
vlv_suspend_cleanup(dev_priv);
i915_workqueues_cleanup(dev_priv);

cpu_latency_qos_remove_request(&dev_priv->sb_qos);
mutex_destroy(&dev_priv->sb_lock);
vlv_iosf_sb_fini(dev_priv);
intel_sbi_fini(dev_priv);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ struct drm_i915_private {
/* VLV/CHV IOSF sideband */
struct {
struct mutex lock; /* protect sideband access */
struct pm_qos_request qos;
} vlv_iosf_sb;

/* Sideband mailbox protection */
struct mutex sb_lock;
struct pm_qos_request sb_qos;

/** Cached value of IMR to avoid reads in updating the bitfield */
u32 irq_mask;
Expand Down
10 changes: 8 additions & 2 deletions drivers/gpu/drm/i915/vlv_sideband.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ static void __vlv_punit_get(struct drm_i915_private *i915)
* to the Valleyview P-unit and not all sideband communications.
*/
if (IS_VALLEYVIEW(i915)) {
cpu_latency_qos_update_request(&i915->sb_qos, 0);
cpu_latency_qos_update_request(&i915->vlv_iosf_sb.qos, 0);
on_each_cpu(ping, NULL, 1);
}
}

static void __vlv_punit_put(struct drm_i915_private *i915)
{
if (IS_VALLEYVIEW(i915))
cpu_latency_qos_update_request(&i915->sb_qos,
cpu_latency_qos_update_request(&i915->vlv_iosf_sb.qos,
PM_QOS_DEFAULT_VALUE);

iosf_mbi_punit_release();
Expand Down Expand Up @@ -254,10 +254,16 @@ void vlv_iosf_sb_init(struct drm_i915_private *i915)
{
if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
mutex_init(&i915->vlv_iosf_sb.lock);

if (IS_VALLEYVIEW(i915))
cpu_latency_qos_add_request(&i915->vlv_iosf_sb.qos, PM_QOS_DEFAULT_VALUE);
}

void vlv_iosf_sb_fini(struct drm_i915_private *i915)
{
if (IS_VALLEYVIEW(i915))
cpu_latency_qos_remove_request(&i915->vlv_iosf_sb.qos);

if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
mutex_destroy(&i915->vlv_iosf_sb.lock);
}

0 comments on commit ec70912

Please sign in to comment.