[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 21/22] exec/cpu: Have cpu_exec_realize() return a boolean
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 21/22] exec/cpu: Have cpu_exec_realize() return a boolean |
Date: |
Mon, 18 Sep 2023 18:02:54 +0200 |
Following the example documented since commit e3fe3988d7 ("error:
Document Error API usage rules"), have cpu_exec_realizefn()
return a boolean indicating whether an error is set or not.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/cpu.h | 2 +-
cpu.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 1e940f6bb5..3dc6968428 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1014,7 +1014,7 @@ G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt,
...)
/* $(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);
+bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
void cpu_exec_unrealizefn(CPUState *cpu);
/**
diff --git a/cpu.c b/cpu.c
index 84b03c09ac..96ae440b81 100644
--- a/cpu.c
+++ b/cpu.c
@@ -131,7 +131,7 @@ const VMStateDescription vmstate_cpu_common = {
};
#endif
-void cpu_exec_realizefn(CPUState *cpu, Error **errp)
+bool cpu_exec_realizefn(CPUState *cpu, Error **errp)
{
/* cache the cpu class for the hotpath */
cpu->cc = CPU_GET_CLASS(cpu);
@@ -142,7 +142,7 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
}
if (!accel_cpu_realizefn(cpu, errp)) {
- return;
+ return false;
}
/* NB: errp parameter is unused currently */
@@ -169,6 +169,8 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
vmstate_register(NULL, cpu->cpu_index,
cpu->cc->sysemu_ops->legacy_vmsd, cpu);
}
#endif /* CONFIG_USER_ONLY */
+
+ return true;
}
void cpu_exec_unrealizefn(CPUState *cpu)
--
2.41.0
- Re: [PATCH 14/22] target/sparc: Init CPU environment *after* accelerator vCPU is realized, (continued)
- [PATCH 15/22] exec/cpu: Introduce CPUClass::verify_accel_features(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 16/22] target/arm: Extract verify_accel_features() from cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 17/22] target/i386: Extract verify_accel_features() from cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 18/22] target/s390x: Call s390_cpu_realize_sysemu from s390_realize_cpu_model, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 19/22] target/s390x: Have s390_realize_cpu_model() return a boolean, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 20/22] target/s390x: Use s390_realize_cpu_model() as verify_accel_features(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 21/22] exec/cpu: Have cpu_exec_realize() return a boolean,
Philippe Mathieu-Daudé <=
- [PATCH 22/22] exec/cpu: Call cpu_exec_realizefn() once in cpu_common_realize(), Philippe Mathieu-Daudé, 2023/09/18