diff mbox series

[v2,04/14] meson: Introduce CONFIG_TCG_TARGET

Message ID 20250203031821.741477-5-richard.henderson@linaro.org (mailing list archive)
State New
Headers show
Series meson: Deprecate 32-bit host support | expand

Commit Message

Richard Henderson Feb. 3, 2025, 3:18 a.m. UTC
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.henderson@linaro.org>
---
 include/qemu/osdep.h |  7 +++++++
 meson.build          | 11 +++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

Comments

Thomas Huth Feb. 3, 2025, 10:08 a.m. UTC | #1
On 03/02/2025 04.18, Richard Henderson wrote:
> 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.henderson@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

Shouldn't that rather go before the "#endif" instead?

Also, would it be possible to rather adjust scripts/make-config-poison.sh 
instead of poisoning this switch manually?

  Thomas

>   
>   /*
>    * 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
Richard Henderson Feb. 3, 2025, 4:38 p.m. UTC | #2
On 2/3/25 02:08, Thomas Huth wrote:
> On 03/02/2025 04.18, Richard Henderson wrote:
>> 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.henderson@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
> 
> Shouldn't that rather go before the "#endif" instead?
> 
> Also, would it be possible to rather adjust scripts/make-config-poison.sh instead of 
> poisoning this switch manually?

No, I want to unconditionally poison it so that no other uses are ever introduced.


r~
Thomas Huth Feb. 4, 2025, 6:41 a.m. UTC | #3
On 03/02/2025 17.38, Richard Henderson wrote:
> On 2/3/25 02:08, Thomas Huth wrote:
>> On 03/02/2025 04.18, Richard Henderson wrote:
>>> 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.henderson@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
>>
>> Shouldn't that rather go before the "#endif" instead?
>>
>> Also, would it be possible to rather adjust scripts/make-config-poison.sh 
>> instead of poisoning this switch manually?
> 
> No, I want to unconditionally poison it so that no other uses are ever 
> introduced.

Ok, but then I think you should put a comment in front of it, explaining the 
rationale, since it is not so obvious (at least it was not obvious for me 
when I read the patch).

  Thanks,
    Thomas
diff mbox series

Patch

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