diff options
author | Sean Christopherson <seanjc@google.com> | 2023-03-10 16:45:59 -0800 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-04-06 14:57:22 -0700 |
commit | fb3146b4dc3bc6d0c0402a75f21d628eccf9bf8c (patch) | |
tree | 3e9367e61a94a0f0dc974268470f9b914862c0c1 /arch/x86/kvm/mmu/mmu.c | |
parent | b1932c5c19ddcbe9140b0583a0931b620c21ca02 (diff) | |
download | lwn-fb3146b4dc3bc6d0c0402a75f21d628eccf9bf8c.tar.gz lwn-fb3146b4dc3bc6d0c0402a75f21d628eccf9bf8c.zip |
KVM: x86: Add a helper to query whether or not a vCPU has ever run
Add a helper to query if a vCPU has run so that KVM doesn't have to open
code the check on last_vmentry_cpu being set to a magic value.
No functional change intended.
Suggested-by: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Like Xu <like.xu.linux@gmail.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20230311004618.920745-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/mmu/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu/mmu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 144c5a01cd77..8ced48797d59 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -5393,7 +5393,7 @@ void kvm_mmu_after_set_cpuid(struct kvm_vcpu *vcpu) * Changing guest CPUID after KVM_RUN is forbidden, see the comment in * kvm_arch_vcpu_ioctl(). */ - KVM_BUG_ON(vcpu->arch.last_vmentry_cpu != -1, vcpu->kvm); + KVM_BUG_ON(kvm_vcpu_has_run(vcpu), vcpu->kvm); } void kvm_mmu_reset_context(struct kvm_vcpu *vcpu) |