Commit Graph

16920 Commits

Author SHA1 Message Date
Stefan Hajnoczi c5fbe57111 block: split out bdrv_co_do_readv() and bdrv_co_do_writev()
The public interface for I/O in coroutine context is bdrv_co_readv() and
bdrv_co_writev().  Split out the request processing code into
bdrv_co_do_readv() and bdrv_co_writev() so that it can be called
internally when we refactor all request processing to use coroutines.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-13 15:02:53 +02:00
Stefan Hajnoczi 1ed20acf2f block: directly invoke .bdrv_* from emulation functions
The emulation functions which supply default BlockDriver .bdrv_*()
functions given another implemented .bdrv_*() function should not use
public bdrv_*() interfaces.  This patch ensures they invoke .bdrv_*()
directly to avoid adding an extra layer of coroutine request processing
and possibly entering an infinite loop.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-13 15:02:53 +02:00
Stefan Hajnoczi a652d16025 block: directly invoke .bdrv_aio_*() in bdrv_co_io_em()
We will unify block layer request processing across sync, aio, and
coroutines and this means a .bdrv_co_*() emulation function should not
call back into the public interface.  There's no need here, just call
.bdrv_aio_*() directly.

The gory details: bdrv_co_io_em() cannot call back into the public
bdrv_aio_*() interface since that will be handled using coroutines,
which causes us to call into bdrv_co_io_em() again in an infinite loop
:).

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-13 15:02:27 +02:00
Gerd Hoffmann 80cf7cf74f usb-hub: don't trigger assert on packet completion.
Calling usb_packet_complete() recursively when passing up the completion
event up the chain for devices connected via usb hub will trigger an
assert.  So don't do that, make the usb hub emulation call the upstream
completion callback directly instead.

Based on a patch from Stefan Hajnoczi <stefanha@gmail.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-13 13:16:34 +02:00
Gerd Hoffmann 3a3286bf0b usb-hid: activate usb tablet / mouse after migration.
qemu uses the ps/2 mouse by default.  The usb tablet (or mouse) is
activated as soon as qemu sees some guest activity on the device,
i.e. polling for HID events.  That used to work fine for both fresh
boot and migration.

Remote wakeup support changed the picture though: There will be no
polling after migration in case the guest suspended the usb bus,
waiting for wakeup events.  Result is that the ps/2 mouse stays
active.

Fix this by activating the usb tablet / mouse in post_load() in case
the guest enabled remote wakeup.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-13 12:58:51 +02:00
Peter Maydell 905fb0342c hw/usb-ohci: Honour endpoint maximum packet size
Honour the maximum packet size for endpoints; this applies when
sending non-isochronous data and means we transfer only as
much as the endpoint allows, leaving the transfer descriptor
on the list for another go next time around. This allows
usb-net to work when connected to an OHCI controller model.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-13 12:58:51 +02:00
Peter Maydell 8d11b78c9a hw/usb-ohci: Fix OHCI_TD_T1 bit position definition
The OHCI Transfer Descriptor T (DataToggle) bits are 24 and 25;
fix an error which accidentally overlaid them both on the same bit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-13 12:58:51 +02:00
Gerd Hoffmann 0fcc3bfc0f usb-host: handle USBDEVFS_SETCONFIGURATION returning EBUSY
In case the host uses the usb device usbfs will refuse to set the
configuration due to the device being busy.  Handle this case by
disconnection the interfaces, then trying again.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-13 12:58:51 +02:00
Gerd Hoffmann e627472731 usb-host: factor out code
Move code to claim usb ports and to disconnect usb interfaces into
usb_host_claim_port and usb_host_disconnect_ifaces functions.  No
functional change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-13 12:58:51 +02:00
Gerd Hoffmann e0b8e72dd9 usb: fix port reset
commit 891fb2cd45 removed the implicit
detach before (re-)attaching in usb_attach().  Some usb host controllers
used that behavior though to do a port reset by a detach+attach
sequence.

This patch establishes old behavior by adding a new usb_reset() function
for port resets and putting it into use, thereby also unifying port
reset behavior of all host controllers.  The patch also adds asserts to
usb_attach() and usb_detach() to make sure the calls are symmetrical.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-13 12:58:51 +02:00
Gerd Hoffmann 3393bc105d usb-hub: need to check dev->attached
commit 891fb2cd45 did that for all host
controllers, the usb hub was left out by accident.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-13 12:58:51 +02:00
Gerd Hoffmann d3ac1a87b2 usb-storage: fix NULL pointer dereference.
When a usb packet is canceled we need to check whenever we actually have
a scsi request in flight before we try to cancel it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-13 12:58:51 +02:00
Aneesh Kumar K.V d3ab98e691 hw/9pfs: Add new virtfs option writeout=immediate skip host page cache
writeout=immediate implies the after pwritev we do a sync_file_range.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-12 19:11:23 +05:30
Aneesh Kumar K.V 5745e38afe hw/9pfs: Use ioeventfd for 9p
With ioeventfd:
[root@qemu-img-64 storage]# dd if=/dev/zero of=/storage/testx bs=8k count=131072 oflag=direct
131072+0 records in
131072+0 records out
1073741824 bytes (1.1 GB) copied, 26.767 s, 40.1 MB/s

