[PATCH 0/2] lxc: Couple of almost trivial fixes
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (2):
lxc: Make lxcCreateHostdevDef() less versatile
lxc: Fix access to hostdev capabilities
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_hostdev.c | 4 ++--
src/lxc/lxc_native.c | 14 +++++---------
3 files changed, 8 insertions(+), 12 deletions(-)
--
2.39.2
1 year, 7 months
[PATCH v2] vfio/pci: Propagate ACPI notifications to user-space via eventfd
by Grzegorz Jaszczyk
To allow pass-through devices receiving ACPI notifications, permit to
register ACPI notify handler (via introduced new ioctl) for a given
device. The handler role is to receive and propagate such ACPI
notifications to the user-space through the user provided eventfd. This
allows VMM to receive and propagate them further to the VM, where the
actual driver for pass-through device resides and can react to device
specific notifications accordingly.
The eventfd usage ensures VMM and device isolation: it allows to use a
dedicated channel associated with the device for such events, such that
the VMM has direct access.
Since the eventfd counter is used as ACPI notification value
placeholder, the eventfd signaling needs to be serialized in order to
not end up with notification values being coalesced. Therefore ACPI
notification values are buffered and signalized one by one, when the
previous notification value has been consumed.
Signed-off-by: Grzegorz Jaszczyk <jaz(a)semihalf.com>
---
Changelog v1..v2:
- The v2 implementation is actually completely different then v1:
instead of using acpi netlink events for propagating ACPI
notifications to the user space take advantage of eventfd, which can
provide better VMM and device isolation: it allows to use a dedicated
channel associated with the device for such events, such that the VMM
has direct access.
- Using eventfd counter as notification value placeholder was suggested
in v1 and requires additional serialization logic introduced in v2.
- Since the vfio-pci supports non-ACPI platforms address !CONFIG_ACPI
case.
- v1 discussion: https://patchwork.kernel.org/project/kvm/patch/20230307220553.631069-1-ja...
---
drivers/vfio/pci/vfio_pci_core.c | 215 +++++++++++++++++++++++++++++++
include/linux/vfio_pci_core.h | 11 ++
include/uapi/linux/vfio.h | 15 +++
3 files changed, 241 insertions(+)
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index a5ab416cf476..ba8c49217875 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -10,6 +10,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/acpi.h>
#include <linux/aperture.h>
#include <linux/device.h>
#include <linux/eventfd.h>
@@ -679,6 +680,70 @@ void vfio_pci_core_disable(struct vfio_pci_core_device *vdev)
}
EXPORT_SYMBOL_GPL(vfio_pci_core_disable);
+struct notification_queue {
+ int notification_val;
+ struct list_head notify_val_next;
+};
+
+#if IS_ENABLED(CONFIG_ACPI)
+static void vfio_pci_core_acpi_notify(acpi_handle handle, u32 event, void *data)
+{
+ struct vfio_pci_core_device *vdev = (struct vfio_pci_core_device *)data;
+ struct vfio_acpi_notification *acpi_notify = vdev->acpi_notification;
+ struct notification_queue *entry;
+
+ entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+ if (!entry)
+ return;
+
+ entry->notification_val = event;
+ INIT_LIST_HEAD(&entry->notify_val_next);
+
+ mutex_lock(&acpi_notify->notification_list_lock);
+ list_add_tail(&entry->notify_val_next, &acpi_notify->notification_list);
+ mutex_unlock(&acpi_notify->notification_list_lock);
+
+ schedule_work(&acpi_notify->acpi_notification_work);
+}
+
+void vfio_pci_acpi_notify_close_device(struct vfio_pci_core_device *vdev)
+{
+ struct vfio_acpi_notification *acpi_notify = vdev->acpi_notification;
+ struct pci_dev *pdev = vdev->pdev;
+ struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
+ struct notification_queue *entry, *entry_tmp;
+ u64 cnt;
+
+ if (!acpi_notify || !acpi_notify->acpi_notify_trigger)
+ return;
+
+ acpi_remove_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY,
+ vfio_pci_core_acpi_notify);
+
+ eventfd_ctx_remove_wait_queue(acpi_notify->acpi_notify_trigger,
+ &acpi_notify->wait, &cnt);
+
+ flush_work(&acpi_notify->acpi_notification_work);
+
+ mutex_lock(&acpi_notify->notification_list_lock);
+ list_for_each_entry_safe(entry, entry_tmp,
+ &acpi_notify->notification_list,
+ notify_val_next) {
+ list_del(&entry->notify_val_next);
+ kfree(entry);
+ }
+ mutex_unlock(&acpi_notify->notification_list_lock);
+
+ eventfd_ctx_put(acpi_notify->acpi_notify_trigger);
+
+ kfree(acpi_notify);
+
+ vdev->acpi_notification = NULL;
+}
+#else
+void vfio_pci_acpi_notify_close_device(struct vfio_pci_core_device *vdev) {}
+#endif /* CONFIG_ACPI */
+
void vfio_pci_core_close_device(struct vfio_device *core_vdev)
{
struct vfio_pci_core_device *vdev =
@@ -705,6 +770,8 @@ void vfio_pci_core_close_device(struct vfio_device *core_vdev)
vdev->req_trigger = NULL;
}
mutex_unlock(&vdev->igate);
+
+ vfio_pci_acpi_notify_close_device(vdev);
}
EXPORT_SYMBOL_GPL(vfio_pci_core_close_device);
@@ -882,6 +949,152 @@ int vfio_pci_core_register_dev_region(struct vfio_pci_core_device *vdev,
}
EXPORT_SYMBOL_GPL(vfio_pci_core_register_dev_region);
+#if IS_ENABLED(CONFIG_ACPI)
+static int vfio_pci_eventfd_wakeup(wait_queue_entry_t *wait, unsigned int mode,
+ int sync, void *key)
+{
+ struct vfio_acpi_notification *acpi_notify =
+ container_of(wait, struct vfio_acpi_notification, wait);
+ __poll_t flags = key_to_poll(key);
+
+ /*
+ * eventfd_read signalize EPOLLOUT at the end of its function - this
+ * means previous eventfd with its notification value was consumed so
+ * the next notification can be signalized now if pending - schedule
+ * proper work.
+ */
+ if (flags & EPOLLOUT) {
+ mutex_unlock(&acpi_notify->notification_lock);
+ schedule_work(&acpi_notify->acpi_notification_work);
+ }
+
+ return 0;
+}
+
+static void vfio_pci_ptable_queue_proc(struct file *file,
+ wait_queue_head_t *wqh, poll_table *pt)
+{
+ struct vfio_acpi_notification *acpi_notify =
+ container_of(pt, struct vfio_acpi_notification, pt);
+
+ add_wait_queue(wqh, &acpi_notify->wait);
+}
+
+static void acpi_notification_work_fn(struct work_struct *work)
+{
+ struct vfio_acpi_notification *acpi_notify;
+ struct notification_queue *entry;
+
+ acpi_notify = container_of(work, struct vfio_acpi_notification,
+ acpi_notification_work);
+
+ mutex_lock(&acpi_notify->notification_list_lock);
+ if (list_empty(&acpi_notify->notification_list) || !acpi_notify->acpi_notify_trigger)
+ goto out;
+
+ /*
+ * If the previous eventfd was not yet consumed by user-space lets hold
+ * on and exit. The notification function will be rescheduled when
+ * signaling eventfd will be possible (when the EPOLLOUT will be
+ * signalized and unlocks notify_events).
+ */
+ if (!mutex_trylock(&acpi_notify->notification_lock))
+ goto out;
+
+ entry = list_first_entry(&acpi_notify->notification_list,
+ struct notification_queue, notify_val_next);
+
+ list_del(&entry->notify_val_next);
+ mutex_unlock(&acpi_notify->notification_list_lock);
+
+ eventfd_signal(acpi_notify->acpi_notify_trigger, entry->notification_val);
+
+ kfree(entry);
+
+ return;
+out:
+ mutex_unlock(&acpi_notify->notification_list_lock);
+}
+
+static int vfio_pci_ioctl_acpi_notify_eventfd(struct vfio_pci_core_device *vdev, struct
+ vfio_irq_info __user *arg)
+{
+ struct file *acpi_notify_trigger_file;
+ struct vfio_acpi_notification *acpi_notify;
+ struct pci_dev *pdev = vdev->pdev;
+ struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
+ struct vfio_acpi_notify_eventfd entry;
+ struct eventfd_ctx *efdctx;
+ acpi_status status;
+ __poll_t events;
+
+ if (!adev)
+ return -ENODEV;
+
+ if (copy_from_user(&entry, arg, sizeof(entry)))
+ return -EFAULT;
+
+ if (entry.notify_eventfd < 0)
+ return -EINVAL;
+
+ efdctx = eventfd_ctx_fdget(entry.notify_eventfd);
+ if (IS_ERR(efdctx))
+ return PTR_ERR(efdctx);
+
+ vdev->acpi_notification = kzalloc(sizeof(*acpi_notify), GFP_KERNEL);
+ if (!vdev->acpi_notification)
+ return -ENOMEM;
+
+ acpi_notify = vdev->acpi_notification;
+
+ INIT_WORK(&acpi_notify->acpi_notification_work, acpi_notification_work_fn);
+ INIT_LIST_HEAD(&acpi_notify->notification_list);
+
+ acpi_notify->acpi_notify_trigger = efdctx;
+
+ mutex_init(&acpi_notify->notification_lock);
+
+ /*
+ * Install custom wake-up handler to be notified whenever underlying
+ * eventfd is consumed by the user-space.
+ */
+ init_waitqueue_func_entry(&acpi_notify->wait, vfio_pci_eventfd_wakeup);
+ init_poll_funcptr(&acpi_notify->pt, vfio_pci_ptable_queue_proc);
+
+ acpi_notify_trigger_file = eventfd_fget(entry.notify_eventfd);
+ events = vfs_poll(acpi_notify_trigger_file, &acpi_notify->pt);
+
+ status = acpi_install_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY,
+ vfio_pci_core_acpi_notify, (void *)vdev);
+
+ if (ACPI_FAILURE(status)) {
+ u64 cnt;
+
+ pci_err(pdev, "Failed to install notify handler: %s",
+ acpi_format_exception(status));
+
+ eventfd_ctx_remove_wait_queue(acpi_notify->acpi_notify_trigger,
+ &acpi_notify->wait, &cnt);
+
+ flush_work(&acpi_notify->acpi_notification_work);
+
+ eventfd_ctx_put(acpi_notify->acpi_notify_trigger);
+
+ kfree(acpi_notify);
+
+ return -ENODEV;
+ }
+
+ return 0;
+}
+#else
+static int vfio_pci_ioctl_acpi_notify_eventfd(struct vfio_pci_core_device *vdev, struct
+ vfio_irq_info __user *arg)
+{
+ return -ENODEV;
+}
+#endif /* CONFIG_ACPI */
+
static int vfio_pci_ioctl_get_info(struct vfio_pci_core_device *vdev,
struct vfio_device_info __user *arg)
{
@@ -1398,6 +1611,8 @@ long vfio_pci_core_ioctl(struct vfio_device *core_vdev, unsigned int cmd,
return vfio_pci_ioctl_reset(vdev, uarg);
case VFIO_DEVICE_SET_IRQS:
return vfio_pci_ioctl_set_irqs(vdev, uarg);
+ case VFIO_ACPI_NOTIFY_EVENTFD:
+ return vfio_pci_ioctl_acpi_notify_eventfd(vdev, uarg);
default:
return -ENOTTY;
}
diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
index 367fd79226a3..3711e8a1c6f0 100644
--- a/include/linux/vfio_pci_core.h
+++ b/include/linux/vfio_pci_core.h
@@ -49,6 +49,16 @@ struct vfio_pci_region {
u32 flags;
};
+struct vfio_acpi_notification {
+ struct eventfd_ctx *acpi_notify_trigger;
+ struct work_struct acpi_notification_work;
+ struct list_head notification_list;
+ struct mutex notification_list_lock;
+ struct mutex notification_lock;
+ poll_table pt;
+ wait_queue_entry_t wait;
+};
+
struct vfio_pci_core_device {
struct vfio_device vdev;
struct pci_dev *pdev;
@@ -96,6 +106,7 @@ struct vfio_pci_core_device {
struct mutex vma_lock;
struct list_head vma_list;
struct rw_semaphore memory_lock;
+ struct vfio_acpi_notification *acpi_notification;
};
/* Will be exported for vfio pci drivers usage */
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 0552e8dcf0cb..d4b602d8f4b2 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -1622,6 +1622,21 @@ struct vfio_iommu_spapr_tce_remove {
};
#define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20)
+/**
+ * VFIO_ACPI_NOTIFY_EVENTFD - _IOW(VFIO_TYPE, VFIO_BASE + 21, struct vfio_acpi_notify_eventfd)
+ *
+ * Register ACPI notify handler for a given device which will allow to receive
+ * and propagate ACPI notifications to the user-space through the user provided
+ * eventfd.
+ *
+ * Return: 0 on success, -errno on failure.
+ */
+struct vfio_acpi_notify_eventfd {
+ __s32 notify_eventfd;
+ __u32 reserved;
+};
+#define VFIO_ACPI_NOTIFY_EVENTFD _IO(VFIO_TYPE, VFIO_BASE + 21)
+
/* ***************************************************************** */
#endif /* _UAPIVFIO_H */
--
2.40.0.634.g4ca3ef3211-goog
1 year, 7 months
[libvirt PATCHv2 0/3] qemu: support host-phys-bits-limit
by Ján Tomko
Ján Tomko (3):
conf: cpu: add limit for maxphysaddr
qemu: add support for setting host-phys-bits-limit
qemu: allow forcing emulated maxphysaddr
docs/formatdomain.rst | 10 ++++--
src/conf/cpu_conf.c | 13 ++++++++
src/conf/cpu_conf.h | 1 +
src/conf/schemas/cputypes.rng | 5 +++
src/qemu/qemu_command.c | 8 ++++-
src/qemu/qemu_validate.c | 7 ----
...-phys-bits-emulate-bare.x86_64-latest.args | 33 +++++++++++++++++++
.../cpu-phys-bits-emulate-bare.xml | 20 +++++++++++
.../cpu-phys-bits-emulate3.err | 1 -
.../cpu-phys-bits-emulate3.xml | 20 -----------
.../cpu-phys-bits-limit.x86_64-latest.args | 33 +++++++++++++++++++
.../qemuxml2argvdata/cpu-phys-bits-limit.xml | 20 +++++++++++
tests/qemuxml2argvtest.c | 3 +-
...u-phys-bits-emulate-bare.x86_64-latest.xml | 31 +++++++++++++++++
.../cpu-phys-bits-limit.x86_64-latest.xml | 31 +++++++++++++++++
tests/qemuxml2xmltest.c | 3 ++
16 files changed, 207 insertions(+), 32 deletions(-)
create mode 100644 tests/qemuxml2argvdata/cpu-phys-bits-emulate-bare.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/cpu-phys-bits-emulate-bare.xml
delete mode 100644 tests/qemuxml2argvdata/cpu-phys-bits-emulate3.err
delete mode 100644 tests/qemuxml2argvdata/cpu-phys-bits-emulate3.xml
create mode 100644 tests/qemuxml2argvdata/cpu-phys-bits-limit.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/cpu-phys-bits-limit.xml
create mode 100644 tests/qemuxml2xmloutdata/cpu-phys-bits-emulate-bare.x86_64-latest.xml
create mode 100644 tests/qemuxml2xmloutdata/cpu-phys-bits-limit.x86_64-latest.xml
--
2.39.2
1 year, 7 months
[PATCH 00/11] qemuhotplugtest: Various cleanups and improvements
by Michal Privoznik
While working on something else, I've taken a look at qemuhotplugtest
and realized we can do various cleanups and improvements.
The test still covers just live attach/detach/update, but after this
it's prepared better to test also config attach/detach/update.
Michal Prívozník (11):
qemu: Replace @dom argument with @driver in
qemuDomainUpdateDeviceLive()
qemu: Move qemuDomainAttachDeviceLive() into qemu_hotplug.c
qemu: Move qemuDomainUpdateDeviceLive() into qemu_hotplug.c
qemuhotplugtest: Call qemuDomainDetachDeviceLive() directly
qemuhotplugtest: Call qemuDomainAttachDeviceLive() directly
qemuhotplugtest: Call qemuDomainUpdateDeviceLive() directly
qemu_hotplug.h: Expose less functions
qemuhotplugtest: Fix misleading comment on monitor unlock
qemuhotplugtest: Don't overwrite vm->def->id in
testQemuHotplugCheckResult()
qemuhotplugtest: use g_autoptr(virDomainDeviceDef)
qemuhotplugtest: Verify domain XML on UPDATE
src/qemu/qemu_driver.c | 472 +---------------
src/qemu/qemu_hotplug.c | 525 +++++++++++++++++-
src/qemu/qemu_hotplug.h | 68 +--
tests/qemuhotplugtest.c | 197 +------
...hotplug-disk-cdrom+disk-cdrom-nochange.xml | 1 +
.../qemuhotplug-disk-cdrom.xml | 30 +-
...graphics-spice+graphics-spice-nochange.xml | 1 +
...graphics-spice-listen-network-password.xml | 71 +++
...imeout+graphics-spice-timeout-nochange.xml | 1 +
...imeout+graphics-spice-timeout-password.xml | 117 ++++
.../qemuhotplug-graphics-spice-timeout.xml | 50 +-
.../qemuhotplug-graphics-spice.xml | 41 +-
12 files changed, 819 insertions(+), 755 deletions(-)
create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom+disk-cdrom-nochange.xml
create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice+graphics-spice-nochange.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network+graphics-spice-listen-network-password.xml
create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-nochange.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml
--
2.39.2
1 year, 7 months
[libvirt PATCH] Move default Input bus logic to PostParse handling
by K Shiva
A new enum type "Default" has been added for Input bus.
The logic that handled default input bus types in
virDomainInputParseXML() has been moved to a new function
virDomainInputDefPostParse() in domain_postparse.c
Link to Issue: https://gitlab.com/libvirt/libvirt/-/issues/8
Signed-off-by: K Shiva <shiva_kr(a)riseup.net>
---
src/conf/domain_conf.c | 27 +++------------------------
src/conf/domain_conf.h | 1 +
src/conf/domain_postparse.c | 30 ++++++++++++++++++++++++++++++
src/qemu/qemu_command.c | 1 +
src/qemu/qemu_domain_address.c | 1 +
src/qemu/qemu_hotplug.c | 2 ++
6 files changed, 38 insertions(+), 24 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b03a3ff011..22af3f1d8a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -905,6 +905,7 @@ VIR_ENUM_IMPL(virDomainInput,
VIR_ENUM_IMPL(virDomainInputBus,
VIR_DOMAIN_INPUT_BUS_LAST,
+ "default",
"ps2",
"usb",
"xen",
@@ -10693,7 +10694,6 @@ virDomainPanicDefParseXML(virDomainXMLOption *xmlopt,
/* Parse the XML definition for an input device */
static virDomainInputDef *
virDomainInputDefParseXML(virDomainXMLOption *xmlopt,
- const virDomainDef *dom,
xmlNodePtr node,
xmlXPathContextPtr ctxt,
unsigned int flags)
@@ -10741,27 +10741,7 @@ virDomainInputDefParseXML(virDomainXMLOption *xmlopt,
}
} else {
- if (dom->os.type == VIR_DOMAIN_OSTYPE_HVM) {
- if ((def->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
- def->type == VIR_DOMAIN_INPUT_TYPE_KBD) &&
- (ARCH_IS_X86(dom->os.arch) || dom->os.arch == VIR_ARCH_NONE)) {
- def->bus = VIR_DOMAIN_INPUT_BUS_PS2;
- } else if (ARCH_IS_S390(dom->os.arch) ||
- def->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) {
- def->bus = VIR_DOMAIN_INPUT_BUS_VIRTIO;
- } else if (def->type == VIR_DOMAIN_INPUT_TYPE_EVDEV) {
- def->bus = VIR_DOMAIN_INPUT_BUS_NONE;
- } else {
- def->bus = VIR_DOMAIN_INPUT_BUS_USB;
- }
- } else if (dom->os.type == VIR_DOMAIN_OSTYPE_XEN ||
- dom->os.type == VIR_DOMAIN_OSTYPE_XENPVH) {
- def->bus = VIR_DOMAIN_INPUT_BUS_XEN;
- } else {
- if ((dom->virtType == VIR_DOMAIN_VIRT_VZ ||
- dom->virtType == VIR_DOMAIN_VIRT_PARALLELS))
- def->bus = VIR_DOMAIN_INPUT_BUS_PARALLELS;
- }
+ def->bus = VIR_DOMAIN_INPUT_BUS_DEFAULT;
}
if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags) < 0)
@@ -13766,7 +13746,7 @@ virDomainDeviceDefParse(const char *xmlStr,
return NULL;
break;
case VIR_DOMAIN_DEVICE_INPUT:
- if (!(dev->data.input = virDomainInputDefParseXML(xmlopt, def, node,
+ if (!(dev->data.input = virDomainInputDefParseXML(xmlopt, node,
ctxt, flags)))
return NULL;
break;
@@ -18872,7 +18852,6 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt,
for (i = 0; i < n; i++) {
virDomainInputDef *input = virDomainInputDefParseXML(xmlopt,
- def,
nodes[i],
ctxt,
flags);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 511067a050..2a8fc6f90d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1510,6 +1510,7 @@ typedef enum {
} virDomainInputType;
typedef enum {
+ VIR_DOMAIN_INPUT_BUS_DEFAULT,
VIR_DOMAIN_INPUT_BUS_PS2,
VIR_DOMAIN_INPUT_BUS_USB,
VIR_DOMAIN_INPUT_BUS_XEN,
diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c
index b756e2cde8..7ef478e3e1 100644
--- a/src/conf/domain_postparse.c
+++ b/src/conf/domain_postparse.c
@@ -649,6 +649,33 @@ virDomainFSDefPostParse(virDomainFSDef *fs)
return 0;
}
+static void
+virDomainInputDefPostParse(virDomainInputDef *input,
+ const virDomainDef *def)
+{
+ if (input->bus == VIR_DOMAIN_INPUT_BUS_DEFAULT) {
+ if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
+ if ((input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
+ input->type == VIR_DOMAIN_INPUT_TYPE_KBD) &&
+ (ARCH_IS_X86(def->os.arch) || def->os.arch == VIR_ARCH_NONE)) {
+ } else if (ARCH_IS_S390(def->os.arch) ||
+ input->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) {
+ input->bus = VIR_DOMAIN_INPUT_BUS_VIRTIO;
+ } else if (input->type == VIR_DOMAIN_INPUT_TYPE_EVDEV) {
+ input->bus = VIR_DOMAIN_INPUT_BUS_NONE;
+ } else {
+ input->bus = VIR_DOMAIN_INPUT_BUS_USB;
+ }
+ } else if (def->os.type == VIR_DOMAIN_OSTYPE_XEN ||
+ def->os.type == VIR_DOMAIN_OSTYPE_XENPVH) {
+ input->bus = VIR_DOMAIN_INPUT_BUS_XEN;
+ } else {
+ if ((def->virtType == VIR_DOMAIN_VIRT_VZ ||
+ def->virtType == VIR_DOMAIN_VIRT_PARALLELS))
+ input->bus = VIR_DOMAIN_INPUT_BUS_PARALLELS;
+ }
+ }
+}
static int
virDomainDeviceDefPostParseCommon(virDomainDeviceDef *dev,
@@ -701,6 +728,9 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDef *dev,
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_NET:
case VIR_DOMAIN_DEVICE_INPUT:
+ virDomainInputDefPostParse(dev->data.input, def);
+ ret = 0;
+ break;
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_WATCHDOG:
case VIR_DOMAIN_DEVICE_GRAPHICS:
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4ca93bf3dc..135e35f43a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4345,6 +4345,7 @@ qemuBuildInputCommandLine(virCommand *cmd,
if (!(props = qemuBuildInputVirtioDevProps(def, input, qemuCaps)))
return -1;
+ case VIR_DOMAIN_INPUT_BUS_DEFAULT:
case VIR_DOMAIN_INPUT_BUS_PS2:
case VIR_DOMAIN_INPUT_BUS_XEN:
case VIR_DOMAIN_INPUT_BUS_PARALLELS:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 7d3d072d5a..49c5e199fa 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -984,6 +984,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
}
return 0;
+ case VIR_DOMAIN_INPUT_BUS_DEFAULT:
case VIR_DOMAIN_INPUT_BUS_PS2:
case VIR_DOMAIN_INPUT_BUS_USB:
case VIR_DOMAIN_INPUT_BUS_XEN:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5072798cb7..f7a41e376e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3053,6 +3053,7 @@ qemuDomainAttachInputDevice(virDomainObj *vm,
goto cleanup;
break;
+ case VIR_DOMAIN_INPUT_BUS_DEFAULT:
case VIR_DOMAIN_INPUT_BUS_PS2:
case VIR_DOMAIN_INPUT_BUS_XEN:
case VIR_DOMAIN_INPUT_BUS_PARALLELS:
@@ -5799,6 +5800,7 @@ qemuDomainDetachPrepInput(virDomainObj *vm,
*detach = input = vm->def->inputs[idx];
switch ((virDomainInputBus) input->bus) {
+ case VIR_DOMAIN_INPUT_BUS_DEFAULT:
case VIR_DOMAIN_INPUT_BUS_PS2:
case VIR_DOMAIN_INPUT_BUS_XEN:
case VIR_DOMAIN_INPUT_BUS_PARALLELS:
--
2.40.0
1 year, 7 months
[PATCH 0/4] qemu: Move <hostdev> preparation into qemuDomainPrepareHostdev()
by Michal Privoznik
Now, technically 2/4 is a v3 of:
https://listman.redhat.com/archives/libvir-list/2023-April/239368.html
but when reviewing it, I realized that we can move more code around and
this ended up bigger cleanup.
Michal Prívozník (3):
qemuDomainAttachHostDevice: Prepare device early and for all types
qemu: Move <hostdev> SCSI path generation into
qemuDomainPrepareHostdev()
qemu: Remove empty functions
Zhenzhong Duan (1):
qemu: Move <hostdev/> PCI backend setting into
qemuDomainPrepareHostdev()
src/qemu/qemu_domain.c | 22 ++++++++++++++++
src/qemu/qemu_driver.c | 56 ---------------------------------------
src/qemu/qemu_hostdev.c | 16 +++++------
src/qemu/qemu_hotplug.c | 11 +++-----
src/qemu/qemu_process.c | 57 ----------------------------------------
src/qemu/qemu_process.h | 3 ---
tests/qemuxml2argvmock.c | 17 ++++++++++++
tests/qemuxml2argvtest.c | 28 --------------------
8 files changed, 50 insertions(+), 160 deletions(-)
--
2.39.2
1 year, 7 months
[PATCH] meson: Work around configure_file(copy:true) deprecation
by Michal Privoznik
In our meson scripts, we use configure_file(copy:true) to copy
files from srcdir into builddir. However, as of meson-0.64.0,
this is deprecated [1] in favor of using:
fs = import('fs')
fs.copyfile(in, out)
Except, the submodule's new method wasn't introduced until
0.64.0. And since we can't bump the minimal meson version we
require, we have to work with both: new and old versions.
Now, the fun part: fs.copyfile() is not a drop in replacement as
it returns different type (a custom_target object). This is
incompatible with places where we store the configure_file()
retval in a variable to process it further.
While we could just replace 'copy:true' with a dummy
'configuration:...' (say 'configuration: configmake_conf') we
can't do that for binary files (like src/fonts/ or src/images/).
Therefore, places where we are not interested in the retval can
be switched to fs.copyfile() and places where we are interested
in the retval will just use a dummy 'configuration:'.
Except, src/network/meson.build. In here we not just copy the
file but also specify alternative install dir and that's not
something that fs.copyfile() can handle. Yet, using 'copy: true'
is viewed wrong [2].
1: https://mesonbuild.com/Release-notes-for-0-64-0.html#fscopyfile-to-replac...
2: https://github.com/mesonbuild/meson/pull/10042
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/css/meson.build | 6 +++++-
docs/fonts/meson.build | 6 +++++-
docs/images/meson.build | 6 +++++-
docs/js/meson.build | 8 ++++++--
docs/logos/meson.build | 6 +++++-
docs/meson.build | 6 +++++-
meson.build | 3 +++
src/locking/meson.build | 8 ++++----
src/network/meson.build | 2 +-
9 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/docs/css/meson.build b/docs/css/meson.build
index 384f6e789f..a2a2ccfb28 100644
--- a/docs/css/meson.build
+++ b/docs/css/meson.build
@@ -11,7 +11,11 @@ install_data(docs_css_files, install_dir: docs_html_dir / 'css')
foreach file : docs_css_files
# This hack enables us to view the web pages
# from within the uninstalled build tree
- configure_file(input: file, output: file, copy: true)
+ if meson.version().version_compare('>=0.64.0')
+ fs.copyfile(file)
+ else
+ configure_file(input: file, output: file, copy: true)
+ endif
install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'css')
endforeach
diff --git a/docs/fonts/meson.build b/docs/fonts/meson.build
index 53a060b972..8f2b1c3d28 100644
--- a/docs/fonts/meson.build
+++ b/docs/fonts/meson.build
@@ -17,7 +17,11 @@ install_data(fonts, install_dir: docs_html_dir / 'fonts')
foreach file : fonts
# This hack enables us to view the web pages
# from within the uninstalled build tree
- configure_file(input: file, output: file, copy: true)
+ if meson.version().version_compare('>=0.64.0')
+ fs.copyfile(file)
+ else
+ configure_file(input: file, output: file, copy: true)
+ endif
install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'fonts')
endforeach
diff --git a/docs/images/meson.build b/docs/images/meson.build
index 3c3cb5cce1..b9ab30fc91 100644
--- a/docs/images/meson.build
+++ b/docs/images/meson.build
@@ -17,7 +17,11 @@ install_data(docs_image_files, install_dir: docs_html_dir / 'images')
foreach file : docs_image_files
# This hack enables us to view the web pages
# from within the uninstalled build tree
- configure_file(input: file, output: file, copy: true)
+ if meson.version().version_compare('>=0.64.0')
+ fs.copyfile(file)
+ else
+ configure_file(input: file, output: file, copy: true)
+ endif
install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'images')
endforeach
diff --git a/docs/js/meson.build b/docs/js/meson.build
index cbf2dc2633..9f77b0d85c 100644
--- a/docs/js/meson.build
+++ b/docs/js/meson.build
@@ -7,7 +7,11 @@ install_data(docs_js_files, install_dir: docs_html_dir / 'js')
foreach file : docs_js_files
# This hack enables us to view the web pages
# from within the uninstalled build tree
- configure_file(input: file, output: file, copy: true)
+ if meson.version().version_compare('>=0.64.0')
+ fs.copyfile(file)
+ else
+ configure_file(input: file, output: file, copy: true)
+ endif
- install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'js')
+ install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'js')
endforeach
diff --git a/docs/logos/meson.build b/docs/logos/meson.build
index c65fcdd8ed..c3f4c9f522 100644
--- a/docs/logos/meson.build
+++ b/docs/logos/meson.build
@@ -25,7 +25,11 @@ install_data(docs_logo_files, install_dir: docs_html_dir / 'logos')
foreach file : docs_logo_files
# This hack enables us to view the web pages
# from within the uninstalled build tree
- configure_file(input: file, output: file, copy: true)
+ if meson.version().version_compare('>=0.64.0')
+ fs.copyfile(file)
+ else
+ configure_file(input: file, output: file, copy: true)
+ endif
install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'logos')
endforeach
diff --git a/docs/meson.build b/docs/meson.build
index 864abf0ba5..caa47a1476 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -345,7 +345,11 @@ subdir('manpages')
foreach file : docs_assets
# This hack enables us to view the web pages
# from within the uninstalled build tree
- configure_file(input: file, output: file, copy: true)
+ if meson.version().version_compare('>=0.64.0')
+ fs.copyfile(file)
+ else
+ configure_file(input: file, output: file, copy: true)
+ endif
install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir)
endforeach
diff --git a/meson.build b/meson.build
index a0682e8d0b..885fa53e50 100644
--- a/meson.build
+++ b/meson.build
@@ -11,6 +11,9 @@ project(
],
)
+if meson.version().version_compare('>=0.64.0')
+ fs = import('fs')
+endif
# figure out if we are building from git
diff --git a/src/locking/meson.build b/src/locking/meson.build
index 72f7780438..57764b0da6 100644
--- a/src/locking/meson.build
+++ b/src/locking/meson.build
@@ -174,7 +174,7 @@ if conf.has('WITH_LIBVIRTD')
qemu_lockd_conf = configure_file(
input: 'lockd.conf',
output: 'qemu-lockd.conf',
- copy: true,
+ configuration: configmake_conf,
)
virt_conf_files += qemu_lockd_conf
virt_test_aug_files += {
@@ -191,7 +191,7 @@ if conf.has('WITH_LIBVIRTD')
libxl_lockd_conf = configure_file(
input: 'lockd.conf',
output: 'libxl-lockd.conf',
- copy: true,
+ configuration: configmake_conf,
)
virt_conf_files += libxl_lockd_conf
endif
@@ -203,7 +203,7 @@ if conf.has('WITH_LIBVIRTD')
qemu_sanlock_conf = configure_file(
input: 'sanlock.conf',
output: 'qemu-sanlock.conf',
- copy: true,
+ configuration: configmake_conf,
)
virt_conf_files += qemu_sanlock_conf
virt_test_aug_files += {
@@ -220,7 +220,7 @@ if conf.has('WITH_LIBVIRTD')
libxl_sanlock_conf = configure_file(
input: 'sanlock.conf',
output: 'libxl-sanlock.conf',
- copy: true,
+ configuration: configmake_conf,
)
virt_conf_files += libxl_sanlock_conf
endif
diff --git a/src/network/meson.build b/src/network/meson.build
index d266bb225a..0888d1beac 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -84,7 +84,7 @@ if conf.has('WITH_NETWORK')
configure_file(
input: 'default.xml.in',
output: '@BASENAME@',
- copy: true,
+ configuration: configmake_conf,
install: true,
install_dir: confdir / 'qemu' / 'networks',
)
--
2.39.2
1 year, 7 months
[libvirt PATCH v2 0/6] Fix compilation on msys2, update keycodemapdb
by marcandre.lureau@redhat.com
From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Hi,
libvirt fails to compile on msys2/win32.
Also update keycodemapdb to fix CI build issues, and turn it into a
subproject(), as that makes things simpler for meson.
Fixes:
https://gitlab.com/libvirt/libvirt/-/issues/453
v2:
- update based on Michal version
- update keycodemapdb, make it a subproject()
Marc-André Lureau (6):
meson: don't look for unix paths on win32
keycodemapdb: update submodule for build fixes
meson: don't hard code find_program() location
meson: drop explicit python interpreter
rpc/ssh: ssh_userauth_agent() is not supported on win32
Move src/keycodemapdb -> subprojects/keycodemapdb
.gitmodules | 2 +-
docs/manpages/meson.build | 4 ++--
docs/meson.build | 6 ++----
meson.build | 15 ++++++++++-----
src/admin/meson.build | 4 ++--
src/esx/meson.build | 4 ++--
src/hyperv/meson.build | 2 +-
src/keycodemapdb | 1 -
src/meson.build | 8 ++++----
src/rpc/virnetlibsshsession.c | 10 +++++++++-
src/util/meson.build | 8 ++++----
subprojects/keycodemapdb | 1 +
12 files changed, 38 insertions(+), 27 deletions(-)
delete mode 160000 src/keycodemapdb
create mode 160000 subprojects/keycodemapdb
--
2.40.0
1 year, 7 months
[PATCH 0/3] qemu: migration: implement zstd compression
by Oleg Vasilev
QEMU now supports multifd-compression=zstd for migration with enabled multifd.
Bring the support to libvirt as well.
Claudio Fontana (1):
qemu: migration: expose qemuMigrationParamsSetString
Oleg Vasilev (2):
qemu: migration: implement zstd compression
tests: qemumigparams: test for zstd compression
include/libvirt/libvirt-domain.h | 10 ++++
src/qemu/qemu_migration.h | 1 +
src/qemu/qemu_migration_params.c | 79 +++++++++++++++++---------
src/qemu/qemu_migration_params.h | 7 +++
tests/qemumigparamsdata/zstd.json | 4 ++
tests/qemumigparamsdata/zstd.reply | 7 +++
tests/qemumigparamsdata/zstd.xml | 6 ++
tests/qemumigparamstest.c | 90 +++++++++++++++++++++++++++---
tools/virsh-completer-domain.c | 2 +-
tools/virsh-domain.c | 14 +++++
10 files changed, 187 insertions(+), 33 deletions(-)
create mode 100644 tests/qemumigparamsdata/zstd.json
create mode 100644 tests/qemumigparamsdata/zstd.reply
create mode 100644 tests/qemumigparamsdata/zstd.xml
--
2.40.0
1 year, 7 months
[libvirt PATCH 0/4] Various cleanups
by Ján Tomko
Found by cppcheck.
Ján Tomko (4):
conf: domain: remove unreachable break
qemu: command: join two adjacent conditions
ch: pinVcpuLive: remove unused variable
conf: storage: remove redundant condition
src/ch/ch_driver.c | 5 -----
src/conf/domain_conf.c | 1 -
src/conf/storage_conf.c | 22 +++++++++-------------
src/qemu/qemu_command.c | 2 --
4 files changed, 9 insertions(+), 21 deletions(-)
--
2.39.2
1 year, 7 months