OSDN Git Service

qmiga/qemu.git
6 years agoqapi: Update qapi-code-gen.txt examples to match current code
Markus Armbruster [Thu, 24 Aug 2017 08:45:56 +0000 (10:45 +0200)]
qapi: Update qapi-code-gen.txt examples to match current code

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503564371-26090-2-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Improve section headings
Markus Armbruster [Thu, 24 Aug 2017 19:14:08 +0000 (21:14 +0200)]
qapi-schema: Improve section headings

The generated QEMU QMP reference is now structured as follows:

    1.1 Introduction
    1.2 Stability Considerations
    1.3 Common data types
    1.4 Socket data types
    1.5 VM run state
    1.6 Cryptography
    1.7 Block devices
    1.7.1 Block core (VM unrelated)
    1.7.2 QAPI block definitions (vm unrelated)
    1.8 Character devices
    1.9 Net devices
    1.10 Rocker switch device
    1.11 TPM (trusted platform module) devices
    1.12 Remote desktop
    1.12.1 Spice
    1.12.2 VNC
    1.13 Input
    1.14 Migration
    1.15 Transactions
    1.16 Tracing
    1.17 QMP introspection
    1.18 Miscellanea

Section "1.18 Miscellanea" is still too big: it documents 134 symbols.
Section "1.7.1 Block core (VM unrelated)" is also rather big: 128
symbols.  All the others are of reasonable size.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-17-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Move queries from common.json to qapi-schema.json
Markus Armbruster [Thu, 24 Aug 2017 19:14:07 +0000 (21:14 +0200)]
qapi-schema: Move queries from common.json to qapi-schema.json

query-version and query-commands are in common.json for no good
reason.  Several similar queries are in qapi-schema.json.  Move them
there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-16-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Make block-core.json self-contained
Markus Armbruster [Thu, 24 Aug 2017 19:14:06 +0000 (21:14 +0200)]
qapi-schema: Make block-core.json self-contained

Except for block-core.json, the sub-schemas are self-contained: if
they use a symbol defined in another sub-schema, they include that
sub-schema.  To check, feed the sub-schema to qapi2texi (or any other
QAPI generator) along with the pragma from qapi-schema.json.

Fix up things to make block-core.json self-contained, too.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-15-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Fold event.json back into qapi-schema.json
Markus Armbruster [Thu, 24 Aug 2017 19:14:05 +0000 (21:14 +0200)]
qapi-schema: Fold event.json back into qapi-schema.json

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-14-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Move block events from event.json to block.json
Markus Armbruster [Thu, 24 Aug 2017 19:14:04 +0000 (21:14 +0200)]
qapi-schema: Move block events from event.json to block.json

Cc: Alberto Garcia <berto@igalia.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-13-git-send-email-armbru@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Collect TPM stuff in qapi/tpm.json
Markus Armbruster [Thu, 24 Aug 2017 19:14:03 +0000 (21:14 +0200)]
qapi-schema: Collect TPM stuff in qapi/tpm.json

Sadly, we don't have a TPM maintainer, not even a MAINTAINERS entry.
Create one, and mark it orphaned.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-12-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Collect transaction stuff in qapi/transaction.json
Markus Armbruster [Thu, 24 Aug 2017 19:14:02 +0000 (21:14 +0200)]
qapi-schema: Collect transaction stuff in qapi/transaction.json

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-11-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Collect migration stuff in qapi/migration.json
Markus Armbruster [Thu, 24 Aug 2017 19:14:01 +0000 (21:14 +0200)]
qapi-schema: Collect migration stuff in qapi/migration.json

Cc: Juan Quintela <quintela@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-10-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
6 years agoqapi-schema: Collect UI stuff in qapi/ui.json
Markus Armbruster [Thu, 24 Aug 2017 19:14:00 +0000 (21:14 +0200)]
qapi-schema: Collect UI stuff in qapi/ui.json

UI stuff is remote desktop stuff (Spice, VNC) and input stuff (mouse,
keyboard).

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-9-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agoqapi-schema: Collect net device stuff in qapi/net.json
Markus Armbruster [Thu, 24 Aug 2017 19:13:59 +0000 (21:13 +0200)]
qapi-schema: Collect net device stuff in qapi/net.json

Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-8-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Collect char device stuff in qapi/char.json
Markus Armbruster [Thu, 24 Aug 2017 19:13:58 +0000 (21:13 +0200)]
qapi-schema: Collect char device stuff in qapi/char.json

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-7-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Collect run state stuff in qapi/run-state.json
Markus Armbruster [Thu, 24 Aug 2017 19:13:57 +0000 (21:13 +0200)]
qapi-schema: Collect run state stuff in qapi/run-state.json

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-6-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Collect sockets stuff in qapi/sockets.json
Markus Armbruster [Thu, 24 Aug 2017 19:13:56 +0000 (21:13 +0200)]
qapi-schema: Collect sockets stuff in qapi/sockets.json

Cc: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503602048-12268-5-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6 years agoqapi-schema: Rocker doc section contains unrelated stuff, fix
Markus Armbruster [Thu, 24 Aug 2017 19:13:55 +0000 (21:13 +0200)]
qapi-schema: Rocker doc section contains unrelated stuff, fix

Bug: section "Rocker switch device" starts with the rocker stuff, but
then has unrelated stuff, like ReplayMode, xen-load-devices-state, ...

