Commit Graph

40629 Commits

Author SHA1 Message Date
Christopher Covington 205ace55ff target-arm: Improve semihosting debug prints
Print semihosting debugging information before the
do_arm_semihosting() call so that angel_SWIreason_ReportException,
which causes the function to not return, gets the same debug prints as
other semihosting calls. Also print out the semihosting call number.

Signed-off-by: Christopher Covington <christopher.covington@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Christopher Covington <cov@codeaurora.org>
Message-id: 1439483745-28752-3-git-send-email-peter.maydell@linaro.org
2015-09-07 10:39:27 +01:00
Peter Maydell 857b55adb7 target-arm/arm-semi.c: Fix broken SYS_WRITE0 via gdb
A spurious trailing "\n" in the gdb syscall format string used
for SYS_WRITE0 meant that gdb would reject the remote syscall,
with the effect that the output from the guest was silently dropped.
Remove the newline so that gdb accepts the packet.

Cc: qemu-stable@nongnu.org

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-07 10:39:27 +01:00
Markus Armbruster b45c03f585 arm: Use g_new() & friends where that makes obvious sense
g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
for two reasons.  One, it catches multiplication overflowing size_t.
Two, it returns T * rather than void *, which lets the compiler catch
more type errors.

This commit only touches allocations with size arguments of the form
sizeof(T).

Coccinelle semantic patch:

    @@
    type T;
    @@
    -g_malloc(sizeof(T))
    +g_new(T, 1)
    @@
    type T;
    @@
    -g_try_malloc(sizeof(T))
    +g_try_new(T, 1)
    @@
    type T;
    @@
    -g_malloc0(sizeof(T))
    +g_new0(T, 1)
    @@
    type T;
    @@
    -g_try_malloc0(sizeof(T))
    +g_try_new0(T, 1)
    @@
    type T;
    expression n;
    @@
    -g_malloc(sizeof(T) * (n))
    +g_new(T, n)
    @@
    type T;
    expression n;
    @@
    -g_try_malloc(sizeof(T) * (n))
    +g_try_new(T, n)
    @@
    type T;
    expression n;
    @@
    -g_malloc0(sizeof(T) * (n))
    +g_new0(T, n)
    @@
    type T;
    expression n;
    @@
    -g_try_malloc0(sizeof(T) * (n))
    +g_try_new0(T, n)
    @@
    type T;
    expression p, n;
    @@
    -g_realloc(p, sizeof(T) * (n))
    +g_renew(T, p, n)
    @@
    type T;
    expression p, n;
    @@
    -g_try_realloc(p, sizeof(T) * (n))
    +g_try_renew(T, p, n)
    @@
    type T;
    expression n;
    @@
    -(T *)g_new(T, n)
    +g_new(T, n)
    @@
    type T;
    expression n;
    @@
    -(T *)g_new0(T, n)
    +g_new0(T, n)
    @@
    type T;
    expression p, n;
    @@
    -(T *)g_renew(T, p, n)
    +g_renew(T, p, n)

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1440524394-15640-1-git-send-email-armbru@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-07 10:39:27 +01:00
Peter Maydell b597aa037d Monitor patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV6YMbAAoJEDhwtADrkYZTmqUP/0PioppNHxOM+ah+9SoNBq+K
 jf6JLfxUkazPamtI1V3BYEhFgOMs+frQ/VG9mJjWdHeARHYePJce7arrUYV71L2+
 Z9hWBM9I71axRG449ox8qwk2NZRNwGPoF4gQeoOYUaiDsQIQVpX69lIiF2XkJ1+c
 v521rLmfprHcJW9Ggzpds45FLUv8t3tvNobuBZO2XAs2oXdesBgIIp2HjL8onFlu
 r1LLnZWxdROe9HM9HXvjWC5aWmgRK0kgAoaEWo9cQj5jMGBNYQDKH56eGx03IZkF
 29+AZ0ACI3b1OwlK7DK/YAYR78LR9z+TA+qf42+SPWLapImmH8qwrTN0vZpTs6GP
 caFGwklGyD6sQHiO5fmkSdxrES/W1ndshf8PfulgHQ4Wjb1rIcgCxl1gcH+zyT1G
 uBHJ7tozpdYZ78T60wY8dj46AidPX9Ru7+Y3D8fTncGuHJa/LacPp2AehA0lEbCK
 DGG5XFOJKIHBy0AXFPIyJ6pNPzU93jXGFf6pI5c15nMoCkh2wiNPWRM3ZXTrgWWc
 l7GZdwTewcm45UZVaITec+IJca7EjQIBvfUxs8yCaeBe6aEJQKw/P9lgvZPzt8Tk
 ozyCkQQIlnRupDb18p+MRD1/U2SZSjrTrlY/qNm/uBCyStjWKsyYFYvlcPFWSlOs
 BqE2BpLiUR2XDIuqe6E4
 =6HLt
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2015-09-04' into staging

Monitor patches

# gpg: Signature made Fri 04 Sep 2015 12:40:11 BST using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-monitor-2015-09-04:
  hmp: add info iothreads command
  qmp-shell: add documentation

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-04 17:37:50 +01:00
Peter Maydell b5bff7518d qapi: Another round of fixes and cleanups
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV6aFGAAoJEDhwtADrkYZT8o8P/R7CZzKv6JE85xQYKtIEdgK7
 zP+GiNY+ysXL/4uRzXk/Ksh3TYuRe/ptMdeXINayOoC3qG8WYuiIjIB6VTtscWGF
 NKj/iKUxk6APLHunLBCf/ubW1uqsOHCgmuxZJEB7aZhUpWfpYL+0pvF+n8qm67f/
 RaaN2FCppTTzKrGFWjmTP1iwm2GF/ETOdlyNQ79AEjEb3n6IvjpVPuHU9ZcZhqLP
 CF0efVX172sbZqOlIBiDlvyCmPHsCpoRRUw4D/E5ctAxj/JkhKtv5pwsIAhKQVNj
 +plsYFYujhkUBT8QRZQF1oH3CQXoDD03qimCRptBSOWHTKsCPYWpSZSaE6BIzOyJ
 NaFcAr4x+/NCxkZ0Ef/qQZfwIH2NLb5gPpaSUpsVrJQUsx4ImKSpa8t1x+iTLqO4
 QnU+pkQ6PdkFNlhj1tOvKcaOWV5wlPTtEfpEflYg0Cx173Ao3nIOPIIYTqdelcn5
 1sopuADvFB61/EiMail9NS9aPPuPrnrrOtzVNyFtDZorO+sot7pWOJ24xAzylG6G
 jOZxMVJteq+XF0DLTdCKJiCxCdwMSrg/wNKnFMmKFGlqJIpRrd7XYPfzVX+pX/s7
 gpuCc3r73WPReP1b/sjn8vQ4PBRpaQb8uK8hkh+GQjnr99cSyTZgI/M1anTh5YEC
 mXPB0mw60g8YA61gJSX0
 =CGzi
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-09-04' into staging

qapi: Another round of fixes and cleanups

# gpg: Signature made Fri 04 Sep 2015 14:48:54 BST using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-qapi-2015-09-04: (33 commits)
  qapi: Generators crash when --output-dir isn't given, fix
  docs/qapi-code-gen.txt: Fix QAPI schema examples
  qapi: Simplify error reporting for array types
  qapi: Fix errors for non-string, non-dictionary members
  tests/qapi-schema: Cover non-string, non-dictionary members
  tests/qapi-schema: Cover two more syntax errors
  qapi: Drop one of two "simple union must not have base" checks
  qapi: Generated code cleanup
  qapi-commands: Drop useless initialization
  qapi-commands: Don't feed output of mcgen() to mcgen() again
  qapi-commands: Inline gen_marshal_output_call()
  qapi-commands: Fix gen_err_check(e) for e and e != 'local_err'
  qapi: Command returning anonymous type doesn't work, outlaw
  qapi: Fix to reject union command and event arguments
  qapi-tests: New tests for union, alternate command arguments
  tests/qapi-schema: Rename tests from data- to args-
  tests/qapi-schema: Restore test case for flat union base bug
  qapi: Document flaws in checking of names
  qapi: Document shortcoming with union 'data' branch
  qapi: Document that input visitor semantics are prone to leaks
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-04 15:53:48 +01:00
Markus Armbruster c4f498fe85 qapi: Generators crash when --output-dir isn't given, fix
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:16 +02:00
Markus Armbruster 94a3f0af38 docs/qapi-code-gen.txt: Fix QAPI schema examples
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:16 +02:00
Markus Armbruster eddf817bd8 qapi: Simplify error reporting for array types
check_type() first checks and peels off the array type, then checks
the element type.  For two out of four error messages, it takes pains
to report errors for "array of T" instead of just T.  Odd.  Let's
examine the errors.

