From patchwork Tue Sep 30 10:05:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jike Song X-Patchwork-Id: 5001801 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 768DABEEA6 for ; Tue, 30 Sep 2014 10:11:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 96F412016C for ; Tue, 30 Sep 2014 10:11:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9A6BD2017D for ; Tue, 30 Sep 2014 10:11:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 081016E636; Tue, 30 Sep 2014 03:11:36 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id D64576E636 for ; Tue, 30 Sep 2014 03:11:34 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by fmsmga103.fm.intel.com with ESMTP; 30 Sep 2014 03:02:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,625,1406617200"; d="scan'208";a="480959870" Received: from kvmgt.bj.intel.com ([10.238.154.64]) by azsmga001.ch.intel.com with ESMTP; 30 Sep 2014 03:11:32 -0700 From: Jike Song To: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org Date: Tue, 30 Sep 2014 18:05:32 +0800 Message-Id: <1412071538-19059-3-git-send-email-jike.song@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1412071538-19059-1-git-send-email-jike.song@intel.com> References: <1412071538-19059-1-git-send-email-jike.song@intel.com> Subject: [Intel-gfx] [RFC PATCH 2/8] drm/i915: introduce the skeleton of vgt X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 #include #include @@ -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 +#include +#include + +#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