qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process
@ 2024-04-08 15:53 Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 01/18] meson: do not link pixman automatically into all targets Paolo Bonzini
                   ` (17 more replies)
  0 siblings, 18 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Some files (especially from hw/core/, stubs/ and util/) are built for
user mode emulation unnecessarily; they are not needed by any code that
is part of qemu-user.

The bulk of the patch (commits 6-17) puts stubs/ on a diet both in
general (moving stubs out into specific subdirectories and away from
libqemuutil.a) and for specific builds, by documenting which parts
of QEMU need the various object files.

Tested by building

   --disable-system --disable-user --disable-tools --disable-guest-agent
   --disable-system --enable-user --disable-tools --disable-guest-agent
   --disable-system --disable-user --enable-tools --disable-guest-agent
   --disable-system --disable-user --disable-tools --enable-guest-agent

as well as regular CI.

Paolo

Paolo Bonzini (15):
  meson: do not link pixman automatically into all targets
  tests: only build plugins if TCG is enabled
  tests/unit: match some unit tests to corresponding feature switches
  yank: only build if needed
  hw/core: Move system emulation files to system_ss
  stubs: remove obsolete stubs
  hw/usb: move stubs out of stubs/
  hw/virtio: move stubs out of stubs/
  semihosting: move stubs out of stubs/
  ramfb: move stubs out of stubs/
  memory-device: move stubs out of stubs/
  colo: move stubs out of stubs/
  stubs: split record/replay stubs further
  stubs: include stubs only if needed
  stubs: move monitor_fdsets_cleanup with other fdset stubs

Philippe Mathieu-Daudé (3):
  ebpf: Restrict to system emulation
  util/qemu-config: Extract QMP commands to qemu-config-qmp.c
  hw: Include minimal source set in user emulation build

 meson.build                                   |   8 +-
 include/qemu/config-file.h                    |   3 +
 include/sysemu/sysemu.h                       |   2 -
 stubs/ramfb.c => hw/display/ramfb-stubs.c     |   0
 .../mem/memory-device-stubs.c                 |   0
 stubs/usb-dev-stub.c => hw/usb/bus-stub.c     |   5 -
 .../virtio/virtio-md-stubs.c                  |   0
 stubs/colo.c => migration/colo-stubs.c        |   0
 monitor/qemu-config-qmp.c                     | 206 ++++++++++++++++++
 stubs/colo-compare.c => net/colo-stubs.c      |   0
 .../semihost-all.c => semihosting/stubs-all.c |   0
 .../semihost.c => semihosting/stubs-system.c  |   0
 stubs/fdset.c                                 |   6 +
 {hw/core => stubs}/hotplug-stubs.c            |   0
 stubs/isa-bus.c                               |   7 -
 stubs/module-opts.c                           |   2 -
 stubs/monitor-core.c                          |   6 -
 stubs/{monitor.c => monitor-internal.c}       |   5 -
 stubs/pci-bus.c                               |   7 -
 stubs/qdev.c                                  |   6 -
 stubs/qtest.c                                 |  10 -
 stubs/replay-mode.c                           |   4 +
 stubs/replay.c                                |   2 -
 util/qemu-config.c                            | 204 +----------------
 ebpf/meson.build                              |   2 +-
 hw/core/meson.build                           |  14 +-
 hw/display/meson.build                        |   2 +-
 hw/mem/meson.build                            |   1 +
 hw/usb/meson.build                            |   2 +-
 hw/virtio/meson.build                         |   3 +-
 migration/meson.build                         |   2 +
 monitor/meson.build                           |   1 +
 net/meson.build                               |   2 +
 semihosting/meson.build                       |   3 +
 stubs/meson.build                             | 133 ++++++-----
 tests/meson.build                             |   2 +-
 tests/unit/meson.build                        |  12 +-
 util/meson.build                              |   2 +-
 38 files changed, 328 insertions(+), 336 deletions(-)
 rename stubs/ramfb.c => hw/display/ramfb-stubs.c (100%)
 rename stubs/memory_device.c => hw/mem/memory-device-stubs.c (100%)
 rename stubs/usb-dev-stub.c => hw/usb/bus-stub.c (83%)
 rename stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c (100%)
 rename stubs/colo.c => migration/colo-stubs.c (100%)
 create mode 100644 monitor/qemu-config-qmp.c
 rename stubs/colo-compare.c => net/colo-stubs.c (100%)
 rename stubs/semihost-all.c => semihosting/stubs-all.c (100%)
 rename stubs/semihost.c => semihosting/stubs-system.c (100%)
 rename {hw/core => stubs}/hotplug-stubs.c (100%)
 delete mode 100644 stubs/isa-bus.c
 delete mode 100644 stubs/module-opts.c
 rename stubs/{monitor.c => monitor-internal.c} (79%)
 delete mode 100644 stubs/pci-bus.c
 create mode 100644 stubs/replay-mode.c

-- 
2.44.0



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v2 01/18] meson: do not link pixman automatically into all targets
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 16:41   ` Richard Henderson
  2024-04-08 15:53 ` [PATCH v2 02/18] tests: only build plugins if TCG is enabled Paolo Bonzini
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

The dependency on pixman is listed manually in all sourcesets that need it.
There is no need to bring into libqemuutil, since there is nothing in
util/ that needs pixman either.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index c9c3217ba4b..09668e3c5f5 100644
--- a/meson.build
+++ b/meson.build
@@ -3477,7 +3477,7 @@ util_ss = util_ss.apply({})
 libqemuutil = static_library('qemuutil',
                              build_by_default: false,
                              sources: util_ss.sources() + stub_ss.sources() + genh,
-                             dependencies: [util_ss.dependencies(), libm, threads, glib, socket, malloc, pixman])
+                             dependencies: [util_ss.dependencies(), libm, threads, glib, socket, malloc])
 qemuutil = declare_dependency(link_with: libqemuutil,
                               sources: genh + version_res,
                               dependencies: [event_loop_base])
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 02/18] tests: only build plugins if TCG is enabled
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 01/18] meson: do not link pixman automatically into all targets Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:54   ` Philippe Mathieu-Daudé
  2024-04-08 17:03   ` Richard Henderson
  2024-04-08 15:53 ` [PATCH v2 03/18] ebpf: Restrict to system emulation Paolo Bonzini
                   ` (15 subsequent siblings)
  17 siblings, 2 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

There is no way to use them for testing, if all the available
accelerators use hardware virtualization.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/meson.build b/tests/meson.build
index 0a6f96f8f84..acb6807094b 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -78,9 +78,9 @@ subdir('decode')
 
 if 'CONFIG_TCG' in config_all_accel
   subdir('fp')
+  subdir('plugin')
 endif
 
-subdir('plugin')
 subdir('unit')
 subdir('qapi-schema')
 subdir('qtest')
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 03/18] ebpf: Restrict to system emulation
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 01/18] meson: do not link pixman automatically into all targets Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 02/18] tests: only build plugins if TCG is enabled Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 04/18] tests/unit: match some unit tests to corresponding feature switches Paolo Bonzini
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

From: Philippe Mathieu-Daudé <philmd@linaro.org>

eBPF is not used in user emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240404194757.9343-2-philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 ebpf/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ebpf/meson.build b/ebpf/meson.build
index c5bf9295a20..bff6156f518 100644
--- a/ebpf/meson.build
+++ b/ebpf/meson.build
@@ -1 +1 @@
-common_ss.add(when: libbpf, if_true: files('ebpf.c', 'ebpf_rss.c'), if_false: files('ebpf_rss-stub.c'))
+system_ss.add(when: libbpf, if_true: files('ebpf.c', 'ebpf_rss.c'), if_false: files('ebpf_rss-stub.c'))
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 04/18] tests/unit: match some unit tests to corresponding feature switches
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (2 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 03/18] ebpf: Restrict to system emulation Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 16:42   ` Richard Henderson
  2024-04-08 15:53 ` [PATCH v2 05/18] yank: only build if needed Paolo Bonzini
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Try not to test code that is not used by user mode emulation, or by the
block layer, unless they are being compiled; and fix test-timed-average
which was not compiled with --disable-system --enable-tools.

This is by no means complete, it only touches the more blatantly
wrong cases.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/unit/meson.build | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/unit/meson.build b/tests/unit/meson.build
index 228a21d03c2..26c109c968c 100644
--- a/tests/unit/meson.build
+++ b/tests/unit/meson.build
@@ -18,7 +18,6 @@ tests = {
   'test-forward-visitor': [testqapi],
   'test-string-input-visitor': [testqapi],
   'test-string-output-visitor': [testqapi],
-  'test-opts-visitor': [testqapi],
   'test-visitor-serialization': [testqapi],
   'test-bitmap': [],
   'test-resv-mem': [],
@@ -46,12 +45,8 @@ tests = {
   'test-qemu-opts': [],
   'test-keyval': [testqapi],
   'test-logging': [],
-  'test-uuid': [],
-  'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
   'test-qapi-util': [],
   'test-interval-tree': [],
-  'test-xs-node': [qom],
-  'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'],
 }
 
 if have_system or have_tools
@@ -97,6 +92,8 @@ if have_block
     'test-crypto-ivgen': [io],
     'test-crypto-afsplit': [io],
     'test-crypto-block': [io],
+    'test-timed-average': [],
+    'test-uuid': [],
   }
   if gnutls.found() and \
      tasn1.found() and \
@@ -131,10 +128,13 @@ endif
 
 if have_system
   tests += {
+    'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
     'test-iov': [],
+    'test-opts-visitor': [testqapi],
+    'test-xs-node': [qom],
+    'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'],
     'test-qmp-cmds': [testqapi],
     'test-xbzrle': [migration],
-    'test-timed-average': [],
     'test-util-sockets': ['socket-helpers.c'],
     'test-base64': [],
     'test-bufferiszero': [],
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 05/18] yank: only build if needed
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (3 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 04/18] tests/unit: match some unit tests to corresponding feature switches Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:55   ` Philippe Mathieu-Daudé
  2024-04-08 16:42   ` Richard Henderson
  2024-04-08 15:53 ` [PATCH v2 06/18] util/qemu-config: Extract QMP commands to qemu-config-qmp.c Paolo Bonzini
                   ` (12 subsequent siblings)
  17 siblings, 2 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

The yank feature is not used in user emulation.

Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 util/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/meson.build b/util/meson.build
index 0ef9886be04..2ad57b10ba2 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -60,7 +60,6 @@ util_ss.add(files('stats64.c'))
 util_ss.add(files('systemd.c'))
 util_ss.add(files('transactions.c'))
 util_ss.add(files('guest-random.c'))
-util_ss.add(files('yank.c'))
 util_ss.add(files('int128.c'))
 util_ss.add(files('memalign.c'))
 util_ss.add(files('interval-tree.c'))
@@ -117,6 +116,7 @@ if have_block
     util_ss.add(files('vfio-helpers.c'))
     util_ss.add(files('chardev_open.c'))
   endif
+  util_ss.add(files('yank.c'))
 endif
 
 if cpu == 'aarch64'
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 06/18] util/qemu-config: Extract QMP commands to qemu-config-qmp.c
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (4 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 05/18] yank: only build if needed Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 07/18] hw/core: Move system emulation files to system_ss Paolo Bonzini
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

From: Philippe Mathieu-Daudé <philmd@linaro.org>

QMP is irrelevant for user emulation. Extract the code
related to QMP in a different source file, which won't
be build for user emulation binaries. This avoid pulling
pointless code.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240404194757.9343-5-philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu/config-file.h |   3 +
 monitor/qemu-config-qmp.c  | 206 +++++++++++++++++++++++++++++++++++++
 util/qemu-config.c         | 204 +-----------------------------------
 monitor/meson.build        |   1 +
 4 files changed, 212 insertions(+), 202 deletions(-)
 create mode 100644 monitor/qemu-config-qmp.c

diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h
index b82a778123f..51b310fa3b4 100644
--- a/include/qemu/config-file.h
+++ b/include/qemu/config-file.h
@@ -8,6 +8,9 @@ QemuOptsList *qemu_find_opts(const char *group);
 QemuOptsList *qemu_find_opts_err(const char *group, Error **errp);
 QemuOpts *qemu_find_opts_singleton(const char *group);
 
+extern QemuOptsList *vm_config_groups[];
+extern QemuOptsList *drive_config_groups[];
+
 void qemu_add_opts(QemuOptsList *list);
 void qemu_add_drive_opts(QemuOptsList *list);
 int qemu_global_option(const char *str);
diff --git a/monitor/qemu-config-qmp.c b/monitor/qemu-config-qmp.c
new file mode 100644
index 00000000000..24477a0e448
--- /dev/null
+++ b/monitor/qemu-config-qmp.c
@@ -0,0 +1,206 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
+#include "qapi/qmp/qlist.h"
+#include "qemu/option.h"
+#include "qemu/config-file.h"
+#include "hw/boards.h"
+
+static CommandLineParameterInfoList *query_option_descs(const QemuOptDesc *desc)
+{
+    CommandLineParameterInfoList *param_list = NULL;
+    CommandLineParameterInfo *info;
+    int i;
+
+    for (i = 0; desc[i].name != NULL; i++) {
+        info = g_malloc0(sizeof(*info));
+        info->name = g_strdup(desc[i].name);
+
+        switch (desc[i].type) {
+        case QEMU_OPT_STRING:
+            info->type = COMMAND_LINE_PARAMETER_TYPE_STRING;
+            break;
+        case QEMU_OPT_BOOL:
+            info->type = COMMAND_LINE_PARAMETER_TYPE_BOOLEAN;
+            break;
+        case QEMU_OPT_NUMBER:
+            info->type = COMMAND_LINE_PARAMETER_TYPE_NUMBER;
+            break;
+        case QEMU_OPT_SIZE:
+            info->type = COMMAND_LINE_PARAMETER_TYPE_SIZE;
+            break;
+        }
+
+        info->help = g_strdup(desc[i].help);
+        info->q_default = g_strdup(desc[i].def_value_str);
+
+        QAPI_LIST_PREPEND(param_list, info);
+    }
+
+    return param_list;
+}
+
+/* remove repeated entry from the info list */
+static void cleanup_infolist(CommandLineParameterInfoList *head)
+{
+    CommandLineParameterInfoList *pre_entry, *cur, *del_entry;
+
+    cur = head;
+    while (cur->next) {
+        pre_entry = head;
+        while (pre_entry != cur->next) {
+            if (!strcmp(pre_entry->value->name, cur->next->value->name)) {
+                del_entry = cur->next;
+                cur->next = cur->next->next;
+                del_entry->next = NULL;
+                qapi_free_CommandLineParameterInfoList(del_entry);
+                break;
+            }
+            pre_entry = pre_entry->next;
+        }
+        cur = cur->next;
+    }
+}
+
+/* merge the description items of two parameter infolists */
+static void connect_infolist(CommandLineParameterInfoList *head,
+                             CommandLineParameterInfoList *new)
+{
+    CommandLineParameterInfoList *cur;
+
+    cur = head;
+    while (cur->next) {
+        cur = cur->next;
+    }
+    cur->next = new;
+}
+
+/* access all the local QemuOptsLists for drive option */
+static CommandLineParameterInfoList *get_drive_infolist(void)
+{
+    CommandLineParameterInfoList *head = NULL, *cur;
+    int i;
+
+    for (i = 0; drive_config_groups[i] != NULL; i++) {
+        if (!head) {
+            head = query_option_descs(drive_config_groups[i]->desc);
+        } else {
+            cur = query_option_descs(drive_config_groups[i]->desc);
+            connect_infolist(head, cur);
+        }
+    }
+    cleanup_infolist(head);
+
+    return head;
+}
+
+static CommandLineParameterInfo *objprop_to_cmdline_prop(ObjectProperty *prop)
+{
+    CommandLineParameterInfo *info;
+
+    info = g_malloc0(sizeof(*info));
+    info->name = g_strdup(prop->name);
+
+    if (g_str_equal(prop->type, "bool") || g_str_equal(prop->type, "OnOffAuto")) {
+        info->type = COMMAND_LINE_PARAMETER_TYPE_BOOLEAN;
+    } else if (g_str_equal(prop->type, "int")) {
+        info->type = COMMAND_LINE_PARAMETER_TYPE_NUMBER;
+    } else if (g_str_equal(prop->type, "size")) {
+        info->type = COMMAND_LINE_PARAMETER_TYPE_SIZE;
+    } else {
+        info->type = COMMAND_LINE_PARAMETER_TYPE_STRING;
+    }
+
+    if (prop->description) {
+        info->help = g_strdup(prop->description);
+    }
+
+    return info;
+}
+
+static CommandLineParameterInfoList *query_all_machine_properties(void)
+{
+    CommandLineParameterInfoList *params = NULL, *clpiter;
+    CommandLineParameterInfo *info;
+    GSList *machines, *curr_mach;
+    ObjectPropertyIterator op_iter;
+    ObjectProperty *prop;
+    bool is_new;
+
+    machines = object_class_get_list(TYPE_MACHINE, false);
+    assert(machines);
+
+    /* Loop over all machine classes */
+    for (curr_mach = machines; curr_mach; curr_mach = curr_mach->next) {
+        object_class_property_iter_init(&op_iter, curr_mach->data);
+        /* ... and over the properties of each machine: */
+        while ((prop = object_property_iter_next(&op_iter))) {
+            if (!prop->set) {
+                continue;
+            }
+            /*
+             * Check whether the property has already been put into the list
+             * (via another machine class)
+             */
+            is_new = true;
+            for (clpiter = params; clpiter != NULL; clpiter = clpiter->next) {
+                if (g_str_equal(clpiter->value->name, prop->name)) {
+                    is_new = false;
+                    break;
+                }
+            }
+            /* If it hasn't been added before, add it now to the list */
+            if (is_new) {
+                info = objprop_to_cmdline_prop(prop);
+                QAPI_LIST_PREPEND(params, info);
+            }
+        }
+    }
+
+    g_slist_free(machines);
+
+    /* Add entry for the "type" parameter */
+    info = g_malloc0(sizeof(*info));
+    info->name = g_strdup("type");
+    info->type = COMMAND_LINE_PARAMETER_TYPE_STRING;
+    info->help = g_strdup("machine type");
+    QAPI_LIST_PREPEND(params, info);
+
+    return params;
+}
+
+CommandLineOptionInfoList *qmp_query_command_line_options(const char *option,
+                                                          Error **errp)
+{
+    CommandLineOptionInfoList *conf_list = NULL;
+    CommandLineOptionInfo *info;
+    int i;
+
+    for (i = 0; vm_config_groups[i] != NULL; i++) {
+        if (!option || !strcmp(option, vm_config_groups[i]->name)) {
+            info = g_malloc0(sizeof(*info));
+            info->option = g_strdup(vm_config_groups[i]->name);
+            if (!strcmp("drive", vm_config_groups[i]->name)) {
+                info->parameters = get_drive_infolist();
+            } else {
+                info->parameters =
+                    query_option_descs(vm_config_groups[i]->desc);
+            }
+            QAPI_LIST_PREPEND(conf_list, info);
+        }
+    }
+
+    if (!option || !strcmp(option, "machine")) {
+        info = g_malloc0(sizeof(*info));
+        info->option = g_strdup("machine");
+        info->parameters = query_all_machine_properties();
+        QAPI_LIST_PREPEND(conf_list, info);
+    }
+
+    if (conf_list == NULL) {
+        error_setg(errp, "invalid option name: %s", option);
+    }
+
+    return conf_list;
+}
diff --git a/util/qemu-config.c b/util/qemu-config.c
index 42076efe1ef..a90c18dad25 100644
--- a/util/qemu-config.c
+++ b/util/qemu-config.c
@@ -1,16 +1,14 @@
 #include "qemu/osdep.h"
 #include "block/qdict.h" /* for qdict_extract_subqdict() */
 #include "qapi/error.h"
-#include "qapi/qapi-commands-misc.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qlist.h"
 #include "qemu/error-report.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
-#include "hw/boards.h"
 
-static QemuOptsList *vm_config_groups[48];
-static QemuOptsList *drive_config_groups[5];
+QemuOptsList *vm_config_groups[48];
+QemuOptsList *drive_config_groups[5];
 
 static QemuOptsList *find_list(QemuOptsList **lists, const char *group,
                                Error **errp)
@@ -55,204 +53,6 @@ QemuOpts *qemu_find_opts_singleton(const char *group)
     return opts;
 }
 
-static CommandLineParameterInfoList *query_option_descs(const QemuOptDesc *desc)
-{
-    CommandLineParameterInfoList *param_list = NULL;
-    CommandLineParameterInfo *info;
-    int i;
-
-    for (i = 0; desc[i].name != NULL; i++) {
-        info = g_malloc0(sizeof(*info));
-        info->name = g_strdup(desc[i].name);
-
-        switch (desc[i].type) {
-        case QEMU_OPT_STRING:
-            info->type = COMMAND_LINE_PARAMETER_TYPE_STRING;
-            break;
-        case QEMU_OPT_BOOL:
-            info->type = COMMAND_LINE_PARAMETER_TYPE_BOOLEAN;
-            break;
-        case QEMU_OPT_NUMBER:
-            info->type = COMMAND_LINE_PARAMETER_TYPE_NUMBER;
-            break;
-        case QEMU_OPT_SIZE:
-            info->type = COMMAND_LINE_PARAMETER_TYPE_SIZE;
-            break;
-        }
-
-        info->help = g_strdup(desc[i].help);
-        info->q_default = g_strdup(desc[i].def_value_str);
-
-        QAPI_LIST_PREPEND(param_list, info);
-    }
-
-    return param_list;
-}
-
-/* remove repeated entry from the info list */
-static void cleanup_infolist(CommandLineParameterInfoList *head)
-{
-    CommandLineParameterInfoList *pre_entry, *cur, *del_entry;
-
-    cur = head;
-    while (cur->next) {
-        pre_entry = head;
-        while (pre_entry != cur->next) {
-            if (!strcmp(pre_entry->value->name, cur->next->value->name)) {
-                del_entry = cur->next;
-                cur->next = cur->next->next;
-                del_entry->next = NULL;
-                qapi_free_CommandLineParameterInfoList(del_entry);
-                break;
-            }
-            pre_entry = pre_entry->next;
-        }
-        cur = cur->next;
-    }
-}
-
-/* merge the description items of two parameter infolists */
-static void connect_infolist(CommandLineParameterInfoList *head,
-                             CommandLineParameterInfoList *new)
-{
-    CommandLineParameterInfoList *cur;
-
-    cur = head;
-    while (cur->next) {
-        cur = cur->next;
-    }
-    cur->next = new;
-}
-
-/* access all the local QemuOptsLists for drive option */
-static CommandLineParameterInfoList *get_drive_infolist(void)
-{
-    CommandLineParameterInfoList *head = NULL, *cur;
-    int i;
-
-    for (i = 0; drive_config_groups[i] != NULL; i++) {
-        if (!head) {
-            head = query_option_descs(drive_config_groups[i]->desc);
-        } else {
-            cur = query_option_descs(drive_config_groups[i]->desc);
-            connect_infolist(head, cur);
-        }
-    }
-    cleanup_infolist(head);
-
-    return head;
-}
-
-static CommandLineParameterInfo *objprop_to_cmdline_prop(ObjectProperty *prop)
-{
-    CommandLineParameterInfo *info;
-
-    info = g_malloc0(sizeof(*info));
-    info->name = g_strdup(prop->name);
-
-    if (g_str_equal(prop->type, "bool") || g_str_equal(prop->type, "OnOffAuto")) {
-        info->type = COMMAND_LINE_PARAMETER_TYPE_BOOLEAN;
-    } else if (g_str_equal(prop->type, "int")) {
-        info->type = COMMAND_LINE_PARAMETER_TYPE_NUMBER;
-    } else if (g_str_equal(prop->type, "size")) {
-        info->type = COMMAND_LINE_PARAMETER_TYPE_SIZE;
-    } else {
-        info->type = COMMAND_LINE_PARAMETER_TYPE_STRING;
-    }
-
-    if (prop->description) {
-        info->help = g_strdup(prop->description);
-    }
-
-    return info;
-}
-
-static CommandLineParameterInfoList *query_all_machine_properties(void)
-{
-    CommandLineParameterInfoList *params = NULL, *clpiter;
-    CommandLineParameterInfo *info;
-    GSList *machines, *curr_mach;
-    ObjectPropertyIterator op_iter;
-    ObjectProperty *prop;
-    bool is_new;
-
-    machines = object_class_get_list(TYPE_MACHINE, false);
-    assert(machines);
-
-    /* Loop over all machine classes */
-    for (curr_mach = machines; curr_mach; curr_mach = curr_mach->next) {
-        object_class_property_iter_init(&op_iter, curr_mach->data);
-        /* ... and over the properties of each machine: */
-        while ((prop = object_property_iter_next(&op_iter))) {
-            if (!prop->set) {
-                continue;
-            }
-            /*
-             * Check whether the property has already been put into the list
-             * (via another machine class)
-             */
-            is_new = true;
-            for (clpiter = params; clpiter != NULL; clpiter = clpiter->next) {
-                if (g_str_equal(clpiter->value->name, prop->name)) {
-                    is_new = false;
-                    break;
-                }
-            }
-            /* If it hasn't been added before, add it now to the list */
-            if (is_new) {
-                info = objprop_to_cmdline_prop(prop);
-                QAPI_LIST_PREPEND(params, info);
-            }
-        }
-    }
-
-    g_slist_free(machines);
-
-    /* Add entry for the "type" parameter */
-    info = g_malloc0(sizeof(*info));
-    info->name = g_strdup("type");
-    info->type = COMMAND_LINE_PARAMETER_TYPE_STRING;
-    info->help = g_strdup("machine type");
-    QAPI_LIST_PREPEND(params, info);
-
-    return params;
-}
-
-CommandLineOptionInfoList *qmp_query_command_line_options(const char *option,
-                                                          Error **errp)
-{
-    CommandLineOptionInfoList *conf_list = NULL;
-    CommandLineOptionInfo *info;
-    int i;
-
-    for (i = 0; vm_config_groups[i] != NULL; i++) {
-        if (!option || !strcmp(option, vm_config_groups[i]->name)) {
-            info = g_malloc0(sizeof(*info));
-            info->option = g_strdup(vm_config_groups[i]->name);
-            if (!strcmp("drive", vm_config_groups[i]->name)) {
-                info->parameters = get_drive_infolist();
-            } else {
-                info->parameters =
-                    query_option_descs(vm_config_groups[i]->desc);
-            }
-            QAPI_LIST_PREPEND(conf_list, info);
-        }
-    }
-
-    if (!option || !strcmp(option, "machine")) {
-        info = g_malloc0(sizeof(*info));
-        info->option = g_strdup("machine");
-        info->parameters = query_all_machine_properties();
-        QAPI_LIST_PREPEND(conf_list, info);
-    }
-
-    if (conf_list == NULL) {
-        error_setg(errp, "invalid option name: %s", option);
-    }
-
-    return conf_list;
-}
-
 QemuOptsList *qemu_find_opts_err(const char *group, Error **errp)
 {
     return find_list(vm_config_groups, group, errp);
diff --git a/monitor/meson.build b/monitor/meson.build
index 5269492cf05..a71523a1ce8 100644
--- a/monitor/meson.build
+++ b/monitor/meson.build
@@ -4,6 +4,7 @@ system_ss.add(files(
   'fds.c',
   'hmp-cmds.c',
   'hmp.c',
+  'qemu-config-qmp.c',
 ))
 system_ss.add([spice_headers, files('qmp-cmds.c')])
 
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 07/18] hw/core: Move system emulation files to system_ss
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (5 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 06/18] util/qemu-config: Extract QMP commands to qemu-config-qmp.c Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 16:45   ` Richard Henderson
  2024-04-08 15:53 ` [PATCH v2 08/18] hw: Include minimal source set in user emulation build Paolo Bonzini
                   ` (10 subsequent siblings)
  17 siblings, 1 reply; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

