[PATCH] qemu-kvm: Couple in-kernel PIT enabling to in-kernel irqchip

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

 



Upstream will not support disabling the in-kernel PIT separately. In
preparation of merging qemu-kvm, couple our KVM PIT to in-kernel irqchip
support as well. Leave the related command line option in place, just
issuing a warning that it has no function anymore.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
 hw/i8254.c     |    6 +++---
 hw/pcspk.c     |    4 ++--
 kvm-all.c      |    2 --
 qemu-kvm-x86.c |   10 +++++-----
 qemu-kvm.h     |    1 -
 vl.c           |    5 ++---
 6 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/hw/i8254.c b/hw/i8254.c
index 7d060be..8b24867 100644
--- a/hw/i8254.c
+++ b/hw/i8254.c
@@ -475,7 +475,7 @@ void hpet_pit_disable(void)
 {
     PITChannelState *s = &pit_state.channels[0];
 
-    if (kvm_enabled() && kvm_pit_in_kernel()) {
+    if (kvm_enabled() && kvm_irqchip_in_kernel()) {
         if (kvm_has_pit_state2()) {
             kvm_hpet_disable_kpit();
         } else {
@@ -499,7 +499,7 @@ void hpet_pit_enable(void)
     PITState *pit = &pit_state;
     PITChannelState *s = &pit->channels[0];
 
-    if (kvm_enabled() && kvm_pit_in_kernel()) {
+    if (kvm_enabled() && kvm_irqchip_in_kernel()) {
         if (kvm_has_pit_state2()) {
             kvm_hpet_enable_kpit();
         } else {
@@ -529,7 +529,7 @@ static int pit_initfn(ISADevice *dev)
     PITChannelState *s;
 
 #ifdef CONFIG_KVM_PIT
-    if (kvm_enabled() && kvm_pit_in_kernel())
+    if (kvm_enabled() && kvm_irqchip_in_kernel())
         kvm_pit_init(pit);
     else {
 #endif
diff --git a/hw/pcspk.c b/hw/pcspk.c
index dc68cd7..c9f311d 100644
--- a/hw/pcspk.c
+++ b/hw/pcspk.c
@@ -57,7 +57,7 @@ static void kvm_get_pit_ch2(ISADevice *dev,
     struct PITState *pit = DO_UPCAST(struct PITState, dev, dev);
     struct kvm_pit_state pit_state;
 
-    if (kvm_enabled() && kvm_pit_in_kernel()) {
+    if (kvm_enabled() && kvm_irqchip_in_kernel()) {
         kvm_get_pit(kvm_state, &pit_state);
         pit->channels[2].mode = pit_state.channels[2].mode;
         pit->channels[2].count = pit_state.channels[2].count;
@@ -74,7 +74,7 @@ static void kvm_set_pit_ch2(ISADevice *dev,
 {
     struct PITState *pit = DO_UPCAST(struct PITState, dev, dev);
 
-    if (kvm_enabled() && kvm_pit_in_kernel()) {
+    if (kvm_enabled() && kvm_irqchip_in_kernel()) {
         inkernel_state->channels[2].mode = pit->channels[2].mode;
         inkernel_state->channels[2].count = pit->channels[2].count;
         inkernel_state->channels[2].count_load_time =
diff --git a/kvm-all.c b/kvm-all.c
index ed9222a..418410a 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -973,8 +973,6 @@ int kvm_init(void)
     s->pit_state2 = kvm_check_extension(s, KVM_CAP_PIT_STATE2);
 #endif
 
-    s->pit_in_kernel = kvm_pit;
-
     ret = kvm_arch_init(s);
     if (ret < 0) {
         goto err;
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index a7981b1..a0bfc23 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -27,7 +27,7 @@ static int kvm_create_pit(KVMState *s)
 {
     int r;
 
-    if (kvm_pit) {
+    if (kvm_irqchip) {
         r = kvm_vm_ioctl(s, KVM_CREATE_PIT);
         if (r < 0) {
             fprintf(stderr, "Create kernel PIC irqchip failed\n");
@@ -97,7 +97,7 @@ int kvm_set_lapic(CPUState *env, struct kvm_lapic_state *s)
 
 int kvm_get_pit(KVMState *s, struct kvm_pit_state *pit_state)
 {
-    if (!kvm_pit_in_kernel()) {
+    if (!kvm_irqchip_in_kernel()) {
         return 0;
     }
     return kvm_vm_ioctl(s, KVM_GET_PIT, pit_state);
@@ -105,7 +105,7 @@ int kvm_get_pit(KVMState *s, struct kvm_pit_state *pit_state)
 
 int kvm_set_pit(KVMState *s, struct kvm_pit_state *pit_state)
 {
-    if (!kvm_pit_in_kernel()) {
+    if (!kvm_irqchip_in_kernel()) {
         return 0;
     }
     return kvm_vm_ioctl(s, KVM_SET_PIT, pit_state);
@@ -113,7 +113,7 @@ int kvm_set_pit(KVMState *s, struct kvm_pit_state *pit_state)
 
 int kvm_get_pit2(KVMState *s, struct kvm_pit_state2 *ps2)
 {
-    if (!kvm_pit_in_kernel()) {
+    if (!kvm_irqchip_in_kernel()) {
         return 0;
     }
     return kvm_vm_ioctl(s, KVM_GET_PIT2, ps2);
@@ -121,7 +121,7 @@ int kvm_get_pit2(KVMState *s, struct kvm_pit_state2 *ps2)
 
 int kvm_set_pit2(KVMState *s, struct kvm_pit_state2 *ps2)
 {
-    if (!kvm_pit_in_kernel()) {
+    if (!kvm_irqchip_in_kernel()) {
         return 0;
     }
     return kvm_vm_ioctl(s, KVM_SET_PIT2, ps2);
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 2bd5602..975b6fa 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -257,7 +257,6 @@ int kvm_arch_set_ioport_access(unsigned long start, unsigned long size,
                                bool enable);
 
 extern int kvm_irqchip;
-extern int kvm_pit;
 extern int kvm_pit_reinject;
 extern unsigned int kvm_shadow_memory;
 
diff --git a/vl.c b/vl.c
index 1048b22..49a4c97 100644
--- a/vl.c
+++ b/vl.c
@@ -2167,7 +2167,6 @@ static void free_and_trace(gpointer mem)
 
 #ifdef CONFIG_KVM_OPTIONS
 int kvm_irqchip = 1;
-int kvm_pit = 1;
 int kvm_pit_reinject = 1;
 #endif
 
@@ -2883,11 +2882,11 @@ int main(int argc, char **argv, char **envp)
 #ifdef CONFIG_KVM_OPTIONS
 	    case QEMU_OPTION_no_kvm_irqchip: {
 		kvm_irqchip = 0;
-		kvm_pit = 0;
 		break;
 	    }
 	    case QEMU_OPTION_no_kvm_pit: {
-		kvm_pit = 0;
+                fprintf(stderr, "Warning: KVM PIT can no longer be disabled "
+                                "separately.\n");
 		break;
 	    }
             case QEMU_OPTION_no_kvm_pit_reinjection: {
-- 
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