]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
10 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:56:51 +0000 (12:56 -0800)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

# By Erik de Castro Lopo (2) and others
# Via Riku Voipio
* riku/linux-user-for-upstream:
  linux-user: pass correct parameter to do_shmctl()
  linux-user: create target_structs header to place ipc_perm and shmid_ds
  flatload: fix non-GOT relocations
  linux-user: Implement handling of 5 POSIX timer syscalls.
  linux-user: Add target struct defs needed for POSIX timer syscalls.

Message-id: cover.1385732338.git.riku.voipio@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'kraxel/tags/pull-usb-1' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:54:35 +0000 (12:54 -0800)]
Merge remote-tracking branch 'kraxel/tags/pull-usb-1' into staging

Improvements for usb3 bulk stream (usb core, xhci).
Bugfixes for uas emulation.
Add remote wakeup support for ehci.
Add suspend support for xhci.
Misc minor tweaks and fixes.

# gpg: Signature made Thu 28 Nov 2013 11:44:49 PM PST using RSA key ID D3E87138
# gpg: Can't check signature: public key not found

# By Hans de Goede (11) and others
# Via Gerd Hoffmann
* kraxel/tags/pull-usb-1:
  usb: move usb_{hi,lo} helpers to header file.
  usb: add vendor request defines
  trace-events: Clean up after removal of old usb-host code
  Revert "usb-tablet: Don't claim wakeup capability for USB-2 version"
  ehci: implement port wakeup
  xhci: Call usb_device_alloc/free_streams
  usb: Add usb_device_alloc/free_streams
  usb: Add max_streams attribute to endpoint info
  uas: s/ui/iu/
  uas: Fix response iu struct definition
  uas: Bounds check tags when using streams
  uas: Streams are numbered 1-y, rather then 0-x
  uas: Fix / cleanup usb_uas_task error handling
  uas: Only use report iu-s for task_mgmt status reporting
  scsi: Add 2 new sense codes needed by uas
  xhci: add support for suspend/resume
  xhci: Add a few missing checks for disconnected devices

Message-id: 1385712381-30918-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:52:50 +0000 (12:52 -0800)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

# By Stefan Weil (9) and others
# Via Michael Tokarev
* mjt/trivial-patches:
  eeprom93xx: fix coding style
  hw/ppc/mac.h: remove unused BIOS_FILENAME definition
  Don't crash on keyboard input with no handler
  libcacard/vcard_emul_nss: Remove unused statement (value stored is never read)
  libcacard/cac: Remove unused statement (value stored is never read)
  virtio-net: fix the indent
  misc: Replace 'struct QEMUTimer' by 'QEMUTimer'
  qobject: Fix compiler warning (missing gnu_printf format attribute)
  acpi-build: Fix compiler warning (missing gnu_printf format attribute)
  .gitignore: Ignore config.status
  gtk: Replace conditional debug messages by trace methods
  console: Replace conditional debug messages by trace methods
  trace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)
  trace: Remove trace.h from console.h (less dependencies)

Message-id: 1385408466-13183-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoeeprom93xx: fix coding style
Antony Pavlov [Wed, 4 Dec 2013 06:27:29 +0000 (10:27 +0400)]
eeprom93xx: fix coding style

scripts/checkpatch.pl reports about some style problems,
this commit fixes some of them:

ERROR: space prohibited before open square bracket '['
+    .fields      = (VMStateField []) {

ERROR: space prohibited after that '!' (ctx:BxW)
+    if (! eeprom->eecs && eecs) {
         ^

ERROR: space prohibited after that '!' (ctx:WxW)
+    } else if (eeprom->eecs && ! eecs) {
                                ^

ERROR: space prohibited after that '!' (ctx:WxW)
+    } else if (eecs && ! eeprom->eesk && eesk) {
                        ^

ERROR: switch and case should be at the same indent
                     switch (address >> (eeprom->addrbits - 2)) {
+                        case 0:
[...]
+                        case 1:
[...]
+                        case 2:
[...]
+                        case 3:

ERROR: return is not a function, parentheses are not required
+    return (eeprom->eedo);

ERROR: switch and case should be at the same indent
     switch (nwords) {
+        case 16:
+        case 64:
[...]
+        case 128:
+        case 256:
[...]
+        default:

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Cc: qemu-trivial@nongnu.org
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agohw/ppc/mac.h: remove unused BIOS_FILENAME definition
Michael Tokarev [Mon, 2 Dec 2013 17:17:19 +0000 (21:17 +0400)]
hw/ppc/mac.h: remove unused BIOS_FILENAME definition

This definition has been moved to prep.c.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoDon't crash on keyboard input with no handler
Don Koch [Tue, 19 Nov 2013 20:01:59 +0000 (15:01 -0500)]
Don't crash on keyboard input with no handler

Prevent a call to put_kbd if null.

On shutdown of some OSes, the keyboard handler goes away before the
system is down. If a key is typed during this window, qemu crashes.

Signed-off-by: Don Koch <dkoch@verizon.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard/vcard_emul_nss: Remove unused statement (value stored is never read)
Stefan Weil [Sun, 17 Nov 2013 21:12:18 +0000 (22:12 +0100)]
libcacard/vcard_emul_nss: Remove unused statement (value stored is never read)

Warning from ccc-analyzer:

libcacard/vcard_emul_nss.c:937:9: warning:
 Value stored to 'cert_count' is never read
        cert_count = options->vreader[i].cert_count;
        ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard/cac: Remove unused statement (value stored is never read)
Stefan Weil [Sun, 17 Nov 2013 21:11:23 +0000 (22:11 +0100)]
libcacard/cac: Remove unused statement (value stored is never read)

Warning from ccc-analyzer:

libcacard/cac.c:192:13: warning: Value stored to 'ret' is never read
            ret = VCARD_DONE;
            ^     ~~~~~~~~~~

Here 'ret' is assigned a value inside of a switch statement and also after
that switch statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovirtio-net: fix the indent
Zhi Yong Wu [Wed, 27 Nov 2013 07:35:26 +0000 (15:35 +0800)]
virtio-net: fix the indent

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomisc: Replace 'struct QEMUTimer' by 'QEMUTimer'
Stefan Weil [Sun, 1 Dec 2013 07:49:47 +0000 (08:49 +0100)]
misc: Replace 'struct QEMUTimer' by 'QEMUTimer'

Most code already used QEMUTimer without the redundant 'struct' keyword.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqobject: Fix compiler warning (missing gnu_printf format attribute)
Stefan Weil [Sun, 17 Nov 2013 18:00:42 +0000 (19:00 +0100)]
qobject: Fix compiler warning (missing gnu_printf format attribute)

gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):

  CC    qobject/qerror.o
qobject/qerror.c: In function ‘qerror_from_info’:
qobject/qerror.c:53:5: error:
 function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
     qerr->err_msg = g_strdup_vprintf(fmt, *va);
     ^

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoacpi-build: Fix compiler warning (missing gnu_printf format attribute)
Stefan Weil [Sun, 17 Nov 2013 18:00:22 +0000 (19:00 +0100)]
acpi-build: Fix compiler warning (missing gnu_printf format attribute)

gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):

  CC    m68k-softmmu/hw/m68k/mcf5206.o
hw/i386/acpi-build.c: In function ‘build_append_nameseg’:
hw/i386/acpi-build.c:294:5: error:
 function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
     g_string_vprintf(s, format, args);
     ^

When this warning is fixed, there is a new compiler warning:

  CC    i386-softmmu/hw/i386/acpi-build.o
hw/i386/acpi-build.c: In function ‘build_append_notify’:
hw/i386/acpi-build.c:632:5: error:
 format not a string literal and no format arguments [-Werror=format-security]
     build_append_nameseg(method, name);
     ^

This is fixed here, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years ago.gitignore: Ignore config.status
Fam Zheng [Fri, 22 Nov 2013 06:39:56 +0000 (14:39 +0800)]
.gitignore: Ignore config.status

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agogtk: Replace conditional debug messages by trace methods
Stefan Weil [Sun, 10 Nov 2013 15:24:02 +0000 (16:24 +0100)]
gtk: Replace conditional debug messages by trace methods

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconsole: Replace conditional debug messages by trace methods
Stefan Weil [Sun, 10 Nov 2013 15:04:16 +0000 (16:04 +0100)]
console: Replace conditional debug messages by trace methods

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotrace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)
Stefan Weil [Sun, 10 Nov 2013 13:20:17 +0000 (14:20 +0100)]
trace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)

