Skip to content

Commit

Permalink
target/riscv/kvm: improve 'init_multiext_cfg' error msg
Browse files Browse the repository at this point in the history
Our error message is returning the value of 'ret', which will be always
-1 in case of error, and will not be that useful:

qemu-system-riscv64: Unable to read ISA_EXT KVM register ssaia, error -1

Improve the error message by outputting 'errno' instead of 'ret'. Use
strerrorname_np() to output the error name instead of the error code.
This will give us what we need to know right away:

qemu-system-riscv64: Unable to read ISA_EXT KVM register ssaia, error code: ENOENT

Given that we're going to exit(1) in this condition instead of
attempting to recover, remove the 'kvm_riscv_destroy_scratch_vcpu()'
call.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20231003132148.797921-2-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 082e9e4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
danielhb authored and Michael Tokarev committed Nov 19, 2023
1 parent 100feda commit 221c0e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions target/riscv/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ static void kvm_riscv_init_multiext_cfg(RISCVCPU *cpu, KVMScratchCPU *kvmcpu)
val = false;
} else {
error_report("Unable to read ISA_EXT KVM register %s, "
"error %d", multi_ext_cfg->name, ret);
kvm_riscv_destroy_scratch_vcpu(kvmcpu);
"error code: %s", multi_ext_cfg->name,
strerrorname_np(errno));
exit(EXIT_FAILURE);
}
} else {
Expand Down

0 comments on commit 221c0e1

Please sign in to comment.