mbox series

[v3,00/70] TCI fixes and cleanups

Message ID 20210208023752.270606-1-richard.henderson@linaro.org (mailing list archive)
Headers show
Series TCI fixes and cleanups | expand

Message

Richard Henderson Feb. 8, 2021, 2:36 a.m. UTC
Changes since v2:
  * 20-something patches are now upstream.
  * Increase testing timeout for tci.
  * Gitlab testing for tci w/ 32-bit host.


r~


Richard Henderson (70):
  gdbstub: Fix handle_query_xfer_auxv
  tcg: Split out tcg_raise_tb_overflow
  tcg: Manage splitwx in tc_ptr_to_region_tree by hand
  tcg/tci: Merge identical cases in generation
  tcg/tci: Remove tci_read_r8
  tcg/tci: Remove tci_read_r8s
  tcg/tci: Remove tci_read_r16
  tcg/tci: Remove tci_read_r16s
  tcg/tci: Remove tci_read_r32
  tcg/tci: Remove tci_read_r32s
  tcg/tci: Reduce use of tci_read_r64
  tcg/tci: Merge basic arithmetic operations
  tcg/tci: Merge extension operations
  tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64
  tcg/tci: Merge bswap operations
  tcg/tci: Merge mov, not and neg operations
  tcg/tci: Rename tci_read_r to tci_read_rval
  tcg/tci: Split out tci_args_rrs
  tcg/tci: Split out tci_args_rr
  tcg/tci: Split out tci_args_rrr
  tcg/tci: Split out tci_args_rrrc
  tcg/tci: Split out tci_args_l
  tcg/tci: Split out tci_args_rrrrrc
  tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl
  tcg/tci: Split out tci_args_ri and tci_args_rI
  tcg/tci: Reuse tci_args_l for calls.
  tcg/tci: Reuse tci_args_l for exit_tb
  tcg/tci: Reuse tci_args_l for goto_tb
  tcg/tci: Split out tci_args_rrrrrr
  tcg/tci: Split out tci_args_rrrr
  tcg/tci: Clean up deposit operations
  tcg/tci: Reduce qemu_ld/st TCGMemOpIdx operand to 32-bits
  tcg/tci: Split out tci_args_{rrm,rrrm,rrrrm}
  tcg/tci: Hoist op_size checking into tci_args_*
  tcg/tci: Remove tci_disas
  tcg/tci: Implement the disassembler properly
  tcg: Build ffi data structures for helpers
  tcg/tci: Use ffi for calls
  tcg/tci: Improve tcg_target_call_clobber_regs
  tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order
  tcg/tci: Push opcode emit into each case
  tcg/tci: Split out tcg_out_op_rrs
  tcg/tci: Split out tcg_out_op_l
  tcg/tci: Split out tcg_out_op_p
  tcg/tci: Split out tcg_out_op_rr
  tcg/tci: Split out tcg_out_op_rrr
  tcg/tci: Split out tcg_out_op_rrrc
  tcg/tci: Split out tcg_out_op_rrrrrc
  tcg/tci: Split out tcg_out_op_rrrbb
  tcg/tci: Split out tcg_out_op_rrcl
  tcg/tci: Split out tcg_out_op_rrrrrr
  tcg/tci: Split out tcg_out_op_rrrr
  tcg/tci: Split out tcg_out_op_rrrrcl
  tcg/tci: Split out tcg_out_op_{rrm,rrrm,rrrrm}
  tcg/tci: Split out tcg_out_op_v
  tcg/tci: Split out tcg_out_op_np
  tcg/tci: Split out tcg_out_op_r[iI]
  tcg/tci: Reserve r13 for a temporary
  tcg/tci: Emit setcond before brcond
  tcg/tci: Remove tci_write_reg
  tcg/tci: Change encoding to uint32_t units
  tcg/tci: Implement goto_ptr
  tcg/tci: Implement movcond
  tcg/tci: Implement andc, orc, eqv, nand, nor
  tcg/tci: Implement extract, sextract
  tcg/tci: Implement clz, ctz, ctpop
  tcg/tci: Implement mulu2, muls2
  tcg/tci: Implement add2, sub2
  tests/tcg: Increase timeout for TCI
  gitlab: Enable cross-i386 builds of TCI

 configure                                     |    3 +
 meson.build                                   |    9 +-
 include/exec/helper-ffi.h                     |  115 ++
 include/exec/helper-tcg.h                     |   24 +-
 include/tcg/tcg-opc.h                         |    6 +-
 include/tcg/tcg.h                             |    1 +
 target/hppa/helper.h                          |    2 +
 target/i386/ops_sse_header.h                  |    6 +
 target/m68k/helper.h                          |    1 +
 target/ppc/helper.h                           |    3 +
 tcg/tci/tcg-target-con-set.h                  |    2 +-
 tcg/tci/tcg-target.h                          |   81 +-
 disas/tci.c                                   |   61 -
 gdbstub.c                                     |   17 +-
 tcg/tcg.c                                     |  117 +-
 tcg/tci.c                                     | 1536 ++++++++++-------
 tcg/tci/tcg-target.c.inc                      |  926 +++++-----
 .gitlab-ci.d/crossbuilds.yml                  |   17 +-
 tcg/tci/README                                |   20 +-
 .../dockerfiles/fedora-i386-cross.docker      |    1 +
 tests/docker/dockerfiles/fedora.docker        |    1 +
 tests/tcg/Makefile.target                     |    6 +-
 22 files changed, 1727 insertions(+), 1228 deletions(-)
 create mode 100644 include/exec/helper-ffi.h
 delete mode 100644 disas/tci.c

Comments

no-reply@patchew.org Feb. 8, 2021, 3:45 a.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20210208023752.270606-1-richard.henderson@linaro.org/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210208023752.270606-1-richard.henderson@linaro.org
Subject: [PATCH v3 00/70] TCI fixes and cleanups

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 - [tag update]      patchew/20210202132103.1096654-1-ppandit@redhat.com -> patchew/20210202132103.1096654-1-ppandit@redhat.com
 * [new tag]         patchew/20210208023752.270606-1-richard.henderson@linaro.org -> patchew/20210208023752.270606-1-richard.henderson@linaro.org
