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>
This commit is contained in:
@@ -563,7 +563,7 @@ static void pit_mask_notifer(struct kvm_irq_mask_notifier *kimn, bool mask)
|
||||
}
|
||||
}
|
||||
|
||||
struct kvm_pit *kvm_create_pit(struct kvm *kvm)
|
||||
struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags)
|
||||
{
|
||||
struct kvm_pit *pit;
|
||||
struct kvm_kpit_state *pit_state;
|
||||
@@ -589,11 +589,13 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm)
|
||||
pit->dev.private = pit;
|
||||
kvm_io_bus_register_dev(&kvm->pio_bus, &pit->dev);
|
||||
|
||||
pit->speaker_dev.read = speaker_ioport_read;
|
||||
pit->speaker_dev.write = speaker_ioport_write;
|
||||
pit->speaker_dev.in_range = speaker_in_range;
|
||||
pit->speaker_dev.private = pit;
|
||||
kvm_io_bus_register_dev(&kvm->pio_bus, &pit->speaker_dev);
|
||||
if (flags & KVM_PIT_SPEAKER_DUMMY) {
|
||||
pit->speaker_dev.read = speaker_ioport_read;
|
||||
pit->speaker_dev.write = speaker_ioport_write;
|
||||
pit->speaker_dev.in_range = speaker_in_range;
|
||||
pit->speaker_dev.private = pit;
|
||||
kvm_io_bus_register_dev(&kvm->pio_bus, &pit->speaker_dev);
|
||||
}
|
||||
|
||||
kvm->arch.vpit = pit;
|
||||
pit->kvm = kvm;
|
||||
|
Reference in New Issue
Block a user