mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
KVM: TDX: Implement hook to get max mapping level of private pages
Implement hook private_max_mapping_level for TDX to let TDP MMU core get max mapping level of private pages. The value is hard coded to 4K for no huge page support for now. Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> Co-developed-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Co-developed-by: Yan Zhao <yan.y.zhao@intel.com> Signed-off-by: Yan Zhao <yan.y.zhao@intel.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-ID: <20241112073816.22256-1-yan.y.zhao@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
02ab57707b
commit
0036b87a95
|
|
@ -174,6 +174,14 @@ static int vt_vcpu_mem_enc_ioctl(struct kvm_vcpu *vcpu, void __user *argp)
|
|||
return tdx_vcpu_ioctl(vcpu, argp);
|
||||
}
|
||||
|
||||
static int vt_gmem_private_max_mapping_level(struct kvm *kvm, kvm_pfn_t pfn)
|
||||
{
|
||||
if (is_td(kvm))
|
||||
return tdx_gmem_private_max_mapping_level(kvm, pfn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define VMX_REQUIRED_APICV_INHIBITS \
|
||||
(BIT(APICV_INHIBIT_REASON_DISABLED) | \
|
||||
BIT(APICV_INHIBIT_REASON_ABSENT) | \
|
||||
|
|
@ -331,6 +339,8 @@ struct kvm_x86_ops vt_x86_ops __initdata = {
|
|||
|
||||
.mem_enc_ioctl = vt_mem_enc_ioctl,
|
||||
.vcpu_mem_enc_ioctl = vt_vcpu_mem_enc_ioctl,
|
||||
|
||||
.private_max_mapping_level = vt_gmem_private_max_mapping_level
|
||||
};
|
||||
|
||||
struct kvm_x86_init_ops vt_init_ops __initdata = {
|
||||
|
|
|
|||
|
|
@ -1636,6 +1636,11 @@ int tdx_vcpu_ioctl(struct kvm_vcpu *vcpu, void __user *argp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int tdx_gmem_private_max_mapping_level(struct kvm *kvm, kvm_pfn_t pfn)
|
||||
{
|
||||
return PG_LEVEL_4K;
|
||||
}
|
||||
|
||||
static int tdx_online_cpu(unsigned int cpu)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ int tdx_sept_remove_private_spte(struct kvm *kvm, gfn_t gfn,
|
|||
void tdx_flush_tlb_current(struct kvm_vcpu *vcpu);
|
||||
void tdx_flush_tlb_all(struct kvm_vcpu *vcpu);
|
||||
void tdx_load_mmu_pgd(struct kvm_vcpu *vcpu, hpa_t root_hpa, int root_level);
|
||||
int tdx_gmem_private_max_mapping_level(struct kvm *kvm, kvm_pfn_t pfn);
|
||||
#else
|
||||
static inline int tdx_vm_init(struct kvm *kvm) { return -EOPNOTSUPP; }
|
||||
static inline void tdx_mmu_release_hkid(struct kvm *kvm) {}
|
||||
|
|
@ -186,6 +187,7 @@ static inline int tdx_sept_remove_private_spte(struct kvm *kvm, gfn_t gfn,
|
|||
static inline void tdx_flush_tlb_current(struct kvm_vcpu *vcpu) {}
|
||||
static inline void tdx_flush_tlb_all(struct kvm_vcpu *vcpu) {}
|
||||
static inline void tdx_load_mmu_pgd(struct kvm_vcpu *vcpu, hpa_t root_hpa, int root_level) {}
|
||||
static inline int tdx_gmem_private_max_mapping_level(struct kvm *kvm, kvm_pfn_t pfn) { return 0; }
|
||||
#endif
|
||||
|
||||
#endif /* __KVM_X86_VMX_X86_OPS_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user