Skip to content

Commit

Permalink
drm/i915/gvt: make gvt oblivious of kvmgt data structures
Browse files Browse the repository at this point in the history
Instead of defining KVMGT per-device state in struct intel_vgpu
directly, add an indirection. This makes the GVT code oblivious of
what state KVMGT needs to keep.

The intention here is to eventually make it possible to build
hypervisor backends for the mediator, without having to touch the
mediator itself. This is a first step.

v2:
- rebased onto gvt-staging (no conflicts)

Signed-off-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200217163858.26496-1-julian.stecklina@cyberus-technology.de
  • Loading branch information
Julian Stecklina authored and Zhenyu Wang committed Feb 20, 2020
1 parent c95baf1 commit 06d63c4
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 135 deletions.
32 changes: 7 additions & 25 deletions drivers/gpu/drm/i915/gvt/gvt.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,31 +196,8 @@ struct intel_vgpu {

struct dentry *debugfs;

#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
struct {
struct mdev_device *mdev;
struct vfio_region *region;
int num_regions;
struct eventfd_ctx *intx_trigger;
struct eventfd_ctx *msi_trigger;

/*
* Two caches are used to avoid mapping duplicated pages (eg.
* scratch pages). This help to reduce dma setup overhead.
*/
struct rb_root gfn_cache;
struct rb_root dma_addr_cache;
unsigned long nr_cache_entries;
struct mutex cache_lock;

struct notifier_block iommu_notifier;
struct notifier_block group_notifier;
struct kvm *kvm;
struct work_struct release_work;
atomic_t released;
struct vfio_device *vfio_device;
} vdev;
#endif
/* Hypervisor-specific device state. */
void *vdev;

struct list_head dmabuf_obj_list_head;
struct mutex dmabuf_lock;
Expand All @@ -229,6 +206,11 @@ struct intel_vgpu {
u32 scan_nonprivbb;
};

static inline void *intel_vgpu_vdev(struct intel_vgpu *vgpu)
{
return vgpu->vdev;
}

/* validating GM healthy status*/
#define vgpu_is_vm_unhealthy(ret_val) \
(((ret_val) == -EBADRQC) || ((ret_val) == -EFAULT))
Expand Down
Loading

0 comments on commit 06d63c4

Please sign in to comment.