diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2012-03-02 20:28:49 +0100 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-07 12:27:43 +0200 |
commit | 5d17c0d2df4998598e6002b27b8e47e792899a0f (patch) | |
tree | 0615a78c68059aa79cc2c3663d954630e097b508 /hw/pc.c | |
parent | 8a7c73932e03f13f29dea8622e15f1ded478d407 (diff) | |
download | qemu-5d17c0d2df4998598e6002b27b8e47e792899a0f.zip qemu-5d17c0d2df4998598e6002b27b8e47e792899a0f.tar.gz qemu-5d17c0d2df4998598e6002b27b8e47e792899a0f.tar.bz2 |
kvm: x86: Add user space part for in-kernel i8254
This provides the required user space stubs to enable the in-kernel
i8254 emulation of KVM.
The in-kernel model supports lost tick compensation according to the
"delay" policy. This is enabled by default and can be switched off via a
device property.
Depending on the feature set of the host kernel (before 2.6.32), we may
have to disable the HPET or lack sound output from the PC speaker.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/pc.c')
-rw-r--r-- | hw/pc.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -1096,7 +1096,13 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); - if (!no_hpet) { + /* + * Check if an HPET shall be created. + * + * Without KVM_CAP_PIT_STATE2, we cannot switch off the in-kernel PIT + * when the HPET wants to take over. Thus we have to disable the latter. + */ + if (!no_hpet && (!kvm_irqchip_in_kernel() || kvm_has_pit_state2())) { hpet = sysbus_try_create_simple("hpet", HPET_BASE, NULL); if (hpet) { @@ -1112,7 +1118,11 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, qemu_register_boot_set(pc_boot_set, *rtc_state); - pit = pit_init(isa_bus, 0x40, pit_isa_irq, pit_alt_irq); + if (kvm_irqchip_in_kernel()) { + pit = kvm_pit_init(isa_bus, 0x40); + } else { + pit = pit_init(isa_bus, 0x40, pit_isa_irq, pit_alt_irq); + } if (hpet) { /* connect PIT to output control line of the HPET */ qdev_connect_gpio_out(hpet, 0, qdev_get_gpio_in(&pit->qdev, 0)); |