sdk/emulator/qemu.git
12 years agoqemu_next_alarm_deadline: check the expire time of a clock only if it is enabled
Stefano Stabellini [Fri, 13 Apr 2012 18:35:03 +0000 (19:35 +0100)]
qemu_next_alarm_deadline: check the expire time of a clock only if it is enabled

Also delta in qemu_next_alarm_deadline is a 64 bit value so set the
default to INT64_MAX instead of INT32_MAX.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotimers: the rearm function should be able to handle delta = INT64_MAX
Stefano Stabellini [Fri, 13 Apr 2012 18:35:02 +0000 (19:35 +0100)]
timers: the rearm function should be able to handle delta = INT64_MAX

Fix win32_rearm_timer and mm_rearm_timer: they should be able to handle
INT64_MAX as a delta parameter without overflowing.
Also, the next deadline in ms should be calculated rounding down rather
than up (see unix_rearm_timer and dynticks_rearm_timer).

Finally ChangeTimerQueueTimer takes an unsigned long and timeSetEvent
takes an unsigned int as delta, so cast the ms delta to the appropriate
unsigned integer.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-i386: Fix x86_cpuid_set_model_id()
Andreas Färber [Tue, 24 Apr 2012 14:22:31 +0000 (16:22 +0200)]
target-i386: Fix x86_cpuid_set_model_id()

Don't assume zeroed cpuid_model[] fields.

This didn't break anything yet but QOM properties should be able to set
the value to something else without setting an intermediate zero string.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqtest: Fix more format errors with qtest_sendf
Stefan Weil [Mon, 23 Apr 2012 19:40:08 +0000 (21:40 +0200)]
qtest: Fix more format errors with qtest_sendf

After adding GCC_FMT_ATTR to qtest_sendf, more format errors are reported
by the compiler. These are fixed here.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosdl: Add QEMU mascot icon for use with SDL
Stefan Weil [Fri, 13 Apr 2012 20:24:42 +0000 (22:24 +0200)]
sdl: Add QEMU mascot icon for use with SDL

This is a bitmap file (32x32x4) derived from the official QEMU mascot
(which was designed by Benoît Canet). I stripped the text from the SVG
to get a nearly square image and converted the result to BMP without
any manual optimization.

The bitmap is currently used by QEMU's SDL interface and replaces the
default X icon.

v2: Add qemu-icon.bmp to Makefile.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: quick and dirty QOM filesystem based on FUSE
Anthony Liguori [Wed, 18 Apr 2012 22:37:04 +0000 (17:37 -0500)]
qom: quick and dirty QOM filesystem based on FUSE

Here's an example session:

anthony@titi:~/git/qemu/QMP$ QMP_SERVER=/tmp/server.sock ./qom-fuse tmp
anthony@titi:~/git/qemu/QMP$ ls tmp
machine  sysbus  type
anthony@titi:~/git/qemu/QMP$ ls tmp/machine
i440fx  peripheral  peripheral-anon  type  unattached
anthony@titi:~/git/qemu/QMP$ ls tmp/machine/i440fx
ioapic  parent_bus  pci.0  type
anthony@titi:~/git/qemu/QMP$ ls tmp/machine/i440fx/pci.0
child[0]  child[1]  child[2]  child[3]  child[4]  child[5]  type
anthony@titi:~/git/qemu/QMP$ ls tmp/machine/i440fx/pci.0/child[4]
addr                 legacy-addr                 multifunction  type
command_serr_enable  legacy-command_serr_enable  parent_bus
ide.0                legacy-multifunction        rombar
ide.1                legacy-romfile              romfile
anthony@titi:~/git/qemu/QMP$ cat tmp/machine/i440fx/pci.0/child[4]/type
piix3-ide
anthony@titi:~/git/qemu/QMP$ ls -al tmp/machine/i440fx/pci.0/child\[4\]/parent_bus
lrwxr-xr-x 2 anthony anthony 4096 1969-12-31 18:00 tmp/machine/i440fx/pci.0/child[4]/parent_bus -> ../../../machine/i440fx/pci.0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopc-sysfw: make sure to call qdev_init
Anthony Liguori [Wed, 18 Apr 2012 22:33:15 +0000 (17:33 -0500)]
pc-sysfw: make sure to call qdev_init

We're not actually calling qdev_init for the pc-sysfw device.  Since we create
the canonical path during realize, this was causing an assert to trigger when
attempting to read a link pointing to pc-sysfw.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agohda: fix codec ids
Gerd Hoffmann [Thu, 26 Apr 2012 07:15:04 +0000 (09:15 +0200)]
hda: fix codec ids

Our hda codecs exist in two variants:  With CONFIG_MIXEMU=y they expose
amplifiers for volume control to the guest, with CONFIG_MIXEMU=n they
don't.

This patch changes the codec ids, they are different now for these two
cases.  This makes sure windows guests will notice the difference.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agohda: add hda-micro codec
Gerd Hoffmann [Thu, 26 Apr 2012 07:15:03 +0000 (09:15 +0200)]
hda: add hda-micro codec

It's identical to the hda-duplex codec, except that it advertises the
input as microphone instead of line-in and the output as speaker instead
of line-out.  Some guest apps (microsoft netmeeting being one) are picky
when it comes to selecting the recording source and don't accept
line-in, so give them what they expect.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agohda: move input widgets from duplex to common
Gerd Hoffmann [Thu, 26 Apr 2012 07:15:02 +0000 (09:15 +0200)]
hda: move input widgets from duplex to common

Preparing for a new user of the input widget definitions.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agofix paaudio.c warnings
Gerd Hoffmann [Wed, 25 Apr 2012 16:19:41 +0000 (18:19 +0200)]
fix paaudio.c warnings

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoLimit ptimer rate to something achievable
Peter Chubb [Fri, 20 Apr 2012 05:32:30 +0000 (15:32 +1000)]
Limit ptimer rate to something achievable

If a guest sets very short timeouts, and asks for a timer to be reloaded on
timeout, QEMU can go to 100%CPU utilisation and become unresponsive,
as it is spending all its time generating timeout interrupts.  On real
hardware this doesn't matter, as the interrupts are just coalesced,
and the effect is to have the interrupt asserted all the time.

This patch is a band-aid, that prevents timeouts less than 10
microseconds from being set.  10 microseconds is a limit that was
determined empirically on a variety of machines as the shortest that
allowed QEMU to pick up a control-a c sequence to get at the monitor.

Reported-by: Anna Lyons <anna.lyons@nicta.com.au>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqom: Refine container_get() to allow using a custom root
Andreas Färber [Thu, 5 Apr 2012 11:21:46 +0000 (13:21 +0200)]
qom: Refine container_get() to allow using a custom root

Specify the root to search from as argument. This avoids hardcoding
"/machine" in some places and makes it more flexible.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqtest: Fix tv_usec != long
Richard Henderson [Thu, 19 Apr 2012 12:09:33 +0000 (07:09 -0500)]
qtest: Fix tv_usec != long

Sparc Debian 5.0.8 does not define __suseconds_t as long,
but FMT_timeval expects %ld.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRemove extra pthread switch
Peter Portante [Fri, 20 Apr 2012 14:36:12 +0000 (10:36 -0400)]
Remove extra pthread switch

  remove the extra pthread switch which might be there
  from the package config check for gthreads.

Signed-off-by: Peter Portante <peter.portante@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: Virtfs doesn't require libcap.
Kusanagi Kouichi [Sun, 22 Apr 2012 10:16:05 +0000 (19:16 +0900)]
configure: Virtfs doesn't require libcap.

Only proxy helper does.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-char: Fix crash when switching consoles
Stefan Weil [Thu, 19 Apr 2012 20:27:14 +0000 (22:27 +0200)]
qemu-char: Fix crash when switching consoles

qemu-system-arm (and other system emulations) crashes with SDL when
the user switches consoles (Alt-Ctrl-F4).

We already check for NULL pointers in qemu_chr_fe_ioctl,
qemu_chr_be_can_write and other functions, so do this also
for s->chr_read in qemu_chr_be_write. This fixes the crash.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: add --with-confsuffix option
Eduardo Habkost [Wed, 18 Apr 2012 19:55:50 +0000 (16:55 -0300)]
configure: add --with-confsuffix option

This will allow the user to make Qemu use a different subdirectory name
inside $datadir and $sysconfdir, instead of "/qemu".

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: change meaning of --datadir to Autoconf convention
Eduardo Habkost [Wed, 18 Apr 2012 19:55:49 +0000 (16:55 -0300)]
configure: change meaning of --datadir to Autoconf convention

Autoconf uses --datadir for the /usr/share directory, not the
program-specific subdirectory inside /usr/share. This changes configure
to match autoconf behavior.

Note that this will break compatibility with existing build scripts.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocreate_config: simplify prefix=* block, remove CONFIG_QEMU_PREFIX
Eduardo Habkost [Wed, 18 Apr 2012 19:55:48 +0000 (16:55 -0300)]
create_config: simplify prefix=* block, remove CONFIG_QEMU_PREFIX

As now that block handles only the prefix variable, the code can be much
simpler. This also removes the CONFIG_QEMU_PREFIX define as it is not
used by any C code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocreate_config: remove *dir block
Eduardo Habkost [Wed, 18 Apr 2012 19:55:47 +0000 (16:55 -0300)]
create_config: remove *dir block

Now only the qemu_*dir variables will become #defines. The other
directory names aren't used by the C code.

That means the following #defines won't be available in C code anymore:

 - CONFIG_QEMU_BINDIR
 - CONFIG_QEMU_LIBDIR
 - CONFIG_QEMU_INCLUDEDIR
 - CONFIG_QEMU_MANDIR
 - CONFIG_QEMU_SYSCONFDIR
 - CONFIG_QEMU_LIBEXECDIR

The following #defines are going to be kept because they are handled by
the qemu_* block on create_config:

 - CONFIG_QEMU_CONFDIR
 - CONFIG_QEMU_DATADIR
 - CONFIG_QEMU_DOCDIR

This one will be kept because it is set directly by ./configure:

 - CONFIG_QEMU_HELPERDIR

This patch keeps the 'prefix=*' (CONFIG_QEMU_PREFIX) pattern because
other variables may use $prefix on their config-host.mak definitions.
The remaining code will be simplified on a further patch.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfig-host.mak: reorder variables a bit
Eduardo Habkost [Wed, 18 Apr 2012 19:55:46 +0000 (16:55 -0300)]
config-host.mak: reorder variables a bit

Cosmetic change.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfig-host.mak: remove CONFIG_QEMU_SHAREDIR
Eduardo Habkost [Wed, 18 Apr 2012 19:55:45 +0000 (16:55 -0300)]
config-host.mak: remove CONFIG_QEMU_SHAREDIR

