diff mbox series

[PULL,04/31] build-system: clean up TCG/TCI configury

Message ID 20210123143128.1167797-5-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/31] runstate: cleanup reboot and panic actions | expand

Commit Message

Paolo Bonzini Jan. 23, 2021, 2:31 p.m. UTC
Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
a warning) if the host CPU is unsupported, making it more similar to
other --enable-* options.

Remove TCG-specific include paths from !CONFIG_TCG builds.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 11 +++--------
 disas/meson.build |  2 --
 meson.build       | 46 +++++++++++++++++++++++++---------------------
 meson_options.txt |  2 ++
 4 files changed, 30 insertions(+), 31 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 6, 2021, 6:01 p.m. UTC | #1
On 1/23/21 3:31 PM, Paolo Bonzini wrote:
> Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
> a warning) if the host CPU is unsupported, making it more similar to
> other --enable-* options.
> 
> Remove TCG-specific include paths from !CONFIG_TCG builds.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure         | 11 +++--------
>  disas/meson.build |  2 --
>  meson.build       | 46 +++++++++++++++++++++++++---------------------
>  meson_options.txt |  2 ++
>  4 files changed, 30 insertions(+), 31 deletions(-)

I spent 2h bisecting until:

23a77b2d18b84e410478e88f11c54911f7a649fc is the first bad commit
commit 23a77b2d18b84e410478e88f11c54911f7a649fc
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Mon Dec 14 12:01:45 2020 +0100

    build-system: clean up TCG/TCI configury

    Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
    a warning) if the host CPU is unsupported, making it more similar to
    other --enable-* options.

    Remove TCG-specific include paths from !CONFIG_TCG builds.

    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

to realize I need to re-bisect from here now including:

commit c6fbea47664466e526e40300568324ef77e5f2cc
Author: Richard Henderson <richard.henderson@linaro.org>
Date:   Sun Jan 24 11:10:55 2021 -1000

    configure: Fix --enable-tcg-interpreter

    The configure option was backward, and we failed to
    pass the value on to meson.

    Fixes: 23a77b2d18b ("build-system: clean up TCG/TCI configury")
    Tested-by: Stefan Weil <sw@weilnetz.de>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Sigh.
Philippe Mathieu-Daudé Feb. 6, 2021, 7:08 p.m. UTC | #2
On 2/6/21 7:01 PM, Philippe Mathieu-Daudé wrote:
> On 1/23/21 3:31 PM, Paolo Bonzini wrote:
>> Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
>> a warning) if the host CPU is unsupported, making it more similar to
>> other --enable-* options.
>>
>> Remove TCG-specific include paths from !CONFIG_TCG builds.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  configure         | 11 +++--------
>>  disas/meson.build |  2 --
>>  meson.build       | 46 +++++++++++++++++++++++++---------------------
>>  meson_options.txt |  2 ++
>>  4 files changed, 30 insertions(+), 31 deletions(-)
> 
> I spent 2h bisecting until:
> 
> 23a77b2d18b84e410478e88f11c54911f7a649fc is the first bad commit
> commit 23a77b2d18b84e410478e88f11c54911f7a649fc
> Author: Paolo Bonzini <pbonzini@redhat.com>
> Date:   Mon Dec 14 12:01:45 2020 +0100
> 
>     build-system: clean up TCG/TCI configury
> 
>     Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with
>     a warning) if the host CPU is unsupported, making it more similar to
>     other --enable-* options.
> 
>     Remove TCG-specific include paths from !CONFIG_TCG builds.
> 
>     Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> to realize I need to re-bisect from here now including:
> 
> commit c6fbea47664466e526e40300568324ef77e5f2cc
> Author: Richard Henderson <richard.henderson@linaro.org>
> Date:   Sun Jan 24 11:10:55 2021 -1000
> 
>     configure: Fix --enable-tcg-interpreter
> 
>     The configure option was backward, and we failed to
>     pass the value on to meson.
> 
>     Fixes: 23a77b2d18b ("build-system: clean up TCG/TCI configury")
>     Tested-by: Stefan Weil <sw@weilnetz.de>
>     Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>     Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>     Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>     Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>     Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

From a buildir configured *before* 23a77b2d18b84, checking out
*after* c6fbea476644 (5b19cb63d9d actually, pull-tcg-20210205
merged today) I get:

[352/396] Compiling C object
libqemu-hppa-linux-user.fa.p/target_hppa_translate.c.o
In file included from /home/philmd/qemu/include/tcg/tcg-op.h:28,
                 from ../target/hppa/translate.c:25:
/home/philmd/qemu/include/tcg/tcg.h:35:10: fatal error: tcg-target.h: No
such file or directory
   35 | #include "tcg-target.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.

When starting in a new empty directory, it works. I don't understand
because there are no generated files involved (similarly to commit
0572d6cd29d).

Note for later: Better merge buildsys fixes sooner rather than later,
as it ease bisections.
diff mbox series

Patch

diff --git a/configure b/configure
index f16fa99060..a84df7c4ad 100755
--- a/configure
+++ b/configure
@@ -359,7 +359,7 @@  sanitizers="no"
 tsan="no"
 fortify_source="$default_feature"
 strip_opt="yes"
-tcg_interpreter="no"
+tcg_interpreter="false"
 bigendian="no"
 mingw32="no"
 gcov="no"
@@ -1119,9 +1119,9 @@  for opt do
   ;;
   --enable-whpx) whpx="enabled"
   ;;
-  --disable-tcg-interpreter) tcg_interpreter="no"
+  --disable-tcg-interpreter) tcg_interpreter="true"
   ;;
-  --enable-tcg-interpreter) tcg_interpreter="yes"
+  --enable-tcg-interpreter) tcg_interpreter="false"
   ;;
   --disable-cap-ng)  cap_ng="disabled"
   ;;
@@ -5834,11 +5834,6 @@  fi
 if test "$optreset" = "yes" ; then
   echo "HAVE_OPTRESET=y" >> $config_host_mak
 fi
-if test "$tcg" = "enabled"; then
-  if test "$tcg_interpreter" = "yes" ; then
-    echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
-  fi
-fi
 if test "$fdatasync" = "yes" ; then
   echo "CONFIG_FDATASYNC=y" >> $config_host_mak
 fi
diff --git a/disas/meson.build b/disas/meson.build
index 09a852742e..da341a511e 100644
--- a/disas/meson.build
+++ b/disas/meson.build
@@ -22,5 +22,3 @@  common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c'))
 common_ss.add(when: 'CONFIG_SPARC_DIS', if_true: files('sparc.c'))
 common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: files('xtensa.c'))
 common_ss.add(when: capstone, if_true: files('capstone.c'))
-
-specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('tci.c'))
diff --git a/meson.build b/meson.build
index af2bc89741..2001e941f4 100644
--- a/meson.build
+++ b/meson.build
@@ -113,25 +113,8 @@  if targetos == 'linux'
                         language: ['c', 'cpp'])
 endif
 
-if 'CONFIG_TCG_INTERPRETER' in config_host
-  tcg_arch = 'tci'
-elif config_host['ARCH'] == 'sparc64'
-  tcg_arch = 'sparc'
-elif config_host['ARCH'] == 's390x'
-  tcg_arch = 's390'
-elif config_host['ARCH'] in ['x86_64', 'x32']
-  tcg_arch = 'i386'
-elif config_host['ARCH'] == 'ppc64'
-  tcg_arch = 'ppc'
-elif config_host['ARCH'] in ['riscv32', 'riscv64']
-  tcg_arch = 'riscv'
-else
-  tcg_arch = config_host['ARCH']
-endif
-add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
-                      '-iquote', '.',
+add_project_arguments('-iquote', '.',
                       '-iquote', meson.current_source_dir(),
-                      '-iquote', meson.current_source_dir() / 'accel/tcg',
                       '-iquote', meson.current_source_dir() / 'include',
                       '-iquote', meson.current_source_dir() / 'disas/libvixl',
                       language: ['c', 'cpp', 'objc'])
@@ -226,14 +209,33 @@  if not get_option('hax').disabled()
     accelerators += 'CONFIG_HAX'
   endif
 endif
+
+tcg_arch = config_host['ARCH']
 if not get_option('tcg').disabled()
   if cpu not in supported_cpus
-    if 'CONFIG_TCG_INTERPRETER' in config_host
+    if get_option('tcg_interpreter')
       warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu))
     else
       error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
     endif
   endif
+  if get_option('tcg_interpreter')
+    tcg_arch = 'tci'
+  elif config_host['ARCH'] == 'sparc64'
+    tcg_arch = 'sparc'
+  elif config_host['ARCH'] == 's390x'
+    tcg_arch = 's390'
+  elif config_host['ARCH'] in ['x86_64', 'x32']
+    tcg_arch = 'i386'
+  elif config_host['ARCH'] == 'ppc64'
+    tcg_arch = 'ppc'
+  elif config_host['ARCH'] in ['riscv32', 'riscv64']
+    tcg_arch = 'riscv'
+  endif
+  add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
+                        '-iquote', meson.current_source_dir() / 'accel/tcg',
+                        language: ['c', 'cpp', 'objc'])
+
   accelerators += 'CONFIG_TCG'
   config_host += { 'CONFIG_TCG': 'y' }
 endif
@@ -1234,7 +1236,9 @@  foreach target : target_dirs
     if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
       config_target += { sym: 'y' }
       config_all += { sym: 'y' }
-      if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
+      if sym == 'CONFIG_TCG' and tcg_arch == 'tci'
+        config_target += { 'CONFIG_TCG_INTERPRETER': 'y' }
+      elif sym == 'CONFIG_XEN' and have_xen_pci_passthrough
         config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
       endif
       accel_kconfig += [ sym + '=y' ]
@@ -2411,7 +2415,7 @@  summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
 summary_info += {'TCG support':       config_all.has_key('CONFIG_TCG')}
 if config_all.has_key('CONFIG_TCG')
   summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
-  summary_info += {'TCG interpreter':   config_host.has_key('CONFIG_TCG_INTERPRETER')}
+  summary_info += {'TCG interpreter':   tcg_arch == 'tci'}
 endif
 summary_info += {'malloc trim support': has_malloc_trim}
 summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
diff --git a/meson_options.txt b/meson_options.txt
index 72a3ca22d6..7dcd81c06a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -37,6 +37,8 @@  option('xen_pci_passthrough', type: 'feature', value: 'auto',
        description: 'Xen PCI passthrough support')
 option('tcg', type: 'feature', value: 'auto',
        description: 'TCG support')
+option('tcg_interpreter', type: 'boolean', value: false,
+       description: 'TCG bytecode interpreter (TCI)')
 option('cfi', type: 'boolean', value: 'false',
        description: 'Control-Flow Integrity (CFI)')
 option('cfi_debug', type: 'boolean', value: 'false',