]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agoupdate VERSION for v1.2.1 v1.2.1
Michael Roth [Fri, 12 Oct 2012 02:46:55 +0000 (21:46 -0500)]
update VERSION for v1.2.1

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agopseries: Don't test for MSR_PR for hypercalls under KVM
David Gibson [Tue, 25 Sep 2012 17:12:20 +0000 (17:12 +0000)]
pseries: Don't test for MSR_PR for hypercalls under KVM

PAPR hypercalls should only be invoked from the guest kernel, not guest
user programs, that is, with MSR[PR]=0.  Currently we check this in
spapr_hypercall, returning H_PRIVILEGE if MSR[PR]=1.

However, under KVM the state of MSR[PR] is already checked by the host
kernel before passing the hypercall to qemu, making this check redundant.
Worse, however, we don't generally synchronize KVM and qemu state on the
hypercall path, meaning that qemu could incorrectly reject a hypercall
because it has a stale MSR value.

This patch fixes the problem by moving the privilege test exclusively to
the TCG hypercall path.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
CC: qemu-stable@nongnu.org
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit efcb9383b974114e5f682e531346006f8f2466c0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agofpu/softfloat.c: Return correctly signed values from uint64_to_float32
Peter Maydell [Fri, 28 Sep 2012 15:17:03 +0000 (16:17 +0100)]
fpu/softfloat.c: Return correctly signed values from uint64_to_float32

The uint64_to_float32() conversion function was incorrectly always
returning numbers with the sign bit set (ie negative numbers). Correct
this so we return positive numbers instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit e744c06fca438dc08271e626034e632a270c91c8)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoi386: kvm: bit 10 of CPUID[8000_0001].EDX is reserved
Eduardo Habkost [Thu, 6 Sep 2012 10:05:35 +0000 (10:05 +0000)]
i386: kvm: bit 10 of CPUID[8000_0001].EDX is reserved

Bit 10 of CPUID[8000_0001].EDX is not defined as an alias of
CPUID[1].EDX[10], so do not duplicate it on
kvm_arch_get_supported_cpuid().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit b1f4679392a03f2b26a37bfa52e95d6cc4f73d82)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoVersatile Express: Fix NOR flash 0 address and remove flash alias
Francesco Lavra [Wed, 19 Sep 2012 05:51:58 +0000 (05:51 +0000)]
Versatile Express: Fix NOR flash 0 address and remove flash alias

In the A series memory map (implemented in the Cortex A15 CoreTile), the
first NOR flash bank (flash 0) is mapped to address 0x08000000, while
address 0x00000000 can be configured as alias to either the first or the
second flash bank. This patch fixes the definition of flash 0 address,
and for simplicity removes the alias definition.

Signed-off-by: Francesco Lavra <francescolavra.fl@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 661bafb3e14bfffcb0a7c7910534c7944608ca45)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agohw/armv7m_nvic: Correctly register GIC region when setting up NVIC
Meador Inge [Wed, 26 Sep 2012 15:46:28 +0000 (16:46 +0100)]
hw/armv7m_nvic: Correctly register GIC region when setting up NVIC

When setting up the NVIC memory regions the memory range
0x100..0xcff is aliased to an IO memory region that belongs
to the ARM GIC.  This aliased region should be added to the
NVIC memory container, but the actual GIC IO memory region
was being added instead.  This mixup was causing the wrong
IO memory access functions to be called when accessing parts
of the NVIC memory.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 9892cae39562d2e6c00ccc5966302c00f23be6d4)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agopl190: fix read of VECTADDR
Brendan Fennell [Wed, 26 Sep 2012 15:46:28 +0000 (16:46 +0100)]
pl190: fix read of VECTADDR

Reading VECTADDR was causing us to set the current priority to
the wrong value, the most obvious effect of which was that we
would return the vector for the wrong interrupt as the result
of the read.

Signed-off-by: Brendan Fennell <bfennell@skynet.ie>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 14c126baf1c38607c5bd988878de85a06cefd8cf)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoClear handler only for valid fd
Orit Wasserman [Mon, 24 Sep 2012 11:11:10 +0000 (13:11 +0200)]
Clear handler only for valid fd

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 3202becaa2b805497ce9e6faa6edfb83665f91b1)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoFix address handling in inet_nonblocking_connect
Orit Wasserman [Mon, 24 Sep 2012 11:11:09 +0000 (13:11 +0200)]
Fix address handling in inet_nonblocking_connect

getaddrinfo can give us a list of addresses, but we only try to
connect to the first one. If that fails we never proceed to
the next one.  This is common on desktop setups that often have ipv6
configured but not actually working.

To fix this make inet_connect_nonblocking retry connection with a different
address.
callers on inet_nonblocking_connect register a callback function that will
be called when connect opertion completes, in case of failure the fd will have
a negative value

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 233aa5c2d1cf4655ffe335025a68cf5454f87dad)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoSeparate inet_connect into inet_connect (blocking) and inet_nonblocking_connect
Orit Wasserman [Mon, 24 Sep 2012 11:11:08 +0000 (13:11 +0200)]
Separate inet_connect into inet_connect (blocking) and inet_nonblocking_connect

No need to add non blocking parameters to the blocking inet_connect
add block parameter for inet_connect_opts instead of using QemuOpt "block".

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 5db5f44cb4b7f24b9e0efdefc9015e36b7c34881)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoRefactor inet_connect_opts function
Michael S. Tsirkin [Mon, 24 Sep 2012 11:11:07 +0000 (13:11 +0200)]
Refactor inet_connect_opts function

refactor address resolution code to fix nonblocking connect
remove getnameinfo call

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 05bc1d8a4b2f77df8cc9880a552047e30c16f1f8)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoconfigure: Allow builds without any system or user emulation
Stefan Weil [Fri, 14 Sep 2012 17:02:30 +0000 (19:02 +0200)]
configure: Allow builds without any system or user emulation

The old code aborted configure when no emulation target was selected.
Even after removing the 'exit 1', it tried to read from STDIN
when QEMU was configured with

    configure' '--disable-user' '--disable-system'

This is fixed here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 8bdd3d499fe0ddffa9901c56ab3bc8911d5b8be0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoblock: correctly set the keep_read_only flag
Jeff Cody [Thu, 20 Sep 2012 19:13:17 +0000 (15:13 -0400)]
block: correctly set the keep_read_only flag

I believe the bs->keep_read_only flag is supposed to reflect
the initial open state of the device. If the device is initially
opened R/O, then commit operations, or reopen operations changing
to R/W, are prohibited.

Currently, the keep_read_only flag is only accurate for the active
layer, and its backing file. Subsequent images end up always having
the keep_read_only flag set.

For instance, what happens now:

[  base  ]  kro = 1, ro = 1
    |
    v
[ snap-1 ]  kro = 1, ro = 1
    |
    v
[ snap-2 ]  kro = 0, ro = 1
    |
    v
[ active ]  kro = 0, ro = 0

What we want:

[  base  ]  kro = 0, ro = 1
    |
    v
[ snap-1 ]  kro = 0, ro = 1
    |
    v
[ snap-2 ]  kro = 0, ro = 1
    |
    v
