Commit | Line | Data |
---|---|---|
1183646a VP |
1 | // SPDX-License-Identifier: GPL-2.0-only |
2 | /* | |
3 | * KVM L1 hypervisor optimizations on Hyper-V for SVM. | |
4 | */ | |
8d20bd63 | 5 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
1183646a VP |
6 | |
7 | #include <linux/kvm_host.h> | |
1183646a VP |
8 | |
9 | #include <asm/mshyperv.h> | |
10 | ||
11 | #include "svm.h" | |
12 | #include "svm_ops.h" | |
13 | ||
14 | #include "hyperv.h" | |
15 | #include "kvm_onhyperv.h" | |
16 | #include "svm_onhyperv.h" | |
17 | ||
b83237ad | 18 | int svm_hv_enable_l2_tlb_flush(struct kvm_vcpu *vcpu) |
1183646a | 19 | { |
26b516bb | 20 | struct hv_vmcb_enlightenments *hve; |
cfef5af3 | 21 | hpa_t partition_assist_page = hv_get_partition_assist_page(vcpu); |
1183646a | 22 | |
cfef5af3 | 23 | if (partition_assist_page == INVALID_PAGE) |
1183646a VP |
24 | return -ENOMEM; |
25 | ||
68ae7c7b | 26 | hve = &to_svm(vcpu)->vmcb->control.hv_enlightenments; |
1183646a | 27 | |
cfef5af3 | 28 | hve->partition_assist_page = partition_assist_page; |
1183646a VP |
29 | hve->hv_vm_id = (unsigned long)vcpu->kvm; |
30 | if (!hve->hv_enlightenments_control.nested_flush_hypercall) { | |
31 | hve->hv_enlightenments_control.nested_flush_hypercall = 1; | |
089fe572 | 32 | vmcb_mark_dirty(to_svm(vcpu)->vmcb, HV_VMCB_NESTED_ENLIGHTENMENTS); |
1183646a VP |
33 | } |
34 | ||
35 | return 0; | |
36 | } | |
37 |