There is no code using that variable according to 'git grep', so kill
it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfig-host.mak: rename docdir to qemu_docdir
Eduardo Habkost [Wed, 18 Apr 2012 19:55:44 +0000 (16:55 -0300)]
config-host.mak: rename docdir to qemu_docdir

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMakefile: use $(qemu_confdir) instead of $(sysconfdir)/qemu
Eduardo Habkost [Wed, 18 Apr 2012 19:55:43 +0000 (16:55 -0300)]
Makefile: use $(qemu_confdir) instead of $(sysconfdir)/qemu

Instead of hardcoding the directory suffix, use the qemu-specific
directory variable.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfig-host.mak: rename confdir to qemu_confdir
Eduardo Habkost [Wed, 18 Apr 2012 19:55:42 +0000 (16:55 -0300)]
config-host.mak: rename confdir to qemu_confdir

$confdir is a confusing name, as it's not clear if it's "the system
config dir" or "the Qemus-specific directory inside the config dir".
$qemu_confdir makes it more clear.

The current C code that uses CONFIG_QEMU_CONFDIR should be safe, as now
create_config generates the same #define name (CONFIG_QEMU_CONFDIR) for
both "confdir" and "qemu_confdir" variables.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfig-host.mak: rename datadir to qemu_datadir
Eduardo Habkost [Wed, 18 Apr 2012 19:55:41 +0000 (16:55 -0300)]
config-host.mak: rename datadir to qemu_datadir

Autoconf concept of "datadir" is supposed to be "$prefix/share", not
"$prefix/share/PACKAGE", so using datadir for the Qemu-specific
directory is confusing.

The current C code that uses CONFIG_QEMU_DATADIR should be safe, as now
create_config generates the same #define name (CONFIG_QEMU_DATADIR) for
both "datadir" and "qemu_datadir" variables.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocreate_config: separate section for qemu_*dir variables (v2)
Eduardo Habkost [Wed, 18 Apr 2012 19:55:40 +0000 (16:55 -0300)]
create_config: separate section for qemu_*dir variables (v2)

The generic *dir section will eventually go away and be replaced with
qemu_* section. By now, both sections will be kept, while the variables
get renamed on config-host.mak.

With this patch, a XXXdir variable will become a CONFIG_QEMU_XXXDIR
define, and a qemu_XXXdir variable will become CONFIG_QEMU_XXXDIR as
well (instead of becoming a CONFIG_QEMU_QEMU_XXXDIR define).

Changes v1 -> v2:
 - Rebase on top of newer qemu.git changes, that changed
   "tr '[:lower:]' '[:upper:]'" to "LC_ALL=C tr '[a-z]' '[A-Z]'".

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: rename $confdir to $qemu_confdir
Eduardo Habkost [Wed, 18 Apr 2012 19:55:39 +0000 (16:55 -0300)]
configure: rename $confdir to $qemu_confdir

There's no "confdir" variable on Autoconf, but it's good to make it
clear that it's a variable for the Qemu-specific subdirectory inside
$sysconfdir.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: rename $docdir to $qemu_docdir
Eduardo Habkost [Wed, 18 Apr 2012 19:55:38 +0000 (16:55 -0300)]
configure: rename $docdir to $qemu_docdir

The autoconf "docdir" variable is used for the program-specific
subdirectory, but anyway it's better to make it clear that the variable
is used for the qemu-specific subdirectory path.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: rename $datadir to $qemu_datadir
Eduardo Habkost [Wed, 18 Apr 2012 19:55:37 +0000 (16:55 -0300)]
configure: rename $datadir to $qemu_datadir

The variable is used for the qemu-specific directory and has a different
meaning of the autoconf "datadir" variable (that's used for the
$prefix/share directory, not for $prefix/share/PACKAGE).

This doesn't change behavior or interfaces, it's just an internal
variable rename.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotarget-microblaze: QOM'ify CPU init
Andreas Färber [Thu, 12 Apr 2012 00:34:40 +0000 (02:34 +0200)]
target-microblaze: QOM'ify CPU init

Move code from cpu_mb_init() to a QOM initfn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
[AF: Leave cpu_reset() call in cpu_mb_init()]

12 years agotarget-microblaze: QOM'ify CPU reset
Andreas Färber [Thu, 12 Apr 2012 00:26:28 +0000 (02:26 +0200)]
target-microblaze: QOM'ify CPU reset

Move code from cpu_state_reset() to QOM mb_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agotarget-microblaze: QOM'ify CPU
Andreas Färber [Thu, 12 Apr 2012 00:17:53 +0000 (02:17 +0200)]
target-microblaze: QOM'ify CPU

Embed CPUMBState as first member of QOM MicroBlazeCPU.

Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
[AF: Updated cpu.c to include cpu-qom.h indirectly via cpu.h]

12 years agotarget-cris: Start QOM'ifying CPU init
Andreas Färber [Wed, 11 Apr 2012 21:41:06 +0000 (23:41 +0200)]
target-cris: Start QOM'ifying CPU init

Move VR-independent code from cpu_cris_init() into an initfn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-cris: QOM'ify CPU reset
Andreas Färber [Wed, 11 Apr 2012 21:35:40 +0000 (23:35 +0200)]
target-cris: QOM'ify CPU reset

Move code from cpu_state_reset() into QOM cris_cpu_reset().
Let CPU init call cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-cris: QOM'ify CPU
Andreas Färber [Wed, 11 Apr 2012 21:12:05 +0000 (23:12 +0200)]
target-cris: QOM'ify CPU

