]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
9 years agolinux-user: support SO_PASSSEC setsockopt option
Paul Burton [Sun, 22 Jun 2014 10:25:36 +0000 (11:25 +0100)]
linux-user: support SO_PASSSEC setsockopt option

Translate the SO_PASSSEC option to setsockopt to the host value &
perform the syscall as expected, allowing use of the option by target
programs.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user: support SO_{SND, RCV}BUFFORCE setsockopt options
Paul Burton [Sun, 22 Jun 2014 10:25:35 +0000 (11:25 +0100)]
linux-user: support SO_{SND, RCV}BUFFORCE setsockopt options

Translate the SO_SNDBUFFORCE & SO_RCVBUFFORCE options to setsockopt to
the host values & perform the syscall as expected, allowing use of those
options by target programs.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user: support SO_ACCEPTCONN getsockopt option
Paul Burton [Sun, 22 Jun 2014 10:25:34 +0000 (11:25 +0100)]
linux-user: support SO_ACCEPTCONN getsockopt option

Translate the SO_ACCEPTCONN option to the host value & execute the
syscall as expected.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user: translate the result of getsockopt SO_TYPE
Paul Burton [Sun, 22 Jun 2014 10:25:33 +0000 (11:25 +0100)]
linux-user: translate the result of getsockopt SO_TYPE

QEMU previously passed the result of the host syscall directly to the
target program. This is a problem if the host & target have different
representations of socket types, as is the case when running a MIPS
target program on an x86 host. Introduce a host_to_target_sock_type
helper function mirroring the existing target_to_host_sock_type, and
call it to translate the value provided by getsockopt when called for
the SO_TYPE option.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user: added fake open() for /proc/self/cmdline
Wim Vander Schelden [Wed, 18 Jun 2014 09:02:39 +0000 (11:02 +0200)]
linux-user: added fake open() for /proc/self/cmdline

Signed-off-by: Wim Vander Schelden <wim@fixnum.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agoAdd support for MAP_NORESERVE mmap flag.
Christophe Lyon [Mon, 3 Feb 2014 16:04:32 +0000 (17:04 +0100)]
Add support for MAP_NORESERVE mmap flag.

mmap_flags_tbl contains a list of mmap flags, and how to map them to
the target. This patch adds MAP_NORESERVE, which was missing to the
list.

