sdk/emulator/qemu.git
12 years agofinally kill cpudef config section support
Eduardo Habkost [Tue, 4 Dec 2012 18:32:58 +0000 (16:32 -0200)]
finally kill cpudef config section support

The external CPU models were removed on QEMU 1.2, and the support for
the "cpudef" config sections was documented as deprecated, but the
actual removal of the config section was pending.

Now that QEMU 1.3 was released, we can finally kill the support for
cpudef config sections, and support only the built-in CPU models from
target-i386/cpu.c.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'memory-ioport' of git://github.com/afaerber/qemu-cpu
Blue Swirl [Sat, 8 Dec 2012 14:28:13 +0000 (14:28 +0000)]
Merge branch 'memory-ioport' of git://github.com/afaerber/qemu-cpu

* 'memory-ioport' of git://github.com/afaerber/qemu-cpu:
  hw/dma.c: Replace register_ioport_*
  hw/pc.c: Replace register_ioport_*
  serial: Replace register_ioport_*
  hw/cirrus_vga.c: Replace register_ioport_*
  hw/apm.c: Replace register_ioport_*
  isa: Add isa_address_space_io()

12 years agoHACKING: List areas where we may rely on impdef C behaviour
Peter Maydell [Wed, 31 Oct 2012 09:30:47 +0000 (09:30 +0000)]
HACKING: List areas where we may rely on impdef C behaviour

Add a section to HACKING saying which version of the C spec
we use and describing the bits of implementation defined C
compiler behaviour which C code in QEMU is allowed to rely on.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agopixman: require 0.18.4 or newer
Gerd Hoffmann [Tue, 27 Nov 2012 12:19:40 +0000 (13:19 +0100)]
pixman: require 0.18.4 or newer

When older versions are found the internal pixman version is prefered.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG: Remove unused global gen_opc_ arrays.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:07 +0000 (11:43 +0400)]
TCG: Remove unused global gen_opc_ arrays.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG: Use gen_opc_instr_start from context instead of global variable.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:06 +0000 (11:43 +0400)]
TCG: Use gen_opc_instr_start from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG: Use gen_opc_icount from context instead of global variable.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:05 +0000 (11:43 +0400)]
TCG: Use gen_opc_icount from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG: Use gen_opc_pc from context instead of global variable.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:04 +0000 (11:43 +0400)]
TCG: Use gen_opc_pc from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:03 +0000 (11:43 +0400)]
tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agocurses: Remove OpenBSD workaround
Brad Smith [Mon, 19 Nov 2012 09:22:12 +0000 (04:22 -0500)]
curses: Remove OpenBSD workaround

I removed the same sort of workaround for OpenBSD within the
configure script with commit 4dcc3f5876fa638d5c35bd47be3b717ea74cc2e7
but didn't bother to grep further to come across this same chunk
of code in the curses code itself. So the following diff removes
the same workaround chunk within the curses code.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec: Advise huge pages for the TCG code gen buffer
Richard Henderson [Thu, 1 Nov 2012 22:20:46 +0000 (09:20 +1100)]
exec: Advise huge pages for the TCG code gen buffer

After allocating 32MB or more contiguous memory, huge pages
would seem to be ideal.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/dma.c: Replace register_ioport_*
Julien Grall [Wed, 19 Sep 2012 11:50:09 +0000 (12:50 +0100)]
hw/dma.c: Replace register_ioport_*

Replace all register_ioport_*() with the new Memory API functions.
This permits to use the new Memory stuff like listeners.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Avi Kivity <avi@redhat.com>
[AF: Rebased onto hwaddr]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agohw/pc.c: Replace register_ioport_*
Julien Grall [Wed, 19 Sep 2012 11:50:08 +0000 (12:50 +0100)]
hw/pc.c: Replace register_ioport_*

Replace all register_ioport_*() with portio_*() or a MemoryRegion.
This permits to use the new Memory stuff like listeners.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Avi Kivity <avi@redhat.com>
[AF: Rebased onto hwaddr]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoserial: Replace register_ioport_*
Julien Grall [Wed, 19 Sep 2012 11:50:07 +0000 (12:50 +0100)]
serial: Replace register_ioport_*

Replace all register_ioport_*() with a MemoryRegion.
This permits to use the new Memory stuff like listeners.

For more flexibility, the IO address space is passed as an argument.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Avi Kivity <avi@redhat.com>
[AF: Rebased onto serial split]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agohw/cirrus_vga.c: Replace register_ioport_*
Julien Grall [Wed, 19 Sep 2012 11:50:06 +0000 (12:50 +0100)]
hw/cirrus_vga.c: Replace register_ioport_*

Replace all register_ioport_*() with the new Memory API.
This permits to use the new Memory stuff like listeners.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Avi Kivity <avi@redhat.com>
[AF: Rebased onto hwaddr]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agohw/apm.c: Replace register_ioport_*
Julien Grall [Wed, 19 Sep 2012 11:50:03 +0000 (12:50 +0100)]
hw/apm.c: Replace register_ioport_*

Replace all register_ioport_*() with a MemoryRegion.
This permits to use the new Memory stuff like listeners.

Moreover, the PCI device is added as an argument for apm_init(),
so we can register IO inside the PCI IO address space.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Avi Kivity <avi@redhat.com>
[AF: Rebased onto hwaddr and q35]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoisa: Add isa_address_space_io()
Julien Grall [Wed, 19 Sep 2012 11:50:02 +0000 (12:50 +0100)]
isa: Add isa_address_space_io()

