[PATCH v2 11/18] hw/virtio: move stubs out of stubs/

Paolo Bonzini posted 7 patches 1 year, 10 months ago
Maintainers: Jason Wang <jasowang@redhat.com>, Andrew Melnychenko <andrew@daynix.com>, Yuri Benditovich <yuri.benditovich@daynix.com>, Gerd Hoffmann <kraxel@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, "Alex Bennée" <alex.bennee@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
[PATCH v2 11/18] hw/virtio: move stubs out of stubs/
Posted by Paolo Bonzini 1 year, 10 months ago
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 <pbonzini@redhat.com>
---
 stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c | 0
 hw/virtio/meson.build                                | 3 ++-
 stubs/meson.build                                    | 1 -
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c (100%)

diff --git a/stubs/virtio-md-pci.c b/hw/virtio/virtio-md-stubs.c
similarity index 100%
rename from stubs/virtio-md-pci.c
rename to hw/virtio/virtio-md-stubs.c
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index d7f18c96e60..2a086f7904b 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -80,7 +80,8 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem-pci.c'
 virtio_pci_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev-pci.c'))
-virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MD', if_true: files('virtio-md-pci.c'))
+virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MD', if_true: files('virtio-md-pci.c'),
+                                            if_false: files('virtio-md-stubs.c'))
 
 specific_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
 
diff --git a/stubs/meson.build b/stubs/meson.build
index 45616afbfaa..60e32d363fa 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -57,7 +57,6 @@ if have_system
   stub_ss.add(files('fw_cfg.c'))
   stub_ss.add(files('semihost.c'))
   stub_ss.add(files('xen-hw-stub.c'))
-  stub_ss.add(files('virtio-md-pci.c'))
 else
   stub_ss.add(files('qdev.c'))
 endif
-- 
2.44.0
Re: [PATCH v2 11/18] hw/virtio: move stubs out of stubs/
Posted by Richard Henderson 1 year, 10 months ago
On 4/8/24 05:53, 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<pbonzini@redhat.com>
> ---
>   stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c | 0
>   hw/virtio/meson.build                                | 3 ++-
>   stubs/meson.build                                    | 1 -
>   3 files changed, 2 insertions(+), 2 deletions(-)
>   rename stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c (100%)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~