* Unknown element type, e.g.
  tests/qapi-schema/args-array-unknown.json:

      Member 'array' of 'data' for command 'oops' uses unknown type
      'array of NoSuchType'

  To make sense of this, you need to know that 'array of NoSuchType'
  refers to '[NoSuchType]'.  Easy enough.  However, simply reporting

      Member 'array' of 'data' for command 'oops' uses unknown type
      'NoSuchType'

  is at least as easy to understand.

* Element type's meta-type is inadmissible, e.g.
  tests/qapi-schema/returns-whitelist.json:

      'returns' for command 'no-way-this-will-get-whitelisted' cannot
      use built-in type 'array of int'

  'array of int' is technically not a built-in type, but that's
  pedantry.  However, simply reporting

      'returns' for command 'no-way-this-will-get-whitelisted' cannot
      use built-in type 'int'

  avoids the issue, and is at least as easy to understand.

* The remaining two errors are unreachable, because the array checking
  ensures that value is a string.

Thus, reporting some errors for "array of T" instead of just T works,
but doesn't really improve things.  Drop it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:16 +02:00
Markus Armbruster c6b71e5ae7 qapi: Fix errors for non-string, non-dictionary members
Fixes the errors demonstrated by the previous commit.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:16 +02:00
Markus Armbruster 10689e36eb tests/qapi-schema: Cover non-string, non-dictionary members
We always report "should be a dictionary" then.  This is misleading:
when allow_dict, it can be a dictionary or a type name string, else it
can only be a type name.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:16 +02:00
Markus Armbruster 91f9816da4 tests/qapi-schema: Cover two more syntax errors
Syntax error coverage should now be complete.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:16 +02:00
Markus Armbruster 65fbe12545 qapi: Drop one of two "simple union must not have base" checks
The first check ensures the second one can't trigger.  Drop the first
one, because the second one is in a more logical place, and emits a
nicer error message.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:16 +02:00
Markus Armbruster 3a864e7c52 qapi: Generated code cleanup
Clean up white-space, brace placement, and superfluous #ifdef
QAPI_TYPES_BUILTIN_CLEANUP_DEF.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:16 +02:00
Markus Armbruster 3f99144cd9 qapi-commands: Drop useless initialization
In generated command handlers, the assignment to retval dominates its
only use.  Therefore, its initialization is useless.  Drop it.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:15 +02:00
Markus Armbruster 1f9a7a1a58 qapi-commands: Don't feed output of mcgen() to mcgen() again
Multiple passes through mcgen() is prone to produce unwanted blank
lines, which we then combat by sprinkling .rstrip() on top.  Just
don't do it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:15 +02:00
Markus Armbruster e02bca281c qapi-commands: Inline gen_marshal_output_call()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:15 +02:00
Markus Armbruster 8102307f51 qapi-commands: Fix gen_err_check(e) for e and e != 'local_err'
gen_err_check() hard-codes 'local_err' instead of substituting the
argument.  Currently harmless, since all callers pass either None or
'local_err'.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:15 +02:00
Markus Armbruster 9b090d42ae qapi: Command returning anonymous type doesn't work, outlaw
Reproducer: with

    { 'command': 'user_def_cmd4', 'returns': { 'a': 'int' } }

added to qapi-schema-test.json, qapi-commands.py dies when it tries to
generate the command handler function

    Traceback (most recent call last):
      File "/work/armbru/qemu/scripts/qapi-commands.py", line 359, in <module>
        ret = generate_command_decl(cmd['command'], arglist, ret_type) + "\n"
      File "/work/armbru/qemu/scripts/qapi-commands.py", line 29, in generate_command_decl
        ret_type=c_type(ret_type), name=c_name(name),
      File "/work/armbru/qemu/scripts/qapi.py", line 927, in c_type
        assert isinstance(value, str) and value != ""
    AssertionError

because the return type doesn't exist.

Simply outlaw this usage, and drop or dumb down test cases accordingly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:15 +02:00
Markus Armbruster 315932b5ed qapi: Fix to reject union command and event arguments
A command's or event's 'data' must be a struct type, given either as a
dictionary, or as struct type name.

