Hi Anton,
On 19/1/24 15:40, Anton Johansson wrote:
Uses target_supports_mttcg() and target_long_bits() to turn ifdefs into
runtime branches.
Signed-off-by: Anton Johansson <a...@rev.ng>
---
accel/tcg/tcg-all.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
static void tcg_accel_instance_init(Object *obj)
@@ -137,17 +129,18 @@ static char *tcg_get_thread(Object *obj, Error **errp)
static void tcg_set_thread(Object *obj, const char *value, Error **errp)
{
TCGState *s = TCG_STATE(obj);
+ const bool oversized_guest = target_long_bits() > TCG_TARGET_REG_BITS;
if (strcmp(value, "multi") == 0) {
- if (TCG_OVERSIZED_GUEST) {
+ if (oversized_guest) {
error_setg(errp, "No MTTCG when guest word size > hosts");
} else if (icount_enabled()) {
error_setg(errp, "No MTTCG when icount is enabled");
} else {
-#ifndef TARGET_SUPPORTS_MTTCG
- warn_report("Guest not yet converted to MTTCG - "
- "you may get unexpected results");
-#endif
+ if (target_supports_mttcg()) {
I started smth similar but then realized this call has to be per target,
so put my work on hold. My plan is to have a single common tcg
accelerator framework, having target-specific code handled by vcpu
dispatchers. Is your plan to have each target link its own tcg?
+ warn_report("Guest not yet converted to MTTCG - "
+ "you may get unexpected results");
+ }
s->mttcg_enabled = true;
}
} else if (strcmp(value, "single") == 0) {