Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-14 Thread John Paul Adrian Glaubitz
Hello!

On 1/13/21 3:23 PM, Helge Deller wrote:
>> This is what that TCG interpreter provides for. eg would anyone
>> really want to emulate aarch64 guest when runing on a hppa host ?
>
> In debian many packages directly and indirectly depend on the qemu
> source package, because it provides - beside the emulator - various
> userspace tools which are necessary natively, like e.g. qemu-img.

I agree, that this a problem and it would be great if QEMU could be fixed
that it builds on all targets, not necessarily with all features available.

Currently, it looks like this:

> https://buildd.debian.org/status/package.php?p=qemu=sid

Note: The build failure on sparc64 is a bug in the device-tree-compiler
package which has not been fixed in Debian yet, see:

> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977031

> In the past building those tools failed on hppa because the configure script
> detected that neither native TCG nor TCG interpreter support was possible.
> As such the configuration aborted and no tools were built.
> So, the change should still make it possible to enable building the userspace
> tools.

I agree.

> On the other side, sometimes even a slow TCG-interpreter enabled qemu
> for other arches can be useful. It's not about speed, but about the
> *possibility* to emulate small pieces of different code, e.g.
> cross-compilers, bios-tools and such. It's not used often, but it
> can be handy.

I also agree here.

> That said, if it doesn't hurt I think we should not disable something
> which can be useful (this applies to all architectures).

True.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913




Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread Helge Deller
On 1/13/21 3:23 PM, Peter Maydell wrote:
> On Wed, 13 Jan 2021 at 13:57, Daniel P. Berrangé  wrote:
>> The question still remains whether anyone is actually likely to be
>> running/using QEMU on a sh4/hppa *host*, to emulate a different
>> guest arch ? This is what that TCG interpreter provides for.
>> eg would anyone really want to emulate aarch64 guest when runing on
>> a hppa host ?
>
> If anybody does, they should provide and help us maintain
> an hppa backend for tcg (and resources so we can CI it).

My time is currently too limited to actually work on such a
backend, but out of couriosity, what hardware resources would be needed?
Is a login to a machine sufficient?

> TCI is going to be so slow as to be useless -- you might
> be able to tick a box saying "we built QEMU for this port"
> but I find it hard to believe anybody would actually use
> the result.

True. As I said in the other mail, it would be useful for small
tools/builds only.

Helge



Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread Helge Deller
On 1/13/21 3:34 PM, Paolo Bonzini wrote:
> On 13/01/21 15:23, Helge Deller wrote:
>> In debian many packages directly and indirectly depend on the qemu
>> source package, because it provides - beside the emulator - various
>> userspace tools which are necessary natively, like e.g. qemu-img.
>> In the past building those tools failed on hppa because the configure script
>> detected that neither native TCG nor TCG interpreter support was possible.
>> As such the configuration aborted and no tools were built.
>> So, the change should still make it possible to enable building the userspace
>> tools.
>
> You could still build those, with --disable-system --disable-user.

Yes, since the tools are independend of the emulation, it should be possible
to build those independend if system/user is enabled or disabled.

> Or we could rig the configure/meson scripts to do that automatically
> if no accelerator is supported.

That would be the expected behaviour.

Helge



Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread John Paul Adrian Glaubitz
Hello!

On 1/13/21 2:09 PM, Philippe Mathieu-Daudé wrote:
>> ia64 is a dead host architecture and doesn't exist in any OS distro that
>> we target anymore, so I don't think we need to consider it.
>>
>> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
>> think we can rule that out too.

Both hppa and ia64 are maintained as unofficial ports in Debian:

> https://cdimage.debian.org/cdimage/ports/snapshots/2021-01-03/

>> Only sh4 still seems to be supported in Debian. I expect the primary
>> need there is for sh4 guest support rather than sh4 host support.

Same applies to sh4:

> https://cdimage.debian.org/cdimage/ports/debian-installer/2021-01-03/sh4/

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913




Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread Helge Deller
On 1/13/21 2:57 PM, Daniel P. Berrangé wrote:
> On Wed, Jan 13, 2021 at 02:42:51PM +0100, Helge Deller wrote:
>> On 1/13/21 2:09 PM, Philippe Mathieu-Daudé wrote:
>>> Cc'ing TCI, SH4 and PA contacts FWIW.
>>>
>>> On 1/7/21 5:06 PM, Daniel P. Berrangé wrote:
 On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
