mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
KVM: x86: Rename kvm_x86_ops' gmem_invalidate() to gmem_make_shared()
Rename kvm_x86_ops's gmem_invalidate() hook to gmem_make_shared(), as the hook doesn't invalidate anything, and so that KVM doesn't need to add yet another vendor callback to support "convert to shared" once in-place conversion comes along. Opportunistically wrap the ops declarations with a GMEM_RECLAIM guard so that attempting to wire up a .gmem_make_shared() hook without selecting CONFIG_HAVE_KVM_ARCH_GMEM_RECLAIM will result in a build failure. No functional change intended. Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Reviewed-by: Ackerley Tng <ackerleytng@google.com> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260723210811.72720-4-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
7b8529e70a
commit
f3c073e254
|
|
@ -149,7 +149,9 @@ KVM_X86_OP_OPTIONAL(alloc_apic_backing_page)
|
|||
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_PREPARE
|
||||
KVM_X86_OP_OPTIONAL_RET0(gmem_prepare)
|
||||
#endif
|
||||
KVM_X86_OP_OPTIONAL(gmem_invalidate)
|
||||
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_RECLAIM
|
||||
KVM_X86_OP_OPTIONAL(gmem_make_shared)
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE
|
||||
KVM_X86_OP_OPTIONAL(gmem_invalidate_range)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1906,7 +1906,9 @@ struct kvm_x86_ops {
|
|||
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_PREPARE
|
||||
int (*gmem_prepare)(struct kvm *kvm, kvm_pfn_t pfn, gfn_t gfn, int max_order);
|
||||
#endif
|
||||
void (*gmem_invalidate)(kvm_pfn_t pfn, kvm_pfn_t nr_pages);
|
||||
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_RECLAIM
|
||||
void (*gmem_make_shared)(kvm_pfn_t pfn, kvm_pfn_t nr_pages);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE
|
||||
void (*gmem_invalidate_range)(struct kvm *kvm, struct kvm_gfn_range *range);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5159,7 +5159,7 @@ int sev_gmem_prepare(struct kvm *kvm, kvm_pfn_t pfn, gfn_t gfn, int max_order)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void sev_gmem_invalidate(kvm_pfn_t pfn, kvm_pfn_t nr_pages)
|
||||
void sev_gmem_make_shared(kvm_pfn_t pfn, kvm_pfn_t nr_pages)
|
||||
{
|
||||
kvm_pfn_t end = pfn + nr_pages;
|
||||
|
||||
|
|
|
|||
|
|
@ -5451,7 +5451,7 @@ struct kvm_x86_ops svm_x86_ops __initdata = {
|
|||
.vm_move_enc_context_from = sev_vm_move_enc_context_from,
|
||||
|
||||
.gmem_prepare = sev_gmem_prepare,
|
||||
.gmem_invalidate = sev_gmem_invalidate,
|
||||
.gmem_make_shared = sev_gmem_make_shared,
|
||||
.gmem_invalidate_range = sev_gmem_invalidate_range,
|
||||
.gmem_max_mapping_level = sev_gmem_max_mapping_level,
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1010,7 +1010,7 @@ int sev_dev_get_attr(u32 group, u64 attr, u64 *val);
|
|||
extern unsigned int max_sev_asid;
|
||||
void sev_handle_rmp_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u64 error_code);
|
||||
int sev_gmem_prepare(struct kvm *kvm, kvm_pfn_t pfn, gfn_t gfn, int max_order);
|
||||
void sev_gmem_invalidate(kvm_pfn_t pfn, kvm_pfn_t nr_pages);
|
||||
void sev_gmem_make_shared(kvm_pfn_t pfn, kvm_pfn_t nr_pages);
|
||||
void sev_gmem_invalidate_range(struct kvm *kvm, struct kvm_gfn_range *range);
|
||||
int sev_gmem_max_mapping_level(struct kvm *kvm, kvm_pfn_t pfn, bool is_private);
|
||||
struct vmcb_save_area *sev_decrypt_vmsa(struct kvm_vcpu *vcpu);
|
||||
|
|
|
|||
|
|
@ -10599,7 +10599,7 @@ int kvm_arch_gmem_prepare(struct kvm *kvm, gfn_t gfn, kvm_pfn_t pfn, int max_ord
|
|||
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_RECLAIM
|
||||
void kvm_arch_gmem_reclaim(kvm_pfn_t pfn, kvm_pfn_t nr_pages)
|
||||
{
|
||||
kvm_x86_call(gmem_invalidate)(pfn, nr_pages);
|
||||
kvm_x86_call(gmem_make_shared)(pfn, nr_pages);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user