It allows accel->synchronize_post_init() hook to return an error upwards. Add a new cpu_synchronize_post_init_full() for it, then let the existing cpu_synchronize_post_init() to call it with errp==NULL.
Signed-off-by: Peter Xu <pet...@redhat.com> --- accel/hvf/hvf-accel-ops.c | 2 +- accel/kvm/kvm-all.c | 2 +- include/sysemu/accel-ops.h | 2 +- include/sysemu/hw_accel.h | 1 + softmmu/cpus.c | 10 ++++++++-- stubs/cpu-synchronize-state.c | 3 +++ target/i386/hax/hax-all.c | 2 +- target/i386/nvmm/nvmm-all.c | 2 +- target/i386/whpx/whpx-all.c | 2 +- 9 files changed, 18 insertions(+), 8 deletions(-) diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index 24913ca9c4..dec4446264 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -228,7 +228,7 @@ static void hvf_cpu_synchronize_post_reset(CPUState *cpu) run_on_cpu(cpu, do_hvf_cpu_synchronize_set_dirty, RUN_ON_CPU_NULL); } -static void hvf_cpu_synchronize_post_init(CPUState *cpu) +static void hvf_cpu_synchronize_post_init(CPUState *cpu, Error **errp) { run_on_cpu(cpu, do_hvf_cpu_synchronize_set_dirty, RUN_ON_CPU_NULL); } diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index ba3210b1c1..df4f7c98f3 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2777,7 +2777,7 @@ static void do_kvm_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg) cpu->vcpu_dirty = false; } -void kvm_cpu_synchronize_post_init(CPUState *cpu) +void kvm_cpu_synchronize_post_init(CPUState *cpu, Error **errp) { run_on_cpu(cpu, do_kvm_cpu_synchronize_post_init, RUN_ON_CPU_NULL); } diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h index a0572ea87a..7e526d3c65 100644 --- a/include/sysemu/accel-ops.h +++ b/include/sysemu/accel-ops.h @@ -35,7 +35,7 @@ struct AccelOpsClass { bool (*cpu_thread_is_idle)(CPUState *cpu); void (*synchronize_post_reset)(CPUState *cpu); - void (*synchronize_post_init)(CPUState *cpu); + void (*synchronize_post_init)(CPUState *cpu, Error **errp); void (*synchronize_state)(CPUState *cpu); void (*synchronize_pre_loadvm)(CPUState *cpu); void (*synchronize_pre_resume)(bool step_pending); diff --git a/include/sysemu/hw_accel.h b/include/sysemu/hw_accel.h index 22903a55f7..3ee3508411 100644 --- a/include/sysemu/hw_accel.h +++ b/include/sysemu/hw_accel.h @@ -21,6 +21,7 @@ void cpu_synchronize_state(CPUState *cpu); void cpu_synchronize_post_reset(CPUState *cpu); void cpu_synchronize_post_init(CPUState *cpu); +void cpu_synchronize_post_init_full(CPUState *cpu, Error **errp); void cpu_synchronize_pre_loadvm(CPUState *cpu); #endif /* QEMU_HW_ACCEL_H */ diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 898363a1d0..464c06201c 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -178,13 +178,19 @@ void cpu_synchronize_post_reset(CPUState *cpu) } } -void cpu_synchronize_post_init(CPUState *cpu) +void cpu_synchronize_post_init_full(CPUState *cpu, Error **errp) { if (cpus_accel->synchronize_post_init) { - cpus_accel->synchronize_post_init(cpu); + cpus_accel->synchronize_post_init(cpu, errp); } } +void cpu_synchronize_post_init(CPUState *cpu) +{ + /* errp=NULL means we won't capture any error */ + cpu_synchronize_post_init_full(cpu, NULL); +} + void cpu_synchronize_pre_loadvm(CPUState *cpu) { if (cpus_accel->synchronize_pre_loadvm) { diff --git a/stubs/cpu-synchronize-state.c b/stubs/cpu-synchronize-state.c index d9211da66c..6d2c9f509a 100644 --- a/stubs/cpu-synchronize-state.c +++ b/stubs/cpu-synchronize-state.c @@ -7,3 +7,6 @@ void cpu_synchronize_state(CPUState *cpu) void cpu_synchronize_post_init(CPUState *cpu) { } +void cpu_synchronize_post_init_full(CPUState *cpu, Error **errp) +{ +} diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c index b185ee8de4..782d83b531 100644 --- a/target/i386/hax/hax-all.c +++ b/target/i386/hax/hax-all.c @@ -651,7 +651,7 @@ static void do_hax_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg) cpu->vcpu_dirty = false; } -void hax_cpu_synchronize_post_init(CPUState *cpu) +void hax_cpu_synchronize_post_init(CPUState *cpu, Error **errp) { run_on_cpu(cpu, do_hax_cpu_synchronize_post_init, RUN_ON_CPU_NULL); } diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index b75738ee9c..f429e940af 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -869,7 +869,7 @@ void nvmm_cpu_synchronize_post_reset(CPUState *cpu) run_on_cpu(cpu, do_nvmm_cpu_synchronize_post_reset, RUN_ON_CPU_NULL); } -void nvmm_cpu_synchronize_post_init(CPUState *cpu) +void nvmm_cpu_synchronize_post_init(CPUState *cpu, Error **errp) { run_on_cpu(cpu, do_nvmm_cpu_synchronize_post_init, RUN_ON_CPU_NULL); } diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index b22a3314b4..09bf5681ce 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2123,7 +2123,7 @@ void whpx_cpu_synchronize_post_reset(CPUState *cpu) run_on_cpu(cpu, do_whpx_cpu_synchronize_post_reset, RUN_ON_CPU_NULL); } -void whpx_cpu_synchronize_post_init(CPUState *cpu) +void whpx_cpu_synchronize_post_init(CPUState *cpu, Error **errp) { run_on_cpu(cpu, do_whpx_cpu_synchronize_post_init, RUN_ON_CPU_NULL); } -- 2.32.0