[Intel-gfx] [RFC PATCH 2/8] drm/i915: introduce the skeleton of vgt

Jike Song jike.song at intel.com
Tue Sep 30 12:05:32 CEST 2014


This patch introduces the skeleton of vgt, an i915 add-on
for controlling physical GPU resources and sharing among VMs.

Signed-off-by: Jike Song <jike.song at intel.com>
---
 drivers/gpu/drm/i915/Kconfig    | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/Makefile   |  4 ++++
 drivers/gpu/drm/i915/i915_drv.c | 10 ++++++++++
 drivers/gpu/drm/i915/i915_vgt.h | 17 +++++++++++++++++
 drivers/gpu/drm/i915/vgt/vgt.c  | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/vgt/vgt.h  |  6 ++++++
 6 files changed, 73 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/i915_vgt.h
 create mode 100644 drivers/gpu/drm/i915/vgt/vgt.c
 create mode 100644 drivers/gpu/drm/i915/vgt/vgt.h

diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index 4e39ab3..aa87e75 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -69,3 +69,21 @@ config DRM_I915_PRELIMINARY_HW_SUPPORT
 	  option changes the default for that module option.
 
 	  If in doubt, say "N".
+
+config I915_IGVT
+	bool "I915 Intel Graphics Virtualization Technology for shared vCPU(Intel GVT-g)"
+	depends on DRM_I915
+	default n
+	help
+	  Intel GVT-g is an efficient GPU sharing technology among multiple Virtual
+	  Machines (VMs), providing full GPU virtualization so native graphics driver
+	  can run inside a VM seamlessly. Both 3D/Media/Compute tasks can be
+	  accelerated simultaneously in multi-VMs, on an Intel Processor Graphics.
+	  Intel GVT-g adopts a mediated pass-through concept, by passing through
+	  performance-critical operations (frame buffer access and command submission),
+	  while trap-and-emulating privileged operations (I/O, GPU page table, etc.).
+	  Overall it can achieve a good balance between performance, feature and
+	  sharing capability.
+
+	  This option specifically enables 'vgt' component in i915 driver,
+	  implementing vGPU device model and GPU sharing capability.
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 2d8317d..8379d19 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -78,6 +78,10 @@ i915-y += dvo_ch7017.o \
 i915-y += i915_dma.o \
 	  i915_ums.o
 
+
+VGT				:= vgt
+i915-$(CONFIG_I915_IGVT)	+= $(VGT)/vgt.o
+
 obj-$(CONFIG_DRM_I915)  += i915.o
 
 CFLAGS_i915_trace_points.o := -I$(src)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6948877..6dbb706 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -35,6 +35,8 @@
 #include "i915_trace.h"
 #include "intel_drv.h"
 
+#include "i915_vgt.h"
+
 #include <linux/console.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
@@ -923,6 +925,14 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	driver.driver_features &= ~(DRIVER_USE_AGP);
 
+	if (i915.enable_vgt) {
+		if (!i915_start_vgt(pdev))
+			i915.enable_vgt = false;
+
+		DRM_INFO("i915_start_vgt %s\n", i915.enable_vgt ?
+					"succedded" : "failed");
+	}
+
 	return drm_get_pci_dev(pdev, ent, &driver);
 }
 
diff --git a/drivers/gpu/drm/i915/i915_vgt.h b/drivers/gpu/drm/i915/i915_vgt.h
new file mode 100644
index 0000000..c6a4144
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_vgt.h
@@ -0,0 +1,17 @@
+#ifndef _I915_VGT_H_
+#define _I915_VGT_H_
+
+#ifdef CONFIG_I915_IGVT
+
+bool i915_start_vgt(struct pci_dev *);
+
+#else /* !CONFIG_I915_IGVT */
+
+static inline bool i915_start_vgt(struct pci_dev *pdev)
+{
+	return false;
+}
+
+#endif /* CONFIG_I915_IGVT */
+
+#endif
diff --git a/drivers/gpu/drm/i915/vgt/vgt.c b/drivers/gpu/drm/i915/vgt/vgt.c
new file mode 100644
index 0000000..07ccee6
--- /dev/null
+++ b/drivers/gpu/drm/i915/vgt/vgt.c
@@ -0,0 +1,18 @@
+#include <linux/module.h>
+#include <linux/kthread.h>
+#include <linux/pci.h>
+
+#include "vgt.h"
+
+
+/**
+ * Initialize Intel GVT-g
+ *
+ * \return true for success
+ * \return false for failure
+ */
+bool i915_start_vgt(struct pci_dev *pdev)
+{
+	/* vgt is not yet integrated, this only means testing */
+	return false;
+}
diff --git a/drivers/gpu/drm/i915/vgt/vgt.h b/drivers/gpu/drm/i915/vgt/vgt.h
new file mode 100644
index 0000000..62d03fd
--- /dev/null
+++ b/drivers/gpu/drm/i915/vgt/vgt.h
@@ -0,0 +1,6 @@
+#ifndef _VGT_DRV_H_
+#define _VGT_DRV_H_
+
+#include "../i915_vgt.h"
+
+#endif
-- 
1.9.1




More information about the Intel-gfx mailing list