This function permits to retrieve ISA IO address space.
It will be usefull when we need to pass IO address space as argument.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoOpen up 1.4 development branch
Anthony Liguori [Mon, 3 Dec 2012 20:08:40 +0000 (14:08 -0600)]
Open up 1.4 development branch

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoUpdate version for 1.3.0 release
Anthony Liguori [Mon, 3 Dec 2012 14:02:50 +0000 (08:02 -0600)]
Update version for 1.3.0 release

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoe1000: Discard packets that are too long if !SBP and !LPE
Michael Contreras [Mon, 3 Dec 2012 04:11:22 +0000 (20:11 -0800)]
e1000: Discard packets that are too long if !SBP and !LPE

The e1000_receive function for the e1000 needs to discard packets longer than
1522 bytes if the SBP and LPE flags are disabled. The linux driver assumes
this behavior and allocates memory based on this assumption.

Signed-off-by: Michael Contreras <michael@inetric.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoUpdate version for 1.3.0-rc2
Anthony Liguori [Fri, 30 Nov 2012 21:04:16 +0000 (15:04 -0600)]
Update version for 1.3.0-rc2

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'kraxel/seabios-b1c35f2' into staging
Anthony Liguori [Fri, 30 Nov 2012 16:24:57 +0000 (10:24 -0600)]
Merge remote-tracking branch 'kraxel/seabios-b1c35f2' into staging

* kraxel/seabios-b1c35f2:
  seabios: update binaries in pc-bios/
  roms: also copy the dsdt when updating seabios.
  seabios: update to b1c35f2b28cc0c94ebed8176ff61ac0e0b377798

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 30 Nov 2012 16:24:24 +0000 (10:24 -0600)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony:
  coroutine-sigaltstack.c: Use stack_t, not struct sigaltstack
  stream: fix ratelimit_set_speed
  atapi: make change media detection for guests easier
  Documentation: Update image format information
  Documentation: Update block cache mode information

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'spice/spice.v65' into staging
Anthony Liguori [Fri, 30 Nov 2012 16:20:36 +0000 (10:20 -0600)]
Merge remote-tracking branch 'spice/spice.v65' into staging

* spice/spice.v65:
  qxl: reload memslots after migration, when qxl is in UNDEFINED mode

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'kraxel/usb.73' into staging
Anthony Liguori [Fri, 30 Nov 2012 16:20:21 +0000 (10:20 -0600)]
Merge remote-tracking branch 'kraxel/usb.73' into staging

* kraxel/usb.73:
  ehci-sysbus: Attach DMA context.
  usb: fail usbdevice_create() when there is no USB bus
  usb: tag usb host adapters as not hotpluggable.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Fri, 30 Nov 2012 16:19:54 +0000 (10:19 -0600)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qapi: fix qapi_dealloc_type_size parameter type

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoseabios: update binaries in pc-bios/
Gerd Hoffmann [Fri, 30 Nov 2012 15:24:59 +0000 (16:24 +0100)]
seabios: update binaries in pc-bios/

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoroms: also copy the dsdt when updating seabios.
Gerd Hoffmann [Fri, 30 Nov 2012 15:24:40 +0000 (16:24 +0100)]
roms: also copy the dsdt when updating seabios.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoRevert "audio/wavcapture: Clarify licensing"
Anthony Liguori [Fri, 30 Nov 2012 15:04:47 +0000 (09:04 -0600)]
Revert "audio/wavcapture: Clarify licensing"

This reverts commit 456a84d156a7c42f18b1da176dd6219e2dffd043.

This patch wasn't submitted to the list and did not get Acked by other
copyright holders in the file.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRevert "audio/audio_pt_int: Clarify licensing"
Anthony Liguori [Fri, 30 Nov 2012 15:04:08 +0000 (09:04 -0600)]
Revert "audio/audio_pt_int: Clarify licensing"

This reverts commit 72bc6f1bf710e205f175af9b1fc8bbd83e8da71f.

This patch wasn't submitted to the list and did not get Acked by other
copyright holders in the file.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoseabios: update to b1c35f2b28cc0c94ebed8176ff61ac0e0b377798
Gerd Hoffmann [Fri, 30 Nov 2012 15:02:58 +0000 (16:02 +0100)]
seabios: update to b1c35f2b28cc0c94ebed8176ff61ac0e0b377798

This patch updates the seabios submodule to commit
b1c35f2b28cc0c94ebed8176ff61ac0e0b377798.

Most important change is that seabios sets the busmaster bit
in the pci config space for the lsi and esp scsi host adapters.
Since commit 1c380f9460522f32c8dd2577b2a53d518ec91c6d qemu
is strict here and disallows any dma access when the bit is
clear.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agomultiboot: fix e801 memory map
Paolo Bonzini [Thu, 29 Nov 2012 17:11:50 +0000 (18:11 +0100)]
multiboot: fix e801 memory map

The e801 memory sizes in the multiboot structures hard-code the available
low memory to 640.  However, the value should not include the size of the
EBDA.  Fill the value in the option ROM, getting the size of low memory
from the BIOS.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoseccomp: adding new syscalls (bugzilla 855162)
Eduardo Otubo [Thu, 29 Nov 2012 15:56:41 +0000 (13:56 -0200)]
seccomp: adding new syscalls (bugzilla 855162)

