[qemu] Upgrade to qemu-kvm-1.1.0
Hans de Goede
jwrdegoede at fedoraproject.org
Thu Jul 5 09:24:41 UTC 2012
commit 329b588089d27facb823d050c0dc03b1f498a94f
Author: Hans de Goede <hdegoede at redhat.com>
Date: Thu Jul 5 11:22:23 2012 +0200
Upgrade to qemu-kvm-1.1.0
- WIP build fails, investigating
- New upstream release 1.1.0
- Drop about a 100 spice + USB patches, which are all upstream
...-regression-i8259-interrupts-did-not-work.patch | 132 --
...u-kvm-Add-missing-default-machine-options.patch | 36 +
...subpage-memory-access-to-RAM-MemoryRegion.patch | 134 --
...rtio-Do-not-register-mask-notifiers-witho.patch | 41 +
...9pfs-Improve-portability-to-older-systems.patch | 101 --
...-migration-blockers-to-prevent-live-migra.patch | 171 --
...w-9pfs-Reset-server-state-during-TVERSION.patch | 64 -
...-qdev.reset-callback-for-virtio-9p-pci-de.patch | 57 -
...-the-correct-file-descriptor-in-Fsdriver-.patch | 210 ---
...lace-iovec-manipulation-with-QEMUIOVector.patch | 305 ----
...-the-correct-signed-type-for-different-va.patch | 133 --
...et-i386-fix-cmpxchg-instruction-emulation.patch | 54 -
...nable-build-by-default-PIE-read-only-relo.patch | 31 -
...cris-Handle-conditional-stores-on-CRISv10.patch | 155 --
0013-pc-add-pc-0.15.patch | 40 -
...vent_idx-compatibility-for-virtio-devices.patch | 87 -
...f-usb-device-description-with-multiple-co.patch | 56 -
0016-usb-storage-cancel-I-O-on-reset.patch | 40 -
...host-properly-release-port-on-unplug-exit.patch | 111 --
...-td.cbp-incorrectly-updated-near-page-end.patch | 40 -
...et-sh4-ignore-ocbp-and-ocbwb-instructions.patch | 47 -
0020-PPC-Fix-linker-scripts-on-ppc-hosts.patch | 74 -
...iov-prevent-double-free-or-use-after-free.patch | 34 -
...witch-per-thread-free-pool-to-a-global-po.patch | 115 --
...g-rebase-Fix-for-undersized-backing-files.patch | 86 -
...tion-Add-qemu-img-t-parameter-in-man-page.patch | 82 -
...s-set-out-parameter-in-qemu_rbd_snap_list.patch | 39 -
...00-bounds-packet-size-against-buffer-size.patch | 37 -
...out-tcp-socket-close-code-in-a-separate-f.patch | 18 +-
...lear-iso-irq-error-when-stopping-the-stre.patch | 56 -
...QemuChrHandlers-struct-to-initialise-char.patch | 504 ++++---
...ynamically-adjust-iso-buffering-size-base.patch | 102 --
...Add-enable-disable_write_fd_handler-funct.patch | 20 +-
...re-fill-our-isoc-input-buffer-before-send.patch | 74 -
...-framework-for-a-write-unblocked-callback.patch | 18 +-
...ry-to-keep-our-buffer-size-near-the-targe.patch | 87 -
...-send_all-to-handle-nonblocking-chardev-w.patch | 60 +-
...usb-redir-Improve-some-debugging-messages.patch | 58 -
...the-unix-tcp-backend-to-handle-nonblockin.patch | 22 +-
...har-Throttle-when-host-connection-is-down.patch | 12 +-
...ole-Enable-port-throttling-when-chardev-i.patch | 18 +-
... => 0109-spice-qemu-char.c-add-throttling.patch | 22 +-
...ce-qemu-char.c-remove-intermediate-buffer.patch | 12 +-
...> 0111-usb-redir-Add-flow-control-support.patch | 32 +-
...serial-bus-replay-guest_open-on-migration.patch | 26 +-
...e-write-callback-if-throttled-chardev-is-.patch | 12 +-
...ear-the-portstatus-powner-bit-on-device-d.patch | 35 -
...dd-the-posibility-to-filter-out-certain-d.patch | 263 ----
...-usb-redir-Fix-printing-of-device-version.patch | 33 -
...lways-clear-device-state-on-filter-reject.patch | 64 -
...et-the-usb-host-know-about-our-device-fil.patch | 93 --
...imit-return-values-returned-by-iso-packet.patch | 42 -
...eturn-USB_RET_NAK-when-we-ve-no-data-for-.patch | 33 -
...ndle-ISO-packets-failing-with-an-error-ot.patch | 64 -
...ver-follow-table-entries-with-the-T-bit-s.patch | 61 -
...lit-our-qh-queue-into-async-and-periodic-.patch | 219 ---
...ways-call-ehci_queues_rip_unused-for-peri.patch | 42 -
...op-cached-qhs-when-the-doorbell-gets-rung.patch | 115 --
...p-the-queues-when-the-async-or-period-sch.patch | 44 -
...y-packet-completion-except-for-NAK-should.patch | 33 -
0133-usb-ehci-Fix-cerr-tracking.patch | 72 -
0134-usb-ehci-Remove-dead-nakcnt-code.patch | 78 -
...usb-ehci-Fix-and-simplify-nakcnt-handling.patch | 120 --
0136-usb-ehci-Remove-dead-isoch_pause-code.patch | 114 --
...BABBLE-rather-then-NAK-when-we-receive-to.patch | 70 -
0138-usb-add-USB_RET_IOERROR.patch | 167 --
0139-usb-ehci-fix-reset.patch | 40 -
0140-usb-ehci-sanity-check-iso-xfers.patch | 42 -
...-ehci-frindex-always-is-a-14-bits-counter.patch | 74 -
0142-usb-ehci-Drop-unused-sofv-value.patch | 49 -
...otify-our-peer-when-we-reject-a-device-du.patch | 36 -
...-An-interface-count-of-0-is-a-valid-value.patch | 47 -
...eset-device-address-and-speed-on-disconne.patch | 30 -
...ot-finding-an-async-urb-id-is-not-an-erro.patch | 31 -
...sure-frindex-writes-leave-a-valid-frindex.patch | 36 -
...orrectly-handle-the-usb_redir_babble-usbr.patch | 27 +
...nity-check-in-qxl_phys2virt-is-off-by-one.patch | 30 -
...d-kbd-mouse-events-only-to-running-guests.patch | 45 -
0403-qxl-fix-warnings-on-32bit.patch | 45 -
...don-t-render-stuff-when-the-vm-is-stopped.patch | 56 -
...y-off-screen-surfaces-dirty-instead-of-th.patch | 97 --
...re-primary-surface-is-saved-on-migration-.patch | 30 -
...ICE-support-to-add_client-monitor-command.patch | 139 --
...rt-ipv6-channel-address-in-monitor-events.patch | 83 -
0409-qxl-drop-vram-bar-minimum-size.patch | 30 -
0410-qxl-move-ram-size-init-to-new-function.patch | 97 --
...qxl-add-user-friendly-bar-size-properties.patch | 63 -
0412-qxl-fix-spice-sdl-no-cursor-regression.patch | 93 --
...dl-remove-NULL-check-g_malloc0-can-t-fail.patch | 29 -
...op-qxl_spice_update_area_async-definition.patch | 34 -
0415-qxl-require-spice-0.8.2.patch | 358 -----
0416-qxl-remove-flipped.patch | 145 --
0417-qxl-introduce-QXLCookie.patch | 264 ----
0418-qxl-make-qxl_render_update-async.patch | 360 -----
0419-spice-use-error_report-to-report-errors.patch | 102 --
...hen-tls-channel-option-is-used-without-TL.patch | 44 -
...ly-handle-upright-and-non-shared-surfaces.patch | 77 -
0422-spice-set-spice-uuid-and-name.patch | 39 -
...or-fix-client_migrate_info-error-handling.patch | 35 -
0424-qxl-init_pipe_signaling-exit-on-failure.patch | 49 -
0425-qxl-switch-qxl.c-to-trace-events.patch | 753 ---------
0426-qxl-qxl_render.c-add-trace-events.patch | 95 --
...-Fix-compilation-failures-on-32-bit-hosts.patch | 80 -
0428-spice-fix-broken-initialization.patch | 67 -
...splay.c-Fix-compilation-warnings-on-32-bi.patch | 56 -
...splay-use-uintptr_t-when-casting-qxl-phys.patch | 78 -
0431-qxl-add-optinal-64bit-vram-bar.patch | 185 ---
...-set-default-values-of-vram-_size_mb-to-1.patch | 35 -
...fix-broken-vnc-spice-since-commit-f934493.patch | 30 -
...on-t-assert-on-guest-create_guest_primary.patch | 36 -
0501-audio-add-VOICE_VOLUME-ctl.patch | 68 -
...-apply-volume-effect-if-backend-has-VOICE.patch | 99 --
0503-hw-ac97-remove-USE_MIXER-code.patch | 170 --
...-hw-ac97-the-volume-mask-is-not-only-0x1f.patch | 28 -
0505-hw-ac97-add-support-for-volume-control.patch | 134 --
...udio-spice-add-support-for-volume-control.patch | 84 -
0507-Do-not-use-pa_simple-PulseAudio-API.patch | 573 -------
...configure-pa_simple-is-not-needed-anymore.patch | 31 -
...ontrolling-volume-with-PulseAudio-backend.patch | 134 --
Fix_save-restore_of_in-kernel_i8259.patch | 87 -
enable_architectural_PMU_cpuid_leaf.patch | 37 -
...Allow-to-leave-type-on-default-in-machine.patch | 14 -
qemu-fix-non-PCI-target-build.patch | 53 -
qemu-vhost-fix-dirty-page-handling.patch | 31 -
qemu-virtio-9p-noatime.patch | 40 -
qemu.spec | 297 +----
qemu_virtio-scsi_support.patch | 1652 --------------------
...o-blk_refuse_SG_IO_requests_with_scsi_off.patch | 111 --
128 files changed, 557 insertions(+), 12684 deletions(-)
---
diff --git a/0001-qemu-kvm-Add-missing-default-machine-options.patch b/0001-qemu-kvm-Add-missing-default-machine-options.patch
new file mode 100644
index 0000000..e785a70
--- /dev/null
+++ b/0001-qemu-kvm-Add-missing-default-machine-options.patch
@@ -0,0 +1,36 @@
+From 398b87f4ef3426569bdda2da2c9c2b89f4ba906f Mon Sep 17 00:00:00 2001
+From: Jan Kiszka <jan.kiszka at siemens.com>
+Date: Mon, 2 Jul 2012 09:34:46 +0200
+Subject: [PATCH 01/17] qemu-kvm: Add missing default machine options
+
+qemu-kvm-specific machine defaults were missing for pc-0.15 and pc-1.0.
+
+Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
+Signed-off-by: Marcelo Tosatti <mtosatti at redhat.com>
+---
+ hw/pc_piix.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/hw/pc_piix.c b/hw/pc_piix.c
+index c3fb74e..4e8a280 100644
+--- a/hw/pc_piix.c
++++ b/hw/pc_piix.c
+@@ -393,6 +393,7 @@ static QEMUMachine pc_machine_v1_0 = {
+ .desc = "Standard PC",
+ .init = pc_init_pci,
+ .max_cpus = 255,
++ .default_machine_opts = "accel=kvm,kernel_irqchip=on",
+ .compat_props = (GlobalProperty[]) {
+ PC_COMPAT_1_0,
+ { /* end of list */ }
+@@ -407,6 +408,7 @@ static QEMUMachine pc_machine_v0_15 = {
+ .desc = "Standard PC",
+ .init = pc_init_pci,
+ .max_cpus = 255,
++ .default_machine_opts = "accel=kvm,kernel_irqchip=on",
+ .compat_props = (GlobalProperty[]) {
+ PC_COMPAT_0_15,
+ { /* end of list */ }
+--
+1.7.10.4
+
diff --git a/0002-qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch b/0002-qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch
new file mode 100644
index 0000000..3c914d0
--- /dev/null
+++ b/0002-qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch
@@ -0,0 +1,41 @@
+From 6f82a5ea52302bab33287b0191538be6f9138637 Mon Sep 17 00:00:00 2001
+From: Jan Kiszka <jan.kiszka at siemens.com>
+Date: Mon, 2 Jul 2012 10:05:39 +0200
+Subject: [PATCH 02/17] qemu-kvm: virtio: Do not register mask notifiers
+ without in-kernel irqchip support
+
+We crash if we registers mask notifiers without backing in-kernel
+irqchip. This corresponds to the check in QEMU upstream after 1.1 now.
+
+Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
+Acked-by: Michael S. Tsirkin <mst at redhat.com>
+Signed-off-by: Marcelo Tosatti <mtosatti at redhat.com>
+---
+ hw/virtio-pci.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
+index a0c2ca7..5b64356 100644
+--- a/hw/virtio-pci.c
++++ b/hw/virtio-pci.c
+@@ -629,7 +629,7 @@ static int virtio_pci_set_guest_notifiers(void *opaque, bool assign)
+
+ /* Must unset mask notifier while guest notifier
+ * is still assigned */
+- if (!assign) {
++ if (kvm_irqchip_in_kernel() && !assign) {
+ r = msix_unset_mask_notifier(&proxy->pci_dev);
+ assert(r >= 0);
+ }
+@@ -647,7 +647,7 @@ static int virtio_pci_set_guest_notifiers(void *opaque, bool assign)
+
+ /* Must set mask notifier after guest notifier
+ * has been assigned */
+- if (assign) {
++ if (kvm_irqchip_in_kernel() && assign) {
+ r = msix_set_mask_notifier(&proxy->pci_dev,
+ virtio_pci_mask_notifier);
+ if (r < 0) {
+--
+1.7.10.4
+
diff --git a/0106-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch b/0101-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch
similarity index 81%
rename from 0106-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch
rename to 0101-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch
index bb37bd7..8f5a24b 100644
--- a/0106-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch
+++ b/0101-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch
@@ -1,22 +1,22 @@
-From 34736b9b6690054152ae2b9b37f75f7ed720590a Mon Sep 17 00:00:00 2001
+From 5b79aa329a378537ec939cee75df10ca073b367f Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah at redhat.com>
Date: Mon, 21 Mar 2011 21:57:47 +0100
-Subject: [PATCH 106/118] char: Split out tcp socket close code in a separate
+Subject: [PATCH 101/114] char: Split out tcp socket close code in a separate
function
Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
qemu-char.c | 25 ++++++++++++++++---------
- 1 files changed, 16 insertions(+), 9 deletions(-)
+ 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
-index 27abcb9..a5ca611 100644
+index fe1126f..78d2a69 100644
--- a/qemu-char.c
+++ b/qemu-char.c
-@@ -2163,6 +2163,21 @@ typedef struct {
-
+@@ -2141,6 +2141,21 @@ typedef struct {
+
static void tcp_chr_accept(void *opaque);
-
+
+static void tcp_closed(void *opaque)
+{
+ CharDriverState *chr = opaque;
@@ -35,7 +35,7 @@ index 27abcb9..a5ca611 100644
static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
{
TCPCharDriver *s = chr->opaque;
-@@ -2313,15 +2328,7 @@ static void tcp_chr_read(void *opaque)
+@@ -2291,15 +2306,7 @@ static void tcp_chr_read(void *opaque)
len = s->max_size;
size = tcp_chr_recv(chr, (void *)buf, len);
if (size == 0) {
@@ -53,5 +53,5 @@ index 27abcb9..a5ca611 100644
if (s->do_telnetopt)
tcp_chr_process_IAC_bytes(chr, s, buf, &size);
--
-1.7.7.5
+1.7.10.4
diff --git a/0107-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch b/0102-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch
similarity index 74%
rename from 0107-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch
rename to 0102-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch
index 48acb6a..5c6b719 100644
--- a/0107-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch
+++ b/0102-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch
@@ -1,7 +1,7 @@
-From 61efa48e1973eaac16615c85198d9d74e36a3124 Mon Sep 17 00:00:00 2001
+From 0e725325a4f3d1eb0eaa243cc059df2774c9c098 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah at redhat.com>
Date: Mon, 21 Mar 2011 20:31:45 +0100
-Subject: [PATCH 107/118] char: Add a QemuChrHandlers struct to initialise
+Subject: [PATCH 102/114] char: Add a QemuChrHandlers struct to initialise
chardev handlers
Instead of passing each handler in the qemu_add_handlers() function,
@@ -10,10 +10,12 @@ create a struct of handlers that can be passed to the function instead.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
gdbstub.c | 9 +++++++--
+ hw/cadence_uart.c | 9 +++++++--
hw/ccid-card-passthru.c | 11 +++++++----
hw/debugcon.c | 2 +-
hw/escc.c | 9 +++++++--
hw/etraxfs_ser.c | 13 +++++++++----
+ hw/exynos4210_uart.c | 9 +++++++--
hw/grlib_apbuart.c | 12 +++++++-----
hw/ivshmem.c | 28 ++++++++++++++++++++++------
hw/lm32_juart.c | 8 +++++++-
@@ -22,30 +24,31 @@ Signed-off-by: Amit Shah <amit.shah at redhat.com>
hw/milkymist-uart.c | 8 +++++++-
hw/pl011.c | 9 +++++++--
hw/pxa2xx.c | 13 +++++++++----
+ hw/qdev-properties.c | 2 +-
hw/serial.c | 9 +++++++--
hw/sh_serial.c | 12 +++++++++---
hw/spapr_vty.c | 8 ++++++--
hw/strongarm.c | 12 +++++++-----
- hw/syborg_serial.c | 9 +++++++--
- hw/usb-serial.c | 9 +++++++--
- hw/virtio-console.c | 11 ++++++++---
+ hw/usb/dev-serial.c | 9 +++++++--
+ hw/usb/redirect.c | 9 +++++++--
+ hw/virtio-console.c | 9 +++++++--
hw/xen_console.c | 16 +++++++++++-----
hw/xilinx_uartlite.c | 11 +++++++++--
monitor.c | 18 ++++++++++++++----
net/slirp.c | 8 ++++++--
qemu-char.c | 32 ++++++++++++++++++++++----------
qemu-char.h | 13 +++++++++----
- usb-redir.c | 9 +++++++--
- 27 files changed, 233 insertions(+), 83 deletions(-)
+ qtest.c | 9 ++++++++-
+ 30 files changed, 248 insertions(+), 86 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
-index 640cf4e..b984e12 100644
+index 6a77a66..9e099b0 100644
--- a/gdbstub.c
+++ b/gdbstub.c
-@@ -2860,6 +2860,12 @@ static void gdb_sigterm_handler(int signal)
+@@ -2874,6 +2874,12 @@ static void gdb_sigterm_handler(int signal)
}
#endif
-
+
+static const QemuChrHandlers gdb_handlers = {
+ .fd_can_read = gdb_chr_can_receive,
+ .fd_read = gdb_chr_receive,
@@ -55,24 +58,51 @@ index 640cf4e..b984e12 100644
int gdbserver_start(const char *device)
{
GDBState *s;
-@@ -2889,8 +2895,7 @@ int gdbserver_start(const char *device)
+@@ -2903,8 +2909,7 @@ int gdbserver_start(const char *device)
if (!chr)
return -1;
-
+
- qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive,
- gdb_chr_event, NULL);
+ qemu_chr_add_handlers(chr, &gdb_handlers, NULL);
}
-
+
s = gdbserver_state;
+diff --git a/hw/cadence_uart.c b/hw/cadence_uart.c
+index d98e531..8f7d64a 100644
+--- a/hw/cadence_uart.c
++++ b/hw/cadence_uart.c
+@@ -435,6 +435,12 @@ static void cadence_uart_reset(UartState *s)
+ s->rx_wpos = 0;
+ }
+
++static const QemuChrHandlers cadence_uart_handlers = {
++ .fd_can_read = uart_can_receive,
++ .fd_read = uart_receive,
++ .fd_event = uart_event,
++};
++
+ static int cadence_uart_init(SysBusDevice *dev)
+ {
+ UartState *s = FROM_SYSBUS(UartState, dev);
+@@ -456,8 +462,7 @@ static int cadence_uart_init(SysBusDevice *dev)
+ cadence_uart_reset(s);
+
+ if (s->chr) {
+- qemu_chr_add_handlers(s->chr, uart_can_receive, uart_receive,
+- uart_event, s);
++ qemu_chr_add_handlers(s->chr, &cadence_uart_handlers, s);
+ }
+
+ return 0;
diff --git a/hw/ccid-card-passthru.c b/hw/ccid-card-passthru.c
-index 9f51c6c..c5bff01 100644
+index bd6c777..fb32107 100644
--- a/hw/ccid-card-passthru.c
+++ b/hw/ccid-card-passthru.c
@@ -274,6 +274,12 @@ static const uint8_t *passthru_get_atr(CCIDCardState *base, uint32_t *len)
return card->atr;
}
-
+
+static const QemuChrHandlers passthru_handlers = {
+ .fd_can_read = ccid_card_vscard_can_read,
+ .fd_read = ccid_card_vscard_read,
@@ -95,26 +125,26 @@ index 9f51c6c..c5bff01 100644
} else {
error_report("missing chardev");
diff --git a/hw/debugcon.c b/hw/debugcon.c
-index c9ee6d9..1d3c3ca 100644
+index 14ab326..7887fd2 100644
--- a/hw/debugcon.c
+++ b/hw/debugcon.c
@@ -73,7 +73,7 @@ static void debugcon_init_core(DebugconState *s)
exit(1);
}
-
+
- qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, s);
+ qemu_chr_add_handlers(s->chr, NULL, s);
}
-
+
static int debugcon_isa_initfn(ISADevice *dev)
diff --git a/hw/escc.c b/hw/escc.c
-index 13c7e66..997377e 100644
+index 4d8a8e8..689f275 100644
--- a/hw/escc.c
+++ b/hw/escc.c
@@ -867,6 +867,12 @@ void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
sysbus_mmio_map(s, 0, base);
}
-
+
+static const QemuChrHandlers serial_handlers = {
+ .fd_can_read = serial_can_receive,
+ .fd_read = serial_receive1,
@@ -135,13 +165,13 @@ index 13c7e66..997377e 100644
}
s->chn[0].otherchn = &s->chn[1];
diff --git a/hw/etraxfs_ser.c b/hw/etraxfs_ser.c
-index 298b985..29d486e 100644
+index 5f16b17..f2571c2 100644
--- a/hw/etraxfs_ser.c
+++ b/hw/etraxfs_ser.c
@@ -208,6 +208,12 @@ static void etraxfs_ser_reset(DeviceState *d)
-
+
}
-
+
+static const QemuChrHandlers serial_handlers = {
+ .fd_can_read = serial_can_receive,
+ .fd_read = serial_receive,
@@ -152,9 +182,9 @@ index 298b985..29d486e 100644
{
struct etrax_serial *s = FROM_SYSBUS(typeof (*s), dev);
@@ -217,10 +223,9 @@ static int etraxfs_ser_init(SysBusDevice *dev)
- sysbus_init_mmio_region(dev, &s->mmio);
-
- s->chr = qdev_init_chardev(&dev->qdev);
+ sysbus_init_mmio(dev, &s->mmio);
+
+ s->chr = qemu_char_get_next_serial();
- if (s->chr)
- qemu_chr_add_handlers(s->chr,
- serial_can_receive, serial_receive,
@@ -164,15 +194,42 @@ index 298b985..29d486e 100644
+ }
return 0;
}
-
+
+diff --git a/hw/exynos4210_uart.c b/hw/exynos4210_uart.c
+index ccc4780..fefe400 100644
+--- a/hw/exynos4210_uart.c
++++ b/hw/exynos4210_uart.c
+@@ -625,6 +625,12 @@ DeviceState *exynos4210_uart_create(target_phys_addr_t addr,
+ return dev;
+ }
+
++static const QemuChrHandlers exynos4210_handlers = {
++ .fd_can_read = exynos4210_uart_can_receive,
++ .fd_read = exynos4210_uart_receive,
++ .fd_event = exynos4210_uart_event,
++};
++
+ static int exynos4210_uart_init(SysBusDevice *dev)
+ {
+ Exynos4210UartState *s = FROM_SYSBUS(Exynos4210UartState, dev);
+@@ -636,8 +642,7 @@ static int exynos4210_uart_init(SysBusDevice *dev)
+
+ sysbus_init_irq(dev, &s->irq);
+
+- qemu_chr_add_handlers(s->chr, exynos4210_uart_can_receive,
+- exynos4210_uart_receive, exynos4210_uart_event, s);
++ qemu_chr_add_handlers(s->chr, &exynos4210_handlers, s);
+
+ return 0;
+ }
diff --git a/hw/grlib_apbuart.c b/hw/grlib_apbuart.c
-index c90b810..ac6c33b 100644
+index 73fc989..fd77d52 100644
--- a/hw/grlib_apbuart.c
+++ b/hw/grlib_apbuart.c
-@@ -144,16 +144,18 @@ static CPUWriteMemoryFunc * const grlib_apbuart_write[] = {
- NULL, NULL, grlib_apbuart_writel,
+@@ -222,15 +222,17 @@ static const MemoryRegionOps grlib_apbuart_ops = {
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
-
+
+static const QemuChrHandlers grlib_handlers = {
+ .fd_can_read = grlib_apbuart_can_receive,
+ .fd_read = grlib_apbuart_receive,
@@ -181,26 +238,25 @@ index c90b810..ac6c33b 100644
+
static int grlib_apbuart_init(SysBusDevice *dev)
{
- UART *uart = FROM_SYSBUS(typeof(*uart), dev);
- int uart_regs = 0;
-
+ UART *uart = FROM_SYSBUS(typeof(*uart), dev);
+
- qemu_chr_add_handlers(uart->chr,
- grlib_apbuart_can_receive,
- grlib_apbuart_receive,
- grlib_apbuart_event,
- uart);
+ qemu_chr_add_handlers(uart->chr, &grlib_handlers, uart);
-
+
sysbus_init_irq(dev, &uart->irq);
-
+
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
-index 7b4dbf6..ee78576 100644
+index d48e5f9..2dbf86e 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
-@@ -276,6 +276,18 @@ static void fake_irqfd(void *opaque, const uint8_t *buf, int size) {
+@@ -279,6 +279,18 @@ static void fake_irqfd(void *opaque, const uint8_t *buf, int size) {
msix_notify(pdev, entry->vector);
}
-
+
+static const QemuChrHandlers ivshmem_handlers = {
+ .fd_can_read = ivshmem_can_receive,
+ .fd_read = ivshmem_receive,
@@ -216,10 +272,10 @@ index 7b4dbf6..ee78576 100644
static CharDriverState* create_eventfd_chr_device(void * opaque, int eventfd,
int vector)
{
-@@ -295,11 +307,10 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, int eventfd,
+@@ -298,11 +310,10 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, int eventfd,
s->eventfd_table[vector].pdev = &s->dev;
s->eventfd_table[vector].vector = vector;
-
+
- qemu_chr_add_handlers(chr, ivshmem_can_receive, fake_irqfd,
- ivshmem_event, &s->eventfd_table[vector]);
+ qemu_chr_add_handlers(chr, &ivshmem_msi_handlers,
@@ -229,12 +285,12 @@ index 7b4dbf6..ee78576 100644
- ivshmem_event, s);
+ qemu_chr_add_handlers(chr, &ivshmem_handlers, s);
}
-
+
return chr;
-@@ -614,6 +625,12 @@ static int ivshmem_load(QEMUFile* f, void *opaque, int version_id)
- return 0;
+@@ -635,6 +646,12 @@ static void ivshmem_write_config(PCIDevice *pci_dev, uint32_t address,
+ msix_write_config(pci_dev, address, val, len);
}
-
+
+static const QemuChrHandlers ivshmem_server_handlers = {
+ .fd_can_read = ivshmem_can_receive,
+ .fd_read = ivshmem_read,
@@ -244,10 +300,10 @@ index 7b4dbf6..ee78576 100644
static int pci_ivshmem_init(PCIDevice *dev)
{
IVShmemState *s = DO_UPCAST(IVShmemState, dev, dev);
-@@ -703,8 +720,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
-
+@@ -724,8 +741,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
+
s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *));
-
+
- qemu_chr_add_handlers(s->server_chr, ivshmem_can_receive, ivshmem_read,
- ivshmem_event, s);
+ qemu_chr_add_handlers(s->server_chr, &ivshmem_server_handlers, s);
@@ -255,13 +311,13 @@ index 7b4dbf6..ee78576 100644
/* just map the file immediately, we're not using a server */
int fd;
diff --git a/hw/lm32_juart.c b/hw/lm32_juart.c
-index 5454aa4..1b9fa07 100644
+index f07ed39..d4daeb8 100644
--- a/hw/lm32_juart.c
+++ b/hw/lm32_juart.c
@@ -110,13 +110,19 @@ static void juart_reset(DeviceState *d)
s->jrx = 0;
}
-
+
+static const QemuChrHandlers juart_handlers = {
+ .fd_can_read = juart_can_rx,
+ .fd_read = juart_rx,
@@ -271,22 +327,22 @@ index 5454aa4..1b9fa07 100644
static int lm32_juart_init(SysBusDevice *dev)
{
LM32JuartState *s = FROM_SYSBUS(typeof(*s), dev);
-
- s->chr = qdev_init_chardev(&dev->qdev);
+
+ s->chr = qemu_char_get_next_serial();
if (s->chr) {
- qemu_chr_add_handlers(s->chr, juart_can_rx, juart_rx, juart_event, s);
-+ qemu_chr_add_handlers(s->chr, juart_handlers, s);
++ qemu_chr_add_handlers(s->chr, &juart_handlers, s);
}
-
+
return 0;
diff --git a/hw/lm32_uart.c b/hw/lm32_uart.c
-index 3678545..ccaf88c 100644
+index 57066e2..4ea130b 100644
--- a/hw/lm32_uart.c
+++ b/hw/lm32_uart.c
-@@ -242,6 +242,12 @@ static void uart_reset(DeviceState *d)
+@@ -243,6 +243,12 @@ static void uart_reset(DeviceState *d)
s->regs[R_LSR] = LSR_THRE | LSR_TEMT;
}
-
+
+static const QemuChrHandlers uart_handlers = {
+ .fd_can_read = uart_can_rx,
+ .fd_read = uart_rx,
@@ -296,23 +352,23 @@ index 3678545..ccaf88c 100644
static int lm32_uart_init(SysBusDevice *dev)
{
LM32UartState *s = FROM_SYSBUS(typeof(*s), dev);
-@@ -255,7 +261,7 @@ static int lm32_uart_init(SysBusDevice *dev)
-
- s->chr = qdev_init_chardev(&dev->qdev);
+@@ -254,7 +260,7 @@ static int lm32_uart_init(SysBusDevice *dev)
+
+ s->chr = qemu_char_get_next_serial();
if (s->chr) {
- qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
-+ qemu_chr_add_handlers(s->chr, uart_handlers, s);
++ qemu_chr_add_handlers(s->chr, &uart_handlers, s);
}
-
+
return 0;
diff --git a/hw/mcf_uart.c b/hw/mcf_uart.c
-index e6b2ab0..2870683 100644
+index ec6a87f..f52fb96 100644
--- a/hw/mcf_uart.c
+++ b/hw/mcf_uart.c
-@@ -268,6 +268,12 @@ static void mcf_uart_receive(void *opaque, const uint8_t *buf, int size)
+@@ -272,6 +272,12 @@ static void mcf_uart_receive(void *opaque, const uint8_t *buf, int size)
mcf_uart_push_byte(s, buf[0]);
}
-
+
+static const QemuChrHandlers mcf_uart_handlers = {
+ .fd_can_read = mcf_uart_can_receive,
+ .fd_read = mcf_uart_receive,
@@ -322,7 +378,7 @@ index e6b2ab0..2870683 100644
void *mcf_uart_init(qemu_irq irq, CharDriverState *chr)
{
mcf_uart_state *s;
-@@ -276,8 +282,7 @@ void *mcf_uart_init(qemu_irq irq, CharDriverState *chr)
+@@ -280,8 +286,7 @@ void *mcf_uart_init(qemu_irq irq, CharDriverState *chr)
s->chr = chr;
s->irq = irq;
if (chr) {
@@ -333,13 +389,13 @@ index e6b2ab0..2870683 100644
mcf_uart_reset(s);
return s;
diff --git a/hw/milkymist-uart.c b/hw/milkymist-uart.c
-index 5404ca9..fd10e12 100644
+index 291fe3c..2dcb41c 100644
--- a/hw/milkymist-uart.c
+++ b/hw/milkymist-uart.c
@@ -189,6 +189,12 @@ static void milkymist_uart_reset(DeviceState *d)
s->regs[R_STAT] = STAT_THRE;
}
-
+
+static const QemuChrHandlers uart_handlers = {
+ .fd_can_read = uart_can_rx,
+ .fd_read = uart_rx,
@@ -350,22 +406,22 @@ index 5404ca9..fd10e12 100644
{
MilkymistUartState *s = FROM_SYSBUS(typeof(*s), dev);
@@ -201,7 +207,7 @@ static int milkymist_uart_init(SysBusDevice *dev)
-
- s->chr = qdev_init_chardev(&dev->qdev);
+
+ s->chr = qemu_char_get_next_serial();
if (s->chr) {
- qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
-+ qemu_chr_add_handlers(s->chr, uart_handlers, s);
++ qemu_chr_add_handlers(s->chr, &uart_handlers, s);
}
-
+
return 0;
diff --git a/hw/pl011.c b/hw/pl011.c
-index 707a161..7482246 100644
+index 8a5a8f5..b125c40 100644
--- a/hw/pl011.c
+++ b/hw/pl011.c
-@@ -260,6 +260,12 @@ static const VMStateDescription vmstate_pl011 = {
+@@ -256,6 +256,12 @@ static const VMStateDescription vmstate_pl011 = {
}
};
-
+
+static const QemuChrHandlers pl011_handlers = {
+ .fd_can_read = pl011_can_receive,
+ .fd_read = pl011_receive,
@@ -374,8 +430,8 @@ index 707a161..7482246 100644
+
static int pl011_init(SysBusDevice *dev, const unsigned char *id)
{
- int iomemtype;
-@@ -278,8 +284,7 @@ static int pl011_init(SysBusDevice *dev, const unsigned char *id)
+ pl011_state *s = FROM_SYSBUS(pl011_state, dev);
+@@ -271,8 +277,7 @@ static int pl011_init(SysBusDevice *dev, const unsigned char *id)
s->cr = 0x300;
s->flags = 0x90;
if (s->chr) {
@@ -386,13 +442,13 @@ index 707a161..7482246 100644
vmstate_register(&dev->qdev, -1, &vmstate_pl011, s);
return 0;
diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
-index e9a507e..24925b6 100644
+index ddaa846..81827a4 100644
--- a/hw/pxa2xx.c
+++ b/hw/pxa2xx.c
-@@ -1984,6 +1984,12 @@ static int pxa2xx_fir_load(QEMUFile *f, void *opaque, int version_id)
+@@ -2011,6 +2011,12 @@ static int pxa2xx_fir_load(QEMUFile *f, void *opaque, int version_id)
return 0;
}
-
+
+static const QemuChrHandlers pxa2xx_handlers = {
+ .fd_can_read = pxa2xx_fir_is_empty,
+ .fd_read = pxa2xx_fir_rx,
@@ -402,10 +458,10 @@ index e9a507e..24925b6 100644
static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem,
target_phys_addr_t base,
qemu_irq irq, qemu_irq rx_dma, qemu_irq tx_dma,
-@@ -2002,10 +2008,9 @@ static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem,
+@@ -2029,10 +2035,9 @@ static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem,
memory_region_init_io(&s->iomem, &pxa2xx_fir_ops, s, "pxa2xx-fir", 0x1000);
memory_region_add_subregion(sysmem, base, &s->iomem);
-
+
- if (chr)
- qemu_chr_add_handlers(chr, pxa2xx_fir_is_empty,
- pxa2xx_fir_rx, pxa2xx_fir_event, s);
@@ -415,15 +471,28 @@ index e9a507e..24925b6 100644
+ }
register_savevm(NULL, "pxa2xx_fir", 0, 0, pxa2xx_fir_save,
pxa2xx_fir_load, s);
-
+
+diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
+index b7b5597..e3c1b40 100644
+--- a/hw/qdev-properties.c
++++ b/hw/qdev-properties.c
+@@ -551,7 +551,7 @@ static void release_chr(Object *obj, const char *name, void *opaque)
+ CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);
+
+ if (*ptr) {
+- qemu_chr_add_handlers(*ptr, NULL, NULL, NULL, NULL);
++ qemu_chr_add_handlers(*ptr, NULL, NULL);
+ }
+ }
+
diff --git a/hw/serial.c b/hw/serial.c
-index d35c7a9..6499d4a 100644
+index a421d1e..056d823 100644
--- a/hw/serial.c
+++ b/hw/serial.c
-@@ -728,6 +728,12 @@ static void serial_reset(void *opaque)
+@@ -736,6 +736,12 @@ static void serial_reset(void *opaque)
qemu_irq_lower(s->irq);
}
-
+
+static const QemuChrHandlers serial_handlers = {
+ .fd_can_read = serial_can_receive1,
+ .fd_read = serial_receive1,
@@ -433,54 +502,54 @@ index d35c7a9..6499d4a 100644
static void serial_init_core(SerialState *s)
{
if (!s->chr) {
-@@ -742,8 +748,7 @@ static void serial_init_core(SerialState *s)
-
+@@ -750,8 +756,7 @@ static void serial_init_core(SerialState *s)
+
qemu_register_reset(serial_reset, s);
-
+
- qemu_chr_add_handlers(s->chr, serial_can_receive1, serial_receive1,
- serial_event, s);
+ qemu_chr_add_handlers(s->chr, &serial_handlers, s);
}
-
+
/* Change the main reference oscillator frequency. */
diff --git a/hw/sh_serial.c b/hw/sh_serial.c
-index a20c59e..470ce7a 100644
+index 43b0eb1..c322784 100644
--- a/hw/sh_serial.c
+++ b/hw/sh_serial.c
-@@ -350,6 +350,12 @@ static CPUWriteMemoryFunc * const sh_serial_writefn[] = {
- &sh_serial_write,
+@@ -350,6 +350,12 @@ static const MemoryRegionOps sh_serial_ops = {
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
-
+
+static const QemuChrHandlers sh_serial_handlers = {
+ .fd_can_read = sh_serial_can_receive1,
+ .fd_read = sh_serial_receive1,
+ .fd_event = sh_serial_event,
+};
+
- void sh_serial_init (target_phys_addr_t base, int feat,
- uint32_t freq, CharDriverState *chr,
- qemu_irq eri_source,
-@@ -389,9 +395,9 @@ void sh_serial_init (target_phys_addr_t base, int feat,
-
+ void sh_serial_init(MemoryRegion *sysmem,
+ target_phys_addr_t base, int feat,
+ uint32_t freq, CharDriverState *chr,
+@@ -394,9 +400,9 @@ void sh_serial_init(MemoryRegion *sysmem,
+
s->chr = chr;
-
+
- if (chr)
- qemu_chr_add_handlers(chr, sh_serial_can_receive1, sh_serial_receive1,
- sh_serial_event, s);
+ if (chr) {
+ qemu_chr_add_handlers(chr, &sh_serial_handlers, s);
+ }
-
+
s->eri = eri_source;
s->rxi = rxi_source;
diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c
-index f23cc36..0d9cd59 100644
+index c9674f3..15f61c3 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -54,6 +54,11 @@ void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len)
qemu_chr_fe_write(dev->chardev, buf, len);
}
-
+
+static const QemuChrHandlers vty_handlers = {
+ .fd_can_read = vty_can_receive,
+ .fd_read = vty_receive,
@@ -492,21 +561,21 @@ index f23cc36..0d9cd59 100644
@@ -63,8 +68,7 @@ static int spapr_vty_init(VIOsPAPRDevice *sdev)
exit(1);
}
-
+
- qemu_chr_add_handlers(dev->chardev, vty_can_receive,
- vty_receive, NULL, dev);
-+ qemu_chr_add_handlers(dev->chardev, vty_handlers, dev);
-
++ qemu_chr_add_handlers(dev->chardev, &vty_handlers, dev);
+
return 0;
}
diff --git a/hw/strongarm.c b/hw/strongarm.c
-index a3d9080..8a8a219 100644
+index 1b15f39..2ae2f7e 100644
--- a/hw/strongarm.c
+++ b/hw/strongarm.c
-@@ -1160,6 +1160,12 @@ static const MemoryRegionOps strongarm_uart_ops = {
+@@ -1199,6 +1199,12 @@ static const MemoryRegionOps strongarm_uart_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-
+
+static const QemuChrHandlers strongarm_uart_handlers = {
+ .fd_can_read = strongarm_uart_can_receive,
+ .fd_read = strongarm_uart_receive,
@@ -516,9 +585,9 @@ index a3d9080..8a8a219 100644
static int strongarm_uart_init(SysBusDevice *dev)
{
StrongARMUARTState *s = FROM_SYSBUS(StrongARMUARTState, dev);
-@@ -1172,11 +1178,7 @@ static int strongarm_uart_init(SysBusDevice *dev)
+@@ -1211,11 +1217,7 @@ static int strongarm_uart_init(SysBusDevice *dev)
s->tx_timer = qemu_new_timer_ns(vm_clock, strongarm_uart_tx, s);
-
+
if (s->chr) {
- qemu_chr_add_handlers(s->chr,
- strongarm_uart_can_receive,
@@ -527,43 +596,16 @@ index a3d9080..8a8a219 100644
- s);
+ qemu_chr_add_handlers(s->chr, &strongarm_uart_handlers, s);
}
-
+
return 0;
-diff --git a/hw/syborg_serial.c b/hw/syborg_serial.c
-index c83f82c..fff76da 100644
---- a/hw/syborg_serial.c
-+++ b/hw/syborg_serial.c
-@@ -292,6 +292,12 @@ static const VMStateDescription vmstate_syborg_serial = {
- }
- };
-
-+static const QemuChrHandlers syborg_serial_handlers = {
-+ .fd_can_read = syborg_serial_can_receive,
-+ .fd_read = syborg_serial_receive,
-+ .fd_event = syborg_serial_event,
-+};
-+
- static int syborg_serial_init(SysBusDevice *dev)
- {
- SyborgSerialState *s = FROM_SYSBUS(SyborgSerialState, dev);
-@@ -304,8 +310,7 @@ static int syborg_serial_init(SysBusDevice *dev)
- sysbus_init_mmio(dev, 0x1000, iomemtype);
- s->chr = qdev_init_chardev(&dev->qdev);
- if (s->chr) {
-- qemu_chr_add_handlers(s->chr, syborg_serial_can_receive,
-- syborg_serial_receive, syborg_serial_event, s);
-+ qemu_chr_add_handlers(s->chr, &syborg_serial_handlers, s);
- }
- if (s->fifo_size <= 0) {
- fprintf(stderr, "syborg_serial: fifo too small\n");
-diff --git a/hw/usb-serial.c b/hw/usb-serial.c
-index 7dbf6df..bcf6622 100644
---- a/hw/usb-serial.c
-+++ b/hw/usb-serial.c
-@@ -482,6 +482,12 @@ static void usb_serial_event(void *opaque, int event)
+diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
+index 56743ee..af670cc 100644
+--- a/hw/usb/dev-serial.c
++++ b/hw/usb/dev-serial.c
+@@ -475,6 +475,12 @@ static void usb_serial_event(void *opaque, int event)
}
}
-
+
+static const QemuChrHandlers usb_serial_handlers = {
+ .fd_can_read = usb_serial_can_read,
+ .fd_read = usb_serial_read,
@@ -573,24 +615,51 @@ index 7dbf6df..bcf6622 100644
static int usb_serial_initfn(USBDevice *dev)
{
USBSerialState *s = DO_UPCAST(USBSerialState, dev, dev);
-@@ -493,8 +499,7 @@ static int usb_serial_initfn(USBDevice *dev)
+@@ -487,8 +493,7 @@ static int usb_serial_initfn(USBDevice *dev)
return -1;
}
-
+
- qemu_chr_add_handlers(s->cs, usb_serial_can_read, usb_serial_read,
- usb_serial_event, s);
+ qemu_chr_add_handlers(s->cs, &usb_serial_handlers, s);
usb_serial_handle_reset(dev);
return 0;
}
+diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
+index 51c27b4..6e8180e 100644
+--- a/hw/usb/redirect.c
++++ b/hw/usb/redirect.c
+@@ -890,6 +890,12 @@ static void usbredir_chardev_event(void *opaque, int event)
+ }
+ }
+
++static const QemuChrHandlers usbredir_chr_handlers = {
++ .fd_can_read = usbredir_chardev_can_read,
++ .fd_read = usbredir_chardev_read,
++ .fd_event = usbredir_chardev_event,
++};
++
+ /*
+ * init + destroy
+ */
+@@ -928,8 +934,7 @@ static int usbredir_initfn(USBDevice *udev)
+
+ /* Let the backend know we are ready */
+ qemu_chr_fe_open(dev->cs);
+- qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read,
+- usbredir_chardev_read, usbredir_chardev_event, dev);
++ qemu_chr_add_handlers(dev->cs, &usbredir_chr_handlers, dev);
+
+ add_boot_device_path(dev->bootindex, &udev->qdev, NULL);
+ return 0;
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
-index d3351c8..6d6f3ef 100644
+index cffee3d..066590c 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
-@@ -95,6 +95,12 @@ static void chr_event(void *opaque, int event)
+@@ -106,6 +106,12 @@ static void chr_event(void *opaque, int event)
}
}
-
+
+static const QemuChrHandlers chr_handlers = {
+ .fd_can_read = chr_can_read,
+ .fd_read = chr_read,
@@ -600,33 +669,24 @@ index d3351c8..6d6f3ef 100644
static int virtconsole_initfn(VirtIOSerialPort *port)
{
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
-@@ -107,8 +113,7 @@ static int virtconsole_initfn(VirtIOSerialPort *port)
+@@ -117,8 +123,7 @@ static int virtconsole_initfn(VirtIOSerialPort *port)
}
-
+
if (vcon->chr) {
- qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
- vcon);
+ qemu_chr_add_handlers(vcon->chr, &chr_handlers, vcon);
- info->have_data = flush_buf;
- info->guest_open = guest_open;
- info->guest_close = guest_close;
-@@ -126,7 +131,7 @@ static int virtconsole_exitfn(VirtIOSerialPort *port)
- * Instead of closing the chardev, free it so it can be used
- * for other purposes.
- */
-- qemu_chr_add_handlers(vcon->chr, NULL, NULL, NULL, NULL);
-+ qemu_chr_add_handlers(vcon->chr, NULL, NULL);
}
-
+
return 0;
diff --git a/hw/xen_console.c b/hw/xen_console.c
-index edcb31c..2ba74f0 100644
+index 3794b19..ee872c3 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -212,6 +212,11 @@ out:
return ret;
}
-
+
+static const QemuChrHandlers xencons_handlers = {
+ .fd_can_read = xencons_can_receive,
+ .fd_read = xencons_receive,
@@ -637,7 +697,7 @@ index edcb31c..2ba74f0 100644
struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
@@ -232,9 +237,9 @@ static int con_initialise(struct XenDevice *xendev)
return -1;
-
+
xen_be_bind_evtchn(&con->xendev);
- if (con->chr)
- qemu_chr_add_handlers(con->chr, xencons_can_receive, xencons_receive,
@@ -645,29 +705,29 @@ index edcb31c..2ba74f0 100644
+ if (con->chr) {
+ qemu_chr_add_handlers(con->chr, &xencons_handlers, con);
+ }
-
+
xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n",
con->ring_ref,
-@@ -248,8 +253,9 @@ static void con_disconnect(struct XenDevice *xendev)
- {
- struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
-
+@@ -251,8 +256,9 @@ static void con_disconnect(struct XenDevice *xendev)
+ if (!xendev->dev) {
+ return;
+ }
- if (con->chr)
- qemu_chr_add_handlers(con->chr, NULL, NULL, NULL, NULL);
+ if (con->chr) {
+ qemu_chr_add_handlers(con->chr, NULL, NULL);
+ }
xen_be_unbind_evtchn(&con->xendev);
-
+
if (con->sring) {
diff --git a/hw/xilinx_uartlite.c b/hw/xilinx_uartlite.c
-index ceb7b4d..69f7191 100644
+index aa0170d..6ca45dc 100644
--- a/hw/xilinx_uartlite.c
+++ b/hw/xilinx_uartlite.c
@@ -195,6 +195,12 @@ static void uart_event(void *opaque, int event)
-
+
}
-
+
+static const QemuChrHandlers uart_handlers = {
+ .fd_can_read = uart_can_rx,
+ .fd_read = uart_rx,
@@ -678,9 +738,9 @@ index ceb7b4d..69f7191 100644
{
struct xlx_uartlite *s = FROM_SYSBUS(typeof (*s), dev);
@@ -206,8 +212,9 @@ static int xilinx_uartlite_init(SysBusDevice *dev)
- sysbus_init_mmio_region(dev, &s->mmio);
-
- s->chr = qdev_init_chardev(&dev->qdev);
+ sysbus_init_mmio(dev, &s->mmio);
+
+ s->chr = qemu_char_get_next_serial();
- if (s->chr)
- qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
+ if (s->chr) {
@@ -688,15 +748,15 @@ index ceb7b4d..69f7191 100644
+ }
return 0;
}
-
+
diff --git a/monitor.c b/monitor.c
-index f956eb7..a82fda3 100644
+index 71f4392..116accb 100644
--- a/monitor.c
+++ b/monitor.c
-@@ -4882,6 +4882,18 @@ static void sortcmdlist(void)
+@@ -4601,6 +4601,18 @@ static void sortcmdlist(void)
* End:
*/
-
+
+static const QemuChrHandlers monitor_handlers = {
+ .fd_can_read = monitor_can_read,
+ .fd_read = monitor_read,
@@ -712,7 +772,7 @@ index f956eb7..a82fda3 100644
void monitor_init(CharDriverState *chr, int flags)
{
static int is_first_init = 1;
-@@ -4904,12 +4916,10 @@ void monitor_init(CharDriverState *chr, int flags)
+@@ -4623,12 +4635,10 @@ void monitor_init(CharDriverState *chr, int flags)
if (monitor_ctrl_mode(mon)) {
mon->mc = g_malloc0(sizeof(MonitorControl));
/* Control mode requires special handlers */
@@ -725,16 +785,16 @@ index f956eb7..a82fda3 100644
- monitor_event, mon);
+ qemu_chr_add_handlers(chr, &monitor_handlers, mon);
}
-
+
QLIST_INSERT_HEAD(&mon_list, mon, entry);
diff --git a/net/slirp.c b/net/slirp.c
-index 6646ecb..05405ff 100644
+index 96f5032..aa8ed08 100644
--- a/net/slirp.c
+++ b/net/slirp.c
-@@ -576,6 +576,11 @@ static void guestfwd_read(void *opaque, const uint8_t *buf, int size)
+@@ -577,6 +577,11 @@ static void guestfwd_read(void *opaque, const uint8_t *buf, int size)
slirp_socket_recv(fwd->slirp, fwd->server, fwd->port, buf, size);
}
-
+
+static const QemuChrHandlers guestfwd_handlers = {
+ .fd_can_read = guestfwd_can_read,
+ .fd_read = guestfwd_read,
@@ -743,24 +803,24 @@ index 6646ecb..05405ff 100644
static int slirp_guestfwd(SlirpState *s, const char *config_str,
int legacy_format)
{
-@@ -632,8 +637,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str,
+@@ -633,8 +638,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str,
fwd->port = port;
fwd->slirp = s->slirp;
-
+
- qemu_chr_add_handlers(fwd->hd, guestfwd_can_read, guestfwd_read,
- NULL, fwd);
+ qemu_chr_add_handlers(fwd->hd, &guestfwd_handlers, fwd);
return 0;
-
+
fail_syntax:
diff --git a/qemu-char.c b/qemu-char.c
-index a5ca611..d2a99a6 100644
+index 78d2a69..86bdabf 100644
--- a/qemu-char.c
+++ b/qemu-char.c
-@@ -189,19 +189,26 @@ void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...)
+@@ -192,19 +192,26 @@ void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...)
va_end(ap);
}
-
+
+static const QemuChrHandlers null_handlers = {
+ /* All handlers are initialised to NULL */
+};
@@ -792,10 +852,10 @@ index a5ca611..d2a99a6 100644
s->handler_opaque = opaque;
if (s->chr_update_read_handler)
s->chr_update_read_handler(s);
-@@ -441,6 +448,12 @@ static void mux_chr_event(void *opaque, int event)
+@@ -442,6 +449,12 @@ static void mux_chr_event(void *opaque, int event)
mux_chr_send_event(d, i, event);
}
-
+
+static const QemuChrHandlers mux_chr_handlers = {
+ .fd_can_read = mux_chr_can_read,
+ .fd_read = mux_chr_read,
@@ -805,7 +865,7 @@ index a5ca611..d2a99a6 100644
static void mux_chr_update_read_handler(CharDriverState *chr)
{
MuxDriver *d = chr->opaque;
-@@ -455,8 +468,7 @@ static void mux_chr_update_read_handler(CharDriverState *chr)
+@@ -456,8 +469,7 @@ static void mux_chr_update_read_handler(CharDriverState *chr)
d->chr_event[d->mux_cnt] = chr->chr_event;
/* Fix up the real driver with mux routines */
if (d->mux_cnt == 0) {
@@ -816,13 +876,13 @@ index a5ca611..d2a99a6 100644
if (d->focus != -1) {
mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_OUT);
diff --git a/qemu-char.h b/qemu-char.h
-index 8ca1e2d..564e688 100644
+index 486644b..dfa8c2d 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -222,10 +222,15 @@ void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
*/
void qemu_chr_be_event(CharDriverState *s, int event);
-
+
-void qemu_chr_add_handlers(CharDriverState *s,
- IOCanReadHandler *fd_can_read,
- IOReadHandler *fd_read,
@@ -837,35 +897,35 @@ index 8ca1e2d..564e688 100644
+
+void qemu_chr_add_handlers(CharDriverState *s, const QemuChrHandlers *handlers,
void *opaque);
-
+
void qemu_chr_generic_open(CharDriverState *s);
-diff --git a/usb-redir.c b/usb-redir.c
-index 86bccf8..e421cff 100644
---- a/usb-redir.c
-+++ b/usb-redir.c
-@@ -865,6 +865,12 @@ static void usbredir_chardev_event(void *opaque, int event)
+diff --git a/qtest.c b/qtest.c
+index fbfab4e..4ab5b69 100644
+--- a/qtest.c
++++ b/qtest.c
+@@ -416,6 +416,13 @@ static void qtest_event(void *opaque, int event)
}
}
-
-+static const QemuChrHandlers usbredir_chr_handlers = {
-+ .fd_can_read = usbredir_chardev_can_read,
-+ .fd_read = usbredir_chardev_read,
-+ .fd_event = usbredir_chardev_event,
+
++static const QemuChrHandlers test_handlers = {
++ .fd_can_read = qtest_can_read,
++ .fd_read = qtest_read,
++ .fd_event = qtest_event,
+};
+
- /*
- * init + destroy
- */
-@@ -892,8 +898,7 @@ static int usbredir_initfn(USBDevice *udev)
-
- /* Let the backend know we are ready */
- qemu_chr_fe_open(dev->cs);
-- qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read,
-- usbredir_chardev_read, usbredir_chardev_event, dev);
-+ qemu_chr_add_handlers(dev->cs, &usbredir_chr_handlers, dev);
-
- return 0;
- }
++
+ int qtest_init(void)
+ {
+ CharDriverState *chr;
+@@ -425,7 +432,7 @@ int qtest_init(void)
+ configure_icount("0");
+ chr = qemu_chr_new("qtest", qtest_chrdev, NULL);
+
+- qemu_chr_add_handlers(chr, qtest_can_read, qtest_read, qtest_event, chr);
++ qemu_chr_add_handlers(chr, &test_handlers, chr);
+ qemu_chr_fe_set_echo(chr, true);
+
+ inbuf = g_string_new("");
--
-1.7.7.5
+1.7.10.4
diff --git a/0108-iohandlers-Add-enable-disable_write_fd_handler-funct.patch b/0103-iohandlers-Add-enable-disable_write_fd_handler-funct.patch
similarity index 83%
rename from 0108-iohandlers-Add-enable-disable_write_fd_handler-funct.patch
rename to 0103-iohandlers-Add-enable-disable_write_fd_handler-funct.patch
index a02a798..7b70e2a 100644
--- a/0108-iohandlers-Add-enable-disable_write_fd_handler-funct.patch
+++ b/0103-iohandlers-Add-enable-disable_write_fd_handler-funct.patch
@@ -1,7 +1,7 @@
-From f896c023201863927853c5d97e62916e0753fede Mon Sep 17 00:00:00 2001
+From 32876859aeee3722398d98abfb6b6307e701091f Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah at redhat.com>
Date: Mon, 21 Mar 2011 20:32:58 +0100
-Subject: [PATCH 108/118] iohandlers: Add enable/disable_write_fd_handler()
+Subject: [PATCH 103/114] iohandlers: Add enable/disable_write_fd_handler()
functions
These will be used to provide a cleaner API for the nonblocking case.
@@ -10,16 +10,16 @@ Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
iohandler.c | 35 +++++++++++++++++++++++++++++++++++
main-loop.h | 3 +++
- 2 files changed, 38 insertions(+), 0 deletions(-)
+ 2 files changed, 38 insertions(+)
diff --git a/iohandler.c b/iohandler.c
-index 5640d49..a9a62cb 100644
+index 3c74de6..250fd0e 100644
--- a/iohandler.c
+++ b/iohandler.c
@@ -45,6 +45,41 @@ typedef struct IOHandlerRecord {
static QLIST_HEAD(, IOHandlerRecord) io_handlers =
QLIST_HEAD_INITIALIZER(io_handlers);
-
+
+static IOHandlerRecord *find_iohandler(int fd)
+{
+ IOHandlerRecord *ioh;
@@ -55,17 +55,17 @@ index 5640d49..a9a62cb 100644
+
+ ioh->fd_write = NULL;
+}
-
+
/* XXX: fd_read_poll should be suppressed, but an API change is
necessary in the character devices to suppress fd_can_read(). */
diff --git a/main-loop.h b/main-loop.h
-index 8a716b1..c5a96cd 100644
+index dce1cd9..eb31273 100644
--- a/main-loop.h
+++ b/main-loop.h
-@@ -167,6 +167,9 @@ typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
+@@ -175,6 +175,9 @@ typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
typedef int IOCanReadHandler(void *opaque);
typedef void IOHandler(void *opaque);
-
+
+void enable_write_fd_handler(int fd, IOHandler *fd_write);
+void disable_write_fd_handler(int fd);
+
@@ -73,5 +73,5 @@ index 8a716b1..c5a96cd 100644
* qemu_set_fd_handler2: Register a file descriptor with the main loop
*
--
-1.7.7.5
+1.7.10.4
diff --git a/0109-char-Add-framework-for-a-write-unblocked-callback.patch b/0104-char-Add-framework-for-a-write-unblocked-callback.patch
similarity index 85%
rename from 0109-char-Add-framework-for-a-write-unblocked-callback.patch
rename to 0104-char-Add-framework-for-a-write-unblocked-callback.patch
index 2599187..bea0d67 100644
--- a/0109-char-Add-framework-for-a-write-unblocked-callback.patch
+++ b/0104-char-Add-framework-for-a-write-unblocked-callback.patch
@@ -1,7 +1,7 @@
-From 6d5337e1dc8d926f9183e2f5eb5e97c438203527 Mon Sep 17 00:00:00 2001
+From 3def2c629b31cfc6dfe54a1a5464bb35359c3b10 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah at redhat.com>
Date: Mon, 21 Mar 2011 21:41:42 +0100
-Subject: [PATCH 109/118] char: Add framework for a 'write unblocked' callback
+Subject: [PATCH 104/114] char: Add framework for a 'write unblocked' callback
The char layer can let users know that the driver will block on further
input. For users interested in not blocking, they can assign a function
@@ -13,13 +13,13 @@ Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
qemu-char.c | 3 +++
qemu-char.h | 4 ++++
- 2 files changed, 7 insertions(+), 0 deletions(-)
+ 2 files changed, 7 insertions(+)
diff --git a/qemu-char.c b/qemu-char.c
-index d2a99a6..66b5887 100644
+index 86bdabf..88cbbd0 100644
--- a/qemu-char.c
+++ b/qemu-char.c
-@@ -208,11 +208,14 @@ void qemu_chr_add_handlers(CharDriverState *s,
+@@ -211,11 +211,14 @@ void qemu_chr_add_handlers(CharDriverState *s,
}
s->chr_can_read = handlers->fd_can_read;
s->chr_read = handlers->fd_read;
@@ -28,14 +28,14 @@ index d2a99a6..66b5887 100644
s->handler_opaque = opaque;
if (s->chr_update_read_handler)
s->chr_update_read_handler(s);
-
+
+ s->write_blocked = false;
+
/* We're connecting to an already opened device, so let's make sure we
also get the open event */
if (s->opened) {
diff --git a/qemu-char.h b/qemu-char.h
-index 564e688..2628bee 100644
+index dfa8c2d..b5e23a4 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -62,6 +62,9 @@ struct CharDriverState {
@@ -55,7 +55,7 @@ index 564e688..2628bee 100644
+ bool write_blocked; /* Are we in a blocked state? */
QTAILQ_ENTRY(CharDriverState) next;
};
-
+
--
-1.7.7.5
+1.7.10.4
diff --git a/0110-char-Update-send_all-to-handle-nonblocking-chardev-w.patch b/0105-char-Update-send_all-to-handle-nonblocking-chardev-w.patch
similarity index 84%
rename from 0110-char-Update-send_all-to-handle-nonblocking-chardev-w.patch
rename to 0105-char-Update-send_all-to-handle-nonblocking-chardev-w.patch
index c694ebf..1b954ef 100644
--- a/0110-char-Update-send_all-to-handle-nonblocking-chardev-w.patch
+++ b/0105-char-Update-send_all-to-handle-nonblocking-chardev-w.patch
@@ -1,7 +1,7 @@
-From 9ca6b87b877fa46c81ce8e5b5a97dca4f522a727 Mon Sep 17 00:00:00 2001
+From 6a36990b303dc64709931e16783e2f2e0a54b9d6 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah at redhat.com>
Date: Mon, 21 Mar 2011 22:00:27 +0100
-Subject: [PATCH 110/118] char: Update send_all() to handle nonblocking
+Subject: [PATCH 105/114] char: Update send_all() to handle nonblocking
chardev write requests
The send_all function is modified to return to the caller in case the
@@ -16,40 +16,40 @@ commits will add such capability.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
- net/socket.c | 4 +-
+ net/socket.c | 4 ++--
qemu-char.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
qemu_socket.h | 2 +-
3 files changed, 66 insertions(+), 9 deletions(-)
diff --git a/net/socket.c b/net/socket.c
-index e9ef128..0d53dce 100644
+index 0bcf229..c21bb60 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -56,8 +56,8 @@ static ssize_t net_socket_receive(VLANClientState *nc, const uint8_t *buf, size_
uint32_t len;
len = htonl(size);
-
+
- send_all(s->fd, (const uint8_t *)&len, sizeof(len));
- return send_all(s->fd, buf, size);
+ send_all(NULL, s->fd, (const uint8_t *)&len, sizeof(len));
+ return send_all(NULL, s->fd, buf, size);
}
-
+
static ssize_t net_socket_receive_dgram(VLANClientState *nc, const uint8_t *buf, size_t size)
diff --git a/qemu-char.c b/qemu-char.c
-index 66b5887..5e7f68e 100644
+index 88cbbd0..d8059ff 100644
--- a/qemu-char.c
+++ b/qemu-char.c
-@@ -507,7 +507,7 @@ static CharDriverState *qemu_chr_open_mux(CharDriverState *drv)
-
-
+@@ -508,7 +508,7 @@ static CharDriverState *qemu_chr_open_mux(CharDriverState *drv)
+
+
#ifdef _WIN32
-int send_all(int fd, const void *buf, int len1)
+static int do_send(int fd, const void *buf, int len1, bool nonblock)
{
int ret, len;
-
-@@ -515,9 +515,14 @@ int send_all(int fd, const void *buf, int len1)
+
+@@ -516,9 +516,14 @@ int send_all(int fd, const void *buf, int len1)
while (len > 0) {
ret = send(fd, buf, len, 0);
if (ret < 0) {
@@ -64,16 +64,16 @@ index 66b5887..5e7f68e 100644
}
} else if (ret == 0) {
break;
-@@ -531,7 +536,7 @@ int send_all(int fd, const void *buf, int len1)
-
+@@ -532,7 +537,7 @@ int send_all(int fd, const void *buf, int len1)
+
#else
-
+
-int send_all(int fd, const void *_buf, int len1)
+static int do_send(int fd, const void *_buf, int len1, bool nonblock)
{
int ret, len;
const uint8_t *buf = _buf;
-@@ -540,8 +545,15 @@ int send_all(int fd, const void *_buf, int len1)
+@@ -541,8 +546,15 @@ int send_all(int fd, const void *_buf, int len1)
while (len > 0) {
ret = write(fd, buf, len);
if (ret < 0) {
@@ -90,10 +90,10 @@ index 66b5887..5e7f68e 100644
} else if (ret == 0) {
break;
} else {
-@@ -556,6 +568,44 @@ int send_all(int fd, const void *_buf, int len1)
+@@ -557,6 +569,44 @@ int send_all(int fd, const void *_buf, int len1)
#define STDIO_MAX_CLIENTS 1
static int stdio_nb_clients;
-
+
+int send_all(CharDriverState *chr, int fd, const void *_buf, int len1)
+{
+ int ret, eagain_errno;
@@ -133,27 +133,27 @@ index 66b5887..5e7f68e 100644
+}
+
#ifndef _WIN32
-
+
typedef struct {
-@@ -567,7 +617,7 @@ typedef struct {
+@@ -568,7 +618,7 @@ typedef struct {
static int fd_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
{
FDCharDriver *s = chr->opaque;
- return send_all(s->fd_out, buf, len);
+ return send_all(chr, s->fd_out, buf, len);
}
-
+
static int fd_chr_read_poll(void *opaque)
-@@ -892,7 +942,7 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
+@@ -887,7 +937,7 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
pty_chr_update_read_handler(chr);
return 0;
}
- return send_all(s->fd, buf, len);
+ return send_all(chr, s->fd, buf, len);
}
-
+
static int pty_chr_read_poll(void *opaque)
-@@ -2196,8 +2246,15 @@ static void tcp_closed(void *opaque)
+@@ -2174,8 +2224,15 @@ static void tcp_closed(void *opaque)
static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
{
TCPCharDriver *s = chr->opaque;
@@ -171,18 +171,18 @@ index 66b5887..5e7f68e 100644
/* XXX: indicate an error ? */
return len;
diff --git a/qemu_socket.h b/qemu_socket.h
-index 9e32fac..9ea33fe 100644
+index 4689ff3..3d780ce 100644
--- a/qemu_socket.h
+++ b/qemu_socket.h
-@@ -37,7 +37,7 @@ int qemu_socket(int domain, int type, int protocol);
- int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
+@@ -36,7 +36,7 @@ int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
+ int socket_set_cork(int fd, int v);
void socket_set_block(int fd);
void socket_set_nonblock(int fd);
-int send_all(int fd, const void *buf, int len1);
+int send_all(CharDriverState *chr, int fd, const void *buf, int len1);
-
+
/* New, ipv6-ready socket helper functions, see qemu-sockets.c */
- int inet_listen_opts(QemuOpts *opts, int port_offset);
+ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp);
--
-1.7.7.5
+1.7.10.4
diff --git a/0111-char-Equip-the-unix-tcp-backend-to-handle-nonblockin.patch b/0106-char-Equip-the-unix-tcp-backend-to-handle-nonblockin.patch
similarity index 82%
rename from 0111-char-Equip-the-unix-tcp-backend-to-handle-nonblockin.patch
rename to 0106-char-Equip-the-unix-tcp-backend-to-handle-nonblockin.patch
index 10ccf75..c6a3987 100644
--- a/0111-char-Equip-the-unix-tcp-backend-to-handle-nonblockin.patch
+++ b/0106-char-Equip-the-unix-tcp-backend-to-handle-nonblockin.patch
@@ -1,7 +1,7 @@
-From b235c039fbab104ab582922f0083625564e177b1 Mon Sep 17 00:00:00 2001
+From bccdec085744256038f35b243853d7142b85cddb Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah at redhat.com>
Date: Mon, 21 Mar 2011 22:02:47 +0100
-Subject: [PATCH 111/118] char: Equip the unix/tcp backend to handle
+Subject: [PATCH 106/114] char: Equip the unix/tcp backend to handle
nonblocking writes#
Now that the infrastructure is in place to return -EAGAIN to callers,
@@ -15,16 +15,16 @@ users of chardevs know that a driver became writable again.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
qemu-char.c | 34 ++++++++++++++++++++++++++++++++++
- 1 files changed, 34 insertions(+), 0 deletions(-)
+ 1 file changed, 34 insertions(+)
diff --git a/qemu-char.c b/qemu-char.c
-index 5e7f68e..f98b240 100644
+index d8059ff..ed306e5 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -106,6 +106,19 @@
static QTAILQ_HEAD(CharDriverStateHead, CharDriverState) chardevs =
QTAILQ_HEAD_INITIALIZER(chardevs);
-
+
+/*
+ * Generic routine that gets called when chardev becomes writable.
+ * Lets chardev user know it's OK to send more data.
@@ -41,10 +41,10 @@ index 5e7f68e..f98b240 100644
void qemu_chr_be_event(CharDriverState *s, int event)
{
/* Keep track if the char device is open */
-@@ -2515,6 +2528,25 @@ static void tcp_chr_close(CharDriverState *chr)
+@@ -2493,6 +2506,25 @@ static void tcp_chr_close(CharDriverState *chr)
qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
}
-
+
+static void tcp_enable_write_fd_handler(CharDriverState *chr)
+{
+ TCPCharDriver *s = chr->opaque;
@@ -64,18 +64,18 @@ index 5e7f68e..f98b240 100644
+ disable_write_fd_handler(s->fd);
+}
+
- static int qemu_chr_open_socket(QemuOpts *opts, CharDriverState **_chr)
+ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
{
CharDriverState *chr = NULL;
-@@ -2571,6 +2603,8 @@ static int qemu_chr_open_socket(QemuOpts *opts, CharDriverState **_chr)
+@@ -2547,6 +2579,8 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
chr->chr_close = tcp_chr_close;
chr->get_msgfd = tcp_get_msgfd;
chr->chr_add_client = tcp_chr_add_client;
+ chr->chr_enable_write_fd_handler = tcp_enable_write_fd_handler;
+ chr->chr_disable_write_fd_handler = tcp_disable_write_fd_handler;
-
+
if (is_listen) {
s->listen_fd = fd;
--
-1.7.7.5
+1.7.10.4
diff --git a/0112-char-Throttle-when-host-connection-is-down.patch b/0107-char-Throttle-when-host-connection-is-down.patch
similarity index 85%
rename from 0112-char-Throttle-when-host-connection-is-down.patch
rename to 0107-char-Throttle-when-host-connection-is-down.patch
index f8d29af..26755a5 100644
--- a/0112-char-Throttle-when-host-connection-is-down.patch
+++ b/0107-char-Throttle-when-host-connection-is-down.patch
@@ -1,7 +1,7 @@
-From e5eb5b185d39942a2011b21114bb7f0b8e11427a Mon Sep 17 00:00:00 2001
+From 52aef47122bcbdd556f9fd3510a2047b8f920064 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah at redhat.com>
Date: Mon, 21 Mar 2011 22:05:10 +0100
-Subject: [PATCH 112/118] char: Throttle when host connection is down#
+Subject: [PATCH 107/114] char: Throttle when host connection is down#
When the host-side connection goes down, throttle the virtio-serial bus
and later unthrottle when a connection gets established. This helps
@@ -17,10 +17,10 @@ worst case (host d/c, guest write, host connect).
Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
qemu-char.c | 14 ++++++++++++++
- 1 files changed, 14 insertions(+), 0 deletions(-)
+ 1 file changed, 14 insertions(+)
diff --git a/qemu-char.c b/qemu-char.c
-index f98b240..5f67652 100644
+index ed306e5..c263328 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -140,6 +140,9 @@ static void qemu_chr_generic_open_bh(void *opaque)
@@ -33,7 +33,7 @@ index f98b240..5f67652 100644
qemu_bh_delete(s->bh);
s->bh = NULL;
}
-@@ -2266,6 +2269,17 @@ static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
+@@ -2244,6 +2247,17 @@ static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
ret = send_all(chr, s->fd, buf, len);
if (ret == -1 && errno == EPIPE) {
tcp_closed(chr);
@@ -52,5 +52,5 @@ index f98b240..5f67652 100644
return ret;
} else {
--
-1.7.7.5
+1.7.10.4
diff --git a/0113-virtio-console-Enable-port-throttling-when-chardev-i.patch b/0108-virtio-console-Enable-port-throttling-when-chardev-i.patch
similarity index 82%
rename from 0113-virtio-console-Enable-port-throttling-when-chardev-i.patch
rename to 0108-virtio-console-Enable-port-throttling-when-chardev-i.patch
index 73dfcb6..d3e4afc 100644
--- a/0113-virtio-console-Enable-port-throttling-when-chardev-i.patch
+++ b/0108-virtio-console-Enable-port-throttling-when-chardev-i.patch
@@ -1,7 +1,7 @@
-From 71108acb189f5fda923013ed72270642199ab50d Mon Sep 17 00:00:00 2001
+From 738da364d19bd99b70c79cb1174eef0e19f8e368 Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah at redhat.com>
Date: Mon, 21 Mar 2011 22:06:41 +0100
-Subject: [PATCH 113/118] virtio-console: Enable port throttling when chardev
+Subject: [PATCH 108/114] virtio-console: Enable port throttling when chardev
is slow to consume data
When a chardev indicates it can't accept more data, we tell the
@@ -13,16 +13,16 @@ As soon as the chardev indicates it can accept more data, start pushing!
Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
hw/virtio-console.c | 11 +++++++++++
- 1 files changed, 11 insertions(+), 0 deletions(-)
+ 1 file changed, 11 insertions(+)
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
-index 6d6f3ef..da68211 100644
+index 066590c..2b5e515 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -20,6 +20,16 @@ typedef struct VirtConsole {
CharDriverState *chr;
} VirtConsole;
-
+
+/*
+ * Callback function that's called from chardevs when backend becomes
+ * writable.
@@ -33,17 +33,17 @@ index 6d6f3ef..da68211 100644
+
+ virtio_serial_throttle_port(&vcon->port, false);
+}
-
+
/* Callback function that's called when the guest sends us data */
static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
-@@ -99,6 +109,7 @@ static const QemuChrHandlers chr_handlers = {
+@@ -110,6 +120,7 @@ static const QemuChrHandlers chr_handlers = {
.fd_can_read = chr_can_read,
.fd_read = chr_read,
.fd_event = chr_event,
+ .fd_write_unblocked = chr_write_unblocked,
};
-
+
static int virtconsole_initfn(VirtIOSerialPort *port)
--
-1.7.7.5
+1.7.10.4
diff --git a/0114-spice-qemu-char.c-add-throttling.patch b/0109-spice-qemu-char.c-add-throttling.patch
similarity index 94%
rename from 0114-spice-qemu-char.c-add-throttling.patch
rename to 0109-spice-qemu-char.c-add-throttling.patch
index 00c7580..b64243e 100644
--- a/0114-spice-qemu-char.c-add-throttling.patch
+++ b/0109-spice-qemu-char.c-add-throttling.patch
@@ -1,7 +1,7 @@
-From d4066655fc866ac0e57420b32dec3b37277b374c Mon Sep 17 00:00:00 2001
+From 484eac58fb0cf9b0ba6d31db868a549ee8799437 Mon Sep 17 00:00:00 2001
From: Alon Levy <alevy at redhat.com>
Date: Tue, 22 Mar 2011 12:27:59 +0200
-Subject: [PATCH 114/118] spice-qemu-char.c: add throttling
+Subject: [PATCH 109/114] spice-qemu-char.c: add throttling
BZ: 672191
@@ -36,10 +36,10 @@ was not accepted upstream, and will not be accepted upstream until the mainloop
is reworked to use glib.
---
spice-qemu-char.c | 39 +++++++++++++++++++++++++++++++++++----
- 1 files changed, 35 insertions(+), 4 deletions(-)
+ 1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
-index 7e8eaa9..eeeb32e 100644
+index 09aa22d..fba2bfb 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -1,4 +1,6 @@
@@ -55,12 +55,12 @@ index 7e8eaa9..eeeb32e 100644
uint32_t debug;
+ QEMUTimer *unblock_timer;
} SpiceCharDriver;
-
+
static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
@@ -50,6 +53,17 @@ static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
return out;
}
-
+
+static void spice_chr_unblock(void *opaque)
+{
+ SpiceCharDriver *scd = opaque;
@@ -100,7 +100,7 @@ index 7e8eaa9..eeeb32e 100644
{
SpiceCharDriver *s = chr->opaque;
+ int read_bytes;
-
+
dprintf(s, 2, "%s: %d\n", __func__, len);
vmc_register_interface(s);
@@ -147,7 +169,15 @@ static int spice_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
@@ -118,16 +118,16 @@ index 7e8eaa9..eeeb32e 100644
+ }
+ return read_bytes;
}
-
+
static void spice_chr_close(struct CharDriverState *chr)
-@@ -225,6 +255,7 @@ int qemu_chr_open_spice(QemuOpts *opts, CharDriverState **_chr)
+@@ -225,6 +255,7 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts)
chr->chr_close = spice_chr_close;
chr->chr_guest_open = spice_chr_guest_open;
chr->chr_guest_close = spice_chr_guest_close;
+ s->unblock_timer = qemu_new_timer_ms(vm_clock, spice_chr_unblock, s);
-
+
#if SPICE_SERVER_VERSION < 0x000901
/* See comment in vmc_state() */
--
-1.7.7.5
+1.7.10.4
diff --git a/0115-spice-qemu-char.c-remove-intermediate-buffer.patch b/0110-spice-qemu-char.c-remove-intermediate-buffer.patch
similarity index 92%
rename from 0115-spice-qemu-char.c-remove-intermediate-buffer.patch
rename to 0110-spice-qemu-char.c-remove-intermediate-buffer.patch
index 2ec2e2f..7a49e1d 100644
--- a/0115-spice-qemu-char.c-remove-intermediate-buffer.patch
+++ b/0110-spice-qemu-char.c-remove-intermediate-buffer.patch
@@ -1,7 +1,7 @@
-From 9d965c99311c6f3d5c7ba9b66a72398814175865 Mon Sep 17 00:00:00 2001
+From 606c5ed5369c862c70fa527892b808f189a2b482 Mon Sep 17 00:00:00 2001
From: Alon Levy <alevy at redhat.com>
Date: Tue, 22 Mar 2011 12:28:00 +0200
-Subject: [PATCH 115/118] spice-qemu-char.c: remove intermediate buffer
+Subject: [PATCH 110/114] spice-qemu-char.c: remove intermediate buffer
BZ: 672191
upstream: not submitted (explained below)
@@ -17,10 +17,10 @@ This relied on the previous patch that introduces throttling, which
can't go upstream right now as explained in that patch.
---
spice-qemu-char.c | 18 ++++++------------
- 1 files changed, 6 insertions(+), 12 deletions(-)
+ 1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
-index eeeb32e..70a83bf 100644
+index fba2bfb..ef44bc0 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -23,9 +23,8 @@ typedef struct SpiceCharDriver {
@@ -38,7 +38,7 @@ index eeeb32e..70a83bf 100644
@@ -69,7 +68,7 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
SpiceCharDriver *scd = container_of(sin, SpiceCharDriver, sin);
int bytes = MIN(len, scd->datalen);
-
+
- dprintf(scd, 2, "%s: %p %d/%d/%zd\n", __func__, scd->datapos, len, bytes, scd->datalen);
+ dprintf(scd, 2, "%s: %p %d/%d/%d\n", __func__, scd->datapos, len, bytes, scd->datalen);
if (bytes > 0) {
@@ -67,5 +67,5 @@ index eeeb32e..70a83bf 100644
/* We'll get passed in the unconsumed data with the next call */
s->datalen = 0;
--
-1.7.7.5
+1.7.10.4
diff --git a/0116-usb-redir-Add-flow-control-support.patch b/0111-usb-redir-Add-flow-control-support.patch
similarity index 70%
rename from 0116-usb-redir-Add-flow-control-support.patch
rename to 0111-usb-redir-Add-flow-control-support.patch
index 94d10ef..8cd4d88 100644
--- a/0116-usb-redir-Add-flow-control-support.patch
+++ b/0111-usb-redir-Add-flow-control-support.patch
@@ -1,28 +1,28 @@
-From 80aafc63c842ee902cc9e32d692efed8952a1e14 Mon Sep 17 00:00:00 2001
+From 2f61a7bed440164c35c739fcef10d19edef3f8ea Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede at redhat.com>
Date: Tue, 19 Jul 2011 10:56:19 +0200
-Subject: [PATCH 116/118] usb-redir: Add flow control support
+Subject: [PATCH 111/114] usb-redir: Add flow control support
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
- usb-redir.c | 26 ++++++++++++++++++++++++--
- 1 files changed, 24 insertions(+), 2 deletions(-)
+ hw/usb/redirect.c | 26 ++++++++++++++++++++++++--
+ 1 file changed, 24 insertions(+), 2 deletions(-)
-diff --git a/usb-redir.c b/usb-redir.c
-index e421cff..1289506 100644
---- a/usb-redir.c
-+++ b/usb-redir.c
-@@ -228,12 +228,22 @@ static int usbredir_read(void *priv, uint8_t *data, int count)
+diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
+index 6e8180e..5f55d78 100644
+--- a/hw/usb/redirect.c
++++ b/hw/usb/redirect.c
+@@ -238,12 +238,22 @@ static int usbredir_read(void *priv, uint8_t *data, int count)
static int usbredir_write(void *priv, uint8_t *data, int count)
{
USBRedirDevice *dev = priv;
+ int r;
-
+
- if (!dev->cs->opened) {
+ if (!dev->cs->opened || dev->cs->write_blocked) {
return 0;
}
-
+
- return qemu_chr_fe_write(dev->cs, data, count);
+ r = qemu_chr_fe_write(dev->cs, data, count);
+
@@ -35,12 +35,12 @@ index e421cff..1289506 100644
+
+ return r;
}
-
+
/*
-@@ -865,10 +875,22 @@ static void usbredir_chardev_event(void *opaque, int event)
+@@ -890,10 +900,22 @@ static void usbredir_chardev_event(void *opaque, int event)
}
}
-
+
+static void usbredir_chardev_write_unblocked(void *opaque)
+{
+ USBRedirDevice *dev = opaque;
@@ -58,8 +58,8 @@ index e421cff..1289506 100644
.fd_event = usbredir_chardev_event,
+ .fd_write_unblocked = usbredir_chardev_write_unblocked,
};
-
+
/*
--
-1.7.7.5
+1.7.10.4
diff --git a/0117-virtio-serial-bus-replay-guest_open-on-migration.patch b/0112-virtio-serial-bus-replay-guest_open-on-migration.patch
similarity index 71%
rename from 0117-virtio-serial-bus-replay-guest_open-on-migration.patch
rename to 0112-virtio-serial-bus-replay-guest_open-on-migration.patch
index 2e76feb..e6464bd 100644
--- a/0117-virtio-serial-bus-replay-guest_open-on-migration.patch
+++ b/0112-virtio-serial-bus-replay-guest_open-on-migration.patch
@@ -1,7 +1,7 @@
-From 8e92fe9feebc319c019feb8c28941e322524932f Mon Sep 17 00:00:00 2001
+From be9fad02180478f6c9435257e6a7c29b9e4c9841 Mon Sep 17 00:00:00 2001
From: Alon Levy <alevy at redhat.com>
Date: Thu, 28 Jul 2011 15:08:48 +0300
-Subject: [PATCH 117/118] virtio-serial-bus: replay guest_open on migration
+Subject: [PATCH 112/114] virtio-serial-bus: replay guest_open on migration
When migrating a host with with a spice agent running the mouse becomes
non operational after the migration. This is rhbz #725965.
@@ -19,32 +19,32 @@ chardev.
Signed-off-by: Alon Levy <alevy at redhat.com>
---
hw/virtio-serial-bus.c | 6 ++++++
- 1 files changed, 6 insertions(+), 0 deletions(-)
+ 1 file changed, 6 insertions(+)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
-index a4825b9..e5f343f 100644
+index 72287d1..7ea5bbf 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
-@@ -618,6 +618,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
+@@ -682,6 +682,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
for (i = 0; i < nr_active_ports; i++) {
uint32_t id;
bool host_connected;
-+ VirtIOSerialPortInfo *info;
-
++ VirtIOSerialPortClass *vsc;
+
id = qemu_get_be32(f);
port = find_port_by_id(s, id);
-@@ -626,6 +627,11 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
+@@ -690,6 +691,11 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
}
-
+
port->guest_connected = qemu_get_byte(f);
-+ info = DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info);
-+ if (port->guest_connected && info->guest_open) {
++ vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
++ if (port->guest_connected && vsc->guest_open) {
+ /* replay guest open */
-+ info->guest_open(port);
++ vsc->guest_open(port);
+ }
host_connected = qemu_get_byte(f);
if (host_connected != port->host_connected) {
/*
--
-1.7.7.5
+1.7.10.4
diff --git a/0118-char-Disable-write-callback-if-throttled-chardev-is-.patch b/0113-char-Disable-write-callback-if-throttled-chardev-is-.patch
similarity index 75%
rename from 0118-char-Disable-write-callback-if-throttled-chardev-is-.patch
rename to 0113-char-Disable-write-callback-if-throttled-chardev-is-.patch
index 757fb21..16c547a 100644
--- a/0118-char-Disable-write-callback-if-throttled-chardev-is-.patch
+++ b/0113-char-Disable-write-callback-if-throttled-chardev-is-.patch
@@ -1,7 +1,7 @@
-From fad276489cbc04f228d52b7019bee9e7a88c8a86 Mon Sep 17 00:00:00 2001
+From 303a46e3877f6d9600151fdf9719fdb2009db7ff Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah at redhat.com>
Date: Fri, 2 Dec 2011 15:42:55 +0530
-Subject: [PATCH 118/118] char: Disable write callback if throttled chardev is
+Subject: [PATCH 113/114] char: Disable write callback if throttled chardev is
detached
If a throttled chardev is detached from the frontend device, all future
@@ -13,13 +13,13 @@ Upstream: Not applicable, since throttling is a RHEL6-only feature.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
qemu-char.c | 5 +++++
- 1 files changed, 5 insertions(+), 0 deletions(-)
+ 1 file changed, 5 insertions(+)
diff --git a/qemu-char.c b/qemu-char.c
-index 5f67652..5a94919 100644
+index c263328..622c388 100644
--- a/qemu-char.c
+++ b/qemu-char.c
-@@ -220,6 +220,11 @@ void qemu_chr_add_handlers(CharDriverState *s,
+@@ -223,6 +223,11 @@ void qemu_chr_add_handlers(CharDriverState *s,
++s->avail_connections;
}
if (!handlers) {
@@ -32,5 +32,5 @@ index 5f67652..5a94919 100644
}
s->chr_can_read = handlers->fd_can_read;
--
-1.7.7.5
+1.7.10.4
diff --git a/0201-usb-redir-Correctly-handle-the-usb_redir_babble-usbr.patch b/0201-usb-redir-Correctly-handle-the-usb_redir_babble-usbr.patch
new file mode 100644
index 0000000..7273c25
--- /dev/null
+++ b/0201-usb-redir-Correctly-handle-the-usb_redir_babble-usbr.patch
@@ -0,0 +1,27 @@
+From 1271c4b3437a8bcf9b35ae8ed03be3dc758fe756 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Fri, 22 Jun 2012 09:43:08 +0200
+Subject: [PATCH] usb-redir: Correctly handle the usb_redir_babble usbredir
+ status
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ hw/usb/redirect.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
+index 5f55d78..c6358c0 100644
+--- a/hw/usb/redirect.c
++++ b/hw/usb/redirect.c
+@@ -1058,6 +1058,8 @@ static int usbredir_handle_status(USBRedirDevice *dev,
+ case usb_redir_inval:
+ WARNING("got invalid param error from usb-host?\n");
+ return USB_RET_NAK;
++ case usb_redir_babble:
++ return USB_RET_BABBLE;
+ case usb_redir_ioerror:
+ case usb_redir_timeout:
+ default:
+--
+1.7.10.4
+
diff --git a/qemu.spec b/qemu.spec
index dcbae41..d1f4afc 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -37,8 +37,8 @@
Summary: QEMU is a FAST! processor emulator
Name: qemu
-Version: 1.0
-Release: 17%{?dist}
+Version: 1.1.0
+Release: 1%{?dist}
# Epoch because we pushed a qemu-1.0 package
Epoch: 2
License: GPLv2+ and LGPLv2+ and BSD
@@ -75,140 +75,28 @@ Source9: ksmtuned.conf
Source10: qemu-guest-agent.service
Source11: 99-qemu-guest-agent.rules
-# Patches queued for 1.0.1 stable
-Patch01: 0001-malta-Fix-regression-i8259-interrupts-did-not-work.patch
-Patch02: 0002-exec.c-Fix-subpage-memory-access-to-RAM-MemoryRegion.patch
-Patch03: 0003-hw-9pfs-Improve-portability-to-older-systems.patch
-Patch04: 0004-hw-9pfs-use-migration-blockers-to-prevent-live-migra.patch
-Patch05: 0005-hw-9pfs-Reset-server-state-during-TVERSION.patch
-Patch06: 0006-hw-9pfs-Add-qdev.reset-callback-for-virtio-9p-pci-de.patch
-Patch07: 0007-hw-9pfs-Use-the-correct-file-descriptor-in-Fsdriver-.patch
-Patch08: 0008-hw-9pfs-replace-iovec-manipulation-with-QEMUIOVector.patch
-Patch09: 0009-hw-9pfs-Use-the-correct-signed-type-for-different-va.patch
-Patch10: 0010-target-i386-fix-cmpxchg-instruction-emulation.patch
-Patch11: 0011-configure-Enable-build-by-default-PIE-read-only-relo.patch
-Patch12: 0012-cris-Handle-conditional-stores-on-CRISv10.patch
-Patch13: 0013-pc-add-pc-0.15.patch
-Patch14: 0014-pc-fix-event_idx-compatibility-for-virtio-devices.patch
-Patch15: 0015-Fix-parse-of-usb-device-description-with-multiple-co.patch
-Patch16: 0016-usb-storage-cancel-I-O-on-reset.patch
-Patch17: 0017-usb-host-properly-release-port-on-unplug-exit.patch
-Patch18: 0018-usb-ohci-td.cbp-incorrectly-updated-near-page-end.patch
-Patch19: 0019-target-sh4-ignore-ocbp-and-ocbwb-instructions.patch
-Patch20: 0020-PPC-Fix-linker-scripts-on-ppc-hosts.patch
-Patch21: 0021-qiov-prevent-double-free-or-use-after-free.patch
-Patch22: 0022-coroutine-switch-per-thread-free-pool-to-a-global-po.patch
-Patch23: 0023-qemu-img-rebase-Fix-for-undersized-backing-files.patch
-Patch24: 0024-Documentation-Add-qemu-img-t-parameter-in-man-page.patch
-Patch25: 0025-rbd-always-set-out-parameter-in-qemu_rbd_snap_list.patch
-Patch26: 0026-e1000-bounds-packet-size-against-buffer-size.patch
-Patch27: virtio-blk_refuse_SG_IO_requests_with_scsi_off.patch
-
-# USB-redir patches all upstream for 1.1 except for the chardev flowcontrol set
-Patch101: 0101-usb-redir-Clear-iso-irq-error-when-stopping-the-stre.patch
-Patch102: 0102-usb-redir-Dynamically-adjust-iso-buffering-size-base.patch
-Patch103: 0103-usb-redir-Pre-fill-our-isoc-input-buffer-before-send.patch
-Patch104: 0104-usb-redir-Try-to-keep-our-buffer-size-near-the-targe.patch
-Patch105: 0105-usb-redir-Improve-some-debugging-messages.patch
-Patch106: 0106-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch
-Patch107: 0107-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch
-Patch108: 0108-iohandlers-Add-enable-disable_write_fd_handler-funct.patch
-Patch109: 0109-char-Add-framework-for-a-write-unblocked-callback.patch
-Patch110: 0110-char-Update-send_all-to-handle-nonblocking-chardev-w.patch
-Patch111: 0111-char-Equip-the-unix-tcp-backend-to-handle-nonblockin.patch
-Patch112: 0112-char-Throttle-when-host-connection-is-down.patch
-Patch113: 0113-virtio-console-Enable-port-throttling-when-chardev-i.patch
-Patch114: 0114-spice-qemu-char.c-add-throttling.patch
-Patch115: 0115-spice-qemu-char.c-remove-intermediate-buffer.patch
-Patch116: 0116-usb-redir-Add-flow-control-support.patch
-Patch117: 0117-virtio-serial-bus-replay-guest_open-on-migration.patch
-Patch118: 0118-char-Disable-write-callback-if-throttled-chardev-is-.patch
-Patch119: 0119-usb-ehci-Clear-the-portstatus-powner-bit-on-device-d.patch
-Patch120: 0120-usb-redir-Add-the-posibility-to-filter-out-certain-d.patch
-Patch121: 0121-usb-redir-Fix-printing-of-device-version.patch
-Patch122: 0122-usb-redir-Always-clear-device-state-on-filter-reject.patch
-Patch123: 0123-usb-redir-Let-the-usb-host-know-about-our-device-fil.patch
-Patch124: 0124-usb-redir-Limit-return-values-returned-by-iso-packet.patch
-Patch125: 0125-usb-redir-Return-USB_RET_NAK-when-we-ve-no-data-for-.patch
-Patch126: 0126-usb-ehci-Handle-ISO-packets-failing-with-an-error-ot.patch
-Patch127: 0127-usb-ehci-Never-follow-table-entries-with-the-T-bit-s.patch
-Patch128: 0128-usb-ehci-split-our-qh-queue-into-async-and-periodic-.patch
-Patch129: 0129-usb-ehci-always-call-ehci_queues_rip_unused-for-peri.patch
-Patch130: 0130-usb-ehci-Drop-cached-qhs-when-the-doorbell-gets-rung.patch
-Patch131: 0131-usb-ehci-Rip-the-queues-when-the-async-or-period-sch.patch
-Patch132: 0132-usb-ehci-Any-packet-completion-except-for-NAK-should.patch
-Patch133: 0133-usb-ehci-Fix-cerr-tracking.patch
-Patch134: 0134-usb-ehci-Remove-dead-nakcnt-code.patch
-Patch135: 0135-usb-ehci-Fix-and-simplify-nakcnt-handling.patch
-Patch136: 0136-usb-ehci-Remove-dead-isoch_pause-code.patch
-Patch137: 0137-usb-return-BABBLE-rather-then-NAK-when-we-receive-to.patch
-Patch138: 0138-usb-add-USB_RET_IOERROR.patch
-Patch139: 0139-usb-ehci-fix-reset.patch
-Patch140: 0140-usb-ehci-sanity-check-iso-xfers.patch
-Patch141: 0141-usb-ehci-frindex-always-is-a-14-bits-counter.patch
-Patch142: 0142-usb-ehci-Drop-unused-sofv-value.patch
-Patch143: 0143-usb-redir-Notify-our-peer-when-we-reject-a-device-du.patch
-Patch144: 0144-usb-redir-An-interface-count-of-0-is-a-valid-value.patch
-Patch145: 0145-usb-redir-Reset-device-address-and-speed-on-disconne.patch
-Patch146: 0146-usb-redir-Not-finding-an-async-urb-id-is-not-an-erro.patch
-Patch147: 0147-usb-ehci-Ensure-frindex-writes-leave-a-valid-frindex.patch
-
-# General bug fixes
-Patch201: Fix_save-restore_of_in-kernel_i8259.patch
-Patch202: qemu-virtio-9p-noatime.patch
-
-# Feature patches, should be in 1.1 before release
-Patch301: enable_architectural_PMU_cpuid_leaf.patch
-Patch302: qemu_virtio-scsi_support.patch
-
-# QXL fixes backports, all are upstream for 1.1
-Patch401: 0401-qxl-Slot-sanity-check-in-qxl_phys2virt-is-off-by-one.patch
-Patch402: 0402-input-send-kbd-mouse-events-only-to-running-guests.patch
-Patch403: 0403-qxl-fix-warnings-on-32bit.patch
-Patch404: 0404-qxl-don-t-render-stuff-when-the-vm-is-stopped.patch
-Patch405: 0405-qxl-set-only-off-screen-surfaces-dirty-instead-of-th.patch
-Patch406: 0406-qxl-make-sure-primary-surface-is-saved-on-migration-.patch
-Patch407: 0407-Add-SPICE-support-to-add_client-monitor-command.patch
-Patch408: 0408-spice-support-ipv6-channel-address-in-monitor-events.patch
-Patch409: 0409-qxl-drop-vram-bar-minimum-size.patch
-Patch410: 0410-qxl-move-ram-size-init-to-new-function.patch
-Patch411: 0411-qxl-add-user-friendly-bar-size-properties.patch
-Patch412: 0412-qxl-fix-spice-sdl-no-cursor-regression.patch
-Patch413: 0413-sdl-remove-NULL-check-g_malloc0-can-t-fail.patch
-Patch414: 0414-qxl-drop-qxl_spice_update_area_async-definition.patch
-Patch415: 0415-qxl-require-spice-0.8.2.patch
-Patch416: 0416-qxl-remove-flipped.patch
-Patch417: 0417-qxl-introduce-QXLCookie.patch
-Patch418: 0418-qxl-make-qxl_render_update-async.patch
-Patch419: 0419-spice-use-error_report-to-report-errors.patch
-Patch420: 0420-Error-out-when-tls-channel-option-is-used-without-TL.patch
-Patch421: 0421-qxl-properly-handle-upright-and-non-shared-surfaces.patch
-Patch422: 0422-spice-set-spice-uuid-and-name.patch
-Patch423: 0423-monitor-fix-client_migrate_info-error-handling.patch
-Patch424: 0424-qxl-init_pipe_signaling-exit-on-failure.patch
-Patch425: 0425-qxl-switch-qxl.c-to-trace-events.patch
-Patch426: 0426-qxl-qxl_render.c-add-trace-events.patch
-Patch427: 0427-hw-qxl.c-Fix-compilation-failures-on-32-bit-hosts.patch
-Patch428: 0428-spice-fix-broken-initialization.patch
-Patch429: 0429-ui-spice-display.c-Fix-compilation-warnings-on-32-bi.patch
-Patch430: 0430-ui-spice-display-use-uintptr_t-when-casting-qxl-phys.patch
-Patch431: 0431-qxl-add-optinal-64bit-vram-bar.patch
-Patch432: 0432-qxl-set-default-values-of-vram-_size_mb-to-1.patch
-Patch433: 0433-qxl-render-fix-broken-vnc-spice-since-commit-f934493.patch
-Patch434: 0434-qxl-don-t-assert-on-guest-create_guest_primary.patch
-
-# Spice volume control backports, all are upstream for 1.1
-Patch501: 0501-audio-add-VOICE_VOLUME-ctl.patch
-Patch502: 0502-audio-don-t-apply-volume-effect-if-backend-has-VOICE.patch
-Patch503: 0503-hw-ac97-remove-USE_MIXER-code.patch
-Patch504: 0504-hw-ac97-the-volume-mask-is-not-only-0x1f.patch
-Patch505: 0505-hw-ac97-add-support-for-volume-control.patch
-Patch506: 0506-audio-spice-add-support-for-volume-control.patch
-Patch507: 0507-Do-not-use-pa_simple-PulseAudio-API.patch
-Patch508: 0508-configure-pa_simple-is-not-needed-anymore.patch
-Patch509: 0509-Allow-controlling-volume-with-PulseAudio-backend.patch
-
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+# Fixes from qemu-kvm git stable-1.1 branch
+Patch1: 0001-qemu-kvm-Add-missing-default-machine-options.patch
+Patch2: 0002-qemu-kvm-virtio-Do-not-register-mask-notifiers-witho.patch
+
+# The infamous chardev flow control patches
+Patch101: 0101-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch
+Patch102: 0102-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch
+Patch103: 0103-iohandlers-Add-enable-disable_write_fd_handler-funct.patch
+Patch104: 0104-char-Add-framework-for-a-write-unblocked-callback.patch
+Patch105: 0105-char-Update-send_all-to-handle-nonblocking-chardev-w.patch
+Patch106: 0106-char-Equip-the-unix-tcp-backend-to-handle-nonblockin.patch
+Patch107: 0107-char-Throttle-when-host-connection-is-down.patch
+Patch108: 0108-virtio-console-Enable-port-throttling-when-chardev-i.patch
+Patch109: 0109-spice-qemu-char.c-add-throttling.patch
+Patch110: 0110-spice-qemu-char.c-remove-intermediate-buffer.patch
+Patch111: 0111-usb-redir-Add-flow-control-support.patch
+Patch112: 0112-virtio-serial-bus-replay-guest_open-on-migration.patch
+Patch113: 0113-char-Disable-write-callback-if-throttled-chardev-is-.patch
+
+# USB-redir bugfixes
+Patch201: 0201-usb-redir-Correctly-handle-the-usb_redir_babble-usbr.patch
+
BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel
BuildRequires: libaio-devel
BuildRequires: rsync
@@ -265,7 +153,7 @@ Requires: %{name}-img = %{epoch}:%{version}-%{release}
Obsoletes: %{name}-system-ppc
Obsoletes: %{name}-system-sparc
-%define qemudocdir %{_docdir}/%{name}-%{version}
+%define qemudocdir %{_docdir}/%{name}
%description
QEMU is a generic and open source processor emulator which achieves a good
@@ -454,33 +342,8 @@ such as kvm_stat.
%prep
%setup -q -n qemu-kvm-%{version}
-%patch01 -p1
-%patch02 -p1
-%patch03 -p1
-%patch04 -p1
-%patch05 -p1
-%patch06 -p1
-%patch07 -p1
-%patch08 -p1
-%patch09 -p1
-%patch10 -p1
-%patch11 -p1
-%patch12 -p1
-%patch13 -p1
-%patch14 -p1
-%patch15 -p1
-%patch16 -p1
-%patch17 -p1
-%patch18 -p1
-%patch19 -p1
-%patch20 -p1
-%patch21 -p1
-%patch22 -p1
-%patch23 -p1
-%patch24 -p1
-%patch25 -p1
-%patch26 -p1
-%patch27 -p1
+%patch1 -p1
+%patch2 -p1
%patch101 -p1
%patch102 -p1
@@ -495,91 +358,8 @@ such as kvm_stat.
%patch111 -p1
%patch112 -p1
%patch113 -p1
-%patch114 -p1
-%patch115 -p1
-%patch116 -p1
-%patch117 -p1
-%patch118 -p1
-%patch119 -p1
-%patch120 -p1
-%patch121 -p1
-%patch122 -p1
-%patch123 -p1
-%patch124 -p1
-%patch125 -p1
-%patch126 -p1
-%patch127 -p1
-%patch128 -p1
-%patch129 -p1
-%patch130 -p1
-%patch131 -p1
-%patch132 -p1
-%patch133 -p1
-%patch134 -p1
-%patch135 -p1
-%patch136 -p1
-%patch137 -p1
-%patch138 -p1
-%patch139 -p1
-%patch140 -p1
-%patch141 -p1
-%patch142 -p1
-%patch143 -p1
-%patch144 -p1
-%patch145 -p1
-%patch146 -p1
-%patch147 -p1
%patch201 -p1
-%patch202 -p1
-
-%patch301 -p1
-%patch302 -p1
-
-%patch401 -p1
-%patch402 -p1
-%patch403 -p1
-%patch404 -p1
-%patch405 -p1
-%patch406 -p1
-%patch407 -p1
-%patch408 -p1
-%patch409 -p1
-%patch410 -p1
-%patch411 -p1
-%patch412 -p1
-%patch413 -p1
-%patch414 -p1
-%patch415 -p1
-%patch416 -p1
-%patch417 -p1
-%patch418 -p1
-%patch419 -p1
-%patch420 -p1
-%patch421 -p1
-%patch422 -p1
-%patch423 -p1
-%patch424 -p1
-%patch425 -p1
-%patch426 -p1
-%patch427 -p1
-%patch428 -p1
-%patch429 -p1
-%patch430 -p1
-%patch431 -p1
-%patch432 -p1
-%patch433 -p1
-%patch434 -p1
-
-%patch501 -p1
-%patch502 -p1
-%patch503 -p1
-%patch504 -p1
-%patch505 -p1
-%patch506 -p1
-%patch507 -p1
-%patch508 -p1
-%patch509 -p1
%build
@@ -638,12 +418,11 @@ cat config-host.mak
echo "==="
make V=1 %{?_smp_mflags} $buildldflags
-./scripts/tracetool --dtrace --binary %{_bindir}/qemu-kvm \
- --target-arch x86_64 --target-type system --stap \
+./scripts/tracetool.py --backend dtrace --format stap \
+ --binary %{_bindir}/qemu-kvm --target-arch x86_64 --target-type system \
--probe-prefix qemu.kvm < ./trace-events > qemu-kvm.stp
cp -a x86_64-softmmu/qemu-system-x86_64 qemu-kvm
make clean
-
%endif
./configure \
@@ -681,7 +460,6 @@ gcc %{SOURCE6} -O2 -g -o ksmctl
%install
-rm -rf $RPM_BUILD_ROOT
%define _udevdir /lib/udev/rules.d
@@ -701,19 +479,13 @@ mkdir -p $RPM_BUILD_ROOT%{_udevdir}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset
install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules/kvm.modules
-install -m 0755 kvm/kvm_stat $RPM_BUILD_ROOT%{_bindir}/
+install -m 0755 scripts/kvm/kvm_stat $RPM_BUILD_ROOT%{_bindir}/
install -m 0755 qemu-kvm $RPM_BUILD_ROOT%{_bindir}/
install -m 0644 qemu-kvm.stp $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/
install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_udevdir}
%endif
-make prefix="${RPM_BUILD_ROOT}%{_prefix}" \
- bindir="${RPM_BUILD_ROOT}%{_bindir}" \
- sharedir="${RPM_BUILD_ROOT}%{_datadir}/%{name}" \
- mandir="${RPM_BUILD_ROOT}%{_mandir}" \
- docdir="${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" \
- datadir="${RPM_BUILD_ROOT}%{_datadir}/%{name}" \
- sysconfdir="${RPM_BUILD_ROOT}%{_sysconfdir}" install
+make DESTDIR=$RPM_BUILD_ROOT install
chmod -x ${RPM_BUILD_ROOT}%{_mandir}/man1/*
install -D -p -m 0644 -t ${RPM_BUILD_ROOT}%{qemudocdir} Changelog README TODO COPYING COPYING.LIB LICENSE
@@ -808,9 +580,6 @@ install -m 0644 %{SOURCE11} $RPM_BUILD_ROOT%{_udevdir}
%check
make check
-%clean
-rm -rf $RPM_BUILD_ROOT
-
%post system-x86
%ifarch %{ix86} x86_64
# load kvm modules now, so we can make sure no reboot is needed.
@@ -1011,6 +780,10 @@ fi
%{_mandir}/man1/qemu-img.1*
%changelog
+* Wed Jul 4 2012 Hans de Goede <hdegoede at redhat.com> - 2:1.1.0-1
+- New upstream release 1.1.0
+- Drop about a 100 spice + USB patches, which are all upstream
+
* Mon Apr 23 2012 Paolo Bonzini <pbonzini at redhat.com> - 2:1.0-17
- Fix install failure due to set -e (rhbz #815272)
More information about the scm-commits
mailing list