From 74acdf0af81f803e748523363abd3c145b9d25ad Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 23 Oct 2020 08:46:17 +0200 Subject: [PATCH 1/5] virtio-gpu: add virtio-gpu-pci module Build virtio-gpu pci devices modular. Must be a separate module because not all qemu softmmu variants come with PCI support. Signed-off-by: Gerd Hoffmann Message-id: 20201023064618.21409-2-kraxel@redhat.com --- hw/display/meson.build | 11 +++++++++-- util/module.c | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/display/meson.build b/hw/display/meson.build index 0d5ddecd65..6699353713 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -62,8 +62,15 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU') hw_display_modules += {'virtio-gpu': virtio_gpu_ss} endif -softmmu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('virtio-gpu-pci.c')) -softmmu_ss.add(when: ['CONFIG_VHOST_USER_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-gpu-pci.c')) +if config_all_devices.has_key('CONFIG_VIRTIO_PCI') + virtio_gpu_pci_ss = ss.source_set() + virtio_gpu_pci_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI'], + if_true: [files('virtio-gpu-pci.c'), pixman]) + virtio_gpu_pci_ss.add(when: ['CONFIG_VHOST_USER_GPU', 'CONFIG_VIRTIO_PCI'], + if_true: files('vhost-user-gpu-pci.c')) + hw_display_modules += {'virtio-gpu-pci': virtio_gpu_pci_ss} +endif + softmmu_ss.add(when: 'CONFIG_VIRTIO_VGA', if_true: files('virtio-vga.c')) softmmu_ss.add(when: 'CONFIG_VHOST_USER_VGA', if_true: files('vhost-user-vga.c')) diff --git a/util/module.c b/util/module.c index fe3b82dd4d..9490f975d3 100644 --- a/util/module.c +++ b/util/module.c @@ -301,6 +301,9 @@ static struct { { "qxl", "hw-", "display-qxl" }, { "virtio-gpu-device", "hw-", "display-virtio-gpu" }, { "vhost-user-gpu", "hw-", "display-virtio-gpu" }, + { "virtio-gpu-pci-base", "hw-", "display-virtio-gpu-pci" }, + { "virtio-gpu-pci", "hw-", "display-virtio-gpu-pci" }, + { "vhost-user-gpu-pci", "hw-", "display-virtio-gpu-pci" }, { "chardev-braille", "chardev-", "baum" }, { "chardev-spicevmc", "chardev-", "spice" }, { "chardev-spiceport", "chardev-", "spice" }, From 1e1f9c20bc0bdd4cf11cfe5057465d484b611858 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 23 Oct 2020 08:46:18 +0200 Subject: [PATCH 2/5] virtio-gpu: add virtio-vga module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build virtio-gpu vga devices modular. Must be a separate module because not all qemu softmmu variants come with VGA support. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201023064618.21409-3-kraxel@redhat.com --- hw/display/meson.build | 10 ++++++++-- util/module.c | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/display/meson.build b/hw/display/meson.build index 6699353713..11ea2895c5 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -71,8 +71,14 @@ if config_all_devices.has_key('CONFIG_VIRTIO_PCI') hw_display_modules += {'virtio-gpu-pci': virtio_gpu_pci_ss} endif -softmmu_ss.add(when: 'CONFIG_VIRTIO_VGA', if_true: files('virtio-vga.c')) -softmmu_ss.add(when: 'CONFIG_VHOST_USER_VGA', if_true: files('vhost-user-vga.c')) +if config_all_devices.has_key('CONFIG_VIRTIO_VGA') + virtio_vga_ss = ss.source_set() + virtio_vga_ss.add(when: 'CONFIG_VIRTIO_VGA', + if_true: [files('virtio-vga.c'), pixman]) + virtio_vga_ss.add(when: 'CONFIG_VHOST_USER_VGA', + if_true: files('vhost-user-vga.c')) + hw_display_modules += {'virtio-vga': virtio_vga_ss} +endif specific_ss.add(when: [x11, opengl, 'CONFIG_MILKYMIST_TMU2'], if_true: files('milkymist-tmu2.c')) specific_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_lcdc.c')) diff --git a/util/module.c b/util/module.c index 9490f975d3..503c399421 100644 --- a/util/module.c +++ b/util/module.c @@ -304,6 +304,9 @@ static struct { { "virtio-gpu-pci-base", "hw-", "display-virtio-gpu-pci" }, { "virtio-gpu-pci", "hw-", "display-virtio-gpu-pci" }, { "vhost-user-gpu-pci", "hw-", "display-virtio-gpu-pci" }, + { "virtio-vga-base", "hw-", "display-virtio-vga" }, + { "virtio-vga", "hw-", "display-virtio-vga" }, + { "vhost-user-vga", "hw-", "display-virtio-vga" }, { "chardev-braille", "chardev-", "baum" }, { "chardev-spicevmc", "chardev-", "spice" }, { "chardev-spiceport", "chardev-", "spice" }, From 43376ccc8d2ceb64e281f0032897df80b6d0251a Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 26 Oct 2020 15:28:51 +0100 Subject: [PATCH 3/5] virtio-gpu: only compile virtio-gpu-3d.c for CONFIG_VIRGL=y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no actual code in the CONFIG_VIRGL=n case. So building is (a) pointless and (b) makes macos ranlib complain. Reported-by: Paolo Bonzini Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 20201026142851.28735-1-kraxel@redhat.com --- hw/display/meson.build | 4 +++- hw/display/virtio-gpu-3d.c | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/display/meson.build b/hw/display/meson.build index 11ea2895c5..dad3bd2b41 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -57,7 +57,9 @@ softmmu_ss.add(when: [pixman, 'CONFIG_ATI_VGA'], if_true: files('ati.c', 'ati_2d if config_all_devices.has_key('CONFIG_VIRTIO_GPU') virtio_gpu_ss = ss.source_set() virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU', - if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c', 'virtio-gpu-3d.c'), pixman, virgl]) + if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), pixman, virgl]) + virtio_gpu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRGL'], + if_true: [files('virtio-gpu-3d.c'), pixman, virgl]) virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c')) hw_display_modules += {'virtio-gpu': virtio_gpu_ss} endif diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 1bd33d7aed..0b0c11474d 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -17,8 +17,6 @@ #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-gpu.h" -#ifdef CONFIG_VIRGL - #include static struct virgl_renderer_callbacks virtio_gpu_3d_cbs; @@ -633,5 +631,3 @@ int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g) return capset2_max_ver ? 2 : 1; } - -#endif /* CONFIG_VIRGL */ From 5869f8dd1f57ce93f80171427e723227471d8a33 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 27 Oct 2020 13:06:03 +0100 Subject: [PATCH 4/5] modules: unbreak them on macos Using the correct shared library suffix helps ;) Signed-off-by: Gerd Hoffmann Message-id: 20201027120603.3625-1-kraxel@redhat.com --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 83610b0db8..6df4306c88 100755 --- a/configure +++ b/configure @@ -618,6 +618,7 @@ Darwin) if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then cpu="x86_64" fi + HOST_DSOSUF=".dylib" ;; SunOS) # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo From 546323bdac18984c771ebefae1046ee61742f9ca Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 28 Oct 2020 06:49:44 +0100 Subject: [PATCH 5/5] modules: turn off lazy binding We want missing symbols fail module load right away instead of having qemu abort later on in case lazy binding fails. Can happen -- for example -- when trying to load a module for a pci device (virtio-gpu-pci) into a qemu without pci support (qemu-system-avr). Signed-off-by: Gerd Hoffmann Message-id: 20201028054944.5772-1-kraxel@redhat.com --- util/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/module.c b/util/module.c index 503c399421..c65060c167 100644 --- a/util/module.c +++ b/util/module.c @@ -132,7 +132,7 @@ static int module_load_file(const char *fname, bool mayfail, bool export_symbols assert(QTAILQ_EMPTY(&dso_init_list)); - flags = G_MODULE_BIND_LAZY; + flags = 0; if (!export_symbols) { flags |= G_MODULE_BIND_LOCAL; }