-
Notifications
You must be signed in to change notification settings - Fork 3
/
0031-drm-i915-gvt-Rebase-the-code-to-gvt-staging-for-live.patch
122 lines (110 loc) · 4.52 KB
/
0031-drm-i915-gvt-Rebase-the-code-to-gvt-staging-for-live.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
From 0d2e76a60da956de9cd4da68ca154146a791bdea Mon Sep 17 00:00:00 2001
From: Yulei Zhang <[email protected]>
Date: Fri, 11 May 2018 15:22:34 +0800
Subject: [PATCH 31/56] drm/i915/gvt: Rebase the code to gvt-staging for live
migration
Signed-off-by: Yulei Zhang <[email protected]>
---
drivers/gpu/drm/i915/gvt/execlist.c | 2 +-
drivers/gpu/drm/i915/gvt/gvt.h | 3 +++
drivers/gpu/drm/i915/gvt/migrate.c | 26 ++++++++++++--------------
drivers/gpu/drm/i915/gvt/migrate.h | 2 ++
4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/execlist.c b/drivers/gpu/drm/i915/gvt/execlist.c
index f21b8fb5b37e..b5cc6378f466 100644
--- a/drivers/gpu/drm/i915/gvt/execlist.c
+++ b/drivers/gpu/drm/i915/gvt/execlist.c
@@ -436,7 +436,7 @@ static int complete_execlist_workload(struct intel_vgpu_workload *workload)
return ret;
}
-static int submit_context(struct intel_vgpu *vgpu, int ring_id,
+int submit_context(struct intel_vgpu *vgpu, int ring_id,
struct execlist_ctx_descriptor_format *desc,
bool emulate_schedule_in)
{
diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
index 43482c6eb2d8..5396cbf099f1 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.h
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
@@ -724,6 +724,9 @@ void intel_gvt_debugfs_add_vgpu(struct intel_vgpu *vgpu);
void intel_gvt_debugfs_remove_vgpu(struct intel_vgpu *vgpu);
void intel_gvt_debugfs_init(struct intel_gvt *gvt);
void intel_gvt_debugfs_clean(struct intel_gvt *gvt);
+int submit_context(struct intel_vgpu *vgpu, int ring_id,
+ struct execlist_ctx_descriptor_format *desc,
+ bool emulate_schedule_in);
#include "trace.h"
diff --git a/drivers/gpu/drm/i915/gvt/migrate.c b/drivers/gpu/drm/i915/gvt/migrate.c
index ef253da339cf..ea728bc5ae58 100644
--- a/drivers/gpu/drm/i915/gvt/migrate.c
+++ b/drivers/gpu/drm/i915/gvt/migrate.c
@@ -428,7 +428,7 @@ static int ppgtt_save(const struct gvt_migration_obj_t *obj)
continue;
entry.page_table_level = mm->ppgtt_mm.root_entry_type;
- memcpy(entry.pdp, mm->ppgtt_mm.shadow_pdps, 32);
+ memcpy(entry.pdp, mm->ppgtt_mm.guest_pdps, 32);
memcpy(des + sizeof(struct gvt_region_t) + (num * sz),
&entry, sz);
@@ -537,8 +537,11 @@ static int workload_save(const struct gvt_migration_obj_t *obj)
list_for_each_entry_safe(pos, n,
&vgpu->submission.workload_q_head[engine->id], list) {
workload.ring_id = pos->ring_id;
- memcpy(&workload.elsp_dwords, &pos->elsp_dwords,
- sizeof(struct intel_vgpu_elsp_dwords));
+ workload.ctx_desc = pos->ctx_desc;
+ workload.emulate_schedule_in = pos->emulate_schedule_in;
+ workload.elsp_dwords = pos->elsp_dwords;
+ list_del_init(&pos->list);
+ intel_vgpu_destroy_workload(pos);
memcpy(des + sizeof(struct gvt_region_t) + (num * sz),
&workload, sz);
num++;
@@ -555,14 +558,11 @@ static int workload_save(const struct gvt_migration_obj_t *obj)
static int workload_load(const struct gvt_migration_obj_t *obj, u32 size)
{
struct intel_vgpu *vgpu = (struct intel_vgpu *) obj->vgpu;
- struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
int n_transfer = INV;
struct gvt_pending_workload_t workload;
- struct intel_engine_cs *engine;
void *src = obj->img + obj->offset;
- u64 pa, off;
u32 sz = sizeof(struct gvt_pending_workload_t);
- int i, j;
+ int i;
if (size == 0)
return size;
@@ -574,16 +574,14 @@ static int workload_load(const struct gvt_migration_obj_t *obj, u32 size)
size);
return n_transfer;
}
-
for (i = 0; i < size / sz; i++) {
memcpy(&workload, src + (i * sz), sz);
- engine = dev_priv->engine[workload.ring_id];
- off = i915_mmio_reg_offset(RING_ELSP(engine));
- pa = intel_vgpu_mmio_offset_to_gpa(vgpu, off);
- for (j = 0; j < 4; j++) {
- intel_vgpu_emulate_mmio_write(vgpu, pa,
- &workload.elsp_dwords.data[j], 4);
+ if (workload.emulate_schedule_in) {
+ vgpu->submission.execlist[workload.ring_id].elsp_dwords = workload.elsp_dwords;
+ vgpu->submission.execlist[workload.ring_id].elsp_dwords.index = 0;
}
+ submit_context(vgpu, workload.ring_id,
+ &workload.ctx_desc, workload.emulate_schedule_in);
}
n_transfer = size;
diff --git a/drivers/gpu/drm/i915/gvt/migrate.h b/drivers/gpu/drm/i915/gvt/migrate.h
index f7d28bcb94e6..ab247dc6f48f 100644
--- a/drivers/gpu/drm/i915/gvt/migrate.h
+++ b/drivers/gpu/drm/i915/gvt/migrate.h
@@ -52,6 +52,8 @@ struct gvt_ppgtt_entry_t {
struct gvt_pending_workload_t {
int ring_id;
+ bool emulate_schedule_in;
+ struct execlist_ctx_descriptor_format ctx_desc;
struct intel_vgpu_elsp_dwords elsp_dwords;
};
--
2.34.1