sdk/emulator/qemu.git
10 years agopm_smbus: correctly report unclaimed cycles
Paolo Bonzini [Mon, 31 Mar 2014 16:26:31 +0000 (18:26 +0200)]
pm_smbus: correctly report unclaimed cycles

Without this patch, i2cdetect will report all addresses as present.
With it, only 0x50..0x57 are present.

Before:

         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
    10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
    20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
    30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
    40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
    50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
    60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
    70: 70 71 72 73 74 75 76 77

After:

         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: 50 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agosmbus: return -1 if nothing found at the given address
Paolo Bonzini [Mon, 31 Mar 2014 16:26:30 +0000 (18:26 +0200)]
smbus: return -1 if nothing found at the given address

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agosmbus: allow returning an error from reads
Paolo Bonzini [Mon, 31 Mar 2014 16:26:29 +0000 (18:26 +0200)]
smbus: allow returning an error from reads

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoapic: use emulated lapic version 0x14 on pc machines >= 2.1
Gabriel L. Somlo [Mon, 5 May 2014 14:52:51 +0000 (10:52 -0400)]
apic: use emulated lapic version 0x14 on pc machines >= 2.1

Add "version" property to local apic, and have it default to
0x14 for pc machines starting at 2.1. For compatibility with
previous releases, pc machines up to 2.0 will have their local
apic version set to 0x11.

Signed-off-by: Gabriel L. Somlo <somlo@cmu.edu>
Acked-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopc: add compat_props placeholder for 2.0 machine type
Gabriel L. Somlo [Mon, 5 May 2014 14:52:50 +0000 (10:52 -0400)]
pc: add compat_props placeholder for 2.0 machine type

Add the "boilerplate" necessary for subsequent patches to
simply drop in compat_props for pc machines 2.0 and older.

This patch contains no functional changes.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Acked-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoi8259: don't abort when trying to use level sensitive irqs
Hervé Poussineau [Tue, 22 Apr 2014 21:00:31 +0000 (23:00 +0200)]
i8259: don't abort when trying to use level sensitive irqs

This is a guest-triggerable error, as seen when using Xenix 2.3.4.
Replace hw_error by LOG_UNIMPL, so that guests can continue.
With this patch, I can install and use Xenix 2.3.4a without any problem.
I can also start installation of Xenix 2.3.4q, but it fails due to not
finding an hard disk.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi: fix tables for no-hpet configuration
Michael S. Tsirkin [Mon, 28 Apr 2014 05:15:32 +0000 (08:15 +0300)]
acpi: fix tables for no-hpet configuration

acpi build tried to add offset of hpet table to rsdt even when hpet was
disabled.  If no tables follow hpet, this could lead to a malformed
rsdt.

Fix it up.

To avoid such errors in the future, rearrange code slightly to make it
clear that acpi_add_table stores the offset of the following table - not
of the previous one.

Reported-by: TeLeMan <geleman@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Cc: qemu-stable@nongnu.org
10 years agoacpi-build: properly decrement objects' reference counters
Kirill Batuzov [Thu, 24 Apr 2014 14:15:57 +0000 (18:15 +0400)]
acpi-build: properly decrement objects' reference counters

Object returned by object_property_get_qobject needs its reference counter to
be decremented when it is not needed by caller anymore.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi/pcihp.c: Rewrite acpi_pcihp_get_bsel using object_property_get_int
Kirill Batuzov [Thu, 24 Apr 2014 14:15:56 +0000 (18:15 +0400)]
acpi/pcihp.c: Rewrite acpi_pcihp_get_bsel using object_property_get_int