Switched to a new branch 'test'
130a759 gitlab: Enable cross-i386 builds of TCI
537da5c tests/tcg: Increase timeout for TCI
657c9d3 tcg/tci: Implement add2, sub2
1723413 tcg/tci: Implement mulu2, muls2
a939076 tcg/tci: Implement clz, ctz, ctpop
7209e1f tcg/tci: Implement extract, sextract
4d08848 tcg/tci: Implement andc, orc, eqv, nand, nor
acf9fa4 tcg/tci: Implement movcond
e2c5d5b tcg/tci: Implement goto_ptr
4888fb2 tcg/tci: Change encoding to uint32_t units
c8a6e41 tcg/tci: Remove tci_write_reg
c6f6fb3 tcg/tci: Emit setcond before brcond
b5e61eb tcg/tci: Reserve r13 for a temporary
737c1a6 tcg/tci: Split out tcg_out_op_r[iI]
1d5e3b6 tcg/tci: Split out tcg_out_op_np
878bc25 tcg/tci: Split out tcg_out_op_v
7715c25 tcg/tci: Split out tcg_out_op_{rrm,rrrm,rrrrm}
0639600 tcg/tci: Split out tcg_out_op_rrrrcl
80d6564 tcg/tci: Split out tcg_out_op_rrrr
28e84b8 tcg/tci: Split out tcg_out_op_rrrrrr
ba38a14 tcg/tci: Split out tcg_out_op_rrcl
dfc698a tcg/tci: Split out tcg_out_op_rrrbb
4e349f3 tcg/tci: Split out tcg_out_op_rrrrrc
c624d63 tcg/tci: Split out tcg_out_op_rrrc
7495322 tcg/tci: Split out tcg_out_op_rrr
9d981cb tcg/tci: Split out tcg_out_op_rr
4e89f8e tcg/tci: Split out tcg_out_op_p
43b03a7 tcg/tci: Split out tcg_out_op_l
891f923 tcg/tci: Split out tcg_out_op_rrs
e0f64b1 tcg/tci: Push opcode emit into each case
a8cdf4b tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order
b658bdf tcg/tci: Improve tcg_target_call_clobber_regs
7061224 tcg/tci: Use ffi for calls
8f5fa28 tcg: Build ffi data structures for helpers
a5aeb2f tcg/tci: Implement the disassembler properly
cff39b3 tcg/tci: Remove tci_disas
436c626 tcg/tci: Hoist op_size checking into tci_args_*
3f97fe3 tcg/tci: Split out tci_args_{rrm,rrrm,rrrrm}
09c4b02 tcg/tci: Reduce qemu_ld/st TCGMemOpIdx operand to 32-bits
d6ea609 tcg/tci: Clean up deposit operations
790a1a4 tcg/tci: Split out tci_args_rrrr
07179d8 tcg/tci: Split out tci_args_rrrrrr
2564979 tcg/tci: Reuse tci_args_l for goto_tb
94b2744 tcg/tci: Reuse tci_args_l for exit_tb
fd26dc8 tcg/tci: Reuse tci_args_l for calls.
5578fd9 tcg/tci: Split out tci_args_ri and tci_args_rI
e2b9810 tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl
cfbdf1d tcg/tci: Split out tci_args_rrrrrc
e4d84d0 tcg/tci: Split out tci_args_l
91a9a07 tcg/tci: Split out tci_args_rrrc
b03a2ac tcg/tci: Split out tci_args_rrr
fcc3c7a tcg/tci: Split out tci_args_rr
d6ae8fc tcg/tci: Split out tci_args_rrs
243857a tcg/tci: Rename tci_read_r to tci_read_rval
3329020 tcg/tci: Merge mov, not and neg operations
dbb2896 tcg/tci: Merge bswap operations
1c440bc tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64
beabf85 tcg/tci: Merge extension operations
8d5959b tcg/tci: Merge basic arithmetic operations
e22c5a6 tcg/tci: Reduce use of tci_read_r64
a8c774f tcg/tci: Remove tci_read_r32s
468e805 tcg/tci: Remove tci_read_r32
fddbd22 tcg/tci: Remove tci_read_r16s
187a012 tcg/tci: Remove tci_read_r16
5ce27c4 tcg/tci: Remove tci_read_r8s
8a4f80e tcg/tci: Remove tci_read_r8
6a28b59 tcg/tci: Merge identical cases in generation
36f0810 tcg: Manage splitwx in tc_ptr_to_region_tree by hand
1ae9d2d tcg: Split out tcg_raise_tb_overflow
955191f gdbstub: Fix handle_query_xfer_auxv

=== OUTPUT BEGIN ===
1/70 Checking commit 955191ffda89 (gdbstub: Fix handle_query_xfer_auxv)
2/70 Checking commit 1ae9d2de47fc (tcg: Split out tcg_raise_tb_overflow)
3/70 Checking commit 36f08102a470 (tcg: Manage splitwx in tc_ptr_to_region_tree by hand)
4/70 Checking commit 6a28b596aec1 (tcg/tci: Merge identical cases in generation)
5/70 Checking commit 8a4f80e01c93 (tcg/tci: Remove tci_read_r8)
6/70 Checking commit 5ce27c4af25a (tcg/tci: Remove tci_read_r8s)
7/70 Checking commit 187a0127a7ac (tcg/tci: Remove tci_read_r16)
8/70 Checking commit fddbd22d85f0 (tcg/tci: Remove tci_read_r16s)
9/70 Checking commit 468e805759cd (tcg/tci: Remove tci_read_r32)
10/70 Checking commit a8c774f174e6 (tcg/tci: Remove tci_read_r32s)
11/70 Checking commit e22c5a6d4fd6 (tcg/tci: Reduce use of tci_read_r64)
12/70 Checking commit 8d5959bfd605 (tcg/tci: Merge basic arithmetic operations)
13/70 Checking commit beabf85d0bfc (tcg/tci: Merge extension operations)
14/70 Checking commit 1c440bc8bd0d (tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64)
15/70 Checking commit dbb289624f02 (tcg/tci: Merge bswap operations)
16/70 Checking commit 3329020e9328 (tcg/tci: Merge mov, not and neg operations)
17/70 Checking commit 243857adadc3 (tcg/tci: Rename tci_read_r to tci_read_rval)
18/70 Checking commit d6ae8fc71f71 (tcg/tci: Split out tci_args_rrs)
19/70 Checking commit fcc3c7a34083 (tcg/tci: Split out tci_args_rr)
20/70 Checking commit b03a2ac0ea6b (tcg/tci: Split out tci_args_rrr)
21/70 Checking commit 91a9a076678a (tcg/tci: Split out tci_args_rrrc)
22/70 Checking commit e4d84d057d1d (tcg/tci: Split out tci_args_l)
23/70 Checking commit cfbdf1d2d888 (tcg/tci: Split out tci_args_rrrrrc)
24/70 Checking commit e2b9810902ac (tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl)
25/70 Checking commit 5578fd9a2f17 (tcg/tci: Split out tci_args_ri and tci_args_rI)
26/70 Checking commit fd26dc87058e (tcg/tci: Reuse tci_args_l for calls.)
27/70 Checking commit 94b274444d21 (tcg/tci: Reuse tci_args_l for exit_tb)
28/70 Checking commit 2564979b3403 (tcg/tci: Reuse tci_args_l for goto_tb)
29/70 Checking commit 07179d882605 (tcg/tci: Split out tci_args_rrrrrr)
30/70 Checking commit 790a1a4efd6e (tcg/tci: Split out tci_args_rrrr)
31/70 Checking commit d6ea609b4a77 (tcg/tci: Clean up deposit operations)
32/70 Checking commit 09c4b028c61f (tcg/tci: Reduce qemu_ld/st TCGMemOpIdx operand to 32-bits)
33/70 Checking commit 3f97fe31b87b (tcg/tci: Split out tci_args_{rrm,rrrm,rrrrm})
34/70 Checking commit 436c6262ac2f (tcg/tci: Hoist op_size checking into tci_args_*)
35/70 Checking commit cff39b3b98da (tcg/tci: Remove tci_disas)
36/70 Checking commit a5aeb2fa96a7 (tcg/tci: Implement the disassembler properly)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#21: 
deleted file mode 100644

total: 0 errors, 1 warnings, 304 lines checked

Patch 36/70 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
37/70 Checking commit 8f5fa28c2116 (tcg: Build ffi data structures for helpers)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#25: 
new file mode 100644

ERROR: Macros with complex values should be enclosed in parenthesis
#40: FILE: include/exec/helper-ffi.h:11:
+#define dh_ffitype_i32  &ffi_type_uint32

ERROR: Macros with complex values should be enclosed in parenthesis
#41: FILE: include/exec/helper-ffi.h:12:
+#define dh_ffitype_s32  &ffi_type_sint32

ERROR: Macros with complex values should be enclosed in parenthesis
#43: FILE: include/exec/helper-ffi.h:14:
+#define dh_ffitype_i64  &ffi_type_uint64

ERROR: Macros with complex values should be enclosed in parenthesis
#44: FILE: include/exec/helper-ffi.h:15:
+#define dh_ffitype_s64  &ffi_type_sint64

ERROR: Macros with complex values should be enclosed in parenthesis
#45: FILE: include/exec/helper-ffi.h:16:
+#define dh_ffitype_f16  &ffi_type_uint32

ERROR: Macros with complex values should be enclosed in parenthesis
#46: FILE: include/exec/helper-ffi.h:17:
+#define dh_ffitype_f32  &ffi_type_uint32

ERROR: Macros with complex values should be enclosed in parenthesis
#47: FILE: include/exec/helper-ffi.h:18:
+#define dh_ffitype_f64  &ffi_type_uint64

ERROR: Macros with complex values should be enclosed in parenthesis
#50: FILE: include/exec/helper-ffi.h:21:
+#  define dh_ffitype_tl &ffi_type_uint32

ERROR: Macros with complex values should be enclosed in parenthesis
#52: FILE: include/exec/helper-ffi.h:23:
+#  define dh_ffitype_tl &ffi_type_uint64

ERROR: Macros with complex values should be enclosed in parenthesis
#55: FILE: include/exec/helper-ffi.h:26:
+#define dh_ffitype_ptr  &ffi_type_pointer

ERROR: Macros with complex values should be enclosed in parenthesis
#56: FILE: include/exec/helper-ffi.h:27:
+#define dh_ffitype_cptr &ffi_type_pointer

ERROR: Macros with complex values should be enclosed in parenthesis
#59: FILE: include/exec/helper-ffi.h:30:
+#define dh_ffitype_env  &ffi_type_pointer

ERROR: space required after that ',' (ctx:VxV)
#63: FILE: include/exec/helper-ffi.h:34:
+    static ffi_cif glue(cif_,NAME) = {          \
                             ^

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#67: FILE: include/exec/helper-ffi.h:38:
+#define DEF_HELPER_FLAGS_1(NAME, FLAGS, ret, t1)                        \
+    static ffi_type *glue(cif_args_,NAME)[1] = { dh_ffitype(t1) };      \
+    static ffi_cif glue(cif_,NAME) = {                                  \
+        .rtype = dh_ffitype(ret), .nargs = 1,                           \
+        .arg_types = glue(cif_args_,NAME),                              \
+    };

ERROR: spaces required around that '*' (ctx:WxV)
#68: FILE: include/exec/helper-ffi.h:39:
+    static ffi_type *glue(cif_args_,NAME)[1] = { dh_ffitype(t1) };      \
                     ^

ERROR: space required after that ',' (ctx:VxV)
#68: FILE: include/exec/helper-ffi.h:39:
+    static ffi_type *glue(cif_args_,NAME)[1] = { dh_ffitype(t1) };      \
                                    ^

ERROR: open brace '{' following function declarations go on the next line
#69: FILE: include/exec/helper-ffi.h:40:
+    static ffi_cif glue(cif_,NAME) = {                                  \

ERROR: space required after that ',' (ctx:VxV)
#69: FILE: include/exec/helper-ffi.h:40:
+    static ffi_cif glue(cif_,NAME) = {                                  \
                             ^

ERROR: space required after that ',' (ctx:VxV)
#71: FILE: include/exec/helper-ffi.h:42:
+        .arg_types = glue(cif_args_,NAME),                              \
                                    ^

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#74: FILE: include/exec/helper-ffi.h:45:
+#define DEF_HELPER_FLAGS_2(NAME, FLAGS, ret, t1, t2)    \
+    static ffi_type *glue(cif_args_,NAME)[2] = {        \
+        dh_ffitype(t1), dh_ffitype(t2)                  \
+    };                                                  \
+    static ffi_cif glue(cif_,NAME) = {                  \
+        .rtype = dh_ffitype(ret), .nargs = 2,           \
+        .arg_types = glue(cif_args_,NAME),              \
+    };

ERROR: spaces required around that '*' (ctx:WxV)
#75: FILE: include/exec/helper-ffi.h:46:
+    static ffi_type *glue(cif_args_,NAME)[2] = {        \
                     ^

ERROR: space required after that ',' (ctx:VxV)
#75: FILE: include/exec/helper-ffi.h:46:
+    static ffi_type *glue(cif_args_,NAME)[2] = {        \
                                    ^

ERROR: open brace '{' following function declarations go on the next line
#78: FILE: include/exec/helper-ffi.h:49:
+    static ffi_cif glue(cif_,NAME) = {                  \

ERROR: space required after that ',' (ctx:VxV)
#78: FILE: include/exec/helper-ffi.h:49:
+    static ffi_cif glue(cif_,NAME) = {                  \
                             ^

ERROR: space required after that ',' (ctx:VxV)
#80: FILE: include/exec/helper-ffi.h:51:
+        .arg_types = glue(cif_args_,NAME),              \
                                    ^

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#83: FILE: include/exec/helper-ffi.h:54:
+#define DEF_HELPER_FLAGS_3(NAME, FLAGS, ret, t1, t2, t3)        \
+    static ffi_type *glue(cif_args_,NAME)[3] = {                \
+        dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3)          \
+    };                                                          \
+    static ffi_cif glue(cif_,NAME) = {                          \
+        .rtype = dh_ffitype(ret), .nargs = 3,                   \
+        .arg_types = glue(cif_args_,NAME),                      \
+    };

ERROR: spaces required around that '*' (ctx:WxV)
#84: FILE: include/exec/helper-ffi.h:55:
+    static ffi_type *glue(cif_args_,NAME)[3] = {                \
                     ^

ERROR: space required after that ',' (ctx:VxV)
#84: FILE: include/exec/helper-ffi.h:55:
+    static ffi_type *glue(cif_args_,NAME)[3] = {                \
                                    ^

ERROR: open brace '{' following function declarations go on the next line
#87: FILE: include/exec/helper-ffi.h:58:
+    static ffi_cif glue(cif_,NAME) = {                          \

ERROR: space required after that ',' (ctx:VxV)
#87: FILE: include/exec/helper-ffi.h:58:
+    static ffi_cif glue(cif_,NAME) = {                          \
                             ^

ERROR: space required after that ',' (ctx:VxV)
#89: FILE: include/exec/helper-ffi.h:60:
+        .arg_types = glue(cif_args_,NAME),                      \
                                    ^

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#92: FILE: include/exec/helper-ffi.h:63:
+#define DEF_HELPER_FLAGS_4(NAME, FLAGS, ret, t1, t2, t3, t4)            \
+    static ffi_type *glue(cif_args_,NAME)[4] = {                        \
+        dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3), dh_ffitype(t4)  \
+    };                                                                  \
+    static ffi_cif glue(cif_,NAME) = {                                  \
+        .rtype = dh_ffitype(ret), .nargs = 4,                           \
+        .arg_types = glue(cif_args_,NAME),                              \
+    };

ERROR: spaces required around that '*' (ctx:WxV)
#93: FILE: include/exec/helper-ffi.h:64:
+    static ffi_type *glue(cif_args_,NAME)[4] = {                        \
                     ^

ERROR: space required after that ',' (ctx:VxV)
#93: FILE: include/exec/helper-ffi.h:64:
+    static ffi_type *glue(cif_args_,NAME)[4] = {                        \
                                    ^

ERROR: open brace '{' following function declarations go on the next line
#96: FILE: include/exec/helper-ffi.h:67:
+    static ffi_cif glue(cif_,NAME) = {                                  \

ERROR: space required after that ',' (ctx:VxV)
#96: FILE: include/exec/helper-ffi.h:67:
+    static ffi_cif glue(cif_,NAME) = {                                  \
                             ^

ERROR: space required after that ',' (ctx:VxV)
#98: FILE: include/exec/helper-ffi.h:69:
+        .arg_types = glue(cif_args_,NAME),                              \
                                    ^

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#101: FILE: include/exec/helper-ffi.h:72:
+#define DEF_HELPER_FLAGS_5(NAME, FLAGS, ret, t1, t2, t3, t4, t5)        \
+    static ffi_type *glue(cif_args_,NAME)[5] = {                        \
+        dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3),                 \
+        dh_ffitype(t4), dh_ffitype(t5)                                  \
+    };                                                                  \
+    static ffi_cif glue(cif_,NAME) = {                                  \
+        .rtype = dh_ffitype(ret), .nargs = 5,                           \
+        .arg_types = glue(cif_args_,NAME),                              \
+    };

ERROR: spaces required around that '*' (ctx:WxV)
#102: FILE: include/exec/helper-ffi.h:73:
+    static ffi_type *glue(cif_args_,NAME)[5] = {                        \
                     ^

ERROR: space required after that ',' (ctx:VxV)
#102: FILE: include/exec/helper-ffi.h:73:
+    static ffi_type *glue(cif_args_,NAME)[5] = {                        \
                                    ^

ERROR: open brace '{' following function declarations go on the next line
#106: FILE: include/exec/helper-ffi.h:77:
+    static ffi_cif glue(cif_,NAME) = {                                  \

ERROR: space required after that ',' (ctx:VxV)
#106: FILE: include/exec/helper-ffi.h:77:
+    static ffi_cif glue(cif_,NAME) = {                                  \
                             ^

ERROR: space required after that ',' (ctx:VxV)
#108: FILE: include/exec/helper-ffi.h:79:
+        .arg_types = glue(cif_args_,NAME),                              \
                                    ^

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#111: FILE: include/exec/helper-ffi.h:82:
+#define DEF_HELPER_FLAGS_6(NAME, FLAGS, ret, t1, t2, t3, t4, t5, t6)    \
+    static ffi_type *glue(cif_args_,NAME)[6] = {                        \
+        dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3),                 \
+        dh_ffitype(t4), dh_ffitype(t5), dh_ffitype(t6)                  \
+    };                                                                  \
+    static ffi_cif glue(cif_,NAME) = {                                  \
+        .rtype = dh_ffitype(ret), .nargs = 6,                           \
+        .arg_types = glue(cif_args_,NAME),                              \
+    };

ERROR: spaces required around that '*' (ctx:WxV)
#112: FILE: include/exec/helper-ffi.h:83:
+    static ffi_type *glue(cif_args_,NAME)[6] = {                        \
                     ^

ERROR: space required after that ',' (ctx:VxV)
#112: FILE: include/exec/helper-ffi.h:83:
+    static ffi_type *glue(cif_args_,NAME)[6] = {                        \
                                    ^

ERROR: open brace '{' following function declarations go on the next line
#116: FILE: include/exec/helper-ffi.h:87:
+    static ffi_cif glue(cif_,NAME) = {                                  \

ERROR: space required after that ',' (ctx:VxV)
#116: FILE: include/exec/helper-ffi.h:87:
+    static ffi_cif glue(cif_,NAME) = {                                  \
                             ^

ERROR: space required after that ',' (ctx:VxV)
#118: FILE: include/exec/helper-ffi.h:89:
+        .arg_types = glue(cif_args_,NAME),                              \
                                    ^

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#121: FILE: include/exec/helper-ffi.h:92:
+#define DEF_HELPER_FLAGS_7(NAME, FLAGS, ret, t1, t2, t3, t4, t5, t6, t7) \
+    static ffi_type *glue(cif_args_,NAME)[7] = {                        \
+        dh_ffitype(t1), dh_ffitype(t2), dh_ffitype(t3),                 \
+        dh_ffitype(t4), dh_ffitype(t5), dh_ffitype(t6), dh_ffitype(t7)  \
+    };                                                                  \
+    static ffi_cif glue(cif_,NAME) = {                                  \
+        .rtype = dh_ffitype(ret), .nargs = 7,                           \
+        .arg_types = glue(cif_args_,NAME),                              \
+    };

ERROR: spaces required around that '*' (ctx:WxV)
#122: FILE: include/exec/helper-ffi.h:93:
+    static ffi_type *glue(cif_args_,NAME)[7] = {                        \
                     ^

ERROR: space required after that ',' (ctx:VxV)
#122: FILE: include/exec/helper-ffi.h:93:
+    static ffi_type *glue(cif_args_,NAME)[7] = {                        \
                                    ^

ERROR: open brace '{' following function declarations go on the next line
#126: FILE: include/exec/helper-ffi.h:97:
+    static ffi_cif glue(cif_,NAME) = {                                  \

ERROR: space required after that ',' (ctx:VxV)
#126: FILE: include/exec/helper-ffi.h:97:
+    static ffi_cif glue(cif_,NAME) = {                                  \
                             ^

ERROR: space required after that ',' (ctx:VxV)
#128: FILE: include/exec/helper-ffi.h:99:
+        .arg_types = glue(cif_args_,NAME),                              \
                                    ^

total: 55 errors, 1 warnings, 309 lines checked

Patch 37/70 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

38/70 Checking commit 7061224572bd (tcg/tci: Use ffi for calls)
ERROR: spaces required around that '+' (ctx:VxV)
#93: FILE: tcg/tcg.c:2085:
+        bool is_64bit = sizemask & (1 << (i+1)*2);
                                            ^

ERROR: spaces required around that '*' (ctx:VxV)
#93: FILE: tcg/tcg.c:2085:
+        bool is_64bit = sizemask & (1 << (i+1)*2);
                                               ^

ERROR: suspect code indent for conditional statements (8, 11)
#122: FILE: tcg/tcg.c:2104:
+        if (TCG_TARGET_REG_BITS < 64 && is_64bit) {
+           /*

total: 3 errors, 0 warnings, 380 lines checked

Patch 38/70 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

39/70 Checking commit b658bdf748c2 (tcg/tci: Improve tcg_target_call_clobber_regs)
40/70 Checking commit a8cdf4b59504 (tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order)
41/70 Checking commit e0f64b1f53b0 (tcg/tci: Push opcode emit into each case)
42/70 Checking commit 891f923a5e8d (tcg/tci: Split out tcg_out_op_rrs)
43/70 Checking commit 43b03a7a482a (tcg/tci: Split out tcg_out_op_l)
44/70 Checking commit 4e89f8e94f32 (tcg/tci: Split out tcg_out_op_p)
45/70 Checking commit 9d981cb696ce (tcg/tci: Split out tcg_out_op_rr)
46/70 Checking commit 749532228b16 (tcg/tci: Split out tcg_out_op_rrr)
47/70 Checking commit c624d631f834 (tcg/tci: Split out tcg_out_op_rrrc)
48/70 Checking commit 4e349f3024c8 (tcg/tci: Split out tcg_out_op_rrrrrc)
49/70 Checking commit dfc698a5e4a7 (tcg/tci: Split out tcg_out_op_rrrbb)
50/70 Checking commit ba38a147fdbb (tcg/tci: Split out tcg_out_op_rrcl)
51/70 Checking commit 28e84b83dd6d (tcg/tci: Split out tcg_out_op_rrrrrr)
52/70 Checking commit 80d6564e8034 (tcg/tci: Split out tcg_out_op_rrrr)
53/70 Checking commit 0639600d9269 (tcg/tci: Split out tcg_out_op_rrrrcl)
54/70 Checking commit 7715c258a91e (tcg/tci: Split out tcg_out_op_{rrm,rrrm,rrrrm})
55/70 Checking commit 878bc25538ce (tcg/tci: Split out tcg_out_op_v)
56/70 Checking commit 1d5e3b6e64a6 (tcg/tci: Split out tcg_out_op_np)
57/70 Checking commit 737c1a64f096 (tcg/tci: Split out tcg_out_op_r[iI])
58/70 Checking commit b5e61ebe266e (tcg/tci: Reserve r13 for a temporary)
59/70 Checking commit c6f6fb337877 (tcg/tci: Emit setcond before brcond)
60/70 Checking commit c8a6e415cc88 (tcg/tci: Remove tci_write_reg)
61/70 Checking commit 4888fb2af0de (tcg/tci: Change encoding to uint32_t units)
62/70 Checking commit e2c5d5b3d328 (tcg/tci: Implement goto_ptr)
63/70 Checking commit acf9fa4f54a5 (tcg/tci: Implement movcond)
64/70 Checking commit 4d08848ba871 (tcg/tci: Implement andc, orc, eqv, nand, nor)
65/70 Checking commit 7209e1f21448 (tcg/tci: Implement extract, sextract)
66/70 Checking commit a939076bac17 (tcg/tci: Implement clz, ctz, ctpop)
67/70 Checking commit 1723413e3f8e (tcg/tci: Implement mulu2, muls2)
68/70 Checking commit 657c9d38d025 (tcg/tci: Implement add2, sub2)
69/70 Checking commit 537da5c6c20d (tests/tcg: Increase timeout for TCI)
70/70 Checking commit 130a759ec343 (gitlab: Enable cross-i386 builds of TCI)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210208023752.270606-1-richard.henderson@linaro.org/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Alex Bennée March 5, 2021, 4:37 p.m. UTC | #2
Richard Henderson <richard.henderson@linaro.org> writes:

> Changes since v2:
>   * 20-something patches are now upstream.
>   * Increase testing timeout for tci.
>   * Gitlab testing for tci w/ 32-bit host.

Hmm that fails with this applied on the current master:

cc -Ilibqemu-i386-linux-user.fa.p -I. -I.. -Itarget/i386 -I../target/i386 -I../linux-user/host/i386 -Ilinux-user -I../linux-user -Ilinux-user/i386 -I../linux-user/i386 -I../capstone/include/capstone -Itrace -Iqapi -Iui -Iui/shader -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -fdiagnostics-color=auto -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -O2 -g -isystem /builds/stsquad/qemu/linux-headers -isystem linux-headers -iquote . -iquote /builds/stsquad/qemu -iquote /builds/stsquad/qemu/include -iquote /builds/stsquad/qemu/disas/libvixl -iquote /builds/stsquad/qemu/tcg/tci -iquote /builds/stsquad/qemu/accel/tcg -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m32 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -m32 -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fPIC -isystem../linux-headers -isystemlinux-headers -DNEED_CPU_H '-DCONFIG_TARGET="i386-linux-user-config-target.h"' '-DCONFIG_DEVICES="i386-linux-user-config-devices.h"' -MD -MQ libqemu-i386-linux-user.fa.p/tcg_tci.c.o -MF libqemu-i386-linux-user.fa.p/tcg_tci.c.o.d -o libqemu-i386-linux-user.fa.p/tcg_tci.c.o -c ../tcg/tci.c
../tcg/tci.c: In function 'tcg_qemu_tb_exec':
../tcg/tci.c:317:37: error: passing argument 1 of 'g2h' makes pointer from integer without a cast [-Werror=int-conversion]
  317 | # define qemu_ld_ub      ldub_p(g2h(taddr))
      |                                     ^~~~~
      |                                     |
      |                                     target_ulong {aka unsigned int}
../tcg/tci.c:923:25: note: in expansion of macro 'qemu_ld_ub'
  923 |                 tmp32 = qemu_ld_ub;
      |                         ^~~~~~~~~~

and more:

https://gitlab.com/stsquad/qemu/-/jobs/1076231320



>
>
> r~
>
>
> Richard Henderson (70):
>   gdbstub: Fix handle_query_xfer_auxv
>   tcg: Split out tcg_raise_tb_overflow
>   tcg: Manage splitwx in tc_ptr_to_region_tree by hand
>   tcg/tci: Merge identical cases in generation
>   tcg/tci: Remove tci_read_r8
>   tcg/tci: Remove tci_read_r8s
>   tcg/tci: Remove tci_read_r16
>   tcg/tci: Remove tci_read_r16s
>   tcg/tci: Remove tci_read_r32
>   tcg/tci: Remove tci_read_r32s
>   tcg/tci: Reduce use of tci_read_r64
>   tcg/tci: Merge basic arithmetic operations
>   tcg/tci: Merge extension operations
>   tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64
>   tcg/tci: Merge bswap operations
>   tcg/tci: Merge mov, not and neg operations
>   tcg/tci: Rename tci_read_r to tci_read_rval
>   tcg/tci: Split out tci_args_rrs
>   tcg/tci: Split out tci_args_rr
>   tcg/tci: Split out tci_args_rrr
>   tcg/tci: Split out tci_args_rrrc
>   tcg/tci: Split out tci_args_l
>   tcg/tci: Split out tci_args_rrrrrc
>   tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl
>   tcg/tci: Split out tci_args_ri and tci_args_rI
>   tcg/tci: Reuse tci_args_l for calls.
>   tcg/tci: Reuse tci_args_l for exit_tb
>   tcg/tci: Reuse tci_args_l for goto_tb
>   tcg/tci: Split out tci_args_rrrrrr
>   tcg/tci: Split out tci_args_rrrr
>   tcg/tci: Clean up deposit operations
>   tcg/tci: Reduce qemu_ld/st TCGMemOpIdx operand to 32-bits
>   tcg/tci: Split out tci_args_{rrm,rrrm,rrrrm}
>   tcg/tci: Hoist op_size checking into tci_args_*
>   tcg/tci: Remove tci_disas
>   tcg/tci: Implement the disassembler properly
>   tcg: Build ffi data structures for helpers
>   tcg/tci: Use ffi for calls
>   tcg/tci: Improve tcg_target_call_clobber_regs
>   tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order
>   tcg/tci: Push opcode emit into each case
>   tcg/tci: Split out tcg_out_op_rrs
>   tcg/tci: Split out tcg_out_op_l
>   tcg/tci: Split out tcg_out_op_p
>   tcg/tci: Split out tcg_out_op_rr
>   tcg/tci: Split out tcg_out_op_rrr
>   tcg/tci: Split out tcg_out_op_rrrc
>   tcg/tci: Split out tcg_out_op_rrrrrc
>   tcg/tci: Split out tcg_out_op_rrrbb
>   tcg/tci: Split out tcg_out_op_rrcl
>   tcg/tci: Split out tcg_out_op_rrrrrr
>   tcg/tci: Split out tcg_out_op_rrrr
>   tcg/tci: Split out tcg_out_op_rrrrcl
>   tcg/tci: Split out tcg_out_op_{rrm,rrrm,rrrrm}
>   tcg/tci: Split out tcg_out_op_v
>   tcg/tci: Split out tcg_out_op_np
>   tcg/tci: Split out tcg_out_op_r[iI]
>   tcg/tci: Reserve r13 for a temporary
>   tcg/tci: Emit setcond before brcond
>   tcg/tci: Remove tci_write_reg
>   tcg/tci: Change encoding to uint32_t units
>   tcg/tci: Implement goto_ptr
>   tcg/tci: Implement movcond
>   tcg/tci: Implement andc, orc, eqv, nand, nor
>   tcg/tci: Implement extract, sextract
>   tcg/tci: Implement clz, ctz, ctpop
>   tcg/tci: Implement mulu2, muls2
>   tcg/tci: Implement add2, sub2
>   tests/tcg: Increase timeout for TCI
>   gitlab: Enable cross-i386 builds of TCI
>
>  configure                                     |    3 +
>  meson.build                                   |    9 +-
>  include/exec/helper-ffi.h                     |  115 ++
>  include/exec/helper-tcg.h                     |   24 +-
>  include/tcg/tcg-opc.h                         |    6 +-
>  include/tcg/tcg.h                             |    1 +
>  target/hppa/helper.h                          |    2 +
>  target/i386/ops_sse_header.h                  |    6 +
>  target/m68k/helper.h                          |    1 +
>  target/ppc/helper.h                           |    3 +
>  tcg/tci/tcg-target-con-set.h                  |    2 +-
>  tcg/tci/tcg-target.h                          |   81 +-
>  disas/tci.c                                   |   61 -
>  gdbstub.c                                     |   17 +-
>  tcg/tcg.c                                     |  117 +-
>  tcg/tci.c                                     | 1536 ++++++++++-------
>  tcg/tci/tcg-target.c.inc                      |  926 +++++-----
>  .gitlab-ci.d/crossbuilds.yml                  |   17 +-
>  tcg/tci/README                                |   20 +-
>  .../dockerfiles/fedora-i386-cross.docker      |    1 +
>  tests/docker/dockerfiles/fedora.docker        |    1 +
>  tests/tcg/Makefile.target                     |    6 +-
>  22 files changed, 1727 insertions(+), 1228 deletions(-)
>  create mode 100644 include/exec/helper-ffi.h
>  delete mode 100644 disas/tci.c
Philippe Mathieu-Daudé March 5, 2021, 4:55 p.m. UTC | #3
On 3/5/21 5:37 PM, Alex Bennée wrote:
> 
> Richard Henderson <richard.henderson@linaro.org> writes:
> 
>> Changes since v2:
>>   * 20-something patches are now upstream.
>>   * Increase testing timeout for tci.
>>   * Gitlab testing for tci w/ 32-bit host.
> 
> Hmm that fails with this applied on the current master:
> 
> cc -Ilibqemu-i386-linux-user.fa.p -I. -I.. -Itarget/i386 -I../target/i386 -I../linux-user/host/i386 -Ilinux-user -I../linux-user -Ilinux-user/i386 -I../linux-user/i386 -I../capstone/include/capstone -Itrace -Iqapi -Iui -Iui/shader -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -fdiagnostics-color=auto -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -O2 -g -isystem /builds/stsquad/qemu/linux-headers -isystem linux-headers -iquote . -iquote /builds/stsquad/qemu -iquote /builds/stsquad/qemu/include -iquote /builds/stsquad/qemu/disas/libvixl -iquote /builds/stsquad/qemu/tcg/tci -iquote /builds/stsquad/qemu/accel/tcg -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m32 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -m32 -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fPIC -isystem../linux-headers -isystemlinux-headers -DNEED_CPU_H '-DCONFIG_TARGET="i386-linux-user-config-target.h"' '-DCONFIG_DEVICES="i386-linux-user-config-devices.h"' -MD -MQ libqemu-i386-linux-user.fa.p/tcg_tci.c.o -MF libqemu-i386-linux-user.fa.p/tcg_tci.c.o.d -o libqemu-i386-linux-user.fa.p/tcg_tci.c.o -c ../tcg/tci.c
> ../tcg/tci.c: In function 'tcg_qemu_tb_exec':
> ../tcg/tci.c:317:37: error: passing argument 1 of 'g2h' makes pointer from integer without a cast [-Werror=int-conversion]
>   317 | # define qemu_ld_ub      ldub_p(g2h(taddr))
>       |                                     ^~~~~
>       |                                     |
>       |                                     target_ulong {aka unsigned int}
> ../tcg/tci.c:923:25: note: in expansion of macro 'qemu_ld_ub'
>   923 |                 tmp32 = qemu_ld_ub;
>       |                         ^~~~~~~~~~
> 
> and more:
> 
> https://gitlab.com/stsquad/qemu/-/jobs/1076231320

This is fixed in v4 ;)

https://www.mail-archive.com/qemu-devel@nongnu.org/msg783452.html
Alex Bennée March 5, 2021, 4:55 p.m. UTC | #4
Alex Bennée <alex.bennee@linaro.org> writes:

> Richard Henderson <richard.henderson@linaro.org> writes:
>
>> Changes since v2:
>>   * 20-something patches are now upstream.
>>   * Increase testing timeout for tci.
>>   * Gitlab testing for tci w/ 32-bit host.
>
> Hmm that fails with this applied on the current master:
>
> cc -Ilibqemu-i386-linux-user.fa.p -I. -I.. -Itarget/i386 -I../target/i386 -I../linux-user/host/i386 -Ilinux-user -I../linux-user -Ilinux-user/i386 -I../linux-user/i386 -I../capstone/include/capstone -Itrace -Iqapi -Iui -Iui/shader -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -fdiagnostics-color=auto -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -O2 -g -isystem /builds/stsquad/qemu/linux-headers -isystem linux-headers -iquote . -iquote /builds/stsquad/qemu -iquote /builds/stsquad/qemu/include -iquote /builds/stsquad/qemu/disas/libvixl -iquote /builds/stsquad/qemu/tcg/tci -iquote /builds/stsquad/qemu/accel/tcg -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m32 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -m32 -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fPIC -isystem../linux-headers -isystemlinux-headers -DNEED_CPU_H '-DCONFIG_TARGET="i386-linux-user-config-target.h"' '-DCONFIG_DEVICES="i386-linux-user-config-devices.h"' -MD -MQ libqemu-i386-linux-user.fa.p/tcg_tci.c.o -MF libqemu-i386-linux-user.fa.p/tcg_tci.c.o.d -o libqemu-i386-linux-user.fa.p/tcg_tci.c.o -c ../tcg/tci.c
> ../tcg/tci.c: In function 'tcg_qemu_tb_exec':
> ../tcg/tci.c:317:37: error: passing argument 1 of 'g2h' makes pointer from integer without a cast [-Werror=int-conversion]
>   317 | # define qemu_ld_ub      ldub_p(g2h(taddr))
>       |                                     ^~~~~
>       |                                     |
>       |                                     target_ulong {aka unsigned int}
> ../tcg/tci.c:923:25: note: in expansion of macro 'qemu_ld_ub'
>   923 |                 tmp32 = qemu_ld_ub;
>       |                         ^~~~~~~~~~
>
> and more:
>
> https://gitlab.com/stsquad/qemu/-/jobs/1076231320

Looks like it was broken by:

3e8f1628e864201692aa28996f8f64f9761555af is the first bad commit
commit 3e8f1628e864201692aa28996f8f64f9761555af
Author: Richard Henderson <richard.henderson@linaro.org>
Date:   Fri Feb 12 10:48:43 2021 -0800

    exec: Use cpu_untagged_addr in g2h; split out g2h_untagged

    Use g2h_untagged in contexts that have no cpu, e.g. the binary
    loaders that operate before the primary cpu is created.  As a
    colollary, target_mmap and friends must use untagged addresses,
    since they are used by the loaders.

    Use g2h_untagged on values returned from target_mmap, as the
    kernel never applies a tag itself.

    Use g2h_untagged on all pc values.  The only current user of
    tags, aarch64, removes tags from code addresses upon branch,
    so "pc" is always untagged.

    Use g2h with the cpu context on hand wherever possible.

    Use g2h_untagged in lock_user, which will be updated soon.

    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Message-id: 20210212184902.1251044-13-richard.henderson@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


>
>
>
>>
>>
>> r~
>>
>>
>> Richard Henderson (70):
>>   gdbstub: Fix handle_query_xfer_auxv
>>   tcg: Split out tcg_raise_tb_overflow
>>   tcg: Manage splitwx in tc_ptr_to_region_tree by hand
>>   tcg/tci: Merge identical cases in generation
>>   tcg/tci: Remove tci_read_r8
>>   tcg/tci: Remove tci_read_r8s
>>   tcg/tci: Remove tci_read_r16
>>   tcg/tci: Remove tci_read_r16s
>>   tcg/tci: Remove tci_read_r32
>>   tcg/tci: Remove tci_read_r32s
>>   tcg/tci: Reduce use of tci_read_r64
>>   tcg/tci: Merge basic arithmetic operations
>>   tcg/tci: Merge extension operations
>>   tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64
>>   tcg/tci: Merge bswap operations
>>   tcg/tci: Merge mov, not and neg operations
>>   tcg/tci: Rename tci_read_r to tci_read_rval
>>   tcg/tci: Split out tci_args_rrs
>>   tcg/tci: Split out tci_args_rr
>>   tcg/tci: Split out tci_args_rrr
>>   tcg/tci: Split out tci_args_rrrc
>>   tcg/tci: Split out tci_args_l
>>   tcg/tci: Split out tci_args_rrrrrc
>>   tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl
>>   tcg/tci: Split out tci_args_ri and tci_args_rI
>>   tcg/tci: Reuse tci_args_l for calls.
>>   tcg/tci: Reuse tci_args_l for exit_tb
>>   tcg/tci: Reuse tci_args_l for goto_tb
>>   tcg/tci: Split out tci_args_rrrrrr
>>   tcg/tci: Split out tci_args_rrrr
>>   tcg/tci: Clean up deposit operations
>>   tcg/tci: Reduce qemu_ld/st TCGMemOpIdx operand to 32-bits
>>   tcg/tci: Split out tci_args_{rrm,rrrm,rrrrm}
>>   tcg/tci: Hoist op_size checking into tci_args_*
>>   tcg/tci: Remove tci_disas
>>   tcg/tci: Implement the disassembler properly
>>   tcg: Build ffi data structures for helpers
>>   tcg/tci: Use ffi for calls
>>   tcg/tci: Improve tcg_target_call_clobber_regs
>>   tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order
>>   tcg/tci: Push opcode emit into each case
>>   tcg/tci: Split out tcg_out_op_rrs
>>   tcg/tci: Split out tcg_out_op_l
>>   tcg/tci: Split out tcg_out_op_p
>>   tcg/tci: Split out tcg_out_op_rr
>>   tcg/tci: Split out tcg_out_op_rrr
>>   tcg/tci: Split out tcg_out_op_rrrc
>>   tcg/tci: Split out tcg_out_op_rrrrrc
>>   tcg/tci: Split out tcg_out_op_rrrbb
>>   tcg/tci: Split out tcg_out_op_rrcl
>>   tcg/tci: Split out tcg_out_op_rrrrrr
>>   tcg/tci: Split out tcg_out_op_rrrr
>>   tcg/tci: Split out tcg_out_op_rrrrcl
>>   tcg/tci: Split out tcg_out_op_{rrm,rrrm,rrrrm}
>>   tcg/tci: Split out tcg_out_op_v
>>   tcg/tci: Split out tcg_out_op_np
>>   tcg/tci: Split out tcg_out_op_r[iI]
>>   tcg/tci: Reserve r13 for a temporary
>>   tcg/tci: Emit setcond before brcond
>>   tcg/tci: Remove tci_write_reg
>>   tcg/tci: Change encoding to uint32_t units
>>   tcg/tci: Implement goto_ptr
>>   tcg/tci: Implement movcond
>>   tcg/tci: Implement andc, orc, eqv, nand, nor
>>   tcg/tci: Implement extract, sextract
>>   tcg/tci: Implement clz, ctz, ctpop
>>   tcg/tci: Implement mulu2, muls2
>>   tcg/tci: Implement add2, sub2
>>   tests/tcg: Increase timeout for TCI
>>   gitlab: Enable cross-i386 builds of TCI
>>
>>  configure                                     |    3 +
>>  meson.build                                   |    9 +-
>>  include/exec/helper-ffi.h                     |  115 ++
>>  include/exec/helper-tcg.h                     |   24 +-
>>  include/tcg/tcg-opc.h                         |    6 +-
>>  include/tcg/tcg.h                             |    1 +
>>  target/hppa/helper.h                          |    2 +
>>  target/i386/ops_sse_header.h                  |    6 +
>>  target/m68k/helper.h                          |    1 +
>>  target/ppc/helper.h                           |    3 +
>>  tcg/tci/tcg-target-con-set.h                  |    2 +-
>>  tcg/tci/tcg-target.h                          |   81 +-
>>  disas/tci.c                                   |   61 -
>>  gdbstub.c                                     |   17 +-
>>  tcg/tcg.c                                     |  117 +-
>>  tcg/tci.c                                     | 1536 ++++++++++-------
>>  tcg/tci/tcg-target.c.inc                      |  926 +++++-----
>>  .gitlab-ci.d/crossbuilds.yml                  |   17 +-
>>  tcg/tci/README                                |   20 +-
>>  .../dockerfiles/fedora-i386-cross.docker      |    1 +
>>  tests/docker/dockerfiles/fedora.docker        |    1 +
>>  tests/tcg/Makefile.target                     |    6 +-
>>  22 files changed, 1727 insertions(+), 1228 deletions(-)
>>  create mode 100644 include/exec/helper-ffi.h
>>  delete mode 100644 disas/tci.c
Alex Bennée March 5, 2021, 4:59 p.m. UTC | #5
Alex Bennée <alex.bennee@linaro.org> writes:

> Alex Bennée <alex.bennee@linaro.org> writes:
>
>> Richard Henderson <richard.henderson@linaro.org> writes:
>>
>>> Changes since v2:
>>>   * 20-something patches are now upstream.
>>>   * Increase testing timeout for tci.
>>>   * Gitlab testing for tci w/ 32-bit host.
>>
>> Hmm that fails with this applied on the current master:
>>
>> cc -Ilibqemu-i386-linux-user.fa.p -I. -I.. -Itarget/i386 -I../target/i386 -I../linux-user/host/i386 -Ilinux-user -I../linux-user -Ilinux-user/i386 -I../linux-user/i386 -I../capstone/include/capstone -Itrace -Iqapi -Iui -Iui/shader -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -fdiagnostics-color=auto -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -O2 -g -isystem /builds/stsquad/qemu/linux-headers -isystem linux-headers -iquote . -iquote /builds/stsquad/qemu -iquote /builds/stsquad/qemu/include -iquote /builds/stsquad/qemu/disas/libvixl -iquote /builds/stsquad/qemu/tcg/tci -iquote /builds/stsquad/qemu/accel/tcg -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m32 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -m32 -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fPIC -isystem../linux-headers -isystemlinux-headers -DNEED_CPU_H '-DCONFIG_TARGET="i386-linux-user-config-target.h"' '-DCONFIG_DEVICES="i386-linux-user-config-devices.h"' -MD -MQ libqemu-i386-linux-user.fa.p/tcg_tci.c.o -MF libqemu-i386-linux-user.fa.p/tcg_tci.c.o.d -o libqemu-i386-linux-user.fa.p/tcg_tci.c.o -c ../tcg/tci.c
>> ../tcg/tci.c: In function 'tcg_qemu_tb_exec':
>> ../tcg/tci.c:317:37: error: passing argument 1 of 'g2h' makes pointer from integer without a cast [-Werror=int-conversion]
>>   317 | # define qemu_ld_ub      ldub_p(g2h(taddr))
>>       |                                     ^~~~~
>>       |                                     |
>>       |                                     target_ulong {aka unsigned int}
>> ../tcg/tci.c:923:25: note: in expansion of macro 'qemu_ld_ub'
>>   923 |                 tmp32 = qemu_ld_ub;
>>       |                         ^~~~~~~~~~
>>
>> and more:
>>
>> https://gitlab.com/stsquad/qemu/-/jobs/1076231320
>
> Looks like it was broken by:
>
> 3e8f1628e864201692aa28996f8f64f9761555af is the first bad commit
> commit 3e8f1628e864201692aa28996f8f64f9761555af
> Author: Richard Henderson <richard.henderson@linaro.org>
> Date:   Fri Feb 12 10:48:43 2021 -0800
>
>     exec: Use cpu_untagged_addr in g2h; split out g2h_untagged
>
>     Use g2h_untagged in contexts that have no cpu, e.g. the binary
>     loaders that operate before the primary cpu is created.  As a
>     colollary, target_mmap and friends must use untagged addresses,
>     since they are used by the loaders.
>
>     Use g2h_untagged on values returned from target_mmap, as the
>     kernel never applies a tag itself.
>
>     Use g2h_untagged on all pc values.  The only current user of
>     tags, aarch64, removes tags from code addresses upon branch,
>     so "pc" is always untagged.
>
>     Use g2h with the cpu context on hand wherever possible.
>
>     Use g2h_untagged in lock_user, which will be updated soon.
>
>     Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>     Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>     Message-id: 20210212184902.1251044-13-richard.henderson@linaro.org
>     Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
<snip>

I will now move to v4 which I missed and has a fix for this ;-)