-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathkernel.patch
More file actions
51 lines (49 loc) · 1.43 KB
/
kernel.patch
File metadata and controls
51 lines (49 loc) · 1.43 KB
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
diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c
index 7ccf3d3f6211..09c9ddcc9657 100644
--- a/arch/x86/kernel/sev-shared.c
+++ b/arch/x86/kernel/sev-shared.c
@@ -280,11 +280,14 @@ static int __svsm_ghcb_protocol(struct ghcb *ghcb, struct svsm_call *call)
ghcb_set_sw_exit_info_2(ghcb, 0);
sev_es_wr_ghcb_msr(__pa(ghcb));
- asm volatile("mov %4, %%r8\n\t"
- "mov %5, %%r9\n\t"
- "movb $1, %6\n\t"
+ asm volatile("mov %8, %%r8\n\t"
+ "mov %9, %%r9\n\t"
+ "movb $1, %10\n\t"
"rep; vmmcall\n\t"
- : "=a" (ret)
+ "mov %%r8, %3\n\t"
+ "mov %%r9, %4\n\t"
+ : "=a" (ret), "=c" (call->rcx), "=d" (call->rdx),
+ "=r" (call->r8), "=r" (call->r9)
: "a" (call->rax), "c" (call->rcx), "d" (call->rdx),
"r" (call->r8), "r" (call->r9), "m" (call->caa->call_pending)
: "r8", "r9");
diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
index bdc6f8946269..22c822413b0d 100644
--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -644,6 +644,23 @@ static int svsm_protocol(struct svsm_call *call)
return ret;
}
+int do_svsm_protocol(struct svsm_call * call){
+
+ unsigned long flags;
+ int ret;
+
+ local_irq_save(flags);
+
+ call->caa = this_cpu_read(svsm_caa);
+
+ ret = svsm_protocol(call);
+
+ local_irq_restore(flags);
+
+ return ret;
+}
+EXPORT_SYMBOL(do_svsm_protocol);
+
void noinstr __sev_es_nmi_complete(void)
{
struct ghcb_state state;