[Patch] Lower uhci timer freq when guest is idle.

UHCI emulation polls the device at a freq of 1000HZ, which consumes
25-30% CPU even though a Windows guest is completely idle.

This solution counts accumulated NAK packets. when it reaches to 64,
then the guest is supposed to be idle and the freq is lowered to 10HZ.

This patch has been tested on Win7/WinXP/F17 guests.
(cherry picked from commit 9c17c0efb81fee06ac177733df28fe5071dcaa7a)
(cherry picked from commit e681bed9c4b7fac16f6886353aa7d74cfc3ca2dd)
[Patch] qemu-clock: add an alarm timer based on timerfd

    timerfd is a new(ish) mechanism provided in the 2.6.25+ Linux kernels that
    allows for a high resolution event timer signaled through a file descriptor.
    This patch adds an alarm timer implementation using timerfd.

    timerfd has a couple advantages over dynticks.  Namely, it's fd based instead
    of signal based which reduces the likelihood of receiving EINTR failure codes.

    Because we can't process timers in a signal handler, we write to a pipe() and
    read that in the main loop.  timerfd allows us to avoid the extra write to a
    pipe.

    Finally, since timerfd is just a file descriptor, it could conceivably used to
    implement per-thread alarm timers.  It also would integrate very easily in a
    glib main loop.

    Unfortunately, there's a lot of Windows code in qemu-timer.c and main-loop.c
    right now otherwise the refactoring would be trivial.  I'll leave that for
    another day.

    Verified this fix on qemu 1.4 with Win7 guest, which will save about 3% CPU load!
(cherry picked from commit 90ab5af817b195cea1528ac90e20f4d003db9227)
(cherry picked from commit 19a3218ec96dfc86cf840409e21f5084425ecc1b)
[Patch] virtio-pci: pass real with_irqfd to virtio_pci_set_guest_notifier()

virtio_pci_set_guest_notifiers() checks whether irqfd can be used and
whether MSI-X is enabled for the PCI adapter.  But then it calls
virtio_pci_set_guest_notifier() and passes kvm_msi_via_irqfd_enabled()
instead of with_irqfd.

When MSI-X is disabled but irqfd is allowed this means that
guest_notifier has neither irqfd nor a
virtio_queue_guest_notifier_read() handler.  Therefore the guest cannot
receive notifications.

This issue is triggered by a Windows 7 Professional 64-bit guest with
-device virtio-blk-pci,x-data-plane=on.  The guest driver does not
enable MSI-X and the guest gets stuck at the Windows boot screen since
it does not receive notifications.
(cherry picked from commit 4fc48ca961f18b3ba9e4835a1e2f1cb993617e8f)
(cherry picked from commit a44cad80d572d968c1e1acfa7b16cbf74a7dc040)
[Patch] Fix against migration zero division segment fault
(cherry picked from commit e6e1d37946b81ced5d72296e2c6cadf6b8dd890e)
(cherry picked from commit 538497253fe3d05ca2b19a13a5dce5ba26806787)
[Patch] Intel-hda sound card emulation problem

    This patch fixed an intel-hda sound card emulation problem as follows:

    http://lists.gnu.org/archive/html/qemu-devel/2013-01/msg05453.html

    I found a bug that qemu doesn't support for setting master volume/mute when guest is winxp. but the wave volume in the volume control works fine.I don't know why it does.

    And then the reporter submitted the patch, but not accepted by qemu mainline.

    http://lists.gnu.org/archive/html/qemu-devel/2013-01/msg05452.html
(cherry picked from commit 7c7709bc932ebe3a1dcd7e56675d3eb191300f3e)
(cherry picked from commit adabb3d0e451d6e6ee2e0330e4c651d293ba4cac)
[live snapshot] initial support for live snapshot

1. apply recent iov patches to resolve savevm regression,
   which includes:

      migration: set f->is_write and flush in add_to_iovec
      migration: use a single I/O operation when writev_buffer is not defined
      migration: drop is_write complications
      migration: simplify writev vs. non-writev logic
      block: Introduce bdrv_writev_vmstate
      savevm: Implement block_writev_buffer()
      block: Introduce bdrv_pwritev() for qcow2_save_vmstate
      qemu-iotests: A few more bdrv_pread/pwrite test

2. temporarilly modify migration thread so not to stop vm
   after migration is completed, which requires further optimization to
   support both live migration and live snapshot.

3. snapshot a vm: migrate "exec:gzip -c > STATEFILE.gz"

4. restore a vm: <qemu-command-line> -incoming "exec: gzip -c -d STATEFILE.gz"

5. for more migration usage, see http://www.linux-kvm.org/page/Migration
(cherry picked from commit 062fffa37a0c204aaecb48bb6cdc26c388288a34)
(cherry picked from commit ade9befb1d28f176de70902070bcf36706da06c6)
(cherry picked from commit 3a4e6379588d48b005b8b4d78178c5cb97f7a0ca)
[live snapshot] snapshot backend image on the fly

This patch improves the previous commit with focuses on:

1. A migrate option is added to differenciate between exec and savevm.
   When savevm is used, vm will not be stopped.

   usage: migrate "savevm:gzip -c > STATEFILE.gz"

2. All backend images will be snapshotted on the fly.
(cherry picked from commit 02a35894a543593221400303e0e0734d43894879)
(cherry picked from commit a93be9a4af539a4841382296fbd2410361463874)
(cherry picked from commit 3eebafed03dc68f86b02f43026f16671912243a9)
[live snapshot] export bdrv_snapshot_find
(cherry picked from commit dd963b9218cfa323f27f8d946c65b2e84f3c3fe3)
(cherry picked from commit 11102db5313da0bba74e04ebbedeb5b2e39ba414)
(cherry picked from commit ecdd0ce1a948bd1d90689ce930fc3b3af67604a5)
[live snapshot] allow to accept snapshot name

Usage:

1. start a vm:
qemu-kvm -cpu host -enable-kvm -m 1024 -smp 2 -drive file=/root/vm/winxp/winxp.img,if=none,id=drive0,format=qcow2,cache=directsync -device virtio-blk-pci,scsi=off,drive=drive0,id=disk0 -boot c -monitor stdio

2. take a live snapshot
(qemu) migrate "savevm:snanpshot-1:gzip -c > snapshot-1.gz"

3. load a snapshot
./qemu-kvm -cpu host -enable-kvm -m 1024 -smp 2 -drive file=/root/vm/winxp/winxp.img,if=none,id=drive0,format=qcow2,cache=directsync -device virtio-blk-pci,scsi=off,drive=drive0,id=disk0 -boot c -monitor stdio -incoming "exec: gzip -c -d snapshot-1.gz"
(cherry picked from commit 814c0e543a21aba9751cd23287a50b13a8a2e6ea)
(cherry picked from commit 4fbb0bebd06f9923d997d6494cea986d7cc1d400)
(cherry picked from commit d9d270757beb46058386abf4d40c5b8ef8fe0923)
Packaging: update VERSION to 1.5.0
(cherry picked from commit 043a63f908fa72851138de961d4b725db68aa13f)