]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
12 years agofix multiboot loading if load_end_addr == 0
Scott Moser [Mon, 26 Mar 2012 19:27:00 +0000 (15:27 -0400)]
fix multiboot loading if load_end_addr == 0

The previous multiboot load code did not treat the case where
load_end_addr was 0 specially.  The multiboot specification says the
following:
 * load_end_addr
   Contains the physical address of the end of the data segment.
   (load_end_addr - load_addr) specifies how much data to load. This
   implies that the text and data segments must be consecutive in the
   OS image; this is true for existing a.out executable formats. If
   this field is zero, the boot loader assumes that the text and data
   segments occupy the whole OS image file.

Signed-off-by: Scott Moser <smoser@ubuntu.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovga: fix vram double-mapping with -vga std and -M pc-0.12
Avi Kivity [Wed, 9 May 2012 15:23:06 +0000 (18:23 +0300)]
vga: fix vram double-mapping with -vga std and -M pc-0.12

With pc-0.12, we map the video RAM both through the PCI BAR (the guest does
this) and through a fixed mapping at 0xe0000000.  The memory API doesn't allow
this double map, and aborts.

Fix by using an alias.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'afaerber-or/cocoa-for-upstream' into staging
Anthony Liguori [Tue, 29 May 2012 11:54:16 +0000 (06:54 -0500)]
Merge remote-tracking branch 'afaerber-or/cocoa-for-upstream' into staging

* afaerber-or/cocoa-for-upstream:
  cocoa: Suppress Cocoa frontend for -qtest
  arch_init: Fix AltiVec build on Darwin/ppc

12 years agococoa: Suppress Cocoa frontend for -qtest
Andreas Färber [Mon, 28 May 2012 01:18:31 +0000 (03:18 +0200)]
cocoa: Suppress Cocoa frontend for -qtest

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
12 years agoarch_init: Fix AltiVec build on Darwin/ppc
Andreas Färber [Sun, 27 May 2012 14:21:02 +0000 (16:21 +0200)]
arch_init: Fix AltiVec build on Darwin/ppc

Commit f29a56147b66845914d0a645bf9b4c5bb9a6af57 (implement
-no-user-config command-line option (v3)) introduced uses of bool
in arch_init.c. Shortly before that usage is support code for
AltiVec (conditional to __ALTIVEC__).

GCC's altivec.h may in a !__APPLE_ALTIVEC__ code path redefine bool,
leading to type mismatches. altivec.h recommends to #undef for C++
compatibility, but doing so in C leads to bool remaining undefined.

Fix by redefining bool to _Bool as mandated for stdbool.h by POSIX.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoMerge remote-tracking branch 'sstabellini/for_1.1_rc3' into staging
Anthony Liguori [Tue, 29 May 2012 09:32:13 +0000 (04:32 -0500)]
Merge remote-tracking branch 'sstabellini/for_1.1_rc3' into staging

* sstabellini/for_1.1_rc3:
  Call xc_domain_shutdown with the reboot flag when the guest requests a reboot.
  xen: Fix PV-on-HVM
  xen_disk: properly update stats in ioreq_release()
  xen_disk: use bdrv_aio_flush instead of bdrv_flush
  xen_disk: remove syncwrite option
  xen: disable rtc_clock
  xen: do not initialize the interval timer and PCSPK emulator

12 years agoMerge remote-tracking branch 'mdroth/qga-pull-5-24-12' into staging
Anthony Liguori [Tue, 29 May 2012 09:31:29 +0000 (04:31 -0500)]
Merge remote-tracking branch 'mdroth/qga-pull-5-24-12' into staging

