From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161907AbdD1JkR (ORCPT ); Fri, 28 Apr 2017 05:40:17 -0400 Received: from mga03.intel.com ([134.134.136.65]:34405 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034682AbdD1Jju (ORCPT ); Fri, 28 Apr 2017 05:39:50 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,387,1488873600"; d="scan'208";a="1124389889" From: Xiaoguang Chen To: kraxel@redhat.com, alex.williamson@redhat.com, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, zhi.a.wang@intel.com, zhenyuw@linux.intel.com, linux-kernel@vger.kernel.org, zhiyuan.lv@intel.com, kevin.tian@intel.com Cc: Xiaoguang Chen Subject: [RFC PATCH 0/6] drm/i915/gvt: dma-buf support for GVT-g Date: Fri, 28 Apr 2017 17:35:24 +0800 Message-Id: <1493372130-27727-1-git-send-email-xiaoguang.chen@intel.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set adds the dma-buf support for intel GVT-g. dma-buf is a uniform mechanism to share DMA buffers across different devices and sub-systems. dma-buf for intel GVT-g is mainly used to share the vgpu's framebuffer to other users or sub-systems so they can use the dma-buf to show the desktop of a vm which uses intel vgpu. The main idea is we create a gem object and set vgpu's framebuffer as the backing storage of this gem object. And associate this gem obj to a dma-buf object then export this dma-buf at the meantime generate a file descriptor for this dma-buf. Finally deliver this file descriptor to end users. In the implementation we create an anonymous fd and send this fd to users using an vfio device region. Once users get this anonymous fd they can do ioctl using this anonymous fd to get the file descriptor we generated for dma-buf. We have an example program on how to use the dma-buf. You can download the program to have a try :) git repo: https://github.com/01org/igvtg-qemu branch:kvmgt_dmabuf_example Xiaoguang Chen (6): drm/i915/gvt: extend the GVT-g architecture to support vfio device region drm/i915/gvt: OpRegion support for GVT-g drm/i915/gvt: framebuffer decoder support for GVT-g drm/i915: export i915 dmabuf_ops drm/i915/gvt: dmabuf support for GVT-g drm/i915/gvt: support QEMU getting the dmabuf drivers/gpu/drm/i915/gvt/Makefile | 3 +- drivers/gpu/drm/i915/gvt/display.c | 2 +- drivers/gpu/drm/i915/gvt/display.h | 2 + drivers/gpu/drm/i915/gvt/dmabuf.c | 268 ++++++++++++++++++ drivers/gpu/drm/i915/gvt/dmabuf.h | 50 ++++ drivers/gpu/drm/i915/gvt/fb_decoder.c | 487 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/gvt/fb_decoder.h | 170 ++++++++++++ drivers/gpu/drm/i915/gvt/gvt.c | 2 + drivers/gpu/drm/i915/gvt/gvt.h | 4 + drivers/gpu/drm/i915/gvt/kvmgt.c | 227 ++++++++++++++- drivers/gpu/drm/i915/gvt/opregion.c | 12 +- drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/i915_gem_dmabuf.c | 2 +- include/uapi/linux/vfio.h | 1 + 14 files changed, 1224 insertions(+), 8 deletions(-) create mode 100644 drivers/gpu/drm/i915/gvt/dmabuf.c create mode 100644 drivers/gpu/drm/i915/gvt/dmabuf.h create mode 100644 drivers/gpu/drm/i915/gvt/fb_decoder.c create mode 100644 drivers/gpu/drm/i915/gvt/fb_decoder.h -- 1.9.1