qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code
@ 2022-11-30 13:52 Philippe Mathieu-Daudé
  2022-11-30 13:52 ` [PATCH-for-8.0 1/5] cpu: Remove capstone meson dependency Philippe Mathieu-Daudé
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-30 13:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost,
	Philippe Mathieu-Daudé, Richard Henderson, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

Trivial housekeeping in cpu*.c.

Philippe Mathieu-Daudé (5):
  cpu: Remove capstone meson dependency
  cpu: Move cpu_class_init_props() to common code
  cpu: Move breakpoint helpers to common code
  cpu: Move cpu_abort() to common code
  cpu: Remove unused includes

 cpu.c         | 165 --------------------------------------------------
 cpus-common.c | 163 +++++++++++++++++++++++++++++++++++++++++++++++++
 meson.build   |   3 +-
 3 files changed, 165 insertions(+), 166 deletions(-)

-- 
2.38.1



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

* [PATCH-for-8.0 1/5] cpu: Remove capstone meson dependency
  2022-11-30 13:52 [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Philippe Mathieu-Daudé
@ 2022-11-30 13:52 ` Philippe Mathieu-Daudé
  2023-02-27 10:54   ` Marc-André Lureau
  2022-11-30 13:52 ` [PATCH-for-8.0 2/5] cpu: Move cpu_class_init_props() to common code Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-30 13:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost,
	Philippe Mathieu-Daudé, Richard Henderson, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

Only disas.c requires capstone CFLAGS, not cpu.c.

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

diff --git a/meson.build b/meson.build
index 5c6b5a1c75..92d449f854 100644
--- a/meson.build
+++ b/meson.build
@@ -3097,11 +3097,12 @@ if have_block
 endif
 
 common_ss.add(files('cpus-common.c'))
+specific_ss.add(files('cpu.c'))
 
 subdir('softmmu')
 
 common_ss.add(capstone)
-specific_ss.add(files('cpu.c', 'disas.c'), capstone)
+specific_ss.add(files('disas.c'), capstone)
 
 # Work around a gcc bug/misfeature wherein constant propagation looks
 # through an alias:
-- 
2.38.1



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

* [PATCH-for-8.0 2/5] cpu: Move cpu_class_init_props() to common code
  2022-11-30 13:52 [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Philippe Mathieu-Daudé
  2022-11-30 13:52 ` [PATCH-for-8.0 1/5] cpu: Remove capstone meson dependency Philippe Mathieu-Daudé
@ 2022-11-30 13:52 ` Philippe Mathieu-Daudé
  2022-11-30 22:17   ` Richard Henderson
  2022-11-30 13:52 ` [PATCH-for-8.0 3/5] cpu: Move breakpoint helpers " Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-30 13:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost,
	Philippe Mathieu-Daudé, Richard Henderson, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

This code is not target-specific.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 cpu.c         | 53 ---------------------------------------------------
 cpus-common.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/cpu.c b/cpu.c
index 4a7d865427..d4b24ea39a 100644
--- a/cpu.c
+++ b/cpu.c
@@ -21,8 +21,6 @@
 #include "qapi/error.h"
 
 #include "exec/target_page.h"
-#include "hw/qdev-core.h"
-#include "hw/qdev-properties.h"
 #include "qemu/error-report.h"
 #include "migration/vmstate.h"
 #ifdef CONFIG_USER_ONLY
@@ -183,57 +181,6 @@ void cpu_exec_unrealizefn(CPUState *cpu)
     cpu_list_remove(cpu);
 }
 
-/*
- * This can't go in hw/core/cpu.c because that file is compiled only
- * once for both user-mode and system builds.
- */
-static Property cpu_common_props[] = {
-#ifdef CONFIG_USER_ONLY
-    /*
-     * Create a property for the user-only object, so users can
-     * adjust prctl(PR_SET_UNALIGN) from the command-line.
-     * Has no effect if the target does not support the feature.
-     */
-    DEFINE_PROP_BOOL("prctl-unalign-sigbus", CPUState,
-                     prctl_unalign_sigbus, false),
-#else
-    /*
-     * Create a memory property for softmmu CPU object, so users can
-     * wire up its memory.  The default if no link is set up is to use
-     * the system address space.
-     */
-    DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
-                     MemoryRegion *),
-#endif
-    DEFINE_PROP_END_OF_LIST(),
-};
-
-static bool cpu_get_start_powered_off(Object *obj, Error **errp)
-{
-    CPUState *cpu = CPU(obj);
-    return cpu->start_powered_off;
-}
-
-static void cpu_set_start_powered_off(Object *obj, bool value, Error **errp)
-{
-    CPUState *cpu = CPU(obj);
-    cpu->start_powered_off = value;
-}
-
-void cpu_class_init_props(DeviceClass *dc)
-{
-    ObjectClass *oc = OBJECT_CLASS(dc);
-
-    device_class_set_props(dc, cpu_common_props);
-    /*
-     * We can't use DEFINE_PROP_BOOL in the Property array for this
-     * property, because we want this to be settable after realize.
-     */
-    object_class_property_add_bool(oc, "start-powered-off",
-                                   cpu_get_start_powered_off,
-                                   cpu_set_start_powered_off);
-}
-
 void cpu_exec_initfn(CPUState *cpu)
 {
     cpu->as = NULL;
diff --git a/cpus-common.c b/cpus-common.c
index 793364dc0e..9151cf4240 100644
--- a/cpus-common.c
+++ b/cpus-common.c
@@ -20,6 +20,8 @@
 #include "qemu/osdep.h"
 #include "qemu/main-loop.h"
 #include "exec/cpu-common.h"
+#include "exec/memory.h"
+#include "hw/qdev-properties.h"
 #include "hw/core/cpu.h"
 #include "sysemu/cpus.h"
 #include "qemu/lockable.h"
@@ -360,3 +362,54 @@ void process_queued_cpu_work(CPUState *cpu)
     qemu_mutex_unlock(&cpu->work_mutex);
     qemu_cond_broadcast(&qemu_work_cond);
 }
+
+/*
+ * This can't go in hw/core/cpu.c because that file is compiled only
+ * once for both user-mode and system builds.
+ */
+static Property cpu_common_props[] = {
+#ifdef CONFIG_USER_ONLY
+    /*
+     * Create a property for the user-only object, so users can
+     * adjust prctl(PR_SET_UNALIGN) from the command-line.
+     * Has no effect if the target does not support the feature.
+     */
+    DEFINE_PROP_BOOL("prctl-unalign-sigbus", CPUState,
+                     prctl_unalign_sigbus, false),
+#else
+    /*
+     * Create a memory property for softmmu CPU object, so users can
+     * wire up its memory.  The default if no link is set up is to use
+     * the system address space.
+     */
+    DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
+                     MemoryRegion *),
+#endif
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static bool cpu_get_start_powered_off(Object *obj, Error **errp)
+{
+    CPUState *cpu = CPU(obj);
+    return cpu->start_powered_off;
+}
+
+static void cpu_set_start_powered_off(Object *obj, bool value, Error **errp)
+{
+    CPUState *cpu = CPU(obj);
+    cpu->start_powered_off = value;
+}
+
+void cpu_class_init_props(DeviceClass *dc)
+{
+    ObjectClass *oc = OBJECT_CLASS(dc);
+
+    device_class_set_props(dc, cpu_common_props);
+    /*
+     * We can't use DEFINE_PROP_BOOL in the Property array for this
+     * property, because we want this to be settable after realize.
+     */
+    object_class_property_add_bool(oc, "start-powered-off",
+                                   cpu_get_start_powered_off,
+                                   cpu_set_start_powered_off);
+}
-- 
2.38.1



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

* [PATCH-for-8.0 3/5] cpu: Move breakpoint helpers to common code
  2022-11-30 13:52 [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Philippe Mathieu-Daudé
  2022-11-30 13:52 ` [PATCH-for-8.0 1/5] cpu: Remove capstone meson dependency Philippe Mathieu-Daudé
  2022-11-30 13:52 ` [PATCH-for-8.0 2/5] cpu: Move cpu_class_init_props() to common code Philippe Mathieu-Daudé
@ 2022-11-30 13:52 ` Philippe Mathieu-Daudé
  2022-11-30 22:19   ` Richard Henderson
  2022-11-30 13:52 ` [PATCH-for-8.0 4/5] cpu: Move cpu_abort() " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-30 13:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost,
	Philippe Mathieu-Daudé, Richard Henderson, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

This code is not target-specific.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 cpu.c         | 71 --------------------------------------------------
 cpus-common.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 71 deletions(-)

diff --git a/cpu.c b/cpu.c
index d4b24ea39a..385e72e140 100644
--- a/cpu.c
+++ b/cpu.c
@@ -257,77 +257,6 @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs)
 }
 #endif
 
-/* Add a breakpoint.  */
-int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
-                          CPUBreakpoint **breakpoint)
-{
-    CPUClass *cc = CPU_GET_CLASS(cpu);
-    CPUBreakpoint *bp;
-
-    if (cc->gdb_adjust_breakpoint) {
-        pc = cc->gdb_adjust_breakpoint(cpu, pc);
-    }
-
-    bp = g_malloc(sizeof(*bp));
-
-    bp->pc = pc;
-    bp->flags = flags;
-
-    /* keep all GDB-injected breakpoints in front */
-    if (flags & BP_GDB) {
-        QTAILQ_INSERT_HEAD(&cpu->breakpoints, bp, entry);
-    } else {
-        QTAILQ_INSERT_TAIL(&cpu->breakpoints, bp, entry);
-    }
-
-    if (breakpoint) {
-        *breakpoint = bp;
-    }
-
-    trace_breakpoint_insert(cpu->cpu_index, pc, flags);
-    return 0;
-}
-
-/* Remove a specific breakpoint.  */
-int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
-{
-    CPUClass *cc = CPU_GET_CLASS(cpu);
-    CPUBreakpoint *bp;
-
-    if (cc->gdb_adjust_breakpoint) {
-        pc = cc->gdb_adjust_breakpoint(cpu, pc);
-    }
-
-    QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
-        if (bp->pc == pc && bp->flags == flags) {
-            cpu_breakpoint_remove_by_ref(cpu, bp);
-            return 0;
-        }
-    }
-    return -ENOENT;
-}
-
-/* Remove a specific breakpoint by reference.  */
-void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *bp)
-{
-    QTAILQ_REMOVE(&cpu->breakpoints, bp, entry);
-
-    trace_breakpoint_remove(cpu->cpu_index, bp->pc, bp->flags);
-    g_free(bp);
-}
-
-/* Remove all matching breakpoints. */
-void cpu_breakpoint_remove_all(CPUState *cpu, int mask)
-{
-    CPUBreakpoint *bp, *next;
-
-    QTAILQ_FOREACH_SAFE(bp, &cpu->breakpoints, entry, next) {
-        if (bp->flags & mask) {
-            cpu_breakpoint_remove_by_ref(cpu, bp);
-        }
-    }
-}
-
 /* enable or disable single step mode. EXCP_DEBUG is returned by the
    CPU loop after each instruction */
 void cpu_single_step(CPUState *cpu, int enabled)
diff --git a/cpus-common.c b/cpus-common.c
index 9151cf4240..8fdb34740e 100644
--- a/cpus-common.c
+++ b/cpus-common.c
@@ -25,6 +25,7 @@
 #include "hw/core/cpu.h"
 #include "sysemu/cpus.h"
 #include "qemu/lockable.h"
+#include "trace/trace-root.h"
 
 static QemuMutex qemu_cpu_list_lock;
 static QemuCond exclusive_cond;
@@ -413,3 +414,74 @@ void cpu_class_init_props(DeviceClass *dc)
                                    cpu_get_start_powered_off,
                                    cpu_set_start_powered_off);
 }
+
+/* Add a breakpoint.  */
+int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
+                          CPUBreakpoint **breakpoint)
+{
+    CPUClass *cc = CPU_GET_CLASS(cpu);
+    CPUBreakpoint *bp;
+
+    if (cc->gdb_adjust_breakpoint) {
+        pc = cc->gdb_adjust_breakpoint(cpu, pc);
+    }
+
+    bp = g_malloc(sizeof(*bp));
+
+    bp->pc = pc;
+    bp->flags = flags;
+
+    /* keep all GDB-injected breakpoints in front */
+    if (flags & BP_GDB) {
+        QTAILQ_INSERT_HEAD(&cpu->breakpoints, bp, entry);
+    } else {
+        QTAILQ_INSERT_TAIL(&cpu->breakpoints, bp, entry);
+    }
+
+    if (breakpoint) {
+        *breakpoint = bp;
+    }
+
+    trace_breakpoint_insert(cpu->cpu_index, pc, flags);
+    return 0;
+}
+
+/* Remove a specific breakpoint.  */
+int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
+{
+    CPUClass *cc = CPU_GET_CLASS(cpu);
+    CPUBreakpoint *bp;
+
+    if (cc->gdb_adjust_breakpoint) {
+        pc = cc->gdb_adjust_breakpoint(cpu, pc);
+    }
+
+    QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
+        if (bp->pc == pc && bp->flags == flags) {
+            cpu_breakpoint_remove_by_ref(cpu, bp);
+            return 0;
+        }
+    }
+    return -ENOENT;
+}
+
+/* Remove a specific breakpoint by reference.  */
+void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *bp)
+{
+    QTAILQ_REMOVE(&cpu->breakpoints, bp, entry);
+
+    trace_breakpoint_remove(cpu->cpu_index, bp->pc, bp->flags);
+    g_free(bp);
+}
+
+/* Remove all matching breakpoints. */
+void cpu_breakpoint_remove_all(CPUState *cpu, int mask)
+{
+    CPUBreakpoint *bp, *next;
+
+    QTAILQ_FOREACH_SAFE(bp, &cpu->breakpoints, entry, next) {
+        if (bp->flags & mask) {
+            cpu_breakpoint_remove_by_ref(cpu, bp);
+        }
+    }
+}
-- 
2.38.1



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

* [PATCH-for-8.0 4/5] cpu: Move cpu_abort() to common code
  2022-11-30 13:52 [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2022-11-30 13:52 ` [PATCH-for-8.0 3/5] cpu: Move breakpoint helpers " Philippe Mathieu-Daudé
@ 2022-11-30 13:52 ` Philippe Mathieu-Daudé
  2022-11-30 22:20   ` Richard Henderson
  2022-11-30 13:52 ` [PATCH-for-8.0 5/5] cpu: Remove unused includes Philippe Mathieu-Daudé
  2022-11-30 15:35 ` [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Paolo Bonzini
  5 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-30 13:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost,
	Philippe Mathieu-Daudé, Richard Henderson, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

This code is not target-specific.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 cpu.c         | 38 --------------------------------------
 cpus-common.c | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/cpu.c b/cpu.c
index 385e72e140..d6936a536b 100644
--- a/cpu.c
+++ b/cpu.c
@@ -31,11 +31,9 @@
 #endif
 #include "sysemu/tcg.h"
 #include "sysemu/kvm.h"
-#include "sysemu/replay.h"
 #include "exec/cpu-common.h"
 #include "exec/exec-all.h"
 #include "exec/translate-all.h"
-#include "exec/log.h"
 #include "hw/core/accel-cpu.h"
 #include "trace/trace-root.h"
 #include "qemu/accel.h"
@@ -270,42 +268,6 @@ void cpu_single_step(CPUState *cpu, int enabled)
     }
 }
 
