summaryrefslogtreecommitdiffstats
path: root/accel/accel-user.c
diff options
context:
space:
mode:
authorClaudio Fontana2021-02-04 17:39:24 +0100
committerRichard Henderson2021-02-05 21:24:15 +0100
commit940e43aa30e0f793bd18b79221296cdf17724018 (patch)
tree9ab6484293ad85368f66aaf72ee944493cf3913c /accel/accel-user.c
parentcpu: tcg_ops: move to tcg-cpu-ops.h, keep a pointer in CPUClass (diff)
downloadqemu-940e43aa30e0f793bd18b79221296cdf17724018.tar.gz
qemu-940e43aa30e0f793bd18b79221296cdf17724018.tar.xz
qemu-940e43aa30e0f793bd18b79221296cdf17724018.zip
accel: extend AccelState and AccelClass to user-mode
Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> [claudio: rebased on Richard's splitwx work] Signed-off-by: Claudio Fontana <cfontana@suse.de> Message-Id: <20210204163931.7358-17-cfontana@suse.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'accel/accel-user.c')
-rw-r--r--accel/accel-user.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/accel/accel-user.c b/accel/accel-user.c
new file mode 100644
index 0000000000..22b6a1a1a8
--- /dev/null
+++ b/accel/accel-user.c
@@ -0,0 +1,24 @@
+/*
+ * QEMU accel class, user-mode components
+ *
+ * Copyright 2021 SUSE LLC
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/accel.h"
+
+AccelState *current_accel(void)
+{
+ static AccelState *accel;
+
+ if (!accel) {
+ AccelClass *ac = accel_find("tcg");
+
+ g_assert(ac != NULL);
+ accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
+ }
+ return accel;
+}