]> xenbits.xensource.com Git - qemu-upstream-4.4-testing.git/log
qemu-upstream-4.4-testing.git
12 years agoMerge remote-tracking branch 'bonzini/hw-dirs' into staging
Anthony Liguori [Mon, 11 Mar 2013 00:39:07 +0000 (19:39 -0500)]
Merge remote-tracking branch 'bonzini/hw-dirs' into staging

* bonzini/hw-dirs:
  sh: move files referencing CPU to hw/sh4/
  ppc: move more files to hw/ppc
  ppc: move files referencing CPU to hw/ppc/
  m68k: move files referencing CPU to hw/m68k/
  i386: move files referencing CPU to hw/i386/
  arm: move files referencing CPU to hw/arm/
  hw: move boards and other isolated files to hw/ARCH
  ppc: express FDT dependency of pSeries and e500 boards via default-configs/
  build: always link device_tree.o into emulators if libfdt available
  hw: include hw header files with full paths
  ppc: do not use ../ in include files
  vt82c686: vt82c686 is not a PCI host bridge
  virtio-9p: remove PCI dependencies from hw/9pfs/
  virtio-9p: use CONFIG_VIRTFS, not CONFIG_LINUX
  hw: move device-hotplug.o to toplevel, compile it once
  hw: move qdev-monitor.o to toplevel directory
  hw: move fifo.[ch] to libqemuutil
  hw: move char backends to backends/

Conflicts:
backends/baum.c
backends/msmouse.c
hw/a15mpcore.c
hw/arm/Makefile.objs
hw/arm/pic_cpu.c
hw/dataplane/event-poll.c
hw/dataplane/virtio-blk.c
include/char/baum.h
include/char/msmouse.h
qemu-char.c
vl.c

