Commit graph

14978 commits

Author SHA1 Message Date
Brad Hards 8e257816b0 usb: Add defines for USB Serial Bus Release Number register
Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:50 +02:00
Hans de Goede 290a5c60a3 usb-bus: Don't detach non attached devices on device exit
This causes an "Error: tried to detach unattached usb device " to be printed,
this can happen when deleting ie a usb host qdev, which did not
get attached (because a device matching the filter never got plugged in).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Hans de Goede 290d26d2e7 usb-bus: Add knowledge of USB_SPEED_SUPER to usb_speed helper
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Hans de Goede f8ddbfbcda usb-linux: Enlarge buffer for descriptors to 8192 bytes
1024 bytes is way to small, one hd UVC webcam I have over here has so
many resolutions its descriptors take op close to 4k. Hopefully 8k will
be enough for all devices.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Gerd Hoffmann e447fc6353 usb: don't call usb_host_device_open from vl.c
Not needed any more, usb-host is qdev-ified these days.
Well, at least the linux version ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Gerd Hoffmann 1f45a81bef usb-linux: only cleanup in host_close when host_open was successful. 2011-06-14 12:56:49 +02:00
Hans de Goede 97f8616648 usb-linux: Don't try to open the same device twice
If a user wants to redirect 2 identical usb sticks, in theory this is
possible by doing:
usb_add host🔢5678
usb_add host🔢5678

But this will lead to us trying to open the first stick twice, since we
don't break the loop after having found a match in our filter list, so the next'
filter list entry will result in us trying to open the same device again.

Fix this by adding the missing break.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Hans de Goede 130314f83d usb-linux: Ensure devep != 0
So that we don't index endp_table with a negative index.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Hans de Goede 61c1117f08 usb-linux: Don't do perror when errno is not set
Note that "op" also is not set, so before this change these error paths
would feed NULL to perror.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Hans de Goede f264cfbf4a usb-linux: Teach about super speed
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Hans de Goede 3991c35e85 usb-linux: Get speed from sysfs rather then from the connectinfo ioctl
The connectinfo ioctl only differentiates between lo speed devices, and
all other speeds, where as we would like to know the real speed. The real
speed is available in sysfs so use that when available.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Gerd Hoffmann f72e502e5f usb: documentation update
Add some more informations to docs/usb2.txt about using usb2 (also usb1)
devices.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Gerd Hoffmann 025b168ca6 usb-ehci: split trace calls to handle arg count limits
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Gerd Hoffmann e654887f38 usb-ehci: itd handling fixes.
This patch fixes a bunch of issues in the itd descriptor handling.
Most important fix is to handle transfers which cross page borders
correctly by looking up the address of the next page.  Luckily the
linux uses physically contigous memory so the data used to hits the
correct location even with this bug instead of corrupting guest
memory.  Also the transfer length updates for outgoing transfers wasn't
correct.

While being at it DPRINTFs have been replaced by tracepoints.

The isoch_pause logic has been disabled.  Not clear to me which propose
this serves and I think it is incorrect too as we just skip processing
itds.  Even when no xfer happens we have to clear the active bit.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Kevin O'Connor 69bf405b50 The USB tablet should not claim boot protocol support.
The USB tablet advertises that it supports the "boot" protocol.
However, its reports aren't "boot" protocol compatible.  So, it
shouldn't claim that.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Kevin O'Connor 46115ac4c4 Fix USB mouse Set_Protocol behavior
The QEMU USB mouse claims to support the "boot" protocol
(bInterfaceSubClass is 1).  However, the mouse rejects the
Set_Protocol command.

The qemu mouse does support the "boot" protocol specification, so a
simple fix is to enable the Set_Protocol request.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Gerd Hoffmann d05393071a usb-ehci: drop EXECUTING checks.
The state machine doesn't stop in EXECUTING state any more when async
packets are in flight, so the checks are not needed any more and can
be dropped.

Also kick out the check for the frame timer.  As we don't stop & sleep
any more on async packets this is obsolete.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Gerd Hoffmann 07771f6fce usb: cancel async packets on unplug
This patch adds USBBusOps struct with (for now) only a single callback
which is called when a device is about to be destroyed.  The USB Host
adapters are implementing this callback and use it to cancel any async
requests which might be in flight before the device actually goes away.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:49 +02:00
Hans de Goede 8e4faf3de9 ehci: fix a number of unused-but-set-variable warnings (new with gcc-4.6)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:48 +02:00
Gerd Hoffmann d2bd525fbb usb-ehci: fix error handling.
Set the correct bits for nodev, stall and babble errors.
Raise errint irq.  Fix state transition from WRITEBACK
to the next state.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:48 +02:00
Gerd Hoffmann ba7cb5a86a usb-ehci: fix offset writeback in ehci_buffer_rw
Two bugs at once:

First the mask is backwards, so the it used to keeps the offset and
clears the page address, which is not what we need when we update the
offset.

Second the offset calculation is wrong in case head isn't page aligned.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:48 +02:00
Gerd Hoffmann 8ac6d699c4 usb-ehci: multiqueue support
This patch adds support for keeping multiple queues going at the same
time.  One slow device will not affect other devices any more.

