Merge tag 'kvm-x86-pvunhalt-6.9' of https://github.com/kvm-x86/linux into HEAD
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 18 Mar 2024 23:19:08 +0000 (19:19 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 18 Mar 2024 23:19:08 +0000 (19:19 -0400)
Fix a bug in KVM_SET_CPUID{2,} where KVM looks at the wrong CPUID entries (old
vs. new) and ultimately neglects to clear PV_UNHALT from vCPUs with HLT-exiting
disabled.

1  2 
tools/testing/selftests/kvm/include/x86_64/processor.h

index 3bd03b088dda605348c7f85fc8d190ef63cf9e5e,8b5c804562f99dfc2ebacbbd6ae130804b291f89..81ce37ec407dd18b04abab3ff0a40c8deca9cd65
@@@ -1034,11 -995,18 +1034,22 @@@ static inline void vcpu_set_cpuid(struc
        vcpu_ioctl(vcpu, KVM_GET_CPUID2, vcpu->cpuid);
  }
  
 -void vcpu_set_cpuid_maxphyaddr(struct kvm_vcpu *vcpu, uint8_t maxphyaddr);
 -
 -void vcpu_clear_cpuid_entry(struct kvm_vcpu *vcpu, uint32_t function);
 +void vcpu_set_cpuid_property(struct kvm_vcpu *vcpu,
 +                           struct kvm_x86_cpu_property property,
 +                           uint32_t value);
++void vcpu_set_cpuid_maxphyaddr(struct kvm_vcpu *vcpu, uint8_t maxphyaddr);
 +
 +void vcpu_clear_cpuid_entry(struct kvm_vcpu *vcpu, uint32_t function);
++
+ static inline bool vcpu_cpuid_has(struct kvm_vcpu *vcpu,
+                                 struct kvm_x86_cpu_feature feature)
+ {
+       struct kvm_cpuid_entry2 *entry;
+       entry = __vcpu_get_cpuid_entry(vcpu, feature.function, feature.index);
+       return *((&entry->eax) + feature.reg) & BIT(feature.bit);
+ }
  void vcpu_set_or_clear_cpuid_feature(struct kvm_vcpu *vcpu,
                                     struct kvm_x86_cpu_feature feature,
                                     bool set);