]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qemu: Introduce target_cpu_type()
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 17 Apr 2025 15:59:35 +0000 (17:59 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 25 Apr 2025 15:09:58 +0000 (17:09 +0200)
Introduce the target_cpu_type() helper to access the
CPU_RESOLVING_TYPE target-specific definition from
target-agnostic code.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250417165430.58213-2-philmd@linaro.org>

MAINTAINERS
include/qemu/target-info.h [new file with mode: 0644]
meson.build
target-info-stub.c [new file with mode: 0644]

index d82d962f1a43c4b4a21c1a9c02b8b0caca79fc8c..28b1e9ba443b976e01db43773dce35a2b1fc4a6f 100644 (file)
@@ -496,6 +496,7 @@ F: include/exec/cpu*.h
 F: include/exec/exec-all.h
 F: include/exec/target_long.h
 F: include/qemu/accel.h
+F: include/qemu/target-info*.h
 F: include/system/accel-*.h
 F: include/system/cpus.h
 F: include/accel/accel-cpu-target.h
@@ -504,6 +505,7 @@ F: accel/Makefile.objs
 F: accel/stubs/Makefile.objs
 F: cpu-common.c
 F: cpu-target.c
+F: target-info*.c
 F: system/cpus.c
 
 Apple Silicon HVF CPUs
diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
new file mode 100644 (file)
index 0000000..b4cc488
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * QEMU target info API
+ *
+ *  Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef QEMU_TARGET_INFO_H
+#define QEMU_TARGET_INFO_H
+
+/**
+ * target_cpu_type:
+ *
+ * Returns: target CPU base QOM type name (i.e. TYPE_X86_CPU).
+ */
+const char *target_cpu_type(void);
+
+#endif
index c736a6f4c4b8dbf9b7cefd5db65cc750ae179324..185c2fb0d1bda8d096b644fe586209f38bf81592 100644 (file)
@@ -3795,6 +3795,8 @@ endif
 common_ss.add(pagevary)
 specific_ss.add(files('page-target.c', 'page-vary-target.c'))
 
+specific_ss.add(files('target-info-stub.c'))
+
 subdir('backends')
 subdir('disas')
 subdir('migration')
diff --git a/target-info-stub.c b/target-info-stub.c
new file mode 100644 (file)
index 0000000..e5d2195
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * QEMU target info stubs (target specific)
+ *
+ *  Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/target-info.h"
+#include "cpu.h"
+
+const char *target_cpu_type(void)
+{
+    return CPU_RESOLVING_TYPE;
+}