Skip to content

Commit 4396f35

Browse files
committed
(ghost/spec) pkvm_host_map_guest only copying the pkvm state when needed
when no memcache donation happened during the hcall, the pkvm lock will not have been taken (and therefore there is nothing to copy).
1 parent 2b07504 commit 4396f35

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/arm64/kvm/hyp/nvhe/ghost_spec.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,12 @@ bool compute_new_abstract_state_handle___pkvm_host_map_guest(struct ghost_state
670670
* so it's safe to copy.
671671
*/
672672
copy_abstraction_host(g1, g0);
673-
copy_abstraction_pkvm(g1, g0);
673+
if (call->memcache_donations.len > 0)
674+
copy_abstraction_pkvm(g1, g0);
675+
else {
676+
ghost_assert(!g0->pkvm.present);
677+
g1->pkvm.present = false;
678+
}
674679

675680
for (int d=0; d<call->memcache_donations.len; d++) {
676681
u64 pfn = call->memcache_donations.pages[d];

0 commit comments

Comments
 (0)