Skip to content
Snippets Groups Projects
  1. Nov 01, 2023
    • Steve Sistare's avatar
      migration: per-mode blockers · fa3673e4
      Steve Sistare authored
      
      Extend the blocker interface so that a blocker can be registered for
      one or more migration modes.  The existing interfaces register a
      blocker for all modes, and the new interfaces take a varargs list
      of modes.
      
      Internally, maintain a separate blocker list per mode.  The same Error
      object may be added to multiple lists.  When a block is deleted, it is
      removed from every list, and the Error is freed.
      
      No functional change until a new mode is added.
      
      Signed-off-by: default avatarSteve Sistare <steven.sistare@oracle.com>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
      Message-ID: <1698263069-406971-3-git-send-email-steven.sistare@oracle.com>
      fa3673e4
  2. Oct 20, 2023
  3. Oct 18, 2023
  4. Oct 12, 2023
    • David Hildenbrand's avatar
      memory-device,vhost: Support automatic decision on the number of memslots · a2335113
      David Hildenbrand authored
      
      We want to support memory devices that can automatically decide how many
      memslots they will use. In the worst case, they have to use a single
      memslot.
      
      The target use cases are virtio-mem and the hyper-v balloon.
      
      Let's calculate a reasonable limit such a memory device may use, and
      instruct the device to make a decision based on that limit. Use a simple
      heuristic that considers:
      * A memslot soft-limit for all memory devices of 256; also, to not
        consume too many memslots -- which could harm performance.
      * Actually still free and unreserved memslots
      * The percentage of the remaining device memory region that memory device
        will occupy.
      
      Further, while we properly check before plugging a memory device whether
      there still is are free memslots, we have other memslot consumers (such as
      boot memory, PCI BARs) that don't perform any checks and might dynamically
      consume memslots without any prior reservation. So we might succeed in
      plugging a memory device, but once we dynamically map a PCI BAR we would
      be in trouble. Doing accounting / reservation / checks for all such
      users is problematic (e.g., sometimes we might temporarily split boot
      memory into two memslots, triggered by the BIOS).
      
      We use the historic magic memslot number of 509 as orientation to when
      supporting 256 memory devices -> memslots (leaving 253 for boot memory and
      other devices) has been proven to work reliable. We'll fallback to
      suggesting a single memslot if we don't have at least 509 total memslots.
      
      Plugging vhost devices with less than 509 memslots available while we
      have memory devices plugged that consume multiple memslots due to
      automatic decisions can be problematic. Most configurations might just fail
      due to "limit < used + reserved", however, it can also happen that these
      memory devices would suddenly consume memslots that would actually be
      required by other memslot consumers (boot, PCI BARs) later. Note that this
      has always been sketchy with vhost devices that support only a small number
      of memslots; but we don't want to make it any worse.So let's keep it simple
      and simply reject plugging such vhost devices in such a configuration.
      
      Eventually, all vhost devices that want to be fully compatible with such
      memory devices should support a decent number of memslots (>= 509).
      
      Message-ID: <20230926185738.277351-13-david@redhat.com>
      Reviewed-by: default avatarMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      a2335113
    • David Hildenbrand's avatar
      memory-device,vhost: Support memory devices that dynamically consume memslots · 766aa0a6
      David Hildenbrand authored
      
      We want to support memory devices that have a dynamically managed memory
      region container as device memory region. This device memory region maps
      multiple RAM memory subregions (e.g., aliases to the same RAM memory
      region), whereby these subregions can be (un)mapped on demand.
      
      Each RAM subregion will consume a memslot in KVM and vhost, resulting in
      such a new device consuming memslots dynamically, and initially usually
      0. We already track the number of used vs. required memslots for all
      memslots. From that, we can derive the number of reserved memslots that
      must not be used otherwise.
      
      The target use case is virtio-mem and the hyper-v balloon, which will
      dynamically map aliases to RAM memory region into their device memory
      region container.
      
      Properly document what's supported and what's not and extend the vhost
      memslot check accordingly.
      
      Message-ID: <20230926185738.277351-10-david@redhat.com>
      Reviewed-by: default avatarMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      766aa0a6
    • David Hildenbrand's avatar
      stubs: Rename qmp_memory_device.c to memory_device.c · 759bac67
      David Hildenbrand authored
      
      We want to place non-qmp stubs in there, so let's rename it. While at
      it, put it into the MAINTAINERS file under "Memory devices".
      
      Message-ID: <20230926185738.277351-8-david@redhat.com>
      Reviewed-by: default avatarMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      759bac67
  5. Oct 11, 2023
  6. Oct 07, 2023
  7. Oct 06, 2023
  8. Aug 07, 2023
  9. Jul 12, 2023
  10. Jun 07, 2023
  11. Jun 01, 2023
  12. May 18, 2023
  13. May 10, 2023
  14. Mar 07, 2023
  15. Feb 27, 2023
    • Philippe Mathieu-Daudé's avatar
      replay: Extract core API to 'exec/replay-core.h' · 5b5968c4
      Philippe Mathieu-Daudé authored
      
      replay API is used deeply within TCG common code (common to user
      and system emulation). Unfortunately "sysemu/replay.h" requires
      some QAPI headers for few system-specific declarations, example:
      
        void replay_input_event(QemuConsole *src, InputEvent *evt);
      
      Since commit c2651c0e ("qapi/meson: Restrict UI module to system
      emulation and tools") the QAPI header defining the InputEvent is
      not generated anymore.
      To keep it simple, extract the 'core' replay prototypes to a new
      "exec/replay-core.h" header which we include in the TCG code that
      doesn't need the rest of the replay API.
      
      Reviewed-by: default avatarPavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
      Message-Id: <20221219170806.60580-5-philmd@linaro.org>
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      5b5968c4
  16. Feb 23, 2023
    • Markus Armbruster's avatar
      hw/acpi: Move QMP command to hw/core/ · 36ebc7db
      Markus Armbruster authored
      
      The QERR_ macros are leftovers from the days of "rich" error objects.
      We've been trying to reduce their remaining use.
      
      qmp_query_vm_generation_id() in stubs/vmgenid.c is the last user of
      QERR_UNSUPPORTED outside qga/.  Unlike the stubs we just dropped, it
      is actually reachable, namely when CONFIG_ACPI_VMGENID is off.  It
      always fails like
      
          (qemu) info vm-generation-id
          Error: this feature or command is not currently supported
      
      Turns out the real qmp_query_vm_generation_id() doesn't actually
      depend on CONFIG_ACPI_VMGENID, and fails safely when it's off.  Move
      it to hw/core/machine-qmp-cmds.c, and drop the stub.  The error
      message becomes
      
          Error: VM Generation ID device not found
      
      Feels like an improvement to me.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20230207075115.1525-8-armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      36ebc7db
  17. Dec 15, 2022
  18. Dec 14, 2022
    • Markus Armbruster's avatar
      qapi qdev qom: Elide redundant has_FOO in generated C · 047f2ca1
      Markus Armbruster authored
      
      The has_FOO for pointer-valued FOO are redundant, except for arrays.
      They are also a nuisance to work with.  Recent commit "qapi: Start to
      elide redundant has_FOO in generated C" provided the means to elide
      them step by step.  This is the step for qapi/qdev.json and
      qapi/qom.json.
      
      Said commit explains the transformation in more detail.  The invariant
      violations mentioned there do not occur here.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Daniel P. Berrangé <berrange@redhat.com>
      Cc: Eduardo Habkost <eduardo@habkost.net>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20221104160712.3005652-21-armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      047f2ca1
  19. Nov 11, 2022
    • Thomas Huth's avatar
      qga: Allow building of the guest agent without system emulators or tools · e0091133
      Thomas Huth authored
      
      If configuring with "--disable-system --disable-user --enable-guest-agent"
      the linking currently fails with:
      
      qga/qemu-ga.p/commands.c.o: In function `qmp_command_info':
      build/../../home/thuth/devel/qemu/qga/commands.c:70: undefined reference to `qmp_command_name'
      build/../../home/thuth/devel/qemu/qga/commands.c:71: undefined reference to `qmp_command_is_enabled'
      build/../../home/thuth/devel/qemu/qga/commands.c:72: undefined reference to `qmp_has_success_response'
      qga/qemu-ga.p/commands.c.o: In function `qmp_guest_info':
      build/../../home/thuth/devel/qemu/qga/commands.c:82: undefined reference to `qmp_for_each_command'
      qga/qemu-ga.p/commands.c.o: In function `qmp_guest_exec':
      build/../../home/thuth/devel/qemu/qga/commands.c:410: undefined reference to `qbase64_decode'
      qga/qemu-ga.p/channel-posix.c.o: In function `ga_channel_open':
      build/../../home/thuth/devel/qemu/qga/channel-posix.c:214: undefined reference to `unix_listen'
      build/../../home/thuth/devel/qemu/qga/channel-posix.c:228: undefined reference to `socket_parse'
      build/../../home/thuth/devel/qemu/qga/channel-posix.c:234: undefined reference to `socket_listen'
      qga/qemu-ga.p/commands-posix.c.o: In function `qmp_guest_file_write':
      build/../../home/thuth/devel/qemu/qga/commands-posix.c:527: undefined reference to `qbase64_decode'
      
      Let's make sure that we also compile and link the required files if
      the system emulators have not been enabled.
      
      Message-Id: <20221110083626.31899-1-thuth@redhat.com>
      Tested-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      e0091133
  20. Oct 26, 2022
    • Stefan Hajnoczi's avatar
      stubs: add qemu_ram_block_from_host() and qemu_ram_get_fd() · 701bff24
      Stefan Hajnoczi authored
      
      The blkio block driver will need to look up the file descriptor for a
      given pointer. This is possible in softmmu builds where the RAMBlock API
      is available for querying guest RAM.
      
      Add stubs so tools like qemu-img that link the block layer still build
      successfully. In this case there is no guest RAM but that is fine.
      Bounce buffers and their file descriptors will be allocated with
      libblkio's blkio_alloc_mem_region() so we won't rely on QEMU's
      qemu_ram_get_fd() in that case.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 20221013185908.1297568-12-stefanha@redhat.com
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      701bff24
  21. Sep 29, 2022
  22. Sep 13, 2022
    • Peter Maydell's avatar
      semihosting: Allow optional use of semihosting from userspace · 5202861b
      Peter Maydell authored
      
      Currently our semihosting implementations generally prohibit use of
      semihosting calls in system emulation from the guest userspace.  This
      is a very long standing behaviour justified originally "to provide
      some semblance of security" (since code with access to the
      semihosting ABI can do things like read and write arbitrary files on
      the host system).  However, it is sometimes useful to be able to run
      trusted guest code which performs semihosting calls from guest
      userspace, notably for test code.  Add a command line suboption to
      the existing semihosting-config option group so that you can
      explicitly opt in to semihosting from guest userspace with
       -semihosting-config userspace=on
      
      (There is no equivalent option for the user-mode emulator, because
      there by definition all code runs in userspace and has access to
      semihosting already.)
      
      This commit adds the infrastructure for the command line option and
      adds a bool 'is_user' parameter to the function
      semihosting_userspace_enabled() that target code can use to check
      whether it should be permitting the semihosting call for userspace.
      It mechanically makes all the callsites pass 'false', so they
      continue checking "is semihosting enabled in general".  Subsequent
      commits will make each target that implements semihosting honour the
      userspace=on option by passing the correct value and removing
      whatever "don't do this for userspace" checking they were doing by
      hand.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Acked-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-Id: <20220822141230.3658237-2-peter.maydell@linaro.org>
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      5202861b
  23. Jul 28, 2022
  24. Jun 28, 2022
  25. Jun 27, 2022
  26. Jun 15, 2022
  27. Jun 06, 2022
  28. Apr 21, 2022
  29. Apr 06, 2022
  30. Mar 04, 2022
    • Emanuele Giuseppe Esposito's avatar
      main-loop.h: introduce qemu_in_main_thread() · 6538692e
      Emanuele Giuseppe Esposito authored
      
      When invoked from the main loop, this function is the same
      as qemu_mutex_iothread_locked, and returns true if the BQL is held.
      When invoked from iothreads or tests, it returns true only
      if the current AioContext is the Main Loop.
      
      This essentially just extends qemu_mutex_iothread_locked to work
      also in unit tests or other users like storage-daemon, that run
      in the Main Loop but end up using the implementation in
      stubs/iothread-lock.c.
      
      Using qemu_mutex_iothread_locked in unit tests defaults to false
      because they use the implementation in stubs/iothread-lock,
      making all assertions added in next patches fail despite the
      AioContext is still the main loop.
      
      See the comment in the function header for more information.
      
      Signed-off-by: default avatarEmanuele Giuseppe Esposito <eesposit@redhat.com>
      Message-Id: <20220303151616.325444-2-eesposit@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      6538692e
  31. Jan 18, 2022
  32. Nov 04, 2021
  33. Nov 02, 2021
Loading