.implied_opt_name = "accel",
.head = QTAILQ_HEAD_INITIALIZER(qemu_accel_opts.head),
.desc = {
- {
- .name = "accel",
- .type = QEMU_OPT_STRING,
- .help = "Select the type of accelerator",
- },
- {
- .name = "thread",
- .type = QEMU_OPT_STRING,
- .help = "Enable/disable multi-threaded TCG",
- },
- { /* end of list */ }
+ /*
+ * no elements => accept any
+ * sanity checking will happen later
+ * when setting accelerator properties
+ */
+ { }
},
};
value = qemu_opt_get(opts, "driftfix");
if (value) {
if (!strcmp(value, "slew")) {
- static GlobalProperty slew_lost_ticks = {
- .driver = "mc146818rtc",
- .property = "lost_tick_policy",
- .value = "slew",
- };
-
- qdev_prop_register_global(&slew_lost_ticks);
+ object_register_sugar_prop("mc146818rtc",
+ "lost_tick_policy",
+ "slew");
} else if (!strcmp(value, "none")) {
/* discard is default */
} else {
static void configure_msg(QemuOpts *opts)
{
- enable_timestamp_msg = qemu_opt_get_bool(opts, "timestamp", true);
+ error_with_timestamp = qemu_opt_get_bool(opts, "timestamp", false);
}
-/* Now we still need this for compatibility with XEN. */
-bool has_igd_gfx_passthru;
-static void igd_gfx_passthru(void)
-{
- has_igd_gfx_passthru = current_machine->igd_gfx_passthru;
-}
-
/***********************************************************/
/* USB devices */
if (g_str_equal(qom_name, "accel")) {
return 0;
}
+ if (g_str_equal(qom_name, "igd-passthru")) {
+ object_register_sugar_prop(ACCEL_CLASS_NAME("xen"), qom_name, value);
+ return 0;
+ }
+ if (g_str_equal(qom_name, "kvm-shadow-mem") ||
+ g_str_equal(qom_name, "kernel-irqchip")) {
+ object_register_sugar_prop(ACCEL_CLASS_NAME("kvm"), qom_name, value);
+ return 0;
+ }
return object_parse_property_opt(opaque, name, value, "type", errp);
}
return 0;
}
+static int accelerator_set_property(void *opaque,
+ const char *name, const char *value,
+ Error **errp)
+{
+ return object_parse_property_opt(opaque, name, value, "accel", errp);
+}
+
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) {
+ *p_init_failed = true;
+ error_report("invalid accelerator %s", acc);
return 0;
}
- ret = accel_init_machine(ac, current_machine);
+ accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
+ object_apply_compat_props(OBJECT(accel));
+ qemu_opt_foreach(opts, accelerator_set_property,
+ accel,
+ &error_fatal);
+
+ ret = accel_init_machine(accel, current_machine);
if (ret < 0) {
*p_init_failed = true;
error_report("failed to initialize %s: %s",
return 0;
}
- if (tcg_enabled()) {
- qemu_tcg_configure(opts, &error_fatal);
- }
return 1;
}
*/
if (accel_find(*tmp)) {
qemu_opts_parse_noisily(qemu_find_opts("accel"), *tmp, true);
+ } else {
+ init_failed = true;
+ error_report("invalid accelerator %s", *tmp);
}
}
} else {
if (init_failed) {
AccelClass *ac = ACCEL_GET_CLASS(current_machine->accelerator);
- error_report("Back to %s accelerator", ac->name);
+ error_report("falling back to %s", ac->name);
}
if (use_icount && !(tcg_enabled() || qtest_enabled())) {
error_report("TCG is disabled");
exit(1);
#endif
- if (qemu_strtoul(optarg, NULL, 0, &tcg_tb_size) < 0) {
- error_report("Invalid argument to -tb-size");
- exit(1);
- }
+ warn_report("The -tb-size option is deprecated, use -accel tcg,tb-size instead");
+ object_register_sugar_prop(ACCEL_CLASS_NAME("tcg"), "tb-size", optarg);
break;
case QEMU_OPTION_icount:
icount_opts = qemu_opts_parse_noisily(qemu_find_opts("icount"),
cleanup_add_fd, NULL, &error_fatal);
#endif
- current_machine = MACHINE(object_new(object_class_get_name(
- OBJECT_CLASS(machine_class))));
+ current_machine = MACHINE(object_new_with_class(OBJECT_CLASS(machine_class)));
if (machine_help_func(qemu_get_machine_opts(), current_machine)) {
exit(0);
}
exit(1);
}
- /* Check if IGD GFX passthrough. */
- igd_gfx_passthru();
-
/* init generic devices */
rom_set_order_override(FW_CFG_ORDER_OVERRIDE_DEVICE);
qemu_opts_foreach(qemu_find_opts("device"),