Resolve conflicts caused by header movements.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 11 Mar 2013 00:33:03 +0000 (19:33 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

# By Lei Li (2) and others
# Via Stefan Hajnoczi
* stefanha/trivial-patches:
  Fix the wrong description in qemu manual
  pci_host: Drop write-only address_space field
  rng-random: Use qemu_open / qemu_close
  configure: Require at least spice-protocol-0.12.3
  osdep: replace setsockopt by qemu_setsockopt
  lm32: remove unused function
  rtc-test: Fix test failures with recent glib
  configure: Create link to icon bitmap for out-of-tree builds

12 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Mon, 11 Mar 2013 00:30:45 +0000 (19:30 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

# By Paolo Bonzini (4) and Peter Lieven (2)
# Via Paolo Bonzini
* bonzini/scsi-next:
  scsi-disk: handle io_canceled uniformly and correctly
  scsi-disk: do not complete canceled UNMAP requests
  scsi: do not call scsi_read_data/scsi_write_data for a canceled request
  iscsi: look for pkg-config file too
  iscsi: add iscsi_truncate support
  iscsi: retry read, write, flush and unmap on unit attention check conditions

12 years agoqemu-char: fix win32 build
Blue Swirl [Sat, 9 Mar 2013 09:56:04 +0000 (09:56 +0000)]
qemu-char: fix win32 build

96c6384776d631839a9c8fe02bf135f9ba22586c did not adjust
Win32 #ifdeffery properly, breaking build in later commits. Fix.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Tested-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 0ba5565b1ed44380c57d4a5fab86e9549f581ebf.1362822910.git.blauwirbel@gmail.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agobaum: fix build
Blue Swirl [Sat, 9 Mar 2013 09:56:03 +0000 (09:56 +0000)]
baum: fix build

08744c98115cfa144ed3493556024e400b2e2573 removed hw/baum.h
but did not adjust hw/baum.c, breaking build. Fix.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Message-id: c50406bda98f8b277e8b9004a0012fa5e5c124d0.1362822910.git.blauwirbel@gmail.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-serial: make flow control explicit in virtio-console
Amit Shah [Tue, 5 Mar 2013 17:51:35 +0000 (23:21 +0530)]
virtio-serial: make flow control explicit in virtio-console

virtio-console.c used to return a value less than the number of bytes
asked to be written out to a chardev backend in case the backend is not
writable.  virtio-serial-bus.c then implicitly enabled flow control for
that port.

Make this explicit instead.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: f5ec50b068c25422256e499cf4adc06d353bf394.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio: console: add flow control
Amit Shah [Tue, 5 Mar 2013 17:51:34 +0000 (23:21 +0530)]
virtio: console: add flow control

The virtio-serial-bus already has the logic to make flow control work
properly.  Hook into the char layer's new ability to signal a backend is
writable again.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: abffa02235d55ca6e2489068c58971c8897e976c.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoserial: add flow control to transmit
Anthony Liguori [Tue, 5 Mar 2013 17:51:33 +0000 (23:21 +0530)]
serial: add flow control to transmit

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 2976f10d4e66ed4a34011f6f0d6937026d22be5f.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: move text console init to console.c
Anthony Liguori [Tue, 5 Mar 2013 17:51:32 +0000 (23:21 +0530)]
qemu-char: move text console init to console.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 17cefde0a8d7807294bab95e93c3328a20d3f2ed.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: move msmouse registeration to msmouse.c
Anthony Liguori [Tue, 5 Mar 2013 17:51:31 +0000 (23:21 +0530)]
qemu-char: move msmouse registeration to msmouse.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: b47d1153b0d7669743c9a6bb98ce30f4cf7f876b.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: move baum registration to baum.c
Anthony Liguori [Tue, 5 Mar 2013 17:51:30 +0000 (23:21 +0530)]
qemu-char: move baum registration to baum.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1b24baa1ec3a174d5cad31e079d829904b53077b.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: move spice registration to spice-qemu-char.c
Anthony Liguori [Tue, 5 Mar 2013 17:51:29 +0000 (23:21 +0530)]
qemu-char: move spice registration to spice-qemu-char.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 49a8d12eeb117e5530b2fab02af7681b54f9245c.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: make char drivers dynamically registerable
Anthony Liguori [Tue, 5 Mar 2013 17:51:28 +0000 (23:21 +0530)]
qemu-char: make char drivers dynamically registerable

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 0ff4f5f2b8b7afdb85a0c241403ad73f472f0b81.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: remove use of QEMUTimer in favor of glib idle function
Anthony Liguori [Tue, 5 Mar 2013 17:51:27 +0000 (23:21 +0530)]
qemu-char: remove use of QEMUTimer in favor of glib idle function

qemu-char is now independent of the QEMU main loop.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 3cda0bbcfb94912df8a767983a52bb71a4a3231d.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: use a glib timeout instead of qemu-timer
Anthony Liguori [Tue, 5 Mar 2013 17:51:26 +0000 (23:21 +0530)]
qemu-char: use a glib timeout instead of qemu-timer

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 05a883ce5a98275b976bf0124610599859c2b7da.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agochar: add gio watch fn for tcp backends
Amit Shah [Tue, 5 Mar 2013 17:51:25 +0000 (23:21 +0530)]
char: add gio watch fn for tcp backends

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: b50e668c4f4146a654c5d4412440eb9e589f2c02.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: add pty watch
Anthony Liguori [Tue, 5 Mar 2013 17:51:24 +0000 (23:21 +0530)]
qemu-char: add pty watch

This lets ptys support adding front end watchs.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 23380f37b22d407ba0b9e080f6ea0d66b279f2d2.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: add watch support
Anthony Liguori [Tue, 5 Mar 2013 17:51:23 +0000 (23:21 +0530)]
qemu-char: add watch support

This allows a front-end to request for a callback when the backend
is writable again.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 96f93c0f741064604bbb6389ce962191120af8b7.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: tcp: make use GIOChannel
Anthony Liguori [Tue, 5 Mar 2013 17:51:22 +0000 (23:21 +0530)]
qemu-char: tcp: make use GIOChannel

I didn't bother switching to g_io_channel_read/write because we need to use
sendmsg on Unix.  No problem though since we're using an unbuffered channel.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 002f726576dfb51bca4854aa257b74d77c1cd4e8.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: convert UDP to GIOChannel
Anthony Liguori [Tue, 5 Mar 2013 17:51:21 +0000 (23:21 +0530)]
qemu-char: convert UDP to GIOChannel

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 775a2bd666a3d1fa008656bf97191b7573c6ffb5.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: convert pty to GIOChannel
Anthony Liguori [Tue, 5 Mar 2013 17:51:20 +0000 (23:21 +0530)]
qemu-char: convert pty to GIOChannel

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 339eebf3c59a450b0354056e9ac4b41f67230831.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: convert fd_chr to use a GIOChannel
Anthony Liguori [Tue, 5 Mar 2013 17:51:19 +0000 (23:21 +0530)]
qemu-char: convert fd_chr to use a GIOChannel

This uses the newly introduced IOWatchPoll source.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 0cb5d14510ee835a0ebc23676d10a2cce9280da5.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agochar: add IOWatchPoll support
Anthony Liguori [Tue, 5 Mar 2013 17:51:18 +0000 (23:21 +0530)]
char: add IOWatchPoll support

This is a special GSource that supports CharDriverState style
poll callbacks.

For reviewability and bisectability, this code is #if 0'd out in this
patch to avoid unused warnings since all of the functions are static.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 9b59ac17b9d0bb3972a73fed04d415f07b391936.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: remove dead/confusing logic with nb_stdio_clients
Anthony Liguori [Tue, 5 Mar 2013 17:51:17 +0000 (23:21 +0530)]
qemu-char: remove dead/confusing logic with nb_stdio_clients

This code is very old dating back to 2007.  What is puzzling is that
STDIO_MAX_CLIENTS was always #define to 1 meaning that all of the code to deal
with more than one client was unreachable.

Just remove the whole mess of it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: d276bccdbf4e7463020c5f539f61ae3bfbc88d1d.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agochar-socket: fix error reporting
Anthony Liguori [Tue, 5 Mar 2013 17:51:16 +0000 (23:21 +0530)]
char-socket: fix error reporting

Right now the inet connect code tries all available addresses but until one
doesn't fail.  It passes local_err each time without clearing it from the
previous failure.  This can trigger an assert since the inet connect code
tries to set an error on an object != NULL.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: 16c806d60aa5e9660ed7751bb4e37dcd278f97f0.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoFix the wrong description in qemu manual
Lei Li [Thu, 7 Mar 2013 07:50:26 +0000 (15:50 +0800)]
Fix the wrong description in qemu manual

Fix LP#1151450 the wrong description in qemu manual:

'qemu-system-x86_84' should be 'qemu-system-x86_64'.

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agopci_host: Drop write-only address_space field
Peter Maydell [Fri, 1 Mar 2013 16:57:41 +0000 (16:57 +0000)]
pci_host: Drop write-only address_space field

The address_space field of PCIHostState was only ever written, never used.
Drop it completely.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agorng-random: Use qemu_open / qemu_close
Stefan Berger [Fri, 1 Mar 2013 12:53:55 +0000 (07:53 -0500)]
rng-random: Use qemu_open / qemu_close

In the rng backend use qemu_open and qemu_close rather than POSIX
open/close.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agoconfigure: Require at least spice-protocol-0.12.3
Michal Privoznik [Fri, 1 Mar 2013 07:43:18 +0000 (08:43 +0100)]
configure: Require at least spice-protocol-0.12.3

As of 5a49d3e9 we assume SPICE_PORT_EVENT_BREAK to be defined.
However, it is defined not in 0.12.2 what we require now, but in
0.12.3.  Therefore in order to prevent build failure we must
adjust our minimal requirements.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agoosdep: replace setsockopt by qemu_setsockopt
Lei Li [Wed, 6 Mar 2013 14:29:16 +0000 (22:29 +0800)]
osdep: replace setsockopt by qemu_setsockopt

Fix the compiler warning when cross build qemu-ga
for windows by using qemu_setsockopt() instead of
setsockopt().

util/osdep.c: In function 'socket_set_nodelay':
util/osdep.c:69:5: warning: passing argument 4 of 'setsockopt' from
                   incompatible pointer type [enabled by default]
In file included from /home/lei/qemu_b/include/sysemu/os-win32.h:30:0,
                 from /home/lei/qemu_b/include/qemu-common.h:46,
                 from util/osdep.c:48:
/usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:990:63: note:
                 expected 'const char *' but argument is of type 'int *'

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agolm32: remove unused function
Paolo Bonzini [Mon, 4 Mar 2013 17:11:47 +0000 (18:11 +0100)]
lm32: remove unused function

The milkymist-minimac device in fact does not exist at all.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agortc-test: Fix test failures with recent glib
Cole Robinson [Wed, 27 Feb 2013 00:31:32 +0000 (19:31 -0500)]
rtc-test: Fix test failures with recent glib

As of glib 2.35.4, glib changed its logic for ordering test cases:

https://bugzilla.gnome.org/show_bug.cgi?id=694487

This was causing failures in rtc-test. Group the reordered test
cases into their own suite, which maintains the original ordering.

CC: qemu-stable@nongnu.org
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agoconfigure: Create link to icon bitmap for out-of-tree builds
Jan Kiszka [Fri, 22 Feb 2013 20:05:01 +0000 (21:05 +0100)]
configure: Create link to icon bitmap for out-of-tree builds

This allows to pick up the icon when starting QEMU directly from an
out-of-tree build directory.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agohw/nand.c: correct the sense of the BUSY/READY status bit
Kuo-Jung Su [Tue, 5 Mar 2013 21:27:24 +0000 (21:27 +0000)]
hw/nand.c: correct the sense of the BUSY/READY status bit

The BIT6 of Status Register(SR):

SR[6] behaves the same as R/B# pin
    SR[6] = 0 indicates the device is busy;
    SR[6] = 1 means the device is ready

Some NAND flash controller (i.e. ftnandc021) relies on the SR[6]
to determine if the NAND flash erase/program is success or error timeout.

P.S:
The exmaple NAND flash datasheet could be found at following link:
http://www.mxic.com.tw/QuickPlace/hq/PageLibrary4825740B00298A3B.nsf/h_Index/8FEA549237D2F7674825795800104C26/$File/MX30LF1G08AA,%203V,%201Gb,%20v1.1.pdf

Signed-off-by: Kuo-Jung Su <dantesu@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoscsi-disk: handle io_canceled uniformly and correctly
Paolo Bonzini [Mon, 25 Feb 2013 11:16:05 +0000 (12:16 +0100)]
scsi-disk: handle io_canceled uniformly and correctly

Always check it immediately after calling bdrv_acct_done, and
always do a "goto done" in case the "done" label has to free
some memory---as is the case for scsi_unmap_complete in the
previous patch.

This patch could fix problems that happen when a request is
split into multiple parts, and one of them is canceled.  Then
the next part is fired, but the HBA's cancellation callbacks have
fired already.  Whether this happens or not, depends on how the
block/ driver implements AIO cancellation.  It it does a simple
bdrv_drain_all() or similar, then it will not have a problem.
If it only cancels the given AIOCB, this scenario could happen.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoscsi-disk: do not complete canceled UNMAP requests
Paolo Bonzini [Mon, 25 Feb 2013 11:14:34 +0000 (12:14 +0100)]
scsi-disk: do not complete canceled UNMAP requests

Canceled requests should never be completed, and doing that could cause
accesses to a NULL hba_private field.

Cc: qemu-stable@nongnu.org
Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Tested-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoscsi: do not call scsi_read_data/scsi_write_data for a canceled request
Paolo Bonzini [Mon, 25 Feb 2013 11:12:58 +0000 (12:12 +0100)]
scsi: do not call scsi_read_data/scsi_write_data for a canceled request

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoiscsi: look for pkg-config file too
Paolo Bonzini [Fri, 22 Feb 2013 17:14:28 +0000 (18:14 +0100)]
iscsi: look for pkg-config file too

Due to library conflicts, Fedora will have to put libiscsi in
/usr/lib/iscsi.  Simplify configuration by using a pkg-config
file.  The Fedora package will distribute one, and the patch
to add it has been sent to upstream libiscsi as well.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoiscsi: add iscsi_truncate support
Peter Lieven [Mon, 18 Feb 2013 13:50:46 +0000 (14:50 +0100)]
iscsi: add iscsi_truncate support

this patch adds iscsi_truncate which effectively allows for
online resizing of iscsi volumes. for this to work you have
to resize the volume on your storage and then call
block_resize command in qemu which will issue a
readcapacity16 to update the capacity.

v4:
  - factor out complete readcapacity logic into a separate function
  - handle capacity change check condition in readcapacity function
    (this happens if the block_resize cmd is the first iscsi task
    executed after a resize on the storage)

v3:
  - remove switch statement in iscsi_open
  - create separate patch for brdv_drain_all() in bdrv_truncate()

v2:
  - add a general bdrv_drain_all() before bdrv_truncate() to avoid
    in-flight AIOs while the device is truncated
  - since no AIOs are in flight we can use a sync libiscsi call
    to re-read the capacity
  - factor out the readcapacity16 logic as it is redundant
    to iscsi_open() and iscsi_truncate().

Signed-off-by: Peter Lieven <pl@kamp.de>
[allow any type of unit attention check condition in iscsi_readcapacity_sync(),
 as in Message-ID: <51263A2A.6070304@dlhnet.de> - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoiscsi: retry read, write, flush and unmap on unit attention check conditions
Peter Lieven [Thu, 21 Feb 2013 15:15:54 +0000 (16:15 +0100)]
iscsi: retry read, write, flush and unmap on unit attention check conditions

the storage might return a check condition status for various reasons.
(e.g. bus reset, capacity change, thin-provisioning info etc.)

currently all these informative status responses lead to an I/O error
which is populated to the guest. this patch introduces a retry mechanism
to avoid this.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoMerge branch 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Aurelien Jarno [Tue, 5 Mar 2013 14:11:30 +0000 (15:11 +0100)]
Merge branch 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm:
  MAINTAINERS: add entry for ARM KVM guest cores
  configure: Enable KVM on ARM
  hw/kvm/arm_gic: Implement support for KVM in-kernel ARM GIC
  target-arm: Use MemoryListener to identify GIC base address for KVM
  hw/arm_gic: Convert ARM GIC classes to use init/realize
  hw/arm_gic: Add presave/postload hooks
  ARM KVM: save and load VFP registers from kernel
  ARM: KVM: Add support for KVM on ARM architecture
  target-arm: Drop CPUARMState* argument from bank_number()
  linux-headers: resync from mainline to add ARM KVM headers
  oslib-posix: Align to permit transparent hugepages on ARM Linux
  target-arm: Don't decode RFE or SRS on M profile cores
  target-arm: Factor out handling of SRS instruction

12 years agomipsn32-linux-user: Configure the architecture properly
Richard Henderson [Sun, 10 Feb 2013 18:30:50 +0000 (10:30 -0800)]
mipsn32-linux-user: Configure the architecture properly

N32 is a 64-bit cpu with a 32-bit address space.  We have
existing cpp defines for this situation, but weren't using them.

This does mean that the linux-user/mipsn32 directory must be
merged with the linux-user/mips64 directory, and differences
must be resolved via ifdefs.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agomips64-linux-user: Enable 64-bit address mode and fpu
Richard Henderson [Sun, 10 Feb 2013 18:30:46 +0000 (10:30 -0800)]
mips64-linux-user: Enable 64-bit address mode and fpu

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agomips-linux-user: Fix n32 and n64 syscalls
Richard Henderson [Sun, 10 Feb 2013 18:30:45 +0000 (10:30 -0800)]
mips-linux-user: Fix n32 and n64 syscalls

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agomips-linux-user: Save and restore fpu and dsp from sigcontext
Richard Henderson [Sun, 10 Feb 2013 18:30:44 +0000 (10:30 -0800)]
mips-linux-user: Save and restore fpu and dsp from sigcontext

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agomips-linux-user: Enable mips64 and mipsn32 linux-user targets
Richard Henderson [Sun, 10 Feb 2013 18:30:43 +0000 (10:30 -0800)]
mips-linux-user: Enable mips64 and mipsn32 linux-user targets

At this point we can enable compilation, though things
still don't work.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agomips-linux-user: Share o32 code for n32 and n64 signals
Richard Henderson [Sun, 10 Feb 2013 18:30:42 +0000 (10:30 -0800)]
mips-linux-user: Share o32 code for n32 and n64 signals

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agomips-linux-user: Delete n32 and n64 signal stubs
Richard Henderson [Sun, 10 Feb 2013 18:30:41 +0000 (10:30 -0800)]
mips-linux-user: Delete n32 and n64 signal stubs

Deleting these first makes the next patch much easier to read.
This doesn't cause any sort of compilation failure because we
have not yet enabled n32/n64 compilation.  This is dead code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agoMAINTAINERS: add entry for ARM KVM guest cores
Peter Maydell [Tue, 5 Mar 2013 00:34:43 +0000 (00:34 +0000)]
MAINTAINERS: add entry for ARM KVM guest cores

Add an entry indicating maintainer status for the ARM KVM code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoconfigure: Enable KVM on ARM
Peter Maydell [Tue, 5 Mar 2013 00:34:43 +0000 (00:34 +0000)]
configure: Enable KVM on ARM

Enable KVM on ARM hosts, now that all the necessary components
for it exist.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agohw/kvm/arm_gic: Implement support for KVM in-kernel ARM GIC
Peter Maydell [Tue, 5 Mar 2013 00:34:43 +0000 (00:34 +0000)]
hw/kvm/arm_gic: Implement support for KVM in-kernel ARM GIC

Implement support for using the KVM in-kernel GIC for ARM.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Use MemoryListener to identify GIC base address for KVM
Peter Maydell [Tue, 5 Mar 2013 00:34:42 +0000 (00:34 +0000)]
target-arm: Use MemoryListener to identify GIC base address for KVM

When using an in-kernel GIC with KVM, we need to tell the kernel where
the GIC's memory mapped registers live. Do this by registering a
MemoryListener which tracks where the board model maps the A15's
private peripherals, so we can finish the GIC initialisation
when the GIC is actually mapped.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agohw/arm_gic: Convert ARM GIC classes to use init/realize
Peter Maydell [Tue, 5 Mar 2013 00:34:42 +0000 (00:34 +0000)]
hw/arm_gic: Convert ARM GIC classes to use init/realize

Convert the ARM GIC classes to use init/realize rather than
SysBusDevice::init. (We have to do them all in one patch to
avoid unconverted subclasses calling a nonexistent SysBusDevice
init function in the base class and crashing.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
12 years agohw/arm_gic: Add presave/postload hooks
Peter Maydell [Tue, 5 Mar 2013 00:34:41 +0000 (00:34 +0000)]
hw/arm_gic: Add presave/postload hooks

Add presave/postload hooks to the ARM GIC common base class.
These will be used by the KVM in-kernel GIC subclass to sync
state between kernel and userspace when migrating.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoARM KVM: save and load VFP registers from kernel
Peter Maydell [Tue, 5 Mar 2013 00:34:41 +0000 (00:34 +0000)]
ARM KVM: save and load VFP registers from kernel

Add support for saving and restoring VFP register state from the
kernel. This includes a check that the KVM-created CPU has full
VFP support (as the TCG Cortex-A15 model always does), since for
the moment ARM QEMU doesn't have any way to tweak optional features
on created CPUs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoARM: KVM: Add support for KVM on ARM architecture
Christoffer Dall [Tue, 5 Mar 2013 00:34:41 +0000 (00:34 +0000)]
ARM: KVM: Add support for KVM on ARM architecture

Add basic support for KVM on ARM architecture.

Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
[PMM: Minor tweaks and code cleanup, switch to ONE_REG]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agotarget-arm: Drop CPUARMState* argument from bank_number()
Peter Maydell [Tue, 5 Mar 2013 00:34:40 +0000 (00:34 +0000)]
target-arm: Drop CPUARMState* argument from bank_number()

Drop the CPUARMState* argument from bank_number(), since we only
use it for passing to cpu_abort(). Use hw_error() instead.
This avoids propagating further interfaces using env pointers.

In the long term this function's callers need auditing to fix
problems where badly behaved guests can pass invalid bank numbers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
12 years agolinux-headers: resync from mainline to add ARM KVM headers
Peter Maydell [Tue, 5 Mar 2013 00:34:40 +0000 (00:34 +0000)]
linux-headers: resync from mainline to add ARM KVM headers

Resync QEMU's copy of the Linux kernel headers from
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
commit 2ef14f4. This adds the ARM KVM headers, since ARM KVM
support has just hit mainline via Russell's ARM tree.

This is not a pure sync -- I have removed by hand some changes
that would have reverted updates for s390x and ppc which have not
yet hit mainline.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agooslib-posix: Align to permit transparent hugepages on ARM Linux
Peter Maydell [Tue, 5 Mar 2013 00:34:40 +0000 (00:34 +0000)]
oslib-posix: Align to permit transparent hugepages on ARM Linux

ARM Linux (like x86-64 Linux) can use transparent hugepages for
KVM if memory blocks are 2MiB aligned; set QEMU_VMALLOC_ALIGN
accordingly.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agotarget-arm: Don't decode RFE or SRS on M profile cores
Peter Maydell [Tue, 5 Mar 2013 00:31:17 +0000 (00:31 +0000)]
target-arm: Don't decode RFE or SRS on M profile cores

M profile cores do not have the RFE or SRS instructions, so
correctly UNDEF these insn patterns on those cores.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Factor out handling of SRS instruction
Peter Maydell [Tue, 5 Mar 2013 00:31:17 +0000 (00:31 +0000)]
target-arm: Factor out handling of SRS instruction

Factor out the handling of the SRS instruction rather than
duplicating it between the Thumb and ARM decoders. This in
passing fixes two bugs in the Thumb decoder's SRS handling
which didn't exist in the ARM decoder:
 * (LP:1079080) storing CPSR rather than SPSR (fixed in the
   ARM decoder in commit c67b6b71 in 2009)
 * failing to free the 'addr' TCG temp in the writeback case

Reported-by: Cesson Vincent <vcesson@stmi.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-mips: Fix accumulator selection for MIPS16 and microMIPS
Richard Sandiford [Mon, 21 Jan 2013 20:43:31 +0000 (20:43 +0000)]
target-mips: Fix accumulator selection for MIPS16 and microMIPS

Add accumulator arguments to gen_HILO and gen_muldiv, rather than
extracting the accumulator directly from ctx->opcode.  The extraction
was only right for the standard encoding: MIPS16 doesn't have access
to the DSP registers, while microMIPS encodes the accumulator register
in a different field (bits 14 and 15).

Passing the accumulator register is probably an over-generalisation
for division and 64-bit multiplication, which never access anything
other than HI and LO, and which always pass 0 as the new argument.
Separating them felt a bit fussy though.

Signed-off-by: Richard Sandiford <rdsandiford@googlemail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotarget-mips: Translate breaks and traps into the appropriate signal
Meador Inge [Thu, 10 Jan 2013 22:50:22 +0000 (16:50 -0600)]
target-mips: Translate breaks and traps into the appropriate signal

GCC and GAS are capable of generating traps or breaks to check for
division by zero.  Additionally, GAS is capable of generating traps
or breaks to check for overflow on certain division and multiplication
operations.  The Linux kernel translates these traps and breaks into
signals.  This patch implements the corresponding feature in QEMU.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotarget-mips: fix DSP overflow macro and affected routines
Petar Jovanovic [Mon, 25 Feb 2013 15:45:40 +0000 (16:45 +0100)]
target-mips: fix DSP overflow macro and affected routines

The previous implementation incorrectly used same macro to detect overflow
for addition and subtraction. This patch makes distinction between these
two, and creates separate macros. The affected routines are changed
accordingly.

This change also includes additions to the existing tests for SUBQ_S_PH and
SUBQ_S_W that would trigger the fixed issue, and it removes dead code from
the test file. The last test case in subq_s_w.c is a bug found/reported/
isolated by Klaus Peichl from Dolby.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Mon, 4 Mar 2013 14:22:48 +0000 (08:22 -0600)]
Merge remote-tracking branch 'stefanha/block' into staging

# By MORITA Kazutaka (5) and others
# Via Stefan Hajnoczi
* stefanha/block:
  block: for HMP commit() operations on 'all', skip non-COW drives
  sheepdog: add support for connecting to unix domain socket
  sheepdog: use inet_connect to simplify connect code
  sheepdog: accept URIs
  move socket_set_nodelay to osdep.c
  slirp/tcp_subr.c: fix coding style in tcp_connect
  dataplane: remove EventPoll in favor of AioContext
  virtio-blk: fix unplug + virsh reboot
  ide/macio: Fix macio DMA initialisation.

12 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 4 Mar 2013 14:22:41 +0000 (08:22 -0600)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

virtio,vhost,pci,e1000

Mostly bugfixes, but also some ICH work by Laszlo.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Thu 28 Feb 2013 07:13:56 AM CST using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Michael S. Tsirkin (2) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  Set virtio-serial device to have a default of 2 MSI vectors.
  ICH9 LPC: Reset Control Register, basic implementation
  Fix guest OS hang when 64bit PCI bar present
  e1000: unbreak the guest network migration to 1.3
  vhost: memory sync fixes

12 years agoMerge remote-tracking branch 'kraxel/seabios-1.7.2.1' into staging
Anthony Liguori [Mon, 4 Mar 2013 14:20:32 +0000 (08:20 -0600)]
Merge remote-tracking branch 'kraxel/seabios-1.7.2.1' into staging

# By Gerd Hoffmann
# Via Gerd Hoffmann
* kraxel/seabios-1.7.2.1:
  update seabios to 1.7.2.1

12 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Mon, 4 Mar 2013 14:20:06 +0000 (08:20 -0600)]
Merge remote-tracking branch 'stefanha/net' into staging

# By Jason Wang (2) and others
# Via Stefan Hajnoczi
* stefanha/net:
  qmp: netdev_add is like -netdev, not -net, fix documentation
  doc: document -netdev hubport
  net: reduce the unnecessary memory allocation of multiqueue
  tap: set IFF_ONE_QUEUE per default
  tap: forbid creating multiqueue tap when hub is used
  net: fix unbounded NetQueue
  net: fix qemu_flush_queued_packets() in presence of a hub

12 years agoblock: for HMP commit() operations on 'all', skip non-COW drives
Jeff Cody [Tue, 26 Feb 2013 14:55:48 +0000 (09:55 -0500)]
block: for HMP commit() operations on 'all', skip non-COW drives

During a commit of 'all' using the HMP non-live commit, the operation
is aborted and returns error on the first error enountered.  When
non-COW drives are in use (e.g. ejected floppy, cdrom, or drives without
a backing parent), that means a commit all will return an error of either
-ENOMEDIUM or -ENOTSUP.  This is not desirable, so for the 'all' commit
case, only attempt the commit if both bs->drv and bs->backing_hd are
present.

More succinctly: 'commit all' now means a commit on all COW drives.

This means an individual commit to a specific non-COW drive will still
return the appropriate error (-ENOMEDIUM if eject / not present, -ENOTSUP
if no backing file).

Reported-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agosheepdog: add support for connecting to unix domain socket
MORITA Kazutaka [Fri, 22 Feb 2013 03:39:53 +0000 (12:39 +0900)]
sheepdog: add support for connecting to unix domain socket

This patch adds support for a unix domain socket for a connection
between qemu and local sheepdog server.  You can use the unix domain
socket with the following syntax:

 $ qemu sheepdog+unix:///<vdiname>?socket=<socket path>[#snapid]

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agosheepdog: use inet_connect to simplify connect code
MORITA Kazutaka [Fri, 22 Feb 2013 03:39:52 +0000 (12:39 +0900)]
sheepdog: use inet_connect to simplify connect code

This uses the form "<host>:<port>" for the representation of the
sheepdog server to use inet_connect.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agosheepdog: accept URIs
MORITA Kazutaka [Fri, 22 Feb 2013 03:39:51 +0000 (12:39 +0900)]
sheepdog: accept URIs

The URI syntax is consistent with the NBD and Gluster syntax.  The
syntax is

  sheepdog[+tcp]://[host:port]/vdiname[#snapid|#tag]

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agomove socket_set_nodelay to osdep.c
MORITA Kazutaka [Fri, 22 Feb 2013 03:39:50 +0000 (12:39 +0900)]
move socket_set_nodelay to osdep.c

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agoslirp/tcp_subr.c: fix coding style in tcp_connect
MORITA Kazutaka [Fri, 22 Feb 2013 03:39:49 +0000 (12:39 +0900)]
slirp/tcp_subr.c: fix coding style in tcp_connect

Fix coding style in tcp_connect before the next patch.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agodataplane: remove EventPoll in favor of AioContext
Paolo Bonzini [Fri, 22 Feb 2013 09:40:34 +0000 (10:40 +0100)]
dataplane: remove EventPoll in favor of AioContext

During the review of the dataplane code, the EventPoll API morphed itself
(not concidentially) into something very very similar to an AioContext.
Thus, it is trivial to convert virtio-blk-dataplane to use AioContext,
and a first baby step towards letting dataplane talk directly to the
QEMU block layer.

The only interesting note is the value-copy of EventNotifiers.  At least
in my opinion this is part of the EventNotifier API and is even portable
to Windows.  Of course, in this case you should not close the notifier's
underlying file descriptors or handle with event_notifier_cleanup.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agovirtio-blk: fix unplug + virsh reboot
Christian Borntraeger [Fri, 22 Feb 2013 13:37:10 +0000 (14:37 +0100)]
virtio-blk: fix unplug + virsh reboot

virtio-blk registers a vmstate change handler. Unfortunately this
handler is not unregistered on unplug, leading to some random
crashes if the system is restarted, e.g. via virsh reboot.
Lets unregister the vmstate change handler if the device is removed.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agoide/macio: Fix macio DMA initialisation.
Mark Cave-Ayland [Sun, 24 Feb 2013 20:46:11 +0000 (20:46 +0000)]
ide/macio: Fix macio DMA initialisation.

Commit 07a7484e5d713f1eb7c1c37b18a8ab0d56d88875 accidentally introduced a bug
in the initialisation of the second macio DMA device which could cause some
DMA operations to segfault QEMU.

CC: Andreas Färber <afaerber@suse.de>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agogen-icount.h: Rename gen_icount_start/end to gen_tb_start/end
Peter Maydell [Fri, 22 Feb 2013 18:10:05 +0000 (18:10 +0000)]
gen-icount.h: Rename gen_icount_start/end to gen_tb_start/end

The gen_icount_start/end functions are now somewhat misnamed since they
are useful for generic "start/end of TB" code, used for more than just
icount. Rename them to gen_tb_start/end.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotranslate-all.c: Remove cpu_unlink_tb()
Peter Maydell [Fri, 22 Feb 2013 18:10:04 +0000 (18:10 +0000)]
translate-all.c: Remove cpu_unlink_tb()

The (unsafe) function cpu_unlink_tb() is now unused, so we can simply
remove it and any code that was only used by it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoHandle CPU interrupts by inline checking of a flag
Peter Maydell [Fri, 22 Feb 2013 18:10:03 +0000 (18:10 +0000)]
Handle CPU interrupts by inline checking of a flag

Fix some of the nasty TCG race conditions and crashes by implementing
cpu_exit() as setting a flag which is checked at the start of each TB.
This avoids crashes if a thread or signal handler calls cpu_exit()
while the execution thread is itself modifying the TB graph (which
may happen in system emulation mode as well as in linux-user mode
with a multithreaded guest binary).

This fixes the crashes seen in LP:668799; however there are another
class of crashes described in LP:1098729 which stem from the fact
that in linux-user with a multithreaded guest all threads will
use and modify the same global TCG date structures (including the
generated code buffer) without any kind of locking. This means that
multithreaded guest binaries are still in the "unsupported"
category.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agocpu-exec: wrap tcg_qemu_tb_exec() in a fn to restore the PC
Peter Maydell [Fri, 22 Feb 2013 18:10:02 +0000 (18:10 +0000)]
cpu-exec: wrap tcg_qemu_tb_exec() in a fn to restore the PC

If tcg_qemu_tb_exec() returns a value whose low bits don't indicate a
link to an indexed next TB, this means that the TB execution never
started (eg because the instruction counter hit zero).  In this case the
guest PC has to be reset to the address of the start of the TB.
Refactor the cpu-exec code to make all tcg_qemu_tb_exec() calls pass
through a wrapper function which does this restoration if necessary.

Note that the apparent change in cpu_exec_nocache() from calling
cpu_pc_from_tb() with the old TB to calling it with the TB returned by
do_tcg_qemu_tb_exec() is safe, because in the nocache case we can
guarantee that the TB we try to execute is not linked to any others,
so the only possible returned TB is the one we started at. That is,
we should arguably previously have included in cpu_exec_nocache() an
assert(next_tb & ~TB_EXIT_MASK) == tb), since the API requires restore
from next_tb but we were using tb.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agocpu: Introduce ENV_OFFSET macros
Andreas Färber [Fri, 22 Feb 2013 18:10:01 +0000 (18:10 +0000)]
cpu: Introduce ENV_OFFSET macros

Introduce ENV_OFFSET macros which can be used in non-target-specific
code that needs to generate TCG instructions which reference CPUState
fields given the cpu_env register that TCG targets set up with a
pointer to the CPUArchState struct.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcg: Document tcg_qemu_tb_exec() and provide constants for low bit uses
Peter Maydell [Fri, 22 Feb 2013 18:10:00 +0000 (18:10 +0000)]
tcg: Document tcg_qemu_tb_exec() and provide constants for low bit uses

Document tcg_qemu_tb_exec(). In particular, its return value is a
combination of a pointer to the next translation block and some
extra information in the low two bits. Provide some #defines for
the values passed in these bits to improve code clarity.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcg-sparc: fix build
Blue Swirl [Wed, 27 Feb 2013 16:09:38 +0000 (16:09 +0000)]
tcg-sparc: fix build

Fix build breakage by 803d805bcef4ea7b7d6ef0b4929263e1160d6b3c:
make tcg_out_addsub2() always available.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosh: move files referencing CPU to hw/sh4/
Paolo Bonzini [Tue, 5 Feb 2013 14:22:56 +0000 (15:22 +0100)]
sh: move files referencing CPU to hw/sh4/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoppc: move more files to hw/ppc
Paolo Bonzini [Tue, 5 Feb 2013 11:20:00 +0000 (12:20 +0100)]
ppc: move more files to hw/ppc

These sPAPR files do not implement devices, move them over.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoppc: move files referencing CPU to hw/ppc/
Paolo Bonzini [Tue, 5 Feb 2013 14:22:56 +0000 (15:22 +0100)]
ppc: move files referencing CPU to hw/ppc/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agom68k: move files referencing CPU to hw/m68k/
Paolo Bonzini [Tue, 5 Feb 2013 14:22:56 +0000 (15:22 +0100)]
m68k: move files referencing CPU to hw/m68k/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoi386: move files referencing CPU to hw/i386/
Paolo Bonzini [Tue, 5 Feb 2013 14:22:56 +0000 (15:22 +0100)]
i386: move files referencing CPU to hw/i386/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoarm: move files referencing CPU to hw/arm/
Paolo Bonzini [Tue, 5 Feb 2013 14:22:56 +0000 (15:22 +0100)]
arm: move files referencing CPU to hw/arm/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agohw: move boards and other isolated files to hw/ARCH
Paolo Bonzini [Tue, 5 Feb 2013 11:03:15 +0000 (12:03 +0100)]
hw: move boards and other isolated files to hw/ARCH

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoppc: express FDT dependency of pSeries and e500 boards via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 11:52:23 +0000 (12:52 +0100)]
ppc: express FDT dependency of pSeries and e500 boards via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agobuild: always link device_tree.o into emulators if libfdt available
Paolo Bonzini [Tue, 5 Feb 2013 11:36:30 +0000 (12:36 +0100)]
build: always link device_tree.o into emulators if libfdt available

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agohw: include hw header files with full paths
Paolo Bonzini [Mon, 4 Feb 2013 14:40:22 +0000 (15:40 +0100)]
hw: include hw header files with full paths

