[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 11/11] softmmu/vl: Exit gracefully when accelerator is not
From: |
Cornelia Huck |
Subject: |
Re: [PATCH v2 11/11] softmmu/vl: Exit gracefully when accelerator is not supported |
Date: |
Mon, 22 Feb 2021 18:46:20 +0100 |
On Fri, 19 Feb 2021 18:38:47 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> Before configuring an accelerator, check it is valid for
> the current machine. Doing so we can return a simple error
> message instead of criptic one.
s/criptic/cryptic/
>
> Before:
>
> $ qemu-system-arm -M raspi2b -enable-kvm
> qemu-system-arm: /build/qemu-ETIdrs/qemu-4.2/exec.c:865:
> cpu_address_space_init: Assertion `asidx == 0 || !kvm_enabled()' failed.
> Aborted
>
> $ qemu-system-aarch64 -M xlnx-zcu102 -enable-kvm -smp 6
> qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid
> argument
>
> After:
>
> $ qemu-system-arm -M raspi2b -enable-kvm
> qemu-system-aarch64: invalid accelerator 'kvm' for machine raspi2b
>
> $ qemu-system-aarch64 -M xlnx-zcu102 -enable-kvm -smp 6
> qemu-system-aarch64: -accel kvm: invalid accelerator 'kvm' for machine
> xlnx-zcu102
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> softmmu/vl.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index b219ce1f357..f2c4074310b 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -2133,6 +2133,7 @@ static int do_configure_accelerator(void *opaque,
> QemuOpts *opts, Error **errp)
> const char *acc = qemu_opt_get(opts, "accel");
> AccelClass *ac = accel_find(acc);
> AccelState *accel;
> + MachineClass *mc;
> int ret;
> bool qtest_with_kvm;
>
> @@ -2145,6 +2146,12 @@ static int do_configure_accelerator(void *opaque,
> QemuOpts *opts, Error **errp)
> }
> return 0;
> }
> + mc = MACHINE_GET_CLASS(current_machine);
> + if (!qtest_chrdev && !machine_class_valid_for_accelerator(mc, ac->name))
> {
Shouldn't qtest be already allowed in any case in the checking function?
> + *p_init_failed = true;
> + error_report("invalid accelerator '%s' for machine %s", acc,
> mc->name);
> + return 0;
> + }
> accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
> object_apply_compat_props(OBJECT(accel));
> qemu_opt_foreach(opts, accelerator_set_property,
- [RFC PATCH v2 08/11] hw/i386: Explicit x86 machines support all current accelerators, (continued)
- [RFC PATCH v2 08/11] hw/i386: Explicit x86 machines support all current accelerators, Philippe Mathieu-Daudé, 2021/02/19
- [PATCH v2 04/11] hw/arm: Restrit KVM to the virt & versal machines, Philippe Mathieu-Daudé, 2021/02/19
- [RFC PATCH v2 06/11] hw/ppc: Restrict KVM to various PPC machines, Philippe Mathieu-Daudé, 2021/02/19
- [PATCH v2 09/11] hw/xenpv: Restrict Xen Para-virtualized machine to Xen accelerator, Philippe Mathieu-Daudé, 2021/02/19
- [PATCH v2 10/11] hw/board: Only allow TCG accelerator by default, Philippe Mathieu-Daudé, 2021/02/19
- [PATCH v2 11/11] softmmu/vl: Exit gracefully when accelerator is not supported, Philippe Mathieu-Daudé, 2021/02/19
- Re: [PATCH v2 11/11] softmmu/vl: Exit gracefully when accelerator is not supported,
Cornelia Huck <=