qemu-ga: add guest-suspend-hybrid

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qemu-ga: add win32 guest-suspend-disk command.

Implement guest-suspend-disk RPC for Windows. Functionally this should be
equivalent to the posix implementation.

Signed-off-by: Gal Hammer <ghammer@redhat.com>
qemu-ga: add win32 guest-suspend-ram command

S3 sleep implementation for windows.
qemu-ga: add guest-network-get-interfaces command

This command returns an array of:

 [ifname, hwaddr, [ipaddr, ipaddr_family, prefix] ]

for each interface in the system.
Currently, only IPv4 and IPv6 are supported.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
qemu-ga: add guest-sync-delimited

guest-sync leaves it as an exercise to the user as to how to reliably
obtain the response to guest-sync if the client had previously read in a
partial response (due qemu-ga previously being restarted mid-"sentence"
due to reboot, forced restart, etc).

qemu-ga handles this situation on its end by having a client precede
their guest-sync request with a 0xFF byte (invalid UTF-8), which
qemu-ga/QEMU JSON parsers will treat as a flush event. Thus we can
reliably flush the qemu-ga parser state in preparation for receiving
the guest-sync request.

guest-sync-delimited provides the same functionality for a client: when
a guest-sync-delimited is issued, qemu-ga will precede it's response
with a 0xFF byte that the client can use as an indicator to flush its
buffer/parser state in preparation for reliably receiving the
guest-sync-delimited response.

It is also useful as an optimization for clients, since, after issuing a
guest-sync-delimited, clients can safely discard all stale data read
from the channel until the 0xFF is found.

More information available on the wiki:

http://wiki.qemu.org/Features/QAPI/GuestAgent#QEMU_Guest_Agent_Protocol

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qapi-schema.json: fix comment for type ObjectPropretyInfo
  qapi-schema: fix typos and explain 'spice' auth
  qjson.h: include compiler.h for GCC_FMT_ATTR
Merge remote-tracking branch 'stefanha/tracing' into staging

* stefanha/tracing:
  vga: add trace event for ppm_save
  console: add some trace events
  maintainers: Add docs/tracing.txt to Tracing
  docs: correct ./configure line in tracing.txt
  trace: make trace_thread_create() use its function arg
  tracetool: Omit useless QEMU_*_ENABLED() check
  trace: Provide a per-event status define for conditional compilation
Merge remote-tracking branch 'qemu-kvm/memory/core' into staging

* qemu-kvm/memory/core:
  memory: get rid of cpu_register_io_memory()
  memory: dispatch directly via MemoryRegion
  exec: fix code tlb entry misused as iotlb in get_page_addr_code()
  memory: store section indices in iotlb instead of io indices
  memory: make phys_page_find() return an unadjusted section
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony:
  test-coroutine: add performance test for nesting
  coroutine: adding configure option for sigaltstack coroutine backend
  coroutine: adding configure choose mechanism for coroutine backend
  coroutine: adding sigaltstack method (.c source)
  qcow2: Reduce number of I/O requests
  qcow2: Add qcow2_alloc_clusters_at()
  qcow2: Factor out count_cow_clusters
  qmp: convert blockdev-snapshot-sync to a wrapper around transactions
  add mode field to blockdev-snapshot-sync transaction item
  rename blockdev-group-snapshot-sync
  qapi: complete implementation of unions
  use QSIMPLEQ_FOREACH_SAFE when freeing list elements
  Add 'make check-block'
  make check: Add qemu-iotests subset
  qemu-iotests: Mark some tests as quick
  qcow2: Add error messages in qcow2_truncate
  block: handle -EBUSY in bdrv_commit_all()
  qcow2: Add some tracing
  qed: do not evict in-use L2 table cache entries
  Group snapshot: Fix format name for backing file
Merge remote-tracking branch 'mdroth/qga-pull-3-12-2012' into staging

* mdroth/qga-pull-3-12-2012:
  qemu-ga: add guest-sync-delimited
  qemu-ga: add guest-network-get-interfaces command
  qemu-ga: add win32 guest-suspend-ram command
  qemu-ga: add win32 guest-suspend-disk command.
  qemu-ga: add guest-suspend-hybrid
  qemu-ga: add guest-suspend-ram
  qemu-ga: add guest-suspend-disk
usb: the big rename

Reorganize usb source files.  Create a new hw/usb/ directory and move
all usb source code to that place.  Also make filenames a bit more
descriptive.  Host adapters are prefixed with "hch-" now, usb device
emulations are prefixed with "dev-".  Fixup paths Makefile and include
paths to make it compile.  No code changes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: zap hw/ush-{ohic,uhci}.h + init wrappers

Remove the uhci and ohci init wrappers, which all wrapped a
pci_create_simple() one-liner.  Switch callsites to call
pci_create_simple directly.  Remove the header files where
the wrappers where declared.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-ehci: drop unused isoch_pause variable

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-ohci: DMA writeback bug fixes

This patch fixes two bugs in the OHCI device where the device writes
back data to system memory that should be exclusively under the
control of the guest side driver.

In OHCI specification Section 5.2.7, it mentioned "In all cases, Host
Controller Driver is responsible for the insertion and removal of all
Endpoint Descriptors in the various Host Controller Endpoint
Descriptor lists".  In the ohci_frame_boundary(), ohci_put_hcca()
writes the entire hcca back including the interrupt ED lists which
should be under driver control. This violates the specification and
can race with a host driver updating that list at the same time.

In the OHCI Spec Section 4.6, Transfer Descriptor Queue Processing, it
mentioned "Since the TD pointed to by TailP is not accessed by the HC,
the Host Controller Driver can initialize that TD and link at least
one other to it without creating a coherency or synchronization
problem".  While the function ohci_put_ed() writes the entire endpoint
descriptor back including the TailP which should under driver
control. This violate the specification and can race with a host
driver updating the TD list at the same time.

In each case the solution is to make sure we don't write data which is
under driver control.

Cc: Gerd Hoffman <kraxel@redhat.com>

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: improve packet state sanity checks

Add a new function to check whenever the packet state is as expected,
log more informations in case it isn't.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uhci: pass addr to uhci_async_alloc

Also do async->td initialization in uhci_async_alloc now.
Prepares for adding tracepoints.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uhci: fix uhci_async_cancel_all

It should also free all queues.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uhci: cancel on schedule stop.

Cancel any in-flight transaction when the guest stops the uhci schedule.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uhci: tracing support

Zap DPRINTF, add tracepoints instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uhci: use enum for uhci_handle_td return codes

Step #1 (separate for better bisectability): replace numbers with names.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>