Commit dd883c6 tightened the checking there, but not enough: we still
accept 'union'.  Fix to reject it.

We may want to support union types there, but we'll have to extend
qapi-commands.py and qapi-events.py for it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:15 +02:00
Markus Armbruster d9658d58e3 qapi-tests: New tests for union, alternate command arguments
A command's 'data' must be a struct type, given either as a
dictionary, or as struct type name.

Existing test case data-int.json covers simple type 'int'.  Add test
cases for type names referring to union and alternate types.

The latter is caught (good), but the former is not (bug).

Events have the same problem, but since they get checked by the same
code, we don't bother to duplicate the tests.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:15 +02:00
Markus Armbruster 6af9a8fc8e tests/qapi-schema: Rename tests from data- to args-
Since every schema entity has 'data', the data- prefix conveys no
information.  These tests actually exercise commands.  Only commands
have arguments, so change the prefix to to args-.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:15 +02:00
Markus Armbruster 80e60a19a8 tests/qapi-schema: Restore test case for flat union base bug
Test case added in commit 2fc0043, and messed up in commit 5223070.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:14 +02:00
Markus Armbruster d90675fa4b qapi: Document flaws in checking of names
We don't actually enforce our "other than downstream extensions [...],
all names should begin with a letter" rule.  Add a FIXME.

We should reject names that differ only in '_' vs. '.'  vs. '-',
because they're liable to clash in generated C.  Add a FIXME.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:14 +02:00
Eric Blake ca56a822dd qapi: Document shortcoming with union 'data' branch
Add a FIXME to remind us to fully audit whether removing the
'void *data' branch of each qapi union type can be done safely.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1438297637-26789-1-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-04 15:47:14 +02:00
Eric Blake 2f52e20597 qapi: Document that input visitor semantics are prone to leaks
Most functions that can return a pointer or set an Error ** value
are decent enough to guarantee a NULL return when reporting an error.
Not so with our generated qapi visitor functions.  If the caller
is not careful to clean up partially-allocated objects on error,
then the caller suffers a memory leak.

Properly fixing it is probably complex enough to save for a later
day, so merely document it for now.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1438295587-19069-1-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-04 15:47:14 +02:00
Markus Armbruster 999387782f tests/qapi-schema: Document events with base don't work
When event FOO's 'data' is a struct with a base, we consider only the
struct's direct members, and ignore its base.  The generated
qapi_event_send_foo() doesn't take arguments for base members.

No such events currently exist in the QMP schema.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:14 +02:00
Markus Armbruster 422e16aac4 tests/qapi-schema: Document alternate's enum lacks visit function
We generate a declaration, but no definition.

The QMP schema has two: Qcow2OverlapChecks and BlockdevRef.  Neither
visit_type_Qcow2OverlapChecksKind() nor visit_type_BlockdevRefKind()
is actually used.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:14 +02:00
Markus Armbruster 40b3adec13 qapi-visit: Fix two name arguments passed to visitors
The generated code passes mangled schema names to visit_type_enum()
and union's visit_start_struct().  Fix it to pass the names
unadulterated, like we do everywhere else.

Only qapi-schema-test.json actually has names where this makes a
difference: enum __org.qemu_x-Enum, flat union __org.qemu_x-Union2,
simple union __org.qemu_x-Union1 and its implicit enum
__org.qemu_x-Union1Kind.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:14 +02:00
Markus Armbruster 8c07eddc61 qapi-visit: Replace list implicit_structs by set
Use set because that's what it is.  While there, rename to
implicit_structs_seen.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:14 +02:00
Markus Armbruster 8c3f8e7721 qapi-visit: Fix generated code when schema has forward refs
The visit_type_implicit_FOO() are generated on demand, right before
their first use.  Used by visit_type_STRUCT_fields() when STRUCT has
base FOO, and by visit_type_UNION() when flat UNION has member a FOO.

If the schema defines FOO after its first use as struct base or flat
union member, visit_type_implicit_FOO() calls
visit_type_implicit_FOO() before its definition, which doesn't
compile.

Rearrange qapi-schema-test.json to demonstrate the bug.

Fix by generating the necessary forward declaration.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:13 +02:00
Markus Armbruster 1e6c1616a9 qapi: Generate a nicer struct for flat unions
The struct generated for a flat union is weird: the members of its
base are at the end, except for the union tag, which is at the
beginning.

