]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
accel: Introduce current_accel_name()
authorAlexander Graf <agraf@csgraf.de>
Fri, 24 Jun 2022 14:42:56 +0000 (15:42 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 27 Jun 2022 10:18:17 +0000 (11:18 +0100)
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>
accel/accel-common.c
include/qemu/accel.h
softmmu/vl.c

index 7b8ec7e0f72adf2c8aea8ead84de7dcee72dd213..50035bda55d0f85d0dcde52fbfc673b4656a87ad 100644 (file)
@@ -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);
index 4f4c283f6fc43a4457d7063ee5cb8a563bced8bf..be56da1b999d1a28902ab22c7cb72e021b879711 100644 (file)
@@ -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);
 
index 54e920ada1a168bc69d3c93c03a7e016505220a4..3dca5936c764da465f4ba468cf3882368bd421e0 100644 (file)
@@ -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()) {