[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/87] accel: pass object to accel_init_machine
From: |
Paolo Bonzini |
Subject: |
[PULL 23/87] accel: pass object to accel_init_machine |
Date: |
Wed, 18 Dec 2019 13:01:49 +0100 |
We will have to set QOM properties before accel_init_machine, based on the
options provided to -accel. Construct the object outside it so that it
will be possible to iterate on properties between object_new_with_class
and accel_init_machine.
Reviewed-by: Marc-André Lureau <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
accel/accel.c | 4 ++--
include/sysemu/accel.h | 2 +-
vl.c | 4 +++-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/accel/accel.c b/accel/accel.c
index dd38a46..1c5c3a6 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -46,9 +46,9 @@ AccelClass *accel_find(const char *opt_name)
return ac;
}
-int accel_init_machine(AccelClass *acc, MachineState *ms)
+int accel_init_machine(AccelState *accel, MachineState *ms)
{
- AccelState *accel = ACCEL(object_new_with_class(OBJECT_CLASS(acc)));
+ AccelClass *acc = ACCEL_GET_CLASS(accel);
int ret;
ms->accelerator = accel;
*(acc->allowed) = true;
diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h
index 90b6213..22cac0f 100644
--- a/include/sysemu/accel.h
+++ b/include/sysemu/accel.h
@@ -67,7 +67,7 @@ typedef struct AccelClass {
extern unsigned long tcg_tb_size;
AccelClass *accel_find(const char *opt_name);
-int accel_init_machine(AccelClass *acc, MachineState *ms);
+int accel_init_machine(AccelState *accel, MachineState *ms);
/* Called just before os_setup_post (ie just before drop OS privs) */
void accel_setup_post(MachineState *ms);
diff --git a/vl.c b/vl.c
index 65e6b75..b2f00cc 100644
--- a/vl.c
+++ b/vl.c
@@ -2716,6 +2716,7 @@ static int do_configure_accelerator(void *opaque,
QemuOpts *opts, Error **errp)
bool *p_init_failed = opaque;
const char *acc = qemu_opt_get(opts, "accel");
AccelClass *ac = accel_find(acc);
+ AccelState *accel;
int ret;
if (!ac) {
@@ -2723,7 +2724,8 @@ static int do_configure_accelerator(void *opaque,
QemuOpts *opts, Error **errp)
error_report("invalid accelerator %s", acc);
return 0;
}
- ret = accel_init_machine(ac, current_machine);
+ accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
+ ret = accel_init_machine(accel, current_machine);
if (ret < 0) {
*p_init_failed = true;
error_report("failed to initialize %s: %s",
--
1.8.3.1
- [PULL 07/87] migration-test: Move -name handling to common commandline, (continued)
- [PULL 07/87] migration-test: Move -name handling to common commandline, Paolo Bonzini, 2019/12/18
- [PULL 08/87] migration-test: Move -serial handling to common commandline, Paolo Bonzini, 2019/12/18
- [PULL 09/87] migration-test: Move -incomming handling to common commandline, Paolo Bonzini, 2019/12/18
- [PULL 14/87] tcg: move qemu_tcg_configure to accel/tcg/tcg-all.c, Paolo Bonzini, 2019/12/18
- [PULL 15/87] vl: extract accelerator option processing to a separate function, Paolo Bonzini, 2019/12/18
- [PULL 13/87] vl: move icount configuration earlier, Paolo Bonzini, 2019/12/18
- [PULL 12/87] memory: do not look at current_machine->accel, Paolo Bonzini, 2019/12/18
- [PULL 11/87] migration-test: Use a struct for test_migrate_start parameters, Paolo Bonzini, 2019/12/18
- [PULL 16/87] vl: merge -accel processing into configure_accelerators, Paolo Bonzini, 2019/12/18
- [PULL 22/87] qom: add object_new_with_class, Paolo Bonzini, 2019/12/18
- [PULL 23/87] accel: pass object to accel_init_machine,
Paolo Bonzini <=
- [PULL 25/87] tcg: add "-accel tcg,tb-size" and deprecate "-tb-size", Paolo Bonzini, 2019/12/18
- [PULL 31/87] object: Improve documentation of interfaces, Paolo Bonzini, 2019/12/18
- [PULL 32/87] build-sys: build vhost-user-gpu only if CONFIG_TOOLS, Paolo Bonzini, 2019/12/18
- [PULL 26/87] xen: convert "-machine igd-passthru" to an accelerator property, Paolo Bonzini, 2019/12/18
- [PULL 18/87] vl: introduce object_parse_property_opt, Paolo Bonzini, 2019/12/18
- [PULL 10/87] migration-test: Rename cmd_src/dst to arch_source/arch_target, Paolo Bonzini, 2019/12/18
- [PULL 17/87] accel: compile accel/accel.c just once, Paolo Bonzini, 2019/12/18
- [PULL 19/87] vl: configure accelerators from -accel options, Paolo Bonzini, 2019/12/18
- [PULL 28/87] kvm: introduce kvm_kernel_irqchip_* functions, Paolo Bonzini, 2019/12/18
- [PULL 33/87] build-sys: do not include Windows SLIRP dependencies in $LIBS, Paolo Bonzini, 2019/12/18