1. 18 12月, 2018 1 次提交
    • D
      qmp: query-current-machine with wakeup-suspend-support · 46ea94ca
      Daniel Henrique Barboza 提交于
      When issuing the qmp/hmp 'system_wakeup' command, what happens in a
      nutshell is:
      
      - qmp_system_wakeup_request set runstate to RUNNING, sets a wakeup_reason
      and notify the event
      - in the main_loop, all vcpus are paused, a system reset is issued, all
      subscribers of wakeup_notifiers receives a notification, vcpus are then
      resumed and the wake up QAPI event is fired
      
      Note that this procedure alone doesn't ensure that the guest will awake
      from SUSPENDED state - the subscribers of the wake up event must take
      action to resume the guest, otherwise the guest will simply reboot. At
      this moment, only the ACPI machines via acpi_pm1_cnt_init and xen_hvm_init
      have wake-up from suspend support.
      
      However, only the presence of 'system_wakeup' is required for QGA to
      support 'guest-suspend-ram' and 'guest-suspend-hybrid' at this moment.
      This means that the user/management will expect to suspend the guest using
      one of those suspend commands and then resume execution using system_wakeup,
      regardless of the support offered in system_wakeup in the first place.
      
      This patch creates a new API called query-current-machine [1], that holds
      a new flag called 'wakeup-suspend-support' that indicates if the guest
      supports wake up from suspend via system_wakeup. The machine is considered
      to implement wake-up support if a call to a new 'qemu_register_wakeup_support'
      is made during its init, as it is now being done inside acpi_pm1_cnt_init
      and xen_hvm_init. This allows for any other machine type to declare wake-up
      support regardless of ACPI state or wakeup_notifiers subscription, making easier
      for newer implementations that might have their own mechanisms in the future.
      
      This is the expected output of query-current-machine when running a x86
      guest:
      
      {"execute" : "query-current-machine"}
      {"return": {"wakeup-suspend-support": true}}
      
      Running the same x86 guest, but with the --no-acpi option:
      
      {"execute" : "query-current-machine"}
      {"return": {"wakeup-suspend-support": false}}
      
      This is the output when running a pseries guest:
      
      {"execute" : "query-current-machine"}
      {"return": {"wakeup-suspend-support": false}}
      
      With this extra tool, management can avoid situations where a guest
      that does not have proper suspend/wake capabilities ends up in
      inconsistent state (e.g.
      https://github.com/open-power-host-os/qemu/issues/31).
      
      [1] the decision of creating the query-current-machine API is based
      on discussions in the QEMU mailing list where it was decided that
      query-target wasn't a proper place to store the wake-up flag, neither
      was query-machines because this isn't a static property of the
      machine object. This new API can then be used to store other
      dynamic machine properties that are scattered around the code
      ATM. More info at:
      https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg04235.htmlReported-by: NBalamuruhan S <bala24@linux.vnet.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Message-Id: <20181205194701.17836-2-danielhb413@gmail.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Acked-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      46ea94ca
  2. 01 6月, 2018 3 次提交
  3. 19 5月, 2018 1 次提交
  4. 26 4月, 2018 4 次提交
    • R
      xen: Use newly added dmops for mapping VGA memory · 2cbf8903
      Ross Lagerwall 提交于
      Xen unstable (to be in 4.11) has two new dmops, relocate_memory and
      pin_memory_cacheattr. Use these to set up the VGA memory, replacing the
      previous calls to libxc. This allows the VGA console to work properly
      when QEMU is running restricted (-xen-domid-restrict).
      
      Wrapper functions are provided to allow QEMU to work with older versions
      of Xen.
      
      Tweak the error handling while making this change:
      * Report pin_memory_cacheattr errors.
      * Report errors even when DEBUG_HVM is not set. This is useful for
      trying to understand why VGA is not working, since otherwise it just
      fails silently.
      * Fix the return values when an error occurs. The functions now
      consistently return -1 and set errno.
      
      CC: Ian Jackson <ian.jackson@eu.citrix.com>
      Signed-off-by: NRoss Lagerwall <ross.lagerwall@citrix.com>
      Reviewed-by: NIan Jackson <ian.jackson@eu.citrix.com>
      Signed-off-by: NIan Jackson <ian.jackson@eu.citrix.com>
      Acked-by: NAnthony PERARD <anthony.perard@citrix.com>
      2cbf8903
    • I
      xen: destroy_hvm_domain: Try xendevicemodel_shutdown · 6b47c2aa
      Ian Jackson 提交于
      xc_interface_open etc. is not going to work if we have dropped
      privilege, but xendevicemodel_shutdown will if everything is new
      enough.
      
      xendevicemodel_shutdown is only availabe in Xen 4.10 and later, so
      provide a stub for earlier versions.
      Signed-off-by: NIan Jackson <Ian.Jackson@eu.citrix.com>
      Reviewed-by: NAnthony PERARD <anthony.perard@citrix.com>
      6b47c2aa
    • I
      xen: destroy_hvm_domain: Move reason into a variable · 74aae6bf
      Ian Jackson 提交于
      We are going to want to reuse this.
      
      No functional change.
      Signed-off-by: NIan Jackson <Ian.Jackson@eu.citrix.com>
      Reviewed-by: NAnthony PERARD <anthony.perard@citrix.com>
      Acked-by: NStefano Stabellini <sstabellini@kernel.org>
      74aae6bf
    • I
      xen: defer call to xen_restrict until just before os_setup_post · 4564e63f
      Ian Jackson 提交于
      We need to restrict *all* the control fds that qemu opens.  Looking in
      /proc/PID/fd shows there are many; their allocation seems scattered
      throughout Xen support code in qemu.
      
      We must postpone the restrict call until roughly the same time as qemu
      changes its uid, chroots (if applicable), and so on.
      
      There doesn't seem to be an appropriate hook already.  The RunState
      change hook fires at different times depending on exactly what mode
      qemu is operating in.
      
      And it appears that no-one but the Xen code wants a hook at this phase
      of execution.  So, introduce a bare call to a new function
      xen_setup_post, just before os_setup_post.  Also provide the
      appropriate stub for when Xen compilation is disabled.
      
      We do the restriction before rather than after os_setup_post, because
      xen_restrict may need to open /dev/null, and os_setup_post might have
      called chroot.
      
      Currently this does not work with migration, because when running as
      the Xen device model qemu needs to signal to the toolstack that it is
      ready.  It currently does this using xenstore, and for incoming
      migration (but not for ordinary startup) that happens after
      os_setup_post.
      
      It is correct that this happens late: we want the incoming migration
      stream to be processed by a restricted qemu.  The fix for this will be
      to do the startup notification a different way, without using
      xenstore.  (QMP is probably a reasonable choice.)
      
      So for now this restriction feature cannot be used in conjunction with
      migration.  (Note that this is not a regression in this patch, because
      previously the -xen-restrict-domid call was, in fact, simply
      ineffective!)  We will revisit this in the Xen 4.11 release cycle.
      Signed-off-by: NIan Jackson <Ian.Jackson@eu.citrix.com>
      CC: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
      CC: Richard Henderson <rth@twiddle.net> (maintainer:X86)
      CC: Eduardo Habkost <ehabkost@redhat.com> (maintainer:X86)
      CC: Michael S. Tsirkin <mst@redhat.com> (supporter:PC)
      Acked-by: NAnthony PERARD <anthony.perard@citrix.com>
      4564e63f
  5. 03 3月, 2018 1 次提交
    • M
      qapi: Empty out qapi-schema.json · 112ed241
      Markus Armbruster 提交于
      The previous commit improved compile time by including less of the
      generated QAPI headers.  This is impossible for stuff defined directly
      in qapi-schema.json, because that ends up in headers that that pull in
      everything.
      
      Move everything but include directives from qapi-schema.json to new
      sub-module qapi/misc.json, then include just the "misc" shard where
      possible.
      
      It's possible everywhere, except:
      
      * monitor.c needs qmp-command.h to get qmp_init_marshal()
      
      * monitor.c, ui/vnc.c and the generated qapi-event-FOO.c need
        qapi-event.h to get enum QAPIEvent
      
      Perhaps we'll get rid of those some other day.
      
      Adding a type to qapi/migration.json now recompiles some 120 instead
      of 2300 out of 5100 objects.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180211093607.27351-25-armbru@redhat.com>
      [eblake: rebase to master]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      112ed241
  6. 09 2月, 2018 1 次提交
  7. 27 10月, 2017 1 次提交
  8. 19 7月, 2017 2 次提交
  9. 15 7月, 2017 2 次提交
  10. 20 6月, 2017 1 次提交
  11. 02 6月, 2017 1 次提交
  12. 23 5月, 2017 2 次提交
    • E
      shutdown: Add source information to SHUTDOWN and RESET · cf83f140
      Eric Blake 提交于
      Time to wire up all the call sites that request a shutdown or
      reset to use the enum added in the previous patch.
      
      It would have been less churn to keep the common case with no
      arguments as meaning guest-triggered, and only modified the
      host-triggered code paths, via a wrapper function, but then we'd
      still have to audit that I didn't miss any host-triggered spots;
      changing the signature forces us to double-check that I correctly
      categorized all callers.
      
      Since command line options can change whether a guest reset request
      causes an actual reset vs. a shutdown, it's easy to also add the
      information to reset requests.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: David Gibson <david@gibson.dropbear.id.au> [ppc parts]
      Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> [SPARC part]
      Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x parts]
      Message-Id: <20170515214114.15442-5-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      cf83f140
    • E
      shutdown: Prepare for use of an enum in reset/shutdown_request · aedbe192
      Eric Blake 提交于
      We want to track why a guest was shutdown; in particular, being able
      to tell the difference between a guest request (such as ACPI request)
      and host request (such as SIGINT) will prove useful to libvirt.
      Since all requests eventually end up changing shutdown_requested in
      vl.c, the logical change is to make that value track the reason,
      rather than its current 0/1 contents.
      
      Since command-line options control whether a reset request is turned
      into a shutdown request instead, the same treatment is given to
      reset_requested.
      
      This patch adds an internal enum ShutdownCause that describes reasons
      that a shutdown can be requested, and changes qemu_system_reset() to
      pass the reason through, although for now nothing is actually changed
      with regards to what gets reported.  The enum could be exported via
      QAPI at a later date, if deemed necessary, but for now, there has not
      been a request to expose that much detail to end clients.
      
      For the most part, we turn 0 into SHUTDOWN_CAUSE_NONE, and 1 into
      SHUTDOWN_CAUSE_HOST_ERROR; the only specific case where we have enough
      information right now to use a different value is when we are reacting
      to a host signal.  It will take a further patch to edit all call-sites
      that can trigger a reset or shutdown request to properly pass in any
      other reasons; this patch includes TODOs to point such places out.
      
      qemu_system_reset() trades its 'bool report' parameter for a
      'ShutdownCause reason', with all non-zero values having the same
      effect; this lets us get rid of the weird #defines for VMRESET_*
      as synonyms for bools.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20170515214114.15442-3-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      aedbe192
  13. 26 4月, 2017 1 次提交
  14. 22 4月, 2017 1 次提交
    • P
      xen: use libxendevice model to restrict operations · 1c599472
      Paul Durrant 提交于
      This patch adds a command-line option (-xen-domid-restrict) which will
      use the new libxendevicemodel API to restrict devicemodel [1] operations
      to the specified domid. (Such operations are not applicable to the xenpv
      machine type).
      
      This patch also adds a tracepoint to allow successful enabling of the
      restriction to be monitored.
      
      [1] I.e. operations issued by libxendevicemodel. Operation issued by other
          xen libraries (e.g. libxenforeignmemory) are currently still unrestricted
          but this will be rectified by subsequent patches.
      Signed-off-by: NPaul Durrant <paul.durrant@citrix.com>
      Reviewed-by: NStefano Stabellini <sstabellini@kernel.org>
      1c599472
  15. 23 3月, 2017 3 次提交
  16. 01 2月, 2017 1 次提交
  17. 29 11月, 2016 3 次提交
  18. 23 11月, 2016 1 次提交
  19. 09 11月, 2016 1 次提交
  20. 13 8月, 2016 1 次提交
  21. 03 8月, 2016 1 次提交
  22. 04 7月, 2016 1 次提交
  23. 17 6月, 2016 1 次提交
  24. 07 6月, 2016 1 次提交
  25. 29 5月, 2016 1 次提交
  26. 19 5月, 2016 2 次提交
    • P
      hw: remove pio_addr_t · 89a80e74
      Paolo Bonzini 提交于
      pio_addr_t is almost unused, because these days I/O ports are simply
      accessed through the address space.  cpu_{in,out}[bwl] themselves are
      almost unused; monitor.c and xen-hvm.c could use address_space_read/write
      directly, since they have an integer size at hand.  This leaves qtest as
      the only user of those functions.
      
      On the other hand even portio_* functions use this type; the only
      interesting use of pio_addr_t thus is include/hw/sysbus.h.  I guess I
      could move it there, but I don't see much benefit in that either.  Using
      uint32_t is enough and avoids the need to include ioport.h everywhere.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      89a80e74
    • P
      33c11879
  27. 10 2月, 2016 1 次提交