All of lore.kernel.org
 help / color / mirror / Atom feed
* [XEN PATCH] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
@ 2025-12-15 13:51 Anthony PERARD
  2025-12-15 14:01 ` Juergen Gross
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Anthony PERARD @ 2025-12-15 13:51 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross

From: Anthony PERARD <anthony.perard@vates.tech>

QEMU used to ignore JSON types and do conversion string <-> integer
automatically for the command "device_add", but that was removed in
QEMU 9.2 (428d1789df91 ("docs/about: Belatedly document tightening of
QMP device_add checking")).

Fixes: 9718ab394d5d ("libxl_usb: Make libxl__device_usbctrl_add uses ev_qmp")
Fixes: 40c7eca10a82 ("libxl_usb: Make libxl__device_usbdev_add uses ev_qmp")
Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
---

Notes:
    I've check other `device_add` call site which are for PCI devices and
    CPUs, and they both are already correct.

 tools/libs/light/libxl_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libs/light/libxl_usb.c b/tools/libs/light/libxl_usb.c
index c5ae59681c..4e7c409fe6 100644
--- a/tools/libs/light/libxl_usb.c
+++ b/tools/libs/light/libxl_usb.c
@@ -367,10 +367,10 @@ static int libxl__device_usbctrl_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
     case 3:
         libxl__qmp_param_add_string(gc, &qmp_args,
                                     "driver", "nec-usb-xhci");
-        libxl__qmp_param_add_string(gc, &qmp_args, "p2",
-                                    GCSPRINTF("%d", usbctrl->ports));
-        libxl__qmp_param_add_string(gc, &qmp_args, "p3",
-                                    GCSPRINTF("%d", usbctrl->ports));
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p2",
+                                     usbctrl->ports);
+        libxl__qmp_param_add_integer(gc, &qmp_args, "p3",
+                                     usbctrl->ports);
         break;
     default:
         abort(); /* Should not be possible. */
@@ -411,10 +411,10 @@ static int libxl__device_usbdev_add_hvm(libxl__egc *egc, libxl__ev_qmp *qmp,
         GCSPRINTF("xenusb-%d.0", usbdev->ctrl));
     libxl__qmp_param_add_string(gc, &qmp_args, "port",
         GCSPRINTF("%d", usbdev->port));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostbus",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostbus));
-    libxl__qmp_param_add_string(gc, &qmp_args, "hostaddr",
-        GCSPRINTF("%d", usbdev->u.hostdev.hostaddr));
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostbus",
+                                 usbdev->u.hostdev.hostbus);
+    libxl__qmp_param_add_integer(gc, &qmp_args, "hostaddr",
+                                 usbdev->u.hostdev.hostaddr);
 
     return libxl__ev_qmp_send(egc, qmp, "device_add", qmp_args);
 }
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-03-09 16:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-15 13:51 [XEN PATCH] libxl: Fix device_add QMP calls with QEMU 9.2 and newer Anthony PERARD
2025-12-15 14:01 ` Juergen Gross
2025-12-15 14:11 ` Jan Beulich
2025-12-15 14:41   ` Anthony PERARD
2026-02-19 13:29     ` Maximilian Engelhardt
2026-03-09 14:48       ` Anthony PERARD
2026-03-09 16:20         ` Maximilian Engelhardt
2025-12-15 16:47 ` Maximilian Engelhardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.