[PULL 15/29] tcg: Provide guest_base fallback for system mode

Richard Henderson posted 29 patches 1 year, 1 month ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, WANG Xuerui <git@xen0n.name>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Huacai Chen <chenhuacai@kernel.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <Alistair.Francis@wdc.com>
There is a newer version of this series
[PULL 15/29] tcg: Provide guest_base fallback for system mode
Posted by Richard Henderson 1 year, 1 month ago
Provide a define to allow !tcg_use_softmmu code paths to
compile in system mode, but require elimination.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/tcg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tcg/tcg.c b/tcg/tcg.c
index d3a4a17ef2..35158a0846 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -178,6 +178,10 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece);
 static int tcg_out_ldst_finalize(TCGContext *s);
 #endif
 
+#ifndef CONFIG_USER_ONLY
+#define guest_base  ({ qemu_build_not_reached(); (uintptr_t)0; })
+#endif
+
 typedef struct TCGLdstHelperParam {
     TCGReg (*ra_gen)(TCGContext *s, const TCGLabelQemuLdst *l, int arg_reg);
     unsigned ntmp;
-- 
2.34.1


Re: [PULL 15/29] tcg: Provide guest_base fallback for system mode
Posted by Stefan Hajnoczi 1 year, 1 month ago
On Wed, 18 Oct 2023 at 15:30, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Provide a define to allow !tcg_use_softmmu code paths to
> compile in system mode, but require elimination.
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  tcg/tcg.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index d3a4a17ef2..35158a0846 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -178,6 +178,10 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece);
>  static int tcg_out_ldst_finalize(TCGContext *s);
>  #endif
>
> +#ifndef CONFIG_USER_ONLY
> +#define guest_base  ({ qemu_build_not_reached(); (uintptr_t)0; })
> +#endif

Please take a look at this CI failure:

cc -m64 -mcx16 -Itcg/libtcg_system.fa.p -Itcg -I../tcg -I. -Iqapi
-Itrace -Iui -Iui/shader -I/usr/local/include/glib-2.0
-I/usr/local/lib/glib-2.0/include -I/usr/local/include
-fcolor-diagnostics -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g
-fstack-protector-strong -Wundef -Wwrite-strings -Wmissing-prototypes
-Wstrict-prototypes -Wredundant-decls -Wold-style-definition
-Wtype-limits -Wformat-security -Wformat-y2k -Winit-self
-Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels
-Wexpansion-to-defined -Wmissing-format-attribute
-Wno-initializer-overrides -Wno-missing-include-dirs
-Wno-shift-negative-value -Wno-string-plus-int
-Wno-typedef-redefinition -Wno-tautological-type-limit-compare
-Wno-psabi -Wno-gnu-variable-sized-type-not-at-end -Wthread-safety
-iquote . -iquote /tmp/cirrus-ci-build -iquote
/tmp/cirrus-ci-build/include -iquote
/tmp/cirrus-ci-build/host/include/x86_64 -iquote
/tmp/cirrus-ci-build/host/include/generic -iquote
/tmp/cirrus-ci-build/tcg/i386 -pthread -D_GNU_SOURCE
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing
-fno-common -fwrapv -fPIE -DCONFIG_SOFTMMU -MD -MQ
tcg/libtcg_system.fa.p/tcg.c.o -MF tcg/libtcg_system.fa.p/tcg.c.o.d -o
tcg/libtcg_system.fa.p/tcg.c.o -c ../tcg/tcg.c
In file included from ../tcg/tcg.c:744:
/tmp/cirrus-ci-build/tcg/i386/tcg-target.c.inc:1953:35: error: cannot
take the address of an rvalue of type 'uintptr_t' (aka 'unsigned
long')
if (sysarch(AMD64_SET_GSBASE, &guest_base) == 0) {
^~~~~~~~~~~
1 error generated.

https://gitlab.com/qemu-project/qemu/-/jobs/5329820109

> +
>  typedef struct TCGLdstHelperParam {
>      TCGReg (*ra_gen)(TCGContext *s, const TCGLabelQemuLdst *l, int arg_reg);
>      unsigned ntmp;
> --
> 2.34.1
>
>