vl: make -accel help to list enabled accelerators only
Currently, -accel help shows all possible accelerators regardless if they are enabled in the binary or not. That is a different semantic from -cpu and -machine helps, for example. So this change makes it to list only the accelerators which support is compiled in the binary target. Note that it does not check if the accelerator is enabled in the host, so the help message's header was rewritten to emphasize that. Also qtest is not displayed given that it is used for internal testing purpose only. Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20190530215755.328-2-wainersm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
aa0d7ed658
commit
cbe6d6365a
18
vl.c
18
vl.c
@ -3576,7 +3576,23 @@ int main(int argc, char **argv, char **envp)
|
|||||||
optarg, true);
|
optarg, true);
|
||||||
optarg = qemu_opt_get(accel_opts, "accel");
|
optarg = qemu_opt_get(accel_opts, "accel");
|
||||||
if (!optarg || is_help_option(optarg)) {
|
if (!optarg || is_help_option(optarg)) {
|
||||||
printf("Possible accelerators: kvm, xen, hax, tcg\n");
|
printf("Accelerators supported in QEMU binary:\n");
|
||||||
|
GSList *el, *accel_list = object_class_get_list(TYPE_ACCEL,
|
||||||
|
false);
|
||||||
|
for (el = accel_list; el; el = el->next) {
|
||||||
|
gchar *typename = g_strdup(object_class_get_name(
|
||||||
|
OBJECT_CLASS(el->data)));
|
||||||
|
/* omit qtest which is used for tests only */
|
||||||
|
if (g_strcmp0(typename, ACCEL_CLASS_NAME("qtest")) &&
|
||||||
|
g_str_has_suffix(typename, ACCEL_CLASS_SUFFIX)) {
|
||||||
|
gchar **optname = g_strsplit(typename,
|
||||||
|
ACCEL_CLASS_SUFFIX, 0);
|
||||||
|
printf("%s\n", optname[0]);
|
||||||
|
g_free(optname);
|
||||||
|
}
|
||||||
|
g_free(typename);
|
||||||
|
}
|
||||||
|
g_slist_free(accel_list);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
opts = qemu_opts_create(qemu_find_opts("machine"), NULL,
|
opts = qemu_opts_create(qemu_find_opts("machine"), NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user