public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
* [PATCH 0/8] hw/vfio: single-binary
@ 2026-03-12 22:44 Pierrick Bouvier
  2026-03-12 22:44 ` [PATCH 1/8] hw/vfio/listener.c: remove CONFIG_KVM Pierrick Bouvier
                   ` (10 more replies)
  0 siblings, 11 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger, Pierrick Bouvier

This series makes changes to hw/vfio to compile files only once.
Changes are pretty straightforward and are mostly extraction of kvm/other config
specific functions to proper files.
This is the last hw/* subsystem that needs to be changed for single-binary.

Pierrick Bouvier (8):
  hw/vfio/listener.c: remove CONFIG_KVM
  hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c
  hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
  hw/vfio: eradicate CONFIG_IOMMU from sources
  hw/vfio/pci.c: eradicate CONFIG_KVM
  hw/vfio/ap.c: use full path for target specific header
  hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to
    hw/vfio/kvm-spapr.c
  hw/vfio: all vfio files can now be common files

 hw/vfio/kvm-spapr.h          |  12 +++
 target/s390x/kvm/kvm_s390x.h |   2 +-
 hw/vfio/ap.c                 |  11 +-
 hw/vfio/ccw.c                |   9 --
 hw/vfio/helpers.c            | 172 -------------------------------
 hw/vfio/igd-stubs.c          |  20 ++++
 hw/vfio/kvm-helpers.c        | 192 +++++++++++++++++++++++++++++++++++
 hw/vfio/kvm-spapr.c          |  47 +++++++++
 hw/vfio/kvm-stubs.c          |  35 +++++++
 hw/vfio/listener.c           |   4 -
 hw/vfio/pci-quirks.c         |   5 -
 hw/vfio/pci.c                |  37 +++----
 hw/vfio/spapr.c              |  30 +-----
 hw/vfio/meson.build          |   8 +-
 14 files changed, 331 insertions(+), 253 deletions(-)
 create mode 100644 hw/vfio/kvm-spapr.h
 create mode 100644 hw/vfio/igd-stubs.c
 create mode 100644 hw/vfio/kvm-helpers.c
 create mode 100644 hw/vfio/kvm-spapr.c
 create mode 100644 hw/vfio/kvm-stubs.c

-- 
2.47.3



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

* [PATCH 1/8] hw/vfio/listener.c: remove CONFIG_KVM
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
@ 2026-03-12 22:44 ` Pierrick Bouvier
  2026-03-13  3:16   ` Philippe Mathieu-Daudé
  2026-03-13  7:41   ` Cédric Le Goater
  2026-03-12 22:44 ` [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c Pierrick Bouvier
                   ` (9 subsequent siblings)
  10 siblings, 2 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger, Pierrick Bouvier

Code concerned is under a kvm_enabled() guard.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/vfio/listener.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
index 960da9e0a93..31c3113f8fb 100644
--- a/hw/vfio/listener.c
+++ b/hw/vfio/listener.c
@@ -20,9 +20,7 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#ifdef CONFIG_KVM
 #include <linux/kvm.h>
-#endif
 #include <linux/vfio.h>
 
 #include "exec/target_page.h"
@@ -303,11 +301,9 @@ static bool vfio_ram_discard_register_listener(VFIOContainer *bcontainer,
     if (bcontainer->dma_max_mappings) {
         unsigned int vrdl_count = 0, vrdl_mappings = 0, max_memslots = 512;
 
-#ifdef CONFIG_KVM
         if (kvm_enabled()) {
             max_memslots = kvm_get_max_memslots();
         }
-#endif
 
         QLIST_FOREACH(vrdl, &bcontainer->vrdl_list, next) {
             hwaddr start, end;
-- 
2.47.3



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

* [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
  2026-03-12 22:44 ` [PATCH 1/8] hw/vfio/listener.c: remove CONFIG_KVM Pierrick Bouvier
@ 2026-03-12 22:44 ` Pierrick Bouvier
  2026-03-13  3:17   ` Philippe Mathieu-Daudé
                     ` (2 more replies)
  2026-03-12 22:44 ` [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD Pierrick Bouvier
                   ` (8 subsequent siblings)
  10 siblings, 3 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger, Pierrick Bouvier

Because those functions use kvm specific types, they need to be isolated
in another source file.
This allows us to link kvm-helpers only in configurations with
CONFIG_KVM.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/vfio/helpers.c     | 172 -------------------------------------
 hw/vfio/kvm-helpers.c | 192 ++++++++++++++++++++++++++++++++++++++++++
 hw/vfio/kvm-stubs.c   |  27 ++++++
 hw/vfio/meson.build   |   2 +
 4 files changed, 221 insertions(+), 172 deletions(-)
 create mode 100644 hw/vfio/kvm-helpers.c
 create mode 100644 hw/vfio/kvm-stubs.c

diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c
index 00d42d3b98e..65c6dba0428 100644
--- a/hw/vfio/helpers.c
+++ b/hw/vfio/helpers.c
@@ -22,7 +22,6 @@
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
 
-#include "system/kvm.h"
 #include "exec/cpu-common.h"
 #include "hw/vfio/vfio-device.h"
 #include "hw/core/hw-error.h"
@@ -107,177 +106,6 @@ bool vfio_get_info_dma_avail(struct vfio_iommu_type1_info *info,
     return true;
 }
 
-#ifdef CONFIG_KVM
-/*
- * We have a single VFIO pseudo device per KVM VM.  Once created it lives
- * for the life of the VM.  Closing the file descriptor only drops our
- * reference to it and the device's reference to kvm.  Therefore once
- * initialized, this file descriptor is only released on QEMU exit and
- * we'll re-use it should another vfio device be attached before then.
- */
-int vfio_kvm_device_fd = -1;
-
-/*
- * Confidential virtual machines:
- * During reset of confidential vms, the kvm vm file descriptor changes.
- * In this case, the old vfio kvm file descriptor is
- * closed and a new descriptor is created against the new kvm vm file
- * descriptor.
- */
-
-typedef struct VFIODeviceFd {
-    int fd;
-    QLIST_ENTRY(VFIODeviceFd) node;
-} VFIODeviceFd;
-
-static QLIST_HEAD(, VFIODeviceFd) vfio_device_fds =
-    QLIST_HEAD_INITIALIZER(vfio_device_fds);
-
-static void vfio_device_fd_list_add(int fd)
-{
-    VFIODeviceFd *file_fd;
-    file_fd = g_malloc0(sizeof(*file_fd));
-    file_fd->fd = fd;
-    QLIST_INSERT_HEAD(&vfio_device_fds, file_fd, node);
-}
-
-static void vfio_device_fd_list_remove(int fd)
-{
-    VFIODeviceFd *file_fd, *next;
-
-    QLIST_FOREACH_SAFE(file_fd, &vfio_device_fds, node, next) {
-        if (file_fd->fd == fd) {
-            QLIST_REMOVE(file_fd, node);
-            g_free(file_fd);
-            break;
-        }
-    }
-}
-
-static int vfio_device_fd_rebind(NotifierWithReturn *notifier, void *data,
-                                  Error **errp)
-{
-    VFIODeviceFd *file_fd;
-    struct kvm_device_attr attr = {
-        .group = KVM_DEV_VFIO_FILE,
-        .attr = KVM_DEV_VFIO_FILE_ADD,
-    };
-    struct kvm_create_device cd = {
-        .type = KVM_DEV_TYPE_VFIO,
-    };
-
-    /* we are not interested in pre vmfd change notification */
-    if (((VmfdChangeNotifier *)data)->pre) {
-        return 0;
-    }
-
-    if (kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd)) {
-        error_setg_errno(errp, errno, "Failed to create KVM VFIO device");
-        return -errno;
-    }
-
-    if (vfio_kvm_device_fd != -1) {
-        close(vfio_kvm_device_fd);
-    }
-
-    vfio_kvm_device_fd = cd.fd;
-
-    QLIST_FOREACH(file_fd, &vfio_device_fds, node) {
-        attr.addr = (uint64_t)(unsigned long)&file_fd->fd;
-        if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
-            error_setg_errno(errp, errno,
-                             "Failed to add fd %d to KVM VFIO device",
-                             file_fd->fd);
-            return -errno;
-        }
-    }
-    return 0;
-}
-
-static struct NotifierWithReturn vfio_vmfd_change_notifier = {
-    .notify = vfio_device_fd_rebind,
-};
-
-#endif
-
-void vfio_kvm_device_close(void)
-{
-#ifdef CONFIG_KVM
-    kvm_close();
-    if (vfio_kvm_device_fd != -1) {
-        close(vfio_kvm_device_fd);
-        vfio_kvm_device_fd = -1;
-    }
-#endif
-}
-
-int vfio_kvm_device_add_fd(int fd, Error **errp)
-{
-#ifdef CONFIG_KVM
-    struct kvm_device_attr attr = {
-        .group = KVM_DEV_VFIO_FILE,
-        .attr = KVM_DEV_VFIO_FILE_ADD,
-        .addr = (uint64_t)(unsigned long)&fd,
-    };
-
-    if (!kvm_enabled()) {
-        return 0;
-    }
-
-    if (vfio_kvm_device_fd < 0) {
-        struct kvm_create_device cd = {
-            .type = KVM_DEV_TYPE_VFIO,
-        };
-
-        if (kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd)) {
-            error_setg_errno(errp, errno, "Failed to create KVM VFIO device");
-            return -errno;
-        }
-
-        vfio_kvm_device_fd = cd.fd;
-        /*
-         * If the vm file descriptor changes, add a notifier so that we can
-         * re-create the vfio_kvm_device_fd.
-         */
-        kvm_vmfd_add_change_notifier(&vfio_vmfd_change_notifier);
-    }
-
-    if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
-        error_setg_errno(errp, errno, "Failed to add fd %d to KVM VFIO device",
-                         fd);
-        return -errno;
-    }
-
-    vfio_device_fd_list_add(fd);
-#endif
-    return 0;
-}
-
-int vfio_kvm_device_del_fd(int fd, Error **errp)
-{
-#ifdef CONFIG_KVM
-    struct kvm_device_attr attr = {
-        .group = KVM_DEV_VFIO_FILE,
-        .attr = KVM_DEV_VFIO_FILE_DEL,
-        .addr = (uint64_t)(unsigned long)&fd,
-    };
-
-    if (vfio_kvm_device_fd < 0) {
-        error_setg(errp, "KVM VFIO device isn't created yet");
-        return -EINVAL;
-    }
-
-    if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
-        error_setg_errno(errp, errno,
-                         "Failed to remove fd %d from KVM VFIO device", fd);
-        return -errno;
-    }
-
-    vfio_device_fd_list_remove(fd);
-#endif
-    return 0;
-}
-
 struct vfio_device_info *vfio_get_device_info(int fd)
 {
     struct vfio_device_info *info;
diff --git a/hw/vfio/kvm-helpers.c b/hw/vfio/kvm-helpers.c
new file mode 100644
index 00000000000..d71c9590aaa
--- /dev/null
+++ b/hw/vfio/kvm-helpers.c
@@ -0,0 +1,192 @@
+/*
+ * low level and IOMMU backend agnostic helpers used by VFIO devices,
+ * related to regions, interrupts, capabilities
+ *
+ * Copyright Red Hat, Inc. 2012
+ *
+ * Authors:
+ *  Alex Williamson <alex.williamson@redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * Based on qemu-kvm device-assignment:
+ *  Adapted for KVM by Qumranet.
+ *  Copyright (c) 2007, Neocleus, Alex Novik (alex@neocleus.com)
+ *  Copyright (c) 2007, Neocleus, Guy Zana (guy@neocleus.com)
+ *  Copyright (C) 2008, Qumranet, Amit Shah (amit.shah@qumranet.com)
+ *  Copyright (C) 2008, Red Hat, Amit Shah (amit.shah@redhat.com)
+ *  Copyright (C) 2008, IBM, Muli Ben-Yehuda (muli@il.ibm.com)
+ */
+
+#include "qemu/osdep.h"
+#include <sys/ioctl.h>
+
+#include <linux/kvm.h>
+#include "system/kvm.h"
+#include "exec/cpu-common.h"
+#include "hw/vfio/vfio-device.h"
+#include "hw/core/hw-error.h"
+#include "qapi/error.h"
+#include "vfio-helpers.h"
+
+/*
+ * We have a single VFIO pseudo device per KVM VM.  Once created it lives
+ * for the life of the VM.  Closing the file descriptor only drops our
+ * reference to it and the device's reference to kvm.  Therefore once
+ * initialized, this file descriptor is only released on QEMU exit and
+ * we'll re-use it should another vfio device be attached before then.
+ */
+int vfio_kvm_device_fd = -1;
+
+/*
+ * Confidential virtual machines:
+ * During reset of confidential vms, the kvm vm file descriptor changes.
+ * In this case, the old vfio kvm file descriptor is
+ * closed and a new descriptor is created against the new kvm vm file
+ * descriptor.
+ */
+
+typedef struct VFIODeviceFd {
+    int fd;
+    QLIST_ENTRY(VFIODeviceFd) node;
+} VFIODeviceFd;
+
+static QLIST_HEAD(, VFIODeviceFd) vfio_device_fds =
+    QLIST_HEAD_INITIALIZER(vfio_device_fds);
+
+static void vfio_device_fd_list_add(int fd)
+{
+    VFIODeviceFd *file_fd;
+    file_fd = g_malloc0(sizeof(*file_fd));
+    file_fd->fd = fd;
+    QLIST_INSERT_HEAD(&vfio_device_fds, file_fd, node);
+}
+
+static void vfio_device_fd_list_remove(int fd)
+{
+    VFIODeviceFd *file_fd, *next;
+
+    QLIST_FOREACH_SAFE(file_fd, &vfio_device_fds, node, next) {
+        if (file_fd->fd == fd) {
+            QLIST_REMOVE(file_fd, node);
+            g_free(file_fd);
+            break;
+        }
+    }
+}
+
+static int vfio_device_fd_rebind(NotifierWithReturn *notifier, void *data,
+                                  Error **errp)
+{
+    VFIODeviceFd *file_fd;
+    struct kvm_device_attr attr = {
+        .group = KVM_DEV_VFIO_FILE,
+        .attr = KVM_DEV_VFIO_FILE_ADD,
+    };
+    struct kvm_create_device cd = {
+        .type = KVM_DEV_TYPE_VFIO,
+    };
+
+    /* we are not interested in pre vmfd change notification */
+    if (((VmfdChangeNotifier *)data)->pre) {
+        return 0;
+    }
+
+    if (kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd)) {
+        error_setg_errno(errp, errno, "Failed to create KVM VFIO device");
+        return -errno;
+    }
+
+    if (vfio_kvm_device_fd != -1) {
+        close(vfio_kvm_device_fd);
+    }
+
+    vfio_kvm_device_fd = cd.fd;
+
+    QLIST_FOREACH(file_fd, &vfio_device_fds, node) {
+        attr.addr = (uint64_t)(unsigned long)&file_fd->fd;
+        if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
+            error_setg_errno(errp, errno,
+                             "Failed to add fd %d to KVM VFIO device",
+                             file_fd->fd);
+            return -errno;
+        }
+    }
+    return 0;
+}
+
+static struct NotifierWithReturn vfio_vmfd_change_notifier = {
+    .notify = vfio_device_fd_rebind,
+};
+
+void vfio_kvm_device_close(void)
+{
+    kvm_close();
+    if (vfio_kvm_device_fd != -1) {
+        close(vfio_kvm_device_fd);
+        vfio_kvm_device_fd = -1;
+    }
+}
+
+int vfio_kvm_device_add_fd(int fd, Error **errp)
+{
+    struct kvm_device_attr attr = {
+        .group = KVM_DEV_VFIO_FILE,
+        .attr = KVM_DEV_VFIO_FILE_ADD,
+        .addr = (uint64_t)(unsigned long)&fd,
+    };
+
+    if (!kvm_enabled()) {
+        return 0;
+    }
+
+    if (vfio_kvm_device_fd < 0) {
+        struct kvm_create_device cd = {
+            .type = KVM_DEV_TYPE_VFIO,
+        };
+
+        if (kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd)) {
+            error_setg_errno(errp, errno, "Failed to create KVM VFIO device");
+            return -errno;
+        }
+
+        vfio_kvm_device_fd = cd.fd;
+        /*
+         * If the vm file descriptor changes, add a notifier so that we can
+         * re-create the vfio_kvm_device_fd.
+         */
+        kvm_vmfd_add_change_notifier(&vfio_vmfd_change_notifier);
+    }
+
+    if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
+        error_setg_errno(errp, errno, "Failed to add fd %d to KVM VFIO device",
+                         fd);
+        return -errno;
+    }
+
+    vfio_device_fd_list_add(fd);
+    return 0;
+}
+
+int vfio_kvm_device_del_fd(int fd, Error **errp)
+{
+    struct kvm_device_attr attr = {
+        .group = KVM_DEV_VFIO_FILE,
+        .attr = KVM_DEV_VFIO_FILE_DEL,
+        .addr = (uint64_t)(unsigned long)&fd,
+    };
+
+    if (vfio_kvm_device_fd < 0) {
+        error_setg(errp, "KVM VFIO device isn't created yet");
+        return -EINVAL;
+    }
+
+    if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
+        error_setg_errno(errp, errno,
+                         "Failed to remove fd %d from KVM VFIO device", fd);
+        return -errno;
+    }
+
+    vfio_device_fd_list_remove(fd);
+    return 0;
+}
diff --git a/hw/vfio/kvm-stubs.c b/hw/vfio/kvm-stubs.c
new file mode 100644
index 00000000000..9593287d9c2
--- /dev/null
+++ b/hw/vfio/kvm-stubs.c
@@ -0,0 +1,27 @@
+/*
+ * Stubs for kvm helpers
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include <sys/ioctl.h>
+
+#include "hw/vfio/vfio-device.h"
+#include "qapi/error.h"
+#include "vfio-helpers.h"
+
+void vfio_kvm_device_close(void)
+{
+    return;
+}
+
+int vfio_kvm_device_add_fd(int fd, Error **errp)
+{
+    return 0;
+}
+
+int vfio_kvm_device_del_fd(int fd, Error **errp)
+{
+    return 0;
+}
diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index 82f68698fb8..f32d8573600 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -7,6 +7,8 @@ vfio_ss.add(files(
   'container-legacy.c',
   'helpers.c',
 ))
+vfio_ss.add(when: 'CONFIG_KVM', if_true: files('kvm-helpers.c'),
+                                if_false: files('kvm-stubs.c'))
 vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
   'pci-quirks.c',
-- 
2.47.3



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

* [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
  2026-03-12 22:44 ` [PATCH 1/8] hw/vfio/listener.c: remove CONFIG_KVM Pierrick Bouvier
  2026-03-12 22:44 ` [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c Pierrick Bouvier
@ 2026-03-12 22:44 ` Pierrick Bouvier
  2026-03-13  3:20   ` Philippe Mathieu-Daudé
  2026-03-13  7:43   ` Cédric Le Goater
  2026-03-12 22:44 ` [PATCH 4/8] hw/vfio: eradicate CONFIG_IOMMU from sources Pierrick Bouvier
                   ` (7 subsequent siblings)
  10 siblings, 2 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger, Pierrick Bouvier

Add stubs for needed functions.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
 hw/vfio/pci-quirks.c |  5 -----
 hw/vfio/meson.build  |  3 ++-
 3 files changed, 22 insertions(+), 6 deletions(-)
 create mode 100644 hw/vfio/igd-stubs.c

diff --git a/hw/vfio/igd-stubs.c b/hw/vfio/igd-stubs.c
new file mode 100644
index 00000000000..f7687d90912
--- /dev/null
+++ b/hw/vfio/igd-stubs.c
@@ -0,0 +1,20 @@
+/*
+ * IGD device quirks stubs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qmp/qerror.h"
+#include "pci.h"
+#include "pci-quirks.h"
+
+void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
+{
+    return;
+}
+
+bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
+{
+    return true;
+}
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 7b907b9360d..ab864048943 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -11,7 +11,6 @@
  */
 
 #include "qemu/osdep.h"
-#include CONFIG_DEVICES
 #include "exec/memop.h"
 #include "qemu/units.h"
 #include "qemu/log.h"
@@ -1128,11 +1127,9 @@ static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr)
  */
 bool vfio_config_quirk_setup(VFIOPCIDevice *vdev, Error **errp)
 {
-#ifdef CONFIG_VFIO_IGD
     if (!vfio_probe_igd_config_quirk(vdev, errp)) {
         return false;
     }
-#endif
     return true;
 }
 
@@ -1179,9 +1176,7 @@ void vfio_bar_quirk_setup(VFIOPCIDevice *vdev, int nr)
     vfio_probe_nvidia_bar5_quirk(vdev, nr);
     vfio_probe_nvidia_bar0_quirk(vdev, nr);
     vfio_probe_rtl8168_bar2_quirk(vdev, nr);
-#ifdef CONFIG_VFIO_IGD
     vfio_probe_igd_bar0_quirk(vdev, nr);
-#endif
 }
 
 void vfio_bar_quirk_exit(VFIOPCIDevice *vdev, int nr)
diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index f32d8573600..562ba79d1c0 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
 ))
 vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
-vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
+vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
+                                     if_false: files('igd-stubs.c'))
 
 specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
 
-- 
2.47.3



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

* [PATCH 4/8] hw/vfio: eradicate CONFIG_IOMMU from sources
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
                   ` (2 preceding siblings ...)
  2026-03-12 22:44 ` [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD Pierrick Bouvier
@ 2026-03-12 22:44 ` Pierrick Bouvier
  2026-03-13  7:44   ` Cédric Le Goater
  2026-03-12 22:44 ` [PATCH 5/8] hw/vfio/pci.c: eradicate CONFIG_KVM Pierrick Bouvier
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger, Pierrick Bouvier

As pointed in c1139fa4 "vfio/iommufd: Remove CONFIG_IOMMUFD usage",
iommufd presence can be detected at runtime (through /dev/iommufd) and
we don't need to isolate this at build time.

It's much (much) more simple to expose this inconditionally compared to
build dynamically properties arrays.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/vfio/ap.c  |  9 ---------
 hw/vfio/ccw.c |  9 ---------
 hw/vfio/pci.c | 11 -----------
 3 files changed, 29 deletions(-)

diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index e58a0169af9..856fa2678cd 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -11,7 +11,6 @@
  */
 
 #include "qemu/osdep.h"
-#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
 #include <linux/vfio.h>
 #include <sys/ioctl.h>
 #include "qapi/error.h"
@@ -279,10 +278,8 @@ static void vfio_ap_unrealize(DeviceState *dev)
 
 static const Property vfio_ap_properties[] = {
     DEFINE_PROP_STRING("sysfsdev", VFIOAPDevice, vdev.sysfsdev),
-#ifdef CONFIG_IOMMUFD
     DEFINE_PROP_LINK("iommufd", VFIOAPDevice, vdev.iommufd,
                      TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
-#endif
 };
 
 static void vfio_ap_reset(DeviceState *dev)
@@ -320,21 +317,17 @@ static void vfio_ap_instance_init(Object *obj)
     vbasedev->mdev = true;
 }
 
-#ifdef CONFIG_IOMMUFD
 static void vfio_ap_set_fd(Object *obj, const char *str, Error **errp)
 {
     vfio_device_set_fd(&VFIO_AP_DEVICE(obj)->vdev, str, errp);
 }
-#endif
 
 static void vfio_ap_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     device_class_set_props(dc, vfio_ap_properties);
-#ifdef CONFIG_IOMMUFD
     object_class_property_add_str(klass, "fd", NULL, vfio_ap_set_fd);
-#endif
     dc->vmsd = &vfio_ap_vmstate;
     dc->desc = "VFIO-based AP device assignment";
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
@@ -347,11 +340,9 @@ static void vfio_ap_class_init(ObjectClass *klass, const void *data)
     object_class_property_set_description(klass, /* 3.1 */
                                           "sysfsdev",
                                           "Host sysfs path of assigned device");
-#ifdef CONFIG_IOMMUFD
     object_class_property_set_description(klass, /* 9.0 */
                                           "iommufd",
                                           "Set host IOMMUFD backend device");
-#endif
 }
 
 static const TypeInfo vfio_ap_info = {
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 2251facb356..c66f42a13c2 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -15,7 +15,6 @@
  */
 
 #include "qemu/osdep.h"
-#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
 #include <linux/vfio.h>
 #include <linux/vfio_ccw.h>
 #include <sys/ioctl.h>
@@ -647,10 +646,8 @@ static void vfio_ccw_unrealize(DeviceState *dev)
 static const Property vfio_ccw_properties[] = {
     DEFINE_PROP_STRING("sysfsdev", VFIOCCWDevice, vdev.sysfsdev),
     DEFINE_PROP_BOOL("force-orb-pfch", VFIOCCWDevice, force_orb_pfch, false),
-#ifdef CONFIG_IOMMUFD
     DEFINE_PROP_LINK("iommufd", VFIOCCWDevice, vdev.iommufd,
                      TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
-#endif
     DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm),
 };
 
@@ -679,12 +676,10 @@ static void vfio_ccw_instance_init(Object *obj)
                      DEVICE(vcdev), true);
 }
 
-#ifdef CONFIG_IOMMUFD
 static void vfio_ccw_set_fd(Object *obj, const char *str, Error **errp)
 {
     vfio_device_set_fd(&VFIO_CCW(obj)->vdev, str, errp);
 }
-#endif
 
 static void vfio_ccw_class_init(ObjectClass *klass, const void *data)
 {
@@ -692,9 +687,7 @@ static void vfio_ccw_class_init(ObjectClass *klass, const void *data)
     S390CCWDeviceClass *cdc = S390_CCW_DEVICE_CLASS(klass);
 
     device_class_set_props(dc, vfio_ccw_properties);
-#ifdef CONFIG_IOMMUFD
     object_class_property_add_str(klass, "fd", NULL, vfio_ccw_set_fd);
-#endif
     dc->vmsd = &vfio_ccw_vmstate;
     dc->desc = "VFIO-based subchannel assignment";
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
@@ -713,11 +706,9 @@ static void vfio_ccw_class_init(ObjectClass *klass, const void *data)
     object_class_property_set_description(klass, /* 3.0 */
                                           "force-orb-pfch",
                                           "Force unlimited prefetch");
-#ifdef CONFIG_IOMMUFD
     object_class_property_set_description(klass, /* 9.0 */
                                           "iommufd",
                                           "Set host IOMMUFD backend device");
-#endif
     object_class_property_set_description(klass, /* 9.2 */
                                           "loadparm",
                                           "Define which devices that can be used for booting");
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 94c174a773f..df617f1fe46 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -19,7 +19,6 @@
  */
 
 #include "qemu/osdep.h"
-#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
 #include <linux/vfio.h>
 #include <sys/ioctl.h>
 
@@ -3471,9 +3470,7 @@ static void vfio_pci_realize(PCIDevice *pdev, Error **errp)
               ~vdev->host.slot || ~vdev->host.function)) {
             error_setg(errp, "No provided host device");
             error_append_hint(errp, "Use -device vfio-pci,host=DDDD:BB:DD.F "
-#ifdef CONFIG_IOMMUFD
                               "or -device vfio-pci,fd=DEVICE_FD "
-#endif
                               "or -device vfio-pci,sysfsdev=PATH_TO_DEVICE\n");
             return;
         }
@@ -3816,22 +3813,18 @@ static const Property vfio_pci_properties[] = {
                                    qdev_prop_nv_gpudirect_clique, uint8_t),
     DEFINE_PROP_OFF_AUTO_PCIBAR("x-msix-relocation", VFIOPCIDevice, msix_relo,
                                 OFF_AUTO_PCIBAR_OFF),
-#ifdef CONFIG_IOMMUFD
     DEFINE_PROP_LINK("iommufd", VFIOPCIDevice, vbasedev.iommufd,
                      TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
-#endif
     DEFINE_PROP_BOOL("skip-vsc-check", VFIOPCIDevice, skip_vsc_check, true),
     DEFINE_PROP_UINT16("x-vpasid-cap-offset", VFIOPCIDevice,
                        vpasid_cap_offset, 0),
 };
 
-#ifdef CONFIG_IOMMUFD
 static void vfio_pci_set_fd(Object *obj, const char *str, Error **errp)
 {
     VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj);
     vfio_device_set_fd(&vdev->vbasedev, str, errp);
 }
-#endif
 
 static void vfio_pci_class_init(ObjectClass *klass, const void *data)
 {
@@ -3840,9 +3833,7 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
 
     device_class_set_legacy_reset(dc, vfio_pci_reset);
     device_class_set_props(dc, vfio_pci_properties);
-#ifdef CONFIG_IOMMUFD
     object_class_property_add_str(klass, "fd", NULL, vfio_pci_set_fd);
-#endif
     dc->vmsd = &vfio_cpr_pci_vmstate;
     dc->desc = "VFIO-based PCI device assignment";
     pdc->realize = vfio_pci_realize;
@@ -3944,11 +3935,9 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
                                           "vf-token",
                                           "Specify UUID VF token. Required for VF when PF is owned "
                                           "by another VFIO driver");
-#ifdef CONFIG_IOMMUFD
     object_class_property_set_description(klass, /* 9.0 */
                                           "iommufd",
                                           "Set host IOMMUFD backend device");
-#endif
     object_class_property_set_description(klass, /* 9.1 */
                                           "x-device-dirty-page-tracking",
                                           "Disable device dirty page tracking and use "
-- 
2.47.3



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

* [PATCH 5/8] hw/vfio/pci.c: eradicate CONFIG_KVM
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
                   ` (3 preceding siblings ...)
  2026-03-12 22:44 ` [PATCH 4/8] hw/vfio: eradicate CONFIG_IOMMU from sources Pierrick Bouvier
@ 2026-03-12 22:44 ` Pierrick Bouvier
  2026-03-13  3:24   ` Philippe Mathieu-Daudé
  2026-03-12 22:44 ` [PATCH 6/8] hw/vfio/ap.c: use full path for target specific header Pierrick Bouvier
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger, Pierrick Bouvier

We just need to add kvm_enabled() guard on concerned functions, but no
need to extract those kvm functions since they are not using any kvm
specific types that would not be visible at compilation time.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/vfio/pci.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index df617f1fe46..62c52407cf9 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -152,7 +152,10 @@ void vfio_pci_intx_eoi(VFIODevice *vbasedev)
 
 static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
 {
-#ifdef CONFIG_KVM
+    if (!kvm_enabled()) {
+        return true;
+    }
+
     PCIDevice *pdev = PCI_DEVICE(vdev);
     int irq_fd = event_notifier_get_fd(&vdev->intx.interrupt);
 
@@ -206,14 +209,14 @@ fail:
     qemu_set_fd_handler(irq_fd, vfio_intx_interrupt, NULL, vdev);
     vfio_device_irq_unmask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
     return false;
-#else
-    return true;
-#endif
 }
 
 static bool vfio_cpr_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
 {
-#ifdef CONFIG_KVM
+    if (!kvm_enabled()) {
+        return true;
+    }
+
     if (vdev->no_kvm_intx || !kvm_irqfds_enabled() ||
         vdev->intx.route.mode != PCI_INTX_ENABLED ||
         !kvm_resamplefds_enabled()) {
@@ -236,14 +239,14 @@ static bool vfio_cpr_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
     vdev->intx.kvm_accel = true;
     trace_vfio_intx_enable_kvm(vdev->vbasedev.name);
     return true;
-#else
-    return true;
-#endif
 }
 
 static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev)
 {
-#ifdef CONFIG_KVM
+    if (!kvm_enabled()) {
+        return;
+    }
+
     PCIDevice *pdev = PCI_DEVICE(vdev);
 
     if (!vdev->intx.kvm_accel) {
@@ -277,7 +280,6 @@ static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev)
     vfio_device_irq_unmask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
 
     trace_vfio_intx_disable_kvm(vdev->vbasedev.name);
-#endif
 }
 
 static void vfio_intx_update(VFIOPCIDevice *vdev, PCIINTxRoute *route)
@@ -350,16 +352,14 @@ static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
     vdev->intx.pin = pin - 1; /* Pin A (1) -> irq[0] */
     pci_config_set_interrupt_pin(pdev->config, pin);
 
-#ifdef CONFIG_KVM
     /*
      * Only conditional to avoid generating error messages on platforms
      * where we won't actually use the result anyway.
      */
-    if (kvm_irqfds_enabled() && kvm_resamplefds_enabled()) {
+    if (kvm_enabled() && kvm_irqfds_enabled() && kvm_resamplefds_enabled()) {
         vdev->intx.route = pci_device_route_intx_to_irq(pdev,
                                                         vdev->intx.pin);
     }
-#endif
 
     if (!vfio_notifier_init(vdev, &vdev->intx.interrupt, "intx-interrupt", 0,
                             errp)) {
-- 
2.47.3



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

* [PATCH 6/8] hw/vfio/ap.c: use full path for target specific header
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
                   ` (4 preceding siblings ...)
  2026-03-12 22:44 ` [PATCH 5/8] hw/vfio/pci.c: eradicate CONFIG_KVM Pierrick Bouvier
@ 2026-03-12 22:44 ` Pierrick Bouvier
  2026-03-13  3:26   ` Philippe Mathieu-Daudé
  2026-03-13  7:45   ` Cédric Le Goater
  2026-03-12 22:44 ` [PATCH 7/8] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c Pierrick Bouvier
                   ` (4 subsequent siblings)
  10 siblings, 2 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger, Pierrick Bouvier

In addition, we fix target/s390x/kvm/kvm_s390x.h cpu-qom include also.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 target/s390x/kvm/kvm_s390x.h | 2 +-
 hw/vfio/ap.c                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/s390x/kvm/kvm_s390x.h b/target/s390x/kvm/kvm_s390x.h
index 649dae5948a..7b1cce3e60d 100644
--- a/target/s390x/kvm/kvm_s390x.h
+++ b/target/s390x/kvm/kvm_s390x.h
@@ -10,7 +10,7 @@
 #ifndef KVM_S390X_H
 #define KVM_S390X_H
 
-#include "cpu-qom.h"
+#include "target/s390x/cpu-qom.h"
 
 struct kvm_s390_irq;
 
diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index 856fa2678cd..3fae9ae9814 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -25,7 +25,7 @@
 #include "qemu/module.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
-#include "kvm/kvm_s390x.h"
+#include "target/s390x/kvm/kvm_s390x.h"
 #include "migration/vmstate.h"
 #include "hw/core/qdev-properties.h"
 #include "hw/s390x/ap-bridge.h"
-- 
2.47.3



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

* [PATCH 7/8] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
                   ` (5 preceding siblings ...)
  2026-03-12 22:44 ` [PATCH 6/8] hw/vfio/ap.c: use full path for target specific header Pierrick Bouvier
@ 2026-03-12 22:44 ` Pierrick Bouvier
  2026-03-13  3:28   ` Philippe Mathieu-Daudé
  2026-03-13  3:29   ` Philippe Mathieu-Daudé
  2026-03-12 22:44 ` [PATCH 8/8] hw/vfio: all vfio files can now be common files Pierrick Bouvier
                   ` (3 subsequent siblings)
  10 siblings, 2 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger, Pierrick Bouvier

Since this function needs kvm specific types, we need to extract in
another file and link it only for KVM builds.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/vfio/kvm-spapr.h | 12 ++++++++++++
 hw/vfio/kvm-spapr.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
 hw/vfio/kvm-stubs.c |  8 ++++++++
 hw/vfio/spapr.c     | 30 ++++-------------------------
 hw/vfio/meson.build |  1 +
 5 files changed, 72 insertions(+), 26 deletions(-)
 create mode 100644 hw/vfio/kvm-spapr.h
 create mode 100644 hw/vfio/kvm-spapr.c

diff --git a/hw/vfio/kvm-spapr.h b/hw/vfio/kvm-spapr.h
new file mode 100644
index 00000000000..1a7697a07a8
--- /dev/null
+++ b/hw/vfio/kvm-spapr.h
@@ -0,0 +1,12 @@
+/*
+ * Vfio spapr kvm specific functions
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "hw/vfio/vfio-container.h"
+#include "qapi/error.h"
+
+bool vfio_spapr_kvm_attach_tce(VFIOContainer *bcontainer,
+                               MemoryRegionSection *section,
+                               Error **errp);
diff --git a/hw/vfio/kvm-spapr.c b/hw/vfio/kvm-spapr.c
new file mode 100644
index 00000000000..6b9d04298c5
--- /dev/null
+++ b/hw/vfio/kvm-spapr.c
@@ -0,0 +1,47 @@
+/*
+ * Vfio spapr kvm specific functions
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include <sys/ioctl.h>
+#include <linux/vfio.h>
+#include <linux/kvm.h>
+
+#include "hw/vfio/vfio-container-legacy.h"
+#include "hw/vfio/kvm-spapr.h"
+#include "qapi/error.h"
+#include "trace.h"
+#include "vfio-helpers.h"
+
+bool vfio_spapr_kvm_attach_tce(VFIOContainer *bcontainer,
+                               MemoryRegionSection *section,
+                               Error **errp)
+{
+    VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
+    VFIOGroup *group;
+    IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
+    struct kvm_vfio_spapr_tce param;
+    struct kvm_device_attr attr = {
+        .group = KVM_DEV_VFIO_GROUP,
+        .attr = KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE,
+        .addr = (uint64_t)(unsigned long)&param,
+    };
+
+    if (!memory_region_iommu_get_attr(iommu_mr, IOMMU_ATTR_SPAPR_TCE_FD,
+                &param.tablefd)) {
+        QLIST_FOREACH(group, &container->group_list, container_next) {
+            param.groupfd = group->fd;
+            if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
+                error_setg_errno(errp, errno,
+                        "vfio: failed GROUP_SET_SPAPR_TCE for "
+                        "KVM VFIO device %d and group fd %d",
+                        param.tablefd, param.groupfd);
+                return false;
+            }
+            trace_vfio_spapr_group_attach(param.groupfd, param.tablefd);
+        }
+    }
+    return true;
+}
diff --git a/hw/vfio/kvm-stubs.c b/hw/vfio/kvm-stubs.c
index 9593287d9c2..65aa1ef192c 100644
--- a/hw/vfio/kvm-stubs.c
+++ b/hw/vfio/kvm-stubs.c
@@ -7,6 +7,7 @@
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
 
+#include "hw/vfio/kvm-spapr.h"
 #include "hw/vfio/vfio-device.h"
 #include "qapi/error.h"
 #include "vfio-helpers.h"
@@ -25,3 +26,10 @@ int vfio_kvm_device_del_fd(int fd, Error **errp)
 {
     return 0;
 }
+
+bool vfio_spapr_kvm_attach_tce(VFIOContainer *bcontainer,
+                               MemoryRegionSection *section,
+                               Error **errp)
+{
+    g_assert_not_reached();
+}
diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
index a9f093c3570..42690e4323d 100644
--- a/hw/vfio/spapr.c
+++ b/hw/vfio/spapr.c
@@ -16,6 +16,7 @@
 #include "system/address-spaces.h"
 
 #include "hw/vfio/vfio-container-legacy.h"
+#include "hw/vfio/kvm-spapr.h"
 #include "hw/core/hw-error.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
@@ -406,33 +407,10 @@ vfio_spapr_container_add_section_window(VFIOContainer *bcontainer,
     vfio_host_win_add(scontainer, section->offset_within_address_space,
                       section->offset_within_address_space +
                       int128_get64(section->size) - 1, pgsize);
-#ifdef CONFIG_KVM
-    if (kvm_enabled()) {
-        VFIOGroup *group;
-        IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
-        struct kvm_vfio_spapr_tce param;
-        struct kvm_device_attr attr = {
-            .group = KVM_DEV_VFIO_GROUP,
-            .attr = KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE,
-            .addr = (uint64_t)(unsigned long)&param,
-        };
-
-        if (!memory_region_iommu_get_attr(iommu_mr, IOMMU_ATTR_SPAPR_TCE_FD,
-                                          &param.tablefd)) {
-            QLIST_FOREACH(group, &container->group_list, container_next) {
-                param.groupfd = group->fd;
-                if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
-                    error_setg_errno(errp, errno,
-                                     "vfio: failed GROUP_SET_SPAPR_TCE for "
-                                     "KVM VFIO device %d and group fd %d",
-                                     param.tablefd, param.groupfd);
-                    return false;
-                }
-                trace_vfio_spapr_group_attach(param.groupfd, param.tablefd);
-            }
-        }
+    if (kvm_enabled() && !vfio_spapr_kvm_attach_tce(bcontainer, section, errp)) {
+        return false;
     }
-#endif
+
     return true;
 }
 
diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index 562ba79d1c0..06e24122c5c 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -10,6 +10,7 @@ vfio_ss.add(files(
 vfio_ss.add(when: 'CONFIG_KVM', if_true: files('kvm-helpers.c'),
                                 if_false: files('kvm-stubs.c'))
 vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))
+vfio_ss.add(when: ['CONFIG_KVM', 'CONFIG_PSERIES'], if_true: files('kvm-spapr.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
   'pci-quirks.c',
   'pci.c',
-- 
2.47.3



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

* [PATCH 8/8] hw/vfio: all vfio files can now be common files
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
                   ` (6 preceding siblings ...)
  2026-03-12 22:44 ` [PATCH 7/8] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c Pierrick Bouvier
@ 2026-03-12 22:44 ` Pierrick Bouvier
  2026-03-13  3:30   ` Philippe Mathieu-Daudé
  2026-03-13  5:32 ` [PATCH 0/8] hw/vfio: single-binary Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger, Pierrick Bouvier

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/vfio/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index 06e24122c5c..4553aed6a6f 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -20,7 +20,7 @@ vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
                                      if_false: files('igd-stubs.c'))
 
-specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
+system_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
 
 system_ss.add(when: 'CONFIG_VFIO', if_true: files(
   'cpr.c',
-- 
2.47.3



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

* Re: [PATCH 1/8] hw/vfio/listener.c: remove CONFIG_KVM
  2026-03-12 22:44 ` [PATCH 1/8] hw/vfio/listener.c: remove CONFIG_KVM Pierrick Bouvier
@ 2026-03-13  3:16   ` Philippe Mathieu-Daudé
  2026-03-13  7:41   ` Cédric Le Goater
  1 sibling, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:16 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> Code concerned is under a kvm_enabled() guard.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/listener.c | 4 ----
>   1 file changed, 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


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

* Re: [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c
  2026-03-12 22:44 ` [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c Pierrick Bouvier
@ 2026-03-13  3:17   ` Philippe Mathieu-Daudé
  2026-03-13  3:18   ` Philippe Mathieu-Daudé
  2026-03-13  7:42   ` Cédric Le Goater
  2 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:17 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> Because those functions use kvm specific types, they need to be isolated
> in another source file.
> This allows us to link kvm-helpers only in configurations with
> CONFIG_KVM.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/helpers.c     | 172 -------------------------------------
>   hw/vfio/kvm-helpers.c | 192 ++++++++++++++++++++++++++++++++++++++++++
>   hw/vfio/kvm-stubs.c   |  27 ++++++
>   hw/vfio/meson.build   |   2 +
>   4 files changed, 221 insertions(+), 172 deletions(-)
>   create mode 100644 hw/vfio/kvm-helpers.c
>   create mode 100644 hw/vfio/kvm-stubs.c

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


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

* Re: [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c
  2026-03-12 22:44 ` [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c Pierrick Bouvier
  2026-03-13  3:17   ` Philippe Mathieu-Daudé
@ 2026-03-13  3:18   ` Philippe Mathieu-Daudé
  2026-03-13 16:17     ` Pierrick Bouvier
  2026-03-13  7:42   ` Cédric Le Goater
  2 siblings, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:18 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> Because those functions use kvm specific types, they need to be isolated
> in another source file.
> This allows us to link kvm-helpers only in configurations with
> CONFIG_KVM.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/helpers.c     | 172 -------------------------------------
>   hw/vfio/kvm-helpers.c | 192 ++++++++++++++++++++++++++++++++++++++++++
>   hw/vfio/kvm-stubs.c   |  27 ++++++
>   hw/vfio/meson.build   |   2 +
>   4 files changed, 221 insertions(+), 172 deletions(-)
>   create mode 100644 hw/vfio/kvm-helpers.c
>   create mode 100644 hw/vfio/kvm-stubs.c


> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
> index 82f68698fb8..f32d8573600 100644
> --- a/hw/vfio/meson.build
> +++ b/hw/vfio/meson.build
> @@ -7,6 +7,8 @@ vfio_ss.add(files(
>     'container-legacy.c',
>     'helpers.c',
>   ))
> +vfio_ss.add(when: 'CONFIG_KVM', if_true: files('kvm-helpers.c'),
> +                                if_false: files('kvm-stubs.c'))

Directly add to global stubs source set:

   stub_ss.addfiles('kvm-stubs.c'))

>   vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))
>   vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>     'pci-quirks.c',



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

* Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
  2026-03-12 22:44 ` [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD Pierrick Bouvier
@ 2026-03-13  3:20   ` Philippe Mathieu-Daudé
  2026-03-13 16:17     ` Pierrick Bouvier
  2026-03-15  2:57     ` Pierrick Bouvier
  2026-03-13  7:43   ` Cédric Le Goater
  1 sibling, 2 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:20 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> Add stubs for needed functions.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>   hw/vfio/pci-quirks.c |  5 -----
>   hw/vfio/meson.build  |  3 ++-
>   3 files changed, 22 insertions(+), 6 deletions(-)
>   create mode 100644 hw/vfio/igd-stubs.c


> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
> index f32d8573600..562ba79d1c0 100644
> --- a/hw/vfio/meson.build
> +++ b/hw/vfio/meson.build
> @@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>   ))
>   vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
>   vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
> -vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
> +vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
> +                                     if_false: files('igd-stubs.c'))

Directly add to global stubs source set, otherwise:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


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

* Re: [PATCH 5/8] hw/vfio/pci.c: eradicate CONFIG_KVM
  2026-03-12 22:44 ` [PATCH 5/8] hw/vfio/pci.c: eradicate CONFIG_KVM Pierrick Bouvier
@ 2026-03-13  3:24   ` Philippe Mathieu-Daudé
  2026-03-13 16:19     ` Pierrick Bouvier
  0 siblings, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:24 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> We just need to add kvm_enabled() guard on concerned functions, but no
> need to extract those kvm functions since they are not using any kvm
> specific types that would not be visible at compilation time.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/pci.c | 26 +++++++++++++-------------
>   1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index df617f1fe46..62c52407cf9 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -152,7 +152,10 @@ void vfio_pci_intx_eoi(VFIODevice *vbasedev)
>   
>   static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
>   {
> -#ifdef CONFIG_KVM
> +    if (!kvm_enabled()) {

I'd rather this check done in callers, and here assert on entry:

        assert(kvm_enabled());

(Applies to other changes in this patch).

But this "call KVM-specific helper even if KVM isn't used" pattern
is pre-existing, so can be done later:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> +        return true;
> +    }



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

* Re: [PATCH 6/8] hw/vfio/ap.c: use full path for target specific header
  2026-03-12 22:44 ` [PATCH 6/8] hw/vfio/ap.c: use full path for target specific header Pierrick Bouvier
@ 2026-03-13  3:26   ` Philippe Mathieu-Daudé
  2026-03-13  5:50     ` Pierrick Bouvier
  2026-03-13  7:45   ` Cédric Le Goater
  1 sibling, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:26 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> In addition, we fix target/s390x/kvm/kvm_s390x.h cpu-qom include also.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   target/s390x/kvm/kvm_s390x.h | 2 +-
>   hw/vfio/ap.c                 | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/s390x/kvm/kvm_s390x.h b/target/s390x/kvm/kvm_s390x.h
> index 649dae5948a..7b1cce3e60d 100644
> --- a/target/s390x/kvm/kvm_s390x.h
> +++ b/target/s390x/kvm/kvm_s390x.h
> @@ -10,7 +10,7 @@
>   #ifndef KVM_S390X_H
>   #define KVM_S390X_H
>   
> -#include "cpu-qom.h"
> +#include "target/s390x/cpu-qom.h"

Yeah, I've been tempted to do that globally with a script, then remove
the various '-Itarget/foo/' from CPPFLAGs, but not a priority.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH 7/8] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c
  2026-03-12 22:44 ` [PATCH 7/8] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c Pierrick Bouvier
@ 2026-03-13  3:28   ` Philippe Mathieu-Daudé
  2026-03-13  3:29   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:28 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> Since this function needs kvm specific types, we need to extract in
> another file and link it only for KVM builds.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/kvm-spapr.h | 12 ++++++++++++
>   hw/vfio/kvm-spapr.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
>   hw/vfio/kvm-stubs.c |  8 ++++++++
>   hw/vfio/spapr.c     | 30 ++++-------------------------
>   hw/vfio/meson.build |  1 +
>   5 files changed, 72 insertions(+), 26 deletions(-)
>   create mode 100644 hw/vfio/kvm-spapr.h
>   create mode 100644 hw/vfio/kvm-spapr.c


> @@ -406,33 +407,10 @@ vfio_spapr_container_add_section_window(VFIOContainer *bcontainer,
>       vfio_host_win_add(scontainer, section->offset_within_address_space,
>                         section->offset_within_address_space +
>                         int128_get64(section->size) - 1, pgsize);
> -#ifdef CONFIG_KVM
> -    if (kvm_enabled()) {
> -        VFIOGroup *group;
> -        IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
> -        struct kvm_vfio_spapr_tce param;
> -        struct kvm_device_attr attr = {
> -            .group = KVM_DEV_VFIO_GROUP,
> -            .attr = KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE,
> -            .addr = (uint64_t)(unsigned long)&param,
> -        };
> -
> -        if (!memory_region_iommu_get_attr(iommu_mr, IOMMU_ATTR_SPAPR_TCE_FD,
> -                                          &param.tablefd)) {
> -            QLIST_FOREACH(group, &container->group_list, container_next) {
> -                param.groupfd = group->fd;
> -                if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
> -                    error_setg_errno(errp, errno,
> -                                     "vfio: failed GROUP_SET_SPAPR_TCE for "
> -                                     "KVM VFIO device %d and group fd %d",
> -                                     param.tablefd, param.groupfd);
> -                    return false;
> -                }
> -                trace_vfio_spapr_group_attach(param.groupfd, param.tablefd);
> -            }
> -        }
> +    if (kvm_enabled() && !vfio_spapr_kvm_attach_tce(bcontainer, section, errp)) {

This is the kvm_enabled() check in caller kind I'm asking in patch 5 ;)
(It feels more natural to me when reviewing).

> +        return false;
>       }
> -#endif

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH 7/8] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c
  2026-03-12 22:44 ` [PATCH 7/8] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c Pierrick Bouvier
  2026-03-13  3:28   ` Philippe Mathieu-Daudé
@ 2026-03-13  3:29   ` Philippe Mathieu-Daudé
  2026-03-13 16:19     ` Pierrick Bouvier
  1 sibling, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:29 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> Since this function needs kvm specific types, we need to extract in
> another file and link it only for KVM builds.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/kvm-spapr.h | 12 ++++++++++++
>   hw/vfio/kvm-spapr.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
>   hw/vfio/kvm-stubs.c |  8 ++++++++
>   hw/vfio/spapr.c     | 30 ++++-------------------------
>   hw/vfio/meson.build |  1 +
>   5 files changed, 72 insertions(+), 26 deletions(-)
>   create mode 100644 hw/vfio/kvm-spapr.h
>   create mode 100644 hw/vfio/kvm-spapr.c
> 
> diff --git a/hw/vfio/kvm-spapr.h b/hw/vfio/kvm-spapr.h
> new file mode 100644
> index 00000000000..1a7697a07a8
> --- /dev/null
> +++ b/hw/vfio/kvm-spapr.h
> @@ -0,0 +1,12 @@
> +/*
> + * Vfio spapr kvm specific functions

      "VFIO sPAPR KVM specific functions"

> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */



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

* Re: [PATCH 8/8] hw/vfio: all vfio files can now be common files
  2026-03-12 22:44 ` [PATCH 8/8] hw/vfio: all vfio files can now be common files Pierrick Bouvier
@ 2026-03-13  3:30   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:30 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
> index 06e24122c5c..4553aed6a6f 100644
> --- a/hw/vfio/meson.build
> +++ b/hw/vfio/meson.build
> @@ -20,7 +20,7 @@ vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
>   vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
>                                        if_false: files('igd-stubs.c'))
>   
> -specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
> +system_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)

Yay \o/

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH 0/8] hw/vfio: single-binary
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
                   ` (7 preceding siblings ...)
  2026-03-12 22:44 ` [PATCH 8/8] hw/vfio: all vfio files can now be common files Pierrick Bouvier
@ 2026-03-13  5:32 ` Philippe Mathieu-Daudé
  2026-03-13 16:21   ` Pierrick Bouvier
  2026-03-13  7:50 ` Cédric Le Goater
  2026-03-15  7:11 ` Pierrick Bouvier
  10 siblings, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  5:32 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 12/3/26 23:44, Pierrick Bouvier wrote:
> This series makes changes to hw/vfio to compile files only once.
> Changes are pretty straightforward and are mostly extraction of kvm/other config
> specific functions to proper files.
> This is the last hw/* subsystem that needs to be changed for single-binary.

There is another file in hw/s390x:

../../hw/s390x/s390-pci-vfio.c: In function ‘s390_pci_read_base’:
../../hw/s390x/s390-pci-vfio.c:153:52: error: ‘TARGET_PAGE_BITS’ 
undeclared (first use in this function); did you mean ‘TARGET_LONG_BITS’?
   153 |         vfio_size = pbdev->iommu->max_dma_limit << 
TARGET_PAGE_BITS;
       |                                                    ^~~~~~~~~~~~~~~~
       |                                                    TARGET_LONG_BITS



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

* Re: [PATCH 6/8] hw/vfio/ap.c: use full path for target specific header
  2026-03-13  3:26   ` Philippe Mathieu-Daudé
@ 2026-03-13  5:50     ` Pierrick Bouvier
  0 siblings, 0 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-13  5:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 3/12/26 8:26 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:44, Pierrick Bouvier wrote:
>> In addition, we fix target/s390x/kvm/kvm_s390x.h cpu-qom include also.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    target/s390x/kvm/kvm_s390x.h | 2 +-
>>    hw/vfio/ap.c                 | 2 +-
>>    2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/target/s390x/kvm/kvm_s390x.h b/target/s390x/kvm/kvm_s390x.h
>> index 649dae5948a..7b1cce3e60d 100644
>> --- a/target/s390x/kvm/kvm_s390x.h
>> +++ b/target/s390x/kvm/kvm_s390x.h
>> @@ -10,7 +10,7 @@
>>    #ifndef KVM_S390X_H
>>    #define KVM_S390X_H
>>    
>> -#include "cpu-qom.h"
>> +#include "target/s390x/cpu-qom.h"
> 
> Yeah, I've been tempted to do that globally with a script, then remove
> the various '-Itarget/foo/' from CPPFLAGs, but not a priority.
>

Crossed my mind in the past also. But it's probably easier to do that on 
a per need basis, like here.

> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 



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

* Re: [PATCH 1/8] hw/vfio/listener.c: remove CONFIG_KVM
  2026-03-12 22:44 ` [PATCH 1/8] hw/vfio/listener.c: remove CONFIG_KVM Pierrick Bouvier
  2026-03-13  3:16   ` Philippe Mathieu-Daudé
@ 2026-03-13  7:41   ` Cédric Le Goater
  1 sibling, 0 replies; 35+ messages in thread
From: Cédric Le Goater @ 2026-03-13  7:41 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Richard Henderson, eric.auger

On 3/12/26 23:44, Pierrick Bouvier wrote:
> Code concerned is under a kvm_enabled() guard.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/listener.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
> index 960da9e0a93..31c3113f8fb 100644
> --- a/hw/vfio/listener.c
> +++ b/hw/vfio/listener.c
> @@ -20,9 +20,7 @@
>   
>   #include "qemu/osdep.h"
>   #include <sys/ioctl.h>
> -#ifdef CONFIG_KVM
>   #include <linux/kvm.h>
> -#endif
>   #include <linux/vfio.h>
>   
>   #include "exec/target_page.h"
> @@ -303,11 +301,9 @@ static bool vfio_ram_discard_register_listener(VFIOContainer *bcontainer,
>       if (bcontainer->dma_max_mappings) {
>           unsigned int vrdl_count = 0, vrdl_mappings = 0, max_memslots = 512;
>   
> -#ifdef CONFIG_KVM
>           if (kvm_enabled()) {
>               max_memslots = kvm_get_max_memslots();
>           }
> -#endif
>   
>           QLIST_FOREACH(vrdl, &bcontainer->vrdl_list, next) {
>               hwaddr start, end;

Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.



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

* Re: [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c
  2026-03-12 22:44 ` [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c Pierrick Bouvier
  2026-03-13  3:17   ` Philippe Mathieu-Daudé
  2026-03-13  3:18   ` Philippe Mathieu-Daudé
@ 2026-03-13  7:42   ` Cédric Le Goater
  2 siblings, 0 replies; 35+ messages in thread
From: Cédric Le Goater @ 2026-03-13  7:42 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Richard Henderson, eric.auger

On 3/12/26 23:44, Pierrick Bouvier wrote:
> Because those functions use kvm specific types, they need to be isolated
> in another source file.
> This allows us to link kvm-helpers only in configurations with
> CONFIG_KVM.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/helpers.c     | 172 -------------------------------------
>   hw/vfio/kvm-helpers.c | 192 ++++++++++++++++++++++++++++++++++++++++++
>   hw/vfio/kvm-stubs.c   |  27 ++++++
>   hw/vfio/meson.build   |   2 +
>   4 files changed, 221 insertions(+), 172 deletions(-)
>   create mode 100644 hw/vfio/kvm-helpers.c
>   create mode 100644 hw/vfio/kvm-stubs.c




Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.



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

* Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
  2026-03-12 22:44 ` [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD Pierrick Bouvier
  2026-03-13  3:20   ` Philippe Mathieu-Daudé
@ 2026-03-13  7:43   ` Cédric Le Goater
  1 sibling, 0 replies; 35+ messages in thread
From: Cédric Le Goater @ 2026-03-13  7:43 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Richard Henderson, eric.auger

On 3/12/26 23:44, Pierrick Bouvier wrote:
> Add stubs for needed functions.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>   hw/vfio/pci-quirks.c |  5 -----
>   hw/vfio/meson.build  |  3 ++-
>   3 files changed, 22 insertions(+), 6 deletions(-)
>   create mode 100644 hw/vfio/igd-stubs.c
Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.



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

* Re: [PATCH 4/8] hw/vfio: eradicate CONFIG_IOMMU from sources
  2026-03-12 22:44 ` [PATCH 4/8] hw/vfio: eradicate CONFIG_IOMMU from sources Pierrick Bouvier
@ 2026-03-13  7:44   ` Cédric Le Goater
  0 siblings, 0 replies; 35+ messages in thread
From: Cédric Le Goater @ 2026-03-13  7:44 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Richard Henderson, eric.auger

On 3/12/26 23:44, Pierrick Bouvier wrote:
> As pointed in c1139fa4 "vfio/iommufd: Remove CONFIG_IOMMUFD usage",
> iommufd presence can be detected at runtime (through /dev/iommufd) and
> we don't need to isolate this at build time.
> 
> It's much (much) more simple to expose this inconditionally compared to
> build dynamically properties arrays.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/ap.c  |  9 ---------
>   hw/vfio/ccw.c |  9 ---------
>   hw/vfio/pci.c | 11 -----------

Commit c1139fa4 ("vfio/iommufd: Remove CONFIG_IOMMUFD usage") changed
the internal routine vfio_attach_device() where relying on the
vbasedev->iommufd pointer value to determine IOMMUFD support is OK.

What bothers me with this change (which I like OTOH) is that it is
exposing IOMMUFD support at the UAPI level. But only i386, s390x and
arm have IOMMUFD support. Not PPC for instance.

C.


>   3 files changed, 29 deletions(-)
> 
> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
> index e58a0169af9..856fa2678cd 100644
> --- a/hw/vfio/ap.c
> +++ b/hw/vfio/ap.c
> @@ -11,7 +11,6 @@
>    */
>   
>   #include "qemu/osdep.h"
> -#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
>   #include <linux/vfio.h>
>   #include <sys/ioctl.h>
>   #include "qapi/error.h"
> @@ -279,10 +278,8 @@ static void vfio_ap_unrealize(DeviceState *dev)
>   
>   static const Property vfio_ap_properties[] = {
>       DEFINE_PROP_STRING("sysfsdev", VFIOAPDevice, vdev.sysfsdev),
> -#ifdef CONFIG_IOMMUFD
>       DEFINE_PROP_LINK("iommufd", VFIOAPDevice, vdev.iommufd,
>                        TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
> -#endif
>   };
>   
>   static void vfio_ap_reset(DeviceState *dev)
> @@ -320,21 +317,17 @@ static void vfio_ap_instance_init(Object *obj)
>       vbasedev->mdev = true;
>   }
>   
> -#ifdef CONFIG_IOMMUFD
>   static void vfio_ap_set_fd(Object *obj, const char *str, Error **errp)
>   {
>       vfio_device_set_fd(&VFIO_AP_DEVICE(obj)->vdev, str, errp);
>   }
> -#endif
>   
>   static void vfio_ap_class_init(ObjectClass *klass, const void *data)
>   {
>       DeviceClass *dc = DEVICE_CLASS(klass);
>   
>       device_class_set_props(dc, vfio_ap_properties);
> -#ifdef CONFIG_IOMMUFD
>       object_class_property_add_str(klass, "fd", NULL, vfio_ap_set_fd);
> -#endif
>       dc->vmsd = &vfio_ap_vmstate;
>       dc->desc = "VFIO-based AP device assignment";
>       set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> @@ -347,11 +340,9 @@ static void vfio_ap_class_init(ObjectClass *klass, const void *data)
>       object_class_property_set_description(klass, /* 3.1 */
>                                             "sysfsdev",
>                                             "Host sysfs path of assigned device");
> -#ifdef CONFIG_IOMMUFD
>       object_class_property_set_description(klass, /* 9.0 */
>                                             "iommufd",
>                                             "Set host IOMMUFD backend device");
> -#endif
>   }
>   
>   static const TypeInfo vfio_ap_info = {
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 2251facb356..c66f42a13c2 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -15,7 +15,6 @@
>    */
>   
>   #include "qemu/osdep.h"
> -#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
>   #include <linux/vfio.h>
>   #include <linux/vfio_ccw.h>
>   #include <sys/ioctl.h>
> @@ -647,10 +646,8 @@ static void vfio_ccw_unrealize(DeviceState *dev)
>   static const Property vfio_ccw_properties[] = {
>       DEFINE_PROP_STRING("sysfsdev", VFIOCCWDevice, vdev.sysfsdev),
>       DEFINE_PROP_BOOL("force-orb-pfch", VFIOCCWDevice, force_orb_pfch, false),
> -#ifdef CONFIG_IOMMUFD
>       DEFINE_PROP_LINK("iommufd", VFIOCCWDevice, vdev.iommufd,
>                        TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
> -#endif
>       DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm),
>   };
>   
> @@ -679,12 +676,10 @@ static void vfio_ccw_instance_init(Object *obj)
>                        DEVICE(vcdev), true);
>   }
>   
> -#ifdef CONFIG_IOMMUFD
>   static void vfio_ccw_set_fd(Object *obj, const char *str, Error **errp)
>   {
>       vfio_device_set_fd(&VFIO_CCW(obj)->vdev, str, errp);
>   }
> -#endif
>   
>   static void vfio_ccw_class_init(ObjectClass *klass, const void *data)
>   {
> @@ -692,9 +687,7 @@ static void vfio_ccw_class_init(ObjectClass *klass, const void *data)
>       S390CCWDeviceClass *cdc = S390_CCW_DEVICE_CLASS(klass);
>   
>       device_class_set_props(dc, vfio_ccw_properties);
> -#ifdef CONFIG_IOMMUFD
>       object_class_property_add_str(klass, "fd", NULL, vfio_ccw_set_fd);
> -#endif
>       dc->vmsd = &vfio_ccw_vmstate;
>       dc->desc = "VFIO-based subchannel assignment";
>       set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> @@ -713,11 +706,9 @@ static void vfio_ccw_class_init(ObjectClass *klass, const void *data)
>       object_class_property_set_description(klass, /* 3.0 */
>                                             "force-orb-pfch",
>                                             "Force unlimited prefetch");
> -#ifdef CONFIG_IOMMUFD
>       object_class_property_set_description(klass, /* 9.0 */
>                                             "iommufd",
>                                             "Set host IOMMUFD backend device");
> -#endif
>       object_class_property_set_description(klass, /* 9.2 */
>                                             "loadparm",
>                                             "Define which devices that can be used for booting");
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index 94c174a773f..df617f1fe46 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -19,7 +19,6 @@
>    */
>   
>   #include "qemu/osdep.h"
> -#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
>   #include <linux/vfio.h>
>   #include <sys/ioctl.h>
>   
> @@ -3471,9 +3470,7 @@ static void vfio_pci_realize(PCIDevice *pdev, Error **errp)
>                 ~vdev->host.slot || ~vdev->host.function)) {
>               error_setg(errp, "No provided host device");
>               error_append_hint(errp, "Use -device vfio-pci,host=DDDD:BB:DD.F "
> -#ifdef CONFIG_IOMMUFD
>                                 "or -device vfio-pci,fd=DEVICE_FD "
> -#endif
>                                 "or -device vfio-pci,sysfsdev=PATH_TO_DEVICE\n");
>               return;
>           }
> @@ -3816,22 +3813,18 @@ static const Property vfio_pci_properties[] = {
>                                      qdev_prop_nv_gpudirect_clique, uint8_t),
>       DEFINE_PROP_OFF_AUTO_PCIBAR("x-msix-relocation", VFIOPCIDevice, msix_relo,
>                                   OFF_AUTO_PCIBAR_OFF),
> -#ifdef CONFIG_IOMMUFD
>       DEFINE_PROP_LINK("iommufd", VFIOPCIDevice, vbasedev.iommufd,
>                        TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
> -#endif
>       DEFINE_PROP_BOOL("skip-vsc-check", VFIOPCIDevice, skip_vsc_check, true),
>       DEFINE_PROP_UINT16("x-vpasid-cap-offset", VFIOPCIDevice,
>                          vpasid_cap_offset, 0),
>   };
>   
> -#ifdef CONFIG_IOMMUFD
>   static void vfio_pci_set_fd(Object *obj, const char *str, Error **errp)
>   {
>       VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj);
>       vfio_device_set_fd(&vdev->vbasedev, str, errp);
>   }
> -#endif
>   
>   static void vfio_pci_class_init(ObjectClass *klass, const void *data)
>   {
> @@ -3840,9 +3833,7 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
>   
>       device_class_set_legacy_reset(dc, vfio_pci_reset);
>       device_class_set_props(dc, vfio_pci_properties);
> -#ifdef CONFIG_IOMMUFD
>       object_class_property_add_str(klass, "fd", NULL, vfio_pci_set_fd);
> -#endif
>       dc->vmsd = &vfio_cpr_pci_vmstate;
>       dc->desc = "VFIO-based PCI device assignment";
>       pdc->realize = vfio_pci_realize;
> @@ -3944,11 +3935,9 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
>                                             "vf-token",
>                                             "Specify UUID VF token. Required for VF when PF is owned "
>                                             "by another VFIO driver");
> -#ifdef CONFIG_IOMMUFD
>       object_class_property_set_description(klass, /* 9.0 */
>                                             "iommufd",
>                                             "Set host IOMMUFD backend device");
> -#endif
>       object_class_property_set_description(klass, /* 9.1 */
>                                             "x-device-dirty-page-tracking",
>                                             "Disable device dirty page tracking and use "



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

* Re: [PATCH 6/8] hw/vfio/ap.c: use full path for target specific header
  2026-03-12 22:44 ` [PATCH 6/8] hw/vfio/ap.c: use full path for target specific header Pierrick Bouvier
  2026-03-13  3:26   ` Philippe Mathieu-Daudé
@ 2026-03-13  7:45   ` Cédric Le Goater
  1 sibling, 0 replies; 35+ messages in thread
From: Cédric Le Goater @ 2026-03-13  7:45 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Richard Henderson, eric.auger

On 3/12/26 23:44, Pierrick Bouvier wrote:
> In addition, we fix target/s390x/kvm/kvm_s390x.h cpu-qom include also.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   target/s390x/kvm/kvm_s390x.h | 2 +-
>   hw/vfio/ap.c                 | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/s390x/kvm/kvm_s390x.h b/target/s390x/kvm/kvm_s390x.h
> index 649dae5948a..7b1cce3e60d 100644
> --- a/target/s390x/kvm/kvm_s390x.h
> +++ b/target/s390x/kvm/kvm_s390x.h
> @@ -10,7 +10,7 @@
>   #ifndef KVM_S390X_H
>   #define KVM_S390X_H
>   
> -#include "cpu-qom.h"
> +#include "target/s390x/cpu-qom.h"
>   
>   struct kvm_s390_irq;
>   
> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
> index 856fa2678cd..3fae9ae9814 100644
> --- a/hw/vfio/ap.c
> +++ b/hw/vfio/ap.c
> @@ -25,7 +25,7 @@
>   #include "qemu/module.h"
>   #include "qemu/option.h"
>   #include "qemu/config-file.h"
> -#include "kvm/kvm_s390x.h"
> +#include "target/s390x/kvm/kvm_s390x.h"
>   #include "migration/vmstate.h"
>   #include "hw/core/qdev-properties.h"
>   #include "hw/s390x/ap-bridge.h"

Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.



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

* Re: [PATCH 0/8] hw/vfio: single-binary
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
                   ` (8 preceding siblings ...)
  2026-03-13  5:32 ` [PATCH 0/8] hw/vfio: single-binary Philippe Mathieu-Daudé
@ 2026-03-13  7:50 ` Cédric Le Goater
  2026-03-13  8:32   ` Pierrick Bouvier
  2026-03-15  7:11 ` Pierrick Bouvier
  10 siblings, 1 reply; 35+ messages in thread
From: Cédric Le Goater @ 2026-03-13  7:50 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Richard Henderson, eric.auger

On 3/12/26 23:44, Pierrick Bouvier wrote:
> This series makes changes to hw/vfio to compile files only once.
> Changes are pretty straightforward and are mostly extraction of kvm/other config
> specific functions to proper files.
> This is the last hw/* subsystem that needs to be changed for single-binary.
> 
> Pierrick Bouvier (8):
>    hw/vfio/listener.c: remove CONFIG_KVM
>    hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c
>    hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
>    hw/vfio: eradicate CONFIG_IOMMU from sources
>    hw/vfio/pci.c: eradicate CONFIG_KVM
>    hw/vfio/ap.c: use full path for target specific header
>    hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to
>      hw/vfio/kvm-spapr.c
>    hw/vfio: all vfio files can now be common files
> 
>   hw/vfio/kvm-spapr.h          |  12 +++
>   target/s390x/kvm/kvm_s390x.h |   2 +-
>   hw/vfio/ap.c                 |  11 +-
>   hw/vfio/ccw.c                |   9 --
>   hw/vfio/helpers.c            | 172 -------------------------------
>   hw/vfio/igd-stubs.c          |  20 ++++
>   hw/vfio/kvm-helpers.c        | 192 +++++++++++++++++++++++++++++++++++
>   hw/vfio/kvm-spapr.c          |  47 +++++++++
>   hw/vfio/kvm-stubs.c          |  35 +++++++
>   hw/vfio/listener.c           |   4 -
>   hw/vfio/pci-quirks.c         |   5 -
>   hw/vfio/pci.c                |  37 +++----
>   hw/vfio/spapr.c              |  30 +-----
>   hw/vfio/meson.build          |   8 +-
>   14 files changed, 331 insertions(+), 253 deletions(-)
>   create mode 100644 hw/vfio/kvm-spapr.h
>   create mode 100644 hw/vfio/igd-stubs.c
>   create mode 100644 hw/vfio/kvm-helpers.c
>   create mode 100644 hw/vfio/kvm-spapr.c
>   create mode 100644 hw/vfio/kvm-stubs.c
> 

I am glad we are getting rid of #ifdef CONFIG in the code. I wonder
why we stopped using stubs in the past.

Anyhow, as said, what bothers me with this change (which I like OTOH)
is that it is exposing IOMMUFD support at the UAPI level. But,

1. only i386, s390x and arm have IOMMUFD support. Not PPC for instance.
2. downstream can compile support off

That said, support should reach all platforms one day. So we could
say that relying on a runtime check is preparing the future. I am
not against the change but it needs more thinking on the consequences.
IOW, a bit late for 11.0.

The idea is great. Let's try for 11.1

Thanks,

C.




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

* Re: [PATCH 0/8] hw/vfio: single-binary
  2026-03-13  7:50 ` Cédric Le Goater
@ 2026-03-13  8:32   ` Pierrick Bouvier
  0 siblings, 0 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-13  8:32 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Richard Henderson, eric.auger

On 3/13/26 12:50 AM, Cédric Le Goater wrote:
> On 3/12/26 23:44, Pierrick Bouvier wrote:
>> This series makes changes to hw/vfio to compile files only once.
>> Changes are pretty straightforward and are mostly extraction of kvm/other config
>> specific functions to proper files.
>> This is the last hw/* subsystem that needs to be changed for single-binary.
>>
>> Pierrick Bouvier (8):
>>     hw/vfio/listener.c: remove CONFIG_KVM
>>     hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c
>>     hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
>>     hw/vfio: eradicate CONFIG_IOMMU from sources
>>     hw/vfio/pci.c: eradicate CONFIG_KVM
>>     hw/vfio/ap.c: use full path for target specific header
>>     hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to
>>       hw/vfio/kvm-spapr.c
>>     hw/vfio: all vfio files can now be common files
>>
>>    hw/vfio/kvm-spapr.h          |  12 +++
>>    target/s390x/kvm/kvm_s390x.h |   2 +-
>>    hw/vfio/ap.c                 |  11 +-
>>    hw/vfio/ccw.c                |   9 --
>>    hw/vfio/helpers.c            | 172 -------------------------------
>>    hw/vfio/igd-stubs.c          |  20 ++++
>>    hw/vfio/kvm-helpers.c        | 192 +++++++++++++++++++++++++++++++++++
>>    hw/vfio/kvm-spapr.c          |  47 +++++++++
>>    hw/vfio/kvm-stubs.c          |  35 +++++++
>>    hw/vfio/listener.c           |   4 -
>>    hw/vfio/pci-quirks.c         |   5 -
>>    hw/vfio/pci.c                |  37 +++----
>>    hw/vfio/spapr.c              |  30 +-----
>>    hw/vfio/meson.build          |   8 +-
>>    14 files changed, 331 insertions(+), 253 deletions(-)
>>    create mode 100644 hw/vfio/kvm-spapr.h
>>    create mode 100644 hw/vfio/igd-stubs.c
>>    create mode 100644 hw/vfio/kvm-helpers.c
>>    create mode 100644 hw/vfio/kvm-spapr.c
>>    create mode 100644 hw/vfio/kvm-stubs.c
>>
> 
> I am glad we are getting rid of #ifdef CONFIG in the code. I wonder
> why we stopped using stubs in the past.
>

Probably for convenience. An ifdef is quicker to add, can be more 
readable, and the only downside is that it breaks all possibilities to 
mix several targets in the same binary, which is a new and recent goal.

> Anyhow, as said, what bothers me with this change (which I like OTOH)
> is that it is exposing IOMMUFD support at the UAPI level. But,
> 
> 1. only i386, s390x and arm have IOMMUFD support. Not PPC for instance.
> 2. downstream can compile support off
> 
> That said, support should reach all platforms one day. So we could
> say that relying on a runtime check is preparing the future. I am
> not against the change but it needs more thinking on the consequences.
> IOW, a bit late for 11.0.
>

Sure, I'm posting it now but don't expect to get this merged for this 
release.

The IOMMUFD part is indeed the one debatable in the series. My rationale 
was that, even if it exposes iommufd properties, they won't have any 
effect as long as kernel doesn't have support.
Having played with it in the past, and having discovered that arm64 
kernel defconfig does not enable CONFIG_IOMMUFD, error message is quite 
clear.

If you prefer, we could definitely try to build properties at runtime. 
However, be aware that it's usually less readable (need to build a 
dynamic array) and more clunky than the static const array, since it 
requires a set_X callback instead of setting properties as a field. It's 
usually our last solution resort if exposing things is not possible.

Let me know what you would prefer for it.

> The idea is great. Let's try for 11.1
> 
> Thanks,
> 
> C.
> 
> 

Thanks,
Pierrick


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

* Re: [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c
  2026-03-13  3:18   ` Philippe Mathieu-Daudé
@ 2026-03-13 16:17     ` Pierrick Bouvier
  0 siblings, 0 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-13 16:17 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 3/12/26 8:18 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:44, Pierrick Bouvier wrote:
>> Because those functions use kvm specific types, they need to be isolated
>> in another source file.
>> This allows us to link kvm-helpers only in configurations with
>> CONFIG_KVM.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    hw/vfio/helpers.c     | 172 -------------------------------------
>>    hw/vfio/kvm-helpers.c | 192 ++++++++++++++++++++++++++++++++++++++++++
>>    hw/vfio/kvm-stubs.c   |  27 ++++++
>>    hw/vfio/meson.build   |   2 +
>>    4 files changed, 221 insertions(+), 172 deletions(-)
>>    create mode 100644 hw/vfio/kvm-helpers.c
>>    create mode 100644 hw/vfio/kvm-stubs.c
> 
> 
>> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
>> index 82f68698fb8..f32d8573600 100644
>> --- a/hw/vfio/meson.build
>> +++ b/hw/vfio/meson.build
>> @@ -7,6 +7,8 @@ vfio_ss.add(files(
>>      'container-legacy.c',
>>      'helpers.c',
>>    ))
>> +vfio_ss.add(when: 'CONFIG_KVM', if_true: files('kvm-helpers.c'),
>> +                                if_false: files('kvm-stubs.c'))
> 
> Directly add to global stubs source set:
> 
>     stub_ss.addfiles('kvm-stubs.c'))
> 
>>    vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))
>>    vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>>      'pci-quirks.c',
> 

Good idea, will do that!


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

* Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
  2026-03-13  3:20   ` Philippe Mathieu-Daudé
@ 2026-03-13 16:17     ` Pierrick Bouvier
  2026-03-15  2:57     ` Pierrick Bouvier
  1 sibling, 0 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-13 16:17 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 3/12/26 8:20 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:44, Pierrick Bouvier wrote:
>> Add stubs for needed functions.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>>    hw/vfio/pci-quirks.c |  5 -----
>>    hw/vfio/meson.build  |  3 ++-
>>    3 files changed, 22 insertions(+), 6 deletions(-)
>>    create mode 100644 hw/vfio/igd-stubs.c
> 
> 
>> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
>> index f32d8573600..562ba79d1c0 100644
>> --- a/hw/vfio/meson.build
>> +++ b/hw/vfio/meson.build
>> @@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>>    ))
>>    vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
>>    vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
>> -vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
>> +vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
>> +                                     if_false: files('igd-stubs.c'))
> 
> Directly add to global stubs source set, otherwise:
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Will do it too, thanks.


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

* Re: [PATCH 5/8] hw/vfio/pci.c: eradicate CONFIG_KVM
  2026-03-13  3:24   ` Philippe Mathieu-Daudé
@ 2026-03-13 16:19     ` Pierrick Bouvier
  0 siblings, 0 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-13 16:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 3/12/26 8:24 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:44, Pierrick Bouvier wrote:
>> We just need to add kvm_enabled() guard on concerned functions, but no
>> need to extract those kvm functions since they are not using any kvm
>> specific types that would not be visible at compilation time.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    hw/vfio/pci.c | 26 +++++++++++++-------------
>>    1 file changed, 13 insertions(+), 13 deletions(-)
>>
>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>> index df617f1fe46..62c52407cf9 100644
>> --- a/hw/vfio/pci.c
>> +++ b/hw/vfio/pci.c
>> @@ -152,7 +152,10 @@ void vfio_pci_intx_eoi(VFIODevice *vbasedev)
>>    
>>    static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
>>    {
>> -#ifdef CONFIG_KVM
>> +    if (!kvm_enabled()) {
> 
> I'd rather this check done in callers, and here assert on entry:
> 
>          assert(kvm_enabled());
> 
> (Applies to other changes in this patch).
> 
> But this "call KVM-specific helper even if KVM isn't used" pattern
> is pre-existing, so can be done later:
>

Indeed, I followed the existing convention.
But over all, it's safer, and would allow to implement the stubs as 
g_assert_not_reached(), so I'll do the change.

> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
>> +        return true;
>> +    }
> 


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

* Re: [PATCH 7/8] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c
  2026-03-13  3:29   ` Philippe Mathieu-Daudé
@ 2026-03-13 16:19     ` Pierrick Bouvier
  0 siblings, 0 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-13 16:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 3/12/26 8:29 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:44, Pierrick Bouvier wrote:
>> Since this function needs kvm specific types, we need to extract in
>> another file and link it only for KVM builds.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    hw/vfio/kvm-spapr.h | 12 ++++++++++++
>>    hw/vfio/kvm-spapr.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
>>    hw/vfio/kvm-stubs.c |  8 ++++++++
>>    hw/vfio/spapr.c     | 30 ++++-------------------------
>>    hw/vfio/meson.build |  1 +
>>    5 files changed, 72 insertions(+), 26 deletions(-)
>>    create mode 100644 hw/vfio/kvm-spapr.h
>>    create mode 100644 hw/vfio/kvm-spapr.c
>>
>> diff --git a/hw/vfio/kvm-spapr.h b/hw/vfio/kvm-spapr.h
>> new file mode 100644
>> index 00000000000..1a7697a07a8
>> --- /dev/null
>> +++ b/hw/vfio/kvm-spapr.h
>> @@ -0,0 +1,12 @@
>> +/*
>> + * Vfio spapr kvm specific functions
> 
>        "VFIO sPAPR KVM specific functions"
>

I'll update it, thanks.

>> + *
>> + * SPDX-License-Identifier: GPL-2.0-or-later
>> + */
> 



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

* Re: [PATCH 0/8] hw/vfio: single-binary
  2026-03-13  5:32 ` [PATCH 0/8] hw/vfio: single-binary Philippe Mathieu-Daudé
@ 2026-03-13 16:21   ` Pierrick Bouvier
  0 siblings, 0 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-13 16:21 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 3/12/26 10:32 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:44, Pierrick Bouvier wrote:
>> This series makes changes to hw/vfio to compile files only once.
>> Changes are pretty straightforward and are mostly extraction of kvm/other config
>> specific functions to proper files.
>> This is the last hw/* subsystem that needs to be changed for single-binary.
> 
> There is another file in hw/s390x:
> 
> ../../hw/s390x/s390-pci-vfio.c: In function ‘s390_pci_read_base’:
> ../../hw/s390x/s390-pci-vfio.c:153:52: error: ‘TARGET_PAGE_BITS’
> undeclared (first use in this function); did you mean ‘TARGET_LONG_BITS’?
>     153 |         vfio_size = pbdev->iommu->max_dma_limit <<
> TARGET_PAGE_BITS;
>         |                                                    ^~~~~~~~~~~~~~~~
>         |                                                    TARGET_LONG_BITS
> 

Thanks for changing it in your series.


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

* Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
  2026-03-13  3:20   ` Philippe Mathieu-Daudé
  2026-03-13 16:17     ` Pierrick Bouvier
@ 2026-03-15  2:57     ` Pierrick Bouvier
  2026-03-15 16:47       ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-15  2:57 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 3/12/26 8:20 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:44, Pierrick Bouvier wrote:
>> Add stubs for needed functions.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>>    hw/vfio/pci-quirks.c |  5 -----
>>    hw/vfio/meson.build  |  3 ++-
>>    3 files changed, 22 insertions(+), 6 deletions(-)
>>    create mode 100644 hw/vfio/igd-stubs.c
> 
> 
>> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
>> index f32d8573600..562ba79d1c0 100644
>> --- a/hw/vfio/meson.build
>> +++ b/hw/vfio/meson.build
>> @@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>>    ))
>>    vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
>>    vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
>> -vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
>> +vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
>> +                                     if_false: files('igd-stubs.c'))
> 
> Directly add to global stubs source set, otherwise:
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

To share some information, using the global stub mechanism instead of 
subsystem ones makes one difference: some dependencies are not included. 
In the case of this stub file, pixman.h and epoxy/gl.h are transitively 
included, which is solved by adding those dependencies to qemuutil library.

Nothing too complex, but just worth mentioning in case you ran into an 
issue similar for other stubs.

Regards,
Pierrick


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

* Re: [PATCH 0/8] hw/vfio: single-binary
  2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
                   ` (9 preceding siblings ...)
  2026-03-13  7:50 ` Cédric Le Goater
@ 2026-03-15  7:11 ` Pierrick Bouvier
  10 siblings, 0 replies; 35+ messages in thread
From: Pierrick Bouvier @ 2026-03-15  7:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Paolo Bonzini, qemu-ppc, Cédric Le Goater,
	Richard Henderson, eric.auger

On 3/12/26 3:44 PM, Pierrick Bouvier wrote:
> This series makes changes to hw/vfio to compile files only once.
> Changes are pretty straightforward and are mostly extraction of kvm/other config
> specific functions to proper files.
> This is the last hw/* subsystem that needs to be changed for single-binary.
> 
> Pierrick Bouvier (8):
>    hw/vfio/listener.c: remove CONFIG_KVM
>    hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c
>    hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
>    hw/vfio: eradicate CONFIG_IOMMU from sources
>    hw/vfio/pci.c: eradicate CONFIG_KVM
>    hw/vfio/ap.c: use full path for target specific header
>    hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to
>      hw/vfio/kvm-spapr.c
>    hw/vfio: all vfio files can now be common files
> 
>   hw/vfio/kvm-spapr.h          |  12 +++
>   target/s390x/kvm/kvm_s390x.h |   2 +-
>   hw/vfio/ap.c                 |  11 +-
>   hw/vfio/ccw.c                |   9 --
>   hw/vfio/helpers.c            | 172 -------------------------------
>   hw/vfio/igd-stubs.c          |  20 ++++
>   hw/vfio/kvm-helpers.c        | 192 +++++++++++++++++++++++++++++++++++
>   hw/vfio/kvm-spapr.c          |  47 +++++++++
>   hw/vfio/kvm-stubs.c          |  35 +++++++
>   hw/vfio/listener.c           |   4 -
>   hw/vfio/pci-quirks.c         |   5 -
>   hw/vfio/pci.c                |  37 +++----
>   hw/vfio/spapr.c              |  30 +-----
>   hw/vfio/meson.build          |   8 +-
>   14 files changed, 331 insertions(+), 253 deletions(-)
>   create mode 100644 hw/vfio/kvm-spapr.h
>   create mode 100644 hw/vfio/igd-stubs.c
>   create mode 100644 hw/vfio/kvm-helpers.c
>   create mode 100644 hw/vfio/kvm-spapr.c
>   create mode 100644 hw/vfio/kvm-stubs.c
> 

sent v2 (that turned into v3 when sending):
https://lore.kernel.org/qemu-devel/20260315070834.198331-1-pierrick.bouvier@linaro.org/T/#t

Regards,
Pierrick


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

* Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
  2026-03-15  2:57     ` Pierrick Bouvier
@ 2026-03-15 16:47       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-15 16:47 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Paolo Bonzini, qemu-ppc, Cédric Le Goater, Richard Henderson,
	eric.auger

On 15/3/26 03:57, Pierrick Bouvier wrote:
> On 3/12/26 8:20 PM, Philippe Mathieu-Daudé wrote:
>> On 12/3/26 23:44, Pierrick Bouvier wrote:
>>> Add stubs for needed functions.
>>>
>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>> ---
>>>    hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>>>    hw/vfio/pci-quirks.c |  5 -----
>>>    hw/vfio/meson.build  |  3 ++-
>>>    3 files changed, 22 insertions(+), 6 deletions(-)
>>>    create mode 100644 hw/vfio/igd-stubs.c
>>
>>
>>> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
>>> index f32d8573600..562ba79d1c0 100644
>>> --- a/hw/vfio/meson.build
>>> +++ b/hw/vfio/meson.build
>>> @@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>>>    ))
>>>    vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
>>>    vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
>>> -vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
>>> +vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
>>> +                                     if_false: files('igd-stubs.c'))
>>
>> Directly add to global stubs source set, otherwise:
>>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> To share some information, using the global stub mechanism instead of 
> subsystem ones makes one difference: some dependencies are not included. 
> In the case of this stub file, pixman.h and epoxy/gl.h are transitively 
> included, which is solved by adding those dependencies to qemuutil library.

Yep, this explains and fixes the failure I had with this patch:

https://lore.kernel.org/qemu-devel/20260225035739.42848-8-philmd@linaro.org/

Thanks!

> 
> Nothing too complex, but just worth mentioning in case you ran into an 
> issue similar for other stubs.
> 
> Regards,
> Pierrick



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

end of thread, other threads:[~2026-03-15 16:48 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 22:44 [PATCH 0/8] hw/vfio: single-binary Pierrick Bouvier
2026-03-12 22:44 ` [PATCH 1/8] hw/vfio/listener.c: remove CONFIG_KVM Pierrick Bouvier
2026-03-13  3:16   ` Philippe Mathieu-Daudé
2026-03-13  7:41   ` Cédric Le Goater
2026-03-12 22:44 ` [PATCH 2/8] hw/vfio/helpers.c: extract kvm helpers in kvm-helpers.c Pierrick Bouvier
2026-03-13  3:17   ` Philippe Mathieu-Daudé
2026-03-13  3:18   ` Philippe Mathieu-Daudé
2026-03-13 16:17     ` Pierrick Bouvier
2026-03-13  7:42   ` Cédric Le Goater
2026-03-12 22:44 ` [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD Pierrick Bouvier
2026-03-13  3:20   ` Philippe Mathieu-Daudé
2026-03-13 16:17     ` Pierrick Bouvier
2026-03-15  2:57     ` Pierrick Bouvier
2026-03-15 16:47       ` Philippe Mathieu-Daudé
2026-03-13  7:43   ` Cédric Le Goater
2026-03-12 22:44 ` [PATCH 4/8] hw/vfio: eradicate CONFIG_IOMMU from sources Pierrick Bouvier
2026-03-13  7:44   ` Cédric Le Goater
2026-03-12 22:44 ` [PATCH 5/8] hw/vfio/pci.c: eradicate CONFIG_KVM Pierrick Bouvier
2026-03-13  3:24   ` Philippe Mathieu-Daudé
2026-03-13 16:19     ` Pierrick Bouvier
2026-03-12 22:44 ` [PATCH 6/8] hw/vfio/ap.c: use full path for target specific header Pierrick Bouvier
2026-03-13  3:26   ` Philippe Mathieu-Daudé
2026-03-13  5:50     ` Pierrick Bouvier
2026-03-13  7:45   ` Cédric Le Goater
2026-03-12 22:44 ` [PATCH 7/8] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c Pierrick Bouvier
2026-03-13  3:28   ` Philippe Mathieu-Daudé
2026-03-13  3:29   ` Philippe Mathieu-Daudé
2026-03-13 16:19     ` Pierrick Bouvier
2026-03-12 22:44 ` [PATCH 8/8] hw/vfio: all vfio files can now be common files Pierrick Bouvier
2026-03-13  3:30   ` Philippe Mathieu-Daudé
2026-03-13  5:32 ` [PATCH 0/8] hw/vfio: single-binary Philippe Mathieu-Daudé
2026-03-13 16:21   ` Pierrick Bouvier
2026-03-13  7:50 ` Cédric Le Goater
2026-03-13  8:32   ` Pierrick Bouvier
2026-03-15  7:11 ` Pierrick Bouvier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox