1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * KVM L1 hypervisor optimizations on Hyper-V.
6 #ifndef __ARCH_X86_KVM_KVM_ONHYPERV_H__
7 #define __ARCH_X86_KVM_KVM_ONHYPERV_H__
9 #if IS_ENABLED(CONFIG_HYPERV)
10 int hv_flush_remote_tlbs_range(struct kvm *kvm, gfn_t gfn, gfn_t nr_pages);
11 int hv_flush_remote_tlbs(struct kvm *kvm);
12 void hv_track_root_tdp(struct kvm_vcpu *vcpu, hpa_t root_tdp);
13 static inline hpa_t hv_get_partition_assist_page(struct kvm_vcpu *vcpu)
16 * Partition assist page is something which Hyper-V running in L0
17 * requires from KVM running in L1 before direct TLB flush for L2
18 * guests can be enabled. KVM doesn't currently use the page but to
19 * comply with TLFS it still needs to be allocated. For now, this
20 * is a single page shared among all vCPUs.
22 struct hv_partition_assist_pg **p_hv_pa_pg =
23 &vcpu->kvm->arch.hv_pa_pg;
26 *p_hv_pa_pg = kzalloc(PAGE_SIZE, GFP_KERNEL_ACCOUNT);
31 return __pa(*p_hv_pa_pg);
33 #else /* !CONFIG_HYPERV */
34 static inline int hv_flush_remote_tlbs(struct kvm *kvm)
39 static inline void hv_track_root_tdp(struct kvm_vcpu *vcpu, hpa_t root_tdp)
42 #endif /* !CONFIG_HYPERV */