[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v3 1/3] xl: Add pci device hotplug option


  • To: "Thierry Escande" <thierry.escande@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Teddy Astie" <teddy.astie@xxxxxxxxxx>
  • Date: Tue, 14 Apr 2026 08:30:22 +0000
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=mte1 header.d=mandrillapp.com header.i="@mandrillapp.com" header.h="From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:Date:MIME-Version:Content-Type:Content-Transfer-Encoding"; dkim=pass header.s=mte1 header.d=vates.tech header.i="teddy.astie@xxxxxxxxxx" header.h="From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID:Date:MIME-Version:Content-Type:Content-Transfer-Encoding"
  • Cc: "Anthony PERARD" <anthony.perard@xxxxxxxxxx>, "Juergen Gross" <jgross@xxxxxxxx>, "Daniel P . Berrangé" <berrange@xxxxxxxxxx>, "Marek Marczykowski-Górecki" <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 14 Apr 2026 08:30:32 +0000
  • Feedback-id: 30504962:30504962.20260414:md
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Le 10/04/2026 à 17:06, Thierry Escande a écrit :
> This option is used to passthrough PCI devices using the Qemu command
> line (-device driver,...) instead of the QMP hot-plug mechanism.
>
> This is needed for Q35 support since its PCI root bus doesn't support
> hotplugging.
>
> If not specified, the default behavior is to use hotplug via QMP.
>
> Signed-off-by: Thierry Escande <thierry.escande@xxxxxxxxxx>
> ---
> v2: no change
> v3: no change
> ---
>   tools/libs/light/libxl_types.idl | 1 +
>   tools/libs/util/libxlu_pci.c     | 2 ++
>   tools/xl/xl_parse.c              | 5 +++++
>   3 files changed, 8 insertions(+)
>
> diff --git a/tools/libs/light/libxl_types.idl 
> b/tools/libs/light/libxl_types.idl
> index a7893460f0..aca0e93793 100644
> --- a/tools/libs/light/libxl_types.idl
> +++ b/tools/libs/light/libxl_types.idl
> @@ -922,6 +922,7 @@ libxl_device_pci = Struct("device_pci", [
>       ("seize", bool),
>       ("rdm_policy", libxl_rdm_reserve_policy),
>       ("name", string),
> +    ("hotplug", bool),
>       ])
>
>   libxl_device_rdm = Struct("device_rdm", [
> diff --git a/tools/libs/util/libxlu_pci.c b/tools/libs/util/libxlu_pci.c
> index 294482c6d7..f6440c878b 100644
> --- a/tools/libs/util/libxlu_pci.c
> +++ b/tools/libs/util/libxlu_pci.c
> @@ -192,6 +192,8 @@ int xlu_pci_parse_spec_string(XLU_Config *cfg, 
> libxl_device_pci *pci,
>               name_present = true;
>               pci->name = strdup(val);
>               if (!pci->name) ret = ERROR_NOMEM;
> +        } else if (!strcmp(key, "hotplug")) {
> +            pci->hotplug = atoi(val);
>           } else {
>               XLU__PCI_ERR(cfg, "Unknown PCI_SPEC_STRING option: %s", key);
>               ret = ERROR_INVAL;
> diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
> index 48c72dce9c..7ea2a76662 100644
> --- a/tools/xl/xl_parse.c
> +++ b/tools/xl/xl_parse.c
> @@ -1361,6 +1361,7 @@ void parse_config_data(const char *config_source,
>       int pci_msitranslate = 0;
>       int pci_permissive = 0;
>       int pci_seize = 0;
> +    int pci_hotplug = 1;
>       int i, e;
>       int num_llc_colors;
>       int num_xs_quota;
> @@ -1699,6 +1700,9 @@ void parse_config_data(const char *config_source,
>       if (!xlu_cfg_get_long (config, "pci_seize", &l, 0))
>           pci_seize = l;
>
> +    if (!xlu_cfg_get_long (config, "pci_hotplug", &l, 0))
> +        pci_hotplug = l;
> +
>       if (!xlu_cfg_get_string(config, "rdm", &buf, 0)) {
>           libxl_rdm_reserve rdm;
>           if (!xlu_rdm_parse(config, &rdm, buf)) {
> @@ -1720,6 +1724,7 @@ void parse_config_data(const char *config_source,
>               pci->power_mgmt = pci_power_mgmt;
>               pci->permissive = pci_permissive;
>               pci->seize = pci_seize;
> +            pci->hotplug = pci_hotplug;
>               /*
>                * Like other pci option, the per-device policy always follows
>                * the global policy by default.

Reviewed-by: Teddy Astie <teddy.astie@xxxxxxxxxx>


--
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.