Commit fa55eedd authored by Wanpeng Li's avatar Wanpeng Li Committed by Radim Krčmář

KVM: X86: Add KVM_VCPU_PREEMPTED

The next patch will add another bit to the preempted field in
kvm_steal_time.  Define a constant for bit 0 (the only one that is
currently used).

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent 5cb0944c
...@@ -51,6 +51,8 @@ struct kvm_steal_time { ...@@ -51,6 +51,8 @@ struct kvm_steal_time {
__u32 pad[11]; __u32 pad[11];
}; };
#define KVM_VCPU_PREEMPTED (1 << 0)
#define KVM_CLOCK_PAIRING_WALLCLOCK 0 #define KVM_CLOCK_PAIRING_WALLCLOCK 0
struct kvm_clock_pairing { struct kvm_clock_pairing {
__s64 sec; __s64 sec;
......
...@@ -643,7 +643,7 @@ __visible bool __kvm_vcpu_is_preempted(long cpu) ...@@ -643,7 +643,7 @@ __visible bool __kvm_vcpu_is_preempted(long cpu)
{ {
struct kvm_steal_time *src = &per_cpu(steal_time, cpu); struct kvm_steal_time *src = &per_cpu(steal_time, cpu);
return !!src->preempted; return !!(src->preempted & KVM_VCPU_PREEMPTED);
} }
PV_CALLEE_SAVE_REGS_THUNK(__kvm_vcpu_is_preempted); PV_CALLEE_SAVE_REGS_THUNK(__kvm_vcpu_is_preempted);
......
...@@ -2916,7 +2916,7 @@ static void kvm_steal_time_set_preempted(struct kvm_vcpu *vcpu) ...@@ -2916,7 +2916,7 @@ static void kvm_steal_time_set_preempted(struct kvm_vcpu *vcpu)
if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED)) if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED))
return; return;
vcpu->arch.st.steal.preempted = 1; vcpu->arch.st.steal.preempted = KVM_VCPU_PREEMPTED;
kvm_write_guest_offset_cached(vcpu->kvm, &vcpu->arch.st.stime, kvm_write_guest_offset_cached(vcpu->kvm, &vcpu->arch.st.stime,
&vcpu->arch.st.steal.preempted, &vcpu->arch.st.steal.preempted,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment