1. 28 4月, 2016 1 次提交
    • M
      qom: -object error messages lost location, restore it · 51b9b478
      Markus Armbruster 提交于
      qemu_opts_foreach() runs its callback with the error location set to
      the option's location.  Any errors the callback reports use the
      option's location automatically.
      
      Commit 90998d58 moved the actual error reporting from "inside"
      qemu_opts_foreach() to after it.  Here's a typical hunk:
      
      	 if (qemu_opts_foreach(qemu_find_opts("object"),
          -                          object_create,
          -                          object_create_initial, NULL)) {
          +                          user_creatable_add_opts_foreach,
          +                          object_create_initial, &err)) {
          +        error_report_err(err);
      	     exit(1);
      	 }
      
      Before, object_create() reports from within qemu_opts_foreach(), using
      the option's location.  Afterwards, we do it after
      qemu_opts_foreach(), using whatever location happens to be current
      there.  Commonly a "none" location.
      
      This is because Error objects don't have location information.
      Problematic.
      
      Reproducer:
      
          $ qemu-system-x86_64 -nodefaults -display none -object secret,id=foo,foo=bar
          qemu-system-x86_64: Property '.foo' not found
      
      Note no location.  This commit restores it:
      
          qemu-system-x86_64: -object secret,id=foo,foo=bar: Property '.foo' not found
      
      Note that the qemu_opts_foreach() bug just fixed could mask the bug
      here: if the location it leaves dangling hasn't been clobbered, yet,
      it's the correct one.
      Reported-by: NEric Blake <eblake@redhat.com>
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1461767349-15329-4-git-send-email-armbru@redhat.com>
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      [Paragraph on Error added to commit message]
      51b9b478
  2. 08 4月, 2016 1 次提交
    • G
      Sort the fw_cfg file list · bab47d9a
      Gerd Hoffmann 提交于
      Entries are inserted in filename order instead of being
      appended to the end in case sorting is enabled.
      
      This will avoid any future issues of moving the file creation
      around, it doesn't matter what order they are created now,
      the will always be in filename order.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      
      Added machine type handling for compatibility.  This was
      a fairly complex change, this will preserve the order of fw_cfg
      for older versions no matter what order the firmware files
      actually come in.  A list is kept of the correct legacy order
      and the entries will be inserted based upon their order in
      the list.  Except that some entries are ordered (in a specific
      area of the list) based upon what order they appear on the
      command line.  Special handling is added for those entries.
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      bab47d9a
  3. 05 4月, 2016 1 次提交
    • D
      vl: Move cpu_synchronize_all_states() into qemu_system_reset() · efdaf797
      David Gibson 提交于
      There are currently 3 calls to qemu_system_reset() in vl.c.  Two of them
      are immediately preceded by a cpu_synchronize_all_states9) and the
      remaining one should be.
      
      The one which doesn't is the very first reset called directly from main().
      Without a cpu_synchronize_all_states(), kvm_vcpu_dirty is false at this
      point from the earlier cpu_synchronize_all_post_init().  That's incorrect
      because the reset path is quite likely to update the CPU state, and that
      updated state should be pushed back to KVM, not overwritten with stale
      data pushed to KVM immediately after init.
      
      This patch moves the call to cpu_synchronize_all_states() into
      qemu_system_reset() for safety, so it is always called.  AFAICT this should
      be safe for the handful of callers outside vl.c - these all appear to be in
      places where the cpu state is already synchronized so the extra call
      will be a no-op.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Tested-by: NLaurent Vivier <lvivier@redhat.com>
      efdaf797
  4. 30 3月, 2016 2 次提交
  5. 24 3月, 2016 1 次提交
  6. 23 3月, 2016 2 次提交
  7. 17 3月, 2016 1 次提交
  8. 08 3月, 2016 1 次提交
    • G
      input: linux evdev support · e0d2bd51
      Gerd Hoffmann 提交于
      This patch adds support for reading input events directly from linux
      evdev devices and forward them to the guest.  Unlike virtio-input-host
      which simply passes on all events to the guest without looking at them
      this will interpret the events and feed them into the qemu input
      subsystem.
      
      Therefore this is limited to what the qemu input subsystem and the
      emulated input devices are able to handle.  Also there is no support for
      absolute coordinates (tablet/touchscreen).  So we are talking here about
      basic mouse and keyboard support.
      
      The advantage is that it'll work without virtio-input drivers in the
      guest, the events are delivered to the usual ps/2 or usb input devices
      (depending on what the machine happens to have).  And for keyboards
      qemu is able to switch the keyboard between guest and host on hotkey.
      The hotkey is hard-coded for now (both control keys), initialy the
      guest owns the keyboard.
      
      Probably most useful when assigning vga devices with vfio and using a
      physical monitor instead of vnc/spice/gtk as guest display.
      
      Usage:  Add '-input-linux /dev/input/event<nr>' to the qemu command
      line.  Note that udev has rules which populate /dev/input/by-{id,path}
      with static names, which might be more convinient to use.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 1457087116-4379-2-git-send-email-kraxel@redhat.com
      e0d2bd51
  9. 01 3月, 2016 1 次提交
  10. 19 2月, 2016 4 次提交
  11. 17 2月, 2016 1 次提交
    • D
      qom: add helpers for UserCreatable object types · 90998d58
      Daniel P. Berrange 提交于
      The QMP monitor code has two helper methods object_add
      and qmp_object_del that are called from several places
      in the code (QMP, HMP and main emulator startup).
      
      The HMP and main emulator startup code also share
      further logic that extracts the qom-type & id
      values from a qdict.
      
      We soon need to use this logic from qemu-img, qemu-io
      and qemu-nbd too, but don't want those to depend on
      the monitor, nor do we want to duplicate the code.
      
      To avoid this, move some code out of qmp.c and hmp.c
      adding new methods to qom/object_interfaces.c
      
       - user_creatable_add - takes a QDict holding a full
         object definition & instantiates it
       - user_creatable_add_type - takes an ID, type name,
         and QDict holding object properties & instantiates
         it
       - user_creatable_add_opts - takes a QemuOpts holding
         a full object definition & instantiates it
       - user_creatable_add_opts_foreach - variant on
         user_creatable_add_opts which can be directly used
         in conjunction with qemu_opts_foreach.
       - user_creatable_del - takes an ID and deletes the
         corresponding object
      
      The existing code is updated to use these new methods.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1455129674-17255-2-git-send-email-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      90998d58
  12. 16 2月, 2016 2 次提交
  13. 09 2月, 2016 6 次提交
    • E
      qapi: Drop unused 'kind' for struct/enum visit · 337283df
      Eric Blake 提交于
      visit_start_struct() and visit_type_enum() had a 'kind' argument
      that was usually set to either the stringized version of the
      corresponding qapi type name, or to NULL (although some clients
      didn't even get that right).  But nothing ever used the argument.
      It's even hard to argue that it would be useful in a debugger,
      as a stack backtrace also tells which type is being visited.
      
      Therefore, drop the 'kind' argument as dead.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-22-git-send-email-eblake@redhat.com>
      [Harmless rebase mistake cleaned up]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      337283df
    • E
      qapi: Swap visit_* arguments for consistent 'name' placement · 51e72bc1
      Eric Blake 提交于
      JSON uses "name":value, but many of our visitor interfaces were
      called with visit_type_FOO(v, &value, name, errp).  This can be
      a bit confusing to have to mentally swap the parameter order to
      match JSON order.  It's particularly bad for visit_start_struct(),
      where the 'name' parameter is smack in the middle of the
      otherwise-related group of 'obj, kind, size' parameters! It's
      time to do a global swap of the parameter ordering, so that the
      'name' parameter is always immediately after the Visitor argument.
      
      Additional reason in favor of the swap: the existing include/qjson.h
      prefers listing 'name' first in json_prop_*(), and I have plans to
      unify that file with the qapi visitors; listing 'name' first in
      qapi will minimize churn to the (admittedly few) qjson.h clients.
      
      Later patches will then fix docs, object.h, visitor-impl.h, and
      those clients to match.
      
      Done by first patching scripts/qapi*.py by hand to make generated
      files do what I want, then by running the following Coccinelle
      script to affect the rest of the code base:
       $ spatch --sp-file script `git grep -l '\bvisit_' -- '**/*.[ch]'`
      I then had to apply some touchups (Coccinelle insisted on TAB
      indentation in visitor.h, and botched the signature of
      visit_type_enum() by rewriting 'const char *const strings[]' to
      the syntactically invalid 'const char*const[] strings').  The
      movement of parameters is sufficient to provoke compiler errors
      if any callers were missed.
      
          // Part 1: Swap declaration order
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_start_struct
          -(TV v, TObj OBJ, T1 ARG1, const char *name, T2 ARG2, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type bool, TV, T1;
          identifier ARG1;
          @@
           bool visit_optional
          -(TV v, T1 ARG1, const char *name)
          +(TV v, const char *name, T1 ARG1)
           { ... }
      
          @@
          type TV, TErr, TObj, T1;
          identifier OBJ, ARG1;
          @@
           void visit_get_next_type
          -(TV v, TObj OBJ, T1 ARG1, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_type_enum
          -(TV v, TObj OBJ, T1 ARG1, T2 ARG2, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj;
          identifier OBJ;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
           void VISIT_TYPE
          -(TV v, TObj OBJ, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, TErr errp)
           { ... }
      
          // Part 2: swap caller order
          @@
          expression V, NAME, OBJ, ARG1, ARG2, ERR;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
          (
          -visit_start_struct(V, OBJ, ARG1, NAME, ARG2, ERR)
          +visit_start_struct(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -visit_optional(V, ARG1, NAME)
          +visit_optional(V, NAME, ARG1)
          |
          -visit_get_next_type(V, OBJ, ARG1, NAME, ERR)
          +visit_get_next_type(V, NAME, OBJ, ARG1, ERR)
          |
          -visit_type_enum(V, OBJ, ARG1, ARG2, NAME, ERR)
          +visit_type_enum(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -VISIT_TYPE(V, OBJ, NAME, ERR)
          +VISIT_TYPE(V, NAME, OBJ, ERR)
          )
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-19-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      51e72bc1
    • E
      vl: Ensure qapi visitor properly ends struct visit · 014791b0
      Eric Blake 提交于
      Guarantee that visit_end_struct() is called if
      visit_start_struct() succeeded.  This matches the behavior of
      most other uses of visitors, and is a step towards the possibility
      of a future patch that adds and enforces some tighter semantics to
      the visitor interface (namely, cleanup of the visitor would no
      longer have to mop up as many leftovers from an aborted partial
      visit).
      
      The change to code here matches the flow of hmp.c:hmp_object_add();
      a later patch will then further simplify the cleanup logic of both
      places by refactoring visit_end_struct() to not require a second
      local error object.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-9-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      014791b0
    • E
      hmp: Cache use of qapi visitor · 9b65859d
      Eric Blake 提交于
      Cache the visitor in a local variable instead of repeatedly
      calling the accessor.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-8-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9b65859d
    • E
      hmp: Drop pointless allocation during qapi visit · 7019738d
      Eric Blake 提交于
      The qapi visitor contract allows us to visit a virtual structure,
      where we don't have any corresponding qapi struct.  Most such uses
      pass NULL for @obj; but these two callers were passing a dummy
      pointer, which then gets allocated to heap memory but then
      immediately freed without use.  Clean this up to suppress unwanted
      allocation, like we do elsewhere.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-7-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      7019738d
    • M
      Use error_fatal to simplify obvious fatal errors (again) · 07d04a02
      Markus Armbruster 提交于
      Done with the Coccinelle semantic patch from commit 007b0657, plus
      manual clean up of dead variables.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1452783732-6581-1-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      07d04a02
  14. 05 2月, 2016 1 次提交
    • P
      all: Clean up includes · d38ea87a
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
      d38ea87a
  15. 04 2月, 2016 1 次提交
  16. 03 2月, 2016 5 次提交
  17. 19 1月, 2016 1 次提交
    • D
      qom: Change object property iterator API contract · 7746abd8
      Daniel P. Berrange 提交于
      Currently the ObjectProperty iterator API works as follows:
      
        ObjectPropertyIterator *iter;
      
        iter = object_property_iter_init(obj);
        while ((prop = object_property_iter_next(iter))) {
           ...
        }
        object_property_iter_free(iter);
      
      This has the benefit that the ObjectPropertyIterator struct
      can be opaque, but has the downside that callers need to
      explicitly call a free function. It is also not in keeping
      with iterator style used elsewhere in QEMU/GLib2.
      
      This patch changes the API to use stack allocation instead:
      
        ObjectPropertyIterator iter;
      
        object_property_iter_init(&iter, obj);
        while ((prop = object_property_iter_next(&iter))) {
           ...
        }
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [AF: Fused ObjectPropertyIterator struct with typedef]
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      7746abd8
  18. 13 1月, 2016 4 次提交
  19. 17 12月, 2015 1 次提交
    • E
      qapi: Don't let implicit enum MAX member collide · 7fb1cf16
      Eric Blake 提交于
      Now that we guarantee the user doesn't have any enum values
      beginning with a single underscore, we can use that for our
      own purposes.  Renaming ENUM_MAX to ENUM__MAX makes it obvious
      that the sentinel is generated.
      
      This patch was mostly generated by applying a temporary patch:
      
      |diff --git a/scripts/qapi.py b/scripts/qapi.py
      |index e6d014b..b862ec9 100644
      |--- a/scripts/qapi.py
      |+++ b/scripts/qapi.py
      |@@ -1570,6 +1570,7 @@ const char *const %(c_name)s_lookup[] = {
      |     max_index = c_enum_const(name, 'MAX', prefix)
      |     ret += mcgen('''
      |     [%(max_index)s] = NULL,
      |+// %(max_index)s
      | };
      | ''',
      |                max_index=max_index)
      
      then running:
      
      $ cat qapi-{types,event}.c tests/test-qapi-types.c |
          sed -n 's,^// \(.*\)MAX,s|\1MAX|\1_MAX|g,p' > list
      $ git grep -l _MAX | xargs sed -i -f list
      
      The only things not generated are the changes in scripts/qapi.py.
      
      Rejecting enum members named 'MAX' is now useless, and will be dropped
      in the next patch.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1447836791-369-23-git-send-email-eblake@redhat.com>
      Reviewed-by: NJuan Quintela <quintela@redhat.com>
      [Rebased to current master, commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      7fb1cf16
  20. 26 11月, 2015 1 次提交
    • D
      Revert "exec: silence hugetlbfs warning under qtest" · 2c189a4e
      Daniel P. Berrange 提交于
      This reverts commit 1c7ba94a.
      
      That commit changed QEMU initialization order from
      
       - object-initial, chardev, qtest, object-late
      
      to
      
       - chardev, qtest, object-initial, object-late
      
      This breaks chardev setups which need to rely on objects
      having been created. For example, when chardevs use TLS
      encryption in the future, they need to have tls credential
      objects created first.
      
      This revert, restores the ordering introduced in
      
        commit f08f9271
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Wed May 13 17:14:04 2015 +0100
      
          vl: Create (most) objects before creating chardev backends
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1448448749-1332-2-git-send-email-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2c189a4e
  21. 19 11月, 2015 2 次提交