* mdroth/qga-pull-5-24-12:
  qemu-ga: Fix missing environ declaration
  configure: check if environ is declared

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Tue, 29 May 2012 09:30:49 +0000 (04:30 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony:
  fdc-test: introduced qtest no_media_on_start and cmos qtest for floppy
  fdc: fix media detection
  fdc: floppy drive should be visible after start without media
  qemu-iotests: mark 035 qcow2-only
  qcow2: Check qcow2_alloc_clusters_at() return value
  sheepdog: use heap instead of stack for BDRVSheepdogState
  sheepdog: return -errno on error
  sheepdog: mark image as snapshot when tag is specified
  qemu-img: Explain how rebase operation can be used to perform a 'diff' operation.
  qcow2: don't leak buffer for unexpected qcow_version in header

12 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Tue, 29 May 2012 09:30:00 +0000 (04:30 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

* kiszka/queues/slirp:
  slirp: Avoid redefining MAX_TCPOPTLEN
  slirp: Avoid statements without effect on Big Endian host
  slirp: Untangle TCPOLEN_* from TCPOPT_*

12 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Tue, 29 May 2012 09:28:59 +0000 (04:28 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  ISCSI: Switch to using READ16/WRITE16 for I/O to the LUN
  ISCSI: Only call READCAPACITY16 for SBC devices, use READCAPACITY10 for MMC
  ISCSI: get device type at connection time
  ISCSI: change num_blocks to 64-bit
  ISCSI: redo how we set up the events
  scsi: declare vmstate_info_scsi_requests to be static

12 years agoslirp: Avoid redefining MAX_TCPOPTLEN
Andreas Färber [Mon, 28 May 2012 17:52:35 +0000 (19:52 +0200)]
slirp: Avoid redefining MAX_TCPOPTLEN

MAX_TCPOPTLEN is being defined as 32. Darwin already has it as 40,
causing a warning. The value is only used to declare an array,
into which currently 4 bytes are written at most.

Therefore always override MAX_TCPOPTLEN for now.

Suggested-by: Jan Kiszka <jan.kiszka@web.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoslirp: Avoid statements without effect on Big Endian host
Andreas Färber [Mon, 28 May 2012 17:34:20 +0000 (19:34 +0200)]
slirp: Avoid statements without effect on Big Endian host

Darwin has HTON*/NTOH* macros that on BE simply return the argument.
This is incompatible with SLIRP's use of these macros as a statement.

Undefine the macros in the HOST_WORDS_BIGENDIAN code path to redefine
these macros as no-op, as already done when they were undefined.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoISCSI: Switch to using READ16/WRITE16 for I/O to the LUN
Ronnie Sahlberg [Tue, 22 May 2012 10:10:05 +0000 (20:10 +1000)]
ISCSI: Switch to using READ16/WRITE16 for I/O to the LUN

This allows using LUNs bigger than 2TB.  Keep using READ10 for other
device types such as MMC.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
12 years agoISCSI: Only call READCAPACITY16 for SBC devices, use READCAPACITY10 for MMC
Ronnie Sahlberg [Sat, 26 May 2012 04:56:38 +0000 (14:56 +1000)]
ISCSI: Only call READCAPACITY16 for SBC devices, use READCAPACITY10 for MMC

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
12 years agoISCSI: get device type at connection time
Ronnie Sahlberg [Fri, 25 May 2012 11:59:01 +0000 (21:59 +1000)]
ISCSI: get device type at connection time

This is needed to avoid READ CAPACITY(16) for MMC devices.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoISCSI: change num_blocks to 64-bit
Paolo Bonzini [Sat, 26 May 2012 07:41:13 +0000 (09:41 +0200)]
ISCSI: change num_blocks to 64-bit

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoISCSI: redo how we set up the events
Ronnie Sahlberg [Tue, 22 May 2012 09:56:36 +0000 (19:56 +1000)]
ISCSI: redo how we set up the events

Call qemu_notify_event() after updating events.  Otherwise, If we add
an event for -is-writeable but the socket is already writeable there
may be a delay before the event callback is actually triggered.

Those delays would in particular hurt performance during BIOS boot and
when the GRUB bootloader reads the kernel and initrd.

But first call out to the socket write functions directly, and only set up
the write event if the socket is full.  This will happen very rarely and
this improves performance.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
12 years agoslirp: Untangle TCPOLEN_* from TCPOPT_*
Andreas Färber [Fri, 27 Apr 2012 22:29:05 +0000 (00:29 +0200)]
slirp: Untangle TCPOLEN_* from TCPOPT_*

Commit b72210568ef0c0fb141a01cffb71a09c4efa0364 (slirp: clean up
conflicts with system headers) enclosed TCPOLEN_MAXSEG with an #ifdef
TCPOPT_EOL. This broke the build on illumos, which has TCPOPT_*
but not TCPOLEN_*.

Move them to their own #ifdef TCPOLEN_MAXSEG section to remedy this.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agotcg/ppc: Handle _CALL_DARWIN being undefined on Darwin
Andreas Färber [Sun, 27 May 2012 17:50:47 +0000 (19:50 +0200)]
tcg/ppc: Handle _CALL_DARWIN being undefined on Darwin

powerpc-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5577)
does not define _CALL_DARWIN, leading to unexpected behavior w.r.t.
register clobbering and stack frame layout.

Since _CALL_DARWIN is a reserved identifier, define a custom
TCG_TARGET_CALL_DARWIN based on either _CALL_DARWIN or __APPLE__.

Signed-off-by: Andreas F?rber <andreas.faerber@web.de>
Signed-off-by: malc <av1474@comtv.ru>
12 years agofdc-test: introduced qtest no_media_on_start and cmos qtest for floppy
Pavel Hrdina [Thu, 24 May 2012 09:02:30 +0000 (11:02 +0200)]
fdc-test: introduced qtest no_media_on_start and cmos qtest for floppy

As default a guest has always one floppy drive so 0x10 byte in CMOS
has to have 0x40 value. Higher 4 bits means that the first floppy drive
is 1.44 Mb 3"5 drive and lower 4 bits means the second drive is not present.

After the guest starts DSKCHG bit in DIR register should be set. If there
is no media in drive, this bit should be set all the time.

Because we start the guest without media in drive, we have to swap
'eject' and 'change' in 'test_media_change'.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: fix media detection
Pavel Hrdina [Thu, 24 May 2012 09:02:29 +0000 (11:02 +0200)]
fdc: fix media detection

We have to set up 'media_changed' after guest start so floppy driver
could detect that there is no media in drive. For this purpose we call
'fdctrl_change_cb' instead of 'fd_revalidate' in 'fdctrl_connect_drives'.
'fd_revalidate' is called inside 'fdctrl_change_cb'.

We still have to set default drive geometry in 'fd_revalidate' even
if there is no media in drive. When you try to open (windows) or mount (linux)
floppy the driver tries to seek on track 1. Linux guest stuck in loop then
kernel crashes and windows guest prints error message.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: floppy drive should be visible after start without media
Pavel Hrdina [Thu, 24 May 2012 09:02:28 +0000 (11:02 +0200)]
fdc: floppy drive should be visible after start without media

If you start guest with floppy drive but without media inserted, guest
still should see floppy drive pressent.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: mark 035 qcow2-only
Stefan Hajnoczi [Thu, 24 May 2012 15:26:51 +0000 (16:26 +0100)]
qemu-iotests: mark 035 qcow2-only

The 035 parallel aio write test relies on knowledge of qcow2 metadata
layout to stress parallel L2 table accesses.  This only works for qcow2
unless we add additional calculations for qed or other formats.

Mark this test as qcow2-only.

Note that the test is strictly speaking non-deterministic although the
output produced is reliable with qcow2.  This is because the aio_write
command returns before the aio write request has completed.  Completions
can occur at any time afterwards and cause a message to be printed.
Therefore the exact output of this test is not deterministic but we seem
to get away with it for qcow2 (maybe due to coroutine and main loop
scheduling).

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Check qcow2_alloc_clusters_at() return value
Kevin Wolf [Thu, 24 May 2012 10:56:32 +0000 (12:56 +0200)]
qcow2: Check qcow2_alloc_clusters_at() return value

When using qcow2_alloc_clusters_at(), the cluster allocation code
checked the wrong variable for an error code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: use heap instead of stack for BDRVSheepdogState
MORITA Kazutaka [Wed, 16 May 2012 18:15:34 +0000 (03:15 +0900)]
sheepdog: use heap instead of stack for BDRVSheepdogState

bdrv_create() is called in coroutine context now, so we cannot use
more stack than 1 MB in the function if we use ucontext coroutine.
This patch allocates BDRVSheepdogState, whose size is 4 MB, on the
heap in sd_create().

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: return -errno on error
MORITA Kazutaka [Wed, 16 May 2012 18:15:33 +0000 (03:15 +0900)]
sheepdog: return -errno on error

On error, BlockDriver APIs should return -errno instead of -1.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: mark image as snapshot when tag is specified
MORITA Kazutaka [Wed, 16 May 2012 18:15:31 +0000 (03:15 +0900)]
sheepdog: mark image as snapshot when tag is specified

When a snapshot tag is specified in the filename, the opened image is
a snapshot.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-img: Explain how rebase operation can be used to perform a 'diff' operation.
Richard W.M. Jones [Mon, 21 May 2012 13:58:05 +0000 (14:58 +0100)]
qemu-img: Explain how rebase operation can be used to perform a 'diff' operation.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: don't leak buffer for unexpected qcow_version in header
Jim Meyering [Mon, 21 May 2012 11:06:54 +0000 (13:06 +0200)]
qcow2: don't leak buffer for unexpected qcow_version in header

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: declare vmstate_info_scsi_requests to be static
Jim Meyering [Mon, 21 May 2012 10:03:10 +0000 (12:03 +0200)]
scsi: declare vmstate_info_scsi_requests to be static

Signed-off-by: Jim Meyering <meyering@redhat.com>
12 years agoqemu-ga: Fix missing environ declaration
Luiz Capitulino [Wed, 23 May 2012 18:48:05 +0000 (15:48 -0300)]
qemu-ga: Fix missing environ declaration

Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ global
variable, but is relying on environ to be declared somewhere else.

This worked for me because on F16 environ is declared in <unistd.h>, but
that doesn't happen in OpenBSD for example, causing a build failure.

This commit fixes the build error by declaring environ if it hasn't
being declared yet.

Also fixes a build warning due to a missing <sys/wait.h> include.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoconfigure: check if environ is declared
Luiz Capitulino [Wed, 23 May 2012 18:48:04 +0000 (15:48 -0300)]
configure: check if environ is declared

Some systems may declare environ automatically, others don't. Check for it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoaudio: Always call fini on exit
Jan Kiszka [Thu, 24 May 2012 15:05:15 +0000 (12:05 -0300)]
audio: Always call fini on exit

Not only clean up enabled voices but any registered one. Backends like
pulsaudio rely on unconditional fini handler invocations.

This fixes "Memory pool destroyed but not all memory blocks freed!"
warnings on VM shutdowns when pa is used and lockups of QEMU on shutdown
as it got stuck on some pa-internal synchronization point.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoes1370: Fix debug code
Stefan Weil [Wed, 23 May 2012 21:26:41 +0000 (23:26 +0200)]
es1370: Fix debug code

When DEBUG_ES1370 is defined, the compiler shows these warnings:

hw/es1370.c: In function ?es1370_update_voices?:
hw/es1370.c:414: warning: format ?%d? expects type ?int?, but argument 3 has type ?size_t?
hw/es1370.c: In function ?es1370_writel?:
hw/es1370.c:582: warning: format ?%d? expects type ?int?, but argument 3 has type ?long int?
hw/es1370.c:592: warning: format ?%d? expects type ?int?, but argument 3 has type ?long int?
hw/es1370.c:609: warning: format ?%d? expects type ?int?, but argument 3 has type ?long int?
hw/es1370.c: In function ?es1370_readl?:
hw/es1370.c:751: warning: suggest braces around empty body in an ?if? statement

Fix the format strings and add the missing braces.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoUpdate version for 1.1.0-rc3
Anthony Liguori [Tue, 22 May 2012 14:21:01 +0000 (09:21 -0500)]
Update version for 1.1.0-rc3

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoxen: Fix PV-on-HVM
Anthony PERARD [Wed, 16 May 2012 17:50:10 +0000 (18:50 +0100)]
xen: Fix PV-on-HVM

In the context of PV-on-HVM under Xen, the emulated nics are supposed to be
unplug before the guest drivers are initialized, when the guest write to a
specific IO port.

Without this patch, the guest end up with two nics with the same MAC, the
emulated nic and the PV nic.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqdev: Fix memory leak
dunrong huang [Fri, 18 May 2012 11:14:13 +0000 (19:14 +0800)]
qdev: Fix memory leak

The str allocated in visit_type_str was not freed.

The visit_type_str function is an input visitor(<QMP/String/etc>-to-native)
here, it will allocate memory for caller, so the caller is responsible for
freeing the memory.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: dunrong huang <riegamaths@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio: check virtio_load return code
Orit Wassermann [Wed, 16 May 2012 10:21:35 +0000 (12:21 +0200)]
virtio: check virtio_load return code

Otherwise we crash on error.

Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Orit Wassermann <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-blk: always enable VIRTIO_BLK_F_SCSI
Paolo Bonzini [Wed, 16 May 2012 10:54:06 +0000 (12:54 +0200)]
virtio-blk: always enable VIRTIO_BLK_F_SCSI

VIRTIO_BLK_F_SCSI is supposed to mean whether the host can *parse*
SCSI requests, not *execute* them.  You could run QEMU with scsi=on
and a file-backed disk, and QEMU would fail all SCSI requests even
though it advertises VIRTIO_BLK_F_SCSI.

Because we need to do this to fix a migration compatibility problem
related to how QEMU is invoked by management, we must do this
unconditionally even on older machine types.  This more or less assumes
that no one ever invoked QEMU with scsi=off.

Here is how testing goes:

- old QEMU, scsi=on -> new QEMU, scsi=on
- new QEMU, scsi=on -> old QEMU, scsi=on
- old QEMU, scsi=off -> new QEMU, scsi=on
- new QEMU, scsi=off -> old QEMU, scsi=on
        ok (new QEMU has VIRTIO_BLK_F_SCSI, adding host features is fine)

- old QEMU, scsi=off -> new QEMU, scsi=off
        ok (new QEMU has VIRTIO_BLK_F_SCSI, adding host features is fine)

- old QEMU, scsi=on -> new QEMU, scsi=off
        ok, bug fixed

- new QEMU, scsi=on -> old QEMU, scsi=off
        doesn't work (same as: old QEMU, scsi=on -> old QEMU, scsi=off)

- new QEMU, scsi=off -> old QEMU, scsi=off
        broken by the patch

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-blk: define VirtIOBlkConf
Paolo Bonzini [Wed, 16 May 2012 10:54:05 +0000 (12:54 +0200)]
virtio-blk: define VirtIOBlkConf

We will have to add another field to the virtio-blk configuration in
the next patch.  Avoid a proliferation of arguments to virtio_blk_init.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-blk: blockdev_mark_auto_del is transport-independent
Paolo Bonzini [Wed, 16 May 2012 10:54:04 +0000 (12:54 +0200)]
virtio-blk: blockdev_mark_auto_del is transport-independent

Move it from virtio_blk_exit_pci to virtio_blk_exit.

This is included here because the next patch removes proxy->block.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-blk: report non-zero status when failing SG_IO requests
Paolo Bonzini [Wed, 16 May 2012 10:54:03 +0000 (12:54 +0200)]
virtio-blk: report non-zero status when failing SG_IO requests

Linux really looks only at scsi->errors for SG_IO requests; it does
not look at the virtio request status at all.  Because of this, when
a SG_IO request is failed early with virtio_blk_req_complete(req,
VIRTIO_BLK_S_UNSUPP), without writing hdr.status, it will look like
a success to the guest.

This is their bug, but we can make it safe for older guests now by
forcing scsi->errors to have a non-zero value whenever a request
has to be failed.

But if we fix the bug in the guest driver, we will have another problem
because QEMU returns VIRTIO_BLK_S_IOERR if the status is non-zero, and
Linux translates that to -EIO.  Rather, the guest should succeed the
request and pass the non-zero status via the userspace-provided SG_IO
structure.  So, remove the case where virtio_blk_handle_scsi can
return VIRTIO_BLK_S_IOERR.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agouse an uint64_t for the max_sz parameter in load_image_targphys
Mark Langsdorf [Mon, 12 Mar 2012 16:33:25 +0000 (11:33 -0500)]
use an uint64_t for the max_sz parameter in load_image_targphys

Allow load_image_targphys to load files on systems with more than 2G of
emulated memory by changing the max_sz parameter from an int to an
uint64_t.

Reviewed-by: Andreas F=E4rber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'mdroth/qga-pull-5-15-12' into staging
Anthony Liguori [Mon, 21 May 2012 20:31:31 +0000 (15:31 -0500)]
Merge remote-tracking branch 'mdroth/qga-pull-5-15-12' into staging

* mdroth/qga-pull-5-15-12:
  qemu-ga: align versioning with QEMU_VERSION
  qemu-ga: fix segv after failure to open log file
  qemu-ga: guest-shutdown: use only async-signal-safe functions
  qemu-ga: guest-shutdown: become synchronous
  qemu-ga: guest-suspend: make the API synchronous
  qemu-ga: become_daemon(): reopen standard fds to /dev/null
  qemu-ga: make reopen_fd_to_null() public
  qemu-ga: guest-suspend-hybrid: don't emit a success response
  qemu-ga: guest-suspend-ram: don't emit a success response
  qemu-ga: guest-suspend-disk: don't emit a success response
  qemu-ga: guest-shutdown: don't emit a success response
  qemu-ga: don't warn on no command return
  qapi: add support for command options

12 years agotests: Add rtc-test (fix test regression)
Stefan Weil [Tue, 15 May 2012 16:19:45 +0000 (18:19 +0200)]
tests: Add rtc-test (fix test regression)

Commit 93e9eb6808c886f5f1c903b7ced1eed65de2ba39 added fdc-test,
but accidentally removed rtc-test because check-qtest-i386-y was
not enhanced but set twice.

This patch adds rtc-test again (and sorts both tests alphabetically).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotests: Fix linker failure for fdc-test
Stefan Weil [Tue, 15 May 2012 05:27:19 +0000 (07:27 +0200)]
tests: Fix linker failure for fdc-test

When QEMU was built with the simple trace backend, linking failed:

  LINK  tests/fdc-test
oslib-posix.o: In function `trace_qemu_memalign':
qemu/bin/debug/x86/./trace.h:31: undefined reference to `trace3'
oslib-posix.o: In function `trace_qemu_vmalloc':
qemu/bin/debug/x86/./trace.h:35: undefined reference to `trace2'
oslib-posix.o: In function `trace_qemu_vfree':
qemu/bin/debug/x86/./trace.h:39: undefined reference to `trace1'
collect2: error: ld returned 1 exit status
make: *** [tests/fdc-test] Fehler 1

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomips: Fix BC1ANY[24]F instructions
Richard Sandiford [Sat, 26 Nov 2011 03:37:07 +0000 (03:37 +0000)]
mips: Fix BC1ANY[24]F instructions

There's some dodgy application of De Morgan's law in the emulation
of the MIPS BC1ANY[24]F instructions: they end up branching only
if all CCs are false, rather than if one CC is.

Tested on mips64-linux-gnu, where it fixes the GCC MIPS3D tests.

Signed-off-by: Richard Sandiford <rdsandiford@googlemail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agolinux-user: Fix stale tbs after mmap
Alexander Graf [Thu, 10 May 2012 22:40:10 +0000 (22:40 +0000)]
linux-user: Fix stale tbs after mmap

If we execute linux-user code that does the following:

  * A = mmap()
  * execute code in A
  * munmap(A)
  * B = mmap(), but mmap returns the same address as A
  * execute code in B

we end up executing a stale cached tb that contains translated code
from A, while we want new code from B.

This patch adds a TB flush for mmap'ed regions, before we return them,
avoiding the whole issue. It also adds a flush for munmap, so that we
don't execute stale TBs instead of getting a segfault.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agovirtio-pci: add missing 'static'
Blue Swirl [Sat, 12 May 2012 19:45:22 +0000 (19:45 +0000)]
virtio-pci: add missing 'static'

There are no outside references to virtio_portio.
Add missing 'static' specifier.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosparc64: fix initrd loading
Blue Swirl [Sat, 12 May 2012 17:20:52 +0000 (17:20 +0000)]
sparc64: fix initrd loading

Initrd load address is too low, it conflicts with kernel load
address:
rom: requested regions overlap (rom phdr #0: /tmp/vmlinux-debian-6.0.4-sparc64. free=0x0000000000742519, addr=0x0000000000400000)
rom loading failed

Fix by making the initrd address variable, load initrd after kernel
image. Use 64 bit variables instead of longs or 32 bit types.

Tested-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoaudio: split IN_T into two separate constants
Roger Pau Monne [Fri, 18 May 2012 11:08:14 +0000 (12:08 +0100)]
audio: split IN_T into two separate constants

Split IN_T into BSIZE and ITYPE, to avoid expansion if the OS has
defined macros for the intX_t and uintX_t types. The IN_T constant is
then defined in mixeng_template.h so it can be used by the
functions/macros on this header file.

This change has been tested successfully under Debian Linux and NetBSD
6.0BETA.

Cc: Vassili Karpov (malc) <av1474@comtv.ru>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agotarget-microblaze: impelemented swapx instructions
Peter A. G. Crosthwaite [Thu, 17 May 2012 05:37:49 +0000 (15:37 +1000)]
target-microblaze: impelemented swapx instructions

Implemented the swapb and swaph byte/halfword reversal instructions added
to microblaze v8.30

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoCall xc_domain_shutdown with the reboot flag when the guest requests a reboot.
John V. Baboval [Thu, 17 May 2012 10:33:09 +0000 (10:33 +0000)]
Call xc_domain_shutdown with the reboot flag when the guest requests a reboot.

Signed-off-by: John V. Baboval <john.baboval@virtualcomputer.com>
Signed-off-by: Tom Goetz <tom.goetz@virtualcomputer.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoxen: Fix PV-on-HVM
Anthony PERARD [Thu, 17 May 2012 10:31:20 +0000 (10:31 +0000)]
xen: Fix PV-on-HVM

In the context of PV-on-HVM under Xen, the emulated nics are supposed to be
unplug before the guest drivers are initialized, when the guest write to a
specific IO port.

Without this patch, the guest end up with two nics with the same MAC, the
emulated nic and the PV nic.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoxen_disk: properly update stats in ioreq_release()
Jan Beulich [Mon, 14 May 2012 16:46:33 +0000 (16:46 +0000)]
xen_disk: properly update stats in ioreq_release()

While for the "normal" case (called from blk_send_response_all())
decrementing requests_finished is correct, doing so in the parse error
case is wrong; requests_inflight needs to be decremented instead.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
12 years agoxen_disk: use bdrv_aio_flush instead of bdrv_flush
Stefano Stabellini [Thu, 26 Apr 2012 16:35:53 +0000 (16:35 +0000)]
xen_disk: use bdrv_aio_flush instead of bdrv_flush

Use bdrv_aio_flush instead of bdrv_flush.

Make sure to call bdrv_aio_writev/readv after the presync bdrv_aio_flush is fully
completed and make sure to call the postsync bdrv_aio_flush after
bdrv_aio_writev/readv is fully completed.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoxen_disk: remove syncwrite option
Stefano Stabellini [Fri, 13 Apr 2012 16:44:54 +0000 (16:44 +0000)]
xen_disk: remove syncwrite option

This patch removes a dead option.

The same can be achieved removing BDRV_O_NOCACHE and BDRV_O_CACHE_WB
from the flags passed to bdrv_open.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoxen: disable rtc_clock
Stefano Stabellini [Mon, 21 Nov 2011 11:10:21 +0000 (11:10 +0000)]
xen: disable rtc_clock

rtc_clock is only used by the RTC emulator (mc146818rtc.c), however Xen
has its own RTC emulator in the hypervisor so we can disable it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoxen: do not initialize the interval timer and PCSPK emulator
Stefano Stabellini [Mon, 14 Nov 2011 15:07:01 +0000 (15:07 +0000)]
xen: do not initialize the interval timer and PCSPK emulator

PIT and PCSPK are emulated by the hypervisor so we don't need to emulate
them in Qemu: this patch prevents Qemu from waking up needlessly at
PIT_FREQ on Xen.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoqemu-ga: align versioning with QEMU_VERSION
Michael Roth [Mon, 14 May 2012 14:33:48 +0000 (09:33 -0500)]
qemu-ga: align versioning with QEMU_VERSION

Previously qemu-ga version was defined seperately. Since it is aligned
with QEMU releases, use QEMU_VERSION instead. This also implies the
version bump for 1.1[-rcN] release of qemu-ga.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: fix segv after failure to open log file
Michael Roth [Mon, 14 May 2012 21:42:35 +0000 (16:42 -0500)]
qemu-ga: fix segv after failure to open log file

Currently, if we fail to open the specified log file (generally due to a
permissions issue), we'll assign NULL to the logfile handle (stderr,
initially) used by the logging routines, which can cause a segfault to
occur when we attempt to report the error before exiting.

Instead, only re-assign if the open() was successful.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: guest-shutdown: use only async-signal-safe functions
Luiz Capitulino [Mon, 14 May 2012 18:25:20 +0000 (15:25 -0300)]
qemu-ga: guest-shutdown: use only async-signal-safe functions

POSIX mandates[1] that a child process of a multi-thread program uses
only async-signal-safe functions before exec(). We consider qemu-ga
to be multi-thread, because it uses glib.

However, qmp_guest_shutdown() uses functions that are not
async-signal-safe. Fix it the following way:

- fclose() -> reopen_fd_to_null()
- execl() -> execle()
- exit() -> _exit()
- drop slog() usage (which is not safe)

  [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: guest-shutdown: become synchronous
Luiz Capitulino [Fri, 11 May 2012 19:19:47 +0000 (16:19 -0300)]
qemu-ga: guest-shutdown: become synchronous

Last commit dropped qemu-ga's SIGCHLD handler, used to automatically
reap terminated children processes. This introduced a bug to
qmp_guest_shutdown(): it will generate zombies.

This problem probably doesn't matter in the success case, as the VM
will shutdown anyway, but let's do the right thing and reap the
created process. This ultimately means that guest-shutdown is now a
synchronous command.

An interesting side effect is that guest-shutdown is now able to
report an error to the client if shutting down fails.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: guest-suspend: make the API synchronous
Luiz Capitulino [Fri, 11 May 2012 19:19:46 +0000 (16:19 -0300)]
qemu-ga: guest-suspend: make the API synchronous

Currently, qemu-ga has a SIGCHLD handler that automatically reaps terminated
children processes. The idea is to avoid having qemu-ga commands blocked
waiting for children to terminate.

That approach has two problems:

 1. qemu-ga is unable to detect errors in the child, meaning that qemu-ga
    returns success even if the child fails to perform its task

 2. if a command does depend on the child exit status, the command has to
    play tricks to bypass the automatic reaper

Case 2 impacts the guest-suspend-* API, because it has to execute an external
program to check for suspend support. Today, to bypass the automatic reaper,
suspend code has to double fork and pass exit status information through a
pipe. Besides being complex, this is prone to race condition bugs. Indeed,
the current code does have such bugs.

Making the guest-suspend-* API synchronous (ie. by dropping the SIGCHLD
handler and calling waitpid() from commands) is a much simpler approach,
which fixes current race conditions bugs and enables commands to detect
errors in the child.

This commit does just that. There's a side effect though, guest-shutdown
will generate zombies if shutting down fails. This will be fixed by the
next commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: become_daemon(): reopen standard fds to /dev/null
Luiz Capitulino [Thu, 10 May 2012 19:50:42 +0000 (16:50 -0300)]
qemu-ga: become_daemon(): reopen standard fds to /dev/null

This fixes a bug where qemu-ga doesn't suspend the guest because it
fails to detect suspend support even when the guest does support
suspend. This happens because of the way qemu-ga fds are managed in
daemon mode.

When starting qemu-ga with --daemon, become_daemon() will close all
standard fds. This will cause qemu-ga to end up with the following
fds (if started with 'qemu-ga --daemon'):

    0 -> /dev/vport0p1
    3 -> /run/qemu-ga.pid

Then a guest-suspend-* function is issued. They call bios_supports_mode(),
which will call pipe(), and qemu-ga's fd will be:

    0 -> /dev/vport0p1
    1 -> pipe:[16247]
    2 -> pipe:[16247]
    3 -> /run/qemu-ga.pid

bios_supports_mode() forks off a child and blocks waiting for the child
to write something to the pipe. The child, however, closes its reading
end of the pipe _and_ reopen all standard fds to /dev/null. This will
cause the child's fds to be:

    0 -> /dev/null
    1 -> /dev/null
    2 -> /dev/null
    3 -> /run/qemu-ga.pid

In other words, the child's writing end of the pipe is now /dev/null.
It writes there and exits. The parent process (blocked on read()) will
get an EOF and interpret this as "something unexpected happened in
the child, let's assume the guest doesn't support suspend". And suspend
will fail.

To solve this problem we have to reopen standard fds to /dev/null
in become_daemon(), instead of closing them.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: make reopen_fd_to_null() public
Luiz Capitulino [Thu, 10 May 2012 19:50:41 +0000 (16:50 -0300)]
qemu-ga: make reopen_fd_to_null() public

The next commit wants to use it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: guest-suspend-hybrid: don't emit a success response
Luiz Capitulino [Tue, 8 May 2012 17:24:49 +0000 (14:24 -0300)]
qemu-ga: guest-suspend-hybrid: don't emit a success response

Today, qemu-ga may not be able to emit a success response when
guest-suspend-hybrid completes. This happens because the VM may
suspend before qemu-ga is able to emit a response.

This semantic is a bit confusing, as it's not clear for clients if
they should wait for a response or how they should check for success.

This commit solves that problem by changing guest-suspend-hybrid to
never emit a success response and suggests in the documentation
what clients should do to check for success.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: guest-suspend-ram: don't emit a success response
Luiz Capitulino [Tue, 8 May 2012 17:24:48 +0000 (14:24 -0300)]
qemu-ga: guest-suspend-ram: don't emit a success response

Today, qemu-ga may not be able to emit a success response when
guest-suspend-ram completes. This happens because the VM may
suspend before qemu-ga is able to emit a response.

This semantic is a bit confusing, as it's not clear for clients if
they should wait for a response or how they should check for success.

This commit solves that problem by changing guest-suspend-ram to
never emit a success response and suggests in the documentation
what clients should do to check for success.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: guest-suspend-disk: don't emit a success response
Luiz Capitulino [Tue, 8 May 2012 17:24:47 +0000 (14:24 -0300)]
qemu-ga: guest-suspend-disk: don't emit a success response

Today, qemu-ga may not be able to emit a success response when
guest-suspend-disk completes. This happens because the VM may
vanish before qemu-ga is able to emit a response.

This semantic is a bit confusing, as it's not clear for clients if
they should wait for a response or how they should check for success.

This commit solves that problem by changing guest-suspend-disk to
never emit a success response and suggests in the documentation
what clients could do to check for success.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: guest-shutdown: don't emit a success response
Luiz Capitulino [Tue, 8 May 2012 17:24:46 +0000 (14:24 -0300)]
qemu-ga: guest-shutdown: don't emit a success response

Today, qemu-ga may not be able to emit a success response when
guest-shutdown completes. This happens because the VM may vanish
before qemu-ga is able to emit a response.

This semantic is a bit confusing, as it's not clear for clients if
they should wait for a response or how they should check for success.

This commit solves that problem by changing guest-shutdown to never
emit a success response and suggests in the documentation what
clients could do to check for success.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqemu-ga: don't warn on no command return
Luiz Capitulino [Tue, 8 May 2012 17:24:45 +0000 (14:24 -0300)]
qemu-ga: don't warn on no command return

This is a valid condition when a command chooses to not emit a
success response.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqapi: add support for command options
Luiz Capitulino [Tue, 8 May 2012 17:24:44 +0000 (14:24 -0300)]
qapi: add support for command options

Options allow for changes in commands behavior. This commit introduces
the QCO_NO_SUCCESS_RESP option, which causes a command to not emit a
success response.

This is needed by commands such as qemu-ga's guest-shutdown, which
may not be able to complete before the VM vanishes. In this case, it's
useful and simpler not to bother sending a success response.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoUpdate version to 1.1.0-rc2
Anthony Liguori [Mon, 14 May 2012 22:56:50 +0000 (17:56 -0500)]
Update version to 1.1.0-rc2

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotcg/ppc64: Fix CONFIG_TCG_PASS_AREG0
Andreas Färber [Sat, 12 May 2012 01:16:58 +0000 (03:16 +0200)]
tcg/ppc64: Fix CONFIG_TCG_PASS_AREG0

In qemu_ld/st load the registers for the helper calls directly rather
than rotating them around afterwards for AREG0.

Also clobber the additional register.

Signed-off-by: Andreas F?rber <afaerber@suse.de>
Signed-off-by: malc <av1474@comtv.ru>
12 years agotcg/ppc64: Don't hardcode register numbers for qemu_ld/st
Andreas Färber [Sat, 12 May 2012 01:16:57 +0000 (03:16 +0200)]
tcg/ppc64: Don't hardcode register numbers for qemu_ld/st

Facilitates using r3 for prepended AREG0.

Signed-off-by: Andreas F?rber <afaerber@suse.de>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 14 May 2012 17:45:01 +0000 (12:45 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony:
  qemu-img: Fix segmentation fault
  qcow2: Don't ignore failure to clear autoclear flags
  coroutine: Fix setup of sigaltstack coroutines

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Mon, 14 May 2012 15:18:06 +0000 (10:18 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qapi: QMP input visitor, handle floats parsed as ints

12 years agoMerge remote-tracking branch 'afaerber-or/qom-1.1' into staging
Anthony Liguori [Mon, 14 May 2012 15:15:52 +0000 (10:15 -0500)]
Merge remote-tracking branch 'afaerber-or/qom-1.1' into staging

* afaerber-or/qom-1.1:
  mips_fulong2e: Don't register "cpu" VMState twice
  pc: Add back PCI.rombar compat property
  qdev: Fix adding of ptr properties
  qdev: Use object_property_print() in info qtree
  target-i386: Defer MCE init
  qom: Documentation addition for object_class_by_name()
  target-mips: Remove commented-out function declaration

12 years agoMerge remote-tracking branch 'kraxel/usb.50' into staging
Anthony Liguori [Mon, 14 May 2012 15:07:23 +0000 (10:07 -0500)]
Merge remote-tracking branch 'kraxel/usb.50' into staging

* kraxel/usb.50:
  usb-host: handle guest-issued clear halt

12 years agoMerge remote-tracking branch 'spice/spice.v55' into staging
Anthony Liguori [Mon, 14 May 2012 15:07:06 +0000 (10:07 -0500)]
Merge remote-tracking branch 'spice/spice.v55' into staging

* spice/spice.v55:
  qxl: set size of PCI IO BAR correctly (16) for revision 2

12 years agoMerge remote-tracking branch 'sweil/for-1.1' into staging
Anthony Liguori [Mon, 14 May 2012 15:06:50 +0000 (10:06 -0500)]
Merge remote-tracking branch 'sweil/for-1.1' into staging

* sweil/for-1.1:
  qemu-doc: Use QEMU instead of qemu for product name
  qemu-doc: Fix executable name in examples
  qemu-doc: Add missing parameter in description of -D option
  configure: Use QEMU instead of Qemu
  fix some common typos
  qemu-timer: Fix wrong error message

12 years agoqdev: fix -device foo,?
Paolo Bonzini [Wed, 2 May 2012 11:30:59 +0000 (13:30 +0200)]
qdev: fix -device foo,?

Since most property types do not have a parse property now, this was
broken.  Fix it by looking at the setter instead.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Andreas F=E4rber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-img: Fix segmentation fault
Charles Arnold [Fri, 11 May 2012 16:57:54 +0000 (10:57 -0600)]
qemu-img: Fix segmentation fault

The following command generates a segmentation fault.
qemu-img convert -O vpc -o ? test test2
This is because the 'goto out;' statement calls qemu_progress_end
before qemu_progress_init is called resulting in a NULL pointer
invocation.

Signed-off-by: Charles Arnold <carnold@suse.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Don't ignore failure to clear autoclear flags
Kevin Wolf [Fri, 11 May 2012 13:33:03 +0000 (15:33 +0200)]
qcow2: Don't ignore failure to clear autoclear flags

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agocoroutine: Fix setup of sigaltstack coroutines
Jan Kiszka [Wed, 9 May 2012 17:23:27 +0000 (14:23 -0300)]
coroutine: Fix setup of sigaltstack coroutines

Use pthread_kill instead of process-wide kill to invoke the signal
handler used for stack switching. This may fix spurious lock-ups with
this backend, easily triggerable by extending the time window between
kill and sigsuspend.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Mon, 14 May 2012 13:44:32 +0000 (08:44 -0500)]
Merge remote-tracking branch 'origin/master' into staging

* origin/master:
  sun4u: implement interrupt clearing registers
  sun4u: initialize OBIO interrupt mappings
  fix block loads broken in commit 30038fd818
  Implement address masking for SPARC v9 CPUs
  vga: disable default VGA if appropriate -device is used
  cputlb: fix watchpoints handling

12 years agoqapi: QMP input visitor, handle floats parsed as ints
Michael Roth [Fri, 11 May 2012 17:43:24 +0000 (12:43 -0500)]
qapi: QMP input visitor, handle floats parsed as ints

JSON numbers can be interpreted as either integers or floating point
values depending on their representation. As a result, QMP input visitor
might visit a QInt when it was expecting a QFloat, so add handling to
account for this.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agousb-host: handle guest-issued clear halt
Gerd Hoffmann [Tue, 8 May 2012 11:54:45 +0000 (13:54 +0200)]
usb-host: handle guest-issued clear halt

Most important here is to update our internal endpoint state so we know
the endpoint isn't in halted state any more.  Without this usb-host
tries to clear halt again with the next data transfer submitted.  Doing
this twice is (a) not correct and (b) confuses some usb devices,
rendering them non-functional in the guest.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl: set size of PCI IO BAR correctly (16) for revision 2
Uri Lublin [Thu, 10 May 2012 13:24:53 +0000 (16:24 +0300)]
qxl: set size of PCI IO BAR correctly (16) for revision 2

Also move it up into switch(qxl->revision) block

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqemu-doc: Use QEMU instead of qemu for product name
Stefan Weil [Fri, 11 May 2012 20:25:50 +0000 (22:25 +0200)]
qemu-doc: Use QEMU instead of qemu for product name

When 'qemu' was used as a product name or as a generic process name,
it is now replaced by the official upper case 'QEMU'.

v2:
Added missing period (hint from Andreas Färber).

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoqemu-doc: Fix executable name in examples
Stefan Weil [Fri, 11 May 2012 20:21:50 +0000 (22:21 +0200)]
qemu-doc: Fix executable name in examples

The executable name qemu was replaced some time ago by qemu-system-i386.
Fix all examples accordingly.

Some examples will only work with qemu-system-i386 or qemu-system-x86_64
for obvious reasons ("dos.img").

To keep things simple, I did not vary the executable name.
Place holders like qemu-system-TARGET were also only used once
in the enhanced description for QEMU launches using Wine.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoqemu-doc: Add missing parameter in description of -D option
Stefan Weil [Fri, 11 May 2012 20:40:50 +0000 (22:40 +0200)]
qemu-doc: Add missing parameter in description of -D option

'logfile' is a place holder for a non optional parameter.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoconfigure: Use QEMU instead of Qemu
Stefan Weil [Fri, 11 May 2012 19:14:47 +0000 (21:14 +0200)]
configure: Use QEMU instead of Qemu

This new 'Qemu' was recently added.
Replace it by the official all upper case 'QEMU'.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agofix some common typos
Jim Meyering [Wed, 9 May 2012 05:12:04 +0000 (05:12 +0000)]
fix some common typos

These were identified using: http://github.com/lyda/misspell-check
and run like this to create a bourne shell script using GNU sed's
-i option:

git ls-files|grep -vF .bin | misspellings -f - |grep -v '^ERROR:' |perl \
-pe 's/^(.*?)\[(\d+)\]: (\w+) -> "(.*?)"$/sed -i '\''${2}s!$3!$4!'\'' $1/'

Manually eliding the FP, "rela->real" and resolving "addres" to
address (not "adders") we get this:

  sed -i '450s!thru!through!' Changelog
  sed -i '260s!neccessary!necessary!' coroutine-sigaltstack.c
  sed -i '54s!miniscule!minuscule!' disas.c
  sed -i '1094s!thru!through!' hw/usb/hcd-ehci.c
  sed -i '1095s!thru!through!' hw/usb/hcd-ehci.c
  sed -i '21s!unecessary!unnecessary!' qapi-schema-guest.json
  sed -i '307s!explictly!explicitly!' qemu-ga.c
  sed -i '490s!preceeding!preceding!' qga/commands-posix.c
  sed -i '792s!addres!address!' qga/commands-posix.c
  sed -i '6s!beeing!being!' tests/tcg/test-mmap.c

Also, manually fix "arithmentic", spotted by Peter Maydell:

  sed -i 's!arithmentic!arithmetic!' coroutine-sigaltstack.c

Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoqemu-timer: Fix wrong error message
Stefan Weil [Tue, 8 May 2012 17:14:43 +0000 (19:14 +0200)]
qemu-timer: Fix wrong error message

Function timeSetEvent returns 0 when it fails, but it does not set
an error code which can be retrieved by GetLastError.

Therefore calling GetLastError is useless.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agomips_fulong2e: Don't register "cpu" VMState twice
Juan Quintela [Sun, 13 May 2012 17:32:54 +0000 (19:32 +0200)]
mips_fulong2e: Don't register "cpu" VMState twice

We have the following simplified callgraph in mips_fulong2e_init():

  cpu_init() => cpu_mips_init()
    object_new()
      mips_cpu_initfn()
        cpu_exec_init()
          register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION,
                          cpu_save, cpu_load, env)
  register_savevm(NULL, "cpu", 0, 3, cpu_save, cpu_load, env)

CPU_SAVE_VERSION is defined as 3 in target-mips/cpu.h.
fulong2e instantiates one CPU, so its cpu_index is 0.
Thus the two are fully identical.

Therefore just remove the second call in fulong2e.

Signed-off-by: Juan Quintela <quintela@redhat.com>
[AF: Extend explanation in commit message]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopc: Add back PCI.rombar compat property
Paolo Bonzini [Wed, 2 May 2012 11:31:04 +0000 (13:31 +0200)]
pc: Add back PCI.rombar compat property

This was erroneously dropped in d6c730086cbf24382eb8cff25551798769edfd84
(pc: reduce duplication in compat machine types).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoqdev: Fix adding of ptr properties
Anthony Liguori [Wed, 2 May 2012 11:31:07 +0000 (13:31 +0200)]
qdev: Fix adding of ptr properties

ptr properties have neither a get/set or a print/parse which means that when
they're added they aren't treated as static or legacy properties.

Just assume properties like this are legacy properties and treat them as such.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Use object_property_print() in info qtree
Paolo Bonzini [Wed, 2 May 2012 11:31:00 +0000 (13:31 +0200)]
qdev: Use object_property_print() in info qtree

Otherwise, non-string properties without a legacy counterpart are missed.
Also fix error propagation in object_property_print() itself.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-i386: Defer MCE init
Andreas Färber [Wed, 9 May 2012 21:15:32 +0000 (23:15 +0200)]
target-i386: Defer MCE init

Commit de024815e3b523addf58f1f79846b7fe74643678 (target-i386: QOM'ify
CPU init) moved mce_init() call from helper.c:cpu_x86_init() into
X86CPU's cpu.c:x86_cpu_initfn().
mce_init() checks for a family >= 6 though, so we could end up with a
sequence such as for -cpu somecpu,family=6:

  x86_cpu_initfn => X86CPU::family == 5
    mce_init => no-op
  cpu_x86_register => X86CPU::family = 6
  => MCE unexpectedly not init'ed

or for -cpu someothercpu,family=5:

  x86_cpu_initfn => X86CPU::family == 6
    mce_init => init'ed
  cpu_x86_register => X86CPU::family = 5
  => MCE unexpectedly init'ed

Therefore partially revert the above commit. To avoid moving
mce_init() back into helper.c, foresightedly move it into a
new x86_cpu_realize() function and, in lack of ObjectClass::realize,
call it directly from cpu_x86_init().

While at it, move the qemu_init_vcpu() call that used to follow
mce_init() in cpu_x86_init() into the new realizefn as well.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>