[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/30] sparc/sun4m: Use start-powered-off CPUState property
From: |
David Gibson |
Subject: |
[PULL 21/30] sparc/sun4m: Use start-powered-off CPUState property |
Date: |
Fri, 4 Sep 2020 13:47:10 +1000 |
From: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Instead of setting CPUState::halted to 1 in secondary_cpu_reset(), use the
start-powered-off property which makes cpu_common_reset() initialize it
to 1 in common code.
Now secondary_cpu_reset() becomes equivalent to main_cpu_reset() so rename
the function to sun4m_cpu_reset().
Also remove setting of cs->halted from cpu_devinit(), which seems out of
place when compared to similar code in other architectures (e.g.,
ppce500_init() in hw/ppc/e500.c).
Finally, change creation of CPU object from cpu_create() to object_new()
and qdev_realize_and_unref() because cpu_create() realizes the CPU and it's
not possible to set a property after the object is realized.
Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Message-Id: <20200826055535.951207-8-bauerman@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/sparc/sun4m.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 7484aa4438..6bf9d27d8a 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -218,7 +218,7 @@ static void dummy_cpu_set_irq(void *opaque, int irq, int
level)
{
}
-static void main_cpu_reset(void *opaque)
+static void sun4m_cpu_reset(void *opaque)
{
SPARCCPU *cpu = opaque;
CPUState *cs = CPU(cpu);
@@ -226,15 +226,6 @@ static void main_cpu_reset(void *opaque)
cpu_reset(cs);
}
-static void secondary_cpu_reset(void *opaque)
-{
- SPARCCPU *cpu = opaque;
- CPUState *cs = CPU(cpu);
-
- cpu_reset(cs);
- cs->halted = 1;
-}
-
static void cpu_halt_signal(void *opaque, int irq, int level)
{
if (level && current_cpu) {
@@ -818,21 +809,17 @@ static const TypeInfo ram_info = {
static void cpu_devinit(const char *cpu_type, unsigned int id,
uint64_t prom_addr, qemu_irq **cpu_irqs)
{
- CPUState *cs;
SPARCCPU *cpu;
CPUSPARCState *env;
- cpu = SPARC_CPU(cpu_create(cpu_type));
+ cpu = SPARC_CPU(object_new(cpu_type));
env = &cpu->env;
cpu_sparc_set_id(env, id);
- if (id == 0) {
- qemu_register_reset(main_cpu_reset, cpu);
- } else {
- qemu_register_reset(secondary_cpu_reset, cpu);
- cs = CPU(cpu);
- cs->halted = 1;
- }
+ qemu_register_reset(sun4m_cpu_reset, cpu);
+ object_property_set_bool(OBJECT(cpu), "start-powered-off", id != 0,
+ &error_fatal);
+ qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal);
*cpu_irqs = qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS);
env->prom_addr = prom_addr;
}
--
2.26.2
- [PULL 11/30] spapr/xive: Allocate vCPU IPIs from the vCPU contexts, (continued)
- [PULL 11/30] spapr/xive: Allocate vCPU IPIs from the vCPU contexts, David Gibson, 2020/09/03
- [PULL 07/30] spapr/xive: Use the xics flag to check for XIVE-only IRQ backends, David Gibson, 2020/09/03
- [PULL 09/30] spapr/xive: Use kvmppc_xive_source_reset() in post_load, David Gibson, 2020/09/03
- [PULL 12/30] ppc/spapr_nvdimm: use g_autofree in spapr_nvdimm_validate_opts(), David Gibson, 2020/09/03
- [PULL 17/30] ppc/spapr: Use start-powered-off CPUState property, David Gibson, 2020/09/03
- [PULL 14/30] ppc/spapr_nvdimm: do not enable support with 'nvdimm=off', David Gibson, 2020/09/03
- [PULL 13/30] spapr, spapr_nvdimm: fold NVDIMM validation in the same place, David Gibson, 2020/09/03
- [PULL 15/30] target/arm: Move start-powered-off property to generic CPUState, David Gibson, 2020/09/03
- [PULL 10/30] spapr/xive: Allocate IPIs independently from the other sources, David Gibson, 2020/09/03
- [PULL 18/30] ppc/e500: Use start-powered-off CPUState property, David Gibson, 2020/09/03
- [PULL 21/30] sparc/sun4m: Use start-powered-off CPUState property,
David Gibson <=
- [PULL 16/30] target/arm: Move setting of CPU halted state to generic code, David Gibson, 2020/09/03
- [PULL 20/30] sparc/sun4m: Don't set cs->halted = 0 in main_cpu_reset(), David Gibson, 2020/09/03
- [PULL 19/30] mips/cps: Use start-powered-off CPUState property, David Gibson, 2020/09/03
- [PULL 23/30] hw/ppc/ppc4xx_pci: Use ARRAY_SIZE() instead of magic value, David Gibson, 2020/09/03
- [PULL 22/30] target/s390x: Use start-powered-off CPUState property, David Gibson, 2020/09/03
- [PULL 25/30] ppc: introducing spapr_numa.c NUMA code helper, David Gibson, 2020/09/03
- [PULL 26/30] ppc/spapr_nvdimm: turn spapr_dt_nvdimm() static, David Gibson, 2020/09/03
- [PULL 28/30] spapr, spapr_numa: handle vcpu ibm,associativity, David Gibson, 2020/09/03
- [PULL 29/30] spapr, spapr_numa: move lookup-arrays handling to spapr_numa.c, David Gibson, 2020/09/03
- [PULL 24/30] hw/ppc/ppc4xx_pci: Replace pointless warning by assert(), David Gibson, 2020/09/03