From patchwork Mon Sep 28 17:28:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 1372780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=quicinc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcdkim header.b=B5FowOwT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C0Tzt5pXcz9s0b for ; Tue, 29 Sep 2020 03:30:02 +1000 (AEST) Received: from localhost ([::1]:57654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMwyO-0002j5-Os for incoming@patchwork.ozlabs.org; Mon, 28 Sep 2020 13:30:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMwxe-0002f4-C8 for qemu-devel@nongnu.org; Mon, 28 Sep 2020 13:29:14 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:53863) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMwxY-0007v8-Lf for qemu-devel@nongnu.org; Mon, 28 Sep 2020 13:29:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1601314148; x=1632850148; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=yd9QhWuPqNTiK0L/UuOTNL4vQyXmKiQbEhbdzdEkgzU=; b=B5FowOwTDUrk+YBkyKCu/8/n5oBP/Uh+MQbU6UdpcF/EhqfJXp7ysV2J /W5FxpKZvY7mctoJEVnkzZlSZgMrnxVctpVKl2NTuqhKKwDkgVPNAswje F9mjzGFh9cM0VuFD+rLS4Gr0depFt3/TTXUQ8xHBLdNNcAA9SKke5RsfH Q=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.qualcomm.com with ESMTP; 28 Sep 2020 10:29:02 -0700 X-QCInternal: smtphost Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg03-sd.qualcomm.com with ESMTP; 28 Sep 2020 10:29:01 -0700 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id 96485FE5; Mon, 28 Sep 2020 12:29:01 -0500 (CDT) From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [RFC PATCH v4 00/29] Hexagon patch series Date: Mon, 28 Sep 2020 12:28:29 -0500 Message-Id: <1601314138-9930-1-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Received-SPF: pass client-ip=199.106.114.38; envelope-from=tsimpson@qualcomm.com; helo=alexa-out-sd-01.qualcomm.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/28 13:29:03 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.199, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ale@rev.ng, riku.voipio@iki.fi, richard.henderson@linaro.org, laurent@vivier.eu, tsimpson@quicinc.com, philmd@redhat.com, aleksandar.m.mail@gmail.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This series adds support for the Hexagon processor with Linux user support See patch 02/34 Hexagon README for detailed information. Once the series is applied, the Hexagon port will pass "make check-tcg". The series also includes Hexagon-specific tests in tcg/tests/hexagon. The series is also available at https://github.com/quic/qemu on branch small_series_v4. We have a parallel effort to make the Hexagon Linux toolchain publically available. *** Known checkpatch issues *** The following are known checkpatch errors in the series target/hexagon/reg_fields.h Complex macro target/hexagon/attribs.h Complex macro target/hexagon/decode.c Complex macro target/hexagon/q6v_decode.c Macro needs do - while target/hexagon/printinsn.c Macro needs do - while target/hexagon/gen_semantics.c Suspicious ; after while (0) target/hexagon/gen_dectree_import.c Complex macro target/hexagon/gen_dectree_import.c Suspicious ; after while (0) target/hexagon/opcodes.c Complex macro target/hexagon/iclass.h Complex macro configure.sh Line over 90 characters scripts/qemu-binfmt-conf.sh Line over 90 characters The following are known checkpatch warnings in the series target/hexagon/fma_emu.c Comments inside macro definition target/hexagon/gen_tcg_funcs.py Line over 80 characters scripts/qemu-binfmt-conf.sh Line over 80 characters *** Changes in v4 *** Convert target/hexagon/Makefile.objs to meson.build Address portions of feedback from Richard Henderson. Here is the table of items from Richard's review. Patch Item Blocker Status Use qemu softfloat Yes Use qemu decodetree.py No Several Use const when appropriate Yes Several Remove anything after g_assert_not_reached Yes DONE Several Fix log_store32/64 add/remove/add in patch series Yes DONE Several Follow naming guidelines for structs and enums Yes 4 Move decls to cpu-param.h Yes DONE 4 Remove CONFIG_USER_ONLY ifdef's Yes DONE 4 Remove DEBUG_HEXAGON Yes Partially 4 Remove stack pointer modification hack Yes DONE 4 Add property x-lldb-compat to control output Yes DONE 6 Include instruction and raw bytes in disassembly Yes 7 Use DEF_HELPER_FLAGS No 07, 26 Endianness of merge_bytes Yes 7 Fix overlap test Yes 7 Remove HELPER(debug_value)/HELPER(debug_value_i64) Yes DONE 9 Include "qemu/osdep.h" instead of Yes DONE Several Stick with stdint.h types except in imported files Yes DONE 11 Remove description from reg field definitions Yes DONE 13 Move regmap.h into decode.c Yes DONE 14, 27 Use bit mask instead of strings in decoding No 14 Add comments to decoder Yes 16 Use qemu/int128.h No 17 Squash patches dealing with imported files Yes DONE 24 Use qemu/bitops.h for instruction attributes No 24 Fix initialization of opcode_short_semantics Yes DONE 24 Change if (p == NULL) { g_assert_not_reached(); } to assert(p != NULL) No DONE 25 Expand DECL/READ/WRITE/FREE macros in generator Yes DONE 26 Rewrite fINSERT*, fEXTRACT*, f?XTN macros Yes DONE 26 Investigate fRND macro No DONE 26 Change REG = REG to (VOID)REG to suppress warning Yes DONE 27 Remove multiple includes of imported/iclass.def Yes DONE 28 Move genptr_helpers.h into genptr.c Yes DONE 28 Remove unneeded temps No DONE 28 Use tcg_gen_deposit_tl and tcg_gen_extract_tl when dealing with p3_0 No DONE 29 Size opcode_genptr[] properly and initialize with [TAG] = generate_##TAG Yes DONE 30 Don't generate helpers for overridden instructions Yes DONE Don't include "gen_tcg.h" in helper.h Yes DONE 31 Use bitmask for ctx->reg_log instead of an array Yes 31 Use tcg_gen_extract_i32 for gen_slot_cancelled_check Yes DONE 31 Properly deal with reading instructions across a page boundary and too many instructions before finding end-of-packet Yes DONE 31 Don't set PC at the beginning of every packet No 31 Don't set slot_cancelled unless needed No 31 Don't set hex_pred_written unless needed No 31 Change cancelled variable to not local Yes DONE 31 Remove unnecessary temp Yes DONE 31 Let tcg_gen_addi_tl check for zero Yes DONE 31 Move gen_exec_counters to end of TB No 31 Move end of TB handling to hexagon_tr_tb_stop Yes DONE Generate two lists for TCG functions instead of the DEF_TCG_FUNC macro Yes DONE *** Changes in v3 *** Remove substantial portions of the code to facilitate review - Plan to submit subsequent patches - Hexagon Vector eXtensions (HVX) - Circular and bit-reverse addressiong - Add/sub-with-carry - Unused insn_t and pkt_t fields - Unused instruction attributes - All TCG overrides except instructions with multiple definitions - Unused macros - Unused reg fields - COUNT_HEX_HELPERS Use Laurent's gensyscall.sh script to generate linux-user/hexagon/syscall_nr.h Handle mem_noshuf Remove "RsV = RsV" per review feedback Simplify include file structure Add directed tests in /tests/tcg/hexagon Change fWRAP_* macros to fGEN_TCG_* *** Changes in v2 *** - Use scripts/git.orderfile - Create a README with the code overview in patch 0001 - Change #define's in hex_regs.h to an enum - Replace hard coded disassembly buffer length (1028) with #define - Move Hexagon architecture types patch earlier in series - Replace #include standard header files with #include "qemu/osdep.h" - Prefix all header file #ifndef's with HEXAGON_ - Update python version to python3 - #include "tcg/tcg.h" in genptr_helpers.h - Change target/hexagon/Makefile.objs to support out-of-tree build - Updated copyright to include year 2020 - Bug fixes Fix some problems with HEX_DEBUG output Fix bug in circular addressing - Optimizations to reduce the amount of TCG code generated Change pred_written from an array to a bit mask Taylor Simpson (29): Hexagon Update MAINTAINERS file Hexagon (target/hexagon) README Hexagon (include/elf.h) ELF machine definition Hexagon (target/hexagon) scalar core definition Hexagon (disas) disassembler Hexagon (target/hexagon) register names Hexagon (target/hexagon) scalar core helpers Hexagon (target/hexagon) GDB Stub Hexagon (target/hexagon) architecture types Hexagon (target/hexagon) instruction and packet types Hexagon (target/hexagon) register fields Hexagon (target/hexagon) instruction attributes Hexagon (target/hexagon) instruction/packet decode Hexagon (target/hexagon) instruction printing Hexagon (target/hexagon) utility functions Hexagon (target/hexagon/imported) arch import Hexagon (target/hexagon) generator phase 1 - C preprocessor for semantics Hexagon (target/hexagon) generator phase 2 - generate header files Hexagon (target/hexagon) generator phase 3 - C preprocessor for decode tree Hexagon (target/hexagon) generater phase 4 - decode tree Hexagon (target/hexagon) opcode data structures Hexagon (target/hexagon) macros Hexagon (target/hexagon) instruction classes Hexagon (target/hexagon) TCG generation Hexagon (target/hexagon) TCG for instructions with multiple definitions Hexagon (target/hexagon) translation Hexagon (linux-user/hexagon) Linux user emulation Hexagon (tests/tcg/hexagon) TCG tests Hexagon build infrastructure configure | 6 + default-configs/hexagon-linux-user.mak | 1 + meson.build | 1 + include/disas/dis-asm.h | 1 + include/elf.h | 2 + linux-user/hexagon/sockbits.h | 18 + linux-user/hexagon/syscall_nr.h | 343 +++++ linux-user/hexagon/target_cpu.h | 44 + linux-user/hexagon/target_elf.h | 40 + linux-user/hexagon/target_fcntl.h | 18 + linux-user/hexagon/target_signal.h | 34 + linux-user/hexagon/target_structs.h | 46 + linux-user/hexagon/target_syscall.h | 36 + linux-user/hexagon/termbits.h | 18 + linux-user/qemu.h | 2 + linux-user/syscall_defs.h | 33 + target/hexagon/arch.h | 42 + target/hexagon/attribs.h | 32 + target/hexagon/attribs_def.h | 98 ++ target/hexagon/conv_emu.h | 50 + target/hexagon/cpu-param.h | 29 + target/hexagon/cpu.h | 159 +++ target/hexagon/cpu_bits.h | 34 + target/hexagon/decode.h | 39 + target/hexagon/fma_emu.h | 27 + target/hexagon/gen_tcg.h | 198 +++ target/hexagon/genptr.h | 25 + target/hexagon/helper.h | 31 + target/hexagon/hex_arch_types.h | 43 + target/hexagon/hex_regs.h | 83 ++ target/hexagon/iclass.h | 40 + target/hexagon/insn.h | 74 + target/hexagon/internal.h | 39 + target/hexagon/macros.h | 654 +++++++++ target/hexagon/opcodes.h | 66 + target/hexagon/printinsn.h | 26 + target/hexagon/reg_fields.h | 36 + target/hexagon/reg_fields_def.h | 41 + target/hexagon/translate.h | 89 ++ disas/hexagon.c | 62 + linux-user/elfload.c | 16 + linux-user/hexagon/cpu_loop.c | 99 ++ linux-user/hexagon/signal.c | 276 ++++ target/hexagon/arch.c | 354 +++++ target/hexagon/conv_emu.c | 369 +++++ target/hexagon/cpu.c | 314 +++++ target/hexagon/decode.c | 606 ++++++++ target/hexagon/fma_emu.c | 777 ++++++++++ target/hexagon/gdbstub.c | 47 + target/hexagon/gen_dectree_import.c | 191 +++ target/hexagon/gen_semantics.c | 88 ++ target/hexagon/genptr.c | 234 +++ target/hexagon/iclass.c | 80 ++ target/hexagon/op_helper.c | 381 +++++ target/hexagon/opcodes.c | 199 +++ target/hexagon/printinsn.c | 91 ++ target/hexagon/q6v_decode.c | 373 +++++ target/hexagon/reg_fields.c | 28 + target/hexagon/translate.c | 678 +++++++++ tests/tcg/hexagon/atomics.c | 122 ++ tests/tcg/hexagon/clrtnew.c | 56 + tests/tcg/hexagon/dual_stores.c | 60 + tests/tcg/hexagon/exec_counters.c | 57 + tests/tcg/hexagon/mem_noshuf.c | 291 ++++ tests/tcg/hexagon/misc.c | 293 ++++ tests/tcg/hexagon/preg_alias.c | 106 ++ tests/tcg/hexagon/pthread_cancel.c | 43 + tests/tcg/hexagon/sfminmax.c | 62 + MAINTAINERS | 8 + disas/meson.build | 1 + linux-user/hexagon/meson.build | 22 + linux-user/meson.build | 1 + scripts/gensyscalls.sh | 3 +- scripts/qemu-binfmt-conf.sh | 6 +- target/hexagon/README | 236 ++++ target/hexagon/dectree.py | 352 +++++ target/hexagon/gen_helper_funcs.py | 229 +++ target/hexagon/gen_helper_protos.py | 158 +++ target/hexagon/gen_op_attribs.py | 46 + target/hexagon/gen_op_regs.py | 119 ++ target/hexagon/gen_opcodes_def.py | 43 + target/hexagon/gen_printinsn.py | 185 +++ target/hexagon/gen_shortcode.py | 71 + target/hexagon/gen_tcg_func_table.py | 66 + target/hexagon/gen_tcg_funcs.py | 543 +++++++ target/hexagon/hex_common.py | 216 +++ target/hexagon/imported/allidefs.def | 30 + target/hexagon/imported/alu.idef | 1259 +++++++++++++++++ target/hexagon/imported/branch.idef | 328 +++++ target/hexagon/imported/compare.idef | 621 ++++++++ target/hexagon/imported/encode.def | 125 ++ target/hexagon/imported/encode_pp.def | 2110 ++++++++++++++++++++++++++++ target/hexagon/imported/encode_subinsn.def | 150 ++ target/hexagon/imported/float.idef | 313 +++++ target/hexagon/imported/iclass.def | 52 + target/hexagon/imported/ldst.idef | 286 ++++ target/hexagon/imported/macros.def | 1529 ++++++++++++++++++++ target/hexagon/imported/mpy.idef | 1212 ++++++++++++++++ target/hexagon/imported/shift.idef | 1067 ++++++++++++++ target/hexagon/imported/subinsns.idef | 152 ++ target/hexagon/imported/system.idef | 69 + target/hexagon/meson.build | 178 +++ target/meson.build | 1 + tests/tcg/configure.sh | 4 +- tests/tcg/hexagon/Makefile.target | 49 + tests/tcg/hexagon/first.S | 57 + tests/tcg/hexagon/float_convs.ref | 748 ++++++++++ tests/tcg/hexagon/float_madds.ref | 768 ++++++++++ 108 files changed, 22361 insertions(+), 3 deletions(-) create mode 100644 default-configs/hexagon-linux-user.mak create mode 100644 linux-user/hexagon/sockbits.h create mode 100644 linux-user/hexagon/syscall_nr.h create mode 100644 linux-user/hexagon/target_cpu.h create mode 100644 linux-user/hexagon/target_elf.h create mode 100644 linux-user/hexagon/target_fcntl.h create mode 100644 linux-user/hexagon/target_signal.h create mode 100644 linux-user/hexagon/target_structs.h create mode 100644 linux-user/hexagon/target_syscall.h create mode 100644 linux-user/hexagon/termbits.h create mode 100644 target/hexagon/arch.h create mode 100644 target/hexagon/attribs.h create mode 100644 target/hexagon/attribs_def.h create mode 100644 target/hexagon/conv_emu.h create mode 100644 target/hexagon/cpu-param.h create mode 100644 target/hexagon/cpu.h create mode 100644 target/hexagon/cpu_bits.h create mode 100644 target/hexagon/decode.h create mode 100644 target/hexagon/fma_emu.h create mode 100644 target/hexagon/gen_tcg.h create mode 100644 target/hexagon/genptr.h create mode 100644 target/hexagon/helper.h create mode 100644 target/hexagon/hex_arch_types.h create mode 100644 target/hexagon/hex_regs.h create mode 100644 target/hexagon/iclass.h create mode 100644 target/hexagon/insn.h create mode 100644 target/hexagon/internal.h create mode 100644 target/hexagon/macros.h create mode 100644 target/hexagon/opcodes.h create mode 100644 target/hexagon/printinsn.h create mode 100644 target/hexagon/reg_fields.h create mode 100644 target/hexagon/reg_fields_def.h create mode 100644 target/hexagon/translate.h create mode 100644 disas/hexagon.c create mode 100644 linux-user/hexagon/cpu_loop.c create mode 100644 linux-user/hexagon/signal.c create mode 100644 target/hexagon/arch.c create mode 100644 target/hexagon/conv_emu.c create mode 100644 target/hexagon/cpu.c create mode 100644 target/hexagon/decode.c create mode 100644 target/hexagon/fma_emu.c create mode 100644 target/hexagon/gdbstub.c create mode 100644 target/hexagon/gen_dectree_import.c create mode 100644 target/hexagon/gen_semantics.c create mode 100644 target/hexagon/genptr.c create mode 100644 target/hexagon/iclass.c create mode 100644 target/hexagon/op_helper.c create mode 100644 target/hexagon/opcodes.c create mode 100644 target/hexagon/printinsn.c create mode 100644 target/hexagon/q6v_decode.c create mode 100644 target/hexagon/reg_fields.c create mode 100644 target/hexagon/translate.c create mode 100644 tests/tcg/hexagon/atomics.c create mode 100644 tests/tcg/hexagon/clrtnew.c create mode 100644 tests/tcg/hexagon/dual_stores.c create mode 100644 tests/tcg/hexagon/exec_counters.c create mode 100644 tests/tcg/hexagon/mem_noshuf.c create mode 100644 tests/tcg/hexagon/misc.c create mode 100644 tests/tcg/hexagon/preg_alias.c create mode 100644 tests/tcg/hexagon/pthread_cancel.c create mode 100644 tests/tcg/hexagon/sfminmax.c create mode 100644 linux-user/hexagon/meson.build create mode 100644 target/hexagon/README create mode 100755 target/hexagon/dectree.py create mode 100755 target/hexagon/gen_helper_funcs.py create mode 100755 target/hexagon/gen_helper_protos.py create mode 100755 target/hexagon/gen_op_attribs.py create mode 100755 target/hexagon/gen_op_regs.py create mode 100755 target/hexagon/gen_opcodes_def.py create mode 100755 target/hexagon/gen_printinsn.py create mode 100755 target/hexagon/gen_shortcode.py create mode 100755 target/hexagon/gen_tcg_func_table.py create mode 100755 target/hexagon/gen_tcg_funcs.py create mode 100755 target/hexagon/hex_common.py create mode 100644 target/hexagon/imported/allidefs.def create mode 100644 target/hexagon/imported/alu.idef create mode 100644 target/hexagon/imported/branch.idef create mode 100644 target/hexagon/imported/compare.idef create mode 100644 target/hexagon/imported/encode.def create mode 100644 target/hexagon/imported/encode_pp.def create mode 100644 target/hexagon/imported/encode_subinsn.def create mode 100644 target/hexagon/imported/float.idef create mode 100644 target/hexagon/imported/iclass.def create mode 100644 target/hexagon/imported/ldst.idef create mode 100755 target/hexagon/imported/macros.def create mode 100644 target/hexagon/imported/mpy.idef create mode 100644 target/hexagon/imported/shift.idef create mode 100644 target/hexagon/imported/subinsns.idef create mode 100644 target/hexagon/imported/system.idef create mode 100644 target/hexagon/meson.build create mode 100644 tests/tcg/hexagon/Makefile.target create mode 100644 tests/tcg/hexagon/first.S create mode 100644 tests/tcg/hexagon/float_convs.ref create mode 100644 tests/tcg/hexagon/float_madds.ref