mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
KVM: Move nVMX's lockdep logic for vcpu->mutex to a common helper
Extract nVMX's lockdep assertion that a vCPU is locked or otherwise unreachable into a common helper, as KVM x86 is about to gain another user, but there is nothing x86-specific about the logic, i.e. the assertion may be useful for other architectures. No functional change intended. Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Link: https://patch.msgid.link/20260630225619.511632-9-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
b29125ead0
commit
e34be29ecd
|
|
@ -57,16 +57,14 @@ bool nested_vmx_check_io_bitmaps(struct kvm_vcpu *vcpu, unsigned int port,
|
|||
|
||||
static inline struct vmcs12 *get_vmcs12(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
lockdep_assert_once(lockdep_is_held(&vcpu->mutex) ||
|
||||
!refcount_read(&vcpu->kvm->users_count));
|
||||
kvm_lockdep_assert_vcpu_is_locked_or_unreachable(vcpu);
|
||||
|
||||
return to_vmx(vcpu)->nested.cached_vmcs12;
|
||||
}
|
||||
|
||||
static inline struct vmcs12 *get_shadow_vmcs12(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
lockdep_assert_once(lockdep_is_held(&vcpu->mutex) ||
|
||||
!refcount_read(&vcpu->kvm->users_count));
|
||||
kvm_lockdep_assert_vcpu_is_locked_or_unreachable(vcpu);
|
||||
|
||||
return to_vmx(vcpu)->nested.cached_shadow_vmcs12;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -989,6 +989,12 @@ static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx)
|
|||
lockdep_is_held(&kvm->slots_lock));
|
||||
}
|
||||
|
||||
static inline void kvm_lockdep_assert_vcpu_is_locked_or_unreachable(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
lockdep_assert_once(lockdep_is_held(&vcpu->mutex) ||
|
||||
!refcount_read(&vcpu->kvm->users_count));
|
||||
}
|
||||
|
||||
static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
|
||||
{
|
||||
int num_vcpus = atomic_read(&kvm->online_vcpus);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user