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

* Re: [XEN PATCH] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
  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 16:47 ` Maximilian Engelhardt
  2 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2025-12-15 14:01 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel; +Cc: Anthony PERARD


[-- Attachment #1.1.1: Type: text/plain, Size: 631 bytes --]

On 15.12.25 14:51, Anthony PERARD wrote:
> 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>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

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

* Re: [XEN PATCH] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
  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
  2025-12-15 16:47 ` Maximilian Engelhardt
  2 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2025-12-15 14:11 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: Anthony PERARD, Juergen Gross, xen-devel

On 15.12.2025 14:51, Anthony PERARD wrote:
> 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")).

And older qemu accepts integers as well?

Jan


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

* Re: [XEN PATCH] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
  2025-12-15 14:11 ` Jan Beulich
@ 2025-12-15 14:41   ` Anthony PERARD
  2026-02-19 13:29     ` Maximilian Engelhardt
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony PERARD @ 2025-12-15 14:41 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Anthony PERARD, Juergen Gross, xen-devel

On Mon, Dec 15, 2025 at 03:11:53PM +0100, Jan Beulich wrote:
> On 15.12.2025 14:51, Anthony PERARD wrote:
> > 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")).
> 
> And older qemu accepts integers as well?

As the QEMU document explains about the removed feature is that they
should. We already have two users of `device_add` which use integers for
some arguments. And just to be sure, I've just tested with QEMU 8.0, the
patch works fine.

Cheers,

-- 
Anthony PERARD


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

* Re: [XEN PATCH] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
  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 16:47 ` Maximilian Engelhardt
  2 siblings, 0 replies; 8+ messages in thread
From: Maximilian Engelhardt @ 2025-12-15 16:47 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross, Anthony PERARD

On Monday, 15 December 2025 14:51:24 CET Anthony PERARD wrote:
> 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>

I can confirm with this patch usb passthrough works on the debian xen 4.20 
package.

Tested-by: Maximilian Engelhardt <maxi@daemonizer.de>




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

* Re: [XEN PATCH] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
  2025-12-15 14:41   ` Anthony PERARD
@ 2026-02-19 13:29     ` Maximilian Engelhardt
  2026-03-09 14:48       ` Anthony PERARD
  0 siblings, 1 reply; 8+ messages in thread
From: Maximilian Engelhardt @ 2026-02-19 13:29 UTC (permalink / raw)
  To: xen-devel, Anthony PERARD; +Cc: Jan Beulich, Anthony PERARD, Juergen Gross

On Monday, 15 December 2025 15:41:02 CET Anthony PERARD wrote:
> On Mon, Dec 15, 2025 at 03:11:53PM +0100, Jan Beulich wrote:
> > On 15.12.2025 14:51, Anthony PERARD wrote:
> > > 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")).
> > 
> > And older qemu accepts integers as well?
> 
> As the QEMU document explains about the removed feature is that they
> should. We already have two users of `device_add` which use integers for
> some arguments. And just to be sure, I've just tested with QEMU 8.0, the
> patch works fine.
> 
> Cheers,

Can this patch be picked for the stable branches? I'm in particular interested 
in 4.20 which is in Debian stable.

Thanks,
Maxi




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

* Re: [XEN PATCH] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
  2026-02-19 13:29     ` Maximilian Engelhardt
@ 2026-03-09 14:48       ` Anthony PERARD
  2026-03-09 16:20         ` Maximilian Engelhardt
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony PERARD @ 2026-03-09 14:48 UTC (permalink / raw)
  To: Maximilian Engelhardt; +Cc: xen-devel, Jan Beulich, Juergen Gross

On Thu, Feb 19, 2026 at 02:29:07PM +0100, Maximilian Engelhardt wrote:
> On Monday, 15 December 2025 15:41:02 CET Anthony PERARD wrote:
> > On Mon, Dec 15, 2025 at 03:11:53PM +0100, Jan Beulich wrote:
> > > On 15.12.2025 14:51, Anthony PERARD wrote:
> > > > 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")).
> > > 
> > > And older qemu accepts integers as well?
> > 
> > As the QEMU document explains about the removed feature is that they
> > should. We already have two users of `device_add` which use integers for
> > some arguments. And just to be sure, I've just tested with QEMU 8.0, the
> > patch works fine.
> > 
> > Cheers,
> 
> Can this patch be picked for the stable branches? I'm in particular interested 
> in 4.20 which is in Debian stable.

Done, thanks.


--
Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



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

* Re: [XEN PATCH] libxl: Fix device_add QMP calls with QEMU 9.2 and newer
  2026-03-09 14:48       ` Anthony PERARD
@ 2026-03-09 16:20         ` Maximilian Engelhardt
  0 siblings, 0 replies; 8+ messages in thread
From: Maximilian Engelhardt @ 2026-03-09 16:20 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: xen-devel, Jan Beulich, Juergen Gross

On Monday, 9 March 2026 15:48:55 CET Anthony PERARD wrote:
> On Thu, Feb 19, 2026 at 02:29:07PM +0100, Maximilian Engelhardt wrote:
[...]
> > Can this patch be picked for the stable branches? I'm in particular
> > interested in 4.20 which is in Debian stable.
> 
> Done, thanks.

Thanks also.

We meanwhile got two reports in Debian from people running into that issue 
(plus me), so it's good to see it fixed.

We will pull the fix with the next xen update in Debian (but not yet the 
upcoming 13.4 point release), which we always base on the upstream stable 
branch.

Maxi




^ permalink raw reply	[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.