-void cpu_abort(CPUState *cpu, const char *fmt, ...)
-{
-    va_list ap;
-    va_list ap2;
-
-    va_start(ap, fmt);
-    va_copy(ap2, ap);
-    fprintf(stderr, "qemu: fatal: ");
-    vfprintf(stderr, fmt, ap);
-    fprintf(stderr, "\n");
-    cpu_dump_state(cpu, stderr, CPU_DUMP_FPU | CPU_DUMP_CCOP);
-    if (qemu_log_separate()) {
-        FILE *logfile = qemu_log_trylock();
-        if (logfile) {
-            fprintf(logfile, "qemu: fatal: ");
-            vfprintf(logfile, fmt, ap2);
-            fprintf(logfile, "\n");
-            cpu_dump_state(cpu, logfile, CPU_DUMP_FPU | CPU_DUMP_CCOP);
-            qemu_log_unlock(logfile);
-        }
-    }
-    va_end(ap2);
-    va_end(ap);
-    replay_finish();
-#if defined(CONFIG_USER_ONLY)
-    {
-        struct sigaction act;
-        sigfillset(&act.sa_mask);
-        act.sa_handler = SIG_DFL;
-        act.sa_flags = 0;
-        sigaction(SIGABRT, &act, NULL);
-    }
-#endif
-    abort();
-}
-
 /* physical memory access (slow version, mainly for debug) */
 #if defined(CONFIG_USER_ONLY)
 int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
