]> git.proxmox.com Git - qemu.git/log
qemu.git
12 years agoqapi: Introduce blockdev-group-snapshot-sync command
Jeff Cody [Tue, 28 Feb 2012 20:54:06 +0000 (15:54 -0500)]
qapi: Introduce blockdev-group-snapshot-sync command

This is a QAPI/QMP only command to take a snapshot of a group of
devices. This is similar to the blockdev-snapshot-sync command, except
blockdev-group-snapshot-sync accepts a list devices, filenames, and
formats.

It is attempted to keep the snapshot of the group atomic; if the
creation or open of any of the new snapshots fails, then all of
the new snapshots are abandoned, and the name of the snapshot image
that failed is returned.  The failure case should not interrupt
any operations.

Rather than use bdrv_close() along with a subsequent bdrv_open() to
perform the pivot, the original image is never closed and the new
image is placed 'in front' of the original image via manipulation
of the BlockDriverState fields.  Thus, once the new snapshot image
has been successfully created, there are no more failure points
before pivoting to the new snapshot.

This allows the group of disks to remain consistent with each other,
even across snapshot failures.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Reject too large header extensions
Kevin Wolf [Wed, 22 Feb 2012 11:37:13 +0000 (12:37 +0100)]
qcow2: Reject too large header extensions

Image files that make qemu-img info read several gigabytes into the
unknown header extensions list are bad. Just fail opening the image
if an extension claims to be larger than the header extension area.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqcow2: Fix offset in qcow2_read_extensions
Kevin Wolf [Wed, 22 Feb 2012 11:31:47 +0000 (12:31 +0100)]
qcow2: Fix offset in qcow2_read_extensions

The spec says that the length of extensions is padded to 8 bytes, not
the offset. Currently this is the same because the header size is a
multiple of 8, so this is only about compatibility with future changes
to the header size.

While touching it, move the calculation to a common place instead of
duplicating it for each header extension type.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoblock: drop aio_multiwrite in BlockDriver
Paolo Bonzini [Tue, 21 Feb 2012 15:43:52 +0000 (16:43 +0100)]
block: drop aio_multiwrite in BlockDriver

These were never used.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: remove unused fields in BlockDriverState
Paolo Bonzini [Mon, 20 Feb 2012 16:58:34 +0000 (17:58 +0100)]
block: remove unused fields in BlockDriverState

sync_aiocb is unused since commit ce1a14d (Dynamically allocate AIO
Completion Blocks., 2006-08-07).

private is unused since commit 56a1493 (drive cleanup fixes., 2009-09-25).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Fix build with DEBUG_EXT enabled
Kevin Wolf [Fri, 17 Feb 2012 17:45:33 +0000 (18:45 +0100)]
qcow2: Fix build with DEBUG_EXT enabled

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoide: fail I/O to empty disk
Paolo Bonzini [Wed, 15 Feb 2012 10:46:11 +0000 (11:46 +0100)]
ide: fail I/O to empty disk

Requesting a read or a write operation on an empty disk can lead
to QEMU dumping core.

Also fix a few braces here and there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: DIR (Digital Input Register) should return status of current drive...
Hervé Poussineau [Mon, 6 Feb 2012 21:29:12 +0000 (22:29 +0100)]
fdc: DIR (Digital Input Register) should return status of current drive...

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: fix seek command, which shouldn't check tracks
Hervé Poussineau [Mon, 6 Feb 2012 21:29:11 +0000 (22:29 +0100)]
fdc: fix seek command, which shouldn't check tracks

The seek command just sends step pulses to the drive and doesn't care if
there is a medium inserted of if it is banging the head against the drive.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: check if media rate is correct before doing any transfer
Hervé Poussineau [Mon, 6 Feb 2012 21:29:10 +0000 (22:29 +0100)]
fdc: check if media rate is correct before doing any transfer

The programmed rate has to be the same as the required rate for the
floppy format ; if that's not the case, the transfer should abort.
This check can be disabled by using the 'check_media_rate' property.

Save media rate value only if media rate check is enabled.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: add a 'check media rate' property. Not used yet
Hervé Poussineau [Mon, 6 Feb 2012 21:29:09 +0000 (22:29 +0100)]
fdc: add a 'check media rate' property. Not used yet

Set it to true for current Qemu versions, and false for previous ones

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: add a transfer rate for floppy types
Hervé Poussineau [Mon, 6 Feb 2012 21:29:07 +0000 (22:29 +0100)]
block: add a transfer rate for floppy types

Floppies must be read at a specific transfer rate, depending of its own format.
Update floppy description table to include required transfer rate.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: add CCR (Configuration Control Register) write register
Hervé Poussineau [Mon, 6 Feb 2012 21:29:06 +0000 (22:29 +0100)]
fdc: add CCR (Configuration Control Register) write register

DIR and CCR registers share the same address ; DIR is read-only
while CCR is write-only

CCR register is used to change media transfer rate, which will be
checked in following changes.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: handle read-only floppies (abort early on write commands)
Hervé Poussineau [Mon, 6 Feb 2012 21:29:05 +0000 (22:29 +0100)]
fdc: handle read-only floppies (abort early on write commands)

A real floppy doesn't attempt to write to read-only media either.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: most control commands do not generate interrupts
Hervé Poussineau [Mon, 6 Feb 2012 21:29:04 +0000 (22:29 +0100)]
fdc: most control commands do not generate interrupts

In fact, only three control commands generate an interrupt:
read_id, recalibrate and seek

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: set busy bit when starting a command
Hervé Poussineau [Mon, 6 Feb 2012 21:29:03 +0000 (22:29 +0100)]
fdc: set busy bit when starting a command

This bit must be active while a command is currently executed.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: take side count into account
Hervé Poussineau [Mon, 6 Feb 2012 21:29:02 +0000 (22:29 +0100)]
fdc: take side count into account

Floppies can be simple or double-sided. However, current code
was only taking the common case into account (ie 2 sides).

