1. 06 9月, 2016 1 次提交
  2. 10 8月, 2016 1 次提交
  3. 22 7月, 2016 1 次提交
  4. 19 7月, 2016 1 次提交
    • E
      qapi: Implement boxed types for commands/events · c818408e
      Eric Blake 提交于
      Turn on the ability to pass command and event arguments in
      a single boxed parameter, which must name a non-empty type
      (although the type can be a struct with all optional members).
      For structs, it makes it possible to pass a single qapi type
      instead of a breakout of all struct members (useful if the
      arguments are already in a struct or if the number of members
      is large); for other complex types, it is now possible to use
      a union or alternate as the data for a command or event.
      
      The empty type may be technically feasible if needed down the
      road, but it's easier to forbid it now and relax things to allow
      it later, than it is to allow it now and have to special case
      how the generated 'q_empty' type is handled (see commit 7ce106a9
      for reasons why nothing is generated for the empty type).  An
      alternate type is never considered empty, but now that a boxed
      type can be either an object or an alternate, we have to provide
      a trivial QAPISchemaAlternateType.is_empty().  The new call to
      arg_type.is_empty() during QAPISchemaCommand.check() requires
      that we first check the type in question; but there is no chance
      of introducing a cycle since objects do not refer back to commands.
      
      We still have a split in syntax checking between ad-hoc parsing
      up front (merely validates that 'boxed' has a sane value) and
      during .check() methods (if 'boxed' is set, then 'data' must name
      a non-empty user-defined type).
      
      Generated code is unchanged, as long as no client uses the
      new feature.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1468468228-27827-10-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [Test files renamed to *-boxed-*]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      c818408e
  5. 18 7月, 2016 1 次提交
  6. 13 7月, 2016 1 次提交
  7. 12 7月, 2016 1 次提交
  8. 06 7月, 2016 4 次提交
    • E
      qapi: Add new visit_complete() function · 3b098d56
      Eric Blake 提交于
      Making each output visitor provide its own output collection
      function was the only remaining reason for exposing visitor
      sub-types to the rest of the code base.  Add a polymorphic
      visit_complete() function which is a no-op for input visitors,
      and which populates an opaque pointer for output visitors.  For
      maximum type-safety, also add a parameter to the output visitor
      constructors with a type-correct version of the output pointer,
      and assert that the two uses match.
      
      This approach was considered superior to either passing the
      output parameter only during construction (action at a distance
      during visit_free() feels awkward) or only during visit_complete()
      (defeating type safety makes it easier to use incorrectly).
      
      Most callers were function-local, and therefore a mechanical
      conversion; the testsuite was a bit trickier, but the previous
      cleanup patch minimized the churn here.
      
      The visit_complete() function may be called at most once; doing
      so lets us use transfer semantics rather than duplication or
      ref-count semantics to get the just-built output back to the
      caller, even though it means our behavior is not idempotent.
      
      Generated code is simplified as follows for events:
      
      |@@ -26,7 +26,7 @@ void qapi_event_send_acpi_device_ost(ACP
      |     QDict *qmp;
      |     Error *err = NULL;
      |     QMPEventFuncEmit emit;
      |-    QmpOutputVisitor *qov;
      |+    QObject *obj;
      |     Visitor *v;
      |     q_obj_ACPI_DEVICE_OST_arg param = {
      |         info
      |@@ -39,8 +39,7 @@ void qapi_event_send_acpi_device_ost(ACP
      |
      |     qmp = qmp_event_build_dict("ACPI_DEVICE_OST");
      |
      |-    qov = qmp_output_visitor_new();
      |-    v = qmp_output_get_visitor(qov);
      |+    v = qmp_output_visitor_new(&obj);
      |
      |     visit_start_struct(v, "ACPI_DEVICE_OST", NULL, 0, &err);
      |     if (err) {
      |@@ -55,7 +54,8 @@ void qapi_event_send_acpi_device_ost(ACP
      |         goto out;
      |     }
      |
      |-    qdict_put_obj(qmp, "data", qmp_output_get_qobject(qov));
      |+    visit_complete(v, &obj);
      |+    qdict_put_obj(qmp, "data", obj);
      |     emit(QAPI_EVENT_ACPI_DEVICE_OST, qmp, &err);
      
      and for commands:
      
      | {
      |     Error *err = NULL;
      |-    QmpOutputVisitor *qov = qmp_output_visitor_new();
      |     Visitor *v;
      |
      |-    v = qmp_output_get_visitor(qov);
      |+    v = qmp_output_visitor_new(ret_out);
      |     visit_type_AddfdInfo(v, "unused", &ret_in, &err);
      |-    if (err) {
      |-        goto out;
      |+    if (!err) {
      |+        visit_complete(v, ret_out);
      |     }
      |-    *ret_out = qmp_output_get_qobject(qov);
      |-
      |-out:
      |     error_propagate(errp, err);
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-13-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3b098d56
    • E
      qmp-input-visitor: Favor new visit_free() function · b70ce101
      Eric Blake 提交于
      Now that we have a polymorphic visit_free(), we no longer need
      qmp_input_visitor_cleanup(); which in turn means we no longer
      need to return a subtype from qmp_input_visitor_new() nor a
      public upcast function.
      
      Generated code changes to qmp-marshal.c look like:
      
      |@@ -52,11 +52,10 @@ void qmp_marshal_add_fd(QDict *args, QOb
      | {
      |     Error *err = NULL;
      |     AddfdInfo *retval;
      |-    QmpInputVisitor *qiv = qmp_input_visitor_new(QOBJECT(args), true);
      |     Visitor *v;
      |     q_obj_add_fd_arg arg = {0};
      |
      |-    v = qmp_input_get_visitor(qiv);
      |+    v = qmp_input_visitor_new(QOBJECT(args), true);
      |     visit_start_struct(v, NULL, NULL, 0, &err);
      |     if (err) {
      |         goto out;
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-8-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      b70ce101
    • E
      qapi: Add new visit_free() function · 2c0ef9f4
      Eric Blake 提交于
      Making each visitor provide its own (awkwardly-named) FOO_cleanup()
      is unusual, when we can instead have a polymorphic visit_free()
      interface.  Over the next few patches, we can use the polymorphic
      functions to eliminate the need for a FOO_get_visitor() function
      for accessing specific visitor functionality, once everything can
      be accessed directly through the Visitor* interfaces.
      
      The dealloc visitor is the first one converted to completely use
      the new entry point, since qapi_dealloc_visitor_cleanup() was the
      only reason that qapi_dealloc_get_visitor() existed, and only
      generated and testsuite code was even using it.  With the new
      visit_free() entry point in place, we no longer need to expose
      the QapiDeallocVisitor subtype through qapi_dealloc_visitor_new(),
      and can get by with less generated code, with diffs that look like:
      
      | void qapi_free_ACPIOSTInfo(ACPIOSTInfo *obj)
      | {
      |-    QapiDeallocVisitor *qdv;
      |     Visitor *v;
      |
      |     if (!obj) {
      |         return;
      |     }
      |
      |-    qdv = qapi_dealloc_visitor_new();
      |-    v = qapi_dealloc_get_visitor(qdv);
      |+    v = qapi_dealloc_visitor_new();
      |     visit_type_ACPIOSTInfo(v, NULL, &obj, NULL);
      |-    qapi_dealloc_visitor_cleanup(qdv);
      |+    visit_free(v);
      |}
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-5-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      2c0ef9f4
    • E
      qapi: Add parameter to visit_end_* · 1158bb2a
      Eric Blake 提交于
      Rather than making the dealloc visitor track of stack of pointers
      remembered during visit_start_* in order to free them during
      visit_end_*, it's a lot easier to just make all callers pass the
      same pointer to visit_end_*.  The generated code has access to the
      same pointer, while all other users are doing virtual walks and
      can pass NULL.  The dealloc visitor is then greatly simplified.
      
      All three visit_end_*() functions intentionally take a void**,
      even though the visit_start_*() functions differ between void**,
      GenericList**, and GenericAlternate**.  This is done for several
      reasons: when doing a virtual walk, passing NULL doesn't care
      what the type is, but when doing a generated walk, we already
      have to cast the caller's specific FOO* to call visit_start,
      while using void** lets us use visit_end without a cast. Also,
      an upcoming patch will add a clone visitor that wants to use
      the same implementation for all three visit_end callbacks,
      which is made easier if all three share the same signature.
      
      For visitors with already track per-object state (the QMP visitors
      via a stack, and the string visitors which do not allow nesting),
      add an assertion that the caller is indeed passing the same
      pointer to paired calls.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-4-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      1158bb2a
  9. 04 7月, 2016 1 次提交
    • P
      memory: Provide memory_region_init_rom() · a1777f7f
      Peter Maydell 提交于
      Provide a new helper function memory_region_init_rom() for memory
      regions which are read-only (and unlike those created by
      memory_region_init_rom_device() don't have special behaviour
      for writes). This has the same behaviour as calling
      memory_region_init_ram() and then memory_region_set_readonly()
      (which is what we do today in boards with pure ROMs) but is a
      more easily discoverable API for the purpose.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1467122287-24974-2-git-send-email-peter.maydell@linaro.org
      a1777f7f
  10. 24 6月, 2016 2 次提交
  11. 21 6月, 2016 1 次提交
  12. 07 6月, 2016 3 次提交
  13. 01 6月, 2016 1 次提交
  14. 29 5月, 2016 2 次提交
    • P
      docs/atomics: update comparison with Linux · a4a0e4b2
      Paolo Bonzini 提交于
      Over time, some differences between QEMU and Linux atomics are getting
      smoothed.  In particular, Linux grew atomic_fetch_or (and in general
      the differences regarding RMW operations were not described accurately)
      and smp_load_acquire/smp_store_release.  Also, set_mb was renamed to
      smp_store_mb().  Include these changes in the documentation.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a4a0e4b2
    • E
      docs/atomics: update atomic_read/set comparison with Linux · 56ebe022
      Emilio G. Cota 提交于
      Recently Linux did a mass conversion of its atomic_read/set calls
      so that they at least are READ/WRITE_ONCE. See Linux's commit
      62e8a325 ("atomic, arch: Audit atomic_{read,set}()"). It seems though
      that their documentation hasn't been updated to reflect this.
      
      The appended updates our documentation to reflect the change, which
      means there is effectively no difference between our atomic_read/set
      and the current Linux implementation.
      
      While at it, fix the statement that a barrier is implied by
      atomic_read/set, which is incorrect. Volatile/atomic semantics prevent
      transformations pertaining the variable they apply to; this, however,
      has no effect on surrounding statements like barriers do. For more
      details on this, see:
        https://gcc.gnu.org/onlinedocs/gcc/Volatiles.htmlSigned-off-by: NEmilio G. Cota <cota@braap.org>
      Message-Id: <1464120374-8950-2-git-send-email-cota@braap.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      56ebe022
  15. 27 5月, 2016 1 次提交
  16. 26 5月, 2016 1 次提交
  17. 23 5月, 2016 1 次提交
  18. 18 5月, 2016 1 次提交
  19. 12 5月, 2016 5 次提交
    • E
      qapi: Change visit_type_FOO() to no longer return partial objects · 68ab47e4
      Eric Blake 提交于
      Returning a partial object on error is an invitation for a careless
      caller to leak memory.  We already fixed things in an earlier
      patch to guarantee NULL if visit_start fails ("qapi: Guarantee
      NULL obj on input visitor callback error"), but that does not
      help the case where visit_start succeeds but some other failure
      happens before visit_end, such that we leak a partially constructed
      object outside visit_type_FOO(). As no one outside the testsuite
      was actually relying on these semantics, it is cleaner to just
      document and guarantee that ALL pointer-based visit_type_FOO()
      functions always leave a safe value in *obj during an input visitor
      (either the new object on success, or NULL if an error is
      encountered), so callers can now unconditionally use
      qapi_free_FOO() to clean up regardless of whether an error occurred.
      
      The decision is done by adding visit_is_input(), then updating the
      generated code to check if additional cleanup is needed based on
      the type of visitor in use.
      
      Note that we still leave *obj unchanged after a scalar-based
      visit_type_FOO(); I did not feel like auditing all uses of
      visit_type_Enum() to see if the callers would tolerate a specific
      sentinel value (not to mention having to decide whether it would
      be better to use 0 or ENUM__MAX as that sentinel).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-25-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      68ab47e4
    • E
      qapi: Simplify semantics of visit_next_list() · d9f62dde
      Eric Blake 提交于
      The semantics of the list visit are somewhat baroque, with the
      following pseudocode when FooList is used:
      
      start()
      for (prev = head; cur = next(prev); prev = &cur) {
          visit(&cur->value)
      }
      
      Note that these semantics (advance before visit) requires that
      the first call to next() return the list head, while all other
      calls return the next element of the list; that is, every visitor
      implementation is required to track extra state to decide whether
      to return the input as-is, or to advance.  It also requires an
      argument of 'GenericList **' to next(), solely because the first
      iteration might need to modify the caller's GenericList head, so
      that all other calls have to do a layer of dereferencing.
      
      Thankfully, we only have two uses of list visits in the entire
      code base: one in spapr_drc (which completely avoids
      visit_next_list(), feeding in integers from a different source
      than uint8List), and one in qapi-visit.py.  That is, all other
      list visitors are generated in qapi-visit.c, and share the same
      paradigm based on a qapi FooList type, so we can refactor how
      lists are laid out with minimal churn among clients.
      
      We can greatly simplify things by hoisting the special case
      into the start() routine, and flipping the order in the loop
      to visit before advance:
      
      start(head)
      for (tail = *head; tail; tail = next(tail)) {
          visit(&tail->value)
      }
      
      With the simpler semantics, visitors have less state to track,
      the argument to next() is reduced to 'GenericList *', and it
      also becomes obvious whether an input visitor is allocating a
      FooList during visit_start_list() (rather than the old way of
      not knowing if an allocation happened until the first
      visit_next_list()).  As a minor drawback, we now allocate in
      two functions instead of one, and have to pass the size to
      both functions (unless we were to tweak the input visitors to
      cache the size to start_list for reuse during next_list, but
      that defeats the goal of less visitor state).
      
      The signature of visit_start_list() is chosen to match
      visit_start_struct(), with the new parameters after 'name'.
      
      The spapr_drc case is a virtual visit, done by passing NULL for
      list, similarly to how NULL is passed to visit_start_struct()
      when a qapi type is not used in those visits.  It was easy to
      provide these semantics for qmp-output and dealloc visitors,
      and a bit harder for qmp-input (several prerequisite patches
      refactored things to make this patch straightforward).  But it
      turned out that the string and opts visitors munge enough other
      state during visit_next_list() to make it easier to just
      document and require a GenericList visit for now; an assertion
      will remind us to adjust things if we need the semantics in the
      future.
      
      Several pre-requisite cleanup patches made the reshuffling of
      the various visitors easier; particularly the qmp input visitor.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-24-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      d9f62dde
    • E
      qapi: Split visit_end_struct() into pieces · 15c2f669
      Eric Blake 提交于
      As mentioned in previous patches, we want to call visit_end_struct()
      functions unconditionally, so that visitors can release resources
      tied up since the matching visit_start_struct() without also having
      to worry about error priority if more than one error occurs.
      
      Even though error_propagate() can be safely used to ignore a second
      error during cleanup caused by a first error, it is simpler if the
      cleanup cannot set an error.  So, split out the error checking
      portion (basically, input visitors checking for unvisited keys) into
      a new function visit_check_struct(), which can be safely skipped if
      any earlier errors are encountered, and leave the cleanup portion
      (which never fails, but must be called unconditionally if
      visit_start_struct() succeeded) in visit_end_struct().
      
      Generated code in qapi-visit.c has diffs resembling:
      
      |@@ -59,10 +59,12 @@ void visit_type_ACPIOSTInfo(Visitor *v,
      |         goto out_obj;
      |     }
      |     visit_type_ACPIOSTInfo_members(v, obj, &err);
      |-    error_propagate(errp, err);
      |-    err = NULL;
      |+    if (err) {
      |+        goto out_obj;
      |+    }
      |+    visit_check_struct(v, &err);
      | out_obj:
      |-    visit_end_struct(v, &err);
      |+    visit_end_struct(v);
      | out:
      
      and in qapi-event.c:
      
      @@ -47,7 +47,10 @@ void qapi_event_send_acpi_device_ost(ACP
      |         goto out;
      |     }
      |     visit_type_q_obj_ACPI_DEVICE_OST_arg_members(v, &param, &err);
      |-    visit_end_struct(v, err ? NULL : &err);
      |+    if (!err) {
      |+        visit_check_struct(v, &err);
      |+    }
      |+    visit_end_struct(v);
      |     if (err) {
      |         goto out;
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-20-git-send-email-eblake@redhat.com>
      [Conflict with a doc fixup resolved]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      15c2f669
    • E
      qapi-commands: Wrap argument visit in visit_start_struct · ed841535
      Eric Blake 提交于
      The qmp-input visitor was allowing callers to play rather fast
      and loose: when visiting a QDict, you could grab members of the
      root dictionary without first pushing into the dict; among the
      culprit callers was the generated marshal code on the 'arguments'
      dictionary of a QMP command.  But we are about to tighten the
      input visitor, at which point the generated marshal code MUST
      follow the same paradigms as everyone else, of pushing into the
      struct before grabbing its keys.
      
      Generated code grows as follows:
      
      |@@ -515,7 +641,12 @@ void qmp_marshal_blockdev_backup(QDict *
      |     BlockdevBackup arg = {0};
      |
      |     v = qmp_input_get_visitor(qiv);
      |+    visit_start_struct(v, NULL, NULL, 0, &err);
      |+    if (err) {
      |+        goto out;
      |+    }
      |     visit_type_BlockdevBackup_members(v, &arg, &err);
      |+    visit_end_struct(v, err ? NULL : &err);
      |     if (err) {
      |         goto out;
      |     }
      |@@ -527,7 +715,9 @@ out:
      |     qmp_input_visitor_cleanup(qiv);
      |     qdv = qapi_dealloc_visitor_new();
      |     v = qapi_dealloc_get_visitor(qdv);
      |+    visit_start_struct(v, NULL, NULL, 0, NULL);
      |     visit_type_BlockdevBackup_members(v, &arg, NULL);
      |+    visit_end_struct(v, NULL);
      |     qapi_dealloc_visitor_cleanup(qdv);
      | }
      
      The use of 'err ? NULL : &err' is temporary; a later patch will
      clean that up when it splits visit_end_struct().
      
      Prior to this patch, the fact that there was no final
      visit_end_struct() meant that even though we are using a strict
      input visit, the marshalling code was not detecting excess input
      at the top level (only in nested levels).  Fortunately, we have
      code in monitor.c:qmp_check_client_args() that also checks for
      no excess arguments at the top level.  But as the generated code
      is more compact than the manual check, a later patch will clean
      up monitor.c to drop the redundancy added here.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-9-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      ed841535
    • E
      qapi: Consolidate QMP input visitor creation · fc471c18
      Eric Blake 提交于
      Rather than having two separate ways to create a QMP input
      visitor, where the safer approach has the more verbose name,
      it is better to consolidate things into a single function
      where the caller must explicitly choose whether to be strict
      or to ignore excess input.  This patch is the strictly
      mechanical conversion; the next patch will then audit which
      uses can be made stricter.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-6-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      fc471c18
  20. 19 4月, 2016 1 次提交
    • M
      fw_cfg: Adopt /opt/RFQDN convention · 63d3145a
      Markus Armbruster 提交于
      FW CFG's primary user is QEMU, which uses it to expose configuration
      information (in the widest sense) to Firmware.  Thus the name FW CFG.
      
      FW CFG can also be used by others for their own purposes.  QEMU is
      merely acting as transport then.  Names starting with opt/ are
      reserved for such uses.  There is no provision, however, to guide safe
      sharing among different such users.
      
      Fix that, loosely following QMP precedence: names should start with
      opt/RFQDN/, where RFQDN is a reverse fully qualified domain name you
      control.
      
      Based on a more ambitious patch from Michael Tsirkin.
      
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Gabriel L. Somlo <somlo@cmu.edu>
      Cc: Laszlo Ersek <lersek@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NGabriel Somlo <somlo@cmu.edu>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      63d3145a
  21. 14 4月, 2016 2 次提交
  22. 08 4月, 2016 1 次提交
  23. 05 4月, 2016 1 次提交
  24. 31 3月, 2016 1 次提交
  25. 30 3月, 2016 1 次提交
    • P
      replay: introduce block devices record/replay · 63785678
      Pavel Dovgalyuk 提交于
      This patch introduces block driver that implement recording
      and replaying of block devices' operations.
      All block completion operations are added to the queue.
      Queue is flushed at checkpoints and information about processed requests
      is recorded to the log. In replay phase the queue is matched with
      events read from the log. Therefore block devices requests are processed
      deterministically.
      Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      [ kwolf: Rebased onto modified and already applied part of the series ]
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      63785678
  26. 22 3月, 2016 3 次提交
    • M
      ivshmem: Require master to have ID zero · 62a830b6
      Markus Armbruster 提交于
      Migration with ivshmem needs to be carefully orchestrated to work.
      Exactly one peer (the "master") migrates to the destination, all other
      peers need to unplug (and disconnect), migrate, plug back (and
      reconnect).  This is sort of documented in qemu-doc.
      
      If peers connect on the destination before migration completes, the
      shared memory can get messed up.  This isn't documented anywhere.  Fix
      that in qemu-doc.
      
      To avoid messing up register IVPosition on migration, the server must
      assign the same ID on source and destination.  ivshmem-spec.txt leaves
      ID assignment unspecified, however.
      
      Amend ivshmem-spec.txt to require the first client to receive ID zero.
      The example ivshmem-server complies: it always assigns the first
      unused ID.
      
      For a bit of additional safety, enforce ID zero for the master.  This
      does nothing when we're not using a server, because the ID is zero for
      all peers then.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-40-git-send-email-armbru@redhat.com>
      62a830b6
    • M
      ivshmem: Split ivshmem-plain, ivshmem-doorbell off ivshmem · 5400c02b
      Markus Armbruster 提交于
      ivshmem can be configured with and without interrupt capability
      (a.k.a. "doorbell").  The two configurations have largely disjoint
      options, which makes for a confusing (and badly checked) user
      interface.  Moreover, the device can't tell the guest whether its
      doorbell is enabled.
      
      Create two new device models ivshmem-plain and ivshmem-doorbell, and
      deprecate the old one.
      
      Changes from ivshmem:
      
      * PCI revision is 1 instead of 0.  The new revision is fully backwards
        compatible for guests.  Guests may elect to require at least
        revision 1 to make sure they're not exposed to the funny "no shared
        memory, yet" state.
      
      * Property "role" replaced by "master".  role=master becomes
        master=on, role=peer becomes master=off.  Default is off instead of
        auto.
      
      * Property "use64" is gone.  The new devices always have 64 bit BARs.
      
      Changes from ivshmem to ivshmem-plain:
      
      * The Interrupt Pin register in PCI config space is zero (does not use
        an interrupt pin) instead of one (uses INTA).
      
      * Property "x-memdev" is renamed to "memdev".
      
      * Properties "shm" and "size" are gone.  Use property "memdev"
        instead.
      
      * Property "msi" is gone.  The new device can't have MSI-X capability.
        It can't interrupt anyway.
      
      * Properties "ioeventfd" and "vectors" are gone.  They're meaningless
        without interrupts anyway.
      
      Changes from ivshmem to ivshmem-doorbell:
      
      * Property "msi" is gone.  The new device always has MSI-X capability.
      
      * Property "ioeventfd" defaults to on instead of off.
      
      * Property "size" is gone.  The new device can only map all the shared
        memory received from the server.
      
      Guests can easily find out whether the device is configured for
      interrupts by checking for MSI-X capability.
      
      Note: some code added in sub-optimal places to make the diff easier to
      review.  The next commit will move it to more sensible places.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-37-git-send-email-armbru@redhat.com>
      5400c02b
    • M
      ivshmem: Propagate errors through ivshmem_recv_setup() · 1309cf44
      Markus Armbruster 提交于
      This kills off the funny state described in the previous commit.
      
      Simplify ivshmem_io_read() accordingly, and update documentation.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1458066895-20632-27-git-send-email-armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      1309cf44