> On 07/01/21 16:01, Peter Maydell wrote:
>> On Thu, 7 Jan 2021 at 14:03, 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.
>>
>> The current behaviour is kind of deliberate. Using the TCG
>> interpreter is a terrible idea and think it's better if we
>> don't let users end up using it without realising that they have.
>> (Personally I would vote to deprecate-and-delete TCI, and also
>> to just have configure error out on unknown host CPU architectures.)
>
> Fair enough, I can change this back of course.  The missing targets are
> parisc, ia64 and sh4 I guess.

 ia64 is a dead host architecture and doesn't exist in any OS distro that
 we target anymore, so I don't think we need to consider it.
>>
>> I have no opinion about ia64.
>>
 Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
 think we can rule that out too.
>>
>> Can we please keep parisc/hppa.
>> It's not an official platform any longer, but quite active in the
>> "unstable" debian-ports repository:
>> https://buildd.debian.org/status/architecture.php?a=hppa=sid
>>
 Only sh4 still seems to be supported in Debian. I expect the primary
 need there is for sh4 guest support rather than sh4 host support.
>>
>> Same as for hppa/parisc, sh4 is in debian-ports too.
>
> So that at least shows that we need *guest target* support hppa/sha4.

Yes.

> The question still remains whether anyone is actually likely to be
> running/using QEMU on a sh4/hppa *host*, to emulate a different
> guest arch ?

Agreed, it's not very useful because of speed and amount of possible
users, but (please read below)

> This is what that TCG interpreter provides for. eg would anyone
> really want to emulate aarch64 guest when runing on a hppa host ?
In debian many packages directly and indirectly depend on the qemu
source package, because it provides - beside the emulator - various
userspace tools which are necessary natively, like e.g. qemu-img.
In the past building those tools failed on hppa because the configure script
detected that neither native TCG nor TCG interpreter support was possible.
As such the configuration aborted and no tools were built.
So, the change should still make it possible to enable building the userspace
tools.

On the other side, sometimes even a slow TCG-interpreter enabled qemu
for other arches can be useful. It's not about speed, but about the
*possibility* to emulate small pieces of different code, e.g.
cross-compilers, bios-tools and such. It's not used often, but it
can be handy.
That said, if it doesn't hurt I think we should not disable something
which can be useful (this applies to all architectures).

Helge



Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread Paolo Bonzini

On 13/01/21 15:23, Helge Deller wrote:

In debian many packages directly and indirectly depend on the qemu
source package, because it provides - beside the emulator - various
userspace tools which are necessary natively, like e.g. qemu-img.
In the past building those tools failed on hppa because the configure script
detected that neither native TCG nor TCG interpreter support was possible.
As such the configuration aborted and no tools were built.
So, the change should still make it possible to enable building the userspace
tools.


You could still build those, with --disable-system --disable-user.  Or 
we could rig the configure/meson scripts to do that automatically if no 
accelerator is supported.


Paolo




Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread Peter Maydell
On Wed, 13 Jan 2021 at 13:57, Daniel P. Berrangé  wrote:
> The question still remains whether anyone is actually likely to be
> running/using QEMU on a sh4/hppa *host*, to emulate a different
> guest arch ? This is what that TCG interpreter provides for.
> eg would anyone really want to emulate aarch64 guest when runing on
> a hppa host ?

If anybody does, they should provide and help us maintain
an hppa backend for tcg (and resources so we can CI it).
TCI is going to be so slow as to be useless -- you might
be able to tick a box saying "we built QEMU for this port"
but I find it hard to believe anybody would actually use
the result.

thanks
-- PMM



Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread John David Anglin
On 2021-01-13 8:42 a.m., Helge Deller wrote:
>>> ia64 is a dead host architecture and doesn't exist in any OS distro that
>>> we target anymore, so I don't think we need to consider it.
> I have no opinion about ia64.
>
>>> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
>>> think we can rule that out too.
> Can we please keep parisc/hppa.
> It's not an official platform any longer, but quite active in the
> "unstable" debian-ports repository:
> https://buildd.debian.org/status/architecture.php?a=hppa=sid
>
>>> Only sh4 still seems to be supported in Debian. I expect the primary
>>> need there is for sh4 guest support rather than sh4 host support.
> Same as for hppa/parisc, sh4 is in debian-ports too.
The status of the platforms in debian-ports is here:
https://www.ports.debian.org/archive
https://buildd.debian.org/status/architecture.php?a=hppa=sid

There is some effort to maintain all the platforms in debian-ports.  The hppa 
platform is also still
in gentoo, and one or two bsd distros.

Regards,
Dave

-- 
John David Anglin  dave.ang...@bell.net





Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread Daniel P . Berrangé
On Wed, Jan 13, 2021 at 02:42:51PM +0100, Helge Deller wrote:
> On 1/13/21 2:09 PM, Philippe Mathieu-Daudé wrote:
> > Cc'ing TCI, SH4 and PA contacts FWIW.
> >
> > On 1/7/21 5:06 PM, Daniel P. Berrangé wrote:
> >> On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
> >>> On 07/01/21 16:01, Peter Maydell wrote:
>  On Thu, 7 Jan 2021 at 14:03, 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.
> 
>  The current behaviour is kind of deliberate. Using the TCG
>  interpreter is a terrible idea and think it's better if we
>  don't let users end up using it without realising that they have.
>  (Personally I would vote to deprecate-and-delete TCI, and also
>  to just have configure error out on unknown host CPU architectures.)
> >>>
> >>> Fair enough, I can change this back of course.  The missing targets are
> >>> parisc, ia64 and sh4 I guess.
> >>
> >> ia64 is a dead host architecture and doesn't exist in any OS distro that
> >> we target anymore, so I don't think we need to consider it.
> 
> I have no opinion about ia64.
> 
> >> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
> >> think we can rule that out too.
> 
> Can we please keep parisc/hppa.
> It's not an official platform any longer, but quite active in the
> "unstable" debian-ports repository:
> https://buildd.debian.org/status/architecture.php?a=hppa=sid
> 
> >> Only sh4 still seems to be supported in Debian. I expect the primary
> >> need there is for sh4 guest support rather than sh4 host support.
> 
> Same as for hppa/parisc, sh4 is in debian-ports too.

So that at least shows that we need *guest target* support hppa/sha4.

The question still remains whether anyone is actually likely to be
running/using QEMU on a sh4/hppa *host*, to emulate a different
guest arch ? This is what that TCG interpreter provides for.
eg would anyone really want to emulate aarch64 guest when runing on
a hppa host ?

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|




Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread Helge Deller
On 1/13/21 2:09 PM, Philippe Mathieu-Daudé wrote:
> Cc'ing TCI, SH4 and PA contacts FWIW.
>
> On 1/7/21 5:06 PM, Daniel P. Berrangé wrote:
>> On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
>>> On 07/01/21 16:01, Peter Maydell wrote:
 On Thu, 7 Jan 2021 at 14:03, 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.

 The current behaviour is kind of deliberate. Using the TCG
 interpreter is a terrible idea and think it's better if we
 don't let users end up using it without realising that they have.
 (Personally I would vote to deprecate-and-delete TCI, and also
 to just have configure error out on unknown host CPU architectures.)
>>>
>>> Fair enough, I can change this back of course.  The missing targets are
>>> parisc, ia64 and sh4 I guess.
>>
>> ia64 is a dead host architecture and doesn't exist in any OS distro that
>> we target anymore, so I don't think we need to consider it.

I have no opinion about ia64.

>> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
>> think we can rule that out too.

Can we please keep parisc/hppa.
It's not an official platform any longer, but quite active in the
"unstable" debian-ports repository:
https://buildd.debian.org/status/architecture.php?a=hppa=sid

>> Only sh4 still seems to be supported in Debian. I expect the primary
>> need there is for sh4 guest support rather than sh4 host support.

Same as for hppa/parisc, sh4 is in debian-ports too.

Helge



Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-13 Thread Philippe Mathieu-Daudé
Cc'ing TCI, SH4 and PA contacts FWIW.

On 1/7/21 5:06 PM, Daniel P. Berrangé wrote:
> On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
>> On 07/01/21 16:01, Peter Maydell wrote:
>>> On Thu, 7 Jan 2021 at 14:03, 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.
>>>
>>> The current behaviour is kind of deliberate. Using the TCG
>>> interpreter is a terrible idea and think it's better if we
>>> don't let users end up using it without realising that they have.
>>> (Personally I would vote to deprecate-and-delete TCI, and also
>>> to just have configure error out on unknown host CPU architectures.)
>>
>> Fair enough, I can change this back of course.  The missing targets are
>> parisc, ia64 and sh4 I guess.
> 
> ia64 is a dead host architecture and doesn't exist in any OS distro that
> we target anymore, so I don't think we need to consider it.
> 
> Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
> think we can rule that out too.
> 
> Only sh4 still seems to be supported in Debian. I expect the primary
> need there is for sh4 guest support rather than sh4 host support.
> 
> Regards,
> Daniel
> 




Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-07 Thread Daniel P . Berrangé
On Thu, Jan 07, 2021 at 04:50:36PM +0100, Paolo Bonzini wrote:
> On 07/01/21 16:01, Peter Maydell wrote:
> > On Thu, 7 Jan 2021 at 14:03, 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.
> > 
> > The current behaviour is kind of deliberate. Using the TCG
> > interpreter is a terrible idea and think it's better if we
> > don't let users end up using it without realising that they have.
> > (Personally I would vote to deprecate-and-delete TCI, and also
> > to just have configure error out on unknown host CPU architectures.)
> 
> Fair enough, I can change this back of course.  The missing targets are
> parisc, ia64 and sh4 I guess.

ia64 is a dead host architecture and doesn't exist in any OS distro that
we target anymore, so I don't think we need to consider it.

Likewise parisc/hppa doesn't seem exist in Debian since Squeeze, so I
think we can rule that out too.

Only sh4 still seems to be supported in Debian. I expect the primary
need there is for sh4 guest support rather than sh4 host support.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|




Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-07 Thread Paolo Bonzini

On 07/01/21 16:01, Peter Maydell wrote:

On Thu, 7 Jan 2021 at 14:03, 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.


The current behaviour is kind of deliberate. Using the TCG
interpreter is a terrible idea and think it's better if we
don't let users end up using it without realising that they have.
(Personally I would vote to deprecate-and-delete TCI, and also
to just have configure error out on unknown host CPU architectures.)


Fair enough, I can change this back of course.  The missing targets are 
parisc, ia64 and sh4 I guess.


Paolo




Re: [PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-07 Thread Peter Maydell
On Thu, 7 Jan 2021 at 14:03, 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.

The current behaviour is kind of deliberate. Using the TCG
interpreter is a terrible idea and think it's better if we
don't let users end up using it without realising that they have.
(Personally I would vote to deprecate-and-delete TCI, and also
to just have configure error out on unknown host CPU architectures.)

thanks
-- PMM



[PATCH 1/8] build-system: clean up TCG/TCI configury

2021-01-07 Thread Paolo Bonzini
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 
---
 configure | 11 +++
 disas/meson.build |  2 --
 meson.build   | 50 ---
 meson_options.txt |  2 ++
 4 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/configure b/configure
index 8e0de14aa6..81801a6fe0 100755
--- a/configure
+++ b/configure
@@ -355,7 +355,7 @@ sanitizers="no"
 tsan="no"
 fortify_source="$default_feature"
 strip_opt="yes"
-tcg_interpreter="no"
+tcg_interpreter="auto"
 bigendian="no"
 mingw32="no"
 gcov="no"
@@ -1117,9 +1117,9 @@ for opt do
   ;;
   --enable-whpx) whpx="enabled"
   ;;
-  --disable-tcg-interpreter) tcg_interpreter="no"
+  --disable-tcg-interpreter) tcg_interpreter="disabled"
   ;;
-  --enable-tcg-interpreter) tcg_interpreter="yes"
+  --enable-tcg-interpreter) tcg_interpreter="enabled"
   ;;
   --disable-cap-ng)  cap_ng="disabled"
   ;;
@@ -5911,11 +5911,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 2742b37e14..36f1d02190 100644
--- a/meson.build
+++ b/meson.build
@@ -109,25 +109,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'])
@@ -224,14 +207,31 @@ 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').enabled() or cpu not in supported_cpus
+if get_option('tcg_interpreter').disabled()
+  error('TCG interpreter disabled but host CPU @0@ supported'.format(cpu))
+elif get_option('tcg_interpreter').auto()
   warning('Unsupported CPU @0@, will use TCG with TCI 
(experimental)'.format(cpu))
-else
-  error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu))
 endif
+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
@@ -1833,7 +1833,9 @@ specific_ss.add(when: 'CONFIG_TCG', if_true: files(
   'tcg/tcg-op.c',
   'tcg/tcg.c',
 ))
-specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 
'tcg/tci.c'))
+if tcg_arch == 'tci'
+  specific_ss.add(files('disas/tci.c', 'tcg/tci.c'))
+endif
 
 subdir('backends')
 subdir('disas')
@@ -2392,7 +2394,7 @@ summary_info += {'WHPX support':  
config_all.has_key('CONFIG_WHPX')}
 summary_info += {'TCG support':   config_all.has_key('CONFIG_TCG')}
 if