1fe5db27dSBen Gardon // SPDX-License-Identifier: GPL-2.0 2fe5db27dSBen Gardon 3fe5db27dSBen Gardon #ifndef __KVM_X86_MMU_TDP_MMU_H 4fe5db27dSBen Gardon #define __KVM_X86_MMU_TDP_MMU_H 5fe5db27dSBen Gardon 6fe5db27dSBen Gardon #include <linux/kvm_host.h> 7fe5db27dSBen Gardon 8fe5db27dSBen Gardon void kvm_mmu_init_tdp_mmu(struct kvm *kvm); 9fe5db27dSBen Gardon void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm); 1002c00b3aSBen Gardon 1102c00b3aSBen Gardon bool is_tdp_mmu_root(struct kvm *kvm, hpa_t root); 1202c00b3aSBen Gardon hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu); 1302c00b3aSBen Gardon void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root); 1402c00b3aSBen Gardon 15faaf05b0SBen Gardon bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end); 16faaf05b0SBen Gardon void kvm_tdp_mmu_zap_all(struct kvm *kvm); 17bb18842eSBen Gardon 18bb18842eSBen Gardon int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, 19bb18842eSBen Gardon int map_writable, int max_level, kvm_pfn_t pfn, 20bb18842eSBen Gardon bool prefault); 21063afacdSBen Gardon 22063afacdSBen Gardon int kvm_tdp_mmu_zap_hva_range(struct kvm *kvm, unsigned long start, 23063afacdSBen Gardon unsigned long end); 24f8e14497SBen Gardon 25f8e14497SBen Gardon int kvm_tdp_mmu_age_hva_range(struct kvm *kvm, unsigned long start, 26f8e14497SBen Gardon unsigned long end); 27f8e14497SBen Gardon int kvm_tdp_mmu_test_age_hva(struct kvm *kvm, unsigned long hva); 281d8dd6b3SBen Gardon 291d8dd6b3SBen Gardon int kvm_tdp_mmu_set_spte_hva(struct kvm *kvm, unsigned long address, 301d8dd6b3SBen Gardon pte_t *host_ptep); 31a6a0b05dSBen Gardon 32a6a0b05dSBen Gardon bool kvm_tdp_mmu_wrprot_slot(struct kvm *kvm, struct kvm_memory_slot *slot, 33a6a0b05dSBen Gardon int min_level); 34a6a0b05dSBen Gardon bool kvm_tdp_mmu_clear_dirty_slot(struct kvm *kvm, 35a6a0b05dSBen Gardon struct kvm_memory_slot *slot); 36a6a0b05dSBen Gardon void kvm_tdp_mmu_clear_dirty_pt_masked(struct kvm *kvm, 37a6a0b05dSBen Gardon struct kvm_memory_slot *slot, 38a6a0b05dSBen Gardon gfn_t gfn, unsigned long mask, 39a6a0b05dSBen Gardon bool wrprot); 40a6a0b05dSBen Gardon bool kvm_tdp_mmu_slot_set_dirty(struct kvm *kvm, struct kvm_memory_slot *slot); 4114881998SBen Gardon void kvm_tdp_mmu_zap_collapsible_sptes(struct kvm *kvm, 4214881998SBen Gardon const struct kvm_memory_slot *slot); 4346044f72SBen Gardon 4446044f72SBen Gardon bool kvm_tdp_mmu_write_protect_gfn(struct kvm *kvm, 4546044f72SBen Gardon struct kvm_memory_slot *slot, gfn_t gfn); 46*95fb5b02SBen Gardon 47*95fb5b02SBen Gardon int kvm_tdp_mmu_get_walk(struct kvm_vcpu *vcpu, u64 addr, u64 *sptes); 48fe5db27dSBen Gardon #endif /* __KVM_X86_MMU_TDP_MMU_H */ 49