qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process
@ 2024-04-04 19:47 Philippe Mathieu-Daudé
  2024-04-04 19:47 ` [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation Philippe Mathieu-Daudé
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-04 19:47 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Thomas Huth

Hi,

While reworking include/exec/ I have to build many configs
to be sure nothing breaks. qemu-user is particularly
sensitive to changes in this directory (mostly because
all user-specific files include "qemu.h", itself including
various exec/ headers). Getting tired of this waste I had
a look at what we pointlessly build. This series is the
beginning of yet another cleanup set.

Regards,

Phil.

Philippe Mathieu-Daudé (7):
  ebpf: Restrict to system emulation
  yank: Restrict to system emulation
  monitor: Rework stubs to simplify user emulation linking
  util/qemu-config: Extract QMP commands to qemu-config-qmp.c
  hw/core: Restrict reset handlers API to system emulation
  hw/core: Move reset.c to hwcore_ss[] source set
  hw: Include minimal source set in user emulation build

 meson.build                |   6 +-
 include/qemu/config-file.h |   3 +
 hw/core/reset.c            |   4 +
 stubs/fdset.c              |  17 ---
 stubs/monitor-core.c       |  20 +++-
 stubs/monitor.c            |   8 +-
 util/qemu-config-qmp.c     | 206 +++++++++++++++++++++++++++++++++++++
 util/qemu-config.c         | 204 +-----------------------------------
 ebpf/meson.build           |   2 +-
 hw/core/meson.build        |   2 +-
 stubs/meson.build          |   5 +-
 util/meson.build           |   3 +-
 12 files changed, 248 insertions(+), 232 deletions(-)
 delete mode 100644 stubs/fdset.c
 create mode 100644 util/qemu-config-qmp.c

-- 
2.41.0



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

* [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation
  2024-04-04 19:47 [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process Philippe Mathieu-Daudé
@ 2024-04-04 19:47 ` Philippe Mathieu-Daudé
  2024-04-04 22:14   ` Richard Henderson
  2024-04-08  6:29   ` Jason Wang
  2024-04-04 19:47 ` [PATCH-for-9.1 2/7] yank: " Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-04 19:47 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Thomas Huth,
	Jason Wang, Andrew Melnychenko, Yuri Benditovich

eBPF is not used in user emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 ebpf/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ebpf/meson.build b/ebpf/meson.build
index c5bf9295a2..bff6156f51 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.41.0



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

* [PATCH-for-9.1 2/7] yank: Restrict to system emulation
  2024-04-04 19:47 [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process Philippe Mathieu-Daudé
  2024-04-04 19:47 ` [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation Philippe Mathieu-Daudé
@ 2024-04-04 19:47 ` Philippe Mathieu-Daudé
  2024-04-04 22:15   ` Richard Henderson
  2024-04-08  8:48   ` Paolo Bonzini
  2024-04-04 19:47 ` [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-04 19:47 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Thomas Huth

The yank feature is not used in user emulation.

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

diff --git a/util/meson.build b/util/meson.build
index 0ef9886be0..247f55a80d 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'))
@@ -76,6 +75,7 @@ if have_system
   if host_os == 'linux'
     util_ss.add(files('userfaultfd.c'))
   endif
+  util_ss.add(files('yank.c'))
 endif
 
 if have_block or have_ga
-- 
2.41.0



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

* [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking
  2024-04-04 19:47 [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process Philippe Mathieu-Daudé
  2024-04-04 19:47 ` [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation Philippe Mathieu-Daudé
  2024-04-04 19:47 ` [PATCH-for-9.1 2/7] yank: " Philippe Mathieu-Daudé
@ 2024-04-04 19:47 ` Philippe Mathieu-Daudé
  2024-04-08  9:50   ` Paolo Bonzini
  2024-04-04 19:47 ` [PATCH-for-9.1 4/7] util/qemu-config: Extract QMP commands to qemu-config-qmp.c Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-04 19:47 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Thomas Huth

Currently monitor stubs are scattered in 3 files.

Merge these stubs in 2 files, a generic one (monitor-core)
included in all builds (in particular user emulation), and
a less generic one to be included by tools and system emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 stubs/fdset.c        | 17 -----------------
 stubs/monitor-core.c | 20 +++++++++++++++-----
 stubs/monitor.c      |  8 ++++++--
 stubs/meson.build    |  5 +++--
 4 files changed, 24 insertions(+), 26 deletions(-)
 delete mode 100644 stubs/fdset.c

diff --git a/stubs/fdset.c b/stubs/fdset.c
deleted file mode 100644
index 56b3663d58..0000000000
--- a/stubs/fdset.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "qemu/osdep.h"
-#include "monitor/monitor.h"
-
-int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
-{
-    errno = ENOSYS;
-    return -1;
-}
-
-int64_t monitor_fdset_dup_fd_find(int dup_fd)
-{
-    return -1;
-}
-
-void monitor_fdset_dup_fd_remove(int dupfd)
-{
-}
diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c
index afa477aae6..72e40bcc15 100644
--- a/stubs/monitor-core.c
+++ b/stubs/monitor-core.c
@@ -1,6 +1,7 @@
+/* Monitor stub required for user emulation */
 #include "qemu/osdep.h"
 #include "monitor/monitor.h"
-#include "qapi/qapi-emit-events.h"
+#include "../monitor/monitor-internal.h"
 
 Monitor *monitor_cur(void)
 {
@@ -12,11 +13,22 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
     return NULL;
 }
 
-void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
+int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
+int64_t monitor_fdset_dup_fd_find(int dup_fd)
+{
+    return -1;
+}
+
+void monitor_fdset_dup_fd_remove(int dupfd)
 {
 }
 
-void qapi_event_emit(QAPIEvent event, QDict *qdict)
+void monitor_fdsets_cleanup(void)
 {
 }
 
@@ -24,5 +36,3 @@ int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
 {
     abort();
 }
-
-
diff --git a/stubs/monitor.c b/stubs/monitor.c
index 20786ac4ff..2fc4dc1493 100644
--- a/stubs/monitor.c
+++ b/stubs/monitor.c
@@ -1,7 +1,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qapi/qapi-emit-events.h"
 #include "monitor/monitor.h"
-#include "../monitor/monitor-internal.h"
 
 int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
 {
@@ -13,6 +13,10 @@ void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
 {
 }
 
-void monitor_fdsets_cleanup(void)
+void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
+{
+}
+
+void qapi_event_emit(QAPIEvent event, QDict *qdict)
 {
 }
diff --git a/stubs/meson.build b/stubs/meson.build
index 0bf25e6ca5..ca1bc07d30 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -10,7 +10,6 @@ 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'))
@@ -28,7 +27,9 @@ if libaio.found()
 endif
 stub_ss.add(files('migr-blocker.c'))
 stub_ss.add(files('module-opts.c'))
-stub_ss.add(files('monitor.c'))
+if have_system or have_tools
+  stub_ss.add(files('monitor.c'))
+endif
 stub_ss.add(files('monitor-core.c'))
 stub_ss.add(files('physmem.c'))
 stub_ss.add(files('qemu-timer-notify-cb.c'))
-- 
2.41.0



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

* [PATCH-for-9.1 4/7] util/qemu-config: Extract QMP commands to qemu-config-qmp.c
  2024-04-04 19:47 [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2024-04-04 19:47 ` [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking Philippe Mathieu-Daudé
@ 2024-04-04 19:47 ` Philippe Mathieu-Daudé
  2024-04-08  8:50   ` Paolo Bonzini
  2024-04-04 19:47 ` [PATCH-for-9.1 5/7] hw/core: Restrict reset handlers API to system emulation Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-04 19:47 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Thomas Huth

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>
---
 include/qemu/config-file.h |   3 +
 util/qemu-config-qmp.c     | 206 +++++++++++++++++++++++++++++++++++++
 util/qemu-config.c         | 204 +-----------------------------------
 util/meson.build           |   1 +
 4 files changed, 212 insertions(+), 202 deletions(-)
 create mode 100644 util/qemu-config-qmp.c

diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h
index b82a778123..8b9d6df173 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[48];
+extern QemuOptsList *drive_config_groups[5];
+
 void qemu_add_opts(QemuOptsList *list);
 void qemu_add_drive_opts(QemuOptsList *list);
 int qemu_global_option(const char *str);
diff --git a/util/qemu-config-qmp.c b/util/qemu-config-qmp.c
new file mode 100644
index 0000000000..24477a0e44
--- /dev/null
+++ b/util/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 42076efe1e..a90c18dad2 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/util/meson.build b/util/meson.build
index 247f55a80d..636b17a414 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -75,6 +75,7 @@ if have_system
   if host_os == 'linux'
     util_ss.add(files('userfaultfd.c'))
   endif
+  util_ss.add(files('qemu-config-qmp.c'))
   util_ss.add(files('yank.c'))
 endif
 
-- 
2.41.0



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

* [PATCH-for-9.1 5/7] hw/core: Restrict reset handlers API to system emulation
  2024-04-04 19:47 [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2024-04-04 19:47 ` [PATCH-for-9.1 4/7] util/qemu-config: Extract QMP commands to qemu-config-qmp.c Philippe Mathieu-Daudé
@ 2024-04-04 19:47 ` Philippe Mathieu-Daudé
  2024-04-08 10:09   ` Paolo Bonzini
  2024-04-04 19:47 ` [PATCH-for-9.1 6/7] hw/core: Move reset.c to hwcore_ss[] source set Philippe Mathieu-Daudé
  2024-04-04 19:47 ` [PATCH-for-9.1 7/7] hw: Include minimal source set in user emulation build Philippe Mathieu-Daudé
  6 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-04 19:47 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Thomas Huth,
	Peter Maydell

Headers in include/sysemu/ are specific to system
emulation and should not be used in user emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/core/reset.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/core/reset.c b/hw/core/reset.c
index d50da7e304..167c8bf1a9 100644
--- a/hw/core/reset.c
+++ b/hw/core/reset.c
@@ -24,7 +24,9 @@
  */
 
 #include "qemu/osdep.h"
+#ifndef CONFIG_USER_ONLY
 #include "sysemu/reset.h"
+#endif
 #include "hw/resettable.h"
 #include "hw/core/resetcontainer.h"
 
@@ -43,6 +45,7 @@ static ResettableContainer *get_root_reset_container(void)
     return root_reset_container;
 }
 
+#ifndef CONFIG_USER_ONLY
 /*
  * Reason why the currently in-progress qemu_devices_reset() was called.
  * If we made at least SHUTDOWN_CAUSE_SNAPSHOT_LOAD have a corresponding
@@ -185,3 +188,4 @@ void qemu_devices_reset(ShutdownCause reason)
     /* Reset the simulation */
     resettable_reset(OBJECT(get_root_reset_container()), RESET_TYPE_COLD);
 }
+#endif
-- 
2.41.0



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

* [PATCH-for-9.1 6/7] hw/core: Move reset.c to hwcore_ss[] source set
  2024-04-04 19:47 [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2024-04-04 19:47 ` [PATCH-for-9.1 5/7] hw/core: Restrict reset handlers API to system emulation Philippe Mathieu-Daudé
@ 2024-04-04 19:47 ` Philippe Mathieu-Daudé
  2024-04-05 22:44   ` Richard Henderson
  2024-04-04 19:47 ` [PATCH-for-9.1 7/7] hw: Include minimal source set in user emulation build Philippe Mathieu-Daudé
  6 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-04 19:47 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Thomas Huth

reset.c contains core code used by any CPU, required
by user emulation. Move it to hwcore_ss[] where it
belongs.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/core/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/meson.build b/hw/core/meson.build
index e26f2e088c..1389f1b339 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',
@@ -16,6 +15,7 @@ if have_system
   hwcore_ss.add(files(
     'hotplug.c',
     'qdev-hotplug.c',
+    'reset.c',
   ))
 else
   hwcore_ss.add(files(
-- 
2.41.0



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

* [PATCH-for-9.1 7/7] hw: Include minimal source set in user emulation build
  2024-04-04 19:47 [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2024-04-04 19:47 ` [PATCH-for-9.1 6/7] hw/core: Move reset.c to hwcore_ss[] source set Philippe Mathieu-Daudé
@ 2024-04-04 19:47 ` Philippe Mathieu-Daudé
  2024-04-05 22:45   ` Richard Henderson
  6 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-04 19:47 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Thomas Huth,
	Marc-André Lureau, Daniel P. Berrangé

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.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 meson.build | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index c9c3217ba4..68eecd1937 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.41.0



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

* Re: [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation
  2024-04-04 19:47 ` [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation Philippe Mathieu-Daudé
@ 2024-04-04 22:14   ` Richard Henderson
  2024-04-08  6:29   ` Jason Wang
  1 sibling, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2024-04-04 22:14 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Michael Tokarev, Laurent Vivier,
	qemu-devel
  Cc: Paolo Bonzini, Thomas Huth, Jason Wang, Andrew Melnychenko,
	Yuri Benditovich

On 4/4/24 09:47, Philippe Mathieu-Daudé wrote:
> eBPF is not used in user emulation.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   ebpf/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

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

r~


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

* Re: [PATCH-for-9.1 2/7] yank: Restrict to system emulation
  2024-04-04 19:47 ` [PATCH-for-9.1 2/7] yank: " Philippe Mathieu-Daudé
@ 2024-04-04 22:15   ` Richard Henderson
  2024-04-08  8:48   ` Paolo Bonzini
  1 sibling, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2024-04-04 22:15 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Michael Tokarev, Laurent Vivier,
	qemu-devel
  Cc: Paolo Bonzini, Thomas Huth

On 4/4/24 09:47, Philippe Mathieu-Daudé wrote:
> The yank feature is not used in user emulation.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   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] 19+ messages in thread

* Re: [PATCH-for-9.1 6/7] hw/core: Move reset.c to hwcore_ss[] source set
  2024-04-04 19:47 ` [PATCH-for-9.1 6/7] hw/core: Move reset.c to hwcore_ss[] source set Philippe Mathieu-Daudé
@ 2024-04-05 22:44   ` Richard Henderson
  2024-04-08  6:00     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 19+ messages in thread
From: Richard Henderson @ 2024-04-05 22:44 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Michael Tokarev, Laurent Vivier,
	qemu-devel
  Cc: Paolo Bonzini, Thomas Huth

On 4/4/24 09:47, Philippe Mathieu-Daudé wrote:
> reset.c contains core code used by any CPU, required
> by user emulation. Move it to hwcore_ss[] where it
> belongs.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/core/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/core/meson.build b/hw/core/meson.build
> index e26f2e088c..1389f1b339 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',
> @@ -16,6 +15,7 @@ if have_system
>     hwcore_ss.add(files(
>       'hotplug.c',
>       'qdev-hotplug.c',
> +    'reset.c',

This patch would seem to obviate the previous?

r~



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

* Re: [PATCH-for-9.1 7/7] hw: Include minimal source set in user emulation build
  2024-04-04 19:47 ` [PATCH-for-9.1 7/7] hw: Include minimal source set in user emulation build Philippe Mathieu-Daudé
@ 2024-04-05 22:45   ` Richard Henderson
  0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2024-04-05 22:45 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Michael Tokarev, Laurent Vivier,
	qemu-devel
  Cc: Paolo Bonzini, Thomas Huth, Marc-André Lureau,
	Daniel P. Berrangé

On 4/4/24 09:47, Philippe Mathieu-Daudé wrote:
> 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.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   meson.build | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)

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

r~


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

* Re: [PATCH-for-9.1 6/7] hw/core: Move reset.c to hwcore_ss[] source set
  2024-04-05 22:44   ` Richard Henderson
@ 2024-04-08  6:00     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-08  6:00 UTC (permalink / raw)
  To: Richard Henderson, Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Paolo Bonzini, Thomas Huth

On 6/4/24 00:44, Richard Henderson wrote:
> On 4/4/24 09:47, Philippe Mathieu-Daudé wrote:
>> reset.c contains core code used by any CPU, required
>> by user emulation. Move it to hwcore_ss[] where it
>> belongs.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   hw/core/meson.build | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/core/meson.build b/hw/core/meson.build
>> index e26f2e088c..1389f1b339 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',
>> @@ -16,6 +15,7 @@ if have_system
>>     hwcore_ss.add(files(
>>       'hotplug.c',
>>       'qdev-hotplug.c',
>> +    'reset.c',
> 
> This patch would seem to obviate the previous?

No, hwcore_ss[] is used for both system/user.

As its name suggests, "sysemu/reset.h" is system specific.
We don't want to compile its definitions and link them to
a user-only build.

I can squash both if it makes it more obvious.

Regards,

Phil.



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

* Re: [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation
  2024-04-04 19:47 ` [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation Philippe Mathieu-Daudé
  2024-04-04 22:14   ` Richard Henderson
@ 2024-04-08  6:29   ` Jason Wang
  1 sibling, 0 replies; 19+ messages in thread
From: Jason Wang @ 2024-04-08  6:29 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Michael Tokarev, Laurent Vivier, qemu-devel, Paolo Bonzini,
	Thomas Huth, Andrew Melnychenko, Yuri Benditovich

On Fri, Apr 5, 2024 at 3:48 AM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> eBPF is not used in user emulation.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Queued for 9.1.

Thanks

> ---
>  ebpf/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ebpf/meson.build b/ebpf/meson.build
> index c5bf9295a2..bff6156f51 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.41.0
>



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

* Re: [PATCH-for-9.1 2/7] yank: Restrict to system emulation
  2024-04-04 19:47 ` [PATCH-for-9.1 2/7] yank: " Philippe Mathieu-Daudé
  2024-04-04 22:15   ` Richard Henderson
@ 2024-04-08  8:48   ` Paolo Bonzini
  1 sibling, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2024-04-08  8:48 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Michael Tokarev, Laurent Vivier, qemu-devel, Thomas Huth

On Thu, Apr 4, 2024 at 9:48 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> The yank feature is not used in user emulation.

But it is used in block layer tools. The simplest thing here is
probably to move it under have_block instead.

Paolo

> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  util/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/util/meson.build b/util/meson.build
> index 0ef9886be0..247f55a80d 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'))
> @@ -76,6 +75,7 @@ if have_system
>    if host_os == 'linux'
>      util_ss.add(files('userfaultfd.c'))
>    endif
> +  util_ss.add(files('yank.c'))
>  endif
>
>  if have_block or have_ga
> --
> 2.41.0
>



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

* Re: [PATCH-for-9.1 4/7] util/qemu-config: Extract QMP commands to qemu-config-qmp.c
  2024-04-04 19:47 ` [PATCH-for-9.1 4/7] util/qemu-config: Extract QMP commands to qemu-config-qmp.c Philippe Mathieu-Daudé
@ 2024-04-08  8:50   ` Paolo Bonzini
  0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2024-04-08  8:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Michael Tokarev, Laurent Vivier, qemu-devel, Thomas Huth

On Thu, Apr 4, 2024 at 9:48 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> 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>
> ---
>  include/qemu/config-file.h |   3 +
>  util/qemu-config-qmp.c     | 206 +++++++++++++++++++++++++++++++++++++

This should go under monitor/.

Queued all except patch 2, please resubmit that and send it to
qemu-block@nongnu.org.

>  util/qemu-config.c         | 204 +-----------------------------------
>  util/meson.build           |   1 +
>  4 files changed, 212 insertions(+), 202 deletions(-)
>  create mode 100644 util/qemu-config-qmp.c
>
> diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h
> index b82a778123..8b9d6df173 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[48];
> +extern QemuOptsList *drive_config_groups[5];
> +
>  void qemu_add_opts(QemuOptsList *list);
>  void qemu_add_drive_opts(QemuOptsList *list);
>  int qemu_global_option(const char *str);
> diff --git a/util/qemu-config-qmp.c b/util/qemu-config-qmp.c
> new file mode 100644
> index 0000000000..24477a0e44
> --- /dev/null
> +++ b/util/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 42076efe1e..a90c18dad2 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/util/meson.build b/util/meson.build
> index 247f55a80d..636b17a414 100644
> --- a/util/meson.build
> +++ b/util/meson.build
> @@ -75,6 +75,7 @@ if have_system
>    if host_os == 'linux'
>      util_ss.add(files('userfaultfd.c'))
>    endif
> +  util_ss.add(files('qemu-config-qmp.c'))
>    util_ss.add(files('yank.c'))
>  endif
>
> --
> 2.41.0
>



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

* Re: [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking
  2024-04-04 19:47 ` [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking Philippe Mathieu-Daudé
@ 2024-04-08  9:50   ` Paolo Bonzini
  2024-04-08 10:59     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 19+ messages in thread
From: Paolo Bonzini @ 2024-04-08  9:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Michael Tokarev, Laurent Vivier, qemu-devel, Thomas Huth

On Thu, Apr 4, 2024 at 9:48 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Currently monitor stubs are scattered in 3 files.
>
> Merge these stubs in 2 files, a generic one (monitor-core)
> included in all builds (in particular user emulation), and
> a less generic one to be included by tools and system emulation.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  stubs/fdset.c        | 17 -----------------

Oops, merging fdset.c breaks storage-daemon linking.

But it is not needed, all I need is

diff --git a/stubs/meson.build b/stubs/meson.build
index 0bf25e6ca53..67cf80aa846 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -10,7 +10,6 @@ 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'))
@@ -28,7 +27,10 @@ if libaio.found()
 endif
 stub_ss.add(files('migr-blocker.c'))
 stub_ss.add(files('module-opts.c'))
-stub_ss.add(files('monitor.c'))
+if have_system or have_tools
+  stub_ss.add(files('monitor.c'))
+  stub_ss.add(files('fdset.c'))
+endif
 stub_ss.add(files('monitor-core.c'))
 stub_ss.add(files('physmem.c'))
 stub_ss.add(files('qemu-timer-notify-cb.c'))


Paolo

>  stubs/monitor-core.c | 20 +++++++++++++++-----
>  stubs/monitor.c      |  8 ++++++--
>  stubs/meson.build    |  5 +++--
>  4 files changed, 24 insertions(+), 26 deletions(-)
>  delete mode 100644 stubs/fdset.c
>
> diff --git a/stubs/fdset.c b/stubs/fdset.c
> deleted file mode 100644
> index 56b3663d58..0000000000
> --- a/stubs/fdset.c
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -#include "qemu/osdep.h"
> -#include "monitor/monitor.h"
> -
> -int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
> -{
> -    errno = ENOSYS;
> -    return -1;
> -}
> -
> -int64_t monitor_fdset_dup_fd_find(int dup_fd)
> -{
> -    return -1;
> -}
> -
> -void monitor_fdset_dup_fd_remove(int dupfd)
> -{
> -}
> diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c
> index afa477aae6..72e40bcc15 100644
> --- a/stubs/monitor-core.c
> +++ b/stubs/monitor-core.c
> @@ -1,6 +1,7 @@
> +/* Monitor stub required for user emulation */
>  #include "qemu/osdep.h"
>  #include "monitor/monitor.h"
> -#include "qapi/qapi-emit-events.h"
> +#include "../monitor/monitor-internal.h"
>
>  Monitor *monitor_cur(void)
>  {
> @@ -12,11 +13,22 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
>      return NULL;
>  }
>
> -void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
> +int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
> +{
> +    errno = ENOSYS;
> +    return -1;
> +}
> +
> +int64_t monitor_fdset_dup_fd_find(int dup_fd)
> +{
> +    return -1;
> +}
> +
> +void monitor_fdset_dup_fd_remove(int dupfd)
>  {
>  }
>
> -void qapi_event_emit(QAPIEvent event, QDict *qdict)
> +void monitor_fdsets_cleanup(void)
>  {
>  }
>
> @@ -24,5 +36,3 @@ int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
>  {
>      abort();
>  }
> -
> -
> diff --git a/stubs/monitor.c b/stubs/monitor.c
> index 20786ac4ff..2fc4dc1493 100644
> --- a/stubs/monitor.c
> +++ b/stubs/monitor.c
> @@ -1,7 +1,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qapi/qapi-emit-events.h"
>  #include "monitor/monitor.h"
> -#include "../monitor/monitor-internal.h"
>
>  int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
>  {
> @@ -13,6 +13,10 @@ void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
>  {
>  }
>
> -void monitor_fdsets_cleanup(void)
> +void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
> +{
> +}
> +
> +void qapi_event_emit(QAPIEvent event, QDict *qdict)
>  {
>  }
> diff --git a/stubs/meson.build b/stubs/meson.build
> index 0bf25e6ca5..ca1bc07d30 100644
> --- a/stubs/meson.build
> +++ b/stubs/meson.build
> @@ -10,7 +10,6 @@ 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'))
> @@ -28,7 +27,9 @@ if libaio.found()
>  endif
>  stub_ss.add(files('migr-blocker.c'))
>  stub_ss.add(files('module-opts.c'))
> -stub_ss.add(files('monitor.c'))
> +if have_system or have_tools
> +  stub_ss.add(files('monitor.c'))
> +endif
>  stub_ss.add(files('monitor-core.c'))
>  stub_ss.add(files('physmem.c'))
>  stub_ss.add(files('qemu-timer-notify-cb.c'))
> --
> 2.41.0
>



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

* Re: [PATCH-for-9.1 5/7] hw/core: Restrict reset handlers API to system emulation
  2024-04-04 19:47 ` [PATCH-for-9.1 5/7] hw/core: Restrict reset handlers API to system emulation Philippe Mathieu-Daudé
@ 2024-04-08 10:09   ` Paolo Bonzini
  0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2024-04-08 10:09 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Michael Tokarev, Laurent Vivier, qemu-devel, Thomas Huth,
	Peter Maydell

On Thu, Apr 4, 2024 at 9:48 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Headers in include/sysemu/ are specific to system
> emulation and should not be used in user emulation.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/core/reset.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/hw/core/reset.c b/hw/core/reset.c
> index d50da7e304..167c8bf1a9 100644
> --- a/hw/core/reset.c
> +++ b/hw/core/reset.c
> @@ -24,7 +24,9 @@
>   */
>
>  #include "qemu/osdep.h"
> +#ifndef CONFIG_USER_ONLY
>  #include "sysemu/reset.h"
> +#endif
>  #include "hw/resettable.h"
>  #include "hw/core/resetcontainer.h"
>
> @@ -43,6 +45,7 @@ static ResettableContainer *get_root_reset_container(void)
>      return root_reset_container;
>  }
>
> +#ifndef CONFIG_USER_ONLY

Wait, this does not make sense. The only thing left in the file is a
single static function, which contradicts the other patch's commit
message "reset.c contains core code used by any CPU,".

Let me rework these two patches so that reset.c, qdev-hotplug.c and
hotplug.c can be moved to system_ss. I'll post a v2 shortly.

Paolo

>  /*
>   * Reason why the currently in-progress qemu_devices_reset() was called.
>   * If we made at least SHUTDOWN_CAUSE_SNAPSHOT_LOAD have a corresponding
> @@ -185,3 +188,4 @@ void qemu_devices_reset(ShutdownCause reason)
>      /* Reset the simulation */
>      resettable_reset(OBJECT(get_root_reset_container()), RESET_TYPE_COLD);
>  }
> +#endif
> --
> 2.41.0
>



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

* Re: [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking
  2024-04-08  9:50   ` Paolo Bonzini
@ 2024-04-08 10:59     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-08 10:59 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Michael Tokarev, Laurent Vivier, qemu-devel, Thomas Huth

On 8/4/24 11:50, Paolo Bonzini wrote:
> On Thu, Apr 4, 2024 at 9:48 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Currently monitor stubs are scattered in 3 files.
>>
>> Merge these stubs in 2 files, a generic one (monitor-core)
>> included in all builds (in particular user emulation), and
>> a less generic one to be included by tools and system emulation.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   stubs/fdset.c        | 17 -----------------
> 
> Oops, merging fdset.c breaks storage-daemon linking.

Odd. My 'tools_only' build directory is configured with:

'--enable-tools' '--disable-docs' '--disable-system' '--disable-user'

I was building qemu-img & co. I just checked it isn't anymore,
the directory only contains libqemuutil.a, libqom.fa,
libevent-loop-base.fa and tests/unit (I'm on macOS host).

This explained why I missed the link failure. I'll dig to
see when these tools disappeared on macOS.

Regards,

Phil.


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

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

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-04 19:47 [PATCH-for-9.1 0/7] buildsys: Start shrinking qemu-user build process Philippe Mathieu-Daudé
2024-04-04 19:47 ` [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation Philippe Mathieu-Daudé
2024-04-04 22:14   ` Richard Henderson
2024-04-08  6:29   ` Jason Wang
2024-04-04 19:47 ` [PATCH-for-9.1 2/7] yank: " Philippe Mathieu-Daudé
2024-04-04 22:15   ` Richard Henderson
2024-04-08  8:48   ` Paolo Bonzini
2024-04-04 19:47 ` [PATCH-for-9.1 3/7] monitor: Rework stubs to simplify user emulation linking Philippe Mathieu-Daudé
2024-04-08  9:50   ` Paolo Bonzini
2024-04-08 10:59     ` Philippe Mathieu-Daudé
2024-04-04 19:47 ` [PATCH-for-9.1 4/7] util/qemu-config: Extract QMP commands to qemu-config-qmp.c Philippe Mathieu-Daudé
2024-04-08  8:50   ` Paolo Bonzini
2024-04-04 19:47 ` [PATCH-for-9.1 5/7] hw/core: Restrict reset handlers API to system emulation Philippe Mathieu-Daudé
2024-04-08 10:09   ` Paolo Bonzini
2024-04-04 19:47 ` [PATCH-for-9.1 6/7] hw/core: Move reset.c to hwcore_ss[] source set Philippe Mathieu-Daudé
2024-04-05 22:44   ` Richard Henderson
2024-04-08  6:00     ` Philippe Mathieu-Daudé
2024-04-04 19:47 ` [PATCH-for-9.1 7/7] hw: Include minimal source set in user emulation build Philippe Mathieu-Daudé
2024-04-05 22:45   ` 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).