1. 30 3月, 2016 1 次提交
  2. 29 3月, 2016 2 次提交
  3. 23 3月, 2016 7 次提交
    • A
      qemu-log: support simple pid substitution for logs · f6880b7f
      Alex Bennée 提交于
      When debugging stuff that occurs over several forks it would be useful
      not to keep overwriting the one logfile you've set-up. This allows a
      simple %d to be included once in the logfile parameter which is
      substituted with getpid().
      
      As the test cases involve checking user output they need
      g_test_trap_subprocess() support. As a result they are currently skipped
      on Travis builds due to the older glib involved.
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: NLeandro Dorileo <l@dorileo.org>
      Reviewed-by: NAurelien Jarno <aurelien@aurel32.net>
      Reviewed-by: NRichard Henderson  <rth@twiddle.net>
      Message-Id: <1458052224-9316-10-git-send-email-alex.bennee@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f6880b7f
    • A
      qemu-log: new option -dfilter to limit output · 3514552e
      Alex Bennée 提交于
      When debugging big programs or system emulation sometimes you want both
      the verbosity of cpu,exec et all but don't want to generate lots of logs
      for unneeded stuff. This patch adds a new option -dfilter which allows
      you to specify interesting address ranges in the form:
      
        -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,...
      
      Then logging code can use the new qemu_log_in_addr_range() function to
      decide if it will output logging information for the given range.
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <1458052224-9316-7-git-send-email-alex.bennee@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3514552e
    • V
      util: move declarations out of qemu-common.h · f348b6d1
      Veronia Bahaa 提交于
      Move declarations out of qemu-common.h for functions declared in
      utils/ files: e.g. include/qemu/path.h for utils/path.c.
      Move inline functions out of qemu-common.h and into new files (e.g.
      include/qemu/bcd.h)
      Signed-off-by: NVeronia Bahaa <veroniabahaa@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f348b6d1
    • M
      include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h · 7136fc1d
      Markus Armbruster 提交于
      qemu-common.h should only be included by .c files.  Its file comment
      explains why: "No header file should depend on qemu-common.h, as this
      would easily lead to circular header dependencies."
      
      Several include/crypto/ headers include qemu-common.h, but either need
      just qapi-types.h from it, or qemu/bswap.h, or nothing at all.  Replace or
      drop the include accordingly.  tests/test-crypto-secret.c now misses
      qemu/module.h, so include it there.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7136fc1d
    • M
      fw_cfg: Split fw_cfg_keys.h off fw_cfg.h · 6f061ea1
      Markus Armbruster 提交于
      Much of fw_cfg.h's contents is #ifndef NO_QEMU_PROTOS.  This lets a
      few places include it without satisfying the dependencies of the
      suppressed code.  If you somehow include it with NO_QEMU_PROTOS, any
      future includes are ignored.  Unnecessarily unclean.
      
      Move the stuff not under NO_QEMU_PROTOS into its own header
      fw_cfg_keys.h, and include it as appropriate.  Tidy up the moved code
      to please checkpatch.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      6f061ea1
    • M
      Clean up includes some more · c80f6e9c
      Markus Armbruster 提交于
      Manually drop redundant includes that scripts/clean-includes misses,
      e.g. because they're hidden in generator programs, or they use the
      wrong kind of delimiter.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c80f6e9c
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  4. 22 3月, 2016 7 次提交
    • 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: Receive shared memory synchronously in realize() · 3a55fc0f
      Markus Armbruster 提交于
      When configured for interrupts (property "chardev" given), we receive
      the shared memory from an ivshmem server.  We do so asynchronously
      after realize() completes, by setting up callbacks with
      qemu_chr_add_handlers().
      
      Keeping server I/O out of realize() that way avoids delays due to a
      slow server.  This is probably relevant only for hot plug.
      
      However, this funny "no shared memory, yet" state of the device also
      causes a raft of issues that are hard or impossible to work around:
      
      * The guest is exposed to this state: when we enter and leave it its
        shared memory contents is apruptly replaced, and device register
        IVPosition changes.
      
        This is a known issue.  We document that guests should not access
        the shared memory after device initialization until the IVPosition
        register becomes non-negative.
      
        For cold plug, the funny state is unlikely to be visible in
        practice, because we normally receive the shared memory long before
        the guest gets around to mess with the device.
      
        For hot plug, the timing is tighter, but the relative slowness of
        PCI device configuration has a good chance to hide the funny state.
      
        In either case, guests complying with the documented procedure are
        safe.
      
      * Migration becomes racy.
      
        If migration completes before the shared memory setup completes on
        the source, shared memory contents is silently lost.  Fortunately,
        migration is rather unlikely to win this race.
      
        If the shared memory's ramblock arrives at the destination before
        shared memory setup completes, migration fails.
      
        There is no known way for a management application to wait for
        shared memory setup to complete.
      
        All you can do is retry failed migration.  You can improve your
        chances by leaving more time between running the destination QEMU
        and the migrate command.
      
        To mitigate silent memory loss, you need to ensure the server
        initializes shared memory exactly the same on source and
        destination.
      
        These issues are entirely undocumented so far.
      
      I'd expect the server to be almost always fast enough to hide these
      issues.  But then rare catastrophic races are in a way the worst kind.
      
      This is way more trouble than I'm willing to take from any device.
      Kill the funny state by receiving shared memory synchronously in
      realize().  If your hot plug hangs, go kill your ivshmem server.
      
      For easier review, this commit only makes the receive synchronous, it
      doesn't add the necessary error propagation.  Without that, the funny
      state persists.  The next commit will do that, and kill it off for
      real.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-26-git-send-email-armbru@redhat.com>
      3a55fc0f
    • M
      ivshmem-test: Improve test cases /ivshmem/server-* · 41b65e5e
      Markus Armbruster 提交于
      Document missing test: behavior with MSI-X present but not enabled.
      
      For MSI-X, we test and clear the interrupt pending bit before testing
      the interrupt.  For INTx, we only clear.  Change to test and clear for
      consistency.
      
      Test MSI-X vector 1 in addition to vector 0.
      
      Improve comments.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-10-git-send-email-armbru@redhat.com>
      41b65e5e
    • M
      ivshmem-test: Clean up wait for devices to become operational · 14c5d49a
      Markus Armbruster 提交于
      test_ivshmem_server() waits until the first byte in BAR 2 contains the
      0x42 we put into shared memory.  Works because the byte reads zero
      until the device maps the shared memory gotten from the server.
      
      Check the IVPosition register instead: it's initially -1, and becomes
      non-negative right when the device maps the share memory, so no
      change, just cleaner, because it's what guest software is supposed to
      do.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-9-git-send-email-armbru@redhat.com>
      14c5d49a
    • M
      ivshmem-test: Improve test case /ivshmem/single · 4958fe5d
      Markus Armbruster 提交于
      Test state of registers after reset.
      
      Test reading Interrupt Status clears it.
      
      Test (invalid) read of Doorbell.
      
      Add more comments.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-8-git-send-email-armbru@redhat.com>
      4958fe5d
    • M
      tests/libqos/pci-pc: Fix qpci_pc_iomap() to map BARs aligned · 99826172
      Markus Armbruster 提交于
      qpci_pc_iomap() maps BARs one after the other, without padding.  This
      is wrong.  PCI Local Bus Specification Revision 3.0, 6.2.5.1. Address
      Maps: "all address spaces used are a power of two in size and are
      naturally aligned".  That's because the size of a BAR is given by the
      number of address bits the device decodes, and the BAR needs to be
      mapped at a multiple of that size to ensure the address decoding
      works.
      
      Fix qpci_pc_iomap() accordingly.  This takes care of a FIXME in
      ivshmem-test.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1458066895-20632-7-git-send-email-armbru@redhat.com>
      99826172
    • M
      event_notifier: Make event_notifier_init_fd() #ifdef CONFIG_EVENTFD · 330b5836
      Markus Armbruster 提交于
      Event notifiers are designed for eventfd(2).  They can fall back to
      pipes, but according to Paolo, event_notifier_init_fd() really
      requires the real thing, and should therefore be under #ifdef
      CONFIG_EVENTFD.  Do that.
      
      Its only user is ivshmem, which is currently CONFIG_POSIX.  Narrow it
      to CONFIG_EVENTFD.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1458066895-20632-6-git-send-email-armbru@redhat.com>
      330b5836
  5. 19 3月, 2016 1 次提交
  6. 18 3月, 2016 5 次提交
    • E
      qapi: Allow anonymous base for flat union · ac4338f8
      Eric Blake 提交于
      Rather than requiring all flat unions to explicitly create
      a separate base struct, we can allow the qapi schema to specify
      the common members via an inline dictionary. This is similar to
      how commands can specify an inline anonymous type for its 'data'.
      We already have several struct types that only exist to serve as
      a single flat union's base; the next commit will clean them up.
      In particular, this patch's change to the BlockdevOptions example
      in qapi-code-gen.txt will actually be done in the real QAPI schema.
      
      Now that anonymous bases are legal, we need to rework the
      flat-union-bad-base negative test (as previously written, it
      forms what is now valid QAPI; tweak it to now provide coverage
      of a new error message path), and add a positive test in
      qapi-schema-test to use an anonymous base (making the integer
      argument optional, for even more coverage).
      
      Note that this patch only allows anonymous bases for flat unions;
      simple unions are already enough syntactic sugar that we do not
      want to burden them further.  Meanwhile, while it would be easy
      to also allow an anonymous base for structs, that would be quite
      redundant, as the members can be put right into the struct
      instead.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1458254921-17042-15-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      ac4338f8
    • E
      qapi: Don't special-case simple union wrappers · 32bafa8f
      Eric Blake 提交于
      Simple unions were carrying a special case that hid their 'data'
      QMP member from the resulting C struct, via the hack method
      QAPISchemaObjectTypeVariant.simple_union_type().  But by using
      the work we started by unboxing flat union and alternate
      branches, coupled with the ability to visit the members of an
      implicit type, we can now expose the simple union's implicit
      type in qapi-types.h:
      
      | struct q_obj_ImageInfoSpecificQCow2_wrapper {
      |     ImageInfoSpecificQCow2 *data;
      | };
      |
      | struct q_obj_ImageInfoSpecificVmdk_wrapper {
      |     ImageInfoSpecificVmdk *data;
      | };
      ...
      | struct ImageInfoSpecific {
      |     ImageInfoSpecificKind type;
      |     union { /* union tag is @type */
      |         void *data;
      |-        ImageInfoSpecificQCow2 *qcow2;
      |-        ImageInfoSpecificVmdk *vmdk;
      |+        q_obj_ImageInfoSpecificQCow2_wrapper qcow2;
      |+        q_obj_ImageInfoSpecificVmdk_wrapper vmdk;
      |     } u;
      | };
      
      Doing this removes asymmetry between QAPI's QMP side and its
      C side (both sides now expose 'data'), and means that the
      treatment of a simple union as sugar for a flat union is now
      equivalent in both languages (previously the two approaches used
      a different layer of dereferencing, where the simple union could
      be converted to a flat union with equivalent C layout but
      different {} on the wire, or to an equivalent QMP wire form
      but with different C representation).  Using the implicit type
      also lets us get rid of the simple_union_type() hack.
      
      Of course, now all clients of simple unions have to adjust from
      using su->u.member to using su->u.member.data; while this touches
      a number of files in the tree, some earlier cleanup patches
      helped minimize the change to the initialization of a temporary
      variable rather than every single member access.  The generated
      qapi-visit.c code is also affected by the layout change:
      
      |@@ -7393,10 +7393,10 @@ void visit_type_ImageInfoSpecific_member
      |     }
      |     switch (obj->type) {
      |     case IMAGE_INFO_SPECIFIC_KIND_QCOW2:
      |-        visit_type_ImageInfoSpecificQCow2(v, "data", &obj->u.qcow2, &err);
      |+        visit_type_q_obj_ImageInfoSpecificQCow2_wrapper_members(v, &obj->u.qcow2, &err);
      |         break;
      |     case IMAGE_INFO_SPECIFIC_KIND_VMDK:
      |-        visit_type_ImageInfoSpecificVmdk(v, "data", &obj->u.vmdk, &err);
      |+        visit_type_q_obj_ImageInfoSpecificVmdk_wrapper_members(v, &obj->u.vmdk, &err);
      |         break;
      |     default:
      |         abort();
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1458254921-17042-13-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      32bafa8f
    • E
      qapi: Adjust names of implicit types · 7599697c
      Eric Blake 提交于
      The original choice of ':obj-' as the prefix for implicit types
      made it obvious that we weren't going to clash with any user-defined
      names, which cannot contain ':'.  But now we want to create structs
      for implicit types, to get rid of special cases in the generators,
      and our use of ':' in implicit names needs a tweak to produce valid
      C code.
      
      We could transliterate ':' to '_', except that C99 mandates that
      "identifiers that begin with an underscore are always reserved for
      use as identifiers with file scope in both the ordinary and tag name
      spaces".  So it's time to change our naming convention: we can
      instead use the 'q_' prefix that we reserved for ourselves back in
      commit 9fb081e0.  Technically, since we aren't planning on exposing
      the empty type in generated code, we could keep the name ':empty',
      but renaming it to 'q_empty' makes the check for startswith('q_')
      cover all implicit types, whether or not code is generated for them.
      
      As long as we don't declare 'empty' or 'obj' ticklish, it shouldn't
      clash with c_name() prepending 'q_' to the user's ticklish names.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1458254921-17042-5-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      7599697c
    • E
      qapi: Fix command with named empty argument type · 972a1101
      Eric Blake 提交于
      The generator special-cased
      
       { 'command':'foo', 'data': {} }
      
      to avoid emitting a visitor variable, but failed to see that
      
       { 'struct':'NamedEmptyType, 'data': {} }
       { 'command':'foo', 'data':'NamedEmptyType' }
      
      needs the same treatment.  There, the generator happily generates a
      visitor to get no arguments, and a visitor to destroy no arguments;
      and the compiler isn't happy with that, as demonstrated by the updated
      qapi-schema-test.json:
      
        tests/test-qmp-marshal.c: In function ‘qmp_marshal_user_def_cmd0’:
        tests/test-qmp-marshal.c:264:14: error: variable ‘v’ set but not used [-Werror=unused-but-set-variable]
             Visitor *v;
                      ^
      
      No change to generated code except for the testsuite addition.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1458254921-17042-3-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      972a1101
    • D
      crypto: implement the LUKS block encryption format · 3e308f20
      Daniel P. Berrange 提交于
      Provide a block encryption implementation that follows the
      LUKS/dm-crypt specification.
      
      This supports all combinations of hash, cipher algorithm,
      cipher mode and iv generator that are implemented by the
      current crypto layer.
      
      There is support for opening existing volumes formatted
      by dm-crypt, and for formatting new volumes. In the latter
      case it will only use key slot 0.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      3e308f20
  7. 17 3月, 2016 14 次提交
  8. 16 3月, 2016 1 次提交
  9. 15 3月, 2016 2 次提交