@@ -53,7 +53,7 @@ TranslationBlock *tb_link_page(TranslationBlock *tb);
void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb,
uintptr_t host_pc);
-bool tcg_exec_realizefn(CPUState *cpu, Error **errp);
-void tcg_exec_unrealizefn(CPUState *cpu);
+bool tcg_exec_realize_unassigned(CPUState *cpu, Error **errp);
+void tcg_exec_unrealize_unassigned(CPUState *cpu);
#endif
@@ -43,8 +43,8 @@ typedef struct AccelClass {
bool (*has_memory)(MachineState *ms, AddressSpace *as,
hwaddr start_addr, hwaddr size);
#endif
- bool (*cpu_common_realize)(CPUState *cpu, Error **errp);
- void (*cpu_common_unrealize)(CPUState *cpu);
+ bool (*cpu_common_realize_unassigned)(CPUState *cpu, Error **errp);
+ void (*cpu_common_unrealize_unassigned)(CPUState *cpu);
/* gdbstub related hooks */
int (*gdbstub_supported_sstep_flags)(void);
@@ -92,17 +92,22 @@ void accel_setup_post(MachineState *ms);
void accel_cpu_instance_init(CPUState *cpu);
/**
- * accel_cpu_common_realize:
+ * accel_cpu_common_realize_unassigned:
* @cpu: The CPU that needs to call accel-specific cpu realization.
* @errp: currently unused.
+ *
+ * The @cpu index is not yet assigned.
*/
-bool accel_cpu_common_realize(CPUState *cpu, Error **errp);
+bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp);
/**
- * accel_cpu_common_unrealize:
+ * accel_cpu_common_unrealize_unassigned:
* @cpu: The CPU that needs to call accel-specific cpu unrealization.
+ *
+ * The @cpu index is no more assigned, @cpu has been removed from the global
+ * #cpus_queue.
*/
-void accel_cpu_common_unrealize(CPUState *cpu);
+void accel_cpu_common_unrealize_unassigned(CPUState *cpu);
/**
* accel_supported_gdbstub_sstep_flags:
@@ -119,7 +119,7 @@ void accel_cpu_instance_init(CPUState *cpu)
}
}
-bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
+bool accel_cpu_common_realize_unassigned(CPUState *cpu, Error **errp)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
AccelState *accel = current_accel();
@@ -132,21 +132,22 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
}
/* generic realization */
- if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) {
+ if (acc->cpu_common_realize_unassigned
+ && !acc->cpu_common_realize_unassigned(cpu, errp)) {
return false;
}
return true;
}
-void accel_cpu_common_unrealize(CPUState *cpu)
+void accel_cpu_common_unrealize_unassigned(CPUState *cpu)
{
AccelState *accel = current_accel();
AccelClass *acc = ACCEL_GET_CLASS(accel);
/* generic unrealization */
- if (acc->cpu_common_unrealize) {
- acc->cpu_common_unrealize(cpu);
+ if (acc->cpu_common_unrealize_unassigned) {
+ acc->cpu_common_unrealize_unassigned(cpu);
}
}
@@ -1074,7 +1074,7 @@ int cpu_exec(CPUState *cpu)
return ret;
}
-bool tcg_exec_realizefn(CPUState *cpu, Error **errp)
+bool tcg_exec_realize_unassigned(CPUState *cpu, Error **errp)
{
static bool tcg_target_initialized;
@@ -1094,7 +1094,7 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp)
}
/* undo the initializations in reverse order */
-void tcg_exec_unrealizefn(CPUState *cpu)
+void tcg_exec_unrealize_unassigned(CPUState *cpu)
{
#ifndef CONFIG_USER_ONLY
tcg_iommu_free_notifier_list(cpu);
@@ -227,8 +227,8 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data)
AccelClass *ac = ACCEL_CLASS(oc);
ac->name = "tcg";
ac->init_machine = tcg_init_machine;
- ac->cpu_common_realize = tcg_exec_realizefn;
- ac->cpu_common_unrealize = tcg_exec_unrealizefn;
+ ac->cpu_common_realize_unassigned = tcg_exec_realize_unassigned;
+ ac->cpu_common_unrealize_unassigned = tcg_exec_unrealize_unassigned;
ac->allowed = &tcg_allowed;
ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags;
@@ -136,7 +136,7 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp)
/* cache the cpu class for the hotpath */
cpu->cc = CPU_GET_CLASS(cpu);
- if (!accel_cpu_common_realize(cpu, errp)) {
+ if (!accel_cpu_common_realize_unassigned(cpu, errp)) {
return false;
}
@@ -176,7 +176,7 @@ void cpu_exec_unrealizefn(CPUState *cpu)
* Now that the vCPU has been removed from the RCU list, we can call
* accel_cpu_common_unrealize, which may free fields using call_rcu.
*/
- accel_cpu_common_unrealize(cpu);
+ accel_cpu_common_unrealize_unassigned(cpu);
}
/*
In preparation of introducing [un]realize handlers for when vCPUs are assigned, rename current handlers using the '_unassigned' suffix. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- accel/tcg/internal-common.h | 4 ++-- include/qemu/accel.h | 17 +++++++++++------ accel/accel-target.c | 11 ++++++----- accel/tcg/cpu-exec.c | 4 ++-- accel/tcg/tcg-all.c | 4 ++-- cpu-target.c | 4 ++-- 6 files changed, 25 insertions(+), 19 deletions(-)