mirror of
https://github.com/qemu/qemu.git
synced 2024-11-27 22:03:35 +08:00
accel: Introduce current_accel_name()
We need to fetch the name of the current accelerator in flexible error messages more going forward. Let's create a helper that gives it to us without casting in the target code. Signed-off-by: Alexander Graf <agraf@csgraf.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220620192242.70573-1-agraf@csgraf.de Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
ba1a6723f5
commit
55bd445c41
@ -49,6 +49,14 @@ AccelClass *accel_find(const char *opt_name)
|
||||
return ac;
|
||||
}
|
||||
|
||||
/* Return the name of the current accelerator */
|
||||
const char *current_accel_name(void)
|
||||
{
|
||||
AccelClass *ac = ACCEL_GET_CLASS(current_accel());
|
||||
|
||||
return ac->name;
|
||||
}
|
||||
|
||||
static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque)
|
||||
{
|
||||
CPUClass *cc = CPU_CLASS(klass);
|
||||
|
@ -68,6 +68,7 @@ typedef struct AccelClass {
|
||||
|
||||
AccelClass *accel_find(const char *opt_name);
|
||||
AccelState *current_accel(void);
|
||||
const char *current_accel_name(void);
|
||||
|
||||
void accel_init_interfaces(AccelClass *ac);
|
||||
|
||||
|
@ -2271,8 +2271,7 @@ static void configure_accelerators(const char *progname)
|
||||
}
|
||||
|
||||
if (init_failed && !qtest_chrdev) {
|
||||
AccelClass *ac = ACCEL_GET_CLASS(current_accel());
|
||||
error_report("falling back to %s", ac->name);
|
||||
error_report("falling back to %s", current_accel_name());
|
||||
}
|
||||
|
||||
if (icount_enabled() && !tcg_enabled()) {
|
||||
|
Loading…
Reference in New Issue
Block a user