Skip to content

Commit 659643f

Browse files
l1viathanzhenyw
authored andcommitted
drm/i915/gvt/kvmgt: add vfio/mdev support to KVMGT
KVMGT leverages vfio/mdev to mediate device accesses from guest, this patch adds the vfio/mdev support, thereby completes the functionality. An intel_vgpu is presented as a mdev device, and full userspace API compatibility with vfio-pci is kept. An intel_vgpu_ops is provided to mdev framework, methods get called to create/remove a vgpu, to open/close it, and to access it. Signed-off-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Xiaoguang Chen <xiaoguang.chen@intel.com> Signed-off-by: Jike Song <jike.song@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
1 parent f440c8a commit 659643f

File tree

4 files changed

+907
-40
lines changed

4 files changed

+907
-40
lines changed

drivers/gpu/drm/i915/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ config DRM_I915_GVT_KVMGT
116116
tristate "Enable KVM/VFIO support for Intel GVT-g"
117117
depends on DRM_I915_GVT
118118
depends on KVM
119+
depends on VFIO_MDEV && VFIO_MDEV_DEVICE
119120
default n
120121
help
121122
Choose this option if you want to enable KVMGT support for

drivers/gpu/drm/i915/gvt/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
55

66
ccflags-y += -I$(src) -I$(src)/$(GVT_DIR) -Wall
77
i915-y += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
8-
9-
CFLAGS_kvmgt.o := -Wno-unused-function
108
obj-$(CONFIG_DRM_I915_GVT_KVMGT) += $(GVT_DIR)/kvmgt.o

drivers/gpu/drm/i915/gvt/gvt.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,17 @@ struct intel_vgpu {
164164

165165
#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
166166
struct {
167-
struct device *mdev;
167+
struct mdev_device *mdev;
168168
struct vfio_region *region;
169169
int num_regions;
170170
struct eventfd_ctx *intx_trigger;
171171
struct eventfd_ctx *msi_trigger;
172172
struct rb_root cache;
173173
struct mutex cache_lock;
174-
void *vfio_group;
175174
struct notifier_block iommu_notifier;
175+
struct notifier_block group_notifier;
176+
struct kvm *kvm;
177+
struct work_struct release_work;
176178
} vdev;
177179
#endif
178180
};

0 commit comments

Comments
 (0)