1. 23 10月, 2017 2 次提交
    • D
      ui: normalize the 'sysrq' key into the 'print' key · 80b857f0
      Daniel P. Berrange 提交于
      The 'sysrq' key was mistakenly added to QEMU to deal with incorrect handling
      of the 'print' key in the ps2 device:
      
        commit f2289cb6
        Author: balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
        Date:   Wed Jun 4 10:14:16 2008 +0000
      
          Add sysrq to key names known by "sendkey".
      
          Adding sysrq keycode to the table enabling running sysrq debugging in
          the guest via the monitor sendkey command, like:
      
          (qemu) sendkey alt-sysrq-t
      
          Tested on x86-64 target and Linux guest.
      Signed-off-by: NRyan Harper <ryanh@us.ibm.com>
      
      The ps2 device is now fixed wrt modifiers and the 'print' key. Further the
      handling of the 'sysrq' key has some problems of its own, documented in the
      previous commit. To cleanup this mess, we convert any use of 'sysrq' into
      'print' prior to dispatching the event to device models.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-id: 20171019142848.572-9-berrange@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      80b857f0
    • D
      ui: use correct union field for key number · 237925ba
      Daniel P. Berrange 提交于
      The code converting key numbers to QKeyCode in the 'input-send-event'
      command mistakenly accessed the key->u.qcode union field instead of
      the key->u.number field. This is harmless because the fields use the
      same size datatype in both cases, but none the less it should be fixed
      to avoid confusion.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 20171019142848.572-4-berrange@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      237925ba
  2. 16 10月, 2017 2 次提交
  3. 04 9月, 2017 1 次提交
  4. 23 6月, 2017 1 次提交
    • A
      input: Decrement queue count on kbd delay · 77b0359b
      Alexander Graf 提交于
      Delays in the input layer are special cased input events. Every input
      event is accounted for in a global intput queue count. The special cased
      delays however did not get removed from the queue, leading to queue overruns
      and thus silent key drops after typing quite a few characters.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Message-id: 1498117318-162102-1-git-send-email-agraf@suse.de
      Fixes: be1a7176 ("input: add support for kbd delays")
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      77b0359b
  5. 21 6月, 2017 1 次提交
  6. 11 5月, 2017 1 次提交
  7. 03 5月, 2017 2 次提交
    • M
      input: don't queue delay if paused · 05c6638b
      Marc-André Lureau 提交于
      qemu_input_event_send() discards key event when the guest is paused,
      but not the delay.
      
      The delay ends up in the input queue, and qemu_input_event_send_key()
      will further fill the queue with upcoming events.
      
      VNC uses qemu_input_event_send_key_delay(), not SPICE, which results
      in a different input behaviour on pause: VNC will queue the events
      (except the first that is discarded), SPICE will discard all events.
      
      Don't queue delay if paused, and provide same behaviour on SPICE and
      VNC clients on resume (and potentially avoid over-allocating the
      buffer queue)
      
      Fixes:
      https://bugzilla.redhat.com/show_bug.cgi?id=1444326Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-id: 20170425130520.31819-1-marcandre.lureau@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      05c6638b
    • G
      input: limit kbd queue depth · fa18f36a
      Gerd Hoffmann 提交于
      Apply a limit to the number of items we accept into the keyboard queue.
      
      Impact: Without this limit vnc clients can exhaust host memory by
      sending keyboard events faster than qemu feeds them to the guest.
      
      Fixes: CVE-2017-8379
      Cc: P J P <ppandit@redhat.com>
      Cc: Huawei PSIRT <PSIRT@huawei.com>
      Reported-by: jiangxin1@huawei.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20170428084237.23960-1-kraxel@redhat.com
      fa18f36a
  8. 18 3月, 2016 1 次提交
    • 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
  9. 05 3月, 2016 2 次提交
    • E
      qapi: Avoid use of 'data' member of QAPI unions · 10f75907
      Eric Blake 提交于
      QAPI code generators currently create a 'void *data' member as
      part of the anonymous union embedded in the C struct corresponding
      to a QAPI union.  However, directly assigning to this member of
      the union feels a bit fishy, when we can assign to another member
      of the struct instead.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1457021813-10704-9-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      10f75907
    • E
      ui: Shorten references into InputEvent · b5a1b443
      Eric Blake 提交于
      An upcoming patch will alter how simple unions, like InputEvent, are
      laid out, which will impact all lines of the form 'evt->u.XXX'
      (expanding it to the longer 'evt->u.XXX.data').  For better
      legibility in that patch, and less need for line wrapping, it's better
      to use a temporary variable to reduce the effect of a layout change to
      just the variable initializations, rather than every reference within
      an InputEvent.
      
      There was one instance in hid.c:hid_pointer_event() where the code
      was referring to evt->u.rel inside the case label where evt->u.abs
      is the correct name; thankfully, both members of the union have the
      same type, so it happened to work, but it is now cleaner.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1457021813-10704-8-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      b5a1b443
  10. 01 3月, 2016 3 次提交
  11. 05 2月, 2016 1 次提交
    • P
      ui: Clean up includes · e16f4c87
      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-2-git-send-email-peter.maydell@linaro.org
      e16f4c87
  12. 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
  13. 06 11月, 2015 1 次提交
  14. 02 11月, 2015 1 次提交
    • E
      input: Convert to new qapi union layout · 568c73a4
      Eric Blake 提交于
      We have two issues with our qapi union layout:
      1) Even though the QMP wire format spells the tag 'type', the
      C code spells it 'kind', requiring some hacks in the generator.
      2) The C struct uses an anonymous union, which places all tag
      values in the same namespace as all non-variant members. This
      leads to spurious collisions if a tag value matches a non-variant
      member's name.
      
      Make the conversion to the new layout for input-related code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-20-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      568c73a4
  15. 23 6月, 2015 2 次提交
  16. 18 2月, 2015 1 次提交
    • M
      hmp: Name HMP command handler functions hmp_COMMAND() · 3e5a50d6
      Markus Armbruster 提交于
      Some are called do_COMMAND() (old ones, usually), some hmp_COMMAND(),
      and sometimes COMMAND pointlessly differs in spelling.
      
      Normalize to hmp_COMMAND(), where COMMAND is exactly the command name
      with '-' replaced by '_'.
      
      Exceptions:
      
      * do_device_add() and client_migrate_info() *not* renamed to
        hmp_device_add(), hmp_client_migrate_info(), because they're also
        QMP handlers.  They still need to be converted to QAPI.
      
      * do_memory_dump(), do_physical_memory_dump(), do_ioport_read(),
        do_ioport_write() renamed do hmp_* instead of hmp_x(), hmp_xp(),
        hmp_i(), hmp_o(), because those names are too cryptic for my taste.
      
      * do_info_help() renamed to hmp_info_help() instead of hmp_info(),
        because it only covers help.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3e5a50d6
  17. 26 11月, 2014 1 次提交
  18. 13 11月, 2014 1 次提交
    • A
      QMP/input-send-event: make console parameter optional · 51fc4476
      Amos Kong 提交于
      The 'QemuConsole' is the input source for handler, we share some
      input handlers to process the input events from different QemuConsole.
      
      Normally we only have one set of keyboard, mouse, usbtablet, etc.
      The devices have different mask, it's fine to just checking mask to
      insure that the handler has the ability to process the event.
      
      I saw we try to bind console to handler in usb/dev-hid.c, but display
      always isn't available at that time.
      
      If we have multiseat setup (as Gerd said), we only have 'problem' in
      this case. Actually event from different devices have the same effect
      for system, it's fine to always use the first available handler
      without caring about the console.
      
      For send-key command, we just pass a NULL for console parameter in
      calling qemu_input_event_send_key(NULL, ..), but 'input-send-event'
      needs to care more devices.
      
      Conclusion:
      Generally assigning the special console is meanless, and we can't
      directly remove the QMP parameter for compatibility.
      
      So we can make the parameter optional. The parameter might be useful
      for some special condition: we have multiple devices without binding
      console and they all have the ability(mask) to process events, and
      we don't want to use the first one.
      
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAmos Kong <akong@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      51fc4476
  19. 02 10月, 2014 1 次提交
  20. 04 6月, 2014 1 次提交
  21. 26 5月, 2014 2 次提交
  22. 16 5月, 2014 1 次提交
  23. 01 4月, 2014 2 次提交
  24. 05 3月, 2014 8 次提交