diff --git a/cpus-common.c b/cpus-common.c
index 8fdb34740e..38af2ab840 100644
--- a/cpus-common.c
+++ b/cpus-common.c
@@ -21,9 +21,11 @@
 #include "qemu/main-loop.h"
 #include "exec/cpu-common.h"
 #include "exec/memory.h"
+#include "exec/log.h"
 #include "hw/qdev-properties.h"
 #include "hw/core/cpu.h"
 #include "sysemu/cpus.h"
+#include "sysemu/replay.h"
 #include "qemu/lockable.h"
 #include "trace/trace-root.h"
 
@@ -485,3 +487,39 @@ void cpu_breakpoint_remove_all(CPUState *cpu, int mask)
         }
     }
 }
+
+void cpu_abort(CPUState *cpu, const char *fmt, ...)
+{
+    va_list ap;
+    va_list ap2;
+
+    va_start(ap, fmt);
+    va_copy(ap2, ap);
+    fprintf(stderr, "qemu: fatal: ");
+    vfprintf(stderr, fmt, ap);
+    fprintf(stderr, "\n");
+    cpu_dump_state(cpu, stderr, CPU_DUMP_FPU | CPU_DUMP_CCOP);
+    if (qemu_log_separate()) {
+        FILE *logfile = qemu_log_trylock();
+        if (logfile) {
+            fprintf(logfile, "qemu: fatal: ");
+            vfprintf(logfile, fmt, ap2);
+            fprintf(logfile, "\n");
+            cpu_dump_state(cpu, logfile, CPU_DUMP_FPU | CPU_DUMP_CCOP);
+            qemu_log_unlock(logfile);
+        }
+    }
+    va_end(ap2);
+    va_end(ap);
+    replay_finish();
+#if defined(CONFIG_USER_ONLY)
+    {
+        struct sigaction act;
+        sigfillset(&act.sa_mask);
+        act.sa_handler = SIG_DFL;
+        act.sa_flags = 0;
+        sigaction(SIGABRT, &act, NULL);
+    }
+#endif
+    abort();
+}
-- 
2.38.1



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

