From a1131aa94256d1007b4267ff9e79c3b4ada6e2b9 Mon Sep 17 00:00:00 2001 From: "Maciej S. Szmigiero" Date: Tue, 4 Mar 2025 23:03:43 +0100 Subject: [PATCH] migration/multifd: Add multifd_device_state_supported() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Since device state transfer via multifd channels requires multifd channels with packets and is currently not compatible with multifd compression add an appropriate query function so device can learn whether it can actually make use of it. Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu Signed-off-by: Maciej S. Szmigiero Link: https://lore.kernel.org/qemu-devel/1ff0d98b85f470e5a33687406e877583b8fab74e.1741124640.git.maciej.szmigiero@oracle.com Signed-off-by: Cédric Le Goater --- include/migration/misc.h | 1 + migration/multifd-device-state.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/migration/misc.h b/include/migration/misc.h index bd3b725fa0..273ebfca62 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -121,5 +121,6 @@ bool migrate_uri_parse(const char *uri, MigrationChannel **channel, /* migration/multifd-device-state.c */ bool multifd_queue_device_state(char *idstr, uint32_t instance_id, char *data, size_t len); +bool multifd_device_state_supported(void); #endif diff --git a/migration/multifd-device-state.c b/migration/multifd-device-state.c index 64d8ca1801..3097ffa310 100644 --- a/migration/multifd-device-state.c +++ b/migration/multifd-device-state.c @@ -13,6 +13,7 @@ #include "qemu/lockable.h" #include "migration/misc.h" #include "multifd.h" +#include "options.h" static struct { QemuMutex queue_job_mutex; @@ -111,3 +112,9 @@ bool multifd_queue_device_state(char *idstr, uint32_t instance_id, return true; } + +bool multifd_device_state_supported(void) +{ + return migrate_multifd() && !migrate_mapped_ram() && + migrate_multifd_compression() == MULTIFD_COMPRESSION_NONE; +} -- 2.30.2