forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/gpu/drm/i915/gvt/mpt.h
....@@ -50,11 +50,10 @@
5050 * Zero on success, negative error code if failed
5151 */
5252 static inline int intel_gvt_hypervisor_host_init(struct device *dev,
53
- void *gvt, const void *ops)
53
+ void *gvt, const void *ops)
5454 {
55
- /* optional to provide */
5655 if (!intel_gvt_host.mpt->host_init)
57
- return 0;
56
+ return -ENODEV;
5857
5958 return intel_gvt_host.mpt->host_init(dev, gvt, ops);
6059 }
....@@ -62,14 +61,13 @@
6261 /**
6362 * intel_gvt_hypervisor_host_exit - exit GVT-g host side
6463 */
65
-static inline void intel_gvt_hypervisor_host_exit(struct device *dev,
66
- void *gvt)
64
+static inline void intel_gvt_hypervisor_host_exit(struct device *dev)
6765 {
6866 /* optional to provide */
6967 if (!intel_gvt_host.mpt->host_exit)
7068 return;
7169
72
- intel_gvt_host.mpt->host_exit(dev, gvt);
70
+ intel_gvt_host.mpt->host_exit(dev);
7371 }
7472
7573 /**
....@@ -101,7 +99,7 @@
10199 if (!intel_gvt_host.mpt->detach_vgpu)
102100 return;
103101
104
- intel_gvt_host.mpt->detach_vgpu(vgpu->handle);
102
+ intel_gvt_host.mpt->detach_vgpu(vgpu);
105103 }
106104
107105 #define MSI_CAP_CONTROL(offset) (offset + 2)
....@@ -257,6 +255,21 @@
257255 }
258256
259257 /**
258
+ * intel_gvt_hypervisor_dma_pin_guest_page - pin guest dma buf
259
+ * @vgpu: a vGPU
260
+ * @dma_addr: guest dma addr
261
+ *
262
+ * Returns:
263
+ * 0 on success, negative error code if failed.
264
+ */
265
+static inline int
266
+intel_gvt_hypervisor_dma_pin_guest_page(struct intel_vgpu *vgpu,
267
+ dma_addr_t dma_addr)
268
+{
269
+ return intel_gvt_host.mpt->dma_pin_guest_page(vgpu->handle, dma_addr);
270
+}
271
+
272
+/**
260273 * intel_gvt_hypervisor_map_gfn_to_mfn - map a GFN region to MFN
261274 * @vgpu: a vGPU
262275 * @gfn: guest PFN
....@@ -316,6 +329,23 @@
316329 }
317330
318331 /**
332
+ * intel_gvt_hypervisor_set_edid - Set EDID region for guest
333
+ * @vgpu: a vGPU
334
+ * @port_num: display port number
335
+ *
336
+ * Returns:
337
+ * Zero on success, negative error code if failed.
338
+ */
339
+static inline int intel_gvt_hypervisor_set_edid(struct intel_vgpu *vgpu,
340
+ int port_num)
341
+{
342
+ if (!intel_gvt_host.mpt->set_edid)
343
+ return 0;
344
+
345
+ return intel_gvt_host.mpt->set_edid(vgpu, port_num);
346
+}
347
+
348
+/**
319349 * intel_gvt_hypervisor_get_vfio_device - increase vfio device ref count
320350 * @vgpu: a vGPU
321351 *
....@@ -362,4 +392,7 @@
362392 return intel_gvt_host.mpt->is_valid_gfn(vgpu->handle, gfn);
363393 }
364394
395
+int intel_gvt_register_hypervisor(struct intel_gvt_mpt *);
396
+void intel_gvt_unregister_hypervisor(void);
397
+
365398 #endif /* _GVT_MPT_H_ */