mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00
accel: Propagate AccelState to AccelClass::init_machine()
In order to avoid init_machine() to call current_accel(), pass AccelState along. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250703173248.44995-31-philmd@linaro.org>
This commit is contained in:
parent
38623a9f63
commit
51e1896199
11 changed files with 11 additions and 11 deletions
|
@ -37,7 +37,7 @@ int accel_init_machine(AccelState *accel, MachineState *ms)
|
||||||
int ret;
|
int ret;
|
||||||
ms->accelerator = accel;
|
ms->accelerator = accel;
|
||||||
*(acc->allowed) = true;
|
*(acc->allowed) = true;
|
||||||
ret = acc->init_machine(ms);
|
ret = acc->init_machine(accel, ms);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ms->accelerator = NULL;
|
ms->accelerator = NULL;
|
||||||
*(acc->allowed) = false;
|
*(acc->allowed) = false;
|
||||||
|
|
|
@ -247,7 +247,7 @@ static MemoryListener hvf_memory_listener = {
|
||||||
.log_sync = hvf_log_sync,
|
.log_sync = hvf_log_sync,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int hvf_accel_init(MachineState *ms)
|
static int hvf_accel_init(AccelState *as, MachineState *ms)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
hv_return_t ret;
|
hv_return_t ret;
|
||||||
|
|
|
@ -2573,7 +2573,7 @@ static int kvm_setup_dirty_ring(KVMState *s)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvm_init(MachineState *ms)
|
static int kvm_init(AccelState *as, MachineState *ms)
|
||||||
{
|
{
|
||||||
MachineClass *mc = MACHINE_GET_CLASS(ms);
|
MachineClass *mc = MACHINE_GET_CLASS(ms);
|
||||||
static const char upgrade_note[] =
|
static const char upgrade_note[] =
|
||||||
|
|
|
@ -38,7 +38,7 @@ static void qtest_set_virtual_clock(int64_t count)
|
||||||
qatomic_set_i64(&qtest_clock_counter, count);
|
qatomic_set_i64(&qtest_clock_counter, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qtest_init_accel(MachineState *ms)
|
static int qtest_init_accel(AccelState *as, MachineState *ms)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ static void tcg_accel_instance_init(Object *obj)
|
||||||
|
|
||||||
bool one_insn_per_tb;
|
bool one_insn_per_tb;
|
||||||
|
|
||||||
static int tcg_init_machine(MachineState *ms)
|
static int tcg_init_machine(AccelState *as, MachineState *ms)
|
||||||
{
|
{
|
||||||
TCGState *s = TCG_STATE(current_accel());
|
TCGState *s = TCG_STATE(current_accel());
|
||||||
unsigned max_threads = 1;
|
unsigned max_threads = 1;
|
||||||
|
|
|
@ -77,7 +77,7 @@ static void xen_setup_post(MachineState *ms, AccelState *accel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xen_init(MachineState *ms)
|
static int xen_init(AccelState *as, MachineState *ms)
|
||||||
{
|
{
|
||||||
MachineClass *mc = MACHINE_GET_CLASS(ms);
|
MachineClass *mc = MACHINE_GET_CLASS(ms);
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,7 @@ int main(int argc, char **argv)
|
||||||
opt_one_insn_per_tb, &error_abort);
|
opt_one_insn_per_tb, &error_abort);
|
||||||
object_property_set_int(OBJECT(accel), "tb-size",
|
object_property_set_int(OBJECT(accel), "tb-size",
|
||||||
opt_tb_size, &error_abort);
|
opt_tb_size, &error_abort);
|
||||||
ac->init_machine(NULL);
|
ac->init_machine(accel, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -40,7 +40,7 @@ typedef struct AccelClass {
|
||||||
/* Cached by accel_init_ops_interfaces() when created */
|
/* Cached by accel_init_ops_interfaces() when created */
|
||||||
AccelOpsClass *ops;
|
AccelOpsClass *ops;
|
||||||
|
|
||||||
int (*init_machine)(MachineState *ms);
|
int (*init_machine)(AccelState *as, MachineState *ms);
|
||||||
bool (*cpu_common_realize)(CPUState *cpu, Error **errp);
|
bool (*cpu_common_realize)(CPUState *cpu, Error **errp);
|
||||||
void (*cpu_common_unrealize)(CPUState *cpu);
|
void (*cpu_common_unrealize)(CPUState *cpu);
|
||||||
|
|
||||||
|
|
|
@ -820,7 +820,7 @@ int main(int argc, char **argv, char **envp)
|
||||||
opt_one_insn_per_tb, &error_abort);
|
opt_one_insn_per_tb, &error_abort);
|
||||||
object_property_set_int(OBJECT(accel), "tb-size",
|
object_property_set_int(OBJECT(accel), "tb-size",
|
||||||
opt_tb_size, &error_abort);
|
opt_tb_size, &error_abort);
|
||||||
ac->init_machine(NULL);
|
ac->init_machine(accel, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1152,7 +1152,7 @@ static struct RAMBlockNotifier nvmm_ram_notifier = {
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvmm_accel_init(MachineState *ms)
|
nvmm_accel_init(AccelState *as, MachineState *ms)
|
||||||
{
|
{
|
||||||
int ret, err;
|
int ret, err;
|
||||||
|
|
||||||
|
|
|
@ -2504,7 +2504,7 @@ static void whpx_set_kernel_irqchip(Object *obj, Visitor *v,
|
||||||
* Partition support
|
* Partition support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int whpx_accel_init(MachineState *ms)
|
static int whpx_accel_init(AccelState *as, MachineState *ms)
|
||||||
{
|
{
|
||||||
struct whpx_state *whpx;
|
struct whpx_state *whpx;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue