diff -Nru qemu-kvm-1.0+noroms/debian/changelog qemu-kvm-1.0-usbredirect/debian/changelog --- qemu-kvm-1.0+noroms/debian/changelog 2012-01-02 16:36:52.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/changelog 2012-01-02 14:47:34.000000000 +0000 @@ -1,223 +1,16 @@ -qemu-kvm (1.0+noroms-0ubuntu2) precise; urgency=low +qemu-kvm (1.0-usbredirect-3ubuntu6) precise; urgency=high - * Change Suggests of ipxe to Recommends of (much smaller) kvm-ipxe. + * Build based on git clone git://people.freedesktop.org/~jwrdegoede/qemu + Adding libattr1-dev to debian/control dependencies LP: #782973 + Creating package qemu-utils to dual boot with Xen 4.1 - -- Serge Hallyn Tue, 13 Dec 2011 16:13:38 -0600 + -- Boris Derzhavets Mon, 02 Jan 2012 16:32:54 +0530 -qemu-kvm (1.0+noroms-0ubuntu1) precise; urgency=low - - * New upstream release - * Remaining changes from upstream: - - removed all binary roms and tests/pi_10.com - * debian/qemu-kvm.links: qemu is now called qemu-system-i386, don't symlink - it - * remove patches applied upstream: - - debian/patches/vpc.patch - - debian/patches/e1000-Dont-set-the-Capabilities-List-bit.patch - - debian/patches/CVE-2011-4111.patch - * replace default-to-tcg.patch with simpler fallback-to-tcg.patch - * keep remaining patches: - - larger_default_ram_size.patch - - CVE-2011-2212-virtqueue-indirect-overflow.patch - - qemuifup-fix-paths.patch - - dont-try-to-hotplug-cpu.patch - - -- Serge Hallyn Tue, 06 Dec 2011 23:40:24 -0600 - -qemu-kvm (0.15.0+noroms-0ubuntu7) precise; urgency=low - - * debian/qemu-ifdown: don't use full paths for sbin/ifconfig, especially - as those paths are wrong. (LP: #898234) - * debian/qemu-kvm.default and debian/qemu-kvm.upstart: optionally load - the vhost_net module. - * debian/patches/dont-try-to-hotplug-cpu.patch: trying to hotplug a cpu - crashes qemu. So just don't do it! (LP: #878422) - - -- Serge Hallyn Wed, 30 Nov 2011 11:37:28 -0600 - -qemu-kvm (0.15.0+noroms-0ubuntu6) precise; urgency=low - - * Revert unintentional changes from 0.15.0+noroms-0ubuntu4: in particular, - move qemu-img and qemu-nbd back to qemu-utils, and bump Breaks/Replaces - to account for this. - - -- Colin Watson Mon, 28 Nov 2011 22:58:56 +0000 - -qemu-kvm (0.15.0+noroms-0ubuntu5) precise; urgency=low - - * SECURITY UPDATE: heap-based overflow with VSC_ATR message handling - - debian/patches/CVE-2011-4111.patch: update - ccid_card_vscard_handle_message() to not continue on error - - CVE-2011-4111 - - -- Jamie Strandboge Mon, 28 Nov 2011 13:56:49 -0600 - -qemu-kvm (0.15.0+noroms-0ubuntu4) precise; urgency=low - - * debian/control: add breaks/replaces to qemu-utils to ensure correct - upgrades. (LP: #897254) - - -- Serge Hallyn Mon, 28 Nov 2011 09:01:34 -0600 - -qemu-kvm (0.15.0+noroms-0ubuntu3) precise; urgency=low - - * Create new qemu-utils package containing qemu-nbd and qemu-img. - - -- Serge Hallyn Tue, 22 Nov 2011 13:38:15 -0600 - -qemu-kvm (0.15.0+noroms-0ubuntu2) precise; urgency=low - - * debian/patches/default-to-tcg.patch: fall back to unaccelerated qemu if - kvm acceleration is not available. (LP: #892050) - - -- Serge Hallyn Fri, 18 Nov 2011 09:26:33 -0600 - -qemu-kvm (0.15.0+noroms-0ubuntu1) precise; urgency=low - - * New upstream release - * Remaining changes from upstream: - - removed all binary roms and tests/pi_10.com - * Removed Detect-and-use-GCC-atomic-builtins-for-locking.patch - non-NPTL - implementations were removed with commit - 02615337ef295443daa03233e492194e289a807e - * Drop spice-qxl-locking-fix-for-qemu-kvm.patch - should be unnecessary - as of commit 196a778428989217b82de042725dc8eb29c8f8d8 - * drop patches applied upstream: - - CVE-2011-1751.diff - - virtio-guard-against-negative-vq-notifies-CVE-2011-2512.diff - - CVE-2011-2527.patch - - fix-pa-configure.patch - * Refreshed the remaining patches: - - larger_default_ram_size.patch - - CVE-2011-2212-virtqueue-indirect-overflow.patch - - qemuifup-fix-paths.patch - - vpc.patch - * e1000-Dont-set-the-Capabilities-List-bit.patch - switched to the - cherrypicked upstream patch (as the source file changed quite a bit, - and the hand-ported patch backported to 0.14.1 does not apply). - * Drop qemu-kvm-spice (all changes from 0.14.1+noroms-0ubuntu7), it will - need its own source package (LP: #878162) - - -- Serge Hallyn Wed, 19 Oct 2011 08:37:43 -0500 - -qemu-kvm (0.14.1+noroms-0ubuntu7) precise; urgency=low - - * Create new qemu-kvm-spice package (LP: #723796) - - debian/control: add libspice-protocol-dev and libspice-server-dev - to build-depends, and define the qemu-kvm-spice package. - - debian/rules: add a new spice-build target (based on old -static rules): - * add --enable-spice to its configure args - * rename its wanted binaries to *-spice - - debian/qemu-kvm-spice.links and debian/qemu-kvm-spice.dirs: install - kvm-spice and qemu-system-x86_64-spice - - -- Serge Hallyn Mon, 17 Oct 2011 16:22:37 +0000 - -qemu-kvm (0.14.1+noroms-0ubuntu6) oneiric; urgency=low - - * debian/patches/e1000-Dont-set-the-Capabilities-List-bit.patch: Do not set - the Capabilities Pointer to NULL for e1000 ethernet adapter, allows Windows' - PCI/PCI Express Compliance Test to pass. Patch cherry picked from upstream - trunk commit, courtesy of Dann Frazier. (LP: #857746) - - -- Dave Walker (Daviey) Mon, 26 Sep 2011 09:36:22 +0100 - -qemu-kvm (0.14.1+noroms-0ubuntu5) oneiric; urgency=low - - * debian/patches/vpc.patch: detect vpc files which are too big - (LP: #814222) - - -- Serge Hallyn Mon, 12 Sep 2011 11:28:36 -0500 - -qemu-kvm (0.14.1+noroms-0ubuntu4) oneiric; urgency=low - - * Add a line to the extended package description pointing to ipxe for - network installs (LP: #819486) - * Change the qemu-common Suggests from kvm-pxe to ipxe, as ipxe is newer - and is in main. - - -- Serge Hallyn Mon, 12 Sep 2011 10:16:55 -0500 - -qemu-kvm (0.14.1+noroms-0ubuntu3) oneiric; urgency=low - - * debian/patches/etc-qemuifscripts-fix-paths.patch: don't hardcode a path - to brctl in qemu-ifup. (LP: #833475) - * debian/control: move Depends: on bridge-utils from qemu-kvm to - qemu-common. (LP: #835355) - * debian/patches/debian/patches/fix-pa-configure.patch: fix FTBFS. Fix - comes from upstream and will be in 0.15 when merged. (LP: #829492) - - -- Serge Hallyn Mon, 29 Aug 2011 12:23:12 -0500 - -qemu-kvm (0.14.1+noroms-0ubuntu2) oneiric; urgency=low - - * debian/{control,rules}: build with PIE. - - -- Kees Cook Wed, 10 Aug 2011 12:04:15 -0700 - -qemu-kvm (0.14.1+noroms-0ubuntu1) oneiric; urgency=low - - * New upstream release - * Removed patch applied upstream: debian/patches/CVE-2011-1750.diff - - -- Serge Hallyn Tue, 26 Jul 2011 23:06:23 -0500 - -qemu-kvm (0.14.0+noroms-0ubuntu9) oneiric; urgency=low - - * SECURITY UPDATE: fix potential privilege escalation via improper group - handling - - debian/patches/CVE-2011-2527.patch: call initgroups() to drop - supplementary group privileges - - CVE-2011-2527 - - -- Jamie Strandboge Tue, 26 Jul 2011 07:51:28 -0500 - -qemu-kvm (0.14.0+noroms-0ubuntu8) oneiric; urgency=low - - * SECURITY UPDATE: fix to validate virtqueue in and out requests from the - guests - - debian/patches/CVE-2011-2212-virtqueue-indirect-overflow.patch: update - hw/virtio.c to verify the length of indirect descriptors in - virtqueue_pop() and virtqueue_avail_bytes() - - CVE-2011-2212 - - LP: #806167 - * SECURITY UPDATE: validate virtio_queue_notify() is non-negative - - virtio-guard-against-negative-vq-notifies-CVE-2011-2512.diff: update - to move comparison out to syborg_virtio_writel(), virtio_ioport_write() - and virtio_queue_notify_vq() and don't call common virtio code if - virtqueue number is invalid. Patch from Debian. - - CVE-2011-2512 - - LP: #806166 - - -- Jamie Strandboge Tue, 05 Jul 2011 13:24:52 -0500 - -qemu-kvm (0.14.0+noroms-0ubuntu7) oneiric; urgency=low - - * SECURITY UPDATE: fix heap buffer overflow from unaligned requests - - CVE-2011-1750 - * SECURITY UPDATE: verify no_hotplug attribute when handling hot-unplug - requests - - CVE-2011-1751 - - -- Jamie Strandboge Sun, 29 May 2011 09:22:55 -0500 - -qemu-kvm (0.14.0+noroms-0ubuntu6) oneiric; urgency=low - - * We need a versioned depend on vgabios to ensure the files we link to - exist. (LP: #783864) - - -- Serge Hallyn Tue, 24 May 2011 10:09:01 -0500 - -qemu-kvm (0.14.0+noroms-0ubuntu5) oneiric; urgency=low - - * Add libattr1-dev to build-depends to enable use of 9p virtfs (LP: #782973) - - -- Serge Hallyn Mon, 16 May 2011 09:53:15 -0500 qemu-kvm (0.14.0+noroms-0ubuntu4) natty; urgency=low *LP: #719174 - Typo corrected + Typo corrected -- Bhaveek Desai Fri, 18 Mar 2011 21:06:54 +0530 diff -Nru qemu-kvm-1.0+noroms/debian/control qemu-kvm-1.0-usbredirect/debian/control --- qemu-kvm-1.0+noroms/debian/control 2012-01-02 16:36:52.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/control 2012-01-02 14:47:34.000000000 +0000 @@ -5,7 +5,6 @@ Build-Depends: bcc, bzip2, debhelper (>= 7), - hardening-wrapper, device-tree-compiler [powerpc], iasl, libaio-dev, @@ -15,28 +14,36 @@ libgnutls-dev, libncurses5-dev, libpci-dev, + libpixman-1-dev, libpulse-dev, libsasl2-dev, libsdl1.2-dev (>= 1.2.14), + libssl-dev, libx11-dev, nasm, perl, pkg-config, quilt (>= 0.40), + libspice-server-dev (>= 0.9.1), + libspice-protocol-dev (>= 0.9.0), sysv-rc (>= 2.86.ds1-14.1ubuntu2), texi2html, texinfo, uuid-dev, - zlib1g-dev + zlib1g-dev, + ipxe, + libgudev-1.0-dev, + libusb-1.0-0-dev, + libusbredir-dev Standards-Version: 3.9.1 Homepage: http://www.linux-kvm.org Package: qemu-kvm Architecture: any -Depends: iproute, +Depends: bridge-utils, + iproute, python, qemu-common (>= ${source:Version}), - qemu-utils (>= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} Pre-Depends: adduser @@ -77,17 +84,16 @@ Package: qemu-utils Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} -Breaks: qemu-kvm (<< 0.15.0+noroms-0ubuntu6) -Replaces: qemu-kvm (<< 0.15.0+noroms-0ubuntu6) Description: qemu utilities This package provides some utilities for which full qemu-kvm is not needed, in particular qemu-nbd and qemu-img. Package: qemu-common Architecture: all -Depends: bridge-utils, seabios, vgabios (>= 0.6c-2ubuntu2), ${misc:Depends}, ${shlibs:Depends} -Recommends: cpu-checker, kvm-ipxe -Suggests: mol-drivers-macosx, +Depends: seabios, vgabios, ${misc:Depends}, ${shlibs:Depends} +Recommends: cpu-checker +Suggests: kvm-pxe, + mol-drivers-macosx, openbios-sparc, ubuntu-vm-builder, uml-utilities diff -Nru qemu-kvm-1.0+noroms/debian/docs qemu-kvm-1.0-usbredirect/debian/docs --- qemu-kvm-1.0+noroms/debian/docs 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/docs 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,4 @@ +pci-ids.txt +qdict-test-data.txt +README +TODO diff -Nru qemu-kvm-1.0+noroms/debian/emacsen-install.ex qemu-kvm-1.0-usbredirect/debian/emacsen-install.ex --- qemu-kvm-1.0+noroms/debian/emacsen-install.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/emacsen-install.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,45 @@ +#! /bin/sh -e +# /usr/lib/emacsen-common/packages/install/qemu-kvm + +# Written by Jim Van Zandt , borrowing heavily +# from the install scripts for gettext by Santiago Vila +# and octave by Dirk Eddelbuettel . + +FLAVOR=$1 +PACKAGE=qemu-kvm + +if [ ${FLAVOR} = emacs ]; then exit 0; fi + +echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} + +#FLAVORTEST=`echo $FLAVOR | cut -c-6` +#if [ ${FLAVORTEST} = xemacs ] ; then +# SITEFLAG="-no-site-file" +#else +# SITEFLAG="--no-site-file" +#fi +FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" + +ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} +ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} + +# Install-info-altdir does not actually exist. +# Maybe somebody will write it. +if test -x /usr/sbin/install-info-altdir; then + echo install/${PACKAGE}: install Info links for ${FLAVOR} + install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz +fi + +install -m 755 -d ${ELCDIR} +cd ${ELDIR} +FILES=`echo *.el` +cp ${FILES} ${ELCDIR} +cd ${ELCDIR} + +cat << EOF > path.el +(setq load-path (cons "." load-path) byte-compile-warnings nil) +EOF +${FLAVOR} ${FLAGS} ${FILES} +rm -f *.el path.el + +exit 0 diff -Nru qemu-kvm-1.0+noroms/debian/emacsen-remove.ex qemu-kvm-1.0-usbredirect/debian/emacsen-remove.ex --- qemu-kvm-1.0+noroms/debian/emacsen-remove.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/emacsen-remove.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,15 @@ +#!/bin/sh -e +# /usr/lib/emacsen-common/packages/remove/qemu-kvm + +FLAVOR=$1 +PACKAGE=qemu-kvm + +if [ ${FLAVOR} != emacs ]; then + if test -x /usr/sbin/install-info-altdir; then + echo remove/${PACKAGE}: removing Info links for ${FLAVOR} + install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/qemu-kvm.info.gz + fi + + echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} + rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} +fi diff -Nru qemu-kvm-1.0+noroms/debian/emacsen-startup.ex qemu-kvm-1.0-usbredirect/debian/emacsen-startup.ex --- qemu-kvm-1.0+noroms/debian/emacsen-startup.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/emacsen-startup.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,25 @@ +;; -*-emacs-lisp-*- +;; +;; Emacs startup file, e.g. /etc/emacs/site-start.d/50qemu-kvm.el +;; for the Debian qemu-kvm package +;; +;; Originally contributed by Nils Naumann +;; Modified by Dirk Eddelbuettel +;; Adapted for dh-make by Jim Van Zandt + +;; The qemu-kvm package follows the Debian/GNU Linux 'emacsen' policy and +;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, +;; xemacs19, emacs20, xemacs20...). The compiled code is then +;; installed in a subdirectory of the respective site-lisp directory. +;; We have to add this to the load-path: +(let ((package-dir (concat "/usr/share/" + (symbol-name flavor) + "/site-lisp/qemu-kvm"))) +;; If package-dir does not exist, the qemu-kvm package must have +;; removed but not purged, and we should skip the setup. + (when (file-directory-p package-dir) + (setq load-path (cons package-dir load-path)) + (autoload 'qemu-kvm-mode "qemu-kvm-mode" + "Major mode for editing qemu-kvm files." t) + (add-to-list 'auto-mode-alist '("\\.qemu-kvm$" . qemu-kvm-mode)))) + diff -Nru qemu-kvm-1.0+noroms/debian/init.d.ex qemu-kvm-1.0-usbredirect/debian/init.d.ex --- qemu-kvm-1.0+noroms/debian/init.d.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/init.d.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,154 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: qemu-kvm +# Required-Start: $network $local_fs +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: +# Description: +# <...> +# <...> +### END INIT INFO + +# Author: boris + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC=qemu-kvm # Introduce a short description here +NAME=qemu-kvm # Introduce the short server's name here +DAEMON=/usr/sbin/qemu-kvm # Introduce the server's location here +DAEMON_ARGS="" # Arguments to run the daemon with +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff -Nru qemu-kvm-1.0+noroms/debian/log.1 qemu-kvm-1.0-usbredirect/debian/log.1 --- qemu-kvm-1.0+noroms/debian/log.1 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/log.1 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,5 @@ +dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 +dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): +dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 +dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2 +dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): -Wl,-Bsymbolic-functions diff -Nru qemu-kvm-1.0+noroms/debian/manpage.1.ex qemu-kvm-1.0-usbredirect/debian/manpage.1.ex --- qemu-kvm-1.0+noroms/debian/manpage.1.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/manpage.1.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,59 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH QEMU-KVM SECTION "December 29, 2011" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +qemu-kvm \- program to do something +.SH SYNOPSIS +.B qemu-kvm +.RI [ options ] " files" ... +.br +.B bar +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B qemu-kvm +and +.B bar +commands. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBqemu-kvm\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. +.SH AUTHOR +qemu-kvm was written by . +.PP +This manual page was written by boris , +for the Debian project (and may be used by others). diff -Nru qemu-kvm-1.0+noroms/debian/manpage.sgml.ex qemu-kvm-1.0-usbredirect/debian/manpage.sgml.ex --- qemu-kvm-1.0+noroms/debian/manpage.sgml.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/manpage.sgml.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,154 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + FIRSTNAME"> + SURNAME"> + + December 29, 2011"> + + SECTION"> + bderzhavets@yahoo.com"> + + QEMU-KVM"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2003 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + program to do something + + + + &dhpackage; + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; and bar + commands. + + This manual page was written for the &debian; distribution + because the original program does not have a manual page. + Instead, it has documentation in the &gnu; + Info format; see below. + + &dhpackage; is a program that... + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files. + + + + + + + + Show summary of options. + + + + + + + + Show version of program. + + + + + + SEE ALSO + + bar (1), baz (1). + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + Info system. + + + AUTHOR + + This manual page was written by &dhusername; &dhemail; for + the &debian; system (and may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; General Public License, Version 2 any + later version published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + +
+ + diff -Nru qemu-kvm-1.0+noroms/debian/manpage.xml.ex qemu-kvm-1.0-usbredirect/debian/manpage.xml.ex --- qemu-kvm-1.0+noroms/debian/manpage.xml.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/manpage.xml.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,291 @@ + +.
will be generated. You may view the +manual page with: nroff -man .
| less'. A typical entry +in a Makefile or Makefile.am is: + +DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl +XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0" + +manpage.1: manpage.xml + $(XP) $(DB2MAN) $< + +The xsltproc binary is found in the xsltproc package. The XSL files are in +docbook-xsl. A description of the parameters you can use can be found in the +docbook-xsl-doc-* packages. Please remember that if you create the nroff +version in one of the debian/rules file targets (such as build), you will need +to include xsltproc and docbook-xsl in your Build-Depends control field. +Alternatively use the xmlto command/package. That will also automatically +pull in xsltproc and docbook-xsl. + +Notes for using docbook2x: docbook2x-man does not automatically create the +AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as + ... . + +To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections +read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be +found in the docbook-xsl-doc-html package. + +Validation can be done using: `xmllint -''-noout -''-valid manpage.xml` + +General documentation about man-pages and man-page-formatting: +man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + +--> + + + + + + + + + + + + + +]> + + + + &dhtitle; + &dhpackage; + + + &dhfirstname; + &dhsurname; + Wrote this manpage for the Debian system. +
+ &dhemail; +
+
+
+ + 2007 + &dhusername; + + + This manual page was written for the Debian system + (and may be used by others). + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License, + Version 2 or (at your option) any later version published by + the Free Software Foundation. + On Debian systems, the complete text of the GNU General Public + License can be found in + /usr/share/common-licenses/GPL. + +
+ + &dhucpackage; + &dhsection; + + + &dhpackage; + program to do something + + + + &dhpackage; + + + + + + + + + this + + + + + + + + this + that + + + + + &dhpackage; + + + + + + + + + + + + + + + + + + + DESCRIPTION + This manual page documents briefly the + &dhpackage; and bar + commands. + This manual page was written for the Debian distribution + because the original program does not have a manual page. + Instead, it has documentation in the GNU + info + 1 + format; see below. + &dhpackage; is a program that... + + + OPTIONS + The program follows the usual GNU command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + + info + 1 + files. + + + + + + + Does this and that. + + + + + + + Show summary of options. + + + + + + + Show version of program. + + + + + + FILES + + + /etc/foo.conf + + The system-wide configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + ${HOME}/.foo.conf + + The per-user configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + + + ENVIONMENT + + + FOO_CONF + + If used, the defined file is used as configuration + file (see also ). + + + + + + DIAGNOSTICS + The following diagnostics may be issued + on stderr: + + + Bad configuration file. Exiting. + + The configuration file seems to contain a broken configuration + line. Use the option, to get more info. + + + + + &dhpackage; provides some return codes, that can + be used in scripts: + + Code + Diagnostic + + 0 + Program exited successfully. + + + 1 + The configuration file seems to be broken. + + + + + + BUGS + The program is currently limited to only work + with the foobar library. + The upstreams BTS can be found + at . + + + SEE ALSO + + + bar + 1 + , + baz + 1 + , + foo.conf + 5 + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + info + 1 + system. + +
+ diff -Nru qemu-kvm-1.0+noroms/debian/menu.ex qemu-kvm-1.0-usbredirect/debian/menu.ex --- qemu-kvm-1.0+noroms/debian/menu.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/menu.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,2 @@ +?package(qemu-kvm):needs="X11|text|vc|wm" section="Applications/see-menu-manual"\ + title="qemu-kvm" command="/usr/bin/qemu-kvm" diff -Nru qemu-kvm-1.0+noroms/debian/patches/debian-changes-1.0-release-3ubuntu5 qemu-kvm-1.0-usbredirect/debian/patches/debian-changes-1.0-release-3ubuntu5 --- qemu-kvm-1.0+noroms/debian/patches/debian-changes-1.0-release-3ubuntu5 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/patches/debian-changes-1.0-release-3ubuntu5 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,52 @@ +Description: Upstream changes introduced in version 1.0-release-3ubuntu5 + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + qemu-kvm (1.0-release-3ubuntu5) precise; urgency=high + . + * Build based on qemu-kvm-1.0 Adding libattr1-dev + to debian/control dependencies LP: #782973 + Creating package qemu-utils to dual boot with Xen 4.1 + . + The person named in the Author field signed this changelog entry. +Author: Boris Derzhavets +Bug-Ubuntu: https://bugs.launchpad.net/bugs/782973 + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- /dev/null ++++ qemu-kvm-1.0-release/.gitmodules +@@ -0,0 +1,21 @@ ++[submodule "roms/vgabios"] ++ path = roms/vgabios ++ url = git://git.kernel.org/pub/scm/virt/kvm/vgabios.git/ ++[submodule "roms/seabios"] ++ path = roms/seabios ++ url = git://git.qemu.org/seabios.git/ ++[submodule "roms/SLOF"] ++ path = roms/SLOF ++ url = git://git.qemu.org/SLOF.git ++[submodule "roms/ipxe"] ++ path = roms/ipxe ++ url = git://git.qemu.org/ipxe.git ++[submodule "roms/openbios"] ++ path = roms/openbios ++ url = git://git.qemu.org/openbios.git ++[submodule "roms/qemu-palcode"] ++ path = roms/qemu-palcode ++ url = git://repo.or.cz/qemu-palcode.git ++[submodule "roms/sgabios"] ++ path = roms/sgabios ++ url = git://git.qemu.org/sgabios.git diff -Nru qemu-kvm-1.0+noroms/debian/patches/debian-changes-1.0-release-3ubuntu7 qemu-kvm-1.0-usbredirect/debian/patches/debian-changes-1.0-release-3ubuntu7 --- qemu-kvm-1.0+noroms/debian/patches/debian-changes-1.0-release-3ubuntu7 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/patches/debian-changes-1.0-release-3ubuntu7 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,52 @@ +Description: Upstream changes introduced in version 1.0-release-3ubuntu7 + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + qemu-kvm (1.0-release-3ubuntu7) precise; urgency=high + . + * Build based on qemu-kvm-1.0 Adding libattr1-dev + to debian/control dependencies LP: #782973 + Creating package qemu-utils to dual boot with Xen 4.1 + . + The person named in the Author field signed this changelog entry. +Author: Boris Derzhavets +Bug-Ubuntu: https://bugs.launchpad.net/bugs/782973 + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- /dev/null ++++ qemu-kvm-1.0-release/.gitmodules +@@ -0,0 +1,21 @@ ++[submodule "roms/vgabios"] ++ path = roms/vgabios ++ url = git://git.kernel.org/pub/scm/virt/kvm/vgabios.git/ ++[submodule "roms/seabios"] ++ path = roms/seabios ++ url = git://git.qemu.org/seabios.git/ ++[submodule "roms/SLOF"] ++ path = roms/SLOF ++ url = git://git.qemu.org/SLOF.git ++[submodule "roms/ipxe"] ++ path = roms/ipxe ++ url = git://git.qemu.org/ipxe.git ++[submodule "roms/openbios"] ++ path = roms/openbios ++ url = git://git.qemu.org/openbios.git ++[submodule "roms/qemu-palcode"] ++ path = roms/qemu-palcode ++ url = git://repo.or.cz/qemu-palcode.git ++[submodule "roms/sgabios"] ++ path = roms/sgabios ++ url = git://git.qemu.org/sgabios.git diff -Nru qemu-kvm-1.0+noroms/debian/patches/debian-changes-1.0-usbredir1-2ubuntu3 qemu-kvm-1.0-usbredirect/debian/patches/debian-changes-1.0-usbredir1-2ubuntu3 --- qemu-kvm-1.0+noroms/debian/patches/debian-changes-1.0-usbredir1-2ubuntu3 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/patches/debian-changes-1.0-usbredir1-2ubuntu3 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,52 @@ +Description: Upstream changes introduced in version 1.0-usbredir1-2ubuntu3 + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + qemu-kvm (1.0-usbredir1-2ubuntu3) precise; urgency=high + . + * Build based on git clone git://people.freedesktop.org/~jwrdegoede/qemu + Adding libattr1-dev to debian/control dependencies LP: #782973 + Creating package qemu-utils to dual boot with Xen 4.1 + . + The person named in the Author field signed this changelog entry. +Author: Boris Derzhavets +Bug-Ubuntu: https://bugs.launchpad.net/bugs/782973 + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- /dev/null ++++ qemu-kvm-1.0-usbredir1/.gitmodules +@@ -0,0 +1,21 @@ ++[submodule "roms/vgabios"] ++ path = roms/vgabios ++ url = git://git.kernel.org/pub/scm/virt/kvm/vgabios.git/ ++[submodule "roms/seabios"] ++ path = roms/seabios ++ url = git://git.qemu.org/seabios.git/ ++[submodule "roms/SLOF"] ++ path = roms/SLOF ++ url = git://git.qemu.org/SLOF.git ++[submodule "roms/ipxe"] ++ path = roms/ipxe ++ url = git://git.qemu.org/ipxe.git ++[submodule "roms/openbios"] ++ path = roms/openbios ++ url = git://git.qemu.org/openbios.git ++[submodule "roms/qemu-palcode"] ++ path = roms/qemu-palcode ++ url = git://repo.or.cz/qemu-palcode.git ++[submodule "roms/sgabios"] ++ path = roms/sgabios ++ url = git://git.qemu.org/sgabios.git diff -Nru qemu-kvm-1.0+noroms/debian/patches/debian-changes-1.0-usbredirect-3ubuntu6 qemu-kvm-1.0-usbredirect/debian/patches/debian-changes-1.0-usbredirect-3ubuntu6 --- qemu-kvm-1.0+noroms/debian/patches/debian-changes-1.0-usbredirect-3ubuntu6 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/patches/debian-changes-1.0-usbredirect-3ubuntu6 2012-01-02 14:48:11.000000000 +0000 @@ -0,0 +1,52 @@ +Description: Upstream changes introduced in version 1.0-usbredirect-3ubuntu6 + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + qemu-kvm (1.0-usbredirect-3ubuntu6) precise; urgency=high + . + * Build based on git clone git://people.freedesktop.org/~jwrdegoede/qemu + Adding libattr1-dev to debian/control dependencies LP: #782973 + Creating package qemu-utils to dual boot with Xen 4.1 + . + The person named in the Author field signed this changelog entry. +Author: Boris Derzhavets +Bug-Ubuntu: https://bugs.launchpad.net/bugs/782973 + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- /dev/null ++++ qemu-kvm-1.0-usbredirect/.gitmodules +@@ -0,0 +1,21 @@ ++[submodule "roms/vgabios"] ++ path = roms/vgabios ++ url = git://git.kernel.org/pub/scm/virt/kvm/vgabios.git/ ++[submodule "roms/seabios"] ++ path = roms/seabios ++ url = git://git.qemu.org/seabios.git/ ++[submodule "roms/SLOF"] ++ path = roms/SLOF ++ url = git://git.qemu.org/SLOF.git ++[submodule "roms/ipxe"] ++ path = roms/ipxe ++ url = git://git.qemu.org/ipxe.git ++[submodule "roms/openbios"] ++ path = roms/openbios ++ url = git://git.qemu.org/openbios.git ++[submodule "roms/qemu-palcode"] ++ path = roms/qemu-palcode ++ url = git://repo.or.cz/qemu-palcode.git ++[submodule "roms/sgabios"] ++ path = roms/sgabios ++ url = git://git.qemu.org/sgabios.git diff -Nru qemu-kvm-1.0+noroms/debian/patches/Detect-and-use-GCC-atomic-builtins-for-locking.patch qemu-kvm-1.0-usbredirect/debian/patches/Detect-and-use-GCC-atomic-builtins-for-locking.patch --- qemu-kvm-1.0+noroms/debian/patches/Detect-and-use-GCC-atomic-builtins-for-locking.patch 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/patches/Detect-and-use-GCC-atomic-builtins-for-locking.patch 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,84 @@ +From de01f17a2cb88dc5ff53cc321342b888c33b120a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lo=C3=AFc=20Minier?= +Date: Thu, 11 Feb 2010 17:42:33 +0100 +Subject: [PATCH] Detect and use GCC atomic builtins for locking + +--- + configure | 17 +++++++++++++++++ + qemu-lock.h | 13 +++++++++++++ + 2 files changed, 30 insertions(+), 0 deletions(-) + +Index: qemu-kvm-0.13.0-rc1/configure +=================================================================== +--- qemu-kvm-0.13.0-rc1.orig/configure 2010-09-07 20:22:49.000000000 -0500 ++++ qemu-kvm-0.13.0-rc1/configure 2010-10-20 13:20:03.425515003 -0500 +@@ -2182,6 +2182,20 @@ + fi + + ########################################## ++# check if we have gcc atomic built-ins ++gcc_atomic_builtins=no ++cat > $TMPC << EOF ++int main(void) { ++ int i; ++ __sync_lock_test_and_set(&i, 1); ++ __sync_lock_release(&i); ++} ++EOF ++if compile_prog "" ""; then ++ gcc_atomic_builtins=yes ++fi ++ ++########################################## + # check if we have fdatasync + + fdatasync=no +@@ -2562,6 +2576,9 @@ + if test "$gcc_attribute_warn_unused_result" = "yes" ; then + echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak + fi ++if test "$gcc_atomic_builtins" = "yes" ; then ++ echo "CONFIG_GCC_ATOMIC_BUILTINS=y" >> $config_host_mak ++fi + if test "$fdatasync" = "yes" ; then + echo "CONFIG_FDATASYNC=y" >> $config_host_mak + fi +Index: qemu-kvm-0.13.0-rc1/qemu-lock.h +=================================================================== +--- qemu-kvm-0.13.0-rc1.orig/qemu-lock.h 2010-09-07 20:22:49.000000000 -0500 ++++ qemu-kvm-0.13.0-rc1/qemu-lock.h 2010-10-20 13:20:03.425515003 -0500 +@@ -33,6 +33,14 @@ + + #else + ++#ifdef CONFIG_GCC_ATOMIC_BUILTINS ++typedef int spinlock_t; ++ ++#define SPIN_LOCK_UNLOCKED 0 ++ ++#define resetlock(p) __sync_lock_release((p)) ++#else /* CONFIG_GCC_ATOMIC_BUILTINS */ ++ + #if defined(__hppa__) + + typedef int spinlock_t[4]; +@@ -56,7 +64,11 @@ + } + + #endif ++#endif /* !CONFIG_GCC_ATOMIC_BUILTINS */ + ++#ifdef CONFIG_GCC_ATOMIC_BUILTINS ++#define testandset(p) __sync_lock_test_and_set((p), 1) ++#else /* CONFIG_GCC_ATOMIC_BUILTINS */ + #if defined(_ARCH_PPC) + static inline int testandset (int *p) + { +@@ -213,6 +225,7 @@ + #else + #error unimplemented CPU support + #endif ++#endif /* !CONFIG_GCC_ATOMIC_BUILTINS */ + + #if defined(CONFIG_USER_ONLY) + static inline void spin_lock(spinlock_t *lock) diff -Nru qemu-kvm-1.0+noroms/debian/patches/series qemu-kvm-1.0-usbredirect/debian/patches/series --- qemu-kvm-1.0+noroms/debian/patches/series 2012-01-02 16:36:52.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/patches/series 2012-01-02 14:48:11.000000000 +0000 @@ -3,3 +3,5 @@ qemuifup-fix-paths.patch fallback-to-tcg.patch dont-try-to-hotplug-cpu.patch +werror.patch +debian-changes-1.0-usbredirect-3ubuntu6 diff -Nru qemu-kvm-1.0+noroms/debian/patches/werror.patch qemu-kvm-1.0-usbredirect/debian/patches/werror.patch --- qemu-kvm-1.0+noroms/debian/patches/werror.patch 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/patches/werror.patch 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,11 @@ +--- qemu-kvm-060811.orig/configure 2011-06-08 15:23:35.477389696 +0400 ++++ qemu-kvm-060811/configure 2011-06-08 15:24:28.587389677 +0400 +@@ -2692,7 +2692,7 @@ + if test -z "$werror" ; then + if test "$z_version" = "50" -a \ + "$linux" = "yes" ; then +- werror="yes" ++ werror="no" + else + werror="no" + fi diff -Nru qemu-kvm-1.0+noroms/debian/postinst.ex qemu-kvm-1.0-usbredirect/debian/postinst.ex --- qemu-kvm-1.0+noroms/debian/postinst.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/postinst.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,39 @@ +#!/bin/sh +# postinst script for qemu-kvm +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff -Nru qemu-kvm-1.0+noroms/debian/postrm.ex qemu-kvm-1.0-usbredirect/debian/postrm.ex --- qemu-kvm-1.0+noroms/debian/postrm.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/postrm.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,37 @@ +#!/bin/sh +# postrm script for qemu-kvm +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff -Nru qemu-kvm-1.0+noroms/debian/preinst.ex qemu-kvm-1.0-usbredirect/debian/preinst.ex --- qemu-kvm-1.0+noroms/debian/preinst.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/preinst.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,35 @@ +#!/bin/sh +# preinst script for qemu-kvm +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff -Nru qemu-kvm-1.0+noroms/debian/prerm.ex qemu-kvm-1.0-usbredirect/debian/prerm.ex --- qemu-kvm-1.0+noroms/debian/prerm.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/prerm.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,38 @@ +#!/bin/sh +# prerm script for qemu-kvm +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff -Nru qemu-kvm-1.0+noroms/debian/qemu-ifdown qemu-kvm-1.0-usbredirect/debian/qemu-ifdown --- qemu-kvm-1.0+noroms/debian/qemu-ifdown 2012-01-02 16:36:52.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/qemu-ifdown 2012-01-02 14:47:34.000000000 +0000 @@ -3,7 +3,7 @@ # NOTE: This script is intended to run in conjunction with qemu-ifup # which uses the same logic to find your bridge/switch -switch=$(ip route list | awk '/^default / { print $5 }') +switch=$(/sbin/ip route list | awk '/^default / { print $5 }') -brctl delif $switch $1 -ifconfig $1 0.0.0.0 down +/usr/sbin/brctl delif $switch $1 +/sbin/ifconfig $1 0.0.0.0 down diff -Nru qemu-kvm-1.0+noroms/debian/qemu-kvm.cron.d.ex qemu-kvm-1.0-usbredirect/debian/qemu-kvm.cron.d.ex --- qemu-kvm-1.0+noroms/debian/qemu-kvm.cron.d.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/qemu-kvm.cron.d.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the qemu-kvm package +# +0 4 * * * root [ -x /usr/bin/qemu-kvm_maintenance ] && /usr/bin/qemu-kvm_maintenance diff -Nru qemu-kvm-1.0+noroms/debian/qemu-kvm.default qemu-kvm-1.0-usbredirect/debian/qemu-kvm.default --- qemu-kvm-1.0+noroms/debian/qemu-kvm.default 2012-01-02 16:36:52.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/qemu-kvm.default 2012-01-02 14:47:34.000000000 +0000 @@ -3,7 +3,3 @@ KSM_ENABLED=1 SLEEP_MILLISECS=200 - -# To load the vhost_net module, which in some cases can speed up -# network performance, set VHOST_NET_ENABLED to 1. -VHOST_NET_ENABLED=0 diff -Nru qemu-kvm-1.0+noroms/debian/qemu-kvm.default.ex qemu-kvm-1.0-usbredirect/debian/qemu-kvm.default.ex --- qemu-kvm-1.0+noroms/debian/qemu-kvm.default.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/qemu-kvm.default.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,10 @@ +# Defaults for qemu-kvm initscript +# sourced by /etc/init.d/qemu-kvm +# installed at /etc/default/qemu-kvm by the maintainer scripts + +# +# This is a POSIX shell fragment +# + +# Additional options that are passed to the Daemon. +DAEMON_OPTS="" diff -Nru qemu-kvm-1.0+noroms/debian/qemu-kvm.doc-base.EX qemu-kvm-1.0-usbredirect/debian/qemu-kvm.doc-base.EX --- qemu-kvm-1.0+noroms/debian/qemu-kvm.doc-base.EX 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/qemu-kvm.doc-base.EX 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,20 @@ +Document: qemu-kvm +Title: Debian qemu-kvm Manual +Author: +Abstract: This manual describes what qemu-kvm is + and how it can be used to + manage online manuals on Debian systems. +Section: unknown + +Format: debiandoc-sgml +Files: /usr/share/doc/qemu-kvm/qemu-kvm.sgml.gz + +Format: postscript +Files: /usr/share/doc/qemu-kvm/qemu-kvm.ps.gz + +Format: text +Files: /usr/share/doc/qemu-kvm/qemu-kvm.text.gz + +Format: HTML +Index: /usr/share/doc/qemu-kvm/html/index.html +Files: /usr/share/doc/qemu-kvm/html/*.html diff -Nru qemu-kvm-1.0+noroms/debian/qemu-kvm.links qemu-kvm-1.0-usbredirect/debian/qemu-kvm.links --- qemu-kvm-1.0+noroms/debian/qemu-kvm.links 2012-01-02 16:36:52.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/qemu-kvm.links 2012-01-02 14:47:34.000000000 +0000 @@ -1,4 +1,7 @@ +# usr/bin/qemu-img usr/bin/kvm-img +# usr/bin/qemu-nbd usr/bin/kvm-nbd usr/bin/qemu-system-x86_64 usr/bin/kvm +usr/bin/qemu usr/bin/qemu-system-i386 usr/share/qemu usr/share/qemu-kvm usr/share/qemu usr/share/kvm usr/share/doc/qemu usr/share/doc/kvm @@ -7,3 +10,5 @@ usr/share/man/man1/qemu.1 usr/share/man/man1/qemu-system-i386.1 usr/share/man/man1/qemu.1 usr/share/man/man1/qemu-system-x86_64.1 usr/share/man/man1/qemu.1 usr/share/man/man1/kvm.1 +usr/share/man/man1/qemu-img.1 usr/share/man/man1/kvm-img.1 +usr/share/man/man8/qemu-nbd.8 usr/share/man/man8/kvm-nbd.8 diff -Nru qemu-kvm-1.0+noroms/debian/qemu-kvm.lintian-overrides qemu-kvm-1.0-usbredirect/debian/qemu-kvm.lintian-overrides --- qemu-kvm-1.0+noroms/debian/qemu-kvm.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/qemu-kvm.lintian-overrides 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,5 @@ +# yes, we specifically want linkers to depends on the standard libjpeg name +qemu-kvm: shlibs-declares-dependency-on-other-package libjpeg62 (>=6b1) +# libturbojpeg while included is an internal lib +qemu-kvm: shlib-missing-in-control-file libturbojpeg +qemu-kvm: shlib-without-versioned-soname */libturbojpeg.so libturbojpeg.so diff -Nru qemu-kvm-1.0+noroms/debian/qemu-kvm.shlibs qemu-kvm-1.0-usbredirect/debian/qemu-kvm.shlibs --- qemu-kvm-1.0+noroms/debian/qemu-kvm.shlibs 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/qemu-kvm.shlibs 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1 @@ +libjpeg 62 libjpeg62 (>=6b1) diff -Nru qemu-kvm-1.0+noroms/debian/qemu-kvm.upstart qemu-kvm-1.0-usbredirect/debian/qemu-kvm.upstart --- qemu-kvm-1.0+noroms/debian/qemu-kvm.upstart 2012-01-02 16:36:52.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/qemu-kvm.upstart 2012-01-02 14:47:34.000000000 +0000 @@ -28,18 +28,13 @@ else [ -w /sys/kernel/mm/ksm/run ] && echo 0 > /sys/kernel/mm/ksm/run fi - # If /etc/default/qemu-kvm says to, load vhost_net. Default is not to. - if [ "$VHOST_NET_ENABLED" = "1" ]; then - modprobe -b vhost_net - fi end script post-stop script - # Unload the modules + # Unload the module if grep -qs "^flags.* vmx" /proc/cpuinfo; then modprobe -r kvm_intel elif grep -qs "^flags.* svm" /proc/cpuinfo; then modprobe -r kvm_amd fi - modprobe -r vhost_net end script diff -Nru qemu-kvm-1.0+noroms/debian/README.Debian qemu-kvm-1.0-usbredirect/debian/README.Debian --- qemu-kvm-1.0+noroms/debian/README.Debian 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/README.Debian 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,6 @@ +qemu-common-0.14.0+noroms for Debian +------------------------------------ + + + + -- Boris Derzhavets Sat, 07 May 2011 12:30:30 +0400 diff -Nru qemu-kvm-1.0+noroms/debian/rules qemu-kvm-1.0-usbredirect/debian/rules --- qemu-kvm-1.0+noroms/debian/rules 2012-01-02 16:36:52.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/rules 2012-01-02 14:47:34.000000000 +0000 @@ -9,8 +9,6 @@ DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) -export DEB_BUILD_HARDENING=1 - # Handle DEB_BUILD_OPTIONS=parallel=N , := , ifneq (,$(filter parallel=%,$(subst $(,), ,$(DEB_BUILD_OPTIONS)))) @@ -39,7 +37,6 @@ CFLAGS += -fno-var-tracking endif - config-host.mak: $(QUILT_STAMPFN) dh_testdir ./configure \ @@ -48,6 +45,8 @@ --interp-prefix=/etc/qemu-binfmt/%M \ --disable-blobs \ --disable-strip \ + --enable-spice \ + --enable-usb-redir \ $(conf_arch) build: build-stamp @@ -61,7 +60,7 @@ # Clean up some upstream build cruft rm -f pc-bios/\*.bin pc-bios/\*.dtb pc-bios/openbios-\* roms/seabios/Makefile roms/vgabios/Makefile [ ! -f config-host.mak ] || $(MAKE) distclean - $(MAKE) -f debian/rules unpatch +# $(MAKE) -f debian/rules unpatch rm -f kvm/extboot/*.o kvm/extboot/extboot.img kvm/extboot/signrom config.mak kvm/user/config.mak kvm/user/test/lib/.*.d kvm/user/test/lib/*/.*.d kvm/bios/acpi-dsdt.aml kvm/bios/acpi-ssdt.aml qemu-monitor.texi dh_clean @@ -73,7 +72,6 @@ dh_installdirs # Build & install normally $(MAKE) DESTDIR=$(CURDIR)/debian/qemu-kvm install - # move qemu-utils binaries into place mv debian/qemu-kvm/usr/bin/qemu-nbd debian/qemu-utils/usr/bin/ mv debian/qemu-kvm/usr/bin/qemu-img debian/qemu-utils/usr/bin/ touch $@ @@ -114,10 +112,6 @@ dh_gencontrol -pkvm -- -v1:84+dfsg-0ubuntu16+$(debsrc_ver)+$(debian_rev) # Prune keymaps from qemu-kvm, as these are now in qemu-common rm -rf debian/qemu-kvm/usr/share/qemu/keymaps - # move manpages for qemu-utils to the right package - mv debian/qemu-kvm/usr/share/man/man1/qemu-img.1.gz debian/qemu-utils/usr/share/man/man1 - mv debian/qemu-kvm/usr/share/man/man8/qemu-nbd.8.gz debian/qemu-utils/usr/share/man/man8 - rmdir debian/qemu-kvm/usr/share/man/man8 dh_md5sums -s dh_builddeb -s diff -Nru qemu-kvm-1.0+noroms/debian/source/format qemu-kvm-1.0-usbredirect/debian/source/format --- qemu-kvm-1.0+noroms/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/source/format 2012-01-02 16:36:54.000000000 +0000 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru qemu-kvm-1.0+noroms/debian/watch.ex qemu-kvm-1.0-usbredirect/debian/watch.ex --- qemu-kvm-1.0+noroms/debian/watch.ex 1970-01-01 00:00:00.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/debian/watch.ex 2012-01-02 14:47:34.000000000 +0000 @@ -0,0 +1,23 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 3 file +version=3 + +# Uncomment to examine a Webpage +# +#http://www.example.com/downloads.php qemu-kvm-(.*)\.tar\.gz + +# Uncomment to examine a Webserver directory +#http://www.example.com/pub/qemu-kvm-(.*)\.tar\.gz + +# Uncommment to examine a FTP server +#ftp://ftp.example.com/pub/qemu-kvm-(.*)\.tar\.gz debian uupdate + +# Uncomment to find new files on sourceforge, for devscripts >= 2.9 +# http://sf.net/qemu-kvm/qemu-kvm-(.*)\.tar\.gz + +# Uncomment to find new files on GooglePages +# http://example.googlepages.com/foo.html qemu-kvm-(.*)\.tar\.gz diff -Nru qemu-kvm-1.0+noroms/EXTERNAL_DEPENDENCIES qemu-kvm-1.0-usbredirect/EXTERNAL_DEPENDENCIES --- qemu-kvm-1.0+noroms/EXTERNAL_DEPENDENCIES 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/EXTERNAL_DEPENDENCIES 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -SLOF 32e3430c018ceb8413cb808477449d1968c42497 -ipxe 7aee315f61aaf1be6d2fff26339f28a1137231a5 -openbios ff61d973e5a4a68b29e485b3f88e6a2d1d96cf45 -qemu-palcode 7abb12f60eb3069019e9497e193733d77d8f0722 -seabios 8e301472e324b6d6496d8b4ffc66863e99d7a505 -sgabios 23d474943dcd55d0550a3d20b3d30e9040a4f15b -vgabios ca056d8e77a534f4f90548bc8cee166a378c1454 diff -Nru qemu-kvm-1.0+noroms/gdbstub.c qemu-kvm-1.0-usbredirect/gdbstub.c --- qemu-kvm-1.0+noroms/gdbstub.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/gdbstub.c 2012-01-02 14:43:47.000000000 +0000 @@ -2860,6 +2860,12 @@ } #endif +static const QemuChrHandlers gdb_handlers = { + .fd_can_read = gdb_chr_can_receive, + .fd_read = gdb_chr_receive, + .fd_event = gdb_chr_event, +}; + int gdbserver_start(const char *device) { GDBState *s; @@ -2889,8 +2895,7 @@ 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 -Nru qemu-kvm-1.0+noroms/.gitignore qemu-kvm-1.0-usbredirect/.gitignore --- qemu-kvm-1.0+noroms/.gitignore 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -config-devices.* -config-all-devices.* -config-host.* -config-target.* -trace.h -trace.c -trace-dtrace.h -trace-dtrace.dtrace -*-timestamp -*-softmmu -*-darwin-user -*-linux-user -*-bsd-user -libdis* -libhw32 -libhw64 -libuser -linux-headers/asm -qapi-generated -qapi-types.[ch] -qapi-visit.[ch] -qmp-commands.h -qmp-marshal.c -qemu-doc.html -qemu-tech.html -qemu-doc.info -qemu-tech.info -qemu.1 -qemu.pod -qemu-img.1 -qemu-img.pod -qemu-img -qemu-nbd -qemu-nbd.8 -qemu-nbd.pod -qemu-options.def -qemu-options.texi -qemu-img-cmds.texi -qemu-img-cmds.h -qemu-io -qemu-ga -qemu-monitor.texi -QMP/qmp-commands.txt -test-coroutine -.gdbinit -*.a -*.aux -*.cp -*.dvi -*.exe -*.fn -*.ky -*.log -*.pdf -*.cps -*.fns -*.kys -*.pg -*.pyc -*.toc -*.tp -*.vr -*.d -*.o -*.swp -*.orig -.pc -patches -pc-bios/bios-pq/status -pc-bios/vgabios-pq/status -pc-bios/optionrom/linuxboot.bin -pc-bios/optionrom/multiboot.bin -pc-bios/optionrom/multiboot.raw -pc-bios/optionrom/vapic.bin -.stgit-* -cscope.* -tags -TAGS -*~ diff -Nru qemu-kvm-1.0+noroms/.gitmodules qemu-kvm-1.0-usbredirect/.gitmodules --- qemu-kvm-1.0+noroms/.gitmodules 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/.gitmodules 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -[submodule "roms/vgabios"] - path = roms/vgabios - url = git://git.kernel.org/pub/scm/virt/kvm/vgabios.git/ -[submodule "roms/seabios"] - path = roms/seabios - url = git://git.qemu.org/seabios.git/ -[submodule "roms/SLOF"] - path = roms/SLOF - url = git://git.qemu.org/SLOF.git -[submodule "roms/ipxe"] - path = roms/ipxe - url = git://git.qemu.org/ipxe.git -[submodule "roms/openbios"] - path = roms/openbios - url = git://git.qemu.org/openbios.git -[submodule "roms/qemu-palcode"] - path = roms/qemu-palcode - url = git://repo.or.cz/qemu-palcode.git -[submodule "roms/sgabios"] - path = roms/sgabios - url = git://git.qemu.org/sgabios.git diff -Nru qemu-kvm-1.0+noroms/hw/ccid-card-passthru.c qemu-kvm-1.0-usbredirect/hw/ccid-card-passthru.c --- qemu-kvm-1.0+noroms/hw/ccid-card-passthru.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/ccid-card-passthru.c 2012-01-02 14:43:47.000000000 +0000 @@ -274,6 +274,12 @@ return card->atr; } +static const QemuChrHandlers passthru_handlers = { + .fd_can_read = ccid_card_vscard_can_read, + .fd_read = ccid_card_vscard_read, + .fd_event = ccid_card_vscard_event, +}; + static int passthru_initfn(CCIDCardState *base) { PassthruState *card = DO_UPCAST(PassthruState, base, base); @@ -282,10 +288,7 @@ card->vscard_in_hdr = 0; if (card->cs) { DPRINTF(card, D_INFO, "initing chardev\n"); - qemu_chr_add_handlers(card->cs, - ccid_card_vscard_can_read, - ccid_card_vscard_read, - ccid_card_vscard_event, card); + qemu_chr_add_handlers(card->cs, &passthru_handlers, card); ccid_card_vscard_send_init(card); } else { error_report("missing chardev"); diff -Nru qemu-kvm-1.0+noroms/hw/debugcon.c qemu-kvm-1.0-usbredirect/hw/debugcon.c --- qemu-kvm-1.0+noroms/hw/debugcon.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/debugcon.c 2012-01-02 14:43:47.000000000 +0000 @@ -73,7 +73,7 @@ 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 -Nru qemu-kvm-1.0+noroms/hw/escc.c qemu-kvm-1.0-usbredirect/hw/escc.c --- qemu-kvm-1.0+noroms/hw/escc.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/escc.c 2012-01-02 14:43:47.000000000 +0000 @@ -867,6 +867,12 @@ sysbus_mmio_map(s, 0, base); } +static const QemuChrHandlers serial_handlers = { + .fd_can_read = serial_can_receive, + .fd_read = serial_receive1, + .fd_event = serial_event, +}; + static int escc_init1(SysBusDevice *dev) { SerialState *s = FROM_SYSBUS(SerialState, dev); @@ -879,8 +885,7 @@ s->chn[i].chn = 1 - i; s->chn[i].clock = s->frequency / 2; if (s->chn[i].chr) { - qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive, - serial_receive1, serial_event, &s->chn[i]); + qemu_chr_add_handlers(s->chn[i].chr, &serial_handlers, &s->chn[i]); } } s->chn[0].otherchn = &s->chn[1]; diff -Nru qemu-kvm-1.0+noroms/hw/etraxfs_ser.c qemu-kvm-1.0-usbredirect/hw/etraxfs_ser.c --- qemu-kvm-1.0+noroms/hw/etraxfs_ser.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/etraxfs_ser.c 2012-01-02 14:43:47.000000000 +0000 @@ -208,6 +208,12 @@ } +static const QemuChrHandlers serial_handlers = { + .fd_can_read = serial_can_receive, + .fd_read = serial_receive, + .fd_event = serial_event, +}; + static int etraxfs_ser_init(SysBusDevice *dev) { struct etrax_serial *s = FROM_SYSBUS(typeof (*s), dev); @@ -217,10 +223,9 @@ sysbus_init_mmio_region(dev, &s->mmio); s->chr = qdev_init_chardev(&dev->qdev); - if (s->chr) - qemu_chr_add_handlers(s->chr, - serial_can_receive, serial_receive, - serial_event, s); + if (s->chr) { + qemu_chr_add_handlers(s->chr, &serial_handlers, s); + } return 0; } diff -Nru qemu-kvm-1.0+noroms/hw/grlib_apbuart.c qemu-kvm-1.0-usbredirect/hw/grlib_apbuart.c --- qemu-kvm-1.0+noroms/hw/grlib_apbuart.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/grlib_apbuart.c 2012-01-02 14:43:47.000000000 +0000 @@ -144,16 +144,18 @@ NULL, NULL, grlib_apbuart_writel, }; +static const QemuChrHandlers grlib_handlers = { + .fd_can_read = grlib_apbuart_can_receive, + .fd_read = grlib_apbuart_receive, + .fd_event = grlib_apbuart_event, +}; + static int grlib_apbuart_init(SysBusDevice *dev) { UART *uart = FROM_SYSBUS(typeof(*uart), dev); int uart_regs = 0; - 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 -Nru qemu-kvm-1.0+noroms/hw/ivshmem.c qemu-kvm-1.0-usbredirect/hw/ivshmem.c --- qemu-kvm-1.0+noroms/hw/ivshmem.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/ivshmem.c 2012-01-02 14:43:47.000000000 +0000 @@ -276,6 +276,18 @@ msix_notify(pdev, entry->vector); } +static const QemuChrHandlers ivshmem_handlers = { + .fd_can_read = ivshmem_can_receive, + .fd_read = ivshmem_receive, + .fd_event = ivshmem_event, +}; + +static const QemuChrHandlers ivshmem_msi_handlers = { + .fd_can_read = ivshmem_can_receive, + .fd_read = fake_irqfd, + .fd_event = ivshmem_event, +}; + static CharDriverState* create_eventfd_chr_device(void * opaque, int eventfd, int vector) { @@ -295,11 +307,10 @@ 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, + &s->eventfd_table[vector]); } else { - qemu_chr_add_handlers(chr, ivshmem_can_receive, ivshmem_receive, - ivshmem_event, s); + qemu_chr_add_handlers(chr, &ivshmem_handlers, s); } return chr; @@ -614,6 +625,12 @@ return 0; } +static const QemuChrHandlers ivshmem_server_handlers = { + .fd_can_read = ivshmem_can_receive, + .fd_read = ivshmem_read, + .fd_event = ivshmem_event, +}; + static int pci_ivshmem_init(PCIDevice *dev) { IVShmemState *s = DO_UPCAST(IVShmemState, dev, dev); @@ -703,8 +720,7 @@ 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); } else { /* just map the file immediately, we're not using a server */ int fd; diff -Nru qemu-kvm-1.0+noroms/hw/lm32_juart.c qemu-kvm-1.0-usbredirect/hw/lm32_juart.c --- qemu-kvm-1.0+noroms/hw/lm32_juart.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/lm32_juart.c 2012-01-02 14:43:47.000000000 +0000 @@ -110,13 +110,19 @@ s->jrx = 0; } +static const QemuChrHandlers juart_handlers = { + .fd_can_read = juart_can_rx, + .fd_read = juart_rx, + .fd_event = juart_event, +}; + static int lm32_juart_init(SysBusDevice *dev) { LM32JuartState *s = FROM_SYSBUS(typeof(*s), dev); s->chr = qdev_init_chardev(&dev->qdev); 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); } return 0; diff -Nru qemu-kvm-1.0+noroms/hw/lm32_uart.c qemu-kvm-1.0-usbredirect/hw/lm32_uart.c --- qemu-kvm-1.0+noroms/hw/lm32_uart.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/lm32_uart.c 2012-01-02 14:43:47.000000000 +0000 @@ -242,6 +242,12 @@ s->regs[R_LSR] = LSR_THRE | LSR_TEMT; } +static const QemuChrHandlers uart_handlers = { + .fd_can_read = uart_can_rx, + .fd_read = uart_rx, + .fd_event = uart_event, +}; + static int lm32_uart_init(SysBusDevice *dev) { LM32UartState *s = FROM_SYSBUS(typeof(*s), dev); @@ -255,7 +261,7 @@ s->chr = qdev_init_chardev(&dev->qdev); 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); } return 0; diff -Nru qemu-kvm-1.0+noroms/hw/mcf_uart.c qemu-kvm-1.0-usbredirect/hw/mcf_uart.c --- qemu-kvm-1.0+noroms/hw/mcf_uart.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/mcf_uart.c 2012-01-02 14:43:47.000000000 +0000 @@ -268,6 +268,12 @@ 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, + .fd_event = mcf_uart_event, +}; + void *mcf_uart_init(qemu_irq irq, CharDriverState *chr) { mcf_uart_state *s; @@ -276,8 +282,7 @@ s->chr = chr; s->irq = irq; if (chr) { - qemu_chr_add_handlers(chr, mcf_uart_can_receive, mcf_uart_receive, - mcf_uart_event, s); + qemu_chr_add_handlers(chr, &mcf_uart_handlers, s); } mcf_uart_reset(s); return s; diff -Nru qemu-kvm-1.0+noroms/hw/milkymist-uart.c qemu-kvm-1.0-usbredirect/hw/milkymist-uart.c --- qemu-kvm-1.0+noroms/hw/milkymist-uart.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/milkymist-uart.c 2012-01-02 14:43:47.000000000 +0000 @@ -189,6 +189,12 @@ s->regs[R_STAT] = STAT_THRE; } +static const QemuChrHandlers uart_handlers = { + .fd_can_read = uart_can_rx, + .fd_read = uart_rx, + .fd_event = uart_event, +}; + static int milkymist_uart_init(SysBusDevice *dev) { MilkymistUartState *s = FROM_SYSBUS(typeof(*s), dev); @@ -201,7 +207,7 @@ s->chr = qdev_init_chardev(&dev->qdev); 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); } return 0; diff -Nru qemu-kvm-1.0+noroms/hw/pl011.c qemu-kvm-1.0-usbredirect/hw/pl011.c --- qemu-kvm-1.0+noroms/hw/pl011.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/pl011.c 2012-01-02 14:43:47.000000000 +0000 @@ -260,6 +260,12 @@ } }; +static const QemuChrHandlers pl011_handlers = { + .fd_can_read = pl011_can_receive, + .fd_read = pl011_receive, + .fd_event = pl011_event, +}; + static int pl011_init(SysBusDevice *dev, const unsigned char *id) { int iomemtype; @@ -278,8 +284,7 @@ s->cr = 0x300; s->flags = 0x90; if (s->chr) { - qemu_chr_add_handlers(s->chr, pl011_can_receive, pl011_receive, - pl011_event, s); + qemu_chr_add_handlers(s->chr, &pl011_handlers, s); } vmstate_register(&dev->qdev, -1, &vmstate_pl011, s); return 0; diff -Nru qemu-kvm-1.0+noroms/hw/pxa2xx.c qemu-kvm-1.0-usbredirect/hw/pxa2xx.c --- qemu-kvm-1.0+noroms/hw/pxa2xx.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/pxa2xx.c 2012-01-02 14:43:47.000000000 +0000 @@ -1984,6 +1984,12 @@ return 0; } +static const QemuChrHandlers pxa2xx_handlers = { + .fd_can_read = pxa2xx_fir_is_empty, + .fd_read = pxa2xx_fir_rx, + .fd_event = pxa2xx_fir_event, +}; + 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 @@ 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); - + if (chr) { + qemu_chr_add_handlers(chr, &pxa2xx_handlers, s); + } register_savevm(NULL, "pxa2xx_fir", 0, 0, pxa2xx_fir_save, pxa2xx_fir_load, s); diff -Nru qemu-kvm-1.0+noroms/hw/serial.c qemu-kvm-1.0-usbredirect/hw/serial.c --- qemu-kvm-1.0+noroms/hw/serial.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/serial.c 2012-01-02 14:43:47.000000000 +0000 @@ -728,6 +728,12 @@ qemu_irq_lower(s->irq); } +static const QemuChrHandlers serial_handlers = { + .fd_can_read = serial_can_receive1, + .fd_read = serial_receive1, + .fd_event = serial_event, +}; + static void serial_init_core(SerialState *s) { if (!s->chr) { @@ -742,8 +748,7 @@ 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 -Nru qemu-kvm-1.0+noroms/hw/sh_serial.c qemu-kvm-1.0-usbredirect/hw/sh_serial.c --- qemu-kvm-1.0+noroms/hw/sh_serial.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/sh_serial.c 2012-01-02 14:43:47.000000000 +0000 @@ -350,6 +350,12 @@ &sh_serial_write, }; +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 @@ 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 -Nru qemu-kvm-1.0+noroms/hw/spapr_vty.c qemu-kvm-1.0-usbredirect/hw/spapr_vty.c --- qemu-kvm-1.0+noroms/hw/spapr_vty.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/spapr_vty.c 2012-01-02 14:43:47.000000000 +0000 @@ -54,6 +54,11 @@ qemu_chr_fe_write(dev->chardev, buf, len); } +static const QemuChrHandlers vty_handlers = { + .fd_can_read = vty_can_receive, + .fd_read = vty_receive, +}; + static int spapr_vty_init(VIOsPAPRDevice *sdev) { VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)sdev; @@ -63,8 +68,7 @@ exit(1); } - qemu_chr_add_handlers(dev->chardev, vty_can_receive, - vty_receive, NULL, dev); + qemu_chr_add_handlers(dev->chardev, vty_handlers, dev); return 0; } diff -Nru qemu-kvm-1.0+noroms/hw/strongarm.c qemu-kvm-1.0-usbredirect/hw/strongarm.c --- qemu-kvm-1.0+noroms/hw/strongarm.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/strongarm.c 2012-01-02 14:43:47.000000000 +0000 @@ -1160,6 +1160,12 @@ .endianness = DEVICE_NATIVE_ENDIAN, }; +static const QemuChrHandlers strongarm_uart_handlers = { + .fd_can_read = strongarm_uart_can_receive, + .fd_read = strongarm_uart_receive, + .fd_event = strongarm_uart_event, +}; + static int strongarm_uart_init(SysBusDevice *dev) { StrongARMUARTState *s = FROM_SYSBUS(StrongARMUARTState, dev); @@ -1172,11 +1178,7 @@ 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, - strongarm_uart_receive, - strongarm_uart_event, - s); + qemu_chr_add_handlers(s->chr, &strongarm_uart_handlers, s); } return 0; diff -Nru qemu-kvm-1.0+noroms/hw/syborg_serial.c qemu-kvm-1.0-usbredirect/hw/syborg_serial.c --- qemu-kvm-1.0+noroms/hw/syborg_serial.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/syborg_serial.c 2012-01-02 14:43:47.000000000 +0000 @@ -292,6 +292,12 @@ } }; +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 @@ 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 -Nru qemu-kvm-1.0+noroms/hw/usb-serial.c qemu-kvm-1.0-usbredirect/hw/usb-serial.c --- qemu-kvm-1.0+noroms/hw/usb-serial.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/usb-serial.c 2012-01-02 14:43:47.000000000 +0000 @@ -482,6 +482,12 @@ } } +static const QemuChrHandlers usb_serial_handlers = { + .fd_can_read = usb_serial_can_read, + .fd_read = usb_serial_read, + .fd_event = usb_serial_event, +}; + static int usb_serial_initfn(USBDevice *dev) { USBSerialState *s = DO_UPCAST(USBSerialState, dev, dev); @@ -493,8 +499,7 @@ 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 -Nru qemu-kvm-1.0+noroms/hw/virtio-console.c qemu-kvm-1.0-usbredirect/hw/virtio-console.c --- qemu-kvm-1.0+noroms/hw/virtio-console.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/virtio-console.c 2012-01-02 14:43:47.000000000 +0000 @@ -20,6 +20,16 @@ CharDriverState *chr; } VirtConsole; +/* + * Callback function that's called from chardevs when backend becomes + * writable. + */ +static void chr_write_unblocked(void *opaque) +{ + VirtConsole *vcon = opaque; + + 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) @@ -95,6 +105,13 @@ } } +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) { VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); @@ -107,8 +124,7 @@ } 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 +142,7 @@ * 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 -Nru qemu-kvm-1.0+noroms/hw/virtio-serial-bus.c qemu-kvm-1.0-usbredirect/hw/virtio-serial-bus.c --- qemu-kvm-1.0+noroms/hw/virtio-serial-bus.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/virtio-serial-bus.c 2012-01-02 14:43:47.000000000 +0000 @@ -618,6 +618,7 @@ for (i = 0; i < nr_active_ports; i++) { uint32_t id; bool host_connected; + VirtIOSerialPortInfo *info; id = qemu_get_be32(f); port = find_port_by_id(s, id); @@ -626,6 +627,11 @@ } port->guest_connected = qemu_get_byte(f); + info = DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info); + if (port->guest_connected && info->guest_open) { + /* replay guest open */ + info->guest_open(port); + } host_connected = qemu_get_byte(f); if (host_connected != port->host_connected) { /* diff -Nru qemu-kvm-1.0+noroms/hw/xen_console.c qemu-kvm-1.0-usbredirect/hw/xen_console.c --- qemu-kvm-1.0+noroms/hw/xen_console.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/xen_console.c 2012-01-02 14:43:47.000000000 +0000 @@ -212,6 +212,11 @@ return ret; } +static const QemuChrHandlers xencons_handlers = { + .fd_can_read = xencons_can_receive, + .fd_read = xencons_receive, +}; + static int con_initialise(struct XenDevice *xendev) { struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); @@ -232,9 +237,9 @@ return -1; xen_be_bind_evtchn(&con->xendev); - if (con->chr) - qemu_chr_add_handlers(con->chr, xencons_can_receive, xencons_receive, - NULL, con); + 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 @@ { struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); - 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 -Nru qemu-kvm-1.0+noroms/hw/xilinx_uartlite.c qemu-kvm-1.0-usbredirect/hw/xilinx_uartlite.c --- qemu-kvm-1.0+noroms/hw/xilinx_uartlite.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/hw/xilinx_uartlite.c 2012-01-02 14:43:47.000000000 +0000 @@ -195,6 +195,12 @@ } +static const QemuChrHandlers uart_handlers = { + .fd_can_read = uart_can_rx, + .fd_read = uart_rx, + .fd_event = uart_event, +}; + static int xilinx_uartlite_init(SysBusDevice *dev) { struct xlx_uartlite *s = FROM_SYSBUS(typeof (*s), dev); @@ -206,8 +212,9 @@ sysbus_init_mmio_region(dev, &s->mmio); s->chr = qdev_init_chardev(&dev->qdev); - if (s->chr) - qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s); + if (s->chr) { + qemu_chr_add_handlers(s->chr, &uart_handlers, s); + } return 0; } diff -Nru qemu-kvm-1.0+noroms/iohandler.c qemu-kvm-1.0-usbredirect/iohandler.c --- qemu-kvm-1.0+noroms/iohandler.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/iohandler.c 2012-01-02 14:43:47.000000000 +0000 @@ -45,6 +45,41 @@ static QLIST_HEAD(, IOHandlerRecord) io_handlers = QLIST_HEAD_INITIALIZER(io_handlers); +static IOHandlerRecord *find_iohandler(int fd) +{ + IOHandlerRecord *ioh; + + QLIST_FOREACH(ioh, &io_handlers, next) { + if (ioh->fd == fd) { + return ioh; + } + } + return NULL; +} + +void enable_write_fd_handler(int fd, IOHandler *fd_write) +{ + IOHandlerRecord *ioh; + + ioh = find_iohandler(fd); + if (!ioh) { + return; + } + + ioh->fd_write = fd_write; +} + +void disable_write_fd_handler(int fd) +{ + IOHandlerRecord *ioh; + + ioh = find_iohandler(fd); + if (!ioh) { + return; + } + + 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 -Nru qemu-kvm-1.0+noroms/KVM_VERSION qemu-kvm-1.0-usbredirect/KVM_VERSION --- qemu-kvm-1.0+noroms/KVM_VERSION 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/KVM_VERSION 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -qemu-kvm-1.0 diff -Nru qemu-kvm-1.0+noroms/main-loop.h qemu-kvm-1.0-usbredirect/main-loop.h --- qemu-kvm-1.0+noroms/main-loop.h 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/main-loop.h 2012-01-02 14:43:47.000000000 +0000 @@ -167,6 +167,9 @@ 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); + /** * qemu_set_fd_handler2: Register a file descriptor with the main loop * diff -Nru qemu-kvm-1.0+noroms/monitor.c qemu-kvm-1.0-usbredirect/monitor.c --- qemu-kvm-1.0+noroms/monitor.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/monitor.c 2012-01-02 14:43:47.000000000 +0000 @@ -4882,6 +4882,18 @@ * End: */ +static const QemuChrHandlers monitor_handlers = { + .fd_can_read = monitor_can_read, + .fd_read = monitor_read, + .fd_event = monitor_event, +}; + +static const QemuChrHandlers monitor_control_handlers = { + .fd_can_read = monitor_can_read, + .fd_read = monitor_control_read, + .fd_event = monitor_control_event, +}; + void monitor_init(CharDriverState *chr, int flags) { static int is_first_init = 1; @@ -4904,12 +4916,10 @@ if (monitor_ctrl_mode(mon)) { mon->mc = g_malloc0(sizeof(MonitorControl)); /* Control mode requires special handlers */ - qemu_chr_add_handlers(chr, monitor_can_read, monitor_control_read, - monitor_control_event, mon); + qemu_chr_add_handlers(chr, &monitor_control_handlers, mon); qemu_chr_fe_set_echo(chr, true); } else { - qemu_chr_add_handlers(chr, monitor_can_read, monitor_read, - monitor_event, mon); + qemu_chr_add_handlers(chr, &monitor_handlers, mon); } QLIST_INSERT_HEAD(&mon_list, mon, entry); diff -Nru qemu-kvm-1.0+noroms/net/slirp.c qemu-kvm-1.0-usbredirect/net/slirp.c --- qemu-kvm-1.0+noroms/net/slirp.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/net/slirp.c 2012-01-02 14:43:47.000000000 +0000 @@ -576,6 +576,11 @@ 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, +}; + static int slirp_guestfwd(SlirpState *s, const char *config_str, int legacy_format) { @@ -632,8 +637,7 @@ 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 -Nru qemu-kvm-1.0+noroms/net/socket.c qemu-kvm-1.0-usbredirect/net/socket.c --- qemu-kvm-1.0+noroms/net/socket.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/net/socket.c 2012-01-02 14:43:47.000000000 +0000 @@ -56,8 +56,8 @@ 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) Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/bamboo.dtb and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/bamboo.dtb differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/bios.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/bios.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/linuxboot.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/linuxboot.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/mpc8544ds.dtb and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/mpc8544ds.dtb differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/multiboot.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/multiboot.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/openbios-ppc and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/openbios-ppc differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/openbios-sparc and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/openbios-sparc differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/openbios-sparc32 and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/openbios-sparc32 differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/openbios-sparc64 and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/openbios-sparc64 differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/palcode-clipper and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/palcode-clipper differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/petalogix-ml605.dtb and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/petalogix-ml605.dtb differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/petalogix-s3adsp1800.dtb and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/petalogix-s3adsp1800.dtb differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/ppc_rom.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/ppc_rom.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/pxe-e1000.rom and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/pxe-e1000.rom differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/pxe-eepro100.rom and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/pxe-eepro100.rom differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/pxe-ne2k_pci.rom and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/pxe-ne2k_pci.rom differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/pxe-pcnet.rom and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/pxe-pcnet.rom differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/pxe-rtl8139.rom and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/pxe-rtl8139.rom differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/pxe-virtio.rom and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/pxe-virtio.rom differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/s390-zipl.rom and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/s390-zipl.rom differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/sgabios.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/sgabios.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/slof.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/slof.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/spapr-rtas.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/spapr-rtas.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/vapic.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/vapic.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/vgabios.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/vgabios.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/vgabios-cirrus.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/vgabios-cirrus.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/vgabios-qxl.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/vgabios-qxl.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/vgabios-stdvga.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/vgabios-stdvga.bin differ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/pc-bios/vgabios-vmware.bin and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/pc-bios/vgabios-vmware.bin differ diff -Nru qemu-kvm-1.0+noroms/qemu-char.c qemu-kvm-1.0-usbredirect/qemu-char.c --- qemu-kvm-1.0+noroms/qemu-char.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/qemu-char.c 2012-01-02 14:43:47.000000000 +0000 @@ -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. + */ +static void char_write_unblocked(void *opaque) +{ + CharDriverState *chr = opaque; + + chr->write_blocked = false; + chr->chr_disable_write_fd_handler(chr); + chr->chr_write_unblocked(chr->handler_opaque); +} + void qemu_chr_be_event(CharDriverState *s, int event) { /* Keep track if the char device is open */ @@ -127,6 +140,9 @@ { CharDriverState *s = opaque; qemu_chr_be_event(s, CHR_EVENT_OPENED); + if (s->write_blocked) { + char_write_unblocked(s); + } qemu_bh_delete(s->bh); s->bh = NULL; } @@ -189,23 +205,38 @@ va_end(ap); } +static const QemuChrHandlers null_handlers = { + /* All handlers are initialised to NULL */ +}; + void qemu_chr_add_handlers(CharDriverState *s, - IOCanReadHandler *fd_can_read, - IOReadHandler *fd_read, - IOEventHandler *fd_event, - void *opaque) + const QemuChrHandlers *handlers, void *opaque) { - if (!opaque && !fd_can_read && !fd_read && !fd_event) { + if (!s) { + return; + } + if (!opaque && !handlers) { /* chr driver being released. */ ++s->avail_connections; } - s->chr_can_read = fd_can_read; - s->chr_read = fd_read; - s->chr_event = fd_event; + if (!handlers) { + if (s->write_blocked) { + /* Ensure we disable the callback if we were throttled */ + s->chr_disable_write_fd_handler(s); + /* s->write_blocked is cleared below */ + } + handlers = &null_handlers; + } + s->chr_can_read = handlers->fd_can_read; + s->chr_read = handlers->fd_read; + s->chr_write_unblocked = handlers->fd_write_unblocked; + s->chr_event = handlers->fd_event; 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) { @@ -441,6 +472,12 @@ 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, + .fd_event = mux_chr_event, +}; + static void mux_chr_update_read_handler(CharDriverState *chr) { MuxDriver *d = chr->opaque; @@ -455,8 +492,7 @@ d->chr_event[d->mux_cnt] = chr->chr_event; /* Fix up the real driver with mux routines */ if (d->mux_cnt == 0) { - qemu_chr_add_handlers(d->drv, mux_chr_can_read, mux_chr_read, - mux_chr_event, chr); + qemu_chr_add_handlers(d->drv, &mux_chr_handlers, chr); } if (d->focus != -1) { mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_OUT); @@ -492,7 +528,7 @@ #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; @@ -500,9 +536,14 @@ while (len > 0) { ret = send(fd, buf, len, 0); if (ret < 0) { + if (nonblock && len1 - len) { + return len1 - len; + } errno = WSAGetLastError(); if (errno != WSAEWOULDBLOCK) { return -1; + } else if (errno == WSAEWOULDBLOCK && nonblock) { + return WSAEWOULDBLOCK; } } else if (ret == 0) { break; @@ -516,7 +557,7 @@ #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; @@ -525,8 +566,15 @@ while (len > 0) { ret = write(fd, buf, len); if (ret < 0) { - if (errno != EINTR && errno != EAGAIN) + if (nonblock && len1 - len) { + return len1 - len; + } + if (errno == EAGAIN && nonblock) { + return -EAGAIN; + } + if (errno != EINTR && errno != EAGAIN) { return -1; + } } else if (ret == 0) { break; } else { @@ -541,6 +589,44 @@ #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; + bool nonblock; + + if (chr && chr->write_blocked) { + /* + * The caller should not send us data while we're blocked, + * but this can happen when multiple writers are woken at once, + * so simply return -EAGAIN. + */ + return -EAGAIN; + } + + nonblock = false; + /* + * Ensure the char backend is able to receive and handle the + * 'write unblocked' event before we turn on nonblock support. + */ + if (chr && chr->chr_enable_write_fd_handler && chr->chr_write_unblocked) { + nonblock = true; + } + ret = do_send(fd, _buf, len1, nonblock); + +#ifdef _WIN32 + eagain_errno = WSAEWOULDBLOCK; +#else + eagain_errno = -EAGAIN; +#endif + + if (nonblock && (ret == eagain_errno || (ret >= 0 && ret < len1))) { + /* Update fd handler to wake up when chr becomes writable */ + chr->chr_enable_write_fd_handler(chr); + chr->write_blocked = true; + } + return ret; +} + #ifndef _WIN32 typedef struct { @@ -552,7 +638,7 @@ 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) @@ -877,7 +963,7 @@ 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) @@ -2163,11 +2249,44 @@ static void tcp_chr_accept(void *opaque); +static void tcp_closed(void *opaque) +{ + CharDriverState *chr = opaque; + TCPCharDriver *s = chr->opaque; + + s->connected = 0; + if (s->listen_fd >= 0) { + qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr); + } + qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); + closesocket(s->fd); + s->fd = -1; + qemu_chr_be_event(chr, CHR_EVENT_CLOSED); +} + static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len) { TCPCharDriver *s = chr->opaque; + if (s->connected) { - return send_all(s->fd, buf, len); + int ret; + + ret = send_all(chr, s->fd, buf, len); + if (ret == -1 && errno == EPIPE) { + tcp_closed(chr); + + if (chr->chr_enable_write_fd_handler && chr->chr_write_unblocked) { + /* + * Since we haven't written out anything, let's say + * we're throttled. This will prevent any output from + * the guest getting lost if host-side chardev goes + * down. Unthrottle when we re-connect. + */ + chr->write_blocked = true; + return 0; + } + } + return ret; } else { /* XXX: indicate an error ? */ return len; @@ -2313,15 +2432,7 @@ len = s->max_size; size = tcp_chr_recv(chr, (void *)buf, len); if (size == 0) { - /* connection closed */ - s->connected = 0; - if (s->listen_fd >= 0) { - qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr); - } - qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); - closesocket(s->fd); - s->fd = -1; - qemu_chr_be_event(chr, CHR_EVENT_CLOSED); + tcp_closed(chr); } else if (size > 0) { if (s->do_telnetopt) tcp_chr_process_IAC_bytes(chr, s, buf, &size); @@ -2436,6 +2547,25 @@ qemu_chr_be_event(chr, CHR_EVENT_CLOSED); } +static void tcp_enable_write_fd_handler(CharDriverState *chr) +{ + TCPCharDriver *s = chr->opaque; + + /* + * This function is called only after tcp_chr_connect() is called + * (either in 'server' mode or client mode. So we're sure of + * s->fd being initialised. + */ + enable_write_fd_handler(s->fd, char_write_unblocked); +} + +static void tcp_disable_write_fd_handler(CharDriverState *chr) +{ + TCPCharDriver *s = chr->opaque; + + disable_write_fd_handler(s->fd); +} + static int qemu_chr_open_socket(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr = NULL; @@ -2492,6 +2622,8 @@ 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; diff -Nru qemu-kvm-1.0+noroms/qemu-char.h qemu-kvm-1.0-usbredirect/qemu-char.h --- qemu-kvm-1.0+noroms/qemu-char.h 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/qemu-char.h 2012-01-02 14:43:47.000000000 +0000 @@ -62,6 +62,9 @@ IOEventHandler *chr_event; IOCanReadHandler *chr_can_read; IOReadHandler *chr_read; + IOHandler *chr_write_unblocked; + void (*chr_enable_write_fd_handler)(struct CharDriverState *chr); + void (*chr_disable_write_fd_handler)(struct CharDriverState *chr); void *handler_opaque; void (*chr_close)(struct CharDriverState *chr); void (*chr_accept_input)(struct CharDriverState *chr); @@ -74,6 +77,7 @@ char *filename; int opened; int avail_connections; + bool write_blocked; /* Are we in a blocked state? */ QTAILQ_ENTRY(CharDriverState) next; }; @@ -222,10 +226,15 @@ */ void qemu_chr_be_event(CharDriverState *s, int event); -void qemu_chr_add_handlers(CharDriverState *s, - IOCanReadHandler *fd_can_read, - IOReadHandler *fd_read, - IOEventHandler *fd_event, + +typedef struct QemuChrHandlers { + IOCanReadHandler *fd_can_read; + IOReadHandler *fd_read; + IOHandler *fd_write_unblocked; + IOEventHandler *fd_event; +} QemuChrHandlers; + +void qemu_chr_add_handlers(CharDriverState *s, const QemuChrHandlers *handlers, void *opaque); void qemu_chr_generic_open(CharDriverState *s); diff -Nru qemu-kvm-1.0+noroms/qemu_socket.h qemu-kvm-1.0-usbredirect/qemu_socket.h --- qemu-kvm-1.0+noroms/qemu_socket.h 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/qemu_socket.h 2012-01-02 14:43:47.000000000 +0000 @@ -37,7 +37,7 @@ int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen); 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); diff -Nru qemu-kvm-1.0+noroms/spice-qemu-char.c qemu-kvm-1.0-usbredirect/spice-qemu-char.c --- qemu-kvm-1.0+noroms/spice-qemu-char.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/spice-qemu-char.c 2012-01-02 14:43:47.000000000 +0000 @@ -1,4 +1,6 @@ #include "config-host.h" +#include "qemu-common.h" +#include "qemu-timer.h" #include "trace.h" #include "ui/qemu-spice.h" #include @@ -21,10 +23,10 @@ SpiceCharDeviceInstance sin; char *subtype; bool active; - uint8_t *buffer; - uint8_t *datapos; - ssize_t bufsize, datalen; + const uint8_t *datapos; + int datalen; uint32_t debug; + QEMUTimer *unblock_timer; } SpiceCharDriver; static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len) @@ -50,20 +52,38 @@ return out; } +static void spice_chr_unblock(void *opaque) +{ + SpiceCharDriver *scd = opaque; + + if (scd->chr->chr_write_unblocked == NULL) { + dprintf(scd, 1, "%s: backend doesn't support unthrottling.\n", __func__); + return; + } + scd->chr->chr_write_unblocked(scd->chr->handler_opaque); +} + 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) { memcpy(buf, scd->datapos, bytes); scd->datapos += bytes; scd->datalen -= bytes; assert(scd->datalen >= 0); - if (scd->datalen == 0) { - scd->datapos = 0; - } + } + if (scd->datalen == 0 && scd->chr->write_blocked) { + dprintf(scd, 1, "%s: unthrottling (%d)\n", __func__, bytes); + scd->chr->write_blocked = false; + /* + * set a timer instead of calling scd->chr->chr_write_unblocked directly, + * because that will call back into spice_chr_write (see + * virtio-console.c:chr_write_unblocked), which is unwanted. + */ + qemu_mod_timer(scd->unblock_timer, 0); } trace_spice_vmc_read(bytes, len); return bytes; @@ -135,19 +155,23 @@ static int spice_chr_write(CharDriverState *chr, const uint8_t *buf, int len) { SpiceCharDriver *s = chr->opaque; + int read_bytes; dprintf(s, 2, "%s: %d\n", __func__, len); vmc_register_interface(s); assert(s->datalen == 0); - if (s->bufsize < len) { - s->bufsize = len; - s->buffer = g_realloc(s->buffer, s->bufsize); - } - memcpy(s->buffer, buf, len); - s->datapos = s->buffer; + s->datapos = buf; s->datalen = len; spice_server_char_device_wakeup(&s->sin); - return len; + read_bytes = len - s->datalen; + if (read_bytes != len) { + dprintf(s, 1, "%s: throttling: %d < %d\n", __func__, + read_bytes, len); + s->chr->write_blocked = true; + /* We'll get passed in the unconsumed data with the next call */ + s->datalen = 0; + } + return read_bytes; } static void spice_chr_close(struct CharDriverState *chr) @@ -225,6 +249,7 @@ 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() */ Binary files /tmp/6J4mBV5_r7/qemu-kvm-1.0+noroms/tests/pi_10.com and /tmp/eigmS2kV6C/qemu-kvm-1.0-usbredirect/tests/pi_10.com differ diff -Nru qemu-kvm-1.0+noroms/usb-redir.c qemu-kvm-1.0-usbredirect/usb-redir.c --- qemu-kvm-1.0+noroms/usb-redir.c 2011-12-04 10:38:06.000000000 +0000 +++ qemu-kvm-1.0-usbredirect/usb-redir.c 2012-01-02 14:43:47.000000000 +0000 @@ -60,7 +60,11 @@ uint8_t iso_error; /* For reporting iso errors to the HC */ uint8_t interrupt_started; uint8_t interrupt_error; + uint8_t bufpq_prefilled; + uint8_t bufpq_dropping_packets; QTAILQ_HEAD(, buf_packet) bufpq; + int bufpq_size; + int bufpq_target_size; }; struct USBRedirDevice { @@ -224,12 +228,22 @@ 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); + + if (r < 0) { + if (dev->cs->write_blocked) { + return 0; + } + return -1; + } + + return r; } /* @@ -287,21 +301,41 @@ } } -static struct buf_packet *bufp_alloc(USBRedirDevice *dev, +static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, int len, int status, uint8_t ep) { - struct buf_packet *bufp = g_malloc(sizeof(struct buf_packet)); + struct buf_packet *bufp; + + if (!dev->endpoint[EP2I(ep)].bufpq_dropping_packets && + dev->endpoint[EP2I(ep)].bufpq_size > + 2 * dev->endpoint[EP2I(ep)].bufpq_target_size) { + DPRINTF("bufpq overflow, dropping packets ep %02X\n", ep); + dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 1; + } + /* Since we're interupting the stream anyways, drop enough packets to get + back to our target buffer size */ + if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) { + if (dev->endpoint[EP2I(ep)].bufpq_size > + dev->endpoint[EP2I(ep)].bufpq_target_size) { + free(data); + return; + } + dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0; + } + + bufp = g_malloc(sizeof(struct buf_packet)); bufp->data = data; bufp->len = len; bufp->status = status; QTAILQ_INSERT_TAIL(&dev->endpoint[EP2I(ep)].bufpq, bufp, next); - return bufp; + dev->endpoint[EP2I(ep)].bufpq_size++; } static void bufp_free(USBRedirDevice *dev, struct buf_packet *bufp, uint8_t ep) { QTAILQ_REMOVE(&dev->endpoint[EP2I(ep)].bufpq, bufp, next); + dev->endpoint[EP2I(ep)].bufpq_size--; free(bufp->data); g_free(bufp); } @@ -332,35 +366,76 @@ uint8_t ep) { int status, len; - if (!dev->endpoint[EP2I(ep)].iso_started && !dev->endpoint[EP2I(ep)].iso_error) { struct usb_redir_start_iso_stream_header start_iso = { .endpoint = ep, - /* TODO maybe do something with these depending on ep interval? */ - .pkts_per_urb = 32, - .no_urbs = 3, }; + int pkts_per_sec; + + if (dev->dev.speed == USB_SPEED_HIGH) + pkts_per_sec = 8000 / dev->endpoint[EP2I(ep)].interval; + else + pkts_per_sec = 1000 / dev->endpoint[EP2I(ep)].interval; + /* Testing has shown that we need circa 60 ms buffer */ + dev->endpoint[EP2I(ep)].bufpq_target_size = (pkts_per_sec * 60) / 1000; + + /* Aim for approx 100 interrupts / second on the client to + balance latency and interrupt load */ + start_iso.pkts_per_urb = pkts_per_sec / 100; + if (start_iso.pkts_per_urb < 1) { + start_iso.pkts_per_urb = 1; + } else if (start_iso.pkts_per_urb > 32) { + start_iso.pkts_per_urb = 32; + } + + start_iso.no_urbs = (dev->endpoint[EP2I(ep)].bufpq_target_size + + start_iso.pkts_per_urb - 1) / + start_iso.pkts_per_urb; + /* Output endpoints pre-fill only 1/2 of the packets, keeping the rest + as overflow buffer. Also see the usbredir protocol documentation */ + if (!(ep & USB_DIR_IN)) { + start_iso.no_urbs *= 2; + } + if (start_iso.no_urbs > 16) { + start_iso.no_urbs = 16; + } + /* No id, we look at the ep when receiving a status back */ usbredirparser_send_start_iso_stream(dev->parser, 0, &start_iso); usbredirparser_do_write(dev->parser); - DPRINTF("iso stream started ep %02X\n", ep); + DPRINTF("iso stream started pkts/sec %d pkts/urb %d urbs %d ep %02X\n", + pkts_per_sec, start_iso.pkts_per_urb, start_iso.no_urbs, ep); dev->endpoint[EP2I(ep)].iso_started = 1; + dev->endpoint[EP2I(ep)].bufpq_prefilled = 0; + dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0; } if (ep & USB_DIR_IN) { struct buf_packet *isop; + if (dev->endpoint[EP2I(ep)].iso_started && + !dev->endpoint[EP2I(ep)].bufpq_prefilled) { + if (dev->endpoint[EP2I(ep)].bufpq_size < + dev->endpoint[EP2I(ep)].bufpq_target_size) { + return usbredir_handle_status(dev, 0, 0); + } + dev->endpoint[EP2I(ep)].bufpq_prefilled = 1; + } + isop = QTAILQ_FIRST(&dev->endpoint[EP2I(ep)].bufpq); if (isop == NULL) { - DPRINTF2("iso-token-in ep %02X, no isop\n", ep); + DPRINTF("iso-token-in ep %02X, no isop, iso_error: %d\n", + ep, dev->endpoint[EP2I(ep)].iso_error); + /* Re-fill the buffer */ + dev->endpoint[EP2I(ep)].bufpq_prefilled = 0; /* Check iso_error for stream errors, otherwise its an underrun */ status = dev->endpoint[EP2I(ep)].iso_error; dev->endpoint[EP2I(ep)].iso_error = 0; return usbredir_handle_status(dev, status, 0); } - DPRINTF2("iso-token-in ep %02X status %d len %d\n", ep, isop->status, - isop->len); + DPRINTF2("iso-token-in ep %02X status %d len %d queue-size: %d\n", ep, + isop->status, isop->len, dev->endpoint[EP2I(ep)].bufpq_size); status = isop->status; if (status != usb_redir_success) { @@ -370,7 +445,8 @@ len = isop->len; if (len > p->iov.size) { - ERROR("received iso data is larger then packet ep %02X\n", ep); + ERROR("received iso data is larger then packet ep %02X (%d > %d)\n", + ep, len, (int)p->iov.size); bufp_free(dev, isop, ep); return USB_RET_NAK; } @@ -410,6 +486,7 @@ DPRINTF("iso stream stopped ep %02X\n", ep); dev->endpoint[EP2I(ep)].iso_started = 0; } + dev->endpoint[EP2I(ep)].iso_error = 0; usbredir_free_bufpq(dev, ep); } @@ -460,6 +537,10 @@ usbredirparser_do_write(dev->parser); DPRINTF("interrupt recv started ep %02X\n", ep); dev->endpoint[EP2I(ep)].interrupt_started = 1; + /* We don't really want to drop interrupt packets ever, but + having some upper limit to how much we buffer is good. */ + dev->endpoint[EP2I(ep)].bufpq_target_size = 1000; + dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0; } intp = QTAILQ_FIRST(&dev->endpoint[EP2I(ep)].bufpq); @@ -522,6 +603,7 @@ DPRINTF("interrupt recv stopped ep %02X\n", ep); dev->endpoint[EP2I(ep)].interrupt_started = 0; } + dev->endpoint[EP2I(ep)].interrupt_error = 0; usbredir_free_bufpq(dev, ep); } @@ -793,6 +875,24 @@ } } +static void usbredir_chardev_write_unblocked(void *opaque) +{ + USBRedirDevice *dev = opaque; + + if (dev->parser == NULL) { + /* usbredir_open_close_bh hasn't handled the open event yet */ + return; + } + usbredirparser_do_write(dev->parser); +} + +static const QemuChrHandlers usbredir_chr_handlers = { + .fd_can_read = usbredir_chardev_can_read, + .fd_read = usbredir_chardev_read, + .fd_event = usbredir_chardev_event, + .fd_write_unblocked = usbredir_chardev_write_unblocked, +}; + /* * init + destroy */ @@ -820,8 +920,7 @@ /* 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; } @@ -959,9 +1058,24 @@ dev->endpoint[i].type = ep_info->type[i]; dev->endpoint[i].interval = ep_info->interval[i]; dev->endpoint[i].interface = ep_info->interface[i]; - if (dev->endpoint[i].type != usb_redir_type_invalid) { + switch (dev->endpoint[i].type) { + case usb_redir_type_invalid: + break; + case usb_redir_type_iso: + case usb_redir_type_interrupt: + if (dev->endpoint[i].interval == 0) { + ERROR("Received 0 interval for isoc or irq endpoint\n"); + usbredir_device_disconnect(dev); + } + /* Fall through */ + case usb_redir_type_control: + case usb_redir_type_bulk: DPRINTF("ep: %02X type: %d interface: %d\n", I2EP(i), dev->endpoint[i].type, dev->endpoint[i].interface); + break; + default: + ERROR("Received invalid endpoint type\n"); + usbredir_device_disconnect(dev); } } } @@ -1029,7 +1143,7 @@ DPRINTF("iso status %d ep %02X id %u\n", iso_stream_status->status, ep, id); - if (!dev->dev.attached) { + if (!dev->dev.attached || !dev->endpoint[EP2I(ep)].iso_started) { return; } @@ -1050,7 +1164,7 @@ DPRINTF("interrupt recv status %d ep %02X id %u\n", interrupt_receiving_status->status, ep, id); - if (!dev->dev.attached) { + if (!dev->dev.attached || !dev->endpoint[EP2I(ep)].interrupt_started) { return; }