Skip to content

Commit 947e86d

Browse files
jsun26intellijinxia
authored andcommitted
HV: restore correct gpa for guest normal world
We should specify gpa for uos or sos when restore memory, otherwise it would cause resume failure issue. Signed-off-by: Victor Sun <victor.sun@intel.com> Reviewed-by: Mingqiang Chi <mingqiang.chi@intel.com> Reviewed-by: Li, Fei1 <fei1.li@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
1 parent da4c95b commit 947e86d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

hypervisor/arch/x86/trusty.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ void destroy_secure_world(struct vm *vm, bool need_clr_mem)
151151
void *pdpt_addr;
152152
struct vm *vm0 = get_vm_from_vmid(0U);
153153
uint64_t hpa = vm->sworld_control.sworld_memory.base_hpa;
154-
uint64_t gpa = vm->sworld_control.sworld_memory.base_gpa_in_sos;
154+
uint64_t gpa_sos = vm->sworld_control.sworld_memory.base_gpa_in_sos;
155+
uint64_t gpa_uos = vm->sworld_control.sworld_memory.base_gpa_in_uos;
155156
uint64_t size = vm->sworld_control.sworld_memory.length;
156157

157158
if (vm0 == NULL) {
@@ -165,13 +166,13 @@ void destroy_secure_world(struct vm *vm, bool need_clr_mem)
165166

166167
/* restore memory to SOS ept mapping */
167168
if (ept_mr_add(vm0, vm0->arch_vm.nworld_eptp,
168-
hpa, gpa, size, EPT_RWX | EPT_WB) != 0) {
169+
hpa, gpa_sos, size, EPT_RWX | EPT_WB) != 0) {
169170
pr_warn("Restore trusty mem to SOS failed");
170171
}
171172

172173
/* Restore memory to guest normal world */
173174
if (ept_mr_add(vm, vm->arch_vm.nworld_eptp,
174-
hpa, gpa, size, EPT_RWX | EPT_WB) != 0) {
175+
hpa, gpa_uos, size, EPT_RWX | EPT_WB) != 0) {
175176
pr_warn("Restore trusty mem to nworld failed");
176177
}
177178

0 commit comments

Comments
 (0)