qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation
@ 2022-12-20 11:11 Philippe Mathieu-Daudé
  2022-12-20 11:11 ` [PATCH RESEND v2 1/5] target/arm: " Philippe Mathieu-Daudé
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Cédric Le Goater, Peter Maydell, Greg Kurz,
	Daniel Henrique Barboza, Philippe Mathieu-Daudé,
	Xiaojuan Yang, Aurelien Jarno, Huacai Chen, Aleksandar Rikalo,
	qemu-arm, David Gibson, Jiaxun Yang, Markus Armbruster, Song Gao

[resend fixing my last name typography...]

All series reviewed, can patches be picked by corresponding
maintainers?

The "qapi-commands-machine.h" header is not generated in user-only
emulation. This series removes its use in user-emu code by moving
the QMP code depending on this header into a separate sysemu unit.

Since v1:
- renamed cpu-monitor.c -> monitor.c on loongarch

Philippe Mathieu-Daudé (5):
  target/arm: Restrict 'qapi-commands-machine.h' to system emulation
  target/i386: Restrict 'qapi-commands-machine.h' to system emulation
  target/loongarch: Restrict 'qapi-commands-machine.h' to system
    emulation
  target/mips: Restrict 'qapi-commands-machine.h' to system emulation
  target/ppc: Restrict 'qapi-commands-machine.h' to system emulation

 target/arm/helper.c            | 29 -------------
 target/arm/m_helper.c          |  1 -
 target/arm/monitor.c           | 28 +++++++++++++
 target/i386/cpu.c              | 74 ++++++++++++++++++----------------
 target/loongarch/cpu.c         | 27 -------------
 target/loongarch/meson.build   |  1 +
 target/loongarch/monitor.c     | 37 +++++++++++++++++
 target/mips/cpu.c              | 29 -------------
 target/mips/sysemu/meson.build |  1 +
 target/mips/sysemu/monitor.c   | 39 ++++++++++++++++++
 target/ppc/cpu-qom.h           |  2 +
 target/ppc/cpu_init.c          | 48 +---------------------
 target/ppc/monitor.c           | 50 ++++++++++++++++++++++-
 13 files changed, 197 insertions(+), 169 deletions(-)
 create mode 100644 target/loongarch/monitor.c
 create mode 100644 target/mips/sysemu/monitor.c

-- 
2.38.1



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

* [PATCH RESEND v2 1/5] target/arm: Restrict 'qapi-commands-machine.h' to system emulation
  2022-12-20 11:11 [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
@ 2022-12-20 11:11 ` Philippe Mathieu-Daudé
  2023-01-13  8:14   ` Philippe Mathieu-Daudé
  2022-12-20 11:11 ` [PATCH RESEND v2 2/5] target/i386: " Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Cédric Le Goater, Peter Maydell, Greg Kurz,
	Daniel Henrique Barboza, Philippe Mathieu-Daudé,
	Xiaojuan Yang, Aurelien Jarno, Huacai Chen, Aleksandar Rikalo,
	qemu-arm, David Gibson, Jiaxun Yang, Markus Armbruster, Song Gao,
	Richard Henderson

Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
user-mode builds") we don't generate the "qapi-commands-machine.h"
header in a user-emulation-only build.

Move the QMP functions from helper.c (which is always compiled) to
monitor.c (which is only compiled when system-emulation is selected).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/helper.c   | 29 -----------------------------
 target/arm/m_helper.c |  1 -
 target/arm/monitor.c  | 28 ++++++++++++++++++++++++++++
 3 files changed, 28 insertions(+), 30 deletions(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index bac2ea62c4..399603b680 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -27,7 +27,6 @@
 #include "sysemu/cpu-timers.h"
 #include "sysemu/kvm.h"
 #include "qemu/range.h"
-#include "qapi/qapi-commands-machine-target.h"
 #include "qapi/error.h"
 #include "qemu/guest-random.h"
 #ifdef CONFIG_TCG
@@ -8514,34 +8513,6 @@ void arm_cpu_list(void)
     g_slist_free(list);
 }
 