Embed CPUCRISState as first member of QOM CRISCPU.

Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Mon, 23 Apr 2012 20:02:53 +0000 (15:02 -0500)]
Merge remote-tracking branch 'origin/master' into staging

* origin/master:
  qtest: fix memread and memwrite on 32 bit hosts

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Mon, 23 Apr 2012 19:29:11 +0000 (14:29 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qapi: g_hash_table_find() instead of GHashTableIter.
  qmp: make block job command naming consistent

12 years agoqtest: fix memread and memwrite on 32 bit hosts
Blue Swirl [Mon, 23 Apr 2012 18:53:38 +0000 (18:53 +0000)]
qtest: fix memread and memwrite on 32 bit hosts

Use PRIx64 to print 64 bit values to avoid truncation
on 32 bit hosts.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 23 Apr 2012 19:27:04 +0000 (14:27 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (38 commits)
  qemu-iotests: Fix test 031 for qcow2 v3 support
  qemu-iotests: Add -o and make v3 the default for qcow2
  qcow2: Zero write support
  qemu-iotests: Test backing file COW with zero clusters
  qemu-iotests: add a simple test for write_zeroes
  qcow2: Support for feature table header extension
  qcow2: Support reading zero clusters
  qcow2: Version 3 images
  qcow2: Ignore reserved bits in check_refcounts
  qcow2: Ignore reserved bits in refcount table entries
  qcow2: Simplify count_cow_clusters
  qcow2: Refactor qcow2_free_any_clusters
  qcow2: Ignore reserved bits in L1/L2 entries
  qcow2: Fail write_compressed when overwriting data
  qcow2: Ignore reserved bits in count_contiguous_clusters()
  qcow2: Ignore reserved bits in get_cluster_offset
  qcow2: Save disk size in snapshot header
  Specification for qcow2 version 3
  qcow2: Fix refcount block allocation during qcow2_alloc_cluster_at()
  iotests: Resolve test failures caused by hostname
  ...

12 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Mon, 23 Apr 2012 19:15:09 +0000 (14:15 -0500)]
Merge remote-tracking branch 'origin/master' into staging

* origin/master:
  fix BCD mask for date (Solaris 2.5 guest hang fix)

12 years agofix BCD mask for date (Solaris 2.5 guest hang fix)
Artyom Tarasenko [Mon, 23 Apr 2012 14:48:31 +0000 (16:48 +0200)]
fix BCD mask for date (Solaris 2.5 guest hang fix)

Fix BCD mask for date. The most visible effect of this patch is
Solaris 2.5.1 doesn't hang at boot if the day of month is >21.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Mon, 23 Apr 2012 16:49:59 +0000 (11:49 -0500)]
Merge remote-tracking branch 'origin/master' into staging

* origin/master: (27 commits)
  target-arm: Move reset handling to arm_cpu_reset
  target-arm: Drop cpu_reset_model_id()
  target-arm: Move cache ID register setup to cpu specific init fns
  target-arm: Move OMAP cp15_i_{max,min} reset to cpu_state_reset
  target-arm: Move feature register setup to per-CPU init fns
  target-arm: Move iWMMXT wCID reset to cpu_state_reset
  target-arm: Drop JTAG_ID documentation
  target-arm: Move SCTLR reset value setup to per cpu init fns
  target-arm: Move CTR setup to per cpu init fns
  target-arm: Move MVFR* setup to per cpu init fns
  target-arm: Move FPSID config to cpu init fns
  target-arm: Move feature bit settings to CPU init fns
  target-arm: Add QOM subclasses for each ARM cpu implementation
  target-arm: remind to keep arm features in sync with linux-user/elfload.c
  tci: GETPC() macro must return an uintptr_t
  gdbstub: Synchronize CPU state unconditionally in gdb_set_cpu_pc
  softfloat: make USE_SOFTFLOAT_STRUCT_TYPES compile
  target-xtensa: add tests for LOOPNEZ and LOOPGTZ
  target-xtensa: fix LOOPNEZ/LOOPGTZ translation
  qtest: add m48t59 tests for Sparc
  ...

12 years agoqapi: g_hash_table_find() instead of GHashTableIter.
NODA, Kai [Sat, 21 Apr 2012 13:41:27 +0000 (22:41 +0900)]
qapi: g_hash_table_find() instead of GHashTableIter.

GHashTableIter was first introduced in glib 2.16.
This patch removes it in favor of older g_hash_table_find()
for better compatibility with RHEL5.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqmp: make block job command naming consistent
Stefan Hajnoczi [Wed, 11 Apr 2012 15:27:10 +0000 (16:27 +0100)]
qmp: make block job command naming consistent

The block streaming and job commands used '_' instead of '-' for reasons
of compatibility with libvirt, which already included support for the
'_' naming.  However, the semantics of block_job_cancel have changed and
libvirt now needs to handle the new semantics.

Since the old semantics were never in a QEMU release we can still rename
the commands to use '-' instead of '_'.  Libvirt is also happy because
the new name can be used to distinguish QEMU binaries that support the
latest block-job-cancel semantics from those that include a downstream
block_job_cancel command.

Therefore, let's apply the QAPI/QMP naming rules to the block streaming
and job commands.  QEMU 1.1 will be the first release with these
commands so no upstream users can break.

Note that HMP commands are left with '_' because that is the convention
there.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoMerge remote-tracking branch 'sstabellini/build_fix' into staging
Anthony Liguori [Mon, 23 Apr 2012 14:58:54 +0000 (09:58 -0500)]
Merge remote-tracking branch 'sstabellini/build_fix' into staging

* sstabellini/build_fix:
  xen: add a dummy xc_hvm_inject_msi for Xen < 4.2
  xen,configure: detect Xen 4.2

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 23 Apr 2012 14:58:33 +0000 (09:58 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  Add .gitignore for tests/
  e1000: Fix spelling (segmentaion -> segmentation) in debug output
  spice-qemu-char.c: Show what name is unsupported
  pflash_cfi01: remove redundant line
  qxl: Add missing GCC_FMT_ATTR and fix format specifier
  fix block_job_set_speed name in documentation
  error.c: don't return value for void function

12 years agoMerge remote-tracking branch 'mdroth/qga-pull-4-19-12' into staging
Anthony Liguori [Mon, 23 Apr 2012 14:58:19 +0000 (09:58 -0500)]
Merge remote-tracking branch 'mdroth/qga-pull-4-19-12' into staging

* mdroth/qga-pull-4-19-12:
  qemu-ga: fix help output
  qemu-ga: generate missing stubs for fsfreeze

12 years agoMerge remote-tracking branch 'bonzini/nbd-next' into staging
Anthony Liguori [Mon, 23 Apr 2012 14:58:01 +0000 (09:58 -0500)]
Merge remote-tracking branch 'bonzini/nbd-next' into staging

* bonzini/nbd-next:
  nbd: obey FUA on reads
  nbd: do not include block_int.h
  nbd: do not block in nbd_wr_sync if no data at all is available
  nbd: consistently return negative errno values
  nbd: consistently check for <0 or >=0
  nbd: consistently use ssize_t
  nbd: avoid out of bounds access to recv_coroutine array

12 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Mon, 23 Apr 2012 14:57:47 +0000 (09:57 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  scsi: add SANITIZE command
  SCSI emulation: should tell the guest that we actually support thin provisioning
  SCSI emulation: Support unmap via WRITE_SAME_10.
  scsi: advertise DPOFUA
  scsi: small refactoring of MMC mode-sense
  scsi: support FUA on reads
  scsi: add a started field to SCSIDiskReq
  scsi: force unit access on VERIFY
  scsi: add support for FUA on writes
  scsi: move scsi_flush_complete around
  scsi: make code more homogeneous in AIO callback functions
  scsi: add missing test for cancelled request
  virtio-scsi: add multiqueue capability
  virtio: add virtio_queue_get_id
  virtio-scsi: prepare migration format for multiqueue
  scsi: fix memory leak

12 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Mon, 23 Apr 2012 14:57:04 +0000 (09:57 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

* stefanha/tracing:
  tracetool: handle DTrace keywords 'in', 'next', 'self'
  tracetool: Add MAINTAINERS info
  tracetool: Add support for the 'dtrace' backend
  tracetool: Add support for the 'ust' backend
  tracetool: Add support for the 'simple' backend
  tracetool: Add support for the 'stderr' backend
  tracetool: Add module for the 'h' format
  tracetool: Add module for the 'c' format
  tracetool: Rewrite infrastructure as python modules

12 years agotarget-arm: Move reset handling to arm_cpu_reset
Peter Maydell [Fri, 20 Apr 2012 17:58:36 +0000 (17:58 +0000)]
target-arm: Move reset handling to arm_cpu_reset

Now that cpu_reset_model_id() has gone we can move the
reset code over to the class reset function and have cpu_state_reset
simply do a reset on the CPU QOM object.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Drop cpu_reset_model_id()
Peter Maydell [Fri, 20 Apr 2012 17:58:35 +0000 (17:58 +0000)]
target-arm: Drop cpu_reset_model_id()

cpu_reset_model_id() is now empty and we can remove it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Move cache ID register setup to cpu specific init fns
Peter Maydell [Fri, 20 Apr 2012 17:58:35 +0000 (17:58 +0000)]
target-arm: Move cache ID register setup to cpu specific init fns

Move cache ID register reset out of cpu_reset_model_id() by
creating a field for the reset value in ARMCPU and setting it
up in the cpu specific init functions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Move OMAP cp15_i_{max,min} reset to cpu_state_reset
Peter Maydell [Fri, 20 Apr 2012 17:58:35 +0000 (17:58 +0000)]
target-arm: Move OMAP cp15_i_{max,min} reset to cpu_state_reset

Move the OMAP-specific cp15_i_{max,min} reset to cpu_state_reset;
since these registers are only accessible on CPUs with the
OMAPCP feature set there's no need to guard this reset with
either a CPUID or feature bit check.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Move feature register setup to per-CPU init fns
Peter Maydell [Fri, 20 Apr 2012 17:58:34 +0000 (17:58 +0000)]
target-arm: Move feature register setup to per-CPU init fns

Move feature register value setup to per-CPU init functions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Move iWMMXT wCID reset to cpu_state_reset
Peter Maydell [Fri, 20 Apr 2012 17:58:34 +0000 (17:58 +0000)]
target-arm: Move iWMMXT wCID reset to cpu_state_reset

Move the iWMMXT wCID reset to cpu_state_reset(). Since
we use the same value for all CPUs with this feature
(with the major/minor revision fields set to the QEMU
specific 'Q' value) there's no need to create an ARMCPU
field just for this.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Drop JTAG_ID documentation
Peter Maydell [Fri, 20 Apr 2012 17:58:33 +0000 (17:58 +0000)]
target-arm: Drop JTAG_ID documentation

None of the machines in QEMU offer a JTAG debug interface, so this info
was unused. Further, the PXA250 ID contradicts the February 2002
Developer's Manual, which has it as 0xn9264013 with n the MIDR Revision.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Move SCTLR reset value setup to per cpu init fns
Peter Maydell [Fri, 20 Apr 2012 17:58:33 +0000 (17:58 +0000)]
target-arm: Move SCTLR reset value setup to per cpu init fns

Move the reset value of SCTLR to ARMCPU, initialised in
the per-cpu init functions. It can then be reset by a
simple copy, and we can drop the code from cpu_reset_model_id().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Move CTR setup to per cpu init fns
Peter Maydell [Fri, 20 Apr 2012 17:58:33 +0000 (17:58 +0000)]
target-arm: Move CTR setup to per cpu init fns

Move CTR (cache type register) value to an ARMCPU field
set up by per-cpu init fns.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Move MVFR* setup to per cpu init fns
Peter Maydell [Fri, 20 Apr 2012 17:58:32 +0000 (17:58 +0000)]
target-arm: Move MVFR* setup to per cpu init fns

Move the MVFR* VFP feature register values to ARMCPU,
so they are set up by the implementation-specific instance
init functions rather than in cpu_reset_model_id().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Move FPSID config to cpu init fns
Peter Maydell [Fri, 20 Apr 2012 17:58:32 +0000 (17:58 +0000)]
target-arm: Move FPSID config to cpu init fns

Move the reset FPSID to the ARMCPU struct, and set it in the
per-implementation instance init function. At reset we then
just copy the reset value into the CPUARMState field.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Move feature bit settings to CPU init fns
Peter Maydell [Fri, 20 Apr 2012 17:58:31 +0000 (17:58 +0000)]
target-arm: Move feature bit settings to CPU init fns

Move the setting of the feature bits from cpu_reset_model_id()
to each CPU's instance init function. This requires us to move
the features field in CPUARMState so that it is not cleared
on reset.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-arm: Add QOM subclasses for each ARM cpu implementation
Peter Maydell [Fri, 20 Apr 2012 17:58:31 +0000 (17:58 +0000)]
target-arm: Add QOM subclasses for each ARM cpu implementation

Register subclasses for each ARM CPU implementation.

Let arm_cpu_list() enumerate CPU subclasses in alphabetical order,
except for special value "any".

Replace cpu_arm_find_by_name()'s string -> CPUID lookup by storing the
CPUID (aka MIDR, Main ID Register) value in the class.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: remind to keep arm features in sync with linux-user/elfload.c
Benoit Canet [Wed, 9 Nov 2011 07:32:59 +0000 (07:32 +0000)]
target-arm: remind to keep arm features in sync with linux-user/elfload.c

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoMerge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 21 Apr 2012 13:33:55 +0000 (13:33 +0000)]
Merge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  versatiblepb: add NOR flash support
  hw/arm_mptimer: Reset the qemu_timer at reset
  versatilepb: add ds1338 rtc device
  realview: break out versatile i2c controller code

12 years agotci: GETPC() macro must return an uintptr_t
Stefan Weil [Tue, 17 Apr 2012 17:22:39 +0000 (19:22 +0200)]
tci: GETPC() macro must return an uintptr_t

Change the data type of tci_tb_ptr, so GETPC() returns an
uintptr_t now (like for all other TCG targets).

This completes commit 2050396801ca0c8359364d61eaadece951006057
and fixes builds with TCI.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agogdbstub: Synchronize CPU state unconditionally in gdb_set_cpu_pc
Peter Maydell [Mon, 12 Mar 2012 06:24:45 +0000 (06:24 +0000)]
gdbstub: Synchronize CPU state unconditionally in gdb_set_cpu_pc

Synchronize the CPU state via cpu_sychronize_state() unconditionally
in gdb_set_cpu_pc() rather than only in some of the target ifdef
ladder cases.

We can divide the CPUs into three categories:
 * non-KVM targets: no change of behaviour since we will use the
   kvm-stub.c no-op function.
 * i386 and s390: no change of behaviour since they were already
   calling this function
 * PPC (in KVM mode): this fixes an error: failing to synchronise
   was accidental and probably a bug.

This also paves the way for other targets (specifically ARM) which
can add KVM support in future without having to add another target
specific change to this bit of code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosoftfloat: make USE_SOFTFLOAT_STRUCT_TYPES compile
Juan Quintela [Tue, 20 Mar 2012 05:24:25 +0000 (05:24 +0000)]
softfloat: make USE_SOFTFLOAT_STRUCT_TYPES compile

This change makes it compile and return the same value than the #undef one.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add tests for LOOPNEZ and LOOPGTZ
Max Filippov [Sun, 15 Apr 2012 21:47:07 +0000 (01:47 +0400)]
target-xtensa: add tests for LOOPNEZ and LOOPGTZ

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: fix LOOPNEZ/LOOPGTZ translation
Max Filippov [Sun, 15 Apr 2012 21:47:06 +0000 (01:47 +0400)]
target-xtensa: fix LOOPNEZ/LOOPGTZ translation

Translation of LOOP instructions used to call LEND SR write handler to
update LEND and invalidate relevant TBs. Now that LEND SR write handler
ends TB, LOOPNEZ and LOOPGTZ generate wrong code (same as for simple
LOOP). Fix it by calling wsr_lend helper directly.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoqtest: add m48t59 tests for Sparc
Blue Swirl [Sun, 15 Apr 2012 11:45:18 +0000 (11:45 +0000)]
qtest: add m48t59 tests for Sparc

Add simple m48t59 qtests, enable test only for Sparc32
and Sparc64. On PPC, the device is behind PCI bus.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoversatiblepb: add NOR flash support
Eric Benard [Mon, 16 Apr 2012 05:02:47 +0000 (05:02 +0000)]
versatiblepb: add NOR flash support

- add support for the 64MB NOR CFI01 flash available at
0x34000000 on the versatilepb board
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0225d/BBAJIHEC.html

- tested with barebox bootloader

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_mptimer: Reset the qemu_timer at reset
Peter Maydell [Fri, 20 Apr 2012 15:38:52 +0000 (15:38 +0000)]
hw/arm_mptimer: Reset the qemu_timer at reset

On reset of the mpcore timer/watchdog block we need to
delete the qemu_timer in case it was running.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoversatilepb: add ds1338 rtc device
Oskar Andero [Fri, 20 Apr 2012 15:38:52 +0000 (15:38 +0000)]
versatilepb: add ds1338 rtc device

Add ds1338 rtc attached on i2c.

Signed-off-by: Oskar Andero <oskar.andero@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agorealview: break out versatile i2c controller code
Oskar Andero [Fri, 20 Apr 2012 15:38:52 +0000 (15:38 +0000)]
realview: break out versatile i2c controller code

The versatile i2c controller implementation was separated to
its own file called versatile_i2c.c. This is done as a preparation
for adding i2c support to the versatilepb board.

Signed-off-by: Oskar Andero <oskar.andero@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoqemu-iotests: Fix test 031 for qcow2 v3 support
Kevin Wolf [Thu, 12 Apr 2012 15:21:44 +0000 (17:21 +0200)]
qemu-iotests: Fix test 031 for qcow2 v3 support

qcow2.py must be updated to work with version 3 images at all, the
output has changed since the feature table extension has been added, and
version 2 and version 3 images can't possibly have the same test output.

Change the test case to completely ignore IMGOPTS and run the test for
both compat=1.1 and compat=0.10 regardless of the ./check command line.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: Add -o and make v3 the default for qcow2
Kevin Wolf [Tue, 27 Mar 2012 11:45:14 +0000 (13:45 +0200)]
qemu-iotests: Add -o and make v3 the default for qcow2

This adds an -o option to qemu-iotests, which is an option string that
is passed through to qemu-img create -o... This allows testing different
subformat with a command like './check -qcow2 -o compat=0.10'.

For qcow2, if no compat option is specified, compat=1.1 is the new
default.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Zero write support
Kevin Wolf [Tue, 20 Mar 2012 14:12:58 +0000 (15:12 +0100)]
qcow2: Zero write support

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: Test backing file COW with zero clusters
Kevin Wolf [Thu, 12 Apr 2012 13:28:12 +0000 (15:28 +0200)]
qemu-iotests: Test backing file COW with zero clusters

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: add a simple test for write_zeroes
Paolo Bonzini [Thu, 8 Mar 2012 17:15:01 +0000 (18:15 +0100)]
qemu-iotests: add a simple test for write_zeroes

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Support for feature table header extension
Kevin Wolf [Thu, 12 Apr 2012 13:20:27 +0000 (15:20 +0200)]
qcow2: Support for feature table header extension

Instead of printing an ugly bitmask, qemu can now print a more helpful
string even for yet unknown features.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Support reading zero clusters
Kevin Wolf [Fri, 16 Mar 2012 14:02:38 +0000 (15:02 +0100)]
qcow2: Support reading zero clusters

This adds support for reading zero clusters in version 3 images.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Version 3 images
Kevin Wolf [Thu, 15 Dec 2011 11:20:58 +0000 (12:20 +0100)]
qcow2: Version 3 images

This adds the basic infrastructure to qcow2 to handle version 3 images.
It includes code to create v3 images, allow header updates for v3 images
and checks feature bits.

It still misses support for zero clusters, so this is not a fully
compliant implementation of v3 yet.

The default for creating new images stays at v2 for now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Ignore reserved bits in check_refcounts
Kevin Wolf [Tue, 27 Mar 2012 11:44:56 +0000 (13:44 +0200)]
qcow2: Ignore reserved bits in check_refcounts

Also don't infer the cluster type directly from the L2 entries, but use
qcow2_get_cluster_type() to keep everything in a single place.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Ignore reserved bits in refcount table entries
Kevin Wolf [Fri, 16 Mar 2012 13:09:08 +0000 (14:09 +0100)]
qcow2: Ignore reserved bits in refcount table entries

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Simplify count_cow_clusters
Kevin Wolf [Tue, 27 Mar 2012 11:17:22 +0000 (13:17 +0200)]
qcow2: Simplify count_cow_clusters

count_cow_clusters() tries to reuse existing functions, and all it
achieves is to make things much more complicated than they really are:
Everything needs COW, unless it's a normal cluster with refcount 1.

This patch implements the obvious way of doing this, and by using
qcow2_get_cluster_type() it gets rid of all flag magic.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Refactor qcow2_free_any_clusters
Kevin Wolf [Tue, 27 Mar 2012 11:09:22 +0000 (13:09 +0200)]
qcow2: Refactor qcow2_free_any_clusters

Zero clusters will add another cluster type. Refactor the open-coded
cluster type detection into a switch of QCOW2_CLUSTER_* options so that
the detection is in a single place. This makes it easier to add new
cluster types.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Ignore reserved bits in L1/L2 entries
Kevin Wolf [Thu, 23 Feb 2012 14:40:55 +0000 (15:40 +0100)]
qcow2: Ignore reserved bits in L1/L2 entries

This changes the still existing places that assume that the only flags
are QCOW_OFLAG_COPIED and QCOW_OFLAG_COMPRESSED to properly mask out
reserved bits.

It does not convert bdrv_check yet.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Fail write_compressed when overwriting data
Kevin Wolf [Thu, 15 Mar 2012 16:20:11 +0000 (17:20 +0100)]
qcow2: Fail write_compressed when overwriting data

qcow2_alloc_compressed_cluster_offset() already fails if the copied flag
is set, because qcow2_write_compressed() doesn't perform COW as it would
have to do to allow this.

However, what we really want to check here is whether the cluster is
allocated or not. With internal snapshots the copied flag may not be set
on allocated clusters. Check the cluster offset instead.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Ignore reserved bits in count_contiguous_clusters()
Kevin Wolf [Thu, 15 Mar 2012 15:37:40 +0000 (16:37 +0100)]
qcow2: Ignore reserved bits in count_contiguous_clusters()

Until now, count_contiguous_clusters() has an argument that allowed to
specify flags that should be ignored in the comparison, i.e. that are
allowed to change between contiguous clusters.

This patch changes the function so that it ignores all flags by default
now and you need to pass the flags on which it should stop.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Ignore reserved bits in get_cluster_offset
Kevin Wolf [Wed, 14 Mar 2012 18:15:03 +0000 (19:15 +0100)]
qcow2: Ignore reserved bits in get_cluster_offset

With this change, reading from a qcow2 image ignores all reserved bits
that are set in an L1 or L2 table entry.

Now get_cluster_offset() assigns *cluster_offset only the offset without
any other flags. The cluster type is not longer encoded in the offset,
but a positive return value in case of success.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Save disk size in snapshot header
Kevin Wolf [Wed, 11 Apr 2012 14:33:50 +0000 (16:33 +0200)]
qcow2: Save disk size in snapshot header

This allows that different snapshots of an image can have different
sizes, which is a requirement for enabling image resizing even with
images that have internal snapshots.

We don't do the actual support for it now, but make sure that the
additional field is present and not completely ignored in all version 3
images. When trying to load a snapshot of different size, it returns
an error.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoSpecification for qcow2 version 3
Kevin Wolf [Thu, 12 Apr 2012 11:20:41 +0000 (13:20 +0200)]
Specification for qcow2 version 3

This updates the qcow2 specification to cover version 3. It contains the
following changes:

- Added compatible/incompatible/auto-clear feature bits plus an optional
  feature name table to allow useful error messages even if an older
  version doesn't know some feature at all.

- Configurable refcount width. If you don't want to use internal
  snapshots, make refcounts one bit and save cache space and I/O.

- Zero cluster flags. This allows discard even with a backing file that
  doesn't contain zeros. It is also useful for copy-on-read/image
  streaming, as you'll want to keep sparseness without accessing the
  remote image for an unallocated cluster all the time.

- Fixed internal snapshot metadata to use 64 bit VM state size. You
  can't save a snapshot of a VM with >= 4 GB RAM today.

- Extended internal snapshot metadata to contain the disk size, so that
  resizing images that have snapshots can be allowed in the future.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Fix refcount block allocation during qcow2_alloc_cluster_at()
Kevin Wolf [Fri, 20 Apr 2012 13:50:39 +0000 (15:50 +0200)]
qcow2: Fix refcount block allocation during qcow2_alloc_cluster_at()

Refcount block allocation and refcount table growth rely on
s->free_cluster_index pointing to somewhere after the current
allocation. Change qcow2_alloc_cluster_at() to fulfill this
assumption.

Without this change it could happen that a newly allocated refcount
block and the allocated data block point to the same area in the image
file, causing data corruption in the long run.

This fixes a bug that became first visible after commit 250196f1.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoAdd .gitignore for tests/
David Gibson [Fri, 20 Apr 2012 01:40:24 +0000 (11:40 +1000)]
Add .gitignore for tests/

The new autotests in tests/ generate a number of files, both
executable and source, which are not caught by the existing .gitignore
files.  This patch adds a new .gitignore in tests/ which covers these.

[Changed 'rtc-test' to '*-test' so future tests do not need to be added
to .gitignore on a case-by-case basis.  Stefan]

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoe1000: Fix spelling (segmentaion -> segmentation) in debug output
Stefan Weil [Wed, 18 Apr 2012 05:28:34 +0000 (07:28 +0200)]
e1000: Fix spelling (segmentaion -> segmentation) in debug output

This was reported by https://bugs.launchpad.net/qemu/+bug/984476.

I also changed the case for 'error'.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agospice-qemu-char.c: Show what name is unsupported
Eduardo Elias Ferreira [Mon, 16 Apr 2012 12:51:42 +0000 (09:51 -0300)]
spice-qemu-char.c: Show what name is unsupported

Signed-off-by: Eduardo Elias Ferreira <edusf@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agopflash_cfi01: remove redundant line
Eric Bénard [Thu, 12 Apr 2012 07:51:46 +0000 (09:51 +0200)]
pflash_cfi01: remove redundant line

Signed-off-by: Eric Bénard <eric@eukrea.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>