aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/i8254.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@web.de>2009-05-14 16:42:53 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:32:41 -0400
commitc5ff41ce66382d657a76bc06ba252d848826950f (patch)
tree4b7bc3674faa6259b1e6b07fc616b17dcf281d98 /arch/x86/kvm/i8254.c
parent721eecbf4fe995ca94a9edec0c9843b1cc0eaaf3 (diff)
KVM: Allow PIT emulation without speaker port
The in-kernel speaker emulation is only a dummy and also unneeded from the performance point of view. Rather, it takes user space support to generate sound output on the host, e.g. console beeps. To allow this, introduce KVM_CREATE_PIT2 which controls in-kernel speaker port emulation via a flag passed along the new IOCTL. It also leaves room for future extensions of the PIT configuration interface. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/i8254.c')
-rw-r--r--arch/x86/kvm/i8254.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 21f68e00524f..0990bc9aac1f 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -563,7 +563,7 @@ static void pit_mask_notifer(struct kvm_irq_mask_notifier *kimn, bool mask)
563 } 563 }
564} 564}
565 565
566struct kvm_pit *kvm_create_pit(struct kvm *kvm) 566struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags)
567{ 567{
568 struct kvm_pit *pit; 568 struct kvm_pit *pit;
569 struct kvm_kpit_state *pit_state; 569 struct kvm_kpit_state *pit_state;
@@ -589,11 +589,13 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm)
589 pit->dev.private = pit; 589 pit->dev.private = pit;
590 kvm_io_bus_register_dev(&kvm->pio_bus, &pit->dev); 590 kvm_io_bus_register_dev(&kvm->pio_bus, &pit->dev);
591 591
592 pit->speaker_dev.read = speaker_ioport_read; 592 if (flags & KVM_PIT_SPEAKER_DUMMY) {
593 pit->speaker_dev.write = speaker_ioport_write; 593 pit->speaker_dev.read = speaker_ioport_read;
594 pit->speaker_dev.in_range = speaker_in_range; 594 pit->speaker_dev.write = speaker_ioport_write;
595 pit->speaker_dev.private = pit; 595 pit->speaker_dev.in_range = speaker_in_range;
596 kvm_io_bus_register_dev(&kvm->pio_bus, &pit->speaker_dev); 596 pit->speaker_dev.private = pit;
597 kvm_io_bus_register_dev(&kvm->pio_bus, &pit->speaker_dev);
598 }
597 599
598 kvm->arch.vpit = pit; 600 kvm->arch.vpit = pit;
599 pit->kvm = kvm; 601 pit->kvm = kvm;