According to the bug 855162[0] - there's the need of adding new syscalls
to the whitelist when using Qemu with Libvirt.

[0] - https://bugzilla.redhat.com/show_bug.cgi?id=855162

Reported-by: Paul Moore <pmoore@redhat.com>
Tested-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocoroutine-sigaltstack.c: Use stack_t, not struct sigaltstack
Peter Maydell [Sat, 10 Nov 2012 21:47:52 +0000 (21:47 +0000)]
coroutine-sigaltstack.c: Use stack_t, not struct sigaltstack

Use the POSIX-specified stack_t type as the argument to sigaltstack()
rather than the legacy struct sigaltstack. This allows us to compile
on MacOSX with --with-coroutine=sigaltstack.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agostream: fix ratelimit_set_speed
Dietmar Maurer [Wed, 24 Oct 2012 10:10:47 +0000 (12:10 +0200)]
stream: fix ratelimit_set_speed

The formula to compute slice_quota was wrong since commit 6ef228fc.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi: make change media detection for guests easier
Pavel Hrdina [Mon, 26 Nov 2012 15:37:39 +0000 (16:37 +0100)]
atapi: make change media detection for guests easier

If you have a guest with a media in the optical drive and you change
it, the windows guest cannot properly recognize this media change.

Windows needs to detect sense "NOT_READY with ASC_MEDIUM_NOT_PRESENT"
before we send sense "UNIT_ATTENTION with ASC_MEDIUM_MAY_HAVE_CHANGED".

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoDocumentation: Update image format information
Kevin Wolf [Wed, 21 Nov 2012 13:21:47 +0000 (14:21 +0100)]
Documentation: Update image format information

Document new and yet undocumented options and image formats. The
qemu-img man page contains information only for raw and qcow2 now and
references the HTML documentation for a more detailed description of
other formats.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agoDocumentation: Update block cache mode information
Kevin Wolf [Wed, 21 Nov 2012 11:26:56 +0000 (12:26 +0100)]
Documentation: Update block cache mode information

Somehow we forgot to update this when cache=writeback became the
default. While changing the information on the default, also make the
description of all caches modes a bit more accurate.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
12 years agovirtio: limit avail bytes lookahead
Michael S. Tsirkin [Thu, 29 Nov 2012 22:02:56 +0000 (00:02 +0200)]
virtio: limit avail bytes lookahead

Commit 0d8d7690850eb0cf2b2b60933cf47669a6b6f18f introduced
a regression in virtio-net performance because it looks
into the ring aggressively while we really only care
about a single packet worth of buffers.
Reported as bugzilla 1066055 in launchpad.

To fix, add parameters limiting lookahead, and
use in virtqueue_avail_bytes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
Tested-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-tech.texi: update implemented xtensa features list
Max Filippov [Thu, 29 Nov 2012 15:53:20 +0000 (19:53 +0400)]
qemu-tech.texi: update implemented xtensa features list

Debug option is available since QEMU-1.2; FP coprocessor and
coprocessor context is available since QEMU-1.3.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqdev: relax bus type check in qdev_device_add() (v2)
Anthony Liguori [Thu, 29 Nov 2012 13:46:23 +0000 (07:46 -0600)]
qdev: relax bus type check in qdev_device_add() (v2)

We are currently checking for an exact type match.  Use QOM dynamic_cast to
check for a compatible type instead.

Cc: Konrad Frederic <fred.konrad@greensocs.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2:
 - also add cast to qbus_find_recursive (Peter)
 - simplify by doing object_dynamic_cast instead of messing with classes

12 years agoqapi: fix qapi_dealloc_type_size parameter type
Bruce Rogers [Tue, 27 Nov 2012 20:11:25 +0000 (13:11 -0700)]
qapi: fix qapi_dealloc_type_size parameter type

The second parameter to qapi_dealloc_type_size should be a uint64_t *,
not a size_t *. This was causing our 32 bit x86 build to fail, since
warnings are treated as errors.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoehci-sysbus: Attach DMA context.
Peter Crosthwaite [Thu, 29 Nov 2012 01:43:18 +0000 (11:43 +1000)]
ehci-sysbus: Attach DMA context.

This was left as NULL on the initial merge due to debate on the mailing list on
how to handle DMA contexts for sysbus devices. Patch
9e11908f12f92e31ea94dc2a4c962c836cba9f2a was later merged to fix OHCI. This is the,
equivalent fix for sysbus EHCI.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb: fail usbdevice_create() when there is no USB bus
Stefan Hajnoczi [Sun, 25 Nov 2012 15:49:15 +0000 (16:49 +0100)]
usb: fail usbdevice_create() when there is no USB bus

Report an error instead of segfaulting when attaching a USB device to a
machine with no USB busses:

  $ qemu-system-arm -machine vexpress-a9 \
      -sd Fedora-17-armhfp-vexpress-mmcblk0.img \
      -kernel vmlinuz-3.4.2-3.fc17.armv7hl \
      -initrd initramfs-3.4.2-3.fc17.armv7hl.img \
      -usbdevice disk:format=raw:test.img

Note that the vexpress-a9 machine does not have a USB host controller.

