]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 30 Sep 2013 22:15:01 +0000 (17:15 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

pc,pci,virtio fixes and cleanups

This includes pc and pci cleanups and enhancements,
and a virtio-net bugfix related to softmac programming.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Sun 29 Sep 2013 01:51:16 AM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Michael S. Tsirkin (8) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  smbios: Factor out smbios_maybe_add_str()
  smbios: Make multiple -smbios type= accumulate sanely
  smbios: Improve diagnostics for conflicting entries
  smbios: Convert to QemuOpts
  smbios: Normalize smbios_entry_add()'s error handling to exit(1)
  virtio-net: fix up HMP NIC info string on reset
  pci: remove explicit check to 64K ioport size
  piix4: disable io on reset
  piix: use 64 bit window programmed by guest
  q35: use 64 bit window programmed by guest
  pci: add helper to retrieve the 64-bit range
  range: add min/max operations on ranges
  range: add Range to typedefs
  q35: make pci window address/size match guest cfg

Message-id: 1380437951-21788-1-git-send-email-mst@redhat.com

10 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 30 Sep 2013 22:14:49 +0000 (17:14 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Max Reitz (10) and others
# Via Kevin Wolf
* kwolf/for-anthony: (30 commits)
  qcow2: Remove useless count_contiguous_clusters() parameter
  qcow2: COMPRESSED on count_contiguous_clusters
  qcow2: count_contiguous_clusters and compression
  qcow2: Free only newly allocated clusters on error
  qcow2: Always use error path in l2_allocate
  qcow2: Don't put invalid L2 table into cache
  qemu-iotests: Preallocated zero clusters in 061
  qcow2: Correct bitmap size in zero expansion
  qemu-iotests: Quote $TEST_IMG* and $TEST_DIR usage
  qemu-iotests: Add basic ability to use binary sample images
  qemu-iotests: fix qmp.py search path
  block: use DIV_ROUND_UP in bdrv_co_do_readv
  qcow2: Assert against currently impossible overflow
  block: qed - use QEMU_PACKED for on-disk structures
  block: qcow2 - used QEMU_PACKED for on-disk structures
  block: vpc - use QEMU_PACKED for on-disk structures
  block: vdi - use QEMU_PACKED for on-disk structures
  rbd: avoid qemu_rbd_snap_list() memory leaks
  qdict: Extract qdict_extract_subqdict
  block: Fix compiler warning (-Werror=uninitialized)
  ...

Message-id: 1380296370-14523-1-git-send-email-kwolf@redhat.com

10 years agoMerge remote-tracking branch 'sstabellini/xen-2013-09-25' into staging
Anthony Liguori [Mon, 30 Sep 2013 22:14:10 +0000 (17:14 -0500)]
Merge remote-tracking branch 'sstabellini/xen-2013-09-25' into staging

# By Anthony PERARD (2) and Liu, Jinsong (2)
# Via Stefano Stabellini
* sstabellini/xen-2013-09-25:
  xen: Enable cpu-hotplug on xenfv machine.
  xen: Fix vcpu initialization.
  qemu: Add qemu xen logic for Xen HVM S3 resume
  qemu: Adjust qemu wakeup

Message-id: alpine.DEB.2.02.1309251749180.5498@kaball.uk.xensource.com

10 years agoMerge remote-tracking branch 'rth/tcg-ppc-pull' into staging
Anthony Liguori [Mon, 30 Sep 2013 22:14:01 +0000 (17:14 -0500)]
Merge remote-tracking branch 'rth/tcg-ppc-pull' into staging

# By Richard Henderson (19) and Paolo Bonzini (2)
# Via Richard Henderson
* rth/tcg-ppc-pull: (21 commits)
  tcg-ppc64: Implement CONFIG_QEMU_LDST_OPTIMIZATION
  tcg-ppc64: Add _noaddr functions for emitting forward branches
  tcg-ppc64: Streamline tcg_out_tlb_read
  tcg-ppc64: Implement tcg_register_jit
  tcg-ppc64: Handle long offsets better
  tcg-ppc64: Tidy register allocation order
  tcg-ppc64: Look through a constant function descriptor
  tcg-ppc64: Fold constant call address into descriptor load
  tcg-ppc64: Don't load the static chain from TCG
  tcg-ppc64: Avoid code for nop move
  tcg-ppc64: Use tcg_out64
  tcg-ppc64: Use TCG_REG_Rn constants
  tcg-ppc64: More use of TAI and SAI helper macros
  tcg-ppc64: Reformat tcg-target.c
  tcg-ppc: Fix and cleanup tcg_out_tlb_check
  tcg-ppc: Use conditional branch and link to slow path
  tcg-ppc: Cleanup tcg_out_qemu_ld/st_slow_path
  tcg-ppc: Avoid code for nop move
  tcg-ppc: use new return-argument ld/st helpers
  tcg-ppc: fix qemu_ld/qemu_st for AIX ABI
  ...

Message-id: 1380126458-3247-1-git-send-email-rth@twiddle.net

10 years agoMerge remote-tracking branch 'quintela/migration.next' into staging
Anthony Liguori [Mon, 30 Sep 2013 22:13:43 +0000 (17:13 -0500)]
Merge remote-tracking branch 'quintela/migration.next' into staging

# By Isaku Yamahata (4) and others
# Via Juan Quintela
* quintela/migration.next:
  migration: ram_handle_compressed
  arch_init: make is_zero_page accept size
  migration: Fix debug print type
  migration: add version supporting macros for struct pointer
  rdma: constify ram_chunk_{index, start, end}
  rdma: clean up of qemu_rdma_cleanup()
  arch_init: right return for ram_save_iterate
  savevm: fix wrong initialization by ram_control_load_hook
  savevm: add comments for qemu_file_get_error()

Message-id: 1380024203-25897-1-git-send-email-quintela@redhat.com

10 years agoMerge remote-tracking branch 'kraxel/audio.1' into staging
Anthony Liguori [Mon, 30 Sep 2013 22:13:32 +0000 (17:13 -0500)]
Merge remote-tracking branch 'kraxel/audio.1' into staging

# By Bandan Das (3) and Gerd Hoffmann (1)
# Via Gerd Hoffmann
* kraxel/audio.1:
  audio: remove CONFIG_MIXEMU configure option
  hda-codec: make mixemu selectable at runtime
  hda-codec: refactor common definitions into a header file
  audio maintainers update

Message-id: 1380011943-15083-1-git-send-email-kraxel@redhat.com

10 years agoMerge remote-tracking branch 'borntraeger/tags/s390-next-20130924' into staging
Anthony Liguori [Mon, 30 Sep 2013 22:13:18 +0000 (17:13 -0500)]
Merge remote-tracking branch 'borntraeger/tags/s390-next-20130924' into staging

This is a bunch of fixes/changes for the s390 architecture. It also
contains the fixes from the previous pull request, which did not make
it yet.
Overall it contains
- a fix for kexec without kdump (which uses diag308 subcode 0 instead of 1)
- several sclp related fixes
- some initial sclp migration code
- the sclp line mode console
- A fix for a boot problem with the virtio ccw ipl bios
- zeroed out padding bytes for the notes section of dump-guest-memory
- some cleanups

# gpg: Signature made Tue 24 Sep 2013 02:18:44 AM CDT using RSA key ID B5A61C7C
# gpg: Can't check signature: public key not found

# By Christian Borntraeger (6) and others
# Via Christian Borntraeger
* borntraeger/tags/s390-next-20130924:
  s390/sclplmconsole: Add support for SCLP line-mode console
  s390/ebcdic: Move conversion tables to header file
  s390/eventfacility: allow childs to handle more than 1 event type
  s390/eventfacility: remove unused event_type variable
  s390/eventfacility: Fix receive/send masks
  s390/eventfacility: fix multiple Read Event Data sources
  s390/sclp: add reset() functions
  s390/sclpquiesce: Add code to support live migration
  s390/sclpconsole: Add code to support live migration for sclpconsole
  s390/sclpconsole: modify definition of input buffer
  s390/kexec: Implement diag308 subcode 0
  s390/ioinst: Moved the CC setting to the IO instruction handlers
  s390/cpu: Make setcc() function available to other files
  s390/ipl: Update the s390-ccw.img rom
  s390/ipl: Fix waiting for virtio processing
  s390/dump: zero out padding bytes in notes sections
  s390/kvm: Add check for priviledged SCLP handler

Message-id: 1380007671-18976-1-git-send-email-borntraeger@de.ibm.com

10 years agosmbios: Factor out smbios_maybe_add_str()
Markus Armbruster [Fri, 16 Aug 2013 13:18:32 +0000 (15:18 +0200)]
smbios: Factor out smbios_maybe_add_str()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agosmbios: Make multiple -smbios type= accumulate sanely
Markus Armbruster [Fri, 16 Aug 2013 13:18:31 +0000 (15:18 +0200)]
smbios: Make multiple -smbios type= accumulate sanely

Currently, -smbios type=T,NAME=VAL,... adds one field (T,NAME) with
value VAL to fw_cfg for each unique NAME.  If NAME occurs multiple
times, the last one's VAL is used (before the QemuOpts conversion, the
first one was used).

Multiple -smbios can add multiple fields with the same (T, NAME).
SeaBIOS reads all of them from fw_cfg, but uses only the first field
(T, NAME).  The others are ignored.

"First one wins, subsequent ones get ignored silently" isn't nice.  We
commonly let the last option win.  Useful, because it lets you
-readconfig first, then selectively override with command line
options.

Clean up -smbios to work the common way.  Accumulate the settings,
with later ones overwriting earlier ones.  Put the result into fw_cfg
(no more useless duplicates).

Bonus cleanup: qemu_uuid_parse() no longer sets SMBIOS system uuid by
side effect.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agosmbios: Improve diagnostics for conflicting entries
Markus Armbruster [Fri, 16 Aug 2013 13:18:30 +0000 (15:18 +0200)]
smbios: Improve diagnostics for conflicting entries

We allow either tables or fields for the same type.  Makes sense,
because SeaBIOS uses fields only when no tables are present.

We do this by searching the SMBIOS blob for a previously added table
or field.  Error messages look like this:

    qemu-system-x86_64: -smbios type=1,serial=42: SMBIOS type 1 table already defined, cannot add field

User needs to know that "table" is defined by -smbios file=..., and
"field" by -smbios type=...

Instead of searching the blob, record additions of interest, and check
that.  Simpler, and makes better error messages possible:

    qemu-system-x86_64: -smbios file=smbios_type_1.bin: Can't mix file= and type= for same type
    qemu-system-x86_64: -smbios type=1,serial=42,serial=99: This is the conflicting setting

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agosmbios: Convert to QemuOpts
Markus Armbruster [Fri, 16 Aug 2013 13:18:29 +0000 (15:18 +0200)]
smbios: Convert to QemuOpts

So that it can be set in config file for -readconfig.

This tightens parsing of -smbios, and makes it more consistent with
other options: unknown parameters are rejected, numbers with trailing
junk are rejected, when a parameter is given multiple times, last
rather than first wins, ...

MST: drop one chunk to fix build errors

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agosmbios: Normalize smbios_entry_add()'s error handling to exit(1)
Markus Armbruster [Fri, 16 Aug 2013 13:18:28 +0000 (15:18 +0200)]
smbios: Normalize smbios_entry_add()'s error handling to exit(1)

It exits on all error conditions but one, where it returns -1.
Normalize, and return void.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqcow2: Remove useless count_contiguous_clusters() parameter
Kevin Wolf [Fri, 27 Sep 2013 11:36:11 +0000 (13:36 +0200)]
qcow2: Remove useless count_contiguous_clusters() parameter

All callers pass start = 0, and it's doubtful if any other value would
actually do what you expect. Remove the parameter.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
10 years agoqcow2: COMPRESSED on count_contiguous_clusters
Max Reitz [Fri, 27 Sep 2013 10:14:16 +0000 (12:14 +0200)]
qcow2: COMPRESSED on count_contiguous_clusters

Compressed clusters can never be contiguous, therefore the corresponding
flag does not need to be given explicitly to count_contiguous_clusters.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: count_contiguous_clusters and compression
Max Reitz [Fri, 27 Sep 2013 10:14:15 +0000 (12:14 +0200)]
qcow2: count_contiguous_clusters and compression

The function is not intended to be used on compressed clusters and will
not work correctly, if used anyway, since L2E_OFFSET_MASK is not the
right mask for determining the offset of compressed clusters. Therefore,
assert that the first cluster is not compressed and always include the
compression flag in the mask of significant flags, i.e., stop the search
as soon as a compressed cluster occurs.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Free only newly allocated clusters on error
Max Reitz [Fri, 27 Sep 2013 08:21:48 +0000 (10:21 +0200)]
qcow2: Free only newly allocated clusters on error

In expand_zero_clusters_in_l1, a new cluster is only allocated if it was
not already preallocated. On error, such preallocated clusters should
not be freed, but only the newly allocated ones.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Always use error path in l2_allocate
Max Reitz [Wed, 25 Sep 2013 14:37:20 +0000 (16:37 +0200)]
qcow2: Always use error path in l2_allocate

Just returning -errno in some cases prevents
trace_qcow2_l2_allocate_done from being executed (and, in one case, also
the unused allocated L2 table from being freed). Always going down the
error path fixes this.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Don't put invalid L2 table into cache
Max Reitz [Wed, 25 Sep 2013 14:37:18 +0000 (16:37 +0200)]
qcow2: Don't put invalid L2 table into cache

In l2_allocate, the fail path is executed if qcow2_cache_flush fails.
However, the L2 table has not yet been fetched from the L2 table cache.
The qcow2_cache_put in the fail path therefore basically gives an
undefined argument as the L2 table address (in this case).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Preallocated zero clusters in 061
Max Reitz [Wed, 25 Sep 2013 10:07:23 +0000 (12:07 +0200)]
qemu-iotests: Preallocated zero clusters in 061

Add a test case for zero cluster expansion on an image completely filled
with preallocated zero clusters to test 061.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Correct bitmap size in zero expansion
Max Reitz [Wed, 25 Sep 2013 10:07:22 +0000 (12:07 +0200)]
qcow2: Correct bitmap size in zero expansion

Since the expanded_clusters bitmap is addressed using host offsets in
the underlying image file, the correct size to use for allocating the
bitmap is not determined by the guest disk image but by the underlying
host image file.

Furthermore, this size may change during the expansion due to cluster
allocations on growable image files. In this case, the bitmap needs to
be resized as well to reflect the growth.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Quote $TEST_IMG* and $TEST_DIR usage
Jeff Cody [Wed, 25 Sep 2013 12:12:22 +0000 (08:12 -0400)]
qemu-iotests: Quote $TEST_IMG* and $TEST_DIR usage

A lot of image filename and paths are used unquoted.  Quote these to
make sure that directories / filenames with spaces are not problematic.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Add basic ability to use binary sample images
Jeff Cody [Wed, 25 Sep 2013 12:12:20 +0000 (08:12 -0400)]
qemu-iotests: Add basic ability to use binary sample images

For image formats that are not "QEMU native", but supported for
compatibility, it is useful to verify that an image created with
the 'gold standard' native tool can be read / written to successfully
by QEMU.

In addition to testing non-native images, this could also be useful to
test against image files created by older versions of QEMU.

This provides a directory to store small sample images, for use by
scripts in tests/qemu-iotests.

Image files should be compressed with bzip2.

To use a sample image from a bash script, the _use_sample_img function
will copy and decompress the image into $TEST_DIR, and set $TEST_IMG to
be the decompressed sample image copy.  To cleanup, call
_cleanup_test_img as normal.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: fix qmp.py search path
Fam Zheng [Thu, 26 Sep 2013 11:57:34 +0000 (19:57 +0800)]
qemu-iotests: fix qmp.py search path

QMP/qmp.py is renamed to scripts/qmp/qmp.py, fix the search path in iotests.py.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: use DIV_ROUND_UP in bdrv_co_do_readv
Fam Zheng [Thu, 26 Sep 2013 11:55:33 +0000 (19:55 +0800)]
block: use DIV_ROUND_UP in bdrv_co_do_readv

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Assert against currently impossible overflow
Max Reitz [Wed, 25 Sep 2013 15:48:55 +0000 (17:48 +0200)]
qcow2: Assert against currently impossible overflow

If qcow2_alloc_cluster_link_l2 is called with a QCowL2Meta describing a
request crossing L2 boundaries, a buffer overflow will occur. This is
impossible right now since such requests are never generated (every
request is shortened to L2 boundaries before) and probably also
completely unintended (considering the name "QCowL2Meta"), however, it
is still worth an assertion.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: qed - use QEMU_PACKED for on-disk structures
Jeff Cody [Wed, 25 Sep 2013 16:08:51 +0000 (12:08 -0400)]
block: qed - use QEMU_PACKED for on-disk structures

QEDHeader is read, and written, directly from on-disk images
via bdrv_pread()/write().  To avoid any unintentional padding,
these structs should be packed.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: qcow2 - used QEMU_PACKED for on-disk structures
Jeff Cody [Wed, 25 Sep 2013 16:08:50 +0000 (12:08 -0400)]
block: qcow2 - used QEMU_PACKED for on-disk structures

QCowHeader and QCowExtension are structs that reside in the on-disk
image format, and are read and written directly via bdrv_pread()/write(),
and as such should be packed to avoid any unintentional struct padding.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: vpc - use QEMU_PACKED for on-disk structures
Jeff Cody [Wed, 25 Sep 2013 16:08:49 +0000 (12:08 -0400)]
block: vpc - use QEMU_PACKED for on-disk structures

The VHD footer and header structs (vhd_footer and vhd_dyndisk_header)
are on-disk structures for the image format, and as such should be
packed.

Go ahead and make these typedefs as well, with the preferred QEMU
naming convention, so that the packed attribute is used consistently
with the struct.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: vdi - use QEMU_PACKED for on-disk structures
Jeff Cody [Wed, 25 Sep 2013 16:08:48 +0000 (12:08 -0400)]
block: vdi - use QEMU_PACKED for on-disk structures

The header struct VdiHeader is an on-disk structure for the image
format, and as such should be packed.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoxen: Enable cpu-hotplug on xenfv machine.
Anthony PERARD [Wed, 25 Sep 2013 16:43:12 +0000 (16:43 +0000)]
xen: Enable cpu-hotplug on xenfv machine.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agoxen: Fix vcpu initialization.
Anthony PERARD [Wed, 25 Sep 2013 16:41:48 +0000 (16:41 +0000)]
xen: Fix vcpu initialization.

Each vcpu need a evtchn binded in qemu, even those that are
offline at QEMU initialisation.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agoqemu: Add qemu xen logic for Xen HVM S3 resume
Liu, Jinsong [Wed, 25 Sep 2013 16:40:23 +0000 (16:40 +0000)]
qemu: Add qemu xen logic for Xen HVM S3 resume

This patch is qemu patch 2 to fix Xen HVM S3 bug, adding qemu
xen logic. When qemu wakeup, qemu xen logic is notified and
hypercall to xen hypervisor to unpause domain.

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
10 years agoqemu: Adjust qemu wakeup
Liu, Jinsong [Wed, 25 Sep 2013 16:38:29 +0000 (16:38 +0000)]
qemu: Adjust qemu wakeup

Currently Xen hvm s3 has a bug coming from the difference between
qemu-traditioanl and qemu-xen. For qemu-traditional, the way to
resume from hvm s3 is via 'xl trigger' command. However, for
qemu-xen, the way to resume from hvm s3 inherited from standard
qemu, i.e. via QMP, and it doesn't work under Xen.

The root cause is, for qemu-xen, 'xl trigger' command didn't reset
devices, while QMP didn't unpause hvm domain though they did qemu
system reset.

We have two qemu patches and one xl patch to fix Xen hvm s3 bug.
This patch is the qemu patch 1. It adjusts qemu wakeup so that
Xen s3 resume logic (which will be implemented at qemu patch 2)
will be notified after qemu system reset.

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
10 years agotcg-ppc64: Implement CONFIG_QEMU_LDST_OPTIMIZATION
Richard Henderson [Wed, 31 Jul 2013 23:15:18 +0000 (16:15 -0700)]
tcg-ppc64: Implement CONFIG_QEMU_LDST_OPTIMIZATION

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Add _noaddr functions for emitting forward branches
Richard Henderson [Sat, 31 Aug 2013 00:58:10 +0000 (17:58 -0700)]
tcg-ppc64: Add _noaddr functions for emitting forward branches

... rather than open-coding this stuff through the file.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Streamline tcg_out_tlb_read
Richard Henderson [Wed, 31 Jul 2013 22:11:44 +0000 (15:11 -0700)]
tcg-ppc64: Streamline tcg_out_tlb_read

Less conditional compilation.  Merge an add insn with the indexed
memory load insn.  Load the tlb addend earlier.  Avoid the address
update memory form.

Fix a bug in not allowing large enough tlb offsets for some guests.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Implement tcg_register_jit
Richard Henderson [Sat, 31 Aug 2013 11:44:21 +0000 (04:44 -0700)]
tcg-ppc64: Implement tcg_register_jit

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Handle long offsets better
Richard Henderson [Wed, 31 Jul 2013 18:36:42 +0000 (11:36 -0700)]
tcg-ppc64: Handle long offsets better

Previously we'd only handle 16-bit offsets from memory operand without falling
back to indexed, but it's easy to use ADDIS to handle full 32-bit offsets.

This also lets us unify code that existed inline in tcg_out_op for handling
addition of large constants.

The new R2 temporary was marked reserved for the AIX calling convention, but
the register really is call-clobbered and since tcg generated code has no use
for a TOC, it's available for use.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Tidy register allocation order
Richard Henderson [Wed, 31 Jul 2013 17:18:49 +0000 (10:18 -0700)]
tcg-ppc64: Tidy register allocation order

Remove conditionalization from tcg_target_reg_alloc_order, relying on
reserved_regs to prevent register allocation that shouldn't happen.
So R11 is now present in reg_alloc_order for __APPLE__, but also now
reserved.

Sort reg_alloc_order into call-saved, call-clobbered, and parameters.
This reduces the effect of values getting spilled and reloaded before
function calls.

Whether or not it is reserved, R2 (TOC) is always call-clobbered.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Look through a constant function descriptor
Richard Henderson [Sat, 31 Aug 2013 13:30:45 +0000 (06:30 -0700)]
tcg-ppc64: Look through a constant function descriptor

Especially in the user-only configurations, a direct branch into
the executable may be in range.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Fold constant call address into descriptor load
Richard Henderson [Sat, 31 Aug 2013 13:13:49 +0000 (06:13 -0700)]
tcg-ppc64: Fold constant call address into descriptor load

Eliminates one insn per call:

 :  lis     r2,4165
-:  ori     r2,r2,59616
-:  ld      r0,0(r2)
+:  ld      r0,-5920(r2)
 :  mtctr   r0
-:  ld      r2,8(r2)
+:  ld      r2,-5912(r2)
 :  bctrl

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Don't load the static chain from TCG
Richard Henderson [Wed, 31 Jul 2013 06:14:19 +0000 (23:14 -0700)]
tcg-ppc64: Don't load the static chain from TCG

There are no helpers that require the static chain.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Avoid code for nop move
Richard Henderson [Wed, 31 Jul 2013 04:26:04 +0000 (18:26 -1000)]
tcg-ppc64: Avoid code for nop move

While these are rare from code that's been through the optimizer,
it's not uncommon within the tcg backend.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Use tcg_out64
Richard Henderson [Sat, 31 Aug 2013 12:46:25 +0000 (05:46 -0700)]
tcg-ppc64: Use tcg_out64

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Use TCG_REG_Rn constants
Richard Henderson [Sat, 31 Aug 2013 12:41:45 +0000 (05:41 -0700)]
tcg-ppc64: Use TCG_REG_Rn constants

Instead of bare N, for clarity.  The only (intentional) exception made
is for insns that encode R|0, i.e. when R0 encoded into the insn is
interpreted as zero not the contents of the register.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: More use of TAI and SAI helper macros
Richard Henderson [Sat, 31 Aug 2013 12:23:23 +0000 (05:23 -0700)]
tcg-ppc64: More use of TAI and SAI helper macros

Finish conversion of all memory operations.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Reformat tcg-target.c
Richard Henderson [Sat, 31 Aug 2013 12:14:53 +0000 (05:14 -0700)]
tcg-ppc64: Reformat tcg-target.c

Whitespace and brace changes only.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Fix and cleanup tcg_out_tlb_check
Richard Henderson [Thu, 29 Aug 2013 16:32:20 +0000 (09:32 -0700)]
tcg-ppc: Fix and cleanup tcg_out_tlb_check

The fix is that sparc has so many mmu modes that the last one overflowed
the 16-bit signed offset we assumed would fit.  Handle this, and check
the new assumption at compile time.

Load the tlb addend earlier for the fast path.

Remove the explicit address + addend and make use of index addressing.

Adjust constraints for qemu_ld64 such that we don't clobber the address
register or tlb addend before loading both values.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Use conditional branch and link to slow path
Richard Henderson [Mon, 9 Sep 2013 23:49:36 +0000 (16:49 -0700)]
tcg-ppc: Use conditional branch and link to slow path

Saves one insn per slow path.  Note that we can no longer use
a tail call into the store helper.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Cleanup tcg_out_qemu_ld/st_slow_path
Richard Henderson [Thu, 29 Aug 2013 17:07:24 +0000 (10:07 -0700)]
tcg-ppc: Cleanup tcg_out_qemu_ld/st_slow_path

Coding style fixes.  Use TCGReg enumeration values instead of raw
numbers.  Don't needlessly pull the whole TCGLabelQemuLdst struct
into local variables.  Less conditional compilation.

No functional changes.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Avoid code for nop move
Richard Henderson [Wed, 28 Aug 2013 22:51:08 +0000 (15:51 -0700)]
tcg-ppc: Avoid code for nop move

While these are rare from code that's been through the optimizer,
it's not uncommon within the tcg backend.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: use new return-argument ld/st helpers
Paolo Bonzini [Thu, 5 Sep 2013 08:22:09 +0000 (10:22 +0200)]
tcg-ppc: use new return-argument ld/st helpers

These use a 32-bit load-of-immediate to save a mflr+addi+mtlr sequence.
Tested with a Windows 98 guest (pretty much the most recent thing I
could run on my PPC machine) and kvm-unit-tests's sieve.flat.  The
speed up for sieve.flat is as high as 10% for qemu-system-i386, 25%
(no kidding) for qemu-system-x86_64 on my PowerBook G4.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: fix qemu_ld/qemu_st for AIX ABI
Paolo Bonzini [Thu, 5 Sep 2013 08:22:08 +0000 (10:22 +0200)]
tcg-ppc: fix qemu_ld/qemu_st for AIX ABI

For the AIX ABI, the function pointer and small area pointer need
to be loaded in the trampoline.  The trampoline instead is called
with a normal BL instruction.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agorbd: avoid qemu_rbd_snap_list() memory leaks
Stefan Hajnoczi [Wed, 25 Sep 2013 14:00:48 +0000 (16:00 +0200)]
rbd: avoid qemu_rbd_snap_list() memory leaks

When there are no snapshots qemu_rbd_snap_list() returns 0 and the
snapshot table pointer is NULL.  Don't forget to free the snaps buffer
we allocated for librbd rbd_snap_list().

When the function succeeds don't forget to free the snaps buffer after
calling rbd_snap_list_end().

Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqdict: Extract qdict_extract_subqdict
Benoît Canet [Wed, 25 Sep 2013 11:30:01 +0000 (13:30 +0200)]
qdict: Extract qdict_extract_subqdict

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Fix compiler warning (-Werror=uninitialized)
Stefan Weil [Sun, 22 Sep 2013 06:19:10 +0000 (08:19 +0200)]
block: Fix compiler warning (-Werror=uninitialized)

The patch fixes a warning from gcc (Debian 4.6.3-14+rpi1) 4.6.3:

block/stream.c:141:22: error:
‘copy’ may be used uninitialized in this function [-Werror=uninitialized]

This is not a real bug - a better compiler would not complain.

Now 'copy' has always a defined value, so the check for ret >= 0
can be removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: introduce BlockDriver.bdrv_needs_filename to enable some drivers.
Benoît Canet [Tue, 24 Sep 2013 15:07:04 +0000 (17:07 +0200)]
block: introduce BlockDriver.bdrv_needs_filename to enable some drivers.

Some drivers will have driver specifics options but no filename.
This new bool allow the block layer to treat them correctly.

The .bdrv_needs_filename is set in drivers not having .bdrv_parse_filename and
not having .bdrv_open.

The first exception to this rule will be the quorum driver.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: add monolithicFlat creation test to 059
Fam Zheng [Wed, 25 Sep 2013 09:45:51 +0000 (17:45 +0800)]
qemu-iotests: add monolithicFlat creation test to 059

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: fix test case 059
Fam Zheng [Wed, 25 Sep 2013 09:45:50 +0000 (17:45 +0800)]
qemu-iotests: fix test case 059

Since commit "block: Error parameter for open functions", error output
is more verbose. Update test case output file to follow the change.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovmdk: fix cluster size check for flat extents
Fam Zheng [Mon, 23 Sep 2013 09:18:29 +0000 (17:18 +0800)]
vmdk: fix cluster size check for flat extents

We use the extent size as cluster size for flat extents (where no L1/L2
table is allocated so it's safe) reuse sector calculating code with
sparse extents.

Don't pass in the cluster size for adding flat extent, just set it to
sectors later, then the cluster size checking will not fail.

The cluster_sectors is changed to int64_t to allow big flat extent.

Without this, flat extent opening is broken:

    # qemu-img create -f vmdk -o subformat=monolithicFlat /tmp/a.vmdk 100G
    Formatting '/tmp/a.vmdk', fmt=vmdk size=107374182400 compat6=off subformat='monolithicFlat' zeroed_grain=off
    # qemu-img info /tmp/a.vmdk
    image: /tmp/a.vmdk
    file format: raw
    virtual size: 0 (0 bytes)
    disk size: 4.0K

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/get_block_status: avoid segfault if there is no backing_hd
Peter Lieven [Tue, 24 Sep 2013 13:35:09 +0000 (15:35 +0200)]
block/get_block_status: avoid segfault if there is no backing_hd

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/get_block_status: set *pnum = 0 on error
Peter Lieven [Tue, 24 Sep 2013 13:35:08 +0000 (15:35 +0200)]
block/get_block_status: set *pnum = 0 on error

if the call is invoked through bdrv_is_allocated the caller might
expect *pnum = 0 on error. however, a new implementation of
bdrv_get_block_status might only return a negative exit value on
error while keeping *pnum untouched.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Don't shadow return value
Max Reitz [Tue, 24 Sep 2013 11:50:46 +0000 (13:50 +0200)]
qcow2: Don't shadow return value

When trying to update the refcounts for a snapshot, the return value of
update_refcount on a compressed cluster was pretty much ignored,
cancelling the update on error but returning 0. This is caused by an
inner "ret" variable shadowing the outer one (the latter is used in the
return statement).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Do not execute 052 with -nocache
Max Reitz [Mon, 23 Sep 2013 14:38:33 +0000 (16:38 +0200)]
qemu-iotests: Do not execute 052 with -nocache

Test 052 uses qemu-io -s which will result in bdrv_open trying to create
a temporary snapshot file in /tmp. However, since O_DIRECT and tmpfs
do not work well together, disable this test for -nocache.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: add test for backing file overriding
Fam Zheng [Sun, 22 Sep 2013 12:05:07 +0000 (20:05 +0800)]
qemu-iotests: add test for backing file overriding

Test that backing.file.filename option can be parsed and override the
backing file from image (backing file reflected with "info block").

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: fix backing file overriding
Fam Zheng [Sun, 22 Sep 2013 12:05:06 +0000 (20:05 +0800)]
block: fix backing file overriding

Providing backing.file.filename doesn't override backing file as expected:

    $ x86_64-softmmu/qemu-system-x86_64 -drive \
        file=/tmp/child.qcow2,backing.file.filename=/tmp/fake.qcow2

    qemu-system-x86_64: -drive \
        file=/tmp/child.qcow2,backing.file.filename=/tmp/fake.qcow2: could not
        open disk image /tmp/child.qcow2: Can't specify 'file' and 'filename'
        options at the same time

With

    $ qemu-img info /tmp/child.qcow2
    image: /tmp/child.qcow2
    file format: qcow2
    virtual size: 1.0G (1073741824 bytes)
    disk size: 196K
    cluster_size: 65536
    backing file: /tmp/fake.qcow2

This fixes it by calling bdrv_get_full_backing_filename only if
backing.file.filename is not provided. Also save the backing file name
to bs->backing_file so the information is correct with HMP "info block".

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoconfigure: Allow command-line configure for ppc32
Richard Henderson [Wed, 28 Aug 2013 22:48:21 +0000 (15:48 -0700)]
configure: Allow command-line configure for ppc32

Similar to manually selecting i386 for an x86_64 host.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agomigration: ram_handle_compressed
Isaku Yamahata [Fri, 20 Sep 2013 16:23:37 +0000 (01:23 +0900)]
migration: ram_handle_compressed

ram_handle_compressed() should be aware of size > TARGET_PAGE_SIZE.
migration-rdma can call it with larger size.

Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoarch_init: make is_zero_page accept size
Isaku Yamahata [Fri, 20 Sep 2013 16:23:36 +0000 (01:23 +0900)]
arch_init: make is_zero_page accept size

Later is_zero_page will be used for non TARGET_PAGE_SIZE
range.
And rename it to is_zero_range as it isn't page size any more.

Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agomigration: Fix debug print type
Christoffer Dall [Fri, 23 Aug 2013 17:34:16 +0000 (10:34 -0700)]
migration: Fix debug print type

The printf args are uint64_t and with -Werr QEMU doesn't compile with
migration debugging turned on unless this is fixed.  Fix it.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agomigration: add version supporting macros for struct pointer
Alexey Kardashevskiy [Wed, 4 Sep 2013 04:35:26 +0000 (14:35 +1000)]
migration: add version supporting macros for struct pointer

This adds version supporting macros VMSTATE_STRUCT_POINTER_TEST_V
and VMSTATE_STRUCT_POINTER_V in addition to the already existing
VMSTATE_STRUCT_POINTER and VMSTATE_STRUCT_POINTER_TEST macros.

Cc: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agordma: constify ram_chunk_{index, start, end}
Isaku Yamahata [Wed, 4 Sep 2013 02:32:19 +0000 (11:32 +0900)]
rdma: constify ram_chunk_{index, start, end}

Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agordma: clean up of qemu_rdma_cleanup()
Isaku Yamahata [Tue, 13 Aug 2013 02:12:43 +0000 (11:12 +0900)]
rdma: clean up of qemu_rdma_cleanup()

- It can't be determined by RDMAContext::cm_id != NULL if the connection
  is established or not.
- RDMAContext::cm_id is leaked and not destroyed because it is set to NULL
  too early.
- RDMAContext::qp is created by rdma_create_qp() so that it should be destroyed
  by rdma_destroy_qp(). not ibv_destroy_qp()

Cc: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoarch_init: right return for ram_save_iterate
Lei Li [Wed, 4 Sep 2013 09:02:36 +0000 (17:02 +0800)]
arch_init: right return for ram_save_iterate

qemu_file_rate_limit() never return negative value since the refactor
by Commit 1964a39, this patch gets rid of the negative check for it,
adjust bytes_transferred and return value correspondingly in
ram_save_iterate().

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agosavevm: fix wrong initialization by ram_control_load_hook
Lei Li [Wed, 4 Sep 2013 09:02:35 +0000 (17:02 +0800)]
savevm: fix wrong initialization by ram_control_load_hook

It should set negative error value rather than 0 in QEMUFile
if there has been an error.

Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agosavevm: add comments for qemu_file_get_error()
Lei Li [Wed, 4 Sep 2013 09:02:34 +0000 (17:02 +0800)]
savevm: add comments for qemu_file_get_error()

Add comments for qemu_file_get_error(), as its return value
is not very clear.

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoaudio: remove CONFIG_MIXEMU configure option
Bandan Das [Sat, 7 Sep 2013 04:54:00 +0000 (00:54 -0400)]
audio: remove CONFIG_MIXEMU configure option

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agohda-codec: make mixemu selectable at runtime
Bandan Das [Sat, 7 Sep 2013 04:53:59 +0000 (00:53 -0400)]
hda-codec: make mixemu selectable at runtime

Define PARAM so that we have two versions of the "desc_codec
and family" structs. Add a property called "mixer" whose default
value depends on whether CONFIG_MIXEMU is defined or not which
will help us call the appropriate instance init functions.

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agohda-codec: refactor common definitions into a header file
Bandan Das [Sat, 7 Sep 2013 04:53:58 +0000 (00:53 -0400)]
hda-codec: refactor common definitions into a header file

Move common defines and structs to a header file.
The next commit will include it twice, once for a device with a
mixer, and once for device without a mixer.

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoaudio maintainers update
Gerd Hoffmann [Tue, 24 Sep 2013 08:26:24 +0000 (10:26 +0200)]
audio maintainers update

av1474@comtv.ru bounces, and I havn't seen malc @ qemu-devel for quite a
while (anyone knows what is up?).  Adding myself as audio maintainer, so
audio patches don't fall through the cracks that easily.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agolinux-user: Handle SOCK_CLOEXEC/NONBLOCK if unavailable on host
Edgar E. Iglesias [Mon, 23 Sep 2013 12:11:53 +0000 (14:11 +0200)]
linux-user: Handle SOCK_CLOEXEC/NONBLOCK if unavailable on host

If the host lacks SOCK_CLOEXEC, bail out with -EINVAL.
If the host lacks SOCK_ONONBLOCK, try to emulate it with fcntl()
and O_NONBLOCK.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years ago[v2] linux-user: implement m68k atomic syscalls
Riku Voipio [Wed, 24 Jul 2013 06:44:26 +0000 (09:44 +0300)]
[v2] linux-user: implement m68k atomic syscalls

With nptl enabled, atomic_cmpxchg_32 and atomic_barrier
system calls are needed. This patch enabled really dummy
versions of the system calls, modeled after the m68k
kernel code.

With this patch I am able to execute m68k binaries
with qemu linux-user (busybox compiled for coldfire).

[v2] que an segfault instead of returning a EFAULT
to keep in line with kernel code.

Cc: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Check type of microMIPS break instruction
Kwok Cheung Yeung [Tue, 10 Sep 2013 00:36:40 +0000 (17:36 -0700)]
linux-user: Check type of microMIPS break instruction

microMIPS instructions that cause breakpoint exceptions come in
16-bit and 32-bit variants.  When handling exceptions caused by
such instructions, the instruction type needs to be taken into
account when extracting the break code.

The code has also been restructured for better clarity.

Signed-off-by: Kwok Cheung Yeung <kcy@codesourcery.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: correct how SOL_SOCKET is converted from target to host and back
Petar Jovanovic [Fri, 13 Sep 2013 17:27:29 +0000 (19:27 +0200)]
linux-user: correct how SOL_SOCKET is converted from target to host and back

Previous implementation does not take into account that SOL_SOCKET constant
can be arch specific. This change fixes some issues with sendmsg/recvmsg.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: add support of binfmt_misc 'O' flag
Laurent Vivier [Thu, 29 Aug 2013 23:46:44 +0000 (01:46 +0200)]
linux-user: add support of binfmt_misc 'O' flag

The binfmt_misc module can calculate the credentials and security
token according to the binary instead of to the interpreter if the
'C' flag is enabled.

To be able to execute non-readable binaries, this flag implies 'O'
flag. When 'O' flag is enabled, bintfmt_misc opens the file for
reading and pass the file descriptor to the interpreter.

References:
linux/Documentation/binfmt_misc.txt          ['O' and 'C' description]
linux/fs/binfmt_misc.c linux/fs/binfmt_elf.c [ AT_EXECFD usage ]

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: add some IPV6 commands in setsockop()
Laurent Vivier [Thu, 29 Aug 2013 23:46:43 +0000 (01:46 +0200)]
linux-user: add some IPV6 commands in setsockop()

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: allow use of TIOCGSID
Laurent Vivier [Thu, 29 Aug 2013 23:46:42 +0000 (01:46 +0200)]
linux-user: allow use of TIOCGSID

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Add setsockopt(SO_ATTACH_FILTER)
Laurent Vivier [Thu, 29 Aug 2013 23:46:41 +0000 (01:46 +0200)]
linux-user: Add setsockopt(SO_ATTACH_FILTER)

This is needed to be able to run dhclient.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: convert /proc/net/route when endianess differs
Laurent Vivier [Thu, 29 Aug 2013 23:46:40 +0000 (01:46 +0200)]
linux-user: convert /proc/net/route when endianess differs

This patch allows to have IP addresses in correct order
in the case of "netstat -nr" when the endianess of the
guest differs from one of the host.

For instance, an m68k guest on an x86_64 host:

WITHOUT this patch:

$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         1.3.0.10        0.0.0.0         UG        0 0          0 eth0
0.3.0.10        0.0.0.0         0.255.255.255   U         0 0          0 eth0
$ cat /proc/net/route
Iface Destination Gateway  Flags RefCnt Use Metric Mask MTU Window IRTT

eth0 00000000 0103000A 0003 0 0 0 000000000 0 0
eth0 0003000A 00000000 0001 0 0 0 00FFFFFF0 0 0

WITH this patch:

$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.0.3.1        0.0.0.0         UG        0 0          0 eth0
10.0.3.0        0.0.0.0         255.255.255.0   U         0 0          0 eth0
$ cat /proc/net/route
Iface Destination Gateway  Flags RefCnt Use Metric Mask MTU Window IRTT
eth0 00000000 0a000301 0003 0 0 0 000000000 0 0
eth0 0a000300 00000000 0001 0 0 0 ffffff000 0 0

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agomips-linux-user: Adjust names in mips_syscall_args
Richard Henderson [Wed, 24 Jul 2013 19:50:01 +0000 (09:50 -1000)]
mips-linux-user: Adjust names in mips_syscall_args

The name field of MIPS_SYS isn't actually used; it's just documentation.
But adjust the umount entries to match mips/syscall_nr.h anyway.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoalpha-linux-user: Fix umount syscall numbers
Richard Henderson [Wed, 24 Jul 2013 19:50:00 +0000 (09:50 -1000)]
alpha-linux-user: Fix umount syscall numbers

It has been pointed out on LKML that the alpha umount syscall numbers
are named wrong, and a patch to rectify that has been posted for 3.11.

Glibc works around this by treating NR_umount as NR_umount2 if
NR_oldumount exists.  That's more complicated than we need in QEMU,
given that we control linux-user/*/syscall_nr.h.

This is the last instance of TARGET_NR_oldumount, so delete that from
the strace.list.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Mon, 23 Sep 2013 16:53:22 +0000 (11:53 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

# By Alexey Kardashevskiy
# Via Stefan Hajnoczi
* stefanha/tracing:
  kvm: fix traces to use %x instead of %d

Message-id: 1379699931-5837-1-git-send-email-stefanha@redhat.com

10 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Mon, 23 Sep 2013 16:53:11 +0000 (11:53 -0500)]
Merge remote-tracking branch 'stefanha/net' into staging

# By Aurelien Jarno (1) and Vincenzo Maffione (1)
# Via Stefan Hajnoczi
* stefanha/net:
  e1000: NetClientInfo.receive_iov implemented
  pcnet-pci: mark I/O and MMIO as LITTLE_ENDIAN

Message-id: 1379699613-5338-1-git-send-email-stefanha@redhat.com

10 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Mon, 23 Sep 2013 16:53:05 +0000 (11:53 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Stefan Hajnoczi (4) and others
# Via Stefan Hajnoczi
* stefanha/block:
  virtio-blk: do not relay a previous driver's WCE configuration to the current
  blockdev: do not default cache.no-flush to true
  block: don't lose data from last incomplete sector
  qcow2: Correct snapshots size for overlap check
  coroutine: fix /perf/nesting coroutine benchmark
  coroutine: add qemu_coroutine_yield benchmark
  qemu-timer: do not take the lock in timer_pending
  qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe
  qemu-timer: drop outdated signal safety comments
  osdep: warn if open(O_DIRECT) on fails with EINVAL
  libcacard: link against qemu-error.o for error_report()

Message-id: 1379698931-946-1-git-send-email-stefanha@redhat.com

10 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Mon, 23 Sep 2013 16:52:55 +0000 (11:52 -0500)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

# By Stefan Weil (8) and others
# Via Michael Tokarev
* mjt/trivial-patches:
  tests/.gitignore: ignore test-throttle
  exec: Fix broken build for MinGW (regression)
  kvm: Fix compiler warning (clang)
  tcg-sparc: Fix parenthesis warning
  Makefile: Remove some more files when cleaning
  target-i386: Fix segment cache dump
  iov: avoid "orig_len may be used unitialized" warning
  vscclient: remove unnecessary use of uninitialized variable
  trace-events: Clean up with scripts/cleanup-trace-events.pl again
  tci: Fix qemu-alpha on 32 bit hosts (wrong assertions)
  *-user: Improve documentation for lock_user function
  MAINTAINERS: Add missing entry to filelist for TCI target
  translate-all: Fix formatting of dump output
  *-user: Fix typo in comment (ulocking -> unlocking)
  docs: Fix IO port number for CPU present bitmap.
  q35: Fix typo in constant DEFUALT -> DEFAULT.
  configure: Undefine _FORTIFY_SOURCE prior using it

Message-id: 1379696296-32105-1-git-send-email-mjt@msgid.tls.msk.ru

10 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 23 Sep 2013 16:52:49 +0000 (11:52 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

# By Alexey Kardashevskiy (3) and others
# Via Paolo Bonzini
* qemu-kvm/uq/master:
  target-i386: add feature kvm_pv_unhalt
  linux-headers: update to 3.12-rc1
  target-i386: forward CPUID cache leaves when -cpu host is used
  linux-headers: update to 3.11
  kvm: fix traces to use %x instead of %d
  kvmvapic: Clear also physical ROM address when entering INACTIVE state
  kvmvapic: Enter inactive state on hardware reset
  kvmvapic: Catch invalid ROM size
  kvm irqfd: support direct msimessage to irq translation
  fix steal time MSR vmsd callback to proper opaque type
  kvm: warn if num cpus is greater than num recommended
  cpu: Move cpu state syncs up into cpu_dump_state()
  exec: always use MADV_DONTFORK

Message-id: 1379694292-1601-1-git-send-email-pbonzini@redhat.com

10 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Mon, 23 Sep 2013 16:52:32 +0000 (11:52 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

# By Hervé Poussineau (5) and Stefan Weil (1)
# Via Paolo Bonzini
* bonzini/scsi-next:
  block/iscsi: Drop iscsi_co_get_block_status for older versions of libiscsi
  lsi: add 53C810 variant
  lsi: remove todo
  lsi: ignore write accesses to CTEST0 registers
  lsi: check ssid versus sdid only if ssid is valid
  lsi: use constant name instead of its value

10 years agovirtio-net: fix up HMP NIC info string on reset
Michael S. Tsirkin [Tue, 17 Sep 2013 08:45:36 +0000 (11:45 +0300)]
virtio-net: fix up HMP NIC info string on reset

When mac is updated on reset, info string has stale data.
Fix it up.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agokvm: fix traces to use %x instead of %d
Alexey Kardashevskiy [Wed, 4 Sep 2013 10:26:25 +0000 (20:26 +1000)]
kvm: fix traces to use %x instead of %d

KVM request types are normally defined using hex constants but QEMU traces
print decimal values instead, which is not very convenient.

This changes the request type format from %d to %x.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoe1000: NetClientInfo.receive_iov implemented
Vincenzo Maffione [Thu, 12 Sep 2013 08:47:37 +0000 (10:47 +0200)]
e1000: NetClientInfo.receive_iov implemented

This patch implements the NetClientInfo.receive_iov method for the
e1000 device emulation. In this way a network backend that uses
qemu_sendv_packet() can deliver the fragmented packet without
requiring an additional copy in the frontend/backend network code
(nc_sendv_compat() function).

The existing method NetClientInfo.receive has been reimplemented
using the new method.

Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>