* [PATCH-for-8.0 5/5] cpu: Remove unused includes
  2022-11-30 13:52 [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2022-11-30 13:52 ` [PATCH-for-8.0 4/5] cpu: Move cpu_abort() " Philippe Mathieu-Daudé
@ 2022-11-30 13:52 ` Philippe Mathieu-Daudé
  2022-11-30 22:20   ` Richard Henderson
  2022-11-30 15:35 ` [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Paolo Bonzini
  5 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-30 13:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost,
	Philippe Mathieu-Daudé, Richard Henderson, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 cpu.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/cpu.c b/cpu.c
index d6936a536b..d512b24c0a 100644
--- a/cpu.c
+++ b/cpu.c
@@ -31,10 +31,7 @@
 #endif
 #include "sysemu/tcg.h"
 #include "sysemu/kvm.h"
-#include "exec/cpu-common.h"
-#include "exec/exec-all.h"
 #include "exec/translate-all.h"
-#include "hw/core/accel-cpu.h"
 #include "trace/trace-root.h"
 #include "qemu/accel.h"
 
-- 
2.38.1



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

* Re: [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code
  2022-11-30 13:52 [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2022-11-30 13:52 ` [PATCH-for-8.0 5/5] cpu: Remove unused includes Philippe Mathieu-Daudé
@ 2022-11-30 15:35 ` Paolo Bonzini
  2022-11-30 22:21   ` Richard Henderson
  5 siblings, 1 reply; 13+ messages in thread
From: Paolo Bonzini @ 2022-11-30 15:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Marc-André Lureau, Eduardo Habkost,
	Richard Henderson, Yanan Wang, Daniel P . Berrangé,
	Marcel Apfelbaum, Thomas Huth

Queued, thanks.

Paolo



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

* Re: [PATCH-for-8.0 2/5] cpu: Move cpu_class_init_props() to common code
  2022-11-30 13:52 ` [PATCH-for-8.0 2/5] cpu: Move cpu_class_init_props() to common code Philippe Mathieu-Daudé
@ 2022-11-30 22:17   ` Richard Henderson
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2022-11-30 22:17 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

On 11/30/22 05:52, Philippe Mathieu-Daudé wrote:
> This code is not target-specific.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   cpu.c         | 53 ---------------------------------------------------
>   cpus-common.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 53 insertions(+), 53 deletions(-)
> 
> diff --git a/cpu.c b/cpu.c
> index 4a7d865427..d4b24ea39a 100644
> --- a/cpu.c
> +++ b/cpu.c
> @@ -21,8 +21,6 @@
>   #include "qapi/error.h"
>   
>   #include "exec/target_page.h"
> -#include "hw/qdev-core.h"
> -#include "hw/qdev-properties.h"
>   #include "qemu/error-report.h"
>   #include "migration/vmstate.h"
>   #ifdef CONFIG_USER_ONLY
> @@ -183,57 +181,6 @@ void cpu_exec_unrealizefn(CPUState *cpu)
>       cpu_list_remove(cpu);
>   }
>   
> -/*
> - * This can't go in hw/core/cpu.c because that file is compiled only
> - * once for both user-mode and system builds.
> - */
> -static Property cpu_common_props[] = {
> -#ifdef CONFIG_USER_ONLY

It is "target" specific in the general sense, in that CONFIG_USER_ONLY is either set or unset.


r~


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

* Re: [PATCH-for-8.0 3/5] cpu: Move breakpoint helpers to common code
  2022-11-30 13:52 ` [PATCH-for-8.0 3/5] cpu: Move breakpoint helpers " Philippe Mathieu-Daudé
@ 2022-11-30 22:19   ` Richard Henderson
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2022-11-30 22:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

On 11/30/22 05:52, Philippe Mathieu-Daudé wrote:
> This code is not target-specific.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   cpu.c         | 71 --------------------------------------------------
>   cpus-common.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 72 insertions(+), 71 deletions(-)

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

r~


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

* Re: [PATCH-for-8.0 4/5] cpu: Move cpu_abort() to common code
  2022-11-30 13:52 ` [PATCH-for-8.0 4/5] cpu: Move cpu_abort() " Philippe Mathieu-Daudé
@ 2022-11-30 22:20   ` Richard Henderson
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2022-11-30 22:20 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

On 11/30/22 05:52, Philippe Mathieu-Daudé wrote:
> This code is not target-specific.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   cpu.c         | 38 --------------------------------------
>   cpus-common.c | 38 ++++++++++++++++++++++++++++++++++++++
>   2 files changed, 38 insertions(+), 38 deletions(-)
> 
> diff --git a/cpu.c b/cpu.c
> index 385e72e140..d6936a536b 100644
> --- a/cpu.c
> +++ b/cpu.c
> @@ -31,11 +31,9 @@
>   #endif
>   #include "sysemu/tcg.h"
>   #include "sysemu/kvm.h"
> -#include "sysemu/replay.h"
>   #include "exec/cpu-common.h"
>   #include "exec/exec-all.h"
>   #include "exec/translate-all.h"
> -#include "exec/log.h"
>   #include "hw/core/accel-cpu.h"
>   #include "trace/trace-root.h"
>   #include "qemu/accel.h"
> @@ -270,42 +268,6 @@ void cpu_single_step(CPUState *cpu, int enabled)
>       }
>   }
>   
> -void cpu_abort(CPUState *cpu, const char *fmt, ...)
> -{
> -    va_list ap;
> -    va_list ap2;
> -
> -    va_start(ap, fmt);
> -    va_copy(ap2, ap);
> -    fprintf(stderr, "qemu: fatal: ");
> -    vfprintf(stderr, fmt, ap);
> -    fprintf(stderr, "\n");
> -    cpu_dump_state(cpu, stderr, CPU_DUMP_FPU | CPU_DUMP_CCOP);
> -    if (qemu_log_separate()) {
> -        FILE *logfile = qemu_log_trylock();
> -        if (logfile) {
> -            fprintf(logfile, "qemu: fatal: ");
> -            vfprintf(logfile, fmt, ap2);
> -            fprintf(logfile, "\n");
> -            cpu_dump_state(cpu, logfile, CPU_DUMP_FPU | CPU_DUMP_CCOP);
> -            qemu_log_unlock(logfile);
> -        }
> -    }
> -    va_end(ap2);
> -    va_end(ap);
> -    replay_finish();
> -#if defined(CONFIG_USER_ONLY)
> -    {
> -        struct sigaction act;
> -        sigfillset(&act.sa_mask);
> -        act.sa_handler = SIG_DFL;
> -        act.sa_flags = 0;
> -        sigaction(SIGABRT, &act, NULL);
> -    }
> -#endif
> -    abort();
> -}
> -
>   /* physical memory access (slow version, mainly for debug) */
>   #if defined(CONFIG_USER_ONLY)
>   int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
> diff --git a/cpus-common.c b/cpus-common.c
> index 8fdb34740e..38af2ab840 100644
> --- a/cpus-common.c
> +++ b/cpus-common.c
> @@ -21,9 +21,11 @@
>   #include "qemu/main-loop.h"
>   #include "exec/cpu-common.h"
>   #include "exec/memory.h"
> +#include "exec/log.h"
>   #include "hw/qdev-properties.h"
>   #include "hw/core/cpu.h"
>   #include "sysemu/cpus.h"
> +#include "sysemu/replay.h"
>   #include "qemu/lockable.h"
>   #include "trace/trace-root.h"
>   
> @@ -485,3 +487,39 @@ void cpu_breakpoint_remove_all(CPUState *cpu, int mask)
>           }
>       }
>   }
> +
> +void cpu_abort(CPUState *cpu, const char *fmt, ...)
> +{
> +    va_list ap;
> +    va_list ap2;
> +
> +    va_start(ap, fmt);
> +    va_copy(ap2, ap);
> +    fprintf(stderr, "qemu: fatal: ");
> +    vfprintf(stderr, fmt, ap);
> +    fprintf(stderr, "\n");
> +    cpu_dump_state(cpu, stderr, CPU_DUMP_FPU | CPU_DUMP_CCOP);
> +    if (qemu_log_separate()) {
> +        FILE *logfile = qemu_log_trylock();
> +        if (logfile) {
> +            fprintf(logfile, "qemu: fatal: ");
> +            vfprintf(logfile, fmt, ap2);
> +            fprintf(logfile, "\n");
> +            cpu_dump_state(cpu, logfile, CPU_DUMP_FPU | CPU_DUMP_CCOP);
> +            qemu_log_unlock(logfile);
> +        }
> +    }
> +    va_end(ap2);
> +    va_end(ap);
> +    replay_finish();
> +#if defined(CONFIG_USER_ONLY)

CONFIG_USER_ONLY is build specific.

r~


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

* Re: [PATCH-for-8.0 5/5] cpu: Remove unused includes
  2022-11-30 13:52 ` [PATCH-for-8.0 5/5] cpu: Remove unused includes Philippe Mathieu-Daudé
@ 2022-11-30 22:20   ` Richard Henderson
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2022-11-30 22:20 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Marc-André Lureau, Eduardo Habkost, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

On 11/30/22 05:52, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   cpu.c | 3 ---
>   1 file changed, 3 deletions(-)
> 
> diff --git a/cpu.c b/cpu.c
> index d6936a536b..d512b24c0a 100644
> --- a/cpu.c
> +++ b/cpu.c
> @@ -31,10 +31,7 @@
>   #endif
>   #include "sysemu/tcg.h"
>   #include "sysemu/kvm.h"
> -#include "exec/cpu-common.h"
> -#include "exec/exec-all.h"
>   #include "exec/translate-all.h"
> -#include "hw/core/accel-cpu.h"
>   #include "trace/trace-root.h"
>   #include "qemu/accel.h"
>   

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


r~


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

* Re: [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code
  2022-11-30 15:35 ` [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Paolo Bonzini
@ 2022-11-30 22:21   ` Richard Henderson
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2022-11-30 22:21 UTC (permalink / raw)
  To: Paolo Bonzini, Philippe Mathieu-Daudé
  Cc: qemu-devel, Marc-André Lureau, Eduardo Habkost, Yanan Wang,
	Daniel P . Berrangé, Marcel Apfelbaum, Thomas Huth

On 11/30/22 07:35, Paolo Bonzini wrote:
> Queued, thanks.

I think at least two patches are broken.


r~



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

* Re: [PATCH-for-8.0 1/5] cpu: Remove capstone meson dependency
  2022-11-30 13:52 ` [PATCH-for-8.0 1/5] cpu: Remove capstone meson dependency Philippe Mathieu-Daudé
@ 2023-02-27 10:54   ` Marc-André Lureau
  0 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2023-02-27 10:54 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Eduardo Habkost, Richard Henderson, Paolo Bonzini,
	Yanan Wang, Daniel P. Berrangé, Marcel Apfelbaum,
	Thomas Huth

On Wed, Nov 30, 2022 at 5:55 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> Only disas.c requires capstone CFLAGS, not cpu.c.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  meson.build | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 5c6b5a1c75..92d449f854 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3097,11 +3097,12 @@ if have_block
>  endif
>
>  common_ss.add(files('cpus-common.c'))
> +specific_ss.add(files('cpu.c'))
>
>  subdir('softmmu')
>
>  common_ss.add(capstone)
> -specific_ss.add(files('cpu.c', 'disas.c'), capstone)
> +specific_ss.add(files('disas.c'), capstone)
>
>  # Work around a gcc bug/misfeature wherein constant propagation looks
>  # through an alias:
> --
> 2.38.1
>
>


-- 
Marc-André Lureau


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

end of thread, other threads:[~2023-02-27 10:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 13:52 [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Philippe Mathieu-Daudé
2022-11-30 13:52 ` [PATCH-for-8.0 1/5] cpu: Remove capstone meson dependency Philippe Mathieu-Daudé
2023-02-27 10:54   ` Marc-André Lureau
2022-11-30 13:52 ` [PATCH-for-8.0 2/5] cpu: Move cpu_class_init_props() to common code Philippe Mathieu-Daudé
2022-11-30 22:17   ` Richard Henderson
2022-11-30 13:52 ` [PATCH-for-8.0 3/5] cpu: Move breakpoint helpers " Philippe Mathieu-Daudé
2022-11-30 22:19   ` Richard Henderson
2022-11-30 13:52 ` [PATCH-for-8.0 4/5] cpu: Move cpu_abort() " Philippe Mathieu-Daudé
2022-11-30 22:20   ` Richard Henderson
2022-11-30 13:52 ` [PATCH-for-8.0 5/5] cpu: Remove unused includes Philippe Mathieu-Daudé
2022-11-30 22:20   ` Richard Henderson
2022-11-30 15:35 ` [PATCH-for-8.0 0/5] cpu: Move target-independent code to common code Paolo Bonzini
2022-11-30 22:21   ` 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).