The patch adds code to manage EHCIQueue structs.  It also does a number
of changes to the state machine:

 * The state machine will never ever stop in EXECUTING any more.
   Instead it will continue with the next queue (aka HORIZONTALQH) when
   the usb device returns USB_RET_ASYNC.
 * The state machine will stop processing when it figures it walks in
   circles (easy to figure now that we have a EHCIQueue struct for each
   QH we've processed).  The bailout logic should not be needed any
   more.  For now it is still in, but will assert() in case it triggers.
 * The state machine will just skip queues with a async USBPacket in
   flight.
 * The state machine will resume processing as soon as the async
   USBPacket is finished.

The patch also takes care to flush the QH struct back to guest memory
when needed, so we don't get stale data when (re-)loading it from guest
memory in FETCHQH state.

It also makes the writeback code to not touch the first three dwords of
the QH struct as the EHCI must not write them.  This actually fixes a
bug where QH chaining changes (next ptr) by the linux ehci driver where
overwritten by the emulated EHCI.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:56:40 +02:00
Gerd Hoffmann 0122f47279 usb-ehci: add queue data struct
Add EHCIQueue struct, move the fields needed to track the queue state
into that struct.  Pass the new struct instead of ehci state down to
functions which handle the queue state.  Lot of variable references have
changed due to that without an actual functional change.

Replace fetch_addr with two variables, one for async and one for
periodic schedule.  Add functions to get and set the fetch address.

Use EHCIQueue->usb_status (old name: EHCIState->exec_status) directly in
ehci_execute_complete instead of passing around the status using a
parameters and the return value.

ehci_state_fetchqh returns a EHCIQueue struct now.

No change in behavior.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:36:29 +02:00
Gerd Hoffmann f2c88dc10e usb-ehci: trace buffer copy
Add a trace point for buffer copies and drop the DPRINTF's.

No change in behavior.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:36:29 +02:00
Gerd Hoffmann c4f8e21165 usb-ehci: improve mmio tracing
Add a separate tracepoint to log how register values change in response
to a mmio write.  Especially useful for registers which have read-only
or clear-on-write bits in them.

No change in behavior.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:36:28 +02:00
Gerd Hoffmann dcbd0b5c0e usb-ehci: trace port state
Trace usb port operations (attach, detach, reset),
drop a few obsolete DPRINTF's.

No change in behavior.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:36:28 +02:00
Gerd Hoffmann 26d53979db usb-ehci: trace state machine changes
Add functions to get and set the current state of the state machine,
add tracepoints there to trace state transitions.  Add support for
traceing the queue heads and transfer descriptors as we look at them.

Drop a few DPRINTFs and all DPRINTF_ST lines, they are obsolete now.

No change in behavior.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:36:28 +02:00
Gerd Hoffmann 439a97ccab usb-ehci: trace mmio and usbsts
This patch starts adding trace support to ehci.  It traces
updates of the status register (USBSTS), mmio access and
controller reset.

It also adds functions to set and clear status register bits
and puts them in use everywhere.

Some DPRINTF's are dropped in favor of the new tracepoints.

No change in behavior.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:36:28 +02:00
Gerd Hoffmann 41c01ee715 usb-linux: catch ENODEV in more places.
Factor out disconnect code (called when a device disappears) to a
separate function.  Add a check for ENODEV errno to a few more places
to make sure we notice disconnects.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-06-14 12:36:28 +02:00
Peter Maydell 0b862cedf3 configure: Detect and don't try to use older libcurl
Older versions of libcurl don't have some of the features we try to
use, in particular curl_multi_setopt(). Check for this in the 'is
libcurl available?' configure test so we disable curl support if the
library is too old.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-06-13 21:16:27 +02:00
Peter Maydell 5f04e36882 Changelog: Add explanatory note that this file is no longer updated
Add an explanatory note to the top of Changelog pointing at the
wiki and git history for changelogs for more recent releases.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-06-13 21:16:27 +02:00
Brad Hards caef55ed14 doc: Minor typo fix.
Thanks to agraf_, stefanha and Snader_LB for their IRC assistance.

Thanks to Markus Armbruster and Alexander Graf (again) for their
assistance with the second version of this patch. No patch is too
simple to test...

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-06-10 23:25:36 +02:00
Alexander Graf 09716e45a0 sigfd: use pthread_sigmask
Qemu uses signalfd to figure out, if a signal occured without the need
to actually receive the signal. Instead, it can read from the fd to receive
its news.

Now, we obviously don't always have signalfd around. Especially not on
non-Linux systems. So what we do there is that we create a new thread,
block that thread on all signals and simply call sigwait to wait for a
signal we're interested in to occur.

This all sounds great, but what we're really doing is:

    sigset_t all;

    sigfillset(&all);
    sigprocmask(SIG_BLOCK, &all, NULL);

which - on Darwin - blocks all signals on the current _process_, not only
on the current thread. To block signals on the thread, we can use
pthread_sigmask().

This patch does that, assuming that my above analysis is correct, and thus
renders Qemu useable on Darwin again.

Reported-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: Paolo Bonizni <pbonzini@redhat.com>
CC: Jan Kiszka <jan.kiszka@siemens.com>
CC: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-06-10 23:18:19 +02:00
Edgar E. Iglesias 448293961f Merge remote branch 'rth/axp-next' into alpha-merge
* rth/axp-next: (26 commits)
  target-alpha: Implement TLB flush primitives.
  target-alpha: Use a fixed frequency for the RPCC in system mode.
  target-alpha: Trap for unassigned and unaligned addresses.
  target-alpha: Remap PIO space for 43-bit KSEG for EV6.
  target-alpha: Implement cpu_alpha_handle_mmu_fault for system mode.
  target-alpha: Implement more CALL_PAL values inline.
  target-alpha: Disable interrupts properly.
  target-alpha: All ISA checks to use TB->FLAGS.
  target-alpha: Swap shadow registers moving to/from PALmode.
  target-alpha: Implement do_interrupt for system mode.
  target-alpha: Add IPRs to be used by the emulation PALcode.
  target-alpha: Use kernel mmu_idx for pal_mode.
  target-alpha: Add various symbolic constants.
  target-alpha: Use do_restore_state for arithmetic exceptions.
  target-alpha: Tidy up arithmetic exceptions.
  target-alpha: Tidy exception constants.
  target-alpha: Enable the alpha-softmmu target.
  target-alpha: Rationalize internal processor registers.
  target-alpha: Merge HW_REI and HW_RET implementations.
  target-alpha: Cleanup MMU modes.
  ...
2011-06-10 22:21:14 +02:00
Edgar E. Iglesias 1c532d92ab fsdev: Fix archs that dont use fsdev
Fix provided by: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-06-10 15:29:11 +02:00
Anthony Liguori 924f766af9 Merge remote-tracking branch 'qmp/for-anthony' into staging 2011-06-08 12:16:24 -05:00
Anthony Liguori 93e0597ef9 Merge remote-tracking branch 'jvrao/for-anthony' into staging 2011-06-08 12:15:43 -05:00
Anthony Liguori ac779fe233 Merge remote-tracking branch 'spice/spice.v37' into staging
Conflicts:
	vl.c
2011-06-08 12:15:11 -05:00
Anthony Liguori 13748cf499 Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-06-08 12:13:58 -05:00
Kevin Wolf 99cce9fa4e qemu-img create: Fix displayed default cluster size
When not specifying a cluster size on the command line, qemu-img printed
a cluster size of 0:

    Formatting '/tmp/test.qcow2', fmt=qcow2 size=67108864
    encryption=off cluster_size=0

This patch adds the default cluster size to the QEMUOptionParameter list, so
that it displays the default value that is used.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 11:56:40 +02:00
Kevin Wolf d220894e02 bdrv_img_create: Fix segfault
Block drivers that don't support creating images don't have a size option. Fail
gracefully instead of segfaulting when trying to access the option's value.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 11:56:40 +02:00
Kevin Wolf 80fa3341a7 qcow2: Fix memory leaks in error cases
This fixes memory leaks that may be caused by I/O errors during L1 table growth
(can happen during save_vm) and in qemu-img check.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 11:56:40 +02:00
Josh Durgin 30cdc48cc8 rbd: Add bdrv_truncate implementation
Reviewed-by: Christian Brunner <chb@muc.de>
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 11:56:40 +02:00
Josh Durgin 51a135287a rbd: check return values when scheduling aio
If scheduling fails, the number of outstanding I/Os must be correct,
or there will be a hang when waiting for everything to be flushed.

Reviewed-by: Christian Brunner <chb@muc.de>
Reported-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 11:56:40 +02:00
Josh Durgin fab5cf592c rbd: allow configuration of rados from the rbd filename
The new format is rbd:pool/image[@snapshot][:option1=value1[:option2=value2...]]
Each option is used to configure rados, and may be any Ceph option, or "conf".
The "conf" option specifies a Ceph configuration file to read.

This allows rbd volumes from more than one Ceph cluster to be used by
specifying different monitor addresses, as well as having different
logging levels or locations for different volumes.

Reviewed-by: Christian Brunner <chb@muc.de>
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 11:56:40 +02:00
Josh Durgin ad32e9c003 rbd: use the higher level librbd instead of just librados
librbd stacks on top of librados to provide access
to rbd images.

Using librbd simplifies the qemu code, and allows
qemu to use new versions of the rbd format
with few (if any) changes.

Reviewed-by: Christian Brunner <chb@muc.de>
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 11:56:39 +02:00
Christoph Egger d1f6fd8d14 block/raw-posix: get right partition size
use the correct way to get the size of a disk device or partition

From: Adam Hamsik <haad@netbsd.org>
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 11:56:39 +02:00
Christoph Egger 1de1ae0a7d block/raw-posix: use a character device if a block device is given
On NetBSD a userland process is better with the character device
interface. In addition, a block device can't be opened twice; if a Xen
backend opens it, qemu can't and vice-versa.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 10:39:32 +02:00
Alexander Graf 16372ff03d vmdk: fix endianness bugs
The vmdk code is sloppy when handling the header descriptor during
creation of an image. Fix all header accesses in the create path to
either store native endianness or convert it when appropriate.

Reported-by: Yury Tsarev <ytsarev@novell.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 10:39:32 +02:00
Christoph Hellwig a659979328 block: clarify the meaning of BDRV_O_NOCACHE
Change BDRV_O_NOCACHE to only imply bypassing the host OS file cache,
but no writeback semantics.  All existing callers are changed to also
specify BDRV_O_CACHE_WB to give them writeback semantics.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08 10:39:32 +02:00