-static void arm_cpu_add_definition(gpointer data, gpointer user_data)
-{
-    ObjectClass *oc = data;
-    CpuDefinitionInfoList **cpu_list = user_data;
-    CpuDefinitionInfo *info;
-    const char *typename;
-
-    typename = object_class_get_name(oc);
-    info = g_malloc0(sizeof(*info));
-    info->name = g_strndup(typename,
-                           strlen(typename) - strlen("-" TYPE_ARM_CPU));
-    info->q_typename = g_strdup(typename);
-
-    QAPI_LIST_PREPEND(*cpu_list, info);
-}
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    CpuDefinitionInfoList *cpu_list = NULL;
-    GSList *list;
-
-    list = object_class_get_list(TYPE_ARM_CPU, false);
-    g_slist_foreach(list, arm_cpu_add_definition, &cpu_list);
-    g_slist_free(list);
-
-    return cpu_list;
-}
-
 /*
  * Private utility function for define_one_arm_cp_reg_with_opaque():
  * add a single reginfo struct to the hash table.
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
index 355cd4d60a..11008528b5 100644
--- a/target/arm/m_helper.c
+++ b/target/arm/m_helper.c
@@ -26,7 +26,6 @@
 #include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
 #include "qemu/range.h"
-#include "qapi/qapi-commands-machine-target.h"
 #include "qapi/error.h"
 #include "qemu/guest-random.h"
 #ifdef CONFIG_TCG
diff --git a/target/arm/monitor.c b/target/arm/monitor.c
index ecdd5ee817..c8fa524002 100644
--- a/target/arm/monitor.c
+++ b/target/arm/monitor.c
@@ -227,3 +227,31 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
 
     return expansion_info;
 }
+
+static void arm_cpu_add_definition(gpointer data, gpointer user_data)
+{
+    ObjectClass *oc = data;
+    CpuDefinitionInfoList **cpu_list = user_data;
+    CpuDefinitionInfo *info;
+    const char *typename;
+
+    typename = object_class_get_name(oc);
+    info = g_malloc0(sizeof(*info));
+    info->name = g_strndup(typename,
+                           strlen(typename) - strlen("-" TYPE_ARM_CPU));
+    info->q_typename = g_strdup(typename);
+
+    QAPI_LIST_PREPEND(*cpu_list, info);
+}
+
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    CpuDefinitionInfoList *cpu_list = NULL;
+    GSList *list;
+
+    list = object_class_get_list(TYPE_ARM_CPU, false);
+    g_slist_foreach(list, arm_cpu_add_definition, &cpu_list);
+    g_slist_free(list);
+
+    return cpu_list;
+}
-- 
2.38.1



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

* [PATCH RESEND v2 2/5] target/i386: Restrict 'qapi-commands-machine.h' to system emulation
  2022-12-20 11:11 [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
  2022-12-20 11:11 ` [PATCH RESEND v2 1/5] target/arm: " Philippe Mathieu-Daudé
@ 2022-12-20 11:11 ` Philippe Mathieu-Daudé
  2022-12-20 11:11 ` [PATCH RESEND v2 3/5] target/loongarch: " Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Cédric Le Goater, Peter Maydell, Greg Kurz,
	Daniel Henrique Barboza, Philippe Mathieu-Daudé,
	Xiaojuan Yang, Aurelien Jarno, Huacai Chen, Aleksandar Rikalo,
	qemu-arm, David Gibson, Jiaxun Yang, Markus Armbruster, Song Gao,
	Richard Henderson

Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
user-mode builds") we don't generate the "qapi-commands-machine.h"
header in a user-emulation-only build.

Guard qmp_query_cpu_definitions() within CONFIG_USER_ONLY; move
x86_cpu_class_check_missing_features() closer since it is only used
by this QMP command handler.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/i386/cpu.c | 74 +++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 35 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index ae502f0bfe..435980dd3a 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -31,11 +31,11 @@
 #include "qapi/error.h"
 #include "qapi/qapi-visit-machine.h"
 #include "qapi/qmp/qerror.h"
-#include "qapi/qapi-commands-machine-target.h"
 #include "standard-headers/asm-x86/kvm_para.h"
 #include "hw/qdev-properties.h"
 #include "hw/i386/topology.h"
 #ifndef CONFIG_USER_ONLY
+#include "qapi/qapi-commands-machine-target.h"
 #include "exec/address-spaces.h"
 #include "hw/boards.h"
 #include "hw/i386/sgx-epc.h"
@@ -4713,40 +4713,6 @@ static void x86_cpu_get_unavailable_features(Object *obj, Visitor *v,
     visit_type_strList(v, "unavailable-features", &result, errp);
 }
 
-/* Check for missing features that may prevent the CPU class from
- * running using the current machine and accelerator.
- */
-static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
-                                                 strList **list)
-{
-    strList **tail = list;
-    X86CPU *xc;
-    Error *err = NULL;
-
-    if (xcc->host_cpuid_required && !accel_uses_host_cpuid()) {
-        QAPI_LIST_APPEND(tail, g_strdup("kvm"));
-        return;
-    }
-
-    xc = X86_CPU(object_new_with_class(OBJECT_CLASS(xcc)));
-
-    x86_cpu_expand_features(xc, &err);
-    if (err) {
-        /* Errors at x86_cpu_expand_features should never happen,
-         * but in case it does, just report the model as not
-         * runnable at all using the "type" property.
-         */
-        QAPI_LIST_APPEND(tail, g_strdup("type"));
-        error_free(err);
-    }
-
-    x86_cpu_filter_features(xc, false);
-
-    x86_cpu_list_feature_names(xc->filtered_features, tail);
-
-    object_unref(OBJECT(xc));
-}
-
 /* Print all cpuid feature names in featureset
  */
 static void listflags(GList *features)
@@ -4875,6 +4841,42 @@ void x86_cpu_list(void)
     g_list_free(names);
 }
 
+#ifndef CONFIG_USER_ONLY
+
+/* Check for missing features that may prevent the CPU class from
+ * running using the current machine and accelerator.
+ */
+static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
+                                                 strList **list)
+{
+    strList **tail = list;
+    X86CPU *xc;
+    Error *err = NULL;
+
+    if (xcc->host_cpuid_required && !accel_uses_host_cpuid()) {
+        QAPI_LIST_APPEND(tail, g_strdup("kvm"));
+        return;
+    }
+
+    xc = X86_CPU(object_new_with_class(OBJECT_CLASS(xcc)));
+
+    x86_cpu_expand_features(xc, &err);
+    if (err) {
+        /* Errors at x86_cpu_expand_features should never happen,
+         * but in case it does, just report the model as not
+         * runnable at all using the "type" property.
+         */
+        QAPI_LIST_APPEND(tail, g_strdup("type"));
+        error_free(err);
+    }
+
+    x86_cpu_filter_features(xc, false);
+
+    x86_cpu_list_feature_names(xc->filtered_features, tail);
+
+    object_unref(OBJECT(xc));
+}
+
 static void x86_cpu_definition_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
@@ -4915,6 +4917,8 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
     return cpu_list;
 }
 