This repairs single-sided floppies, which where totally broken
before this patch : for track > 0, wrong sector number was
calculated, and data was read/written at wrong place on
underlying device.

Fortunately, only some 360 kB floppies are single-sided, so
this bug was probably not seen much.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoMerge remote-tracking branch 'aneesh/for-upstream' into staging
Anthony Liguori [Mon, 27 Feb 2012 17:19:27 +0000 (11:19 -0600)]
Merge remote-tracking branch 'aneesh/for-upstream' into staging

* aneesh/for-upstream:
  hw/9pfs: Endian fixes for virtfs
  ./configure: add option for disabling VirtFS

12 years agoslirp: Fix assertion failure on rejected DHCP requests
David Gibson [Fri, 24 Feb 2012 00:23:28 +0000 (01:23 +0100)]
slirp: Fix assertion failure on rejected DHCP requests

The guest network stack might DHCPREQUEST an address that the slirp built
in dhcp server can't let it have - for example if the guest has an old
leases file from another network configuration.  In this case the dhcp
server should and does reject the request and prepares to send a DHCPNAK
to the client.

However, in this case the daddr variable in bootp_reply() is set to
0.0.0.0.  Shortly afterwards, it unconditionally attempts to pre-insert the
new client address into the ARP table.  This causes an assertion failure in
arp_address_add() because of the 0.0.0.0 address.

According to RFC2131, DHCPNAK messages for clients on the same subnet
must be sent to the broadcast address (S3.2, subpoint 2).

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoslirp: Refactor if_start
Jan Kiszka [Fri, 17 Feb 2012 15:35:36 +0000 (16:35 +0100)]
slirp: Refactor if_start

Replace gotos with a while loop, fix coding style.

CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoslirp: Fix requeuing of batchq packets in if_start
Jan Kiszka [Fri, 17 Feb 2012 15:26:38 +0000 (16:26 +0100)]
slirp: Fix requeuing of batchq packets in if_start

In case we requeued a packet that was the head of a longer session
queue, we failed to restore this ordering. Also, we did not properly
deal with changes to Slirp::next_m.

Instead of a cumbersome roll back, this fix simply avoids any changes
until we know if the packet was actually sent. Both fixes crashes due
to inconsistent queues and simplifies the logic.

Thanks to Zhi Yong Wu who found the reason for these crashes.

CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoslirp: Clean up ifs_init
Jan Kiszka [Fri, 17 Feb 2012 13:39:30 +0000 (14:39 +0100)]
slirp: Clean up ifs_init

Remove duplicate ifs_init macros, reimplement the logic as static inline
in mbuf.h.

CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoaudio: Add some fall through comments
Stefan Weil [Sat, 25 Feb 2012 13:46:55 +0000 (14:46 +0100)]
audio: Add some fall through comments

Static code analysers expect these comments for case statements without
a break statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoconfigure: Check whether makecontext() is a glibc stub function
Peter Maydell [Thu, 23 Feb 2012 16:20:05 +0000 (16:20 +0000)]
configure: Check whether makecontext() is a glibc stub function

On some systems (notably ARM Linux) glibc provides implementations
of makecontext(), getcontext() and friends which are stubs which
always return failure. Make the configure test for makecontext()
also check for the presence of the __stub_makecontext macro which
indicates the presence of these stubs, so we can avoid trying to use
them and fall back to a different coroutine implementation instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovl.c: Avoid segfault when started with no arguments
Peter Maydell [Wed, 22 Feb 2012 22:40:00 +0000 (22:40 +0000)]
vl.c: Avoid segfault when started with no arguments

Fix a bug (introduced in commit a0abe47) where a command line which
specified no machine arguments (either explicitly or implicitly via
-kernel &co) would result in a segfault because of a NULL pointer
returned from qemu_opts_find(qemu_find_opts("machine"), 0).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agonic: zap obsolote romloading bits from ne2k + pcnet
Gerd Hoffmann [Wed, 8 Feb 2012 15:02:11 +0000 (16:02 +0100)]
nic: zap obsolote romloading bits from ne2k + pcnet

These days one just needs to specify the romfile in PCiDeviceInfo and
everything magically works.  It also allows to disable pxe rom loading
via "romfile=<emptystring>" like it is possible for all other nics.

[ v2: rebased & adapted to qom changes ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agobuild: allow turning off debuginfo
Gerd Hoffmann [Wed, 8 Feb 2012 12:54:13 +0000 (13:54 +0100)]
build: allow turning off debuginfo

This patch adds --{enable,disable}-debug-info switches to configure
which allows to include/exclude the '-g' switch on the gcc & ld
command lines.  Not building debug info reduces ressource usage
(especially disk) alot and is quite useful for test builds.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agooptimize screendump for the common non-switch case
Gerd Hoffmann [Fri, 24 Feb 2012 11:43:45 +0000 (12:43 +0100)]
optimize screendump for the common non-switch case

switch console only if needed, also pass down whenever the console was
switched or not because a displaysurface redraw is only needed in case
the console was switched.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRemove screendump dummy functions.
Gerd Hoffmann [Fri, 24 Feb 2012 11:43:44 +0000 (12:43 +0100)]
Remove screendump dummy functions.

The code in console.c verifies whenever a screen_dump function
pointer is present before calling it, so there is no need to supply an
dummy function.  Remove them.  Also report an error to notify the user
that he didn't got a screenshot.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovga: simplify screendump
Gerd Hoffmann [Fri, 24 Feb 2012 11:43:43 +0000 (12:43 +0100)]
vga: simplify screendump

The displaychangelistener isn't needed at all, we can simply save the
image when vga_hw_update is done instead of hooking into the update
process.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosuspend: add qmp events
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:26 +0000 (13:45 +0100)]
suspend: add qmp events

Send qmp events on suspend and wakeup so libvirt
has a chance to track the vm state.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosuspend: make acpi timer wakeup the guest.
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:25 +0000 (13:45 +0100)]
suspend: make acpi timer wakeup the guest.

