[PATCH 1/5] qemu-kvm: i8254/pcspk: Remove unused bits to make PC speaker kvm-aware

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

 



Due to old-style-only creation of the in-kernel PIT (became broken long
ago during refactorings), the kernel always handled the speaker port in
qemu-kvm for a long while. Thus all bits that try to make the user space
speaker emulating kvm-aware are actually unused. Upstream will come with
fully-working speaker emulation even while the in-kernel PIT is enabled,
so let's drop the dead bits from qemu-kvm to ease merging with upstream.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
 Makefile.objs   |    2 +-
 Makefile.target |    4 ++--
 hw/i8254.c      |   44 --------------------------------------------
 hw/pcspk.c      |    6 ------
 4 files changed, 3 insertions(+), 53 deletions(-)

diff --git a/Makefile.objs b/Makefile.objs
index c33c0f2..39791ac 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -212,7 +212,7 @@ hw-obj-$(CONFIG_SERIAL) += serial.o
 hw-obj-$(CONFIG_PARALLEL) += parallel.o
 # Moved back to Makefile.target due to #include qemu-kvm.h:
 #hw-obj-$(CONFIG_I8254) += i8254.o
-#hw-obj-$(CONFIG_PCSPK) += pcspk.o
+hw-obj-$(CONFIG_PCSPK) += pcspk.o
 hw-obj-$(CONFIG_PCKBD) += pckbd.o
 hw-obj-$(CONFIG_USB_UHCI) += usb-uhci.o
 hw-obj-$(CONFIG_USB_OHCI) += usb-ohci.o
diff --git a/Makefile.target b/Makefile.target
index ae04331..5f6b963 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -250,7 +250,7 @@ obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
 obj-i386-y += testdev.o
 obj-i386-y += acpi.o acpi_piix4.o
 
-obj-i386-y += pcspk.o i8254.o
+obj-i386-y += i8254.o
 obj-i386-$(CONFIG_KVM_PIT) += i8254-kvm.o
 obj-i386-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += device-assignment.o
 
@@ -308,7 +308,7 @@ obj-lm32-y += milkymist-vgafb.o
 obj-lm32-y += framebuffer.o
 
 obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
-obj-mips-y += pcspk.o i8254.o
+obj-mips-y += i8254.o
 obj-mips-y += acpi.o acpi_piix4.o
 obj-mips-y += mips_addr.o mips_timer.o mips_int.o
 obj-mips-y += gt64xxx.o mc146818rtc.o
diff --git a/hw/i8254.c b/hw/i8254.c
index 33d94e1..8925139 100644
--- a/hw/i8254.c
+++ b/hw/i8254.c
@@ -176,55 +176,11 @@ void pit_set_gate(ISADevice *dev, int channel, int val)
     s->gate = val;
 }
 
-#ifdef CONFIG_KVM_PIT
-static void kvm_get_pit_ch2(ISADevice *dev,
-                            struct kvm_pit_state *inkernel_state)
-{
-    struct PITState *pit = DO_UPCAST(struct PITState, dev, dev);
-    struct kvm_pit_state pit_state;
-
-    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;
-        pit->channels[2].count_load_time = pit_state.channels[2].count_load_time;
-        pit->channels[2].gate = pit_state.channels[2].gate;
-        if (inkernel_state) {
-            memcpy(inkernel_state, &pit_state, sizeof(*inkernel_state));
-        }
-    }
-}
-
-#if 0
-static void kvm_set_pit_ch2(ISADevice *dev,
-                            struct kvm_pit_state *inkernel_state)
-{
-    struct PITState *pit = DO_UPCAST(struct PITState, dev, dev);
-
-    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 =
-            pit->channels[2].count_load_time;
-        inkernel_state->channels[2].gate = pit->channels[2].gate;
-        kvm_set_pit(kvm_state, inkernel_state);
-    }
-}
-#endif
-#else
-static inline void kvm_get_pit_ch2(ISADevice *dev,
-                                   struct kvm_pit_state *inkernel_state) { }
-static inline void kvm_set_pit_ch2(ISADevice *dev,
-                                   struct kvm_pit_state *inkernel_state) { }
-#endif
-
 void pit_get_channel_info(ISADevice *dev, int channel, PITChannelInfo *info)
 {
     PITState *pit = DO_UPCAST(PITState, dev, dev);
     PITChannelState *s = &pit->channels[channel];
 
-    kvm_get_pit_ch2(dev, NULL);
-
     info->gate = s->gate;
     info->mode = s->mode;
     info->initial_count = s->count;
diff --git a/hw/pcspk.c b/hw/pcspk.c
index bb25ffb..e430324 100644
--- a/hw/pcspk.c
+++ b/hw/pcspk.c
@@ -29,7 +29,6 @@
 #include "qemu-timer.h"
 #include "i8254.h"
 #include "pcspk.h"
-#include "qemu-kvm.h"
 
 #define PCSPK_BUF_LEN 1792
 #define PCSPK_SAMPLE_RATE 32000
@@ -141,9 +140,6 @@ static void pcspk_io_write(void *opaque, target_phys_addr_t addr, uint64_t val,
 {
     PCSpkState *s = opaque;
     const int gate = val & 1;
-    PITChannelInfo ch;
-
-    pit_get_channel_info(s->pit, 2, &ch);
 
     s->data_on = (val >> 1) & 1;
     pit_set_gate(s->pit, 2, gate);
@@ -152,8 +148,6 @@ static void pcspk_io_write(void *opaque, target_phys_addr_t addr, uint64_t val,
             s->play_pos = 0;
         AUD_set_active_out(s->voice, gate & s->data_on);
     }
-
-    /*  kvm_set_pit_ch2(s->pit, &inkernel_state); ?? */
 }
 
 static const MemoryRegionOps pcspk_io_ops = {
-- 
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