hotplug.c, qdev-hotplug.c and reset.c are not used by user emulation
and need not be included in hwcore_ss.  Move them to system_ss, where
they belong, by letting the linker pull in the stubs when needed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 {hw/core => stubs}/hotplug-stubs.c |  0
 hw/core/meson.build                | 14 +++-----------
 stubs/meson.build                  |  1 +
 3 files changed, 4 insertions(+), 11 deletions(-)
 rename {hw/core => stubs}/hotplug-stubs.c (100%)

diff --git a/hw/core/hotplug-stubs.c b/stubs/hotplug-stubs.c
similarity index 100%
rename from hw/core/hotplug-stubs.c
rename to stubs/hotplug-stubs.c
diff --git a/hw/core/meson.build b/hw/core/meson.build
index e26f2e088c3..f20d4143f7a 100644
--- a/hw/core/meson.build
+++ b/hw/core/meson.build
@@ -3,7 +3,6 @@ hwcore_ss.add(files(
   'bus.c',
   'qdev-properties.c',
   'qdev.c',
-  'reset.c',
   'resetcontainer.c',
   'resettable.c',
   'vmstate-if.c',
@@ -12,16 +11,6 @@ hwcore_ss.add(files(
   'clock.c',
   'qdev-clock.c',
 ))
-if have_system
-  hwcore_ss.add(files(
-    'hotplug.c',
-    'qdev-hotplug.c',
-  ))
-else
-  hwcore_ss.add(files(
-    'hotplug-stubs.c',
-  ))
-endif
 
 common_ss.add(files('cpu-common.c'))
 common_ss.add(files('machine-smp.c'))
@@ -40,6 +29,7 @@ system_ss.add(files(
   'cpu-sysemu.c',
   'fw-path-provider.c',
   'gpio.c',
+  'hotplug.c',
   'loader.c',
   'machine-hmp-cmds.c',
   'machine-qmp-cmds.c',
@@ -48,7 +38,9 @@ system_ss.add(files(
   'null-machine.c',
   'numa.c',
   'qdev-fw.c',
+  'qdev-hotplug.c',
   'qdev-properties-system.c',
+  'reset.c',
   'sysbus.c',
   'vm-change-state-handler.c',
   'clock-vmstate.c',
diff --git a/stubs/meson.build b/stubs/meson.build
index 0bf25e6ca53..f87f5c1110f 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -14,6 +14,7 @@ stub_ss.add(files('fdset.c'))
 stub_ss.add(files('gdbstub.c'))
 stub_ss.add(files('get-vm-name.c'))
 stub_ss.add(files('graph-lock.c'))
+stub_ss.add(files('hotplug-stubs.c'))
 if linux_io_uring.found()
   stub_ss.add(files('io_uring.c'))
 endif
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 08/18] hw: Include minimal source set in user emulation build
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (6 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 07/18] hw/core: Move system emulation files to system_ss Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 09/18] stubs: remove obsolete stubs Paolo Bonzini
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

From: Philippe Mathieu-Daudé <philmd@linaro.org>

Only the files in hwcore_ss[] are required to link a user emulation
binary.

Have meson process the hw/ sub-directories if system emulation is
selected, otherwise directly process hw/core/ to get hwcore_ss[], which
is the only set required by user emulation.

This removes about 10% from the time needed to run
"../configure --disable-system --disable-tools --disable-guest-agent".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240404194757.9343-8-philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 09668e3c5f5..e8ac846fc5a 100644
--- a/meson.build
+++ b/meson.build
@@ -3447,8 +3447,12 @@ subdir('qom')
 subdir('authz')
 subdir('crypto')
 subdir('ui')
-subdir('hw')
 subdir('gdbstub')
+if have_system
+  subdir('hw')
+else
+  subdir('hw/core')
+endif
 
 if enable_modules
   libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 09/18] stubs: remove obsolete stubs
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (7 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 08/18] hw: Include minimal source set in user emulation build Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 16:46   ` Richard Henderson
  2024-04-08 15:53 ` [PATCH v2 10/18] hw/usb: move stubs out of stubs/ Paolo Bonzini
                   ` (8 subsequent siblings)
  17 siblings, 1 reply; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

These file define functions are are not called from common code
anymore.  Delete those functions and, if applicable, the entire files.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/sysemu/sysemu.h |  2 --
 stubs/isa-bus.c         |  7 -------
 stubs/module-opts.c     |  2 --
 stubs/monitor-core.c    |  6 ------
 stubs/pci-bus.c         |  7 -------
 stubs/qdev.c            |  6 ------
 stubs/qtest.c           | 10 ----------
 stubs/usb-dev-stub.c    |  5 -----
 stubs/meson.build       |  3 ---
 9 files changed, 48 deletions(-)
 delete mode 100644 stubs/isa-bus.c
 delete mode 100644 stubs/module-opts.c
 delete mode 100644 stubs/pci-bus.c

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index eb1dc1e4eda..5b4397eeb80 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -71,8 +71,6 @@ Chardev *serial_hd(int i);
 
 extern Chardev *parallel_hds[MAX_PARALLEL_PORTS];
 
-void hmp_info_usb(Monitor *mon, const QDict *qdict);
-
 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
                           const char *suffix);
 char *get_boot_devices_list(size_t *size);
diff --git a/stubs/isa-bus.c b/stubs/isa-bus.c
deleted file mode 100644
index 522f448997d..00000000000
--- a/stubs/isa-bus.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "hw/isa/isa.h"
-
-ISADevice *isa_create_simple(ISABus *bus, const char *name)
-{
-    g_assert_not_reached();
-}
diff --git a/stubs/module-opts.c b/stubs/module-opts.c
deleted file mode 100644
index 5412429ea86..00000000000
--- a/stubs/module-opts.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu/config-file.h"
diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c
index afa477aae65..1894cdfe1f8 100644
--- a/stubs/monitor-core.c
+++ b/stubs/monitor-core.c
@@ -12,10 +12,6 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
     return NULL;
 }
 
-void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
-{
-}
-
 void qapi_event_emit(QAPIEvent event, QDict *qdict)
 {
 }
@@ -24,5 +20,3 @@ int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
 {
     abort();
 }
-
-
diff --git a/stubs/pci-bus.c b/stubs/pci-bus.c
deleted file mode 100644
index a8932fa9325..00000000000
--- a/stubs/pci-bus.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "hw/pci/pci.h"
-
-PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
-{
-    g_assert_not_reached();
-}
diff --git a/stubs/qdev.c b/stubs/qdev.c
index 6869f6f90a2..7e957b3e524 100644
--- a/stubs/qdev.c
+++ b/stubs/qdev.c
@@ -20,9 +20,3 @@ void qapi_event_send_device_deleted(const char *device,
 {
     /* Nothing to do. */
 }
-
-void qapi_event_send_device_unplug_guest_error(const char *device,
-                                               const char *path)
-{
-    /* Nothing to do. */
-}
diff --git a/stubs/qtest.c b/stubs/qtest.c
index 4666a49d7d1..39e376eb67d 100644
--- a/stubs/qtest.c
+++ b/stubs/qtest.c
@@ -13,13 +13,3 @@
 
 /* Needed for qtest_allowed() */
 bool qtest_allowed;
-
-bool qtest_driver(void)
-{
-    return false;
-}
-
-int64_t qtest_get_virtual_clock(void)
-{
-    return 0;
-}
diff --git a/stubs/usb-dev-stub.c b/stubs/usb-dev-stub.c
index aa557692b71..fcabe8429e6 100644
--- a/stubs/usb-dev-stub.c
+++ b/stubs/usb-dev-stub.c
@@ -26,8 +26,3 @@ HumanReadableText *qmp_x_query_usb(Error **errp)
     error_setg(errp, "Support for USB devices not built-in");
     return NULL;
 }
-
-void hmp_info_usb(Monitor *mon, const QDict *qdict)
-{
-    monitor_printf(mon, "Support for USB devices not built-in\n");
-}
diff --git a/stubs/meson.build b/stubs/meson.build
index f87f5c1110f..aa7120f7110 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -22,13 +22,11 @@ stub_ss.add(files('iothread-lock.c'))
 if have_block
   stub_ss.add(files('iothread-lock-block.c'))
 endif
-stub_ss.add(files('isa-bus.c'))
 stub_ss.add(files('is-daemonized.c'))
 if libaio.found()
   stub_ss.add(files('linux-aio.c'))
 endif
 stub_ss.add(files('migr-blocker.c'))
-stub_ss.add(files('module-opts.c'))
 stub_ss.add(files('monitor.c'))
 stub_ss.add(files('monitor-core.c'))
 stub_ss.add(files('physmem.c'))
@@ -57,7 +55,6 @@ if have_block or have_ga
 endif
 if have_system
   stub_ss.add(files('fw_cfg.c'))
-  stub_ss.add(files('pci-bus.c'))
   stub_ss.add(files('semihost.c'))
   stub_ss.add(files('usb-dev-stub.c'))
   stub_ss.add(files('xen-hw-stub.c'))
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 10/18] hw/usb: move stubs out of stubs/
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (8 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 09/18] stubs: remove obsolete stubs Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:59   ` Philippe Mathieu-Daudé
  2024-04-08 16:47   ` Richard Henderson
  2024-04-08 15:53 ` [PATCH v2 11/18] hw/virtio: " Paolo Bonzini
                   ` (7 subsequent siblings)
  17 siblings, 2 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Since the USB stubs are needed exactly when the Kconfig symbols are not
enabled, they can be placed in hw/usb/ and conditionalized on CONFIG_USB.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 0
 hw/usb/meson.build                        | 2 +-
 stubs/meson.build                         | 1 -
 3 files changed, 1 insertion(+), 2 deletions(-)
 rename stubs/usb-dev-stub.c => hw/usb/bus-stub.c (100%)

diff --git a/stubs/usb-dev-stub.c b/hw/usb/bus-stub.c
similarity index 100%
rename from stubs/usb-dev-stub.c
rename to hw/usb/bus-stub.c
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
index aac3bb35f27..23f7f7acb50 100644
--- a/hw/usb/meson.build
+++ b/hw/usb/meson.build
@@ -9,7 +9,7 @@ system_ss.add(when: 'CONFIG_USB', if_true: files(
   'desc-msos.c',
   'libhw.c',
   'pcap.c',
-))
+), if_false: files('bus-stub.c'))
 
 # usb host adapters
 system_ss.add(when: 'CONFIG_USB_UHCI', if_true: files('hcd-uhci.c'))
diff --git a/stubs/meson.build b/stubs/meson.build
index aa7120f7110..45616afbfaa 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -56,7 +56,6 @@ endif
 if have_system
   stub_ss.add(files('fw_cfg.c'))
   stub_ss.add(files('semihost.c'))
-  stub_ss.add(files('usb-dev-stub.c'))
   stub_ss.add(files('xen-hw-stub.c'))
   stub_ss.add(files('virtio-md-pci.c'))
 else
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 11/18] hw/virtio: move stubs out of stubs/
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (9 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 10/18] hw/usb: move stubs out of stubs/ Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 16:47   ` Richard Henderson
  2024-04-08 15:53 ` [PATCH v2 12/18] semihosting: " Paolo Bonzini
                   ` (6 subsequent siblings)
  17 siblings, 1 reply; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

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



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 12/18] semihosting: move stubs out of stubs/
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (10 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 11/18] hw/virtio: " Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 13/18] ramfb: " Paolo Bonzini
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Since the semihosting stubs are needed exactly when the Kconfig symbols
are not needed, move them to semihosting/ and conditionalize them
on CONFIG_SEMIHOSTING and/or CONFIG_SYSTEM_ONLY.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/semihost-all.c => semihosting/stubs-all.c | 0
 stubs/semihost.c => semihosting/stubs-system.c  | 0
 semihosting/meson.build                         | 3 +++
 stubs/meson.build                               | 2 --
 4 files changed, 3 insertions(+), 2 deletions(-)
 rename stubs/semihost-all.c => semihosting/stubs-all.c (100%)
 rename stubs/semihost.c => semihosting/stubs-system.c (100%)

diff --git a/stubs/semihost-all.c b/semihosting/stubs-all.c
similarity index 100%
rename from stubs/semihost-all.c
rename to semihosting/stubs-all.c
diff --git a/stubs/semihost.c b/semihosting/stubs-system.c
similarity index 100%
rename from stubs/semihost.c
rename to semihosting/stubs-system.c
diff --git a/semihosting/meson.build b/semihosting/meson.build
index b07cbd980f2..34933e5a195 100644
--- a/semihosting/meson.build
+++ b/semihosting/meson.build
@@ -9,5 +9,8 @@ specific_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_true: fil
   'uaccess.c',
 ))
 
+common_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_false: files('stubs-all.c'))
+system_ss.add(when: ['CONFIG_SEMIHOSTING'], if_false: files('stubs-system.c'))
+
 specific_ss.add(when: ['CONFIG_ARM_COMPATIBLE_SEMIHOSTING'],
 		if_true: files('arm-compat-semi.c'))
diff --git a/stubs/meson.build b/stubs/meson.build
index 60e32d363fa..84ecaa4daa1 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -55,9 +55,7 @@ if have_block or have_ga
 endif
 if have_system
   stub_ss.add(files('fw_cfg.c'))
-  stub_ss.add(files('semihost.c'))
   stub_ss.add(files('xen-hw-stub.c'))
 else
   stub_ss.add(files('qdev.c'))
 endif
-stub_ss.add(files('semihost-all.c'))
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 13/18] ramfb: move stubs out of stubs/
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (11 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 12/18] semihosting: " Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:59   ` Philippe Mathieu-Daudé
                     ` (2 more replies)
  2024-04-08 15:53 ` [PATCH v2 14/18] memory-device: " Paolo Bonzini
                   ` (4 subsequent siblings)
  17 siblings, 3 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Since the ramfb stubs are needed exactly when the Kconfig symbols are not
needed, move them to hw/display/ and compile them when ramfb.c is absent.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/ramfb.c => hw/display/ramfb-stubs.c | 0
 hw/display/meson.build                    | 2 +-
 stubs/meson.build                         | 1 -
 3 files changed, 1 insertion(+), 2 deletions(-)
 rename stubs/ramfb.c => hw/display/ramfb-stubs.c (100%)

diff --git a/stubs/ramfb.c b/hw/display/ramfb-stubs.c
similarity index 100%
rename from stubs/ramfb.c
rename to hw/display/ramfb-stubs.c
diff --git a/hw/display/meson.build b/hw/display/meson.build
index f93a69f70f4..4751aab3ba9 100644
--- a/hw/display/meson.build
+++ b/hw/display/meson.build
@@ -3,7 +3,7 @@ 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'))
+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-standalone.c'))
 
 system_ss.add(when: 'CONFIG_VGA_CIRRUS', if_true: files('cirrus_vga.c'))
diff --git a/stubs/meson.build b/stubs/meson.build
index 84ecaa4daa1..92887660e41 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -36,7 +36,6 @@ stub_ss.add(files('qmp-command-available.c'))
 stub_ss.add(files('qmp-quit.c'))
 stub_ss.add(files('qtest.c'))
 stub_ss.add(files('ram-block.c'))
-stub_ss.add(files('ramfb.c'))
 stub_ss.add(files('replay.c'))
 stub_ss.add(files('runstate-check.c'))
 stub_ss.add(files('sysbus.c'))
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 14/18] memory-device: move stubs out of stubs/
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (12 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 13/18] ramfb: " Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 16:50   ` Richard Henderson
  2024-04-08 18:17   ` Philippe Mathieu-Daudé
  2024-04-08 15:53 ` [PATCH v2 15/18] colo: " Paolo Bonzini
                   ` (3 subsequent siblings)
  17 siblings, 2 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Since the memory-device stubs are needed exactly when the Kconfig symbols are not
needed, move them to hw/mem/.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/memory_device.c => hw/mem/memory-device-stubs.c | 0
 hw/mem/meson.build                                    | 1 +
 stubs/meson.build                                     | 1 -
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename stubs/memory_device.c => hw/mem/memory-device-stubs.c (100%)

diff --git a/stubs/memory_device.c b/hw/mem/memory-device-stubs.c
similarity index 100%
rename from stubs/memory_device.c
rename to hw/mem/memory-device-stubs.c
diff --git a/hw/mem/meson.build b/hw/mem/meson.build
index faee1fe9360..1c1c6da24b5 100644
--- a/hw/mem/meson.build
+++ b/hw/mem/meson.build
@@ -6,6 +6,7 @@ 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'))
 
+system_ss.add(when: 'CONFIG_MEM_DEVICE', if_false: 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'))
diff --git a/stubs/meson.build b/stubs/meson.build
index 92887660e41..a4404e765ab 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -31,7 +31,6 @@ stub_ss.add(files('monitor.c'))
 stub_ss.add(files('monitor-core.c'))
 stub_ss.add(files('physmem.c'))
 stub_ss.add(files('qemu-timer-notify-cb.c'))
-stub_ss.add(files('memory_device.c'))
 stub_ss.add(files('qmp-command-available.c'))
 stub_ss.add(files('qmp-quit.c'))
 stub_ss.add(files('qtest.c'))
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 15/18] colo: move stubs out of stubs/
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (13 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 14/18] memory-device: " Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 16/18] stubs: split record/replay stubs further Paolo Bonzini
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Since the colo stubs are needed exactly when the build options are not
enabled, move them together with the code they stub.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/colo.c => migration/colo-stubs.c   | 0
 stubs/colo-compare.c => net/colo-stubs.c | 0
 migration/meson.build                    | 2 ++
 net/meson.build                          | 2 ++
 stubs/meson.build                        | 2 --
 5 files changed, 4 insertions(+), 2 deletions(-)
 rename stubs/colo.c => migration/colo-stubs.c (100%)
 rename stubs/colo-compare.c => net/colo-stubs.c (100%)

diff --git a/stubs/colo.c b/migration/colo-stubs.c
similarity index 100%
rename from stubs/colo.c
rename to migration/colo-stubs.c
diff --git a/stubs/colo-compare.c b/net/colo-stubs.c
similarity index 100%
rename from stubs/colo-compare.c
rename to net/colo-stubs.c
diff --git a/migration/meson.build b/migration/meson.build
index 1eeb915ff63..f76b1ba3289 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -34,6 +34,8 @@ system_ss.add(files(
 
 if get_option('replication').allowed()
   system_ss.add(files('colo-failover.c', 'colo.c'))
+else
+  system_ss.add(files('colo-stubs.c'))
 endif
 
 system_ss.add(when: rdma, if_true: files('rdma.c'))
diff --git a/net/meson.build b/net/meson.build
index 9432a588e4e..e0cd71470e0 100644
--- a/net/meson.build
+++ b/net/meson.build
@@ -20,6 +20,8 @@ if get_option('replication').allowed() or \
     get_option('colo_proxy').allowed()
   system_ss.add(files('colo-compare.c'))
   system_ss.add(files('colo.c'))
+else
+  system_ss.add(files('colo-stubs.c'))
 endif
 
 if get_option('colo_proxy').allowed()
diff --git a/stubs/meson.build b/stubs/meson.build
index a4404e765ab..a252bffad00 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -42,8 +42,6 @@ stub_ss.add(files('target-get-monitor-def.c'))
 stub_ss.add(files('target-monitor-defs.c'))
 stub_ss.add(files('trace-control.c'))
 stub_ss.add(files('uuid.c'))
-stub_ss.add(files('colo.c'))
-stub_ss.add(files('colo-compare.c'))
 stub_ss.add(files('vmstate.c'))
 stub_ss.add(files('vm-stop.c'))
 stub_ss.add(files('win32-kbd-hook.c'))
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 16/18] stubs: split record/replay stubs further
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (14 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 15/18] colo: " Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 16:59   ` Richard Henderson
  2024-04-08 15:53 ` [PATCH v2 17/18] stubs: include stubs only if needed Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 18/18] stubs: move monitor_fdsets_cleanup with other fdset stubs Paolo Bonzini
  17 siblings, 1 reply; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

replay.c symbols are only needed by user mode emulation, with the
exception of replay_mode that is needed by both user mode emulation
(by way of qemu_guest_getrandom) and block layer tools (by way of
util/qemu-timer.c).

Since it is needed by libqemuutil rather than specific files that
are part of the tools and emulators, split the replay_mode stub
into its own file.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/replay-mode.c | 4 ++++
 stubs/replay.c      | 2 --
 stubs/meson.build   | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)
 create mode 100644 stubs/replay-mode.c

diff --git a/stubs/replay-mode.c b/stubs/replay-mode.c
new file mode 100644
index 00000000000..264be9d96c9
--- /dev/null
+++ b/stubs/replay-mode.c
@@ -0,0 +1,4 @@
+#include "qemu/osdep.h"
+#include "sysemu/replay.h"
+
+ReplayMode replay_mode;
diff --git a/stubs/replay.c b/stubs/replay.c
index 42c92e4acb8..b4dd6a566e8 100644
--- a/stubs/replay.c
+++ b/stubs/replay.c
@@ -1,8 +1,6 @@
 #include "qemu/osdep.h"
 #include "exec/replay-core.h"
 
-ReplayMode replay_mode;
-
 void replay_finish(void)
 {
 }
diff --git a/stubs/meson.build b/stubs/meson.build
index a252bffad00..4a524f5816b 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -36,6 +36,7 @@ stub_ss.add(files('qmp-quit.c'))
 stub_ss.add(files('qtest.c'))
 stub_ss.add(files('ram-block.c'))
 stub_ss.add(files('replay.c'))
+stub_ss.add(files('replay-mode.c'))
 stub_ss.add(files('runstate-check.c'))
 stub_ss.add(files('sysbus.c'))
 stub_ss.add(files('target-get-monitor-def.c'))
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 17/18] stubs: include stubs only if needed
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (15 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 16/18] stubs: split record/replay stubs further Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 15:53 ` [PATCH v2 18/18] stubs: move monitor_fdsets_cleanup with other fdset stubs Paolo Bonzini
  17 siblings, 0 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Currently it is not documented anywhere why some functions need to
be stubbed.

Group the files in stubs/meson.build according to who needs them, both
to reduce the size of the compilation and to clarify the use of stubs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/{monitor.c => monitor-internal.c} |   0
 stubs/meson.build                       | 122 +++++++++++++++---------
 2 files changed, 75 insertions(+), 47 deletions(-)
 rename stubs/{monitor.c => monitor-internal.c} (100%)

diff --git a/stubs/monitor.c b/stubs/monitor-internal.c
similarity index 100%
rename from stubs/monitor.c
rename to stubs/monitor-internal.c
diff --git a/stubs/meson.build b/stubs/meson.build
index 4a524f5816b..8ff25faaf1c 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -1,58 +1,86 @@
-stub_ss.add(files('bdrv-next-monitor-owned.c'))
-stub_ss.add(files('blk-commit-all.c'))
-stub_ss.add(files('blk-exp-close-all.c'))
-stub_ss.add(files('blockdev-close-all-bdrv-states.c'))
-stub_ss.add(files('change-state-handler.c'))
-stub_ss.add(files('cmos.c'))
+# If possible, add new files to other directories, by using "if_false".
+# If you need them here, try to add them under one of the if statements
+# below, so that it is clear who needs the stubbed functionality.
+
 stub_ss.add(files('cpu-get-clock.c'))
-stub_ss.add(files('cpus-get-virtual-clock.c'))
-stub_ss.add(files('qemu-timer-notify-cb.c'))
-stub_ss.add(files('icount.c'))
-stub_ss.add(files('dump.c'))
-stub_ss.add(files('error-printf.c'))
 stub_ss.add(files('fdset.c'))
-stub_ss.add(files('gdbstub.c'))
-stub_ss.add(files('get-vm-name.c'))
-stub_ss.add(files('graph-lock.c'))
-stub_ss.add(files('hotplug-stubs.c'))
-if linux_io_uring.found()
-  stub_ss.add(files('io_uring.c'))
-endif
 stub_ss.add(files('iothread-lock.c'))
-if have_block
-  stub_ss.add(files('iothread-lock-block.c'))
-endif
 stub_ss.add(files('is-daemonized.c'))
-if libaio.found()
-  stub_ss.add(files('linux-aio.c'))
-endif
-stub_ss.add(files('migr-blocker.c'))
-stub_ss.add(files('monitor.c'))
 stub_ss.add(files('monitor-core.c'))
-stub_ss.add(files('physmem.c'))
-stub_ss.add(files('qemu-timer-notify-cb.c'))
-stub_ss.add(files('qmp-command-available.c'))
-stub_ss.add(files('qmp-quit.c'))
-stub_ss.add(files('qtest.c'))
-stub_ss.add(files('ram-block.c'))
-stub_ss.add(files('replay.c'))
 stub_ss.add(files('replay-mode.c'))
-stub_ss.add(files('runstate-check.c'))
-stub_ss.add(files('sysbus.c'))
-stub_ss.add(files('target-get-monitor-def.c'))
-stub_ss.add(files('target-monitor-defs.c'))
 stub_ss.add(files('trace-control.c'))
-stub_ss.add(files('uuid.c'))
-stub_ss.add(files('vmstate.c'))
-stub_ss.add(files('vm-stop.c'))
-stub_ss.add(files('win32-kbd-hook.c'))
-stub_ss.add(files('cpu-synchronize-state.c'))
-if have_block or have_ga
+
+if have_block
+  stub_ss.add(files('bdrv-next-monitor-owned.c'))
+  stub_ss.add(files('blk-commit-all.c'))
+  stub_ss.add(files('blk-exp-close-all.c'))
+  stub_ss.add(files('blockdev-close-all-bdrv-states.c'))
+  stub_ss.add(files('change-state-handler.c'))
+  stub_ss.add(files('get-vm-name.c'))
+  stub_ss.add(files('iothread-lock-block.c'))
+  stub_ss.add(files('migr-blocker.c'))
+  stub_ss.add(files('physmem.c'))
+  stub_ss.add(files('ram-block.c'))
   stub_ss.add(files('replay-tools.c'))
+  stub_ss.add(files('runstate-check.c'))
+  stub_ss.add(files('uuid.c'))
 endif
-if have_system
-  stub_ss.add(files('fw_cfg.c'))
-  stub_ss.add(files('xen-hw-stub.c'))
-else
+
+if have_block or have_ga
+  # stubs for hooks in util/main-loop.c, util/async.c etc.
+  stub_ss.add(files('cpus-get-virtual-clock.c'))
+  stub_ss.add(files('icount.c'))
+  stub_ss.add(files('graph-lock.c'))
+  if linux_io_uring.found()
+    stub_ss.add(files('io_uring.c'))
+  endif
+  if libaio.found()
+    stub_ss.add(files('linux-aio.c'))
+  endif
+  stub_ss.add(files('qemu-timer-notify-cb.c'))
+
+  # stubs for monitor
+  stub_ss.add(files('monitor-internal.c'))
+  stub_ss.add(files('qmp-command-available.c'))
+  stub_ss.add(files('qmp-quit.c'))
+endif
+
+if have_block or have_user
+  stub_ss.add(files('qtest.c'))
+  stub_ss.add(files('vm-stop.c'))
+  stub_ss.add(files('vmstate.c'))
+
+  # more symbols provided by the monitor
+  stub_ss.add(files('error-printf.c'))
+endif
+
+if have_user
+  # Symbols that are used by hw/core.
+  stub_ss.add(files('cpu-synchronize-state.c'))
   stub_ss.add(files('qdev.c'))
 endif
+
+if have_system
+  # Symbols that are only needed in some configurations.  Try not
+  # adding more of these.  If the symbol is used in specific_ss,
+  # in particular, consider adding a symbol in configs/targets/
+  # instead.
+  stub_ss.add(files('dump.c'))
+  stub_ss.add(files('cmos.c'))
+  stub_ss.add(files('fw_cfg.c'))
+  stub_ss.add(files('target-get-monitor-def.c'))
+  stub_ss.add(files('target-monitor-defs.c'))
+  stub_ss.add(files('win32-kbd-hook.c'))
+  stub_ss.add(files('xen-hw-stub.c'))
+endif
+
+if have_system or have_user
+  stub_ss.add(files('gdbstub.c'))
+
+  # Also included in have_system for --disable-tcg builds
+  stub_ss.add(files('replay.c'))
+
+  # Also included in have_system for tests/unit/test-qdev-global-props
+  stub_ss.add(files('hotplug-stubs.c'))
+  stub_ss.add(files('sysbus.c'))
+endif
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2 18/18] stubs: move monitor_fdsets_cleanup with other fdset stubs
  2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
                   ` (16 preceding siblings ...)
  2024-04-08 15:53 ` [PATCH v2 17/18] stubs: include stubs only if needed Paolo Bonzini
@ 2024-04-08 15:53 ` Paolo Bonzini
  2024-04-08 17:02   ` Richard Henderson
  17 siblings, 1 reply; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 15:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Even though monitor_get_fd() has to remain separate because it is mocked by
tests/unit/test-util-sockets, monitor_fdsets_cleanup() is logically part
of the stubs for monitor/fds.c, so move it there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/fdset.c            | 6 ++++++
 stubs/monitor-internal.c | 5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/stubs/fdset.c b/stubs/fdset.c
index 56b3663d588..d7c39a28acb 100644
--- a/stubs/fdset.c
+++ b/stubs/fdset.c
@@ -1,5 +1,7 @@
 #include "qemu/osdep.h"
+#include "qapi/error.h"
 #include "monitor/monitor.h"
