-
Notifications
You must be signed in to change notification settings - Fork 3
/
0028-drm-i915-gvt-xengt-Impliment-mpt-dma_map-unmap_guest.patch
60 lines (55 loc) · 1.76 KB
/
0028-drm-i915-gvt-xengt-Impliment-mpt-dma_map-unmap_guest.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 9898d72868efde6da81ea3885c41b8e45e4c4726 Mon Sep 17 00:00:00 2001
From: Xiong Zhang <[email protected]>
Date: Tue, 6 Mar 2018 22:06:12 +0800
Subject: [PATCH 28/56] drm/i915/gvt/xengt: Impliment
mpt->dma_map/unmap_guest_page
Commit b2079a4352a7(drm/i915/gvt: Fix guest vGPU hang caused by very
high dma setup overhead) add a mandatory mpt interface
dma_map/unmap_guest_page, xengt should implement it. it has the same
function as gfn_to_mfn in xengt.
Signed-off-by: Xiong Zhang <[email protected]>
---
drivers/gpu/drm/i915/gvt/xengt.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/i915/gvt/xengt.c b/drivers/gpu/drm/i915/gvt/xengt.c
index 4eed86bb942a..effa6e865006 100644
--- a/drivers/gpu/drm/i915/gvt/xengt.c
+++ b/drivers/gpu/drm/i915/gvt/xengt.c
@@ -1801,6 +1801,27 @@ static unsigned long xengt_gfn_to_pfn(unsigned long handle, unsigned long gfn)
return pfn;
}
+static int xengt_dma_map_guest_page(unsigned long handle, unsigned long gfn,
+ unsigned long size, dma_addr_t *dma_addr)
+{
+ unsigned long pfn;
+
+ BUG_ON(size != PAGE_SIZE);
+ pfn = xengt_gfn_to_pfn(handle, gfn);
+
+ if (pfn < 0)
+ return -EINVAL;
+
+ *dma_addr = pfn << PAGE_SHIFT;
+
+ return 0;
+}
+
+static void xengt_dma_unmap_guest_page(unsigned long handle,
+ dma_addr_t dma_addr)
+{
+}
+
struct intel_gvt_mpt xengt_mpt = {
//.detect_host = xengt_detect_host,
.host_init = xengt_host_init,
@@ -1814,6 +1835,8 @@ struct intel_gvt_mpt xengt_mpt = {
.read_gpa = xengt_read_gpa,
.write_gpa = xengt_write_gpa,
.gfn_to_mfn = xengt_gfn_to_pfn,
+ .dma_map_guest_page = xengt_dma_map_guest_page,
+ .dma_unmap_guest_page = xengt_dma_unmap_guest_page,
.map_gfn_to_mfn = xengt_map_gfn_to_mfn,
.set_trap_area = xengt_set_trap_area,
};
--
2.34.1