summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/i8254.h
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2016-03-03 00:56:44 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-03-04 11:29:58 +0300
commitb39c90b6560c4458d46cb243abea0dcb7bc126d1 (patch)
tree0504d13b96b7006735826f3fbbfbb5ac21bd4dc0 /arch/x86/kvm/i8254.h
parent09edea72b7f9fd8a8d26c1f7504d989b9773ee5e (diff)
downloadlinux-b39c90b6560c4458d46cb243abea0dcb7bc126d1.tar.xz
KVM: i8254: remove unnecessary uses of PIT state lock
- kvm_create_pit had to lock only because it exposed kvm->arch.vpit very early, but initialization doesn't use kvm->arch.vpit since the last patch, so we can drop locking. - kvm_free_pit is only run after there are no users of KVM and therefore is the sole actor. - Locking in kvm_vm_ioctl_reinject doesn't do anything, because reinject is only protected at that place. - kvm_pit_reset isn't used anywhere and its locking can be dropped if we hide it. Removing useless locking allows to see what actually is being protected by PIT state lock (values accessible from the guest). Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/i8254.h')
-rw-r--r--arch/x86/kvm/i8254.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86/kvm/i8254.h b/arch/x86/kvm/i8254.h
index a6aceaf08df5..840fbb3cb626 100644
--- a/arch/x86/kvm/i8254.h
+++ b/arch/x86/kvm/i8254.h
@@ -22,17 +22,19 @@ struct kvm_kpit_channel_state {
};
struct kvm_kpit_state {
+ /* All members before "struct mutex lock" are protected by the lock. */
struct kvm_kpit_channel_state channels[3];
u32 flags;
bool is_periodic;
s64 period; /* unit: ns */
struct hrtimer timer;
- atomic_t pending; /* accumulated triggered timers */
- bool reinject;
- struct kvm *kvm;
u32 speaker_data_on;
+
struct mutex lock;
+ struct kvm *kvm;
struct kvm_pit *pit;
+ bool reinject;
+ atomic_t pending; /* accumulated triggered timers */
atomic_t irq_ack;
struct kvm_irq_ack_notifier irq_ack_notifier;
};
@@ -59,7 +61,6 @@ struct kvm_pit {
struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags);
void kvm_free_pit(struct kvm *kvm);
-void kvm_pit_reset(struct kvm_pit *pit);
void kvm_pit_load_count(struct kvm_pit *pit, int channel, u32 val,
int hpet_legacy_start);