Example: qapi-schema-test.json has

    { 'struct': 'UserDefUnionBase',
      'data': { 'string': 'str', 'enum1': 'EnumOne' } }

    { 'union': 'UserDefFlatUnion',
      'base': 'UserDefUnionBase',
      'discriminator': 'enum1',
      'data': { 'value1' : 'UserDefA',
                'value2' : 'UserDefB',
                'value3' : 'UserDefB' } }

We generate:

    struct UserDefFlatUnion
    {
        EnumOne enum1;
        union {
            void *data;
            UserDefA *value1;
            UserDefB *value2;
            UserDefB *value3;
        };
        char *string;
    };

Change to put all base members at the beginning, unadulterated.  Not
only is this easier to understand, it also permits casting the flat
union to its base, if that should become useful.

We now generate:

    struct UserDefFlatUnion
    {
        /* Members inherited from UserDefUnionBase: */
        char *string;
        EnumOne enum1;
        /* Own members: */
        union { /* union tag is @enum1 */
            void *data;
            UserDefA *value1;
            UserDefB *value2;
            UserDefB *value3;
        };
    };

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:13 +02:00
Markus Armbruster 0f61af3eb3 qapi: Fix generated code when flat union has member 'kind'
A flat union's tag member gets renamed to 'kind' in the generated
code.  Breaks when another member named 'kind' exists.

Example, adapted from qapi-schema-test.json:

    { 'struct': 'UserDefUnionBase',
      'data': { 'kind': 'str', 'enum1': 'EnumOne' } }

We generate:

    struct UserDefFlatUnion
    {
        EnumOne kind;
        union {
            void *data;
            UserDefA *value1;
            UserDefB *value2;
            UserDefB *value3;
        };
        char *kind;
    };

Kill the silly rename.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:13 +02:00
Markus Armbruster 5aa05d3f72 qapi: Drop unused and useless parameters and variables
gen_sync_call()'s parameter indent is useless: gen_sync_call() uses it
only as optional argument for push_indent() and pop_indent(), their
default is four, and gen_sync_call()'s only caller passes four.  Drop
the parameter.

gen_visitor_input_containers_decl()'s parameter obj is always
"QOBJECT(args)".  Use that, and drop the parameter.

Drop unused parameters of gen_marshal_output(),
gen_marshal_input_decl(), generate_visit_struct_body(),
generate_visit_list(), generate_visit_enum(), generate_declaration(),
generate_enum_declaration(), generate_decl_enum().

Drop unused variables in generate_event_enum_lookup(),
generate_enum_lookup(), generate_visit_struct_fields(), check_event().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:13 +02:00
Markus Armbruster 1cf47a15f1 qapi: Reject -p arguments that break qapi-event.py
qapi-event.py breaks when you ask for a funny prefix like '@'.
Protect it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:13 +02:00
Markus Armbruster 016a335bd8 qapi-event: Clean up how name of enum QAPIEvent is made
Use c_name() instead of ad hoc code.  Doesn't upcase the -p prefix,
which is an improvement in my book.  Unbreaks prefix containing '.',
but other funny characters remain broken.  To be fixed next.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:13 +02:00
Markus Armbruster 00dfc3b2c2 qapi: Simplify guardname()
The guards around built-in declarations lose their _H.  It never made
much sense anyway.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:13 +02:00
Markus Armbruster 77e703b861 qapi: Clean up cgen() and mcgen()
Commit 05dfb26 added eatspace stripping to mcgen().  Move it to
cgen(), just in case somebody gets tempted to use cgen() directly
instead of via mcgen().

cgen() indents blank lines.  No such lines get generated right now,
but fix it anyway.

We use triple-quoted strings for program text, like this:

    '''
    Program text
    any number of lines
    '''

Keeps the program text relatively readable, but puts an extra newline
at either end.  mcgen() "fixes" that by dropping the first and last
line outright.  Drop only the newlines.

This unmasks a bug in qapi-commands.py: four quotes instead of three.
Fix it up.

Output doesn't change

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:13 +02:00
Markus Armbruster 4247f83900 qapi: Clarify docs on including the same file multiple times
It's idempotent.

While there, update examples to current code.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-04 15:47:13 +02:00
Ting Wang 62313160cb hmp: add info iothreads command
Make "info iothreads" available on the HMP monitor.

