Commit graph

19813 commits

Author SHA1 Message Date
Stefan Weil 9b47b17e80 async: Use bool for boolean struct members and remove a hole
Using bool reduces the size of the structure and improves readability.
A hole in the structure was removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-05-01 10:13:25 +01:00
Stefan Weil 72b8b5a19a configure: Fix creation of symbolic links for MinGW toolchain
The MinGW toolchain on w32/w64 hosts does not create symbolic links,
but implements 'ln -s' similar to 'cp -r'.

In incremental out of tree builds, this resulted in files which
were not updated when their counterparts in the QEMU source tree
changed. Especially for Makefile* this happened very often.

With this patch, the 'symlinked' files are now always updated for
out of tree builds. Similar code was already used for the symbolic
link of libcacard/Makefile.

The symlink macro always removes the target before it is created
again, therefore the rm command for libcacard/Makefile was redundant
and is removed now.

Macro symlink is also used with directories. To remove them on w32
hosts, a recursive rm is needed.

v2:
Quote arguments in shell function symlink, and also quote any argument
which is passed to symlink and which contains macros. This should reduce
the chance of accidents caused by rm -rf.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-05-01 10:12:40 +01:00
Stefan Weil 42fe1c245f main-loop: Fix build for w32 and w64
This patch fixes a build regression with MinGW which was introduced by
commit 7c7db75576.

The 3rd argument of g_main_context_query must point to a gint value.
Using a pointer to an uint32_t value is wrong.

The timeout argument of function os_host_main_loop_wait was never
used for w32 / w64.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-28 09:25:54 +00:00
Andreas Färber 08de3949bd configure: Don't build bsd-user on Mac OS X by default
Fixes the build when combined with the drop of darwin-user.
Enthusiasts can still try building it using --enable-bsd-user.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Bernhard Walle <bernhard@bwalle.de>
Tested-by: Bernhard Walle <bernhard@bwalle.de> [Mac OS 10.7.3]
Acked-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-28 09:15:05 +00:00
Andreas Färber 94a49d86c5 softfloat: Replace int16 type with int_fast16_t
Based on the following Coccinelle patch:

@@
typedef int16, int_fast16_t;
@@
-int16
+int_fast16_t

Avoids a workaround for AIX.

Add typedef for pre-10 Solaris.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: malc <av1474@comtv.ru>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
Tested-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-28 09:13:26 +00:00
Andreas Färber 5aea4c589a softfloat: Replace uint16 type with uint_fast16_t
Based on the following Coccinelle patch:

@@
typedef uint16, uint_fast16_t;
@@
-uint16
+uint_fast16_t

Fixes the build of the Cocoa frontend on Mac OS X and avoids a
workaround for AIX.

For pre-10 Solaris include osdep.h.

Reported-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Reported-by: Rui Carmo <rui.carmo@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Juan Pineda <juan@logician.com>
Cc: malc <av1474@comtv.ru>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
Tested-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-28 09:13:09 +00:00
Andreas Färber dda3c2ee33 target-mips: Move definition of uint_fast{8, 16}_t to osdep.h
osdep.h is included via qemu-common.h.

Prepares for use of [u]int_fast*_t types in softfloat code.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
Cc: Aurélien Jarno <aurelien@aurel32.net>
Cc: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-28 09:12:38 +00:00
Andreas Färber c9696547d4 softfloat: Fix mixups of int and int16
normalizeFloat{32,64}Subnormal() expect the exponent as int16, not int.
This went unnoticed since int16 and uint16 were both typedef'ed to int.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-28 09:12:24 +00:00
Blue Swirl c4c50b9edd Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
* 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Make SETEND respect bswap_code (BE8) setting
  target-arm: Move A9 config_base_address reset value to ARMCPU
  target-arm: Change cpu_arm_init() return type to ARMCPU
2012-04-28 08:57:56 +00:00
Blue Swirl 2ff0f66851 Merge branch 'timer' of git://qemu.weilnetz.de/qemu
* 'timer' of git://qemu.weilnetz.de/qemu:
  qemu-timer: Optimize data structures
  qemu-timer: Remove function alarm_has_dynticks
  qemu-timer: Use bool, false, true for boolean values
  qemu-timer: Remove unused function qemu_alarm_pending
  qemu-timer: Remove redundant include statements
