Skip to content
Snippets Groups Projects
  1. Jun 05, 2020
  2. May 19, 2020
  3. May 18, 2020
  4. Mar 06, 2020
    • Kevin Wolf's avatar
      hmp: Fail gracefully if chardev is already in use · 8e9119a8
      Kevin Wolf authored
      
      Trying to attach a HMP monitor to a chardev that is already in use
      results in a crash because monitor_init_hmp() passes &error_abort to
      qemu_chr_fe_init():
      
      $ ./x86_64-softmmu/qemu-system-x86_64 --chardev stdio,id=foo --mon foo --mon foo
      QEMU 4.2.50 monitor - type 'help' for more information
      (qemu) Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:220:
      qemu-system-x86_64: --mon foo: Device 'foo' is in use
      Abgebrochen (Speicherabzug geschrieben)
      
      Fix this by allowing monitor_init_hmp() to return an error and passing
      any error in qemu_chr_fe_init() to its caller instead of aborting.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20200224143008.13362-19-kwolf@redhat.com>
      Acked-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      8e9119a8
    • Kevin Wolf's avatar
      qmp: Fail gracefully if chardev is already in use · f27a9bb3
      Kevin Wolf authored
      
      Trying to attach a QMP monitor to a chardev that is already in use
      results in a crash because monitor_init_qmp() passes &error_abort to
      qemu_chr_fe_init():
      
      $ ./x86_64-softmmu/qemu-system-x86_64 --chardev stdio,id=foo --mon foo,mode=control --mon foo,mode=control
      Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:220:
      qemu-system-x86_64: --mon foo,mode=control: Device 'foo' is in use
      Abgebrochen (Speicherabzug geschrieben)
      
      Fix this by allowing monitor_init_qmp() to return an error and passing
      any error in qemu_chr_fe_init() to its caller instead of aborting.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20200224143008.13362-18-kwolf@redhat.com>
      Acked-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      f27a9bb3
    • Kevin Wolf's avatar
      stubs: Update monitor stubs for qemu-storage-daemon · 6ede81d5
      Kevin Wolf authored
      
      Before we can add the monitor to qemu-storage-daemon, we need to add a
      stubs for monitor_fdsets_cleanup().
      
      We also need to make sure that stubs that are actually implemented in
      the monitor core aren't linked to qemu-storage-daemon so that we don't
      get linker errors because of duplicate symbols. This is achieved by
      moving the stubs in question to a new file stubs/monitor-core.c.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20200224143008.13362-15-kwolf@redhat.com>
      Acked-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      6ede81d5
    • Kevin Wolf's avatar
      stubs: Add arch_type · 5964ed56
      Kevin Wolf authored
      
      blockdev.c uses the arch_type constant, so before we can use the file in
      tools (i.e. outside of the system emulator), we need to add a stub for
      it. A new QEMU_ARCH_NONE is introduced for this case.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20200224143008.13362-3-kwolf@redhat.com>
      Acked-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      5964ed56
  5. Jan 30, 2020
  6. Jan 20, 2020
  7. Jan 09, 2020
  8. Jan 07, 2020
  9. Jan 06, 2020
  10. Dec 17, 2019
  11. Nov 05, 2019
  12. Oct 14, 2019
  13. Aug 16, 2019
    • Markus Armbruster's avatar
      sysemu: Split sysemu/runstate.h off sysemu/sysemu.h · 54d31236
      Markus Armbruster authored
      
      sysemu/sysemu.h is a rather unfocused dumping ground for stuff related
      to the system-emulator.  Evidence:
      
      * It's included widely: in my "build everything" tree, changing
        sysemu/sysemu.h still triggers a recompile of some 1100 out of 6600
        objects (not counting tests and objects that don't depend on
        qemu/osdep.h, down from 5400 due to the previous two commits).
      
      * It pulls in more than a dozen additional headers.
      
      Split stuff related to run state management into its own header
      sysemu/runstate.h.
      
      Touching sysemu/sysemu.h now recompiles some 850 objects.  qemu/uuid.h
      also drops from 1100 to 850, and qapi/qapi-types-run-state.h from 4400
      to 4200.  Touching new sysemu/runstate.h recompiles some 500 objects.
      
      Since I'm touching MAINTAINERS to add sysemu/runstate.h anyway, also
      add qemu/main-loop.h.
      
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190812052359.30071-30-armbru@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      [Unbreak OS-X build]
      54d31236
    • Markus Armbruster's avatar
      Clean up inclusion of sysemu/sysemu.h · d5938f29
      Markus Armbruster authored
      
      In my "build everything" tree, changing sysemu/sysemu.h triggers a
      recompile of some 5400 out of 6600 objects (not counting tests and
      objects that don't depend on qemu/osdep.h).
      
      Almost a third of its inclusions are actually superfluous.  Delete
      them.  Downgrade two more to qapi/qapi-types-run-state.h, and move one
      from char/serial.h to char/serial.c.
      
      hw/semihosting/config.c, monitor/monitor.c, qdev-monitor.c, and
      stubs/semihost.c define variables declared in sysemu/sysemu.h without
      including it.  The compiler is cool with that, but include it anyway.
      
      This doesn't reduce actual use much, as it's still included into
      widely included headers.  The next commit will tackle that.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Message-Id: <20190812052359.30071-27-armbru@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      d5938f29
  14. Jun 18, 2019
  15. Jun 17, 2019
  16. Jun 12, 2019
    • Markus Armbruster's avatar
      Include qemu-common.h exactly where needed · a8d25326
      Markus Armbruster authored
      
      No header includes qemu-common.h after this commit, as prescribed by
      qemu-common.h's file comment.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-5-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c
      block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c
      target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h
      target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h
      target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h
      target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and
      net/tap-bsd.c fixed up]
      a8d25326
  17. May 28, 2019
  18. May 24, 2019
  19. May 23, 2019
  20. Apr 18, 2019
    • Markus Armbruster's avatar
      qemu-print: New qemu_printf(), qemu_vprintf() etc. · 637de4db
      Markus Armbruster authored
      
      We commonly want to print to the current monitor if we have one, else
      to stdout/stderr.  For stderr, have error_printf().  For stdout, all
      we have is monitor_vfprintf(), which is rather unwieldy.  We often
      print to stderr just because error_printf() is easier.
      
      New qemu_printf() and qemu_vprintf() do exactly what's needed.  The
      next commits will put them to use.
      
      Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20190417190641.26814-12-armbru@redhat.com>
      637de4db
    • Markus Armbruster's avatar
      monitor error: Make printf()-like functions return a value · 679cb8e1
      Markus Armbruster authored
      
      printf() & friends return the number of characters written on success,
      negative value on error.
      
      monitor_printf(), monitor_vfprintf(), monitor_vprintf(),
      error_printf(), error_printf_unless_qmp(), error_vprintf(), and
      error_vprintf_unless_qmp() return void.  Some of them carry a TODO
      comment asking for int instead.
      
      Improve them to return int like printf() does.
      
      This makes our use of monitor_printf() as fprintf_function slightly
      less dirty: the function cast no longer adds a return value that isn't
      there.  It still changes a parameter's pointer type.  That will be
      addressed in a future commit.
      
      monitor_vfprintf() always returns zero.  Improve it to return the
      proper value.
      
      Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20190417190641.26814-11-armbru@redhat.com>
      679cb8e1
  21. Mar 06, 2019
    • Yury Kotov's avatar
      exec: Change RAMBlockIterFunc definition · 754cb9c0
      Yury Kotov authored
      
      Currently, qemu_ram_foreach_* calls RAMBlockIterFunc with many
      block-specific arguments. But often iter func needs RAMBlock*.
      This refactoring is needed for fast access to RAMBlock flags from
      qemu_ram_foreach_block's callback. The only way to achieve this now
      is to call qemu_ram_block_from_host (which also enumerates blocks).
      
      So, this patch reduces complexity of
      qemu_ram_foreach_block() -> cb() -> qemu_ram_block_from_host()
      from O(n^2) to O(n).
      
      Fix RAMBlockIterFunc definition and add some functions to read
      RAMBlock* fields witch were passed.
      
      Signed-off-by: default avatarYury Kotov <yury-kotov@yandex-team.ru>
      Message-Id: <20190215174548.2630-2-yury-kotov@yandex-team.ru>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      754cb9c0
  22. Feb 18, 2019
  23. Feb 07, 2019
  24. Jan 24, 2019
    • Markus Armbruster's avatar
      qapi: Eliminate indirection through qmp_event_get_func_emit() · a9529100
      Markus Armbruster authored
      
      The qapi_event_send_FOO() functions emit events like this:
      
          QMPEventFuncEmit emit;
      
          emit = qmp_event_get_func_emit();
          if (!emit) {
              return;
          }
      
          qmp = qmp_event_build_dict("FOO");
          [put event arguments into @qmp...]
      
          emit(QAPI_EVENT_FOO, qmp);
      
      The value of qmp_event_get_func_emit() depends only on the program:
      
      * In qemu-system-FOO, it's always monitor_qapi_event_queue.
      
      * In tests/test-qmp-event, it's always event_test_emit.
      
      * In all other programs, it's always null.
      
      This is exactly the kind of dependence the linker is supposed to
      resolve; we don't actually need an indirection.
      
      Note that things would fall apart if we linked more than one QAPI
      schema into a single program: each set of qapi_event_send_FOO() uses
      its own event enumeration, yet they share a single emit function.
      Which takes the event enumeration as an argument.  Which one if
      there's more than one?
      
      More seriously: how does this work even now?  qemu-system-FOO wants
      QAPIEvent, and passes a function taking that to
      qmp_event_set_func_emit().  test-qmp-event wants test_QAPIEvent, and
      passes a function taking that to qmp_event_set_func_emit().
      
      It works by type trickery, of course:
      
          typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict);
      
          void qmp_event_set_func_emit(QMPEventFuncEmit emit);
      
          QMPEventFuncEmit qmp_event_get_func_emit(void);
      
      We use unsigned instead of the enumeration type.  Relies on both
      enumerations boiling down to unsigned, which happens to be true for
      the compilers we use.
      
      Clean this up as follows:
      
      * Generate qapi_event_send_FOO() that call PREFIX_qapi_event_emit()
        instead of the value of qmp_event_set_func_emit().
      
      * Generate a prototype for PREFIX_qapi_event_emit() into
        qapi-events.h.
      
      * PREFIX_ is empty for qapi/qapi-schema.json, and test_ for
        tests/qapi-schema/qapi-schema-test.json.  It's qga_ for
        qga/qapi-schema.json, and doc-good- for
        tests/qapi-schema/doc-good.json, but those don't define any events.
      
      * Rename monitor_qapi_event_queue() to qapi_event_emit() instead of
        passing it to qmp_event_set_func_emit().  This takes care of
        qemu-system-FOO.
      
      * Rename event_test_emit() to test_qapi_event_emit() instead of
        passing it to qmp_event_set_func_emit().  This takes care of
        tests/test-qmp-event.
      
      * Add a qapi_event_emit() that does nothing to stubs/monitor.c.  This
        takes care of all other programs that link code emitting QMP events.
      
      * Drop qmp_event_set_func_emit(), qmp_event_get_func_emit().
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20181218182234.28876-3-armbru@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      [Commit message typos fixed]
      a9529100
  25. Jan 18, 2019
  26. Jan 13, 2019
  27. Oct 19, 2018
  28. Oct 15, 2018
Loading