KVM: x86/mmu: Handle KVM bookkeeping in page-track APIs, not callers
authorSean Christopherson <seanjc@google.com>
Sat, 29 Jul 2023 01:35:34 +0000 (18:35 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 31 Aug 2023 18:08:19 +0000 (14:08 -0400)
commitf22b1e8500b449fabc33ca271cd8e91749fa63b4
tree3be59f09e9872d46419fc03c2d062723cb22a23a
parent96316a06700fc93140e7492c9e994045680f7272
KVM: x86/mmu: Handle KVM bookkeeping in page-track APIs, not callers

Get/put references to KVM when a page-track notifier is (un)registered
instead of relying on the caller to do so.  Forcing the caller to do the
bookkeeping is unnecessary and adds one more thing for users to get
wrong, e.g. see commit 9ed1fdee9ee3 ("drm/i915/gvt: Get reference to KVM
iff attachment to VM is successful").

Reviewed-by: Yan Zhao <yan.y.zhao@intel.com>
Tested-by: Yongwei Ma <yongwei.ma@intel.com>
Link: https://lore.kernel.org/r/20230729013535.1070024-29-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_page_track.h
arch/x86/kvm/mmu/page_track.c
drivers/gpu/drm/i915/gvt/kvmgt.c