This reduces the dependencies on trace.h.
Only one source file which needs hcd-ehci.h also needs trace.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotrace: Remove trace.h from console.h (less dependencies)
Stefan Weil [Sun, 10 Nov 2013 13:20:16 +0000 (14:20 +0100)]
trace: Remove trace.h from console.h (less dependencies)

This reduces the dependencies on trace.h.
Only two source files which need console.h also need trace.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolinux-user: pass correct parameter to do_shmctl()
Petar Jovanovic [Wed, 30 Oct 2013 13:46:32 +0000 (14:46 +0100)]
linux-user: pass correct parameter to do_shmctl()

Fix shmctl issue by passing correct parameter buf to do_shmctl().

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: create target_structs header to place ipc_perm and shmid_ds
Petar Jovanovic [Wed, 30 Oct 2013 13:46:31 +0000 (14:46 +0100)]
linux-user: create target_structs header to place ipc_perm and shmid_ds

Creating target_structs header in linux-user/$arch/ and making
target_ipc_perm and target_shmid_ds its first inhabitants.
The struct defintions may/should be further fine-tuned by arch maintainers.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoflatload: fix non-GOT relocations
Corey J. Boyle [Sat, 5 Oct 2013 11:46:31 +0000 (07:46 -0400)]
flatload: fix non-GOT relocations

Use target address rather than host address when performing
non-GOT relocations

Signed-off-by: Corey J. Boyle <corey@kansanian.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Implement handling of 5 POSIX timer syscalls.
Erik de Castro Lopo [Fri, 29 Nov 2013 07:39:23 +0000 (18:39 +1100)]
linux-user: Implement handling of 5 POSIX timer syscalls.

Implement timer_create, timer_settime, timer_gettime, timer_getoverrun
and timer_delete.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Add target struct defs needed for POSIX timer syscalls.
Erik de Castro Lopo [Fri, 29 Nov 2013 07:39:22 +0000 (18:39 +1100)]
linux-user: Add target struct defs needed for POSIX timer syscalls.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agousb: move usb_{hi,lo} helpers to header file.
Gerd Hoffmann [Wed, 20 Nov 2013 06:33:28 +0000 (07:33 +0100)]
usb: move usb_{hi,lo} helpers to header file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb: add vendor request defines
Gerd Hoffmann [Tue, 19 Nov 2013 11:37:58 +0000 (12:37 +0100)]
usb: add vendor request defines

Add defines for vendor specific usb control requests.
Group defines by Device / Interface / Endpoint while
being at it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agotrace-events: Clean up after removal of old usb-host code
Markus Armbruster [Mon, 25 Nov 2013 12:08:18 +0000 (13:08 +0100)]
trace-events: Clean up after removal of old usb-host code

Commit b5613fd neglected to drop the trace events along with the code.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoRevert "usb-tablet: Don't claim wakeup capability for USB-2 version"
Gerd Hoffmann [Wed, 20 Nov 2013 13:32:27 +0000 (14:32 +0100)]
Revert "usb-tablet: Don't claim wakeup capability for USB-2 version"

This reverts commit aa1c9e971e80d25b92908dce3dec7c38b49480ea.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoehci: implement port wakeup
Gerd Hoffmann [Wed, 20 Nov 2013 13:10:19 +0000 (14:10 +0100)]
ehci: implement port wakeup

Update portsc register and raise irq in case a suspended
port is woken up, so remote wakeup works on our ehci ports.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoOpen 2.0 development tree
Anthony Liguori [Wed, 27 Nov 2013 22:02:45 +0000 (14:02 -0800)]
Open 2.0 development tree

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoUpdate version for 1.7.0 release
Anthony Liguori [Wed, 27 Nov 2013 19:30:46 +0000 (11:30 -0800)]
Update version for 1.7.0 release

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoqemu-iotests: Fix test 041
Max Reitz [Mon, 25 Nov 2013 19:28:56 +0000 (20:28 +0100)]
qemu-iotests: Fix test 041

Performing multiple drive-mirror blockjobs on the same qemu instance
results in the image file used for the block device being replaced by
the newly mirrored file, which is not what we want.

Fix this by performing one dedicated test per sync mode.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1385407736-13941-3-git-send-email-mreitz@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoblock/drive-mirror: Reuse backing HD for sync=none
Max Reitz [Mon, 25 Nov 2013 19:28:55 +0000 (20:28 +0100)]
block/drive-mirror: Reuse backing HD for sync=none

For "none" sync mode in "absolute-paths" mode, the current image should
be used as the backing file for the newly created image.

The current behavior is:
a) If the image to be mirrored has a backing file, use that (which is
   wrong, since the operations recorded by "none" are applied to the
   image itself, not to its backing file).
b) If the image to be mirrored lacks a backing file, the target doesn't
   have one either (which is not really wrong, but not really right,
   either; "none" records a set of operations executed on the image
   file, therefore having no backing file to apply these operations on
   seems rather pointless).

For a, this is clearly a bugfix. For b, it is still a bugfix, although
it might break existing API - but since that case crashed qemu just
three weeks ago (before 1452686495922b81d6cf43edf025c1aef15965c0), we
can safely assume there is no such API relying on that case yet.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1385407736-13941-2-git-send-email-mreitz@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoxhci: Call usb_device_alloc/free_streams
Hans de Goede [Tue, 19 Nov 2013 13:36:58 +0000 (14:36 +0100)]
xhci: Call usb_device_alloc/free_streams

