1 // SPDX-License-Identifier: GPL-2.0-only
3 * KVM L1 hypervisor optimizations on Hyper-V for SVM.
6 #include <linux/kvm_host.h>
7 #include "kvm_cache_regs.h"
9 #include <asm/mshyperv.h>
15 #include "kvm_onhyperv.h"
16 #include "svm_onhyperv.h"
18 int svm_hv_enable_direct_tlbflush(struct kvm_vcpu *vcpu)
20 struct hv_enlightenments *hve;
21 struct hv_partition_assist_pg **p_hv_pa_pg =
22 &to_kvm_hv(vcpu->kvm)->hv_pa_pg;
25 *p_hv_pa_pg = kzalloc(PAGE_SIZE, GFP_KERNEL);
30 hve = (struct hv_enlightenments *)to_svm(vcpu)->vmcb->control.reserved_sw;
32 hve->partition_assist_page = __pa(*p_hv_pa_pg);
33 hve->hv_vm_id = (unsigned long)vcpu->kvm;
34 if (!hve->hv_enlightenments_control.nested_flush_hypercall) {
35 hve->hv_enlightenments_control.nested_flush_hypercall = 1;
36 vmcb_mark_dirty(to_svm(vcpu)->vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS);