qemu.git
8 years agovirtio-rng: hardware random number generator device
Amit Shah [Wed, 20 Jun 2012 06:59:32 +0000 (12:29 +0530)] 
virtio-rng: hardware random number generator device

The Linux kernel already has a virtio-rng driver, this is the device
implementation.

When the guest asks for entropy from the virtio hwrng, it puts a buffer
in the vq.  We then put entropy into that buffer, and push it back to
the guest.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
aliguori: converted to new RngBackend interface
aliguori: remove entropy needed event
aliguori: fix migration

8 years agorng-egd: introduce EGD compliant RNG backend
Anthony Liguori [Mon, 25 Jun 2012 18:13:31 +0000 (13:13 -0500)] 
rng-egd: introduce EGD compliant RNG backend

This backend talks EGD to a CharDriverState.  A typical way to invoke this would
be:

qemu -chardev socket,host=localhost,port=1024,id=chr0 \
     -object rng-egd,chardev=chr0,id=egd0 \
     -device virtio-rng-pci,rng=egd0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agorng-random: add an RNG backend that uses /dev/random (v3)
Anthony Liguori [Mon, 25 Jun 2012 15:34:09 +0000 (10:34 -0500)] 
rng-random: add an RNG backend that uses /dev/random (v3)

The filename can be overridden but it expects a non-blocking source of entropy.
A typical invocation would be:

qemu -object rng-random,id=rng0 -device virtio-rng-pci,rng=rng0

This can also be used with /dev/urandom by using the command line:

qemu -object rng-random,filename=/dev/urandom,id=rng0 \
     -device virtio-rng-pci,rng=rng0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - merged header split patch into this one
v2 -> v3
 - bug fix in rng-random (Paolo)

8 years agorng: add RndBackend abstract object class
Anthony Liguori [Mon, 25 Jun 2012 15:03:47 +0000 (10:03 -0500)] 
rng: add RndBackend abstract object class

This is the backend used by devices that need to request entropy.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agoobject: add object_property_add_bool (v2)
Anthony Liguori [Mon, 25 Jun 2012 15:32:46 +0000 (10:32 -0500)] 
object: add object_property_add_bool (v2)

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - Fix whitespace (Andreas Faerber)

8 years agovl: add -object option to create QOM objects from the command line
Anthony Liguori [Mon, 25 Jun 2012 19:36:33 +0000 (14:36 -0500)] 
vl: add -object option to create QOM objects from the command line

This will create a new QOM object in the '/objects' path.  Note that properties
are set in order which allows for simple objects to be initialized entirely
with this option and then realized.

This option is roughly equivalent to -device but for things that are not
devices.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agotarget-mips: fix wrong microMIPS opcode encoding
陳韋任 (Wei-Ren Chen) [Wed, 14 Nov 2012 02:49:55 +0000 (10:49 +0800)] 
target-mips: fix wrong microMIPS opcode encoding

While reading microMIPS decoding, I found a possible wrong opcode
encoding. According to [1] page 166, the bits 13..12 for MULTU is
0x01 rather than 0x00. Please review, thanks.

[1] MIPS Architecture for Programmers VolumeIV-e: The MIPS DSP
    Application-Specific Extension to the microMIPS32 Architecture

Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
8 years agomips/malta: fix CBUS UART interrupt pin
Aurelien Jarno [Wed, 14 Nov 2012 14:04:42 +0000 (15:04 +0100)] 
mips/malta: fix CBUS UART interrupt pin

According to the MIPS Malta Developement Platform User's Manual, the
i8259 interrupt controller is supposed to be connected to the hardware
IRQ0, and the CBUS UART to the hardware interrupt 2.

In QEMU they are both connected to hardware interrupt 0, the CBUS UART
interrupt being wrong. This patch fixes that. It should be noted that
the irq array in QEMU includes the software interrupts, hence
env->irq[2] is the first hardware interrupt.

Cc: Ralf Baechle <ralf@linux-mips.org>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
8 years agoMerge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-1.3.0-rc0' into staging
Anthony Liguori [Wed, 14 Nov 2012 14:53:40 +0000 (08:53 -0600)] 
Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-1.3.0-rc0' into staging

vfio-pci: KVM INTx accel & common msi_get_message

* awilliam/tags/vfio-pci-for-qemu-1.3.0-rc0:
  vfio-pci: Use common msi_get_message
  vfio-pci: Add KVM INTx acceleration
  linux-headers: Update to 3.7-rc5

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agoMerge remote-tracking branch 'kraxel/pixman.v5' into staging
Anthony Liguori [Wed, 14 Nov 2012 14:53:03 +0000 (08:53 -0600)] 
Merge remote-tracking branch 'kraxel/pixman.v5' into staging

* kraxel/pixman.v5:
  pixman: cleanup properly on make distclean
  pixman: add licensing info
  pixman: build internal version early
  pixman: pass cflags, add -fPIC
  pixman: disable gtk
  pixman: set --host for cross builds
  pixman: add output dir to include path

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agoMerge remote-tracking branch 'bonzini/nbd-next' into staging
Anthony Liguori [Wed, 14 Nov 2012 14:51:06 +0000 (08:51 -0600)] 
Merge remote-tracking branch 'bonzini/nbd-next' into staging

* bonzini/nbd-next:
  nbd: fixes to read-only handling
  hmp: add NBD server commands
  nbd: disallow nbd-server-add before nbd-server-start
  nbd: force read-only export for read-only devices
  nbd: fix nbd_server_stop crash when no server was running
  nbd: accept URIs
  nbd: accept relative path to Unix socket
  qemu-nbd: initialize main loop before block layer

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Wed, 14 Nov 2012 14:50:45 +0000 (08:50 -0600)] 
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  virtio-scsi: use dma_context_memory
  dma: Define dma_context_memory and use in sysbus-ohci
  megasas: Correct target/lun mapping
  scsi-disk: flush cache after disabling it
  megasas: do not include block_int.h
  scsi: remove superfluous call to scsi_device_set_ua
  virtio-scsi: factor checks for VIRTIO_SCSI_S_DRIVER_OK when reporting events
  scsi: do not return short responses for emulated commands

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agoMerge remote-tracking branch 'kraxel/usb.70' into staging
Anthony Liguori [Wed, 14 Nov 2012 14:50:18 +0000 (08:50 -0600)] 
Merge remote-tracking branch 'kraxel/usb.70' into staging

* kraxel/usb.70:
  ehci: fix migration
  xhci: Fix some DMA host endian bugs
  usb/combined-packet: Move freeing of combined to usb_combined_packet_remove()
  xhci: Add support for packets with both data and an error status
  ehci: Add support for packets with both data and an error status
  ehci: Get rid of the magical PROC_ERR status
  usb-redir: Allow packets to have both data and an error-status
  usb: split packet result into actual_length + status

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agoMerge remote-tracking branch 'spice/spice.v63' into staging
Anthony Liguori [Wed, 14 Nov 2012 14:49:54 +0000 (08:49 -0600)] 
Merge remote-tracking branch 'spice/spice.v63' into staging

* spice/spice.v63:
  spice: fix initialization order
  pflib: unused, remove it.
  spice: switch to pixman
  qxl: call dpy_gfx_resize when entering vga mode
  qxl: fix cursor reset
  hw/qxl: qxl_send_events: nop if stopped
  hw/qxl: guest bug on primary create with stride %4 != 0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agopixman: cleanup properly on make distclean
Gerd Hoffmann [Wed, 14 Nov 2012 12:45:55 +0000 (13:45 +0100)] 
pixman: cleanup properly on make distclean

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agopixman: add licensing info
Gerd Hoffmann [Tue, 13 Nov 2012 08:38:06 +0000 (09:38 +0100)] 
pixman: add licensing info

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agopixman: build internal version early
Gerd Hoffmann [Mon, 12 Nov 2012 11:18:38 +0000 (12:18 +0100)] 
pixman: build internal version early

Signed-off-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agopixman: pass cflags, add -fPIC
Gerd Hoffmann [Wed, 14 Nov 2012 12:26:54 +0000 (13:26 +0100)] 
pixman: pass cflags, add -fPIC

Pass on CFLAGS to the pixman configure script.
Add -fPIC to the cflags, needed to make the final link succeed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agopixman: disable gtk
Gerd Hoffmann [Wed, 7 Nov 2012 10:41:01 +0000 (11:41 +0100)] 
pixman: disable gtk

gtk is only needed to build test cases.
Disable it to simplify the build.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agopixman: set --host for cross builds
Gerd Hoffmann [Wed, 7 Nov 2012 10:09:52 +0000 (11:09 +0100)] 
pixman: set --host for cross builds

Set --host when calling pixman configure while doing cross builds so
pixman's autoconf picks up the cross build tools correctly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agopixman: add output dir to include path
Gerd Hoffmann [Wed, 7 Nov 2012 10:06:23 +0000 (11:06 +0100)] 
pixman: add output dir to include path

Needed to make sure the (generated) pixman-version.h file is found.
Based on a patch from Blue Swirl.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agovfio-pci: Use common msi_get_message
Alex Williamson [Tue, 13 Nov 2012 19:27:40 +0000 (12:27 -0700)] 
vfio-pci: Use common msi_get_message

We can get rid of our local version now that a helper exists.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agovfio-pci: Add KVM INTx acceleration
Alex Williamson [Tue, 13 Nov 2012 19:27:40 +0000 (12:27 -0700)] 
vfio-pci: Add KVM INTx acceleration

This makes use of the new level irqfd support enabling bypass of qemu
userspace both on INTx injection and unmask.  This significantly
boosts the performance of devices making use of legacy interrupts (ex.
~60% better netperf TCP_RR scores for an e1000e assigned to a Linux
guest and booted with pci=nomsi).  This also avoids flipping mmaps on
and off to simulate EOIs, so greatly improves performance of device
access in addition to interrupt latency.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agolinux-headers: Update to 3.7-rc5
Alex Williamson [Tue, 13 Nov 2012 19:27:40 +0000 (12:27 -0700)] 
linux-headers: Update to 3.7-rc5

update-linux-headers.sh script run against Linux tag v3.7-rc5

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agonbd: fixes to read-only handling
Paolo Bonzini [Tue, 13 Nov 2012 09:34:17 +0000 (10:34 +0100)] 
nbd: fixes to read-only handling

We do not need BLKROSET if the kernel supports setting flags.
Also, always do BLKROSET even for a read-write export, otherwise
the read-only state remains "sticky" after the invocation of
"qemu-nbd -r".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoaio: fix aio_ctx_prepare with idle bottom halves
Paolo Bonzini [Mon, 12 Nov 2012 12:30:10 +0000 (13:30 +0100)] 
aio: fix aio_ctx_prepare with idle bottom halves

Commit ed2aec4867f0d5f5de496bb765347b5d0cfe113d changed the return
value of aio_ctx_prepare from false to true when only idle bottom
halves are available.  This broke PC old-style DMA, which uses them.
Fix this by making aio_ctx_prepare return true only when non-idle
bottom halves are scheduled to run.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
8 years agovirtio-scsi: use dma_context_memory
Paolo Bonzini [Tue, 30 Oct 2012 16:31:43 +0000 (17:31 +0100)] 
virtio-scsi: use dma_context_memory

Until address_space_rw was introduced, NULL was accepted as a
placeholder for DMA with no IOMMU (to address_space_memory).

This does not work anymore, and dma_context_memory needs to
be specified explicitly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agodma: Define dma_context_memory and use in sysbus-ohci
Peter Maydell [Mon, 29 Oct 2012 01:34:32 +0000 (11:34 +1000)] 
dma: Define dma_context_memory and use in sysbus-ohci

Define a new global dma_context_memory which is a DMAContext corresponding
to the global address_space_memory AddressSpace. This can be used by
sysbus peripherals like sysbus-ohci which need to do DMA.

In particular, use it in the sysbus-ohci device, which fixes a
segfault when attempting to use that device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
8 years agomegasas: Correct target/lun mapping
Hannes Reinecke [Mon, 12 Nov 2012 14:42:42 +0000 (15:42 +0100)] 
megasas: Correct target/lun mapping

The structure to reference a logical drive has an unused field,
which can be used to carry the lun ID. This enabled seabios to
establish the proper target/LUN mapping.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoscsi-disk: flush cache after disabling it
Paolo Bonzini [Wed, 31 Oct 2012 16:14:41 +0000 (17:14 +0100)] 
scsi-disk: flush cache after disabling it

SBC says that "if an application client changes the WCE bit from one to
zero via a MODE SELECT command, then the device server shall write
any data in volatile cache to non-volatile medium before completing
the command".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomegasas: do not include block_int.h
Paolo Bonzini [Fri, 28 Sep 2012 14:43:41 +0000 (16:43 +0200)] 
megasas: do not include block_int.h

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoscsi: remove superfluous call to scsi_device_set_ua
Paolo Bonzini [Mon, 8 Oct 2012 14:46:54 +0000 (16:46 +0200)] 
scsi: remove superfluous call to scsi_device_set_ua

Suggested by Laszlo Ersek.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agovirtio-scsi: factor checks for VIRTIO_SCSI_S_DRIVER_OK when reporting events
Paolo Bonzini [Mon, 8 Oct 2012 14:50:51 +0000 (16:50 +0200)] 
virtio-scsi: factor checks for VIRTIO_SCSI_S_DRIVER_OK when reporting events

Suggested by Laszlo Ersek.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoscsi: do not return short responses for emulated commands
Paolo Bonzini [Wed, 10 Oct 2012 10:18:03 +0000 (12:18 +0200)] 
scsi: do not return short responses for emulated commands

The inquiry command, for the case of VPD=1, was returning short
responses; the number of returned bytes was just the number of bytes
in the request, without padding to the specified allocation length
with zero bytes.  This is usually harmless, but it is a violation
of the SCSI specification.

To fix this, always pad with zero bytes to r->cmd.xfer in
scsi_disk_emulate_command, and return at most r->buflen bytes
(the size of the buffer for command data) rather than at most
buflen bytes (the number of bytes that was filled in).

Before this patch, "strace sg_inq -p0x83 /dev/sda" would report a
non-zero resid value.  After this patch, it reports resid=0.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agohmp: add NBD server commands
Paolo Bonzini [Thu, 23 Aug 2012 09:53:04 +0000 (11:53 +0200)] 
hmp: add NBD server commands

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: disallow nbd-server-add before nbd-server-start
Paolo Bonzini [Mon, 12 Nov 2012 13:25:17 +0000 (14:25 +0100)] 
nbd: disallow nbd-server-add before nbd-server-start

It works nicely with the QMP commands, but it adds useless complication
with HMP.  In particular, see the following:

    (qemu) nbd_server_add -w scsi0-hd0
    (qemu) nbd_server_start -a localhost:10809
    NBD server already exporting device scsi0-hd0

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: force read-only export for read-only devices
Paolo Bonzini [Sun, 4 Nov 2012 11:43:37 +0000 (12:43 +0100)] 
nbd: force read-only export for read-only devices

This is the desired behavior for HMP, but it is a better choice for QMP as well.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: fix nbd_server_stop crash when no server was running
Paolo Bonzini [Mon, 12 Nov 2012 13:12:54 +0000 (14:12 +0100)] 
nbd: fix nbd_server_stop crash when no server was running

This failed on the new assertion of qemu_set_fd_handler2:

qemu-system-x86_64: /home/pbonzini/work/upstream/qemu/iohandler.c:60: qemu_set_fd_handler2: Assertion `fd >= 0' failed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: accept URIs
Paolo Bonzini [Sun, 4 Nov 2012 12:04:24 +0000 (13:04 +0100)] 
nbd: accept URIs

The URI syntax is consistent with the Gluster syntax.  Export names
are specified in the path, preceded by one or more (otherwise unused)
slashes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: accept relative path to Unix socket
Paolo Bonzini [Sun, 4 Nov 2012 11:56:39 +0000 (12:56 +0100)] 
nbd: accept relative path to Unix socket

Adding the "is_unix" member now will simplify the parsing of NBD URIs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-nbd: initialize main loop before block layer
Paolo Bonzini [Sat, 3 Nov 2012 17:06:26 +0000 (18:06 +0100)] 
qemu-nbd: initialize main loop before block layer

qemu-nbd was broken because they initialized the block layer while
qemu_aio_context was still NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotcg: properly check that op's output needs to be synced to memory
Kirill Batuzov [Wed, 7 Nov 2012 11:26:38 +0000 (15:26 +0400)] 
tcg: properly check that op's output needs to be synced to memory

Fix typo introduced in b3a1be87bac3a6aaa59bb88c1410f170dc9b22d5.

Reported-by: Ruslan Savchenko <ruslan.savchenko@gmail.com>
Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
8 years agotarget-mips: Fix seg fault for LUI when MIPS_DEBUG_DISAS==1.
Eric Johnson [Sat, 10 Nov 2012 03:40:51 +0000 (19:40 -0800)] 
target-mips: Fix seg fault for LUI when MIPS_DEBUG_DISAS==1.

The call to gen_logic_imm for OPC_LUI passes -1 for rs.  This
causes the MIPS_DEBUG statement to seg fault due to the deference
of regnames[rs].  This patch fixes that.

Signed-off-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(aurel32: replaced static string formating by a static string)

8 years agotarget-i386: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 13:26:02 +0000 (13:26 +0000)] 
target-i386: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
8 years agotarget-xtensa: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 13:09:07 +0000 (13:09 +0000)] 
target-xtensa: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
8 years agotarget-unicore32: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 12:58:13 +0000 (12:58 +0000)] 
target-unicore32: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Reviewed-by: Andreas Färber <afaerber@suse.de>
8 years agokvm: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 12:43:16 +0000 (12:43 +0000)] 
kvm: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
8 years agodisas: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 12:40:00 +0000 (12:40 +0000)] 
disas: avoid using cpu_single_env

Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Richard Henderson <rth@twiddle.net>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
8 years agoslirp: remove unused function u_sleep
Blue Swirl [Sat, 13 Oct 2012 18:52:23 +0000 (18:52 +0000)] 
slirp: remove unused function u_sleep

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agosun4c: remove unused functions
Blue Swirl [Sat, 13 Oct 2012 18:49:20 +0000 (18:49 +0000)] 
sun4c: remove unused functions

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agom48t59: remove unused m48t59_set_addr
Blue Swirl [Sat, 13 Oct 2012 18:46:05 +0000 (18:46 +0000)] 
m48t59: remove unused m48t59_set_addr

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agotests/tcg: new test for i386 FPREM and FPREM1
Catalin Patulea [Mon, 29 Oct 2012 07:45:51 +0000 (03:45 -0400)] 
tests/tcg: new test for i386 FPREM and FPREM1

This is setting the stage for a cleanup of FPREM and FPREM1 helpers while being
sure that they behave same as bare metal.

The test constructs operands using combinations of corner cases for the
floating-point bitfields and prints operands, result and FPU status word for
FPREM and FPREM1. The outputs can then be compared between bare metal and QEMU.
The 'run-test-i386-fprem' make target does just that.

Signed-off-by: Catalin Patulea <catalinp@google.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agomemory: Don't dump disabled regions
Jan Kiszka [Wed, 31 Oct 2012 09:49:02 +0000 (10:49 +0100)] 
memory: Don't dump disabled regions

This makes "info mtree" output readable again.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agomemory: Reintroduce dirty flag to optimize changes on disabled regions
Jan Kiszka [Mon, 5 Nov 2012 15:45:56 +0000 (16:45 +0100)] 
memory: Reintroduce dirty flag to optimize changes on disabled regions

Cirrus is triggering this, e.g. during Win2k boot: Changes only on
disabled regions require no topology update when transaction depth drops
to 0 again.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agoqemu-timer: Fix compilation for non-POSIX hosts
Stefan Weil [Sun, 4 Nov 2012 20:42:08 +0000 (21:42 +0100)] 
qemu-timer: Fix compilation for non-POSIX hosts

A compiler warning is caused by the unused local function reinit_timers
on non-POSIX hosts. Include that function only for POSIX hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agovmware_vga: Add back some info in local state partially reverting aa32b38c
BALATON Zoltan [Sun, 4 Nov 2012 17:41:59 +0000 (18:41 +0100)] 
vmware_vga: Add back some info in local state partially reverting aa32b38c

Keep saving display surface parameters at init and using these cached
values instead of getting them when needed. Not sure why this is
needed (maybe due to the interaction with the vga device) but not
doing this broke the Xorg vmware driver at least.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agokvmvapic: Fix TB invalidation after instruction patching
Jan Kiszka [Sun, 4 Nov 2012 08:16:55 +0000 (09:16 +0100)] 
kvmvapic: Fix TB invalidation after instruction patching

Since 0b57e287, cpu_memory_rw_debug already triggers a TB invalidation.
As it doesn't (and cannot) set is_cpu_write_access=1 but "consumes" the
currently executed TB, the tb_invalidate_phys_page_range call from
patch_instruction didn't work anymore.

Fix this by open-coding the required bits to restore the CPU state from
the current TB position before patching and resume execution on the
patched instruction afterward.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agoehci: fix migration
Gerd Hoffmann [Thu, 8 Nov 2012 09:14:46 +0000 (10:14 +0100)] 
ehci: fix migration

Commit 5010d4dc618b6b8e7c21129c487c06f6493f71fc reorganized vmstate to
split core + pci, but got two little details wrong.  Fix them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoxhci: Fix some DMA host endian bugs
David Gibson [Mon, 5 Nov 2012 03:29:01 +0000 (14:29 +1100)] 
xhci: Fix some DMA host endian bugs

The xhci device does correct endian switches on the results of some DMAs
but not all.  In particular, there are many DMAs of what are essentially
arrays of 32-bit integers which never get byteswapped.  This causes them
to be interpreted incorrectly on big-endian hosts, since (as per the xhci
spec) these arrays are always little-endian in guest memory.

This patch adds some helper functions to fix these bugs.  This may not be
all the endian bugs in the xhci code, but it's certainly some of them and
the Linux guest xhci driver certainly gets further with these fixes.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb/combined-packet: Move freeing of combined to usb_combined_packet_remove()
Hans de Goede [Thu, 1 Nov 2012 16:15:06 +0000 (17:15 +0100)] 
usb/combined-packet: Move freeing of combined to usb_combined_packet_remove()

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoxhci: Add support for packets with both data and an error status
Hans de Goede [Thu, 1 Nov 2012 16:15:05 +0000 (17:15 +0100)] 
xhci: Add support for packets with both data and an error status

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoehci: Add support for packets with both data and an error status
Hans de Goede [Thu, 1 Nov 2012 16:15:04 +0000 (17:15 +0100)] 
ehci: Add support for packets with both data and an error status

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoehci: Get rid of the magical PROC_ERR status
Hans de Goede [Thu, 1 Nov 2012 16:15:03 +0000 (17:15 +0100)] 
ehci: Get rid of the magical PROC_ERR status

Instead make ehci_execute and ehci_fill_queue return the again value.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb-redir: Allow packets to have both data and an error-status
Hans de Goede [Thu, 1 Nov 2012 16:15:02 +0000 (17:15 +0100)] 
usb-redir: Allow packets to have both data and an error-status

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb: split packet result into actual_length + status
Hans de Goede [Thu, 1 Nov 2012 16:15:01 +0000 (17:15 +0100)] 
usb: split packet result into actual_length + status

Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have
an error.

An example would be an input transfer from a bulk endpoint successfully
receiving 1 or more maxpacketsize packets from the device, followed
by a packet signalling halt.

While already touching all the devices and controllers handle_packet /
handle_data / handle_control code, also change the return type of
these functions to void, solely storing the status in the packet. To
make the code paths for regular versus async packet handling more
uniform.

This patch unfortunately is somewhat invasive, since makeing the qemu
usb core deal with this requires changes everywhere. This patch only
prepares the usb core for this, all the hcd / device changes are done
in such a way that there are no functional changes.

This patch has been tested with uhci and ehci hcds, together with usb-audio,
usb-hid and usb-storage devices, as well as with usb-redir redirection
with a wide variety of real devices.

Note that there is usually no need to directly set packet->actual_length
form devices handle_data callback, as that is done by usb_packet_copy()

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agomicroblaze: translate.c: Fix swaph decoding
Peter Crosthwaite [Thu, 8 Nov 2012 04:01:19 +0000 (14:01 +1000)] 
microblaze: translate.c: Fix swaph decoding

The swaph instruction was not decoding correctly. s/1e1/1e2 on the
9 LSBs on the instruction decode.

Reported-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
8 years agotools: initialize main loop before block layer
Paolo Bonzini [Sat, 3 Nov 2012 17:10:17 +0000 (18:10 +0100)] 
tools: initialize main loop before block layer

Tools were broken because they initialized the block layer while
qemu_aio_context was still NULL.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
8 years agotcg/ppc32: Use trampolines to trim the code size for mmu slow path accessors
malc [Mon, 5 Nov 2012 17:47:04 +0000 (21:47 +0400)] 
tcg/ppc32: Use trampolines to trim the code size for mmu slow path accessors

mmu access looks something like:

<check tlb>
if miss goto slow_path
<fast path>
done:
...

; end of the TB
slow_path:
 <pre process>
 mr r3, r27         ; move areg0 to r3
                    ; (r3 holds the first argument for all the PPC32 ABIs)
 <call mmu_helper>
 b $+8
 .long done
 <post process>
 b done

On ppc32 <call mmu_helper> is:

(SysV and Darwin)

mmu_helper is most likely not within direct branching distance from
the call site, necessitating

a. moving 32 bit offset of mmu_helper into a GPR ; 8 bytes
b. moving GPR to CTR/LR                          ; 4 bytes
c. (finally) branching to CTR/LR                 ; 4 bytes

r3 setting              - 4 bytes
call                    - 16 bytes
dummy jump over retaddr - 4 bytes
embedded retaddr        - 4 bytes
         Total overhead - 28 bytes

(PowerOpen (AIX))
a. moving 32 bit offset of mmu_helper's TOC into a GPR1 ; 8 bytes
b. loading 32 bit function pointer into GPR2            ; 4 bytes
c. moving GPR2 to CTR/LR                                ; 4 bytes
d. loading 32 bit small area pointer into R2            ; 4 bytes
e. (finally) branching to CTR/LR                        ; 4 bytes

r3 setting              - 4 bytes
call                    - 24 bytes
dummy jump over retaddr - 4 bytes
embedded retaddr        - 4 bytes
         Total overhead - 36 bytes

Following is done to trim the code size of slow path sections:

In tcg_target_qemu_prologue trampolines are emitted that look like this:

trampoline:
mfspr r3, LR
addi  r3, 4
mtspr LR, r3      ; fixup LR to point over embedded retaddr
mr    r3, r27
<jump mmu_helper> ; tail call of sorts

And slow path becomes:

slow_path:
 <pre process>
 <call trampoline>
 .long done
 <post process>
 b done

call                    - 4 bytes (trampoline is within code gen buffer
                                   and most likely accessible via
                                   direct branch)
embedded retaddr        - 4 bytes
         Total overhead - 8 bytes

In the end the icache pressure is decreased by 20/28 bytes at the cost
of an extra jump to trampoline and adjusting LR (to skip over embedded
retaddr) once inside.

Signed-off-by: malc <av1474@comtv.ru>
8 years agospice: fix initialization order
Gerd Hoffmann [Fri, 2 Nov 2012 08:37:27 +0000 (09:37 +0100)] 
spice: fix initialization order

Register displaychangelistener last, after spice is fully initialized,
otherwise we may hit NULL pointer dereferences when qemu starts calling
our callbacks.

Commit e250d949feb1334828f27f0d145c35f29c4b7639 triggers this bug.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agopflib: unused, remove it.
Gerd Hoffmann [Tue, 18 Sep 2012 06:52:26 +0000 (08:52 +0200)] 
pflib: unused, remove it.

Replaced by pixman library.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agospice: switch to pixman
Gerd Hoffmann [Fri, 2 Nov 2012 08:12:49 +0000 (09:12 +0100)] 
spice: switch to pixman

Switch over spice-display.c to use the pixman library
instead of the home-grown pflib bits.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoqxl: call dpy_gfx_resize when entering vga mode
Gerd Hoffmann [Tue, 30 Oct 2012 13:55:12 +0000 (14:55 +0100)] 
qxl: call dpy_gfx_resize when entering vga mode

When entering vga mode the display size likely changes,
notify all displaychangelisteners about this.

Probably went unnoticed for a while as one if the first
things the guest does after leaving qxl native mode and
entering qxl vga mode is to set the vga video mode.  But
there is still a small window where qemu can operate on
stale data, leading to crashes now and then.

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

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoqxl: fix cursor reset
Gerd Hoffmann [Fri, 14 Sep 2012 20:17:44 +0000 (22:17 +0200)] 
qxl: fix cursor reset

When resetting the qxl cursor notify the qemu displaystate too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agohw/qxl: qxl_send_events: nop if stopped
Alon Levy [Thu, 1 Nov 2012 12:56:00 +0000 (14:56 +0200)] 
hw/qxl: qxl_send_events: nop if stopped

Added a trace point for easy logging.

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

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agohw/qxl: guest bug on primary create with stride %4 != 0
Alon Levy [Mon, 15 Oct 2012 12:54:03 +0000 (14:54 +0200)] 
hw/qxl: guest bug on primary create with stride %4 != 0

Due to usage of pixman for rendering on all spice surfaces we have
pixman's requirement that the stride be word aligned. A guest not
honoring that can crash spice and qemu with it due to failure to create
a surface (in spice-server). Avoid this early on in primary surface
creation and offscreen surface creation.

Recently windows guests got odd width support which triggers a non word
aligned primary surface in 16bit color depth. Off screen surfaces have
always been word aligned, but doesn't hurt to check them here too.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agotarget-mips: use ULL for 64 bit constants
Blue Swirl [Sat, 3 Nov 2012 18:48:35 +0000 (18:48 +0000)] 
target-mips: use ULL for 64 bit constants

Fix build on a 32 bit host:
  CC    mips-softmmu/target-mips/dsp_helper.o
/src/qemu/target-mips/dsp_helper.c: In function 'helper_dextr_rs_w':
/src/qemu/target-mips/dsp_helper.c:3556: error: integer constant is too large for 'long' type
/src/qemu/target-mips/dsp_helper.c: In function 'helper_extr_s_h':
/src/qemu/target-mips/dsp_helper.c:3656: error: integer constant is too large for 'long' type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
8 years agobuild: pthread_atfork() needs include of pthread.h
Anthony Liguori [Fri, 2 Nov 2012 21:12:53 +0000 (16:12 -0500)] 
build: pthread_atfork() needs include of pthread.h

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agotcg/ppc: ld/st optimization
malc [Sat, 3 Nov 2012 15:38:32 +0000 (19:38 +0400)] 
tcg/ppc: ld/st optimization

Signed-off-by: malc <av1474@comtv.ru>
8 years agovmware_vga: Allow simple drivers to work without using the fifo
BALATON Zoltan [Sat, 3 Nov 2012 11:47:08 +0000 (12:47 +0100)] 
vmware_vga: Allow simple drivers to work without using the fifo

Postpone stopping the dirty log to the point where the command fifo is
configured to allow drivers which don't use the fifo to work too.
(Without this the picture rendered into the vram never got to the
screen and the DIRECT_VRAM option meant to support this case was
removed a year ago.)

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agovmware_vga: Return a value for FB_SIZE before the device is enabled
BALATON Zoltan [Sat, 3 Nov 2012 11:47:08 +0000 (12:47 +0100)] 
vmware_vga: Return a value for FB_SIZE before the device is enabled

According to the documentation drivers using this device should read
FB_SIZE before enabling the device to know what memory to map. This
would not work if we return 0 before enabled. The docs also mention
reading SVGA_REG_DEPTH but not writing it. (Only SVGA_REG_BITS_PER_PIXEL
can be written but we don't really support that either.)

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agovmware_vga: Remove duplicated info from local state
BALATON Zoltan [Sat, 3 Nov 2012 11:47:08 +0000 (12:47 +0100)] 
vmware_vga: Remove duplicated info from local state

Removed info from vmsvga_state that is available from elsewhere and
thus was duplicated here unnecessarily.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agovmware_vga: Coding style cleanup
BALATON Zoltan [Sat, 3 Nov 2012 11:47:08 +0000 (12:47 +0100)] 
vmware_vga: Coding style cleanup

Fix coding style as suggested by checkpatch.pl

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agoMerge branch 'trivial-patches' of git://github.com/stefanha/qemu
Blue Swirl [Sat, 3 Nov 2012 12:55:05 +0000 (12:55 +0000)] 
Merge branch 'trivial-patches' of git://github.com/stefanha/qemu

* 'trivial-patches' of git://github.com/stefanha/qemu:
  pc: Drop redundant test for ROM memory region
  exec: make some functions static
  target-ppc: make some functions static
  ppc: add missing static
  vnc: add missing static
  vl.c: add missing static
  target-sparc: make do_unaligned_access static
  m68k: Return semihosting errno values correctly
  cadence_uart: More debug information

Conflicts:
target-m68k/m68k-semi.c

8 years agotcg: Optimize qemu_ld/st by generating slow paths at the end of a block
Yeongkyoon Lee [Wed, 31 Oct 2012 07:04:25 +0000 (16:04 +0900)] 
tcg: Optimize qemu_ld/st by generating slow paths at the end of a block

Add optimized TCG qemu_ld/st generation which locates the code of TLB miss
cases at the end of a block after generating the other IRs.
Currently, this optimization supports only i386 and x86_64 hosts.

Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agotcg: Add extended GETPC mechanism for MMU helpers with ldst optimization
Yeongkyoon Lee [Wed, 31 Oct 2012 07:04:24 +0000 (16:04 +0900)] 
tcg: Add extended GETPC mechanism for MMU helpers with ldst optimization

Add GETPC_EXT which is used by MMU helpers to selectively calculate the code
address of accessing guest memory when called from a qemu_ld/st optimized code
or a C function. Currently, it supports only i386 and x86-64 hosts.

Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agoconfigure: Add CONFIG_QEMU_LDST_OPTIMIZATION for TCG qemu_ld/st optimization
Yeongkyoon Lee [Wed, 31 Oct 2012 07:04:23 +0000 (16:04 +0900)] 
configure: Add CONFIG_QEMU_LDST_OPTIMIZATION for TCG qemu_ld/st optimization

Enable CONFIG_QEMU_LDST_OPTIMIZATION for TCG qemu_ld/st optimization only when
a host is i386 or x86_64.

Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agotarget-m68k/m68k-semi.c: Log when put_user for returning values fails
Peter Maydell [Mon, 29 Oct 2012 12:05:11 +0000 (12:05 +0000)] 
target-m68k/m68k-semi.c: Log when put_user for returning values fails

Abstract out the use of put_user for returning semihosting call results,
so that we can log when a guest erroneously attempts a semihosting call
with an unwritable argument block.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agotarget-m68k/m68k-semi: Handle get_user failure
Peter Maydell [Mon, 29 Oct 2012 12:05:10 +0000 (12:05 +0000)] 
target-m68k/m68k-semi: Handle get_user failure

Handle failure of get_user accessing the semihosting
argument block, rather than simply ignoring the failures.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agom68k: Return semihosting errno values correctly
Meador Inge [Mon, 29 Oct 2012 12:05:09 +0000 (12:05 +0000)] 
m68k: Return semihosting errno values correctly

Fixing a simple typo, s/errno/err/, that caused
the error status from GDB semihosted system calls
to be returned incorrectly.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
8 years agovl: delay thread initialization after daemonization
Paolo Bonzini [Fri, 2 Nov 2012 14:43:24 +0000 (15:43 +0100)] 
vl: delay thread initialization after daemonization

Commit ac4119c (chardev: Use timer instead of bottom-half to postpone
open event, 2012-10-12) moved the alarm timer initialization to an earlier
point but failed to consider that it depends on qemu_init_main_loop.

Later, commit 1c53786 (vl: init main loop earlier, 2012-10-30) fixed
this, but left -daemonize in two different ways.  First, timers need to
be reinitialized after forking.  Second, the global mutex was being held
by the parent, and thus dropped after forking.

The first is now fixed using pthread_atfork.  For the second part,
make sure that the global mutex is not taken before daemonization,
and similarly delay qemu_thread_self.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agovl: unify calls to init_timer_alarm
Paolo Bonzini [Fri, 2 Nov 2012 14:43:23 +0000 (15:43 +0100)] 
vl: unify calls to init_timer_alarm

init_timer_alarm was being called twice.  This is not needed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agoqemu-timer: reinitialize timers after fork
Paolo Bonzini [Fri, 2 Nov 2012 14:43:22 +0000 (15:43 +0100)] 
qemu-timer: reinitialize timers after fork

Timers are not inherited by the child of a fork(2), so just use
pthread_atfork to reinstate them after daemonize.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agosemaphore: implement fallback counting semaphores with mutex+condvar
Paolo Bonzini [Fri, 2 Nov 2012 14:43:21 +0000 (15:43 +0100)] 
semaphore: implement fallback counting semaphores with mutex+condvar

OpenBSD and Darwin do not have sem_timedwait.  Implement a fallback
for them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agocompiler: support Darwin weak references
Paolo Bonzini [Fri, 2 Nov 2012 14:43:20 +0000 (15:43 +0100)] 
compiler: support Darwin weak references

Weakrefs only tell you if the symbol was defined elsewhere, so you
need a further check at runtime to pick the default definition
when needed.

This could be automated by the compiler, but it does not do it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 years agoMerge remote-tracking branch 'bonzini/migr-coroutine' into staging
Anthony Liguori [Fri, 2 Nov 2012 18:06:28 +0000 (13:06 -0500)] 
Merge remote-tracking branch 'bonzini/migr-coroutine' into staging

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* bonzini/migr-coroutine:
  migration: move process_incoming_migration to a coroutine
  migration: handle EAGAIN while reading QEMUFile
  migration: move qemu_fclose to process_incoming_migration
  migration: close socket QEMUFile from socket_close
  migration: xxx_close will only be called once
  migration: use closesocket, not close
  migration: use migrate_fd_close in migrate_fd_cleanup
  migration: clean up server sockets and handlers before invoking process_incoming_migration
  migration: replace qemu_stdio_fd with qemu_get_fd
  migration: add qemu_get_fd
  migration: consolidate QEMUFile methods in a single QEMUFileOps struct
  migration: unify stdio-based QEMUFile operations

8 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Fri, 2 Nov 2012 18:05:38 +0000 (13:05 -0500)] 
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* afaerber/qom-cpu:
  target-i386: cpu: fix --disable-kvm compilation

8 years agomigration: move process_incoming_migration to a coroutine
Paolo Bonzini [Tue, 7 Aug 2012 08:57:43 +0000 (10:57 +0200)] 
migration: move process_incoming_migration to a coroutine

The final part of incoming migration, which now consists of
process_incoming_migration for all protocols, is thus made non-blocking.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomigration: handle EAGAIN while reading QEMUFile
Paolo Bonzini [Tue, 7 Aug 2012 09:07:59 +0000 (11:07 +0200)] 
migration: handle EAGAIN while reading QEMUFile

This will never happen right now (the assertion would fail).  The
next patch will set the socket or pipe in non-blocking mode, thus
enabling this part of the code.

Coroutines can just stop whenever they want with qemu_coroutine_yield.
As soon as select tells the main loop that the migration stream is
readable, the coroutine is re-entered directly in qemu_get_buffer,
where it will read more data and pass it to the loading routines.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomigration: move qemu_fclose to process_incoming_migration
Paolo Bonzini [Tue, 7 Aug 2012 08:51:51 +0000 (10:51 +0200)] 
migration: move qemu_fclose to process_incoming_migration

The common suffix is now just process_incoming_migration.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomigration: close socket QEMUFile from socket_close
Paolo Bonzini [Tue, 7 Aug 2012 08:50:26 +0000 (10:50 +0200)] 
migration: close socket QEMUFile from socket_close

The common suffix now is process_incoming_migration+qemu_fclose.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>