1. 07 3月, 2017 2 次提交
  2. 06 3月, 2017 7 次提交
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.9-20170306' into staging · 56b51708
      Peter Maydell 提交于
      ppc patch queue for 2017-03-06
      
      Looks like my previous batch wasn't quite the last before hard freeze.
      This has a handful of bugfixes to go in.  They're all genuine
      bugfixes, though not regressions in some cases.
      
      # gpg: Signature made Mon 06 Mar 2017 04:07:48 GMT
      # gpg:                using RSA key 0x6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-2.9-20170306:
        target/ppc: use helper for excp handling
        target/ppc: fmadd: add macro for updating flags
        target/ppc: fmadd check for excp independently
        spapr: ensure that all threads within core are on the same NUMA node
        ppc/xics: register reset handlers for the ICP and ICS objects
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      56b51708
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-02-28' into staging · fbddc2e5
      Peter Maydell 提交于
      QAPI patches for 2017-02-28
      
      # gpg: Signature made Sun 05 Mar 2017 08:21:51 GMT
      # gpg:                using RSA key 0x3870B400EB918653
      # 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-qapi-2017-02-28: (27 commits)
        qapi: Improve qobject visitor documentation
        qapi: Fix object input visit beyond end of list
        tests: Cover input visit beyond end of list
        qapi: Make input visitors detect unvisited list tails
        test-qobject-input-visitor: Cover missing nested struct member
        tests: Cover partial input visit of list
        test-string-input-visitor: Improve list coverage
        test-string-input-visitor: Tear down existing test automatically
        tests-qobject-input-strict: Merge into test-qobject-input-visitor
        qapi: Drop unused non-strict qobject input visitor
        test-qobject-input-visitor: Use strict visitor
        qom: Make object_property_set_qobject()'s input visitor strict
        qapi: Make string input and opts visitor require non-null input
        qapi: Drop string input visitor method optional()
        qapi: Improve qobject input visitor error reporting
        qapi: Make QObject input visitor set *list reliably
        qapi: Clean up after commit 3d344c2a
        qapi: Improve a QObject input visitor error message
        qmp: Eliminate silly QERR_QMP_* macros
        qmp: Drop duplicated QMP command object checks
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      fbddc2e5
    • N
      target/ppc: use helper for excp handling · 182fe2cf
      Nikunj A Dadhania 提交于
      Use the helper routine float[32,64]_maddsub_update_excp() in VSX_MADD
      macro.
      Signed-off-by: NNikunj A Dadhania <nikunj@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      182fe2cf
    • N
      target/ppc: fmadd: add macro for updating flags · 3e5b26cf
      Nikunj A Dadhania 提交于
      Adds FPU_MADDSUB_UPDATE macro, this will be used for other routines
      having float32/16
      Signed-off-by: NNikunj A Dadhania <nikunj@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      3e5b26cf
    • N
      target/ppc: fmadd check for excp independently · 806c9d71
      Nikunj A Dadhania 提交于
      Current order of checking does not confirm with the spec
      (ISA 3.0: MultiplyAddDP page-469). Change the order and make them
      independent of each other.
      
      For example: a = infinity, b = zero, c = SNaN, this should set both
      VXIMZ and VXNAN
      Signed-off-by: NNikunj A Dadhania <nikunj@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      806c9d71
    • I
      spapr: ensure that all threads within core are on the same NUMA node · 17b7c39e
      Igor Mammedov 提交于
      Threads within a core shouldn't be on different
      NUMA nodes, so if user has misconfgured command
      line, fail QEMU at start up to force user fix it.
      
      For now use the first thread on the core as source
      of core's node-id. Later when cpu-numa refactoring
      lands  it will be switched to core's node-id from
      possible_cpus[].
      
      This prevents the same problems as commit 20bb648d
      "spapr: Fix default NUMA node allocation for threads",
      but for the case of manually configured NUMA node
      mappings, instead of just the default case.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      17b7c39e
    • C
      ppc/xics: register reset handlers for the ICP and ICS objects · 7ea6e067
      Cédric Le Goater 提交于
      The recent changes on the XICS layer removed the XICSState object to
      let the sPAPR machine handle the ICP and ICS directly. The reset of
      these objects was previously handled by XICSState, which was a SysBus
      device, and to keep the same behavior, the ICP and ICS were assigned
      to SysbBus.
      
      But that broke the 'info qtree' command in the monitor. 'qtree'
      performs a loop on the children of a bus to print their properties and
      SysBus devices are expected to be found under SysBus, which is not the
      case anymore.
      
      The fix for this problem is to register reset handlers for the ICP and
      ICS objects and stop using SysBus for such devices.
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Tested-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      7ea6e067
  3. 05 3月, 2017 28 次提交
    • M
      qapi: Improve qobject visitor documentation · aa3a982e
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-29-git-send-email-armbru@redhat.com>
      aa3a982e
    • M
      qapi: Fix object input visit beyond end of list · 1f41a645
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-28-git-send-email-armbru@redhat.com>
      1f41a645
    • M
      tests: Cover input visit beyond end of list · a9416dc6
      Markus Armbruster 提交于
      When you try to visit beyond the end of a list, the qobject input
      visitor crashes, and the string visitor screws returns garbage.  The
      generated list visits never go beyond the list end, but manual visits
      could.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-27-git-send-email-armbru@redhat.com>
      a9416dc6
    • M
      qapi: Make input visitors detect unvisited list tails · a4a1c70d
      Markus Armbruster 提交于
      Fix the design flaw demonstrated in the previous commit: new method
      check_list() lets input visitors report that unvisited input remains
      for a list, exactly like check_struct() lets them report that
      unvisited input remains for a struct or union.
      
      Implement the method for the qobject input visitor (straightforward),
      and the string input visitor (less so, due to the magic list syntax
      there).  The opts visitor's list magic is even more impenetrable, and
      all I can do there today is a stub with a FIXME comment.  No worse
      than before.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1488544368-30622-26-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      a4a1c70d
    • M
      test-qobject-input-visitor: Cover missing nested struct member · 86ca0dbe
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1488544368-30622-25-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      86ca0dbe
    • M
      tests: Cover partial input visit of list · 9cb8ef36
      Markus Armbruster 提交于
      Demonstrates a design flaw: there is no way to for input visitors to
      report that a list visit didn't visit the complete input list.  The
      generated list visits always do, but manual visits needn't.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-24-git-send-email-armbru@redhat.com>
      9cb8ef36
    • M
      test-string-input-visitor: Improve list coverage · 3d089cea
      Markus Armbruster 提交于
      Lists with elements above INT64_MAX don't work (known bug).  Empty
      lists don't work (weird).
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-23-git-send-email-armbru@redhat.com>
      3d089cea
    • M
      test-string-input-visitor: Tear down existing test automatically · 0f721d16
      Markus Armbruster 提交于
      Call visitor_input_teardown() from visitor_input_test_init(), so you
      don't have to call it from the actual tests.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-22-git-send-email-armbru@redhat.com>
      0f721d16
    • M
      tests-qobject-input-strict: Merge into test-qobject-input-visitor · 77c47de2
      Markus Armbruster 提交于
      Much of test-qobject-input-strict.c duplicates
      test-qobject-input-strict.c, but with less assertions on expected
      output:
      
      * test_validate_struct() duplicates test_visitor_in_struct()
      
      * test_validate_struct_nested() duplicates
        test_visitor_in_struct_nested()
      
      * test_validate_list() duplicates the first half of
        test_visitor_in_list()
      
      * test_validate_union_native_list() duplicates
        test_visitor_in_native_list_int()
      
      * test_validate_union_flat() duplicates test_visitor_in_union_flat()
      
      * test_validate_alternate() duplicates the first part of
        test_visitor_in_alternate()
      
      Merge the remaining test cases into test-qobject-input-visitor.c, and
      drop the now redundant test-qobject-input-strict.c.
      
      Test case "/visitor/input-strict/fail/list" isn't really about lists,
      it's about a bad struct nested in a list.  Rename accordingly.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-21-git-send-email-armbru@redhat.com>
      77c47de2
    • M
      qapi: Drop unused non-strict qobject input visitor · 048abb7b
      Markus Armbruster 提交于
      The split between tests/test-qobject-input-visitor.c and
      tests/test-qobject-input-strict.c now makes less sense than ever.  The
      next commit will take care of that.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-20-git-send-email-armbru@redhat.com>
      048abb7b
    • M
      test-qobject-input-visitor: Use strict visitor · ec95f614
      Markus Armbruster 提交于
      The qobject input visitor comes in a strict and a non-strict variant.
      This test is the non-strict variant's last user.  Turns out it relies
      on non-strict only in test_visitor_in_null(), and just out of
      laziness.  We don't actually test the non-strict behavior.
      
      Clean up test_visitor_in_null(), and switch to the strict variant.
      The next commit will drop the non-strict variant.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-19-git-send-email-armbru@redhat.com>
      ec95f614
    • M
      qom: Make object_property_set_qobject()'s input visitor strict · 05601ed2
      Markus Armbruster 提交于
      Commit 240f64b6 made all qobject input visitors created outside tests
      strict, except for the one in object_property_set_qobject().  That one
      was left behind only because Eric couldn't spare the time to figure
      out whether making it strict would break anything, with a TODO
      comment.  Time to resolve it.
      
      Strict makes a difference only for otherwise successful visits of QAPI
      structs or unions.  Let's examine what the callers of
      object_property_set_qobject() visit:
      
      * object_property_set_str(), object_property_set_bool(),
        object_property_set_int() visit a QString, QBool, QInt,
        respectively.  Strictness can't matter.
      
      * qmp_qom_set visits its @value argument.  Comes straight from QMP and
        can be anything ('any' in the QAPI schema).  Strictness matters when
        the property's set() method visits a struct or union QAPI type.
      
        No such methods exist, thus switching to strict can't break
        anything.
      
        If we acquire such methods in the future, we'll *want* the visitor
        to be strict, so that unexpected members get rejected as they should
        be.
      
      Switch to strict.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-18-git-send-email-armbru@redhat.com>
      05601ed2
    • M
      qapi: Make string input and opts visitor require non-null input · f332e830
      Markus Armbruster 提交于
      The string input visitor tries to cope with null input.  Null input
      isn't used anywhere, and isn't covered by tests.  Unsurprisingly, it
      doesn't fully work: start_list() crashes because it passes the input
      via parse_str() to strtoll() unchecked.
      
      Make string_input_visitor_new() assert its argument isn't null, and
      drop the code trying to deal with null input.
      
      The opts visitor crashes when you try to actually visit something with
      null input.  Make opts_visitor_new() assert its argument isn't null,
      mostly for clarity.
      
      qobject_input_visitor_new() already asserts its argument isn't null.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-17-git-send-email-armbru@redhat.com>
      f332e830
    • M
      qapi: Drop string input visitor method optional() · a8aec6de
      Markus Armbruster 提交于
      visit_optional() is to be called only between visit_start_struct() and
      visit_end_struct().  Visitors that don't support struct visits,
      i.e. don't implement start_struct(), end_struct(), have no use for it.
      Clarify documentation.
      
      The string input visitor doesn't support struct visits.  Its
      parse_optional() is therefore useless.  Drop it.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-16-git-send-email-armbru@redhat.com>
      a8aec6de
    • M
      qapi: Improve qobject input visitor error reporting · a9fc37f6
      Markus Armbruster 提交于
      Error messages refer to nodes of the QObject being visited by name.
      Trouble is the names are sometimes less than helpful:
      
      * The name of the root QObject is whatever @name argument got passed
        to the visitor, except NULL gets mapped to "null".  We commonly pass
        NULL.  Not good.
      
        Avoiding errors "at the root" mitigates.  For instance,
        visit_start_struct() can only fail when the visited object is not a
        dictionary, and we commonly ensure it is beforehand.
      
      * The name of a QDict's member is the member key.  Good enough only
        when this happens to be unique.
      
      * The name of a QList's member is "null".  Not good.
      
      Improve error messages by referring to nodes by path instead, as
      follows:
      
      * The path of the root QObject is whatever @name argument got passed
        to the visitor, except NULL gets mapped to "<anonymous>".
      
      * The path of a root QDict's member is the member key.
      
      * The path of a root QList's member is "[%u]", where %u is the list
        index, starting at zero.
      
      * The path of a non-root QDict's member is the path of the QDict
        concatenated with "." and the member key.
      
      * The path of a non-root QList's member is the path of the QList
        concatenated with "[%u]", where %u is the list index.
      
      For example, the incorrect QMP command
      
          { "execute": "blockdev-add", "arguments": { "node-name": "foo", "driver": "raw", "file": {"driver": "file" } } }
      
      now fails with
      
          {"error": {"class": "GenericError", "desc": "Parameter 'file.filename' is missing"}}
      
      instead of
      
          {"error": {"class": "GenericError", "desc": "Parameter 'filename' is missing"}}
      
      and
      
          { "execute": "input-send-event", "arguments": { "device": "bar", "events": [ [] ] } }
      
      now fails with
      
          {"error": {"class": "GenericError", "desc": "Invalid parameter type for 'events[0]', expected: object"}}
      
      instead of
      
          {"error": {"class": "GenericError", "desc": "Invalid parameter type for 'null', expected: QDict"}}
      
      Aside: calling the thing "parameter" is suboptimal for QMP, because
      the root object is "arguments" there.
      
      The qobject output visitor doesn't have this problem because it should
      not fail.  Same for dealloc and clone visitors.
      
      The string visitors don't have this problem because they visit just
      one value, whose name needs to be passed to the visitor as @name.  The
      string output visitor shouldn't fail anyway.
      
      The options visitor uses QemuOpts names.  Their name space is flat, so
      the use of QDict member keys as names is fine.  NULL names used with
      roots and lists could conceivably result in bad error messages.  Left
      for another day.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-15-git-send-email-armbru@redhat.com>
      a9fc37f6
    • M
      qapi: Make QObject input visitor set *list reliably · 58561c27
      Markus Armbruster 提交于
      qobject_input_start_struct() sets *list, except when it fails because
      qobject_input_get_object() fails, i.e. the input object doesn't exist.
      
      All the other input visitor start_struct(), start_list(),
      start_alternate() always set *obj / *list.
      
      Change qobject_input_start_struct() to match.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-14-git-send-email-armbru@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      58561c27
    • M
      qapi: Clean up after commit 3d344c2a · b8874fbf
      Markus Armbruster 提交于
      Drop unused QIV_STACK_SIZE and unused qobject_input_start_struct()
      parameter errp.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-13-git-send-email-armbru@redhat.com>
      b8874fbf
    • M
      qapi: Improve a QObject input visitor error message · 910f738b
      Markus Armbruster 提交于
      The QObject input visitor has three error message formats:
      
      * Parameter '%s' is missing
      * "Invalid parameter type for '%s', expected: %s"
      * "QMP input object member '%s' is unexpected"
      
      The '%s' are member names (or "null", but I'll fix that later).
      
      The last error message calls the thing "QMP input object member"
      instead of "parameter".  Misleading when the visitor is used on
      QObjects that don't come from QMP.  Change it to "Parameter '%s' is
      unexpected".
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-12-git-send-email-armbru@redhat.com>
      910f738b
    • M
      qmp: Eliminate silly QERR_QMP_* macros · 99fb0c53
      Markus Armbruster 提交于
      The QERR_ macros are leftovers from the days of "rich" error objects.
      
      QERR_QMP_BAD_INPUT_OBJECT, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
      QERR_QMP_EXTRA_MEMBER are used in just one place now, except for one
      use that has crept into qobject-input-visitor.c.
      
      Drop these macros, to make the (bad) error messages more visible.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-10-git-send-email-armbru@redhat.com>
      99fb0c53
    • M
      qmp: Drop duplicated QMP command object checks · 104fc302
      Markus Armbruster 提交于
      qmp_check_input_obj() duplicates qmp_dispatch_check_obj(), except the
      latter screws up an error message.  handle_qmp_command() runs first
      the former, then the latter via qmp_dispatch(), masking the screwup.
      
      qemu-ga also masks the screwup, because it also duplicates checks,
      just differently.
      
      qmp_check_input_obj() exists because handle_qmp_command() needs to
      examine the command before dispatching it.  The previous commit got
      rid of this need, except for a tracepoint, and a bit of "id" code that
      relies on qdict not being null.
      
      Fix up the error message in qmp_dispatch_check_obj(), drop
      qmp_check_input_obj() and the tracepoint.  Protect the "id" code with
      a conditional.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-9-git-send-email-armbru@redhat.com>
      104fc302
    • M
      qmp: Clean up how we enforce capability negotiation · 635db18f
      Markus Armbruster 提交于
      To enforce capability negotiation before normal operation,
      handle_qmp_command() inspects every command before it's handed off to
      qmp_dispatch().  This is a bit of a layering violation, and results in
      duplicated code.
      
      Before capability negotiation (!cur_mon->in_command_mode), we fail
      commands other than "qmp_capabilities".  This is what enforces
      capability negotiation.
      
      Afterwards, we fail command "qmp_capabilities".
      
      Clean this up as follows.
      
      The obvious place to fail a command is the command itself, so move the
      "afterwards" check to qmp_qmp_capabilities().
      
      We do the "before" check in every other command, but that would be
      bothersome.  Instead, start with an alternate list of commands that
      contains only "qmp_capabilities".  Switch to the full list in
      qmp_qmp_capabilities().
      
      Additionally, replace the generic human-readable error message for
      CommandNotFound by one that reminds the user to run qmp_capabilities.
      Without that, we'd regress commit 2d5a8346.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1488544368-30622-8-git-send-email-armbru@redhat.com>
      [Mirco-optimization squashed in, commit message typo fixed]
      Reviewed-by: NEric Blake <eblake@redhat.com>
      635db18f
    • M
      qapi-introspect: Mangle --prefix argument properly for C · 9b0c9a63
      Markus Armbruster 提交于
      qapi-introspect.py --prefix hasn't been used so far, but fix it anyway.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1488544368-30622-7-git-send-email-armbru@redhat.com>
      [Commit message improved]
      Reviewed-by: NEric Blake <eblake@redhat.com>
      9b0c9a63
    • M
      qapi: Support multiple command registries per program · 1527badb
      Markus Armbruster 提交于
      The command registry encapsulates a single command list.  Give the
      functions using it a parameter instead.  Define suitable command lists
      in monitor, guest agent and test-qmp-commands.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1488544368-30622-6-git-send-email-armbru@redhat.com>
      [Debugging turds buried]
      Reviewed-by: NEric Blake <eblake@redhat.com>
      1527badb
    • M
      qmp: Dumb down how we run QMP command registration · 05875687
      Markus Armbruster 提交于
      The way we get QMP commands registered is high tech:
      
      * qapi-commands.py generates qmp_init_marshal() that does the actual work
      
      * it also generates the magic to register it as a MODULE_INIT_QAPI
        function, so it runs when someone calls
        module_call_init(MODULE_INIT_QAPI)
      
      * main() calls module_call_init()
      
      QEMU needs to register a few non-qapified commands.  Same high tech
      works: monitor.c has its own qmp_init_marshal() along with the magic
      to make it run in module_call_init(MODULE_INIT_QAPI).
      
      QEMU also needs to unregister commands that are not wanted in this
      build's configuration (commit 5032a16d).  Simple enough:
      qmp_unregister_commands_hack().  The difficulty is to make it run
      after the generated qmp_init_marshal().  We can't simply run it in
      monitor.c's qmp_init_marshal(), because the order in which the
      registered functions run is indeterminate.  So qmp_init_marshal()
      registers qmp_unregister_commands_hack() separately.  Since
      registering *appends* to the list of registered functions, this will
      make it run after all the functions that have been registered already.
      
      I suspect it takes a long and expensive computer science education to
      not find this silly.
      
      Dumb it down as follows:
      
      * Drop MODULE_INIT_QAPI entirely
      
      * Give the generated qmp_init_marshal() external linkage.
      
      * Call it instead of module_call_init(MODULE_INIT_QAPI)
      
      * Except in QEMU proper, call new monitor_init_qmp_commands() that in
        turn calls the generated qmp_init_marshal(), registers the
        additional commands and unregisters the unwanted ones.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-5-git-send-email-armbru@redhat.com>
      05875687
    • M
      qmp-test: New, covering basic QMP protocol · f66e7ac8
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-4-git-send-email-armbru@redhat.com>
      f66e7ac8
    • M
      libqtest: Work around a "QMP wants a newline" bug · 13420ef8
      Markus Armbruster 提交于
      The next commit is going to add a test that calls qmp("null").
      Curiously, this hangs.  Here's why.
      
      qmp_fd_sendv() doesn't send newlines.  Not even when @fmt contains
      some.  At first glance, the QMP parser seems to be fine with that.
      However, it turns out that it fails to react to input until it sees
      either a newline, an object or an array.  To reproduce, feed to a QMP
      monitor like this:
      
          $ echo -n 'null' | socat UNIX:/work/armbru/images/test-qmp STDIO
          {"QMP": {"version": {"qemu": {"micro": 50, "minor": 8, "major": 2}, "package": " (v2.8.0-1195-gf84141e-dirty)"}, "capabilities": []}}
      
      No output after the greeting.
      
      Add a newline:
      
          $ echo 'null' | socat UNIX:/work/armbru/images/test-qmp STDIO
          {"QMP": {"version": {"qemu": {"micro": 50, "minor": 8, "major": 2}, "package": " (v2.8.0-1195-gf84141e-dirty)"}, "capabilities": []}}
          {"error": {"class": "GenericError", "desc": "Expected 'object' in QMP input"}}
      
      Correct output for input 'null'.
      
      Add an object instead:
      
          $ echo -n 'null { "execute": "qmp_capabilities" }' | socat UNIX:qmp-socket STDIO
          {"QMP": {"version": {"qemu": {"micro": 50, "minor": 8, "major": 2}, "package": " (v2.8.0-1195-gf84141e-dirty)"}, "capabilities": []}}
          {"error": {"class": "GenericError", "desc": "Expected 'object' in QMP input"}}
          {"return": {}}
      
      Also correct output.
      
      Work around this QMP bug by having qmp_fd_sendv() append a newline.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-3-git-send-email-armbru@redhat.com>
      13420ef8
    • M
      qga: Fix crash on non-dictionary QMP argument · 74d8c9d9
      Markus Armbruster 提交于
      The value of key 'arguments' must be a JSON object.  qemu-ga neglects
      to check, and crashes.  To reproduce, send
      
          { 'execute': 'guest-sync', 'arguments': [] }
      
      to qemu-ga.
      
      do_qmp_dispatch() uses qdict_get_qdict() to get the arguments.  When
      not a JSON object, this gets a null pointer, which flows through the
      generated marshalling function to qobject_input_visitor_new(), where
      it fails the assertion.  qmp_dispatch_check_obj() needs to catch this
      error.
      
      QEMU isn't affected, because it runs qmp_check_input_obj() first,
      which basically duplicates qmp_dispatch_check_obj()'s checks, plus the
      missing one.
      
      Fix by copying the missing one from qmp_check_input_obj() to
      qmp_dispatch_check_obj().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-2-git-send-email-armbru@redhat.com>
      74d8c9d9
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.9-20170303' into staging · 17783ac8
      Peter Maydell 提交于
      ppc patch queuye for 2017-03-03
      
      This will probably be my last pull request before the hard freeze.  It
      has some new work, but that has all been posted in draft before the
      soft freeze, so I think it's reasonable to include in qemu-2.9.
      
      This batch has:
          * A substantial amount of POWER9 work
              * Implements the legacy (hash) MMU for POWER9
      	* Some more preliminaries for implementing the POWER9 radix
                MMU
      	* POWER9 has_work
      	* Basic POWER9 compatibility mode handling
      	* Removal of some premature tests
          * Some cleanups and fixes to the existing MMU code to make the
            POWER9 work simpler
          * A bugfix for TCG multiply adds on power
          * Allow pseries guests to access PCIe extended config space
      
      This also includes a code-motion not strictly in ppc code - moving
      getrampagesize() from ppc code to exec.c.  This will make some future
      VFIO improvements easier, Paolo said it was ok to merge via my tree.
      
      # gpg: Signature made Fri 03 Mar 2017 03:20:36 GMT
      # gpg:                using RSA key 0x6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-2.9-20170303:
        target/ppc: rewrite f[n]m[add,sub] using float64_muladd
        spapr: Small cleanup of PPC MMU enums
        spapr_pci: Advertise access to PCIe extended config space
        target/ppc: Rework hash mmu page fault code and add defines for clarity
        target/ppc: Move no-execute and guarded page checking into new function
        target/ppc: Add execute permission checking to access authority check
        target/ppc: Add Instruction Authority Mask Register Check
        hw/ppc/spapr: Add POWER9 to pseries cpu models
        target/ppc/POWER9: Add cpu_has_work function for POWER9
        target/ppc/POWER9: Add POWER9 pa-features definition
        target/ppc/POWER9: Add POWER9 mmu fault handler
        target/ppc: Don't gen an SDR1 on POWER9 and rework register creation
        target/ppc: Add patb_entry to sPAPRMachineState
        target/ppc/POWER9: Add POWERPC_MMU_V3 bit
        powernv: Don't test POWER9 CPU yet
        exec, kvm, target-ppc: Move getrampagesize() to common code
        target/ppc: Add POWER9/ISAv3.00 to compat_table
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      17783ac8
  4. 04 3月, 2017 3 次提交