hexagon: Add scalar v75=>v81 support
v2 cover hexagon: Add scalar v75=>v81 support
Add support for the scalar opcodes from v75 through v81, and v81 machines to go along with those.
Added in v2:
- widened interrupt/CPU masks for v81
- expanded global system regs for v81
- moved 'sim' machine alias to v81qa_1
- test case to cover wider v81 interrupt masks
v1: https://lore.kernel.org/qemu-devel/[email protected]/
Brian Cain (9):
target/hexagon: add the v75, v79 and v81 CPU models target/hexagon: add the v73 J2_unpause scalar instruction target/hexagon: add the v79 instructions target/hexagon: add Y2_tlbpp as unimplemented hw/hexagon: add the V81DGB_1 and V81QA_1 machines hw/hexagon: move "sim" alias to "V81QA_1" target/hexagon: widen v81 CPU masks target/hexagon: add v81 interrupt registers tests/functional: cover v81 system registers
include/hw/hexagon/hexagon.h | 11 ++ target/hexagon/cpu-qom.h | 6 + target/hexagon/cpu.h | 4 +- target/hexagon/hex_regs.h | 42 ++++++ target/hexagon/sys_macros.h | 11 +- hw/hexagon/machine_cfg_v81dgb_1.h.inc | 73 +++++++++ hw/hexagon/machine_cfg_v81qa_1.h.inc | 73 +++++++++ target/hexagon/attribs_def.h.inc | 3 + target/hexagon/reg_fields_def.h.inc | 10 +- hw/hexagon/hexagon_dsp.c | 48 +++++- hw/hexagon/hexagon_globalreg.c | 10 ++ linux-user/hexagon/elfload.c | 6 + target/hexagon/cpu.c | 14 +- target/hexagon/cpu_helper.c | 15 +- target/hexagon/genptr.c | 8 +- target/hexagon/hex_interrupts.c | 141 ++++++++++++------ target/hexagon/op_helper.c | 58 +++++--- target/hexagon/translate.c | 8 +- tests/tcg/hexagon/check_rev_gating.c | 32 +++- tests/tcg/hexagon/v73_scalar.c | 7 + tests/tcg/hexagon/v79_scalar.c | 157 ++++++++++++++++++++ target/hexagon/tag_rev_info.c.inc | 30 +++- target/hexagon/imported/encode_pp.def | 21 +++ target/hexagon/imported/ldst.idef | 21 +++ target/hexagon/imported/system.idef | 7 + tests/functional/hexagon/test_arch_tests.py | 21 +++ tests/tcg/hexagon/meson.build | 1 + 27 files changed, 752 insertions(+), 86 deletions(-) create mode 100644 hw/hexagon/machine_cfg_v81dgb_1.h.inc create mode 100644 hw/hexagon/machine_cfg_v81qa_1.h.inc create mode 100644 tests/tcg/hexagon/v79_scalar.c
Signature · 1 line
2.34.1
PATCH v2 1/9 target/hexagon: add the v75, v79 and v81 CPU models
v73 is currently the newest core this target implements.
Add the v75, v79, v81 CPUs. New instructions to follow in subsequent commits.
--- target/hexagon/cpu-qom.h | 6 ++++++ linux-user/hexagon/elfload.c | 6 ++++++ target/hexagon/cpu.c | 3 +++ 3 files changed, 15 insertions(+)
target/hexagon/cpu-qom.h +6 -0
@@ -25,6 +25,9 @@ typedef enum {HEX_VER_V69 =0x69 ,HEX_VER_V71 =0x71 ,HEX_VER_V73 =0x73 , +HEX_VER_V75 =0x75 , +HEX_VER_V79 =0x79 , +HEX_VER_V81 =0x81 ,HEX_VER_ANY =0xff , } HexagonVersion;
@@ -49,6 +52,9 @@ typedef struct {#define TYPE_HEXAGON_CPU_V69 HEXAGON_CPU_TYPE_NAME("v69")#define TYPE_HEXAGON_CPU_V71 HEXAGON_CPU_TYPE_NAME("v71")#define TYPE_HEXAGON_CPU_V73 HEXAGON_CPU_TYPE_NAME("v73") +#define TYPE_HEXAGON_CPU_V75 HEXAGON_CPU_TYPE_NAME("v75") +#define TYPE_HEXAGON_CPU_V79 HEXAGON_CPU_TYPE_NAME("v79") +#define TYPE_HEXAGON_CPU_V81 HEXAGON_CPU_TYPE_NAME("v81")OBJECT_DECLARE_CPU_TYPE (HexagonCPU, HexagonCPUClass,HEXAGON_CPU )
linux-user/hexagon/elfload.c +6 -0
@@ -37,6 +37,12 @@ const char *get_elf_cpu_model(uint32_t eflags)return "v71" ;case 0x73 :return "v73" ; +case 0x75 : +return "v75" ; +case 0x79 : +return "v79" ; +case 0x81 : +return "v81" ; } err =snprintf (buf,sizeof (buf),"unknown (0x%x)" , eflags);
target/hexagon/cpu.c +3 -0
@@ -874,6 +874,9 @@ static const TypeInfo hexagon_cpu_type_infos[] = {DEFINE_CPU (TYPE_HEXAGON_CPU_V69 ,HEX_VER_V69 ),DEFINE_CPU (TYPE_HEXAGON_CPU_V71 ,HEX_VER_V71 ),DEFINE_CPU (TYPE_HEXAGON_CPU_V73 ,HEX_VER_V73 ), +DEFINE_CPU (TYPE_HEXAGON_CPU_V75 ,HEX_VER_V75 ), +DEFINE_CPU (TYPE_HEXAGON_CPU_V79 ,HEX_VER_V79 ), +DEFINE_CPU (TYPE_HEXAGON_CPU_V81 ,HEX_VER_V81 ), };DEFINE_TYPES (hexagon_cpu_type_infos)
Signature · 1 line
2.34.1
PATCH v2 2/9 target/hexagon: add the v73 J2_unpause scalar instruction
In reply to Brian Cainv73 already added J2_callrh and J2_jumprh but unintentionally omitted unpause. Its effect is to cause other threads' pause instructions to cease pausing, but we treat pause as a nop or a yield in RR, so unpause can safely be a nop.
While here, spell the other two v73 entries' version as HEX_VER_V73 instead of the literal 0x73, matching every other entry in the table.
--- tests/tcg/hexagon/check_rev_gating.c | 12 +++++++++--- tests/tcg/hexagon/v73_scalar.c | 7 +++++++ target/hexagon/tag_rev_info.c.inc | 5 +++-- target/hexagon/imported/encode_pp.def | 1 + target/hexagon/imported/system.idef | 3 +++ 5 files changed, 23 insertions(+), 5 deletions(-)
tests/tcg/hexagon/check_rev_gating.c +9 -3
@@ -3,9 +3,12 @@* are rejected with SIGILL. * * Compiled with -mv66 so that e_flags selects CPU v66. The test embeds -* a v68 instruction (L2_loadw_aq: "r0 = memw_aq(r0)") via .word -* encoding. The revision-gated decoder must reject it, and linux-user -* must deliver SIGILL. +* instructions from v68 through v73 via .word encoding: the assembler +* enforces the selected CPU's own minimum version, so none of these -- +* including ones it otherwise knows how to assemble at their own +* target, such as callrh or unpause -- can be written as themselves in +* a file built for v66. The revision-gated decoder must reject every +* one of them, and linux-user must deliver SIGILL. * * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. * SPDX-License-Identifier: GPL-2.0-or-later
@@ -102,6 +105,8 @@ TRY_FUNC(v73_callrh, ".word 0x50c5c000 /* callrh r5 */\n") TRY_FUNC(v73_jumprh, ".word 0x52c0c000 /* jumprh r0 */\n") +TRY_FUNC(v73_unpause, + ".word 0x57e0d000 /* unpause */\n")int main (void ) {
@@ -133,6 +138,7 @@ int main(void)assert (try_v73_callrh () ==SIGILL );assert (try_v73_jumprh () ==SIGILL ); +assert (try_v73_unpause () ==SIGILL );assert (signals_handled == expected_signals);
tests/tcg/hexagon/v73_scalar.c +7 -0
@@ -86,10 +86,17 @@ static void test_jumprh(void)check32 (res,1 ); } +static void test_unpause (void ) +{ +/* Nothing is paused, so this just needs to execute without faulting. */ + asmvolatile ("unpause\n\t" ); +} +int main () {test_callrh ();test_jumprh (); +test_unpause ();puts (err ?"FAIL" :"PASS" );return err ?1 :0 ;
target/hexagon/tag_rev_info.c.inc +3 -2
@@ -571,8 +571,9 @@ static const struct tag_rev_info tag_rev_info[XX_LAST_OPCODE] = { [F2_dfmpyhh] = { .introduced = HEX_VER_V67, .removed = HEX_VER_NONE }, [F2_dfmpylh] = { .introduced = HEX_VER_V67, .removed = HEX_VER_NONE }, [F2_dfmpyll] = { .introduced = HEX_VER_V67, .removed = HEX_VER_NONE }, - [J2_callrh] = { .introduced = 0x73, .removed = HEX_VER_NONE }, - [J2_jumprh] = { .introduced = 0x73, .removed = HEX_VER_NONE }, + [J2_callrh] = { .introduced = HEX_VER_V73, .removed = HEX_VER_NONE }, + [J2_jumprh] = { .introduced = HEX_VER_V73, .removed = HEX_VER_NONE }, + [J2_unpause] = { .introduced = HEX_VER_V73, .removed = HEX_VER_NONE }, [L2_loadw_aq] = { .introduced = HEX_VER_V68, .removed = HEX_VER_NONE }, [L4_loadd_aq] = { .introduced = HEX_VER_V68, .removed = HEX_VER_NONE }, [Y6_dmcfgrd] = { .introduced = HEX_VER_V68, .removed = HEX_VER_NONE },
target/hexagon/imported/encode_pp.def +1 -0
@@ -585,6 +585,7 @@ DEF_FIELDROW_DESC32(ICLASS_J" 0100 -------- PP------ --------","[#4] (#u8) ") DEF_ENC32(J2_trap0, ICLASS_J" 0100 00------ PP-iiiii ---iii--") DEF_ENC32(J2_trap1, ICLASS_J" 0100 10-xxxxx PP-iiiii ---iii--") DEF_ENC32(J2_pause, ICLASS_J" 0100 01----ii PP-iiiii ---iii--") +DEF_ENC32(J2_unpause,"01010111111-----PP01----000-----") DEF_FIELDROW_DESC32(ICLASS_J" 0101 -------- PP------ --------","[#5] Rd=(Rs) ") DEF_ENC32(Y2_icdatar, ICLASS_J" 0101 101sssss PP------ ---ddddd")
target/hexagon/imported/system.idef +3 -0
@@ -51,6 +51,9 @@ Q6INSN(J2_trap1,"trap1(Rx32,#u8)",ATTRIBS(A_COF,A_NOTE_NOPACKET,A_RESTRICT_NOPAC Q6INSN(J2_pause,"pause(#u8)",ATTRIBS(A_COF,A_NOTE_NOPACKET,A_RESTRICT_NOPACKET), "Enter low-power state for #u8 cycles",{fPAUSE(uiV);}) +Q6INSN(J2_unpause,"unpause",ATTRIBS(A_COF,A_NOTE_NOPACKET,A_RESTRICT_NOPACKET), +"Resume paused threads",{fUNPAUSE();}) + Q6INSN(J2_rte, "rte", ATTRIBS(A_PRIV,A_NOTE_PRIV,A_NO_TIMING_LOG), "Return from Exception", {
Signature · 1 line
2.34.1
PATCH v2 3/9 target/hexagon: add the v79 instructions
In reply to Brian Cainv79 adds a ":nt" non-temporal cache-locality hint to the post-increment store family and to dcfetch/dczeroa.
None of the ":nt" mnemonics are accepted by the assembler yet, so the new test embeds them via .word.
--- target/hexagon/attribs_def.h.inc | 2 + tests/tcg/hexagon/check_rev_gating.c | 32 +++++- tests/tcg/hexagon/v79_scalar.c | 157 ++++++++++++++++++++++++++ target/hexagon/tag_rev_info.c.inc | 23 ++++ target/hexagon/imported/encode_pp.def | 19 ++++ target/hexagon/imported/ldst.idef | 21 ++++ target/hexagon/imported/system.idef | 2 + tests/tcg/hexagon/meson.build | 1 + 8 files changed, 251 insertions(+), 6 deletions(-) create mode 100644 tests/tcg/hexagon/v79_scalar.c
target/hexagon/attribs_def.h.inc +2 -0
@@ -21,6 +21,8 @@ DEF_ATTRIB(AA_DUMMY, "Dummy Zeroth Attribute", "", "") /* Misc */ DEF_ATTRIB(EXTENSION, "Extension instruction", "", "") +DEF_ATTRIB(NA_NT, "Non-Allocating Non-Temporal instruction", "", "") + DEF_ATTRIB(PRIV, "Not available in user or guest mode", "", "") DEF_ATTRIB(GUEST, "Not available in user mode", "", "")
tests/tcg/hexagon/check_rev_gating.c +26 -6
@@ -3,12 +3,15 @@* are rejected with SIGILL. * * Compiled with -mv66 so that e_flags selects CPU v66. The test embeds -* instructions from v68 through v73 via .word encoding: the assembler -* enforces the selected CPU's own minimum version, so none of these -- -* including ones it otherwise knows how to assemble at their own -* target, such as callrh or unpause -- can be written as themselves in -* a file built for v66. The revision-gated decoder must reject every -* one of them, and linux-user must deliver SIGILL. +* instructions from v68 up through v79 via .word encoding: the +* assembler enforces the selected CPU's own minimum version, so none +* of these -- including ones it otherwise knows how to assemble at +* their own target, such as callrh or unpause -- can be written as +* themselves in a file built for v66. The v79 non-temporal hints +* (":nt") aren't known to the assembler at any target yet, so those +* would need .word regardless. The revision-gated decoder must reject +* representative instructions from each family, and linux-user must +* deliver SIGILL. * * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. * SPDX-License-Identifier: GPL-2.0-or-later
@@ -108,6 +111,17 @@ TRY_FUNC(v73_jumprh,TRY_FUNC (v73_unpause, ".word 0x57e0d000 /* unpause */\n") +TRY_FUNC (v79_storeri_pi_nt, + ".word 0xaa82c308 /* memw(r2++#4):nt = r3 */\n") +TRY_FUNC (v79_pstorerit_pi_nt, + ".word 0xaa82e308 /* if (p0) memw(r2++#4):nt = r3 */\n") +TRY_FUNC (v79_pstorerif_pi_nt, + ".word 0xaa82e30c /* if (!p0) memw(r2++#4):nt = r3 */\n") +TRY_FUNC (v79_dczeroa_nt, + ".word 0xa0c2e000 /* dczeroa(r2):nt */\n") +TRY_FUNC (v79_dcfetchbo_nt, + ".word 0x9402e000 /* dcfetch(r2+#0):nt */\n") +int main (void ) {struct sigaction act;
@@ -140,6 +154,12 @@ int main(void)assert (try_v73_jumprh () ==SIGILL );assert (try_v73_unpause () ==SIGILL ); +assert (try_v79_storeri_pi_nt () ==SIGILL ); +assert (try_v79_pstorerit_pi_nt () ==SIGILL ); +assert (try_v79_pstorerif_pi_nt () ==SIGILL ); +assert (try_v79_dczeroa_nt () ==SIGILL ); +assert (try_v79_dcfetchbo_nt () ==SIGILL ); +assert (signals_handled == expected_signals);puts ("PASS" );
tests/tcg/hexagon/v79_scalar.c new file +157 -0
157 lines not on this page · raw message
target/hexagon/tag_rev_info.c.inc +23 -0
@@ -619,6 +619,29 @@ static const struct tag_rev_info tag_rev_info[XX_LAST_OPCODE] = { [V6_vassign_tmp] = { .introduced = HEX_VER_V69, .removed = HEX_VER_NONE }, [V6_vcombine_tmp] = { .introduced = HEX_VER_V69, .removed = HEX_VER_NONE }, [V6_vmpyuhvs] = { .introduced = HEX_VER_V69, .removed = HEX_VER_NONE }, + + [S2_pstorerbf_pi_nt] = { .introduced = HEX_VER_V79, + .removed = HEX_VER_NONE }, + [S2_pstorerbt_pi_nt] = { .introduced = HEX_VER_V79, + .removed = HEX_VER_NONE }, + [S2_pstorerdf_pi_nt] = { .introduced = HEX_VER_V79, + .removed = HEX_VER_NONE }, + [S2_pstorerdt_pi_nt] = { .introduced = HEX_VER_V79, + .removed = HEX_VER_NONE }, + [S2_pstorerhf_pi_nt] = { .introduced = HEX_VER_V79, + .removed = HEX_VER_NONE }, + [S2_pstorerht_pi_nt] = { .introduced = HEX_VER_V79, + .removed = HEX_VER_NONE }, + [S2_pstorerif_pi_nt] = { .introduced = HEX_VER_V79, + .removed = HEX_VER_NONE }, + [S2_pstorerit_pi_nt] = { .introduced = HEX_VER_V79, + .removed = HEX_VER_NONE }, + [S2_storerb_pi_nt] = { .introduced = HEX_VER_V79, .removed = HEX_VER_NONE }, + [S2_storerd_pi_nt] = { .introduced = HEX_VER_V79, .removed = HEX_VER_NONE }, + [S2_storerh_pi_nt] = { .introduced = HEX_VER_V79, .removed = HEX_VER_NONE }, + [S2_storeri_pi_nt] = { .introduced = HEX_VER_V79, .removed = HEX_VER_NONE }, + [Y2_dcfetchbo_nt] = { .introduced = HEX_VER_V79, .removed = HEX_VER_NONE }, + [Y2_dczeroa_nt] = { .introduced = HEX_VER_V79, .removed = HEX_VER_NONE }, }; #endif /* HEXAGON_TAG_ARCH_TABLE_H */
target/hexagon/imported/encode_pp.def +19 -0
@@ -407,6 +407,7 @@ DEF_ENC32(R6_release_st_vi, ICLASS_ST" 000 01 11sssss PP0ttttt --1011dd") DEF_EXT_SPACE(EXTRACTW, ICLASS_LD" 001 0 000 iiiii PP0iiiii 001iiiii") DEF_ENC32(Y2_dcfetchbo, ICLASS_LD" 010 0 000 sssss PP0--iii iiiiiiii") +DEF_ENC32(Y2_dcfetchbo_nt,"10010100000sssssPP10-iiiiiiiiiii")
@@ -473,6 +474,13 @@ STD_ST_ENC(rbnew, "1 101","00ttt") STD_ST_ENC(rhnew, "1 101","01ttt") STD_ST_ENC(rinew, "1 101","10ttt") +/* Non-temporal post-increment stores: the OPC nibble's high bit, always + * 1 above, is repurposed as the "nt" hint for this addressing mode only. */ +DEF_ENC32(S2_storerb_pi_nt,"10101010000xxxxxPP0ttttt0iiii-0-") +DEF_ENC32(S2_storerh_pi_nt,"10101010010xxxxxPP0ttttt0iiii-0-") +DEF_ENC32(S2_storeri_pi_nt,"10101010100xxxxxPP0ttttt0iiii-0-") +DEF_ENC32(S2_storerd_pi_nt,"10101010110xxxxxPP0ttttt0iiii-00") + STD_PST_ENC(rb, "1 000","ttttt") STD_PST_ENC(rh, "1 010","ttttt") STD_PST_ENC(rf, "1 011","ttttt")
@@ -482,6 +490,16 @@ STD_PST_ENC(rbnew, "1 101","00ttt") STD_PST_ENC(rhnew, "1 101","01ttt") STD_PST_ENC(rinew, "1 101","10ttt") +/* Predicated forms of the non-temporal post-increment stores above. */ +DEF_ENC32(S2_pstorerbt_pi_nt,"10101010000xxxxxPP1ttttt0iiii0vv") +DEF_ENC32(S2_pstorerbf_pi_nt,"10101010000xxxxxPP1ttttt0iiii1vv") +DEF_ENC32(S2_pstorerht_pi_nt,"10101010010xxxxxPP1ttttt0iiii0vv") +DEF_ENC32(S2_pstorerhf_pi_nt,"10101010010xxxxxPP1ttttt0iiii1vv") +DEF_ENC32(S2_pstorerit_pi_nt,"10101010100xxxxxPP1ttttt0iiii0vv") +DEF_ENC32(S2_pstorerif_pi_nt,"10101010100xxxxxPP1ttttt0iiii1vv") +DEF_ENC32(S2_pstorerdt_pi_nt,"10101010110xxxxxPP1ttttt0iiii0vv") +DEF_ENC32(S2_pstorerdf_pi_nt,"10101010110xxxxxPP1ttttt0iiii1vv") + /* User */
@@ -492,6 +510,7 @@ STD_PST_ENC(rinew, "1 101","10ttt") DEF_ENC32(S2_allocframe, ICLASS_ST" 000 01 00xxxxx PP000iii iiiiiiii") DEF_ENC32(Y5_l2locka, ICLASS_ST" 000 01 11sssss PP1----- ------dd") DEF_ENC32(Y2_dczeroa, ICLASS_ST" 000 01 10sssss PP0----- --------") +DEF_ENC32(Y2_dczeroa_nt,"10100000110sssssPP1-------------") DEF_ENC32(Y2_barrier, ICLASS_ST" 100 00 00----- PP------ 000-----")
target/hexagon/imported/ldst.idef +21 -0
@@ -118,6 +118,16 @@ STD_ST_AMODES(storerh, "Rt32", "memh","Store Half integer",ATTRIBS(A_REGWRSIZE_2 STD_ST_AMODES(storerf, "Rt.H32", "memh","Store Upper Half integer",ATTRIBS(A_REGWRSIZE_2B,A_MEMSIZE_2B,A_STORE),"1",fSTORE(1,2,EA,fGETHALF(1,RtV)),1) STD_ST_AMODES(storeri, "Rt32", "memw","Store Word",ATTRIBS(A_REGWRSIZE_4B,A_MEMSIZE_4B,A_STORE),"2",fSTORE(1,4,EA,RtV),2) STD_ST_AMODES(storerd, "Rtt32","memd","Store Double integer",ATTRIBS(A_REGWRSIZE_8B,A_MEMSIZE_8B,A_STORE),"3",fSTORE(1,8,EA,RttV),3) + +/* + * Non-temporal post-increment stores: same store, with a cache-locality + * hint that a normal-priority cache line is unlikely to be reused soon. + */ +Q6INSN(S2_storerb_pi_nt,"memb(Rx32++#s4:0):nt=Rt32",ATTRIBS(A_ARCHV2,A_MEMSIZE_1B,A_STORE,A_NA_NT),"Store Byte",{fEA_REG(RxV); fPM_I(RxV,siV); fSTORE(1,1,EA,fGETBYTE(0,RtV)); }) +Q6INSN(S2_storerh_pi_nt,"memh(Rx32++#s4:1):nt=Rt32",ATTRIBS(A_REGWRSIZE_2B,A_ARCHV2,A_MEMSIZE_2B,A_STORE,A_NA_NT),"Store Half integer",{fEA_REG(RxV); fPM_I(RxV,siV); fSTORE(1,2,EA,fGETHALF(0,RtV)); }) +Q6INSN(S2_storeri_pi_nt,"memw(Rx32++#s4:2):nt=Rt32",ATTRIBS(A_REGWRSIZE_4B,A_ARCHV2,A_MEMSIZE_4B,A_STORE,A_NA_NT),"Store Word",{fEA_REG(RxV); fPM_I(RxV,siV); fSTORE(1,4,EA,RtV); }) +Q6INSN(S2_storerd_pi_nt,"memd(Rx32++#s4:3):nt=Rtt32",ATTRIBS(A_REGWRSIZE_8B,A_ARCHV2,A_MEMSIZE_8B,A_STORE,A_NA_NT),"Store Double integer",{fEA_REG(RxV); fPM_I(RxV,siV); fSTORE(1,8,EA,RttV); }) + STD_ST_AMODES(storerinew, "Nt8.new", "memw","Store Word",ATTRIBS(A_REGWRSIZE_4B,A_NOTE_NEWVAL_SLOT0,A_NVSTORE,A_NOTE_NVSLOT0,A_MEMSIZE_4B,A_STORE,A_RESTRICT_NOSLOT1_STORE),"2",fSTORE(1,4,EA,fNEWREG_ST(NtN)),2) STD_ST_AMODES(storerbnew, "Nt8.new", "memb","Store Byte",ATTRIBS(A_NOTE_NEWVAL_SLOT0,A_NVSTORE,A_NOTE_NVSLOT0,A_MEMSIZE_1B,A_STORE,A_RESTRICT_NOSLOT1_STORE),"0",fSTORE(1,1,EA,fGETBYTE(0,fNEWREG_ST(NtN))),0) STD_ST_AMODES(storerhnew, "Nt8.new", "memh","Store Half integer",ATTRIBS(A_REGWRSIZE_2B,A_NOTE_NEWVAL_SLOT0,A_NVSTORE,A_NOTE_NVSLOT0,A_MEMSIZE_2B,A_STORE,A_RESTRICT_NOSLOT1_STORE),"1",fSTORE(1,2,EA,fGETHALF(0,fNEWREG_ST(NtN))),1)
@@ -277,6 +287,17 @@ STD_PST_AMODES(storerh,"Rt32","memh","Store Half integer",ATTRIBS(A_REGWRSIZE_2B STD_PST_AMODES(storerf,"Rt.H32","memh","Store Upper Half integer",ATTRIBS(A_REGWRSIZE_2B,A_ARCHV2,A_MEMSIZE_2B,A_STORE),"1",1,fSTORE(1,2,EA,fGETHALF(1,RtV))) STD_PST_AMODES(storeri,"Rt32","memw","Store Word",ATTRIBS(A_REGWRSIZE_4B,A_ARCHV2,A_MEMSIZE_4B,A_STORE),"2",2,fSTORE(1,4,EA,RtV)) STD_PST_AMODES(storerd,"Rtt32","memd","Store Double integer",ATTRIBS(A_REGWRSIZE_8B,A_ARCHV2,A_MEMSIZE_8B,A_STORE),"3",3,fSTORE(1,8,EA,RttV)) + +/* Predicated forms of the non-temporal post-increment stores above. */ +Q6INSN(S2_pstorerbt_pi_nt,"if (Pv4) memb(Rx32++#s4:0):nt=Rt32",ATTRIBS(A_ARCHV2,A_MEMSIZE_1B,A_STORE,A_NA_NT),"Store Byte",{fEA_REG(RxV); if (fLSBOLD(PvV)){ fPM_I(RxV,siV); fSTORE(1,1,EA,fGETBYTE(0,RtV));} else {STORE_CANCEL(EA);}}) +Q6INSN(S2_pstorerbf_pi_nt,"if (!Pv4) memb(Rx32++#s4:0):nt=Rt32",ATTRIBS(A_ARCHV2,A_MEMSIZE_1B,A_STORE,A_NA_NT),"Store Byte",{fEA_REG(RxV); if (fLSBOLDNOT(PvV)){ fPM_I(RxV,siV); fSTORE(1,1,EA,fGETBYTE(0,RtV));} else {STORE_CANCEL(EA);}}) +Q6INSN(S2_pstorerht_pi_nt,"if (Pv4) memh(Rx32++#s4:1):nt=Rt32",ATTRIBS(A_REGWRSIZE_2B,A_ARCHV2,A_MEMSIZE_2B,A_STORE,A_NA_NT),"Store Half integer",{fEA_REG(RxV); if (fLSBOLD(PvV)){ fPM_I(RxV,siV); fSTORE(1,2,EA,fGETHALF(0,RtV));} else {STORE_CANCEL(EA);}}) +Q6INSN(S2_pstorerhf_pi_nt,"if (!Pv4) memh(Rx32++#s4:1):nt=Rt32",ATTRIBS(A_REGWRSIZE_2B,A_ARCHV2,A_MEMSIZE_2B,A_STORE,A_NA_NT),"Store Half integer",{fEA_REG(RxV); if (fLSBOLDNOT(PvV)){ fPM_I(RxV,siV); fSTORE(1,2,EA,fGETHALF(0,RtV));} else {STORE_CANCEL(EA);}}) +Q6INSN(S2_pstorerit_pi_nt,"if (Pv4) memw(Rx32++#s4:2):nt=Rt32",ATTRIBS(A_REGWRSIZE_4B,A_ARCHV2,A_MEMSIZE_4B,A_STORE,A_NA_NT),"Store Word",{fEA_REG(RxV); if (fLSBOLD(PvV)){ fPM_I(RxV,siV); fSTORE(1,4,EA,RtV);} else {STORE_CANCEL(EA);}}) +Q6INSN(S2_pstorerif_pi_nt,"if (!Pv4) memw(Rx32++#s4:2):nt=Rt32",ATTRIBS(A_REGWRSIZE_4B,A_ARCHV2,A_MEMSIZE_4B,A_STORE,A_NA_NT),"Store Word",{fEA_REG(RxV); if (fLSBOLDNOT(PvV)){ fPM_I(RxV,siV); fSTORE(1,4,EA,RtV);} else {STORE_CANCEL(EA);}}) +Q6INSN(S2_pstorerdt_pi_nt,"if (Pv4) memd(Rx32++#s4:3):nt=Rtt32",ATTRIBS(A_REGWRSIZE_8B,A_ARCHV2,A_MEMSIZE_8B,A_STORE,A_NA_NT),"Store Double integer",{fEA_REG(RxV); if (fLSBOLD(PvV)){ fPM_I(RxV,siV); fSTORE(1,8,EA,RttV);} else {STORE_CANCEL(EA);}}) +Q6INSN(S2_pstorerdf_pi_nt,"if (!Pv4) memd(Rx32++#s4:3):nt=Rtt32",ATTRIBS(A_REGWRSIZE_8B,A_ARCHV2,A_MEMSIZE_8B,A_STORE,A_NA_NT),"Store Double integer",{fEA_REG(RxV); if (fLSBOLDNOT(PvV)){ fPM_I(RxV,siV); fSTORE(1,8,EA,RttV);} else {STORE_CANCEL(EA);}}) + STD_PST_AMODES(storerinew,"Nt8.new","memw","Store Word",ATTRIBS(A_REGWRSIZE_4B,A_ARCHV2,A_NOTE_NEWVAL_SLOT0,A_NVSTORE,A_NOTE_NVSLOT0,A_MEMSIZE_4B,A_STORE,A_RESTRICT_NOSLOT1_STORE),"2",2,fSTORE(1,4,EA,fNEWREG_ST(NtN))) STD_PST_AMODES(storerbnew,"Nt8.new","memb","Store Byte",ATTRIBS(A_ARCHV2,A_NOTE_NEWVAL_SLOT0,A_NVSTORE,A_NOTE_NVSLOT0,A_MEMSIZE_1B,A_STORE,A_RESTRICT_NOSLOT1_STORE),"0",0,fSTORE(1,1,EA,fGETBYTE(0,fNEWREG_ST(NtN)))) STD_PST_AMODES(storerhnew,"Nt8.new","memh","Store Half integer",ATTRIBS(A_REGWRSIZE_2B,A_ARCHV2,A_NOTE_NEWVAL_SLOT0,A_NVSTORE,A_NOTE_NVSLOT0,A_MEMSIZE_2B,A_STORE,A_RESTRICT_NOSLOT1_STORE),"1",1,fSTORE(1,2,EA,fGETHALF(0,fNEWREG_ST(NtN))))
target/hexagon/imported/system.idef +2 -0
@@ -238,10 +238,12 @@ Q6INSN(Y6_dmresume,"dmresume(Rs32)",ATTRIBS(A_NOTE_NOPACKET,A_RESTRICT_NOPACKET, Q6INSN(Y2_dcfetchbo,"dcfetch(Rs32+#u11:3)",ATTRIBS(A_RESTRICT_PREFERSLOT0,A_DCFETCH,A_RESTRICT_NOSLOT1_STORE),"Data Cache Prefetch",{fEA_RI(RsV,uiV); fDCFETCH(EA);}) +Q6INSN(Y2_dcfetchbo_nt,"dcfetch(Rs32+#u11:3):nt",ATTRIBS(A_NA_NT,A_RESTRICT_PREFERSLOT0,A_DCFETCH,A_RESTRICT_NOSLOT1_STORE),"Data Cache Prefetch",{fEA_RI(RsV,uiV); fDCFETCH(EA);}) Q6INSN(Y2_dckill,"dckill",ATTRIBS(A_PRIV,A_NOTE_PRIV,A_NOTE_NOPACKET,A_RESTRICT_SLOT0ONLY,A_RESTRICT_NOPACKET,A_CACHEOP,A_DCFLUSHOP),"Data Cache Invalidate",{fDCKILL();}) Q6INSN(Y2_dczeroa,"dczeroa(Rs32)",ATTRIBS(A_STORE,A_RESTRICT_SLOT1_AOK,A_NOTE_SLOT1_AOK,A_RESTRICT_SLOT0ONLY,A_CACHEOP,A_COPBYADDRESS,A_DCZEROA),"Zero an aligned 32-byte cacheline",{fEA_REG(RsV); fDCZEROA(EA);}) +Q6INSN(Y2_dczeroa_nt,"dczeroa(Rs32):nt",ATTRIBS(A_STORE,A_RESTRICT_SLOT1_AOK,A_NOTE_SLOT1_AOK,A_RESTRICT_SLOT0ONLY,A_CACHEOP,A_COPBYADDRESS,A_DCZEROA,A_NA_NT),"Zero an aligned 32-byte cacheline",{fEA_REG(RsV); fDCZEROA(EA);}) Q6INSN(Y2_dccleana,"dccleana(Rs32)",ATTRIBS(A_RESTRICT_SLOT1_AOK,A_NOTE_SLOT1_AOK,A_RESTRICT_SLOT0ONLY,A_CACHEOP,A_COPBYADDRESS,A_DCFLUSHOP),"Data Cache Clean Address",{fEA_REG(RsV); fDCCLEANA(EA);}) Q6INSN(Y2_dccleanidx,"dccleanidx(Rs32)",ATTRIBS(A_PRIV,A_NOTE_PRIV,A_RESTRICT_PACKET_AXOK,A_NOTE_AXOK,A_RESTRICT_SLOT0ONLY,A_CACHEOP,A_COPBYIDX,A_DCFLUSHOP),"Data Cache Clean Index",{fDCCLEANIDX(RsV);}) Q6INSN(Y2_dccleaninva,"dccleaninva(Rs32)",ATTRIBS(A_RESTRICT_SLOT1_AOK,A_NOTE_SLOT1_AOK,A_RESTRICT_SLOT0ONLY,A_CACHEOP,A_COPBYADDRESS,A_DCFLUSHOP),"Data Cache Clean and Invalidate Address",{fEA_REG(RsV); fDCCLEANINVA(EA);})
tests/tcg/hexagon/meson.build +1 -0
@@ -101,6 +101,7 @@ tests += { 'v68_hvx.c': {'cflags': [cflags, '-mhvx', '-Wno-unused-function', '-mv68']}, 'v69_hvx.c': {'cflags': [cflags, '-mhvx', '-Wno-unused-function', '-mv69']}, 'v73_scalar.c': {'cflags': [cflags, '-Wno-unused-function', '-mv73']}, + 'v79_scalar.c': {'cflags': [cflags, '-Wno-unused-function', '-mv79']}, 'valid-slots.c': {'cflags': cflags}, 'vector_add_int.c': {'cflags': [cflags, '-mhvx', '-fvectorize']}, }
Signature · 1 line
2.34.1
PATCH v2 4/9 target/hexagon: add Y2_tlbpp as unimplemented
In reply to Brian CainY2_tlbpp is mostly associated with the not-yet-implemented DMA engine. Let's decode it as unimpl for now.
--- target/hexagon/sys_macros.h | 3 +++ target/hexagon/attribs_def.h.inc | 1 + target/hexagon/tag_rev_info.c.inc | 2 ++ target/hexagon/imported/encode_pp.def | 1 + target/hexagon/imported/system.idef | 2 ++ 5 files changed, 9 insertions(+)
target/hexagon/sys_macros.h +3 -0
@@ -177,6 +177,9 @@ fTLB_NONPOW2WRAP(fTLB_IDXMASK(INDEX)))#define fTLBP (TLBHI ) \ hex_tlb_lookup(env, ((TLBHI) >> 12), ((TLBHI) << 12)) +#define fTLBPP (TLBHI ) ({ \ + qemu_log_mask(LOG_UNIMP, "tlbpp is not implemented\n"); \ + 0; })#define iic_flush_cache (p)#define fIN_DEBUG_MODE (TNUM ) ({ \
target/hexagon/attribs_def.h.inc +1 -0
@@ -25,6 +25,7 @@ DEF_ATTRIB(NA_NT, "Non-Allocating Non-Temporal instruction", "", "") DEF_ATTRIB(PRIV, "Not available in user or guest mode", "", "") DEF_ATTRIB(GUEST, "Not available in user mode", "", "") +DEF_ATTRIB(TLBPP_INSN, "Extended (64-bit VA) TLB probe instruction", "", "") DEF_ATTRIB(FPOP, "Floating Point Operation", "", "")
target/hexagon/tag_rev_info.c.inc +2 -0
@@ -642,6 +642,8 @@ static const struct tag_rev_info tag_rev_info[XX_LAST_OPCODE] = { [S2_storeri_pi_nt] = { .introduced = HEX_VER_V79, .removed = HEX_VER_NONE }, [Y2_dcfetchbo_nt] = { .introduced = HEX_VER_V79, .removed = HEX_VER_NONE }, [Y2_dczeroa_nt] = { .introduced = HEX_VER_V79, .removed = HEX_VER_NONE }, + + [Y2_tlbpp] = { .introduced = HEX_VER_V81, .removed = HEX_VER_NONE }, }; #endif /* HEXAGON_TAG_ARCH_TABLE_H */
target/hexagon/imported/encode_pp.def +1 -0
@@ -890,6 +890,7 @@ DEF_ENC32(Y2_tlbunlock,ICLASS_CR" 1100 001----- PP------ 010-----") DEF_ENC32(Y2_k0lock, ICLASS_CR" 1100 001----- PP------ 011-----") DEF_ENC32(Y2_k0unlock, ICLASS_CR" 1100 001----- PP------ 100-----") DEF_ENC32(Y2_tlbp, ICLASS_CR" 1100 100sssss PP------ ---ddddd") +DEF_ENC32(Y2_tlbpp,"01101100011sssssPP---------ddddd") DEF_ENC32(Y5_tlboc, ICLASS_CR" 1100 111sssss PP------ ---ddddd") DEF_ENC32(Y5_tlbasidi, ICLASS_CR" 1100 101sssss PP------ --------") DEF_ENC32(Y2_tlbr, ICLASS_CR" 1100 010sssss PP------ ---ddddd")
target/hexagon/imported/system.idef +2 -0
@@ -118,6 +118,8 @@ Q6INSN(Y2_tlbr,"Rdd32=tlbr(Rs32)", ATTRIBS(A_PRIV,A_NOTE_PRIV,A_NOTE_NOPACKET,A_ Q6INSN(Y2_tlbp,"Rd32=tlbp(Rs32)", ATTRIBS(A_PRIV,A_NOTE_PRIV,A_NOTE_NOPACKET,A_RESTRICT_NOPACKET), "Probe TLB", {RdV=fTLBP(RsV);}) +Q6INSN(Y2_tlbpp,"Rd32=tlbp(Rss32)", ATTRIBS(A_PRIV,A_NOTE_PRIV,A_NOTE_NOPACKET,A_RESTRICT_NOPACKET,A_TLBPP_INSN), "Probe TLB64", {RdV=fTLBPP(RssV);}) + Q6INSN(Y5_tlbasidi,"tlbinvasid(Rs32)",ATTRIBS(A_PRIV,A_NOTE_PRIV,A_NOTE_NOPACKET,A_RESTRICT_NOPACKET), "Invalidate ASID", { fHIDE(int i;)
Signature · 1 line
2.34.1
PATCH v2 5/9 hw/hexagon: add the V81DGB_1 and V81QA_1 machines
In reply to Brian CainAdd these new machines that correspond to the hexagon-sim machine types.
--- include/hw/hexagon/hexagon.h | 11 ++++ target/hexagon/cpu.h | 2 +- hw/hexagon/machine_cfg_v81dgb_1.h.inc | 73 +++++++++++++++++++++++++++ hw/hexagon/machine_cfg_v81qa_1.h.inc | 73 +++++++++++++++++++++++++++ hw/hexagon/hexagon_dsp.c | 46 +++++++++++++++++ 5 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 hw/hexagon/machine_cfg_v81dgb_1.h.inc create mode 100644 hw/hexagon/machine_cfg_v81qa_1.h.inc
include/hw/hexagon/hexagon.h +11 -0
@@ -27,6 +27,8 @@ typedef enum { v71_rev =0x8c71 , v73_rev =0x8c73 , v73m_rev =0xcc73 , + v81_rev =0x8781 , + v81dgb_1_rev =0xcc81 , } Rev_t;#define HEXAGON_LATEST_REV v73#define HEXAGON_LATEST_REV_UPPER V73
@@ -129,6 +131,15 @@ union hexagon_config_table {uint32_t corecfg_present;uint32_t coproc2_fp16_acc_exp;uint32_t AXIM2_secondary_base; +uint32_t AXIM_data_width; +/* Number of L1 data cache ways */ +uint32_t l1d_ways; +/* Number of L1 instruction cache ways */ +uint32_t l1i_ways; +/* Number of L2 cache ways */ +uint32_t l2way_num; +/* Number of DMA JTLB entries */ +uint32_t dma_jtlb_entries; };uint32_t raw[HEXAGON_CFGSPACE_ENTRIES ]; };
target/hexagon/cpu.h +1 -1
@@ -50,7 +50,7 @@ typedef struct HexagonGlobalRegState HexagonGlobalRegState;#define PRED_WRITES_MAX 5/* 4 insns + endloop */ #define VSTORES_MAX 2#define MAX_TLB_ENTRIES 1024 -#define THREADS_MAX 8 +#define THREADS_MAX 16#define CPU_RESOLVING_TYPE TYPE_HEXAGON_CPU#ifndef CONFIG_USER_ONLY
hw/hexagon/machine_cfg_v81dgb_1.h.inc new file +73 -0
73 lines not on this page · raw message
hw/hexagon/machine_cfg_v81qa_1.h.inc new file +73 -0
73 lines not on this page · raw message
hw/hexagon/hexagon_dsp.c +46 -0
64 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 5/9] hw/hexagon: add the V81DGB_1 and V81QA_1 machines
Quoted 4 lines · Brian Cain
Add these new machines that correspond to the hexagon-sim machine types.
Signed-off-by Brian Cain <[email protected]>
Quoted 9 lines
--- include/hw/hexagon/hexagon.h | 11 ++++ target/hexagon/cpu.h | 2 +- hw/hexagon/machine_cfg_v81dgb_1.h.inc | 73 +++++++++++++++++++++++++++ hw/hexagon/machine_cfg_v81qa_1.h.inc | 73 +++++++++++++++++++++++++++ hw/hexagon/hexagon_dsp.c | 46 +++++++++++++++++ 5 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 hw/hexagon/machine_cfg_v81dgb_1.h.inc create mode 100644 hw/hexagon/machine_cfg_v81qa_1.h.inc
PATCH v2 6/9 hw/hexagon: move "sim" alias to "V81QA_1"
In reply to Brian CainThe 'sim' machine name is an alias for 'most up-to-date/capable hexagon-sim-style-memory-map machine', so with new v81 machines available, we'll update the alias.
--- hw/hexagon/hexagon_dsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/hexagon/hexagon_dsp.c +1 -1
@@ -194,7 +194,6 @@ static void v68n_1024_init(ObjectClass *oc, const void *data)MachineClass *mc =MACHINE_CLASS (oc); mc->desc ="Hexagon V68N_1024" ; - mc->alias ="sim" ; mc->init = v68n_1024_config_init;init_mc (mc); mc->default_cpu_type =TYPE_HEXAGON_CPU_V68 ;
@@ -228,6 +227,7 @@ static void v81qa_1_init(ObjectClass *oc, const void *data)MachineClass *mc =MACHINE_CLASS (oc); mc->desc ="Hexagon V81QA_1" ; + mc->alias ="sim" ; mc->init = v81qa_1_config_init;init_mc (mc); mc->default_cpu_type =TYPE_HEXAGON_CPU_V81 ;
Signature · 1 line
2.34.1
Re: [PATCH v2 6/9] hw/hexagon: move "sim" alias to "V81QA_1"
Quoted 9 lines · Brian Cain
The 'sim' machine name is an alias for 'most up-to-date/capable hexagon-sim-style-memory-map machine', so with new v81 machines available, we'll update the alias.
Signed-off-by Brian Cain <[email protected]>--- hw/hexagon/hexagon_dsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v2 7/9 target/hexagon: widen v81 CPU masks
In reply to Brian Cain--- target/hexagon/reg_fields_def.h.inc | 9 ++++----- target/hexagon/genptr.c | 8 ++++++-- 2 files changed, 10 insertions(+), 7 deletions(-)
target/hexagon/reg_fields_def.h.inc +4 -5
@@ -44,7 +44,7 @@ DEF_REG_FIELD(IPENDAD_IAD, 16, 16) DEF_REG_FIELD(IPENDAD_IPEND, 0, 16) DEF_REG_FIELD(SCHEDCFG_EN, 8, 1) -DEF_REG_FIELD(SCHEDCFG_INTNO, 0, 4) +DEF_REG_FIELD(SCHEDCFG_INTNO, 0, 5) DEF_REG_FIELD(BESTWAIT_PRIO, 0, 9)
@@ -109,14 +109,13 @@ DEF_REG_FIELD(SSR_SS, 30, 1) DEF_REG_FIELD(SSR_XE, 31, 1) /* misc registers */ -DEF_REG_FIELD(IMASK_MASK, 0, 16) +DEF_REG_FIELD(IMASK_MASK, 0, 32) DEF_REG_FIELD(STID_PRIO, 16, 8) DEF_REG_FIELD(STID_STID, 0, 8) -/* MODECTL fields */ -DEF_REG_FIELD(MODECTL_E, 0, 8) -DEF_REG_FIELD(MODECTL_W, 16, 8) +DEF_REG_FIELD(MODECTL_E, 0, 16) +DEF_REG_FIELD(MODECTL_W, 16, 16) DEF_REG_FIELD(CCR_L1ICP, 0, 2) DEF_REG_FIELD(CCR_L1DCP, 3, 2)
target/hexagon/genptr.c +6 -2
@@ -269,14 +269,18 @@ static const uint32_t sreg_immut_masks[NUM_SREGS] = { [HEX_SREG_SSR] = 0x00008000, [HEX_SREG_CCR] = 0x10e0ff24, [HEX_SREG_HTID] = IMMUTABLE, - [HEX_SREG_IMASK] = 0xffff0000, [HEX_SREG_GEVB] = 0x000000ff, };G_GNUC_UNUSED static void gen_log_sreg_write(DisasContext *ctx, int rnum, TCGv_i32 val) { -const uint32_t reg_mask = sreg_immut_masks[rnum]; +uint32_t reg_mask = sreg_immut_masks[rnum]; + +if (rnum ==HEX_SREG_IMASK && + ctx->hex_def->hex_version <HEX_VER_V81 ) { + reg_mask =0xffff0000 ; + }if (reg_mask !=IMMUTABLE ) {if (rnum <HEX_SREG_GLB_START ) {
Signature · 1 line
2.34.1
Re: [PATCH v2 7/9] target/hexagon: widen v81 CPU masks
Quoted 6 lines · Brian Cain
Signed-off-by Brian Cain <[email protected]>--- target/hexagon/reg_fields_def.h.inc | 9 ++++----- target/hexagon/genptr.c | 8 ++++++-- 2 files changed, 10 insertions(+), 7 deletions(-)
PATCH v2 8/9 target/hexagon: add v81 interrupt registers
In reply to Brian Cain--- target/hexagon/cpu.h | 2 +- target/hexagon/hex_regs.h | 42 +++++++++ target/hexagon/sys_macros.h | 8 +- target/hexagon/reg_fields_def.h.inc | 1 + hw/hexagon/hexagon_globalreg.c | 10 ++ target/hexagon/cpu.c | 11 ++- target/hexagon/cpu_helper.c | 15 ++- target/hexagon/hex_interrupts.c | 141 +++++++++++++++++++--------- target/hexagon/op_helper.c | 58 ++++++++---- target/hexagon/translate.c | 8 +- 10 files changed, 224 insertions(+), 72 deletions(-)
target/hexagon/cpu.h +1 -1
@@ -23,7 +23,7 @@#ifndef CONFIG_USER_ONLY #define NUM_GREGS 32#define GREG_WRITES_MAX 2 -#define NUM_SREGS 64 +#define NUM_SREGS 106#define SREG_WRITES_MAX 2#endif
target/hexagon/hex_regs.h +42 -0
48 lines not on this page · raw message
target/hexagon/sys_macros.h +6 -2
@@ -184,10 +184,14 @@#define fIN_DEBUG_MODE (TNUM ) ({ \ HexagonCPU *_cpu = env_archcpu(env); \ + bool _is_v81 = _cpu->cfg.hex_def->hex_version >= HEX_VER_V81; \ uint32_t _isdbst = _cpu->globalregs ? \ hexagon_globalreg_read(_cpu->globalregs, \ - HEX_SREG_ISDBST, env->threadId) : 0; \ - (GET_FIELD(ISDBST_DEBUGMODE, _isdbst) \ + _is_v81 ? HEX_SREG_ISDBST2 : HEX_SREG_ISDBST, \ + env->threadId) : 0; \ + ((_is_v81 ? \ + GET_FIELD(ISDBST2_DEBUGMODE, _isdbst) : \ + GET_FIELD(ISDBST_DEBUGMODE, _isdbst)) \ & (0x1 << (TNUM))) != 0; })#define fIN_DEBUG_MODE_NO_ISDB (TNUM ) false
target/hexagon/reg_fields_def.h.inc +1 -0
@@ -152,3 +152,4 @@ DEF_REG_FIELD(ISDBST_PROCMODE, 3, 1) DEF_REG_FIELD(ISDBST_MBXINSTATUS, 2, 1) DEF_REG_FIELD(ISDBST_MBXOUTSTATUS, 1, 1) DEF_REG_FIELD(ISDBST_READY, 0, 1) +DEF_REG_FIELD(ISDBST2_DEBUGMODE, 16, 16)
hw/hexagon/hexagon_globalreg.c +10 -0
@@ -84,6 +84,11 @@ static const char *hex_sreg_names[] = { [HEX_SREG_S61] = "s61", [HEX_SREG_S62] = "s62", [HEX_SREG_S63] = "s63", + [HEX_SREG_IPEND] = "ipend", + [HEX_SREG_IAD] = "iad", + [HEX_SREG_ISDBST1] = "isdbst1", + [HEX_SREG_ISDBST2] = "isdbst2", + [HEX_SREG_BRKPTINFO1] = "brkptinfo1", };static const char *get_sreg_name (uint32_t reg)
@@ -100,6 +105,8 @@ static const uint32_t global_sreg_immut_masks[NUM_SREGS] = { [HEX_SREG_MODECTL] = IMMUTABLE, [HEX_SREG_SYSCFG] = 0x80001c00, [HEX_SREG_IPENDAD] = IMMUTABLE, + [HEX_SREG_IPEND] = IMMUTABLE, + [HEX_SREG_IAD] = IMMUTABLE, [HEX_SREG_VID] = 0xfc00fc00, [HEX_SREG_VID1] = 0xfc00fc00, [HEX_SREG_BESTWAIT] = 0xfffffe00,
@@ -109,6 +116,9 @@ static const uint32_t global_sreg_immut_masks[NUM_SREGS] = { [HEX_SREG_DIAG] = 0x00000000, [HEX_SREG_REV] = IMMUTABLE, [HEX_SREG_ISDBST] = IMMUTABLE, + [HEX_SREG_ISDBST1] = IMMUTABLE, + [HEX_SREG_ISDBST2] = IMMUTABLE, + [HEX_SREG_BRKPTINFO1] = IMMUTABLE, [HEX_SREG_ISDBCFG0] = 0xe0000000, [HEX_SREG_BRKPTPC0] = 0x00000003, [HEX_SREG_BRKPTCFG0] = 0xfc007000,
target/hexagon/cpu.c +10 -1
@@ -103,7 +103,16 @@ const char * const hexagon_sregnames[] = {"pmucnt5" ,"pmucnt6" ,"pmucnt7" ,"pmucnt0" ,"pmucnt1" ,"pmucnt2" ,"pmucnt3" ,"pmuevtcfg" ,"pmustid0" ,"pmuevtcfg1" ,"pmustid1" ,"timerlo" ,"timerhi" ,"pmucfg" ,"s59" , - "s60", "s61", "s62", "s63", +"s60" ,"s61" ,"s62" ,"s63" ,"commit1t" , +"commit2t" ,"commit3t" ,"commit4t" ,"commit5t" ,"commit6t" , +"pcycle1t" ,"pcycle2t" ,"pcycle3t" ,"pcycle4t" ,"pcycle5t" , +"pcycle6t" ,"stfinst" ,"isdbcmd" ,"isdbver" ,"brkptinfo" , +"s80" ,"commit7t" ,"commit8t" ,"pcycle7t" ,"pcycle8t" , +"commit9t" ,"commit10t" ,"commit11t" ,"commit12t" ,"commit13t" , +"commit14t" ,"commit15t" ,"commit16t" ,"pcycle9t" ,"pcycle10t" , +"pcycle11t" ,"pcycle12t" ,"pcycle13t" ,"pcycle14t" ,"pcycle15t" , +"pcycle16t" ,"ipend" ,"iad" ,"isdbst1" ,"isdbst2" , + "brkptinfo1", };G_STATIC_ASSERT (NUM_SREGS ==ARRAY_SIZE (hexagon_sregnames));
target/hexagon/cpu_helper.c +11 -4
@@ -333,10 +333,17 @@ int get_exe_mode(const CPUHexagonState *env) E_bit = thread_enabled_mask & (0x1 << env->threadId); thread_wait_mask =GET_FIELD (MODECTL_W , modectl); W_bit = thread_wait_mask & (0x1 << env->threadId); - isdbst = cpu->globalregs ? -hexagon_globalreg_read (cpu->globalregs,HEX_SREG_ISDBST , - env->threadId) :0 ; - debugmode =GET_FIELD (ISDBST_DEBUGMODE , isdbst); +if (cpu->cfg.hex_def->hex_version >=HEX_VER_V81 ) { + isdbst = cpu->globalregs ? +hexagon_globalreg_read (cpu->globalregs,HEX_SREG_ISDBST2 , + env->threadId) :0 ; + debugmode =GET_FIELD (ISDBST2_DEBUGMODE , isdbst); + }else { + isdbst = cpu->globalregs ? +hexagon_globalreg_read (cpu->globalregs,HEX_SREG_ISDBST , + env->threadId) :0 ; + debugmode =GET_FIELD (ISDBST_DEBUGMODE , isdbst); + } D_bit = debugmode & (0x1 << env->threadId);if (!D_bit && !W_bit && !E_bit) {
target/hexagon/hex_interrupts.c +97 -44
189 lines not on this page · raw message
target/hexagon/op_helper.c +40 -18
102 lines not on this page · raw message
target/hexagon/translate.c +6 -2
@@ -319,6 +319,8 @@ static bool sreg_write_ends_tb(int reg_num) reg_num ==HEX_SREG_STID || reg_num ==HEX_SREG_IMASK || reg_num ==HEX_SREG_IPENDAD || + reg_num ==HEX_SREG_IPEND || + reg_num ==HEX_SREG_IAD || reg_num ==HEX_SREG_BESTWAIT || reg_num ==HEX_SREG_SCHEDCFG ; }
@@ -830,8 +832,10 @@ static void gen_sreg_writes(DisasContext *ctx)gen_helper_modify_ssr (tcg_env, ctx->t_sreg_new_value[reg_num], old_reg); }else if ((reg_num ==HEX_SREG_STID ) || - (reg_num ==HEX_SREG_IMASK ) || - (reg_num ==HEX_SREG_IPENDAD )) { + (reg_num ==HEX_SREG_IMASK ) || + (reg_num ==HEX_SREG_IPENDAD ) || + (reg_num ==HEX_SREG_IPEND ) || + (reg_num ==HEX_SREG_IAD )) {if (ctx->need_commit && reg_num <HEX_SREG_GLB_START ) {tcg_gen_mov_tl (hex_t_sreg[reg_num], ctx->t_sreg_new_value[reg_num]);
Signature · 1 line
2.34.1
Re: [PATCH v2 8/9] target/hexagon: add v81 interrupt registers
Quoted 14 lines · Brian Cain
Signed-off-by Brian Cain <[email protected]>--- target/hexagon/cpu.h | 2 +- target/hexagon/hex_regs.h | 42 +++++++++ target/hexagon/sys_macros.h | 8 +- target/hexagon/reg_fields_def.h.inc | 1 + hw/hexagon/hexagon_globalreg.c | 10 ++ target/hexagon/cpu.c | 11 ++- target/hexagon/cpu_helper.c | 15 ++- target/hexagon/hex_interrupts.c | 141 +++++++++++++++++++--------- target/hexagon/op_helper.c | 58 ++++++++---- target/hexagon/translate.c | 8 +- 10 files changed, 224 insertions(+), 72 deletions(-)
PATCH v2 9/9 tests/functional: cover v81 system registers
In reply to Brian Cain--- tests/functional/hexagon/test_arch_tests.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
tests/functional/hexagon/test_arch_tests.py +21 -0
@@ -24,6 +24,11 @@ class ArchTestsUart(QemuSystemTest): "download/v0.2.14/arch_tests_uart.tar.gz", "ce93cb90b9d757c1946dfe8fe6abcec8292b08a66546ac51b2dd48650b05fa91", ) + ASSET_SEMIHOSTING_TARBALL = Asset( + "https://github.com/qualcomm/qemu-hexagon-testing/releases/" + "download/v0.2.9/arch_tests_semihosting.tar.gz", + "f0ce731dc8dc2b861792b8bd60808cb714fd1922c0dc793af65090c0ba525bb0", + ) def run_uart_test(self, test_name: str, machine: str = "virt") -> None:
@@ -40,6 +45,18 @@ def run_uart_test(self, test_name: str, self.vm.launch() wait_for_console_pattern(self, "PASS") + def run_semihosting_test(self, test_name: str, + machine: str = "V81QA_1") -> None: + self.set_machine(machine) + self.archive_extract(self.ASSET_SEMIHOSTING_TARBALL) + target_bin = self.scratch_file('arch_tests_semihosting_package', + 'bin', test_name) + self.vm.set_console(semihosting=True) + self.set_vm_arg("-display", "none") + self.set_vm_arg("-kernel", target_bin) + self.vm.launch() + wait_for_console_pattern(self, "PASS") + def test_exceptions(self) -> None: """Tests exception delivery for trap instructions, privilege violations, and verifies SSR cause codes and ELR values.
@@ -78,6 +95,10 @@ def test_sys_regs(self) -> None: """Tests system registers.""" self.run_uart_test("test_sys_regs") + def test_sys_regs_v81(self) -> None: + """Tests V81-specific system register masks.""" + self.run_semihosting_test("test_sys_regs") + def test_threads(self) -> None: """Tests hardware thread management: start/stop, MODECTL state, per-thread HTID, shared memory, wait/resume, STID priority, and
Signature · 1 line
2.34.1
Re: [PATCH v2 9/9] tests/functional: cover v81 system registers
Quoted 5 lines · Brian Cain
Signed-off-by Brian Cain <[email protected]>--- tests/functional/hexagon/test_arch_tests.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)