Make the acpi timer wake up the guest.
Guests can enable/disable this via acpi too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosuspend: make rtc alarm wakeup the guest.
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:24 +0000 (13:45 +0100)]
suspend: make rtc alarm wakeup the guest.

Make the rtc wake up the guest when the alarm fires.
Add acpi windup to property support RTC_EN, so guests
can enable and disable this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosuspend: make serial ports wakeup the guest.
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:23 +0000 (13:45 +0100)]
suspend: make serial ports wakeup the guest.

Add a 'wakeup' property to the serial port.  It is off by default.  When
enabled any incoming character on the serial line will wake up the
guest.  Useful for guests which have a serial console configured.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosuspend: make ps/2 devices wakeup the guest
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:22 +0000 (13:45 +0100)]
suspend: make ps/2 devices wakeup the guest

This patch adds wakeup support to ps/2 emulation.  Any key press on the
ps/2 keyboard will wakeup the guest.  Likewise any mouse button press
will wakeup the guest.  Mouse moves are ignored, so the guest will not
wakeup in case your mouse crosses the vnc window of a suspended guest by
accident.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosuspend: add system_wakeup monitor command
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:21 +0000 (13:45 +0100)]
suspend: add system_wakeup monitor command

This patch adds the system_wakeup monitor command which will simply
wake up suspended guests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosuspend: switch acpi s3 to new infrastructure.
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:20 +0000 (13:45 +0100)]
suspend: switch acpi s3 to new infrastructure.

This patch switches pc s3 suspend over to the new infrastructure.
The cmos_s3 qemu_irq is killed, the new notifier is used instead.
The xen hack goes away with that too, the hypercall can simply be
done in a notifier function now.

This patch also makes the guest actually stay suspended instead
of leaving suspend instantly, so it is useful for more than just
testing whenever the suspend/resume cycle actually works.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosuspend: add infrastructure
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:19 +0000 (13:45 +0100)]
suspend: add infrastructure

This patch adds some infrastructure to handle suspend and resume to
qemu.  First there are two functions to switch state and second there
is a suspend notifier:

 * qemu_system_suspend_request is supposed to be called when the
   guest asks for being be suspended, for example via ACPI.

 * qemu_system_wakeup_request is supposed to be called on events
   which should wake up the guest.

 * qemu_register_suspend_notifier can be used to register a notifier
   which will be called when the guest is suspended.  Machine types
   and device models can hook in there to modify state if needed.

 * qemu_register_wakeup_notifier can be used to register a notifier
   which will be called when the guest is woken up.  Machine types
   and device models can hook in there to modify state if needed.

 * qemu_system_wakeup_enable can be used to enable/disable wakeup
   events.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoacpi: add acpi_pm1_evt_write_en
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:18 +0000 (13:45 +0100)]
acpi: add acpi_pm1_evt_write_en

Do APCIREGS->pm1.evt.en updates using the new acpi_pm1_evt_write_en
function, so the acpi code will see those updates.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoacpi: don't pass overflow_time to acpi_pm1_evt_get_sts
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:17 +0000 (13:45 +0100)]
acpi: don't pass overflow_time to acpi_pm1_evt_get_sts

Pretty pointless, can easily be reached via ACPIREGS now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoacpi: add ACPIREGS
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:16 +0000 (13:45 +0100)]
acpi: add ACPIREGS

All those acpi structs are not independent from each other.
Various acpi functions expecting multiple acpi structs passed
in are a clean indicator for that ;)

So this patch bundles all acpi structs in the new ACPIREGS
struct, then use it everythere pass around acpi state.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoacpi: move around structs
Gerd Hoffmann [Thu, 23 Feb 2012 12:45:15 +0000 (13:45 +0100)]
acpi: move around structs

Group all structs at the top of hw/acpi.h.
Just moving around lines, no code changes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:51:24 +0000 (09:51 -0600)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  slirp/misc: fix gcc __warn_memset_zero_len warnings
  vl.c: Increase width of machine name column in "-M ?" output
  tcg: Remove unneeded include statements

12 years agoMerge remote-tracking branch 'mdroth/qga-win32-pull-2-23-12' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:50:37 +0000 (09:50 -0600)]
Merge remote-tracking branch 'mdroth/qga-win32-pull-2-23-12' into staging

* mdroth/qga-win32-pull-2-23-12:
  qemu-ga: add win32 guest-shutdown command
  qemu-ga: add Windows service integration
  qemu-ga: add initial win32 support
  qemu-ga: fixes for win32 build of qemu-ga
  qemu-ga: rename guest-agent-commands.c -> commands-posix.c
  qemu-ga: separate out common commands from posix-specific ones
  qemu-ga: move channel/transport functionality into wrapper class
  qemu-ga: Add schema documentation for types

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:45:22 +0000 (09:45 -0600)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qmp: add DEVICE_TRAY_MOVED event
  ide: drop ide_tray_state_post_load()
  block: Don't call bdrv_eject() if the tray state didn't change
  block: bdrv_eject(): Make eject_flag a real bool
  block: Rename bdrv_mon_event() & BlockMonEventAction

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:37:27 +0000 (09:37 -0600)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (46 commits)
  qemu-iotests: common.config: Allow use of arbitrary qemu* paths
  qemu-iotests: check: print relevant path information
  qemu-iotests: test loading internal snapshots
  qemu-iotests: Update filter for default cluster size
  qemu-iotests: add qed support to 025 image resize test
  qemu-iotests: Update rbd support
  qemu-iotests: common.config: Fix no $TEST_DIR directory
  qemu-iotests: only run 016 for file and sheepdog protocols
  qemu-iotests: Use zero-based offsets for IO patterns
  qemu-iotests: add support for rbd and sheepdog protocols
  qemu-iotests: filter IMGFMT correctly in 019
  qemu-iotests: README: Fix spelling
  qemu-iotests: add support for qed format
  qemu-iotests: filter TEST_DIR correctly in 019
  qemu-iotests: fix 019 golden output
  qemu-iotests: update expected results after qemu-img changes
  qemu-iotests: add read/write from smaller backing image test
  qemu-iotests: add sub-cluster allocating write test for sparse image formats
  qemu-iotests: improve test for qemu-img convert with backing file
  qemu-iotests: consider more cases in parsing qemu-io output
  ...

12 years agoMerge remote-tracking branch 'bonzini/virtio-scsi' into staging
Anthony Liguori [Fri, 24 Feb 2012 15:33:03 +0000 (09:33 -0600)]
Merge remote-tracking branch 'bonzini/virtio-scsi' into staging

* bonzini/virtio-scsi:
  scsi-block: always use scsi_generic_ops for cache != none
  scsi: fix searching for an empty id
  scsi: fix wrong return for target INQUIRY
  virtio-scsi: add migration support
  virtio-scsi: process control queue requests
  virtio-scsi: add basic SCSI bus operation
  virtio-scsi: Add basic request processing infrastructure
  virtio-scsi: Add virtio-scsi stub device
  scsi-disk: add migration support
  scsi-generic: add migration support
  scsi: add SCSIDevice vmstate definitions
  scsi-disk: enable scatter/gather functionality
  scsi: add scatter/gather functionality
  scsi: pass residual amount to command_complete
  ahci: use new DMA helpers
  dma-helpers: add accounting wrappers
  dma-helpers: add dma_buf_read and dma_buf_write
  dma-helpers: make QEMUSGList target independent

12 years agotarget-i386: Introduce x86_cpuid_set_model_id()
Andreas Färber [Fri, 17 Feb 2012 16:46:04 +0000 (17:46 +0100)]
target-i386: Introduce x86_cpuid_set_model_id()

Move the logic to transform the 48-char model ID into the 12-word model
value into a helper.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-i386: Introduce x86_cpuid_version_set_stepping()
Andreas Färber [Fri, 17 Feb 2012 16:46:03 +0000 (17:46 +0100)]
target-i386: Introduce x86_cpuid_version_set_stepping()

Move the logic for setting the stepping field into a helper function.

To make the function self-contained and to prepare for future
unordered/multiple uses, mask out any previous stepping values first.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-i386: Introduce x86_cpuid_version_set_model()
Andreas Färber [Fri, 17 Feb 2012 16:46:02 +0000 (17:46 +0100)]
target-i386: Introduce x86_cpuid_version_set_model()

Move the logic for setting the model and extended model fields
into a helper function.

To make the function self-contained and to prepare for future
unordered/multiple uses, mask out any previous model values first.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-i386: Introduce x86_cpuid_version_set_family()
Andreas Färber [Fri, 17 Feb 2012 16:46:01 +0000 (17:46 +0100)]
target-i386: Introduce x86_cpuid_version_set_family()

Move the logic for setting the family and extended family into a
helper function.

To make the helper self-contained and in preparation of future
unordered/multiple uses, mask out any previous family values first.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconsole: Eliminate text_consoles[]
Markus Armbruster [Tue, 7 Feb 2012 14:09:21 +0000 (15:09 +0100)]
console: Eliminate text_consoles[]

Simply use consoles[] instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosockets: Clean up inet_listen_opts()'s convoluted bind() loop
Markus Armbruster [Tue, 7 Feb 2012 14:09:15 +0000 (15:09 +0100)]
sockets: Clean up inet_listen_opts()'s convoluted bind() loop

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosockets: Drop sockets_debug debug code
Markus Armbruster [Tue, 7 Feb 2012 14:09:14 +0000 (15:09 +0100)]
sockets: Drop sockets_debug debug code

I'm trying to improve this code's error reporting, and the debug code
is getting in my way: it clutters the code, it clobbers errno in
inconvenient places, and it uses the same fprintf() both for error
reporting and debug output in a few places.

Get rid of it.  Once decent error reporting is in place, adding back
whatever debug code we need shouldn't be hard.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agogdbstub: Error locations for -gdb
Markus Armbruster [Tue, 7 Feb 2012 14:09:13 +0000 (15:09 +0100)]
gdbstub: Error locations for -gdb

Stash away the option argument with add_device_config(), so we still
have its location when we get around to parsing it.

This doesn't improve any messages I can see just yet, but that'll
change shortly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovl.c: Error locations for options using add_device_config()
Markus Armbruster [Tue, 7 Feb 2012 14:09:12 +0000 (15:09 +0100)]
vl.c: Error locations for options using add_device_config()

These are -bt, -serial, -virtcon, -parallel, -debugcon, -usbdevice.
Improves messages emitted via proper error reporting interfaces.  For
instance:

    $ qemu-system-x86_64 -nodefaults -S -usb -usbdevice net:vlan=xxx
    qemu-system-x86_64: Parameter 'vlan' expects a number

becomes:

    qemu-system-x86_64: -usbdevice net:vlan=xxx: Parameter 'vlan' expects a number

Many more remain unimproved, because they're fprintf()ed.  The next
few commits will take care of that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: qemu_chr_open_fd() can't fail, don't check
Markus Armbruster [Tue, 7 Feb 2012 14:09:11 +0000 (15:09 +0100)]
qemu-char: qemu_chr_open_fd() can't fail, don't check

Cleaned up silently in commit aad04cd0, but that just got reverted.
Re-apply this part.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: Re-apply style fixes from just reverted aad04cd0
Markus Armbruster [Tue, 7 Feb 2012 14:09:10 +0000 (15:09 +0100)]
qemu-char: Re-apply style fixes from just reverted aad04cd0

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: Use qemu_open() to avoid leaking fds to children
Markus Armbruster [Tue, 7 Feb 2012 14:09:09 +0000 (15:09 +0100)]
qemu-char: Use qemu_open() to avoid leaking fds to children

Fixed silently in commit aad04cd0, but that just got reverted.
Re-apply the fixes, plus one missed instance: parport on Linux.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRevert "qemu-char: Print strerror message on failure" and deps
Markus Armbruster [Tue, 7 Feb 2012 14:09:08 +0000 (15:09 +0100)]
Revert "qemu-char: Print strerror message on failure" and deps