2012-04-28 08:19:50 +00:00
Anthony Liguori a8b69b8e24 Merge remote-tracking branch 'qmp/queue/qmp' into staging
* qmp/queue/qmp:
  qapi: fix qmp_balloon() conversion
  qemu-iotests: add block-stream speed value test case
  block: add 'speed' optional parameter to block-stream
  block: change block-job-set-speed argument from 'value' to 'speed'
  block: use Error mechanism instead of -errno for block_job_set_speed()
  block: use Error mechanism instead of -errno for block_job_create()
2012-04-27 12:00:06 -05:00
Luiz Capitulino b3c83a2265 qapi: fix qmp_balloon() conversion
Commit d72f326431 forgot to convert a call from qerror_report() to
error_set(). Fix it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-04-27 11:44:50 -03:00
Stefan Hajnoczi e425306a27 qemu-iotests: add block-stream speed value test case
Add tests to exercise the InvalidParameter 'speed' error code path, as
well as the regular success case for setting the speed.  The
block-stream 'speed' parameter allows the speed limit of the job to be
applied immediately when the job starts instead of issuing a separate
block-job-set-speed command later.  If the parameter has an invalid
value we expect to get an error and the job is not created.

It turns out that cancelling a block job is a common operation in these
test cases, let's extract a cancel_and_wait() function instead of
duplicating the QMP commands.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-04-27 11:44:50 -03:00
Stefan Hajnoczi c83c66c3b5 block: add 'speed' optional parameter to block-stream
Allow streaming operations to be started with an initial speed limit.
This eliminates the window of time between starting streaming and
issuing block-job-set-speed.  Users should use the new optional 'speed'
parameter instead so that speed limits are in effect immediately when
the job starts.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-04-27 11:44:50 -03:00
Stefan Hajnoczi 882ec7ce53 block: change block-job-set-speed argument from 'value' to 'speed'
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-04-27 11:44:50 -03:00
Stefan Hajnoczi 9e6636c72d block: use Error mechanism instead of -errno for block_job_set_speed()
There are at least two different errors that can occur in
block_job_set_speed(): the job might not support setting speeds or the
value might be invalid.

Use the Error mechanism to report the error where it occurs.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-04-27 11:44:50 -03:00
Stefan Hajnoczi fd7f8c6537 block: use Error mechanism instead of -errno for block_job_create()
The block job API uses -errno return values internally and we convert
these to Error in the QMP functions.  This is ugly because the Error
should be created at the point where we still have all the relevant
information.  More importantly, it is hard to add new error cases to
this case since we quickly run out of -errno values without losing
information.