Note this code is not as KISS as I would like, the reason for this is that
the Linux kernel interface wants streams on eps belonging to one interface
to be allocated in one call. Things will also work if we do this one ep at a
time (as long as all eps support the same amount of streams), but lets stick
to the kernel API.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb: Add usb_device_alloc/free_streams
Hans de Goede [Tue, 19 Nov 2013 13:36:57 +0000 (14:36 +0100)]
usb: Add usb_device_alloc/free_streams

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb: Add max_streams attribute to endpoint info
Hans de Goede [Tue, 19 Nov 2013 13:36:56 +0000 (14:36 +0100)]
usb: Add max_streams attribute to endpoint info

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: s/ui/iu/
Hans de Goede [Tue, 19 Nov 2013 13:37:04 +0000 (14:37 +0100)]
uas: s/ui/iu/

The various uas data structures are called IU-s, which is short for
Information Unit, rather then UI-s.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Fix response iu struct definition
Hans de Goede [Thu, 31 Oct 2013 09:35:31 +0000 (10:35 +0100)]
uas: Fix response iu struct definition

This patch mirrors a patch to the Linux uas kernel driver which I've just
submitted. It looks like the qemu uas struct definitions were taken from
the Linux kernel driver, and have inherited the same mistake.

Besides fixing the response iu struct, the patch also drops the add_info
parameter from the usb_uas_queue_response() function, it is always 0 anyways,
and expressing 3 zero-bytes as a function argument is a bit hard.

Below is the long explanation for this change taken from the kernel commit:

The response iu struct before this patch has a size of 7 bytes, which is weird
since all other iu-s are explictly padded to a multiple of 4 bytes.

Submitting a 7 byte bulk transfer to the status endpoint of a real uasp device
when expecting a response iu results in an USB babble error, as the device
actually sends 8 bytes.

Up on closer reading of the UAS spec:
http://www.t10.org/cgi-bin/ac.pl?t=f&f=uas2r00.pdf

The reason for this becomes clear, the 2 entries in "Table 17 — RESPONSE IU"
are numbered 4 and 6, looking at other iu definitions in the spec, esp.
multi-byte fields, this indicates that the ADDITIONAL RESPONSE INFORMATION
field is not a 2 byte field as one might assume at a first look, but is
a multi-byte field containing 3 bytes.

This also aligns with the SCSI Architecture Model 4 spec, which UAS is based
on which states in paragraph "7.1 Task management function procedure calls"
that the "Additional Response Information" output argument for a Task
management function procedure call is 3 bytes.

Last but not least I've verified this by sending a logical unit reset task
management call with an invalid lun to an actual uasp device, and received
back a response-iu with byte 6 being 0, and byte 7 being 9, which is the
responce code for an invalid iu, which confirms that the response code is
being reported in byte 7 of the response iu rather then in byte 6.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Bounds check tags when using streams
Hans de Goede [Thu, 24 Oct 2013 17:15:53 +0000 (18:15 +0100)]
uas: Bounds check tags when using streams

Disallow the guest to cause us to address the data3 and status3 arrays
out of bounds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Streams are numbered 1-y, rather then 0-x
Hans de Goede [Thu, 24 Oct 2013 17:15:52 +0000 (18:15 +0100)]
uas: Streams are numbered 1-y, rather then 0-x

It is easier to simply make the arrays one larger, rather then
substracting one everywhere.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Fix / cleanup usb_uas_task error handling
Hans de Goede [Thu, 24 Oct 2013 17:15:51 +0000 (18:15 +0100)]
uas: Fix / cleanup usb_uas_task error handling

-The correct error if we cannot find the dev is INCORRECT_LUN rather then
 INVALID_INFO_UNIT
-Move the device not found check to the top so we only need to do it once
-Remove the dev->lun != lun checks, dev is returned by scsi_device_find
 which searches by lun, so this will never trigger

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agouas: Only use report iu-s for task_mgmt status reporting
Hans de Goede [Thu, 24 Oct 2013 17:15:50 +0000 (18:15 +0100)]
uas: Only use report iu-s for task_mgmt status reporting

Regular scsi cmds should always report their status using a sense-iu, using
the sense code to report any errors.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoscsi: Add 2 new sense codes needed by uas
Hans de Goede [Thu, 24 Oct 2013 17:15:49 +0000 (18:15 +0100)]
scsi: Add 2 new sense codes needed by uas

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoxhci: add support for suspend/resume
Gerd Hoffmann [Fri, 8 Nov 2013 10:43:20 +0000 (11:43 +0100)]
xhci: add support for suspend/resume

The OS can ask the xhci controller to save and restore its
internal state, which is used by the OS when the system is
suspended and resumed.

This patch handles writes to the save + restore bits in the
command register.  Only thing it does is updating the
restore error bit in the status register to signal an error
on restore.  The guest OS should do a full reinitialization
after resume then.

This is the minimal patch which gets S3 going with xhci.
Implementing full save/restore support is TBD.

https://bugzilla.redhat.com/show_bug.cgi?id=1012365

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoxhci: Add a few missing checks for disconnected devices
Hans de Goede [Tue, 19 Nov 2013 13:36:59 +0000 (14:36 +0100)]
xhci: Add a few missing checks for disconnected devices

One of the reworks of qemu's usb core made changes to usb-port's disconnect
handling. Now ports with a device will always have a non 0 dev member, but
if the device is not attached (which is possible with usb redirection),
dev->attached will be 0.

So supplement all checks for dev to also check dev->attached, and add an
extra check in a path where a device check was completely missing.

This fixes various crashes (asserts triggering) I've been seeing when xhci
attached usb devices get disconnected at the wrong time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoUpdate version for v1.7.0-rc2 release
Anthony Liguori [Tue, 26 Nov 2013 04:37:12 +0000 (20:37 -0800)]
Update version for v1.7.0-rc2 release

10 years agocurses: fixup SIGWINCH handler mess
Gerd Hoffmann [Fri, 22 Nov 2013 14:35:03 +0000 (15:35 +0100)]
curses: fixup SIGWINCH handler mess

Don't run code in the signal handler, only set a flag.
Use sigaction(2) to avoid non-portable signal(2) semantics.
Make #ifdefs less messy.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1385130903-20531-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoqga: Fix two format strings for MinGW
Stefan Weil [Mon, 25 Nov 2013 19:54:17 +0000 (20:54 +0100)]
qga: Fix two format strings for MinGW

Both code locations cause a compiler warning. Using "%s" instead of "%lu"
would result in a program crash if the wrong code were executed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1385409257-2522-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoPPC: BookE: Make FIT/WDT timers at best millisecond grained
Alexander Graf [Mon, 25 Nov 2013 21:46:55 +0000 (22:46 +0100)]
PPC: BookE: Make FIT/WDT timers at best millisecond grained