Reported-by: David Abdurachmanov <David.Abdurachmanov@cern.ch>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb: tag usb host adapters as not hotpluggable.
Gerd Hoffmann [Thu, 22 Nov 2012 13:44:50 +0000 (14:44 +0100)]
usb: tag usb host adapters as not hotpluggable.

Hotplugging them simply doesn't work, so tag them accordingly to
avoid users trying and then crashing qemu.

For xhci there is nothing fundamental which prevents hotplug from
working, we'll "only" need a exit() function which cleans up
everything properly.  That isn't for 1.3 though.

For ehci+uhci+ohci hotplug can't be supported until qemu gains the
capability to hotplug multifunction pci devices.

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

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl: reload memslots after migration, when qxl is in UNDEFINED mode
Yonit Halperin [Wed, 28 Nov 2012 15:08:22 +0000 (10:08 -0500)]
qxl: reload memslots after migration, when qxl is in UNDEFINED mode

The devram memslot stays active when qxl enters UNDEFINED mode (i.e, no
primary surface). If migration has occurred while the device is in
UNDEFINED stae, the memslots have to be reloaded at the destination.

Fixes rhbz#874574

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoevent notifier: Fix setup for win32
Jan Kiszka [Thu, 22 Nov 2012 19:56:11 +0000 (20:56 +0100)]
event notifier: Fix setup for win32

The event notifier state is only reset by test_and_clear. But we created
the windows event object with auto-reset, which subtly swallowed events.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'bonzini/nbd-next' into staging
Anthony Liguori [Wed, 28 Nov 2012 19:19:30 +0000 (13:19 -0600)]
Merge remote-tracking branch 'bonzini/nbd-next' into staging

* bonzini/nbd-next:
  nbd-server-add: Fix the default for 'writable'
  nbd: fix use of two uninitialized bytes when connecting to a named export

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Wed, 28 Nov 2012 19:19:24 +0000 (13:19 -0600)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  virtio-scsi: Fix subtle (guest) endian bug
  virtio-scsi: Fix some endian bugs with virtio-scsi
  iscsi: do not assume device is zero initialized
  iscsi: fix deadlock during login
  iscsi: fix segfault in url parsing

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'agraf/s390-for-upstream-1.3' into staging
Anthony Liguori [Wed, 28 Nov 2012 19:19:16 +0000 (13:19 -0600)]
Merge remote-tracking branch 'agraf/s390-for-upstream-1.3' into staging

* agraf/s390-for-upstream-1.3:
  sclp: Fix uninitialized var in handle_write_event_buf().
  s390: Fix ram_size updating in machine init

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'agraf/ppc-for-upstream-1.3' into staging
Anthony Liguori [Wed, 28 Nov 2012 19:19:06 +0000 (13:19 -0600)]
Merge remote-tracking branch 'agraf/ppc-for-upstream-1.3' into staging

* agraf/ppc-for-upstream-1.3:
  fbdev: fix pixman compile on old pixman
  vl.c: Fix broken -usb option
  pseries: Fix bug in PCI MSI allocation
  kvm: fix incorrect length in a loop over kvm dirty pages map
  PPC: Fix missing TRACE exception
  hw/ide/macio: Fix segfault caused by NULL DMAContext*

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'afaerber/qom-cpu-1.3' into staging
Anthony Liguori [Wed, 28 Nov 2012 19:18:56 +0000 (13:18 -0600)]
Merge remote-tracking branch 'afaerber/qom-cpu-1.3' into staging

* afaerber/qom-cpu-1.3:
  target-i386: Enable SSSE3 TCG support
  target-i386/cpu: Add missing flags to Haswell CPU model

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agobuild: compile translate.o with -fno-gcse option on GCC 4.6.x and 4.7.[012]
Paolo Bonzini [Wed, 28 Nov 2012 08:40:23 +0000 (09:40 +0100)]
build: compile translate.o with -fno-gcse option on GCC 4.6.x and 4.7.[012]

These versions of GCC require insane (>2GB) amounts of memory to compile
translate.o.  As a countermeasure, disable the culprit optimization pass.
This should fix the buildbot failure for default_x86_64_fedora16.  Anyway
this is a good thing to do because people will try to compile 1.3 with
less than 2GB of memory and complain.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-scsi: Fix subtle (guest) endian bug
David Gibson [Mon, 26 Nov 2012 01:33:52 +0000 (12:33 +1100)]
virtio-scsi: Fix subtle (guest) endian bug

The virtio-scsi config space is, by specification, in guest endian (which
is ill-defined, but there you go).  In virtio_scsi_get_config() we set up
all the fields in there, using stl_raw().  Which is a problem for the
max_channel and max_target fields, which are 16-bit, not 32-bit.  For
little-endian targets we get away with it by accident, since the first
two bytes will still be correct, and the extra two bytes written (with
zeroes) will be overwritten correctly by the next store.

But for big-endian guests, this means the max_target field ends up as zero,
which means the guest will only recognize a single disk on the virtio-scsi
bus.  This patch fixes the problem.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul 'Rusty' Russell <rusty@rustcorp.com.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovirtio-scsi: Fix some endian bugs with virtio-scsi
David Gibson [Fri, 23 Nov 2012 05:08:44 +0000 (16:08 +1100)]
virtio-scsi: Fix some endian bugs with virtio-scsi

