Re: [PATCH v2 07/14] accel/stubs: Expand stubs for TCG
On 2/3/25 09:38, Thomas Huth wrote: On 03/02/2025 17.43, Richard Henderson wrote: On 2/3/25 02:22, Thomas Huth wrote: On 03/02/2025 04.18, Richard Henderson wrote: Add tcg_allowed, qmp_x_query_jit, qmp_x_query_opcount. These are referenced when CONFIG_TCG is enabled globally, but not for a specific target. Signed-off-by: Richard Henderson --- accel/stubs/tcg-stub.c | 24 1 file changed, 24 insertions(+) diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c index 7f4208fddf..9c2e2dc6e1 100644 --- a/accel/stubs/tcg-stub.c +++ b/accel/stubs/tcg-stub.c @@ -13,6 +13,18 @@ #include "qemu/osdep.h" #include "exec/tb-flush.h" #include "exec/exec-all.h" +#include "qapi/error.h" + +/* + * This file *ought* to be built once and linked only when required. + * However, it is built per-target, which means qemu/osdep.h has already + * undef'ed CONFIG_TCG, which hides the auto-generated declaration. So why don't we only build this file once? I think we'd have to create a static library for it. It didn't seem worth the effort at the time. I can re-investigate if you like. I think something like this might work: I think we need some of Philippe's include/exec/ cleanup work first. We currently use exec/exec-all.h, which requires cpu.h, which requires building per-target. r~
Re: [PATCH v2 07/14] accel/stubs: Expand stubs for TCG
On 03/02/2025 17.43, Richard Henderson wrote:
On 2/3/25 02:22, Thomas Huth wrote:
On 03/02/2025 04.18, Richard Henderson wrote:
Add tcg_allowed, qmp_x_query_jit, qmp_x_query_opcount.
These are referenced when CONFIG_TCG is enabled globally,
but not for a specific target.
Signed-off-by: Richard Henderson
---
accel/stubs/tcg-stub.c | 24
1 file changed, 24 insertions(+)
diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c
index 7f4208fddf..9c2e2dc6e1 100644
--- a/accel/stubs/tcg-stub.c
+++ b/accel/stubs/tcg-stub.c
@@ -13,6 +13,18 @@
#include "qemu/osdep.h"
#include "exec/tb-flush.h"
#include "exec/exec-all.h"
+#include "qapi/error.h"
+
+/*
+ * This file *ought* to be built once and linked only when required.
+ * However, it is built per-target, which means qemu/osdep.h has already
+ * undef'ed CONFIG_TCG, which hides the auto-generated declaration.
So why don't we only build this file once?
I think we'd have to create a static library for it.
It didn't seem worth the effort at the time.
I can re-investigate if you like.
I think something like this might work:
diff --git a/accel/stubs/meson.build b/accel/stubs/meson.build
--- a/accel/stubs/meson.build
+++ b/accel/stubs/meson.build
@@ -1,6 +1,9 @@
system_stubs_ss = ss.source_set()
-system_stubs_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
-system_stubs_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
system_stubs_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
+system_ss.add_all(when: ['CONFIG_SYSTEM_ONLY'], if_true: system_stubs_ss)
+
+specific_stubs_ss = ss.source_set()
+specific_stubs_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
+specific_stubs_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
+specific_ss.add_all(when: ['CONFIG_SYSTEM_ONLY'], if_true: specific_stubs_ss)
-specific_ss.add_all(when: ['CONFIG_SYSTEM_ONLY'], if_true: system_stubs_ss)
?
Thomas
Re: [PATCH v2 07/14] accel/stubs: Expand stubs for TCG
On 2/3/25 02:22, Thomas Huth wrote: On 03/02/2025 04.18, Richard Henderson wrote: Add tcg_allowed, qmp_x_query_jit, qmp_x_query_opcount. These are referenced when CONFIG_TCG is enabled globally, but not for a specific target. Signed-off-by: Richard Henderson --- accel/stubs/tcg-stub.c | 24 1 file changed, 24 insertions(+) diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c index 7f4208fddf..9c2e2dc6e1 100644 --- a/accel/stubs/tcg-stub.c +++ b/accel/stubs/tcg-stub.c @@ -13,6 +13,18 @@ #include "qemu/osdep.h" #include "exec/tb-flush.h" #include "exec/exec-all.h" +#include "qapi/error.h" + +/* + * This file *ought* to be built once and linked only when required. + * However, it is built per-target, which means qemu/osdep.h has already + * undef'ed CONFIG_TCG, which hides the auto-generated declaration. So why don't we only build this file once? I think we'd have to create a static library for it. It didn't seem worth the effort at the time. I can re-investigate if you like. r~
Re: [PATCH v2 07/14] accel/stubs: Expand stubs for TCG
On 03/02/2025 04.18, Richard Henderson wrote:
Add tcg_allowed, qmp_x_query_jit, qmp_x_query_opcount.
These are referenced when CONFIG_TCG is enabled globally,
but not for a specific target.
Signed-off-by: Richard Henderson
---
accel/stubs/tcg-stub.c | 24
1 file changed, 24 insertions(+)
diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c
index 7f4208fddf..9c2e2dc6e1 100644
--- a/accel/stubs/tcg-stub.c
+++ b/accel/stubs/tcg-stub.c
@@ -13,6 +13,18 @@
#include "qemu/osdep.h"
#include "exec/tb-flush.h"
#include "exec/exec-all.h"
+#include "qapi/error.h"
+
+/*
+ * This file *ought* to be built once and linked only when required.
+ * However, it is built per-target, which means qemu/osdep.h has already
+ * undef'ed CONFIG_TCG, which hides the auto-generated declaration.
So why don't we only build this file once?
Thomas
+ */
+#define CONFIG_TCG
+#include "qapi/qapi-commands-machine.h"
+
+
+const bool tcg_allowed = false;
void tb_flush(CPUState *cpu)
{
@@ -27,3 +39,15 @@ G_NORETURN void cpu_loop_exit_restore(CPUState *cpu,
uintptr_t pc)
{
g_assert_not_reached();
}
+
+HumanReadableText *qmp_x_query_jit(Error **errp)
+{
+error_setg(errp, "JIT information is only available with accel=tcg");
+return NULL;
+}
+
+HumanReadableText *qmp_x_query_opcount(Error **errp)
+{
+error_setg(errp, "Opcode count information is only available with
accel=tcg");
+return NULL;
+}
