Skip to content

hv: hyperv: Add hyperv page destory function #8760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions hypervisor/arch/x86/guest/hyperv.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,14 @@ hyperv_init_vcpuid_entry(uint32_t leaf, uint32_t subleaf, uint32_t flags,
dev_dbg(DBG_LEVEL_HYPERV, "hv: %s: leaf=%x subleaf=%x flags=%x eax=%x ebx=%x ecx=%x edx=%x",
__func__, leaf, subleaf, flags, entry->eax, entry->ebx, entry->ecx, entry->edx);
}

void
hyperv_page_destory(struct acrn_vm *vm)
{
/* Reset the hypercall page */
vm->arch_vm.hyperv.hypercall_page.enabled = 0U;
/* Reset OS id */
vm->arch_vm.hyperv.guest_os_id.val64 = 0UL;
/* Reset the TSC page */
vm->arch_vm.hyperv.ref_tsc_page.enabled = 0UL;
}
4 changes: 4 additions & 0 deletions hypervisor/arch/x86/guest/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,10 @@ int32_t shutdown_vm(struct acrn_vm *vm)
offline_vcpu(vcpu);
}

#ifdef CONFIG_HYPERV_ENABLED
hyperv_page_destory(vm);
#endif

/* after guest_flags not used, then clear it */
vm_config = get_vm_config(vm->vm_id);
vm_config->guest_flags &= ~DM_OWNED_GUEST_FLAG_MASK;
Expand Down
1 change: 1 addition & 0 deletions hypervisor/include/arch/x86/asm/guest/hyperv.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ int32_t hyperv_rdmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t *rval);
void hyperv_init_time(struct acrn_vm *vm);
void hyperv_init_vcpuid_entry(uint32_t leaf, uint32_t subleaf, uint32_t flags,
struct vcpuid_entry *entry);
void hyperv_page_destory(struct acrn_vm *vm);
#endif