The virtio-scsi specification does not specify the correct endianness for
fields in the request structure.  It's therefore best to assume that it is
"guest native" endian since that's the (stupid and poorly defined) norm in
virtio.

However, the qemu device for virtio-scsi has no byteswaps at all, and so
will break if the guest has different endianness from the host.  This patch
fixes it by adding tswap() calls for the sense_len and resid fields in
the request structure.  In theory status_qualifier needs swaps as well,
but that field is never actually touched.  The tag field is a uint64_t, but
since its value is completely arbitrary, it might as well be uint8_t[8]
and so it does not need swapping.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul 'Rusty' Russell <rusty@rustcorp.com.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoiscsi: do not assume device is zero initialized
Peter Lieven [Sat, 17 Nov 2012 15:20:28 +0000 (16:20 +0100)]
iscsi: do not assume device is zero initialized

Without any complex checks we can't assume that an
iscsi target is initialized to zero.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoiscsi: fix deadlock during login
Peter Lieven [Sat, 17 Nov 2012 13:37:39 +0000 (14:37 +0100)]
iscsi: fix deadlock during login

If the connection is interrupted before the first login is successfully
completed qemu-kvm is waiting forever in qemu_aio_wait().

This is fixed by performing an sync login to the target. If the
connection breaks after the first successful login errors are
handled internally by libiscsi.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoiscsi: fix segfault in url parsing
Peter Lieven [Thu, 15 Nov 2012 14:42:06 +0000 (15:42 +0100)]
iscsi: fix segfault in url parsing

If an invalid URL is specified iscsi_get_error(iscsi) is called
with iscsi == NULL.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agonbd-server-add: Fix the default for 'writable'
Michal Privoznik [Wed, 28 Nov 2012 10:46:39 +0000 (11:46 +0100)]
nbd-server-add: Fix the default for 'writable'

The documentation to this monitor command tells, that 'writable'
argument is optional and defaults to false. However, the code sets
true as the default. But since some applications may already been
using this, it's safer to fix the code and not documentation which
would break those applications.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agonbd: fix use of two uninitialized bytes when connecting to a named export
Paolo Bonzini [Mon, 26 Nov 2012 14:19:31 +0000 (15:19 +0100)]
nbd: fix use of two uninitialized bytes when connecting to a named export

Reported-by: Michal Privoznik <mprivoznik@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agortc: Only call rtc_set_cmos when Register B SET flag is disabled.
Alex Horn [Mon, 26 Nov 2012 16:32:54 +0000 (17:32 +0100)]
rtc: Only call rtc_set_cmos when Register B SET flag is disabled.

This bug occurs when the SET flag of Register B is enabled. When an RTC
data register (i.e. any of the ten time/calender CMOS bytes) is set, the
data is (as expected) correctly stored in the cmos_data array. However,
since the SET flag is enabled, the function rtc_set_time is not invoked.
As a result, the field base_rtc in RTCState remains uninitialized. This
causes a problem on subsequent writes which can end up overwriting data.
To see this, consider writing data to Register A after having written
data to any of the RTC data registers; the following figure illustrates
the call stack for the Register A write operation:

 +- cmos_io_port_write
 +-- check_update_timer
 +---- get_next_alarm
 +------ rtc_update_time

In rtc_update_time, get_guest_rtc calculates the wrong time and
overwrites the previously written RTC data register values.

Signed-off-by: Alex Horn <alex.horn@cs.ox.ac.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-rng: do not use g_assert_cmpint
Paolo Bonzini [Tue, 27 Nov 2012 08:16:24 +0000 (09:16 +0100)]
virtio-rng: do not use g_assert_cmpint

g_assert_cmpint is not available on glib 2.12, which is the minimum
version required to build QEMU (we only require 2.16 to run tests,
since that is the first version including GTester).  Do not use it
in hardware models, use a normal assertion instead.

This fixes the buildbot failure for default_x86_64_rhel5.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotests: make threadpool cancellation test looser
Paolo Bonzini [Tue, 27 Nov 2012 08:51:48 +0000 (09:51 +0100)]
tests: make threadpool cancellation test looser

The cancellation test is failing on the buildbots.  While the failure
merits a little more investigation to understand what is going on,
the logs show that the failure is not impacting the coverage
provided by the test.  Hence, loosen a bit the assertions in a
way that should let the test proceed and hopefully pass.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoUpdate version for 1.3.0-rc1
Anthony Liguori [Mon, 26 Nov 2012 21:13:31 +0000 (15:13 -0600)]
Update version for 1.3.0-rc1

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-rng: fix typos, comments
Amit Shah [Wed, 21 Nov 2012 05:51:21 +0000 (11:21 +0530)]
virtio-rng: fix typos, comments

Fix typos, whitespace and update comments to match current
implementation.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-rng: disable timer on device removal
Amit Shah [Wed, 21 Nov 2012 05:51:20 +0000 (11:21 +0530)]
virtio-rng: disable timer on device removal

Disable the rate-limit timer on device remove (e.g. hot-unplug).

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-rng: remove extra request for entropy
Amit Shah [Wed, 21 Nov 2012 05:51:19 +0000 (11:21 +0530)]
virtio-rng: remove extra request for entropy

If we got fewer bytes from the backend than requested, don't poke the
backend for more bytes; the guest will ask for more (or if the guest has
already asked for more, the backend knows about it via handle_input()).

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-rng: use virtqueue_get_avail_bytes, fix migration
Amit Shah [Wed, 21 Nov 2012 05:51:18 +0000 (11:21 +0530)]
virtio-rng: use virtqueue_get_avail_bytes, fix migration