The commit's purpose is laudable:

    The only way for chardev drivers to communicate an error was to
    return a NULL pointer, which resulted in an error message that
    said _that_ something went wrong, but not _why_.

It attempts to achieve it by changing the interface to return 0/-errno
and update qemu_chr_open_opts() to use strerror() to display a more
helpful error message.  Unfortunately, it has serious flaws:

1. Backends "socket" and "udp" return bogus error codes, because
qemu_chr_open_socket() and qemu_chr_open_udp() assume that
unix_listen_opts(), unix_connect_opts(), inet_listen_opts(),
inet_connect_opts() and inet_dgram_opts() fail with errno set
appropriately.  That assumption is wrong, and the commit turns
unspecific error messages into misleading error messages.  For
instance:

    $ qemu-system-x86_64 -nodefaults -vnc :0 -chardev socket,id=bar,host=xxx
    inet_connect: host and/or port not specified
    chardev: opening backend "socket" failed: No such file or directory

ENOENT is what happens to be in my errno when the backend returns
-errno.  Let's put ERANGE there just for giggles:

    $ qemu-system-x86_64 -nodefaults -vnc :0 -chardev socket,id=bar,host=xxx -drive if=none,iops=99999999999999999999
    inet_connect: host and/or port not specified
    chardev: opening backend "socket" failed: Numerical result out of range

Worse: when errno happens to be zero, return -errno erroneously
signals success, and qemu_chr_new_from_opts() dies dereferencing
uninitialized chr.  I observe this with "-serial unix:".

2. All qemu_chr_open_opts() knows about the error is an errno error
code.  That's simply not enough for a decent message.  For instance,
when inet_dgram() can't resolve the parameter host, which errno code
should it use?  What if it can't resolve parameter localaddr?

Clue: many backends already report errors in their open methods.
Let's revert the flawed commit along with its dependencies, and fix up
the silent error paths instead.

This reverts commit 6e1db57b2ac9025c2443c665a0d9e78748637b26.

Conflicts:

console.c
hw/baum.c
qemu-char.c

This reverts commit aad04cd024f0c59f0b96f032cde2e24eb3abba6d.

The parts of commit db418a0a "Add stdio char device on windows" that
depend on the reverted change fixed up.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoscsi-block: always use scsi_generic_ops for cache != none
Paolo Bonzini [Wed, 15 Feb 2012 13:11:22 +0000 (14:11 +0100)]
scsi-block: always use scsi_generic_ops for cache != none

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoscsi: fix searching for an empty id
Paolo Bonzini [Wed, 15 Feb 2012 08:22:54 +0000 (09:22 +0100)]
scsi: fix searching for an empty id

The conditions for detecting no free target or LUN were wrong.

The LUN loop was followed by an "if" condition that is never
true, because the loop is exited as soon as lun becomes equal
to bus->info->max_lun, and never becomes greater than it.

The target loop had a wrong condition (<= instead of <).  Once
this is fixed, the loop would fail in the same way as the LUN
loop.

The fix is to see whether scsi_device_find returned the device with the
last (channel, target, LUN) pair, and fail if so.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoscsi: fix wrong return for target INQUIRY
Paolo Bonzini [Wed, 15 Feb 2012 08:23:50 +0000 (09:23 +0100)]
scsi: fix wrong return for target INQUIRY

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovirtio-scsi: add migration support
Paolo Bonzini [Fri, 2 Dec 2011 14:23:15 +0000 (15:23 +0100)]
virtio-scsi: add migration support

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovirtio-scsi: process control queue requests
Paolo Bonzini [Mon, 14 Nov 2011 16:44:09 +0000 (17:44 +0100)]
virtio-scsi: process control queue requests

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoslirp/misc: fix gcc __warn_memset_zero_len warnings
Alon Levy [Fri, 24 Feb 2012 11:33:49 +0000 (13:33 +0200)]
slirp/misc: fix gcc __warn_memset_zero_len warnings

By removing memset altogether (Patch from Stefan Hajnoczi, tested
compile only by me).

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agohw/9pfs: Endian fixes for virtfs
Benjamin Herrenschmidt [Fri, 24 Feb 2012 00:23:30 +0000 (11:23 +1100)]
hw/9pfs: Endian fixes for virtfs

This patch fixes several endian bugs in virtfs.

Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years ago./configure: add option for disabling VirtFS
Meador Inge [Fri, 24 Feb 2012 08:30:42 +0000 (14:00 +0530)]
./configure: add option for disabling VirtFS

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agoqemu-ga: add win32 guest-shutdown command
Michael Roth [Mon, 23 Jan 2012 02:24:37 +0000 (20:24 -0600)]
qemu-ga: add win32 guest-shutdown command

Implement guest-shutdown RPC for Windows. Functionally this should be
equivalent to the posix implementation.

Original patch by Gal Hammer <ghammer@redhat.com>

12 years agoqemu-ga: add Windows service integration
Michael Roth [Sat, 21 Jan 2012 22:42:27 +0000 (16:42 -0600)]
qemu-ga: add Windows service integration

This allows qemu-ga to function as a Windows service:

 - to install the service (will auto-start on boot):
     qemu-ga --service install
 - to start the service:
     net start qemu-ga
 - to stop the service:
     net stop qemu-ga
 - to uninstall service:
     qemu-ga --service uninstall

Original patch by Gal Hammer <ghammer@redhat.com>

12 years agoqemu-ga: add initial win32 support
Michael Roth [Sat, 21 Jan 2012 01:01:30 +0000 (19:01 -0600)]
qemu-ga: add initial win32 support

