On 3/17/26 20:42, Pierrick Bouvier wrote:
Add stubs for needed functions.

As well, we need to add pixman to qemuutil library dependencies since
pixman is transitively included from pci.h header, which is needed to be
able to include prototypes for stubs we declared.
In file included from include/ui/console.h:4,
                  from ../hw/vfio/vfio-display.h:12,
                  from ../hw/vfio/pci.h:25,
                  from ../hw/vfio/igd-stubs.c:9:
include/ui/qemu-pixman.h:10:10: fatal error: pixman.h: No such file or directory
    10 | #include <pixman.h>
       |          ^~~~~~~~~~

On OpenBSD, opengl headers are not available in default include path,
and thus we need to add opengl to list of qemuutil dependencies.
In file included from /home/root/qemu/include/ui/console.h:9:
/home/root/qemu/include/ui/surface.h:11:11: fatal error: 'epoxy/gl.h' file not 
found

Finally, vfio_pci_hot_reset_info must be forwarded declared on non linux
platforms:
In file included from ../hw/vfio/igd-stubs.c:9:
../hw/vfio/pci.h:265:44: error: 'struct vfio_pci_hot_reset_info' declared 
inside parameter list will not be visible outside of this definition or 
declaration [-Werror]
   265 |                                     struct vfio_pci_hot_reset_info 
**info_p);
       |

Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Pierrick Bouvier <[email protected]>

Signed-off-by: Pierrick Bouvier <[email protected]>

Duplicated Signed-off-by. I can fix when applying.

Thanks,

C.

---
  meson.build          |  2 +-
  hw/vfio/pci.h        |  2 ++
  hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
  hw/vfio/pci-quirks.c |  5 -----
  hw/vfio/meson.build  |  1 +
  5 files changed, 24 insertions(+), 6 deletions(-)
  create mode 100644 hw/vfio/igd-stubs.c

diff --git a/meson.build b/meson.build
index b2154bb9287..ab726ea1152 100644
--- a/meson.build
+++ b/meson.build
@@ -3781,7 +3781,7 @@ util_ss = util_ss.apply({})
  libqemuutil = static_library('qemuutil',
                               build_by_default: false,
                               sources: util_ss.sources() + stub_ss.sources() + 
genh,
-                             dependencies: [util_ss.dependencies(), libm, 
threads, glib, socket, malloc, rt])
+                             dependencies: [util_ss.dependencies(), libm, 
threads, glib, socket, malloc, rt, pixman, opengl])
  qemuutil = declare_dependency(link_with: libqemuutil,
                                sources: genh + version_res,
                                dependencies: [event_loop_base])
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
index d6495d7f297..c3a1f53d350 100644
--- a/hw/vfio/pci.h
+++ b/hw/vfio/pci.h
@@ -258,6 +258,8 @@ bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, Error 
**errp);
extern const PropertyInfo qdev_prop_nv_gpudirect_clique; +struct vfio_pci_hot_reset_info;
+
  void vfio_pci_pre_reset(VFIOPCIDevice *vdev);
  void vfio_pci_post_reset(VFIOPCIDevice *vdev);
  bool vfio_pci_host_match(PCIHostDeviceAddress *addr, const char *name);
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 f2a7728d3d0..6c00a7f51bb 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -17,6 +17,7 @@ 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'))
+stub_ss.add(files('igd-stubs.c'))
specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)


Reply via email to