Popping an elem from the vq just to find out its length causes problems
with save/load later on.  Use the new virtqueue_get_avail_bytes()
function instead, saves us the complexity in the migration code, as well
as makes the migration endian-safe.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoi8259: Fix PIC_COMMON() macro
Andreas Färber [Sun, 25 Nov 2012 19:44:33 +0000 (20:44 +0100)]
i8259: Fix PIC_COMMON() macro

It used a wrong struct type name since its introduction in
8f04ee0882aec9fe91fb70f767edf5dacff59835 (isa: pic: convert to QEMU
Object Model), apparently it is unused so far.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqapi: handle visitor->type_size() in QapiDeallocVisitor
Stefan Hajnoczi [Mon, 26 Nov 2012 12:10:12 +0000 (13:10 +0100)]
qapi: handle visitor->type_size() in QapiDeallocVisitor

visit_type_size() requires either visitor->type_size() or
visitor_uint64() to be implemented, otherwise a NULL function pointer is
invoked.

It is possible to trigger this crash as follows:

  $ qemu-system-x86_64 -netdev tap,sndbuf=0,id=netdev0 \
                       -device virtio-blk-pci,netdev=netdev0

The 'sndbuf' option has type "size".

Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-i386: cpu: add missing flags to Haswell CPU model
Eduardo Habkost [Thu, 22 Nov 2012 15:31:03 +0000 (13:31 -0200)]
target-i386: cpu: add missing flags to Haswell CPU model

When adding the Haswell CPU model, I intended to make it a superset of the
features present on the SandyBridge model, but I have removed the SEP and
RDTSCP features from the feature list by mistake. This patch adds the missing
SEP and RDTSCP features (that are present on SandyBridge) to Haswell.

Reported-by: Martin Kletzander <mkletzan@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovl.c: Fix broken -usb option
Peter Maydell [Thu, 22 Nov 2012 16:48:45 +0000 (16:48 +0000)]
vl.c: Fix broken -usb option

Commit 094b287f0b accidentally broke the "-usb" command line
option, so it would have no effect if the user had not specified
any machine options at that point. (the return value from
'qemu_opts_find(qemu_find_opts("machine"), 0);' is NULL if there
are no user specified options, so it is only to be used for
looking up an option, not when trying to set one.) Similarly,
would '-usbdevice' no longer cause USB to default to enabled.

Fix this regression by using the same style of code for forcing
the usb=on machine option that we use for other aliases such as
'-enable-kvm'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: make object_finalize static
Paolo Bonzini [Fri, 23 Nov 2012 08:47:16 +0000 (09:47 +0100)]
qom: make object_finalize static

It is not used anymore, and there is no need to make it public.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqdev: simplify (de)allocation of buses
Paolo Bonzini [Fri, 23 Nov 2012 08:47:15 +0000 (09:47 +0100)]
qdev: simplify (de)allocation of buses

All conditional deallocation can now be done with object_delete.
Remove the @qom_allocated and @glib_allocated fields; replace the latter
with a direct assignment of the @free function pointer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: make object_delete usable for statically-allocated objects
Paolo Bonzini [Fri, 23 Nov 2012 08:47:14 +0000 (09:47 +0100)]
qom: make object_delete usable for statically-allocated objects

Store in the object the freeing function that will be used at deletion
time.  This makes it possible to use object_delete on statically-allocated
(embedded) objects.  Dually, it makes it possible to use object_unparent
and object_unref without leaking memory, when the lifetime of object
might extend until after the call to object_delete.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqdev: move bus removal to object_unparent
Paolo Bonzini [Fri, 23 Nov 2012 08:47:13 +0000 (09:47 +0100)]
qdev: move bus removal to object_unparent

Add an ObjectClass method that is done at object_unparent time.  It
should remove any backlinks to the object in the composition tree,
so that object_delete will be able to drop the last reference and
free the object.

Use it for qdev buses.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: fix refcount of non-heap-allocated objects
Paolo Bonzini [Fri, 23 Nov 2012 08:47:12 +0000 (09:47 +0100)]
qom: fix refcount of non-heap-allocated objects

The reference count for embedded objects is always one too low, because
object_initialize_with_type returns with zero references to the object.
This causes premature finalization of the object (or an assertion failure)
after calling object_ref to add an extra reference and object_unref to
remove it.

The fix is to move the initial object_ref call from object_new_with_type
to object_initialize_with_type.

Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosclp: Fix uninitialized var in handle_write_event_buf().
Cornelia Huck [Fri, 23 Nov 2012 00:18:12 +0000 (00:18 +0000)]
sclp: Fix uninitialized var in handle_write_event_buf().

Some gcc versions rightly complain about a possibly unitialized rc,
so let's move setting it before the QTAILQ_FOREACH().

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agos390: Fix ram_size updating in machine init
Heinz Graalfs [Mon, 19 Nov 2012 23:28:34 +0000 (23:28 +0000)]
s390: Fix ram_size updating in machine init