Cause: rocker.json is included in the middle of section "QMP commands".

Fix: include it in a sane place, namely next to the other sub-schemas.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1503602048-12268-4-git-send-email-armbru@redhat.com>

6 years agoqapi-schema: Introspection doc is in the wrong section, fix
Markus Armbruster [Thu, 24 Aug 2017 19:13:54 +0000 (21:13 +0200)]
qapi-schema: Introspection doc is in the wrong section, fix

Bug: introspection documentation is in section "Tracing commands".

Cause: sub-schema qapi/introspect.json lacks a section header, and
therefore goes into whatever section precedes its include.

Fix: add a section header.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1503602048-12268-3-git-send-email-armbru@redhat.com>

6 years agoqapi-schema: Document how generated documentation is ordered
Markus Armbruster [Thu, 24 Aug 2017 19:13:53 +0000 (21:13 +0200)]
qapi-schema: Document how generated documentation is ordered

Documentation generated with qapi2texi.py is in source order, with
included sub-schemas inserted at the first include directive
(subsequent include directives have no effect).  To get a sane and
stable order, it's best to include each sub-schema just once, or
include it first in qapi-schema.json.  Document that.

While there, drop a few redundant comments.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1503602048-12268-2-git-send-email-armbru@redhat.com>

6 years agoqlit: Tighten QLit list vs QList comparison
Marc-André Lureau [Fri, 25 Aug 2017 10:59:11 +0000 (12:59 +0200)]
qlit: Tighten QLit list vs QList comparison

We check that all members of the QLit list are also in the QList.  We
neglect to check the other direction.  Fix that.

While there, use QLIST_FOREACH_ENTRY() to simplify the code and break
the loop on the first mismatch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170825105913.4060-13-marcandre.lureau@redhat.com>
[Commit message improved]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqlit: Tighten QLit dict vs QDict comparison
Marc-André Lureau [Fri, 25 Aug 2017 10:59:10 +0000 (12:59 +0200)]
qlit: Tighten QLit dict vs QDict comparison

We check that all members of the QLit dictionary are also in the
QDict.  We neglect to check the other direction.

Comparing the number of members suffices, because QDict can't
contain duplicate members, and putting duplicates in a QLit is a
programming error.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170825105913.4060-12-marcandre.lureau@redhat.com>
[Commit message improved]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agotests/check-qlit: New, covering qobject/qlit.c
Marc-André Lureau [Fri, 25 Aug 2017 10:59:09 +0000 (12:59 +0200)]
tests/check-qlit: New, covering qobject/qlit.c

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170825105913.4060-11-marcandre.lureau@redhat.com>
[Copyright notice correction squashed in, commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqlit: Replace open-coded qnum_get_int() by call
Marc-André Lureau [Fri, 25 Aug 2017 10:59:08 +0000 (12:59 +0200)]
qlit: Replace open-coded qnum_get_int() by call

Bonus: rids us of a side effect in an assertion.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170825105913.4060-10-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqlit: add QLIT_QNULL and QLIT_BOOL
Marc-André Lureau [Fri, 25 Aug 2017 10:59:07 +0000 (12:59 +0200)]
qlit: add QLIT_QNULL and QLIT_BOOL

As they are going to be used in the following patches.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170825105913.4060-9-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqlit: make qlit_equal_qobject() take const arguments
Marc-André Lureau [Fri, 25 Aug 2017 10:59:06 +0000 (12:59 +0200)]
qlit: make qlit_equal_qobject() take const arguments

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170825105913.4060-8-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqlit: make qlit_equal_qobject return a bool
Marc-André Lureau [Fri, 25 Aug 2017 10:59:05 +0000 (12:59 +0200)]
qlit: make qlit_equal_qobject return a bool

Make it more obvious about the expected return values.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170825105913.4060-7-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqlit: rename compare_litqobj_to_qobj() to qlit_equal_qobject()
Marc-André Lureau [Fri, 25 Aug 2017 10:59:04 +0000 (12:59 +0200)]
qlit: rename compare_litqobj_to_qobj() to qlit_equal_qobject()

compare_litqobj_to_qobj() lacks a qlit_ prefix.  Moreover, "compare"
suggests -1, 0, +1 for less than, equal and greater than.  The
function actually returns non-zero for equal, zero for unequal.
Rename to qlit_equal_qobject().

Its return type will be cleaned up in the next patch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170825105913.4060-6-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqlit: Change compound literals to initializers
Marc-André Lureau [Fri, 25 Aug 2017 10:59:03 +0000 (12:59 +0200)]
qlit: Change compound literals to initializers

The QLIT_QFOO() macros expand into compound literals.  Sadly, gcc
doesn't recognizes these as constant expressions (clang does), which
makes the macros useless for initializing objects with static storage
duration.

There is a gcc bug about it:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71713

Change the macros to expand into initializers.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170825105913.4060-5-marcandre.lureau@redhat.com>
[Commit message improved]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqlit: use QLit prefix consistently
Marc-André Lureau [Fri, 25 Aug 2017 10:59:02 +0000 (12:59 +0200)]
qlit: use QLit prefix consistently

Rename from LiteralQ to QLit.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170825105913.4060-4-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqlit: move qlit from check-qjson to qobject/
Marc-André Lureau [Fri, 25 Aug 2017 10:59:01 +0000 (12:59 +0200)]
qlit: move qlit from check-qjson to qobject/

Fix code style issues while at it, to please checkpatch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170825105913.4060-3-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqdict: Add qdict_put_null() helper, and put it to use
Marc-André Lureau [Fri, 25 Aug 2017 10:59:00 +0000 (12:59 +0200)]
qdict: Add qdict_put_null() helper, and put it to use

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170825105913.4060-2-marcandre.lureau@redhat.com>
[Update to qobject.cocci squashed in, commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoqobject: Explain how QNum works, and why
Markus Armbruster [Tue, 22 Aug 2017 06:52:19 +0000 (08:52 +0200)]
qobject: Explain how QNum works, and why

Suggested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503384739-17207-1-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[Comment typos fixed]

6 years agotests/qmp-test: Add generic, basic test of query commands
Markus Armbruster [Fri, 11 Aug 2017 14:19:08 +0000 (16:19 +0200)]
tests/qmp-test: Add generic, basic test of query commands

A command is a query if it has no side effect and yields a result.
Such commands are typically named query-FOO, but there are exceptions.

The basic idea is to find candidates with query-qmp-schema, filter out
the ones that aren't queries with an explicit blacklist, and test the
remaining ones against a QEMU with no special arguments.

The current blacklist is just add-fd.

The test can't do queries with arguments, because it knows nothing
about the arguments.  No coverage for query-cpu-model-baseline,
query-cpu-model-comparison, query-cpu-model-expansion, query-rocker,
query-rocker-ports, query-rocker-of-dpa-flows, and
query-rocker-of-dpa-groups.

Most tested commands are expected to succeed.  The test does not check
the return value then.

query-balloon and query-vm-generation-id are expected to fail because
they need a virtio-balloon / vmgenid device to succeed, and this test
is too dumb to set one up.  Could be addressed later.

query-acpi-ospm-status and query-hotpluggable-cpus are expected to
fail because they require features provided only by special machine
types, and this test is too dumb to set that up.  Could also be
addressed later.

Several commands may either be functional or stubs that always fail,
depending on build configuration.  Ideally, the stubs shouldn't be in
query-qmp-schema, but that requires QAPI schema compile-time
configuration, which we don't have, yet.  Until we do, we need to
figure out whether a command is a stub.  When we have a suitable
CONFIG_FOO preprocessor symbol is available, use that.  Else,
simply blacklist the command for now.

We get basic test coverage for the following commands, except as
noted:

    qom-list-types
    query-acpi-ospm-status      (expected to fail)
    query-balloon               (expected to fail)
    query-block
    query-block-jobs
    query-blockstats
    query-chardev
    query-chardev-backends
    query-command-line-options
    query-commands
    query-cpu-definitions       (blacklisted for now)
    query-cpus
    query-dump
    query-dump-guest-memory-capability
    query-events
    query-fdsets
    query-gic-capabilities      (blacklisted for now)
    query-hotpluggable-cpus     (expected to fail)
    query-iothreads
    query-kvm
    query-machines
    query-memdev
    query-memory-devices
    query-mice
    query-migrate
    query-migrate-cache-size
    query-migrate-capabilities
    query-migrate-parameters
    query-name
    query-named-block-nodes
    query-pci                   (blacklisted for now)
    query-qmp-schema
    query-rx-filter
    query-spice
    query-status
    query-target
    query-tpm
    query-tpm-models
    query-tpm-types
    query-uuid
    query-version
    query-vm-generation-id      (expected to fail)
    query-vnc
    query-vnc-servers
    query-xen-replication-status

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1502461148-10154-1-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[Typos in code under #ifndef and in the commit message fixed]

6 years agoqapi: Fix error handling code on alternate conflict
Eduardo Habkost [Mon, 17 Jul 2017 18:09:26 +0000 (15:09 -0300)]
qapi: Fix error handling code on alternate conflict

The conflict check added by commit c0644771 ("qapi: Reject
alternates that can't work with keyval_parse()") doesn't work
with the following declaration:

  { 'alternate': 'Alt',
    'data': { 'one': 'bool',
              'two': 'str' } }

It crashes with:

  Traceback (most recent call last):
    File "./scripts/qapi-types.py", line 295, in <module>
      schema = QAPISchema(input_file)
    File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 1468, in __init__
      self.exprs = check_exprs(parser.exprs)
    File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 958, in check_exprs
      check_alternate(expr, info)
    File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 830, in check_alternate
      % (name, key, types_seen[qtype]))
  KeyError: 'QTYPE_QSTRING'

This happens because the previously-seen conflicting member
('one') can't be found at types_seen[qtype], but at
types_seen['QTYPE_BOOL'].

Fix the bug by moving the error check to the same loop that adds
new items to types_seen, raising an exception if types_seen[qt]
is already set.

Add two additional test cases that can detect the bug.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170717180926.14924-1-ehabkost@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/elmarco/tags/tidy-pull-request' into staging
Peter Maydell [Thu, 31 Aug 2017 14:52:43 +0000 (15:52 +0100)]
Merge remote-tracking branch 'remotes/elmarco/tags/tidy-pull-request' into staging

# gpg: Signature made Thu 31 Aug 2017 11:29:33 BST
# gpg:                using RSA key 0xDAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>"
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/tidy-pull-request: (29 commits)
  eepro100: replace g_malloc()+memcpy() with g_memdup()
  test-iov: replace g_malloc()+memcpy() with g_memdup()
  i386: replace g_malloc()+memcpy() with g_memdup()
  i386: introduce ELF_NOTE_SIZE macro
  decnumber: use DIV_ROUND_UP
  kvm: use DIV_ROUND_UP
  i386/dump: use DIV_ROUND_UP
  ppc: use DIV_ROUND_UP
  msix: use DIV_ROUND_UP
  usb-hub: use DIV_ROUND_UP
  q35: use DIV_ROUND_UP
  piix: use DIV_ROUND_UP
  virtio-serial: use DIV_ROUND_UP
  console: use DIV_ROUND_UP
  monitor: use DIV_ROUND_UP
  virtio-gpu: use DIV_ROUND_UP
  vga: use DIV_ROUND_UP
  ui: use DIV_ROUND_UP
  vnc: use DIV_ROUND_UP
  vvfat: use DIV_ROUND_UP
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Thu, 31 Aug 2017 13:33:54 +0000 (14:33 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Thu 31 Aug 2017 09:21:49 BST
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  qcow2: allocate cluster_cache/cluster_data on demand
  qemu-doc: Add UUID support in initiator name
  tests: migration/guestperf Python 2.6 argparse compatibility
  docker.py: Python 2.6 argparse compatibility
  scripts: add argparse module for Python 2.6 compatibility
  misc: Remove unused Error variables
  oslib-posix: Print errors before aborting on qemu_alloc_stack()
  throttle: Test the valid range of config values
  throttle: Make burst_length 64bit and add range checks
  throttle: Make LeakyBucket.avg and LeakyBucket.max integer types
  throttle: Remove throttle_fix_bucket() / throttle_unfix_bucket()
  throttle: Make throttle_is_valid() a bit less verbose
  throttle: Update the throttle_fix_bucket() documentation
  throttle: Fix wrong variable name in the header documentation
  nvme: Fix get/set number of queues feature, again

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-08-30' into staging
Peter Maydell [Thu, 31 Aug 2017 12:51:40 +0000 (13:51 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-08-30' into staging

nbd patches for 2017-08-30

- Kashyap Chamarthy: qemu-iotests: Extend non-shared storage migration test (194)
- Stefan Hajnaczi: 0/3 nbd-client: enter read_reply_co during init to avoid crash
- Vladimir Sementsov-Ogievskiy: portions of 0/17 nbd client refactoring and fixing

# gpg: Signature made Wed 30 Aug 2017 19:03:46 BST
# gpg:                using RSA key 0xA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2017-08-30:
  block/nbd-client: refactor request send/receive
  block/nbd-client: rename nbd_recv_coroutines_enter_all
  block/nbd-client: get rid of ssize_t
  nbd/client: fix nbd_send_request to return int
  nbd/client: refactor nbd_receive_reply
  nbd/client: refactor nbd_read_eof
  nbd/client: fix nbd_opt_go
  qemu-iotests: test NBD over UNIX domain sockets in 083
  qemu-iotests: improve nbd-fault-injector.py startup protocol
  nbd-client: avoid read_reply_co entry if send failed
  qemu-iotests: Extend non-shared storage migration test (194)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20170830' into staging
Peter Maydell [Thu, 31 Aug 2017 10:29:41 +0000 (11:29 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20170830' into staging

First batch of s390x patches:
- 2.11 compat machine
- support the new --s390-pgste linker option, making it possible to
  avoid enabling the global vm.allocate_pgste systl if all pieces
  are in place
- correctly identify some devices as not hotpluggable
- clean up some tests and enable them for s390x
- wire up the diag288 watchdog in tcg
- clean up dependencies on CONFIG_PCI, making it possible to disable
  it by hand
- lots of cleanup in target/s390x/
- fix alignment of the ccw1 structure in the s390-ccw bios
- and some more bugfixes

# gpg: Signature made Wed 30 Aug 2017 17:40:34 BST
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20170830: (44 commits)
  s390x/pci: fixup trap_msix()
  pc-bios/s390-ccw.img: update image
  s390-ccw: Fix alignment for CCW1
  s390x/s390-stattrib: Mark the storage attribute as not user_creatable
  target/s390x: cleanup cpu.h
  s390x/kvm: move KVM declarations and stubs to separate files
  s390x: avoid calling kvm_ functions outside of target/s390x/
  target/s390x: move a couple of functions to cpu.c
  target/s390x: introduce internal.h
  target/s390x: move get_per_in_range() to misc_helper.c
  target/s390x: move s390_do_cpu_reset() to diag.c
  target/s390x: move psw_key_valid() to mem_helper.c
  target/s390x: move cpu_mmu_idx_to_asc() to excp_helper.c
  target/s390x: move cc_name() to helper.c
  target/s390x: move gtod_*() declarations to s390-virtio.h
  s390x: drop inclusion of sysemu/kvm.h from some files
  s390x/cpumodel: factor out determination of default model name
  target/s390x: no need to pass kvm_state to savevm_gtod handlers
  target/s390x: simplify gs_allowed()
  target/s390x: simplify ri_allowed()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoeepro100: replace g_malloc()+memcpy() with g_memdup()
Marc-André Lureau [Tue, 6 Jun 2017 20:45:43 +0000 (00:45 +0400)]
eepro100: replace g_malloc()+memcpy() with g_memdup()

I found these pattern via grepping the source tree. I don't have a
coccinelle script for it!

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agotest-iov: replace g_malloc()+memcpy() with g_memdup()
Marc-André Lureau [Tue, 6 Jun 2017 20:45:43 +0000 (00:45 +0400)]
test-iov: replace g_malloc()+memcpy() with g_memdup()

I found these pattern via grepping the source tree. I don't have a
coccinelle script for it!

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoi386: replace g_malloc()+memcpy() with g_memdup()
Marc-André Lureau [Tue, 6 Jun 2017 20:45:43 +0000 (00:45 +0400)]
i386: replace g_malloc()+memcpy() with g_memdup()

I found these pattern via grepping the source tree. I don't have a
coccinelle script for it!

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoi386: introduce ELF_NOTE_SIZE macro
Marc-André Lureau [Tue, 6 Jun 2017 17:25:10 +0000 (21:25 +0400)]
i386: introduce ELF_NOTE_SIZE macro

Factour out a common pattern to compute the ELF note size.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agodecnumber: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
decnumber: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agokvm: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
kvm: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoi386/dump: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
i386/dump: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoppc: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
ppc: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agomsix: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
msix: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agousb-hub: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
usb-hub: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoq35: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
q35: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agopiix: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
piix: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agovirtio-serial: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
virtio-serial: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Amit Shah <amit@kernel.org>
6 years agoconsole: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
console: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agomonitor: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
monitor: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agovirtio-gpu: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
virtio-gpu: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agovga: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
vga: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoui: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
ui: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agovnc: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
vnc: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agovvfat: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
vvfat: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agovpc: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
vpc: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoqcow2: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
qcow2: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agodmg: use DIV_ROUND_UP
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
dmg: use DIV_ROUND_UP

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agopcspk: use QEMU_ALIGN_DOWN
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
pcspk: use QEMU_ALIGN_DOWN

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoi8254: use QEMU_ALIGN_DOWN
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
i8254: use QEMU_ALIGN_DOWN

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agovhost: use QEMU_ALIGN_DOWN
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
vhost: use QEMU_ALIGN_DOWN

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agovhdx: use QEMU_ALIGN_DOWN
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
vhdx: use QEMU_ALIGN_DOWN

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agovnc: use QEMU_ALIGN_DOWN
Marc-André Lureau [Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)]
vnc: use QEMU_ALIGN_DOWN

I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoi386: use ROUND_UP macro
Marc-André Lureau [Tue, 6 Jun 2017 15:44:01 +0000 (19:44 +0400)]
i386: use ROUND_UP macro

I used the clang-tidy qemu-round check (with the option OnlyAlignUp)
to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
6 years agoslirp: fix clearing ifq_so from pending packets
Samuel Thibault [Thu, 24 Aug 2017 23:35:53 +0000 (01:35 +0200)]
slirp: fix clearing ifq_so from pending packets

The if_fastq and if_batchq contain not only packets, but queues of packets
for the same socket. When sofree frees a socket, it thus has to clear ifq_so
from all the packets from the queues, not only the first.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoOpen 2.11 development tree
Peter Maydell [Wed, 30 Aug 2017 22:10:38 +0000 (23:10 +0100)]
Open 2.11 development tree

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoblock/nbd-client: refactor request send/receive
Vladimir Sementsov-Ogievskiy [Tue, 29 Aug 2017 21:48:31 +0000 (16:48 -0500)]
block/nbd-client: refactor request send/receive

Add nbd_co_request, to remove code duplications in
nbd_client_co_{pwrite,pread,...} functions. Also this is
needed for further refactoring.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20170804151440.320927-8-vsementsov@virtuozzo.com>
[eblake: make nbd_co_request a wrapper, rather than merging two
existing functions]
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agoblock/nbd-client: rename nbd_recv_coroutines_enter_all
Vladimir Sementsov-Ogievskiy [Fri, 4 Aug 2017 15:14:31 +0000 (18:14 +0300)]
block/nbd-client: rename nbd_recv_coroutines_enter_all

Rename nbd_recv_coroutines_enter_all to nbd_recv_coroutines_wake_all,
as it most probably just adds all recv coroutines into co_queue_wakeup,
rather than directly enter them.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20170804151440.320927-9-vsementsov@virtuozzo.com>
[eblake: tweak commit message]
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agoblock/nbd-client: get rid of ssize_t
Vladimir Sementsov-Ogievskiy [Fri, 4 Aug 2017 15:14:28 +0000 (18:14 +0300)]
block/nbd-client: get rid of ssize_t

Use int variable for nbd_co_send_request return value (as
nbd_co_send_request returns int).

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20170804151440.320927-6-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agonbd/client: fix nbd_send_request to return int
Vladimir Sementsov-Ogievskiy [Fri, 4 Aug 2017 15:14:27 +0000 (18:14 +0300)]
nbd/client: fix nbd_send_request to return int

Fix nbd_send_request to return int, as it returns a return value
of nbd_write (which is int), and the only user of nbd_send_request's
return value (nbd_co_send_request) consider it as int too.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20170804151440.320927-5-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agonbd/client: refactor nbd_receive_reply
Vladimir Sementsov-Ogievskiy [Fri, 4 Aug 2017 15:14:26 +0000 (18:14 +0300)]
nbd/client: refactor nbd_receive_reply

Refactor nbd_receive_reply to return 1 on success, 0 on eof, when no
data was read and <0 for other cases, because returned size of read
data is not actually used.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20170804151440.320927-4-vsementsov@virtuozzo.com>
[eblake: tweak function comments]
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agonbd/client: refactor nbd_read_eof
Vladimir Sementsov-Ogievskiy [Fri, 4 Aug 2017 15:14:25 +0000 (18:14 +0300)]
nbd/client: refactor nbd_read_eof

Refactor nbd_read_eof to return 1 on success, 0 on eof, when no
data was read and <0 for other cases, because returned size of
read data is not actually used.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20170804151440.320927-3-vsementsov@virtuozzo.com>
[eblake: tweak function comments, rebase to test 083 enhancements]
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agonbd/client: fix nbd_opt_go
Vladimir Sementsov-Ogievskiy [Fri, 4 Aug 2017 15:14:24 +0000 (18:14 +0300)]
nbd/client: fix nbd_opt_go

Do not send NBD_OPT_ABORT to the broken server. After sending
NBD_REP_ACK on NBD_OPT_GO server is most probably in transmission
phase, when option sending is finished.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20170804151440.320927-2-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agoqemu-iotests: test NBD over UNIX domain sockets in 083
Stefan Hajnoczi [Tue, 29 Aug 2017 12:27:45 +0000 (13:27 +0100)]
qemu-iotests: test NBD over UNIX domain sockets in 083

083 only tests TCP.  Some failures might be specific to UNIX domain
sockets.

A few adjustments are necessary:

1. Generating a port number and waiting for server startup is
   TCP-specific.  Use the new nbd-fault-injector.py startup protocol to
   fetch the address.  This is a little more elegant because we don't
   need netstat anymore.

2. The NBD filter does not work for the UNIX domain sockets URIs we
   generate and must be extended.

3. Run all tests twice: once for TCP and once for UNIX domain sockets.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20170829122745.14309-4-stefanha@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agoqemu-iotests: improve nbd-fault-injector.py startup protocol
Stefan Hajnoczi [Tue, 29 Aug 2017 12:27:44 +0000 (13:27 +0100)]
qemu-iotests: improve nbd-fault-injector.py startup protocol

Currently 083 waits for the nbd-fault-injector.py server to start up by
looping until netstat shows the TCP listen socket.

The startup protocol can be simplified by passing a 0 port number to
nbd-fault-injector.py.  The kernel will allocate a port in bind(2) and
the final port number can be printed by nbd-fault-injector.py.

This should make it slightly nicer and less TCP-specific to wait for
server startup.  This patch changes nbd-fault-injector.py, the next one
will rewrite server startup in 083.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20170829122745.14309-3-stefanha@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agonbd-client: avoid read_reply_co entry if send failed
Stefan Hajnoczi [Tue, 29 Aug 2017 12:27:43 +0000 (13:27 +0100)]
nbd-client: avoid read_reply_co entry if send failed

The following segfault is encountered if the NBD server closes the UNIX
domain socket immediately after negotiation:

  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  aio_co_schedule (ctx=0x0, co=0xd3c0ff2ef0) at util/async.c:441
  441       QSLIST_INSERT_HEAD_ATOMIC(&ctx->scheduled_coroutines,
  (gdb) bt
  #0  0x000000d3c01a50f8 in aio_co_schedule (ctx=0x0, co=0xd3c0ff2ef0) at util/async.c:441
  #1  0x000000d3c012fa90 in nbd_coroutine_end (bs=bs@entry=0xd3c0fec650, request=<optimized out>) at block/nbd-client.c:207
  #2  0x000000d3c012fb58 in nbd_client_co_preadv (bs=0xd3c0fec650, offset=0, bytes=<optimized out>, qiov=0x7ffc10a91b20, flags=0) at block/nbd-client.c:237
  #3  0x000000d3c0128e63 in bdrv_driver_preadv (bs=bs@entry=0xd3c0fec650, offset=offset@entry=0, bytes=bytes@entry=512, qiov=qiov@entry=0x7ffc10a91b20, flags=0) at block/io.c:836
  #4  0x000000d3c012c3e0 in bdrv_aligned_preadv (child=child@entry=0xd3c0ff51d0, req=req@entry=0x7f31885d6e90, offset=offset@entry=0, bytes=bytes@entry=512, align=align@entry=1, qiov=qiov@entry=0x7ffc10a91b20, f
+lags=0) at block/io.c:1086
  #5  0x000000d3c012c6b8 in bdrv_co_preadv (child=0xd3c0ff51d0, offset=offset@entry=0, bytes=bytes@entry=512, qiov=qiov@entry=0x7ffc10a91b20, flags=flags@entry=0) at block/io.c:1182
  #6  0x000000d3c011cc17 in blk_co_preadv (blk=0xd3c0ff4f80, offset=0, bytes=512, qiov=0x7ffc10a91b20, flags=0) at block/block-backend.c:1032
  #7  0x000000d3c011ccec in blk_read_entry (opaque=0x7ffc10a91b40) at block/block-backend.c:1079
  #8  0x000000d3c01bbb96 in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at util/coroutine-ucontext.c:79
  #9  0x00007f3196cb8600 in __start_context () at /lib64/libc.so.6

The problem is that nbd_client_init() uses
nbd_client_attach_aio_context() -> aio_co_schedule(new_context,
client->read_reply_co).  Execution of read_reply_co is deferred to a BH
which doesn't run until later.

In the mean time blk_co_preadv() can be called and nbd_coroutine_end()
calls aio_wake() on read_reply_co.  At this point in time
read_reply_co's ctx isn't set because it has never been entered yet.

This patch simplifies the nbd_co_send_request() ->
nbd_co_receive_reply() -> nbd_coroutine_end() lifecycle to just
nbd_co_send_request() -> nbd_co_receive_reply().  The request is "ended"
if an error occurs at any point.  Callers no longer have to invoke
nbd_coroutine_end().

This cleanup also eliminates the segfault because we don't call
aio_co_schedule() to wake up s->read_reply_co if sending the request
failed.  It is only necessary to wake up s->read_reply_co if a reply was
received.

Note this only happens with UNIX domain sockets on Linux.  It doesn't
seem possible to reproduce this with TCP sockets.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20170829122745.14309-2-stefanha@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agoqemu-iotests: Extend non-shared storage migration test (194)
Kashyap Chamarthy [Tue, 29 Aug 2017 16:50:58 +0000 (18:50 +0200)]
qemu-iotests: Extend non-shared storage migration test (194)

This is the follow-up patch that was discussed[*] as part of feedback to
qemu-iotest 194.

Changes in this patch:

  - Supply 'job-id' parameter to `drive-mirror` invocation.

  - Once migration completes, issue QMP `block-job-cancel` command on
    the source QEMU to gracefully complete `drive-mirror` operation.

  - Once the BLOCK_JOB_COMPLETED event is emitted, stop the NBD server
    on the destination QEMU.

  - Check for both the events: MIGRATION and BLOCK_JOB_COMPLETED.

With the above, the test will also be (almost) in sync with the
procedure outlined in the document 'live-block-operations.rst'[+]
(section: "QMP invocation for live storage migration with
``drive-mirror`` + NBD").

[*] https://lists.nongnu.org/archive/html/qemu-devel/2017-08/msg04820.html
    -- qemu-iotests: add 194 non-shared storage migration test
[+] https://git.qemu.org/gitweb.cgi?p=qemu.git;a=blob;f=docs/interop/live-block-operations.rst

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Message-Id: <20170829165058.8229-1-kchamart@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agoqcow2: allocate cluster_cache/cluster_data on demand
Stefan Hajnoczi [Mon, 21 Aug 2017 13:55:30 +0000 (14:55 +0100)]
qcow2: allocate cluster_cache/cluster_data on demand

Most qcow2 files are uncompressed so it is wasteful to allocate (32 + 1)
* cluster_size + 512 bytes upfront.  Allocate s->cluster_cache and
s->cluster_data when the first read operation is performance on a
compressed cluster.

The buffers are freed in .bdrv_close().  .bdrv_open() no longer has any
code paths that can allocate these buffers, so remove the free functions
in the error code path.

This patch can result in significant memory savings when many qcow2
disks are attached or backing file chains are long:

Before 12.81% (1,023,193,088B)
After   5.36% (393,893,888B)

Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20170821135530.32344-1-stefanha@redhat.com
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agos390x/pci: fixup trap_msix()
Yi Min Zhao [Mon, 28 Aug 2017 08:04:44 +0000 (10:04 +0200)]
s390x/pci: fixup trap_msix()

The function trap_msix() is to check if pcistg instruction would access
msix table entries. The correct boundary condition should be
[table_offset, table_offset+entries*entry_size). But the current
condition calculated misses the last entry. So let's fixup it.

Acked-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Message-Id: <1503907487-2764-2-git-send-email-zyimin@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agopc-bios/s390-ccw.img: update image
Cornelia Huck [Mon, 28 Aug 2017 08:22:54 +0000 (10:22 +0200)]
pc-bios/s390-ccw.img: update image

Contains the following commit:
- s390-ccw: Fix alignment for CCW1

Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390-ccw: Fix alignment for CCW1
Farhan Ali [Fri, 25 Aug 2017 13:24:46 +0000 (09:24 -0400)]
s390-ccw: Fix alignment for CCW1

The commit 198c0d1f9df8c4 s390x/css: check ccw address validity
exposes an alignment issue in ccw bios.

According to PoP the CCW must be doubleword aligned. Let's fix
this in the bios.

Cc: qemu-stable@nongnu.org
Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <3ed8b810b6592daee6a775037ce21f850e40647d.1503667215.git.alifm@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/s390-stattrib: Mark the storage attribute as not user_creatable
Thomas Huth [Thu, 24 Aug 2017 12:00:29 +0000 (14:00 +0200)]
s390x/s390-stattrib: Mark the storage attribute as not user_creatable

The storage attribute devices are only meant to be instantiated one
time, internally. They can not be used by the user, so mark them with
user_creatable = false.

Suggested-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1503576029-24264-1-git-send-email-thuth@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: cleanup cpu.h
David Hildenbrand [Fri, 18 Aug 2017 11:43:53 +0000 (13:43 +0200)]
target/s390x: cleanup cpu.h

Let's reshuffle the function prototypes so we get a cleaner outline
of the files.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-19-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/kvm: move KVM declarations and stubs to separate files
David Hildenbrand [Fri, 18 Aug 2017 11:43:52 +0000 (13:43 +0200)]
s390x/kvm: move KVM declarations and stubs to separate files

Let's do it just like the other architectures. Introduce kvm-stub.c
for stubs and kvm_s390x.h for the declarations.

Change license to GPL2+ and keep copyright notice.

As we are dropping the sysemu/kvm.h include from cpu.h, fix up includes.

Suggested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-18-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x: avoid calling kvm_ functions outside of target/s390x/
David Hildenbrand [Fri, 18 Aug 2017 11:43:51 +0000 (13:43 +0200)]
s390x: avoid calling kvm_ functions outside of target/s390x/

Let's just introduce an helper.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-17-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: move a couple of functions to cpu.c
David Hildenbrand [Fri, 18 Aug 2017 11:43:50 +0000 (13:43 +0200)]
target/s390x: move a couple of functions to cpu.c

Prepare to move more stuff (especially KVM related) from cpu.h to
internal.h.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-16-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: introduce internal.h
David Hildenbrand [Fri, 18 Aug 2017 11:43:49 +0000 (13:43 +0200)]
target/s390x: introduce internal.h

cpu.h should only contain what really has to be accessed outside of
target/s390x/. Add internal.h which can only be used inside target/s390x/.

Move everything that isn't fast enough to run away and restructure it
right away. We'll move all kvm_* stuff later.

Minor style fixes to avoid checkpatch warning to:
- struct Lowcore: "{" goes into same line as typedef
- struct LowCore: add spaces around "-" in array length calculations
- time2tod() and tod2time(): move "{" to separate line
- get_per_atmid(): add space between ")" and "?". Move cases by one char.
- get_per_atmid(): drop extra paremthesis around (1 << 6)

Change license of new file to GPL2+ and keep copyright notice.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-15-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: move get_per_in_range() to misc_helper.c
David Hildenbrand [Fri, 18 Aug 2017 11:43:48 +0000 (13:43 +0200)]
target/s390x: move get_per_in_range() to misc_helper.c

Only used in that file.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-14-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: move s390_do_cpu_reset() to diag.c
David Hildenbrand [Fri, 18 Aug 2017 11:43:47 +0000 (13:43 +0200)]
target/s390x: move s390_do_cpu_reset() to diag.c

Only used in that file. Also drop the comment, not really needed.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-13-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: move psw_key_valid() to mem_helper.c
David Hildenbrand [Fri, 18 Aug 2017 11:43:46 +0000 (13:43 +0200)]
target/s390x: move psw_key_valid() to mem_helper.c

Only used in that file.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-12-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: move cpu_mmu_idx_to_asc() to excp_helper.c
David Hildenbrand [Fri, 18 Aug 2017 11:43:45 +0000 (13:43 +0200)]
target/s390x: move cpu_mmu_idx_to_asc() to excp_helper.c

Only used in that file.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-11-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: move cc_name() to helper.c
David Hildenbrand [Fri, 18 Aug 2017 11:43:44 +0000 (13:43 +0200)]
target/s390x: move cc_name() to helper.c

While at it, move the translations into the function and properly pass
enum cc_op as parameter. We can't move it to cc_helper.c as this would
break --disable-tcg.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-10-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: move gtod_*() declarations to s390-virtio.h
David Hildenbrand [Fri, 18 Aug 2017 11:43:43 +0000 (13:43 +0200)]
target/s390x: move gtod_*() declarations to s390-virtio.h

The functions are not used in target/s390x/ so a header in hw/s390x/
is a better place.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-9-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x: drop inclusion of sysemu/kvm.h from some files
David Hildenbrand [Fri, 18 Aug 2017 11:43:42 +0000 (13:43 +0200)]
s390x: drop inclusion of sysemu/kvm.h from some files

s390-stattrib.c needs definition of TARGET_PAGE_SIZE, solve it via cpu.h.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-8-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/cpumodel: factor out determination of default model name
David Hildenbrand [Fri, 18 Aug 2017 11:43:41 +0000 (13:43 +0200)]
s390x/cpumodel: factor out determination of default model name

Now we can drop inclusion of "sysemu/kvm.h" from "s390-virtio.c".

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-7-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: no need to pass kvm_state to savevm_gtod handlers
David Hildenbrand [Fri, 18 Aug 2017 11:43:40 +0000 (13:43 +0200)]
target/s390x: no need to pass kvm_state to savevm_gtod handlers

Let's avoid any KVM stuff in s390-virtio-ccw.c. This parameter is simply
ignored.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-6-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: simplify gs_allowed()
David Hildenbrand [Fri, 18 Aug 2017 11:43:39 +0000 (13:43 +0200)]
target/s390x: simplify gs_allowed()

No need for kvm_enabled() as this function is only called from KVM and
there is no reason why it shouldn't be allowed for tcg. It is simply not
available under tcg.

Also, there is no need to check for the machine type anymore. Just like
ri_enabled(), we can directly use the stored flag, which results in
"true" for the "none" machine.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-5-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agotarget/s390x: simplify ri_allowed()
David Hildenbrand [Fri, 18 Aug 2017 11:43:38 +0000 (13:43 +0200)]
target/s390x: simplify ri_allowed()

Only used in KVM and there is no reason why it shouldn't be allowed for
tcg - it is simply not available.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-4-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agos390x/kvm: drop KVMState parameter from kvm_s390_set_mem_limit()
David Hildenbrand [Fri, 18 Aug 2017 11:43:37 +0000 (13:43 +0200)]
s390x/kvm: drop KVMState parameter from kvm_s390_set_mem_limit()

Not needed at that point. Also drop it from kvm_s390_query_mem_limit()
we call in kvm_s390_set_mem_limit().

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170818114353.13455-3-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>