cpu: Add Error argument to cpu_exec_init()
Add an Error argument to cpu_exec_init() to let users collect the error. This is in preparation to change the CPU enumeration logic in cpu_exec_init(). With the new enumeration logic, cpu_exec_init() can fail if cpu_index values corresponding to max_cpus have already been handed out. Since all current callers of cpu_exec_init() are from instance_init, use error_abort Error argument to abort in case of an error. Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
291135b5da
commit
5a790cc4b9
2
exec.c
2
exec.c
|
@ -526,7 +526,7 @@ void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void cpu_exec_init(CPUArchState *env)
|
void cpu_exec_init(CPUArchState *env, Error **errp)
|
||||||
{
|
{
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||||
|
|
|
@ -88,7 +88,7 @@ void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
|
||||||
TranslationBlock *tb_gen_code(CPUState *cpu,
|
TranslationBlock *tb_gen_code(CPUState *cpu,
|
||||||
target_ulong pc, target_ulong cs_base, int flags,
|
target_ulong pc, target_ulong cs_base, int flags,
|
||||||
int cflags);
|
int cflags);
|
||||||
void cpu_exec_init(CPUArchState *env);
|
void cpu_exec_init(CPUArchState *env, Error **errp);
|
||||||
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu);
|
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu);
|
||||||
|
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
|
|
|
@ -257,7 +257,7 @@ static void alpha_cpu_initfn(Object *obj)
|
||||||
CPUAlphaState *env = &cpu->env;
|
CPUAlphaState *env = &cpu->env;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
tlb_flush(cs, 1);
|
tlb_flush(cs, 1);
|
||||||
|
|
||||||
alpha_translate_init();
|
alpha_translate_init();
|
||||||
|
|
|
@ -392,7 +392,7 @@ static void arm_cpu_initfn(Object *obj)
|
||||||
uint32_t Aff1, Aff0;
|
uint32_t Aff1, Aff0;
|
||||||
|
|
||||||
cs->env_ptr = &cpu->env;
|
cs->env_ptr = &cpu->env;
|
||||||
cpu_exec_init(&cpu->env);
|
cpu_exec_init(&cpu->env, &error_abort);
|
||||||
cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal,
|
cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal,
|
||||||
g_free, g_free);
|
g_free, g_free);
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ static void cris_cpu_initfn(Object *obj)
|
||||||
static bool tcg_initialized;
|
static bool tcg_initialized;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
env->pregs[PR_VR] = ccc->vr;
|
env->pregs[PR_VR] = ccc->vr;
|
||||||
|
|
||||||
|
|
|
@ -3038,7 +3038,7 @@ static void x86_cpu_initfn(Object *obj)
|
||||||
static int inited;
|
static int inited;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
object_property_add(obj, "family", "int",
|
object_property_add(obj, "family", "int",
|
||||||
x86_cpuid_version_get_family,
|
x86_cpuid_version_get_family,
|
||||||
|
|
|
@ -151,7 +151,7 @@ static void lm32_cpu_initfn(Object *obj)
|
||||||
static bool tcg_initialized;
|
static bool tcg_initialized;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
env->flags = 0;
|
env->flags = 0;
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ static void m68k_cpu_initfn(Object *obj)
|
||||||
static bool inited;
|
static bool inited;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
if (tcg_enabled() && !inited) {
|
if (tcg_enabled() && !inited) {
|
||||||
inited = true;
|
inited = true;
|
||||||
|
|
|
@ -190,7 +190,7 @@ static void mb_cpu_initfn(Object *obj)
|
||||||
static bool tcg_initialized;
|
static bool tcg_initialized;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
|
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ static void mips_cpu_initfn(Object *obj)
|
||||||
CPUMIPSState *env = &cpu->env;
|
CPUMIPSState *env = &cpu->env;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
if (tcg_enabled()) {
|
if (tcg_enabled()) {
|
||||||
mips_tcg_init();
|
mips_tcg_init();
|
||||||
|
|
|
@ -66,7 +66,7 @@ static void moxie_cpu_initfn(Object *obj)
|
||||||
static int inited;
|
static int inited;
|
||||||
|
|
||||||
cs->env_ptr = &cpu->env;
|
cs->env_ptr = &cpu->env;
|
||||||
cpu_exec_init(&cpu->env);
|
cpu_exec_init(&cpu->env, &error_abort);
|
||||||
|
|
||||||
if (tcg_enabled() && !inited) {
|
if (tcg_enabled() && !inited) {
|
||||||
inited = 1;
|
inited = 1;
|
||||||
|
|
|
@ -92,7 +92,7 @@ static void openrisc_cpu_initfn(Object *obj)
|
||||||
static int inited;
|
static int inited;
|
||||||
|
|
||||||
cs->env_ptr = &cpu->env;
|
cs->env_ptr = &cpu->env;
|
||||||
cpu_exec_init(&cpu->env);
|
cpu_exec_init(&cpu->env, &error_abort);
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
cpu_openrisc_mmu_init(cpu);
|
cpu_openrisc_mmu_init(cpu);
|
||||||
|
|
|
@ -9633,7 +9633,7 @@ static void ppc_cpu_initfn(Object *obj)
|
||||||
CPUPPCState *env = &cpu->env;
|
CPUPPCState *env = &cpu->env;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
cpu->cpu_dt_id = cs->cpu_index;
|
cpu->cpu_dt_id = cs->cpu_index;
|
||||||
|
|
||||||
env->msr_mask = pcc->msr_mask;
|
env->msr_mask = pcc->msr_mask;
|
||||||
|
|
|
@ -212,7 +212,7 @@ static void s390_cpu_initfn(Object *obj)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
qemu_register_reset(s390_cpu_machine_reset_cb, cpu);
|
qemu_register_reset(s390_cpu_machine_reset_cb, cpu);
|
||||||
qemu_get_timedate(&tm, 0);
|
qemu_get_timedate(&tm, 0);
|
||||||
|
|
|
@ -248,7 +248,7 @@ static void superh_cpu_initfn(Object *obj)
|
||||||
CPUSH4State *env = &cpu->env;
|
CPUSH4State *env = &cpu->env;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
env->movcal_backup_tail = &(env->movcal_backup);
|
env->movcal_backup_tail = &(env->movcal_backup);
|
||||||
|
|
||||||
|
|
|
@ -802,7 +802,7 @@ static void sparc_cpu_initfn(Object *obj)
|
||||||
CPUSPARCState *env = &cpu->env;
|
CPUSPARCState *env = &cpu->env;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
if (tcg_enabled()) {
|
if (tcg_enabled()) {
|
||||||
gen_intermediate_code_init(env);
|
gen_intermediate_code_init(env);
|
||||||
|
|
|
@ -92,7 +92,7 @@ static void tricore_cpu_initfn(Object *obj)
|
||||||
CPUTriCoreState *env = &cpu->env;
|
CPUTriCoreState *env = &cpu->env;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
if (tcg_enabled()) {
|
if (tcg_enabled()) {
|
||||||
tricore_tcg_init();
|
tricore_tcg_init();
|
||||||
|
|
|
@ -111,7 +111,7 @@ static void uc32_cpu_initfn(Object *obj)
|
||||||
static bool inited;
|
static bool inited;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
#ifdef CONFIG_USER_ONLY
|
#ifdef CONFIG_USER_ONLY
|
||||||
env->uncached_asr = ASR_MODE_USER;
|
env->uncached_asr = ASR_MODE_USER;
|
||||||
|
|
|
@ -114,7 +114,7 @@ static void xtensa_cpu_initfn(Object *obj)
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
env->config = xcc->config;
|
env->config = xcc->config;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env, &error_abort);
|
||||||
|
|
||||||
if (tcg_enabled() && !tcg_inited) {
|
if (tcg_enabled() && !tcg_inited) {
|
||||||
tcg_inited = true;
|
tcg_inited = true;
|
||||||
|
|
Loading…
Reference in a new issue