This adds a win32 channel implementation that makes qemu-ga functional
on Windows using virtio-serial (unix-listen/isa-serial not currently
implemented). Unlike with the posix implementation, we do not use
GIOChannel for the following reasons:

 - glib calls stat() on an fd to check whether S_IFCHR is set, which is
   the case for virtio-serial on win32. Because of that, a one-time
   check to determine whether the channel is readable is done by making
   a call to PeekConsoleInput(), which reports the underlying handle is
   not a valid console handle, and thus we can never read from the
   channel.

 - if one goes as far as to "trick" glib into thinking it is a normal
   file descripter, the buffering is done in such a way that data
   written to the output stream will subsequently result in that same
   data being read back as if it were input, causing an error loop.
   furthermore, a forced flush of the channel only moves the data into a
   secondary buffer managed by glib, so there's no way to prevent output
   from getting read back as input.

The implementation here ties into the glib main loop by implementing a
custom GSource that continually submits asynchronous/overlapped I/O to
fill an GAChannel-managed read buffer, and tells glib to poll the
corresponding event handle for a completion whenever there is no
data/RPC in the read buffer to notify the main application about.

12 years agoqemu-ga: fixes for win32 build of qemu-ga
Michael Roth [Fri, 20 Jan 2012 04:04:34 +0000 (22:04 -0600)]
qemu-ga: fixes for win32 build of qemu-ga

Various stubs and #ifdefs to compile for Windows using mingw
cross-build. Still has 1 linker error due to a dependency on the
forthcoming win32 versions of the GAChannel/transport class.

12 years agoqemu-ga: rename guest-agent-commands.c -> commands-posix.c
Michael Roth [Fri, 20 Jan 2012 04:28:18 +0000 (22:28 -0600)]
qemu-ga: rename guest-agent-commands.c -> commands-posix.c

12 years agoqemu-ga: separate out common commands from posix-specific ones
Michael Roth [Fri, 20 Jan 2012 04:19:27 +0000 (22:19 -0600)]
qemu-ga: separate out common commands from posix-specific ones

Many of the current RPC implementations are very much POSIX-specific
and require complete re-writes for Windows. There are however a small
set of core guest agent commands that are common to both, and other
commands such as guest-file-* which *may* be portable. So we introduce
commands.c for the latter, and will rename guest-agent-commands.c to
commands-posix.c in a future commit. Windows implementations will go in
commands-win32.c, eventually.

12 years agoqemu-ga: move channel/transport functionality into wrapper class
Michael Roth [Thu, 19 Jan 2012 06:18:20 +0000 (00:18 -0600)]
qemu-ga: move channel/transport functionality into wrapper class

This is mostly in preparation for the win32 port, which won't use
GIO channels for reasons that will be made clearer later. Here the
GAChannel class is just a loose wrapper around GIOChannel
calls/callbacks, but we also roll in the logic/configuration for
various channel types and managing unix socket connections, which makes
the abstraction much more complete and further aids in the win32 port
since isa-serial/unix-listen will not be supported initially.

There's also a bit of refactoring in the main logic to consolidate the
exit paths so we can do common cleanup for things like pid files, which
weren't always cleaned up previously.

12 years agoqemu-ga: Add schema documentation for types
Michael Roth [Mon, 16 Jan 2012 23:44:16 +0000 (17:44 -0600)]
qemu-ga: Add schema documentation for types

Document guest agent schema types in similar fashion to qmp schema
types.

12 years agoMerge qemu-iotests into for-anthony
Kevin Wolf [Thu, 23 Feb 2012 09:33:55 +0000 (10:33 +0100)]
Merge qemu-iotests into for-anthony

12 years agoqemu-iotests: common.config: Allow use of arbitrary qemu* paths
Lucas Meneghel Rodrigues [Thu, 1 Dec 2011 13:41:24 +0000 (11:41 -0200)]
qemu-iotests: common.config: Allow use of arbitrary qemu* paths

Since we might want to test arbitrary qemu, qemu-img and
qemu-io paths, allow users to specify environment variable
values for QEMU_PROG, QEMU_IMG_PROG and QEMU_IO_PROG so
the testsuite will use those values rather than find them
on PATH. Obviously, if such env variables are not set
prior to script execution, normal detection mechanism
takes place.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: check: print relevant path information
Lucas Meneghel Rodrigues [Thu, 1 Dec 2011 13:41:23 +0000 (11:41 -0200)]
qemu-iotests: check: print relevant path information

Print the paths of the programs under test
(qemu, qemu-img and qemu-io).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: test loading internal snapshots
Kevin Wolf [Fri, 5 Aug 2011 14:37:25 +0000 (16:37 +0200)]
qemu-iotests: test loading internal snapshots

Test loading internal snapshots where the L1 table of the snapshot
is smaller than the current L1 table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: Update filter for default cluster size
Kevin Wolf [Wed, 8 Jun 2011 11:23:33 +0000 (13:23 +0200)]
qemu-iotests: Update filter for default cluster size

Until recently, qemu-img create displayed cluster_size=0 for the default
cluster size. It is changed to display the real cluster size now, which results
in the cluster size not being filtered out any more.

If the cluster size is specified explicitly in CLUSTER_SIZE, keep the output,
and if using the default, filter it out. This mostly restores the old behaviour
of the test cases; test 015 must be fixed to use CLUSTER_SIZE instead of using
extra_img_options for it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: add qed support to 025 image resize test
Stefan Hajnoczi [Mon, 16 May 2011 12:59:12 +0000 (13:59 +0100)]
qemu-iotests: add qed support to 025 image resize test

QED now supports the truncate (aka resize) operation for growing images.
Update test 025 so it runs for QED.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: Update rbd support
Josh Durgin [Wed, 13 Apr 2011 00:47:45 +0000 (17:47 -0700)]
qemu-iotests: Update rbd support

rbd implements bdrv_truncate, so test 025 will work.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: common.config: Fix no $TEST_DIR directory
Mitnick Lyu [Mon, 11 Apr 2011 20:05:44 +0000 (04:05 +0800)]
qemu-iotests: common.config: Fix no $TEST_DIR directory

mkdir $TEST_DIR on common.config first run