acpi_pcihp_get_bsel implements functionality of object_property_get_int for
specific property named ACPI_PCIHP_PROP_BSEL, but fails to decrement object's
reference counter properly. Rewriting it using generic object_property_get_int
serves two purposes: reducing code duplication and fixing memory leak.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-smbios-2' into staging
Peter Maydell [Tue, 6 May 2014 11:23:05 +0000 (12:23 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-smbios-2' into staging

smbios: make qemu generate smbios tables.

# gpg: Signature made Mon 05 May 2014 12:20:27 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-smbios-2:
  SMBIOS: Build aggregate smbios tables and entry point
  SMBIOS: Use bitmaps to prevent incompatible comand line options
  SMBIOS: Use macro to set smbios defaults
  SMBIOS: Update header file definitions
  SMBIOS: Rename symbols to better reflect future use
  E820: Add interface for accessing e820 table
  pc: add 2.1 machine type

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/rth/tgt-axp' into staging
Peter Maydell [Tue, 6 May 2014 10:57:46 +0000 (11:57 +0100)]
Merge remote-tracking branch 'remotes/rth/tgt-axp' into staging

* remotes/rth/tgt-axp:
  target-alpha: Fix RDUSP

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/riku/linux-user-for-upstream' into staging
Peter Maydell [Tue, 6 May 2014 09:56:38 +0000 (10:56 +0100)]
Merge remote-tracking branch 'remotes/riku/linux-user-for-upstream' into staging

* remotes/riku/linux-user-for-upstream:
  linux-user: fix getrusage and wait4 failures with invalid rusage struct
  linux-user/elfload.c: Support ARM HWCAP2 flags
  linux-user/elfload.c: Fix A64 code which was incorrectly acting like A32
  linux-user/elfload.c: Update ARM HWCAP bits
  linux-user/elfload.c: Fix incorrect ARM HWCAP bits
  linux-user: remove configure option for setting uname release
  linux-user: move uname functions to uname.c
  linux-user: rename cpu-uname -> uname
  linux-user/signal.c: Set fault address in AArch64 signal info
  linux-user: avoid using glibc internals in _syscall5 and in definition of target_sigevent struct
  linux-user: Handle arches with llseek instead of _llseek
  linux-user: Add support for SCM_CREDENTIALS.
  linux-user: Move if-elses to a switch statement.
  linux-user: Assert stack used for auxvec, envp, argv
  linux-user: Add /proc/self/exe open forwarding

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agolinux-user: fix getrusage and wait4 failures with invalid rusage struct
Petar Jovanovic [Tue, 8 Apr 2014 17:24:30 +0000 (19:24 +0200)]
linux-user: fix getrusage and wait4 failures with invalid rusage struct

Implementations of system calls getrusage and wait4 have not previously
handled correctly cases when incorrect address of struct rusage is
passed.
This change makes sure return values are correctly set for these cases.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoSMBIOS: Build aggregate smbios tables and entry point
Gabriel L. Somlo [Wed, 23 Apr 2014 13:42:42 +0000 (09:42 -0400)]
SMBIOS: Build aggregate smbios tables and entry point

Build an aggregate set of smbios tables and an entry point structure.

Insert tables and entry point into fw_cfg respectively under
"etc/smbios/smbios-tables" and "etc/smbios/smbios-anchor".

Machine types <= 2.0 will for now continue using field-by-field
overrides to SeaBIOS defaults, but for machine types 2.1 and up we
expect the BIOS to look for and use the aggregate tables generated
by this patch.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
[ kraxel: fix 32bit build ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoSMBIOS: Use bitmaps to prevent incompatible comand line options
Gabriel L. Somlo [Wed, 23 Apr 2014 13:42:41 +0000 (09:42 -0400)]
SMBIOS: Use bitmaps to prevent incompatible comand line options

Replace existing smbios_check_collision() functionality with
a pair of bitmaps: have_binfile_bitmap and have_fields_bitmap.
Bits corresponding to each smbios type are set by smbios_entry_add(),
which also uses the bitmaps to ensure that binary blobs and field
values are never accepted for the same type.

These bitmaps will also be used in the future to decide whether
or not to build a full table for a given smbios type.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoSMBIOS: Use macro to set smbios defaults
Gabriel L. Somlo [Wed, 23 Apr 2014 13:42:40 +0000 (09:42 -0400)]
SMBIOS: Use macro to set smbios defaults

The function smbios_set_defaults() uses a repeating code pattern
for each field. This patch replaces that pattern with a macro.

This patch contains no functional changes.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoSMBIOS: Update header file definitions
Gabriel L. Somlo [Wed, 23 Apr 2014 13:42:39 +0000 (09:42 -0400)]
SMBIOS: Update header file definitions

Add definitions for smbios entry point (anchor), and for type 2
(base board) structure which is required by some versions of OS X.

Remove definition for type 20 (memory device mapped address)
structure, which is no longer required as of smbios spec v2.5.

Update all other structure definitions to bring them into
compliance with smbios spec v2.8.

This patch contains no functional changes.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoSMBIOS: Rename symbols to better reflect future use
Gabriel L. Somlo [Wed, 23 Apr 2014 13:42:38 +0000 (09:42 -0400)]
SMBIOS: Rename symbols to better reflect future use

Rename the following symbols:

  - smbios_set_type1_defaults() to the more general smbios_set_defaults();
  - bool smbios_type1_defaults to the more general smbios_defaults;
  - smbios_get_table() to smbios_get_table_legacy();

This patch contains no functional changes.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoE820: Add interface for accessing e820 table
Gabriel L. Somlo [Wed, 23 Apr 2014 13:42:36 +0000 (09:42 -0400)]
E820: Add interface for accessing e820 table

Add the following two functions:

  - e820_get_num_entries() - query the size of the e820 table
  - e820_get_entry() - grab an entry matching a given set of criteria

This interface is currently necessary for creating type 19
(memory array mapped address) structures in smbios.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agopc: add 2.1 machine type
Michael S. Tsirkin [Thu, 24 Apr 2014 10:14:53 +0000 (13:14 +0300)]
pc: add 2.1 machine type

At the moment, 2.1 and 2.0 machines are identical.
As several people are working on incompatible changes
to the PC machine, collaboration will be made easier
by merging this place-holder.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agotarget-alpha: Fix RDUSP
Richard Henderson [Sat, 3 May 2014 03:42:02 +0000 (20:42 -0700)]
target-alpha: Fix RDUSP

Commit 06ef8604e92964cbf30084b7d31091aa7cbbb62f contained a typo.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agolinux-user/elfload.c: Support ARM HWCAP2 flags
Peter Maydell [Fri, 2 May 2014 13:45:15 +0000 (14:45 +0100)]
linux-user/elfload.c: Support ARM HWCAP2 flags

The ARM kernel has chosen to spill into the HWCAP2 ELF feature bit flags
early, even though it hasn't yet exhausted all 32 bits of the HWCAP word.
Add support for setting this in the same way we do for HWCAP.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user/elfload.c: Fix A64 code which was incorrectly acting like A32
Peter Maydell [Fri, 2 May 2014 13:45:14 +0000 (14:45 +0100)]
linux-user/elfload.c: Fix A64 code which was incorrectly acting like A32

The ARM target-specific code in elfload.c was incorrectly allowing
the 64-bit ARM target to use most of the existing 32-bit definitions:
most noticably this meant that our HWCAP bits passed to the guest
were wrong, and register handling when dumping core was totally
broken. Fix this by properly separating the 64 and 32 bit code,
since they have more differences than similarities.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user/elfload.c: Update ARM HWCAP bits
Peter Maydell [Fri, 2 May 2014 13:45:13 +0000 (14:45 +0100)]
linux-user/elfload.c: Update ARM HWCAP bits

The kernel has added support for a number of new ARM HWCAP bits;
add them to QEMU, including support for setting them where we have
a corresponding CPU feature bit.

We were also incorrectly setting the VFPv3D16 HWCAP -- this means
"only 16 D registers", not "supports 16-bit floating point format";
since QEMU always has 32 D registers for VFPv3, we can just remove
the line that incorrectly set this bit.

The kernel does not set the HWCAP_FPA even if it is providing FPA
emulation via nwfpe, so don't set this bit in QEMU either.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user/elfload.c: Fix incorrect ARM HWCAP bits
Peter Maydell [Fri, 2 May 2014 13:45:12 +0000 (14:45 +0100)]
linux-user/elfload.c: Fix incorrect ARM HWCAP bits

The ELF HWCAP bits for ARM features THUMBEE, NEON, VFPv3 and VFPv3D16 are
all off by one compared to the kernel definitions. Fix this discrepancy
and add in the missing CRUNCH bit which was the cause of the off-by-one
error. (We don't emulate any of the CPUs which have that weird hardware,
so it's otherwise uninteresting to us.)

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: remove configure option for setting uname release
Riku Voipio [Tue, 4 Mar 2014 02:28:43 +0000 (04:28 +0200)]
linux-user: remove configure option for setting uname release

--enable-uname-release was a rather heavyweight hammer, as it allows
providing values less that UNAME_MINIMUM_RELEASE. Also, it affects
all built linux-user targets, which in most cases is not what user
wants.

Now that we have UNAME_MINIMUM_RELEASE for all linux-user platforms,
we can drop --enable-uname-release and the related CONFIG_UNAME_RELEASE
define.

Users can still override the variable with QEMU_UNAME=2.6.32 or -r
command line option. If distributors need to update a minimum version
for a specific target, it can be done by updating UNAME_MINIMUM_RELEASE.

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: move uname functions to uname.c
Riku Voipio [Wed, 19 Feb 2014 13:35:35 +0000 (15:35 +0200)]
linux-user: move uname functions to uname.c

Make syscall.c slightly smaller by moving uname-related
functions to uname.c.

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: rename cpu-uname -> uname
Riku Voipio [Wed, 19 Feb 2014 10:59:58 +0000 (12:59 +0200)]
linux-user: rename cpu-uname -> uname

To move more uname related functions out of syscall.c,
rename cpu-uname.{c,h} to uname.{c.h}

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user/signal.c: Set fault address in AArch64 signal info
Peter Maydell [Thu, 1 May 2014 17:36:17 +0000 (18:36 +0100)]
linux-user/signal.c: Set fault address in AArch64 signal info

Set the fault address correctly in the signal information passed
to a signal handler for AArch64 guests.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: avoid using glibc internals in _syscall5 and in definition of target_sige...
Natanael Copa [Tue, 29 Apr 2014 11:11:20 +0000 (13:11 +0200)]
linux-user: avoid using glibc internals in _syscall5 and in definition of target_sigevent struct

Use the public sigset_t instead of the glibc specific internal
__sigset_t in _syscall.

Calculate the sigevent pad size is calculated in similar way as kernel
does it instead of using glibc internal field _pad.

This is needed for building with musl libc.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10 years agolinux-user: Handle arches with llseek instead of _llseek
James Hogan [Tue, 25 Mar 2014 21:51:08 +0000 (21:51 +0000)]
linux-user: Handle arches with llseek instead of _llseek

Recently merged kernel ports (such as OpenRISC and Meta) have an llseek
system call instead of _llseek. This is handled for the host
architecture by defining __NR__llseek as __NR_llseek, but not for the
target architecture.

Handle it in the same way for these architectures, defining
TARGET_NR__llseek as TARGET_NR_llseek.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Jia Liu <proljc@gmail.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Add support for SCM_CREDENTIALS.
Huw Davies [Thu, 17 Apr 2014 13:02:48 +0000 (14:02 +0100)]
linux-user: Add support for SCM_CREDENTIALS.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Move if-elses to a switch statement.
Huw Davies [Thu, 17 Apr 2014 13:02:47 +0000 (14:02 +0100)]
linux-user: Move if-elses to a switch statement.

This makes adding more message types cleaner.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Assert stack used for auxvec, envp, argv
James Hogan [Tue, 25 Mar 2014 23:21:50 +0000 (23:21 +0000)]
linux-user: Assert stack used for auxvec, envp, argv

Assert that the amount of stack space used for auxvec, envp & argv
exactly matches the amount allocated. This catches if DLINFO_ITEMS isn't
updated when another NEW_AUX_ENT is added.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Add /proc/self/exe open forwarding
Maxim Ostapenko [Fri, 2 May 2014 08:17:07 +0000 (11:17 +0300)]
linux-user: Add /proc/self/exe open forwarding

QEMU already supports /proc/self/{maps,stat,auxv} so addition of
/proc/self/exe is rather trivial.

Fixes https://bugs.launchpad.net/qemu/+bug/1299190

Signed-off-by: Maxim Ostapenko <m.ostapenko@partner.samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140501' into...
Peter Maydell [Fri, 2 May 2014 10:32:00 +0000 (11:32 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140501' into staging

target-arm queue:
 * implement XScale cache lockdown cp15 ops
 * fix v7M CPUID base register
 * implement WFE and YIELD as yields for A64
 * fix A64 "BLR LR"
 * support Cortex-A57 in virt machine model
 * a few other minor AArch64 bugfixes

# gpg: Signature made Thu 01 May 2014 15:42:17 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20140501:
  hw/arm/virt: Add support for Cortex-A57
  hw/arm/virt: Put GIC register banks on 64K boundaries
  hw/arm/virt: Create the GIC ourselves rather than (ab)using a15mpcore_priv
  target-arm: Correct a comment refering to EL0
  target-arm: A64: Fix a typo when declaring TLBI ops
  target-arm: A64: Handle blr lr
  target-arm: Make vbar_write 64bit friendly on 32bit hosts
  target-arm: implement WFE/YIELD as a yield for AArch64
  armv7m_nvic: fix CPUID Base Register
  target-arm: Implement XScale cache lockdown operations as NOPs

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Fri, 2 May 2014 09:50:58 +0000 (10:50 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block patches

# gpg: Signature made Wed 30 Apr 2014 19:19:32 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (31 commits)
  curl: Fix hang reading from slow connections
  curl: Ensure all informationals are checked for completion
  curl: Eliminate unnecessary use of curl_multi_socket_all
  curl: Remove unnecessary explicit calls to internal event handler
  curl: Remove erroneous sleep waiting for curl completion
  curl: Fix return from curl_read_cb with invalid state
  curl: Remove unnecessary use of goto
  curl: Fix long line
  block/vdi: Error out immediately in vdi_create()
  block/bochs: Fix error handling for seek_to_sector()
  qcow2: Check min_size in qcow2_grow_l1_table()
  qcow2: Catch bdrv_getlength() error
  block: Use correct width in format strings
  qcow2: Avoid overflow in alloc_clusters_noref()
  block: Use error_abort in bdrv_image_info_specific_dump()
  block: Fix open_flags in bdrv_reopen()
  Revert "block: another bdrv_append fix"
  block: Unlink temporary files in raw-posix/win32
  block: Remove BDRV_O_COPY_ON_READ for bs->file
  block: Create bdrv_backing_flags()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/cohuck/tags/kvm_cap_helpers' into staging
Peter Maydell [Thu, 1 May 2014 16:32:25 +0000 (17:32 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/kvm_cap_helpers' into staging

Add helpers for enabling kvm capabilities and convert the existing
s390x and ppc users to use them.

# gpg: Signature made Wed 30 Apr 2014 14:48:45 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/kvm_cap_helpers:
  ppc: use kvm_vcpu_enable_cap()
  s390x: use kvm_vcpu_enable_cap()
  kvm: add kvm_{vm,vcpu}_enable_cap

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vga-2' into staging
Peter Maydell [Thu, 1 May 2014 15:02:45 +0000 (16:02 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-2' into staging

vga: add secondary stdvga variant

# gpg: Signature made Mon 28 Apr 2014 10:11:44 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-vga-2:
  add secondary-vga to display-vga test
  add display-vga test
  vga: add secondary stdvga variant
  vga: allow non-global vmstate

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agohw/arm/virt: Add support for Cortex-A57
Peter Maydell [Thu, 24 Apr 2014 17:54:43 +0000 (18:54 +0100)]
hw/arm/virt: Add support for Cortex-A57

Support the Cortex-A57 in the virt machine model.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1398362083-17737-4-git-send-email-peter.maydell@linaro.org

10 years agohw/arm/virt: Put GIC register banks on 64K boundaries
Peter Maydell [Thu, 24 Apr 2014 17:54:42 +0000 (18:54 +0100)]
hw/arm/virt: Put GIC register banks on 64K boundaries

For an AArch64 CPU which supports 64K pages, having the GIC
register banks at 4K offsets is potentially awkward. Move
them out to being at 64K offsets. (This is harmless for
AArch32 CPUs and for AArch64 CPUs with 4K pages, so it is simpler
to use the same offsets everywhere than to try to use 64K offsets
only for AArch64 host CPUs.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1398362083-17737-3-git-send-email-peter.maydell@linaro.org

10 years agohw/arm/virt: Create the GIC ourselves rather than (ab)using a15mpcore_priv
Peter Maydell [Thu, 1 May 2014 14:24:46 +0000 (15:24 +0100)]
hw/arm/virt: Create the GIC ourselves rather than (ab)using a15mpcore_priv

Rather than having the virt machine model create an a15mpcore_priv
device regardless of the actual CPU type in order to instantiate the GIC,
move to having the machine model create the GIC directly. This
corresponds to a system which uses a standalone GIC (eg the GIC-400)
rather than the one built in to the CPU core.

The primary motivation for this is to support the Cortex-A57,
which for a KVM configuration will use a GICv2, which is not
built into the CPU.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1398362083-17737-2-git-send-email-peter.maydell@linaro.org

10 years agotarget-arm: Correct a comment refering to EL0
Edgar E. Iglesias [Thu, 1 May 2014 14:24:46 +0000 (15:24 +0100)]
target-arm: Correct a comment refering to EL0

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1398926097-28097-5-git-send-email-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: A64: Fix a typo when declaring TLBI ops
Edgar E. Iglesias [Thu, 1 May 2014 14:24:46 +0000 (15:24 +0100)]
target-arm: A64: Fix a typo when declaring TLBI ops

Harmless typo as opc1 defaults to zero and opc2 gets
re-declared to its correct value.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1398926097-28097-4-git-send-email-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: A64: Handle blr lr
Edgar E. Iglesias [Thu, 1 May 2014 14:24:45 +0000 (15:24 +0100)]
target-arm: A64: Handle blr lr

For linked branches, updates to the link register happen
conceptually after the read of the branch target register.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Cc: qemu-stable@nongnu.org
Message-id: 1398926097-28097-3-git-send-email-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Make vbar_write 64bit friendly on 32bit hosts
Edgar E. Iglesias [Thu, 1 May 2014 14:24:45 +0000 (15:24 +0100)]
target-arm: Make vbar_write 64bit friendly on 32bit hosts

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1398926097-28097-2-git-send-email-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: implement WFE/YIELD as a yield for AArch64
Rob Herring [Thu, 1 May 2014 14:24:45 +0000 (15:24 +0100)]
target-arm: implement WFE/YIELD as a yield for AArch64

Like was done for AArch32 for WFE, implement both WFE and YIELD as a
yield operation. This speeds up multi-core system emulation.

Signed-off-by: Rob Herring <rob.herring@linaro.org>
Message-id: 1397588401-20366-1-git-send-email-robherring2@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoarmv7m_nvic: fix CPUID Base Register
Rabin Vincent [Thu, 1 May 2014 14:24:44 +0000 (15:24 +0100)]
armv7m_nvic: fix CPUID Base Register

cp15.c0_cpuid is never initialized for ARMv7-M; take the value directly
from cpu->midr instead.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Message-id: 1398036308-32166-1-git-send-email-rabin@rab.in
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Implement XScale cache lockdown operations as NOPs
Peter Maydell [Thu, 1 May 2014 14:24:44 +0000 (15:24 +0100)]
target-arm: Implement XScale cache lockdown operations as NOPs

XScale defines some implementation-specific coprocessor registers
for doing cache lockdown operations. Since QEMU doesn't model a
cache no proper implementation is possible, but NOP out the
registers so that guest code like u-boot that tries to use them
doesn't crash.

Reported-by: <prqek@centrum.cz>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-6' into staging
Peter Maydell [Thu, 1 May 2014 13:17:33 +0000 (14:17 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-6' into staging

gtk: collection of fixes and cleanups by Cole Robinson

# gpg: Signature made Tue 29 Apr 2014 10:44:44 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-gtk-6:
  gtk: Fix accelerators being triggered twice with gtk3
  gtk: Fix -serial vc
  gtk: Use ctrl+alt+q for quit accelerator
  gtk: Remove use of deprecated stock items
  gtk: Don't use deprecated vte_terminal_get_adjustment
  gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic
  configure: Re-run make if gtkabi/sdlabi is changed
  configure: Document --with-gtkabi

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-sdl-2' into staging
Peter Maydell [Thu, 1 May 2014 12:51:23 +0000 (13:51 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-sdl-2' into staging

sdl2: mouse wheel support, ui config notify

# gpg: Signature made Tue 29 Apr 2014 11:17:01 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-sdl-2:
  sdl2: Support mouse wheel
  sdl2: add ui info setting.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-audio-4' into staging
Peter Maydell [Thu, 1 May 2014 12:05:54 +0000 (13:05 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-4' into staging

hda-audio: fix non-mixer codecs

# gpg: Signature made Tue 29 Apr 2014 10:03:44 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-audio-4:
  hda-audio: fix non-mixer codecs

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agocurl: Fix hang reading from slow connections
Matthew Booth [Tue, 29 Apr 2014 15:03:32 +0000 (16:03 +0100)]
curl: Fix hang reading from slow connections

When receiving a new aio read request, we first look for an existing
transaction whose range will cover the read request by the time it
completes. However, we weren't checking that the existing transaction
was still active. If it had timed out, we were adding the request to a
transaction which would never complete and had already been cancelled,
resulting in a hang.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Ensure all informationals are checked for completion
Matthew Booth [Tue, 29 Apr 2014 15:03:31 +0000 (16:03 +0100)]
curl: Ensure all informationals are checked for completion

According to the documentation, the correct way to ensure all
informationals have been returned by curl_multi_info_read is to loop
until it returns NULL.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Eliminate unnecessary use of curl_multi_socket_all
Matthew Booth [Tue, 29 Apr 2014 15:03:30 +0000 (16:03 +0100)]
curl: Eliminate unnecessary use of curl_multi_socket_all

curl_multi_socket_all is a deprecated catch-all which checks for
activities on all open curl sockets. We have enough information from
the event loop to check only the sockets with activity. This change
removes use of curl_multi_socket_all in favour of
curl_multi_socket_action called with the relevant handle.

At the same time, it also ensures that the driver only checks for
completion of read operations after reading from a socket, rather than
both reading and writing.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Remove unnecessary explicit calls to internal event handler
Matthew Booth [Tue, 29 Apr 2014 15:03:29 +0000 (16:03 +0100)]
curl: Remove unnecessary explicit calls to internal event handler

Remove calls to curl_multi_do where the relevant handles are already
registered to the event loop.

Ensure that we kick off socket handling with CURL_SOCKET_TIMEOUT after
adding a new handle.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Remove erroneous sleep waiting for curl completion
Matthew Booth [Tue, 29 Apr 2014 15:03:28 +0000 (16:03 +0100)]
curl: Remove erroneous sleep waiting for curl completion

The driver will not start more than a fixed number of curl sessions.
If it needs more, it must wait for the completion of an existing one.
The driver was sleeping, which will prevent the main loop from
running, and therefore the event it's waiting on. It was also directly
calling its internal handler rather than waiting on existing
registered handlers to be called from the main loop.

This change causes it simply to wait for a period of time whilst
allowing the main loop to execute.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Fix return from curl_read_cb with invalid state
Matthew Booth [Tue, 29 Apr 2014 15:03:27 +0000 (16:03 +0100)]
curl: Fix return from curl_read_cb with invalid state

A curl write callback is supposed to return the number of bytes it
handled.  curl_read_cb would have erroneously reported it had handled
all bytes in the event that the internal curl state was invalid.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Remove unnecessary use of goto
Matthew Booth [Tue, 29 Apr 2014 15:03:26 +0000 (16:03 +0100)]
curl: Remove unnecessary use of goto

This isn't any of the usually acceptable uses of goto.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Fix long line
Matthew Booth [Tue, 29 Apr 2014 15:03:25 +0000 (16:03 +0100)]
curl: Fix long line

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/vdi: Error out immediately in vdi_create()
Max Reitz [Tue, 29 Apr 2014 17:03:16 +0000 (19:03 +0200)]
block/vdi: Error out immediately in vdi_create()

Currently, if an error occurs during the part of vdi_create() which
actually writes the image, the function stores -errno, but continues
anyway.

Instead of trying to write data which (if it can be written at all) does
not make any sense without the operations before succeeding (e.g.,
writing the image header), just error out immediately.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/bochs: Fix error handling for seek_to_sector()
Max Reitz [Tue, 29 Apr 2014 17:03:15 +0000 (19:03 +0200)]
block/bochs: Fix error handling for seek_to_sector()

Currently, seek_to_sector() returns -1 both for errors and unallocated
sectors, resulting in silent errors. As 0 is an invalid offset of data
clusters (bitmap_offset is greater than 0 because s->data_offset is
greater than 0), just return 0 for unallocated sectors and -errno in
case of error. This should then be propagated by bochs_read(), the sole
user of seek_to_sector().

That function also has a case of "return -1 in case of error", which is
fixed by this patch as well.

bochs_read() is called by bochs_co_read() which passes the return value
through, therefore it is indeed correct for bochs_read() to return
-errno.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Check min_size in qcow2_grow_l1_table()
Max Reitz [Tue, 29 Apr 2014 17:03:14 +0000 (19:03 +0200)]
qcow2: Check min_size in qcow2_grow_l1_table()

First, new_l1_size is an int64_t, whereas min_size is a uint64_t.
Therefore, during the loop which adjusts new_l1_size until it equals or
exceeds min_size, new_l1_size might overflow and become negative. The
comparison in the loop condition however will take it as an unsigned
value (because min_size is unsigned) and therefore recognize it as
exceeding min_size. Therefore, the loop is left with a negative
new_l1_size, which is not correct. This could be fixed by making
new_l1_size uint64_t.

On the other hand, however, by doing this, the while loop may take
forever. If min_size is e.g. UINT64_MAX, it will take new_l1_size
probably multiple overflows to reach the exact same value (if it reaches
it at all). Then, right after the loop, new_l1_size will be recognized
as being too big anyway.

Both problems require a ridiculously high min_size value, which is very
unlikely to occur; but both problems are also simply avoided by checking
whether min_size is sane before calculating new_l1_size (which should
still be checked separately, though).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Catch bdrv_getlength() error
Max Reitz [Tue, 29 Apr 2014 17:03:13 +0000 (19:03 +0200)]
qcow2: Catch bdrv_getlength() error

The call to bdrv_getlength() from qcow2_check_refcounts() may result in
an error. Check this and abort if necessary.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Use correct width in format strings
Max Reitz [Tue, 29 Apr 2014 17:03:12 +0000 (19:03 +0200)]
block: Use correct width in format strings

Instead of blindly relying on a normal integer having a width of 32 bits
(which is a pretty good assumption, but we should not rely on it if
there is no need), use the correct format string macros.

This does not touch DEBUG output.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Avoid overflow in alloc_clusters_noref()
Max Reitz [Tue, 29 Apr 2014 17:03:11 +0000 (19:03 +0200)]
qcow2: Avoid overflow in alloc_clusters_noref()

alloc_clusters_noref() stores the cluster index in a uint64_t. However,
offsets are often represented as int64_t (as for example the return
value of alloc_clusters_noref() itself demonstrates). Therefore, we
should make sure all offsets in the allocated range of clusters are
representable using int64_t without overflows.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoppc: use kvm_vcpu_enable_cap()
Cornelia Huck [Wed, 9 Apr 2014 15:21:57 +0000 (17:21 +0200)]
ppc: use kvm_vcpu_enable_cap()

Convert existing users of KVM_ENABLE_CAP to new helper.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x: use kvm_vcpu_enable_cap()
Cornelia Huck [Wed, 9 Apr 2014 15:23:34 +0000 (17:23 +0200)]
s390x: use kvm_vcpu_enable_cap()

Make kvm_s390_enable_css_support() use new interface.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agokvm: add kvm_{vm,vcpu}_enable_cap
Cornelia Huck [Wed, 23 Oct 2013 16:19:26 +0000 (18:19 +0200)]
kvm: add kvm_{vm,vcpu}_enable_cap

Provide helper functions for enabling capabilities (on a vcpu and on a vm).

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agoblock: Use error_abort in bdrv_image_info_specific_dump()
Max Reitz [Tue, 29 Apr 2014 16:32:25 +0000 (18:32 +0200)]
block: Use error_abort in bdrv_image_info_specific_dump()

Currently, bdrv_image_info_specific_dump() uses an error variable for
visit_type_ImageInfoSpecific, but ignores the result. As this function
is used here with an output visitor to transform the ImageInfoSpecific
object to a generic QDict, an error should actually be impossible. It is
however better to assert that this is indeed the case. This is done by
this patch using error_abort instead of an unused local Error variable.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Fix open_flags in bdrv_reopen()
Kevin Wolf [Fri, 25 Apr 2014 17:04:55 +0000 (19:04 +0200)]
block: Fix open_flags in bdrv_reopen()

Use the same function as bdrv_open() for determining what the right
flags for bs->file are. Without doing this, a reopen means that
bs->file loses BDRV_O_CACHE_WB or BDRV_O_UNMAP if bs doesn't have it as
well.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoRevert "block: another bdrv_append fix"
Kevin Wolf [Fri, 25 Apr 2014 10:36:07 +0000 (12:36 +0200)]
Revert "block: another bdrv_append fix"

This reverts commit 3a389e7926750cba5c83f662b1941888b2bebc04. The commit
was wrong and what it tried to fix just works today without any change.

What the commit tried to fix:

    When creating live snapshots, the new image file is opened with
    BDRV_O_NO_BACKING because the whole backing chain is already opened.
    It is then appended to the chain using bdrv_append(). The result of
    this was that the image had a backing file, but BDRV_O_NO_BACKING
    was still set. This is obviously inconsistent.

    There used to be some places in qemu that closed and image and then
    opened it again, with its old flags (a bdrv_open()/close() sequence
    involves reopening the whole backing file chain, too). In this case
    the BDRV_O_NO_BACKING flag meant that the backing chain wasn't
    reopened and only the top layer was left.

    (Most, but not all of these places are replaced by bdrv_reopen()
    today, which doesn't touch the backing files at all.)

    Other places that looked at bs->open_flags weren't interested in
    BDRV_O_NO_BACKING, so no breakage there.

What it actually did:

    The commit moved the BDRV_O_NO_BACKING away to the backing file.
    Because the bdrv_open()/close() sequences only looked at the flags
    of the top level BlockDriverState and used it for the whole chain,
    the flag didn't hurt there any more. Obviously, it is still
    inconsistent because the backing file may have another backing file,
    but without practical impact.

    At the same time, it swapped all other flags. This is practically
    irrelevant as long as live snapshots only allow opening the new
    layer with the same flags as the old top layer. It still doesn't
    make any sense, and it is a time bomb that explodes as soon as the
    flags can differ.

    bdrv_append_temp_snapshot() is such a case: It adds the new flag
    BDRV_O_TEMPORARY for the temporary snapshot. The swapping of commit
    3a389e79 results in the following nonsensical configuration:

    bs->open_flags:                     BDRV_O_TEMPORARY cleared
    bs->file->open_flags:               BDRV_O_TEMPORARY set
    bs->backing_hd->open_flags:         BDRV_O_TEMPORARY set
    bs->backing_hd->file->open_flags:   BDRV_O_TEMPORARY cleared

    We're still lucky because the format layer ignores the flag and the
    protocol layer happens to get the right value, but sooner or later
    this is bound to go wrong...

What the right fix would have been:

    Simply clear the BDRV_O_NO_BACKING flag when the BlockDriverState is
    appended to an existing backing file chain, because now it does have
    a backing file.

    Commit 4ddc07ca already implemented this silently in bdrv_append(),
    so we don't have to come up with a new fix.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Unlink temporary files in raw-posix/win32
Kevin Wolf [Fri, 11 Apr 2014 17:16:36 +0000 (19:16 +0200)]
block: Unlink temporary files in raw-posix/win32

Instead of having unlink() calls in the generic block layer, where we
aren't even guarateed to have a file name, move them to those block
drivers that are actually used and that always have a filename. Gets us
rid of some #ifdefs as well.

The patch also converts bs->is_temporary to a new BDRV_O_TEMPORARY open
flag so that it is inherited in the protocol layer and the raw-posix and
raw-win32 drivers can unlink the file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Remove BDRV_O_COPY_ON_READ for bs->file
Kevin Wolf [Fri, 11 Apr 2014 19:36:45 +0000 (21:36 +0200)]
block: Remove BDRV_O_COPY_ON_READ for bs->file

Copy on Read makes sense on the format level where backing files are
implemented, but it's not required on the protocol level. While it
shouldn't actively break anything to have COR enabled on both layers,
needless serialisation and allocation checks may impact performance.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Create bdrv_backing_flags()
Kevin Wolf [Fri, 25 Apr 2014 11:27:34 +0000 (13:27 +0200)]
block: Create bdrv_backing_flags()

Instead of manipulation flags inline, move the derivation of the flags
of a backing file into a new function next to the existing functions
that derive flags for bs->file and for the block driver open function.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoblock: Create bdrv_inherited_flags()
Kevin Wolf [Fri, 11 Apr 2014 19:29:52 +0000 (21:29 +0200)]
block: Create bdrv_inherited_flags()

Instead of having bdrv_open_flags() as a function that creates flags for
several unrelated places and then adding open-coded flags on top, create
a new function that derives the flags for bs->file from the flags for bs.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
10 years agoiotests: Discarding compressed clusters on qcow2
Max Reitz [Tue, 29 Apr 2014 14:12:31 +0000 (16:12 +0200)]
iotests: Discarding compressed clusters on qcow2

Add a test which discards a compressed cluster on qcow2. This should
work without any problems.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Fix discard
Max Reitz [Tue, 29 Apr 2014 14:12:30 +0000 (16:12 +0200)]
qcow2: Fix discard

discard_single_l2() should not implement its own version of
qcow2_get_cluster_type(), but rather rely on this already existing
function. By doing so, it will work for compressed clusters as well
(which it did not so far).

Also, rename "old_offset" to "old_l2_entry", as both are quite different
(and the value is indeed of the latter kind).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: qemu-iotests: make test 019 and 086 work with spaced pathnames
Jeff Cody [Thu, 10 Apr 2014 20:47:40 +0000 (16:47 -0400)]
block: qemu-iotests: make test 019 and 086 work with spaced pathnames

Both tests 019 and 086 need proper quotations to work with pathnames
that contain spaces.

Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: qemu-iotests - fix image cleanup when using spaced pathnames
Jeff Cody [Thu, 10 Apr 2014 20:47:39 +0000 (16:47 -0400)]
block: qemu-iotests - fix image cleanup when using spaced pathnames

The _rm_test_img() function in common.rc did not quote the image
file, which left droppings in the scratch directory (and performed
a potentially unsafe rm -f).

This adds the necessary quotes.

Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/rth/tags/tcg-sparc-pull-20140428' into staging
Peter Maydell [Tue, 29 Apr 2014 12:03:25 +0000 (13:03 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/tcg-sparc-pull-20140428' into staging

TCG sparc backend update for 20140428

# gpg: Signature made Mon 28 Apr 2014 19:36:55 BST using RSA key ID 4DD0279B
# gpg: Can't check signature: public key not found

* remotes/rth/tags/tcg-sparc-pull-20140428:
  tcg-sparc: Accept stores of zero
  tcg-sparc: Fix small 32-bit movi
  tcg-sparc: Fixup function argument types
  tcg-sparc: Hoist common argument loads in tcg_out_op
  tcg-sparc: Don't handle mov/movi in tcg_out_op
  tcg-sparc: Tidy check_fit_* tests
  tcg-sparc: Implement muls2_i32
  tcg-sparc: Use the RETURN instruction
  tcg-sparc: Use 64-bit registers with sparcv8plus
  tcg-sparc: Support trunc_shr_i32
  tcg-sparc: Remove most uses of TCG_TARGET_REG_BITS
  tcg: Add INDEX_op_trunc_shr_i32
  tcg: Fix missed pointer size != TCG_TARGET_REG_BITS changes

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agomirror: Check for bdrv_get_info result
Fam Zheng [Tue, 29 Apr 2014 10:14:17 +0000 (18:14 +0800)]
mirror: Check for bdrv_get_info result

bdrv_get_info could fail. Add check before using the returned value.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agomirror: Fix resource leak when bdrv_getlength fails
Fam Zheng [Tue, 29 Apr 2014 10:09:09 +0000 (18:09 +0800)]
mirror: Fix resource leak when bdrv_getlength fails

The direct return will skip releasing of all the resouces at
immediate_exit, don't miss that.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Ignore duplicate or NULL format_name in bdrv_iterate_format
Jeff Cody [Mon, 28 Apr 2014 22:29:54 +0000 (18:29 -0400)]
block: Ignore duplicate or NULL format_name in bdrv_iterate_format

Some block drivers have multiple BlockDriver instances with identical
format_name fields (e.g. gluster, nbd).

Both qemu-img and qemu will use bdrv_iterate_format() to list the
supported formats when a help option is invoked.  As protocols and
formats may register multiple drivers, redundant listings of formats
occur (e.g., "Supported formats: ... gluster gluster gluster gluster ...
").

Since the list of driver formats will be small, this performs a simple
linear search on format_name, and ignores any duplicates.

The end result change is that the iterator will no longer receive
duplicate string names, nor will it receive NULL pointers.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosdl2: Support mouse wheel
Cole Robinson [Mon, 21 Apr 2014 22:58:50 +0000 (18:58 -0400)]
sdl2: Support mouse wheel

In SDL2, wheel movement is its own event, not a button event. Wire
it up similar to gtk.c

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agosdl2: add ui info setting.
Dave Airlie [Tue, 25 Mar 2014 06:50:36 +0000 (16:50 +1000)]
sdl2: add ui info setting.

Allows you to resize the sdl2 window and have the guest notice.

[ kraxel: zero-initialize QemuUIInfo ]

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agogtk: Fix accelerators being triggered twice with gtk3
Cole Robinson [Thu, 24 Apr 2014 17:35:56 +0000 (13:35 -0400)]
gtk: Fix accelerators being triggered twice with gtk3

When keyboard focus is grabbed, current qemu wants to pass every
keypress to the VM, unless the user is pressing a UI accelerator.

That's exactly how things work without any of the fancy handling. Drop
the special handling, which seems to trigger accelerators twice on gtk3.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agogtk: Fix -serial vc
Cole Robinson [Thu, 24 Apr 2014 17:35:54 +0000 (13:35 -0400)]
gtk: Fix -serial vc

Try kicking off a rhel5 text install over serial, the text menu navigation
is all messed up, and some of the kernel boot messages are randomly
corrupted.

Drop use of a pty and just use vte infrastructure for reading and writing.
This fixes the above corruption, and is simpler to boot.

(I don't know what was wrong with the original code though. FWIW this is
what virt-manager has done for years).

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agogtk: Use ctrl+alt+q for quit accelerator
Cole Robinson [Mon, 17 Mar 2014 20:06:27 +0000 (16:06 -0400)]
gtk: Use ctrl+alt+q for quit accelerator

Using the standard ctrl+q makes it too easy to kill the whole VM. Using
ctrl+alt+FOO is consistent with our other accelerators.

https://bugzilla.redhat.com/show_bug.cgi?id=1062393
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agogtk: Remove use of deprecated stock items
Cole Robinson [Mon, 17 Mar 2014 20:06:26 +0000 (16:06 -0400)]
gtk: Remove use of deprecated stock items

Stock items are deprecated. As are ImageMenuItems. Convert everything to
text only MenuItems, with the same text content as mentioned in the
conversion guide:

https://docs.google.com/spreadsheet/pub?key=0AsPAM3pPwxagdGF4THNMMUpjUW5xMXZfdUNzMXhEa2c&output=html

gtk2 users lose their menu icons as well, but I don't think that's enough
of a problem to warrant keeping around back compat code.

Example error:

ui/gtk.c:1328:5: error: ‘GtkStock’ is deprecated [-Werror=deprecated-declarations]
ui/gtk.c:1335:5: error: ‘gtk_image_menu_item_new_from_stock’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:78): Use 'gtk_menu_item_new' instead [-Werror=deprecated-declarations]
     s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL);

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agogtk: Don't use deprecated vte_terminal_get_adjustment
Cole Robinson [Mon, 17 Mar 2014 20:06:25 +0000 (16:06 -0400)]
gtk: Don't use deprecated vte_terminal_get_adjustment

Guard this with a VTE version check, since I'm not sure if this is backwards
compatible.

ui/gtk.c: In function ‘gd_vc_init’:
ui/gtk.c:1176:5: error: ‘vte_terminal_get_adjustment’ is deprecated (declared at /usr/include/vte-2.90/vte/vtedeprecated.h:101) [-Werror=deprecated-declarations]

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agogtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic
Cole Robinson [Mon, 17 Mar 2014 20:06:24 +0000 (16:06 -0400)]
gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic

In these cases we weren't using an image in the menu item anyways, so
just do as the suggestion says. Should be fine for all qemu supported
gtk versions.

ui/gtk.c: In function ‘gd_create_menu_machine’:
ui/gtk.c:1284:5: error: ‘gtk_image_menu_item_new_with_mnemonic’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:76): Use 'gtk_menu_item_new_with_mnemonic' instead [-Werror=deprecated-declarations]
     s->reset_item = gtk_image_menu_item_new_with_mnemonic(_("_Reset"));
     ^
ui/gtk.c:1287:5: error: ‘gtk_image_menu_item_new_with_mnemonic’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:76): Use 'gtk_menu_item_new_with_mnemonic' instead [-Werror=deprecated-declarations]
     s->powerdown_item = gtk_image_menu_item_new_with_mnemonic(_("Power _Down"));

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoconfigure: Re-run make if gtkabi/sdlabi is changed
Cole Robinson [Thu, 24 Apr 2014 17:35:52 +0000 (13:35 -0400)]
configure: Re-run make if gtkabi/sdlabi is changed

Reconfiguring with a different --with-gtkabi or --with-sdlabi doesn't
trigger a remake. Generate an (unused) CONFIG_GTKABI/CONFIG_SDLABI
so config-host.h will actually give 'make' something to trigger on.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoconfigure: Document --with-gtkabi
Cole Robinson [Mon, 17 Mar 2014 20:06:23 +0000 (16:06 -0400)]
configure: Document --with-gtkabi

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agohda-audio: fix non-mixer codecs
Gerd Hoffmann [Thu, 17 Apr 2014 10:43:26 +0000 (12:43 +0200)]
hda-audio: fix non-mixer codecs

They don't advertise mixer support, but still allow the guest change
mixer settings.  Add a check to avoid it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoblock: Add '--version' option to qemu-img
Jeff Cody [Mon, 28 Apr 2014 18:37:18 +0000 (14:37 -0400)]
block: Add '--version' option to qemu-img

This allows qemu-img to print out version information, without
needing to print the long help wall of text.

While there, perform some minor whitespace cleanup, and remove the
unused option_index variable in the call to getopt_long().

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agotcg-sparc: Accept stores of zero
Richard Henderson [Mon, 17 Mar 2014 18:10:59 +0000 (11:10 -0700)]
tcg-sparc: Accept stores of zero

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-sparc: Fix small 32-bit movi
Richard Henderson [Fri, 7 Mar 2014 00:06:24 +0000 (16:06 -0800)]
tcg-sparc: Fix small 32-bit movi

We tested imm13 before discarding garbage high bits.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-sparc: Fixup function argument types
Richard Henderson [Thu, 6 Mar 2014 23:12:48 +0000 (15:12 -0800)]
tcg-sparc: Fixup function argument types

Use TCGReg everywhere appropriate.  Use int32_t for all arguments
that may be registers or immediate constants.  Merge tcg_out_addi
into its only caller.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-sparc: Hoist common argument loads in tcg_out_op
Richard Henderson [Thu, 6 Mar 2014 22:21:26 +0000 (14:21 -0800)]
tcg-sparc: Hoist common argument loads in tcg_out_op

Signed-off-by: Richard Henderson <rth@twiddle.net>