The global variable 'ram_size' is hidden by the local variable
declaration in s390_init(). Since we want to update the global
ram size in certain cases we must not use a local ram_size
variable.
- This fixes booting with unusual ram sizes like -m 67001
- This changes behaviour back to the situation before commit
  5f072e1f3075bd869e0ace9f2545a85992ac0084
  (create struct for machine initialization arguments)

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agofbdev: fix pixman compile on old pixman
Alexander Graf [Mon, 26 Nov 2012 18:49:58 +0000 (19:49 +0100)]
fbdev: fix pixman compile on old pixman

My QEMU compile failed with the following error:

qemu-pixman.c: In function ‘qemu_pixman_get_type’:
qemu-pixman.c:24: error: ‘PIXMAN_TYPE_BGRA’ undeclared (first use in this function)
qemu-pixman.c:24: error: (Each undeclared identifier is reported only once
qemu-pixman.c:24: error: for each function it appears in.)

Guard the PIXMAN_TYPE_BGRA branch like in the case right above the failing
case, so that compilation is fixed. Functionality on such old pixman is a
different question ;-).

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agovl.c: Fix broken -usb option
Peter Maydell [Thu, 22 Nov 2012 06:48:45 +0000 (06:48 +0000)]
vl.c: Fix broken -usb option

Commit 094b287f0b accidentally broke the "-usb" command line
option, so it would have no effect if the user had not specified
any machine options at that point. (the return value from
'qemu_opts_find(qemu_find_opts("machine"), 0);' is NULL if there
are no user specified options, so it is only to be used for
looking up an option, not when trying to set one.) Similarly,
would '-usbdevice' no longer cause USB to default to enabled.

Fix this regression by using the same style of code for forcing
the usb=on machine option that we use for other aliases such as
'-enable-kvm'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Fix bug in PCI MSI allocation
Alexey Kardashevskiy [Mon, 12 Nov 2012 16:46:59 +0000 (16:46 +0000)]
pseries: Fix bug in PCI MSI allocation

In one of the recent reworks to the XICS code, a bug was introduced where
we use the wrong sense and allocate level interrupts instead of message
interrupts for PCI MSIs.  This patch fixes it.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agokvm: fix incorrect length in a loop over kvm dirty pages map
Alexey Kardashevskiy [Mon, 19 Nov 2012 15:40:47 +0000 (15:40 +0000)]
kvm: fix incorrect length in a loop over kvm dirty pages map

QEMU allocates a map enough for 4k pages. However the system page size
can be 64K (for example on POWER) and the host kernel uses only a small
part of it as one big stores a dirty flag for 16 pages 4K each,
the hpratio variable stores this ratio and
the kvm_get_dirty_pages_log_range function handles it correctly.

However kvm_get_dirty_pages_log_range still goes beyond the data
provided by the host kernel which is not correct. It does not cause
errors at the moment as the whole bitmap is zeroed before doing KVM ioctl.

The patch reduces number of iterations over the map.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Fix missing TRACE exception
Julio Guerra [Fri, 19 Oct 2012 00:17:13 +0000 (00:17 +0000)]
PPC: Fix missing TRACE exception

This patch fixes bug 1031698 :
https://bugs.launchpad.net/qemu/+bug/1031698

If we look at the (truncated) translation of the conditional branch
instruction in the test submitted in the bug post, the call to the
exception helper is missing in the "bne-false" chunk of translated
code :

IN:
bne-    0x1800278

OUT:
0xb544236d:  jne    0xb5442396

0xb5442373:  mov    %ebp,(%esp)
0xb5442376:  mov    $0x44,%ebx
0xb544237b:  mov    %ebx,0x4(%esp)
0xb544237f:  mov    $0x1800278,%ebx
0xb5442384:  mov    %ebx,0x25c(%ebp)
0xb544238a:  call   0x827475a
                     ^^^^^^^^^^^^^^^^^^

0xb5442396:  mov    %ebp,(%esp)
0xb5442399:  mov    $0x44,%ebx
0xb544239e:  mov    %ebx,0x4(%esp)
0xb54423a2:  mov    $0x1800270,%ebx
0xb54423a7:  mov    %ebx,0x25c(%ebp)

Indeed, gen_exception(ctx, excp) called by gen_goto_tb (called by
gen_bcond) changes ctx->exception's value to excp's :

gen_bcond()
{
  gen_goto_tb(ctx, 0, ctx->nip + li - 4);
  /* ctx->exception value is POWERPC_EXCP_BRANCH */

  gen_goto_tb(ctx, 1, ctx->nip);
  /* ctx->exception now value is POWERPC_EXCP_TRACE */
}

Making the following gen_goto_tb()'s test false during the second call :

if ((ctx->singlestep_enabled &
    (CPU_BRANCH_STEP | CPU_SINGLE_STEP)) &&
    ctx->exception == POWERPC_EXCP_BRANCH /* false...*/) {
         target_ulong tmp = ctx->nip;
         ctx->nip = dest;
         /* ... and this is the missing call */
         gen_exception(ctx, POWERPC_EXCP_TRACE);
         ctx->nip = tmp;
}

So the patch simply adds the missing matching case, fixing our problem.

Signed-off-by: Julio Guerra <guerr@julio.in>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agohw/ide/macio: Fix segfault caused by NULL DMAContext*
Peter Maydell [Tue, 20 Nov 2012 08:16:51 +0000 (08:16 +0000)]
hw/ide/macio: Fix segfault caused by NULL DMAContext*