Signed-off-by: Mitnick Lyu <mitnick.lyu@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: only run 016 for file and sheepdog protocols
Christoph Hellwig [Thu, 21 Apr 2011 06:26:04 +0000 (08:26 +0200)]
qemu-iotests: only run 016 for file and sheepdog protocols

016 writes past EOF which isn't support by most protocols, so limit
it to file and sheepdog, which explicitly support it.

Pointed out by Josh Durgin <josh.durgin@dreamhost.com>.

Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: Use zero-based offsets for IO patterns
Stefan Hajnoczi [Fri, 4 Feb 2011 12:55:02 +0000 (12:55 +0000)]
qemu-iotests: Use zero-based offsets for IO patterns

The io_pattern style functions have the following loop:

  for i in `seq 1 $count`; do
      echo ... $(( start + i * step )) ...
  done

Offsets are 1-based so start=1024, step=512, count=4 yields:
1536, 2048, 2560, 3072

Normally we expect:
1024, 1536, 2048, 2560

Most tests ignore this detail, which means that they perform I/O to a
slightly different range than expected by the test author.

Later on things got less innocent and tests started trying to compensate
for the 1-based indexing.  This included negative start values in test
024 and my own attempt with count-1 in test 028!

The end result is that tests that use io_pattern are hard to reason
about and don't work the way you'd expect.  It's time to clean this mess
up.

This patch switches io_pattern to 0-based offsets.  This requires
adjusting the golden outputs since I/O ranges are now shifted and output
differs.

Verifying these output diffs is easy, however.  Each diff hunk moves one
I/O from beyond the end of the pattern range to the beginning.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: add support for rbd and sheepdog protocols
MORITA Kazutaka [Mon, 17 Jan 2011 17:01:17 +0000 (02:01 +0900)]
qemu-iotests: add support for rbd and sheepdog protocols

This patch introduces tests for protocols other than file, and
initially supports rbd and sheepdog.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: filter IMGFMT correctly in 019
Stefan Hajnoczi [Wed, 24 Nov 2010 16:12:21 +0000 (17:12 +0100)]
qemu-iotests: filter IMGFMT correctly in 019

Test 019 can be run with qcow2 and qed image formats.  Replace the
specific image format value with "IMGFMT" so the golden output does not
hardcode qcow2 or qed.

This patch also includes a typo fix for "occurrences".

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: README: Fix spelling
Stefan Weil [Sun, 7 Nov 2010 13:56:57 +0000 (14:56 +0100)]
qemu-iotests: README: Fix spelling

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: add support for qed format
Stefan Hajnoczi [Sun, 31 Oct 2010 20:10:20 +0000 (16:10 -0400)]
qemu-iotests: add support for qed format

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
12 years agoqemu-iotests: filter TEST_DIR correctly in 019
Christoph Hellwig [Sun, 31 Oct 2010 20:07:46 +0000 (16:07 -0400)]
qemu-iotests: filter TEST_DIR correctly in 019

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovl.c: Increase width of machine name column in "-M ?" output
Peter Maydell [Wed, 22 Feb 2012 22:13:11 +0000 (22:13 +0000)]
vl.c: Increase width of machine name column in "-M ?" output

