Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4734057 authored by Zhi Wang's avatar Zhi Wang Committed by Zhenyu Wang
Browse files

drm/i915/gvt: vGPU workload scheduler



This patch introduces the vGPU workload scheduler routines.

GVT workload scheduler is responsible for picking and executing GVT workload
from current scheduled vGPU. Before the workload is submitted to host i915,
the guest execlist context will be shadowed in the host GVT shadow context.
the instructions in guest ring buffer will be copied into GVT shadow ring
buffer. Then GVT-g workload scheduler will scan the instructions in guest
ring buffer and submit it to host i915.

Signed-off-by: default avatarZhi Wang <zhi.a.wang@intel.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent 28c4c6ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
GVT_DIR := gvt
GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
	interrupt.o gtt.o cfg_space.o opregion.o mmio.o display.o edid.o \
	execlist.o
	execlist.o scheduler.o

ccflags-y                      += -I$(src) -I$(src)/$(GVT_DIR) -Wall
i915-y			       += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
+3 −0
Original line number Diff line number Diff line
@@ -45,4 +45,7 @@
#define gvt_dbg_el(fmt, args...) \
	DRM_DEBUG_DRIVER("gvt: el: "fmt, ##args)

#define gvt_dbg_sched(fmt, args...) \
	DRM_DEBUG_DRIVER("gvt: sched: "fmt, ##args)

#endif
+23 −1
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ static int complete_execlist_workload(struct intel_vgpu_workload *workload)
	gvt_dbg_el("complete workload %p status %d\n", workload,
			workload->status);

	if (workload->status)
	if (workload->status || vgpu->resetting)
		goto out;

	if (!list_empty(workload_q_head(vgpu, workload->ring_id))) {
@@ -672,3 +672,25 @@ int intel_vgpu_init_execlist(struct intel_vgpu *vgpu)

	return 0;
}

void intel_vgpu_reset_execlist(struct intel_vgpu *vgpu,
		unsigned long ring_bitmap)
{
	int bit;
	struct list_head *pos, *n;
	struct intel_vgpu_workload *workload = NULL;

	for_each_set_bit(bit, &ring_bitmap, sizeof(ring_bitmap) * 8) {
		if (bit >= I915_NUM_ENGINES)
			break;
		/* free the unsubmited workload in the queue */
		list_for_each_safe(pos, n, &vgpu->workload_q_head[bit]) {
			workload = container_of(pos,
					struct intel_vgpu_workload, list);
			list_del_init(&workload->list);
			free_workload(workload);
		}

		init_vgpu_execlist(vgpu, bit);
	}
}
+3 −0
Original line number Diff line number Diff line
@@ -182,4 +182,7 @@ int intel_vgpu_init_execlist(struct intel_vgpu *vgpu);

int intel_vgpu_submit_execlist(struct intel_vgpu *vgpu, int ring_id);

void intel_vgpu_reset_execlist(struct intel_vgpu *vgpu,
		unsigned long ring_bitmap);

#endif /*_GVT_EXECLIST_H_*/
+8 −1
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv)
		return;

	clean_service_thread(gvt);
	intel_gvt_clean_workload_scheduler(gvt);
	intel_gvt_clean_opregion(gvt);
	intel_gvt_clean_gtt(gvt);
	intel_gvt_clean_irq(gvt);
@@ -239,14 +240,20 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
	if (ret)
		goto out_clean_gtt;

	ret = init_service_thread(gvt);
	ret = intel_gvt_init_workload_scheduler(gvt);
	if (ret)
		goto out_clean_opregion;

	ret = init_service_thread(gvt);
	if (ret)
		goto out_clean_workload_scheduler;

	gvt_dbg_core("gvt device creation is done\n");
	gvt->initialized = true;
	return 0;

out_clean_workload_scheduler:
	intel_gvt_clean_workload_scheduler(gvt);
out_clean_opregion:
	intel_gvt_clean_opregion(gvt);
out_clean_gtt:
Loading