]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
5 years agoqapi: Add 'if' to implicit struct members
Marc-André Lureau [Thu, 13 Dec 2018 12:37:15 +0000 (16:37 +0400)]
qapi: Add 'if' to implicit struct members

The generated code is for now *unconditional*.  Later patches generate
the conditionals.

Note that union discriminators may not have 'if' conditionals.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-14-marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-15-marcandre.lureau@redhat.com>
[Patches squashed, commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: add a dictionary form for TYPE
Marc-André Lureau [Thu, 13 Dec 2018 12:37:14 +0000 (16:37 +0400)]
qapi: add a dictionary form for TYPE

Wherever a struct/union/alternate/command/event member with NAME: TYPE
form is accepted, desugar it to a NAME: { 'type': TYPE } form.

This will allow to add new member details, such as 'if' in the
following patch to introduce conditionals, or 'default' for default
values etc.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-13-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi-events: add 'if' condition to implicit event enum
Marc-André Lureau [Thu, 13 Dec 2018 12:37:12 +0000 (16:37 +0400)]
qapi-events: add 'if' condition to implicit event enum

Add condition to QAPIEvent enum members based on the event 'if'.

The generated code remains unconditional for now. Later patches
generate the conditionals (also there is no additional coverage of
this change in qapi-schema-test.out since the event_names enum is an
implicit type created by qapi/events.py).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-11-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: add 'if' to enum members
Marc-André Lureau [Thu, 13 Dec 2018 12:37:11 +0000 (16:37 +0400)]
qapi: add 'if' to enum members

QAPISchemaMember gains .ifcond for enum members: inherited classes,
such as QAPISchemaObjectTypeMember, will thus have an ifcond member
after this (those different types will also use the .ifcond to store
the condition and generate conditional code in the following patches).

The generated code remains unconditional for now. Later patches
generate the conditionals.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-10-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: add a dictionary form with 'name' key for enum members
Marc-André Lureau [Thu, 13 Dec 2018 12:37:08 +0000 (16:37 +0400)]
qapi: add a dictionary form with 'name' key for enum members

Desugar the enum NAME form to { 'name': NAME }. This will allow to add
new enum members, such as 'if' in the following patch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-7-marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-8-marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-9-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Harmless accidental move backed out, long line wrapped, patches
squashed]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: improve reporting of unknown or missing keys
Marc-André Lureau [Thu, 13 Dec 2018 12:37:07 +0000 (16:37 +0400)]
qapi: improve reporting of unknown or missing keys

Report the set of missing or unknown keys. And give a hint about the
accepted keys.

The error message for multiple meta type members (visible in
tests/qapi-schema/double-type.err) is not improved.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-6-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: factor out checking for keys
Marc-André Lureau [Thu, 13 Dec 2018 12:37:06 +0000 (16:37 +0400)]
qapi: factor out checking for keys

Introduce a new helper function to check if the given keys are known,
and if mandatory keys are present. The function will be reused in
other places in the following code changes.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-5-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agotests: print enum type members more like object type members
Marc-André Lureau [Thu, 13 Dec 2018 12:37:05 +0000 (16:37 +0400)]
tests: print enum type members more like object type members

Commit 93bda4dd461 changed the internal representation of enum type
members from str to QAPISchemaMember, but we still print only a
string.  Has been good enough, as the name is the member's only
attribute of interest, but that's about to change.  To prepare, print
them more like object type members.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-4-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: change enum visitor and gen_enum* to take QAPISchemaMember
Marc-André Lureau [Thu, 13 Dec 2018 12:37:04 +0000 (16:37 +0400)]
qapi: change enum visitor and gen_enum* to take QAPISchemaMember

This will allow to add and access more properties associated with enum
values/members, like the associated 'if' condition. We may want to
have a specialized type QAPISchemaEnumMember, for now this will do.

Modify gen_enum() and gen_enum_lookup() for the same reason.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-3-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: Do not define enumeration value explicitly
Marc-André Lureau [Thu, 13 Dec 2018 12:37:03 +0000 (16:37 +0400)]
qapi: Do not define enumeration value explicitly

The generated C enumeration types explicitly set the enumeration
constants to 0, 1, 2, ...  That's exactly what you get when you don't
supply values.

Drop the explicit values.  No change now, but it will avoid gaps in
the values when we later add support for 'if' conditions.  Avoiding
such gaps will save us the trouble of changing the ENUM_lookup[]
tables to work without a sentinel.

We'll have to take care to ensure the headers required by the 'if'
conditions get always included before the generated QAPI code.
Fortunately, our convention to include "qemu/osdep.h" first in any .c
ensures that's the case for our CONFIG_FOO macros.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-2-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: break long lines at 'data' member
Marc-André Lureau [Sat, 8 Dec 2018 11:16:04 +0000 (15:16 +0400)]
qapi: break long lines at 'data' member

Let's break the line before 'data'. While at it, improve a bit
indentation/spacing. (I removed some alignment which are not helping
much readability and become quickly inconsistent)

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181208111606.8505-26-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: rename QAPISchemaEnumType.values to .members
Marc-André Lureau [Sat, 8 Dec 2018 11:15:42 +0000 (15:15 +0400)]
qapi: rename QAPISchemaEnumType.values to .members

Rename QAPISchemaEnumType.values and related variables to members.
Makes sense ever since commit 93bda4dd4 changed .values from list of
string to list of QAPISchemaMember. Obvious no-op.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181208111606.8505-4-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agotests/qapi: Cover commands with 'if' and union / alternate 'data'
Marc-André Lureau [Sat, 8 Dec 2018 11:15:57 +0000 (15:15 +0400)]
tests/qapi: Cover commands with 'if' and union / alternate 'data'

Forgotten in commit 967c885108f.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181208111606.8505-19-marcandre.lureau@redhat.com>
Message-Id: <20181208111606.8505-21-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Squashed, commit message adjusted]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agojson: Fix to reject duplicate object member names
Markus Armbruster [Thu, 6 Dec 2018 12:17:43 +0000 (13:17 +0100)]
json: Fix to reject duplicate object member names

The JSON parser happily accepts duplicate object member names.  The
last value wins.  Reproducer #1:

    $ qemu-system-x86_64 -qmp stdio
    {"QMP": {"version": {"qemu": {"micro": 93, "minor": 0, "major": 3},
    "package": "v3.1.0-rc3-7-g87a45d86ed"}, "capabilities": []}}
    {'execute':'qmp_capabilities'}
    {"return": {}}
    {'execute':'blockdev-add','arguments':{'driver':'null-co',
     'node-name':'foo','node-name':'bar'}}
    {"return": {}}
    {'execute':'query-named-block-nodes'}
    {"return": [{ [...] "node-name": "bar" [...] }]}

