[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 33/48] Revert "cpu: Move cpu_common_props to hw/core/cpu.c"
From: |
Richard Henderson |
Subject: |
[PATCH v4 33/48] Revert "cpu: Move cpu_common_props to hw/core/cpu.c" |
Date: |
Tue, 12 Oct 2021 19:45:52 -0700 |
This reverts commit 1b36e4f5a5de585210ea95f2257839c2312be28f.
Despite a comment saying why cpu_common_props cannot be placed in
a file that is compiled once, it was moved anyway. Revert that.
Since then, Property is not defined in hw/core/cpu.h, so it is now
easier to declare a function to install the properties rather than
the Property array itself.
Cc: Eduardo Habkost <ehabkost@redhat.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/hw/core/cpu.h | 1 +
cpu.c | 21 +++++++++++++++++++++
hw/core/cpu-common.c | 17 +----------------
3 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index b7d5bc1200..1a10497af3 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1008,6 +1008,7 @@ void QEMU_NORETURN cpu_abort(CPUState *cpu, const char
*fmt, ...)
GCC_FMT_ATTR(2, 3);
/* $(top_srcdir)/cpu.c */
+void cpu_class_init_props(DeviceClass *dc);
void cpu_exec_initfn(CPUState *cpu);
void cpu_exec_realizefn(CPUState *cpu, Error **errp);
void cpu_exec_unrealizefn(CPUState *cpu);
diff --git a/cpu.c b/cpu.c
index e1799a15bc..9bce67ef55 100644
--- a/cpu.c
+++ b/cpu.c
@@ -179,6 +179,27 @@ void cpu_exec_unrealizefn(CPUState *cpu)
cpu_list_remove(cpu);
}
+static Property cpu_common_props[] = {
+#ifndef CONFIG_USER_ONLY
+ /*
+ * Create a memory property for softmmu CPU object,
+ * so users can wire up its memory. (This can't go in hw/core/cpu.c
+ * because that file is compiled only once for both user-mode
+ * and system builds.) 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_BOOL("start-powered-off", CPUState, start_powered_off, false),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
+void cpu_class_init_props(DeviceClass *dc)
+{
+ device_class_set_props(dc, cpu_common_props);
+}
+
void cpu_exec_initfn(CPUState *cpu)
{
cpu->as = NULL;
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index e2f5a64604..9e3241b430 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -257,21 +257,6 @@ static int64_t cpu_common_get_arch_id(CPUState *cpu)
return cpu->cpu_index;
}
-static Property cpu_common_props[] = {
-#ifndef CONFIG_USER_ONLY
- /* Create a memory property for softmmu CPU object,
- * so users can wire up its memory. (This can't go in hw/core/cpu.c
- * because that file is compiled only once for both user-mode
- * and system builds.) 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_BOOL("start-powered-off", CPUState, start_powered_off, false),
- DEFINE_PROP_END_OF_LIST(),
-};
-
static void cpu_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -286,7 +271,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
dc->realize = cpu_common_realizefn;
dc->unrealize = cpu_common_unrealizefn;
dc->reset = cpu_common_reset;
- device_class_set_props(dc, cpu_common_props);
+ cpu_class_init_props(dc);
/*
* Reason: CPUs still need special care by board code: wiring up
* IRQs, adding reset handlers, halting non-first CPUs, ...
--
2.25.1
- [PATCH v4 29/48] tcg: Move helper_*_mmu decls to tcg/tcg-ldst.h, (continued)
- [PATCH v4 29/48] tcg: Move helper_*_mmu decls to tcg/tcg-ldst.h, Richard Henderson, 2021/10/12
- [PATCH v4 34/48] linux-user: Add code for PR_GET/SET_UNALIGN, Richard Henderson, 2021/10/12
- [PATCH v4 22/48] accel/tcg: Add cpu_{ld,st}*_mmu interfaces, Richard Henderson, 2021/10/12
- [PATCH v4 35/48] target/alpha: Reorg fp memory operations, Richard Henderson, 2021/10/12
- [PATCH v4 36/48] target/alpha: Reorg integer memory operations, Richard Henderson, 2021/10/12
- [PATCH v4 25/48] target/mips: Use 8-byte memory ops for msa load/store, Richard Henderson, 2021/10/12
- [PATCH v4 30/48] tcg: Add helper_unaligned_{ld, st} for user-only sigbus, Richard Henderson, 2021/10/12
- [PATCH v4 39/48] target/sh4: Implement prctl_unalign_sigbus, Richard Henderson, 2021/10/12
- [PATCH v4 27/48] target/sparc: Use cpu_*_mmu instead of helper_*_mmu, Richard Henderson, 2021/10/12
- [PATCH v4 32/48] linux-user: Disable more prctl subcodes, Richard Henderson, 2021/10/12
- [PATCH v4 33/48] Revert "cpu: Move cpu_common_props to hw/core/cpu.c",
Richard Henderson <=
- [PATCH v4 38/48] target/hppa: Implement prctl_unalign_sigbus, Richard Henderson, 2021/10/12
- [PATCH v4 40/48] linux-user/signal: Handle BUS_ADRALN in host_signal_handler, Richard Henderson, 2021/10/12
- [PATCH v4 41/48] tcg: Canonicalize alignment flags in MemOp, Richard Henderson, 2021/10/12
- [PATCH v4 43/48] tcg/aarch64: Support raising sigbus for user-only, Richard Henderson, 2021/10/12
- [PATCH v4 42/48] tcg/i386: Support raising sigbus for user-only, Richard Henderson, 2021/10/12
- [PATCH v4 44/48] tcg/ppc: Support raising sigbus for user-only, Richard Henderson, 2021/10/12
- [PATCH v4 45/48] tcg/s390: Support raising sigbus for user-only, Richard Henderson, 2021/10/12
- [PATCH v4 46/48] tcg/tci: Support raising sigbus for user-only, Richard Henderson, 2021/10/12
- [PATCH v4 47/48] tcg/riscv: Support raising sigbus for user-only, Richard Henderson, 2021/10/12
- [PATCH v4 48/48] tests/tcg/multiarch: Add sigbus.c, Richard Henderson, 2021/10/12