Without:
[root@qemu-img-64 storage]# dd if=/dev/zero of=/storage/testx bs=8k count=131072 oflag=direct
131072+0 records in
131072+0 records out
1073741824 bytes (1.1 GB) copied, 65.3361 s, 16.4 MB/s

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-12 19:11:23 +05:30
Richard Henderson 0d95952453 isa: Remove isa_init_ioport_range and isa_init_ioport
All users have been converted to either isa_register_ioport
or isa_register_old_portio_list.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:11 +02:00
Richard Henderson 4a91d3b337 ide: Convert to isa_register_portio_list
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:11 +02:00
Richard Henderson f75317b420 vmport: Convert to isa_register_ioport
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:11 +02:00
Richard Henderson 23af670e53 pc: Convert port92 to isa_register_ioport
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:11 +02:00
Richard Henderson 0a039dc700 vga: Convert to isa_register_portio_list
[jan: fix cut'n'paste errors]
[avi: adjust pci variants not to use isa functions]

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:10 +02:00
Richard Henderson 42c1a22de7 sb16: Convert to isa_register_portio_list
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:10 +02:00
Richard Henderson 1922abd0a2 parallel: Convert to isa_register_portio_list
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:10 +02:00
Richard Henderson a502852030 ne2000: Convert to isa_register_ioport
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:10 +02:00
Richard Henderson b2c5009b45 rtc: Convert to isa_register_ioport
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:10 +02:00
Richard Henderson 9936d6e423 m48t59: Convert to isa_register_ioport
The sysbus interface is as yet unconverted.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:10 +02:00
Richard Henderson d7adb96f83 gus: Convert to isa_register_portio_list
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:10 +02:00
Richard Henderson 212ec7baa2 fdc: Convert to isa_register_portio_list
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:10 +02:00
Avi Kivity d750073472 isa: Add isa_register_portio_list()
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:09 +02:00
Jan Kiszka 03808f58e4 memory: Fix old portio word accesses
As we register old portio regions via ioport_register, we are also
responsible for providing the word access wrapper.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:09 +02:00
Avi Kivity 6bf9fd43cf Introduce PortioList
Add a type and methods for manipulating a list of disjoint I/O ports,
used in some older hardware devices.

Based on original patch by Richard Henderson.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-11 15:57:07 +02:00
Kevin Wolf 0d460d6f41 vvfat: Fix potential buffer overflow
path2[PATH_MAX] can be used for the null termination, so make the array big
enough to allow this.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:42:46 +02:00
Stefan Weil 7ef6d3dc39 block/vvfat: Remove unused code
The unused code was detected using cppcheck.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:42:45 +02:00
Stefan Weil ce137829e7 block/vvfat: Fix potential memory leaks and other memory errors
cppcheck reported memory leaks and mismatched g_malloc() with free()
instead of g_free().

Fix these errors.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:42:45 +02:00
Luiz Capitulino d2078cc238 HMP: Print 'io-status' information
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:42:45 +02:00
Luiz Capitulino f04ef60100 QMP: query-status: Add 'io-status' key
Contains the I/O status for the given device. The key is only present
if the device supports it and the VM is configured to stop on errors.

Please, check the documentation being added in this commit for more
information.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:42:45 +02:00
Luiz Capitulino 9fb118e6b3 scsi: Support I/O status
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:42:45 +02:00
Luiz Capitulino 50fb19008f ide: Support I/O status
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:42:39 +02:00
Luiz Capitulino af239a62c0 virtio: Support I/O status
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:42:29 +02:00
Luiz Capitulino 28a7282a5d block: Keep track of devices' I/O status
This commit adds support to the BlockDriverState type to keep track
of devices' I/O status.

There are three possible status: BDRV_IOS_OK (no error), BDRV_IOS_ENOSPC
(no space error) and BDRV_IOS_FAILED (any other error). The distinction
between no space and other errors is important because a management
application may want to watch for no space in order to extend the
space assigned to the VM and put it to run again.

Qemu devices supporting the I/O status feature have to enable it
explicitly by calling bdrv_iostatus_enable() _and_ have to be
configured to stop the VM on errors (ie. werror=stop|enospc or
rerror=stop).

In case of multiple errors being triggered in sequence only the first
one is stored. The I/O status is always reset to BDRV_IOS_OK when the
'cont' command is issued.

Next commits will add support to some devices and extend the
query-block/info block commands to return the I/O status information.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:41:47 +02:00
Kevin Wolf 449c184ed2 linux-aio: Fix laio_submit error handling
The error handling order was in the wrong order, so that either the ACB would
be leaked or the counter would be decremented when it shouldn't.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:41:47 +02:00
Christoph Hellwig 55b949c847 block: allow resizing of images residing on host devices
Allow to resize images that reside on host devices up to the available
space.  This allows to grow images after resizing the device manually or
vice versa.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-11 09:41:46 +02:00
Richard Henderson ebf47c24b0 isa: Tidy support code for isabus_get_fw_dev_path
The only user of ISADevice.ioports is isabus_get_fw_dev_path, and it
only looks at the first entry of the array.  Which suggests that this
entire array+sort operation can be replaced by a simple minimum.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Avi Kivity febbd7c29a ppc_newworld: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Peter Maydell 7d6e771f49 hw/versatile_pci: Expose multiple sysbus mmio regions
Clean up versatile_pci to expose the various PCI mmio regions
properly as separate mmio regions rather than as a single mmio
which uses callbacks to map and unmap everything.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Peter Maydell dd236a50aa hw/arm11mpcore: Clean up to avoid using sysbus_mmio_init_cb2
Clean up the initialisation of the realview_mpcore device to avoid
using sysbus_init_mmio_cb2(): we can pass through the MemoryRegion
of the private arm11mpcore_priv device directly now.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Avi Kivity a682fd5c29 ppc405_boards: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Avi Kivity 589f0aaddd petalogix_s2adsp1800: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Avi Kivity d7973c774c petalogix_ml605: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Avi Kivity ced52fa68e palm: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Peter Maydell f0cdd7a9a8 hw/lan9118.c: Convert to MemoryRegion
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-10 15:29:28 +02:00
Anthony Liguori ebffe2afce Merge remote-tracking branch 'qmp/queue/qmp' into staging 2011-10-10 08:21:46 -05:00