On Fri, Sep 6, 2024 at 9:08 AM Michael Tokarev <m...@tls.msk.ru> wrote: > > 05.09.2024 19:27, Paolo Bonzini wrote: > > On Sat, Aug 3, 2024 at 4:29 AM Michael Tokarev <m...@tls.msk.ru> wrote: > >> > >> 23.04.2024 18:08, Paolo Bonzini wrote: > >>> Since the virtio memory device stubs are needed exactly when the > >>> Kconfig symbol is not enabled, they can be placed in hw/virtio/ and > >>> conditionalized on CONFIG_VIRTIO_MD. > >>> > >>> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > >>> Reviewed-by: Richard Henderson <richard.hender...@linaro.org> > >>> Message-ID: <20240408155330.522792-12-pbonz...@redhat.com> > >>> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > >>> --- > >>> stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c | 0 > >>> hw/virtio/meson.build | 2 ++ > >>> stubs/meson.build | 1 - > >>> 3 files changed, 2 insertions(+), 1 deletion(-) > >>> rename stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c (100%) > >> > >> FWIW, this broke a minimal microvm build for debian: > >> > >> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/hw_i386_pc.c.o: in function > >> `pc_machine_device_pre_plug_cb': > >> ./b/microvm/hw/i386/pc.c:1377: undefined reference to > >> `virtio_md_pci_pre_plug' > >> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/hw_i386_pc.c.o: in function > >> `pc_machine_device_unplug_request_cb': > >> ./b/microvm/hw/i386/pc.c:1427: undefined reference to > >> `virtio_md_pci_unplug_request' > >> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/hw_i386_pc.c.o: in function > >> `pc_machine_device_unplug_cb': > >> ./b/microvm/hw/i386/pc.c:1443: undefined reference to > >> `virtio_md_pci_unplug' > >> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/hw_i386_pc.c.o: in function > >> `pc_machine_device_plug_cb': > >> ./b/microvm/hw/i386/pc.c:1413: undefined reference to `virtio_md_pci_plug' > >> collect2: error: ld returned 1 exit status > > > > Does it not link hw/virtio-virtio-md-stubs.c? > > The complete link line (it's done by using `cc -m64 @qemu-system-x86_64.rsp`) > is attached. > > Yes, it does NOT link md-stubs. > > > Can you send the > > x86_64-softmmu-config-devices.mak file? > > Yeah, it was in my first email (to which you replied), here it is again:
No I meant the full config in the build directory. Anyway I could reproduce this, the issue shows up because VIRTIO_MEM and VIRTIO_PMEM are effectively PCI only but hw/virtio/Kconfig doesn't list the dependency. The fix is to either add CONFIG_VIRTIO_PCI=y to microvm-devices.mak, or to remove CONFIG_VIRTIO_MEM and CONFIG_VIRTIO_PMEM. I'll shortly send a patch that will turn this into a compilation failure with the following error The following clauses were found for VIRTIO_MEM CONFIG_VIRTIO_MEM=y config VIRTIO_MEM depends on VIRTIO_PCI ... KconfigDataError: contradiction between clauses when setting VIRTIO_MEM Paolo