This capability tells whether qemu is capable of waking up the guest from PM suspend. Based-on-work-of: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 24 +++++++++++++++++++ src/qemu/qemu_capabilities.h | 3 +++ .../caps_4.0.0.riscv32.replies | 11 +++++++++ .../caps_4.0.0.riscv32.xml | 1 + .../caps_4.0.0.riscv64.replies | 11 +++++++++ .../caps_4.0.0.riscv64.xml | 1 + .../caps_4.0.0.x86_64.replies | 11 +++++++++ .../caps_4.0.0.x86_64.xml | 1 + 8 files changed, 63 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5b3a2d0c33..389986d924 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -525,6 +525,9 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "scsi-disk.device_id", "virtio-pci-non-transitional", "query-current-machine", + + /* 330 */ + "wakeup-suspend-support", ); @@ -2769,6 +2772,25 @@ virQEMUCapsProbeQMPSEVCapabilities(virQEMUCapsPtr qemuCaps, } +static int +virQEMUCapsProbeQMPCurrentMachine(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) +{ + qemuMonitorCurrentMachineInfo info = { 0 }; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE)) + return 0; + + if (qemuMonitorGetCurrentMachineInfo(mon, &info) < 0) + return -1; + + if (info.wakeupSuspendSupport) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_PM_WAKEUP_SUPPORT); + + return 0; +} + + bool virQEMUCapsCPUFilterFeatures(const char *name, void *opaque) @@ -4373,6 +4395,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, return -1; if (virQEMUCapsProbeQMPSEVCapabilities(qemuCaps, mon) < 0) return -1; + if (virQEMUCapsProbeQMPCurrentMachine(qemuCaps, mon) < 0) + return -1; virQEMUCapsInitProcessCaps(qemuCaps); diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index d3f90e82a8..721092b91b 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -509,6 +509,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL, /* virtio *-pci-{non-}transitional devices */ QEMU_CAPS_QUERY_CURRENT_MACHINE, /* query-current-machine command */ + /* 330 */ + QEMU_CAPS_PM_WAKEUP_SUPPORT, /* domain has wake-up from suspend support */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies index c7dac44289..a4d5786301 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies @@ -17756,3 +17756,14 @@ ], "id": "libvirt-39" } + +{ + "execute": "query-current-machine", + "id": "libvirt-40" +} + +{ + "return": { + "wakeup-suspend-support": true + } +} diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml index 9d20be128a..c82b0d5e74 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml @@ -164,6 +164,7 @@ <flag name='scsi-disk.device_id'/> <flag name='virtio-pci-non-transitional'/> <flag name='query-current-machine'/> + <flag name='wakeup-suspend-support'/> <version>3001091</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies index 6fda8ad2d2..f2d209cd91 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies @@ -17756,3 +17756,14 @@ ], "id": "libvirt-39" } + +{ + "execute": "query-current-machine", + "id": "libvirt-40" +} + +{ + "return": { + "wakeup-suspend-support": true + } +} diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml index a1a59e14cb..bf7f95e3b1 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml @@ -164,6 +164,7 @@ <flag name='scsi-disk.device_id'/> <flag name='virtio-pci-non-transitional'/> <flag name='query-current-machine'/> + <flag name='wakeup-suspend-support'/> <version>3001091</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies index aa9ee38c80..47ed75d359 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies @@ -21052,6 +21052,17 @@ } } +{ + "execute": "query-current-machine", + "id": "libvirt-50" +} + +{ + "return": { + "wakeup-suspend-support": true + } +} + { "execute": "qmp_capabilities", "id": "libvirt-1" diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml index 899c0cf7c8..df1b0da731 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -202,6 +202,7 @@ <flag name='scsi-disk.device_id'/> <flag name='virtio-pci-non-transitional'/> <flag name='query-current-machine'/> + <flag name='wakeup-suspend-support'/> <version>3001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100758</microcodeVersion> -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list