On 6/20/25 10:27, Philippe Mathieu-Daudé wrote:
In preparation of other accelerator (or potential emulator),
expose the "hw" and "sw" keys. Only HVF and TCG allowed so far.
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
accel/split/split-all.c | 46 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/accel/split/split-all.c b/accel/split/split-all.c
index 7cbe32ea768..28f626d0ff4 100644
--- a/accel/split/split-all.c
+++ b/accel/split/split-all.c
@@ -8,6 +8,7 @@
#include "qemu/osdep.h"
#include "qemu/accel.h"
+#include "qapi/error.h"
#include "hw/boards.h"
#include "accel/accel-internal.h"
#include "split-accel.h"
@@ -78,6 +79,42 @@ static void split_get_stats(AccelState *as, GString *buf)
g_assert_not_reached();
}
+static char *split_get_hw(Object *obj, Error **errp)
+{
+ SplitAccelState *s = SPLIT_ACCEL(obj);
+
+ return g_strdup(s->hw_name);
+}
+
+static void split_set_hw(Object *obj, const char *value, Error **errp)
+{
+ SplitAccelState *s = SPLIT_ACCEL(obj);
+
+ if (strcmp(value, "hvf") == 0) {
+ s->hw_name = g_strdup(value);
Since you've compared, you could assign the literal and not strdup.
I.e.
if (strcmp(value, "hvf") == 0) {
s->hw_name = "hvf";
+ } else {
+ error_setg(errp, "'%s' accelerator no supported", value);
not
+static char *split_get_sw(Object *obj, Error **errp)
+{
+ SplitAccelState *s = SPLIT_ACCEL(obj);
+
+ return g_strdup(s->sw_name);
+}
+
+static void split_set_sw(Object *obj, const char *value, Error **errp)
+{
+ SplitAccelState *s = SPLIT_ACCEL(obj);
+
+ if (strcmp(value, "tcg") == 0) {
+ s->hw_name = g_strdup(value);
+ } else {
+ error_setg(errp, "'%s' emulator no supported", value);
+ }
+}
Maybe just skip this until such time as there really is a second sw emulator.
r~