Done with this script:

cd hw
for i in `find . -name '*.h' | sed 's/^..//'`; do
  echo '\,^#.*include.*["<]'$i'[">], s,'$i',hw/&,'
done | sed -i -f - `find . -type f`

This is so that paths remain valid as files are moved.

Instead, files in hw/dataplane are referenced with the relative path.
We know they are not going to move to include/, and they are the only
include files that are in subdirectories _and_ move.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoppc: do not use ../ in include files
Paolo Bonzini [Sun, 3 Feb 2013 19:18:28 +0000 (20:18 +0100)]
ppc: do not use ../ in include files

This simplifies the scripted execution of the next patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovt82c686: vt82c686 is not a PCI host bridge
Paolo Bonzini [Mon, 4 Feb 2013 14:00:38 +0000 (15:00 +0100)]
vt82c686: vt82c686 is not a PCI host bridge

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovirtio-9p: remove PCI dependencies from hw/9pfs/
Paolo Bonzini [Mon, 4 Feb 2013 14:37:49 +0000 (15:37 +0100)]
virtio-9p: remove PCI dependencies from hw/9pfs/

Also move the 9p.h file to 9pfs/virtio-9p-device.h, for consistency
with the corresponding .c file.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovirtio-9p: use CONFIG_VIRTFS, not CONFIG_LINUX
Paolo Bonzini [Mon, 4 Feb 2013 14:32:02 +0000 (15:32 +0100)]
virtio-9p: use CONFIG_VIRTFS, not CONFIG_LINUX

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agohw: move device-hotplug.o to toplevel, compile it once
Paolo Bonzini [Mon, 4 Feb 2013 16:20:47 +0000 (17:20 +0100)]
hw: move device-hotplug.o to toplevel, compile it once

The situation with device-hotplug.c is similar to qdev-monitor.c.
Add a stub for pci_drive_hot_add, so that it can be compiled once,
and move it out of hw/.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agohw: move qdev-monitor.o to toplevel directory
Paolo Bonzini [Mon, 4 Feb 2013 10:37:52 +0000 (11:37 +0100)]
hw: move qdev-monitor.o to toplevel directory

qdev-monitor.c is the only "core qdev" file that is not used in
user-mode emulation, and it does not define anything that is used
by hardware models.  Remove it from the hw/ directory and
remove hw/qdev-monitor.h from hw/qdev.h too; this requires
some files to have some new explicitly includes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>