Increase the width of the column used for the machine name in
the "-M ?" output from 10 to 20 spaces. This fixes the formatting
so it looks nice for architectures where a few of the machines
have overly long names. (Our current longest machine name is
"petalogix-s3adsp1800" with "realview-eb-mpcore" not far behind.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotcg: Remove unneeded include statements
Stefan Weil [Sat, 11 Feb 2012 09:07:55 +0000 (10:07 +0100)]
tcg: Remove unneeded include statements

The standard include files are already included in qemu-common.h.

malloc.h and alloca.h were needed for alloca() which was removed
from TCG code some years ago when switching from dyngen to TCG
(see commit 49516bc0d622112caac9df628caf19010fda8b67).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqom: In function object_set_link_property(), first call object_ref(), then object_unr...
Alexander Barabash [Wed, 22 Feb 2012 17:22:26 +0000 (19:22 +0200)]
qom: In function object_set_link_property(), first call object_ref(), then object_unref().

In the old implementation, if the new value of the property links
to the same object, as the old value, that object is first unref-ed,
and then ref-ed. This leads to unintended deinitialization of that object.

In the new implementation, this is fixed.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alexander Barabash <alexander_barabash@mentor.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocpu defs: uncomment empty extfeatures_ecx definition for Opteron_G1 (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:25 +0000 (14:41 -0200)]
cpu defs: uncomment empty extfeatures_ecx definition for Opteron_G1 (v2)

This should have no visible effect, but it should just clean up the
config file a bit.

This is based on a previous patch from John Cooper where this was introduced
with many other changes at the same time. Original John's patch submission is
at Message-ID: <4DDAD5E7.2020002@redhat.com>, <http://marc.info/?l=qemu-devel&m=130618871926030>.

Changes v1 -> v2:
 - Rebase against latest Qemu git tree

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoadd Westmere as a qemu cpu model (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:24 +0000 (14:41 -0200)]
add Westmere as a qemu cpu model (v2)

Version 1 of this patch was:

Message-Id: <1307041990-26194-11-git-send-email-ehabkost@redhat.com
http://marc.info/?l=qemu-devel&m=130704415919346

This version doesn't have the duplicate feature bits on extfeature_edx, though,
as they are being removed from the Intel models (as they are reserved bits on
Intel CPUs).

Version 1 patch description:

    This patch adds Westmere as a qemu cpu model.  The only
    additional guest visible feature of a Westmere relative
    to Nehalem is the inclusion of AES instructions.  However
    as other non-ABI visible modifications exist along with
    fabrication changes, the CPUID data of the corresponding
    deployed silicon was altered slightly to reflect this.

    We've seen isolated cases where apparently unrelated yet
    slightly incoherent CPUID data has caused problems, most
    notably during guest boot.  Providing Westmere as a
    model separate fro Nehalem allows us to more easily address
    such quirks.

    [ehabkost: edited commit message to have a better Subject line]

Signed-off-by: john cooper <john.cooper@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Changes version 1 -> version 2:
 - Remove the duplicate feature bits on extfeature_edx, that are
   reserved on Intel CPUs
 - Reorder feature flags
 - Remove x2apic from the definition because x2apic requires some fixes
   that have to be resubmitted

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocpu defs: remove replicated flags from Intel (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:23 +0000 (14:41 -0200)]
cpu defs: remove replicated flags from Intel (v2)

This patch removes the replicated feature flags from cpuid 8000_0001:edx
(extfeature_edx) from Intel models, as the duplicated feature flags are present
only on AMD CPUs. On Intel models, only the i64, syscall, and xd flags are kept
on extfeature_edx.

This is based on a previous patch from John Cooper where this was introduced
with many other changes at the same time. Original John's patch submission is
at Message-ID: <4DDAD5E7.2020002@redhat.com>, <http://marc.info/?l=qemu-devel&m=130618871926030>.

Original John's patch description was:

    cpu model bug fixes and definition corrections

    This patch was intended to address the replicated feature
    flags in cpuid 8000_0001:edx from cpuid 0000_0001:edx.
    This is due to AMD's definition where these flags are
    mostly cloned in the 8000_0001:edx cpuid function.
    qemu64 attempted to glue together the respective Intel
    and AMD nearly disjoint features and this propagated to
    the new Intel models as doing so was believed conservative
    at the time.  However after further soak and test lugging
    around this cruft doesn't provide any value, could
    conceivably confuse a guest, and has confused users trying
    to maintain/add cpu definitions.  This also caused issues
    for libvirt attempting to track this mis-encoding.

    So we've here tossed out the AMD replicated definitions
    from the Intel models, added a few replications into AMD
    definitions which were missing according to AMD's latest
    CPUID document, and reordered the config file flags to
    follow intuitive sequential bit ordering.  Also two flag
    name aliases were added for clarity to Intel models.  The
    end result being the models definitions now conform to
    their respective cpuid specifications sans x2apic which is
    emulated by kvm.

    This was tested with the following combinations:

        [Conroe, Penryn, Nehalem] x [F12-64, win64, win32] -- Intel host
        [Opteron_G1, Opteron_G2, Opteron_G3] x [F12-64, win64, win32] -- AMD host

    Yielding successful boots in all cases.

Signed-off-by: john cooper <john.cooper@redhat.com>
Changes v1 -> v2:
 - Rebase against latest Qemu git tree

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocpu defs: add pse36, mca, mtrr to AMD CPU definitions (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:22 +0000 (14:41 -0200)]
cpu defs: add pse36, mca, mtrr to AMD CPU definitions (v2)

This patch adds some missing flags to extfeature_edx, that were missing
according to AMD's latest CPUID document.

This is based on a previous patch from John Cooper where this was introduced
with many other changes at the same time. Original John's patch submission is
at Message-ID: <4DDAD5E7.2020002@redhat.com>, <http://marc.info/?l=qemu-devel&m=130618871926030>.

Original John's patch description was:

    cpu model bug fixes and definition corrections

    This patch was intended to address the replicated feature
    flags in cpuid 8000_0001:edx from cpuid 0000_0001:edx.
    This is due to AMD's definition where these flags are
    mostly cloned in the 8000_0001:edx cpuid function.
    qemu64 attempted to glue together the respective Intel
    and AMD nearly disjoint features and this propagated to
    the new Intel models as doing so was believed conservative
    at the time.  However after further soak and test lugging
    around this cruft doesn't provide any value, could
    conceivably confuse a guest, and has confused users trying
    to maintain/add cpu definitions.  This also caused issues
    for libvirt attempting to track this mis-encoding.

    So we've here tossed out the AMD replicated definitions
    from the Intel models, added a few replications into AMD
    definitions which were missing according to AMD's latest
    CPUID document, and reordered the config file flags to
    follow intuitive sequential bit ordering.  Also two flag
    name aliases were added for clarity to Intel models.  The
    end result being the models definitions now conform to
    their respective cpuid specifications sans x2apic which is
    emulated by kvm.

    This was tested with the following combinations:

        [Conroe, Penryn, Nehalem] x [F12-64, win64, win32] -- Intel host
        [Opteron_G1, Opteron_G2, Opteron_G3] x [F12-64, win64, win32] -- AMD host

    Yielding successful boots in all cases.

Signed-off-by: john cooper <john.cooper@redhat.com>
Changes v1 -> v2:
 - Rebase against latest Qemu git tree

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocpu defs: use Intel flag names for Intel models (v2)
Eduardo Habkost [Fri, 17 Feb 2012 16:41:21 +0000 (14:41 -0200)]
cpu defs: use Intel flag names for Intel models (v2)

Use 'i64' instead of 'lm' and 'xd' instead of 'nx' on Intel models.

The flags have different names on Intel docs, so use those names for clarity.

This is based on a previous patch from John Cooper where this was introduced
with many other changes at the same time. Original John's patch submission is
at Message-ID: <4DDAD5E7.2020002@redhat.com>, <http://marc.info/?l=qemu-devel&m=130618871926030>.

Changes v1 -> v2:
 - Rebase patch against latest Qemu git tree

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocpu flags: aliases: pclmuldq|pclmulqdq and ffxsr|fxsr_opt
Eduardo Habkost [Fri, 17 Feb 2012 16:41:20 +0000 (14:41 -0200)]
cpu flags: aliases: pclmuldq|pclmulqdq and ffxsr|fxsr_opt

pclmulqdq: /proc/cpuinfo on Linux and all documentation I have seen uses
pclmulqdq as the flag name. As the only document using pclmuldq seems to
be the Intel CPUID documentation (Application Note 485), it looks like a
typo and not the correct name for the flag.

ffxsr: AMD docs refer to fxsr_opt as ffxsr, so allow this named to be
used too.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>