aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorHang Yuan <hang.yuan@linux.intel.com>2018-08-29 05:15:56 -0400
committerZhenyu Wang <zhenyuw@linux.intel.com>2018-08-30 00:54:32 -0400
commitb2b599fb54f90ae395ddc51f0d49e4f28244a8f8 (patch)
tree203bdb7cd72ab203716a90b6bc8f8c7fa71f351e /drivers/gpu
parentb9b824a55876275f8506c1c187558ab22d879f73 (diff)
drm/i915/gvt: move intel_runtime_pm_get out of spin_lock in stop_schedule
pm_runtime_get_sync in intel_runtime_pm_get might sleep if i915 device is not active. When stop vgpu schedule, the device may be inactive. So need to move runtime_pm_get out of spin_lock/unlock. Fixes: b24881e0b0b6("drm/i915/gvt: Add runtime_pm_get/put into gvt_switch_mmio Cc: <stable@vger.kernel.org> Signed-off-by: Hang Yuan <hang.yuan@linux.intel.com> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/gvt/mmio_context.c2
-rw-r--r--drivers/gpu/drm/i915/gvt/sched_policy.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/gvt/mmio_context.c b/drivers/gpu/drm/i915/gvt/mmio_context.c
index 42e1e6bdcc2c..e872f4847fbe 100644
--- a/drivers/gpu/drm/i915/gvt/mmio_context.c
+++ b/drivers/gpu/drm/i915/gvt/mmio_context.c
@@ -562,11 +562,9 @@ void intel_gvt_switch_mmio(struct intel_vgpu *pre,
562 * performace for batch mmio read/write, so we need 562 * performace for batch mmio read/write, so we need
563 * handle forcewake mannually. 563 * handle forcewake mannually.
564 */ 564 */
565 intel_runtime_pm_get(dev_priv);
566 intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); 565 intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
567 switch_mmio(pre, next, ring_id); 566 switch_mmio(pre, next, ring_id);
568 intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); 567 intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
569 intel_runtime_pm_put(dev_priv);
570} 568}
571 569
572/** 570/**
diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c
index 09d7bb72b4ff..985fe81794dd 100644
--- a/drivers/gpu/drm/i915/gvt/sched_policy.c
+++ b/drivers/gpu/drm/i915/gvt/sched_policy.c
@@ -426,6 +426,7 @@ void intel_vgpu_stop_schedule(struct intel_vgpu *vgpu)
426 &vgpu->gvt->scheduler; 426 &vgpu->gvt->scheduler;
427 int ring_id; 427 int ring_id;
428 struct vgpu_sched_data *vgpu_data = vgpu->sched_data; 428 struct vgpu_sched_data *vgpu_data = vgpu->sched_data;
429 struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
429 430
430 if (!vgpu_data->active) 431 if (!vgpu_data->active)
431 return; 432 return;
@@ -444,6 +445,7 @@ void intel_vgpu_stop_schedule(struct intel_vgpu *vgpu)
444 scheduler->current_vgpu = NULL; 445 scheduler->current_vgpu = NULL;
445 } 446 }
446 447
448 intel_runtime_pm_get(dev_priv);
447 spin_lock_bh(&scheduler->mmio_context_lock); 449 spin_lock_bh(&scheduler->mmio_context_lock);
448 for (ring_id = 0; ring_id < I915_NUM_ENGINES; ring_id++) { 450 for (ring_id = 0; ring_id < I915_NUM_ENGINES; ring_id++) {
449 if (scheduler->engine_owner[ring_id] == vgpu) { 451 if (scheduler->engine_owner[ring_id] == vgpu) {
@@ -452,5 +454,6 @@ void intel_vgpu_stop_schedule(struct intel_vgpu *vgpu)
452 } 454 }
453 } 455 }
454 spin_unlock_bh(&scheduler->mmio_context_lock); 456 spin_unlock_bh(&scheduler->mmio_context_lock);
457 intel_runtime_pm_put(dev_priv);
455 mutex_unlock(&vgpu->gvt->sched_lock); 458 mutex_unlock(&vgpu->gvt->sched_lock);
456} 459}