[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH] vl: only display available accelerators
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [RFC PATCH] vl: only display available accelerators |
Date: |
Mon, 30 Oct 2017 09:20:29 +0100 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Mon, Oct 30, 2017 at 01:00:56AM -0300, Philippe Mathieu-Daudé wrote:
> examples configuring with '--enable-kvm --disable-tcg'
>
> - before
>
> $ qemu-system-x86_64 -accel help
> Possible accelerators: kvm, xen, hax, tcg
>
> $ qemu-system-x86_64 -accel tcg
> qemu-system-x86_64: -machine accel=tcg: No accelerator found
>
> # qemu-system-x86_64 -accel hax
> qemu-system-x86_64: -machine accel=hax: No accelerator found
>
> # qemu-system-x86_64 -accel xen
> xencall: error: Could not obtain handle on privileged command interface: No
> such file or directory
> xen be core: xen be core: can't open xen interface
> can't open xen interface
> qemu-system-x86_64: failed to initialize Xen: Operation not permitted
>
> - after
>
> $ qemu-system-x86_64 -accel help
> Possible accelerators: kvm
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> RFC because:
> - I don't think this is the nicest way, too much #ifdef'fery in main()
I suggest using object_class_get_list(TYPE_ACCEL, false).
> - I'm not sure the correct use of CONFIG_KVM_IS_POSSIBLE
> - shouldn't CONFIG_XEN/CONFIG_HAX be as poisoned as CONFIG_KVM?
>
> vl.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/vl.c b/vl.c
> index ec299099ff..13fce86a6e 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3883,7 +3883,20 @@ int main(int argc, char **argv, char **envp)
> optarg, true);
> optarg = qemu_opt_get(accel_opts, "accel");
> if (!optarg || is_help_option(optarg)) {
> - error_printf("Possible accelerators: kvm, xen, hax,
> tcg\n");
> + error_printf("Possible accelerators: ");
> +#ifdef CONFIG_KVM_IS_POSSIBLE
> + error_printf("kvm ");
> +#endif
> +#ifdef CONFIG_XEN
> + error_printf("xen ");
> +#endif
> +#ifdef CONFIG_HAX
> + error_printf("hax ");
> +#endif
> +#ifdef CONFIG_TCG
> + error_printf("tcg ");
> +#endif
> + error_printf("\n");
> exit(0);
> }
> opts = qemu_opts_create(qemu_find_opts("machine"), NULL,
> --
> 2.15.0.rc2
>
--
Eduardo