Use CONFIG_TCG as a project-wide flag to indicate that TCG is enabled
for *some* target.  Use CONFIG_TCG_TARGET to indicate that TCG is
enabled for a specific target.

Within a specific compilation unit, we can remap CONFIG_TCG based on
CONFIG_TCG_TARGET.  This allows us to avoid changes to the bulk of
the code base.

Within meson.build, while CONFIG_TCG may be set in config_host_data,
it may not be set within config_target.  Thus all references to
CONFIG_TCG in source_set 'when:' need not be updated.

For the moment, CONFIG_TCG and CONFIG_TCG_TARGET are identical.

Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
 include/qemu/osdep.h |  7 +++++++
 meson.build          | 11 +++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 112ebdff21..1f6f73a148 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -34,9 +34,16 @@
 #include "config-host.h"
 #ifdef COMPILING_PER_TARGET
 #include CONFIG_TARGET
+# ifdef CONFIG_TCG_TARGET
+#  undef CONFIG_TCG_TARGET
+# else
+#  undef CONFIG_TCG
+# endif
 #else
 #include "exec/poison.h"
 #endif
+#pragma GCC poison CONFIG_TCG_TARGET
+
 
 /*
  * HOST_WORDS_BIGENDIAN was replaced with HOST_BIG_ENDIAN. Prevent it from
diff --git a/meson.build b/meson.build
index b72114819b..5ca3cc3f34 100644
--- a/meson.build
+++ b/meson.build
@@ -3270,11 +3270,14 @@ foreach target : target_dirs
 
   target_kconfig = []
   foreach sym: accelerators
-    if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
-      config_target += { sym: 'y' }
-      config_all_accel += { sym: 'y' }
-      target_kconfig += [ sym + '=y' ]
+    if sym == 'CONFIG_TCG'
+      config_target += { 'CONFIG_TCG_TARGET': 'y' }
+    elif target not in accelerator_targets.get(sym, [])
+      continue
     endif
+    config_target += { sym: 'y' }
+    config_all_accel += { sym: 'y' }
+    target_kconfig += [ sym + '=y' ]
   endforeach
   if target_kconfig.length() == 0
     if default_targets
-- 
2.43.0


Reply via email to