The default granularity for the FIT timer on 440 is on every 0x1000th
transition of TB from 0 to 1. Translated that means 48828 times a second.

Since interrupts are quite expensive for 440 and we don't really care
about the accuracy of the FIT to that significance, let's force FIT and
WDT to at best millisecond granularity.

This basically restores behavior as it was in QEMU 1.6, where timers
could only deal with millisecond granularities at all.

This patch greatly improves performance with the 440 target and restores
roughly the same performance level that QEMU 1.6 had for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
Message-id: 1385416015-22775-3-git-send-email-agraf@suse.de
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoPPC: Make BookE FIT/WDT timers more lazy
Alexander Graf [Mon, 25 Nov 2013 21:46:54 +0000 (22:46 +0100)]
PPC: Make BookE FIT/WDT timers more lazy

Today we fire FIT and WDT timer events every time the respective bit
position in TB flips from 0 -> 1.

However, there is no need to do this if the end result would be that
we're changing a TSR bit that is set to 1 to 1 again. No guest visible
change would have occured.

So whenever we see that the TSR bit to our timer is already set, don't
even bother to update the timer that would potentially fire it off.

However, we do need to make sure that we update our timer that notifies
us of the TB flip when the respective TSR bit gets unset. In that case
we do care about the flip and need to notify the guest again. So add
a callback into our timer handlers when TSR bits get unset.

This improves performance for me when the guest is busy processing things.

Signed-off-by: Alexander Graf <agraf@suse.de>
Message-id: 1385416015-22775-2-git-send-email-agraf@suse.de
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoacpi-build: fix support for glib < 2.22
Michael S. Tsirkin [Mon, 25 Nov 2013 22:00:39 +0000 (00:00 +0200)]
acpi-build: fix support for glib < 2.22

glib < 2.22 does not have g_array_get_element_size,
limit it's use (to check all elements are 1 byte
in size) to newer glib.

This fixes build on RHEL 5.3.

Reported-by: Richard Henderson <rth@redhat.com>
Reported-by: Erik Rull <erik.rull@rdsoftware.de>
Tested-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20131125220039.GA16386@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 25 Nov 2013 17:49:42 +0000 (09:49 -0800)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

pc very last minute fixes for 1.7

This has a fix for a crasher bug with pci bridges,
boot failure fix for s390 on 32 bit hosts,
and fixes build for hosts with old glib.

There's also a fix for --iasl configure flag - it can be used
to work around broken iasl on some systems either
by using a non-standard iasl or by disabling it.

I've also reverted a e1000/rtl mac programming change
that seems slightly wrong and too risky for 1.8.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 25 Nov 2013 03:40:07 AM PST using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Michael S. Tsirkin (5) and Bandan Das (1)
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  configure: make --iasl option actually work
  Revert "e1000/rtl8139: update HMP NIC when every bit is written"
  acpi-build: fix build on glib < 2.14
  acpi-build: fix build on glib < 2.22
  pci: unregister vmstate_pcibus on unplug
  s390x: fix flat file load on 32 bit systems

Message-id: 1385379990-32093-1-git-send-email-mst@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'bonzini/tags/for-anthony' into staging
Anthony Liguori [Mon, 25 Nov 2013 17:41:24 +0000 (09:41 -0800)]
Merge remote-tracking branch 'bonzini/tags/for-anthony' into staging

Here are a bunch of 1.7-tagged patches that I was afraid
were getting forgotten or that did not have a clear maintainer responsible
for making a pull request.

# gpg: Signature made Thu 21 Nov 2013 08:40:59 AM PST using RSA key ID 9B4D86F2
# gpg: Can't check signature: public key not found

# By Peter Maydell (3) and others
# Via Paolo Bonzini
* bonzini/tags/for-anthony:
  qga: Fix compiler warnings (missing format attribute, wrong format strings)
  mips jazz: do not raise data bus exception when accessing invalid addresses
  target-i386: yield to another VCPU on PAUSE
  rng-egd: offset the point when repeatedly read from the buffer
  rng-egd: remove redundant free
  target-i386: Fix build by providing stub kvm_arch_get_supported_cpuid()
  vfio-pci: Fix multifunction=on
  atomic.h: Fix build with clang
  pc: get rid of builtin pvpanic for "-M pc-1.5"
  configure: Explicitly set ARFLAGS so we can build with GNU Make 4.0
  sun4m: Add FCode ROM for TCX framebuffer

Message-id: 1385052578-32352-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'mdroth/qga-pull-2013-11-22' into staging
Anthony Liguori [Mon, 25 Nov 2013 17:37:44 +0000 (09:37 -0800)]
Merge remote-tracking branch 'mdroth/qga-pull-2013-11-22' into staging

# By Tomoki Sekiyama
# Via Michael Roth
* mdroth/qga-pull-2013-11-22:
  qemu-ga: vss-win32: Install VSS provider COM+ application service

Message-id: 1385154505-15145-1-git-send-email-mdroth@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Mon, 25 Nov 2013 17:37:27 +0000 (09:37 -0800)]
Merge remote-tracking branch 'stefanha/net' into staging

# By Vlad Yasevich
# Via Stefan Hajnoczi
* stefanha/net:
  qdev-properties-system.c: Allow vlan or netdev for -device, not both

Message-id: 1385118544-28482-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoconfigure: make --iasl option actually work
Michael S. Tsirkin [Sun, 24 Nov 2013 09:38:05 +0000 (11:38 +0200)]
configure: make --iasl option actually work

--iasl option was added to CC option parsing section by mistake,
it's not effective there and attempts to use cause
an 'unknown option' error.

Fix this up.

Tested-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqemu-ga: vss-win32: Install VSS provider COM+ application service
Tomoki Sekiyama [Fri, 1 Nov 2013 21:47:25 +0000 (17:47 -0400)]
qemu-ga: vss-win32: Install VSS provider COM+ application service

Currently, qemu-ga for Windows fails to execute guset-fsfreeze-freeze when
no user is logging in to Windows, with an error message:
  {"error":{"class":"GenericError",
            "desc":"failed to add C:\\ to snapshotset:  (error: 8004230f)"}}

To enable guest-fsfreeze-freeze/thaw without logging in users, this installs
a service to execute qemu-ga VSS provider COM+ application that has full
access privileges to the local system. The service will automatically be
removed when the COM+ application is deregistered.

This patch replaces ICOMAdminCatalog interface with ICOMAdminCatalog2
interface that contains CreateServiceForApplication() method in addition.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Reviewed-by: Gal Hammer <ghammer@redhat.com>
Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>
Tested-by: Yan Vugenfirer <yvugenfi@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agoqdev-properties-system.c: Allow vlan or netdev for -device, not both
Vlad Yasevich [Fri, 8 Nov 2013 02:13:09 +0000 (21:13 -0500)]
qdev-properties-system.c: Allow vlan or netdev for -device, not both

