Skip to contentSkip to conversation

buildsys: Build most stubs once

PATCH Superseded Philippe Mathieu-Daudé 3 participants 23 messages Feb 24 – Feb 25 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover buildsys: Build most stubs once

Use meson magical machinery to build stubs once,
instead of one time per qemu-system-FOO binary.

Philippe Mathieu-Daudé (10):
meson: Include various directories providing stubs before libqemuutil hw/acpi: Move acpi_send_event() function out of acpi_interface.c hw/acpi: Move qbus_build_aml() function out of acpi_interface.c hw/acpi: Always link QOM interfaces with system binaries hw/acpi: Build stubs once
hw/display: Build stubs once
hw/net: Build stubs once
hw/*: Build stubs once
fsdev: Build stubs once
semihosting: Build stubs once

 meson.build                                   | 14 +++++-----
 hw/acpi/acpi_interface.c                      | 19 -------------
 hw/acpi/aml-build.c                           | 11 ++++++++
 hw/acpi/core.c                                | 10 +++++++
 hw/display/acpi-vga-stub.c                    |  1 +
 .../rocker/{qmp-norocker.c => rocker-stubs.c} |  0
 fsdev/meson.build                             |  3 +-
 hw/acpi/meson.build                           | 28 ++++++++++---------
 hw/cxl/meson.build                            |  4 +--
 hw/display/meson.build                        | 19 ++++++-------
 hw/i386/kvm/meson.build                       |  5 +---
 hw/mem/meson.build                            |  4 +--
 hw/net/meson.build                            |  3 +-
 hw/pci/meson.build                            |  2 +-
 hw/smbios/meson.build                         | 10 +++----
 hw/usb/meson.build                            |  3 +-
 hw/virtio/meson.build                         |  9 ++----
 semihosting/meson.build                       |  9 +++---
 18 files changed, 77 insertions(+), 77 deletions(-)
 rename hw/net/rocker/{qmp-norocker.c => rocker-stubs.c} (100%)
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/10 meson: Include various directories providing stubs before libqemuutil

Stubs are provided by libqemuutil. We want to use the generic meson machinery to provide stubs once, instead of per sub-directories. Move the 'subdir' calls earlier so when these directories are processed they can add units to the global stub_ss[] source set.

---
 meson.build | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
meson.build +7 -7
index 4ffbb96fe49..db051a1b87b 100644
@@ -3725,6 +3725,13 @@ subdir('authz')
 subdir('crypto')
 subdir('ui')
 subdir('gdbstub')
+subdir('semihosting')
+subdir('audio')
+subdir('io')
+subdir('chardev')
+subdir('fsdev')
+subdir('dump')
+
 if have_system
   subdir('hw')
 else
@@ -3770,12 +3777,6 @@ if have_system or have_user
   subdir('target')
 endif
 
-subdir('audio')
-subdir('io')
-subdir('chardev')
-subdir('fsdev')
-subdir('dump')
-
 if have_block
   block_ss.add(files(
     'block.c',
@@ -3845,7 +3846,6 @@ subdir('migration')
 subdir('monitor')
 subdir('net')
 subdir('replay')
-subdir('semihosting')
 subdir('stats')
 subdir('tcg')
 subdir('fpu')
Signature · 1 line
2.52.0
Reviewed-by on v1 1/10
#2 lore raw

Re: [PATCH 01/10] meson: Include various directories providing stubs before libqemuutil

Quoted 10 lines · Philippe Mathieu-Daudé

Stubs are provided by libqemuutil. We want to use the generic meson machinery to provide stubs once, instead of per sub-directories. Move the 'subdir' calls earlier so when these directories are processed they can add units to the global stub_ss[] source set.

---
  meson.build | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
#3 lore raw

PATCH 2/10 hw/acpi: Move acpi_send_event() function out of acpi_interface.c

In reply to Philippe Mathieu-Daudé

acpi_interface.c should only register QOM interfaces. Move the acpi_send_event() function to core.c with the other event handlers.

---
 hw/acpi/acpi_interface.c |  9 ---------
 hw/acpi/core.c           | 10 ++++++++++
 2 files changed, 10 insertions(+), 9 deletions(-)
hw/acpi/acpi_interface.c +0 -9
index 8637ff18fca..e58e8aaee23 100644
@@ -4,15 +4,6 @@
 #include "qemu/module.h"
 #include "qemu/queue.h"
 
-void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event)
-{
-    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(dev);
-    if (adevc->send_event) {
-        AcpiDeviceIf *adev = ACPI_DEVICE_IF(dev);
-        adevc->send_event(adev, event);
-    }
-}
-
 void qbus_build_aml(BusState *bus, Aml *scope)
 {
     BusChild *kid;
hw/acpi/core.c +10 -0
index 6b65e587f2a..a6a62a742d1 100644
@@ -22,6 +22,7 @@
 #include "qemu/osdep.h"
 #include "hw/core/irq.h"
 #include "hw/acpi/acpi.h"
+#include "hw/acpi/acpi_dev_interface.h"
 #include "hw/nvram/fw_cfg.h"
 #include "qemu/config-file.h"
 #include "qapi/error.h"
@@ -753,3 +754,12 @@ void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
                        (regs->pm1.evt.en & ACPI_BITMASK_TIMER_ENABLE) &&
                        !(pm1a_sts & ACPI_BITMASK_TIMER_STATUS));
 }
+
+void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event)
+{
+    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(dev);
+    if (adevc->send_event) {
+        AcpiDeviceIf *adev = ACPI_DEVICE_IF(dev);
+        adevc->send_event(adev, event);
+    }
+}
Signature · 1 line
2.52.0
Reviewed-by on v1 2/10
#4 lore raw

Re: [PATCH 02/10] hw/acpi: Move acpi_send_event() function out of acpi_interface.c

Quoted 10 lines · Philippe Mathieu-Daudé

acpi_interface.c should only register QOM interfaces. Move the acpi_send_event() function to core.c with the other event handlers.

---
  hw/acpi/acpi_interface.c |  9 ---------
  hw/acpi/core.c           | 10 ++++++++++
  2 files changed, 10 insertions(+), 9 deletions(-)

Should you move the function declaration to hw/acpi/acpi.h in this case?

#5 lore raw

Re: [PATCH 02/10] hw/acpi: Move acpi_send_event() function out of acpi_interface.c

Quoted 5 lines · Pierrick Bouvier
Quoted 4 lines · Philippe Mathieu-Daudé

acpi_interface.c should only register QOM interfaces. Move the acpi_send_event() function to core.c with the other event handlers.

Quoted 8 lines
Quoted 6 lines

---
  hw/acpi/acpi_interface.c |  9 ---------
  hw/acpi/core.c           | 10 ++++++++++

  2 files changed, 10 insertions(+), 9 deletions(-)

Should you move the function declaration to hw/acpi/acpi.h in this case?

Good point, will do.

Quoted 1 line

Thanks!

#6 lore raw

PATCH 3/10 hw/acpi: Move qbus_build_aml() function out of acpi_interface.c

In reply to Philippe Mathieu-Daudé

acpi_interface.c should only register QOM interfaces. Move the qbus_build_aml() function to aml-build.c with the other AML build-related helpers.

---
 hw/acpi/acpi_interface.c | 10 ----------
 hw/acpi/aml-build.c      | 11 +++++++++++
 2 files changed, 11 insertions(+), 10 deletions(-)
hw/acpi/acpi_interface.c +0 -10
index e58e8aaee23..a44679017ea 100644
@@ -2,16 +2,6 @@
 #include "hw/acpi/acpi_dev_interface.h"
 #include "hw/acpi/acpi_aml_interface.h"
 #include "qemu/module.h"
-#include "qemu/queue.h"
-
-void qbus_build_aml(BusState *bus, Aml *scope)
-{
-    BusChild *kid;
-
-    QTAILQ_FOREACH(kid, &bus->children, sibling) {
-        call_dev_aml_func(DEVICE(kid->child), scope);
-    }
-}
 
 static void register_types(void)
 {
hw/acpi/aml-build.c +11 -0
index ea1c415b211..4b374050881 100644
@@ -25,12 +25,14 @@
 #include "hw/acpi/acpi.h"
 #include "qemu/bswap.h"
 #include "qemu/bitops.h"
+#include "qemu/queue.h"
 #include "system/numa.h"
 #include "hw/core/boards.h"
 #include "hw/acpi/tpm.h"
 #include "hw/pci/pci_host.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_bridge.h"
+#include "hw/acpi/acpi_aml_interface.h"
 #include "qemu/cutils.h"
 
 static GArray *build_alloc_array(void)
@@ -2647,3 +2649,12 @@ Aml *aml_error_device(void)
 
     return dev;
 }
+
+void qbus_build_aml(BusState *bus, Aml *scope)
+{
+    BusChild *kid;
+
+    QTAILQ_FOREACH(kid, &bus->children, sibling) {
+        call_dev_aml_func(DEVICE(kid->child), scope);
+    }
+}
Signature · 1 line
2.52.0
Reviewed-by on v1 3/10
#7 lore raw

Re: [PATCH 03/10] hw/acpi: Move qbus_build_aml() function out of acpi_interface.c

Quoted 10 lines · Philippe Mathieu-Daudé

acpi_interface.c should only register QOM interfaces. Move the qbus_build_aml() function to aml-build.c with the other AML build-related helpers.

---
  hw/acpi/acpi_interface.c | 10 ----------
  hw/acpi/aml-build.c      | 11 +++++++++++
  2 files changed, 11 insertions(+), 10 deletions(-)
#8 lore raw

PATCH 4/10 hw/acpi: Always link QOM interfaces with system binaries

In reply to Philippe Mathieu-Daudé

Now that acpi_interface.c only contains QOM interfaces, unconditionally link it with system binaries, regardless of whether CONFIG_ACPI is set or not. It is now easier to deselect hardware models depending on ACPI.

---
 hw/acpi/meson.build | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/acpi/meson.build +1 -2
index 66c978aae83..e1e848327b9 100644
@@ -1,6 +1,5 @@
 acpi_ss = ss.source_set()
 acpi_ss.add(files(
-  'acpi_interface.c',
   'aml-build.c',
   'bios-linker-loader.c',
   'core.c',
@@ -36,4 +35,4 @@ system_ss.add(when: 'CONFIG_ACPI_PCI_BRIDGE', if_false: files('pci-bridge-stub.c
 system_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss)
 system_ss.add(when: 'CONFIG_GHES_CPER', if_true: files('ghes_cper.c'))
 system_ss.add(when: 'CONFIG_GHES_CPER', if_false: files('ghes_cper_stub.c'))
-system_ss.add(files('acpi-qmp-cmds.c'))
+system_ss.add(files('acpi-qmp-cmds.c', 'acpi_interface.c'))
Signature · 1 line
2.52.0
Reviewed-by on v1 4/10
#9 lore raw

Re: [PATCH 04/10] hw/acpi: Always link QOM interfaces with system binaries

Quoted 10 lines · Philippe Mathieu-Daudé

Now that acpi_interface.c only contains QOM interfaces, unconditionally link it with system binaries, regardless of whether CONFIG_ACPI is set or not. It is now easier to deselect hardware models depending on ACPI.

---
  hw/acpi/meson.build | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
#10 lore raw

PATCH 5/10 hw/acpi: Build stubs once

In reply to Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

---
 hw/acpi/meson.build | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
hw/acpi/meson.build +14 -11
index e1e848327b9..1c5251909b4 100644
@@ -6,33 +6,36 @@ acpi_ss.add(files(
   'utils.c',
 ))
 acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c'))
-acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_false: files('acpi-cpu-hotplug-stub.c'))
+stub_ss.add(files('acpi-cpu-hotplug-stub.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_MEMORY_HOTPLUG', if_true: files('memory_hotplug.c'))
-acpi_ss.add(when: 'CONFIG_ACPI_MEMORY_HOTPLUG', if_false: files('acpi-mem-hotplug-stub.c'))
+stub_ss.add(files('acpi-mem-hotplug-stub.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_NVDIMM', if_true: files('nvdimm.c'))
-acpi_ss.add(when: 'CONFIG_ACPI_NVDIMM', if_false: files('acpi-nvdimm-stub.c'))
+stub_ss.add(files('acpi-nvdimm-stub.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_PCI', if_true: files('pci.c'))
-acpi_ss.add(when: 'CONFIG_ACPI_CXL', if_true: files('cxl.c'), if_false: files('cxl-stub.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_CXL', if_true: files('cxl.c'))
+stub_ss.add(files('cxl-stub.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_VMGENID', if_true: files('vmgenid.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_VMCLOCK', if_true: files('vmclock.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_HMAT', if_true: files('hmat.c'))
-acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files('ghes-stub.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'))
+stub_ss.add(files('ghes-stub.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_PCI_BRIDGE', if_true: files('pci-bridge.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c'))
-acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c'))
+stub_ss.add(files('acpi-pci-hotplug-stub.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('ich9.c', 'ich9_tco.c', 'ich9_timer.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c'))
-acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c'))
-acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
+acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'))
+stub_ss.add(files('ipmi-stub.c'))
+stub_ss.add(files('acpi-x86-stub.c'))
 if have_tpm
   acpi_ss.add(files('tpm.c'))
 endif
-system_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c', 'acpi_interface.c'))
-system_ss.add(when: 'CONFIG_ACPI_PCI_BRIDGE', if_false: files('pci-bridge-stub.c'))
+stub_ss.add(files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c'))
+stub_ss.add(files('pci-bridge-stub.c'))
 system_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss)
 system_ss.add(when: 'CONFIG_GHES_CPER', if_true: files('ghes_cper.c'))
-system_ss.add(when: 'CONFIG_GHES_CPER', if_false: files('ghes_cper_stub.c'))
+stub_ss.add(files('ghes_cper_stub.c'))
 system_ss.add(files('acpi-qmp-cmds.c', 'acpi_interface.c'))
Signature · 1 line
2.52.0
Reviewed-by on v1 5/10
#11 lore raw

Re: [PATCH 05/10] hw/acpi: Build stubs once

Quoted 9 lines · Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

---
  hw/acpi/meson.build | 25 ++++++++++++++-----------
  1 file changed, 14 insertions(+), 11 deletions(-)
#12 lore raw

PATCH 6/10 hw/display: Build stubs once

In reply to Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

---
 hw/display/acpi-vga-stub.c |  1 +
 hw/display/meson.build     | 19 ++++++++-----------
 2 files changed, 9 insertions(+), 11 deletions(-)
hw/display/acpi-vga-stub.c +1 -0
index a9b0ecf76d0..ee0fbf8175d 100644
@@ -1,4 +1,5 @@
 #include "qemu/osdep.h"
+#undef CONFIG_PIXMAN
 #include "hw/acpi/acpi_aml_interface.h"
 #include "vga_int.h"
 
hw/display/meson.build +8 -11
index 90e6c041bdb..e730c289b15 100644
@@ -3,7 +3,8 @@ hw_display_modules = {}
 system_ss.add(when: 'CONFIG_DDC', if_true: files('i2c-ddc.c'))
 system_ss.add(when: 'CONFIG_EDID', if_true: files('edid-generate.c', 'edid-region.c'))
 
-system_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb.c'), if_false: files('ramfb-stubs.c'))
+system_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb.c'))
+stub_ss.add(files('ramfb-stubs.c'))
 system_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb-standalone.c'))
 
 system_ss.add(when: 'CONFIG_VGA_CIRRUS', if_true: files('cirrus_vga.c'))
@@ -36,21 +37,20 @@ system_ss.add(when: 'CONFIG_VGA', if_true: files('vga.c'))
 system_ss.add(when: 'CONFIG_VIRTIO', if_true: files('virtio-dmabuf.c'))
 system_ss.add(when: 'CONFIG_DM163', if_true: files('dm163.c'))
 
+stub_ss.add([files('acpi-vga-stub.c'), pixman])
 if (config_all_devices.has_key('CONFIG_VGA_CIRRUS') or
     config_all_devices.has_key('CONFIG_VGA_PCI') or
     config_all_devices.has_key('CONFIG_VMWARE_VGA') or
     config_all_devices.has_key('CONFIG_ATI_VGA')
    )
-  system_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'),
-                                      if_false: files('acpi-vga-stub.c'))
+  system_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'))
 endif
 
 if config_all_devices.has_key('CONFIG_QXL')
   qxl_ss = ss.source_set()
   qxl_ss.add(when: 'CONFIG_QXL', if_true: [files('qxl.c', 'qxl-logger.c', 'qxl-render.c'),
                                            pixman, spice])
-  qxl_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'),
-                                  if_false: files('acpi-vga-stub.c'))
+  qxl_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'))
   hw_display_modules += {'qxl': qxl_ss}
 endif
 
@@ -119,16 +119,14 @@ if config_all_devices.has_key('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'))
-  virtio_vga_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'),
-                                         if_false: files('acpi-vga-stub.c'))
+  virtio_vga_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'))
   hw_display_modules += {'virtio-vga': virtio_vga_ss}
 
   if virgl.found() and opengl.found()
     virtio_vga_gl_ss = ss.source_set()
     virtio_vga_gl_ss.add(when: ['CONFIG_VIRTIO_VGA', virgl, opengl],
                          if_true: [files('virtio-vga-gl.c'), pixman])
-    virtio_vga_gl_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'),
-                                              if_false: files('acpi-vga-stub.c'))
+    virtio_vga_gl_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'))
     hw_display_modules += {'virtio-vga-gl': virtio_vga_gl_ss}
   endif
 
@@ -136,8 +134,7 @@ if config_all_devices.has_key('CONFIG_VIRTIO_VGA')
     virtio_vga_rutabaga_ss = ss.source_set()
     virtio_vga_rutabaga_ss.add(when: ['CONFIG_VIRTIO_VGA', rutabaga],
                                if_true: [files('virtio-vga-rutabaga.c'), pixman])
-    virtio_vga_rutabaga_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'),
-                                                    if_false: files('acpi-vga-stub.c'))
+    virtio_vga_rutabaga_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-vga.c'))
     hw_display_modules += {'virtio-vga-rutabaga': virtio_vga_rutabaga_ss}
   endif
 endif
Signature · 1 line
2.52.0
Reviewed-by on v1 6/10
#13 lore raw

Re: [PATCH 06/10] hw/display: Build stubs once

Quoted 10 lines · Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

---
  hw/display/acpi-vga-stub.c |  1 +
  hw/display/meson.build     | 19 ++++++++-----------
  2 files changed, 9 insertions(+), 11 deletions(-)
#14 lore raw

PATCH 7/10 hw/net: Build stubs once

In reply to Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

qmp-norocker.c only contains stubs, rename it accordingly.

---
 hw/net/rocker/{qmp-norocker.c => rocker-stubs.c} | 0
 hw/net/meson.build                               | 3 ++-
 2 files changed, 2 insertions(+), 1 deletion(-)
 rename hw/net/rocker/{qmp-norocker.c => rocker-stubs.c} (100%)
hw/net/rocker/rocker-stubs.c renamed from hw/net/rocker/qmp-norocker.c +0 -0
similarity index 100%
rename from hw/net/rocker/qmp-norocker.c
rename to hw/net/rocker/rocker-stubs.c
hw/net/meson.build +2 -1
index 913eaedbc52..4ee09143165 100644
@@ -67,7 +67,8 @@ system_ss.add(when: 'CONFIG_ROCKER', if_true: files(
   'rocker/rocker_fp.c',
   'rocker/rocker_of_dpa.c',
   'rocker/rocker_world.c',
-), if_false: files('rocker/qmp-norocker.c'))
+))
+stub_ss.add(files('rocker/rocker-stubs.c'))
 system_ss.add(files('rocker/rocker-hmp-cmds.c'))
 
 subdir('can')
Signature · 1 line
2.52.0
Reviewed-by on v1 7/10
#15 lore raw

Re: [PATCH 07/10] hw/net: Build stubs once

Quoted 4 lines · Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

Quoted 9 lines

qmp-norocker.c only contains stubs, rename it accordingly.

---
  hw/net/rocker/{qmp-norocker.c => rocker-stubs.c} | 0
  hw/net/meson.build                               | 3 ++-
  2 files changed, 2 insertions(+), 1 deletion(-)

rename hw/net/rocker/{qmp-norocker.c => rocker-stubs.c} (100%)

#16 lore raw

PATCH 8/10 hw/*: Build stubs once

In reply to Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

---
 hw/cxl/meson.build      |  4 ++--
 hw/i386/kvm/meson.build |  5 +----
 hw/mem/meson.build      |  4 ++--
 hw/pci/meson.build      |  2 +-
 hw/smbios/meson.build   | 10 +++++-----
 hw/usb/meson.build      |  3 ++-
 hw/virtio/meson.build   |  9 +++------
 7 files changed, 16 insertions(+), 21 deletions(-)
hw/cxl/meson.build +2 -2
index 3e375f61a98..5f61273a68d 100644
@@ -7,7 +7,7 @@ system_ss.add(when: 'CONFIG_CXL',
                    'cxl-cdat.c',
                    'cxl-events.c',
                    'switch-mailbox-cci.c',
-               ),
-               if_false: files(
+               ))
+stub_ss.add(files(
                    'cxl-host-stubs.c',
                ))
hw/i386/kvm/meson.build +1 -4
index a4a2e23c06e..a34b3504cba 100644
@@ -15,9 +15,6 @@ i386_kvm_ss.add(when: 'CONFIG_XEN_EMU', if_true: files(
 
 i386_ss.add_all(when: 'CONFIG_KVM', if_true: i386_kvm_ss)
 
-xen_stubs_ss = ss.source_set()
-xen_stubs_ss.add(when: 'CONFIG_XEN_EMU', if_false: files(
+stub_ss.add(files(
   'xen-stubs.c',
 ))
-
-specific_ss.add_all(when: 'CONFIG_SYSTEM_ONLY', if_true: xen_stubs_ss)
hw/mem/meson.build +2 -2
index 1c1c6da24b5..8c2beeb7d4d 100644
@@ -4,9 +4,9 @@ mem_ss.add(when: 'CONFIG_DIMM', if_true: files('pc-dimm.c'))
 mem_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_mc.c'))
 mem_ss.add(when: 'CONFIG_NVDIMM', if_true: files('nvdimm.c'))
 mem_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_true: files('cxl_type3.c'))
-system_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_false: files('cxl_type3_stubs.c'))
+stub_ss.add(files('cxl_type3_stubs.c'))
 
-system_ss.add(when: 'CONFIG_MEM_DEVICE', if_false: files('memory-device-stubs.c'))
+stub_ss.add(files('memory-device-stubs.c'))
 system_ss.add_all(when: 'CONFIG_MEM_DEVICE', if_true: mem_ss)
 
 system_ss.add(when: 'CONFIG_SPARSE_MEM', if_true: files('sparse-mem.c'))
hw/pci/meson.build +1 -1
index b9c34b2acfe..a6cbd89c0a3 100644
@@ -19,4 +19,4 @@ pci_ss.add(files('pcie_doe.c'))
 system_ss.add(when: 'CONFIG_PCI_EXPRESS', if_true: files('pcie_port.c', 'pcie_host.c'))
 system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss)
 
-system_ss.add(when: 'CONFIG_PCI', if_false: files('pci-stub.c'))
+stub_ss.add(files('pci-stub.c'))
hw/smbios/meson.build +5 -5
index a59039f6692..9bf4b1ad1e5 100644
@@ -1,12 +1,12 @@
 smbios_ss = ss.source_set()
 smbios_ss.add(files('smbios.c'))
 smbios_ss.add(when: 'CONFIG_IPMI',
-              if_true: files('smbios_type_38.c'),
-              if_false: files('smbios_type_38-stub.c'))
+              if_true: files('smbios_type_38.c'))
+stub_ss.add(files('smbios_type_38-stub.c'))
 
 smbios_ss.add(when: 'CONFIG_SMBIOS_LEGACY',
-              if_true: files('smbios_legacy.c'),
-              if_false: files('smbios_legacy_stub.c'))
+              if_true: files('smbios_legacy.c'))
+stub_ss.add(files('smbios_legacy_stub.c'))
 
 system_ss.add_all(when: 'CONFIG_SMBIOS', if_true: smbios_ss)
-system_ss.add(when: 'CONFIG_SMBIOS', if_false: files('smbios-stub.c'))
+stub_ss.add(files('smbios-stub.c'))
hw/usb/meson.build +2 -1
index 17360a5b5a4..ba55c28ef69 100644
@@ -9,7 +9,8 @@ system_ss.add(when: 'CONFIG_USB', if_true: files(
   'desc-msos.c',
   'libhw.c',
   'pcap.c',
-), if_false: files('bus-stub.c'))
+))
+stub_ss.add(files('bus-stub.c'))
 
 # usb host adapters
 system_ss.add(when: 'CONFIG_USB_UHCI', if_true: files('hcd-uhci.c'))
hw/virtio/meson.build +3 -6
index 6675b63ce65..3af34ef9321 100644
@@ -50,8 +50,6 @@ if have_vhost
     system_virtio_ss.add(files('vhost-vdpa.c'))
     system_virtio_ss.add(files('vhost-shadow-virtqueue.c'))
   endif
-else
-  system_virtio_ss.add(files('vhost-stub.c'))
 endif
 system_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock.c'))
 system_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c'))
@@ -94,10 +92,9 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MD', if_true: files('virtio-md-pci.c'))
 system_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
 
 system_ss.add_all(when: 'CONFIG_VIRTIO', if_true: system_virtio_ss)
-system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
-system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c'))
-system_ss.add(when: ['CONFIG_VIRTIO_MD', 'CONFIG_VIRTIO_PCI'],
-              if_false: files('virtio-md-stubs.c'))
+stub_ss.add(files('vhost-stub.c'))
+stub_ss.add(files('virtio-stub.c'))
+stub_ss.add(files('virtio-md-stubs.c'))
 
 system_ss.add(files('virtio-hmp-cmds.c'))
 
Signature · 1 line
2.52.0
Reviewed-by on v1 8/10
#17 lore raw

Re: [PATCH 08/10] hw/*: Build stubs once

Quoted 5 lines · Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

Quoted 10 lines
---
  hw/cxl/meson.build      |  4 ++--
  hw/i386/kvm/meson.build |  5 +----
  hw/mem/meson.build      |  4 ++--
  hw/pci/meson.build      |  2 +-
  hw/smbios/meson.build   | 10 +++++-----
  hw/usb/meson.build      |  3 ++-
  hw/virtio/meson.build   |  9 +++------
  7 files changed, 16 insertions(+), 21 deletions(-)
#18 lore raw

PATCH 9/10 fsdev: Build stubs once

In reply to Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

---
 fsdev/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fsdev/meson.build +2 -1
index 95fe816604f..b552cc7153a 100644
@@ -4,7 +4,8 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files(
   '9p-iov-marshal.c',
   '9p-marshal.c',
   'qemu-fsdev.c',
-), if_false: files('qemu-fsdev-dummy.c'))
+))
+stub_ss.add(files('qemu-fsdev-dummy.c'))
 if host_os in ['linux', 'darwin', 'freebsd']
   system_ss.add_all(fsdev_ss)
 endif
Signature · 1 line
2.52.0
#20 lore raw

PATCH 10/10 semihosting: Build stubs once

In reply to Philippe Mathieu-Daudé

Move stubs to the global stub_ss[] source set. These files are now built once for all binaries, instead of one time per system binary.

---
 semihosting/meson.build | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
semihosting/meson.build +5 -4
index 99f10e2e2bb..15e3be26989 100644
@@ -1,4 +1,4 @@
-common_ss.add(when: 'CONFIG_SEMIHOSTING', if_false: files('stubs-all.c'))
+stub_ss.add(files('stubs-all.c'))
 user_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(
   'user.c',
   'guestfd.c'))
@@ -8,12 +8,13 @@ system_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(
   'guestfd.c',
   'uaccess.c',
   'syscalls.c',
-), if_false: files(
+))
+stub_ss.add(files(
   'stubs-system.c',
 ))
 system_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING',
-  if_true: files('arm-compat-semi.c'),
-  if_false: files('arm-compat-semi-stub.c'))
+  if_true: files('arm-compat-semi.c'))
+stub_ss.add(files('arm-compat-semi-stub.c'))
 
 specific_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_USER_ONLY'],
                 if_true: files('syscalls.c'))
Signature · 1 line
2.52.0
Reviewed-by on the v1 series
#22 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 14 lines · Philippe Mathieu-Daudé

Use meson magical machinery to build stubs once,
instead of one time per qemu-system-FOO binary.

Philippe Mathieu-Daudé (10):
meson: Include various directories providing stubs before libqemuutil hw/acpi: Move acpi_send_event() function out of acpi_interface.c hw/acpi: Move qbus_build_aml() function out of acpi_interface.c hw/acpi: Always link QOM interfaces with system binaries hw/acpi: Build stubs once
hw/display: Build stubs once
hw/net: Build stubs once
hw/*: Build stubs once
fsdev: Build stubs once
semihosting: Build stubs once

r~