+#include "../monitor/monitor-internal.h"
 
 int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
 {
@@ -15,3 +17,7 @@ int64_t monitor_fdset_dup_fd_find(int dup_fd)
 void monitor_fdset_dup_fd_remove(int dupfd)
 {
 }
+
+void monitor_fdsets_cleanup(void)
+{
+}
diff --git a/stubs/monitor-internal.c b/stubs/monitor-internal.c
index 20786ac4ffb..4fece49d531 100644
--- a/stubs/monitor-internal.c
+++ b/stubs/monitor-internal.c
@@ -1,7 +1,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "monitor/monitor.h"
-#include "../monitor/monitor-internal.h"
 
 int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
 {
@@ -12,7 +11,3 @@ int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
 void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
 {
 }
-
-void monitor_fdsets_cleanup(void)
-{
-}
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 02/18] tests: only build plugins if TCG is enabled
  2024-04-08 15:53 ` [PATCH v2 02/18] tests: only build plugins if TCG is enabled Paolo Bonzini
@ 2024-04-08 15:54   ` Philippe Mathieu-Daudé
  2024-04-08 17:03   ` Richard Henderson
  1 sibling, 0 replies; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-08 15:54 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 8/4/24 17:53, Paolo Bonzini wrote:
> There is no way to use them for testing, if all the available
> accelerators use hardware virtualization.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   tests/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 05/18] yank: only build if needed
  2024-04-08 15:53 ` [PATCH v2 05/18] yank: only build if needed Paolo Bonzini
@ 2024-04-08 15:55   ` Philippe Mathieu-Daudé
  2024-04-08 16:42   ` Richard Henderson
  1 sibling, 0 replies; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-08 15:55 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 8/4/24 17:53, Paolo Bonzini wrote:
> The yank feature is not used in user emulation.
> 
> Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   util/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/util/meson.build b/util/meson.build
> index 0ef9886be04..2ad57b10ba2 100644
> --- a/util/meson.build
> +++ b/util/meson.build
> @@ -60,7 +60,6 @@ util_ss.add(files('stats64.c'))
>   util_ss.add(files('systemd.c'))
>   util_ss.add(files('transactions.c'))
>   util_ss.add(files('guest-random.c'))
> -util_ss.add(files('yank.c'))
>   util_ss.add(files('int128.c'))
>   util_ss.add(files('memalign.c'))
>   util_ss.add(files('interval-tree.c'))
> @@ -117,6 +116,7 @@ if have_block

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

>       util_ss.add(files('vfio-helpers.c'))
>       util_ss.add(files('chardev_open.c'))
>     endif
> +  util_ss.add(files('yank.c'))
>   endif
>   
>   if cpu == 'aarch64'



^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 10/18] hw/usb: move stubs out of stubs/
  2024-04-08 15:53 ` [PATCH v2 10/18] hw/usb: move stubs out of stubs/ Paolo Bonzini
@ 2024-04-08 15:59   ` Philippe Mathieu-Daudé
  2024-04-08 16:47   ` Richard Henderson
  1 sibling, 0 replies; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-08 15:59 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 8/4/24 17:53, Paolo Bonzini wrote:
> Since the USB stubs are needed exactly when the Kconfig symbols are not
> enabled, they can be placed in hw/usb/ and conditionalized on CONFIG_USB.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 0
>   hw/usb/meson.build                        | 2 +-
>   stubs/meson.build                         | 1 -
>   3 files changed, 1 insertion(+), 2 deletions(-)
>   rename stubs/usb-dev-stub.c => hw/usb/bus-stub.c (100%)

> diff --git a/hw/usb/meson.build b/hw/usb/meson.build
> index aac3bb35f27..23f7f7acb50 100644
> --- a/hw/usb/meson.build
> +++ b/hw/usb/meson.build
> @@ -9,7 +9,7 @@ system_ss.add(when: 'CONFIG_USB', if_true: files(
>     'desc-msos.c',
>     'libhw.c',
>     'pcap.c',
> -))
> +), if_false: files('bus-stub.c'))

I like it because the stub is restricted to the
subsystem. Possibly easing maintenance.

> diff --git a/stubs/meson.build b/stubs/meson.build

> -  stub_ss.add(files('usb-dev-stub.c'))

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 13/18] ramfb: move stubs out of stubs/
  2024-04-08 15:53 ` [PATCH v2 13/18] ramfb: " Paolo Bonzini
@ 2024-04-08 15:59   ` Philippe Mathieu-Daudé
  2024-04-08 16:49   ` Richard Henderson
  2024-04-08 16:50   ` Richard Henderson
  2 siblings, 0 replies; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-08 15:59 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 8/4/24 17:53, Paolo Bonzini wrote:
> Since the ramfb stubs are needed exactly when the Kconfig symbols are not
> needed, move them to hw/display/ and compile them when ramfb.c is absent.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   stubs/ramfb.c => hw/display/ramfb-stubs.c | 0
>   hw/display/meson.build                    | 2 +-
>   stubs/meson.build                         | 1 -
>   3 files changed, 1 insertion(+), 2 deletions(-)
>   rename stubs/ramfb.c => hw/display/ramfb-stubs.c (100%)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 01/18] meson: do not link pixman automatically into all targets
  2024-04-08 15:53 ` [PATCH v2 01/18] meson: do not link pixman automatically into all targets Paolo Bonzini
@ 2024-04-08 16:41   ` Richard Henderson
  0 siblings, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:41 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> The dependency on pixman is listed manually in all sourcesets that need it.
> There is no need to bring into libqemuutil, since there is nothing in
> util/ that needs pixman either.
> 
> Reported-by: Michael Tokarev<mjt@tls.msk.ru>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 04/18] tests/unit: match some unit tests to corresponding feature switches
  2024-04-08 15:53 ` [PATCH v2 04/18] tests/unit: match some unit tests to corresponding feature switches Paolo Bonzini
@ 2024-04-08 16:42   ` Richard Henderson
  0 siblings, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:42 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> Try not to test code that is not used by user mode emulation, or by the
> block layer, unless they are being compiled; and fix test-timed-average
> which was not compiled with --disable-system --enable-tools.
> 
> This is by no means complete, it only touches the more blatantly
> wrong cases.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   tests/unit/meson.build | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 05/18] yank: only build if needed
  2024-04-08 15:53 ` [PATCH v2 05/18] yank: only build if needed Paolo Bonzini
  2024-04-08 15:55   ` Philippe Mathieu-Daudé
@ 2024-04-08 16:42   ` Richard Henderson
  1 sibling, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:42 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> The yank feature is not used in user emulation.
> 
> Suggested-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   util/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 07/18] hw/core: Move system emulation files to system_ss
  2024-04-08 15:53 ` [PATCH v2 07/18] hw/core: Move system emulation files to system_ss Paolo Bonzini
@ 2024-04-08 16:45   ` Richard Henderson
  0 siblings, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:45 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> hotplug.c, qdev-hotplug.c and reset.c are not used by user emulation
> and need not be included in hwcore_ss.  Move them to system_ss, where
> they belong, by letting the linker pull in the stubs when needed.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   {hw/core => stubs}/hotplug-stubs.c |  0
>   hw/core/meson.build                | 14 +++-----------
>   stubs/meson.build                  |  1 +
>   3 files changed, 4 insertions(+), 11 deletions(-)
>   rename {hw/core => stubs}/hotplug-stubs.c (100%)

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 09/18] stubs: remove obsolete stubs
  2024-04-08 15:53 ` [PATCH v2 09/18] stubs: remove obsolete stubs Paolo Bonzini
@ 2024-04-08 16:46   ` Richard Henderson
  0 siblings, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:46 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> These file define functions are are not called from common code
> anymore.  Delete those functions and, if applicable, the entire files.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   include/sysemu/sysemu.h |  2 --
>   stubs/isa-bus.c         |  7 -------
>   stubs/module-opts.c     |  2 --
>   stubs/monitor-core.c    |  6 ------
>   stubs/pci-bus.c         |  7 -------
>   stubs/qdev.c            |  6 ------
>   stubs/qtest.c           | 10 ----------
>   stubs/usb-dev-stub.c    |  5 -----
>   stubs/meson.build       |  3 ---
>   9 files changed, 48 deletions(-)
>   delete mode 100644 stubs/isa-bus.c
>   delete mode 100644 stubs/module-opts.c
>   delete mode 100644 stubs/pci-bus.c

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 10/18] hw/usb: move stubs out of stubs/
  2024-04-08 15:53 ` [PATCH v2 10/18] hw/usb: move stubs out of stubs/ Paolo Bonzini
  2024-04-08 15:59   ` Philippe Mathieu-Daudé
@ 2024-04-08 16:47   ` Richard Henderson
  1 sibling, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:47 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> Since the USB stubs are needed exactly when the Kconfig symbols are not
> enabled, they can be placed in hw/usb/ and conditionalized on CONFIG_USB.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 0
>   hw/usb/meson.build                        | 2 +-
>   stubs/meson.build                         | 1 -
>   3 files changed, 1 insertion(+), 2 deletions(-)
>   rename stubs/usb-dev-stub.c => hw/usb/bus-stub.c (100%)

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 11/18] hw/virtio: move stubs out of stubs/
  2024-04-08 15:53 ` [PATCH v2 11/18] hw/virtio: " Paolo Bonzini
@ 2024-04-08 16:47   ` Richard Henderson
  0 siblings, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:47 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

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~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 13/18] ramfb: move stubs out of stubs/
  2024-04-08 15:53 ` [PATCH v2 13/18] ramfb: " Paolo Bonzini
  2024-04-08 15:59   ` Philippe Mathieu-Daudé
@ 2024-04-08 16:49   ` Richard Henderson
  2024-04-08 16:50   ` Richard Henderson
  2 siblings, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:49 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> Since the ramfb stubs are needed exactly when the Kconfig symbols are not
> needed, move them to hw/display/ and compile them when ramfb.c is absent.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   stubs/ramfb.c => hw/display/ramfb-stubs.c | 0
>   hw/display/meson.build                    | 2 +-
>   stubs/meson.build                         | 1 -
>   3 files changed, 1 insertion(+), 2 deletions(-)
>   rename stubs/ramfb.c

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 14/18] memory-device: move stubs out of stubs/
  2024-04-08 15:53 ` [PATCH v2 14/18] memory-device: " Paolo Bonzini