It is currently possible to specify things like:
-device e1000,netdev=foo,vlan=1
With this usage, whichever argument was specified last (vlan or netdev)
overwrites what was previousely set and results in a non-working
configuration.  Even worse, when used with multiqueue devices,
it causes a segmentation fault on exit in qemu_free_net_client.

That patch treates the above command line options as invalid and
generates an error at start-up.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqga: Fix compiler warnings (missing format attribute, wrong format strings)
Stefan Weil [Sun, 17 Nov 2013 18:19:52 +0000 (19:19 +0100)]
qga: Fix compiler warnings (missing format attribute, wrong format strings)

gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):

  CC    qga/commands.o
qga/commands.c: In function ‘slog’:
qga/commands.c:28:5: error:
 function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
     g_logv("syslog", G_LOG_LEVEL_INFO, fmt, ap);
     ^

gcc 4.8.2 reports this warning when slog is declared with the
gnu_printf format attribute:

qga/commands-posix.c: In function ‘qmp_guest_file_open’:
qga/commands-posix.c:404:5: warning:
 format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int64_t’ [-Wformat=]
     slog("guest-file-open, handle: %d", handle);
     ^

On 32 bit hosts there are three more warnings which are also fixed here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomips jazz: do not raise data bus exception when accessing invalid addresses
Hervé Poussineau [Mon, 4 Nov 2013 22:26:17 +0000 (23:26 +0100)]
mips jazz: do not raise data bus exception when accessing invalid addresses

MIPS Jazz chipset doesn't seem to raise data bus exceptions on invalid accesses.
However, there is no easy way to prevent them. Creating a big memory region
for the whole address space doesn't prevent memory core to directly call
unassigned_mem_read/write which in turn call cpu->do_unassigned_access,
which (for MIPS CPU) raise an data bus exception.

This fixes a MIPS Jazz regression introduced in c658b94f6e8c206c59d02aa6fbac285b86b53d2c.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agotarget-i386: yield to another VCPU on PAUSE
Paolo Bonzini [Wed, 20 Nov 2013 11:54:02 +0000 (12:54 +0100)]
target-i386: yield to another VCPU on PAUSE

After commit b1bbfe7 (aio / timers: On timer modification, qemu_notify
or aio_notify, 2013-08-21) FreeBSD guests report a huge slowdown.

The problem shows up as soon as FreeBSD turns out its periodic (~1 ms)
tick, but the timers are only the trigger for a pre-existing problem.

Before the offending patch, setting a timer did a timer_settime system call.

