xen: convert "-machine igd-passthru" to an accelerator property

The first machine property to fall is Xen's Intel integrated graphics
passthrough.  The "-machine igd-passthru" option does not set anymore
a property on the machine object, but desugars to a GlobalProperty on
accelerator objects.

The setter is very simple, since the value ends up in a
global variable, so this patch also provides an example before the more
complicated cases that follow it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2019-11-13 10:56:53 +01:00
parent fe17413247
commit 46472d8232
6 changed files with 28 additions and 34 deletions

14
vl.c
View file

@ -1133,13 +1133,6 @@ static void configure_msg(QemuOpts *opts)
}
/* 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 */
@ -2517,6 +2510,10 @@ static int machine_set_property(void *opaque,
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;
}
return object_parse_property_opt(opaque, name, value, "type", errp);
}
@ -4297,9 +4294,6 @@ int main(int argc, char **argv, char **envp)
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"),