|
@@ -179,20 +179,34 @@ static void intel_gvt_update_vgpu_types(struct intel_gvt *gvt)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * intel_gvt_destroy_vgpu - destroy a virtual GPU
|
|
|
|
|
|
+ * intel_gvt_active_vgpu - activate a virtual GPU
|
|
* @vgpu: virtual GPU
|
|
* @vgpu: virtual GPU
|
|
*
|
|
*
|
|
- * This function is called when user wants to destroy a virtual GPU.
|
|
|
|
|
|
+ * This function is called when user wants to activate a virtual GPU.
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
-void intel_gvt_destroy_vgpu(struct intel_vgpu *vgpu)
|
|
|
|
|
|
+void intel_gvt_activate_vgpu(struct intel_vgpu *vgpu)
|
|
|
|
+{
|
|
|
|
+ mutex_lock(&vgpu->gvt->lock);
|
|
|
|
+ vgpu->active = true;
|
|
|
|
+ mutex_unlock(&vgpu->gvt->lock);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * intel_gvt_deactive_vgpu - deactivate a virtual GPU
|
|
|
|
+ * @vgpu: virtual GPU
|
|
|
|
+ *
|
|
|
|
+ * This function is called when user wants to deactivate a virtual GPU.
|
|
|
|
+ * All virtual GPU runtime information will be destroyed.
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+void intel_gvt_deactivate_vgpu(struct intel_vgpu *vgpu)
|
|
{
|
|
{
|
|
struct intel_gvt *gvt = vgpu->gvt;
|
|
struct intel_gvt *gvt = vgpu->gvt;
|
|
|
|
|
|
mutex_lock(&gvt->lock);
|
|
mutex_lock(&gvt->lock);
|
|
|
|
|
|
vgpu->active = false;
|
|
vgpu->active = false;
|
|
- idr_remove(&gvt->vgpu_idr, vgpu->id);
|
|
|
|
|
|
|
|
if (atomic_read(&vgpu->running_workload_num)) {
|
|
if (atomic_read(&vgpu->running_workload_num)) {
|
|
mutex_unlock(&gvt->lock);
|
|
mutex_unlock(&gvt->lock);
|
|
@@ -201,6 +215,26 @@ void intel_gvt_destroy_vgpu(struct intel_vgpu *vgpu)
|
|
}
|
|
}
|
|
|
|
|
|
intel_vgpu_stop_schedule(vgpu);
|
|
intel_vgpu_stop_schedule(vgpu);
|
|
|
|
+
|
|
|
|
+ mutex_unlock(&gvt->lock);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * intel_gvt_destroy_vgpu - destroy a virtual GPU
|
|
|
|
+ * @vgpu: virtual GPU
|
|
|
|
+ *
|
|
|
|
+ * This function is called when user wants to destroy a virtual GPU.
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+void intel_gvt_destroy_vgpu(struct intel_vgpu *vgpu)
|
|
|
|
+{
|
|
|
|
+ struct intel_gvt *gvt = vgpu->gvt;
|
|
|
|
+
|
|
|
|
+ mutex_lock(&gvt->lock);
|
|
|
|
+
|
|
|
|
+ WARN(vgpu->active, "vGPU is still active!\n");
|
|
|
|
+
|
|
|
|
+ idr_remove(&gvt->vgpu_idr, vgpu->id);
|
|
intel_vgpu_clean_sched_policy(vgpu);
|
|
intel_vgpu_clean_sched_policy(vgpu);
|
|
intel_vgpu_clean_gvt_context(vgpu);
|
|
intel_vgpu_clean_gvt_context(vgpu);
|
|
intel_vgpu_clean_execlist(vgpu);
|
|
intel_vgpu_clean_execlist(vgpu);
|
|
@@ -277,7 +311,6 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
|
|
if (ret)
|
|
if (ret)
|
|
goto out_clean_shadow_ctx;
|
|
goto out_clean_shadow_ctx;
|
|
|
|
|
|
- vgpu->active = true;
|
|
|
|
mutex_unlock(&gvt->lock);
|
|
mutex_unlock(&gvt->lock);
|
|
|
|
|
|
return vgpu;
|
|
return vgpu;
|