After, setting the timer exits the event loop (which uses poll) and
reenters it with a new deadline.  This does not cause any slowdown; the
difference is between one system call (timer_settime and a signal
delivery (SIGALRM) before the patch, and two system calls afterwards
(write to a pipe or eventfd + calling poll again when re-entering the
event loop).

Unfortunately, the exit/enter causes the main loop to grab the iothread
lock, which in turns kicks the VCPU thread out of execution.  This
causes TCG to execute the next VCPU in its round-robin scheduling of
VCPUS.  When the second VCPU is mostly unused, FreeBSD runs a "pause"
instruction in its idle loop which only burns cycles without any
progress.  As soon as the timer tick expires, the first VCPU runs
the interrupt handler but very soon it sets it again---and QEMU
then goes back doing nothing in the second VCPU.

The fix is to make the pause instruction do "cpu_loop_exit".

Reported-by: Luigi Rizzo <rizzo@iet.unipi.it>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agorng-egd: offset the point when repeatedly read from the buffer
Amos Kong [Thu, 21 Nov 2013 08:42:51 +0000 (16:42 +0800)]
rng-egd: offset the point when repeatedly read from the buffer

The buffer content might be read out more than once, currently
we just repeatedly read the first data block, buffer offset is
missing.

Cc: qemu-stable@nongnu.org
Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agorng-egd: remove redundant free
Amos Kong [Thu, 21 Nov 2013 08:42:50 +0000 (16:42 +0800)]
rng-egd: remove redundant free

We didn't set default chr_name, the free is redundant.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agotarget-i386: Fix build by providing stub kvm_arch_get_supported_cpuid()
Peter Maydell [Wed, 13 Nov 2013 23:09:07 +0000 (23:09 +0000)]
target-i386: Fix build by providing stub kvm_arch_get_supported_cpuid()

Fix build failures with clang when KVM is not enabled by
providing a stub version of kvm_arch_get_supported_cpuid().
We retain the compile time check that this function isn't
called when CONFIG_KVM is not set by guarding the stub with
ifndef __OPTIMIZE__ (we assume that an optimizing build will
do sufficient constant folding and dead code elimination to
remove the calls before linking).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agovfio-pci: Fix multifunction=on
Alex Williamson [Tue, 12 Nov 2013 18:53:24 +0000 (11:53 -0700)]
vfio-pci: Fix multifunction=on

When an assigned device is initialized it copies the device config
space into the emulated config space.  Unfortunately multifunction is
setup prior to the device initfn and gets clobbered.  We need to
restore it just like pci-assign does.

Cc: qemu-stable@nongnu.org
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoatomic.h: Fix build with clang
Peter Maydell [Tue, 22 Oct 2013 09:58:41 +0000 (10:58 +0100)]
atomic.h: Fix build with clang

clang defines __ATOMIC_SEQ_CST but its implementation of the
__atomic_exchange() builtin differs from that of gcc. Move the
__clang__ branch of the ifdef ladder to the top and fix its
implementation (there is no such builtin as __sync_exchange),
so we can compile with clang again.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agopc: get rid of builtin pvpanic for "-M pc-1.5"
Paolo Bonzini [Mon, 4 Nov 2013 13:30:48 +0000 (14:30 +0100)]
pc: get rid of builtin pvpanic for "-M pc-1.5"

This causes two slight backwards-incompatibilities between "-M pc-1.5"
and 1.5's "-M pc":

(1) a fw_cfg file is removed with this patch.  This is only a problem
if migration stops the virtual machine exactly during fw_cfg enumeration.

(2) after migration, a VM created without an explicit "-device pvpanic"
will stop reporting panics to management.

The first problem only occurs if migration is done at a very, very
early point (and I'm not sure it can happen in practice for reasonable-size
VMs, since it will likely take more time to send the RAM to destination,
than it will take for BIOS to scan fw_cfg).

The second problem only occurs if the guest panics _and_ has a guest
driver _and_ management knows to look at the crash event, so it is
mostly theoretical at this point in time.

Thus keep the code simple, and pretend it was never broken.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoconfigure: Explicitly set ARFLAGS so we can build with GNU Make 4.0
Peter Maydell [Mon, 21 Oct 2013 20:03:06 +0000 (21:03 +0100)]
configure: Explicitly set ARFLAGS so we can build with GNU Make 4.0

Our rules.mak adds '-rR' to MAKEFLAGS to indicate that we will be
explicitly specifying everything and not relying on any default
variables or rules. However we were accidentally relying on the
default ARFLAGS ("rv"). This went unnoticed because of a bug in
GNU Make 3.82 and earlier which meant that adding -rR to MAKEFLAGS
only affected submakes, not the currently running instance.
Explicitly set ARFLAGS in config-host.mak, in the same way we
handle CFLAGS and LDFLAGS; this will allow us to work with
Make 4.0.

Thanks to Paul Smith for analyzing this bug for us.

Cc: qemu-stable@nongnu.org
Reported-by: Ken Moffat <zarniwhoop@ntlworld.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agosun4m: Add FCode ROM for TCX framebuffer
Mark Cave-Ayland [Sat, 2 Nov 2013 16:03:50 +0000 (16:03 +0000)]
sun4m: Add FCode ROM for TCX framebuffer

Upstream OpenBIOS now implements SBus probing in order to determine the
contents of a physical bus slot, which is required to allow OpenBIOS to
identify the framebuffer without help from the fw_cfg interface.

SBus probing works by detecting the presence of an FCode program
(effectively tokenised Forth) at the base address of each slot, and if
present executes it so that it creates its own device node in the
OpenBIOS device tree.

The FCode ROM is generated as part of the OpenBIOS build and should
generally be updated at the same time.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
CC: Blue Swirl <blauwirbel@gmail.com>
CC: Bob Breuer <breuerr@mc.net>
CC: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoUpdate version for 1.7.0-rc1 release
Anthony Liguori [Thu, 21 Nov 2013 16:11:47 +0000 (08:11 -0800)]
Update version for 1.7.0-rc1 release

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agovfio-pci: Fix multifunction=on
Alex Williamson [Tue, 12 Nov 2013 18:53:24 +0000 (11:53 -0700)]
vfio-pci: Fix multifunction=on

When an assigned device is initialized it copies the device config
space into the emulated config space.  Unfortunately multifunction is
setup prior to the device initfn and gets clobbered.  We need to
restore it just like pci-assign does.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Bandan Das <bsd@redhat.com>
Message-id: 20131112185059.7262.33780.stgit@bling.home
Cc: qemu-stable@nongnu.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agotarget-i386: Fix addr32 prefix in gen_lea_modrm
Richard Henderson [Tue, 12 Nov 2013 01:16:56 +0000 (11:16 +1000)]
target-i386: Fix addr32 prefix in gen_lea_modrm

Fix the following run-test-x86_64 testsuite failures:

-lea (%%eax) = 0000000000000001
-lea (%%ebx) = 0000000000000002
-lea (%%ecx) = 0000000000000004
-lea (%%edx) = 0000000000000008
-lea (%%esi) = 0000000000000010
-lea (%%edi) = 0000000000000020
+lea (%%eax) = 0000abcc00000001
+lea (%%ebx) = 0000abcf00000002
+lea (%%ecx) = 0000abc900000004
+lea (%%edx) = 0000abc500000008
+lea (%%esi) = 0000abdd00000010
+lea (%%edi) = 0000abed00000020

In addition, reduce ifdeffery and minimize the number of TCG ops
produced during address computation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-id: 1384219016-5170-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoatomic.h: Fix build with clang
Peter Maydell [Tue, 22 Oct 2013 09:58:41 +0000 (10:58 +0100)]
atomic.h: Fix build with clang

clang defines __ATOMIC_SEQ_CST but its implementation of the
__atomic_exchange() builtin differs from that of gcc. Move the
__clang__ branch of the ifdef ladder to the top and fix its
implementation (there is no such builtin as __sync_exchange),
so we can compile with clang again.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1382435921-18438-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agotarget-i386: do not override nr_cores for -cpu host
Paolo Bonzini [Tue, 19 Nov 2013 16:49:46 +0000 (17:49 +0100)]
target-i386: do not override nr_cores for -cpu host

Commit 787aaf5 (target-i386: forward CPUID cache leaves when -cpu host is
used, 2013-09-02) brings bits 31..26 of CPUID leaf 04h out of sync with
the APIC IDs that QEMU reserves for each package.  This number must come
from "-smp" options rather than from the host CPUID.

It also turns out that this unsyncing makes Windows Server 2012R2 fail
to boot.

Tested-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-id: 1384879786-6721-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agomips jazz: do not raise data bus exception when accessing invalid addresses
Hervé Poussineau [Mon, 4 Nov 2013 22:26:17 +0000 (23:26 +0100)]
mips jazz: do not raise data bus exception when accessing invalid addresses

MIPS Jazz chipset doesn't seem to raise data bus exceptions on invalid accesses.
However, there is no easy way to prevent them. Creating a big memory region
for the whole address space doesn't prevent memory core to directly call
unassigned_mem_read/write which in turn call cpu->do_unassigned_access,
which (for MIPS CPU) raise an data bus exception.

This fixes a MIPS Jazz regression introduced in c658b94f6e8c206c59d02aa6fbac285b86b53d2c.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-id: 1383603977-7003-1-git-send-email-hpoussin@reactos.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agotarget-i386: yield to another VCPU on PAUSE
Paolo Bonzini [Wed, 20 Nov 2013 11:54:02 +0000 (12:54 +0100)]
target-i386: yield to another VCPU on PAUSE

After commit b1bbfe7 (aio / timers: On timer modification, qemu_notify
or aio_notify, 2013-08-21) FreeBSD guests report a huge slowdown.

The problem shows up as soon as FreeBSD turns out its periodic (~1 ms)
tick, but the timers are only the trigger for a pre-existing problem.

Before the offending patch, setting a timer did a timer_settime system call.

After, setting the timer exits the event loop (which uses poll) and
reenters it with a new deadline.  This does not cause any slowdown; the
difference is between one system call (timer_settime and a signal
delivery (SIGALRM) before the patch, and two system calls afterwards
(write to a pipe or eventfd + calling poll again when re-entering the
event loop).

Unfortunately, the exit/enter causes the main loop to grab the iothread
lock, which in turns kicks the VCPU thread out of execution.  This
causes TCG to execute the next VCPU in its round-robin scheduling of
VCPUS.  When the second VCPU is mostly unused, FreeBSD runs a "pause"
instruction in its idle loop which only burns cycles without any
progress.  As soon as the timer tick expires, the first VCPU runs
the interrupt handler but very soon it sets it again---and QEMU
then goes back doing nothing in the second VCPU.

The fix is to make the pause instruction do "cpu_loop_exit".

Cc: Richard Henderson <rth@twiddle.net>
Reported-by: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 1384948442-24217-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agorng-egd: offset the point when repeatedly read from the buffer
Amos Kong [Thu, 21 Nov 2013 08:42:51 +0000 (16:42 +0800)]
rng-egd: offset the point when repeatedly read from the buffer

The buffer content might be read out more than once, currently
we just repeatedly read the first data block, buffer offset is
missing.

Cc: qemu-stable@nongnu.org
Signed-off-by: Amos Kong <akong@redhat.com>
Message-id: 1385023371-8198-3-git-send-email-akong@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agorng-egd: remove redundant free
Amos Kong [Thu, 21 Nov 2013 08:42:50 +0000 (16:42 +0800)]
rng-egd: remove redundant free

We didn't set default chr_name, the free is redundant.

Signed-off-by: Amos Kong <akong@redhat.com>
Message-id: 1385023371-8198-2-git-send-email-akong@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agovirtio-rng: add check of period
Amos Kong [Thu, 21 Nov 2013 10:53:23 +0000 (18:53 +0800)]
virtio-rng: add check of period

If period is assigned to 0, limit timer will expire immediately.
It causes a qemu warning:

"main-loop: WARNING: I/O thread spun for 1000 iterations"

This limit is meaningless. This patch forbids to assign 0 to period.

Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Message-id: 1385031203-23790-1-git-send-email-akong@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agos390x: fix flat file load on 32 bit systems
Michael S. Tsirkin [Thu, 21 Nov 2013 13:34:26 +0000 (15:34 +0200)]
s390x: fix flat file load on 32 bit systems

pc-bios/s390-zipl.rom is a flat image so it's expected that
loading it as elf will fail.
It should fall back on loading a flat file, but doesn't
on 32 bit systems, instead it fails printing:
    qemu: hardware error: could not load bootloader 's390-zipl.rom'

The result is boot failure.

The reason is that a 64 bit unsigned interger which is set
to -1 on error is compared to -1UL which on a 32 bit system
with gcc is a 32 bit unsigned interger.
Since both are unsigned, no sign extension takes place and
comparison evaluates to non-equal.

There's no reason to do clever tricks: all functions
we call actually return int so just use int.
And then we can use == -1 everywhere, consistently.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20131121133426.GA30827@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoacpi-build: fix build on glib < 2.14
Michael S. Tsirkin [Thu, 21 Nov 2013 12:17:54 +0000 (14:17 +0200)]
acpi-build: fix build on glib < 2.14

g_array_get_element_size was only added in glib 2.14.
Fortunately we don't use it for any arrays where
element size is > 1, so just add an assert.

Reported-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1385036128-8753-2-git-send-email-mst@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoacpi-build: fix build on glib < 2.22
Michael S. Tsirkin [Thu, 21 Nov 2013 12:17:51 +0000 (14:17 +0200)]
acpi-build: fix build on glib < 2.22

g_string_vprintf was only introduced in 2.24 so switch to vsnprintf
instead.  A bit uglier but name size is fixed at 4 bytes here so it's
easy.

Reported-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1385036128-8753-1-git-send-email-mst@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Thu, 21 Nov 2013 15:09:52 +0000 (07:09 -0800)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

# By Jan Kiszka (1) and others
# Via Gleb Natapov
* qemu-kvm/uq/master:
  kvm: Fix uninitialized cpuid_data
  pci-assign: Remove dead code for direct I/O region access from userspace
  KVM: x86: fix typo in KVM_GET_XCRS

Message-id: cover.1385040432.git.gleb@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'jliu/or32' into staging
Anthony Liguori [Thu, 21 Nov 2013 15:08:47 +0000 (07:08 -0800)]
Merge remote-tracking branch 'jliu/or32' into staging

# By Sebastian Macke
# Via Jia Liu
* jliu/or32:
  target-openrisc: Correct carry flag check of l.addc and l.addic test cases
  target-openrisc: Correct memory bounds checking for the tlb buffers
  openrisc-timer: Reduce overhead, Separate clock update functions
  target-openrisc: Correct wrong epcr register in interrupt handler
  target-openrisc: Remove executable flag for every page
  target-openrisc: Remove unnecessary code generated by jump instructions
  target-openrisc: Speed up move instruction

Message-id: 1384958318-9145-1-git-send-email-proljc@gmail.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'quintela/migration.next' into staging
Anthony Liguori [Thu, 21 Nov 2013 15:08:31 +0000 (07:08 -0800)]
Merge remote-tracking branch 'quintela/migration.next' into staging

# By Wangting (Kathy)
# Via Juan Quintela
* quintela/migration.next:
  The calculation of bytes_xfer in qemu_put_buffer() is wrong

Message-id: 1384946787-8190-1-git-send-email-quintela@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoRevert "e1000/rtl8139: update HMP NIC when every bit is written"
Michael S. Tsirkin [Mon, 18 Nov 2013 19:41:44 +0000 (21:41 +0200)]
Revert "e1000/rtl8139: update HMP NIC when every bit is written"

This reverts commit cd5be5829c1ce87aa6b3a7806524fac07ac9a757.
Digging into hardware specs shows this does not
actually make QEMU behave more like hardware:

There are valid arguments backed by the spec to indicate why the version
of e1000 prior to cd5be582 was more correct: the high byte actually
includes a valid bit, this is why all guests write it last.

For rtl8139 there's actually a separate undocumented valid bit, but we
don't implement it yet.

To summarize all the drivers we know about behave in one way
that allows us to make an assumption about write order and avoid
spurious, incorrect mac address updates to the monitor.

Let's stick to the tried heuristic for 1.7 and
possibly revisit for 1.8.

Reported-by: Vlad Yasevich <vyasevic@redhat.com>
Reviewed-by: Vlad Yasevich <vyasevic@redhat.com>
Cc: Amos Kong <akong@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-build: fix build on glib < 2.14
Michael S. Tsirkin [Thu, 21 Nov 2013 09:22:51 +0000 (11:22 +0200)]
acpi-build: fix build on glib < 2.14

g_array_get_element_size was only added in glib 2.14,
there's no way to find element size in with an older glib.

Fortunately we only use a single table (linker) where element size > 1.
Switch element size to 1 everywhere, then we can just look at len field
to get table size in bytes.

Add an assert to make sure we catch any violations of this rule.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-build: fix build on glib < 2.22
Michael S. Tsirkin [Thu, 21 Nov 2013 09:19:58 +0000 (11:19 +0200)]
acpi-build: fix build on glib < 2.22

g_string_vprintf was only introduced in 2.24 so switch to vsnprintf
instead.  A bit uglier but name size is fixed at 4 bytes here so it's
easy.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopci: unregister vmstate_pcibus on unplug
Bandan Das [Wed, 6 Nov 2013 22:52:17 +0000 (17:52 -0500)]
pci: unregister vmstate_pcibus on unplug

PCIBus registers a vmstate during init. Unregister it upon
removal/unplug.

Signed-off-by: Bandan Das <bsd@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agos390x: fix flat file load on 32 bit systems
Michael S. Tsirkin [Thu, 21 Nov 2013 11:59:15 +0000 (13:59 +0200)]
s390x: fix flat file load on 32 bit systems

pc-bios/s390-zipl.rom is a flat image so it's expected that
loading it as elf will fail.
It should fall back on loading a flat file, but doesn't
on 32 bit systems, instead it fails printing:
    qemu: hardware error: could not load bootloader 's390-zipl.rom'

The result is boot failure.

The reason is that a 64 bit unsigned interger which is set
to -1 on error is compared to -1UL which on a 32 bit system
with gcc is a 32 bit unsigned interger.
Since both are unsigned, no sign extension takes place and
comparison evaluates to non-equal.

There's no reason to do clever tricks: all functions
we call actually return int so just use int.
And then we can use == -1 everywhere, consistently.

Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agotarget-openrisc: Correct carry flag check of l.addc and l.addic test cases
Sebastian Macke [Tue, 22 Oct 2013 00:12:45 +0000 (02:12 +0200)]
target-openrisc: Correct carry flag check of l.addc and l.addic test cases

The test cases did not correctly test for the carry flag.

Signed-off-by: Sebastian Macke <sebastian@macke.de>
Reviewed-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Jia Liu <proljc@gmail.com>
10 years agotarget-openrisc: Correct memory bounds checking for the tlb buffers
Sebastian Macke [Tue, 22 Oct 2013 00:12:42 +0000 (02:12 +0200)]
target-openrisc: Correct memory bounds checking for the tlb buffers

The mtspr and mfspr routines didn't check for the correct memory boundaries.
This fixes a segmentation fault while booting Linux.

Signed-off-by: Sebastian Macke <sebastian@macke.de>
Reviewed-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Jia Liu <proljc@gmail.com>
10 years agoopenrisc-timer: Reduce overhead, Separate clock update functions
Sebastian Macke [Tue, 22 Oct 2013 00:12:41 +0000 (02:12 +0200)]
openrisc-timer: Reduce overhead, Separate clock update functions

The clock value is only evaluated when really necessary reducing
the overhead of the timer handling.

This also solves a problem in the way the Linux kernel
handles the timer and the expected accuracy.
The old version could lead to inaccurate timings.

Signed-off-by: Sebastian Macke <sebastian@macke.de>
Reviewed-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Jia Liu <proljc@gmail.com>
10 years agotarget-openrisc: Correct wrong epcr register in interrupt handler
Sebastian Macke [Tue, 22 Oct 2013 00:12:40 +0000 (02:12 +0200)]
target-openrisc: Correct wrong epcr register in interrupt handler

This patch corrects several misbehaviors during an interrupt process.
Most of the time the pc is already correct and therefore no special treatment
of the exceptions is necessary.

Tested by checking crashing programs which otherwise work in or1ksim.

Signed-off-by: Sebastian Macke <sebastian@macke.de>
Reviewed-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Jia Liu <proljc@gmail.com>
10 years agotarget-openrisc: Remove executable flag for every page
Sebastian Macke [Tue, 22 Oct 2013 00:12:39 +0000 (02:12 +0200)]
target-openrisc: Remove executable flag for every page

Pages should be flagged executable only if the tlb executable flag is
set or the mmu is off.

Signed-off-by: Sebastian Macke <sebastian@macke.de>
Reviewed-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Jia Liu <proljc@gmail.com>
10 years agotarget-openrisc: Remove unnecessary code generated by jump instructions
Sebastian Macke [Tue, 22 Oct 2013 00:12:38 +0000 (02:12 +0200)]
target-openrisc: Remove unnecessary code generated by jump instructions

The sr_f variable is only used for the l.bf and l.bnf instructions.
For clarity the code is also rewritten using a switch statement instead
of if chaining.

Signed-off-by: Sebastian Macke <sebastian@macke.de>
Reviewed-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Jia Liu <proljc@gmail.com>
10 years agotarget-openrisc: Speed up move instruction
Sebastian Macke [Tue, 22 Oct 2013 00:12:37 +0000 (02:12 +0200)]
target-openrisc: Speed up move instruction

The OpenRISC architecture does not have its own move register
instruction. Instead it uses either "l.addi rd, r0, x" or
"l.ori rd, rs, 0" or "l.or rd, rx, r0"

The l.ori instruction is automatically optimized but not the l.addi instruction.
This patch optimizes for this special case.

Signed-off-by: Sebastian Macke <sebastian@macke.de>
Reviewed-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Jia Liu <proljc@gmail.com>
10 years agoThe calculation of bytes_xfer in qemu_put_buffer() is wrong
Wangting (Kathy) [Tue, 19 Nov 2013 05:53:45 +0000 (05:53 +0000)]
The calculation of bytes_xfer in qemu_put_buffer() is wrong

In qemu_put_buffer(), bytes_xfer += size is wrong, it will be more
than expected, and should be bytes_xfer += l.

Signed-off-by: zhangmin <zhangmin6@huawei.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoMerge remote-tracking branch 'quintela/migration.next' into staging
Anthony Liguori [Tue, 19 Nov 2013 21:03:06 +0000 (13:03 -0800)]
Merge remote-tracking branch 'quintela/migration.next' into staging

# By Peter Lieven
# Via Juan Quintela
* quintela/migration.next:
  migration: drop MADVISE_DONT_NEED for incoming zero pages

Message-id: 1384878412-23521-1-git-send-email-quintela@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Tue, 19 Nov 2013 21:00:52 +0000 (13:00 -0800)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Andreas Färber
# Via Stefan Hajnoczi
* stefanha/block:
  qtest: Use -display none by default

10 years agoMerge remote-tracking branch 'afaerber/tags/qom-devices-for-anthony' into staging
Anthony Liguori [Tue, 19 Nov 2013 21:00:09 +0000 (13:00 -0800)]
Merge remote-tracking branch 'afaerber/tags/qom-devices-for-anthony' into staging

QOM infrastructure fixes for 1.7

* QOM memory leak fix

# gpg: Signature made Tue 19 Nov 2013 01:58:58 AM PST using RSA key ID 3E7E013F
# gpg: Can't check signature: public key not found

# By Vlad Yasevich
# Via Andreas Färber
* afaerber/tags/qom-devices-for-anthony:
  qom: Fix memory leak in object_property_set_link()

10 years agoMerge remote-tracking branch 'rth/tcg-ia64-17' into staging
Anthony Liguori [Tue, 19 Nov 2013 21:00:02 +0000 (13:00 -0800)]
Merge remote-tracking branch 'rth/tcg-ia64-17' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/tcg-ia64-17:
  tcg-ia64: Introduce tcg_opc_bswap64_i
  tcg-ia64: Introduce tcg_opc_ext_i
  tcg-ia64: Introduce tcg_opc_movi_a
  tcg-ia64: Introduce tcg_opc_mov_a
  tcg-ia64: Use A3 form of logical operations
  tcg-ia64: Use SUB_A3 and ADDS_A4 for subtraction
  tcg-ia64: Use ADDS for small addition
  tcg-ia64: Avoid unnecessary stop bit in tcg_out_alu
  tcg-ia64: Move AREG0 to R32
  tcg-ia64: Simplify brcond
  tcg-ia64: Handle constant calls
  tcg-ia64: Use shortcuts for nop insns
  tcg-ia64: Use TCGMemOp within qemu_ldst routines

Message-id: 1384811395-7097-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@amazon.com>