Message ID | 20201023064618.21409-2-kraxel@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | virtio-gpu: build pci and vga bits modular too. | expand |
On Fri, Oct 23, 2020 at 10:46 AM Gerd Hoffmann <kraxel@redhat.com> wrote: > 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 <kraxel@redhat.com> > Hmm, I realize we have a different behaviour when building devices as modules shared by different qemu system binaries. It will attempt to load any kind of modules: ./qemu-system-m68k -kernel ~/Downloads/vmlinux-5.8.0-3-m68k -device virtio-gpu-pci Failed to open module: /home/elmarco/src/qemu/buildnodoc/hw-display-virtio-gpu-pci.so: undefined symbol: virtio_instance_init_common qemu-system-m68k: -device virtio-gpu-pci: 'virtio-gpu-pci' is not a valid device model name And this is not a new problem, for example with qemu 5.1.0-5.fc33: $ qemu-system-m68k -device help Failed to open module: /usr/lib64/qemu/hw-usb-smartcard.so: undefined symbol: ccid_card_send_apdu_to_guest Failed to open module: /usr/lib64/qemu/hw-display-qxl.so: undefined symbol: vga_ioport_read ... What would be the solution? load modules from an arch-specific directory? link to a common shared library location? Ex: /usr/lib64/qemu/x86_64/hw-usb-smartcard.so -> /usr/lib64/qemu/hw-usb-smartcard.so --- > util/module.c | 3 +++ > hw/display/meson.build | 11 +++++++++-- > 2 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/util/module.c b/util/module.c > index fe3b82dd4d37..9490f975d303 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" }, > diff --git a/hw/display/meson.build b/hw/display/meson.build > index 0d5ddecd6503..669935371335 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')) > > -- > 2.27.0 > > > Otherwise patch works well: Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> -- Marc-André Lureau <div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 23, 2020 at 10:46 AM Gerd Hoffmann <<a href="mailto:kraxel@redhat.com">kraxel@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Build virtio-gpu pci devices modular. Must be a separate module because<br> not all qemu softmmu variants come with PCI support.<br> <br> Signed-off-by: Gerd Hoffmann <<a href="mailto:kraxel@redhat.com" target="_blank">kraxel@redhat.com</a>><br></blockquote><br></div><div class="gmail_quote">Hmm, I realize we have a different behaviour when building devices as modules shared by different qemu system binaries.<br></div><div class="gmail_quote"><div><br></div><div>It will attempt to load any kind of modules:</div><div><br></div><div>./qemu-system-m68k -kernel ~/Downloads/vmlinux-5.8.0-3-m68k -device virtio-gpu-pci<br>Failed to open module: /home/elmarco/src/qemu/buildnodoc/hw-display-virtio-gpu-pci.so: undefined symbol: virtio_instance_init_common<br>qemu-system-m68k: -device virtio-gpu-pci: 'virtio-gpu-pci' is not a valid device model name</div><div><br></div><div><br></div><div>And this is not a new problem, for example with qemu 5.1.0-5.fc33:</div><div><br></div><div>$ qemu-system-m68k -device help <br>Failed to open module: /usr/lib64/qemu/hw-usb-smartcard.so: undefined symbol: ccid_card_send_apdu_to_guest<br>Failed to open module: /usr/lib64/qemu/hw-display-qxl.so: undefined symbol: vga_ioport_read</div><div>...</div><div><br></div><div>What would be the solution? load modules from an arch-specific directory? link to a common shared library location? Ex:<br></div><div>/usr/lib64/qemu/x86_64/hw-usb-smartcard.so -> /usr/lib64/qemu/hw-usb-smartcard.so</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> ---<br> util/module.c | 3 +++<br> hw/display/meson.build | 11 +++++++++--<br> 2 files changed, 12 insertions(+), 2 deletions(-)<br> <br> diff --git a/util/module.c b/util/module.c<br> index fe3b82dd4d37..9490f975d303 100644<br> --- a/util/module.c<br> +++ b/util/module.c<br> @@ -301,6 +301,9 @@ static struct {<br> { "qxl", "hw-", "display-qxl" },<br> { "virtio-gpu-device", "hw-", "display-virtio-gpu" },<br> { "vhost-user-gpu", "hw-", "display-virtio-gpu" },<br> + { "virtio-gpu-pci-base", "hw-", "display-virtio-gpu-pci" },<br> + { "virtio-gpu-pci", "hw-", "display-virtio-gpu-pci" },<br> + { "vhost-user-gpu-pci", "hw-", "display-virtio-gpu-pci" },<br> { "chardev-braille", "chardev-", "baum" },<br> { "chardev-spicevmc", "chardev-", "spice" },<br> { "chardev-spiceport", "chardev-", "spice" },<br> diff --git a/hw/display/meson.build b/hw/display/meson.build<br> index 0d5ddecd6503..669935371335 100644<br> --- a/hw/display/meson.build<br> +++ b/hw/display/meson.build<br> @@ -62,8 +62,15 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU')<br> hw_display_modules += {'virtio-gpu': virtio_gpu_ss}<br> endif<br> <br> -softmmu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('virtio-gpu-pci.c'))<br> -softmmu_ss.add(when: ['CONFIG_VHOST_USER_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-gpu-pci.c'))<br> +if config_all_devices.has_key('CONFIG_VIRTIO_PCI')<br> + virtio_gpu_pci_ss = ss.source_set()<br> + virtio_gpu_pci_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI'],<br> + if_true: [files('virtio-gpu-pci.c'), pixman])<br> + virtio_gpu_pci_ss.add(when: ['CONFIG_VHOST_USER_GPU', 'CONFIG_VIRTIO_PCI'],<br> + if_true: files('vhost-user-gpu-pci.c'))<br> + hw_display_modules += {'virtio-gpu-pci': virtio_gpu_pci_ss}<br> +endif<br> +<br> softmmu_ss.add(when: 'CONFIG_VIRTIO_VGA', if_true: files('virtio-vga.c'))<br> softmmu_ss.add(when: 'CONFIG_VHOST_USER_VGA', if_true: files('vhost-user-vga.c'))<br> <br> -- <br> 2.27.0<br> <br> <br> </blockquote></div><div><br></div><div>Otherwise patch works well:</div><div><br></div><div>Reviewed-by: Marc-André Lureau <<a href="mailto:marcandre.lureau@redhat.com">marcandre.lureau@redhat.com</a>><br></div><br>-- <br><div dir="ltr" class="gmail_signature">Marc-André Lureau<br></div></div>
diff --git a/util/module.c b/util/module.c index fe3b82dd4d37..9490f975d303 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" }, diff --git a/hw/display/meson.build b/hw/display/meson.build index 0d5ddecd6503..669935371335 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'))
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 <kraxel@redhat.com> --- util/module.c | 3 +++ hw/display/meson.build | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)