Reproducer #2 is iotest 229.

Fix the parser to reject duplicates, and fix iotest 229 not to use
them.

Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181206121743.20762-1-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[Trailing whitespace tidied up]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agodocs: Update references to JSON RFC
Eric Blake [Mon, 3 Dec 2018 17:57:02 +0000 (11:57 -0600)]
docs: Update references to JSON RFC

RFC8259 obsoletes RFC7159. Fix a couple of URLs to point to the
newer version.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181203175702.128701-1-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agotest-string-input-visitor: Add range overflow tests
David Hildenbrand [Wed, 21 Nov 2018 16:44:21 +0000 (17:44 +0100)]
test-string-input-visitor: Add range overflow tests

Let's make sure that the range handling code can properly deal with
ranges that end at the biggest possible number.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-10-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agotest-string-input-visitor: Split off uint64 list tests
David Hildenbrand [Wed, 21 Nov 2018 16:44:20 +0000 (17:44 +0100)]
test-string-input-visitor: Split off uint64 list tests

Basically copy all int64 list tests but adapt them to work on uint64
instead. The values for very big/very small values have to be adapted.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-9-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agotest-string-input-visitor: Use virtual walk
David Hildenbrand [Wed, 21 Nov 2018 16:44:19 +0000 (17:44 +0100)]
test-string-input-visitor: Use virtual walk

We now support virtual walks, so use that instead.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-8-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: Rewrite string-input-visitor's integer and list parsing
David Hildenbrand [Wed, 21 Nov 2018 16:44:18 +0000 (17:44 +0100)]
qapi: Rewrite string-input-visitor's integer and list parsing

The input visitor has some problems right now, especially
- unsigned type "Range" is used to process signed ranges, resulting in
  inconsistent behavior and ugly/magical code
- uint64_t are parsed like int64_t, so big uint64_t values are not
  supported and error messages are misleading
- lists/ranges of int64_t are accepted although no list is parsed and
  we should rather report an error
- lists/ranges are preparsed using int64_t, making it hard to
  implement uint64_t values or uint64_t lists
- types that don't support lists don't bail out
- visiting beyond the end of a list is not handled properly
- we don't actually parse lists, we parse *sets*: members are sorted,
  and duplicates eliminated

So let's rewrite it by getting rid of usage of the type "Range" and
properly supporting lists of int64_t and uint64_t (including ranges of
both types), fixing the above mentioned issues.

Lists of other types are not supported and will properly report an
error. Virtual walks are now supported.

Tests have to be fixed up:
- Two BUGs were hardcoded that are fixed now
- The string-input-visitor now actually returns a parsed list and not
  an ordered set.

Please note that no users/callers have to be fixed up. Candidates using
visit_type_uint16List() and friends are:
- backends/hostmem.c:host_memory_backend_set_host_nodes()
-- Code can deal with duplicates/unsorted lists
- numa.c::query_memdev()
-- via object_property_get_uint16List(), the list will still be sorted
   and without duplicates (via host_memory_backend_get_host_nodes())
- qapi-visit.c::visit_type_Memdev_members()
- qapi-visit.c::visit_type_NumaNodeOptions_members()
- qapi-visit.c::visit_type_RockerOfDpaGroup_members
- qapi-visit.c::visit_type_RxFilterInfo_members()
-- Not used with string-input-visitor.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-7-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agotest-string-input-visitor: Add more tests
David Hildenbrand [Wed, 21 Nov 2018 16:44:17 +0000 (17:44 +0100)]
test-string-input-visitor: Add more tests

Test that very big/small values are not accepted and that ranges with
only one element work. Also test that ranges are ascending and cannot
have more than 65536 elements.

Rename expect4 to expect5, as we will be moving that to a separate ulist
test after the rework.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-6-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: Use qemu_strtod_finite() in qobject-input-visitor
David Hildenbrand [Wed, 21 Nov 2018 16:44:16 +0000 (17:44 +0100)]
qapi: Use qemu_strtod_finite() in qobject-input-visitor

Let's use the new function. Just as current behavior, we have to
consume the whole string (now it's just way clearer what's going on).

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-5-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi: Fix string-input-visitor to reject NaN and infinities
David Hildenbrand [Wed, 21 Nov 2018 16:44:15 +0000 (17:44 +0100)]
qapi: Fix string-input-visitor to reject NaN and infinities

The string-input-visitor happily accepts NaN and infinities when parsing
numbers (doubles). They shouldn't. Fix that.

Also, add two test cases, testing if "NaN" and "inf" is properly
rejected.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-4-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agocutils: Fix qemu_strtosz() & friends to reject non-finite sizes
David Hildenbrand [Wed, 21 Nov 2018 16:44:14 +0000 (17:44 +0100)]
cutils: Fix qemu_strtosz() & friends to reject non-finite sizes

qemu_strtosz() & friends reject NaNs, but happily accept infinities.
They shouldn't. Fix that.

The fix makes use of qemu_strtod_finite(). To avoid ugly casts,
change the @end parameter of qemu_strtosz() & friends from char **
to const char **.

Also, add two test cases, testing that "inf" and "NaN" are properly
rejected. While at it, also fixup the function documentation.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-3-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agocutils: Add qemu_strtod() and qemu_strtod_finite()
David Hildenbrand [Wed, 21 Nov 2018 16:44:13 +0000 (17:44 +0100)]
cutils: Add qemu_strtod() and qemu_strtod_finite()

Let's provide a wrapper for strtod().

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181121164421.20780-2-david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2018-12-12' into staging
Peter Maydell [Thu, 13 Dec 2018 13:41:44 +0000 (13:41 +0000)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2018-12-12' into staging

Monitor patches for 2018-12-12

# gpg: Signature made Wed 12 Dec 2018 10:08:15 GMT
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-monitor-2018-12-12:
  tests: add oob functional test for test-qmp-cmds
  Revert "tests: Add parameter to qtest_init_without_qmp_handshake"
  monitor: Remove "x-oob", offer capability "oob" unconditionally
  monitor: Suspend monitor instead dropping commands
  monitor: avoid potential dead-lock when cleaning up
  monitor: prevent inserting new monitors after cleanup
  colo: check chardev can switch context
  monitor: check if chardev can switch gcontext for OOB
  char: add a QEMU_CHAR_FEATURE_GCONTEXT flag
  monitor: accept chardev input from iothread
  monitor: inline ambiguous helper functions

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20181212' into staging
Peter Maydell [Thu, 13 Dec 2018 13:06:09 +0000 (13:06 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20181212' into staging

s390x patches for 4.0:
- add 4.0 machine type
- various fixes and small changes

# gpg: Signature made Wed 12 Dec 2018 09:52:04 GMT
# gpg:                using RSA key DECF6B93C6F02FAF
# 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-20181212:
  hw/s390x/virtio-ccw.c: Don't take address of fields in packed structs
  vfio-ap: flag as compatible with balloon
  s390x/tod: Properly stop the KVM TOD while the guest is not running
  s390/MAINTAINERS: Add Halil as kvm and machine maintainer
  s390x: introduce 4.0 compat machine
  s390x/zpci: drop msix.available

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Thu, 13 Dec 2018 11:35:42 +0000 (11:35 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

Minor virtio-blk fixes.

# gpg: Signature made Wed 12 Dec 2018 09:50:17 GMT
# gpg:                using RSA key 9CA4ABB381AB73C8
# 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:
  virtio-blk: fix comment for virtio_blk_rw_complete as nalloc is initially -1
  virtio-blk: rename iov to out_iov in virtio_blk_handle_request()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-12-04-1' into...
Peter Maydell [Thu, 13 Dec 2018 09:27:30 +0000 (09:27 +0000)]
Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-12-04-1' into staging

Merge tpm 2018/12/04 v1

# gpg: Signature made Tue 04 Dec 2018 15:25:52 GMT
# gpg:                using RSA key 75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.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: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2018-12-04-1:
  tpm: Make sure the locality received from backend is valid
  tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
  tpm: Remove unused locty parameter from tpm_tis_abort()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging
Peter Maydell [Wed, 12 Dec 2018 21:11:49 +0000 (21:11 +0000)]
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging

x86 queue, 2018-12-11

* New CPU features: MOVDIRI, MOVDIR64B (Liu Jingqi);
  STIBP (Eduardo Habkost)
* Fix clang build warning (Peter Maydell)

# gpg: Signature made Tue 11 Dec 2018 20:52:56 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-next-pull-request:
  i386: Add "stibp" flag name
  target/i386/kvm.c: Don't mark cpuid_data as QEMU_PACKED
  x86/cpu: Enable MOVDIR64B cpu feature
  x86/cpu: Enable MOVDIRI cpu feature

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/s390x/virtio-ccw.c: Don't take address of fields in packed structs
Peter Maydell [Mon, 10 Dec 2018 12:04:36 +0000 (12:04 +0000)]
hw/s390x/virtio-ccw.c: Don't take address of fields in packed structs

Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

Patch produced with scripts/coccinelle/inplace-byteswaps.cocci
(with a couple of long lines manually wrapped).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20181210120436.30522-1-peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agovfio-ap: flag as compatible with balloon
Cornelia Huck [Wed, 5 Dec 2018 14:35:03 +0000 (15:35 +0100)]
vfio-ap: flag as compatible with balloon

vfio-ap devices do not pin any pages in the host. Therefore, they
are compatible with memory ballooning.

Flag them as compatible, so both vfio-ap and a balloon can be
used simultaneously.

Cc: qemu-stable@nongnu.org
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Tested-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tod: Properly stop the KVM TOD while the guest is not running
David Hildenbrand [Fri, 30 Nov 2018 09:49:57 +0000 (10:49 +0100)]
s390x/tod: Properly stop the KVM TOD while the guest is not running

Just like on other architectures, we should stop the clock while the guest
is not running. This is already properly done for TCG. Right now, doing an
offline migration (stop, migrate, cont) can easily trigger stalls in the
guest.

Even doing a
    (hmp) stop
    ... wait 2 minutes ...
    (hmp) cont
will already trigger stalls.

So whenever the guest stops, backup the KVM TOD. When continuing to run
the guest, restore the KVM TOD.

One special case is starting a simple VM: Reading the TOD from KVM to
stop it right away until the guest is actually started means that the
time of any simple VM will already differ to the host time. We can
simply leave the TOD running and the guest won't be able to recognize
it.

For migration, we actually want to keep the TOD stopped until really
starting the guest. To be able to catch most errors, we should however
try to set the TOD in addition to simply storing it. So we can still
catch basic migration problems.

If anything goes wrong while backing up/restoring the TOD, we have to
ignore it (but print a warning). This is then basically a fallback to
old behavior (TOD remains running).

I tested this very basically with an initrd:
    1. Start a simple VM. Observed that the TOD is kept running. Old
       behavior.
    2. Ordinary live migration. Observed that the TOD is temporarily
       stopped on the destination when setting the new value and
       correctly started when finally starting the guest.
    3. Offline live migration. (stop, migrate, cont). Observed that the
       TOD will be stopped on the source with the "stop" command. On the
       destination, the TOD is temporarily stopped when setting the new
       value and correctly started when finally starting the guest via
       "cont".
    4. Simple stop/cont correctly stops/starts the TOD. (multiple stops
       or conts in a row have no effect, so works as expected)

In the future, we might want to send the guest a special kind of time sync
interrupt under some conditions, so it can synchronize its tod to the
host tod. This is interesting for migration scenarios but also when we
get time sync interrupts ourselves. This however will most probably have
to be handled in KVM (e.g. when the tods differ too much) and is not
desired e.g. when debugging the guest (single stepping should not
result in permanent time syncs). I consider something like that an add-on
on top of this basic "don't break the guest" handling.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181130094957.4121-1-david@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390/MAINTAINERS: Add Halil as kvm and machine maintainer
Christian Borntraeger [Tue, 4 Dec 2018 13:38:02 +0000 (14:38 +0100)]
s390/MAINTAINERS: Add Halil as kvm and machine maintainer

Halil does more work in this area than I do right now. Lets add Halil.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20181204133802.100998-1-borntraeger@de.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x: introduce 4.0 compat machine
Cornelia Huck [Mon, 19 Nov 2018 10:58:53 +0000 (11:58 +0100)]
s390x: introduce 4.0 compat machine

Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/zpci: drop msix.available
David Hildenbrand [Mon, 5 Nov 2018 11:03:10 +0000 (12:03 +0100)]
s390x/zpci: drop msix.available

I fail to see why this is useful as we require MSIX always and
completely fail adding a device.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181105110313.29312-2-david@redhat.com>
Fixes: 4f6482bfe3da1e6b51ad4722a0c22f22f0d54a3b
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agotests: add oob functional test for test-qmp-cmds
Peter Xu [Tue, 9 Oct 2018 06:27:17 +0000 (14:27 +0800)]
tests: add oob functional test for test-qmp-cmds

Straightforward test just to let the test-qmp-cmds be complete.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20181009062718.1914-6-peterx@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoRevert "tests: Add parameter to qtest_init_without_qmp_handshake"
Peter Xu [Tue, 9 Oct 2018 06:27:16 +0000 (14:27 +0800)]
Revert "tests: Add parameter to qtest_init_without_qmp_handshake"

This reverts commit ddee57e0176f6ab53b13c6c97605b62737a8fd7a.

Meanwhile, revert one line from fa198ad9bdef to make sure
qtest_init_without_qmp_handshake() will only pass in one parameter.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20181009062718.1914-5-peterx@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agomonitor: Remove "x-oob", offer capability "oob" unconditionally
Peter Xu [Tue, 9 Oct 2018 06:27:15 +0000 (14:27 +0800)]
monitor: Remove "x-oob", offer capability "oob" unconditionally

Out-of-band command execution was introduced in commit cf869d53172.
Unfortunately, we ran into a regression, and had to turn it into an
experimental option for 2.12 (commit be933ffc23).

  http://lists.gnu.org/archive/html/qemu-devel/2018-03/msg06231.html

The regression has since been fixed (commit 951702f39c7 "monitor: bind
dispatch bh to iohandler context").  A thorough re-review of OOB
commands led to a few more issues, which have also been addressed.

This patch partly reverts be933ffc23 (monitor: new parameter "x-oob"),
and makes QMP monitors again offer capability "oob" whenever they can
provide it, i.e. when the monitor's character device is capable of
running in an I/O thread.

Some trivial touch-up in the test code is required to make sure qmp-test
won't break.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20181009062718.1914-4-peterx@redhat.com>
[Conflict with "monitor: check if chardev can switch gcontext for OOB"
resolved, commit message updated]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agovirtio-blk: fix comment for virtio_blk_rw_complete as nalloc is initially -1
Dongli Zhang [Tue, 6 Nov 2018 04:52:32 +0000 (12:52 +0800)]
virtio-blk: fix comment for virtio_blk_rw_complete as nalloc is initially -1

The initial value of nalloc is -1, but not 1.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-id: 1541479952-32355-1-git-send-email-dongli.zhang@oracle.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agovirtio-blk: rename iov to out_iov in virtio_blk_handle_request()
Dongli Zhang [Tue, 6 Nov 2018 16:09:16 +0000 (00:09 +0800)]
virtio-blk: rename iov to out_iov in virtio_blk_handle_request()

In virtio_blk_handle_request(), in_iov is used for input header while iov
is used for output header. Rename iov to out_iov to pair output header's
name with in_iov to avoid confusing people when reading source code.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Message-id: 1541520556-8334-1-git-send-email-dongli.zhang@oracle.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agomonitor: Suspend monitor instead dropping commands
Peter Xu [Tue, 9 Oct 2018 06:27:13 +0000 (14:27 +0800)]
monitor: Suspend monitor instead dropping commands

When a QMP client sends in-band commands more quickly that we can
process them, we can either queue them without limit (QUEUE), drop
commands when the queue is full (DROP), or suspend receiving commands
when the queue is full (SUSPEND).  None of them is ideal:

* QUEUE lets a misbehaving client make QEMU eat memory without bounds.
Not such a hot idea.

* With DROP, the client has to cope with dropped in-band commands.  To
inform the client, we send a COMMAND_DROPPED event then.  The event is
flawed by design in two ways: it's ambiguous (see commit d621cfe0a17),
and it brings back the "eat memory without bounds" problem.

* With SUSPEND, the client has to manage the flow of in-band commands to
keep the monitor available for out-of-band commands.

We currently DROP.  Switch to SUSPEND.

Managing the flow of in-band commands to keep the monitor available for
out-of-band commands isn't really hard: just count the number of
"outstanding" in-band commands (commands sent minus replies received),
and if it exceeds the limit, hold back additional ones until it drops
below the limit again.

Note that we need to be careful pairing the suspend with a resume, or
else the monitor will hang, possibly forever.  And here since we need to
make sure both:

     (1) popping request from the req queue, and
     (2) reading length of the req queue

will be in the same critical section, we let the pop function take the
corresponding queue lock when there is a request, then we release the
lock from the caller.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20181009062718.1914-2-peterx@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agomonitor: avoid potential dead-lock when cleaning up
Marc-André Lureau [Wed, 5 Dec 2018 20:37:37 +0000 (00:37 +0400)]
monitor: avoid potential dead-lock when cleaning up

When a monitor is connected to a Spice chardev, the monitor cleanup
can dead-lock:

 #0  0x00007f43446637fd in __lll_lock_wait () at /lib64/libpthread.so.0
 #1  0x00007f434465ccf4 in pthread_mutex_lock () at /lib64/libpthread.so.0
 #2  0x0000556dd79f22ba in qemu_mutex_lock_impl (mutex=0x556dd81c9220 <monitor_lock>, file=0x556dd7ae3648 "/home/elmarco/src/qq/monitor.c", line=645) at /home/elmarco/src/qq/util/qemu-thread-posix.c:66
 #3  0x0000556dd7431bd5 in monitor_qapi_event_queue (event=QAPI_EVENT_SPICE_DISCONNECTED, qdict=0x556dd9abc850, errp=0x7fffb7bbddd8) at /home/elmarco/src/qq/monitor.c:645
 #4  0x0000556dd79d476b in qapi_event_send_spice_disconnected (server=0x556dd98ee760, client=0x556ddaaa8560, errp=0x556dd82180d0 <error_abort>) at qapi/qapi-events-ui.c:149
 #5  0x0000556dd7870fc1 in channel_event (event=3, info=0x556ddad1b590) at /home/elmarco/src/qq/ui/spice-core.c:235
 #6  0x00007f434560a6bb in reds_handle_channel_event (reds=<optimized out>, event=3, info=0x556ddad1b590) at reds.c:316
 #7  0x00007f43455f393b in main_dispatcher_self_handle_channel_event (info=0x556ddad1b590, event=3, self=0x556dd9a7d8c0) at main-dispatcher.c:197
 #8  0x00007f43455f393b in main_dispatcher_channel_event (self=0x556dd9a7d8c0, event=event@entry=3, info=0x556ddad1b590) at main-dispatcher.c:197
 #9  0x00007f4345612833 in red_stream_push_channel_event (s=s@entry=0x556ddae2ef40, event=event@entry=3) at red-stream.c:414
 #10 0x00007f434561286b in red_stream_free (s=0x556ddae2ef40) at red-stream.c:388
 #11 0x00007f43455f9ddc in red_channel_client_finalize (object=0x556dd9bb21a0) at red-channel-client.c:347
 #12 0x00007f434b5f9fb9 in g_object_unref () at /lib64/libgobject-2.0.so.0
 #13 0x00007f43455fc212 in red_channel_client_push (rcc=0x556dd9bb21a0) at red-channel-client.c:1341
 #14 0x0000556dd76081ba in spice_port_set_fe_open (chr=0x556dd9925e20, fe_open=0) at /home/elmarco/src/qq/chardev/spice.c:241
 #15 0x0000556dd796d74a in qemu_chr_fe_set_open (be=0x556dd9a37c00, fe_open=0) at /home/elmarco/src/qq/chardev/char-fe.c:340
 #16 0x0000556dd796d4d9 in qemu_chr_fe_set_handlers (b=0x556dd9a37c00, fd_can_read=0x0, fd_read=0x0, fd_event=0x0, be_change=0x0, opaque=0x0, context=0x0, set_open=true) at /home/elmarco/src/qq/chardev/char-fe.c:280
 #17 0x0000556dd796d359 in qemu_chr_fe_deinit (b=0x556dd9a37c00, del=false) at /home/elmarco/src/qq/chardev/char-fe.c:233
 #18 0x0000556dd7432240 in monitor_data_destroy (mon=0x556dd9a37c00) at /home/elmarco/src/qq/monitor.c:786
 #19 0x0000556dd743b968 in monitor_cleanup () at /home/elmarco/src/qq/monitor.c:4683
 #20 0x0000556dd75ce776 in main (argc=3, argv=0x7fffb7bbe458, envp=0x7fffb7bbe478) at /home/elmarco/src/qq/vl.c:4660

Because spice code tries to emit a "disconnected" signal on the
monitors. Fix this dead-lock by releasing the monitor lock for
flush/destroy.

monitor_lock protects mon_list, monitor_qapi_event_state and
monitor_destroyed. monitor_flush() and monitor_data_destroy() don't
access any of those variables.

monitor_cleanup()'s loop is safe because it uses
QTAILQ_FOREACH_SAFE(), and no further monitor can be added after
calling monitor_cleanup() thanks to monitor_destroyed check in
monitor_list_append().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181205203737.9011-8-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agomonitor: prevent inserting new monitors after cleanup
Marc-André Lureau [Wed, 5 Dec 2018 20:37:36 +0000 (00:37 +0400)]
monitor: prevent inserting new monitors after cleanup

monitor_cleanup() is one of the last things main() calls before it
returns.  In the following patch, monitor_cleanup() will release the
monitor_lock during flushing. There may be pending commands to insert
new monitors, which would modify the mon_list during iteration, and
the clean-up could thus miss those new insertions.

Add a monitor_destroyed global to check if monitor_cleanup() has been
already called. In this case, don't insert the new monitor in the
list, but free it instead. A cleaner solution would involve the main
thread telling other threads to terminate, waiting for their
termination.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181205203737.9011-7-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agocolo: check chardev can switch context
Marc-André Lureau [Wed, 5 Dec 2018 20:37:35 +0000 (00:37 +0400)]
colo: check chardev can switch context

COLO uses a worker context (iothread) to drive the chardev. All
backends are not able to switch the context, let's report an error in
this case.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181205203737.9011-6-marcandre.lureau@redhat.com>
Reviewed-by: Li Zhijian <lizhiian@cn.fujitsu.com>
Reviewed-by: Zhang Chen <zhangckid@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agomonitor: check if chardev can switch gcontext for OOB
Marc-André Lureau [Wed, 5 Dec 2018 20:37:34 +0000 (00:37 +0400)]
monitor: check if chardev can switch gcontext for OOB

Not all backends are able to switch gcontext. Those backends cannot
drive a OOB monitor (the monitor would then be blocking on main
thread).

For example, ringbuf, spice, or more esoteric input chardevs like
braille or MUX.

We already forbid MUX because not all frontends are ready to run outside
main loop.  Replace that by a context-switching feature check.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181205203737.9011-5-marcandre.lureau@redhat.com>
[Error condition simplified, commit message adjusted accordingly]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agochar: add a QEMU_CHAR_FEATURE_GCONTEXT flag
Marc-André Lureau [Wed, 5 Dec 2018 20:37:33 +0000 (00:37 +0400)]
char: add a QEMU_CHAR_FEATURE_GCONTEXT flag

QEMU_CHAR_FEATURE_GCONTEXT declares the character device can switch
GMainContext.

Assert we don't switch context when the character device doesn't
provide this feature.  Character device users must not violate this
restriction.  In particular, user configurations that violate them
must be rejected.

Existing frontend that rely on context switching would now assert() if
the backend doesn't allow it (instead of silently producing undesired
events in the default context). Following patches improve the
situation by reporting an error earlier instead, on the frontend side.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181205203737.9011-4-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agomonitor: accept chardev input from iothread
Marc-André Lureau [Wed, 5 Dec 2018 20:37:32 +0000 (00:37 +0400)]
monitor: accept chardev input from iothread

Chardev backends may not handle safely IO events from concurrent
threads (may not handle I/O events from concurrent threads safely,
only the write path is since commit >
9005b2a7589540a3733b3abdcfbccfe7746cd1a1). Better to wake up the
chardev from the monitor IO thread if it's being used as the chardev
context.

Unify code paths by using a BH in all cases.

Drop the now redundant aio_notify() call.

Clean up control flow not to rely on mon->use_io_thread implying
monitor_is_qmp(mon).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181205203737.9011-3-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agomonitor: inline ambiguous helper functions
Marc-André Lureau [Wed, 5 Dec 2018 20:37:31 +0000 (00:37 +0400)]
monitor: inline ambiguous helper functions

The function were not named with "mon_iothread", or following the AIO
vs GMainContext distinction. Inline them instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181205203737.9011-2-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/vivier2/tags/trivial-patches-pull-request'...
Peter Maydell [Tue, 11 Dec 2018 22:26:44 +0000 (22:26 +0000)]
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-patches-pull-request' into staging

Trivial patches (2018-12-11)

# gpg: Signature made Tue 11 Dec 2018 18:02:20 GMT
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/trivial-patches-pull-request: (30 commits)
  Fixes i386 xchgq test
  maint: Grammar fix to mailmap
  MAINTAINERS: Update email address for Fam Zheng
  cutils: Assert in-range base for string-to-integer conversions
  util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
  target: hax: fix errors in comment
  MAINTAINERS: Use my work email to review Build and test automation patches
  MAINTAINERS: Add a missing entry for the NVDIMM device
  MAINTAINERS: Add a missing entry to the QMP section
  MAINTAINERS: Add a missing entry to SPICE
  MAINTAINERS: Add missing entries for the MPS2 machine
  MAINTAINERS: Add missing entries for the Canon DIGIC machine
  MAINTAINERS: Add missing entries to the vhost section
  MAINTAINERS: Add missing entries to the PC Chipset section
  MAINTAINERS: Add a missing entry for the sun4m machines
  MAINTAINERS: Add a missing entry for the Old World machines
  MAINTAINERS: Add a missing entry for the Xilinx S3A-DSP 1800 machine
  MAINTAINERS: Add missing entries for the Jazz machine
  MAINTAINERS: Add missing entries for the Xilinx ZynqMP machine
  MAINTAINERS: Add a missing entry to the SPARC CPU
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoi386: Add "stibp" flag name
Eduardo Habkost [Mon, 10 Dec 2018 18:02:50 +0000 (16:02 -0200)]
i386: Add "stibp" flag name

The STIBP flag may be supported by the host KVM module, so QEMU
can allow it to be configured manually, and it can be exposed to
guests when using "-cpu host".

No additional migration code is required because the whole
contents of spec_ctrl is already migrated in the "cpu/spec_ctrl"
section.

Corresponding KVM patch was submitted at:
https://lore.kernel.org/lkml/20181205191956.31480-1-ehabkost@redhat.com/

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181210180250.31299-1-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agotarget/i386/kvm.c: Don't mark cpuid_data as QEMU_PACKED
Peter Maydell [Mon, 10 Dec 2018 11:46:54 +0000 (11:46 +0000)]
target/i386/kvm.c: Don't mark cpuid_data as QEMU_PACKED

clang complains about taking the address of a packed
member of a struct:

target/i386/kvm.c:1245:27: warning: taking address of packed member 'cpuid' of class or structure '' may result in an unaligned pointer value [-Waddress-of-packed-member]
    c = cpuid_find_entry(&cpuid_data.cpuid, 1, 0);
                          ^~~~~~~~~~~~~~~~
target/i386/kvm.c:1297:31: warning: taking address of packed member 'cpuid' of class or structure '' may result in an unaligned pointer value [-Waddress-of-packed-member]
        c = cpuid_find_entry(&cpuid_data.cpuid, kvm_base, 0);
                              ^~~~~~~~~~~~~~~~

The kernel's definitions of struct kvm_cpuid2 and struct
kvm_cpuid_entry2 are carefully set up with padding fields
so that there is no between-struct padding anyway, so
the QEMU_PACKED annotation is unnecessary and might result
in the compiler generating worse code. Drop it, and instead
assert at build time that there is no stray padding.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20181210114654.31433-1-peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agox86/cpu: Enable MOVDIR64B cpu feature
Liu Jingqi [Tue, 6 Nov 2018 07:13:27 +0000 (15:13 +0800)]
x86/cpu: Enable MOVDIR64B cpu feature

MOVDIR64B moves 64-bytes as direct-store with 64-bytes write atomicity.
Direct store is implemented by using write combining (WC) for writing
data directly into memory without caching the data.

The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 28] MOVDIR64B

The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

Cc: Xu Tao <tao3.xu@intel.com>
Signed-off-by: Liu Jingqi <jingqi.liu@intel.com>
Message-Id: <1541488407-17045-3-git-send-email-jingqi.liu@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agox86/cpu: Enable MOVDIRI cpu feature
Liu Jingqi [Tue, 6 Nov 2018 07:13:26 +0000 (15:13 +0800)]
x86/cpu: Enable MOVDIRI cpu feature

MOVDIRI moves doubleword or quadword from register to memory through
direct store which is implemented by using write combining (WC) for
writing data directly into memory without caching the data.

The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 27] MOVDIRI

The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

Cc: Xu Tao <tao3.xu@intel.com>
Signed-off-by: Liu Jingqi <jingqi.liu@intel.com>
Message-Id: <1541488407-17045-2-git-send-email-jingqi.liu@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into...
Peter Maydell [Tue, 11 Dec 2018 19:18:58 +0000 (19:18 +0000)]
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging

Machine queue post-3.1.0 (including 4.0 machine-types)

Features:
* Add 4.0 machine-types to q35/440fx/arm/spapr (Alex Williamson)

Documentation:
* Document vCPU hotplug procedure (Kashyap Chamarthy)
* Deprecate `cpu-add` monitor commands (Kashyap Chamarthy)

Bug fixes:
* A small sun4v_rtc_write() tracing fix that fell through the cracks
  (Eduardo Habkost)
* Validation of "host-nodes" option on memory backends (Eduardo Habkost)
* memory-device fixes and cleanups (David Hildenbrand)

Cleanups:
* Machine-type code cleanup (remove unnecessary instance_init functions)
  (Eduardo Habkost)
* qdev, qom, and global property code cleanups (Marc-André Lureau)
* PCMachineState field renames (Corey Minyard)
* numa: Match struct to typedef name (Eric Blake)
* hostmem-file: remove object id from pmem error message (Zhang Yi)

# gpg: Signature made Tue 11 Dec 2018 17:58:03 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/machine-next-pull-request: (24 commits)
  qom: remove unimplemented class_finalize
  qdev: move qdev_prop_register_global_list() to tests
  accel: register global_props like machine globals
  qom: make user_creatable_complete() specific to UserCreatable
  qom: make interface types abstract
  tests: qdev_prop_check_globals() doesn't return "all_used"
  pc: Use default_machine_opts to set suppress_vmdesc
  spapr: Delete instance_options functions
  spapr: Use default_machine_opts to set suppress_vmdesc
  spapr: Use default_machine_opts to set use_hotplug_event_source
  virt: Eliminate separate instance_init functions
  q35/440fx/arm/spapr: Add QEMU 4.0 machine type
  hostmem: Validate host-nodes before setting bitmap
  numa: Match struct to typedef name
  i386: Rename bools in PCMachineState to end in _enabled
  move ObjectClass to typedefs.h
  memory-device: avoid overflows on very huge devices
  memory-device: use QEMU_IS_ALIGNED
  range: pass const pointer where possible
  Deprecate HMP `cpu-add`
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoqom: remove unimplemented class_finalize
Marc-André Lureau [Tue, 4 Dec 2018 14:20:10 +0000 (18:20 +0400)]
qom: remove unimplemented class_finalize

Instead of trying to implement something that isn't well specified,
remove it. (it would be tricky to implement, since a class struct is
memcpy on children types...)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181204142023.15982-7-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqdev: move qdev_prop_register_global_list() to tests
Marc-André Lureau [Tue, 4 Dec 2018 14:20:09 +0000 (18:20 +0400)]
qdev: move qdev_prop_register_global_list() to tests

The function is only used by a test, move it there.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20181204142023.15982-6-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoaccel: register global_props like machine globals
Marc-André Lureau [Tue, 4 Dec 2018 14:20:08 +0000 (18:20 +0400)]
accel: register global_props like machine globals

global_props is only used for Xen xen_compat_props. It's a static
array of GlobalProperty, like machine globals in SET_MACHINE_COMPAT().
Let's register the globals the same way, without extra copy allocation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20181204142023.15982-5-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqom: make user_creatable_complete() specific to UserCreatable
Marc-André Lureau [Tue, 4 Dec 2018 14:20:07 +0000 (18:20 +0400)]
qom: make user_creatable_complete() specific to UserCreatable

Instead of accepting any Object*, change user_creatable_complete() to
require a UserCreatable*. Modify the callers to pass the appropriate
argument, removing redundant dynamic cast checks in object creation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181204142023.15982-4-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqom: make interface types abstract
Marc-André Lureau [Tue, 4 Dec 2018 14:20:06 +0000 (18:20 +0400)]
qom: make interface types abstract

Interfaces don't have instance, let's make the interface type really
abstract to avoid confusion.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181204142023.15982-3-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agotests: qdev_prop_check_globals() doesn't return "all_used"
Marc-André Lureau [Tue, 4 Dec 2018 14:20:05 +0000 (18:20 +0400)]
tests: qdev_prop_check_globals() doesn't return "all_used"

Instead, it returns 1 if an error was detected, which is the case for:

/qdev/properties/dynamic/global/subprocess:
warning: global dynamic-prop-type-bad.prop3 has invalid class name
warning: global nohotplug-type.prop5=105 not used
warning: global nondevice-type.prop6 has invalid class name

Clarify the function return value.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181204142023.15982-2-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agopc: Use default_machine_opts to set suppress_vmdesc
Eduardo Habkost [Wed, 5 Dec 2018 20:58:27 +0000 (18:58 -0200)]
pc: Use default_machine_opts to set suppress_vmdesc

Instead of setting suppress_vmdesc at instance_init time, set
default_machine_opts on pc_i440fx_2_2_machine_options() to
implement equivalent behavior.

This will let us eliminate the need for pc_compat_*() functions
for PC machine-types.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-6-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agospapr: Delete instance_options functions
Eduardo Habkost [Wed, 5 Dec 2018 20:58:26 +0000 (18:58 -0200)]
spapr: Delete instance_options functions

Now that all instance_options functions for spapr are empty,
delete them.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-5-ehabkost@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agospapr: Use default_machine_opts to set suppress_vmdesc
Eduardo Habkost [Wed, 5 Dec 2018 20:58:25 +0000 (18:58 -0200)]
spapr: Use default_machine_opts to set suppress_vmdesc

Instead of setting suppress_vmdesc at instance_init time, set
default_machine_opts on spapr_machine_2_2_class_options() to
implement equivalent behavior.

This will let us eliminate the need for separate instance_init
functions for each spapr machine-type.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-4-ehabkost@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agospapr: Use default_machine_opts to set use_hotplug_event_source
Eduardo Habkost [Wed, 5 Dec 2018 20:58:24 +0000 (18:58 -0200)]
spapr: Use default_machine_opts to set use_hotplug_event_source

Instead of setting use_hotplug_event_source at instance_init
time, set default_machine_opts on spapr_machine_2_7_class_options()
to implement equivalent behavior.

This will let us eliminate the need for separate instance_init
functions for each spapr machine-type.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-3-ehabkost@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agovirt: Eliminate separate instance_init functions
Eduardo Habkost [Wed, 5 Dec 2018 20:58:23 +0000 (18:58 -0200)]
virt: Eliminate separate instance_init functions

All instance_init functions for all virt machine-types run
exactly the same code, so we don't need separate functions.  We
only need to set instance_init for TYPE_VIRT_MACHINE.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-2-ehabkost@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoq35/440fx/arm/spapr: Add QEMU 4.0 machine type
Alex Williamson [Tue, 4 Dec 2018 16:27:16 +0000 (09:27 -0700)]
q35/440fx/arm/spapr: Add QEMU 4.0 machine type

Including all machine types that might have a pcie-root-port.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Message-Id: <154394083644.28192.8501647946108201466.stgit@gimli.home>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
[ehabkost: fixed accidental recursion at spapr_machine_3_1_class_options()]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agohostmem: Validate host-nodes before setting bitmap
Eduardo Habkost [Fri, 30 Nov 2018 12:28:44 +0000 (10:28 -0200)]
hostmem: Validate host-nodes before setting bitmap

host_memory_backend_set_host_nodes() was not validating
host-nodes before writing to backend->host_nodes, making QEMU
write beyond the end of the bitmap.

Fix the crash and add a simple regression test for the fix.

While at it, fix memory leak of the list returned by
visit_type_uint16List().

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181130122844.29103-1-ehabkost@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
[ehabkost: removed test case code]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agonuma: Match struct to typedef name
Eric Blake [Thu, 15 Nov 2018 21:17:52 +0000 (15:17 -0600)]
numa: Match struct to typedef name

There's no reason to violate our naming conventions by having a
struct with a different name than its typedef.  Messed up since
its introduction in commit 8c85901e, but made more obvious when
commit 3bfe5716 promoted it to typedefs.h.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181115211752.1295571-3-eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoi386: Rename bools in PCMachineState to end in _enabled
Corey Minyard [Wed, 7 Nov 2018 15:24:34 +0000 (09:24 -0600)]
i386: Rename bools in PCMachineState to end in _enabled

This makes their function more clear and prevents conflicts when adding
the actual devices to the machine state, if necessary.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181107152434.22219-1-minyard@acm.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agomove ObjectClass to typedefs.h
Gerd Hoffmann [Tue, 6 Nov 2018 10:23:30 +0000 (11:23 +0100)]
move ObjectClass to typedefs.h

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20181106102335.20027-2-kraxel@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agomemory-device: avoid overflows on very huge devices
David Hildenbrand [Tue, 23 Oct 2018 15:23:05 +0000 (17:23 +0200)]
memory-device: avoid overflows on very huge devices

Should not be a problem right now, but it could theoretically happen
in the future.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181023152306.3123-7-david@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agomemory-device: use QEMU_IS_ALIGNED
David Hildenbrand [Tue, 23 Oct 2018 15:23:04 +0000 (17:23 +0200)]
memory-device: use QEMU_IS_ALIGNED

Shorter and easier to read.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181023152306.3123-6-david@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agorange: pass const pointer where possible
David Hildenbrand [Tue, 23 Oct 2018 15:23:02 +0000 (17:23 +0200)]
range: pass const pointer where possible

If there are no changes, let's use a const pointer.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181023152306.3123-4-david@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoDeprecate HMP `cpu-add`
Kashyap Chamarthy [Tue, 30 Oct 2018 12:35:25 +0000 (13:35 +0100)]
Deprecate HMP `cpu-add`

Since we're deprecating the QMP `cpu-add`, let's deprecate its HMP
equivalent, too.

Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Message-Id: <20181030123526.26415-3-kchamart@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoDeprecate QMP `cpu-add`
Kashyap Chamarthy [Tue, 30 Oct 2018 12:35:24 +0000 (13:35 +0100)]
Deprecate QMP `cpu-add`

The intended functionality of QMP `cpu-add` is replaced with
`device_add` (and `query-hotpluggable-cpus`).  So let's deprecate
`cpu-add`.

A complete example of vCPU hotplug with the recommended way (using
`device_add`) is provided as part of a seperate docs patch.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com
Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Message-Id: <20181030123526.26415-2-kchamart@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agodocs: Document vCPU hotplug procedure
Kashyap Chamarthy [Tue, 30 Oct 2018 12:35:26 +0000 (13:35 +0100)]
docs: Document vCPU hotplug procedure

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Message-Id: <20181030123526.26415-4-kchamart@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agohw/timer/sun4v-rtc: Fix tracing at sun4v_rtc_write()
Eduardo Habkost [Wed, 31 Oct 2018 00:18:43 +0000 (21:18 -0300)]
hw/timer/sun4v-rtc: Fix tracing at sun4v_rtc_write()

The code was converted to use sun4v_rtc_read() by mistake, fix
it.

Reported-by: David Gibson <david@gibson.dropbear.id.au>
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181031001843.12892-1-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agohostmem-file: remove object id from pmem error message
Zhang Yi [Wed, 24 Oct 2018 14:14:56 +0000 (22:14 +0800)]
hostmem-file: remove object id from pmem error message

We will never get the canonical path from the object
before object_property_add_child.

Signed-off-by: Zhang Yi <yi.z.zhang@linux.intel.com>
Message-Id: <a6491f996827f4039c1a52198ed5dcc7727cb0f9.1540389255.git.yi.z.zhang@linux.intel.com>
[ehabkost: reword commit message]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoFixes i386 xchgq test
fabrice.desclaux@cea.fr [Fri, 7 Dec 2018 14:44:40 +0000 (15:44 +0100)]
Fixes i386 xchgq test

As "xchg" reads and writes both operands, the "+m" is required to avoid
undefined behavior on -O2 compilation.

Signed-off-by: Fabrice Desclaux <fabrice.desclaux@cea.fr>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <03506cf0-a204-f619-8ee4-4990a5e69af5@cea.fr>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agomaint: Grammar fix to mailmap
Eric Blake [Fri, 7 Dec 2018 17:07:33 +0000 (11:07 -0600)]
maint: Grammar fix to mailmap

Make the sentence read better.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20181207170733.129532-1-eblake@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Update email address for Fam Zheng
Fam Zheng [Wed, 21 Nov 2018 15:30:36 +0000 (23:30 +0800)]
MAINTAINERS: Update email address for Fam Zheng

Since I am about to change company, update the email address in
MAINTAINERS to my personal one. Depending on responsibility changes I
may eventually fade out in some of the maintained areas, but that will
be figured out afterward, or maybe I'll use the work email later. For
now, just do a search and replace.

Signed-off-by: Fam Zheng <fam@euphon.net>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20181121153036.2941-1-famz@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agocutils: Assert in-range base for string-to-integer conversions
Eric Blake [Thu, 6 Dec 2018 15:18:56 +0000 (09:18 -0600)]
cutils: Assert in-range base for string-to-integer conversions

POSIX states that the value of endptr is unspecified if strtol()
fails with EINVAL due to an invalid base argument.  Since none of
the callers to check_strtox_error() initialized endptr, we could
end up propagating uninitialized data back to a caller on error.
However, passing an out-of-range base is already a sign of poor
programming, so let's just assert that base is in range, at which
point check_strtox_error() can be tightened to assert that it is
receiving an initialized ep that points somewhere within the
caller's original string, regardless of whether strto*() succeeded
or failed with ERANGE.

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20181206151856.77503-1-eblake@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoutil: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
Li Qiang [Fri, 30 Nov 2018 09:53:58 +0000 (01:53 -0800)]
util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()

Cc: qemu-trivial@nongnu.org
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1543571638-2892-1-git-send-email-liq3ea@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agotarget: hax: fix errors in comment
Li Qiang [Tue, 27 Nov 2018 10:00:12 +0000 (02:00 -0800)]
target: hax: fix errors in comment

Cc: qemu-trivial@nongnu.org
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1543312812-2929-1-git-send-email-liq3ea@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Use my work email to review Build and test automation patches
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:59 +0000 (21:49 +0100)]
MAINTAINERS: Use my work email to review Build and test automation patches

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-25-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry for the NVDIMM device
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:56 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry for the NVDIMM device

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-22-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry to the QMP section
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:54 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry to the QMP section

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181125205000.10324-20-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry to SPICE
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:52 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry to SPICE

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20181125205000.10324-18-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries for the MPS2 machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:51 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries for the MPS2 machine

Missed in de343bb632a.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20181125205000.10324-17-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries for the Canon DIGIC machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:50 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries for the Canon DIGIC machine

This pattern now also matches:
- include/hw/timer/digic-timer.h
- include/hw/char/digic-uart.h

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20181125205000.10324-16-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries to the vhost section
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:49 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries to the vhost section

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-15-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries to the PC Chipset section
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:47 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries to the PC Chipset section

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-13-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry for the sun4m machines
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:44 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry for the sun4m machines

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20181125205000.10324-10-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry for the Old World machines
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:43 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry for the Old World machines

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20181125205000.10324-9-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry for the Xilinx S3A-DSP 1800 machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:41 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry for the Xilinx S3A-DSP 1800 machine

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20181125205000.10324-7-philmd@redhat.com>
[lv: added the missing 'F:' field]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries for the Jazz machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:40 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries for the Jazz machine

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Message-Id: <20181125205000.10324-6-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries for the Xilinx ZynqMP machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:39 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries for the Xilinx ZynqMP machine

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20181125205000.10324-5-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry to the SPARC CPU
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:37 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry to the SPARC CPU

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20181125205000.10324-3-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Fix ACPI tests data files path
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:36 +0000 (21:49 +0100)]
MAINTAINERS: Fix ACPI tests data files path

Missed while moving those files in 438c78dab75.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-2-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agotarget: hax: replace g_malloc with g_new0
Li Qiang [Mon, 26 Nov 2018 09:56:19 +0000 (01:56 -0800)]
target: hax: replace g_malloc with g_new0

And also the g_malloc doesn't need check return value,
remove it.

Cc: qemu-trivial@nongnu.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1543226179-5135-1-git-send-email-liq3ea@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>