[ active ]  kro = 0, ro = 0

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit be028adcedd68ca4d78fdc43e7e2fa4f1cdbc653)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoblockdev: preserve readonly and snapshot states across media changes
Kevin Shanahan [Thu, 20 Sep 2012 23:20:22 +0000 (08:50 +0930)]
blockdev: preserve readonly and snapshot states across media changes

If readonly=on is given at device creation time, the ->readonly flag
needs to be set in the block driver state for this device so that
readonly-ness is preserved across media changes (qmp change command).
Similarly, to preserve the snapshot property requires ->open_flags to
be correct.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 80dd1aae3657a902d262f5d20a7a3c655b23705e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agow32: Add implementation of gmtime_r, localtime_r
Stefan Weil [Sat, 22 Sep 2012 20:26:19 +0000 (22:26 +0200)]
w32: Add implementation of gmtime_r, localtime_r

Those functions are missing in MinGW.

Some versions of MinGW-w64 include defines for gmtime_r and localtime_r.
Older versions of these macros are buggy (they return a pointer to a
static variable), therefore we don't want them. Newer versions are
similar to the code used here, but without the memset.

The implementation which is used here is not strictly reentrant,
but sufficiently good for QEMU on w32 or w64.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
[blauwirbel@gmail.com: added comment about locking]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit d3e8f95753114a827f9cd8e819b1d5cc8333f76b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agow32: Always use standard instead of native format strings
Stefan Weil [Wed, 22 Aug 2012 19:42:32 +0000 (21:42 +0200)]
w32: Always use standard instead of native format strings

GLib 2.0 include files use __printf__ for the format attribute
which resolves to native format strings on w32 hosts.

QEMU wants standard format strings instead of native format
strings, so we simply change any declaration with __printf__
to use __gnu_printf__.

This works because all basic printf functions support both
kinds of format strings.

This fixes a compiler warning:

qapi/string-output-visitor.c: In function ‘print_type_int’:
qapi/string-output-visitor.c:34:5: warning: unknown conversion type character ‘l’ in format [-Wformat]
qapi/string-output-visitor.c:34:5: warning: too many arguments for format [-Wformat-extra-args]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 95df51a4a02a853af8828c281bce2d4f2a41d6fd)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet/socket: Fix compiler warning (regression for MinGW)
Stefan Weil [Sat, 22 Sep 2012 19:13:28 +0000 (21:13 +0200)]
net/socket: Fix compiler warning (regression for MinGW)

Commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf removed a type cast
which is needed for MinGW:

net/socket.c:136: warning:
 pointer targets in passing argument 2 of ‘sendto’ differ in signedness
/usr/lib/gcc/amd64-mingw32msvc/4.4.4/../../../../amd64-mingw32msvc/include/winsock2.h:1313: note:
 expected ‘const char *’ but argument is of type ‘const uint8_t *’

Add a 'qemu_sendto' macro which provides that type cast where needed
and use the new macro instead of 'sendto'.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 73062dfe6be0050dbd43ce3516e935ebb2545add)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agolinux-user: Remove redundant null check and replace free by g_free
Stefan Weil [Tue, 4 Sep 2012 20:14:19 +0000 (22:14 +0200)]
linux-user: Remove redundant null check and replace free by g_free

Report from smatch:

linux-user/syscall.c:3632 do_ioctl_dm(220) info:
 redundant null check on big_buf calling free()

'big_buf' was allocated by g_malloc0, therefore free was also
replaced by g_free.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit ad11ad77748bdd8016370db210751683dc038dd6)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoTextConsole: saturate escape parameter in TTY_STATE_CSI
Laszlo Ersek [Mon, 17 Sep 2012 09:10:03 +0000 (11:10 +0200)]
TextConsole: saturate escape parameter in TTY_STATE_CSI

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit c10600af60865ba6c60987be313102ebb5fcee57)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agocurses: don't initialize curses when qemu is daemonized
Hitoshi Mitake [Fri, 14 Sep 2012 16:15:41 +0000 (01:15 +0900)]
curses: don't initialize curses when qemu is daemonized

Current qemu initializes curses even if -daemonize option is
passed. This cause problem because shell prompt appears without
calling endwin().

This patch adds new function, is_daemonized(), to OS dependent
code. With this function, curses_display_init() can check that qemu is
daemonized or not. If daemonized, curses_display_init() isn't called
and the problem is avoided.

Of course, -daemonize && -curses doesn't make sense. Users shouldn't
pass the arguments at the same time. But the problem is very painful
because Ctrl-C cannot be delivered to the terminal.

Cc: Andrzej Zaborowski <balrog@zabor.org>
Cc: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Hitoshi Mitake <h.mitake@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 995ee2bf469de6bbe5ce133ec853392b2a4ce34c)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agopflash_cfi01: Fix warning caused by unreachable code
Stefan Weil [Sat, 1 Sep 2012 11:00:48 +0000 (13:00 +0200)]
pflash_cfi01: Fix warning caused by unreachable code

Report from smatch:
hw/pflash_cfi01.c:431 pflash_write(180) info: ignoring unreachable code.

Instead of removing the return statement after the switch statement,
the patch replaces the return statements in the switch statement by
break statements. Other switch statements in the same code do it also
like that.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 12dabc79f976d66755025272f7e2e8e4da31715a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoioh3420: Remove unreachable code
Stefan Weil [Sat, 1 Sep 2012 10:56:03 +0000 (12:56 +0200)]
ioh3420: Remove unreachable code

Report from smatch:
hw/ioh3420.c:128 ioh3420_initfn(35) info: ignoring unreachable code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 997f15672a5ca7714cf310d92f475d2c5fe40970)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agolm4549: Fix buffer overflow
Stefan Weil [Sat, 1 Sep 2012 10:43:41 +0000 (12:43 +0200)]
lm4549: Fix buffer overflow

Report from smatch:
lm4549.c:234 lm4549_write_samples(14) error:
 buffer overflow 's->buffer' 1024 <= 1024

There must be enough space to add two entries starting with index
s->buffer_level, therefore the old check was wrong.

[Peter Maydell <peter.maydell@linaro.org> clarifies the nature of the
analyser warning:

I don't object to making the change to placate the analyser,
but I don't think this is actually a buffer overrun. We always
add and remove samples from the buffer two at a time, so it's
not possible to get here with s->buffer_level == BUFFER_SIZE-1
(which is the only case where the old and new conditions
give different answers).]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 8139626643cbe8dc07bd9acc88057effeedf8064)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agocadence_uart: Fix buffer overflow
Stefan Weil [Sat, 1 Sep 2012 09:12:23 +0000 (11:12 +0200)]
cadence_uart: Fix buffer overflow

Report from smatch:
hw/cadence_uart.c:413 uart_read(13) error: buffer overflow 's->r' 18 <= 18

This fixes read access to s->r[R_MAX] which is behind the limits of s->r.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 5d40097fc09fe5d34cf316a411dc27d455ac2cd0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-sockets: Fix potential memory leak
Stefan Weil [Sat, 1 Sep 2012 07:40:26 +0000 (09:40 +0200)]
qemu-sockets: Fix potential memory leak

The old code leaks variable 'peer'.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 39b384591fda27d6e1213cea0b11b1ebe0ed4b74)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-ga: Remove unreachable code after g_error
Stefan Weil [Sat, 1 Sep 2012 07:34:15 +0000 (09:34 +0200)]
qemu-ga: Remove unreachable code after g_error

Report from smatch:
qemu-ga.c:117 register_signal_handlers(11) info: ignoring unreachable code.
qemu-ga.c:122 register_signal_handlers(16) info: ignoring unreachable code.

g_error calls abort which terminates the program.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit b548828862d3bf7214b7ef9cb361356b153b89c9)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoaudio: Fix warning from static code analysis
Stefan Weil [Mon, 3 Sep 2012 09:25:16 +0000 (09:25 +0000)]
audio: Fix warning from static code analysis

smatch report:
audio/audio_template.h:416 AUD_open_out(18) warn:
 variable dereferenced before check 'as' (see line 414)

Moving the ldebug statement after the statement which checks 'as'
fixes that warning.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit 93b6599734f81328ee3d608f57667742cafeea72)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoSCSI: Standard INQUIRY data should report HiSup flag as set.
Ronnie Sahlberg [Sat, 15 Sep 2012 01:13:29 +0000 (18:13 -0700)]
SCSI: Standard INQUIRY data should report HiSup flag as set.

QEMU as far as I know only reports LUN numbers using the modes that
are described in SAM4.
As such, since all LUN numbers generated by the SCSI emulation in QEMU
follow SAM4, we should set the HiSup bit in the standard INQUIRY data
to indicate such.

From SAM4:
  4.6.3 LUNs overview
  All LUN formats described in this standard are hierarchical in
  structure even when only a single level in that hierarchy is used.
  The HISUP bit shall be set to one in the standard INQUIRY data
  (see SPC-4) when any LUN format described in this standard is used.
  Non-hierarchical formats are outside the scope of this standard.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
(cherry picked from commit 1109c894052751df99962c009fd7dbae397721f5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoscsi-disk: fix check for out-of-range LBA
Paolo Bonzini [Wed, 5 Sep 2012 15:54:36 +0000 (17:54 +0200)]
scsi-disk: fix check for out-of-range LBA

This fix is needed to correctly handle 0-block read and writes.
Without it, a 0-block access at LBA 0 would underflow.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 12ca76fc48081b3a0ad1a70546abfcf198aedfc4)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoscsi-disk: introduce check_lba_range
Paolo Bonzini [Wed, 5 Sep 2012 15:46:18 +0000 (17:46 +0200)]
scsi-disk: introduce check_lba_range

Abstract the test for an out-of-range (starting block, block count)
pair.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 444bc908611ccaf4512dc37c33ac3b54d873a62b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoiSCSI: We dont need to explicitely call qemu_notify_event() any more
Ronnie Sahlberg [Thu, 30 Aug 2012 23:56:36 +0000 (16:56 -0700)]
iSCSI: We dont need to explicitely call qemu_notify_event() any more

We no longer need to explicitely call qemu_notify_event() any more
since this is now done automatically any time the filehandles we listen
to change.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 40a13ca8d28c21062e35b10d9b80e76b92405bdf)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoiSCSI: We need to support SG_IO also from iscsi_ioctl()
Ronnie Sahlberg [Fri, 31 Aug 2012 00:28:40 +0000 (17:28 -0700)]
iSCSI: We need to support SG_IO also from iscsi_ioctl()

We need to support SG_IO from the synchronous iscsi_ioctl() since
scsi-block uses this to do an INQ to the device to discover its properties
This patch makes scsi-block work with iscsi.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit f1a12821d7df2e4d21be4f2206f84b4640533e53)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoMAINTAINERS: Add entry for QOM CPU
Andreas Färber [Mon, 17 Sep 2012 17:10:32 +0000 (19:10 +0200)]
MAINTAINERS: Add entry for QOM CPU

Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit f2ca052414d7eddc10517e98a5a27ba8099b19b1)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agopflash_cfi01: fix vendor specific extended query
Aurelien Jarno [Mon, 3 Sep 2012 20:47:03 +0000 (22:47 +0200)]
pflash_cfi01: fix vendor specific extended query

pflash_cfi01 announces a version number of 1.1, which implies
"Protection Register Information" and "Burst Read information"
sections, which are not provided.

Decrease the version number to 1.0 so that only the "Protection
Register Information" section is needed.

Set the number of protection fields (0x3f) to 0x01, as 0x00 means 256
protections field, which makes the CFI table bigger than the current
implementation, causing some kernels to fail to read it.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 262e1eaafabf32d33a9fa0b03b3c8ea426c5ae1b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoxilinx_timer: Fix a compile error if debug enabled
Chris Wulff [Mon, 10 Sep 2012 00:20:07 +0000 (20:20 -0400)]
xilinx_timer: Fix a compile error if debug enabled

There was a missing include of qemu-log and a variable name in a printf was out
of date.

Signed-off-by: Chris Wulff <crwulff@gmail.com>
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
(cherry picked from commit 8354cd722e0afae63bee3e4cb21c8f0ddb6874c2)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoxilinx.h: Error check when setting links
Peter A. G. Crosthwaite [Mon, 17 Sep 2012 03:41:39 +0000 (13:41 +1000)]
xilinx.h: Error check when setting links

Assert that the ethernet and dma controller are sucessfully linked to their
peers.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
(cherry picked from commit 4b5e52101f9ad077d1c016f2b7130e2fdae6d2da)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoxilinx_timer: Send dbg msgs to stderr not stdout
Peter A. G. Crosthwaite [Thu, 28 Jun 2012 06:28:03 +0000 (16:28 +1000)]
xilinx_timer: Send dbg msgs to stderr not stdout

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
(cherry picked from commit e03377ae75808d33d0a7afc803b37bcda9f796b3)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoxilinx_timer: Removed comma in device name
Peter A. G. Crosthwaite [Thu, 28 Jun 2012 02:52:23 +0000 (12:52 +1000)]
xilinx_timer: Removed comma in device name

Fixes an error in a61e4b07a30c062260d2d01771773f14820d1eb7

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
(cherry picked from commit c0a1dcb9f0baf9269f8baeb02cbcca8dad75454c)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoarch_init.c: Improve '-soundhw help' for non-HAS_AUDIO_CHOICE archs
Peter Maydell [Wed, 19 Sep 2012 13:51:38 +0000 (14:51 +0100)]
arch_init.c: Improve '-soundhw help' for non-HAS_AUDIO_CHOICE archs

For architectures which don't set HAS_AUDIO_CHOICE, improve the
'-soundhw help' message so that it doesn't simply print an empty
list, implying no sound support at all.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit 55d4fd3c24bd253bd96270c7fdf1bb862f3a3400)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agocpu_physical_memory_write_rom() needs to do TB invalidates
David Gibson [Mon, 10 Sep 2012 02:30:57 +0000 (12:30 +1000)]
cpu_physical_memory_write_rom() needs to do TB invalidates

cpu_physical_memory_write_rom(), despite the name, can also be used to
write images into RAM - and will often be used that way if the machine
uses load_image_targphys() into RAM addresses.

However, cpu_physical_memory_write_rom(), unlike cpu_physical_memory_rw()
doesn't invalidate any cached TBs which might be affected by the region
written.

This was breaking reset (under full emu) on the pseries machine - we loaded
our firmware image into RAM, and while executing it rewrite the code at
the entry point (correctly causing a TB invalidate/refresh).  When we
reset the firmware image was reloaded, but the TB from the rewrite was
still active and caused us to get an illegal instruction trap.

This patch fixes the bug by duplicating the tb invalidate code from
cpu_physical_memory_rw() in cpu_physical_memory_write_rom().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 0b57e287138728f72d88b06e69b970c5d745c44a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqemu-char: BUGFIX, don't call FD_ISSET with negative fd
David Gibson [Mon, 10 Sep 2012 02:30:56 +0000 (12:30 +1000)]
qemu-char: BUGFIX, don't call FD_ISSET with negative fd

tcp_chr_connect(), unlike for example udp_chr_update_read_handler() does
not check if the fd it is using is valid (>= 0) before passing it to
qemu_set_fd_handler2().  If using e.g. a TCP serial port, which is not
initially connected, this can result in -1 being passed to FD_ISSET, which
has undefined behaviour.  On x86 it seems to harmlessly return 0, but on
PowerPC, it causes a fortify buffer overflow error to be thrown.

This patch fixes this by putting an extra test in tcp_chr_connect(), and
also adds an assert qemu_set_fd_handler2() to catch other such errors on
all platforms, rather than just some.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit bbdd2ad0814ea0911076419ea21b7957505cf1cc)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoRevert 455aa1e08 and c3767ed0eb
Anthony Liguori [Wed, 12 Sep 2012 19:34:07 +0000 (14:34 -0500)]
Revert 455aa1e08 and c3767ed0eb

    commit c3767ed0eb5d0bb25fe409ae5dec06e3411ff1b6
    qemu-char: (Re-)connect for tcp_chr_write() unconnected writing

Has no hope of working because tcp_chr_connect() does not actually connect.

455aa1e08 just fixes the SEGV with server() but the attempt to connect a client
socket is still completely broken.

This patch reverts both.

Reported-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 6db0fdce02d72546a4c47100a9b2cd0090cf464d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoconfigure: properly check if -lrt and -lm is needed
Natanael Copa [Wed, 12 Sep 2012 09:06:51 +0000 (09:06 +0000)]
configure: properly check if -lrt and -lm is needed

Fixes build against uClibc.

uClibc provides 2 versions of clock_gettime(), one with realtime
support and one without (this is so you can avoid linking in -lrt
unless actually needed). This means that the clock_gettime() don't
need -lrt. We still need it for timer_create() so we check for this
function in addition.

We also need check if -lm is needed for isnan().

Both -lm and -lrt are needed for libs_qga.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit 8bacde8d86a09699207d85d4bab06162aed18dc4)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoconfigure: fix seccomp check
Yann E. MORIN [Thu, 6 Sep 2012 20:40:30 +0000 (22:40 +0200)]
configure: fix seccomp check

Currently, if libseccomp is missing but the user explicitly requested
seccomp support using --enable-seccomp, configure silently ignores the
situation and disables seccomp support.

This is unlike all other tests that explicitly fail in such situation.

Fix that.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit e84d5956cc6215d2f098e7b6090fc5ec4cba1be3)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: EAGAIN handling for net/socket.c TCP
Stefan Hajnoczi [Mon, 20 Aug 2012 09:14:35 +0000 (10:14 +0100)]
net: EAGAIN handling for net/socket.c TCP

Replace spinning send_all() with a proper non-blocking send.  When the
socket write buffer limit is reached, we should stop trying to send and
wait for the socket to become writable again.

Non-blocking TCP sockets can return in two different ways when the write
buffer limit is reached:

1. ret = -1 and errno = EAGAIN/EWOULDBLOCK.  No data has been written.

2. ret < total_size.  Short write, only part of the message was
   transmitted.

Handle both cases and keep track of how many bytes have been written in
s->send_index.  (This includes the 'length' header before the actual
payload buffer.)

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 45a7f54a8bb3928ffa58d522e0d61acaee8277bb)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: EAGAIN handling for net/socket.c UDP
Stefan Hajnoczi [Mon, 20 Aug 2012 09:28:53 +0000 (10:28 +0100)]
net: EAGAIN handling for net/socket.c UDP

Implement asynchronous send for UDP (or other SOCK_DGRAM) sockets.  If
send fails with EAGAIN we wait for the socket to become writable again.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: asynchronous send/receive infrastructure for net/socket.c
Stefan Hajnoczi [Mon, 20 Aug 2012 09:21:54 +0000 (10:21 +0100)]
net: asynchronous send/receive infrastructure for net/socket.c

The net/socket.c net client is not truly asynchronous.  This patch
borrows the qemu_set_fd_handler2() code from net/tap.c as the basis for
proper asynchronous send/receive.

Only read packets from the socket when the peer is able to receive.
This avoids needless queuing.

Later patches implement asynchronous send.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 863f678fba4191f3b695620f41056cb7c124425d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: broadcast hub packets if at least one port can receive
Stefan Hajnoczi [Fri, 24 Aug 2012 12:50:30 +0000 (13:50 +0100)]
net: broadcast hub packets if at least one port can receive

In commit 60c07d933c66c4b30a83b7ccbc8a0cb3df1b2d0e ("net: fix
qemu_can_send_packet logic") the "VLAN" broadcast behavior was changed
to queue packets if any net client cannot receive.  It turns out that
this was not actually the right fix and just hides the real bug that
hw/usb/dev-network.c:usbnet_receive() clobbers its receive buffer when
called multiple times in a row.  The commit also introduced a new bug
that "VLAN" packets would not be sent if one of multiple net clients was
down.

The hw/usb/dev-network.c bug has since been fixed, so this patch reverts
broadcast behavior to send packets as long as one net client can
receive.  Packets simply get queued for the net clients that are
temporarily unable to receive.

Reported-by: Roy.Li <rongqing.li@windriver.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 61518a74ca98870e8ff132f91dd5dda252e31f58)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: fix usbnet_receive() packet drops
Stefan Hajnoczi [Fri, 24 Aug 2012 12:37:29 +0000 (13:37 +0100)]
net: fix usbnet_receive() packet drops

The USB network interface has a single buffer which the guest reads
from.  This patch prevents multiple calls to usbnet_receive() from
clobbering the input buffer.  Instead we queue packets until buffer
space becomes available again.

This is inspired by virtio-net and e1000 rxbuf handling.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 190563f9a90c9df8ad32fc7f3e4b166deda949a6)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: clean up usbnet_receive()
Stefan Hajnoczi [Fri, 24 Aug 2012 12:32:16 +0000 (13:32 +0100)]
net: clean up usbnet_receive()

The USB network interface has two code paths depending on whether or not
RNDIS mode is enabled.  Refactor usbnet_receive() so that there is a
common path throughout the function instead of duplicating everything
across if (is_rndis(s)) ... else ... code paths.

Clean up coding style and 80 character line wrap along the way.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit f237ddbb89142c6948a2257c459e49dee7500a7c)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: add -netdev options to man page
Stefan Hajnoczi [Tue, 14 Aug 2012 13:14:27 +0000 (14:14 +0100)]
net: add -netdev options to man page

Document the -netdev syntax which supercedes the older -net syntax.
This patch is a first step to making -netdev prominent in the QEMU
manual.

Reported-by: Anatoly Techtonik <techtonik@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 08d12022c7f1aba6acccc75150659c6e4c9dff23)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: do not report queued packets as sent
Stefan Hajnoczi [Mon, 20 Aug 2012 12:35:23 +0000 (13:35 +0100)]
net: do not report queued packets as sent

Net send functions have a return value where 0 means the packet has not
been sent and will be queued.  A non-zero value means the packet was
sent or an error caused the packet to be dropped.

This patch fixes two instances where packets are queued but we return
their size.  This causes callers to believe the packets were sent.  When
the caller uses the async send interface this creates a real problem
because the callback will be invoked for a packet that the caller
believed to be already sent.  This bug can cause double-frees in the
caller.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 06b5f36d052b540a59b52150582d65674199b2ce)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: add receive_disabled logic to iov delivery path
Stefan Hajnoczi [Fri, 17 Aug 2012 20:16:42 +0000 (21:16 +0100)]
net: add receive_disabled logic to iov delivery path

This patch adds the missing NetClient->receive_disabled logic in the
sendv delivery code path.  It seems that commit
893379efd0e1b84ceb0c42a713293f3dbd27b1bd ("net: disable receiving if
client returns zero") only added the logic to qemu_deliver_packet() and
not qemu_deliver_packet_iov().

The receive_disabled flag should be automatically set when .receive(),
.receive_raw(), or .receive_iov() return 0.  No further packets will be
delivered to the NetClient until the receive_disabled flag is cleared
again by calling qemu_flush_queued_packets().

Typically the NetClient will wait until its file descriptor becomes
writable and then invoke qemu_flush_queued_packets() to resume
transmission.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit c67f5dc10573687497f0f5c3aec19b15c35c63d7)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoeepro100: Fix network hang when rx buffers run out
Bo Yang [Wed, 29 Aug 2012 11:26:11 +0000 (19:26 +0800)]
eepro100: Fix network hang when rx buffers run out

This is reported by QA. When installing os with pxe, after the initial
kernel and initrd are loaded, the procedure tries to copy files from install
server to local harddisk, the network becomes stall because of running out of
receive descriptor.

[Whitespace fixes and removed qemu_notify_event() because Paolo's
earlier net patches have moved it into qemu_flush_queued_packets().

Additional info:

I can reproduce the network hang with a tap device doing a iPXE HTTP
boot as follows:

  $ qemu -enable-kvm -m 1024 \
    -netdev tap,id=netdev0,script=no,downscript=no \
    -device i82559er,netdev=netdev0,romfile=80861209.rom \
    -drive if=virtio,cache=none,file=test.img
  iPXE> ifopen net0
  iPXE> config # set static network configuration
  iPXE> kernel http://mirror.bytemark.co.uk/fedora/linux/releases/17/Fedora/x86_64/os/images/pxeboot/vmlinuz

I needed a vanilla iPXE ROM to get to the iPXE prompt.  I think the boot
prompt has been disabled in the ROMs that ship with QEMU to reduce boot
time.

During the vmlinuz HTTP download there is a network hang.  hw/eepro100.c
has reached the end of the rx descriptor list.  When the iPXE driver
replenishes the rx descriptor list we don't kick the QEMU net subsystem
and event loop, thereby leaving the tap netdev without its file
descriptor in select(2).

Stefan Hajnoczi <stefanha@gmail.com>]

Signed-off-by: Bo Yang <boyang@suse.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 1069985fb132cd4324fc02d371f1e61492a1823f)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoxen: flush queue when getting an event
Paolo Bonzini [Thu, 9 Aug 2012 14:45:57 +0000 (16:45 +0200)]
xen: flush queue when getting an event

xen does not have a register that, when written, will cause can_receive
to go from false to true.  However, flushing the queue can be attempted
whenever the front-end raises its side of the Xen event channel.  There
is a single event channel for tx and rx.

Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit a98b140223d3a627eab7ee3ddec645bab630d756)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoe1000: flush queue whenever can_receive can go from false to true
Paolo Bonzini [Thu, 9 Aug 2012 14:45:56 +0000 (16:45 +0200)]
e1000: flush queue whenever can_receive can go from false to true

When the guests replenish the receive ring buffer, the network device
should flush its queue of pending packets.  This is done with
qemu_flush_queued_packets.

e1000's can_receive can go from false to true when RCTL or RDT are
modified.

Reported-by: Luigi Rizzo <rizzo@iet.unipi.it>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Jan Kiszka <jan.kiszka@siemens.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit e8b4c680b41bd960ecccd9ff076b7b058e0afcd4)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agonet: notify iothread after flushing queue
Paolo Bonzini [Thu, 9 Aug 2012 14:45:55 +0000 (16:45 +0200)]
net: notify iothread after flushing queue

virtio-net has code to flush the queue and notify the iothread
whenever new receive buffers are added by the guest.  That is
fine, and indeed we need to do the same in all other drivers.
However, notifying the iothread should be work for the network
subsystem.  And since we are at it we can add a little smartness:
if some of the queued packets already could not be delivered,
there is no need to notify the iothread.

Reported-by: Luigi Rizzo <rizzo@iet.unipi.it>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Jan Kiszka <jan.kiszka@siemens.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 987a9b4800003567b1a47a379255e886a77d57ea)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoarch_init.c: add missing '%' symbols before PRIu64 in debug printfs
Igor Mitsyanko [Wed, 5 Sep 2012 09:04:56 +0000 (13:04 +0400)]
arch_init.c: add missing '%' symbols before PRIu64 in debug printfs

'%' symbols were missing in front of PRIu64 macros in DPRINTF() messages in
arch_init.c, this caused compilation warnings when compiled with DEBUG_ARCH_INIT defined.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit ef37a699a06f96e098ee00683b7052b5fbb6ad7d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agokvm: Fix warning from static code analysis
Stefan Weil [Mon, 3 Sep 2012 20:40:40 +0000 (22:40 +0200)]
kvm: Fix warning from static code analysis

Report from smatch:

kvm-all.c:1373 kvm_init(135) warn:
 variable dereferenced before check 's' (see line 1360)

's' cannot by NULL (it was alloced using g_malloc0), so there is no need
to check it here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 6d1cc3210ccc4372ffa337c187da9db68314c0c4)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqapi: Fix enumeration typo error
Lei Li [Thu, 23 Aug 2012 05:14:25 +0000 (13:14 +0800)]
qapi: Fix enumeration typo error

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit 6932a69b20a88428c531805cdd20eec8acf05b27)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoconsole: Clean up bytes per pixel calculation
BALATON Zoltan [Wed, 22 Aug 2012 15:19:42 +0000 (17:19 +0200)]
console: Clean up bytes per pixel calculation

Division with round up is the correct way to compute this even if the
only case where division with round down gives incorrect result is
probably 15 bpp. This case was explicitely patched up in one of these
functions but was unhandled in the other. (I'm not sure about setting
16 bpp for the 15bpp case either but I left that there for now.)

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit feadf1a4de0d7468ffb671a2b9f681925469fa58)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoSpelling fixes in comments and documentation
Stefan Weil [Fri, 10 Aug 2012 20:03:25 +0000 (22:03 +0200)]
Spelling fixes in comments and documentation

These wrong spellings were detected by codespell:

* successully -> successfully

* alot -> a lot

* wanna -> want to

* infomation -> information

* occured -> occurred

["also is" -> "is also" and "ressources" -> "resources" suggested by
Peter Maydell <peter.maydell@linaro.org>]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 0546b8c2f089867cd7606ff47e026e8931157828)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agosrp: Don't use QEMU_PACKED for single elements of a structured type
Stefan Weil [Fri, 10 Aug 2012 20:03:27 +0000 (22:03 +0200)]
srp: Don't use QEMU_PACKED for single elements of a structured type

QEMU_PACKED results in a MinGW compiler warning when it is
used for single structure elements:

warning: 'gcc_struct' attribute ignored

Using QEMU_PACKED for the whole structure avoids the compiler warning
without changing the memory layout.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
(cherry picked from commit 93d3ad2a8048469d2b2bb157697425b66b2a37aa)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoslirp: Implement TFTP Blocksize option
Hervé Poussineau [Thu, 13 Sep 2012 05:55:01 +0000 (07:55 +0200)]
slirp: Implement TFTP Blocksize option

This option is described in RFC 1783. As this is only an optional field,
we may ignore it in some situations and handle it in some others.

However, MS Windows 2003 PXE boot client requests a block size of the MTU
(most of the times 1472 bytes), and doesn't work if the option is not
acknowledged (with whatever value).

According to the RFC 1783, we cannot acknowledge the option with a bigger
value than the requested one.

As current implementation is using 512 bytes by block, accept the option
with a value of 512 if the option was specified, and don't acknowledge it
if it is not present or less than 512 bytes.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 95b1ad7ad86793c27ab8e9987be69571937900d1)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoslirp: Handle more than 65535 blocks in TFTP transfers
Hervé Poussineau [Thu, 13 Sep 2012 10:39:36 +0000 (12:39 +0200)]
slirp: Handle more than 65535 blocks in TFTP transfers

RFC 1350 does not mention block count roll-over. However, a lot of TFTP servers
implement it to be able to transmit big files, so do it also.

Current block size is 512 bytes, so TFTP files were limited to 32 MB.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 4aa401f39e048e71020cceb59f126ab941095a42)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoslirp: improve TFTP performance
Hervé Poussineau [Mon, 10 Sep 2012 18:52:25 +0000 (20:52 +0200)]
slirp: improve TFTP performance

When transferring a file, keep it open during the whole transfer,
instead of opening/closing it for each block.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit 78be056628c76ff73eedeade86fde44b97343c79)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoslirp: Fix error reported by static code analysis
Stefan Weil [Tue, 4 Sep 2012 21:20:36 +0000 (23:20 +0200)]
slirp: Fix error reported by static code analysis

Report from smatch:

slirp/tcp_subr.c:127 tcp_respond(17) error:
 we previously assumed 'tp' could be null (see line 124)

Return if 'tp' is NULL.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit e56afbc54a2132c56931f44bae1992c28119944f)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoslirp: Remove wrong type casts ins debug statements
Stefan Weil [Tue, 4 Sep 2012 21:20:35 +0000 (23:20 +0200)]
slirp: Remove wrong type casts ins debug statements

The type casts of pointers to long are not allowed
when sizeof(pointer) != sizeof(long).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
(cherry picked from commit c4d12a743c73a5b88a8705ca68ff620ce0f8bba7)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agouhci: Don't queue up packets after one with the SPD flag set
Hans de Goede [Wed, 12 Sep 2012 13:08:40 +0000 (15:08 +0200)]
uhci: Don't queue up packets after one with the SPD flag set

Don't queue up packets after a packet with the SPD (short packet detect)
flag set. Since we won't know if the packet will actually be short until it
has completed, and if it is short we should stop the queue.

This fixes a miniature photoframe emulating a USB cdrom with the windows
software for it not working.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 72a04d0c178f01908d74539230d9de64ffc6da19)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agousb-redir: Revert usb-redir part of commit 93bfef4c
Hans de Goede [Wed, 12 Sep 2012 13:08:39 +0000 (15:08 +0200)]
usb-redir: Revert usb-redir part of commit 93bfef4c

Commit 93bfef4c6e4b23caea9d51e1099d06433d8835a4 makes qemu-devices
which report the qemu version string to the guest in some way use a
qemu_get_version function which reports a machine-specific version string.

However usb-redir does not expose the qemu version to the guest, only to
the usbredir-host as part of the initial handshake. This can then be logged
on the usbredir-host side for debugging purposes and is otherwise completely
unused! For debugging purposes it is important to have the real qemu version
in there, rather then the machine-specific version.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 35efba2cc6812dc980c336d7b9bf81dbfb5daf00)

Conflicts:

hw/usb/redirect.c

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoehci: Walk async schedule before and after migration
Hans de Goede [Wed, 12 Sep 2012 13:08:33 +0000 (15:08 +0200)]
ehci: Walk async schedule before and after migration

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit ceab6f96454fe6589d1b09ce64403c041d79f9d9)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoehci: Don't set seen to 0 when removing unseen queue-heads
Hans de Goede [Wed, 12 Sep 2012 13:08:32 +0000 (15:08 +0200)]
ehci: Don't set seen to 0 when removing unseen queue-heads

When removing unseen queue-heads from the async queue list, we should not
set the seen flag to 0, as this may cause them to be removed by
ehci_queues_rip_unused() during the next call to ehci_advance_async_state()
if the timer is late or running at a low frequency.

Note:
1) This *may* have caused the instant unlink / relinks described in commit
   9bc3a3a216e2689bfcdd36c3e079333bbdbf3ba0

2) Rather then putting more if-s inside ehci_queues_rip_unused, this patch
   instead introduces a new ehci_queues_rip_unseen function.

3) This patch also makes it save to call ehci_queues_rip_unseen() multiple
   times, which gets used in the folluw up patch titled:
   "ehci: Walk async schedule before and after migration"

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 8f5457eb04140714eaf57a99bc08dc661d83fa87)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoconfigure: usbredir fixes
Aurelien Jarno [Tue, 11 Sep 2012 18:57:58 +0000 (20:57 +0200)]
configure: usbredir fixes

usbredir is only used by system emulation, so add the libraries to
libs_softmmu instead of LIBS.

Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 56ab2ad177dc43d474dc0a0bd84e81ef00f31e11)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agohw/qxl: tracing fixes
Alon Levy [Wed, 12 Sep 2012 13:13:26 +0000 (16:13 +0300)]
hw/qxl: tracing fixes

Add two new trace events:
qxl_send_events(int qid, uint32_t events) "%d %d"
qxl_set_guest_bug(int qid) "%d"

Change qxl_io_unexpected_vga_mode parameters to be equivalent to those
of qxl_io_write for easier grouping under a single systemtap probe.

Change d to qxl in one place.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 917ae08ca1565aab2d10c8b6269cd905d6c5c05b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoblock: Don't forget to delete temporary file
Dunrong Huang [Wed, 5 Sep 2012 13:26:22 +0000 (21:26 +0800)]
block: Don't forget to delete temporary file

The caller would not delete temporary file after failed get_tmp_filename().

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit fe235a06e1e008dedd2ac3cc0a3a655169ce9b33)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoDon't require encryption password for 'qemu-img info' command
Daniel P. Berrange [Mon, 10 Sep 2012 11:11:31 +0000 (12:11 +0100)]
Don't require encryption password for 'qemu-img info' command

The encryption password is only required if I/O is going to be
performed on a disk image. The 'qemu-img info' command merely
reports metadata, so it should not ask for a decryption password

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit f0536bb848ad6eb2709a7dc675f261bd160c751b)

Conflicts:

qemu-img.c

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoahci: properly reset PxCMD on HBA reset
Jason Baron [Tue, 4 Sep 2012 20:08:08 +0000 (16:08 -0400)]
ahci: properly reset PxCMD on HBA reset

While testing q35, I found that windows 7 (specifically, windows 7 ultimate
with sp1 x64), wouldn't install because it can't find the cdrom or disk drive.
The failure message is: 'A required cd/dvd device driver is missing. If you
have a driver floppy disk, CD, DVD, or USB flash drive, please insert it now.'
This can also be reproduced on piix by adding an ahci controller, and
observing that windows 7 does not see any devices behind it.

The problem is that when windows issues a HBA reset, qemu does not reset the
individual ports' PxCMD register. Windows 7 then reads back the PxCMD register
and presumably assumes that the ahci controller has already been initialized.
Windows then never sets up the PxIE register to enable interrupts, and thus it
never gets irqs back when it sends ata device inquiry commands.

This change brings qemu into ahci 1.3 specification compliance.

Section 10.4.3 HBA Reset:

"
When GHC.HR is set to '1', GHC.AE, GHC.IE, the IS register, and all port
register fields (except PxFB/PxFBU/PxCLB/PxCLBU) that are not HwInit in the
HBA's register memory space are reset.
"

I've also re-tested Fedora 16 and 17 to verify that they continue to work with
this change.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 2a4f4f34e6fe55f4c82507c3e7ec9b58c2e24ad4)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoblock: fix block tray status
Pavel Hrdina [Thu, 9 Aug 2012 10:44:48 +0000 (12:44 +0200)]
block: fix block tray status

The tray status should change also if you eject empty block device.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 9ca111544c64b5abed2e79cf52e19a8f227b347b)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agovdi: Fix warning from clang
Stefan Weil [Fri, 17 Aug 2012 13:23:24 +0000 (15:23 +0200)]
vdi: Fix warning from clang

ccc-analyzer reports these warnings:

block/vdi.c:704:13: warning: Dereference of null pointer
            bmap[i] = VDI_UNALLOCATED;
            ^
block/vdi.c:702:13: warning: Dereference of null pointer
            bmap[i] = i;
            ^

Moving some code into the if block fixes this.
It also avoids calling function write with 0 bytes of data.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 514f21a5d4613e495adc2e2dd48f18091454efb8)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoblock/curl: Fix wrong free statement
Stefan Weil [Sat, 1 Sep 2012 09:06:45 +0000 (11:06 +0200)]
block/curl: Fix wrong free statement

Report from smatch:
block/curl.c:546 curl_close(21) info: redundant null check on s->url calling free()

The check was redundant, and free was also wrong because the memory
was allocated using g_strdup.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 45724d6d02383b0d7d4a90e05787fca7c55cb070)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoide: Fix error messages from static code analysis (no real error)
Stefan Weil [Mon, 3 Sep 2012 20:13:56 +0000 (22:13 +0200)]
ide: Fix error messages from static code analysis (no real error)

Report from smatch:
hw/ide/core.c:1472 ide_exec_cmd(423) error: buffer overflow 'smart_attributes' 8 <= 29
hw/ide/core.c:1474 ide_exec_cmd(425) error: buffer overflow 'smart_attributes' 8 <= 29
hw/ide/core.c:1475 ide_exec_cmd(426) error: buffer overflow 'smart_attributes' 8 <= 29
...

The upper limit of 30 was never reached because both for loops terminated
when 'smart_attributes' reached end of list, so there was no real buffer
overflow.

Nevertheless, changing the code not only fixes the error report, but also
reduces the size of smart_attributes and simplifies the for loops.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 1e53537fdaa4657d11f130a0f2673fcfb1956381)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agosheepdog: fix savevm and loadvm
MORITA Kazutaka [Wed, 29 Aug 2012 18:39:45 +0000 (03:39 +0900)]
sheepdog: fix savevm and loadvm

This patch sets data to be sent to Sheepdog correctly and fixes savevm
and loadvm operations on a Sheepdog image.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 1f7a48de4467f31afc51169122453318efdb0f33)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoehci: Don't process too much frames in 1 timer tick (v2)
Hans de Goede [Mon, 10 Sep 2012 10:44:11 +0000 (12:44 +0200)]
ehci: Don't process too much frames in 1 timer tick (v2)

The Linux ehci isoc scheduling code fills the entire schedule ahead of
time minus 80 frames. If we make a large jump in where we are in the
schedule, ie 40 frames, then the scheduler all of a sudden will only have
40 frames left to work in, causing it to fail packet submissions
with error -27 (-EFBIG).

Changes in v2:
-Don't hardcode a maximum number of frames to process in one tick, instead:
 -Process a minimum number of frames to ensure we do eventually catch up
 -Stop (after the minimum number) when the guest has requested an irq

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 8f74ed1e43263293301031a10e440549bab19a6e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoehci: Fix interrupts stopping when Interrupt Threshold Control is 8
Hans de Goede [Mon, 10 Sep 2012 10:44:10 +0000 (12:44 +0200)]
ehci: Fix interrupts stopping when Interrupt Threshold Control is 8

If Interrupt Threshold Control is 8 or a multiple of 8, then
s->usbsts_frindex can become exactly 0x4000, at which point
(s->usbsts_frindex > s->frindex) will never become true, as
s->usbsts_frindex will not be lowered / reset in this case.

This patch fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit ffa1f2e088eb7e3d57f2fc35f21e7bdb23e592c5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoehci: switch to new-style memory ops
Gerd Hoffmann [Thu, 6 Sep 2012 09:24:51 +0000 (11:24 +0200)]
ehci: switch to new-style memory ops

Also register different memory regions for capabilities,
operational registers and port status registers.  Create
separate tracepoints for operational regs and port status
regs.  Ditch a bunch of sanity checks because the memory
core will do this for us now.

Offloading the byte, word and dword access handling to the
memory core also has the side effect of fixing ehci register
access on bigendian hosts.

Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 3e4f910c8d490a1490409a7e381dbbb229f9d272)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqxl: better cleanup for surface destroy
Uri Lublin [Tue, 11 Sep 2012 07:09:58 +0000 (10:09 +0300)]
qxl: better cleanup for surface destroy

Add back a call to qxl_spice_destroy_surface_wait_complete() in qxl_spice_destroy_surface_wait(),
that was removed by commit c480bb7da465186b84d8427e068ef7502e47ffbf

It is needed to complete surface-removal cleanup, for non async.
For async, qxl_spice_destroy_surface_wait_complete is called upon operation completion.

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 753b8b0d77ba1b343a35f9679cc777ea10a62bba)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agousb-host: allow emulated (non-async) control requests without USBPacket
Gerd Hoffmann [Thu, 6 Sep 2012 10:03:41 +0000 (12:03 +0200)]
usb-host: allow emulated (non-async) control requests without USBPacket

xhci needs this for USB_REQ_SET_ADDRESS due to the way
usb addressing is handled by the xhci hardware.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 63587e31353b6652cadfcfb869f5692a2b69daeb)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqxl: dont update invalid area
Dunrong Huang [Thu, 30 Aug 2012 16:44:44 +0000 (00:44 +0800)]
qxl: dont update invalid area

This patch fixes the following error:

$ ~/usr/bin/qemu-system-x86_64 -enable-kvm -m 1024 -spice port=5900,disable-ticketing -vga qxl -cdrom ~/Images/linuxmint-13-mate-dvd-32bit.iso
(/home/mathslinux/usr/bin/qemu-system-x86_64:10068): SpiceWorker-CRITICAL **: red_worker.c:4599:red_update_area: condition `area->left >= 0 && area->top >= 0 && area->left < area->right && area->top < area->bottom' failed
Aborted

spice server terminates QEMU process if we pass invalid area to it,
so dont update those invalid areas.

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit ccc2960d654a233a6ed415b37d8ff41728d817c5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoxhci: allow bytewise capability register reads
Gerd Hoffmann [Tue, 4 Sep 2012 12:48:03 +0000 (14:48 +0200)]
xhci: allow bytewise capability register reads

Some guests need this according to
Alejandro Martinez Ruiz <alex@securiforest.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 6ee021d41078844df60a3a466e3829a3e82776f3)

Conflicts:

hw/usb/hcd-xhci.c

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoxhci: fix runtime write tracepoint
Gerd Hoffmann [Thu, 30 Aug 2012 10:42:32 +0000 (12:42 +0200)]
xhci: fix runtime write tracepoint

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 8e9f18b6db1cd67f0a7efd7d0285bee489445197)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoxhci: drop buffering
Gerd Hoffmann [Fri, 17 Aug 2012 09:04:36 +0000 (11:04 +0200)]
xhci: drop buffering

This patch splits the xhci_xfer_data function into three.
The xhci_xfer_data function used to do does two things:

  (1) copy transfer data between guest memory and a temporary buffer.
  (2) report transfer results to the guest using events.

Now we three functions to handle this:

  (1) xhci_xfer_map creates a scatter list for the transfer and
      uses that (instead of the temporary buffer) to build a
      USBPacket.
  (2) xhci_xfer_unmap undoes the mapping.
  (3) xhci_xfer_report sends out events.

The patch also fixes reporting of transaction errors which must be
reported unconditinally, not only in case the guest asks for it
using the ISP flag.

[ v2: fix warning ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit d5a15814b413869667b2a3215772986885be574a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoxhci: rip out background transfer code
Gerd Hoffmann [Fri, 17 Aug 2012 12:05:21 +0000 (14:05 +0200)]
xhci: rip out background transfer code

original xhci code (the one which used libusb directly) used to use
'background transfers' for iso streams.  In upstream qemu the iso
stream buffering is handled by usb-host & usb-redir, so we will
never ever need this.  It has been left in as reference, but is dead
code anyway.  Rip it out.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 331e9406f152b6bae6859a153d36e5076c58901d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agousb-audio: fix usb version
Gerd Hoffmann [Tue, 28 Aug 2012 14:43:34 +0000 (16:43 +0200)]
usb-audio: fix usb version

usb-audio is a full speed (1.1) device,
but bcdUSB claims it is usb 2.0.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 2bbd086c41a00dc4384727ec895a94890c688eb5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoBetter name usb braille device
Samuel Thibault [Thu, 23 Aug 2012 07:59:27 +0000 (09:59 +0200)]
Better name usb braille device

Windows users need to know that they have to use the Baum driver to make
the qemu braille device work.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 2964cd9bfa5100e433471d3e3fedcc9d62891894)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agousb-redir: Return babble when getting more bulk data then requested
Hans de Goede [Tue, 28 Aug 2012 09:33:47 +0000 (11:33 +0200)]
usb-redir: Return babble when getting more bulk data then requested

Babble is the appropriate error in this case (rather then signalling a stall).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 2979a36183a3902cd75665e7c6bbc8668668fd17)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agousb-redir: Move to core packet id and queue handling
Hans de Goede [Tue, 28 Aug 2012 09:30:13 +0000 (11:30 +0200)]
usb-redir: Move to core packet id and queue handling

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit de550a6afb468ed3b8171019e19b63ae8254886d)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agousb-redir: Get rid of unused async-struct dev member
Hans de Goede [Tue, 28 Aug 2012 07:08:45 +0000 (09:08 +0200)]
usb-redir: Get rid of unused async-struct dev member

This is a preparation patch for completely getting rid of the async-packet
struct in usb-redir, instead relying on the (new) per ep queues in the
qemu usb core.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 206e7f20fe7b920b362bcc02608680c5d5527f2a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agousb-redir: Get rid of local shadow copy of packet headers
Hans de Goede [Tue, 28 Aug 2012 07:05:38 +0000 (09:05 +0200)]
usb-redir: Get rid of local shadow copy of packet headers

The shadow copy only serves as an extra check (besides the packet-id) to
ensure the packet we get back is a reply to the packet we think it is.

This check has never triggered in all the time usb-redir is in use now,
and since the verified data in the returned packet-header is not used
otherwise, removing the check does not open any possibilities for the
usbredirhost to confuse us.

This is a preparation patch for completely getting rid of the async-packet
struct in usb-redir, instead relying on the (new) per ep queues in the
qemu usb core.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 104981d52b63dc3d68f39d4442881c667f44bbb9)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agousb-redir: Get rid of async-struct get member
Hans de Goede [Mon, 27 Aug 2012 14:33:08 +0000 (16:33 +0200)]
usb-redir: Get rid of async-struct get member

This is a preparation patch for completely getting rid of the async-packet
struct in usb-redir, instead relying on the (new) per ep queues in the
qemu usb core.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit cb897117cdedd488f19985c8ec5ea05971103a27)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agousb-redir: Don't delay handling of open events to a bottom half
Hans de Goede [Thu, 23 Aug 2012 14:37:19 +0000 (16:37 +0200)]
usb-redir: Don't delay handling of open events to a bottom half

There is no need for this, and doing so means that a backend trying to
write immediately after an open event will see qemu_chr_be_can_write
returning 0, which not all backends handle well as there is no wakeup
mechanism to detect when the frontend does become writable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit ed9873bfbf145c084d039baab08c63b9d67e7bd3)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>