Pass qemu_sglist_init the global dma_context_memory rather than a NULL
pointer; this fixes a segfault in dma_memory_map() when the guest
starts using DMA.

Reported-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-i386: Enable SSSE3 TCG support
Aurelien Jarno [Sat, 24 Nov 2012 14:07:01 +0000 (15:07 +0100)]
target-i386: Enable SSSE3 TCG support

SSSE3 support has been added to TCG more than 4 years ago in commit
4242b1bd8acc19aaaacffdaad4ac23213d72a72b. It has been disabled by
mistake in commit 551a2dec8fa55006a68393b9d6fb63577d2b3f1c.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-i386/cpu: Add missing flags to Haswell CPU model
Eduardo Habkost [Thu, 22 Nov 2012 15:31:03 +0000 (13:31 -0200)]
target-i386/cpu: Add missing flags to Haswell CPU model

When adding the Haswell CPU model, I intended to make it a superset of the
features present on the SandyBridge model, but I have removed the SEP and
RDTSCP features from the feature list by mistake. This patch adds the
missing SEP and RDTSCP features (that are present on SandyBridge) to
Haswell.

Reported-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agohmp: do not crash on invalid SCSI hotplug
Paolo Bonzini [Fri, 23 Nov 2012 15:56:18 +0000 (16:56 +0100)]
hmp: do not crash on invalid SCSI hotplug

Commit 0d93692 (qdev: Convert busses to QEMU Object Model, 2012-05-02)
removed a check on the type of the bus where a SCSI disk is hotplugged.
However, hot-plugging to the wrong kind of device now causes a crash
due to either a NULL pointer dereference (avoided by the previous patch)
or a failed QOM cast.

Instead, in this case we need to use object_dynamic_cast and check for
the result, similar to what was done before that commit.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: dynamic_cast of NULL is always NULL
Paolo Bonzini [Fri, 23 Nov 2012 15:56:17 +0000 (16:56 +0100)]
qom: dynamic_cast of NULL is always NULL

Trying to cast a NULL value will cause a crash.  Returning
NULL is also sensible, and it is also what the type-unsafe
DO_UPCAST macro does.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotests: add thread pool unit tests
Paolo Bonzini [Fri, 23 Nov 2012 15:13:24 +0000 (16:13 +0100)]
tests: add thread pool unit tests

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotests: add AioContext unit tests
Paolo Bonzini [Fri, 23 Nov 2012 15:13:23 +0000 (16:13 +0100)]
tests: add AioContext unit tests

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoaio: avoid livelock behavior for Win32
Paolo Bonzini [Fri, 23 Nov 2012 14:59:43 +0000 (15:59 +0100)]
aio: avoid livelock behavior for Win32

The repeated calls to WaitForMultipleObjects may cause a livelock in aio_poll,
where no progress is made on bottom halves.  This patch matches the behavior
of the POSIX code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoq35: Add kvmclock support
Jan Kiszka [Wed, 14 Nov 2012 20:54:08 +0000 (15:54 -0500)]
q35: Add kvmclock support

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoq35: Fix non-PCI IRQ processing in ich9_lpc_update_apic
Jan Kiszka [Wed, 14 Nov 2012 20:54:08 +0000 (15:54 -0500)]
q35: Fix non-PCI IRQ processing in ich9_lpc_update_apic

Avoid passing a non-PCI IRQ to ich9_gsi_to_pirq. It's wrong and triggers
an assertion.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoq35: Suppress SMM BIOS initialization under KVM
Jan Kiszka [Wed, 14 Nov 2012 20:54:07 +0000 (15:54 -0500)]
q35: Suppress SMM BIOS initialization under KVM

Same as for i44fx: KVM does not support SMM yet. Signal it initialized
to Seabios to avoid failures.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoich9: Add i82801b11 dmi-to-pci bridge
Jason Baron [Wed, 14 Nov 2012 20:54:07 +0000 (15:54 -0500)]
ich9: Add i82801b11 dmi-to-pci bridge

Add the dmi-to-pci i82801b11 bridge chip. This is the pci bridge chip
that q35 uses on its host bus for PCI bus arbitration.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoq35: Introduce q35 pc based chipset emulator
Isaku Yamahata [Wed, 14 Nov 2012 20:54:06 +0000 (15:54 -0500)]
q35: Introduce q35 pc based chipset emulator

pc q35 based chipset emulator to support pci express natively. Based on
Anthony Liguori's suggestion, the machine name is 'q35-next', with an alias
of 'q35'. At this point, there are no compatibility guarantees. When the
chipset stabilizes more, we will begin to version the machine names.

Major features which still need to be added:

-Migration support (mostly around ahci)
-ACPI hotplug support (pcie hotplug support is working)
-Passthrough support

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoich9: Add smbus
Jason Baron [Fri, 23 Nov 2012 03:06:42 +0000 (22:06 -0500)]
ich9: Add smbus

Add support for the ich9 smbus chip.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoich9: Add the lpc chip
Jason Baron [Wed, 14 Nov 2012 20:54:05 +0000 (15:54 -0500)]
ich9: Add the lpc chip

Add support for the ICH9 LPC chip.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoich9: Add acpi support and definitions
Jason Baron [Fri, 23 Nov 2012 03:05:06 +0000 (22:05 -0500)]
ich9: Add acpi support and definitions

Lay the groundwork for subsequent ich9 support.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>