diff options
author | Alexander Graf <agraf@csgraf.de> | 2022-06-24 15:42:56 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2022-06-27 11:18:17 +0100 |
commit | 55bd445c4195966675236936c0a8642f1965dddb (patch) | |
tree | 60f42772a34decbea78de9cb46dd0913a7a87510 /accel | |
parent | ba1a6723f58640ba281bc952abc255e97c70bad5 (diff) |
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>
Diffstat (limited to 'accel')
-rw-r--r-- | accel/accel-common.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/accel/accel-common.c b/accel/accel-common.c index 7b8ec7e0f7..50035bda55 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -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); |