For example, the results are as follows when executing qemu
command with "-object iothread,id=iothread-1 -object
iothread,id=iothread-2".
(qemu) info iothreads
iothread-1: thread_id=123
iothread-2: thread_id=456

Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
Message-Id: <1435306033-58372-1-git-send-email-kathy.wangting@huawei.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Amos Jianjun Kong <kongjianjun@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-04 13:26:26 +02:00
John Snow e2f9a6572b qmp-shell: add documentation
I should probably document the changes that were made.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <1435775149-17285-1-git-send-email-jsnow@redhat.com>
Reviewed-By: Kashyap Chamarthy <kchamart@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-04 13:18:04 +02:00
Peter Maydell b041066421 -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
 
 iQEcBAABAgAGBQJV6F1cAAoJEJykq7OBq3PIvvgH/0UMyYBRdzm9XkN5fV9kPZmQ
 RK2NVm5pBAy8qVH8FOneYvmY2X3npLGhB/+JfQMjGgXuHkD/GeIonMbhJGuukFKh
 b7oPU7hb5J4N7Wp+aH8gUL+F3WwGQWcAhXPJgK8HbBQqWKxsAtHZmzaDTmKCpNid
 Ujd7O6f6ygtGIVzz1PsOeU9S38S3XdY1y26RXbJjdHg1ZMpF49h+XQ0mVmQSLp6c
 rlZRjXJjvDVKL5alf5UFHquZujof8n4nIpsSBtzne/ZpujGCpsZV/TaqKiU8vj38
 PiBtBozKr2IocCPkS9RjBorJLADQsUjsmqdLpPynC+BUKkgY5gRSnlpfYarMXao=
 =Uc38
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging

# gpg: Signature made Thu 03 Sep 2015 15:46:52 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/tracing-pull-request:
  trace-events: Add hmp completion

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-03 16:17:28 +01:00
Dr. David Alan Gilbert 987bd27000 trace-events: Add hmp completion
Add completion for the trace event names in the hmp trace-event
command.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: 1439548063-18410-1-git-send-email-dgilbert@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-09-03 15:46:10 +01:00
Peter Maydell 550e66ea4c First batch of s390x patches for 2.5:
- introduce 2.5 compat machine
 - support for migration of storage keys
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJV6CC2AAoJEN7Pa5PG8C+v/v4P/2WnFxe8iy3qZ7UIPm6TWYm4
 MXIJzyqLmR9yETqVeNQXqqIX8Z4QEA4bn6tiHlyjUZEEAH0um7C4g0ZP3qkuO23N
 oSR95PpRJwXKLI60jZI3+aS5wNf+T2F9it6Z/3ii8ga0vFXrYkotbo1pKY18jXDC
 WI+SFkB/OF2PYdNVl9KF7hBcDPUQq9bjODoTdwMiW7VlxsLotztZAApoJK4bWKFl
 ynVStRKfwr2fsvf+TEJ3/eE3CDLLXG4APdVFoM6WPEQ+XGswwZcBxONrLMzn/o0Q
 663l6/DZN5wmV2dSgORuDjB5zVZ5oZ4LxdX96xzeau5z1IinIJLJNlY4k/uPPtN2
 dIMWsVItGG0wGAhbMBUdcHXxazQPU5KGkXzoGL7dWtyMWDeNEZaO1flHa6XGaKPa
 m5UhuJR49aUyYbxkK6j7hQ7gB9EER0LmErayDgqjOocboubnJIuilQ/sQGFE24/f
 UNeOktR7gWn+cLBL8r/fFoPEnYWPeczeGty+UmPUojdOft9PCcu/lKernsa1XNCq
 OBw3S7k30IYhVqvb27Y4cWMGOOHqWzyHl02Zb4sb/OWKMed2f0sswwSWGHUdSFOI
 pGUhdy8FihzSJdhpuM4TcXuoQenc3S7i1OmejI1LUo0rTt57NxECPA70VHc1YhnE
 G7mXs10Q/NYTn8uzaAPG
 =CIDV
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20150903' into staging

First batch of s390x patches for 2.5:
- introduce 2.5 compat machine
- support for migration of storage keys

# gpg: Signature made Thu 03 Sep 2015 11:28:06 BST using RSA key ID C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"

* remotes/cohuck/tags/s390x-20150903:
  s390x: Disable storage key migration on old machine type
  s390x: Migrate guest storage keys (initial memory only)
  s390x: Info skeys sub-command
  s390x: Dump-skeys hmp support
  s390x: Dump storage keys qmp command
  s390x: Enable new s390-storage-keys device
  s390x: Create QOM device for s390 storage keys
  s390x: add 2.5 compat s390-ccw-virtio machine

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-03 14:33:03 +01:00
Peter Maydell 561578c2a8 queued tcg patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJV52upAAoJEK0ScMxN0CebDaQIAJ5SzydWuImw1aun5JC+EAcZ
 GNdc3F2C5kSafgkq8Xxyo5igN7cKFSqPkChvc9hEEMlplsWv7FeA7cV7P7pxnw7a
 OnxOmbcU3I2GhZ06vbYU7c9dkaToaXQcCiZfkYO99+l1rc8u1K8EVtG43FbxybWj
 OZ0cC1qwOx/EAjGAM6LCIOxIBIsHkyC52Z62rd6XHdr8J2/IAha8mcz8n+HKbnaN
 xGnc1/8juQnLfiBuCY+2V2kqdq85oFkGMg9UROIjOt4qsB8aIh+ppmotLq/mxR1Z
 iAwSuPe8X9qqfEgYoqUG3eUwEdYoICCw7dCBzwWgLKAdcWvF4UqgoRUe7vDntcs=
 =gL4M
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20150902' into staging

queued tcg patches

# gpg: Signature made Wed 02 Sep 2015 22:35:37 BST using RSA key ID 4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"

* remotes/rth/tags/pull-tcg-20150902:
  tcg/i386: omit a few REXW prefixes in softmmu code
  tcg/aarch64: Fix tcg_out_qemu_{ld, st} for guest_base == 0

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-03 13:05:45 +01:00
Peter Maydell fc8135a46d cmpbge emulation improvements
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJV500WAAoJEK0ScMxN0CebePEH/RkxQTmYv61ji2MDY0ouswQR
 jlGJeKoZlyZxmyWMqerXK892SI13HpQpH3lVoJMsSrFnUIG79VFN+I22+MfkNI6S
 XbRWPCk+AxoXat2O8zSX1f40GJE3go1ZDT8h4/OQ3fveFi+q95ngPFHXSuDg17GP
 hU5LYHdpzlDm0wqKnz5+57RW5XjRvO285Zo+ludewnZWzFK8Dp9YNgH2Of8hj1Z0
 a6NNZ9T8/U09VbtC5NKDEeZajl+2aFjjNC5A4qUUliW1kWy/2mfRnSnN3oFQXWr3
 vn6wemKClWeyX6ch4yQzCOKGBq52RSjn+VsKYVrmesfBP1sclggJ1uvJXzfYqNI=
 =iazd
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/rth/tags/pull-axp-20150902' into staging

cmpbge emulation improvements

# gpg: Signature made Wed 02 Sep 2015 20:25:10 BST using RSA key ID 4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"

* remotes/rth/tags/pull-axp-20150902:
  target-alpha: Special case cmpbge with zero
  target-alpha: Rewrite helper_cmpbge using bit tests

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-03 12:09:41 +01:00
Jason J. Herne 9ef40173fb s390x: Disable storage key migration on old machine type
This code disables storage key migration when an older machine type is
specified.

Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-09-03 12:17:54 +02:00
Jason J. Herne 186208fa1f s390x: Migrate guest storage keys (initial memory only)
Routines to save/load guest storage keys are provided. register_savevm is
called to register them as migration handlers.

We prepare the protocol to support more complex parameters. So we will
later be able to support standby memory (having empty holes), compression
and "state live migration" like done for ram.

Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-09-03 12:17:54 +02:00
Jason J. Herne a08f0081c9 s390x: Info skeys sub-command
Provide an  info skeys hmp sub-command to allow the end user to dump a storage
key for a given address. This is useful for guest operating system developers.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-09-03 12:17:54 +02:00
Jason J. Herne a4538a5cc5 s390x: Dump-skeys hmp support
Add dump-skeys command to the human monitor.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-09-03 12:17:54 +02:00
Jason J. Herne 7ee0c3e33a s390x: Dump storage keys qmp command
Provide a dump-skeys qmp command to allow the end user to dump storage
keys. This is useful for debugging problems with guest storage key support
within Qemu and for guest operating system developers.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-09-03 12:17:54 +02:00