sdk/emulator/qemu.git
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Tue, 4 Mar 2014 17:01:07 +0000 (17:01 +0000)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp: (32 commits)
  qapi: Add missing null check to opts_start_struct()
  qapi: Clean up superfluous null check in qapi_dealloc_type_str()
  qapi: Clean up null checking in generated visitors
  qapi: Drop unused code in qapi-commands.py
  qapi: Drop nonsensical header guard in generated qapi-visit.c
  qapi: Fix licensing of scripts
  tests/qapi-schema: Cover flat union types
  tests/qapi-schema: Cover union types with base
  tests/qapi-schema: Cover complex types with base
  tests/qapi-schema: Cover anonymous union types
  tests/qapi-schema: Cover simple argument types
  tests/qapi-schema: Cover optional command arguments
  tests/qapi-schema: Actually check successful QMP command response
  monitor: Remove left-over code in do_info_profile.
  qerror: Improve QERR_DEVICE_NOT_ACTIVE message
  qmp: Check for returned data from __json_read in get_events
  dump: add 'query-dump-guest-memory-capability' command
  Define the architecture for compressed dump format
  dump: make kdump-compressed format available for 'dump-guest-memory'
  dump: add API to write dump pages
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Tue, 4 Mar 2014 16:33:25 +0000 (16:33 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Block pull request

# gpg: Signature made Fri 28 Feb 2014 18:27:24 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# 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: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  block/vmdk: do not report file offset for compressed extents
  discard rbd error output when not relevant in qemu-iotests
  block: use /var/tmp instead of /tmp for -snapshot
  qemu-io-test: Disable Quorum test when not compiled in.
  qmp: Make Quorum error events more palatable.
  qmp: Fix BlockdevOptionQuorum.
  block: gluster - add reopen support.
  block: gluster - code movements, state storage changes
  qemu-iotests: add more tests to the "quick" group

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/rth/i386-fix' into staging
Peter Maydell [Tue, 4 Mar 2014 15:53:00 +0000 (15:53 +0000)]
Merge remote-tracking branch 'remotes/rth/i386-fix' into staging

* remotes/rth/i386-fix:
  target-i386: Fix ucomis and comis memory access
  target-i386: Fix SSE status flag corruption
  target-i386: Fix CC_OP_CLR vs PF

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/borntraeger/tags/kvm-s390-20140227' into staging
Peter Maydell [Tue, 4 Mar 2014 14:50:46 +0000 (14:50 +0000)]
Merge remote-tracking branch 'remotes/borntraeger/tags/kvm-s390-20140227' into staging

Several features, fixes and cleanups for kvm/s390:

- sclp event facility: cleanup structure. This allows to use
  realize/unrealize   as well as migration support via vmsd
- reboot: Two fixes that make reboot much more reliable
- ipl: make elf loading more robust
- flic interrupt controller: This allows to migrate floating
  interrupts, as well as clear them on reset etc.
- enable async_pf feature of KVM on s390
- several sclp fixes and cleanups
- several sigp fixes and cleanups

* remotes/borntraeger/tags/kvm-s390-20140227: (22 commits)
  s390x/ipl: Fix crash of ELF images with arbitrary entry points
  s390x/kvm: Rework priv instruction handlers
  s390x/kvm: Add missing SIGP CPU RESET order
  s390x/kvm: Rework SIGP INITIAL CPU RESET handler
  s390x/cpu: Use ioctl to reset state in the kernel
  s390-ccw.img: new binary rom to match latest fixes
  s390-ccw.img: Fix sporadic errors with ccw boot image - initialize css
  s390-ccw.img: Fix sporadic reboot hangs: Initialize next_idx
  s390x/event-facility: exploit realize/unrealize
  s390x/event-facility: add support for live migration
  s390x/event-facility: code restructure
  s390x/event-facility: some renaming
  s390x/sclp: Fixed setting of condition code register
  s390x/sclp: Add missing checks to SCLP handler
  s390x/sclp: Fixed the size of sccb and code parameter
  s390x/eventfacility: mask out commands
  s390x/virtio-hcall: Specification exception for illegal subcodes
  s390x/virtio-hcall: Add range check for hypervisor call
  s390x/kvm: Fixed bad SIGP SET-ARCHITECTURE handler
  s390x/async_pf: Check for apf extension and enable pfault
  ...

Conflicts:
linux-headers/linux/kvm.h

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/bonzini/scsi-next' into staging
Peter Maydell [Tue, 4 Mar 2014 14:25:34 +0000 (14:25 +0000)]
Merge remote-tracking branch 'remotes/bonzini/scsi-next' into staging

* remotes/bonzini/scsi-next:
  block/iscsi: fix segfault if writesame fails
  scsi-disk: Add support for port WWN and index descriptors in VPD page 83h
  block/iscsi: query for supported VPD pages
  block/iscsi: fix deadlock on scsi check condition
  scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b
  scsi: report thin provisioning errors with werror=report
  scsi: Change scsi sense buf size to 252

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mcayland/qemu-sparc' into staging
Peter Maydell [Tue, 4 Mar 2014 13:09:06 +0000 (13:09 +0000)]
Merge remote-tracking branch 'remotes/mcayland/qemu-sparc' into staging

* remotes/mcayland/qemu-sparc:
  sun4m: Add Sun CG3 framebuffer initialisation function
  sun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM
  sun4m: fix slavio timer RUN/STOP bit
  sun4m: Set HostID in NVRAM

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMakefile: Add missing dependency for system emulation (fix build)
Stefan Weil [Thu, 27 Feb 2014 20:28:03 +0000 (21:28 +0100)]
Makefile: Add missing dependency for system emulation (fix build)

Comment from Makefile.objs:

The system emulation needs this dependency (which was missing in Makefile),
otherwise builds without tools (or massive parallel builds) fail.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoqapi: Add missing null check to opts_start_struct()
Markus Armbruster [Sat, 1 Mar 2014 07:40:39 +0000 (08:40 +0100)]
qapi: Add missing null check to opts_start_struct()

Argument is null when visiting an unboxed struct.  I can't see such a
visit in the current code.  Fix it anyway.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Clean up superfluous null check in qapi_dealloc_type_str()
Markus Armbruster [Sat, 1 Mar 2014 07:40:38 +0000 (08:40 +0100)]
qapi: Clean up superfluous null check in qapi_dealloc_type_str()

Argument can't be null.  No other Visitor method type_str() checks for
null.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Clean up null checking in generated visitors
Markus Armbruster [Sat, 1 Mar 2014 07:40:37 +0000 (08:40 +0100)]
qapi: Clean up null checking in generated visitors

Visitors get passed a pointer to the visited object.  The generated
visitors try to cope with this pointer being null in some places, for
instance like this:

    visit_start_optional(m, obj ? &(*obj)->has_name : NULL, "name", &err);

visit_start_optional() passes its second argument to Visitor method
start_optional.  Three out of three methods dereference it
unconditionally.

I fail to see how this pointer could legitimately be null.

All this useless null checking is highly redundant, which Coverity
duly reports.  About 200 times.

Remove the useless null checks.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Drop unused code in qapi-commands.py
Markus Armbruster [Sat, 1 Mar 2014 07:40:36 +0000 (08:40 +0100)]
qapi: Drop unused code in qapi-commands.py

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Drop nonsensical header guard in generated qapi-visit.c
Markus Armbruster [Sat, 1 Mar 2014 07:40:35 +0000 (08:40 +0100)]
qapi: Drop nonsensical header guard in generated qapi-visit.c

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Fix licensing of scripts
Markus Armbruster [Sat, 1 Mar 2014 07:40:34 +0000 (08:40 +0100)]
qapi: Fix licensing of scripts

The scripts carry this copyright notice:

    # This work is licensed under the terms of the GNU GPLv2.
    # See the COPYING.LIB file in the top-level directory.

The sentences contradict each other, as COPYING.LIB contains the LGPL
2.1.  Michael Roth says this was a simple pasto, and he meant to refer
COPYING.  Let's fix that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotests/qapi-schema: Cover flat union types
Markus Armbruster [Sat, 1 Mar 2014 07:40:33 +0000 (08:40 +0100)]
tests/qapi-schema: Cover flat union types

The test demonstrates a generator bug: the generated struct
UserDefFlatUnion doesn't include members for the indirect base
UserDefZero.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotests/qapi-schema: Cover union types with base
Markus Armbruster [Sat, 1 Mar 2014 07:40:32 +0000 (08:40 +0100)]
tests/qapi-schema: Cover union types with base

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotests/qapi-schema: Cover complex types with base
Markus Armbruster [Sat, 1 Mar 2014 07:40:31 +0000 (08:40 +0100)]
tests/qapi-schema: Cover complex types with base

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotests/qapi-schema: Cover anonymous union types
Markus Armbruster [Sat, 1 Mar 2014 07:40:30 +0000 (08:40 +0100)]
tests/qapi-schema: Cover anonymous union types

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotests/qapi-schema: Cover simple argument types
Markus Armbruster [Sat, 1 Mar 2014 07:40:29 +0000 (08:40 +0100)]
tests/qapi-schema: Cover simple argument types

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotests/qapi-schema: Cover optional command arguments
Markus Armbruster [Sat, 1 Mar 2014 07:40:28 +0000 (08:40 +0100)]
tests/qapi-schema: Cover optional command arguments

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotests/qapi-schema: Actually check successful QMP command response
Markus Armbruster [Sat, 1 Mar 2014 07:40:27 +0000 (08:40 +0100)]
tests/qapi-schema: Actually check successful QMP command response

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: Remove left-over code in do_info_profile.
Hani Benhabiles [Wed, 26 Feb 2014 22:09:52 +0000 (23:09 +0100)]
monitor: Remove left-over code in do_info_profile.

This is a left-over from 4a1418e.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqerror: Improve QERR_DEVICE_NOT_ACTIVE message
Hani Benhabiles [Tue, 25 Feb 2014 07:10:05 +0000 (08:10 +0100)]
qerror: Improve QERR_DEVICE_NOT_ACTIVE message

The error message as currently used is confusing as there are no "balloon" or
"spice" devices.

(qemu) balloon 1024
balloon: Device 'balloon' has not been activated

With this patch:

(qemu) balloon 1024
balloon: No balloon device has been activated

Signed-off-by: Hani Benhabiles <hani@linux.com>
Suggested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqmp: Check for returned data from __json_read in get_events
Fam Zheng [Mon, 24 Feb 2014 05:45:01 +0000 (13:45 +0800)]
qmp: Check for returned data from __json_read in get_events

When QEMU process aborts and socket is closed, qmp client will not
detect it. When this happens, some qemu-iotests scripts will enter an
endless loop waiting for qmp events.

It's better we raise an exception in qmp.py to catch this and make the
test script stop.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoblock/vmdk: do not report file offset for compressed extents
Peter Lieven [Wed, 26 Feb 2014 09:47:57 +0000 (10:47 +0100)]
block/vmdk: do not report file offset for compressed extents

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agodiscard rbd error output when not relevant in qemu-iotests
Loic Dachary [Wed, 8 Jan 2014 20:05:38 +0000 (21:05 +0100)]
discard rbd error output when not relevant in qemu-iotests

Suppress rbd progress messages with --no-progress so they are not
confused with an error output when comparing test results ( progress is
displayed on stderr ).

Signed-off-by: Loic Dachary <loic@dachary.org>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: use /var/tmp instead of /tmp for -snapshot
Amit Shah [Wed, 26 Feb 2014 09:42:37 +0000 (15:12 +0530)]
block: use /var/tmp instead of /tmp for -snapshot

If TMPDIR is not specified, the default was to use /tmp for the working
copy of the block devices.  Update this to /var/tmp instead, so systems
using tmp-on-tmpfs don't end up inadvertently using RAM for the block
device.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-io-test: Disable Quorum test when not compiled in.
Benoît Canet [Sat, 22 Feb 2014 17:43:42 +0000 (18:43 +0100)]
qemu-io-test: Disable Quorum test when not compiled in.

Quorum is not compiled by default: make the quorum 081 test aware of this.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqmp: Make Quorum error events more palatable.
Benoît Canet [Sat, 22 Feb 2014 17:43:41 +0000 (18:43 +0100)]
qmp: Make Quorum error events more palatable.

Insert quorum QMP events documentation alphabetically.

Also change the "ret" errno value by an optional "error" being an strerror(-ret)
in the QUORUM_REPORT_BAD qmp event.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqmp: Fix BlockdevOptionQuorum.
Benoît Canet [Sat, 22 Feb 2014 17:43:40 +0000 (18:43 +0100)]
qmp: Fix BlockdevOptionQuorum.

Fix some nits before QEMU 2.0 freeze.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: gluster - add reopen support.
Jeff Cody [Mon, 17 Feb 2014 16:11:12 +0000 (11:11 -0500)]
block: gluster - add reopen support.

Gluster does parse open flags in its .bdrv_open() implementation,
and the .bdrv_reopen_* implementations need to do the same.

A new gluster connection to the image file to be created is established
in the .bdrv_reopen_prepare(), and the image file opened with the new
flags.

If this is successful, then the old image file is closed, and the
old connection torn down. The relevant structure pointers in the gluster
state structure are updated to the new connection.

If it is not successful, then the new file handle and connection is
abandoned (if it exists), while the old connection is not modified at
all.

With reopen supported, block-commit (and offline commit) is now also
supported for image files whose base image uses the native gluster
protocol driver.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: gluster - code movements, state storage changes
Jeff Cody [Mon, 17 Feb 2014 16:11:11 +0000 (11:11 -0500)]
block: gluster - code movements, state storage changes

In preparation for supporting reopen on gluster, move flag
parsing out to a function.  Also, add a NULL check in the
gconf cleanup.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: add more tests to the "quick" group
Paolo Bonzini [Thu, 20 Feb 2014 17:28:03 +0000 (18:28 +0100)]
qemu-iotests: add more tests to the "quick" group

None of these needs QEMU_PROG, and they all take but a few seconds.
We need to point the launching script to qemu-nbd, though.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agodump: add 'query-dump-guest-memory-capability' command
qiaonuohan [Tue, 18 Feb 2014 06:11:38 +0000 (14:11 +0800)]
dump: add 'query-dump-guest-memory-capability' command

'query-dump-guest-memory-capability' is used to query the available formats for
'dump-guest-memory'. The output of the command will be like:

-> { "execute": "query-dump-guest-memory-capability" }
<- { "return": { "formats":
                    ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoDefine the architecture for compressed dump format
qiaonuohan [Tue, 18 Feb 2014 06:11:37 +0000 (14:11 +0800)]
Define the architecture for compressed dump format

Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: make kdump-compressed format available for 'dump-guest-memory'
qiaonuohan [Tue, 18 Feb 2014 06:11:36 +0000 (14:11 +0800)]
dump: make kdump-compressed format available for 'dump-guest-memory'

Make monitor command 'dump-guest-memory' be able to dump in kdump-compressed
format. The command's usage:

  dump [-p] protocol [begin] [length] [format]

'format' is used to specified the format of vmcore and can be:
1. 'elf': ELF format, without compression
2. 'kdump-zlib': kdump-compressed format, with zlib-compressed
3. 'kdump-lzo': kdump-compressed format, with lzo-compressed
4. 'kdump-snappy': kdump-compressed format, with snappy-compressed
Without 'format' being set, it is same as 'elf'. And if non-elf format is
specified, paging and filter is not allowed.

Note:
  1. The kdump-compressed format is readable only with the crash utility and
     makedumpfile, and it can be smaller than the ELF format because of the
     compression support.
  2. The kdump-compressed format is the 6th edition.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add API to write dump pages
qiaonuohan [Tue, 18 Feb 2014 06:11:35 +0000 (14:11 +0800)]
dump: add API to write dump pages

functions are used to write page to vmcore. vmcore is written page by page.
page desc is used to store the information of a page, including a page's size,
offset, compression format, etc.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add APIs to operate DataCache
qiaonuohan [Tue, 18 Feb 2014 06:11:34 +0000 (14:11 +0800)]
dump: add APIs to operate DataCache

DataCache is used to store data temporarily, then the data will be written to
vmcore. These functions will be called later when writing data of page to
vmcore.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add API to write dump_bitmap
qiaonuohan [Tue, 18 Feb 2014 06:11:33 +0000 (14:11 +0800)]
dump: add API to write dump_bitmap

functions are used to write 1st and 2nd dump_bitmap of kdump-compressed format,
which is used to indicate whether the corresponded page is existed in vmcore.
1st and 2nd dump_bitmap are same, because dump level is specified to 1 here.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add API to write dump header
qiaonuohan [Tue, 18 Feb 2014 06:11:32 +0000 (14:11 +0800)]
dump: add API to write dump header

the functions are used to write header of kdump-compressed format to vmcore.
Header of kdump-compressed format includes:
1. common header: DiskDumpHeader32 / DiskDumpHeader64
2. sub header: KdumpSubHeader32 / KdumpSubHeader64
3. extra information: only elf notes here

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add members to DumpState and init some of them
qiaonuohan [Tue, 18 Feb 2014 06:11:31 +0000 (14:11 +0800)]
dump: add members to DumpState and init some of them

add some members to DumpState that will be used in writing vmcore in
kdump-compressed format. some of them, like page_size, will be initialized
in the patch.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add support for lzo/snappy
qiaonuohan [Tue, 18 Feb 2014 06:11:30 +0000 (14:11 +0800)]
dump: add support for lzo/snappy

kdump-compressed format supports three compression format, zlib/lzo/snappy.
Currently, only zlib is available. This patch is used to support lzo/snappy.
'--enable-lzo/--enable-snappy' is needed to be specified with configure to make
lzo/snappy available for qemu

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add API to write elf notes to buffer
qiaonuohan [Tue, 18 Feb 2014 06:11:29 +0000 (14:11 +0800)]
dump: add API to write elf notes to buffer

the function can be used by write_elf32_notes/write_elf64_notes to write notes
to a buffer. If fd_write_vmcore is used, write_elf32_notes/write_elf64_notes
will write elf notes to vmcore directly. Instead, if buf_write_note is used,
elf notes will be written to opaque->note_buf at first.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add API to write vmcore
qiaonuohan [Tue, 18 Feb 2014 06:11:28 +0000 (14:11 +0800)]
dump: add API to write vmcore

Function is used to write vmcore in flatten format. In flatten format, data is
written block by block, and in front of each block, a struct
MakedumpfileDataHeader is stored there to indicate the offset and size of the
data block.

struct MakedumpfileDataHeader {
    int64_t offset;
    int64_t buf_size;
};

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add API to write header of flatten format
qiaonuohan [Tue, 18 Feb 2014 06:11:27 +0000 (14:11 +0800)]
dump: add API to write header of flatten format

flatten format will be used when writing kdump-compressed format. The format is
also used by makedumpfile, you can refer to the following URL to get more
detailed information about flatten format of kdump-compressed format:
http://sourceforge.net/projects/makedumpfile/

The two functions here are used to write start flat header and end flat header
to vmcore, and they will be called later when flatten format is used.

struct MakedumpfileHeader stored at the head of vmcore is used to indicate the
vmcore is in flatten format.

struct MakedumpfileHeader {
    char signature[16];     /* = "makedumpfile" */
    int64_t type;           /* = 1 */
    int64_t version;        /* = 1 */
};

And struct MakedumpfileDataHeader, with offset and buf_size set to -1, is used
to indicate the end of vmcore in flatten format.

struct MakedumpfileDataHeader {
    int64_t offset;         /* = -1 */
    int64_t buf_size;       /* = -1 */
};

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: add argument to write_elfxx_notes
qiaonuohan [Tue, 18 Feb 2014 06:11:26 +0000 (14:11 +0800)]
dump: add argument to write_elfxx_notes

write_elf32_notes/wirte_elf64_notes use fd_write_vmcore to write elf notes to
vmcore. Adding parameter "WriteCoreDumpFunction f" makes it available to choose
the method of writing elf notes

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: const-qualify the buf of WriteCoreDumpFunction
qiaonuohan [Tue, 18 Feb 2014 06:11:25 +0000 (14:11 +0800)]
dump: const-qualify the buf of WriteCoreDumpFunction

WriteCoreDumpFunction is a function pointer that points to the function used to
write content in "buf" into core file, so "buf" should be const-qualify.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotarget-i386: Fix ucomis and comis memory access
Richard Henderson [Mon, 24 Feb 2014 23:53:40 +0000 (15:53 -0800)]
target-i386: Fix ucomis and comis memory access

We were loading 16 bytes for both single and double-precision
scalar comparisons.

Reported-by: Alexander Bluhm <bluhm@openbsd.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-i386: Fix SSE status flag corruption
Richard Henderson [Mon, 24 Feb 2014 22:59:54 +0000 (14:59 -0800)]
target-i386: Fix SSE status flag corruption

When we restore the mxcsr register with FXRSTOR, or set it with gdb,
we need to update the various SSE status flags in CPUX86State

Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-i386: Fix CC_OP_CLR vs PF
Richard Henderson [Fri, 10 Jan 2014 20:38:40 +0000 (12:38 -0800)]
target-i386: Fix CC_OP_CLR vs PF

Parity should be set for a zero result.

Cc: qemu-stable@nongnu.org
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoMAINTAINERS: update status for HMP, QAPI and QMP trees
Luiz Capitulino [Tue, 18 Feb 2014 14:08:14 +0000 (09:08 -0500)]
MAINTAINERS: update status for HMP, QAPI and QMP trees

This commit updates the status for the HMP, QAPI and QMP trees from
"Supported" to "Maintained".

In practice this means that patch review and pull requests may take
longer. Also, I'll rely more on reviewers such as Eric Blake so that
I'm able to send pull requests regularly.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoQMP: Allow dot separated dict path arguments in qmp-shell
Fam Zheng [Wed, 12 Feb 2014 03:05:13 +0000 (11:05 +0800)]
QMP: Allow dot separated dict path arguments in qmp-shell

As another convenience to allow using commands that expect a dict as
argument, this patch adds support for foo.bar=value syntax, similar to
command line argument style:

  (QEMU) blockdev-add options.driver=file options.id=drive1 options.filename=...

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomodules: Fix building with --enable-modules
Fam Zheng [Wed, 26 Feb 2014 22:31:33 +0000 (06:31 +0800)]
modules: Fix building with --enable-modules

Compiling util/modules.c with modules enabled fails now.

Fix it by including qemu-common.h before #ifdef testing in module.c.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1393453893-12125-1-git-send-email-famz@redhat.com
Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kvm/uq/master' into staging
Peter Maydell [Thu, 27 Feb 2014 16:00:30 +0000 (16:00 +0000)]
Merge remote-tracking branch 'remotes/kvm/uq/master' into staging

* remotes/kvm/uq/master:
  KVM: Use return value for error print

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140226.0...
Peter Maydell [Thu, 27 Feb 2014 11:31:51 +0000 (11:31 +0000)]
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140226.0' into staging

Updates include:
 - Coverify fixes for vfio & pci-assign (Markus)
 - VFIO blacklisting support for known brokwn PCI option ROMs (Bandan)

# gpg: Signature made Wed 26 Feb 2014 18:15:28 GMT using RSA key ID 3BB08B22
# gpg: Can't check signature: public key not found

* remotes/awilliam/tags/vfio-pci-for-qemu-20140226.0:
  vfio: blacklist loading of unstable roms
  qdev-monitor: set DeviceState opts before calling realize
  pci-assign: Fix potential read beyond buffer on -EBUSY
  vfio: Fix overrun after readlink() fills buffer completely

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agosun4m: Add Sun CG3 framebuffer initialisation function
Mark Cave-Ayland [Tue, 15 Oct 2013 20:03:04 +0000 (21:03 +0100)]
sun4m: Add Sun CG3 framebuffer initialisation function

In order to allow the user to choose the framebuffer for sparc-softmmu, add
-vga tcx and -vga cg3 options to the QEMU command line. If no option is
specified, the default TCX framebuffer is used.

Since proprietary FCode ROMs use a resolution of 1152x900, slightly relax the
validation rules to allow both displays to be initiated at the higher
resolution used by these ROMs upon request (OpenBIOS FCode ROMs default to
the normal QEMU sun4m default resolution of 1024x768).

Finally move any fprintf(stderr ...) statements in the areas affected by this
patch over to the new error_report() function.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
CC: Blue Swirl <blauwirbel@gmail.com>
CC: Anthony Liguori <aliguori@amazon.com>
CC: Peter Maydell <peter.maydell@linaro.org>
CC: Bob Breuer <breuerr@mc.net>
CC: Artyom Tarasenko <atar4qemu@gmail.com>
10 years agosun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM
Mark Cave-Ayland [Tue, 15 Oct 2013 20:03:04 +0000 (21:03 +0100)]
sun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM

The CG3 framebuffer is a simple 8-bit framebuffer for use with operating
systems such as early Solaris that do not have drivers for TCX.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
CC: Blue Swirl <blauwirbel@gmail.com>
CC: Anthony Liguori <aliguori@amazon.com>
CC: Peter Maydell <peter.maydell@linaro.org>
CC: Bob Breuer <breuerr@mc.net>
CC: Artyom Tarasenko <atar4qemu@gmail.com>
10 years agosun4m: fix slavio timer RUN/STOP bit
Mark Cave-Ayland [Sat, 22 Feb 2014 22:54:53 +0000 (22:54 +0000)]
sun4m: fix slavio timer RUN/STOP bit

The sun4m architecture has one 'system' timer and one timer per CPU.
The CPU timers can be configured in two modes:

  * 22 bits Counter/Timer. Periodic interrupts.
  * 54 bits User timer. For profiling. In this mode, the Run/Stop bit
    controls the timer.

The run/stop bit controls the timer only when it is in "User" mode, but
its state shall be persistent.

Signed-off-by: Olivier Danet <odanet@caramail.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
10 years agosun4m: Set HostID in NVRAM
Mark Cave-Ayland [Sun, 23 Feb 2014 17:08:06 +0000 (17:08 +0000)]
sun4m: Set HostID in NVRAM

On SparcStations, the HostID field in the NVRAM is equal to the last
three bytes of the MAC address (which is also stored in the NVRAM).

This constant is used as an identification/serial number on Solaris.

Signed-off-by: Olivier Danet <odanet@caramail.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
10 years agos390x/ipl: Fix crash of ELF images with arbitrary entry points
Thomas Huth [Sat, 8 Feb 2014 11:31:15 +0000 (12:31 +0100)]
s390x/ipl: Fix crash of ELF images with arbitrary entry points

When loading S390 kernels, the current code expects an ELF file with the
start address 0x10000. Other ELF files cause a segmentation fault. To avoid
these crashes, we should get the start address from the ELF file instead
of always using a hard-coded address.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/kvm: Rework priv instruction handlers
Frank Blaschka [Tue, 11 Feb 2014 07:41:38 +0000 (08:41 +0100)]
s390x/kvm: Rework priv instruction handlers

The current implementation uses the second byte of the instruction
to identify the instruction handler. This is not sufficient to
support instructions not starting with 0xb2. This patch
adds separate handlers for 0xb2, 0xb9 and 0xeb to be able to
support the full instruction set.

Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/kvm: Add missing SIGP CPU RESET order
Thomas Huth [Fri, 24 Jan 2014 16:18:38 +0000 (17:18 +0100)]
s390x/kvm: Add missing SIGP CPU RESET order

The SIGP order CPU RESET was still missing in the list of our
supported handler. This patch now adds a simple implementation,
by using the cpu_reset() function that is already available in
target-s390x/cpu.c.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/kvm: Rework SIGP INITIAL CPU RESET handler
Thomas Huth [Fri, 24 Jan 2014 15:39:54 +0000 (16:39 +0100)]
s390x/kvm: Rework SIGP INITIAL CPU RESET handler

The s390_cpu_initial_reset() function had two deficiencies: First, it
used an ioctl for the destination CPU, and this ioctl could block
nearly forever, as long as the destination CPU was running in the SIE
loop. Second, it also cleared the general purpose registers - something
it should not do according to the Principles of Operations.
Since we've already got another function for the initial CPU reset in
cpu.c, we can also use that function instead. And by using run_on_cpu()
for executing this code, we make sure that the destination CPU is
correctly kicked out of kernel mode now.

Suggested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/cpu: Use ioctl to reset state in the kernel
Thomas Huth [Wed, 12 Feb 2014 08:56:35 +0000 (09:56 +0100)]
s390x/cpu: Use ioctl to reset state in the kernel

Some of the state in the kernel can not be reset from QEMU yet.
For this we've got to use the KVM_S390_INITIAL_RESET ioctl to make
sure that the state in the kernel is set to the right values during
initial CPU reset, too.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390-ccw.img: new binary rom to match latest fixes
Christian Borntraeger [Thu, 13 Feb 2014 08:48:12 +0000 (09:48 +0100)]
s390-ccw.img: new binary rom to match latest fixes

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390-ccw.img: Fix sporadic errors with ccw boot image - initialize css
Christian Borntraeger [Tue, 11 Feb 2014 21:46:53 +0000 (22:46 +0100)]
s390-ccw.img: Fix sporadic errors with ccw boot image - initialize css

We have to set the cssid to 0, otherwise the stsch code will
return an operand exception without the m bit. In the same way
we should set m=0.

This case was triggered in some cases during reboot, if for some
reason the location of blk_schid.cssid contains 1 and m was 0.
Turns out that the qemu elf loader does not zero out the bss section
on reboot.

The symptom was an dump of the old kernel with several areas
overwritten. The bootloader does not register a program check
handler, so bios exception jumped back into the old kernel.

Lets just use a local struct with a designed initializer. That
will guarantee that all other subelements are initialized to 0.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390-ccw.img: Fix sporadic reboot hangs: Initialize next_idx
Christian Borntraeger [Wed, 12 Feb 2014 15:17:35 +0000 (16:17 +0100)]
s390-ccw.img: Fix sporadic reboot hangs: Initialize next_idx

The current code does not initialize next_idx in the virtio ring.
As the ccw bios will always use guest memory at a fixed location,
this queue might != 0 after a reboot.
Lets make the initialization explicit.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390x/event-facility: exploit realize/unrealize
Heinz Graalfs [Fri, 20 Dec 2013 11:02:17 +0000 (12:02 +0100)]
s390x/event-facility: exploit realize/unrealize

init/exit functionality of abstract SCLPEvent class is now exploiting
realize/unrealize.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/event-facility: add support for live migration
Heinz Graalfs [Wed, 18 Dec 2013 12:59:57 +0000 (13:59 +0100)]
s390x/event-facility: add support for live migration

Add support for live migration using VMStateDescription.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/event-facility: code restructure
Heinz Graalfs [Wed, 18 Dec 2013 09:10:49 +0000 (10:10 +0100)]
s390x/event-facility: code restructure

Code restructure in order to simplify class hierarchy
  - remove S390SCLPDevice abstract base class
    and move function pointers into new SCLPEventFacilityClass
  - implement SCLPEventFacility as SysBusDevice
  - use define constants for instance creation strings

The following ascii-art shows the class structure wrt the SCLP EventFacility
before (CURRENT) and after the restructure (NEW):

----
CURRENT:

   "s390-sclp-events-bus"
   +-------------------------+
   |      SCLPEventsBus      |
   |-------------------------|
   |BusState qbus            |
   +-------------------------+

   +-------------------------+
   |   SCLPEventFacility     |  - to be replaced by new SCLPEventFacility,
   |-------------------------|    which will be a SysBusDevice
   |SCLPEventsBus sbus       |
   |DeviceState *qdev        |
   |unsigned int receive_mask|
   +-------------------------+

   +-------------------------+
   |   S390SCLPDeviceClass   |  - to be replaced by new SCLPEventFacilityClass
   |-------------------------|
   |DeviceClass qdev         |
   |*(init)()                |
   +-------------------------+

   "s390-sclp-event-facility"
             |
         instance-of
             |
             V
   "s390-sclp-device"           - this is an abstract class
   +-------------------------+
   |     S390SCLPDevice   (A)|  - to be replaced by new SCLPEventFacility
   |-------------------------|
   |SysBusDevice busdev      |
   |SCLPEventFacility *ef    |
   |                         |
   |*(sclp_command_handler)()|  - these 2 go to new SCLPEventFacilityClass
   |*(event_pending)()       |
   +-------------------------+

----
NEW:

   "s390-sclp-events-bus"
   +-------------------------+
   |      SCLPEventsBus      |
   |-------------------------|
   |BusState qbus            |
   +-------------------------+

   +-------------------------+
   | SCLPEventFacilityClass  |
   |-------------------------|
   |DeviceClass parent_class |
   |                         |
   |*(init)()                |
   |*(command_handler)()     |
   |*(event_pending)()       |
   +-------------------------+

   "s390-sclp-event-facility"
   +-------------------------+
   |   SCLPEventFacility     |
   |-------------------------|
   |SysBusDevice parent_class|
   |SCLPEventsBus sbus       |
   |unsigned int receive_mask|
   +-------------------------+

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/event-facility: some renaming
Heinz Graalfs [Mon, 23 Dec 2013 09:25:38 +0000 (10:25 +0100)]
s390x/event-facility: some renaming

Do some renaming to shorten some identifiers and to emphasize sclp.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/sclp: Fixed setting of condition code register
Thomas Huth [Tue, 14 Jan 2014 11:13:32 +0000 (12:13 +0100)]
s390x/sclp: Fixed setting of condition code register

In the SCLP handler function, the condition code register must
only be set if no exception occured.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/sclp: Add missing checks to SCLP handler
Thomas Huth [Mon, 13 Jan 2014 11:55:55 +0000 (12:55 +0100)]
s390x/sclp: Add missing checks to SCLP handler

If the 51 most significant bits of the SCCB address are zero or equal to
the prefix, we should throw an specification exception, too.
Also moved the check for privileged mode to sclp_service_call() to have
all program checks in one place now.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/sclp: Fixed the size of sccb and code parameter
Thomas Huth [Mon, 13 Jan 2014 11:19:03 +0000 (12:19 +0100)]
s390x/sclp: Fixed the size of sccb and code parameter

The pointer to the SCCB should not be limited to 32 bits only.
In contrast to this, the command word parameter is only 32 bits
(the upper 32 bits should be ignored).

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/eventfacility: mask out commands
Christian Borntraeger [Fri, 7 Feb 2014 12:41:58 +0000 (13:41 +0100)]
s390x/eventfacility: mask out commands

As a followup to commit 5f04c14a10fa7f259bc0808f35a0beda49f7821e
(s390-sclp: Define New SCLP Codes) we should mask the sclp command
not only in base sclp, but also in the event facility.

Based on an initial patch from Ralf Hoppe.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/virtio-hcall: Specification exception for illegal subcodes
Thomas Huth [Tue, 14 Jan 2014 12:32:23 +0000 (13:32 +0100)]
s390x/virtio-hcall: Specification exception for illegal subcodes

So far, the DIAG 500 hypervisor call was only setting -EINVAL in
R2 when a guest tried to call this function with an illegal subcode.
This patch now changes the behavior so that a specification exception
is thrown instead, since this is the common behavior of other DIAG
functions (and other CPU instructions) when being called with illegal
parameters.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/virtio-hcall: Add range check for hypervisor call
Thomas Huth [Mon, 13 Jan 2014 08:26:49 +0000 (09:26 +0100)]
s390x/virtio-hcall: Add range check for hypervisor call

The handler for diag 500 did not check whether the requested function
was in the supported range, so illegal values could crash QEMU in the
worst case.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
CC: qemu-stable@nongnu.org
10 years agos390x/kvm: Fixed bad SIGP SET-ARCHITECTURE handler
Thomas Huth [Wed, 22 Jan 2014 16:02:46 +0000 (17:02 +0100)]
s390x/kvm: Fixed bad SIGP SET-ARCHITECTURE handler

The SET-ARCHITECTURE handler in QEMU caused a program interruption.
This is wrong according to the "Principles of Operations" specification
(since SIGP should never cause a program interrupt) and was likely only
introduced for debugging purposes. Since we handle SET-ARCHITECTURE in
the kernel already and only dropped to user space in case of bad mode
parameters, we should just report INVALID PARAMETER in QEMU instead.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/async_pf: Check for apf extension and enable pfault
Dominik Dingel [Thu, 5 Sep 2013 11:54:39 +0000 (13:54 +0200)]
s390x/async_pf: Check for apf extension and enable pfault

S390 can also use async page faults, to enhance guest scheduling.
In case of live migration we want to disable the feature and let
all pending request finish.

Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390x/kvm: implement floating-interrupt controller device
Jens Freimann [Tue, 16 Jul 2013 07:04:04 +0000 (09:04 +0200)]
s390x/kvm: implement floating-interrupt controller device

This patch implements a floating-interrupt controller device (flic)
which interacts with the s390 flic kvm_device.

Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agoupdate linux headers to kvm/next
Christian Borntraeger [Fri, 7 Feb 2014 11:13:39 +0000 (12:13 +0100)]
update linux headers to kvm/next

This updates the kvm headers to
commit d3714010c307d26df251c45be9cd12ab6d41f0c4
    KVM: x86: emulator_cmpxchg_emulated should mark_page_dirty
in kvm/next.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140226' into...
Peter Maydell [Wed, 26 Feb 2014 22:53:50 +0000 (22:53 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140226' into staging

target-arm queue:
 * fixes for various Coverity-spotted bugs
 * support new KVM device control API for VGIC
 * support KVM VGIC save/restore/migration
 * more AArch64 system mode foundations
 * support ARMv8 CRC instructions for A32/T32
 * PL330 minor fixes and cleanup

# gpg: Signature made Wed 26 Feb 2014 17:51:32 GMT using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20140226: (45 commits)
  dma/pl330: implement dmaadnh instruction
  dma/pl330: Fix buffer depth
  dma/pl330: Add event debugging printfs
  dma/pl330: Rename parent_obj
  dma/pl330: printf format type sweep.
  dma/pl330: Fix misleading type
  dma/pl330: Delete overly verbose debug printf
  target-arm: Add support for AArch32 ARMv8 CRC32 instructions
  include/qemu/crc32c.h: Rename include guards to match filename
  target-arm: Add utility function for checking AA32/64 state of an EL
  target-arm: Implement AArch64 view of CPACR
  target-arm: A64: Implement MSR (immediate) instructions
  target-arm: Store AIF bits in env->pstate for AArch32
  target-arm: A64: Implement WFI
  target-arm: Get MMU index information correct for A64 code
  target-arm: Implement AArch64 OSLAR_EL1 sysreg as WI
  target-arm: Implement AArch64 dummy breakpoint and watchpoint registers
  target-arm: Implement AArch64 ID and feature registers
  target-arm: Implement AArch64 generic timers
  target-arm: Implement AArch64 MPIDR
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20140225' into...
Peter Maydell [Wed, 26 Feb 2014 22:31:10 +0000 (22:31 +0000)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20140225' into staging

migration/next for 20140225

# gpg: Signature made Tue 25 Feb 2014 14:04:31 GMT using RSA key ID 5872D723
# gpg: Can't check signature: public key not found

* remotes/juanquintela/tags/migration/20140225:
  rdma: rename 'x-rdma' => 'rdma'
  Fix two XBZRLE corruption issues
  Fix vmstate_info_int32_le comparison/assign
  qemu_file: use fwrite() correctly

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Peter Maydell [Wed, 26 Feb 2014 20:04:37 +0000 (20:04 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

Net patches

# gpg: Signature made Tue 25 Feb 2014 13:32:33 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# 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: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/net-pull-request:
  virtio-net: use qemu_get_queue() where possible
  vhost_net: use offload API instead of bypassing it
  net: remove implicit peer from offload API
  net: Disable netmap backend when not supported
  net: add offloading support to netmap backend
  net: make tap offloading callbacks static
  net: virtio-net and vmxnet3 use offloading API
  net: TAP uses NetClientInfo offloading callbacks
  net: extend NetClientInfo for offloading
  net: change vnet-hdr TAP prototypes
  opencores_eth: flush queue whenever can_receive can go from false to true

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-audio-3' into staging
Peter Maydell [Wed, 26 Feb 2014 18:22:11 +0000 (18:22 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-3' into staging

hda-audio: qom cleanups

# gpg: Signature made Mon 24 Feb 2014 12:19:48 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-audio-3:
  hda-audio: qom cleanups

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agovfio: blacklist loading of unstable roms
Bandan Das [Wed, 26 Feb 2014 17:33:45 +0000 (10:33 -0700)]
vfio: blacklist loading of unstable roms

Certain cards such as the Broadcom BCM57810 have rom quirks
that exhibit unstable system behavior duing device assignment. In
the particular case of 57810, rom execution hangs and if a FLR
follows, the device becomes inoperable until a power cycle. This
change blacklists loading of rom for such cards unless the user
specifies a romfile or rombar=1 on the cmd line

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agoqdev-monitor: set DeviceState opts before calling realize
Bandan Das [Wed, 26 Feb 2014 17:32:40 +0000 (10:32 -0700)]
qdev-monitor: set DeviceState opts before calling realize

Setting opts before the realize property is set allows the
following patch to make decisions based on whether the user
specified "rombar". This also avoids having to create a new
tristate property especially for this purpose

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agopci-assign: Fix potential read beyond buffer on -EBUSY
Markus Armbruster [Wed, 26 Feb 2014 17:30:03 +0000 (10:30 -0700)]
pci-assign: Fix potential read beyond buffer on -EBUSY

readlink() doesn't write a terminating null byte.
assign_failed_examine() passes the unterminated string to strrchr().
Oops.  Terminate it.

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agovfio: Fix overrun after readlink() fills buffer completely
Markus Armbruster [Wed, 26 Feb 2014 17:28:36 +0000 (10:28 -0700)]
vfio: Fix overrun after readlink() fills buffer completely

readlink() returns the number of bytes written to the buffer, and it
doesn't write a terminating null byte.  vfio_init() writes it itself.
Overruns the buffer when readlink() filled it completely.

Fix by treating readlink() filling the buffer completely as error,
like we do in pci-assign.c's assign_failed_examine().

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agodma/pl330: implement dmaadnh instruction
Peter Crosthwaite [Wed, 26 Feb 2014 17:20:09 +0000 (17:20 +0000)]
dma/pl330: implement dmaadnh instruction

Implement the missing DMAADNH instruction. This is a minor variant
of the DMAADDH instruction, so factor out to a common implementation
for both (dmaadxh).

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 73ab13532a7cae53441da89b46c279b5f50785e3.1393372019.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agodma/pl330: Fix buffer depth
Peter Crosthwaite [Wed, 26 Feb 2014 17:20:08 +0000 (17:20 +0000)]
dma/pl330: Fix buffer depth

This is the product of the data-width and the depth arguments, I.e the
depth of the FIFO is in terms of data entries and not bytes (which is
what the original implementation was suggesting). Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: c34de31031511538ccdb3164b48ee8a6a973ebd4.1393372019.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agodma/pl330: Add event debugging printfs
Peter Crosthwaite [Wed, 26 Feb 2014 17:20:08 +0000 (17:20 +0000)]
dma/pl330: Add event debugging printfs

These are helpful to anyone trying to debug event sequencing.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: e82a0ad804db3de4f46839e55a9d287735ef870d.1393372019.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agodma/pl330: Rename parent_obj
Peter Crosthwaite [Wed, 26 Feb 2014 17:20:08 +0000 (17:20 +0000)]
dma/pl330: Rename parent_obj

As per current QOM conventions.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: abb137347ea1ee9c31487b544f3d5435fb17f6a4.1393372019.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agodma/pl330: printf format type sweep.
Peter Crosthwaite [Wed, 26 Feb 2014 17:20:08 +0000 (17:20 +0000)]
dma/pl330: printf format type sweep.

Use PRI formats as appropriate rather than raw %x and %d. This fixes
debug printfery on some host platforms. Fix types of debug only
variables as appropriate.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: dbb5f5fd048b2d4a3cb5c6357577d11211a7a585.1393372019.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agodma/pl330: Fix misleading type
Peter Crosthwaite [Wed, 26 Feb 2014 17:20:08 +0000 (17:20 +0000)]
dma/pl330: Fix misleading type

This type really should just be a regular int as no usages rely on it's
32 bitness (it's only meaningful as a bit position and not a bit mask).
This also fixes a printf which uses the variable with a regular %d.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 2a99d31f377aee371476d9da8fd0d1b7efa30f63.1393372019.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agodma/pl330: Delete overly verbose debug printf
Peter Crosthwaite [Wed, 26 Feb 2014 17:20:07 +0000 (17:20 +0000)]
dma/pl330: Delete overly verbose debug printf

When using event synchronisation, this particular debug printf floods.
Just delete it.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: dd94d19493f97c47497b9d8caf74ca43e70d58fd.1393372019.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Add support for AArch32 ARMv8 CRC32 instructions
Will Newton [Wed, 26 Feb 2014 17:20:07 +0000 (17:20 +0000)]
target-arm: Add support for AArch32 ARMv8 CRC32 instructions

Add support for AArch32 CRC32 and CRC32C instructions added in ARMv8
and add a CPU feature flag to enable these instructions.

The CRC32-C implementation used is the built-in qemu implementation
and The CRC-32 implementation is from zlib. This requires adding zlib
to LIBS to ensure it is linked for the linux-user binary.

Signed-off-by: Will Newton <will.newton@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1393411566-24104-3-git-send-email-will.newton@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoinclude/qemu/crc32c.h: Rename include guards to match filename
Will Newton [Wed, 26 Feb 2014 17:20:07 +0000 (17:20 +0000)]
include/qemu/crc32c.h: Rename include guards to match filename

Signed-off-by: Will Newton <will.newton@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1393411566-24104-2-git-send-email-will.newton@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Add utility function for checking AA32/64 state of an EL
Peter Maydell [Wed, 26 Feb 2014 17:20:07 +0000 (17:20 +0000)]
target-arm: Add utility function for checking AA32/64 state of an EL

There are various situations where we need to behave differently
depending on whether a given exception level is in AArch64 or
AArch32 state. The state of the current exception level is stored
in env->aarch64, but there's no equivalent guest-visible architected
state bits for the status of the exception levels "above" the
current one which may still affect execution. At the moment we
only support EL1 (ie no EL2 or EL3) and insist that AArch64
capable CPUs run with EL1 in AArch64 state, but these may change
in the future, so abstract out the "what state is this?" check
into a utility function which can be enhanced later if necessary.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
10 years agotarget-arm: Implement AArch64 view of CPACR
Peter Maydell [Wed, 26 Feb 2014 17:20:06 +0000 (17:20 +0000)]
target-arm: Implement AArch64 view of CPACR

Implement the AArch64 view of the CPACR. The AArch64
CPACR is defined to have a lot of RES0 bits, but since
the architecture defines that RES0 bits may be implemented
as reads-as-written and we know that a v8 CPU will have
no registered coprocessors for cp0..cp13 we can safely
implement the whole register this way.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
10 years agotarget-arm: A64: Implement MSR (immediate) instructions
Peter Maydell [Wed, 26 Feb 2014 17:20:06 +0000 (17:20 +0000)]
target-arm: A64: Implement MSR (immediate) instructions

Implement the MSR (immediate) instructions, which can update the
PSTATE SP and DAIF fields.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>