+#endif /* !CONFIG_USER_ONLY */
+
 uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
                                             bool migratable_only)
 {
-- 
2.38.1



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

* [PATCH RESEND v2 3/5] target/loongarch: Restrict 'qapi-commands-machine.h' to system emulation
  2022-12-20 11:11 [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
  2022-12-20 11:11 ` [PATCH RESEND v2 1/5] target/arm: " Philippe Mathieu-Daudé
  2022-12-20 11:11 ` [PATCH RESEND v2 2/5] target/i386: " Philippe Mathieu-Daudé
@ 2022-12-20 11:11 ` Philippe Mathieu-Daudé
  2022-12-20 11:11 ` [PATCH RESEND v2 4/5] target/mips: " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Cédric Le Goater, Peter Maydell, Greg Kurz,
	Daniel Henrique Barboza, Philippe Mathieu-Daudé,
	Xiaojuan Yang, Aurelien Jarno, Huacai Chen, Aleksandar Rikalo,
	qemu-arm, David Gibson, Jiaxun Yang, Markus Armbruster, Song Gao,
	Richard Henderson

Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
user-mode builds") we don't generate the "qapi-commands-machine.h"
header in a user-emulation-only build.

Extract the QMP functions from cpu.c (which is always compiled)
to the new 'monitor.c' unit (which is only compiled when system
emulation is selected).

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/loongarch/cpu.c       | 27 --------------------------
 target/loongarch/meson.build |  1 +
 target/loongarch/monitor.c   | 37 ++++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 27 deletions(-)
 create mode 100644 target/loongarch/monitor.c

diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index e7b0e12be6..0fb853d915 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -12,7 +12,6 @@
 #include "qemu/module.h"
 #include "sysemu/qtest.h"
 #include "exec/exec-all.h"
-#include "qapi/qapi-commands-machine-target.h"
 #include "cpu.h"
 #include "internals.h"
 #include "fpu/softfloat-helpers.h"
@@ -744,29 +743,3 @@ static const TypeInfo loongarch_cpu_type_infos[] = {
 };
 
 DEFINE_TYPES(loongarch_cpu_type_infos)
-
-static void loongarch_cpu_add_definition(gpointer data, gpointer user_data)
-{
-    ObjectClass *oc = data;
-    CpuDefinitionInfoList **cpu_list = user_data;
-    CpuDefinitionInfo *info = g_new0(CpuDefinitionInfo, 1);
-    const char *typename = object_class_get_name(oc);
-
-    info->name = g_strndup(typename,
-                           strlen(typename) - strlen("-" TYPE_LOONGARCH_CPU));
-    info->q_typename = g_strdup(typename);
-
-    QAPI_LIST_PREPEND(*cpu_list, info);
-}
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    CpuDefinitionInfoList *cpu_list = NULL;
-    GSList *list;
-
-    list = object_class_get_list(TYPE_LOONGARCH_CPU, false);
-    g_slist_foreach(list, loongarch_cpu_add_definition, &cpu_list);
-    g_slist_free(list);
-
-    return cpu_list;
-}
diff --git a/target/loongarch/meson.build b/target/loongarch/meson.build
index 6376f9e84b..48a7eb7c40 100644
--- a/target/loongarch/meson.build
+++ b/target/loongarch/meson.build
@@ -18,6 +18,7 @@ loongarch_tcg_ss.add(zlib)
 loongarch_softmmu_ss = ss.source_set()
 loongarch_softmmu_ss.add(files(
   'machine.c',
+  'monitor.c',
   'tlb_helper.c',
   'constant_timer.c',
   'csr_helper.c',
diff --git a/target/loongarch/monitor.c b/target/loongarch/monitor.c
new file mode 100644
index 0000000000..6c25957881
--- /dev/null
+++ b/target/loongarch/monitor.c
@@ -0,0 +1,37 @@
+/*
+ * QEMU LoongArch CPU (monitor definitions)
+ *
+ * SPDX-FileCopyrightText: 2021 Loongson Technology Corporation Limited
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qapi-commands-machine-target.h"
+#include "cpu.h"
+
+static void loongarch_cpu_add_definition(gpointer data, gpointer user_data)
+{
+    ObjectClass *oc = data;
+    CpuDefinitionInfoList **cpu_list = user_data;
+    CpuDefinitionInfo *info = g_new0(CpuDefinitionInfo, 1);
+    const char *typename = object_class_get_name(oc);
+
+    info->name = g_strndup(typename,
+                           strlen(typename) - strlen("-" TYPE_LOONGARCH_CPU));
+    info->q_typename = g_strdup(typename);
+
+    QAPI_LIST_PREPEND(*cpu_list, info);
+}
+
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    CpuDefinitionInfoList *cpu_list = NULL;
+    GSList *list;
+
+    list = object_class_get_list(TYPE_LOONGARCH_CPU, false);
+    g_slist_foreach(list, loongarch_cpu_add_definition, &cpu_list);
+    g_slist_free(list);
+
+    return cpu_list;
+}
-- 
2.38.1



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

* [PATCH RESEND v2 4/5] target/mips: Restrict 'qapi-commands-machine.h' to system emulation
  2022-12-20 11:11 [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2022-12-20 11:11 ` [PATCH RESEND v2 3/5] target/loongarch: " Philippe Mathieu-Daudé
@ 2022-12-20 11:11 ` Philippe Mathieu-Daudé
  2022-12-21  8:30   ` Philippe Mathieu-Daudé
  2022-12-20 11:11 ` [PATCH RESEND v2 5/5] target/ppc: " Philippe Mathieu-Daudé
  2023-01-13 13:57 ` [PATCH RESEND v2 0/5] target: " Markus Armbruster
  5 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Cédric Le Goater, Peter Maydell, Greg Kurz,
	Daniel Henrique Barboza, Philippe Mathieu-Daudé,
	Xiaojuan Yang, Aurelien Jarno, Huacai Chen, Aleksandar Rikalo,
	qemu-arm, David Gibson, Jiaxun Yang, Markus Armbruster, Song Gao,
	Richard Henderson

Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
user-mode builds") we don't generate the "qapi-commands-machine.h"
header in a user-emulation-only build.

Extract the QMP functions from cpu.c (which is always compiled) to
the new 'sysemu/monitor.c' unit (which is only compiled when system
emulation is selected).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/mips/cpu.c              | 29 -------------------------
 target/mips/sysemu/meson.build |  1 +
 target/mips/sysemu/monitor.c   | 39 ++++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 29 deletions(-)
 create mode 100644 target/mips/sysemu/monitor.c

diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 7a565466cb..7a37123419 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -32,7 +32,6 @@
 #include "hw/qdev-properties.h"
 #include "hw/qdev-clock.h"
 #include "semihosting/semihost.h"
-#include "qapi/qapi-commands-machine-target.h"
 #include "fpu_helper.h"
 
 const char regnames[32][3] = {
@@ -627,34 +626,6 @@ static void mips_cpu_register_types(void)
 
 type_init(mips_cpu_register_types)
 
-static void mips_cpu_add_definition(gpointer data, gpointer user_data)
-{
-    ObjectClass *oc = data;
-    CpuDefinitionInfoList **cpu_list = user_data;
-    CpuDefinitionInfo *info;
-    const char *typename;
-
-    typename = object_class_get_name(oc);
-    info = g_malloc0(sizeof(*info));
-    info->name = g_strndup(typename,
-                           strlen(typename) - strlen("-" TYPE_MIPS_CPU));
-    info->q_typename = g_strdup(typename);
-
-    QAPI_LIST_PREPEND(*cpu_list, info);
-}
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    CpuDefinitionInfoList *cpu_list = NULL;
-    GSList *list;
-
-    list = object_class_get_list(TYPE_MIPS_CPU, false);
-    g_slist_foreach(list, mips_cpu_add_definition, &cpu_list);
-    g_slist_free(list);
-
-    return cpu_list;
-}
-
 /* Could be used by generic CPU object */
 MIPSCPU *mips_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk)
 {
diff --git a/target/mips/sysemu/meson.build b/target/mips/sysemu/meson.build
index cefc227582..0e424c9cc6 100644
--- a/target/mips/sysemu/meson.build
+++ b/target/mips/sysemu/meson.build
@@ -3,5 +3,6 @@ mips_softmmu_ss.add(files(
   'cp0.c',
   'cp0_timer.c',
   'machine.c',
+  'monitor.c',
   'physaddr.c',
 ))
diff --git a/target/mips/sysemu/monitor.c b/target/mips/sysemu/monitor.c
new file mode 100644
index 0000000000..6db4626412
--- /dev/null
+++ b/target/mips/sysemu/monitor.c
@@ -0,0 +1,39 @@
+/*
+ * QEMU MIPS CPU (monitor definitions)
+ *
+ * SPDX-FileCopyrightText: 2012 SUSE LINUX Products GmbH
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qapi-commands-machine-target.h"
+#include "cpu.h"
+
+static void mips_cpu_add_definition(gpointer data, gpointer user_data)
+{
+    ObjectClass *oc = data;
+    CpuDefinitionInfoList **cpu_list = user_data;
+    CpuDefinitionInfo *info;
+    const char *typename;
+
+    typename = object_class_get_name(oc);
+    info = g_malloc0(sizeof(*info));
+    info->name = g_strndup(typename,
+                           strlen(typename) - strlen("-" TYPE_MIPS_CPU));
+    info->q_typename = g_strdup(typename);
+
+    QAPI_LIST_PREPEND(*cpu_list, info);
+}
+
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    CpuDefinitionInfoList *cpu_list = NULL;
+    GSList *list;
+
+    list = object_class_get_list(TYPE_MIPS_CPU, false);
+    g_slist_foreach(list, mips_cpu_add_definition, &cpu_list);
+    g_slist_free(list);
+
+    return cpu_list;
+}
-- 
2.38.1



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

* [PATCH RESEND v2 5/5] target/ppc: Restrict 'qapi-commands-machine.h' to system emulation
  2022-12-20 11:11 [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2022-12-20 11:11 ` [PATCH RESEND v2 4/5] target/mips: " Philippe Mathieu-Daudé
@ 2022-12-20 11:11 ` Philippe Mathieu-Daudé
  2022-12-21 10:22   ` Cédric Le Goater
  2023-01-13 13:57 ` [PATCH RESEND v2 0/5] target: " Markus Armbruster
  5 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 11:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Cédric Le Goater, Peter Maydell, Greg Kurz,
	Daniel Henrique Barboza, Philippe Mathieu-Daudé,
	Xiaojuan Yang, Aurelien Jarno, Huacai Chen, Aleksandar Rikalo,
	qemu-arm, David Gibson, Jiaxun Yang, Markus Armbruster, Song Gao,
	Richard Henderson

Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
user-mode builds") we don't generate the "qapi-commands-machine.h"
header in a user-emulation-only build.

Move the QMP functions from cpu_init.c (which is always compiled) to
monitor.c (which is only compiled when system-emulation is selected).
Note ppc_cpu_class_by_name() is used by both file units, so we expose
its prototype in "cpu-qom.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/ppc/cpu-qom.h  |  2 ++
 target/ppc/cpu_init.c | 48 +----------------------------------------
 target/ppc/monitor.c  | 50 ++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 52 insertions(+), 48 deletions(-)

diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
index 89ff88f28c..6431c520c8 100644
--- a/target/ppc/cpu-qom.h
+++ b/target/ppc/cpu-qom.h
@@ -31,6 +31,8 @@
 
 OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)
 
+ObjectClass *ppc_cpu_class_by_name(const char *name);
+
 typedef struct CPUArchState CPUPPCState;
 typedef struct ppc_tb_t ppc_tb_t;
 typedef struct ppc_dcr_t ppc_dcr_t;
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index cbf0081374..7858cc4c6c 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -40,7 +40,6 @@
 #include "qemu/cutils.h"
 #include "disas/capstone.h"
 #include "fpu/softfloat.h"
-#include "qapi/qapi-commands-machine-target.h"
 
 #include "helper_regs.h"
 #include "internal.h"
@@ -6816,7 +6815,7 @@ static const char *ppc_cpu_lookup_alias(const char *alias)
     return NULL;
 }
 
-static ObjectClass *ppc_cpu_class_by_name(const char *name)
+ObjectClass *ppc_cpu_class_by_name(const char *name)
 {
     char *cpu_model, *typename;
     ObjectClass *oc;
@@ -6956,51 +6955,6 @@ void ppc_cpu_list(void)
 #endif
 }
 
-static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
-{
-    ObjectClass *oc = data;
-    CpuDefinitionInfoList **first = user_data;
-    const char *typename;
-    CpuDefinitionInfo *info;
-
-    typename = object_class_get_name(oc);
-    info = g_malloc0(sizeof(*info));
-    info->name = g_strndup(typename,
-                           strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
-
-    QAPI_LIST_PREPEND(*first, info);
-}
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    CpuDefinitionInfoList *cpu_list = NULL;
-    GSList *list;
-    int i;
-
-    list = object_class_get_list(TYPE_POWERPC_CPU, false);
-    g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list);
-    g_slist_free(list);
-
-    for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
-        PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
-        ObjectClass *oc;
-        CpuDefinitionInfo *info;
-
-        oc = ppc_cpu_class_by_name(alias->model);
-        if (oc == NULL) {
-            continue;
-        }
-
-        info = g_malloc0(sizeof(*info));
-        info->name = g_strdup(alias->alias);
-        info->q_typename = g_strdup(object_class_get_name(oc));
-
-        QAPI_LIST_PREPEND(cpu_list, info);
-    }
-
-    return cpu_list;
-}
-
 static void ppc_cpu_set_pc(CPUState *cs, vaddr value)
 {
     PowerPCCPU *cpu = POWERPC_CPU(cs);
diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c
index 8250b1304e..36e5b5eff8 100644
--- a/target/ppc/monitor.c
+++ b/target/ppc/monitor.c
@@ -1,5 +1,5 @@
 /*
- * QEMU monitor
+ * QEMU PPC (monitor definitions)
  *
  * Copyright (c) 2003-2004 Fabrice Bellard
  *
@@ -28,6 +28,9 @@
 #include "qemu/ctype.h"
 #include "monitor/hmp-target.h"
 #include "monitor/hmp.h"
+#include "qapi/qapi-commands-machine-target.h"
+#include "cpu-models.h"
+#include "cpu-qom.h"
 
 static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
                                    int val)
@@ -172,3 +175,48 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval)
 
     return -EINVAL;
 }
+
+static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
+{
+    ObjectClass *oc = data;
+    CpuDefinitionInfoList **first = user_data;
+    const char *typename;
+    CpuDefinitionInfo *info;
+
+    typename = object_class_get_name(oc);
+    info = g_malloc0(sizeof(*info));
+    info->name = g_strndup(typename,
+                           strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
+
+    QAPI_LIST_PREPEND(*first, info);
+}
+
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    CpuDefinitionInfoList *cpu_list = NULL;
+    GSList *list;
+    int i;
+
+    list = object_class_get_list(TYPE_POWERPC_CPU, false);
+    g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list);
+    g_slist_free(list);
+
+    for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
+        PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
+        ObjectClass *oc;
+        CpuDefinitionInfo *info;
+
+        oc = ppc_cpu_class_by_name(alias->model);
+        if (oc == NULL) {
+            continue;
+        }
+
+        info = g_malloc0(sizeof(*info));
+        info->name = g_strdup(alias->alias);
+        info->q_typename = g_strdup(object_class_get_name(oc));
+
+        QAPI_LIST_PREPEND(cpu_list, info);
+    }
+
+    return cpu_list;
+}
-- 
2.38.1



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

* Re: [PATCH RESEND v2 4/5] target/mips: Restrict 'qapi-commands-machine.h' to system emulation
  2022-12-20 11:11 ` [PATCH RESEND v2 4/5] target/mips: " Philippe Mathieu-Daudé
@ 2022-12-21  8:30   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-21  8:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Cédric Le Goater, Peter Maydell, Greg Kurz,
	Daniel Henrique Barboza, Xiaojuan Yang, Aurelien Jarno,
	Huacai Chen, Aleksandar Rikalo, qemu-arm, David Gibson,
	Jiaxun Yang, Markus Armbruster, Song Gao, Richard Henderson

On 20/12/22 12:11, Philippe Mathieu-Daudé wrote:
> Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
> user-mode builds") we don't generate the "qapi-commands-machine.h"
> header in a user-emulation-only build.
> 
> Extract the QMP functions from cpu.c (which is always compiled) to
> the new 'sysemu/monitor.c' unit (which is only compiled when system
> emulation is selected).
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/mips/cpu.c              | 29 -------------------------
>   target/mips/sysemu/meson.build |  1 +
>   target/mips/sysemu/monitor.c   | 39 ++++++++++++++++++++++++++++++++++
>   3 files changed, 40 insertions(+), 29 deletions(-)
>   create mode 100644 target/mips/sysemu/monitor.c

Patch queued to mips-next.


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

* Re: [PATCH RESEND v2 5/5] target/ppc: Restrict 'qapi-commands-machine.h' to system emulation
  2022-12-20 11:11 ` [PATCH RESEND v2 5/5] target/ppc: " Philippe Mathieu-Daudé
@ 2022-12-21 10:22   ` Cédric Le Goater
  0 siblings, 0 replies; 13+ messages in thread
From: Cédric Le Goater @ 2022-12-21 10:22 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Peter Maydell, Greg Kurz, Daniel Henrique Barboza,
	Xiaojuan Yang, Aurelien Jarno, Huacai Chen, Aleksandar Rikalo,
	qemu-arm, David Gibson, Jiaxun Yang, Markus Armbruster, Song Gao,
	Richard Henderson

On 12/20/22 12:11, Philippe Mathieu-Daudé wrote:
> Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
> user-mode builds") we don't generate the "qapi-commands-machine.h"
> header in a user-emulation-only build.
> 
> Move the QMP functions from cpu_init.c (which is always compiled) to
> monitor.c (which is only compiled when system-emulation is selected).
> Note ppc_cpu_class_by_name() is used by both file units, so we expose
> its prototype in "cpu-qom.h".
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

> ---
>   target/ppc/cpu-qom.h  |  2 ++
>   target/ppc/cpu_init.c | 48 +----------------------------------------
>   target/ppc/monitor.c  | 50 ++++++++++++++++++++++++++++++++++++++++++-
>   3 files changed, 52 insertions(+), 48 deletions(-)
> 
> diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
> index 89ff88f28c..6431c520c8 100644
> --- a/target/ppc/cpu-qom.h
> +++ b/target/ppc/cpu-qom.h
> @@ -31,6 +31,8 @@
>   
>   OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)
>   
> +ObjectClass *ppc_cpu_class_by_name(const char *name);
> +
>   typedef struct CPUArchState CPUPPCState;
>   typedef struct ppc_tb_t ppc_tb_t;
>   typedef struct ppc_dcr_t ppc_dcr_t;
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index cbf0081374..7858cc4c6c 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -40,7 +40,6 @@
>   #include "qemu/cutils.h"
>   #include "disas/capstone.h"
>   #include "fpu/softfloat.h"
> -#include "qapi/qapi-commands-machine-target.h"
>   
>   #include "helper_regs.h"
>   #include "internal.h"
> @@ -6816,7 +6815,7 @@ static const char *ppc_cpu_lookup_alias(const char *alias)
>       return NULL;
>   }
>   
> -static ObjectClass *ppc_cpu_class_by_name(const char *name)
> +ObjectClass *ppc_cpu_class_by_name(const char *name)
>   {
>       char *cpu_model, *typename;
>       ObjectClass *oc;
> @@ -6956,51 +6955,6 @@ void ppc_cpu_list(void)
>   #endif
>   }
>   
> -static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
> -{
> -    ObjectClass *oc = data;
> -    CpuDefinitionInfoList **first = user_data;
> -    const char *typename;
> -    CpuDefinitionInfo *info;
> -
> -    typename = object_class_get_name(oc);
> -    info = g_malloc0(sizeof(*info));
> -    info->name = g_strndup(typename,
> -                           strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
> -
> -    QAPI_LIST_PREPEND(*first, info);
> -}
> -
> -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
> -{
> -    CpuDefinitionInfoList *cpu_list = NULL;
> -    GSList *list;
> -    int i;
> -
> -    list = object_class_get_list(TYPE_POWERPC_CPU, false);
> -    g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list);
> -    g_slist_free(list);
> -
> -    for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
> -        PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
> -        ObjectClass *oc;
> -        CpuDefinitionInfo *info;
> -
> -        oc = ppc_cpu_class_by_name(alias->model);
> -        if (oc == NULL) {
> -            continue;
> -        }
> -
> -        info = g_malloc0(sizeof(*info));
> -        info->name = g_strdup(alias->alias);
> -        info->q_typename = g_strdup(object_class_get_name(oc));
> -
> -        QAPI_LIST_PREPEND(cpu_list, info);
> -    }
> -
> -    return cpu_list;
> -}
> -
>   static void ppc_cpu_set_pc(CPUState *cs, vaddr value)
>   {
>       PowerPCCPU *cpu = POWERPC_CPU(cs);
> diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c
> index 8250b1304e..36e5b5eff8 100644
> --- a/target/ppc/monitor.c
> +++ b/target/ppc/monitor.c
> @@ -1,5 +1,5 @@
>   /*
> - * QEMU monitor
> + * QEMU PPC (monitor definitions)
>    *
>    * Copyright (c) 2003-2004 Fabrice Bellard
>    *
> @@ -28,6 +28,9 @@
>   #include "qemu/ctype.h"
>   #include "monitor/hmp-target.h"
>   #include "monitor/hmp.h"
> +#include "qapi/qapi-commands-machine-target.h"
> +#include "cpu-models.h"
> +#include "cpu-qom.h"
>   
>   static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
>                                      int val)
> @@ -172,3 +175,48 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval)
>   
>       return -EINVAL;
>   }
> +
> +static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
> +{
> +    ObjectClass *oc = data;
> +    CpuDefinitionInfoList **first = user_data;
> +    const char *typename;
> +    CpuDefinitionInfo *info;
> +
> +    typename = object_class_get_name(oc);
> +    info = g_malloc0(sizeof(*info));
> +    info->name = g_strndup(typename,
> +                           strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
> +
> +    QAPI_LIST_PREPEND(*first, info);
> +}
> +
> +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
> +{
> +    CpuDefinitionInfoList *cpu_list = NULL;
> +    GSList *list;
> +    int i;
> +
> +    list = object_class_get_list(TYPE_POWERPC_CPU, false);
> +    g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list);
> +    g_slist_free(list);
> +
> +    for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
> +        PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
> +        ObjectClass *oc;
> +        CpuDefinitionInfo *info;
> +
> +        oc = ppc_cpu_class_by_name(alias->model);
> +        if (oc == NULL) {
> +            continue;
> +        }
> +
> +        info = g_malloc0(sizeof(*info));
> +        info->name = g_strdup(alias->alias);
> +        info->q_typename = g_strdup(object_class_get_name(oc));
> +
> +        QAPI_LIST_PREPEND(cpu_list, info);
> +    }
> +
> +    return cpu_list;
> +}



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

* Re: [PATCH RESEND v2 1/5] target/arm: Restrict 'qapi-commands-machine.h' to system emulation
  2022-12-20 11:11 ` [PATCH RESEND v2 1/5] target/arm: " Philippe Mathieu-Daudé
@ 2023-01-13  8:14   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-13  8:14 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell
  Cc: qemu-ppc, Cédric Le Goater, Greg Kurz,
	Daniel Henrique Barboza, Xiaojuan Yang, Aurelien Jarno,
	Huacai Chen, Aleksandar Rikalo, qemu-arm, David Gibson,
	Jiaxun Yang, Markus Armbruster, Song Gao, Richard Henderson

Hi Peter,

On 20/12/22 12:11, Philippe Mathieu-Daudé wrote:
> Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
> user-mode builds") we don't generate the "qapi-commands-machine.h"
> header in a user-emulation-only build.
> 
> Move the QMP functions from helper.c (which is always compiled) to
> monitor.c (which is only compiled when system-emulation is selected).
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/helper.c   | 29 -----------------------------
>   target/arm/m_helper.c |  1 -
>   target/arm/monitor.c  | 28 ++++++++++++++++++++++++++++
>   3 files changed, 28 insertions(+), 30 deletions(-)

Could you take this patch via your ARM tree?

Thanks,

Phil.


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

* Re: [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation
  2022-12-20 11:11 [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2022-12-20 11:11 ` [PATCH RESEND v2 5/5] target/ppc: " Philippe Mathieu-Daudé
@ 2023-01-13 13:57 ` Markus Armbruster
  2023-01-13 14:42   ` Philippe Mathieu-Daudé
  5 siblings, 1 reply; 13+ messages in thread
From: Markus Armbruster @ 2023-01-13 13:57 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-ppc, Cédric Le Goater, Peter Maydell,
	Greg Kurz, Daniel Henrique Barboza, Xiaojuan Yang, Aurelien Jarno,
	Huacai Chen, Aleksandar Rikalo, qemu-arm, David Gibson,
	Jiaxun Yang, Markus Armbruster, Song Gao

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

> [resend fixing my last name typography...]
>
> All series reviewed, can patches be picked by corresponding
> maintainers?
>
> The "qapi-commands-machine.h" header is not generated in user-only
> emulation. This series removes its use in user-emu code by moving
> the QMP code depending on this header into a separate sysemu unit.
>
> Since v1:
> - renamed cpu-monitor.c -> monitor.c on loongarch

Quick drive-by remark: we usually name C files containing just QMP
commands SUBSYSTEM-qmp-cmds.c, and files containing just HMP commands
SUBSYSTEM-hmp-cmds.c.  On the other hand, the existing monitor-related
files seem to be named target/TARGET/monitor.c.

Keeping QMP and HMP two separate is desirable, but not required.
monitor.c is a fine name for a file containing both.

Use your judgement.



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

* Re: [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation
  2023-01-13 13:57 ` [PATCH RESEND v2 0/5] target: " Markus Armbruster
@ 2023-01-13 14:42   ` Philippe Mathieu-Daudé
  2023-01-13 14:53     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-13 14:42 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel, qemu-ppc, Cédric Le Goater, Peter Maydell,
	Greg Kurz, Daniel Henrique Barboza, Xiaojuan Yang, Aurelien Jarno,
	Huacai Chen, Aleksandar Rikalo, qemu-arm, David Gibson,
	Jiaxun Yang, Song Gao

On 13/1/23 14:57, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> 
>> [resend fixing my last name typography...]
>>
>> All series reviewed, can patches be picked by corresponding
>> maintainers?
>>
>> The "qapi-commands-machine.h" header is not generated in user-only
>> emulation. This series removes its use in user-emu code by moving
>> the QMP code depending on this header into a separate sysemu unit.
>>
>> Since v1:
>> - renamed cpu-monitor.c -> monitor.c on loongarch
> 
> Quick drive-by remark: we usually name C files containing just QMP
> commands SUBSYSTEM-qmp-cmds.c, and files containing just HMP commands
> SUBSYSTEM-hmp-cmds.c.  On the other hand, the existing monitor-related
> files seem to be named target/TARGET/monitor.c.
> 
> Keeping QMP and HMP two separate is desirable, but not required.
> monitor.c is a fine name for a file containing both.

$ git ls-files | fgrep qmp-cmds.c
block/monitor/bitmap-qmp-cmds.c
hw/core/machine-qmp-cmds.c
hw/pci/pci-qmp-cmds.c
monitor/qmp-cmds.c
qom/qom-qmp-cmds.c
tests/unit/test-qmp-cmds.c

$ git ls-files | fgrep monitor.c
monitor/monitor.c
softmmu/qdev-monitor.c
stubs/monitor.c
target/arm/monitor.c
target/i386/monitor.c
target/m68k/monitor.c
target/mips/sysemu/monitor.c
target/nios2/monitor.c
target/ppc/monitor.c
target/riscv/monitor.c
target/sh4/monitor.c
target/sparc/monitor.c
target/xtensa/monitor.c
tests/unit/test-util-filemonitor.c

Do you rather 'cpu-qmp-cmds.c'?

Or is your SUBSYSTEM the $target here?
Because , target/arm/arm-qmp-cmds.c sounds redundant.




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

* Re: [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation
  2023-01-13 14:42   ` Philippe Mathieu-Daudé
@ 2023-01-13 14:53     ` Philippe Mathieu-Daudé
  2023-01-13 17:21       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-13 14:53 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel, qemu-ppc, Cédric Le Goater, Peter Maydell,
	Greg Kurz, Daniel Henrique Barboza, Xiaojuan Yang, Aurelien Jarno,
	Huacai Chen, Aleksandar Rikalo, qemu-arm, David Gibson,
	Jiaxun Yang, Song Gao

On 13/1/23 15:42, Philippe Mathieu-Daudé wrote:
> On 13/1/23 14:57, Markus Armbruster wrote:
>> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>>
>>> [resend fixing my last name typography...]
>>>
>>> All series reviewed, can patches be picked by corresponding
>>> maintainers?
>>>
>>> The "qapi-commands-machine.h" header is not generated in user-only
>>> emulation. This series removes its use in user-emu code by moving
>>> the QMP code depending on this header into a separate sysemu unit.
>>>
>>> Since v1:
>>> - renamed cpu-monitor.c -> monitor.c on loongarch
>>
>> Quick drive-by remark: we usually name C files containing just QMP
>> commands SUBSYSTEM-qmp-cmds.c, and files containing just HMP commands
>> SUBSYSTEM-hmp-cmds.c.  On the other hand, the existing monitor-related
>> files seem to be named target/TARGET/monitor.c.
>>
>> Keeping QMP and HMP two separate is desirable, but not required.
>> monitor.c is a fine name for a file containing both.
> 
> $ git ls-files | fgrep qmp-cmds.c
> block/monitor/bitmap-qmp-cmds.c
> hw/core/machine-qmp-cmds.c
> hw/pci/pci-qmp-cmds.c
> monitor/qmp-cmds.c
> qom/qom-qmp-cmds.c
> tests/unit/test-qmp-cmds.c
> 
> $ git ls-files | fgrep monitor.c
> monitor/monitor.c
> softmmu/qdev-monitor.c
> stubs/monitor.c
> target/arm/monitor.c
> target/i386/monitor.c
> target/m68k/monitor.c
> target/mips/sysemu/monitor.c
> target/nios2/monitor.c
> target/ppc/monitor.c
> target/riscv/monitor.c
> target/sh4/monitor.c
> target/sparc/monitor.c
> target/xtensa/monitor.c
> tests/unit/test-util-filemonitor.c
> 
> Do you rather 'cpu-qmp-cmds.c'?
> 
> Or is your SUBSYSTEM the $target here?
> Because , target/arm/arm-qmp-cmds.c sounds redundant.

IIUC the SUBSYSTEM is "target" so maybe you meant target-qmp-cmds.c?


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

* Re: [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation
  2023-01-13 14:53     ` Philippe Mathieu-Daudé
@ 2023-01-13 17:21       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-13 17:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, qemu-ppc, Cédric Le Goater, Peter Maydell,
	Greg Kurz, Daniel Henrique Barboza, Xiaojuan Yang, Aurelien Jarno,
	Huacai Chen, Aleksandar Rikalo, qemu-arm, David Gibson,
	Jiaxun Yang, Song Gao

On 13/1/23 15:53, Philippe Mathieu-Daudé wrote:
> On 13/1/23 15:42, Philippe Mathieu-Daudé wrote:
>> On 13/1/23 14:57, Markus Armbruster wrote:
>>> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>>>
>>>> [resend fixing my last name typography...]
>>>>
>>>> All series reviewed, can patches be picked by corresponding
>>>> maintainers?
>>>>
>>>> The "qapi-commands-machine.h" header is not generated in user-only
>>>> emulation. This series removes its use in user-emu code by moving
>>>> the QMP code depending on this header into a separate sysemu unit.
>>>>
>>>> Since v1:
>>>> - renamed cpu-monitor.c -> monitor.c on loongarch
>>>
>>> Quick drive-by remark: we usually name C files containing just QMP
>>> commands SUBSYSTEM-qmp-cmds.c, and files containing just HMP commands
>>> SUBSYSTEM-hmp-cmds.c.  On the other hand, the existing monitor-related
>>> files seem to be named target/TARGET/monitor.c.
>>>
>>> Keeping QMP and HMP two separate is desirable, but not required.
>>> monitor.c is a fine name for a file containing both.
>>
>> $ git ls-files | fgrep qmp-cmds.c
>> block/monitor/bitmap-qmp-cmds.c
>> hw/core/machine-qmp-cmds.c
>> hw/pci/pci-qmp-cmds.c
>> monitor/qmp-cmds.c
>> qom/qom-qmp-cmds.c
>> tests/unit/test-qmp-cmds.c
>>
>> $ git ls-files | fgrep monitor.c
>> monitor/monitor.c
>> softmmu/qdev-monitor.c
>> stubs/monitor.c
>> target/arm/monitor.c
>> target/i386/monitor.c
>> target/m68k/monitor.c
>> target/mips/sysemu/monitor.c
>> target/nios2/monitor.c
>> target/ppc/monitor.c
>> target/riscv/monitor.c
>> target/sh4/monitor.c
>> target/sparc/monitor.c
>> target/xtensa/monitor.c
>> tests/unit/test-util-filemonitor.c
>>
>> Do you rather 'cpu-qmp-cmds.c'?
>>
>> Or is your SUBSYSTEM the $target here?
>> Because , target/arm/arm-qmp-cmds.c sounds redundant.
> 
> IIUC the SUBSYSTEM is "target" so maybe you meant target-qmp-cmds.c?

FTR Markus suggested ${target}-qmp-cmds.c on IRC, I'll respin renamed.


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

end of thread, other threads:[~2023-01-13 17:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20 11:11 [PATCH RESEND v2 0/5] target: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
2022-12-20 11:11 ` [PATCH RESEND v2 1/5] target/arm: " Philippe Mathieu-Daudé
2023-01-13  8:14   ` Philippe Mathieu-Daudé
2022-12-20 11:11 ` [PATCH RESEND v2 2/5] target/i386: " Philippe Mathieu-Daudé
2022-12-20 11:11 ` [PATCH RESEND v2 3/5] target/loongarch: " Philippe Mathieu-Daudé
2022-12-20 11:11 ` [PATCH RESEND v2 4/5] target/mips: " Philippe Mathieu-Daudé
2022-12-21  8:30   ` Philippe Mathieu-Daudé
2022-12-20 11:11 ` [PATCH RESEND v2 5/5] target/ppc: " Philippe Mathieu-Daudé
2022-12-21 10:22   ` Cédric Le Goater
2023-01-13 13:57 ` [PATCH RESEND v2 0/5] target: " Markus Armbruster
2023-01-13 14:42   ` Philippe Mathieu-Daudé
2023-01-13 14:53     ` Philippe Mathieu-Daudé
2023-01-13 17:21       ` Philippe Mathieu-Daudé

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).