@ 2024-04-08 16:50   ` Richard Henderson
  2024-04-08 18:17   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:50 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> Since the memory-device stubs are needed exactly when the Kconfig symbols are not
> needed, move them to hw/mem/.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   stubs/memory_device.c => hw/mem/memory-device-stubs.c | 0
>   hw/mem/meson.build                                    | 1 +
>   stubs/meson.build                                     | 1 -
>   3 files changed, 1 insertion(+), 1 deletion(-)
>   rename stubs/memory_device.c => hw/mem/memory-device-stubs.c (100%)

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 13/18] ramfb: move stubs out of stubs/
  2024-04-08 15:53 ` [PATCH v2 13/18] ramfb: " Paolo Bonzini
  2024-04-08 15:59   ` Philippe Mathieu-Daudé
  2024-04-08 16:49   ` Richard Henderson
@ 2024-04-08 16:50   ` Richard Henderson
  2 siblings, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:50 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> Since the ramfb stubs are needed exactly when the Kconfig symbols are not
> needed, move them to hw/display/ and compile them when ramfb.c is absent.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   stubs/ramfb.c => hw/display/ramfb-stubs.c | 0
>   hw/display/meson.build                    | 2 +-
>   stubs/meson.build                         | 1 -
>   3 files changed, 1 insertion(+), 2 deletions(-)
>   rename stubs/ramfb.c => hw/display/ramfb-stubs.c (100%)

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 16/18] stubs: split record/replay stubs further
  2024-04-08 15:53 ` [PATCH v2 16/18] stubs: split record/replay stubs further Paolo Bonzini
@ 2024-04-08 16:59   ` Richard Henderson
  2024-04-08 17:14     ` Paolo Bonzini
  0 siblings, 1 reply; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 16:59 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> replay.c symbols are only needed by user mode emulation, with the
> exception of replay_mode that is needed by both user mode emulation
> (by way of qemu_guest_getrandom) and block layer tools (by way of
> util/qemu-timer.c).
> 
> Since it is needed by libqemuutil rather than specific files that
> are part of the tools and emulators, split the replay_mode stub
> into its own file.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   stubs/replay-mode.c | 4 ++++
>   stubs/replay.c      | 2 --
>   stubs/meson.build   | 1 +
>   3 files changed, 5 insertions(+), 2 deletions(-)
>   create mode 100644 stubs/replay-mode.c

I don't see how this helps.

With qemu_guest_getrandom you still pull in replay_read_random and replay_save_random. 
With timerlist_run_timers you still pull in replay_checkpoint.

So both stubs files are still used in the same cases.


r~



^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 18/18] stubs: move monitor_fdsets_cleanup with other fdset stubs
  2024-04-08 15:53 ` [PATCH v2 18/18] stubs: move monitor_fdsets_cleanup with other fdset stubs Paolo Bonzini
@ 2024-04-08 17:02   ` Richard Henderson
  0 siblings, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 17:02 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> Even though monitor_get_fd() has to remain separate because it is mocked by
> tests/unit/test-util-sockets, monitor_fdsets_cleanup() is logically part
> of the stubs for monitor/fds.c, so move it there.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   stubs/fdset.c            | 6 ++++++
>   stubs/monitor-internal.c | 5 -----
>   2 files changed, 6 insertions(+), 5 deletions(-)

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 02/18] tests: only build plugins if TCG is enabled
  2024-04-08 15:53 ` [PATCH v2 02/18] tests: only build plugins if TCG is enabled Paolo Bonzini
  2024-04-08 15:54   ` Philippe Mathieu-Daudé
@ 2024-04-08 17:03   ` Richard Henderson
  1 sibling, 0 replies; 38+ messages in thread
From: Richard Henderson @ 2024-04-08 17:03 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 4/8/24 05:53, Paolo Bonzini wrote:
> There is no way to use them for testing, if all the available
> accelerators use hardware virtualization.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   tests/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

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

r~


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 16/18] stubs: split record/replay stubs further
  2024-04-08 16:59   ` Richard Henderson
@ 2024-04-08 17:14     ` Paolo Bonzini
  0 siblings, 0 replies; 38+ messages in thread
From: Paolo Bonzini @ 2024-04-08 17:14 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, philmd

On Mon, Apr 8, 2024 at 6:59 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 4/8/24 05:53, Paolo Bonzini wrote:
> > replay.c symbols are only needed by user mode emulation, with the
> > exception of replay_mode that is needed by both user mode emulation
> > (by way of qemu_guest_getrandom) and block layer tools (by way of
> > util/qemu-timer.c).
> >
> > Since it is needed by libqemuutil rather than specific files that
> > are part of the tools and emulators, split the replay_mode stub
> > into its own file.
>
> I don't see how this helps.
>
> With qemu_guest_getrandom you still pull in replay_read_random and replay_save_random.
> With timerlist_run_timers you still pull in replay_checkpoint.
>
> So both stubs files are still used in the same cases.

But user-mode emulation does not use timerlist_run_timers, and block
layer tools do not use qemu_guest_getrandom. In fact the next patch
wouldn't compile if that wasn't the case.

Paolo



^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2 14/18] memory-device: move stubs out of stubs/
  2024-04-08 15:53 ` [PATCH v2 14/18] memory-device: " Paolo Bonzini
  2024-04-08 16:50   ` Richard Henderson
@ 2024-04-08 18:17   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-08 18:17 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 8/4/24 17:53, Paolo Bonzini wrote:
> Since the memory-device stubs are needed exactly when the Kconfig symbols are not
> needed, move them to hw/mem/.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   stubs/memory_device.c => hw/mem/memory-device-stubs.c | 0
>   hw/mem/meson.build                                    | 1 +
>   stubs/meson.build                                     | 1 -
>   3 files changed, 1 insertion(+), 1 deletion(-)
>   rename stubs/memory_device.c => hw/mem/memory-device-stubs.c (100%)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2024-04-08 18:18 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08 15:53 [PATCH v2 0/7] buildsys: Start shrinking qemu-user build process Paolo Bonzini
2024-04-08 15:53 ` [PATCH v2 01/18] meson: do not link pixman automatically into all targets Paolo Bonzini
2024-04-08 16:41   ` Richard Henderson
2024-04-08 15:53 ` [PATCH v2 02/18] tests: only build plugins if TCG is enabled Paolo Bonzini
2024-04-08 15:54   ` Philippe Mathieu-Daudé
2024-04-08 17:03   ` Richard Henderson
2024-04-08 15:53 ` [PATCH v2 03/18] ebpf: Restrict to system emulation Paolo Bonzini
2024-04-08 15:53 ` [PATCH v2 04/18] tests/unit: match some unit tests to corresponding feature switches Paolo Bonzini
2024-04-08 16:42   ` Richard Henderson
2024-04-08 15:53 ` [PATCH v2 05/18] yank: only build if needed Paolo Bonzini
2024-04-08 15:55   ` Philippe Mathieu-Daudé
2024-04-08 16:42   ` Richard Henderson
2024-04-08 15:53 ` [PATCH v2 06/18] util/qemu-config: Extract QMP commands to qemu-config-qmp.c Paolo Bonzini
2024-04-08 15:53 ` [PATCH v2 07/18] hw/core: Move system emulation files to system_ss Paolo Bonzini
2024-04-08 16:45   ` Richard Henderson
2024-04-08 15:53 ` [PATCH v2 08/18] hw: Include minimal source set in user emulation build Paolo Bonzini
2024-04-08 15:53 ` [PATCH v2 09/18] stubs: remove obsolete stubs Paolo Bonzini
2024-04-08 16:46   ` Richard Henderson
2024-04-08 15:53 ` [PATCH v2 10/18] hw/usb: move stubs out of stubs/ Paolo Bonzini
2024-04-08 15:59   ` Philippe Mathieu-Daudé
2024-04-08 16:47   ` Richard Henderson
2024-04-08 15:53 ` [PATCH v2 11/18] hw/virtio: " Paolo Bonzini
2024-04-08 16:47   ` Richard Henderson
2024-04-08 15:53 ` [PATCH v2 12/18] semihosting: " Paolo Bonzini
2024-04-08 15:53 ` [PATCH v2 13/18] ramfb: " Paolo Bonzini
2024-04-08 15:59   ` Philippe Mathieu-Daudé
2024-04-08 16:49   ` Richard Henderson
2024-04-08 16:50   ` Richard Henderson
2024-04-08 15:53 ` [PATCH v2 14/18] memory-device: " Paolo Bonzini
2024-04-08 16:50   ` Richard Henderson
2024-04-08 18:17   ` Philippe Mathieu-Daudé
2024-04-08 15:53 ` [PATCH v2 15/18] colo: " Paolo Bonzini
2024-04-08 15:53 ` [PATCH v2 16/18] stubs: split record/replay stubs further Paolo Bonzini
2024-04-08 16:59   ` Richard Henderson
2024-04-08 17:14     ` Paolo Bonzini
2024-04-08 15:53 ` [PATCH v2 17/18] stubs: include stubs only if needed Paolo Bonzini
2024-04-08 15:53 ` [PATCH v2 18/18] stubs: move monitor_fdsets_cleanup with other fdset stubs Paolo Bonzini
2024-04-08 17:02   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).