Skip to contentSkip to conversation

Restrict virtio-gpu-udmabuf stubs to !Linux

PATCH New Philippe Mathieu-Daudé 1 participant 3 messages Aug 23, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

v2 cover Restrict virtio-gpu-udmabuf stubs to !Linux

Annoying problem when stubs take over module symbols.

See https://gitlab.com/qemu-project/qemu/-/issues/553

Philippe Mathieu-Daudé (2):
hw/display: Restrict virtio-gpu-udmabuf stubs to !Linux ui/console: Restrict udmabuf_fd() to Linux

 include/ui/console.h                                  |  2 ++
 .../display/virtio-gpu-udmabuf-stubs.c                |  0
 ui/udmabuf.c                                          | 11 -----------
 hw/display/meson.build                                |  3 ++-
 stubs/meson.build                                     |  1 -
 ui/meson.build                                        |  6 ++++--
 6 files changed, 8 insertions(+), 15 deletions(-)
 rename stubs/virtio-gpu-udmabuf.c => hw/display/virtio-gpu-udmabuf-stubs.c (100%)
Signature · 1 line
2.31.1
#1 lore raw

PATCH v2 1/2 hw/display: Restrict virtio-gpu-udmabuf stubs to !Linux

When using qemu configured with --enabled-modules, the generic stubs are used instead of the module symbols:

qemu-system-x86_64: -device virtio-vga,blob=on: cannot enable blob resources without udmabuf

Restrict the stubs to Linux and only link them when CONFIG_VIRTIO_GPU is disabled (only the modularized version is available when it is enabled).

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/553

---
 .../display/virtio-gpu-udmabuf-stubs.c                         | 0
 hw/display/meson.build                                         | 3 ++-
 stubs/meson.build                                              | 1 -
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename stubs/virtio-gpu-udmabuf.c => hw/display/virtio-gpu-udmabuf-stubs.c (100%)
hw/display/virtio-gpu-udmabuf-stubs.c renamed from stubs/virtio-gpu-udmabuf.c +0 -0
similarity index 100%
rename from stubs/virtio-gpu-udmabuf.c
rename to hw/display/virtio-gpu-udmabuf-stubs.c
hw/display/meson.build +2 -1
index 1e6b707d3c0..861c43ff984 100644
@@ -56,7 +56,8 @@
   virtio_gpu_ss = ss.source_set()
   virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU',
                     if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), pixman])
-  virtio_gpu_ss.add(when: 'CONFIG_LINUX', if_true: files('virtio-gpu-udmabuf.c'))
+  virtio_gpu_ss.add(when: 'CONFIG_LINUX', if_true: files('virtio-gpu-udmabuf.c'),
+                                          if_false: files('virtio-gpu-udmabuf-stubs.c'))
   virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c'))
   hw_display_modules += {'virtio-gpu': virtio_gpu_ss}
 
stubs/meson.build +0 -1
index d3fa8646b38..3d7cfac608e 100644
@@ -53,7 +53,6 @@
   stub_ss.add(files('semihost.c'))
   stub_ss.add(files('usb-dev-stub.c'))
   stub_ss.add(files('xen-hw-stub.c'))
-  stub_ss.add(files('virtio-gpu-udmabuf.c'))
 else
   stub_ss.add(files('qdev.c'))
 endif
Signature · 1 line
2.31.1
#2 lore raw

PATCH v2 2/2 ui/console: Restrict udmabuf_fd() to Linux

In reply to Philippe Mathieu-Daudé
---
 include/ui/console.h |  2 ++
 ui/udmabuf.c         | 11 -----------
 ui/meson.build       |  6 ++++--
 3 files changed, 6 insertions(+), 13 deletions(-)
include/ui/console.h +2 -0
index b30b63976a5..3be21497a2e 100644
@@ -471,7 +471,9 @@ bool vnc_display_reload_certs(const char *id,  Error **errp);
 /* input.c */
 int index_from_key(const char *key, size_t key_length);
 
+#ifdef CONFIG_LINUX
 /* udmabuf.c */
 int udmabuf_fd(void);
+#endif
 
 #endif
ui/udmabuf.c +0 -11
index 23abe1e7eb9..cebceb26100 100644
@@ -8,8 +8,6 @@
 #include "qapi/error.h"
 #include "ui/console.h"
 
-#ifdef CONFIG_LINUX
-
 #include <fcntl.h>
 #include <sys/ioctl.h>
 
@@ -29,12 +27,3 @@ int udmabuf_fd(void)
     }
     return udmabuf;
 }
-
-#else
-
-int udmabuf_fd(void)
-{
-    return -1;
-}
-
-#endif
ui/meson.build +4 -2
index a3a187d633a..7d25c1b95b5 100644
@@ -12,12 +12,14 @@
   'kbd-state.c',
   'keymaps.c',
   'qemu-pixman.c',
-  'udmabuf.c',
 ))
 softmmu_ss.add([spice_headers, files('spice-module.c')])
 softmmu_ss.add(when: spice_protocol, if_true: files('vdagent.c'))
 
-softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('input-linux.c'))
+softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files(
+  'input-linux.c',
+  'udmabuf.c',
+))
 softmmu_ss.add(when: cocoa, if_true: files('cocoa.m'))
 
 vnc_ss = ss.source_set()
Signature · 1 line
2.31.1