Skip to content

Commit 06d63c4

Browse files
blitzzhenyw
authored andcommitted
drm/i915/gvt: make gvt oblivious of kvmgt data structures
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 <[email protected]> Acked-by: Zhenyu Wang <[email protected]> Signed-off-by: Zhenyu Wang <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c95baf1 commit 06d63c4

File tree

2 files changed

+184
-135
lines changed

2 files changed

+184
-135
lines changed

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

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -196,31 +196,8 @@ struct intel_vgpu {
196196

197197
struct dentry *debugfs;
198198

199-
#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
200-
struct {
201-
struct mdev_device *mdev;
202-
struct vfio_region *region;
203-
int num_regions;
204-
struct eventfd_ctx *intx_trigger;
205-
struct eventfd_ctx *msi_trigger;
206-
207-
/*
208-
* Two caches are used to avoid mapping duplicated pages (eg.
209-
* scratch pages). This help to reduce dma setup overhead.
210-
*/
211-
struct rb_root gfn_cache;
212-
struct rb_root dma_addr_cache;
213-
unsigned long nr_cache_entries;
214-
struct mutex cache_lock;
215-
216-
struct notifier_block iommu_notifier;
217-
struct notifier_block group_notifier;
218-
struct kvm *kvm;
219-
struct work_struct release_work;
220-
atomic_t released;
221-
struct vfio_device *vfio_device;
222-
} vdev;
223-
#endif
199+
/* Hypervisor-specific device state. */
200+
void *vdev;
224201

225202
struct list_head dmabuf_obj_list_head;
226203
struct mutex dmabuf_lock;
@@ -229,6 +206,11 @@ struct intel_vgpu {
229206
u32 scan_nonprivbb;
230207
};
231208

209+
static inline void *intel_vgpu_vdev(struct intel_vgpu *vgpu)
210+
{
211+
return vgpu->vdev;
212+
}
213+
232214
/* validating GM healthy status*/
233215
#define vgpu_is_vm_unhealthy(ret_val) \
234216
(((ret_val) == -EBADRQC) || ((ret_val) == -EFAULT))

0 commit comments

Comments
 (0)