Go ahead and use Error directly and don't convert later.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-04-27 11:44:50 -03:00
Peter Maydell 10962fd510 target-arm: Make SETEND respect bswap_code (BE8) setting
Make the SETEND instruction respect the setting of bswap_code,
so that in BE8 mode we UNDEF for attempts to switch into
little-endian mode and nop for attempts to stay in big-endian
mode. (This is the inverse of the existing handling of SETEND
in the more common little-endian setup, which we use since
we don't implement the architecturally-mandated dynamic
endianness switching.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-04-27 11:07:52 +00:00
Peter Maydell c5fad12fa0 target-arm: Move A9 config_base_address reset value to ARMCPU
Move the A9 config_base_address cp15 register reset value to
ARMCPU. This should become a QOM property so that the Highbank
board can set it without having to pull in cpu-qom.h, but at
least this avoids the implicit dependency on reset ordering
that the previous workaround had.

Cc: Mark Langsdorf <mark.langsdorf@calxeda.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-04-27 11:06:18 +00:00
Andreas Färber 778c3a0619 target-arm: Change cpu_arm_init() return type to ARMCPU
Make cpu_arm_init() return a QOM ARMCPU, so that we don't need to
obtain an ARMCPU through arm_env_get_cpu() in machine init code.
This requires to adjust the inclusion site of cpu-qom.h and in turn,
forward-looking, to homogenize its include order.

cpu_init() must still return a CPUARMState for backwards and
cross-target compatibility, so adjust the cpu_init macro.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-04-27 11:04:44 +00:00
Stefan Weil 9a14b298bb qemu-timer: Optimize data structures
Remove all holes which were found by pahole on Linux x86_64
(and replace "struct QEMUTimer" by "QEMUTimer").

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-04-27 07:39:39 +02:00
Stefan Weil 8205199d7b qemu-timer: Remove function alarm_has_dynticks
Some time ago, the last time which did not have dynticks was removed,
so now all timers have dynticks.

I also removed a misleading error message for the dynticks timer.
If timer_create fails, there is already an error message, and
QEMU will use the unix timer which also provides dynamic ticks,
therefore dynamic ticks are not disabled.

v2:
Remove two if statements because they were always true
(thanks to Paolo Bonzini for this correction).

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-04-27 07:39:39 +02:00
Stefan Weil 5e1ec7b267 qemu-timer: Use bool, false, true for boolean values
This avoids conversions between int and bool / char.

It also makes the code more readable.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-04-27 07:39:39 +02:00
Stefan Weil c4879f2a67 qemu-timer: Remove unused function qemu_alarm_pending
The last user of this function was removed by commit
12d4536f7d.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-04-27 07:39:39 +02:00
Stefan Weil bff9f8bfbe qemu-timer: Remove redundant include statements
qemu-timer.h includes qemu-common.h which already includes time.h,
sys/time.h, windows.h, unistd.h, fcntl.h, errno.h and signal.h.

Therefore those include statements are redundant and can be removed.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-04-27 07:39:39 +02:00
Anthony Liguori a75bfc5fdd Merge remote-tracking branch 'bonzini/nbd-next' into staging
* bonzini/nbd-next:
  nbd: Fix uninitialised use of s->sock
2012-04-26 15:22:07 -05:00
Anthony Liguori f5eef2cf66 Merge remote-tracking branch 'kraxel/usb.49' into staging
* kraxel/usb.49:
  usb-uhci: update irq line on reset
  usb: add serial number generator
  usb-redir: Not finding an async urb id is not an error
  usb-redir: Reset device address and speed on disconnect
  usb-redir: An interface count of 0 is a valid value
  usb-xhci: fix bit test
  usb-xhci: Use PCI DMA helper functions
  usb-host: fix zero-length packets
  usb-host: don't dereference invalid iovecs
  usb-storage: fix request canceling
  usb-ehci: Ensure frindex writes leave a valid frindex value
  usb-ehci: add missing usb_packet_init() call
  usb-ehci: remove hack
2012-04-26 15:21:52 -05:00
Anthony Liguori b1bbf76e70 Merge remote-tracking branch 'stefanha/tracing' into staging
* stefanha/tracing:
  Beautify makefile commands for generation of files with tracetool
  Generic elimination of auto-generated files
2012-04-26 15:21:01 -05:00
Anthony Liguori 0677e2777e Merge remote-tracking branch 'mst/tags/for_anthony' into staging
* mst/tags/for_anthony:
  e1000: set E1000_ICR_INT_ASSERTED only for 8257x
  e1000: link auto-negotiation emulation
  e1000: introduce bit for debugging PHY emulation
  e1000: introduce helpers to manipulate link status
  e1000: PHY loopback mode support
  e1000: conditionally raise irq at the end of MDI cycle
  e1000: introduce bits of PHY control register
  eepro100: Fix multicast regression
  virtio: order index/descriptor reads
  virtio: add missing mb() on enable notification
  virtio: add missing mb() on notification
  e1000: move reset function earlier in file
2012-04-26 15:20:33 -05:00
Anthony Liguori 1fa95c23fe Merge remote-tracking branch 'afaerber/qom-cpu-x86-prop.v3' into staging
* afaerber/qom-cpu-x86-prop.v3:
  target-i386: Introduce "tsc-frequency" property for X86CPU
  target-i386: Prepare "vendor" property for X86CPU
  target-i386: Introduce "xlevel" property for X86CPU
  target-i386: Introduce "level" property for X86CPU
  target-i386: Add property getter for CPU model-id
  target-i386: Add property getter for CPU stepping
  target-i386: Add property getter for CPU model
  target-i386: Add property getter for CPU family
  target-i386: Add "model-id" property to X86CPU
  target-i386: Add "stepping" property to X86CPU
  target-i386: Add "model" property to X86CPU
  target-i386: Add "family" property to X86CPU
  target-i386: Add range check for -cpu ,family=x
  target-i386: Pass X86CPU to cpu_x86_register()
  target-i386: Fix x86_cpuid_set_model_id()
2012-04-26 15:18:06 -05:00
Anthony Liguori d6a6922f3b Merge remote-tracking branch 'amit/master' into staging
* amit/master:
  virtio-serial-bus: Unset guest_connected at reset and driver reset
  virtio-serial-bus: fix guest_connected init before driver init
2012-04-26 15:16:24 -05:00
Anthony Liguori be5ea8ed44 Revert "configure: Virtfs doesn't require libcap."
This reverts commit d10f9056ba due to a build
breakage.

See http://spunk.home.kraxel.org/bb/builders/ubuntu-default/builds/52

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:58 -05:00
Nathan Whitehorn 15fdaee3c5 os-posix: Fix build on FreeBSD
Add an include for a header required to build on recent FreeBSD.

Signed-off-by: Nathan Whitehorn <nwhitehorn@freebsd.org>
Signed-off-by: Andreas Frber <andreas.faerber@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:58 -05:00
Stefano Stabellini 7c7db75576 main_loop_wait: block indefinitely
- remove qemu_calculate_timeout;

- explicitly size timeout to uint32_t;

- introduce slirp_update_timeout;

- pass NULL as timeout argument to select in case timeout is the maximum
value;

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Paul Brook <paul@codesourcery.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:58 -05:00
Stefano Stabellini 4ffd16fc29 qemu_next_alarm_deadline: check the expire time of a clock only if it is enabled
Also delta in qemu_next_alarm_deadline is a 64 bit value so set the
default to INT64_MAX instead of INT32_MAX.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:58 -05:00
Stefano Stabellini 5bfb723f07 timers: the rearm function should be able to handle delta = INT64_MAX
Fix win32_rearm_timer and mm_rearm_timer: they should be able to handle
INT64_MAX as a delta parameter without overflowing.
Also, the next deadline in ms should be calculated rounding down rather
than up (see unix_rearm_timer and dynticks_rearm_timer).

Finally ChangeTimerQueueTimer takes an unsigned long and timeSetEvent
takes an unsigned int as delta, so cast the ms delta to the appropriate
unsigned integer.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:57 -05:00
Andreas Färber 4ed5f5ea45 target-i386: Fix x86_cpuid_set_model_id()
Don't assume zeroed cpuid_model[] fields.

This didn't break anything yet but QOM properties should be able to set
the value to something else without setting an intermediate zero string.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:57 -05:00
Stefan Weil ea7697fcd6 qtest: Fix more format errors with qtest_sendf
After adding GCC_FMT_ATTR to qtest_sendf, more format errors are reported
by the compiler. These are fixed here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:57 -05:00
Stefan Weil 94b2629494 sdl: Add QEMU mascot icon for use with SDL
This is a bitmap file (32x32x4) derived from the official QEMU mascot
(which was designed by Benoît Canet). I stripped the text from the SVG
to get a nearly square image and converted the result to BMP without
any manual optimization.

The bitmap is currently used by QEMU's SDL interface and replaces the
default X icon.

v2: Add qemu-icon.bmp to Makefile.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:57 -05:00
Anthony Liguori 5ade767485 qom: quick and dirty QOM filesystem based on FUSE
Here's an example session:

anthony@titi:~/git/qemu/QMP$ QMP_SERVER=/tmp/server.sock ./qom-fuse tmp
anthony@titi:~/git/qemu/QMP$ ls tmp
machine  sysbus  type
anthony@titi:~/git/qemu/QMP$ ls tmp/machine
i440fx  peripheral  peripheral-anon  type  unattached
anthony@titi:~/git/qemu/QMP$ ls tmp/machine/i440fx
ioapic  parent_bus  pci.0  type
anthony@titi:~/git/qemu/QMP$ ls tmp/machine/i440fx/pci.0
child[0]  child[1]  child[2]  child[3]  child[4]  child[5]  type
anthony@titi:~/git/qemu/QMP$ ls tmp/machine/i440fx/pci.0/child[4]
addr                 legacy-addr                 multifunction  type
command_serr_enable  legacy-command_serr_enable  parent_bus
ide.0                legacy-multifunction        rombar
ide.1                legacy-romfile              romfile
anthony@titi:~/git/qemu/QMP$ cat tmp/machine/i440fx/pci.0/child[4]/type
piix3-ide
anthony@titi:~/git/qemu/QMP$ ls -al tmp/machine/i440fx/pci.0/child\[4\]/parent_bus
lrwxr-xr-x 2 anthony anthony 4096 1969-12-31 18:00 tmp/machine/i440fx/pci.0/child[4]/parent_bus -> ../../../machine/i440fx/pci.0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:57 -05:00
Anthony Liguori 1d38574fdf pc-sysfw: make sure to call qdev_init
We're not actually calling qdev_init for the pc-sysfw device.  Since we create
the canonical path during realize, this was causing an assert to trigger when
attempting to read a link pointing to pc-sysfw.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26 13:14:57 -05:00
Kevin Wolf b3adf53a3a nbd: Fix uninitialised use of s->sock
s->sock is assigned only afterwards, so we're really registering an
aio_fd_handler for file descriptor 0 here. Not exactly what we intended.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-04-26 17:54:22 +02:00
Gerd Hoffmann aba1f24283 usb-uhci: update irq line on reset
uhci_reset() clears irq mask and irq status registers, but doesn't
update the irq line.  Which may result in suspious IRQs after uhci
reset.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26 12:21:17 +02:00
Gerd Hoffmann 9d55d1adc8 usb: add serial number generator
This patch adds a function which creates unique serial numbers for usb
devices and puts it into use.  Windows guests tend to become unhappy if
they find two identical usb devices in the system.  Effects range from
non-functional devices (with yellow exclamation mark in device manager)
to BSODs.  Handing out unique serial numbers to devices fixes this.

With this patch applied almost all emulated devices get a generated,
unique serial number.  There are two exceptions:

 * usb-storage devices will prefer a user-specified serial number
   and will only get a generated number in case the serial property
   is unset.
 * usb-hid devices keep the fixed serial number "42" as it is used
   to signal "remote wakeup actually works".
   See commit 7b074a22da

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26 12:21:17 +02:00
Hans de Goede b15cf49b78 usb-redir: Not finding an async urb id is not an error
We clear our pending async urb list on device disconnect and we may still
receive "packet complete" packets from our peer after this, which will then
refer to packet ids no longer in our list.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26 12:21:17 +02:00
Hans de Goede a0625c56e0 usb-redir: Reset device address and speed on disconnect
Without this disconnected devices look like the last redirected device
in the monitor in "info usb".

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26 12:21:17 +02:00
Hans de Goede 1510168e27 usb-redir: An interface count of 0 is a valid value
An interface-count of 0 happens when a device is in unconfigured state when
it gets redirected. So we should not use 0 to detect not having received
interface info from our peer.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26 12:21:17 +02:00
Lai Jiangshan 215bff17ed usb-xhci: fix bit test
use & instead of the wrong &&

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26 12:21:16 +02:00
David Gibson 59a70ccd3b usb-xhci: Use PCI DMA helper functions
Shortly before 1.0, we added helper functions / wrappers for doing PCI DMA
from individual devices.  This makes what's going on clearer and means that
when we add IOMMU support somewhere in the future, only the general PCI
code will have to change, not every device that uses PCI DMA.

However, usb-xhci is not using these wrappers, despite being a PCI only
device.  This patch remedies the situation, using the pci dma functions
instead of direct calls to cpu_physical_memory_{read,write}().  Likewise
address parameters for DMA are changed to dma_addr_t instead of
target_phys_addr_t.

[ kraxel: removed #ifdefs ]

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26 12:21:16 +02:00
Gerd Hoffmann 0b377169b1 usb-host: fix zero-length packets
usb-host optimizes away zero-length packets by not entering the
processing loop at all.  Which isn't correct, we should submit a
zero-length urb to the host devicein that case.  This patch makes
sure we run the processing loop at least once.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26 12:21:16 +02:00