Signed-off-by: Christophe Lyon <christophe.lyon@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20140627' into staging
Peter Maydell [Sun, 29 Jun 2014 10:43:30 +0000 (11:43 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140627' into staging

A series of patches to the s390-ccw bios:
- code cleanup
- improved error reporting
- most important, support to ipl (boot) from ECKD DASD (CDL, LDL or CMS
  formatted)

# gpg: Signature made Fri 27 Jun 2014 12:03:30 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/s390x-20140627:
  pc-bios/s390-ccw: update binary
  pc-bios/s390-ccw: IPL from LDL/CMS-formatted ECKD DASD
  pc-bios/s390-ccw: IPL from CDL-formatted ECKD DASD
  pc-bios/s390-ccw: factor out ipl code
  pc-bios/s390-ccw: Add fill_hex_val func to provide better msgs
  pc-bios/s390-ccw: Unify error handling
  pc-bios/s390-ccw: add some utility code
  pc-bios/s390-ccw: handle different sector sizes
  pc-bios/s390-ccw: cleanup and enhance bootmap defintions
  pc-bios/s390-ccw: make checkpatch happy

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotcg/ppc: Fix support for 64-bit PPC MacOSX hosts
Peter Maydell [Thu, 26 Jun 2014 15:37:17 +0000 (16:37 +0100)]
tcg/ppc: Fix support for 64-bit PPC MacOSX hosts

Add back in the support for 64-bit PPC MacOSX hosts that was
broken in the recent merge of the 32-bit and 64-bit TCG backends.

Reported-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: Andreas Färber <andreas.faerber@web.de>
9 years agotcg/ppc: Fix failure in tcg_out_mem_long
Richard Henderson [Fri, 27 Jun 2014 04:26:00 +0000 (21:26 -0700)]
tcg/ppc: Fix failure in tcg_out_mem_long

With rt != r0 on loads, we use rt for scratch.  If we need an index
register different from base, we can't use rt, but r0 is usable.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-id: 1403843160-30332-1-git-send-email-rth@twiddle.net
Tested-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agopc-bios/s390-ccw: update binary
Jens Freimann [Tue, 24 Jun 2014 17:26:27 +0000 (19:26 +0200)]
pc-bios/s390-ccw: update binary

Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agopc-bios/s390-ccw: IPL from LDL/CMS-formatted ECKD DASD
Eugene (jno) Dvurechenski [Mon, 19 May 2014 18:14:41 +0000 (20:14 +0200)]
pc-bios/s390-ccw: IPL from LDL/CMS-formatted ECKD DASD

Add code that allows us to start from two further ECKD DASD disk
layouts: LDL (Linux disk layout) and CMS (cms-formatted disk).

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agopc-bios/s390-ccw: IPL from CDL-formatted ECKD DASD
Eugene (jno) Dvurechenski [Mon, 19 May 2014 18:13:41 +0000 (20:13 +0200)]
pc-bios/s390-ccw: IPL from CDL-formatted ECKD DASD

Add code that allows us to start from ECKD DASD using the z/OS
compatible disk layout (CDL), which is the most common format for ECKD
DASD.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agopc-bios/s390-ccw: factor out ipl code
Eugene (jno) Dvurechenski [Mon, 19 May 2014 18:12:43 +0000 (20:12 +0200)]
pc-bios/s390-ccw: factor out ipl code

Move the scsi-disk specific ipl code from zipl_load() into a new
function ipl_scsi(). This makes it easier to add ipl routines for other
disk types.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agopc-bios/s390-ccw: Add fill_hex_val func to provide better msgs
Eugene (jno) Dvurechenski [Mon, 19 May 2014 18:11:55 +0000 (20:11 +0200)]
pc-bios/s390-ccw: Add fill_hex_val func to provide better msgs

Factor out helper function for dumping a hex value into a buffer.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agopc-bios/s390-ccw: Unify error handling
Eugene (jno) Dvurechenski [Mon, 19 May 2014 18:11:07 +0000 (20:11 +0200)]
pc-bios/s390-ccw: Unify error handling

Convert to IPL_assert and friends

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agopc-bios/s390-ccw: add some utility code
Eugene (jno) Dvurechenski [Mon, 19 May 2014 18:09:50 +0000 (20:09 +0200)]
pc-bios/s390-ccw: add some utility code

IPL_assert(term,message) is introduced to handle error conditions.
ebcdic_to_ascii() to convert chars (mostly to print VOLSERs).
read_block() provision for unified block-number handling.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agopc-bios/s390-ccw: handle different sector sizes
Eugene (jno) Dvurechenski [Mon, 19 May 2014 18:10:27 +0000 (20:10 +0200)]
pc-bios/s390-ccw: handle different sector sizes

Use the virtio device's configuration to figure out the disk geometry
and use a sector size based upon the layout.

[CH: s/SECTOR_SIZE/MAX_SECTOR_SIZE/g]
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agopc-bios/s390-ccw: cleanup and enhance bootmap defintions
Eugene (jno) Dvurechenski [Mon, 19 May 2014 18:08:54 +0000 (20:08 +0200)]
pc-bios/s390-ccw: cleanup and enhance bootmap defintions

Add declarations to describe structure of different dasd IPL sources
(eckd and fba). Move the structure definitions to a new header bootmap.h.
While we are at it, change structs to typedefs.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agopc-bios/s390-ccw: make checkpatch happy
Eugene (jno) Dvurechenski [Mon, 19 May 2014 18:05:40 +0000 (20:05 +0200)]
pc-bios/s390-ccw: make checkpatch happy

Remove tabs, tweak whitespace and comments.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agocoroutine-win32.c: Add noinline attribute to work around gcc bug
Peter Maydell [Mon, 23 Jun 2014 14:55:03 +0000 (15:55 +0100)]
coroutine-win32.c: Add noinline attribute to work around gcc bug

A gcc codegen bug in x86_64-w64-mingw32-gcc (GCC) 4.6.3 means that
non-debug builds of QEMU for Windows tend to assert when using
coroutines. Work around this by marking qemu_coroutine_switch
as noinline.

If we allow gcc to inline qemu_coroutine_switch into
coroutine_trampoline, then it hoists the code to get the
address of the TLS variable "current" out of the while() loop.
This is an invalid transformation because the SwitchToFiber()
call may be called when running thread A but return in thread B,
and so we might be in a different thread context each time
round the loop. This can happen quite often.  Typically.
a coroutine is started when a VCPU thread does bdrv_aio_readv:

     VCPU thread

     main VCPU thread coroutine      I/O coroutine
        bdrv_aio_readv ----->
                                     start I/O operation
                                       thread_pool_submit_co
                       <------------ yields
        back to emulation

Then I/O finishes and the thread-pool.c event notifier triggers in
the I/O thread.  event_notifier_ready calls thread_pool_co_cb, and
the I/O coroutine now restarts *in another thread*:

     iothread

     main iothread coroutine         I/O coroutine (formerly in VCPU thread)
        event_notifier_ready
          thread_pool_co_cb ----->   current = I/O coroutine;
                                     call AIO callback

But on Win32, because of the bug, the "current" being set here the
current coroutine of the VCPU thread, not the iothread.

noinline is a good-enough workaround, and quite unlikely to break in
the future.

(Thanks to Paolo Bonzini for assistance in diagnosing the problem
and providing the detailed example/ascii art quoted above.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1403535303-14939-1-git-send-email-peter.maydell@linaro.org
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agoMerge remote-tracking branch 'remotes/afaerber/tags/qom-cpu-for-2.1' into staging
Peter Maydell [Thu, 26 Jun 2014 12:33:11 +0000 (13:33 +0100)]
Merge remote-tracking branch 'remotes/afaerber/tags/qom-cpu-for-2.1' into staging

X86CPU

* Filter out MONITOR for KVM
* Fix filtering for TCG
* -cpu foo,check and -cpu foo,enforce support for TCG
* -cpu host migration support (-cpu host,migratable=no to disable)
* Add invtsc feature support
* New model: Broadwell

# gpg: Signature made Wed 25 Jun 2014 22:55:04 BST using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"

* remotes/afaerber/tags/qom-cpu-for-2.1:
  target-i386: Broadwell CPU model
  target-i386: Fix indentation of CPU model definitions
  target-i386: Support "invariant tsc" flag
  target-i386: block migration and savevm if invariant tsc is exposed
  savevm: check vmsd for migratability status
  target-i386: Set migratable=yes by default on "host" CPU mooel
  target-i386: Add "migratable" property to "host" CPU model
  target-i386: Support check/enforce flags in TCG mode, too
  target-i386: Loop-based feature word filtering in TCG mode
  target-i386: Loop-based copying and setting/unsetting of feature words
  target-i386: Define TCG_*_FEATURES earlier in cpu.c
  target-i386: Filter KVM and 0xC0000001 features on TCG
  target-i386: Filter FEAT_7_0_EBX TCG features too
  target-i386: Make TCG feature filtering more readable
  target-i386: Isolate KVM-specific code on CPU feature filtering logic
  target-i386: Pass FeatureWord argument to report_unavailable_features()
  target-i386: Merge feature filtering/checking functions
  target-i386: Simplify reporting of unavailable features
  target-i386: kvm: Don't enable MONITOR by default on any CPU model

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoqemu-char: initialize chr_write_lock
Paolo Bonzini [Wed, 25 Jun 2014 07:04:57 +0000 (09:04 +0200)]
qemu-char: initialize chr_write_lock

Otherwise, Windows fails with a deadlock.

Reported-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1403679897-11480-1-git-send-email-pbonzini@redhat.com
Tested-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoqemu-char: fix warning 'res' may be used uninitialized
Igor Mammedov [Wed, 25 Jun 2014 08:00:41 +0000 (10:00 +0200)]
qemu-char: fix warning 'res' may be used uninitialized

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-id: 1403683241-20678-1-git-send-email-imammedo@redhat.com
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-i386: Broadwell CPU model
Eduardo Habkost [Tue, 17 Jun 2014 20:11:40 +0000 (17:11 -0300)]
target-i386: Broadwell CPU model

This adds a new CPU model named "Broadwell". It has all the features
from Haswell, plus PREFETCHW, RDSEED, ADX, SMAP.

PREFETCHW was already supported as "3dnowprefetch".

RDSEED, ADX was added on Linux v3.15-rc1.

SMAP was added on Linux v3.15-rc2.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Cc: Wang, Yong Y <yong.y.wang@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Dugger, Donald D <donald.d.dugger@intel.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Fix indentation of CPU model definitions
Eduardo Habkost [Tue, 17 Jun 2014 23:05:29 +0000 (20:05 -0300)]
target-i386: Fix indentation of CPU model definitions

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Support "invariant tsc" flag
Marcelo Tosatti [Wed, 30 Apr 2014 16:48:45 +0000 (13:48 -0300)]
target-i386: Support "invariant tsc" flag

Expose "Invariant TSC" flag, if KVM is enabled. From Intel documentation:

17.13.1 Invariant TSC The time stamp counter in newer processors may
support an enhancement, referred to as invariant TSC. Processor’s
support for invariant TSC is indicated by CPUID.80000007H:EDX[8].
The invariant TSC will run at a constant rate in all ACPI P-, C-.
and T-states. This is the architectural behavior moving forward. On
processors with invariant TSC support, the OS may use the TSC for wall
clock timer services (instead of ACPI or HPET timers). TSC reads are
much more efficient and do not incur the overhead associated with a ring
transition or access to a platform resource.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
[ehabkost: redo feature filtering to use .tcg_features]
[ehabkost: add CPUID_APM_INVTSC macro, add it to .unmigratable_flags]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: block migration and savevm if invariant tsc is exposed
Marcelo Tosatti [Wed, 14 May 2014 19:30:09 +0000 (16:30 -0300)]
target-i386: block migration and savevm if invariant tsc is exposed

Invariant TSC documentation mentions that "invariant TSC will run at a
constant rate in all ACPI P-, C-. and T-states".

This is not the case if migration to a host with different TSC frequency
is allowed, or if savevm is performed. So block migration/savevm.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
[AF+mtosatti: Updated error message]
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agosavevm: check vmsd for migratability status
Marcelo Tosatti [Wed, 14 May 2014 19:30:08 +0000 (16:30 -0300)]
savevm: check vmsd for migratability status

Check vmsd for unmigratable field, allowing migratibility status
to be modified after vmstate_register.

Cc: Juan Quintela <quintela@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Set migratable=yes by default on "host" CPU mooel
Eduardo Habkost [Tue, 17 Jun 2014 20:31:53 +0000 (17:31 -0300)]
target-i386: Set migratable=yes by default on "host" CPU mooel

Having only migratable flags reported by default on the "host" CPU model
is safer for the following reasons:

 * Existing users may expect "-cpu host" to be migration-safe, if they
   take care of always using compatible host CPUs, host kernels, and
   QEMU versions.
 * Users who don't care aboug migration and want to enable all features
   supported by the host kernel can simply change their setup to use
   migratable=no.

Without this change, people using "-cpu host" will stop being able to
migrate, because now "invtsc" is getting enabled by default.

We are not setting migratable=yes by default on all X86CPU subclasses,
because users should be able to get non-migratable features enabled if
they ask for them explicitly.

Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Add "migratable" property to "host" CPU model
Eduardo Habkost [Wed, 30 Apr 2014 16:48:41 +0000 (13:48 -0300)]
target-i386: Add "migratable" property to "host" CPU model

This flag will allow the user to choose between two modes:
 * All flags that can be enabled on the host, even if unmigratable
   (migratable=no);
 * All flags that can be enabled on the host, are known to QEMU
   and migratable (migratable=yes).

The default is still migratable=false, to keep current behavior, but
this will be changed to migratable=true by another patch.

My plan was to support the "migratable" flag on all CPU classes, but
have the default to "false" on all CPU models except "host". However,
DeviceClass has no mechanism to allow a child class to have a different
property default from the parent class yet, so by now only the "host"
CPU model will support the "migratable" flag.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Support check/enforce flags in TCG mode, too
Eduardo Habkost [Wed, 30 Apr 2014 16:48:39 +0000 (13:48 -0300)]
target-i386: Support check/enforce flags in TCG mode, too

If enforce/check is specified in TCG mode, QEMU will ensure all CPU
features are supported by TCG, so no CPU feature is silently disabled.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
[AF: Be explicit about TCG vs. !KVM]
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Loop-based feature word filtering in TCG mode
Eduardo Habkost [Wed, 30 Apr 2014 16:48:38 +0000 (13:48 -0300)]
target-i386: Loop-based feature word filtering in TCG mode

Instead of manually filtering each feature word, add a tcg_features
field to FeatureWordInfo, and use that field to filter all feature words
in TCG mode.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Loop-based copying and setting/unsetting of feature words
Eduardo Habkost [Wed, 30 Apr 2014 16:48:37 +0000 (13:48 -0300)]
target-i386: Loop-based copying and setting/unsetting of feature words

Now that we have the feature word arrays, we don't need to manually copy
each array item, we can simply iterate through each feature word.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Define TCG_*_FEATURES earlier in cpu.c
Eduardo Habkost [Wed, 30 Apr 2014 16:48:36 +0000 (13:48 -0300)]
target-i386: Define TCG_*_FEATURES earlier in cpu.c

Those macros will be used in the feature_word_info array data, so need
to be defined earlier.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Filter KVM and 0xC0000001 features on TCG
Eduardo Habkost [Wed, 30 Apr 2014 16:48:35 +0000 (13:48 -0300)]
target-i386: Filter KVM and 0xC0000001 features on TCG

TCG doesn't support any of the feature flags on FEAT_KVM and
FEAT_C000_0001_EDX feature words, so clear all bits on those feature
words.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Filter FEAT_7_0_EBX TCG features too
Eduardo Habkost [Wed, 30 Apr 2014 16:48:34 +0000 (13:48 -0300)]
target-i386: Filter FEAT_7_0_EBX TCG features too

The TCG_7_0_EBX_FEATURES macro was defined but never used (it even had a
typo that was never noticed). Make the existing TCG feature filtering
code use it.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Make TCG feature filtering more readable
Eduardo Habkost [Wed, 30 Apr 2014 16:48:33 +0000 (13:48 -0300)]
target-i386: Make TCG feature filtering more readable

Instead of an #ifdef in the middle of the code, just set
TCG_EXT2_FEATURES to a different value depending on TARGET_X86_64.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Isolate KVM-specific code on CPU feature filtering logic
Eduardo Habkost [Wed, 30 Apr 2014 16:48:32 +0000 (13:48 -0300)]
target-i386: Isolate KVM-specific code on CPU feature filtering logic

This will allow us to re-use the feature filtering logic (and the
check/enforce flag logic) for TCG.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Pass FeatureWord argument to report_unavailable_features()
Eduardo Habkost [Wed, 30 Apr 2014 16:48:31 +0000 (13:48 -0300)]
target-i386: Pass FeatureWord argument to report_unavailable_features()

This will help us simplify the code that calls
report_unavailable_features() later.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Merge feature filtering/checking functions
Eduardo Habkost [Wed, 30 Apr 2014 16:48:30 +0000 (13:48 -0300)]
target-i386: Merge feature filtering/checking functions

Merge filter_features_for_kvm() and kvm_check_features_against_host().

Both functions made exactly the same calculations, the only difference
was that filter_features_for_kvm() changed the bits on cpu->features[],
and kvm_check_features_against_host() did error reporting.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: Simplify reporting of unavailable features
Eduardo Habkost [Wed, 30 Apr 2014 16:48:29 +0000 (13:48 -0300)]
target-i386: Simplify reporting of unavailable features

Instead of checking and calling unavailable_host_feature() once for each
bit, simply call the function (now renamed to
report_unavailable_features()) once for each feature word.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
[AF: Drop unused return value]
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: kvm: Don't enable MONITOR by default on any CPU model
Eduardo Habkost [Wed, 30 Apr 2014 16:48:28 +0000 (13:48 -0300)]
target-i386: kvm: Don't enable MONITOR by default on any CPU model

KVM never supported the MONITOR flag so it doesn't make sense to have it
enabled by default when KVM is enabled.

The rationale here is similar to the cases where it makes sense to have
a feature enabled by default on all CPU models when on KVM mode (e.g.
x2apic). In this case we are having a feature disabled by default for
the same reasons.

In this case we don't need machine-type compat code because it is
currently impossible to run a KVM VM with the MONITOR flag set.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-06-24' into staging
Peter Maydell [Tue, 24 Jun 2014 16:14:57 +0000 (17:14 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-06-24' into staging

trivial patches for 2014-06-24

# gpg: Signature made Tue 24 Jun 2014 17:07:31 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514  66A7 BEE5 9D74 A4C3 D7DB

* remotes/mjt/tags/trivial-patches-2014-06-24:
  Add support for the arm breakpoint syscall
  Increase maximum number of session of the internal TFTP server.
  target-s390x: Remove unused ld_code6() function
  hw/moxie/moxiesim.c: Remove unused moxie_intc_create()
  target-unicore: Remove unused functions
  build-sys: introduce install-prog macro to install&strip binaries and use it
  tcg: mark tcg_out* and tcg_patch* with attribute 'unused'
  rng-random: NULL check not needed before g_free()
  block.c: Remove useless 'buf' variable
  vscclient: Add required headers to fix build on FreeBSD
  target-ppc: Fix compiler warning
  configure: Enable TPM by default, add --disable-tpm
  Fix new typos (found by codespell)
  virtio-serial: remove useless set_config function

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoAdd support for the arm breakpoint syscall
Hunter Laux [Fri, 20 Jun 2014 11:13:14 +0000 (04:13 -0700)]
Add support for the arm breakpoint syscall

OABI arm used a software interrupt(0xef9f0001) for breakpoints.
Since 2005 gdb has used the break instruction(0xe7f001f0) for EABI.
Apparently Steel Bank Common Lisp still uses the swi instruction.

This is the kernel implementation:
http://lxr.free-electrons.com/source/arch/arm/kernel/traps.c#L598

Signed-off-by: Hunter Laux <hunterlaux@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoIncrease maximum number of session of the internal TFTP server.
Bernhard Übelacker [Sat, 21 Jun 2014 13:26:05 +0000 (15:26 +0200)]
Increase maximum number of session of the internal TFTP server.

Grub fails to boot from internal TFTP server when loading more than
3 initrd files.

Grub first opens a session to the TFTP server for every initrd file and
retrieves only the file size for all.
Then it wants to download the content using the old sessions which are
already expired.

Increasing the maximum number of session of the internal TFTP
server avoids this issue.

The error message reads as following:
error: timeout reading
`/boot/ISO.ROOT/BOOTMGR'.

Press any key to continue...

Signed-off-by: Bernhard Übelacker <bernhardu@vr-web.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agotarget-s390x: Remove unused ld_code6() function
Peter Maydell [Mon, 23 Jun 2014 23:06:34 +0000 (00:06 +0100)]
target-s390x: Remove unused ld_code6() function

The ld_code6() function is unused; remove it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agohw/moxie/moxiesim.c: Remove unused moxie_intc_create()
Peter Maydell [Mon, 23 Jun 2014 23:10:09 +0000 (00:10 +0100)]
hw/moxie/moxiesim.c: Remove unused moxie_intc_create()

The function moxie_intc_create() is unused; remove it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agotarget-unicore: Remove unused functions
Peter Maydell [Mon, 23 Jun 2014 23:07:59 +0000 (00:07 +0100)]
target-unicore: Remove unused functions

The functions gen_st64, gen_ld64, gen_mulxy, ucf64_itod and
ucf64_dtoi are all unused; remove them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agobuild-sys: introduce install-prog macro to install&strip binaries and use it
Michael Tokarev [Sun, 22 Jun 2014 06:55:23 +0000 (10:55 +0400)]
build-sys: introduce install-prog macro to install&strip binaries and use it

Use common rule (macro) to install and strip binaries, and use
it in all places where we install binaries, instead of fixing
bugs like 1319493 in every place.
(This fixes https://bugs.launchpad.net/bugs/1319493)

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agotcg: mark tcg_out* and tcg_patch* with attribute 'unused'
Peter Maydell [Sat, 7 Jun 2014 17:08:44 +0000 (18:08 +0100)]
tcg: mark tcg_out* and tcg_patch* with attribute 'unused'

The tcg_out* and tcg_patch* functions are utility routines that may or
may not be used by a particular backend; mark them with the 'unused'
attribute to suppress spurious warnings if they aren't used.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agorng-random: NULL check not needed before g_free()
Eduardo Habkost [Fri, 30 May 2014 20:02:18 +0000 (17:02 -0300)]
rng-random: NULL check not needed before g_free()

g_free() is NULL-safe.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoblock.c: Remove useless 'buf' variable
Chen Gang [Sat, 21 Jun 2014 13:00:44 +0000 (21:00 +0800)]
block.c: Remove useless 'buf' variable

'buf' is not used actually, so remove it and related snprintf() statement.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agovscclient: Add required headers to fix build on FreeBSD
Ed Maste [Wed, 18 Jun 2014 12:58:00 +0000 (08:58 -0400)]
vscclient: Add required headers to fix build on FreeBSD

Signed-off-by: Ed Maste <emaste@freebsd.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agotarget-ppc: Fix compiler warning
Stefan Weil [Tue, 17 Jun 2014 17:18:28 +0000 (19:18 +0200)]
target-ppc: Fix compiler warning

gcc reports a warning which is usually wrong:

target-ppc/dfp_helper.c: In function ‘dfp_get_digit’:
target-ppc/dfp_helper.c:417:1: warning:
 control reaches end of non-void function [-Wreturn-type]

The compiler shows the warning if assert is not marked with the noreturn
attribute or if the code is compiled with -DNDEBUG.

Using g_assert_not_reached better documents the intention and does not
have these problems.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoconfigure: Enable TPM by default, add --disable-tpm
Cole Robinson [Mon, 16 Jun 2014 19:32:47 +0000 (15:32 -0400)]
configure: Enable TPM by default, add --disable-tpm

I don't see why tpm is disabled by default: it doesn't have any
external dependencies, or change default behavior. Leaving it disabled
is just going to cause it to bit rot.

Enable it by default, and add a --disable-tpm option.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoFix new typos (found by codespell)
Stefan Weil [Fri, 13 Jun 2014 18:42:57 +0000 (20:42 +0200)]
Fix new typos (found by codespell)

* accomodate -> accommodate
* aquiring -> acquiring
* beacuse -> because
* loosing -> losing
* prefering -> preferring
* threshhold -> threshold

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agovirtio-serial: remove useless set_config function
Paolo Bonzini [Thu, 12 Jun 2014 09:20:53 +0000 (11:20 +0200)]
virtio-serial: remove useless set_config function

Its only contents are a dead memcpy.  Since it is optional,
drop the function altogether.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20140623' into...
Peter Maydell [Tue, 24 Jun 2014 14:33:42 +0000 (15:33 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20140623' into staging

migration/next for 20140623

# gpg: Signature made Mon 23 Jun 2014 18:18:57 BST using RSA key ID 5872D723
# gpg: Can't check signature: public key not found

* remotes/juanquintela/tags/migration/20140623: (22 commits)
  vmstate: Refactor & increase tests for primitive types
  vmstate: Return error in case of error
  migration: Remove unneeded minimum_version_id_old
  tests: vmstate static checker: add size mismatch inside substructure
  tests: vmstate static checker: add substructure for usb-kbd for hid section
  tests: vmstate static checker: remove Subsections
  tests: vmstate static checker: remove a subsection
  tests: vmstate static checker: remove Description inside Fields
  tests: vmstate static checker: remove Description
  tests: vmstate static checker: remove Fields
  tests: vmstate static checker: change description name
  tests: vmstate static checker: remove last field in a struct
  tests: vmstate static checker: remove a field
  tests: vmstate static checker: remove a section
  tests: vmstate static checker: minimum_version_id check
  tests: vmstate static checker: version mismatch inside a Description
  tests: vmstate static checker: add version error in main section
  tests: vmstate static checker: incompat machine types
  tests: vmstate static checker: add dump1 and dump2 files
  vmstate-static-checker: script to validate vmstate changes
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Tue, 24 Jun 2014 12:06:13 +0000 (13:06 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp: (43 commits)
  monitor: protect event emission
  monitor: protect outbuf and mux_out with mutex
  qemu-char: make writes thread-safe
  qemu-char: move pty_chr_update_read_handler around
  qemu-char: do not call chr_write directly
  qemu-char: introduce qemu_chr_alloc
  qapi event: clean up
  qapi event: convert QUORUM events
  qapi event: convert GUEST_PANICKED
  qapi event: convert BALLOON_CHANGE
  qmp: convert ACPI_DEVICE_OST event
  qapi event: convert SPICE events
  qapi event: convert VNC events
  qapi event: convert NIC_RX_FILTER_CHANGED
  qapi event: convert other BLOCK_JOB events
  qapi event: convert BLOCK_IMAGE_CORRUPTED
  qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR
  qapi event: convert DEVICE_TRAY_MOVED
  qapi event: convert DEVICE_DELETED
  qapi event: convert WATCHDOG
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Tue, 24 Jun 2014 10:14:47 +0000 (11:14 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc,pci,vhost,net fixes, enhancements

Don's patches to limit below-4g ram for pc
Marcel's pcie hotplug rewrite
Gabriel's changes to e1000 auto-negotiation
qemu char bugfixes by Stefan
misc bugfixes

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 23 Jun 2014 16:25:19 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream: (23 commits)
  xen-hvm: Handle machine opt max-ram-below-4g
  pc & q35: Add new machine opt max-ram-below-4g
  xen-hvm: Fix xen_hvm_init() to adjust pc memory layout
  pcie: coding style tweak
  hw/pcie: better hotplug/hotunplug support
  hw/pcie: implement power controller functionality
  hw/pcie: correct debug message
  q35: Use PC_Q35_COMPAT_1_4 on pc-q35-1.4 compat_props
  virtio-pci: Report an error when msix vectors init fails
  qemu-char: avoid leaking unused fds in tcp_get_msgfds()
  qemu-char: fix qemu_chr_fe_get_msgfd()
  qapi/string-output-visitor: fix human output
  e1000: factor out checking for auto-negotiation availability
  e1000: move e1000_autoneg_timer() to after set_ics()
  e1000: signal guest on successful link auto-negotiation
  e1000: improve auto-negotiation reporting via mii-tool
  e1000: emulate auto-negotiation during external link status change
  qtest: fix vhost-user-test unbalanced mutex locks
  qtest: fix qtest for vhost-user
  libqemustub: add more stubs for qemu-char
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/rth/tcg-ppc-merge-1' into staging
Peter Maydell [Mon, 23 Jun 2014 17:26:58 +0000 (18:26 +0100)]
Merge remote-tracking branch 'remotes/rth/tcg-ppc-merge-1' into staging

* remotes/rth/tcg-ppc-merge-1: (25 commits)
  tcg-ppc: Use the return address as a base pointer
  tcg-ppc: Merge cache-utils into the backend
  qemu/osdep: Remove the need for qemu_init_auxval
  tcg-ppc: Rename the tcg/ppc64 backend
  tcg-ppc: Remove the backend
  tcg-ppc64: Merge ppc32 shifts
  tcg-ppc64: Support mulsh_i32
  tcg-ppc64: Merge ppc32 register usage
  tcg-ppc64: Merge ppc32 qemu_ld/st
  tcg-ppc64: Merge ppc32 brcond2, setcond2, muluh
  tcg-ppc64: Begin merging ppc32 with ppc64
  tcg-ppc64: Fix sub2 implementation
  tcg-ppc64: Merge 32-bit ABIs into the prologue / frame code
  tcg-ppc64: Adjust tcg_out_call for ELFv2
  tcg-ppc64: Support the ppc64 elfv2 ABI
  tcg-ppc64: Use the correct test in tcg_out_call
  tcg-ppc64: Better parameterize the stack frame
  tcg-ppc64: Fix TCG_TARGET_CALL_STACK_OFFSET
  tcg-ppc64: Move call macros out of tcg-target.h
  tcg-ppc64: Make TCG_AREG0 and TCG_REG_CALL_STACK enum constants
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agovmstate: Refactor & increase tests for primitive types
Juan Quintela [Sat, 5 Apr 2014 18:12:51 +0000 (20:12 +0200)]
vmstate: Refactor & increase tests for primitive types

This commit refactor the simple tests to test all integer types. We
move to hex because it is easier to read values of different types.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9 years agovmstate: Return error in case of error
Juan Quintela [Sat, 5 Apr 2014 18:16:22 +0000 (20:16 +0200)]
vmstate: Return error in case of error

If there is an error while loading a field, we should stop reading and
not continue with the rest of fields.  And we should also set an error
in qemu_file.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9 years agomigration: Remove unneeded minimum_version_id_old
Juan Quintela [Tue, 10 Jun 2014 15:04:08 +0000 (17:04 +0200)]
migration: Remove unneeded minimum_version_id_old

Once there, make checkpatch happy.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9 years agotests: vmstate static checker: add size mismatch inside substructure
Amit Shah [Fri, 20 Jun 2014 13:26:25 +0000 (18:56 +0530)]
tests: vmstate static checker: add size mismatch inside substructure

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: add substructure for usb-kbd for hid section
Amit Shah [Fri, 20 Jun 2014 13:26:24 +0000 (18:56 +0530)]
tests: vmstate static checker: add substructure for usb-kbd for hid section

This shows how the script deals with substructures added to vmstate
descriptions that don't change the on-wire format.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: remove Subsections
Amit Shah [Fri, 20 Jun 2014 13:26:23 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Subsections

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: remove a subsection
Amit Shah [Fri, 20 Jun 2014 13:26:22 +0000 (18:56 +0530)]
tests: vmstate static checker: remove a subsection

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: remove Description inside Fields
Amit Shah [Fri, 20 Jun 2014 13:26:21 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Description inside Fields

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: remove Description
Amit Shah [Fri, 20 Jun 2014 13:26:20 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Description

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: remove Fields
Amit Shah [Fri, 20 Jun 2014 13:26:19 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Fields

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: change description name
Amit Shah [Fri, 20 Jun 2014 13:26:18 +0000 (18:56 +0530)]
tests: vmstate static checker: change description name

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: remove last field in a struct
Amit Shah [Fri, 20 Jun 2014 13:26:17 +0000 (18:56 +0530)]
tests: vmstate static checker: remove last field in a struct

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: remove a field
Amit Shah [Fri, 20 Jun 2014 13:26:16 +0000 (18:56 +0530)]
tests: vmstate static checker: remove a field

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: remove a section
Amit Shah [Fri, 20 Jun 2014 13:26:15 +0000 (18:56 +0530)]
tests: vmstate static checker: remove a section

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: minimum_version_id check
Amit Shah [Fri, 20 Jun 2014 13:26:14 +0000 (18:56 +0530)]
tests: vmstate static checker: minimum_version_id check

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: version mismatch inside a Description
Amit Shah [Fri, 20 Jun 2014 13:26:13 +0000 (18:56 +0530)]
tests: vmstate static checker: version mismatch inside a Description

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: add version error in main section
Amit Shah [Fri, 20 Jun 2014 13:26:12 +0000 (18:56 +0530)]
tests: vmstate static checker: add version error in main section

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: incompat machine types
Amit Shah [Fri, 20 Jun 2014 13:26:11 +0000 (18:56 +0530)]
tests: vmstate static checker: incompat machine types

This commit modifies the dump2 data to flag incompatibilities in the
machine types being compared.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agotests: vmstate static checker: add dump1 and dump2 files
Amit Shah [Fri, 20 Jun 2014 13:26:10 +0000 (18:56 +0530)]
tests: vmstate static checker: add dump1 and dump2 files

These are stripped-down JSON data as obtained from the -dump-vmstate
option.  The two files are identical in this commit, and will be
modified in the later commits to show what the script does with the
data.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agovmstate-static-checker: script to validate vmstate changes
Amit Shah [Fri, 20 Jun 2014 13:26:09 +0000 (18:56 +0530)]
vmstate-static-checker: script to validate vmstate changes

This script compares the vmstate dumps in JSON format as output by QEMU
with the -dump-vmstate option.

It flags various errors, like version mismatch, sections going away,
size mismatches, etc.

This script is tolerant of a few changes that do not change the on-wire
format, like embedding a few fields within substructs.

The script takes -s/--src and -d/--dest parameters, to which filenames
are given as arguments.

Example:

(in a qemu 2.0 tree):
./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate qemu-2.0.json

(in a qemu 2.2 tree:)
./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate -M pc-i440fx-2.0 \
   qemu-2.2-m2.0.json

./scripts/vmstate-static-checker.py -s qemu-2.0.json -d qemu-2.2-m2.0.json

The script also takes a --reverse parameter to switch the src and dest
jsons.  This is just a shorthand for reversing the src and dest.

The --help parameter shows usage information.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agomigration: dump vmstate info as a json file for static analysis
Amit Shah [Fri, 20 Jun 2014 13:26:08 +0000 (18:56 +0530)]
migration: dump vmstate info as a json file for static analysis

This commit adds a new command, '-dump-vmstate', that takes a filename
as an argument.  When executed, QEMU will dump the vmstate information
for the machine type it's invoked with to the file, and quit.

The JSON-format output can then be used to compare the vmstate info for
different QEMU versions, specifically to test whether live migration
would break due to changes in the vmstate data.

A Python script that compares the output of such JSON dumps is included
in the following commit.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agordma: bug fixes
Michael R. Hines [Tue, 18 Feb 2014 02:34:06 +0000 (10:34 +0800)]
rdma: bug fixes

1. Fix small memory leak in parsing inet address from command line in data_init()
2. Fix ibv_post_send() return value check and pass error code back up correctly.
3. Fix rdma_destroy_qp() segfault after failure to connect to destination.

Reported-by: frank.yangjie@gmail.com
Reported-by: dgilbert@redhat.com
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20140623-2' into staging
Peter Maydell [Mon, 23 Jun 2014 16:47:28 +0000 (17:47 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140623-2' into staging

A couple of s390-ccw bios bugfixes: Fix booting for some bootmaps and get
the devices to a sane state before running the guest.

# gpg: Signature made Mon 23 Jun 2014 13:22:32 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/s390x-20140623-2:
  pc-bios/s390-ccw: update s390-ccw.img binary
  pc-bios/s390-ccw: fix for fragmented SCSI bootmap
  pc-bios/s390-ccw: do a subsystem reset before running the guest
  pc-bios/s390-ccw: virtio_load_direct() can't load max number of sectors

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agomonitor: protect event emission
Paolo Bonzini [Wed, 18 Jun 2014 06:44:00 +0000 (08:44 +0200)]
monitor: protect event emission

Event emission must be protected by a mutex because of access to
the shared rate-limiting state, and to guard against concurrent
monitor "hot-plug" by means of human-monitor-command.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agomonitor: protect outbuf and mux_out with mutex
Paolo Bonzini [Wed, 18 Jun 2014 06:43:59 +0000 (08:43 +0200)]
monitor: protect outbuf and mux_out with mutex

This lets the block layer emit QMP events from outside the I/O thread.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqemu-char: make writes thread-safe
Paolo Bonzini [Wed, 18 Jun 2014 06:43:58 +0000 (08:43 +0200)]
qemu-char: make writes thread-safe

This will let threads other than the I/O thread raise QMP events.

GIOChannel is thread-safe, and send and receive state is usually
well-separated.  The only driver that requires some care is the
pty driver, where some of the state is shared by the read and write
sides.  That state is protected with the chr_write_lock too.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqemu-char: move pty_chr_update_read_handler around
Paolo Bonzini [Wed, 18 Jun 2014 06:43:57 +0000 (08:43 +0200)]
qemu-char: move pty_chr_update_read_handler around

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqemu-char: do not call chr_write directly
Paolo Bonzini [Wed, 18 Jun 2014 06:43:56 +0000 (08:43 +0200)]
qemu-char: do not call chr_write directly

Make the mux always go through qemu_chr_fe_write, so that we'll get
the mutex for the underlying chardev.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqemu-char: introduce qemu_chr_alloc
Paolo Bonzini [Wed, 18 Jun 2014 06:43:55 +0000 (08:43 +0200)]
qemu-char: introduce qemu_chr_alloc

The next patch will modify this function to initialize state that is
common to all backends.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqapi event: clean up
Wenchao Xia [Wed, 18 Jun 2014 06:43:54 +0000 (08:43 +0200)]
qapi event: clean up

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqapi event: convert QUORUM events
Wenchao Xia [Wed, 18 Jun 2014 06:43:53 +0000 (08:43 +0200)]
qapi event: convert QUORUM events

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqapi event: convert GUEST_PANICKED
Wenchao Xia [Wed, 18 Jun 2014 06:43:52 +0000 (08:43 +0200)]
qapi event: convert GUEST_PANICKED

'monitor.h' is still included in target-s390x/kvm.c, since I have
no good way to verify whether other code need it on my x86 host.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqapi event: convert BALLOON_CHANGE
Wenchao Xia [Wed, 18 Jun 2014 06:43:51 +0000 (08:43 +0200)]
qapi event: convert BALLOON_CHANGE

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqmp: convert ACPI_DEVICE_OST event
Igor Mammedov [Mon, 23 Jun 2014 13:26:57 +0000 (15:26 +0200)]
qmp: convert ACPI_DEVICE_OST event

... using new QAPI event infrastructure

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqapi event: convert SPICE events
Wenchao Xia [Wed, 18 Jun 2014 06:43:50 +0000 (08:43 +0200)]
qapi event: convert SPICE events

SPICE_INITIALIZED, SPICE_CONNECTED, SPICE_DISCONNECTED and
SPICE_MIGRATE_COMPLETED are converted in one patch, since they
use some common functions. inet_strfamily() is removed since no
callers exist anymore.

Note that there is no existing doc for SPICE_MIGRATE_COMPLETED
in docs/qmp/qmp-events.txt before this patch.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqapi event: convert VNC events
Wenchao Xia [Wed, 18 Jun 2014 06:43:49 +0000 (08:43 +0200)]
qapi event: convert VNC events

Since VNC_CONNECTED, VNC_DISCONNECTED, VNC_INITIALIZED share some
common functions, convert them in one patch.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqapi event: convert NIC_RX_FILTER_CHANGED
Wenchao Xia [Wed, 18 Jun 2014 06:43:48 +0000 (08:43 +0200)]
qapi event: convert NIC_RX_FILTER_CHANGED

Param name is declared as optional, since in code it is an optional
one.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqapi event: convert other BLOCK_JOB events
Wenchao Xia [Wed, 18 Jun 2014 06:43:47 +0000 (08:43 +0200)]
qapi event: convert other BLOCK_JOB events

Since BLOCK_JOB_COMPLETED, BLOCK_JOB_CANCELLED, BLOCK_JOB_READY are
related, convert them in one patch. The block_job_event_* functions
are used to keep encapsulation of BlockJob structure.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqapi event: convert BLOCK_IMAGE_CORRUPTED
Wenchao Xia [Wed, 18 Jun 2014 06:43:46 +0000 (08:43 +0200)]
qapi event: convert BLOCK_IMAGE_CORRUPTED

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>