On 11/20/24 19:49, Anton Johansson wrote:
> Adds a meson option for enabling/disabling helper-to-tcg along with a
> CONFIG_* definition.
>
> CONFIG_* will in future commits be used to conditionally include the
> helper-to-tcg subproject, and to remove unneeded code/memory when
> helper-to-tcg is not in use.
>
> Current meson option is limited to Hexagon, as helper-to-tcg will be
> included as a subproject from target/hexagon. This will change in the
> future if multiple frontends adopt helper-to-tcg.
>
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
> meson.build | 7 +++++++
> meson_options.txt | 2 ++
> scripts/meson-buildoptions.sh | 5 +++++
> 3 files changed, 14 insertions(+)
Looks ok. Could probably stand another set of meson eyes.
Acked-by: Richard Henderson <richard.henderson@linaro.org>
r~
>
> diff --git a/meson.build b/meson.build
> index e0b880e4e1..657ebe43f6 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -230,6 +230,7 @@ have_ga = get_option('guest_agent') \
> error_message: 'unsupported OS for QEMU guest agent') \
> .allowed()
> have_block = have_system or have_tools
> +helper_to_tcg_enabled = get_option('hexagon_helper_to_tcg')
>
> enable_modules = get_option('modules') \
> .require(host_os != 'windows',
> @@ -3245,6 +3246,11 @@ foreach target : target_dirs
> 'CONFIG_QEMU_RTSIG_MAP': get_option('rtsig_map'),
> }
> endif
> + if helper_to_tcg_enabled
> + config_target += {
> + 'CONFIG_HELPER_TO_TCG': 'y',
> + }
> + endif
>
> target_kconfig = []
> foreach sym: accelerators
> @@ -4122,6 +4128,7 @@ foreach target : target_dirs
> if host_os == 'linux'
> target_inc += include_directories('linux-headers', is_system: true)
> endif
> +
> if target.endswith('-softmmu')
> target_type='system'
> t = target_system_arch[target_base_arch].apply(config_target, strict: false)
> diff --git a/meson_options.txt b/meson_options.txt
> index 5eeaf3eee5..0730378305 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -374,6 +374,8 @@ option('qemu_ga_version', type: 'string', value: '',
>
> option('hexagon_idef_parser', type : 'boolean', value : true,
> description: 'use idef-parser to automatically generate TCG code for the Hexagon frontend')
> +option('hexagon_helper_to_tcg', type : 'boolean', value : true,
> + description: 'use the helper-to-tcg translator to automatically generate TCG code for the Hexagon frontend')
>
> option('x86_version', type : 'combo', choices : ['0', '1', '2', '3', '4'], value: '1',
> description: 'tweak required x86_64 architecture version beyond compiler default')
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index a8066aab03..19c891a39b 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -13,6 +13,9 @@ meson_options_help() {
> printf "%s\n" ' --datadir=VALUE Data file directory [share]'
> printf "%s\n" ' --disable-coroutine-pool coroutine freelist (better performance)'
> printf "%s\n" ' --disable-debug-info Enable debug symbols and other information'
> + printf "%s\n" ' --disable-hexagon-helper-to-tcg'
> + printf "%s\n" ' use the helper-to-tcg translator to automatically'
> + printf "%s\n" ' generate TCG code for the Hexagon frontend'
> printf "%s\n" ' --disable-hexagon-idef-parser'
> printf "%s\n" ' use idef-parser to automatically generate TCG'
> printf "%s\n" ' code for the Hexagon frontend'
> @@ -341,6 +344,8 @@ _meson_option_parse() {
> --disable-guest-agent) printf "%s" -Dguest_agent=disabled ;;
> --enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=enabled ;;
> --disable-guest-agent-msi) printf "%s" -Dguest_agent_msi=disabled ;;
> + --enable-hexagon-helper-to-tcg) printf "%s" -Dhexagon_helper_to_tcg=true ;;
> + --disable-hexagon-helper-to-tcg) printf "%s" -Dhexagon_helper_to_tcg=false ;;
> --enable-hexagon-idef-parser) printf "%s" -Dhexagon_idef_parser=true ;;
> --disable-hexagon-idef-parser) printf "%s" -Dhexagon_idef_parser=false ;;
> --enable-hv-balloon) printf "%s" -Dhv_balloon=enabled ;;