|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH v4 1/6] xl: Add an hotplug option for PCI device passthrough
This patch adds a boolean option to the PCI device configuration table
named hotplug. This will allow to control how devices are attached to
the guest, either by using the legacy QMP mechanism (this will be the
default) or by passing them directly to the Qemu command line using
xen-pci-passthrough device.
Sample use in xl.cfg file:
pci = [ "00:03.0,seize=1,hotplug=0" ]
If not specified, the default behavior is to use hotplug via QMP.
This will be needed for Q35 support in guests since the Q35 PCI root bus
doesn't support hotplugging and Xen only support 1 PCI bus for now.
Signed-off-by: Thierry Escande <thierry.escande@xxxxxxxxxx>
---
v2: no change
v3: no change
v4:
- Reword commit message
---
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.
--
2.53.0
--
Thierry Escande | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |