Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F94510F995C for ; Wed, 8 Apr 2026 17:24:00 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1276423.1561887 (Exim 4.92) (envelope-from ) id 1wAWcy-0005D6-W2; Wed, 08 Apr 2026 17:23:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1276423.1561887; Wed, 08 Apr 2026 17:23:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wAWcy-0005Cz-St; Wed, 08 Apr 2026 17:23:44 +0000 Received: by outflank-mailman (input) for mailman id 1276423; Wed, 08 Apr 2026 17:23:44 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wAWcx-0005Ct-WA for xen-devel@lists.xenproject.org; Wed, 08 Apr 2026 17:23:44 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wAWcx-005z4v-Ao for xen-devel@lists.xenproject.org; Wed, 08 Apr 2026 19:23:43 +0200 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69d68f00-e002-0a2a0a5209dd-0a2a4509a776-32 for ; Wed, 08 Apr 2026 19:23:43 +0200 Received: from [198.2.180.46] (helo=mail180-46.suw31.mandrillapp.com) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.0) (envelope-from ) id 69d68f1c-bf79-0a2a45090019-c602b42ee0c0-3 for ; Wed, 08 Apr 2026 19:23:41 +0200 Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail180-46.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4frVK80ckpz8XS3Fl for ; Wed, 8 Apr 2026 17:23:40 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id c66f53c3790a424abefe018ecad7fdfe; Wed, 08 Apr 2026 17:23:40 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=mte1 header.d=mandrillapp.com header.i="@mandrillapp.com" header.h="From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:Content-Type:Content-Transfer-Encoding"; dkim=pass header.s=mte1 header.d=vates.tech header.i="thierry.escande@vates.tech" header.h="From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version:Content-Type:Content-Transfer-Encoding" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1775669020; x=1775939020; bh=xxNIkKDN7lXNq1YcBt2lBjJMfrZZXPZ7kai8JheAc4c=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=qiMdTQWE1bdnulNELNeIvu60g+5c5C6AgFZqutAvC6wZvfwhfR77YwHqQlAn11SwO 1OgkSIZomjfhOHNtNLk1WRAc8u0TBhNE7Mq02a2Jnll4ImFPI1SAA4+bIA3dbwZZYw fI3FVEc81NkRsjPyuN1/ieY12O/QxVWqVUmQyXhiobXZY5HbK0if6F1i1/QglSOLQy KS3Z4rlc15OTrqWnsL+Q9N+fO4zGcHAxV6gp/HcAnHELIrvcGMH4eMNGJz94hR3zqg 92F+uotoUBU0CSOiSgoF1/+PHJgu0r5jTKIXyj8OfWHGc2ByXIHvDIllNWwNb8q0qJ xC/1GKK6cVcBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1775669020; x=1775929520; i=thierry.escande@vates.tech; bh=xxNIkKDN7lXNq1YcBt2lBjJMfrZZXPZ7kai8JheAc4c=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=cRDh1wQGpCSsGYEveRboT3EZRfkLWw28GtuggH8cRt18dHs1zXRNAvDm9xftmdlXB 30yxtc9b5N1EOfTscxGui7UR8G+/VhfQYzI9mVmVpXYJYlzOIo/Rnd41mbDKK0REuo oPtQdFxzq+7NEkiZ1dCWNpWjr4VE1g888HpQkMRPP+45NZtH0hF05nL0S2G71728Hg GxJHz9idyd+EPgqvW5QdzEztsduUG/uTTj0vtLULmTxJHifINmuv1jKQeUHcwmBzzO fEk+ElhPnC3ICzJlJngzYzrJeCZU56YTubFX1Oz4t2Opr3LkeEJrXsyh3d75J2PRzn y6bZ4Cih1mPEg== From: "Thierry Escande" Subject: =?utf-8?Q?[RFC=20PATCH=200/3]=20xl:=20Allow=20PCI=20devices=20to=20be=20passthrough'd=20via=20Qemu=20command=20line?= X-Mailer: git-send-email 2.53.0 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1775669019256 To: xen-devel@lists.xenproject.org Cc: "Thierry Escande" , "Anthony PERARD" , "Juergen Gross" , "=?utf-8?Q?Daniel=20P=20.=20Berrang=C3=A9?=" , "=?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?=" Message-Id: <20260408172320.539750-1-thierry.escande@vates.tech> X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.c66f53c3790a424abefe018ecad7fdfe?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20260408:md Date: Wed, 08 Apr 2026 17:23:40 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-purgate-ID: tlsNG-bad1c0/1775669021-54D5F152-527CBC20/0/0 X-purgate-type: clean X-purgate-size: 2481 This series adds support for a new 'hotplug' option for PCI devices to be passthrough'd to guests. The current mechanism for device passthrough uses QMP device_add command to hot-plug PCI devices to the guest Qemu instance. This is an issue for guests running on Q35 chipset (preliminary support posted at [1]) since the Q35 PCI root bus does not support hotplug. Devices could be hotplugged to a secondary PCI bus but Xen only support 1 PCI bus for now. The 'hotplug' option allows to control how devices are attached to the guest, either by using the legacy QMP mechanism (this is the default) or by passing it directly to the Qemu command line using xen-pci-passthrough device. Example usage in cfg file: pci = [ "00:03.0,seize=1,hotplug=0" ] Since Qemu -device option accepts parameters in json format, this patchset adds a new internal function libxl__device_pci_get_qmp_json() that generates the device json object used for both QMP hotplug and command line passing. Also, the function libxl_pci_assignable() is made available from libxl.h for access in libxl_dm.c. I don't know if it's ok to make it public or if it should stay private. Maybe it should be renamed as libxl_device_pci_assignable() to match the other PCI device APIs. This has been successfully tested on Xen 4.22-dev and Qemu 10.0 running Debian VMs in both Bios and UEFI mode with a passthrough'd nvme disk. Disabling the hotplug mechanism might be made mandatory for Q35 machines later, once Q35 support is merged upstream. [1] https://lore.kernel.org/xen-devel/20260313163455.790692-1-thierry.escande@vates.tech/ Thierry Escande (3): xl: Add pci device hotplug option libxl: Allow PCI device passthrough using -device Qemu command line docs: provide description for pci hotplug option docs/man/xl-pci-configuration.5.pod | 17 ++++++++++++ docs/man/xl.cfg.5.pod.in | 6 +++++ tools/include/libxl.h | 1 + tools/libs/light/libxl_dm.c | 31 ++++++++++++++++++++++ tools/libs/light/libxl_internal.h | 2 ++ tools/libs/light/libxl_pci.c | 41 ++++++++++++++++++++++------- tools/libs/light/libxl_types.idl | 1 + tools/libs/util/libxlu_pci.c | 2 ++ tools/xl/xl_parse.c | 5 ++++ 9 files changed, 96 insertions(+), 10 deletions(-) -- 2.53.0 -- Thierry Escande | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech