hexagon: Add scalar v75=>v81 support
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.
Brian Cain (5):
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
include/hw/hexagon/hexagon.h | 11 ++ target/hexagon/cpu-qom.h | 6 + target/hexagon/cpu.h | 2 +- target/hexagon/sys_macros.h | 3 + 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 + hw/hexagon/hexagon_dsp.c | 46 ++++++++ linux-user/hexagon/elfload.c | 6 + target/hexagon/cpu.c | 3 + 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/tcg/hexagon/meson.build | 1 + 18 files changed, 496 insertions(+), 6 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 1/5 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
Re: [PATCH 1/5] target/hexagon: add the v75, v79 and v81 CPU models
Quoted 6 lines · Brian Cain
v73 is currently the newest core this target implements.
Add the v75, v79, v81 CPUs. New instructions to follow in subsequent commits.
Quoted 6 lines
Signed-off-by Brian Cain <[email protected]>--- target/hexagon/cpu-qom.h | 6 ++++++ linux-user/hexagon/elfload.c | 6 ++++++ target/hexagon/cpu.c | 3 +++ 3 files changed, 15 insertions(+)
PATCH 2/5 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
Re: [PATCH 2/5] target/hexagon: add the v73 J2_unpause scalar instruction
Quoted 9 lines · Brian Cain
v73 already added
J2_callrhandJ2_jumprhbut unintentionally omittedunpause. Its effect is to cause other threads' pause instructions to cease pausing, but we treatpauseas 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_V73instead of the literal0x73, matching every other entry in the table.
Quoted 8 lines
Signed-off-by Brian Cain <[email protected]>--- 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(-)
PATCH 3/5 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
Re: [PATCH 3/5] target/hexagon: add the v79 instructions
Quoted 8 lines · Brian Cain
v79 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.
Signed-off-by Brian Cain <[email protected]>
Quoted 11 lines
--- 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
PATCH 4/5 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
Re: [PATCH 4/5] target/hexagon: add Y2_tlbpp as unimplemented
Quoted 4 lines · Brian Cain
Y2_tlbppis mostly associated with the not-yet-implemented DMA engine. Let's decode it as unimpl for now.
Quoted 8 lines
Signed-off-by Brian Cain <[email protected]>--- 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(+)
PATCH 5/5 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 5/5] hw/hexagon: add the V81DGB_1 and V81QA_1 machines
Quoted 19 lines · Brian Cain
Add these new machines that correspond to the hexagon-sim machine types.
Signed-off-by Brian Cain <[email protected]>--- 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.inctarget/hexagon/cpu.h +0
-0
target/hexagon/cpu.h typedef struct HexagonGlobalRegState HexagonGlobalRegState; · line 53
Quoted 5 lines
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
MODECTL_E\W and SCHECFG_INTNO need updates to handle the increased number of threads too.
Re: [PATCH 5/5] hw/hexagon: add the V81DGB_1 and V81QA_1 machines
Quoted 14 lines · Marco Liebel
Quoted 13 lines · Brian Cain
Add these new machines that correspond to the hexagon-sim machine types.
Signed-off-by Brian Cain <[email protected]>--- 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
Quoted 12 lines
target/hexagon/cpu.h typedef struct HexagonGlobalRegState HexagonGlobalRegState; · line 53
Quoted 10 lines
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 16MODECTL_E\W and
SCHECFG_INTNOneed updates to handle the increased number of threads too.
I'd intended to follow up with another set of patches including some v81-specific changes like that. But on second thought they do belong with this series.
I'll make a v2 with those missing patches.