[PATCH v3 01/10] qemu-kvm: Move kvm_create_pit out of arch init code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This belongs where the PIT is created and allows us to drop another
kvm_irqchip reference.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
 hw/i8254-kvm.c    |    3 +++
 qemu-kvm-x86.c    |    4 ++--
 qemu-kvm.h        |    2 ++
 target-i386/kvm.c |    7 -------
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/hw/i8254-kvm.c b/hw/i8254-kvm.c
index ba3b5c9..7316111 100644
--- a/hw/i8254-kvm.c
+++ b/hw/i8254-kvm.c
@@ -107,6 +107,9 @@ void kvm_pit_init(PITState *pit)
 {
     PITChannelState *s;
 
+    if (kvm_create_pit(kvm_state) < 0) {
+        hw_error("KVM PIT creation failed\n");
+    }
     s = &pit->channels[0];
     s->irq_timer = qemu_new_timer_ns(vm_clock, dummy_timer, s);
     vmstate_pit.pre_save = kvm_pit_pre_save;
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index a0bfc23..6fe48a4 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -23,11 +23,11 @@
 #include "kvm.h"
 #include "hw/apic.h"
 
-static int kvm_create_pit(KVMState *s)
+int kvm_create_pit(KVMState *s)
 {
     int r;
 
-    if (kvm_irqchip) {
+    if (kvm_irqchip_in_kernel()) {
         r = kvm_vm_ioctl(s, KVM_CREATE_PIT);
         if (r < 0) {
             fprintf(stderr, "Create kernel PIC irqchip failed\n");
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 975b6fa..653370e 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -256,6 +256,8 @@ int kvm_update_ioport_access(CPUState *env);
 int kvm_arch_set_ioport_access(unsigned long start, unsigned long size,
                                bool enable);
 
+int kvm_create_pit(KVMState *s);
+
 extern int kvm_irqchip;
 extern int kvm_pit_reinject;
 extern unsigned int kvm_shadow_memory;
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index a91a18f..0954c74 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -661,8 +661,6 @@ static int kvm_get_supported_msrs(KVMState *s)
     return ret;
 }
 
-static int kvm_create_pit(KVMState *s);
-
 int kvm_arch_init(KVMState *s)
 {
     QemuOptsList *list = qemu_find_opts("machine");
@@ -714,11 +712,6 @@ int kvm_arch_init(KVMState *s)
     }
     qemu_register_reset(kvm_unpoison_all, NULL);
 
-    ret = kvm_create_pit(s);
-    if (ret < 0) {
-        return ret;
-    }
-
     if (!QTAILQ_EMPTY(&list->head)) {
         shadow_mem = qemu_opt_get_size(QTAILQ_FIRST(&list->head),
                                        "kvm_shadow_mem", -1);
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux