target/arm: Implement ARMv8.5-MemTag, system mode
v7 cover target/arm: Implement ARMv8.5-MemTag, system mode
Version 6 was back in March:
https://lists.nongnu.org/archive/html/qemu-devel/2020-03/msg03790.html
Version 7 is a rebase on master, which now contains all prereqs. In addition, two bugs fixed, pointed out by users of the branch.
I've done light testing against
https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=devel/mte-v4
I still have not implemented the arm,armv8.5-memtag OF property expected by that branch, so I have been disabling it.
r~
arch/arm64/kernel/cpufeature.c +2 -0
@@ -155,6 +155,7 @@ s64 mte_ftr_filterreturn ID_AA64PFR1_MTE_NI ; } +#if 0 /* check the DT "memory" nodes for MTE support */ for_each_node_by_type (np,"memory" ) { memory_checked = true;
@@ -167,6 +168,7 @@ s64 mte_ftr_filter mte_capable = false; return ID_AA64PFR1_MTE_NI; } +#endif return val; }
Richard Henderson (42):
target/arm: Add isar tests for mte
target/arm: Improve masking of SCR RES0 bits target/arm: Add support for MTE to SCTLR_ELx target/arm: Add support for MTE to HCR_EL2 and SCR_EL3 target/arm: Rename DISAS_UPDATE to DISAS_UPDATE_EXIT target/arm: Add DISAS_UPDATE_NOCHAIN
target/arm: Add MTE system registers
target/arm: Add MTE bits to tb_flags
target/arm: Implement the IRG instruction target/arm: Implement the ADDG, SUBG instructions target/arm: Implement the GMI instruction target/arm: Implement the SUBP instruction target/arm: Define arm_cpu_do_unaligned_access for user-only target/arm: Add helper_probe_access
target/arm: Implement LDG, STG, ST2G instructions target/arm: Implement the STGP instruction target/arm: Restrict the values of DCZID.BS under TCG target/arm: Simplify DC_ZVA
target/arm: Implement the LDGM, STGM, STZGM instructions target/arm: Implement the access tag cache flushes target/arm: Move regime_el to internals.h target/arm: Move regime_tcr to internals.h target/arm: Add gen_mte_check1
target/arm: Add gen_mte_checkN
target/arm: Implement helper_mte_check1
target/arm: Implement helper_mte_checkN
target/arm: Add helper_mte_check_zva
target/arm: Use mte_checkN for sve unpredicated loads target/arm: Use mte_checkN for sve unpredicated stores target/arm: Use mte_check1 for sve LD1R
target/arm: Add mte helpers for sve scalar + int loads target/arm: Add mte helpers for sve scalar + int stores target/arm: Add mte helpers for sve scalar + int ff/nf loads target/arm: Handle TBI for sve scalar + int memory ops target/arm: Add mte helpers for sve scatter/gather memory ops target/arm: Complete TBI clearing for user-only for SVE target/arm: Implement data cache set allocation tags target/arm: Set PSTATE.TCO on exception entry target/arm: Enable MTE
target/arm: Cache the Tagged bit for a page in MemTxAttrs target/arm: Create tagged ram when MTE is enabled target/arm: Add allocation tag storage for system mode
target/arm/cpu.h | 36 +- target/arm/helper-a64.h | 16 + target/arm/helper-sve.h | 491 +++++++++++ target/arm/helper.h | 2 + target/arm/internals.h | 148 ++++ target/arm/translate-a64.h | 5 + target/arm/translate.h | 23 +- hw/arm/virt.c | 52 ++ linux-user/aarch64/cpu_loop.c | 7 + linux-user/arm/cpu_loop.c | 7 + target/arm/cpu.c | 77 +- target/arm/cpu64.c | 1 + target/arm/helper-a64.c | 94 +-- target/arm/helper.c | 350 ++++++-- target/arm/mte_helper.c | 897 ++++++++++++++++++++ target/arm/op_helper.c | 16 + target/arm/sve_helper.c | 746 ++++++++++++++--- target/arm/tlb_helper.c | 41 +- target/arm/translate-a64.c | 607 ++++++++++++-- target/arm/translate-sve.c | 1421 ++++++++++++++++++++------------ target/arm/translate-vfp.inc.c | 2 +- target/arm/translate.c | 16 +- target/arm/Makefile.objs | 1 + 23 files changed, 4206 insertions(+), 850 deletions(-) create mode 100644 target/arm/mte_helper.c
Signature · 1 line
2.25.1
PATCH v7 1/42 target/arm: Add isar tests for mte
--- target/arm/cpu.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
target/arm/cpu.h +10 -0
@@ -3814,6 +3814,16 @@ static inline bool isar_feature_aa64_bti(const ARMISARegisters *id)return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,BT ) !=0 ; } +static inline bool isar_feature_aa64_mte_insn_reg (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,MTE ) !=0 ; +} + +static inline bool isar_feature_aa64_mte (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,MTE ) >=2 ; +} +static inline bool isar_feature_aa64_pmu_8_1 (const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 4 &&
Signature · 1 line
2.25.1
Re: [PATCH v7 01/42] target/arm: Add isar tests for mte
Quoted 3 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v7 2/42 target/arm: Improve masking of SCR RES0 bits
In reply to Richard HendersonProtect reads of aa64 id registers with ARM_CP_STATE_AA64. Use this as a simpler test than arm_el_is_aa64, since EL3 cannot change mode.
--- target/arm/helper.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
target/arm/helper.c +8 -7
@@ -2011,9 +2011,16 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)uint32_t valid_mask =0x3fff ;ARMCPU *cpu =env_archcpu (env); -if (arm_el_is_aa64 (env,3 )) { +if (ri->state ==ARM_CP_STATE_AA64 ) { value |=SCR_FW |SCR_AW ;/* these two bits are RES1. */ valid_mask &= ~SCR_NET ; + +if (cpu_isar_feature (aa64_lor, cpu)) { + valid_mask |=SCR_TLOR ; + } +if (cpu_isar_feature (aa64_pauth, cpu)) { + valid_mask |=SCR_API |SCR_APK ; + } }else { valid_mask &= ~(SCR_RW |SCR_ST ); }
@@ -2032,12 +2039,6 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) valid_mask &= ~SCR_SMD ; } } -if (cpu_isar_feature (aa64_lor, cpu)) { - valid_mask |=SCR_TLOR ; - } -if (cpu_isar_feature (aa64_pauth, cpu)) { - valid_mask |=SCR_API |SCR_APK ; - }/* Clear all-context RES0 bits. */ value &= valid_mask;
Signature · 1 line
2.25.1
Re: [PATCH v7 02/42] target/arm: Improve masking of SCR RES0 bits
Quoted 6 lines · Richard Henderson
Protect reads of aa64 id registers with
ARM_CP_STATE_AA64. Use this as a simpler test thanarm_el_is_aa64, since EL3 cannot change mode.Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v7 3/42 target/arm: Add support for MTE to SCTLR_ELx
In reply to Richard HendersonThis does not attempt to rectify all of the res0 bits, but does clear the mte bits when not enabled. Since there is no high-part mapping of SCTLR, aa32 mode cannot write to these bits.
--- target/arm/helper.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
target/arm/helper.c +17 -6
@@ -4698,6 +4698,22 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, {ARMCPU *cpu =env_archcpu (env); +if (arm_feature (env,ARM_FEATURE_PMSA ) && !cpu->has_mpu) { +/* M bit is RAZ/WI for PMSA with no MPU implemented */ + value &= ~SCTLR_M ; + } + +/* ??? Lots of these bits are not implemented. */ + +if (ri->state ==ARM_CP_STATE_AA64 && !cpu_isar_feature (aa64_mte, cpu)) { +if (ri->opc1 ==6 ) {/* SCTLR_EL3 */ + value &= ~(SCTLR_ITFSB |SCTLR_TCF |SCTLR_ATA ); + }else { + value &= ~(SCTLR_ITFSB |SCTLR_TCF0 |SCTLR_TCF | +SCTLR_ATA0 |SCTLR_ATA ); + } + } +if (raw_read (env, ri) == value) {/* Skip the TLB flush if nothing actually changed; Linux likes * to do a lot of pointless SCTLR writes.
@@ -4705,13 +4721,8 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,return ; } -if (arm_feature (env,ARM_FEATURE_PMSA ) && !cpu->has_mpu) { -/* M bit is RAZ/WI for PMSA with no MPU implemented */ - value &= ~SCTLR_M ; - } -raw_write (env, ri, value); -/* ??? Lots of these bits are not implemented. */ +/* This may enable/disable the MMU, so do a TLB flush. */ tlb_flush (CPU (cpu));
Signature · 1 line
2.25.1
Re: [PATCH v7 03/42] target/arm: Add support for MTE to SCTLR_ELx
Quoted 22 lines · Richard Henderson
This does not attempt to rectify all of the res0 bits, but does clear the mte bits when not enabled. Since there is no high-part mapping of SCTLR, aa32 mode cannot write to these bits.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/helper.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)target/arm/helper.c +4
-0@@ -4698,6 +4698,22 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, {ARMCPU *cpu =env_archcpu (env); +if (arm_feature (env,ARM_FEATURE_PMSA ) && !cpu->has_mpu) { +/* M bit is RAZ/WI for PMSA with no MPU implemented */ + value &= ~SCTLR_M ; + }
target/arm/helper.c static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, · line 4714
Quoted 10 lines
target/arm/helper.c +10
-0+ +/* ??? Lots of these bits are not implemented. */ + +if (ri->state ==ARM_CP_STATE_AA64 && !cpu_isar_feature (aa64_mte, cpu)) { +if (ri->opc1 ==6 ) {/* SCTLR_EL3 */ + value &= ~(SCTLR_ITFSB |SCTLR_TCF |SCTLR_ATA ); + }else { + value &= ~(SCTLR_ITFSB |SCTLR_TCF0 |SCTLR_TCF | +SCTLR_ATA0 |SCTLR_ATA ); + }
Doesn't SCTLR_EL2 have the same "no ATA0 and no TCF0" that SCTLR_EL3 does?
thanks
-- PMM
Re: [PATCH v7 03/42] target/arm: Add support for MTE to SCTLR_ELx
Quoted 10 lines · Peter Maydell
target/arm/helper.c static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, · line 4714
Quoted 7 lines
target/arm/helper.c +7
-0+if (ri->state ==ARM_CP_STATE_AA64 && !cpu_isar_feature (aa64_mte, cpu)) { +if (ri->opc1 ==6 ) {/* SCTLR_EL3 */ + value &= ~(SCTLR_ITFSB |SCTLR_TCF |SCTLR_ATA ); + }else { + value &= ~(SCTLR_ITFSB |SCTLR_TCF0 |SCTLR_TCF | +SCTLR_ATA0 |SCTLR_ATA ); + }Doesn't
SCTLR_EL2have the same "no ATA0 and no TCF0" thatSCTLR_EL3does?
No. With HCR.{E2H,TGE} = '11', those fields are present.
r~
Peter Maydell
Reviewed-byRe: [PATCH v7 03/42] target/arm: Add support for MTE to SCTLR_ELx
Quoted 10 lines · Richard Henderson
Quoted 8 lines · Peter Maydell
Quoted 7 lines
target/arm/helper.c +7
-0+if (ri->state ==ARM_CP_STATE_AA64 && !cpu_isar_feature (aa64_mte, cpu)) { +if (ri->opc1 ==6 ) {/* SCTLR_EL3 */ + value &= ~(SCTLR_ITFSB |SCTLR_TCF |SCTLR_ATA ); + }else { + value &= ~(SCTLR_ITFSB |SCTLR_TCF0 |SCTLR_TCF | +SCTLR_ATA0 |SCTLR_ATA ); + }
Quoted 4 lines
Quoted 2 lines
Doesn't
SCTLR_EL2have the same "no ATA0 and no TCF0" thatSCTLR_EL3does?No. With HCR.{E2H,TGE} = '11', those fields are present.
Ah, right.
thanks
-- PMM
PATCH v7 4/42 target/arm: Add support for MTE to HCR_EL2 and SCR_EL3
In reply to Richard Henderson--- target/arm/helper.c | 6 ++++++ 1 file changed, 6 insertions(+)
target/arm/helper.c +6 -0
@@ -2021,6 +2021,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)if (cpu_isar_feature (aa64_pauth, cpu)) { valid_mask |=SCR_API |SCR_APK ; } +if (cpu_isar_feature (aa64_mte, cpu)) { + valid_mask |=SCR_ATA ; + } }else { valid_mask &= ~(SCR_RW |SCR_ST ); }
@@ -5248,6 +5251,9 @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)if (cpu_isar_feature (aa64_pauth, cpu)) { valid_mask |=HCR_API |HCR_APK ; } +if (cpu_isar_feature (aa64_mte, cpu)) { + valid_mask |=HCR_ATA |HCR_TID5 ; + } }/* Clear RES0 bits. */
Signature · 1 line
2.25.1
Re: [PATCH v7 04/42] target/arm: Add support for MTE to HCR_EL2 and SCR_EL3
Quoted 5 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/helper.c | 6 ++++++ 1 file changed, 6 insertions(+)
thanks
-- PMM
PATCH v7 5/42 target/arm: Rename DISAS_UPDATE to DISAS_UPDATE_EXIT
In reply to Richard HendersonEmphasize that the is_jmp option exits to the main loop.
--- target/arm/translate.h | 14 ++++++++------ target/arm/translate-a64.c | 8 ++++---- target/arm/translate-vfp.inc.c | 2 +- target/arm/translate.c | 12 ++++++------ 4 files changed, 19 insertions(+), 17 deletions(-)
target/arm/translate.h +8 -6
@@ -148,7 +148,8 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)/* is_jmp field values */ #define DISAS_JUMP DISAS_TARGET_0/* only pc was modified dynamically */ -#define DISAS_UPDATE DISAS_TARGET_1/* cpu state was modified dynamically */ +/* CPU state was modified dynamically; exit to main loop for interrupts. */ +#define DISAS_UPDATE_EXIT DISAS_TARGET_1/* These instructions trap after executing, so the A32/T32 decoder must * defer them until after the conditional execution state has been updated. * WFI also needs special handling when single-stepping.
@@ -164,11 +165,12 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)* custom end-of-TB code) */ #define DISAS_BX_EXCRET DISAS_TARGET_8 -/* For instructions which want an immediate exit to the main loop, -* as opposed to attempting to use lookup_and_goto_ptr. Unlike -* DISAS_UPDATE this doesn't write the PC on exiting the translation -* loop so you need to ensure something (gen_a64_set_pc_im or runtime -* helper) has done so before we reach return from cpu_tb_exec. +/* +* For instructions which want an immediate exit to the main loop, as opposed +* to attempting to use lookup_and_goto_ptr. Unlike DISAS_UPDATE_EXIT, this +* doesn't write the PC on exiting the translation loop so you need to ensure +* something (gen_a64_set_pc_im or runtime helper) has done so before we reach +* return from cpu_tb_exec. */ #define DISAS_EXIT DISAS_TARGET_9
target/arm/translate-a64.c +4 -4
@@ -1607,7 +1607,7 @@ static void handle_msr_i(DisasContext *s, uint32_t insn,gen_helper_msr_i_daifclear (cpu_env, t1);tcg_temp_free_i32 (t1);/* For DAIFClear, exit the cpu loop to re-evaluate pending IRQs. */ - s->base.is_jmp =DISAS_UPDATE ; + s->base.is_jmp =DISAS_UPDATE_EXIT ;break ;default :
@@ -1786,7 +1786,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,if ((tb_cflags (s->base.tb) &CF_USE_ICOUNT ) && (ri->type &ARM_CP_IO )) {/* I/O operations must end the TB here (whether read or write) */ - s->base.is_jmp =DISAS_UPDATE ; + s->base.is_jmp =DISAS_UPDATE_EXIT ; }if (!isread && !(ri->type &ARM_CP_SUPPRESS_TB_END )) {/*
@@ -1801,7 +1801,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,* but allow this to be suppressed by the register definition * (usually only necessary to work around guest bugs). */ - s->base.is_jmp =DISAS_UPDATE ; + s->base.is_jmp =DISAS_UPDATE_EXIT ; } }
@@ -14334,7 +14334,7 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)gen_goto_tb (dc,1 , dc->base.pc_next);break ;default : -case DISAS_UPDATE : +case DISAS_UPDATE_EXIT :gen_a64_set_pc_im (dc->base.pc_next);/* fall through */ case DISAS_EXIT :
target/arm/translate-vfp.inc.c +1 -1
@@ -2861,6 +2861,6 @@ static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a)tcg_temp_free_i32 (fptr);/* End the TB, because we have updated FP control bits */ - s->base.is_jmp =DISAS_UPDATE ; + s->base.is_jmp =DISAS_UPDATE_EXIT ;return true; }
target/arm/translate.c +6 -6
@@ -2931,7 +2931,7 @@ static void gen_msr_banked(DisasContext *s, int r, int sysm, int rn)tcg_temp_free_i32 (tcg_tgtmode);tcg_temp_free_i32 (tcg_regno);tcg_temp_free_i32 (tcg_reg); - s->base.is_jmp =DISAS_UPDATE ; + s->base.is_jmp =DISAS_UPDATE_EXIT ; }static void gen_mrs_banked (DisasContext *s,int r,int sysm,int rn)
@@ -2953,7 +2953,7 @@ static void gen_mrs_banked(DisasContext *s, int r, int sysm, int rn)tcg_temp_free_i32 (tcg_tgtmode);tcg_temp_free_i32 (tcg_regno);store_reg (s, rn, tcg_reg); - s->base.is_jmp =DISAS_UPDATE ; + s->base.is_jmp =DISAS_UPDATE_EXIT ; }/* Store value to PC as for an exception return (ie don't
@@ -7312,7 +7312,7 @@ static void gen_srs(DisasContext *s,tcg_temp_free_i32 (tmp); }tcg_temp_free_i32 (addr); - s->base.is_jmp =DISAS_UPDATE ; + s->base.is_jmp =DISAS_UPDATE_EXIT ; }/* Generate a label used for skipping this instruction */
@@ -10361,7 +10361,7 @@ static bool trans_SETEND(DisasContext *s, arg_SETEND *a) }if (a->E != (s->be_data ==MO_BE )) {gen_helper_setend (cpu_env); - s->base.is_jmp =DISAS_UPDATE ; + s->base.is_jmp =DISAS_UPDATE_EXIT ; }return true; }
@@ -11084,7 +11084,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)break ;case DISAS_NEXT :case DISAS_TOO_MANY : -case DISAS_UPDATE : +case DISAS_UPDATE_EXIT :gen_set_pc_im (dc, dc->base.pc_next);/* fall through */ default :
@@ -11111,7 +11111,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)case DISAS_JUMP :gen_goto_ptr ();break ; -case DISAS_UPDATE : +case DISAS_UPDATE_EXIT :gen_set_pc_im (dc, dc->base.pc_next);/* fall through */ default :
Signature · 1 line
2.25.1
Re: [PATCH v7 05/42] target/arm: Rename DISAS_UPDATE to DISAS_UPDATE_EXIT
Quoted 4 lines · Richard Henderson
Emphasize that the
is_jmpoption exits to the main loop.Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v7 6/42 target/arm: Add DISAS_UPDATE_NOCHAIN
In reply to Richard HendersonAdd an option that writes back the PC, like DISAS_UPDATE_EXIT, but does not exit back to the main loop.
--- target/arm/translate.h | 2 ++ target/arm/translate-a64.c | 3 +++ target/arm/translate.c | 4 ++++ 3 files changed, 9 insertions(+)
target/arm/translate.h +2 -0
@@ -173,6 +173,8 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)* return from cpu_tb_exec. */ #define DISAS_EXIT DISAS_TARGET_9 +/* CPU state was modified dynamically; no need to exit, but do not chain. */ +#define DISAS_UPDATE_NOCHAIN DISAS_TARGET_10#ifdef TARGET_AARCH64 void a64_translate_init (void );
target/arm/translate-a64.c +3 -0
@@ -14340,6 +14340,9 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)case DISAS_EXIT :tcg_gen_exit_tb (NULL ,0 );break ; +case DISAS_UPDATE_NOCHAIN : +gen_a64_set_pc_im (dc->base.pc_next); +/* fall through */ case DISAS_JUMP :tcg_gen_lookup_and_goto_ptr ();break ;
target/arm/translate.c +4 -0
@@ -11085,6 +11085,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)case DISAS_NEXT :case DISAS_TOO_MANY :case DISAS_UPDATE_EXIT : +case DISAS_UPDATE_NOCHAIN :gen_set_pc_im (dc, dc->base.pc_next);/* fall through */ default :
@@ -11108,6 +11109,9 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)case DISAS_TOO_MANY :gen_goto_tb (dc,1 , dc->base.pc_next);break ; +case DISAS_UPDATE_NOCHAIN : +gen_set_pc_im (dc, dc->base.pc_next); +/* fall through */ case DISAS_JUMP :gen_goto_ptr ();break ;
Signature · 1 line
2.25.1
Re: [PATCH v7 06/42] target/arm: Add DISAS_UPDATE_NOCHAIN
Quoted 5 lines · Richard Henderson
Add an option that writes back the PC, like
DISAS_UPDATE_EXIT, but does not exit back to the main loop.Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v7 7/42 target/arm: Add MTE system registers
In reply to Richard HendersonThis is TFSRE0_EL1, TFSR_EL1, TFSR_EL2, TFSR_EL3,RGSR_EL1, GCR_EL1, GMID_EL1, and PSTATE.TCO.
---
v3: Add GMID; add access_mte.
v4: Define only TCO at mte_insn_reg.
v6: Define RAZ/WI version of TCO at mte_insn_reg;
honor TID5 for GMID_EL1; fix TFS crn/crm; recalc hflags after TCO.
--- target/arm/cpu.h | 4 ++ target/arm/internals.h | 9 ++++ target/arm/helper.c | 94 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-a64.c | 21 +++++++++ 4 files changed, 128 insertions(+)
target/arm/cpu.h +4 -0
@@ -502,6 +502,9 @@ typedef struct CPUARMState {uint64_t pmccfiltr_el0;/* Performance Monitor Filter Register */ uint64_t vpidr_el2;/* Virtualization Processor ID Register */ uint64_t vmpidr_el2;/* Virtualization Multiprocessor ID Register */ +uint64_t tfsr_el[4 ];/* tfsre0_el1 is index 0. */ +uint64_t gcr_el1; +uint64_t rgsr_el1; } cp15;struct {
@@ -1282,6 +1285,7 @@ void pmu_init(ARMCPU *cpu);#define PSTATE_SS (1U << 21)#define PSTATE_PAN (1U << 22)#define PSTATE_UAO (1U << 23) +#define PSTATE_TCO (1U << 25)#define PSTATE_V (1U << 28)#define PSTATE_C (1U << 29)#define PSTATE_Z (1U << 30)
target/arm/internals.h +9 -0
@@ -1159,6 +1159,9 @@ static inline uint32_t aarch64_pstate_valid_mask(const ARMISARegisters *id)if (isar_feature_aa64_uao (id)) { valid |=PSTATE_UAO ; } +if (isar_feature_aa64_mte (id)) { + valid |=PSTATE_TCO ; + }return valid; }
@@ -1234,4 +1237,10 @@ void arm_log_exception(int idx);#endif /* !CONFIG_USER_ONLY */ +/* +* The log2 of the words in the tag block, for GMID_EL1.BS. +* The is the maximum, 256 bytes, which manipulates 64-bits of tags. +*/ +#define GMID_EL1_BS 6 +#endif
target/arm/helper.c +94 -0
112 lines not on this page · raw message
target/arm/translate-a64.c +21 -0
@@ -1610,6 +1610,27 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, s->base.is_jmp =DISAS_UPDATE_EXIT ;break ; +case 0x1c :/* TCO */ +if (dc_isar_feature (aa64_mte, s)) { +/* Full MTE is enabled -- set the TCO bit as directed. */ +if (crm &1 ) { +set_pstate_bits (PSTATE_TCO ); + }else { +clear_pstate_bits (PSTATE_TCO ); + } + t1 =tcg_const_i32 (s->current_el); +gen_helper_rebuild_hflags_a64 (cpu_env, t1); +tcg_temp_free_i32 (t1); +/* Many factors, including TCO, go into MTE_ACTIVE. */ + s->base.is_jmp =DISAS_UPDATE_NOCHAIN ; + }else if (dc_isar_feature (aa64_mte_insn_reg, s)) { +/* Only "instructions accessible at EL0" -- PSTATE.TCO is WI. */ + s->base.is_jmp =DISAS_NEXT ; + }else { + goto do_unallocated; + } +break ; +default : do_unallocated:unallocated_encoding (s);
Signature · 1 line
2.25.1
Re: [PATCH v7 07/42] target/arm: Add MTE system registers
Quoted 5 lines · Richard Henderson
This is
TFSRE0_EL1,TFSR_EL1,TFSR_EL2,TFSR_EL3,RGSR_EL1,GCR_EL1,GMID_EL1, and PSTATE.TCO.Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v7 8/42 target/arm: Add MTE bits to tb_flags
In reply to Richard HendersonCache the composite ATA setting.
Cache when MTE is fully enabled, i.e. access to tags are enabled and tag checks affect the PE. Do this for both the normal context and the UNPRIV context.
---
v3: Remove stub helper_mte_check; moved to a later patch.
v6: Add mte0_active and ata bits; drop reviewed-by.
--- target/arm/cpu.h | 12 ++++++++---- target/arm/internals.h | 18 +++++++++++++++++ target/arm/translate.h | 5 +++++ target/arm/helper.c | 40 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-a64.c | 4 ++++ 5 files changed, 75 insertions(+), 4 deletions(-)
target/arm/cpu.h +8 -4
@@ -3187,10 +3187,10 @@ typedef ARMCPU ArchCPU;* | | | TBFLAG_A32 | | * | | +-----+----------+ TBFLAG_AM32 | * | TBFLAG_ANY | |TBFLAG_M32| | -* | | +-+----------+--------------| -* | | | TBFLAG_A64 | -* +--------------+---------+---------------------------+ -* 31 20 15 0 +* | +-----------+----------+--------------| +* | | TBFLAG_A64 | +* +--------------+-------------------------------------+ +* 31 20 0 * * Unless otherwise noted, these bits are cached in env->hflags. */
@@ -3257,6 +3257,10 @@ FIELD(TBFLAG_A64, BT, 9, 1) FIELD(TBFLAG_A64, BTYPE, 10, 2) /* Not cached. */ FIELD(TBFLAG_A64, TBID, 12, 2) FIELD(TBFLAG_A64, UNPRIV, 14, 1) +FIELD(TBFLAG_A64, ATA, 15, 1) +FIELD(TBFLAG_A64, TCMA, 16, 2) +FIELD(TBFLAG_A64, MTE_ACTIVE, 18, 1) +FIELD (TBFLAG_A64 ,MTE0_ACTIVE ,19 ,1 )/** * cpu_mmu_index:
target/arm/internals.h +18 -0
@@ -1198,6 +1198,24 @@ static inline int exception_target_el(CPUARMState *env)return target_el; } +/* Determine if allocation tags are available. */ +static inline bool allocation_tag_access_enabled (CPUARMState *env,int el, +uint64_t sctlr) +{ +if (el <3 + &&arm_feature (env,ARM_FEATURE_EL3 ) + && !(env->cp15.scr_el3 &SCR_ATA )) { +return false; + } +if (el <2 + &&arm_feature (env,ARM_FEATURE_EL2 ) + && !(arm_hcr_el2_eff (env) &HCR_ATA )) { +return false; + } + sctlr &= (el ==0 ?SCTLR_ATA0 :SCTLR_ATA ); +return sctlr !=0 ; +} +#ifndef CONFIG_USER_ONLY /* Security attributes for an address, as returned by v8m_security_lookup. */
target/arm/translate.h +5 -0
@@ -30,6 +30,7 @@ typedef struct DisasContext {ARMMMUIdx mmu_idx;/* MMU index to use for normal loads/stores */ uint8_t tbii;/* TBI1|TBI0 for insns */ uint8_t tbid;/* TBI1|TBI0 for data */ +uint8_t tcma;/* TCMA1|TCMA0 for MTE */ bool ns;/* Use non-secure CPREG bank on access */ int fp_excp_el;/* FP exception EL or 0 if enabled */ int sve_excp_el;/* SVE exception EL or 0 if enabled */
@@ -77,6 +78,10 @@ typedef struct DisasContext {bool unpriv;/* True if v8.3-PAuth is active. */ bool pauth_active; +/* True if v8.5-MTE access to tags is enabled. */ +bool ata; +/* True if v8.5-MTE tag checks affect the PE; index with is_unpriv. */ +bool mte_active[2 ];/* True with v8.5-BTI and SCTLR_ELx.BT* set. */ bool bt;/* True if any CP15 access is trapped by HSTR_EL2 */
target/arm/helper.c +40 -0
@@ -10653,6 +10653,16 @@ static int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx) } } +static int aa64_va_parameter_tcma (uint64_t tcr,ARMMMUIdx mmu_idx) +{ +if (regime_has_2_ranges (mmu_idx)) { +return extract64 (tcr,57 ,2 ); + }else { +/* Replicate the single TCMA bit so we always have 2 bits. */ +return extract32 (tcr,30 ,1 ) *3 ; + } +} +ARMVAParameters aa64_va_parameters (CPUARMState *env,uint64_t va,ARMMMUIdx mmu_idx,bool data) {
@@ -12677,6 +12687,36 @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, } } +if (cpu_isar_feature (aa64_mte,env_archcpu (env))) { +/* +* Set MTE_ACTIVE if any access may be Checked, and leave clear +* if all accesses must be Unchecked: +* 1) If no TBI, then there are no tags in the address to check, +* 2) If Tag Check Override, then all accesses are Unchecked, +* 3) If Tag Check Fail == 0, then Checked access have no effect, +* 4) If no Allocation Tag Access, then all accesses are Unchecked. +*/ +if (allocation_tag_access_enabled (env, el, sctlr)) { + flags =FIELD_DP32 (flags,TBFLAG_A64 ,ATA ,1 ); +if (tbid + && !(env->pstate &PSTATE_TCO ) + && (sctlr & (el ==0 ?SCTLR_TCF0 :SCTLR_TCF ))) { + flags =FIELD_DP32 (flags,TBFLAG_A64 ,MTE_ACTIVE ,1 ); + } + } +/* And again for unprivileged accesses, if required. */ +if (FIELD_EX32 (flags,TBFLAG_A64 ,UNPRIV ) + && tbid + && !(env->pstate &PSTATE_TCO ) + && (sctlr &SCTLR_TCF0 ) + &&allocation_tag_access_enabled (env,0 , sctlr)) { + flags =FIELD_DP32 (flags,TBFLAG_A64 ,MTE0_ACTIVE ,1 ); + } +/* Cache TCMA as well as TBI. */ + flags =FIELD_DP32 (flags,TBFLAG_A64 ,TCMA , +aa64_va_parameter_tcma (tcr, mmu_idx)); + } +return rebuild_hflags_common (env, fp_el, mmu_idx, flags); }
target/arm/translate-a64.c +4 -0
@@ -14213,6 +14213,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->mmu_idx =core_to_aa64_mmu_idx (core_mmu_idx); dc->tbii =FIELD_EX32 (tb_flags,TBFLAG_A64 ,TBII ); dc->tbid =FIELD_EX32 (tb_flags,TBFLAG_A64 ,TBID ); + dc->tcma =FIELD_EX32 (tb_flags,TBFLAG_A64 ,TCMA ); dc->current_el =arm_mmu_idx_to_el (dc->mmu_idx);#if !defined(CONFIG_USER_ONLY ) dc->user = (dc->current_el ==0 );
@@ -14224,6 +14225,9 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->bt =FIELD_EX32 (tb_flags,TBFLAG_A64 ,BT ); dc->btype =FIELD_EX32 (tb_flags,TBFLAG_A64 ,BTYPE ); dc->unpriv =FIELD_EX32 (tb_flags,TBFLAG_A64 ,UNPRIV ); + dc->ata =FIELD_EX32 (tb_flags,TBFLAG_A64 ,ATA ); + dc->mte_active[0 ] =FIELD_EX32 (tb_flags,TBFLAG_A64 ,MTE_ACTIVE ); + dc->mte_active[1 ] =FIELD_EX32 (tb_flags,TBFLAG_A64 ,MTE0_ACTIVE ); dc->vec_len =0 ; dc->vec_stride =0 ; dc->cp_regs = arm_cpu->cp_regs;
Signature · 1 line
2.25.1
Re: [PATCH v7 08/42] target/arm: Add MTE bits to tb_flags
Quoted 8 lines · Richard Henderson
Cache the composite ATA setting.
Cache when MTE is fully enabled, i.e. access to tags are enabled and tag checks affect the PE. Do this for both the normal context and the UNPRIV context.
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v7 9/42 target/arm: Implement the IRG instruction
In reply to Richard Henderson---
v2: Update to 00eac5.
Merge choose_random_nonexcluded_tag into helper_irg since that pseudo function no longer exists separately.
v6: Remove obsolete logical/physical tag distinction;
implement inline for !ATA.
--- target/arm/helper-a64.h | 2 ++ target/arm/internals.h | 5 +++ target/arm/mte_helper.c | 72 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-a64.c | 18 ++++++++++ target/arm/Makefile.objs | 1 + 5 files changed, 98 insertions(+) create mode 100644 target/arm/mte_helper.c
target/arm/helper-a64.h +2 -0
@@ -103,3 +103,5 @@ DEF_HELPER_FLAGS_3(autda, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(autdb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_2(xpaci, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_2(xpacd, TCG_CALL_NO_RWG_SE, i64, env, i64) + +DEF_HELPER_FLAGS_3 (irg,TCG_CALL_NO_RWG , i64, env, i64, i64)
target/arm/internals.h +5 -0
@@ -1261,4 +1261,9 @@ void arm_log_exception(int idx);*/ #define GMID_EL1_BS 6 +static inline uint64_t address_with_allocation_tag (uint64_t ptr,int rtag) +{ +return deposit64 (ptr,56 ,4 , rtag); +} +#endif
target/arm/mte_helper.c new file +72 -0
72 lines not on this page · raw message
target/arm/translate-a64.c +18 -0
@@ -226,6 +226,12 @@ static TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr)return clean; } +/* Insert a zero tag into src, with the result at dst. */ +static void gen_address_with_allocation_tag0 (TCGv_i64 dst,TCGv_i64 src) +{ +tcg_gen_andi_i64 (dst, src, ~MAKE_64BIT_MASK (56 ,4 )); +} + typedef struct DisasCompare64 { TCGCond cond; TCGv_i64 value;
@@ -5275,6 +5281,18 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn)case 3 :/* SDIV */ handle_div (s, true, sf, rm, rn, rd);break ; +case 4 :/* IRG */ +if (sf ==0 || !dc_isar_feature (aa64_mte_insn_reg, s)) { + goto do_unallocated; + } +if (s->ata) { +gen_helper_irg (cpu_reg_sp (s, rd), cpu_env, +cpu_reg_sp (s, rn),cpu_reg (s, rm)); + }else { +gen_address_with_allocation_tag0 (cpu_reg_sp (s, rd), +cpu_reg_sp (s, rn)); + } +break ;case 8 :/* LSLV */ handle_shift_reg (s,A64_SHIFT_TYPE_LSL , sf, rm, rn, rd);break ;
target/arm/Makefile.objs +1 -0
@@ -86,3 +86,4 @@ obj-$(CONFIG_SOFTMMU) += psci.o obj-$(TARGET_AARCH64) += translate-a64.o helper-a64.o obj-$(TARGET_AARCH64) += translate-sve.o sve_helper.o obj-$(TARGET_AARCH64) += pauth_helper.o +obj-$(TARGET_AARCH64) += mte_helper.o
Signature · 1 line
2.25.1
Re: [PATCH v7 09/42] target/arm: Implement the IRG instruction
Quoted 16 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
v2: Update to 00eac5.
Mergechoose_random_nonexcluded_tagintohelper_irgsince that pseudo function no longer exists separately.
v6: Remove obsolete logical/physical tag distinction;
implement inline for !ATA.
---target/arm/mte_helper.c new file +6
-0+static int choose_nonexcluded_tag (int tag,int offset,uint16_t exclude) +{ +if (exclude ==0xffff ) { +return 0 ; + } +if (offset ==0 ) {
target/arm/mte_helper.c line 43
Quoted 10 lines
target/arm/mte_helper.c new file +10
-0+while (exclude & (1 << tag)) { + tag = (tag +1 ) &15 ; + } + }else { +do { +do { + tag = (tag +1 ) &15 ; + }while (exclude & (1 << tag)); + }while (--offset >0 ); + }
Not the way the pseudocode is phrased, but the effect seems to be the same.
thanks
-- PMM
PATCH v7 10/42 target/arm: Implement the ADDG, SUBG instructions
In reply to Richard Henderson---
v2: Shift offset in translate; use extract32.
v6: Implement inline for !ATA.
--- target/arm/helper-a64.h | 1 + target/arm/internals.h | 9 +++++++++ target/arm/mte_helper.c | 10 ++++++++++ target/arm/translate-a64.c | 36 ++++++++++++++++++++++++++++++++++-- 4 files changed, 54 insertions(+), 2 deletions(-)
target/arm/helper-a64.h +1 -0
@@ -105,3 +105,4 @@ DEF_HELPER_FLAGS_2(xpaci, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_2(xpacd, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_3(irg, TCG_CALL_NO_RWG, i64, env, i64, i64) +DEF_HELPER_FLAGS_4 (addsubg,TCG_CALL_NO_RWG_SE , i64, env, i64, s32, i32)
target/arm/internals.h +9 -0
@@ -1261,6 +1261,15 @@ void arm_log_exception(int idx);*/ #define GMID_EL1_BS 6 +/* We associate one allocation tag per 16 bytes, the minimum. */ +#define LOG2_TAG_GRANULE 4 +#define TAG_GRANULE (1 << LOG2_TAG_GRANULE) + +static inline int allocation_tag_from_addr (uint64_t ptr) +{ +return extract64 (ptr,56 ,4 ); +} +static inline uint64_t address_with_allocation_tag (uint64_t ptr,int rtag) {return deposit64 (ptr,56 ,4 , rtag);
target/arm/mte_helper.c +10 -0
@@ -70,3 +70,13 @@ uint64_t HELPER(irg)(CPUARMState *env, uint64_t rn, uint64_t rm)return address_with_allocation_tag (rn, rtag); } + +uint64_t HELPER (addsubg )(CPUARMState *env,uint64_t ptr, +int32_t offset,uint32_t tag_offset) +{ +int start_tag =allocation_tag_from_addr (ptr); +uint16_t exclude =extract32 (env->cp15.gcr_el1,0 ,16 ); +int rtag =choose_nonexcluded_tag (start_tag, tag_offset, exclude); + +return address_with_allocation_tag (ptr + offset, rtag); +}
target/arm/translate-a64.c +34 -2
@@ -3753,17 +3753,20 @@ static void disas_pc_rel_adr(DisasContext *s, uint32_t insn)* sf: 0 -> 32bit, 1 -> 64bit * op: 0 -> add , 1 -> sub * S: 1 -> set flags -* shift: 00 -> LSL imm by 0, 01 -> LSL imm by 12 +* shift: 00 -> LSL imm by 0, +* 01 -> LSL imm by 12 +* 10 -> ADDG, SUBG */ static void disas_add_sub_imm (DisasContext *s,uint32_t insn) {int rd =extract32 (insn,0 ,5 );int rn =extract32 (insn,5 ,5 ); -uint64_t imm =extract32 (insn,10 ,12 ); +int imm =extract32 (insn,10 ,12 );int shift =extract32 (insn,22 ,2 );bool setflags =extract32 (insn,29 ,1 );bool sub_op =extract32 (insn,30 ,1 );bool is_64bit =extract32 (insn,31 ,1 ); +bool is_tag = false;TCGv_i64 tcg_rn =cpu_reg_sp (s, rn);TCGv_i64 tcg_rd = setflags ?cpu_reg (s, rd) :cpu_reg_sp (s, rd);
@@ -3775,11 +3778,40 @@ static void disas_add_sub_imm(DisasContext *s, uint32_t insn)case 0x1 : imm <<=12 ;break ; +case 0x2 : +/* ADDG, SUBG */ +if (!is_64bit || setflags || (imm &0x30 ) || + !dc_isar_feature (aa64_mte_insn_reg, s)) { + goto do_unallocated; + } + is_tag = true; +break ;default : + do_unallocated:unallocated_encoding (s);return ; } +if (is_tag) { + imm = (imm >>6 ) <<LOG2_TAG_GRANULE ; +if (sub_op) { + imm = -imm; + } + +if (s->ata) { +TCGv_i32 tag_offset =tcg_const_i32 (imm &15 ); +TCGv_i32 offset =tcg_const_i32 (imm); + +gen_helper_addsubg (tcg_rd, cpu_env, tcg_rn, offset, tag_offset); +tcg_temp_free_i32 (tag_offset); +tcg_temp_free_i32 (offset); + }else { +tcg_gen_addi_i64 (tcg_rd, tcg_rn, imm); +gen_address_with_allocation_tag0 (tcg_rd, tcg_rd); + } +return ; + } + tcg_result =tcg_temp_new_i64 ();if (!setflags) {if (sub_op) {
Signature · 1 line
2.25.1
Re: [PATCH v7 10/42] target/arm: Implement the ADDG, SUBG instructions
Quoted 60 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
v2: Shift offset in translate; use extract32.
v6: Implement inline for !ATA.target/arm/translate-a64.c +23
-2@@ -3753,17 +3753,20 @@ static void disas_pc_rel_adr(DisasContext *s, uint32_t insn)* sf: 0 -> 32bit, 1 -> 64bit * op: 0 -> add , 1 -> sub * S: 1 -> set flags -* shift: 00 -> LSL imm by 0, 01 -> LSL imm by 12 +* shift: 00 -> LSL imm by 0, +* 01 -> LSL imm by 12 +* 10 -> ADDG, SUBG */ static void disas_add_sub_imm (DisasContext *s,uint32_t insn) {int rd =extract32 (insn,0 ,5 );int rn =extract32 (insn,5 ,5 ); -uint64_t imm =extract32 (insn,10 ,12 ); +int imm =extract32 (insn,10 ,12 );int shift =extract32 (insn,22 ,2 );bool setflags =extract32 (insn,29 ,1 );bool sub_op =extract32 (insn,30 ,1 );bool is_64bit =extract32 (insn,31 ,1 ); +bool is_tag = false;TCGv_i64 tcg_rn =cpu_reg_sp (s, rn);TCGv_i64 tcg_rd = setflags ?cpu_reg (s, rd) :cpu_reg_sp (s, rd);@@ -3775,11 +3778,40 @@ static void disas_add_sub_imm(DisasContext *s, uint32_t insn)case 0x1 : imm <<=12 ;break ; +case 0x2 : +/* ADDG, SUBG */ +if (!is_64bit || setflags || (imm &0x30 ) || + !dc_isar_feature (aa64_mte_insn_reg, s)) { + goto do_unallocated; + } + is_tag = true; +break ;default : + do_unallocated:unallocated_encoding (s);return ; } +if (is_tag) { + imm = (imm >>6 ) <<LOG2_TAG_GRANULE ; +if (sub_op) { + imm = -imm; + } + +if (s->ata) { +TCGv_i32 tag_offset =tcg_const_i32 (imm &15 ); +TCGv_i32 offset =tcg_const_i32 (imm);
target/arm/translate-a64.c static void disas_add_sub_imm(DisasContext *s, uint32_t insn) · line 3813
Quoted 10 lines
target/arm/translate-a64.c +10
-0+ +gen_helper_addsubg (tcg_rd, cpu_env, tcg_rn, offset, tag_offset); +tcg_temp_free_i32 (tag_offset); +tcg_temp_free_i32 (offset); + }else { +tcg_gen_addi_i64 (tcg_rd, tcg_rn, imm); +gen_address_with_allocation_tag0 (tcg_rd, tcg_rd); + } +return ; + }
Given that we don't really share any of the codegen with the existing disas_add_sub_imm() insns, and the insn format isn't the same (uimm6/op3/uimm4 rather than an imm12), I'm tempted to suggest we should structure this the same way the Arm ARM decode tables do, where "Add/subtract (immediate, with tags)" is a separate subtable from "Add/subtract (immediate)": so instead of disas_data_proc_imm() sending both case 0x22 and 0x23 to disas_add_sub_imm(), it would send 0x23 to a new disas_add_sub_tag().
But this patch is functionally correct, so if you don't feel like making that change you can have
for this version.
thanks
-- PMM
Re: [PATCH v7 10/42] target/arm: Implement the ADDG, SUBG instructions
Quoted 1 line · Peter Maydell
Quoted 1 line
+ imm = (imm >> 6) <<
LOG2_TAG_GRANULE;
...
Quoted 1 line
Quoted 1 line
+
TCGv_i32tag_offset=tcg_const_i32(imm & 15);
...
Quoted 9 lines
Given that we don't really share any of the codegen with the existing
disas_add_sub_imm()insns, and the insn format isn't the same (uimm6/op3/uimm4 rather than an imm12), I'm tempted to suggest we should structure this the same way the Arm ARM decode tables do, where "Add/subtract (immediate, with tags)" is a separate subtable from "Add/subtract (immediate)": so instead ofdisas_data_proc_imm()sending both case0x22and0x23todisas_add_sub_imm(), it would send0x23to a newdisas_add_sub_tag().
I'll do that, because...
Quoted 1 line
But this patch is functionally correct...
... I've just noticed that it isn't correct.
I drop the low 6 bits of the 12-bit "imm" on the first line, and then try to read the low 4 bits on the second line.
Oops.
r~
Re: [PATCH v7 10/42] target/arm: Implement the ADDG, SUBG instructions
Quoted 16 lines · Richard Henderson
Quoted 1 line · Peter Maydell
Quoted 1 line
+ imm = (imm >> 6) <<
LOG2_TAG_GRANULE;...
Quoted 1 line
Quoted 1 line
+
TCGv_i32tag_offset=tcg_const_i32(imm & 15);...
Quoted 9 lines
Given that we don't really share any of the codegen with the existing
disas_add_sub_imm()insns, and the insn format isn't the same (uimm6/op3/uimm4 rather than an imm12), I'm tempted to suggest we should structure this the same way the Arm ARM decode tables do, where "Add/subtract (immediate, with tags)" is a separate subtable from "Add/subtract (immediate)": so instead ofdisas_data_proc_imm()sending both case0x22and0x23todisas_add_sub_imm(), it would send0x23to a newdisas_add_sub_tag().
Quoted 5 lines
I'll do that, because...
Quoted 1 line
But this patch is functionally correct...
... I've just noticed that it isn't correct.
Heh. I do think it will look nicer this way round. Don't forget to tidy up disas_add_sub_imm(): its 'shift' field will then be 1 bit, not 2.
thanks
-- PMM
PATCH v7 11/42 target/arm: Implement the GMI instruction
In reply to Richard Henderson---
v6: Inline the operation.
--- target/arm/translate-a64.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
target/arm/translate-a64.c +15 -0
@@ -5325,6 +5325,21 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) cpu_reg_sp(s, rn)); }break ; +case 5 :/* GMI */ +if (sf ==0 || !dc_isar_feature (aa64_mte_insn_reg, s)) { + goto do_unallocated; + }else { +TCGv_i64 t1 =tcg_const_i64 (1 ); +TCGv_i64 t2 =tcg_temp_new_i64 (); + +tcg_gen_extract_i64 (t2,cpu_reg_sp (s, rn),56 ,4 ); +tcg_gen_shl_i64 (t1, t1, t2); +tcg_gen_or_i64 (cpu_reg (s, rd),cpu_reg (s, rm), t1); + +tcg_temp_free_i64 (t1); +tcg_temp_free_i64 (t2); + } +break ;case 8 :/* LSLV */ handle_shift_reg (s,A64_SHIFT_TYPE_LSL , sf, rm, rn, rd);break ;
Signature · 1 line
2.25.1
Re: [PATCH v7 11/42] target/arm: Implement the GMI instruction
Quoted 8 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
v6: Inline the operation.--- target/arm/translate-a64.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
thanks
-- PMM
PATCH v7 12/42 target/arm: Implement the SUBP instruction
In reply to Richard Henderson---
v2: Fix extraction length.
--- target/arm/translate-a64.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
target/arm/translate-a64.c +22 -2
@@ -5294,19 +5294,39 @@ static void handle_crc32(DisasContext *s,*/ static void disas_data_proc_2src (DisasContext *s,uint32_t insn) { -unsigned int sf, rm, opcode, rn, rd; +unsigned int sf, rm, opcode, rn, rd, setflag; sf =extract32 (insn,31 ,1 ); + setflag =extract32 (insn,29 ,1 ); rm =extract32 (insn,16 ,5 ); opcode =extract32 (insn,10 ,6 ); rn =extract32 (insn,5 ,5 ); rd =extract32 (insn,0 ,5 ); -if (extract32 (insn,29 ,1 )) { +if (setflag && opcode !=0 ) {unallocated_encoding (s);return ; }switch (opcode) { +case 0 :/* SUBP(S) */ +if (sf ==0 || !dc_isar_feature (aa64_mte_insn_reg, s)) { + goto do_unallocated; + }else { +TCGv_i64 tcg_n, tcg_m, tcg_d; + + tcg_n =read_cpu_reg_sp (s, rn, true); + tcg_m =read_cpu_reg_sp (s, rm, true); +tcg_gen_sextract_i64 (tcg_n, tcg_n,0 ,56 ); +tcg_gen_sextract_i64 (tcg_m, tcg_m,0 ,56 ); + tcg_d =cpu_reg (s, rd); + +if (setflag) { +gen_sub_CC (true, tcg_d, tcg_n, tcg_m); + }else { +tcg_gen_sub_i64 (tcg_d, tcg_n, tcg_m); + } + } +break ;case 2 :/* UDIV */ handle_div (s, false, sf, rm, rn, rd);break ;
Signature · 1 line
2.25.1
PATCH v7 13/42 target/arm: Define arm_cpu_do_unaligned_access for user-only
In reply to Richard HendersonWe need this to raise unaligned exceptions from user mode.
---
v6: Use EXCP_UNALIGNED for user-only and update cpu_loop.c.
--- linux-user/aarch64/cpu_loop.c | 7 ++++++ linux-user/arm/cpu_loop.c | 7 ++++++ target/arm/cpu.c | 2 +- target/arm/tlb_helper.c | 41 ++++++++++++++++++++++------------- 4 files changed, 41 insertions(+), 16 deletions(-)
linux-user/aarch64/cpu_loop.c +7 -0
@@ -121,6 +121,13 @@ void cpu_loop(CPUARMState *env) info._sifields._sigfault._addr = env->exception.vaddress;queue_signal (env, info.si_signo,QEMU_SI_FAULT , &info);break ; +case EXCP_UNALIGNED : + info.si_signo =TARGET_SIGBUS ; + info.si_errno =0 ; + info.si_code =TARGET_BUS_ADRALN ; + info._sifields._sigfault._addr = env->exception.vaddress; +queue_signal (env, info.si_signo,QEMU_SI_FAULT , &info); +break ;case EXCP_DEBUG :case EXCP_BKPT : info.si_signo =TARGET_SIGTRAP ;
linux-user/arm/cpu_loop.c +7 -0
@@ -411,6 +411,13 @@ void cpu_loop(CPUARMState *env)queue_signal (env, info.si_signo,QEMU_SI_FAULT , &info); }break ; +case EXCP_UNALIGNED : + info.si_signo =TARGET_SIGBUS ; + info.si_errno =0 ; + info.si_code =TARGET_BUS_ADRALN ; + info._sifields._sigfault._addr = env->exception.vaddress; +queue_signal (env, info.si_signo,QEMU_SI_FAULT , &info); +break ;case EXCP_DEBUG :case EXCP_BKPT : excp_debug:
target/arm/cpu.c +1 -1
@@ -2166,8 +2166,8 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->tlb_fill = arm_cpu_tlb_fill; cc->debug_excp_handler = arm_debug_excp_handler; cc->debug_check_watchpoint = arm_debug_check_watchpoint; -#if !defined(CONFIG_USER_ONLY ) cc->do_unaligned_access = arm_cpu_do_unaligned_access; +#if !defined(CONFIG_USER_ONLY ) cc->do_transaction_failed = arm_cpu_do_transaction_failed; cc->adjust_watchpoint_address = arm_adjust_watchpoint_address;#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
target/arm/tlb_helper.c +26 -15
50 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 13/42] target/arm: Define arm_cpu_do_unaligned_access for user-only
Quoted 6 lines · Richard Henderson
We need this to raise unaligned exceptions from user mode.
Signed-off-by Richard Henderson <[email protected]>---
v6: UseEXCP_UNALIGNEDfor user-only and updatecpu_loop.c.
Could you update the comment in cpu.h, maybe something like:
#define EXCP_UNALIGNED 22 /* v7M UNALIGNED UsageFault; also linux-user */
and also update the string printed by arm_log_exception():
#ifdef CONFIG_USER_ONLY
[EXCP_UNALIGNED] = "linux-user unaligned access fault",
#else
[EXCP_UNALIGNED] = "v7M UNALIGNED UsageFault",
#endif
Otherwise
thanks
-- PMM
Re: [PATCH v7 13/42] target/arm: Define arm_cpu_do_unaligned_access for user-only
Quoted 19 lines · Peter Maydell
Quoted 6 lines · Richard Henderson
We need this to raise unaligned exceptions from user mode.
Signed-off-by Richard Henderson <[email protected]>---
v6: UseEXCP_UNALIGNEDfor user-only and updatecpu_loop.c.Could you update the comment in
cpu.h, maybe something like:
#defineEXCP_UNALIGNED22 /* v7M UNALIGNED UsageFault; also linux-user */and also update the string printed by
arm_log_exception():
#ifdefCONFIG_USER_ONLY
[EXCP_UNALIGNED] = "linux-user unaligned access fault",
#else
[EXCP_UNALIGNED] = "v7M UNALIGNED UsageFault",
#endif
Quoted 2 lines
Otherwise
Reviewed-by Peter Maydell <[email protected]>
First, this could definitely be delayed to the follow-on linux-user patch set.
Second, in the linux-user patch set, I decode the syndrome data to determine what kind of segv to deliver for MTE synchronous faults. It would be easy to extend that just a little to notice the usual syndrome for unaligned accesses.
Which may be less confusing than abusing the v7m exception code?
r~
Re: [PATCH v7 13/42] target/arm: Define arm_cpu_do_unaligned_access for user-only
Quoted 6 lines · Richard Henderson
First, this could definitely be delayed to the follow-on linux-user patch set.
Second, in the linux-user patch set, I decode the syndrome data to determine what kind of segv to deliver for MTE synchronous faults. It would be easy to extend that just a little to notice the usual syndrome for unaligned accesses.
Which may be less confusing than abusing the v7m exception code?
Yeah, if we're going to look at syndrome data anyway that might be clearer.
The other thing that really it would be nice if we were able to feed through (via syndrome info or otherwise) is the difference between SIGSEGV with si_code == SEGV_ACCERR vs SEGV_MAPERR. At the moment handle_cpu_signal() knows the difference, but it doesn't have a way to pass this through to tlb_fill, and then cpu_loop() has to make up a si_code when it gets the EXCP_DATA_ABORT. I mention this mostly in case it affects how you want to design how you treat alignment and MTE faults -- it might be that the si_code stuff is better dealt with entirely differently.
thanks
-- PMM
Re: [PATCH v7 13/42] target/arm: Define arm_cpu_do_unaligned_access for user-only
In reply to Richard HendersonQuoted 1 line · Richard Henderson
First, this could definitely be delayed to the follow-on linux-user patch set.
Bah, no, I need the function to be defined at least, even if it isn't reachable yet.
r~
PATCH v7 14/42 target/arm: Add helper_probe_access
In reply to Richard HendersonRaise an exception if the given virtual memory is not accessible.
--- target/arm/helper.h | 2 ++ target/arm/op_helper.c | 16 ++++++++++++++++ target/arm/translate-a64.c | 13 +++++++++++++ 3 files changed, 31 insertions(+)
target/arm/helper.h +2 -0
@@ -96,6 +96,8 @@ DEF_HELPER_FLAGS_1(rebuild_hflags_a32_newel, TCG_CALL_NO_RWG, void, env) DEF_HELPER_FLAGS_2(rebuild_hflags_a32, TCG_CALL_NO_RWG, void, env, int) DEF_HELPER_FLAGS_2(rebuild_hflags_a64, TCG_CALL_NO_RWG, void, env, int) +DEF_HELPER_FLAGS_5(probe_access, TCG_CALL_NO_WG, void, env, tl, i32, i32, i32) + DEF_HELPER_1(vfp_get_fpscr, i32, env)DEF_HELPER_2 (vfp_set_fpscr, void, env, i32)
target/arm/op_helper.c +16 -0
@@ -935,3 +935,19 @@ uint32_t HELPER(ror_cc)(CPUARMState *env, uint32_t x, uint32_t i)return ((uint32_t )x >> shift) | (x << (32 - shift)); } } + +void HELPER (probe_access )(CPUARMState *env,target_ulong ptr, +uint32_t access_type,uint32_t mmu_idx, +uint32_t size) +{ +uint32_t in_page = -((uint32_t )ptr |TARGET_PAGE_SIZE ); +uintptr_t ra =GETPC (); + +if (likely (size <= in_page)) { +probe_access (env, ptr, size, access_type, mmu_idx, ra); + }else { +probe_access (env, ptr, in_page, access_type, mmu_idx, ra); +probe_access (env, ptr + in_page, size - in_page, + access_type, mmu_idx, ra); + } +}
target/arm/translate-a64.c +13 -0
@@ -232,6 +232,19 @@ static void gen_address_with_allocation_tag0(TCGv_i64 dst, TCGv_i64 src)tcg_gen_andi_i64 (dst, src, ~MAKE_64BIT_MASK (56 ,4 )); } +static void gen_probe_access (DisasContext *s,TCGv_i64 ptr, +MMUAccessType acc,int log2_size) +{ +TCGv_i32 t_acc =tcg_const_i32 (acc); +TCGv_i32 t_idx =tcg_const_i32 (get_mem_index (s)); +TCGv_i32 t_size =tcg_const_i32 (1 << log2_size); + +gen_helper_probe_access (cpu_env, ptr, t_acc, t_idx, t_size); +tcg_temp_free_i32 (t_acc); +tcg_temp_free_i32 (t_idx); +tcg_temp_free_i32 (t_size); +} + typedef struct DisasCompare64 { TCGCond cond; TCGv_i64 value;
Signature · 1 line
2.25.1
Re: [PATCH v7 14/42] target/arm: Add helper_probe_access
Quoted 16 lines · Richard Henderson
Raise an exception if the given virtual memory is not accessible.
Signed-off-by Richard Henderson <[email protected]>---
target/arm/translate-a64.c +2
-0@@ -232,6 +232,19 @@ static void gen_address_with_allocation_tag0(TCGv_i64 dst, TCGv_i64 src)tcg_gen_andi_i64 (dst, src, ~MAKE_64BIT_MASK (56 ,4 )); } +static void gen_probe_access (DisasContext *s,TCGv_i64 ptr, +MMUAccessType acc,int log2_size)
target/arm/translate-a64.c static void gen_address_with_allocation_tag0(TCGv_i64 dst, TCGv_i64 src) · line 246
Quoted 10 lines
target/arm/translate-a64.c +10
-0+{ +TCGv_i32 t_acc =tcg_const_i32 (acc); +TCGv_i32 t_idx =tcg_const_i32 (get_mem_index (s)); +TCGv_i32 t_size =tcg_const_i32 (1 << log2_size); + +gen_helper_probe_access (cpu_env, ptr, t_acc, t_idx, t_size); +tcg_temp_free_i32 (t_acc); +tcg_temp_free_i32 (t_idx); +tcg_temp_free_i32 (t_size); +}
This isn't called from anywhere -- clang is probably going to complain about that.
thanks
-- PMM
Re: [PATCH v7 14/42] target/arm: Add helper_probe_access
Quoted 16 lines · Peter Maydell
Quoted 14 lines · Richard Henderson
Raise an exception if the given virtual memory is not accessible.
Signed-off-by Richard Henderson <[email protected]>---
target/arm/translate-a64.c +0
-0@@ -232,6 +232,19 @@ static void gen_address_with_allocation_tag0(TCGv_i64 dst, TCGv_i64 src)tcg_gen_andi_i64 (dst, src, ~MAKE_64BIT_MASK (56 ,4 )); }
Quoted 15 lines
target/arm/translate-a64.c static void gen_address_with_allocation_tag0(TCGv_i64 dst, TCGv_i64 src) · line 246
Quoted 12 lines
target/arm/translate-a64.c +12
-0+static void gen_probe_access (DisasContext *s,TCGv_i64 ptr, +MMUAccessType acc,int log2_size) +{ +TCGv_i32 t_acc =tcg_const_i32 (acc); +TCGv_i32 t_idx =tcg_const_i32 (get_mem_index (s)); +TCGv_i32 t_size =tcg_const_i32 (1 << log2_size); + +gen_helper_probe_access (cpu_env, ptr, t_acc, t_idx, t_size); +tcg_temp_free_i32 (t_acc); +tcg_temp_free_i32 (t_idx); +tcg_temp_free_i32 (t_size); +}This isn't called from anywhere -- clang is probably going to complain about that.
Ah, yes. I thought it would be helpful to split this patch, but I guess not. I'll merge with the next patch where it's used.
r~
PATCH v7 15/42 target/arm: Implement LDG, STG, ST2G instructions
In reply to Richard Henderson---
v2: Split out allocation_tag_mem. Handle atomicity of stores.
v3: Add X[t] input to these insns; require pre-cleaned addresses.
v5: Fix !32-byte aligned operation of st2g.
v6: Fix op2 extract, stg pre/post-index, stores vs sp, commentary;
use pre-computed ata.
v7: Fix STZG iteration (stephen long)
--- target/arm/helper-a64.h | 7 ++ target/arm/mte_helper.c | 194 +++++++++++++++++++++++++++++++++++++ target/arm/translate-a64.c | 158 +++++++++++++++++++++++++++++- 3 files changed, 354 insertions(+), 5 deletions(-)
target/arm/helper-a64.h +7 -0
@@ -106,3 +106,10 @@ DEF_HELPER_FLAGS_2(xpacd, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_3(irg, TCG_CALL_NO_RWG, i64, env, i64, i64) DEF_HELPER_FLAGS_4(addsubg, TCG_CALL_NO_RWG_SE, i64, env, i64, s32, i32) +DEF_HELPER_FLAGS_3(ldg, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(stg, TCG_CALL_NO_WG, void, env, i64, i64) +DEF_HELPER_FLAGS_3(stg_parallel, TCG_CALL_NO_WG, void, env, i64, i64) +DEF_HELPER_FLAGS_2(stg_stub, TCG_CALL_NO_WG, void, env, i64) +DEF_HELPER_FLAGS_3(st2g, TCG_CALL_NO_WG, void, env, i64, i64) +DEF_HELPER_FLAGS_3(st2g_parallel, TCG_CALL_NO_WG, void, env, i64, i64) +DEF_HELPER_FLAGS_2 (st2g_stub,TCG_CALL_NO_WG , void, env, i64)
target/arm/mte_helper.c +194 -0
203 lines not on this page · raw message
target/arm/translate-a64.c +153 -5
172 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 15/42] target/arm: Implement LDG, STG, ST2G instructions
Quoted 19 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
v2: Split outallocation_tag_mem. Handle atomicity of stores.
v3: Add X[t] input to these insns; require pre-cleaned addresses.
v5: Fix !32-byte aligned operation of st2g.
v6: Fix op2 extract, stg pre/post-index, stores vs sp, commentary;
use pre-computed ata.
v7: Fix STZG iteration (stephen long)
---target/arm/translate-a64.c +7
-0+static void disas_ldst_tag (DisasContext *s,uint32_t insn) +{ + addr =read_cpu_reg_sp (s, rn, true); +if (index >=0 ) { +/* pre-index or signed offset */ +tcg_gen_addi_i64 (addr, addr, offset); + }
target/arm/translate-a64.c static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) · line 3785
Quoted 10 lines
target/arm/translate-a64.c +10
-0+ +if (is_load) { + tcg_rt =cpu_reg (s, rt); +if (s->ata) { +gen_helper_ldg (tcg_rt, cpu_env, addr, tcg_rt); + }else { + clean_addr =clean_data_tbi (s, addr); +gen_probe_access (s, clean_addr,MMU_DATA_LOAD ,MO_8 ); +gen_address_with_allocation_tag0 (tcg_rt, addr); + }
The pseudocode for LDG has an
address = Align(address, TAG_GRANULE);
in it. I don't see where in this code is the equivalent; have I missed it?
thanks
-- PMM
Re: [PATCH v7 15/42] target/arm: Implement LDG, STG, ST2G instructions
Quoted 3 lines · Peter Maydell
The pseudocode for LDG has an
address =Align(address, TAG_GRANULE);
in it. I don't see where in this code is the equivalent; have I missed it?
Nope, I missed it.
r~
PATCH v7 16/42 target/arm: Implement the STGP instruction
In reply to Richard Henderson---
v3: Handle atomicity, require pre-cleaned address.
v6: Fix constant offset shift, non-checked address, use pre-computed ata.
--- target/arm/translate-a64.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
target/arm/translate-a64.c +26 -3
@@ -2681,7 +2681,7 @@ static void disas_ld_lit(DisasContext *s, uint32_t insn)* +-----+-------+---+---+-------+---+-------+-------+------+------+ * * opc: LDP/STP/LDNP/STNP 00 -> 32 bit, 10 -> 64 bit -* LDPSW 01 +* LDPSW/STGP 01 * LDP/STP/LDNP/STNP (SIMD) 00 -> 32 bit, 01 -> 64 bit, 10 -> 128 bit * V: 0 -> GPR, 1 -> Vector * idx: 00 -> signed offset with non-temporal hint, 01 -> post-index,
@@ -2706,6 +2706,7 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn)bool is_signed = false;bool postindex = false;bool wback = false; +bool set_tag = false;TCGv_i64 clean_addr, dirty_addr;
@@ -2718,6 +2719,14 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn)if (is_vector) { size =2 + opc; + }else if (opc ==1 && !is_load) { +/* STGP */ +if (!dc_isar_feature (aa64_mte_insn_reg, s) || index ==0 ) { +unallocated_encoding (s); +return ; + } + size =3 ; + set_tag = true; }else { size =2 +extract32 (opc,1 ,1 ); is_signed =extract32 (opc,0 ,1 );
@@ -2758,7 +2767,7 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn)return ; } - offset <<= size; + offset <<= (set_tag ?LOG2_TAG_GRANULE : size);if (rn ==31 ) {gen_check_sp_alignment (s);
@@ -2768,8 +2777,22 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn)if (!postindex) {tcg_gen_addi_i64 (dirty_addr, dirty_addr, offset); } - clean_addr =clean_data_tbi (s, dirty_addr); +if (set_tag) { +if (!s->ata) { +/* +* TODO: We could rely on the stores below, at least for +* system mode, if we arrange to add MO_ALIGN_16. +*/ +gen_helper_stg_stub (cpu_env, dirty_addr); + }else if (tb_cflags (s->base.tb) &CF_PARALLEL ) { +gen_helper_stg_parallel (cpu_env, dirty_addr, dirty_addr); + }else { +gen_helper_stg (cpu_env, dirty_addr, dirty_addr); + } + } + + clean_addr =clean_data_tbi (s, dirty_addr);if (is_vector) {if (is_load) {do_fp_ld (s, rt, clean_addr, size);
Signature · 1 line
2.25.1
PATCH v7 17/42 target/arm: Restrict the values of DCZID.BS under TCG
In reply to Richard HendersonWe can simplify our DC_ZVA if we recognize that the largest BS that we actually use in system mode is 64. Let us just assert that it fits within TARGET_PAGE_SIZE.
For DC_GVA and STZGM, we want to be able to write whole bytes of tag memory, so assert that BS is >= 2 * TAG_GRANULE, or 32.
--- target/arm/cpu.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
target/arm/cpu.c +24 -0
@@ -1754,6 +1754,30 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) }#endif +if (tcg_enabled ()) { +int dcz_blocklen =4 << cpu->dcz_blocksize; + +/* +* We only support DCZ blocklen that fits on one page. +* +* Architectually this is always true. However TARGET_PAGE_SIZE +* is variable and, for compatibility with -machine virt-2.7, +* is only 1KiB, as an artifact of legacy ARMv5 subpage support. +* But even then, while the largest architectural DCZ blocklen +* is 2KiB, no cpu actually uses such a large blocklen. +*/ +assert (dcz_blocklen <=TARGET_PAGE_SIZE ); + +/* +* We only support DCZ blocksize >= 2*TAG_GRANULE, which is to say +* both nibbles of each byte storing tag data may be written at once. +* Since TAG_GRANULE is 16, this means that blocklen must be >= 32. +*/ +if (cpu_isar_feature (aa64_mte, cpu)) { +assert (dcz_blocklen >=2 *TAG_GRANULE ); + } + } +qemu_init_vcpu (cs);cpu_reset (cs);
Signature · 1 line
2.25.1
Re: [PATCH v7 17/42] target/arm: Restrict the values of DCZID.BS under TCG
Quoted 9 lines · Richard Henderson
We can simplify our
DC_ZVAif we recognize that the largest BS that we actually use in system mode is 64. Let us just assert that it fits withinTARGET_PAGE_SIZE.For
DC_GVAand STZGM, we want to be able to write whole bytes of tag memory, so assert that BS is >= 2 *TAG_GRANULE, or 32.Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v7 18/42 target/arm: Simplify DC_ZVA
In reply to Richard HendersonNow that we know that the operation is on a single page, we need not loop over pages while probing.
--- target/arm/helper-a64.c | 94 +++++++++++------------------------------ 1 file changed, 25 insertions(+), 69 deletions(-)
target/arm/helper-a64.c +25 -69
@@ -1119,85 +1119,41 @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)* (which matches the usual QEMU behaviour of not implementing either * alignment faults or any memory attribute handling). */ +int blocklen =4 <<env_archcpu (env)->dcz_blocksize; +uint64_t vaddr = vaddr_in & -blocklen; +int mmu_idx =cpu_mmu_index (env, false); +void *mem; -ARMCPU *cpu =env_archcpu (env); -uint64_t blocklen =4 << cpu->dcz_blocksize; -uint64_t vaddr = vaddr_in & ~(blocklen -1 ); +/* +* Trapless lookup. In addition to actual invalid page, may +* return NULL for I/O, watchpoints, clean pages, etc. +*/ + mem =tlb_vaddr_to_host (env, vaddr,MMU_DATA_STORE , mmu_idx);#ifndef CONFIG_USER_ONLY - { +if (unlikely (!mem)) { +uintptr_t ra =GETPC (); +/* -* Slightly awkwardly, QEMU's TARGET_PAGE_SIZE may be less than -* the block size so we might have to do more than one TLB lookup. -* We know that in fact for any v8 CPU the page size is at least 4K -* and the block size must be 2K or less, but TARGET_PAGE_SIZE is only -* 1K as an artefact of legacy v5 subpage support being present in the -* same QEMU executable. So in practice the hostaddr[] array has -* two entries, given the current setting of TARGET_PAGE_BITS_MIN. +* Trap if accessing an invalid page. DC_ZVA requires that we supply +* the original pointer for an invalid page. But watchpoints require +* that we probe the actual space. So do both. */ -int maxidx =DIV_ROUND_UP (blocklen,TARGET_PAGE_SIZE ); -void *hostaddr[DIV_ROUND_UP (2 * KiB,1 <<TARGET_PAGE_BITS_MIN )]; -int try, i; -unsigned mmu_idx =cpu_mmu_index (env, false); -TCGMemOpIdx oi =make_memop_idx (MO_UB , mmu_idx); + (void )probe_write (env, vaddr_in,1 , mmu_idx, ra); + mem =probe_write (env, vaddr, blocklen, mmu_idx, ra); -assert (maxidx <=ARRAY_SIZE (hostaddr)); - -for (try =0 ; try <2 ; try++) { - -for (i =0 ; i < maxidx; i++) { - hostaddr[i] =tlb_vaddr_to_host (env, - vaddr +TARGET_PAGE_SIZE * i, -1 , mmu_idx); -if (!hostaddr[i]) { -break ; - } - } -if (i == maxidx) { -/* -* If it's all in the TLB it's fair game for just writing to; -* we know we don't need to update dirty status, etc. -*/ -for (i =0 ; i < maxidx -1 ; i++) { -memset (hostaddr[i],0 ,TARGET_PAGE_SIZE ); - } -memset (hostaddr[i],0 , blocklen - (i *TARGET_PAGE_SIZE )); -return ; - } +if (unlikely (!mem)) {/* -* OK, try a store and see if we can populate the tlb. This -* might cause an exception if the memory isn't writable, -* in which case we will longjmp out of here. We must for -* this purpose use the actual register value passed to us -* so that we get the fault address right. +* The only remaining reason for mem == NULL is I/O. +* Just do a series of byte writes as the architecture demands. */ -helper_ret_stb_mmu (env, vaddr_in,0 , oi,GETPC ()); -/* Now we can populate the other TLB entries, if any */ -for (i =0 ; i < maxidx; i++) { -uint64_t va = vaddr +TARGET_PAGE_SIZE * i; -if (va != (vaddr_in &TARGET_PAGE_MASK )) { -helper_ret_stb_mmu (env, va,0 , oi,GETPC ()); - } +for (int i =0 ; i < blocklen; i++) { +cpu_stb_mmuidx_ra (env, vaddr + i,0 , mmu_idx, ra); } - } - -/* -* Slow path (probably attempt to do this to an I/O device or -* similar, or clearing of a block of code we have translations -* cached for). Just do a series of byte writes as the architecture -* demands. It's not worth trying to use a cpu_physical_memory_map(), -* memset(), unmap() sequence here because: -* + we'd need to account for the blocksize being larger than a page -* + the direct-RAM access case is almost always going to be dealt -* with in the fastpath code above, so there's no speed benefit -* + we would have to deal with the map returning NULL because the -* bounce buffer was in use -*/ -for (i =0 ; i < blocklen; i++) { -helper_ret_stb_mmu (env, vaddr + i,0 , oi,GETPC ()); +return ; } } -#else -memset (g2h (vaddr),0 , blocklen);#endif + +memset (mem,0 , blocklen); }
Signature · 1 line
2.25.1
Re: [PATCH v7 18/42] target/arm: Simplify DC_ZVA
Quoted 14 lines · Richard Henderson
Now that we know that the operation is on a single page, we need not loop over pages while probing.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/helper-a64.c | 94 +++++++++++------------------------------ 1 file changed, 25 insertions(+), 69 deletions(-)target/arm/helper-a64.c +0
-0
target/arm/helper-a64.c void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) · line 1123
Quoted 5 lines
target/arm/helper-a64.c +2
-0@@ -1119,85 +1119,41 @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)* (which matches the usual QEMU behaviour of not implementing either * alignment faults or any memory attribute handling). */ +int blocklen =4 <<env_archcpu (env)->dcz_blocksize; +uint64_t vaddr = vaddr_in & -blocklen;
This seems unnecessarily confusing compared to keeping the old
target/arm/helper-a64.c void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) · line 1125
Quoted 1 line
target/arm/helper-a64.c +0
-1-uint64_t vaddr = vaddr_in & ~(blocklen -1 );
I generally find mixing of arithmetic negation with bitwise ops hard to read because I have to remember what the binary operation that is 2s-complement-negation actually is.
thanks
-- PMM
PATCH v7 19/42 target/arm: Implement the LDGM, STGM, STZGM instructions
In reply to Richard Henderson---
v3: Require pre-cleaned addresses.
v6: Check full mte enabled. Reorg the helpers.
--- target/arm/helper-a64.h | 3 ++ target/arm/translate.h | 2 + target/arm/mte_helper.c | 84 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-a64.c | 74 +++++++++++++++++++++++++++++---- 4 files changed, 154 insertions(+), 9 deletions(-)
target/arm/helper-a64.h +3 -0
@@ -113,3 +113,6 @@ DEF_HELPER_FLAGS_2(stg_stub, TCG_CALL_NO_WG, void, env, i64) DEF_HELPER_FLAGS_3(st2g, TCG_CALL_NO_WG, void, env, i64, i64) DEF_HELPER_FLAGS_3(st2g_parallel, TCG_CALL_NO_WG, void, env, i64, i64) DEF_HELPER_FLAGS_2(st2g_stub, TCG_CALL_NO_WG, void, env, i64) +DEF_HELPER_FLAGS_2(ldgm, TCG_CALL_NO_WG, i64, env, i64) +DEF_HELPER_FLAGS_3(stgm, TCG_CALL_NO_WG, void, env, i64, i64) +DEF_HELPER_FLAGS_3 (stzgm_tags,TCG_CALL_NO_WG , void, env, i64, i64)
target/arm/translate.h +2 -0
@@ -91,6 +91,8 @@ typedef struct DisasContext {* < 0, set by the current instruction. */ int8_t btype; +/* A copy of cpu->dcz_blocksize. */ +uint8_t dcz_blocksize;/* True if this page is guarded. */ bool guarded_page;/* Bottom two bits of XScale c15_cpar coprocessor access control reg */
target/arm/mte_helper.c +84 -0
87 lines not on this page · raw message
target/arm/translate-a64.c +65 -9
121 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 19/42] target/arm: Implement the LDGM, STGM, STZGM instructions
Quoted 5 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
v3: Require pre-cleaned addresses.
v6: Check full mte enabled. Reorg the helpers
thanks
-- PMM
PATCH v7 20/42 target/arm: Implement the access tag cache flushes
In reply to Richard HendersonLike the regular data cache flushes, these are nops within qemu.
---
v6: Split out and handle el0 cache ops properly.
--- target/arm/helper.c | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
target/arm/helper.c +65 -0
@@ -6927,6 +6927,32 @@ static const ARMCPRegInfo mte_reginfo[] = { .opc0 = 3, .opc1 = 3, .crn = 4, .crm = 2, .opc2 = 7, .type = ARM_CP_NO_RAW, .access = PL0_RW, .readfn = tco_read, .writefn = tco_write }, + { .name = "DC_IGVAC", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 3, + .type = ARM_CP_NOP, .access = PL1_W, + .accessfn = aa64_cacheop_poc_access }, + { .name = "DC_IGSW", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 4, + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, + { .name = "DC_IGDVAC", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 5, + .type = ARM_CP_NOP, .access = PL1_W, + .accessfn = aa64_cacheop_poc_access }, + { .name = "DC_IGDSW", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 6, + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, + { .name = "DC_CGSW", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 4, + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, + { .name = "DC_CGDSW", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 6, + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, + { .name = "DC_CIGSW", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 4, + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, + { .name = "DC_CIGDSW", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 6, + .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, REGINFO_SENTINEL };
@@ -6936,6 +6962,43 @@ static const ARMCPRegInfo mte_tco_ro_reginfo[] = { .type = ARM_CP_CONST, .access = PL0_RW, },REGINFO_SENTINEL }; + +static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { + { .name ="DC_CGVAC" , .state =ARM_CP_STATE_AA64 , + .opc0 =1 , .opc1 =3 , .crn =7 , .crm =10 , .opc2 =3 , + .type =ARM_CP_NOP , .access =PL0_W , + .accessfn = aa64_cacheop_poc_access }, + { .name ="DC_CGDVAC" , .state =ARM_CP_STATE_AA64 , + .opc0 =1 , .opc1 =3 , .crn =7 , .crm =10 , .opc2 =5 , + .type =ARM_CP_NOP , .access =PL0_W , + .accessfn = aa64_cacheop_poc_access }, + { .name ="DC_CGVAP" , .state =ARM_CP_STATE_AA64 , + .opc0 =1 , .opc1 =3 , .crn =7 , .crm =12 , .opc2 =3 , + .type =ARM_CP_NOP , .access =PL0_W , + .accessfn = aa64_cacheop_poc_access }, + { .name ="DC_CGDVAP" , .state =ARM_CP_STATE_AA64 , + .opc0 =1 , .opc1 =3 , .crn =7 , .crm =12 , .opc2 =5 , + .type =ARM_CP_NOP , .access =PL0_W , + .accessfn = aa64_cacheop_poc_access }, + { .name ="DC_CGVADP" , .state =ARM_CP_STATE_AA64 , + .opc0 =1 , .opc1 =3 , .crn =7 , .crm =13 , .opc2 =3 , + .type =ARM_CP_NOP , .access =PL0_W , + .accessfn = aa64_cacheop_poc_access }, + { .name ="DC_CGDVADP" , .state =ARM_CP_STATE_AA64 , + .opc0 =1 , .opc1 =3 , .crn =7 , .crm =13 , .opc2 =5 , + .type =ARM_CP_NOP , .access =PL0_W , + .accessfn = aa64_cacheop_poc_access }, + { .name ="DC_CIGVAC" , .state =ARM_CP_STATE_AA64 , + .opc0 =1 , .opc1 =3 , .crn =7 , .crm =14 , .opc2 =3 , + .type =ARM_CP_NOP , .access =PL0_W , + .accessfn = aa64_cacheop_poc_access }, + { .name ="DC_CIGDVAC" , .state =ARM_CP_STATE_AA64 , + .opc0 =1 , .opc1 =3 , .crn =7 , .crm =14 , .opc2 =5 , + .type =ARM_CP_NOP , .access =PL0_W , + .accessfn = aa64_cacheop_poc_access }, +REGINFO_SENTINEL +}; +#endif static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri,
@@ -8069,8 +8132,10 @@ void register_cp_regs_for_features(ARMCPU *cpu)*/ if (cpu_isar_feature (aa64_mte, cpu)) {define_arm_cp_regs (cpu, mte_reginfo); +define_arm_cp_regs (cpu, mte_el0_cacheop_reginfo); }else if (cpu_isar_feature (aa64_mte_insn_reg, cpu)) {define_arm_cp_regs (cpu, mte_tco_ro_reginfo); +define_arm_cp_regs (cpu, mte_el0_cacheop_reginfo); }#endif
Signature · 1 line
2.25.1
Re: [PATCH v7 20/42] target/arm: Implement the access tag cache flushes
Quoted 7 lines · Richard Henderson
Like the regular data cache flushes, these are nops within qemu.
Signed-off-by Richard Henderson <[email protected]>---
v6: Split out and handle el0 cache ops properly.
---
thanks
-- PMM
PATCH v7 21/42 target/arm: Move regime_el to internals.h
In reply to Richard HendersonWe will shortly need this in mte_helper.c as well.
--- target/arm/internals.h | 36 ++++++++++++++++++++++++++++++++++++ target/arm/helper.c | 36 ------------------------------------ 2 files changed, 36 insertions(+), 36 deletions(-)
target/arm/internals.h +36 -0
@@ -913,6 +913,42 @@ static inline bool regime_is_pan(CPUARMState *env, ARMMMUIdx mmu_idx) } } +/* Return the exception level which controls this address translation regime */ +static inline uint32_t regime_el (CPUARMState *env,ARMMMUIdx mmu_idx) +{ +switch (mmu_idx) { +case ARMMMUIdx_E20_0: +case ARMMMUIdx_E20_2: +case ARMMMUIdx_E20_2_PAN: +case ARMMMUIdx_Stage2: +case ARMMMUIdx_E2: +return 2 ; +case ARMMMUIdx_SE3: +return 3 ; +case ARMMMUIdx_SE10_0: +return arm_el_is_aa64 (env,3 ) ?1 :3 ; +case ARMMMUIdx_SE10_1: +case ARMMMUIdx_SE10_1_PAN: +case ARMMMUIdx_Stage1_E0: +case ARMMMUIdx_Stage1_E1: +case ARMMMUIdx_Stage1_E1_PAN: +case ARMMMUIdx_E10_0: +case ARMMMUIdx_E10_1: +case ARMMMUIdx_E10_1_PAN: +case ARMMMUIdx_MPrivNegPri: +case ARMMMUIdx_MUserNegPri: +case ARMMMUIdx_MPriv: +case ARMMMUIdx_MUser: +case ARMMMUIdx_MSPrivNegPri: +case ARMMMUIdx_MSUserNegPri: +case ARMMMUIdx_MSPriv: +case ARMMMUIdx_MSUser: +return 1 ; +default : +g_assert_not_reached (); + } +} +/* Return the FSR value for a debug exception (watchpoint, hardware * breakpoint or BKPT insn) targeting the specified exception level. */
target/arm/helper.c +0 -36
@@ -9791,42 +9791,6 @@ void arm_cpu_do_interrupt(CPUState *cs) }#endif /* !CONFIG_USER_ONLY */ -/* Return the exception level which controls this address translation regime */ -static uint32_t regime_el (CPUARMState *env,ARMMMUIdx mmu_idx) -{ -switch (mmu_idx) { -case ARMMMUIdx_E20_0: -case ARMMMUIdx_E20_2: -case ARMMMUIdx_E20_2_PAN: -case ARMMMUIdx_Stage2: -case ARMMMUIdx_E2: -return 2 ; -case ARMMMUIdx_SE3: -return 3 ; -case ARMMMUIdx_SE10_0: -return arm_el_is_aa64 (env,3 ) ?1 :3 ; -case ARMMMUIdx_SE10_1: -case ARMMMUIdx_SE10_1_PAN: -case ARMMMUIdx_Stage1_E0: -case ARMMMUIdx_Stage1_E1: -case ARMMMUIdx_Stage1_E1_PAN: -case ARMMMUIdx_E10_0: -case ARMMMUIdx_E10_1: -case ARMMMUIdx_E10_1_PAN: -case ARMMMUIdx_MPrivNegPri: -case ARMMMUIdx_MUserNegPri: -case ARMMMUIdx_MPriv: -case ARMMMUIdx_MUser: -case ARMMMUIdx_MSPrivNegPri: -case ARMMMUIdx_MSUserNegPri: -case ARMMMUIdx_MSPriv: -case ARMMMUIdx_MSUser: -return 1 ; -default : -g_assert_not_reached (); - } -} -uint64_t arm_sctlr (CPUARMState *env,int el) {/* Only EL0 needs to be adjusted for EL1&0 or EL2&0. */
Signature · 1 line
2.25.1
Re: [PATCH v7 21/42] target/arm: Move regime_el to internals.h
Quoted 8 lines · Richard Henderson
We will shortly need this in
mte_helper.cas well.Signed-off-by Richard Henderson <[email protected]>--- target/arm/internals.h | 36 ++++++++++++++++++++++++++++++++++++ target/arm/helper.c | 36 ------------------------------------ 2 files changed, 36 insertions(+), 36 deletions(-)
thanks
-- PMM
PATCH v7 22/42 target/arm: Move regime_tcr to internals.h
In reply to Richard HendersonWe will shortly need this in mte_helper.c as well.
--- target/arm/internals.h | 9 +++++++++ target/arm/helper.c | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-)
target/arm/internals.h +9 -0
@@ -949,6 +949,15 @@ static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx) } } +/* Return the TCR controlling this translation regime */ +static inline TCR *regime_tcr (CPUARMState *env,ARMMMUIdx mmu_idx) +{ +if (mmu_idx == ARMMMUIdx_Stage2) { +return &env->cp15.vtcr_el2; + } +return &env->cp15.tcr_el[regime_el (env, mmu_idx)]; +} +/* Return the FSR value for a debug exception (watchpoint, hardware * breakpoint or BKPT insn) targeting the specified exception level. */
target/arm/helper.c +0 -9
@@ -9873,15 +9873,6 @@ static inline uint64_t regime_ttbr(CPUARMState *env, ARMMMUIdx mmu_idx,#endif /* !CONFIG_USER_ONLY */ -/* Return the TCR controlling this translation regime */ -static inline TCR *regime_tcr (CPUARMState *env,ARMMMUIdx mmu_idx) -{ -if (mmu_idx == ARMMMUIdx_Stage2) { -return &env->cp15.vtcr_el2; - } -return &env->cp15.tcr_el[regime_el (env, mmu_idx)]; -} -/* Convert a possible stage1+2 MMU index into the appropriate * stage 1 MMU index */
Signature · 1 line
2.25.1
Re: [PATCH v7 22/42] target/arm: Move regime_tcr to internals.h
Quoted 8 lines · Richard Henderson
We will shortly need this in
mte_helper.cas well.Signed-off-by Richard Henderson <[email protected]>--- target/arm/internals.h | 9 +++++++++ target/arm/helper.c | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-)
thanks
-- PMM
PATCH v7 23/42 target/arm: Add gen_mte_check1
In reply to Richard HendersonReplace existing uses of check_data_tbi in translate-a64.c that perform a single logical memory access. Leave the helper blank for now to reduce the patch size.
--- target/arm/helper-a64.h | 1 + target/arm/internals.h | 8 ++++ target/arm/translate-a64.h | 2 + target/arm/mte_helper.c | 8 ++++ target/arm/translate-a64.c | 96 ++++++++++++++++++++++++++++---------- 5 files changed, 91 insertions(+), 24 deletions(-)
target/arm/helper-a64.h +1 -0
@@ -104,6 +104,7 @@ DEF_HELPER_FLAGS_3(autdb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_2(xpaci, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_2(xpacd, TCG_CALL_NO_RWG_SE, i64, env, i64) +DEF_HELPER_FLAGS_3(mte_check1, TCG_CALL_NO_WG, i64, env, i32, i64) DEF_HELPER_FLAGS_3(irg, TCG_CALL_NO_RWG, i64, env, i64, i64) DEF_HELPER_FLAGS_4(addsubg, TCG_CALL_NO_RWG_SE, i64, env, i64, s32, i32)DEF_HELPER_FLAGS_3 (ldg,TCG_CALL_NO_WG , i64, env, i64, i64)
target/arm/internals.h +8 -0
@@ -1310,6 +1310,14 @@ void arm_log_exception(int idx);#define LOG2_TAG_GRANULE 4#define TAG_GRANULE (1 << LOG2_TAG_GRANULE) +/* Bits within a descriptor passed to the helper_mte_check* functions. */ +FIELD(MTEDESC, MIDX, 0, 4) +FIELD(MTEDESC, TBI, 4, 2) +FIELD(MTEDESC, TCMA, 6, 2) +FIELD(MTEDESC, WRITE, 8, 1) +FIELD(MTEDESC, ESIZE, 9, 5) +FIELD(MTEDESC, TSIZE, 14, 10) /* mte_checkN only */ +static inline int allocation_tag_from_addr (uint64_t ptr) {return extract64 (ptr,56 ,4 );
target/arm/translate-a64.h +2 -0
@@ -40,6 +40,8 @@ TCGv_ptr get_fpstatus_ptr(bool);bool logic_imm_decode_wmask (uint64_t *result,unsigned int immn,unsigned int imms,unsigned int immr);bool sve_access_check (DisasContext *s); +TCGv_i64 gen_mte_check1 (DisasContext *s,TCGv_i64 addr,bool is_write, +bool tag_checked,int log2_size);/* We should have at some point before trying to access an FP register * done the necessary access check, so assert that
target/arm/mte_helper.c +8 -0
@@ -358,3 +358,11 @@ void HELPER(stzgm_tags)(CPUARMState *env, uint64_t ptr, uint64_t val)memset (mem, tag_pair, tag_bytes); } } + +/* +* Perform an MTE checked access for a single logical or atomic access. +*/ +uint64_t HELPER (mte_check1 )(CPUARMState *env,uint32_t desc,uint64_t ptr) +{ +return ptr; +}
target/arm/translate-a64.c +72 -24
202 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 23/42] target/arm: Add gen_mte_check1
Quoted 14 lines · Richard Henderson
Replace existing uses of
check_data_tbiintranslate-a64.cthat perform a single logical memory access. Leave the helper blank for now to reduce the patch size.Signed-off-by Richard Henderson <[email protected]>target/arm/translate-a64.c +0
-0@@ -204,20 +204,20 @@ static void gen_a64_set_pc(DisasContext *s, TCGv_i64 src) }
target/arm/translate-a64.c static void gen_a64_set_pc(DisasContext *s, TCGv_i64 src) · line 212
Quoted 10 lines
target/arm/translate-a64.c +6
-3/* -* Return a "clean" address for ADDR according to TBID. -* This is always a fresh temporary, as we need to be able to -* increment this independently of a dirty write-back address. +* Handle MTE and/or TBI. +* +* For TBI, ideally, we would do nothing. Proper behaviour on fault is +* for the tag to be present in the FAR_ELx register. But for user-only +* mode, we do not have a TLB with which to implement this, so we must +* remote the top byte now.
"remove".
Otherwise
thanks
-- PMM
PATCH v7 24/42 target/arm: Add gen_mte_checkN
In reply to Richard HendersonReplace existing uses of check_data_tbi in translate-a64.c that perform multiple logical memory access. Leave the helper blank for now to reduce the patch size.
--- target/arm/helper-a64.h | 1 + target/arm/translate-a64.h | 2 ++ target/arm/mte_helper.c | 8 +++++ target/arm/translate-a64.c | 71 +++++++++++++++++++++++++++++--------- 4 files changed, 66 insertions(+), 16 deletions(-)
target/arm/helper-a64.h +1 -0
@@ -105,6 +105,7 @@ DEF_HELPER_FLAGS_2(xpaci, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_2(xpacd, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_3(mte_check1, TCG_CALL_NO_WG, i64, env, i32, i64) +DEF_HELPER_FLAGS_3(mte_checkN, TCG_CALL_NO_WG, i64, env, i32, i64) DEF_HELPER_FLAGS_3(irg, TCG_CALL_NO_RWG, i64, env, i64, i64) DEF_HELPER_FLAGS_4(addsubg, TCG_CALL_NO_RWG_SE, i64, env, i64, s32, i32)DEF_HELPER_FLAGS_3 (ldg,TCG_CALL_NO_WG , i64, env, i64, i64)
target/arm/translate-a64.h +2 -0
@@ -42,6 +42,8 @@ bool logic_imm_decode_wmask(uint64_t *result, unsigned int immn,bool sve_access_check (DisasContext *s);TCGv_i64 gen_mte_check1 (DisasContext *s,TCGv_i64 addr,bool is_write,bool tag_checked,int log2_size); +TCGv_i64 gen_mte_checkN (DisasContext *s,TCGv_i64 addr,bool is_write, +bool tag_checked,int count,int log2_esize);/* We should have at some point before trying to access an FP register * done the necessary access check, so assert that
target/arm/mte_helper.c +8 -0
@@ -366,3 +366,11 @@ uint64_t HELPER(mte_check1)(CPUARMState *env, uint32_t desc, uint64_t ptr) {return ptr; } + +/* +* Perform an MTE checked access for multiple logical accesses. +*/ +uint64_t HELPER (mte_checkN )(CPUARMState *env,uint32_t desc,uint64_t ptr) +{ +return ptr; +}
target/arm/translate-a64.c +55 -16
131 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 24/42] target/arm: Add gen_mte_checkN
Quoted 7 lines · Richard Henderson
Replace existing uses of
check_data_tbiintranslate-a64.cthat perform multiple logical memory access. Leave the helper blank for now to reduce the patch size.Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v7 25/42 target/arm: Implement helper_mte_check1
In reply to Richard HendersonFill out the stub that was added earlier.
--- target/arm/internals.h | 47 +++++++++++++++ target/arm/mte_helper.c | 126 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 172 insertions(+), 1 deletion(-)
target/arm/internals.h +47 -0
@@ -1318,6 +1318,9 @@ FIELD(MTEDESC, WRITE, 8, 1) FIELD(MTEDESC, ESIZE, 9, 5) FIELD(MTEDESC, TSIZE, 14, 10) /* mte_checkN only */ +bool mte_probe1 (CPUARMState *env,uint32_t desc,uint64_t ptr,uintptr_t ra); +uint64_t mte_check1 (CPUARMState *env,uint32_t desc,uint64_t ptr,uintptr_t ra); +static inline int allocation_tag_from_addr (uint64_t ptr) {return extract64 (ptr,56 ,4 );
@@ -1328,4 +1331,48 @@ static inline uint64_t address_with_allocation_tag(uint64_t ptr, int rtag) return deposit64(ptr, 56, 4, rtag); } +/* Return true if tbi bits mean that the access is checked. */ +static inline bool tbi_check (uint32_t desc,int bit55) +{ +return (desc >> (R_MTEDESC_TBI_SHIFT + bit55)) &1 ; +} + +/* Return true if tcma bits mean that the access is unchecked. */ +static inline bool tcma_check (uint32_t desc,int bit55,int ptr_tag) +{ +/* +* We had extracted bit55 and ptr_tag for other reasons, so fold +* (ptr<59:55> == 00000 || ptr<59:55> == 11111) into a single test. +*/ +bool match = ((ptr_tag + bit55) &0xf ) ==0 ; +bool tcma = (desc >> (R_MTEDESC_TCMA_SHIFT + bit55)) &1 ; +return tcma && match; +} + +/* +* For TBI, ideally, we would do nothing. Proper behaviour on fault is +* for the tag to be present in the FAR_ELx register. But for user-only +* mode, we do not have a TLB with which to implement this, so we must +* remote the top byte. +*/ +static inline uint64_t useronly_clean_ptr (uint64_t ptr) +{ +/* TBI is known to be enabled. */ +#ifdef CONFIG_USER_ONLY + ptr =sextract64 (ptr,0 ,56 ); +#endif +return ptr; +} + +static inline uint64_t useronly_maybe_clean_ptr (uint32_t desc,uint64_t ptr) +{ +#ifdef CONFIG_USER_ONLY +int64_t clean_ptr =sextract64 (ptr,0 ,56 ); +if (tbi_check (desc, clean_ptr <0 )) { + ptr = clean_ptr; + } +#endif +return ptr; +} +#endif
target/arm/mte_helper.c +125 -1
137 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 25/42] target/arm: Implement helper_mte_check1
Quoted 25 lines · Richard Henderson
Fill out the stub that was added earlier.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/internals.h | 47 +++++++++++++++ target/arm/mte_helper.c | 126 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 172 insertions(+), 1 deletion(-)target/arm/internals.h +3
-0@@ -1318,6 +1318,9 @@ FIELD(MTEDESC, WRITE, 8, 1) FIELD(MTEDESC, ESIZE, 9, 5) FIELD(MTEDESC, TSIZE, 14, 10) /* mte_checkN only */ +bool mte_probe1 (CPUARMState *env,uint32_t desc,uint64_t ptr,uintptr_t ra); +uint64_t mte_check1 (CPUARMState *env,uint32_t desc,uint64_t ptr,uintptr_t ra); +static inline int allocation_tag_from_addr (uint64_t ptr) {return extract64 (ptr,56 ,4 );@@ -1328,4 +1331,48 @@ static inline uint64_t address_with_allocation_tag(uint64_t ptr, int rtag)return deposit64 (ptr,56 ,4 , rtag);
target/arm/internals.h static inline uint64_t address_with_allocation_tag(uint64_t ptr, int rtag) · line 1341
Quoted 10 lines
target/arm/internals.h +8
-0} +/* Return true if tbi bits mean that the access is checked. */ +static inline bool tbi_check (uint32_t desc,int bit55) +{ +return (desc >> (R_MTEDESC_TBI_SHIFT + bit55)) &1 ; +} + +/* Return true if tcma bits mean that the access is unchecked. */ +static inline bool tcma_check (uint32_t desc,int bit55,int ptr_tag)
It's a bit confusing that one of these foo_check()s returns "true for checked access" and the other one returns "true for unchecked access"...
thanks
-- PMM
Re: [PATCH v7 25/42] target/arm: Implement helper_mte_check1
Quoted 4 lines · Peter Maydell
Quoted 4 lines
target/arm/internals.h +4
-0+/* Return true if tbi bits mean that the access is checked. */ +static inline bool tbi_check (uint32_t desc,int bit55) +{ +return (desc >> (R_MTEDESC_TBI_SHIFT + bit55)) &1 ;
Quoted 8 lines
target/arm/internals.h static inline uint64_t address_with_allocation_tag(uint64_t ptr, int rtag) · line 1341
Quoted 4 lines
target/arm/internals.h +4
-0+} + +/* Return true if tcma bits mean that the access is unchecked. */ +static inline bool tcma_check (uint32_t desc,int bit55,int ptr_tag)It's a bit confusing that one of these foo_check()s returns "true for checked access" and the other one returns "true for unchecked access"...
Yes, but that's true of the hardware bits too. I tried to reverse them but then got confused.
r~
Re: [PATCH v7 25/42] target/arm: Implement helper_mte_check1
In reply to Richard HendersonQuoted 10 lines · Richard Henderson
Fill out the stub that was added earlier.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/internals.h | 47 +++++++++++++++ target/arm/mte_helper.c | 126 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 172 insertions(+), 1 deletion(-)
Quoted 5 lines
+/*
+ * For TBI, ideally, we would do nothing. Proper behaviour on fault is
+ * for the tag to be present in theFAR_ELxregister. But for user-only
+ * mode, we do not have a TLB with which to implement this, so we must
+ * remote the top byte.
"remove"
target/arm/internals.h static inline uint64_t address_with_allocation_tag(uint64_t ptr, int rtag)
Quoted 13 lines
+ */
target/arm/internals.h +11
-0+static inline uint64_t useronly_clean_ptr (uint64_t ptr) +{ +/* TBI is known to be enabled. */ +#ifdef CONFIG_USER_ONLY + ptr =sextract64 (ptr,0 ,56 ); +#endif +return ptr; +} + +/* No-fault version of mte_check1, to be used by SVE for MemSingleNF. */ +bool mte_probe1 (CPUARMState *env,uint32_t desc,uint64_t ptr,uintptr_t ra)
If this is a no-fault version, why do we need to pass in the ra ?
target/arm/mte_helper.c void HELPER(stzgm_tags)(CPUARMState *env, uint64_t ptr, uint64_t val) · line 470
Quoted 10 lines
target/arm/mte_helper.c +10
-0+{ +int bit55 =extract64 (ptr,55 ,1 ); + +/* If TBI is disabled, the access is unchecked. */ +if (unlikely (!tbi_check (desc, bit55))) { +return true; + } + +return mte_probe1_int (env, desc, ptr, ra, bit55); +}
thanks
-- PMM
Re: [PATCH v7 25/42] target/arm: Implement helper_mte_check1
Quoted 4 lines · Peter Maydell
target/arm/mte_helper.c void HELPER(stzgm_tags)(CPUARMState *env, uint64_t ptr, uint64_t val) · line 460
Quoted 2 lines
target/arm/mte_helper.c +2
-0+/* No-fault version of mte_check1, to be used by SVE for MemSingleNF. */ +bool mte_probe1 (CPUARMState *env,uint32_t desc,uint64_t ptr,uintptr_t ra)If this is a no-fault version, why do we need to pass in the ra ?
Excellent question.
At first blush this doesn't actually implement no-fault at all, since it looks as if probe_access_flags would in fact fault. Except that within sve, we've already probed the page and this is just to handle the mte check.
I think I'll remove the argument, pass 0 down to allocation_tag_mem, assert that the page is valid, and document the process.
r~
PATCH v7 26/42 target/arm: Implement helper_mte_checkN
In reply to Richard HendersonFill out the stub that was added earlier.
---
v7: Fix page crossing test (szabolcs nagy).
--- target/arm/internals.h | 1 + target/arm/mte_helper.c | 165 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 165 insertions(+), 1 deletion(-)
target/arm/internals.h +1 -0
@@ -1320,6 +1320,7 @@ FIELD(MTEDESC, TSIZE, 14, 10) /* mte_checkN only */bool mte_probe1 (CPUARMState *env,uint32_t desc,uint64_t ptr,uintptr_t ra);uint64_t mte_check1 (CPUARMState *env,uint32_t desc,uint64_t ptr,uintptr_t ra); +uint64_t mte_checkN (CPUARMState *env,uint32_t desc,uint64_t ptr,uintptr_t ra);static inline int allocation_tag_from_addr (uint64_t ptr) {
target/arm/mte_helper.c +164 -1
171 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 26/42] target/arm: Implement helper_mte_checkN
Quoted 7 lines · Richard Henderson
Fill out the stub that was added earlier.
Signed-off-by Richard Henderson <[email protected]>---
v7: Fix page crossing test (szabolcs nagy).
---
thanks
-- PMM
PATCH v7 27/42 target/arm: Add helper_mte_check_zva
In reply to Richard HendersonUse a special helper for DC_ZVA, rather than the more general mte_checkN. Leave the helper blank for now.
--- target/arm/helper-a64.h | 1 + target/arm/mte_helper.c | 106 +++++++++++++++++++++++++++++++++++++ target/arm/translate-a64.c | 16 +++++- 3 files changed, 122 insertions(+), 1 deletion(-)
target/arm/helper-a64.h +1 -0
@@ -106,6 +106,7 @@ DEF_HELPER_FLAGS_2(xpacd, TCG_CALL_NO_RWG_SE, i64, env, i64) DEF_HELPER_FLAGS_3(mte_check1, TCG_CALL_NO_WG, i64, env, i32, i64) DEF_HELPER_FLAGS_3(mte_checkN, TCG_CALL_NO_WG, i64, env, i32, i64) +DEF_HELPER_FLAGS_3(mte_check_zva, TCG_CALL_NO_WG, i64, env, i32, i64) DEF_HELPER_FLAGS_3(irg, TCG_CALL_NO_RWG, i64, env, i64, i64) DEF_HELPER_FLAGS_4(addsubg, TCG_CALL_NO_RWG_SE, i64, env, i64, s32, i32)DEF_HELPER_FLAGS_3 (ldg,TCG_CALL_NO_WG , i64, env, i64, i64)
target/arm/mte_helper.c +106 -0
109 lines not on this page · raw message
target/arm/translate-a64.c +15 -1
@@ -1848,7 +1848,21 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,return ;case ARM_CP_DC_ZVA :/* Writes clear the aligned block of memory which rt points into. */ - tcg_rt =clean_data_tbi (s,cpu_reg (s, rt)); +if (s->mte_active[0 ]) { +TCGv_i32 t_desc; +int desc =0 ; + + desc =FIELD_DP32 (desc,MTEDESC ,MIDX ,get_mem_index (s)); + desc =FIELD_DP32 (desc,MTEDESC ,TBI , s->tbid); + desc =FIELD_DP32 (desc,MTEDESC ,TCMA , s->tcma); + t_desc =tcg_const_i32 (desc); + + tcg_rt =new_tmp_a64 (s); +gen_helper_mte_check_zva (tcg_rt, cpu_env, t_desc,cpu_reg (s, rt)); +tcg_temp_free_i32 (t_desc); + }else { + tcg_rt =clean_data_tbi (s,cpu_reg (s, rt)); + }gen_helper_dc_zva (cpu_env, tcg_rt);return ;default :
Signature · 1 line
2.25.1
Re: [PATCH v7 27/42] target/arm: Add helper_mte_check_zva
Quoted 5 lines · Richard Henderson
Use a special helper for
DC_ZVA, rather than the more generalmte_checkN. Leave the helper blank for now.Signed-off-by Richard Henderson <[email protected]>
Helper does not appear to be blank :-)
Otherwise
thanks
-- PMM
PATCH v7 28/42 target/arm: Use mte_checkN for sve unpredicated loads
In reply to Richard Henderson--- target/arm/helper-sve.h | 2 + target/arm/sve_helper.c | 70 +++++++++++++++++++++++++++- target/arm/translate-sve.c | 93 ++++++++++++++++---------------------- 3 files changed, 109 insertions(+), 56 deletions(-)
target/arm/helper-sve.h +2 -0
@@ -1138,6 +1138,8 @@ DEF_HELPER_FLAGS_5(sve_ftmad_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_ftmad_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_ftmad_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ldr, TCG_CALL_NO_WG, void, env, ptr, tl, int) + DEF_HELPER_FLAGS_4(sve_ld1bb_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_ld2bb_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32)DEF_HELPER_FLAGS_4 (sve_ld3bb_r,TCG_CALL_NO_WG , void, env, ptr, tl, i32)
target/arm/sve_helper.c +69 -1
82 lines not on this page · raw message
target/arm/translate-sve.c +38 -55
127 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 28/42] target/arm: Use mte_checkN for sve unpredicated loads
Quoted 2 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>
Commit message suggests we should be just adding an MTE check but patch contents appear to be moving insn implementation from inline codegen to a helper function? If you want to do that it would probably be easier to review done separately from adding the MTE check.
thanks
-- PMM
Re: [PATCH v7 28/42] target/arm: Use mte_checkN for sve unpredicated loads
Quoted 10 lines · Peter Maydell
Quoted 2 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>Commit message suggests we should be just adding an MTE check but patch contents appear to be moving insn implementation from inline codegen to a helper function? If you want to do that it would probably be easier to review done separately from adding the MTE check.
I don't recall why I did that. I've made a more minimal change for both of these.
r~
PATCH v7 29/42 target/arm: Use mte_checkN for sve unpredicated stores
In reply to Richard Henderson--- target/arm/helper-sve.h | 1 + target/arm/sve_helper.c | 63 ++++++++++++++++++++++++++- target/arm/translate-sve.c | 88 ++++++++++++++------------------------ 3 files changed, 94 insertions(+), 58 deletions(-)
target/arm/helper-sve.h +1 -0
@@ -1139,6 +1139,7 @@ DEF_HELPER_FLAGS_5(sve_ftmad_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_ftmad_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_ldr, TCG_CALL_NO_WG, void, env, ptr, tl, int) +DEF_HELPER_FLAGS_4(sve_str, TCG_CALL_NO_WG, void, env, ptr, tl, int) DEF_HELPER_FLAGS_4(sve_ld1bb_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32)DEF_HELPER_FLAGS_4 (sve_ld2bb_r,TCG_CALL_NO_WG , void, env, ptr, tl, i32)
target/arm/sve_helper.c +62 -1
75 lines not on this page · raw message
target/arm/translate-sve.c +31 -57
109 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 29/42] target/arm: Use mte_checkN for sve unpredicated stores
Quoted 7 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/helper-sve.h | 1 + target/arm/sve_helper.c | 63 ++++++++++++++++++++++++++- target/arm/translate-sve.c | 88 ++++++++++++++------------------------ 3 files changed, 94 insertions(+), 58 deletions(-)
Same remarks as patch 28.
thanks
-- PMM
PATCH v7 30/42 target/arm: Use mte_check1 for sve LD1R
In reply to Richard Henderson--- target/arm/translate-sve.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
target/arm/translate-sve.c +8 -6
@@ -4830,16 +4830,16 @@ static bool trans_LD1RQ_zpri(DisasContext *s, arg_rpri_load *a)/* Load and broadcast element. */ static bool trans_LD1R_zpri (DisasContext *s,arg_rpri_load *a) { -if (!sve_access_check (s)) { -return true; - } -unsigned vsz =vec_full_reg_size (s);unsigned psz =pred_full_reg_size (s);unsigned esz = dtype_esz[a->dtype];unsigned msz =dtype_msz (a->dtype);TCGLabel *over =gen_new_label (); -TCGv_i64 temp; +TCGv_i64 temp, clean_addr; + +if (!sve_access_check (s)) { +return true; + }/* If the guarding predicate has no bits set, no load occurs. */ if (psz <=8 ) {
@@ -4862,7 +4862,9 @@ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a)/* Load the data. */ temp =tcg_temp_new_i64 ();tcg_gen_addi_i64 (temp,cpu_reg_sp (s, a->rn), a->imm << msz); -tcg_gen_qemu_ld_i64 (temp, temp,get_mem_index (s), + clean_addr =gen_mte_check1 (s, temp, false, true, msz); + +tcg_gen_qemu_ld_i64 (temp, clean_addr,get_mem_index (s), s->be_data | dtype_mop[a->dtype]);/* Broadcast to *all* elements. */
Signature · 1 line
2.25.1
Re: [PATCH v7 30/42] target/arm: Use mte_check1 for sve LD1R
Quoted 19 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/translate-sve.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)target/arm/translate-sve.c +0
-4@@ -4830,16 +4830,16 @@ static bool trans_LD1RQ_zpri(DisasContext *s, arg_rpri_load *a)/* Load and broadcast element. */ static bool trans_LD1R_zpri (DisasContext *s,arg_rpri_load *a) { -if (!sve_access_check (s)) { -return true; - } -unsigned vsz =vec_full_reg_size (s);
target/arm/translate-sve.c static bool trans_LD1RQ_zpri(DisasContext *s, arg_rpri_load *a) · line 4842
Quoted 10 lines
target/arm/translate-sve.c +5
-1unsigned psz =pred_full_reg_size (s);unsigned esz = dtype_esz[a->dtype];unsigned msz =dtype_msz (a->dtype);TCGLabel *over =gen_new_label (); -TCGv_i64 temp; +TCGv_i64 temp, clean_addr; + +if (!sve_access_check (s)) { +return true; + }
This cleanup should really be its own patch.
We should probably not call gen_new_label() until after the sve_access_check() ?
Quoted 5 lines
target/arm/translate-sve.c +0
-0/* If the guarding predicate has no bits set, no load occurs. */ if (psz <=8 ) {@@ -4862,7 +4862,9 @@ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a)/* Load the data. */
target/arm/translate-sve.c static bool trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a)
Quoted 10 lines
target/arm/translate-sve.c +3
-2temp =tcg_temp_new_i64 ();tcg_gen_addi_i64 (temp,cpu_reg_sp (s, a->rn), a->imm << msz); -tcg_gen_qemu_ld_i64 (temp, temp,get_mem_index (s), + clean_addr =gen_mte_check1 (s, temp, false, true, msz); + +tcg_gen_qemu_ld_i64 (temp, clean_addr,get_mem_index (s), s->be_data | dtype_mop[a->dtype]);/* Broadcast to *all* elements. */ --
This patch of the change looks good.
thanks
-- PMM
Re: [PATCH v7 30/42] target/arm: Use mte_check1 for sve LD1R
Quoted 20 lines · Peter Maydell
Quoted 7 lines
static bool
trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a){target/arm/translate-sve.c +0
-4-if (!sve_access_check (s)) { -return true; - } -unsigned vsz =vec_full_reg_size (s);target/arm/translate-sve.c static bool trans_LD1RQ_zpri(DisasContext *s, arg_rpri_load *a) · line 4842
Quoted 10 lines
target/arm/translate-sve.c +5
-1unsigned psz =pred_full_reg_size (s);unsigned esz = dtype_esz[a->dtype];unsigned msz =dtype_msz (a->dtype);TCGLabel *over =gen_new_label (); -TCGv_i64 temp; +TCGv_i64 temp, clean_addr; + +if (!sve_access_check (s)) { +return true; + }This cleanup should really be its own patch.
Quoted 2 lines
We should probably not call
gen_new_label()until after thesve_access_check()?
Done.
r~
PATCH v7 31/42 target/arm: Add mte helpers for sve scalar + int loads
In reply to Richard HendersonBecause the elements are sequential, we can eliminate many tests all at once when the tag hits TCMA, or if the page(s) are not Tagged.
--- target/arm/helper-sve.h | 58 ++++++++++ target/arm/internals.h | 6 + target/arm/sve_helper.c | 218 ++++++++++++++++++++++++++++++------- target/arm/translate-sve.c | 186 ++++++++++++++++++++++--------- 4 files changed, 377 insertions(+), 91 deletions(-)
target/arm/helper-sve.h +58 -0
@@ -1199,6 +1199,64 @@ DEF_HELPER_FLAGS_4(sve_ld1sds_le_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_ld1sdu_be_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_ld1sds_be_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld2bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld3bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld4bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1hh_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld2hh_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld3hh_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld4hh_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1hh_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld2hh_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld3hh_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld4hh_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1ss_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld2ss_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld3ss_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld4ss_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1ss_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld2ss_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld3ss_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld4ss_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1dd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld2dd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld3dd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld4dd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1dd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld2dd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld3dd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld4dd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1bhu_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1bsu_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1bdu_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1bhs_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1bss_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1bds_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1hsu_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1hdu_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1hss_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1hds_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1hsu_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1hdu_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1hss_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1hds_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1sdu_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1sds_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_ld1sdu_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ld1sds_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + DEF_HELPER_FLAGS_4(sve_ldff1bb_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_ldff1bhu_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32)DEF_HELPER_FLAGS_4 (sve_ldff1bsu_r,TCG_CALL_NO_WG , void, env, ptr, tl, i32)
target/arm/internals.h +6 -0
@@ -1310,6 +1310,12 @@ void arm_log_exception(int idx);#define LOG2_TAG_GRANULE 4#define TAG_GRANULE (1 << LOG2_TAG_GRANULE) +/* +* The SVE simd_data field, for memory ops, contains either +* rd (5 bits) or a shift count (2 bits). +*/ +#define SVE_MTEDESC_SHIFT 5 +/* Bits within a descriptor passed to the helper_mte_check* functions. */ FIELD(MTEDESC, MIDX, 0, 4)FIELD (MTEDESC ,TBI ,4 ,2 )
target/arm/sve_helper.c +179 -39
253 lines not on this page · raw message
target/arm/translate-sve.c +134 -52
237 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 31/42] target/arm: Add mte helpers for sve scalar + int loads
Quoted 6 lines · Richard Henderson
Because the elements are sequential, we can eliminate many tests all at once when the tag hits TCMA, or if the page(s) are not Tagged.
Signed-off-by Richard Henderson <[email protected]>
target/arm/sve_helper.c static void sve_cont_ldst_watchpoints(SVEContLdSt *info, CPUARMState *env, · line 4536
Quoted 10 lines
target/arm/sve_helper.c +10
-0+static inline QEMU_ALWAYS_INLINE +void sve_cont_ldst_mte_check_int(SVEContLdSt *info, CPUARMState *env, +uint64_t *vg,target_ulong addr,int esize, +int msize,uint32_t mtedesc,uintptr_t ra, +mte_check_fn *check) +{ +intptr_t mem_off, reg_off, reg_last; + +/* Process the page only if MemAttr == Tagged. */ +if (info->page[0 ].attrs.target_tlb_bit1) {
It's a bit odd to use this bit here when you don't define what it is until patch 40. (Similarly for the next few patches.)
thanks
-- PMM
Re: [PATCH v7 31/42] target/arm: Add mte helpers for sve scalar + int loads
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Richard Henderson
Because the elements are sequential, we can eliminate many tests all at once when the tag hits TCMA, or if the page(s) are not Tagged.
Signed-off-by Richard Henderson <[email protected]>
Quoted 13 lines
target/arm/sve_helper.c static void sve_cont_ldst_watchpoints(SVEContLdSt *info, CPUARMState *env, · line 4536
Quoted 10 lines
target/arm/sve_helper.c +10
-0+static inline QEMU_ALWAYS_INLINE +void sve_cont_ldst_mte_check_int(SVEContLdSt *info, CPUARMState *env, +uint64_t *vg,target_ulong addr,int esize, +int msize,uint32_t mtedesc,uintptr_t ra, +mte_check_fn *check) +{ +intptr_t mem_off, reg_off, reg_last; + +/* Process the page only if MemAttr == Tagged. */ +if (info->page[0 ].attrs.target_tlb_bit1) {It's a bit odd to use this bit here when you don't define what it is until patch 40. (Similarly for the next few patches.)
Perhaps. What do you suggest to resolve this? Moving the system patches earlier?
Just defining some inline functions for self-documentation?
r~
PATCH v7 32/42 target/arm: Add mte helpers for sve scalar + int stores
In reply to Richard HendersonBecause the elements are sequential, we can eliminate many tests all at once when the tag hits TCMA, or if the page(s) are not Tagged.
--- target/arm/helper-sve.h | 47 +++++++++++ target/arm/sve_helper.c | 95 ++++++++++++++++------ target/arm/translate-sve.c | 162 ++++++++++++++++++++++++------------- 3 files changed, 226 insertions(+), 78 deletions(-)
target/arm/helper-sve.h +47 -0
@@ -1366,6 +1366,53 @@ DEF_HELPER_FLAGS_4(sve_st1hd_be_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_st1sd_le_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_st1sd_be_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st1bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st2bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st3bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st4bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_st1hh_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st2hh_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st3hh_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st4hh_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_st1hh_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st2hh_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st3hh_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st4hh_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_st1ss_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st2ss_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st3ss_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st4ss_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_st1ss_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st2ss_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st3ss_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st4ss_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_st1dd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st2dd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st3dd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st4dd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_st1dd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st2dd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st3dd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st4dd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_st1bh_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st1bs_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st1bd_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_st1hs_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st1hd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st1hs_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st1hd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4(sve_st1sd_le_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_st1sd_be_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldbsu_zsu,TCG_CALL_NO_WG , void, env, ptr, ptr, ptr, tl, i32) DEF_HELPER_FLAGS_6(sve_ldhsu_le_zsu, TCG_CALL_NO_WG,
target/arm/sve_helper.c +72 -23
116 lines not on this page · raw message
target/arm/translate-sve.c +107 -55
180 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v7 33/42 target/arm: Add mte helpers for sve scalar + int ff/nf loads
In reply to Richard HendersonBecause the elements are sequential, we can eliminate many tests all at once when the tag hits TCMA, or if the page(s) are not Tagged.
--- target/arm/helper-sve.h | 98 ++++++++++++++++ target/arm/sve_helper.c | 98 ++++++++++++++-- target/arm/translate-sve.c | 232 +++++++++++++++++++++++++------------ 3 files changed, 342 insertions(+), 86 deletions(-)
target/arm/helper-sve.h +98 -0
@@ -1288,6 +1288,55 @@ DEF_HELPER_FLAGS_4(sve_ldff1sds_be_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_ldff1dd_le_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_ldff1dd_be_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldff1bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldff1bhu_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldff1bsu_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldff1bdu_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldff1bhs_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldff1bss_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldff1bds_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldff1hh_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1hsu_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1hdu_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1hss_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1hds_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldff1hh_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1hsu_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1hdu_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1hss_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1hds_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldff1ss_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1sdu_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1sds_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldff1ss_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1sdu_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1sds_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldff1dd_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldff1dd_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + DEF_HELPER_FLAGS_4(sve_ldnf1bb_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_ldnf1bhu_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32)DEF_HELPER_FLAGS_4 (sve_ldnf1bsu_r,TCG_CALL_NO_WG , void, env, ptr, tl, i32)
@@ -1319,6 +1368,55 @@ DEF_HELPER_FLAGS_4(sve_ldnf1sds_be_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_ldnf1dd_le_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_ldnf1dd_be_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldnf1bb_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldnf1bhu_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldnf1bsu_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldnf1bdu_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldnf1bhs_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldnf1bss_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4(sve_ldnf1bds_r_mte, TCG_CALL_NO_WG, void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldnf1hh_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1hsu_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1hdu_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1hss_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1hds_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldnf1hh_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1hsu_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1hdu_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1hss_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1hds_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldnf1ss_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1sdu_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1sds_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldnf1ss_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1sdu_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1sds_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + +DEF_HELPER_FLAGS_4 (sve_ldnf1dd_le_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve_ldnf1dd_be_r_mte,TCG_CALL_NO_WG , + void, env, ptr, tl, i32) + DEF_HELPER_FLAGS_4(sve_st1bb_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32) DEF_HELPER_FLAGS_4(sve_st2bb_r, TCG_CALL_NO_WG, void, env, ptr, tl, i32)DEF_HELPER_FLAGS_4 (sve_st3bb_r,TCG_CALL_NO_WG , void, env, ptr, tl, i32)
target/arm/sve_helper.c +86 -12
164 lines not on this page · raw message
target/arm/translate-sve.c +158 -74
270 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v7 34/42 target/arm: Handle TBI for sve scalar + int memory ops
In reply to Richard HendersonWe still need to handle tbi for user-only when mte is inactive.
--- target/arm/translate-a64.h | 1 + target/arm/translate-a64.c | 2 +- target/arm/translate-sve.c | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-)
target/arm/translate-a64.h +1 -0
@@ -40,6 +40,7 @@ TCGv_ptr get_fpstatus_ptr(bool);bool logic_imm_decode_wmask (uint64_t *result,unsigned int immn,unsigned int imms,unsigned int immr);bool sve_access_check (DisasContext *s); +TCGv_i64 clean_data_tbi (DisasContext *s,TCGv_i64 addr);TCGv_i64 gen_mte_check1 (DisasContext *s,TCGv_i64 addr,bool is_write,bool tag_checked,int log2_size); TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write,
target/arm/translate-a64.c +1 -1
@@ -215,7 +215,7 @@ static void gen_a64_set_pc(DisasContext *s, TCGv_i64 src)* of the write-back address. */ -static TCGv_i64 clean_data_tbi (DisasContext *s,TCGv_i64 addr) +TCGv_i64 clean_data_tbi (DisasContext *s,TCGv_i64 addr) {TCGv_i64 clean =new_tmp_a64 (s);#ifdef CONFIG_USER_ONLY
target/arm/translate-sve.c +4 -2
@@ -4534,9 +4534,8 @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr,* For e.g. LD4, there are not enough arguments to pass all 4 * registers as pointers, so encode the regno into the data field. * For consistency, do this even for LD1. -* TODO: mte_n check here while callers are updated. */ -if (mte_n && s->mte_active[0 ]) { +if (s->mte_active[0 ]) {int msz =dtype_msz (dtype); desc =FIELD_DP32 (desc,MTEDESC ,MIDX ,get_mem_index (s));
@@ -4546,7 +4545,10 @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, desc =FIELD_DP32 (desc,MTEDESC ,ESIZE ,1 << msz); desc =FIELD_DP32 (desc,MTEDESC ,TSIZE , mte_n << msz); desc <<=SVE_MTEDESC_SHIFT ; + }else { + addr =clean_data_tbi (s, addr); } + desc =simd_desc (vsz, vsz, zt | desc); t_desc =tcg_const_i32 (desc); t_pg =tcg_temp_new_ptr ();
Signature · 1 line
2.25.1
Re: [PATCH v7 34/42] target/arm: Handle TBI for sve scalar + int memory ops
Quoted 5 lines · Richard Henderson
We still need to handle tbi for user-only when mte is inactive.
Signed-off-by Richard Henderson <[email protected]>---
I don't really understand how the commit message and the code change go together here...
thanks
-- PMM
PATCH v7 35/42 target/arm: Add mte helpers for sve scatter/gather memory ops
In reply to Richard HendersonBecause the elements are non-sequential, we cannot eliminate many tests straight away like we can for sequential operations. But we often have the PTE details handy, so we can test for Tagged.
--- target/arm/helper-sve.h | 285 ++++++++++++++++ target/arm/sve_helper.c | 185 +++++++++-- target/arm/translate-sve.c | 650 +++++++++++++++++++++++++------------ 3 files changed, 872 insertions(+), 248 deletions(-)
target/arm/helper-sve.h +285 -0
@@ -1620,6 +1620,115 @@ DEF_HELPER_FLAGS_6(sve_ldsds_le_zd, TCG_CALL_NO_WG,DEF_HELPER_FLAGS_6 (sve_ldsds_be_zd,TCG_CALL_NO_WG , void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldbsu_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhsu_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhsu_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldss_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldss_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldbss_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhss_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhss_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_ldbsu_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhsu_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhsu_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldss_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldss_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldbss_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhss_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhss_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_ldbdu_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhdu_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhdu_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsdu_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsdu_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_lddd_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_lddd_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldbds_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhds_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhds_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsds_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsds_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_ldbdu_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhdu_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhdu_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsdu_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsdu_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_lddd_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_lddd_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldbds_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhds_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhds_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsds_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsds_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_ldbdu_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhdu_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhdu_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsdu_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsdu_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_lddd_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_lddd_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldbds_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhds_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldhds_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsds_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldsds_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffbsu_zsu,TCG_CALL_NO_WG , void, env, ptr, ptr, ptr, tl, i32) DEF_HELPER_FLAGS_6(sve_ldffhsu_le_zsu, TCG_CALL_NO_WG,
@@ -1729,6 +1838,115 @@ DEF_HELPER_FLAGS_6(sve_ldffsds_le_zd, TCG_CALL_NO_WG,DEF_HELPER_FLAGS_6 (sve_ldffsds_be_zd,TCG_CALL_NO_WG , void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffbsu_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhsu_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhsu_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffss_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffss_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffbss_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhss_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhss_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_ldffbsu_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhsu_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhsu_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffss_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffss_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffbss_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhss_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhss_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_ldffbdu_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhdu_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhdu_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsdu_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsdu_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffdd_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffdd_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffbds_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhds_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhds_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsds_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsds_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_ldffbdu_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhdu_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhdu_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsdu_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsdu_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffdd_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffdd_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffbds_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhds_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhds_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsds_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsds_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_ldffbdu_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhdu_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhdu_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsdu_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsdu_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffdd_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffdd_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffbds_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhds_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffhds_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsds_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_ldffsds_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stbs_zsu,TCG_CALL_NO_WG , void, env, ptr, ptr, ptr, tl, i32) DEF_HELPER_FLAGS_6(sve_sths_le_zsu, TCG_CALL_NO_WG,
@@ -1796,4 +2014,71 @@ DEF_HELPER_FLAGS_6(sve_stdd_le_zd, TCG_CALL_NO_WG,DEF_HELPER_FLAGS_6 (sve_stdd_be_zd,TCG_CALL_NO_WG , void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stbs_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sths_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sths_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stss_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stss_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_stbs_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sths_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sths_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stss_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stss_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_stbd_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sthd_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sthd_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stsd_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stsd_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stdd_le_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stdd_be_zsu_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_stbd_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sthd_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sthd_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stsd_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stsd_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stdd_le_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stdd_be_zss_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_6 (sve_stbd_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sthd_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_sthd_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stsd_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stsd_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stdd_le_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_6 (sve_stdd_be_zd_mte,TCG_CALL_NO_WG , + void, env, ptr, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_4 (sve2_pmull_h,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, i32)
target/arm/sve_helper.c +153 -32
268 lines not on this page · raw message
target/arm/translate-sve.c +434 -216
761 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v7 36/42 target/arm: Complete TBI clearing for user-only for SVE
In reply to Richard HendersonThere are a number of paths by which the TBI is still intact for user-only in the SVE helpers.
Because we currently always set TBI for user-only, we do not need to pass down the actual TBI setting from above, and we can remove the top byte in the inner-most primitives, so that none are forgotten. Moreover, this keeps the "dirty" pointer around at the higher levels, where we need it for any MTE checking.
Since the normal case, especially for user-only, goes through RAM, this clearing merely adds two insns per page lookup, which will be completely in the noise.
--- target/arm/sve_helper.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
target/arm/sve_helper.c +17 -2
@@ -3966,14 +3966,16 @@ static void sve_##NAME##_host(void *vd, intptr_t reg_off, void *host) \ static void sve_##NAME##_tlb(CPUARMState *env, void *vd, intptr_t reg_off, \target_ulong addr,uintptr_t ra) \ { \ - *(TYPEE *)(vd +H (reg_off)) = (TYPEM )TLB (env, addr, ra); \ + *(TYPEE *)(vd +H (reg_off)) = \ + (TYPEM )TLB (env,useronly_clean_ptr (addr), ra); \ }#define DO_ST_TLB (NAME ,H ,TYPEE ,TYPEM ,TLB ) \ static void sve_##NAME##_tlb(CPUARMState *env, void *vd, intptr_t reg_off, \ target_ulong addr, uintptr_t ra) \ { \ - TLB(env, addr, (TYPEM)*(TYPEE *)(vd + H(reg_off)), ra); \ + TLB(env, useronly_clean_ptr(addr), \ + (TYPEM)*(TYPEE *)(vd + H(reg_off)), ra); \ }#define DO_LD_PRIM_1 (NAME ,H ,TE ,TM ) \
@@ -4091,6 +4093,19 @@ static bool sve_probe_page(SVEHostPage *info, bool nofault,int flags; addr += mem_off; + +/* +* User-only currently always issues with TBI. See the comment +* above useronly_clean_ptr. Usually we clean this top byte away +* during translation, but we can't do that for e.g. vector + imm +* addressing modes. +* +* We currently always enable TBI for user-only, and do not provide +* a way to turn it off. So clean the pointer unconditionally here, +* rather than look it up here, or pass it down from above. +*/ + addr =useronly_clean_ptr (addr); + flags =probe_access_flags (env, addr, access_type, mmu_idx, nofault, &info->host, retaddr); info->flags = flags;
Signature · 1 line
2.25.1
PATCH v7 37/42 target/arm: Implement data cache set allocation tags
In reply to Richard HendersonThis is DC GVA and DC GZVA, and the tag check for DC ZVA.
---
v2: Use allocation_tag_mem + memset.
v3: Require pre-cleaned addresses.
v6: Move DCZ block size assert to cpu realize.
Perform a tag check for DC ZVA.
--- target/arm/cpu.h | 4 +++- target/arm/helper.c | 16 ++++++++++++++++ target/arm/translate-a64.c | 39 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-)
target/arm/cpu.h +3 -1
@@ -2360,7 +2360,9 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)#define ARM_CP_NZCV (ARM_CP_SPECIAL | 0x0300)#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | 0x0400)#define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | 0x0500) -#define ARM_LAST_SPECIAL ARM_CP_DC_ZVA +#define ARM_CP_DC_GVA (ARM_CP_SPECIAL | 0x0600) +#define ARM_CP_DC_GZVA (ARM_CP_SPECIAL | 0x0700) +#define ARM_LAST_SPECIAL ARM_CP_DC_GZVA#define ARM_CP_FPU 0x1000#define ARM_CP_SVE 0x2000#define ARM_CP_NO_GDB 0x4000
target/arm/helper.c +16 -0
@@ -6996,6 +6996,22 @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 5, .type = ARM_CP_NOP, .access = PL0_W, .accessfn = aa64_cacheop_poc_access }, + { .name = "DC_GVA", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 4, .opc2 = 3, + .access = PL0_W, .type = ARM_CP_DC_GVA, +#ifndef CONFIG_USER_ONLY +/* Avoid overhead of an access check that always passes in user-mode */ + .accessfn = aa64_zva_access, +#endif + }, + { .name = "DC_GZVA", .state = ARM_CP_STATE_AA64, + .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 4, .opc2 = 4, + .access = PL0_W, .type = ARM_CP_DC_GZVA, +#ifndef CONFIG_USER_ONLY +/* Avoid overhead of an access check that always passes in user-mode */ + .accessfn = aa64_zva_access, +#endif + },REGINFO_SENTINEL };
target/arm/translate-a64.c +39 -0
@@ -1865,6 +1865,45 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, }gen_helper_dc_zva (cpu_env, tcg_rt);return ; +case ARM_CP_DC_GVA : + { +TCGv_i64 clean_addr, tag; + +/* +* DC_GVA, like DC_ZVA, requires that we supply the original +* pointer for an invalid page. Probe that address first. +*/ + tcg_rt =cpu_reg (s, rt); + clean_addr =clean_data_tbi (s, tcg_rt); +gen_probe_access (s, clean_addr,MMU_DATA_STORE ,MO_8 ); + +if (s->ata) { +/* Extract the tag from the register to match STZGM. */ + tag =tcg_temp_new_i64 (); +tcg_gen_shri_i64 (tag, tcg_rt,56 ); +gen_helper_stzgm_tags (cpu_env, clean_addr, tag); +tcg_temp_free_i64 (tag); + } + } +return ; +case ARM_CP_DC_GZVA : + { +TCGv_i64 clean_addr, tag; + +/* For DC_GZVA, we can rely on DC_ZVA for the proper fault. */ + tcg_rt =cpu_reg (s, rt); + clean_addr =clean_data_tbi (s, tcg_rt); +gen_helper_dc_zva (cpu_env, clean_addr); + +if (s->ata) { +/* Extract the tag from the register to match STZGM. */ + tag =tcg_temp_new_i64 (); +tcg_gen_shri_i64 (tag, tcg_rt,56 ); +gen_helper_stzgm_tags (cpu_env, clean_addr, tag); +tcg_temp_free_i64 (tag); + } + } +return ;default :break ; }
Signature · 1 line
2.25.1
Re: [PATCH v7 37/42] target/arm: Implement data cache set allocation tags
Quoted 4 lines · Richard Henderson
This is DC GVA and DC GZVA, and the tag check for DC ZVA.
Signed-off-by Richard Henderson <[email protected]>
thanks
-- PMM
PATCH v7 38/42 target/arm: Set PSTATE.TCO on exception entry
In reply to Richard HendersonD1.10 specifies that exception handlers begin with tag checks overridden.
---
v2: Only set if MTE feature present.
--- target/arm/helper.c | 3 +++ 1 file changed, 3 insertions(+)
target/arm/helper.c +3 -0
@@ -9702,6 +9702,9 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)break ; } } +if (cpu_isar_feature (aa64_mte, cpu)) { + new_mode |=PSTATE_TCO ; + }pstate_write (env,PSTATE_DAIF | new_mode); env->aarch64 =1 ;
Signature · 1 line
2.25.1
PATCH v7 39/42 target/arm: Enable MTE
In reply to Richard HendersonWe now implement all of the components of MTE, without actually supporting any tagged memory. All MTE instructions will work, trivially, so we can enable support.
---
v6: Delay user-only cpu reset bits to the user-only patch set.
--- target/arm/cpu64.c | 1 + 1 file changed, 1 insertion(+)
target/arm/cpu64.c +1 -0
@@ -655,6 +655,7 @@ static void aarch64_max_initfn(Object *obj) t = cpu->isar.id_aa64pfr1; t =FIELD_DP64 (t,ID_AA64PFR1 ,BT ,1 ); + t =FIELD_DP64 (t,ID_AA64PFR1 ,MTE ,2 ); cpu->isar.id_aa64pfr1 = t; t = cpu->isar.id_aa64mmfr1;
Signature · 1 line
2.25.1
Re: [PATCH v7 39/42] target/arm: Enable MTE
Quoted 17 lines · Richard Henderson
We now implement all of the components of MTE, without actually supporting any tagged memory. All MTE instructions will work, trivially, so we can enable support.
Signed-off-by Richard Henderson <[email protected]>---
v6: Delay user-only cpu reset bits to the user-only patch set.--- target/arm/cpu64.c | 1 + 1 file changed, 1 insertion(+)target/arm/cpu64.c +0
-0
target/arm/cpu64.c static void aarch64_max_initfn(Object *obj) · line 659
Quoted 5 lines
target/arm/cpu64.c +1
-0@@ -655,6 +655,7 @@ static void aarch64_max_initfn(Object *obj) t = cpu->isar.id_aa64pfr1; t =FIELD_DP64 (t,ID_AA64PFR1 ,BT ,1 ); + t =FIELD_DP64 (t,ID_AA64PFR1 ,MTE ,2 ); cpu->isar.id_aa64pfr1 = t;
If we don't actually have tagged memory yet should we really set the MTE field to 2 rather than 1 ?
thanks
-- PMM
Re: [PATCH v7 39/42] target/arm: Enable MTE
Quoted 7 lines · Peter Maydell
Quoted 4 lines
t = cpu->isar.id_aa64pfr1; t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); + t = FIELD_DP64(t, ID_AA64PFR1, MTE, 2); cpu->isar.id_aa64pfr1 = t;If we don't actually have tagged memory yet should we really set the MTE field to 2 rather than 1 ?
Well, we reduce that later in arm_cpu_realizefn. But perhaps this patch should be sorted after patch 41.
r~
PATCH v7 40/42 target/arm: Cache the Tagged bit for a page in MemTxAttrs
In reply to Richard HendersonThis "bit" is a particular value of the page's MemAttr.
---
v6: Test HCR_EL2.{DC,DCT}; test Stage2 attributes.
--- target/arm/helper.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-)
target/arm/helper.c +35 -8
@@ -10875,6 +10875,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,uint64_t descaddrmask;bool aarch64 =arm_el_is_aa64 (env, el);bool guarded = false; +uint8_t memattr;/* TODO: This code does not support shareability levels. */ if (aarch64) {
@@ -11099,17 +11100,32 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, txattrs->target_tlb_bit0 = true; } -if (cacheattrs !=NULL ) { +if (mmu_idx == ARMMMUIdx_Stage2) { + memattr =convert_stage2_attrs (env,extract32 (attrs,0 ,4 )); + }else { +/* Index into MAIR registers for cache attributes */ +uint64_t mair = env->cp15.mair_el[el]; + memattr =extract64 (mair,extract32 (attrs,0 ,3 ) *8 ,8 ); + } + +/* When MTE is enabled, remember Tagged Memory in IOTLB. */ +if (aarch64 &&cpu_isar_feature (aa64_mte, cpu)) {if (mmu_idx == ARMMMUIdx_Stage2) { - cacheattrs->attrs =convert_stage2_attrs (env, -extract32 (attrs,0 ,4 )); +/* +* Require Normal, I+O Shareable, WB, NT, RA, WA (0xff). +* If not, squash stage1 tagged normal setting. +*/ +if (memattr !=0xff ) { + txattrs->target_tlb_bit1 = false; + } }else { -/* Index into MAIR registers for cache attributes */ -uint8_t attrindx =extract32 (attrs,0 ,3 ); -uint64_t mair = env->cp15.mair_el[regime_el (env, mmu_idx)]; -assert (attrindx <=7 ); - cacheattrs->attrs =extract64 (mair, attrindx *8 ,8 ); +/* Tagged Normal Memory (0xf0). */ + txattrs->target_tlb_bit1 = (memattr ==0xf0 ); } + } + +if (cacheattrs !=NULL ) { + cacheattrs->attrs = memattr; cacheattrs->shareability =extract32 (attrs,6 ,2 ); }
@@ -12065,6 +12081,17 @@ bool get_phys_addr(CPUARMState *env, target_ulong address, *phys_ptr = address; *prot =PAGE_READ |PAGE_WRITE |PAGE_EXEC ; *page_size =TARGET_PAGE_SIZE ; + +/* Stage1 translations are Tagged or Untagged based on HCR_DCT. */ +if (cpu_isar_feature (aa64_mte,env_archcpu (env)) + && (mmu_idx == ARMMMUIdx_Stage1_E0 || + mmu_idx == ARMMMUIdx_Stage1_E1 || + mmu_idx == ARMMMUIdx_Stage1_E1_PAN)) { +uint64_t hcr =arm_hcr_el2_eff (env); +if ((hcr & (HCR_DC |HCR_DCT )) == (HCR_DC |HCR_DCT )) { + attrs->target_tlb_bit1 = true; + } + }return 0 ; }
Signature · 1 line
2.25.1
Re: [PATCH v7 40/42] target/arm: Cache the Tagged bit for a page in MemTxAttrs
Quoted 37 lines · Richard Henderson
This "bit" is a particular value of the page's MemAttr.
Signed-off-by Richard Henderson <[email protected]>---
v6: Test HCR_EL2.{DC,DCT}; test Stage2 attributes.--- target/arm/helper.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-)target/arm/helper.c +11
-1@@ -10875,6 +10875,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,uint64_t descaddrmask;bool aarch64 =arm_el_is_aa64 (env, el);bool guarded = false; +uint8_t memattr;/* TODO: This code does not support shareability levels. */ if (aarch64) {@@ -11099,17 +11100,32 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, txattrs->target_tlb_bit0 = true; } -if (cacheattrs !=NULL ) { +if (mmu_idx == ARMMMUIdx_Stage2) { + memattr =convert_stage2_attrs (env,extract32 (attrs,0 ,4 )); + }else { +/* Index into MAIR registers for cache attributes */ +uint64_t mair = env->cp15.mair_el[el]; + memattr =extract64 (mair,extract32 (attrs,0 ,3 ) *8 ,8 ); + } + +/* When MTE is enabled, remember Tagged Memory in IOTLB. */ +if (aarch64 &&cpu_isar_feature (aa64_mte, cpu)) {
target/arm/helper.c static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, · line 11120
Quoted 10 lines
target/arm/helper.c +7
-2if (mmu_idx == ARMMMUIdx_Stage2) { - cacheattrs->attrs =convert_stage2_attrs (env, -extract32 (attrs,0 ,4 )); +/* +* Require Normal, I+O Shareable, WB, NT, RA, WA (0xff). +* If not, squash stage1 tagged normal setting. +*/ +if (memattr !=0xff ) { + txattrs->target_tlb_bit1 = false; + }
Can we implement the effect of stage1+stage2 attrs on whether the memory location is tagged in the same way it's described in the Arm ARM, ie by combining the stage1+stage2 attrs and then looking at the combined result to decide ? In particular, this code works for the classic attribute-combining logic (where stage2 gets to override only in the more-like-device direction), but when we get round to implementing ARMv8.4-S2FWB then HCR_EL2.FWB will allow the stage2 page tables to entirely override stage1 so that we might have memory that is tagged even if stage 1's attributes said it wasn't.
Currently we do this attribute-combining only for cacheattrs (the combine_cacheattrs() call) but we could make that deal with more attributes if we need them for this purpose.
thanks
-- PMM
PATCH v7 41/42 target/arm: Create tagged ram when MTE is enabled
In reply to Richard Henderson---
v5: Assign cs->num_ases to the final value first.
Downgrade to ID_AA64PFR1.MTE=1 if tag memory is not available.
v6: Add secure tag memory for EL3.
--- target/arm/cpu.h | 6 ++++++ hw/arm/virt.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ target/arm/cpu.c | 51 ++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 106 insertions(+), 3 deletions(-)
target/arm/cpu.h +6 -0
@@ -792,6 +792,10 @@ struct ARMCPU {/* MemoryRegion to use for secure physical accesses */ MemoryRegion *secure_memory; +/* MemoryRegion to use for allocation tag accesses */ +MemoryRegion *tag_memory; +MemoryRegion *secure_tag_memory; +/* For v8M, pointer to the IDAU interface provided by board/SoC */ Object *idau;
@@ -2985,6 +2989,8 @@ typedef enum ARMMMUIdxBit {typedef enum ARMASIdx { ARMASIdx_NS =0 , ARMASIdx_S =1 , + ARMASIdx_TagNS =2 , + ARMASIdx_TagS =3 , }ARMASIdx ;/* Return the Exception Level targeted by debug exceptions. */
hw/arm/virt.c +52 -0
76 lines not on this page · raw message
target/arm/cpu.c +48 -3
71 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v7 41/42] target/arm: Create tagged ram when MTE is enabled
Quoted 16 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
v5: Assigncs->num_asesto the final value first.
Downgrade to ID_AA64PFR1.MTE=1 if tag memory is not available.
v6: Add secure tag memory for EL3.
---static void
arm_cpu_finalizefn(Object *obj)target/arm/cpu.c +1
-1@@ -1735,17 +1754,43 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)MachineState *ms =MACHINE (qdev_get_machine ());unsigned int smp_cpus = ms->smp.cpus; -if (cpu->has_el3 ||arm_feature (env,ARM_FEATURE_M_SECURITY )) { +/*
target/arm/cpu.c static void arm_cpu_realizefn(DeviceState *dev, Error **errp) · line 1767
Quoted 10 lines
target/arm/cpu.c +9
-0+* We must set cs->num_ases to the final value before +* the first call to cpu_address_space_init. +*/ +if (cpu->tag_memory !=NULL ) { + cs->num_ases =4 ; + }else if (cpu->has_el3 ||arm_feature (env,ARM_FEATURE_M_SECURITY )) { cs->num_ases =2 ; + }else { + cs->num_ases =1 ; + }
1: neither MTE nor TrustZone
2: TrustZone but not MTE
...but why is MTE always 4 even if no TrustZone? I would have expected MTE-no-TZ to have 2 ASes...
Quoted 18 lines
target/arm/cpu.c +10
-2+if (cpu->has_el3 ||arm_feature (env,ARM_FEATURE_M_SECURITY )) {if (!cpu->secure_memory) { cpu->secure_memory = cs->memory; }cpu_address_space_init (cs, ARMASIdx_S,"cpu-secure-memory" , cpu->secure_memory); - }else { - cs->num_ases =1 ; } + +if (cpu->tag_memory !=NULL ) { +cpu_address_space_init (cs, ARMASIdx_TagNS,"cpu-tag-memory" , + cpu->tag_memory); +if (cpu->has_el3) { +cpu_address_space_init (cs, ARMASIdx_TagS,"cpu-tag-memory" , + cpu->secure_tag_memory); + } + }else if (cpu_isar_feature (aa64_mte, cpu)) {
target/arm/cpu.c static void arm_cpu_realizefn(DeviceState *dev, Error **errp) · line 1794
Quoted 10 lines
target/arm/cpu.c +9
-0+/* +* Since there is no tag memory, we can't meaningfully support MTE +* to its fullest. To avoid problems later, when we would come to +* use the tag memory, downgrade support to insns only. +*/ + cpu->isar.id_aa64pfr1 = +FIELD_DP64 (cpu->isar.id_aa64pfr1,ID_AA64PFR1 ,MTE ,1 ); + } +cpu_address_space_init (cs, ARMASIdx_NS,"cpu-memory" , cs->memory);
...and indeed the code here only inits the ARMASIdx_NS and ARMASIdx_TagNS spaces in that case. I guess we need to leave ARMASIdx_S in the array but unused since we're effectively indexing them by constant integer, but even so shouldn't num_ases be 3 (0 and 2 used, 1 present but empty, 3 not needed) ?
thanks
-- PMM
PATCH v7 42/42 target/arm: Add allocation tag storage for system mode
In reply to Richard HendersonLook up the physical address for the given virtual address, convert that to a tag physical address, and finally return the host address that backs it.
--- target/arm/mte_helper.c | 128 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+)
target/arm/mte_helper.c +128 -0
@@ -21,6 +21,7 @@#include "cpu.h" #include "internals.h" #include "exec/exec-all.h" +#include "exec/ram_addr.h" #include "exec/cpu_ldst.h" #include "exec/helper-proto.h"
@@ -74,8 +75,135 @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int ptr_mmu_idx, int ptr_size, MMUAccessType tag_access, int tag_size, uintptr_t ra) { +#ifdef CONFIG_USER_ONLY/* Tag storage not implemented. */ return NULL; +#else +uintptr_t index; +CPUIOTLBEntry *iotlbentry; +int in_page, flags; +ram_addr_t ptr_ra; +hwaddr ptr_paddr, tag_paddr, xlat; +MemoryRegion *mr; +ARMASIdx tag_asi; +AddressSpace *tag_as; +void *host; + +/* +* The caller must split calls to this function such that it will +* not access *tag* memory beyond the end of the page. +*/ + in_page = -(ptr | -(TARGET_PAGE_SIZE >> (LOG2_TAG_GRANULE +1 ))); +g_assert (tag_size <= in_page); + +/* +* Probe the first byte of the virtual address. This raises an +* exception for inaccessible pages, and resolves the virtual address +* into the softmmu tlb. +*/ + flags =probe_access_flags (env, ptr, ptr_access, ptr_mmu_idx, + false, &host, ra); + +/* +* Find the iotlbentry for ptr. This *must* be present in the TLB +* because we just found the mapping. +* TODO: Perhaps there should be a cputlb helper that returns a +* matching tlb entry + iotlb entry. +*/ + index =tlb_index (env, ptr_mmu_idx, ptr); +# ifdef CONFIG_DEBUG_TCG + { +CPUTLBEntry *entry =tlb_entry (env, ptr_mmu_idx, ptr); +target_ulong comparator = (ptr_access ==MMU_DATA_LOAD + ? entry->addr_read + :tlb_addr_write (entry)); +g_assert (tlb_hit (comparator, ptr)); + } +# endif + iotlbentry = &env_tlb (env)->d[ptr_mmu_idx].iotlb[index]; + +/* If the virtual page MemAttr != Tagged, access unchecked. */ +if (!iotlbentry->attrs.target_tlb_bit1) { +return NULL ; + } + +/* If not normal memory, tag storage is not implemented, access unchecked. */ +if (unlikely (flags &TLB_MMIO )) { +qemu_log_mask (LOG_GUEST_ERROR , +"Page @ 0x%" PRIx64" indicates Tagged Normal memory " +"but is Device memory\n" , ptr); +return NULL ; + } + +/* +* The Normal memory access can extend to the next page. E.g. a single +* 8-byte access to the last byte of a page will check only the last +* tag on the first page. +* Any page access exception has priority over tag check exception. +*/ + in_page = -(ptr |TARGET_PAGE_MASK ); +if (unlikely (ptr_size > in_page)) { +void *ignore; + flags |=probe_access_flags (env, ptr + in_page, ptr_access, + ptr_mmu_idx, false, &ignore, ra); + } + +/* Any debug exception has priority over a tag check exception. */ +if (unlikely (flags &TLB_WATCHPOINT )) { +int wp = ptr_access ==MMU_DATA_LOAD ?BP_MEM_READ :BP_MEM_WRITE ; +cpu_check_watchpoint (env_cpu (env), ptr, ptr_size, + iotlbentry->attrs, wp, ra); + } + +/* +* Find the physical address within the normal mem space. +* The memory region lookup must succeed because TLB_MMIO was +* not set in the cputlb lookup above. +*/ + mr =memory_region_from_host (host, &ptr_ra); +tcg_debug_assert (mr !=NULL ); +tcg_debug_assert (memory_region_is_ram (mr)); + ptr_paddr = ptr_ra; +do { + ptr_paddr += mr->addr; + mr = mr->container; + }while (mr); + +/* Convert to the physical address in tag space. */ + tag_paddr = ptr_paddr >> (LOG2_TAG_GRANULE +1 ); + +/* Look up the address in tag space. */ + tag_asi = iotlbentry->attrs.secure ? ARMASIdx_TagS : ARMASIdx_TagNS; + tag_as =cpu_get_address_space (env_cpu (env), tag_asi); + mr =address_space_translate (tag_as, tag_paddr, &xlat,NULL , + tag_access ==MMU_DATA_STORE , + iotlbentry->attrs); + +/* +* Note that @mr will never be NULL. If there is nothing in the address +* space at @tag_paddr, the translation will return the unallocated memory +* region. For our purposes, the result must be ram. +*/ +if (unlikely (!memory_region_is_ram (mr))) { +/* ??? Failure is a board configuration error. */ +qemu_log_mask (LOG_UNIMP , +"Tag Memory @ 0x%" HWADDR_PRIx" not found for " +"Normal Memory @ 0x%" HWADDR_PRIx"\n" , + tag_paddr, ptr_paddr); +return NULL ; + } + +/* +* Ensure the tag memory is dirty on write, for migration. +* Tag memory can never contain code or display memory (vga). +*/ +if (tag_access ==MMU_DATA_STORE ) { +ram_addr_t tag_ra =memory_region_get_ram_addr (mr) + xlat; +cpu_physical_memory_set_dirty_flag (tag_ra,DIRTY_MEMORY_MIGRATION ); + } + +return memory_region_get_ram_ptr (mr) + xlat; +#endif }uint64_t HELPER (irg )(CPUARMState *env,uint64_t rn,uint64_t rm)
Signature · 1 line
2.25.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Message-id: [email protected]
Subject: [PATCH v7 00/42] target/arm: Implement ARMv8.5-MemTag, system mode
Type: series
=== 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
* [new tag] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
62fe299 target/arm: Add allocation tag storage for system mode 7e853b6 target/arm: Create tagged ram when MTE is enabled 0f7ab37 target/arm: Cache the Tagged bit for a page in MemTxAttrs bce00b5 target/arm: Enable MTE
39c912c target/arm: Set PSTATE.TCO on exception entry 7e09fd1 target/arm: Implement data cache set allocation tags 226fcf6 target/arm: Complete TBI clearing for user-only for SVE 010fffd target/arm: Add mte helpers for sve scatter/gather memory ops 216f125 target/arm: Handle TBI for sve scalar + int memory ops a7312b3 target/arm: Add mte helpers for sve scalar + int ff/nf loads a11212f target/arm: Add mte helpers for sve scalar + int stores a41c42e target/arm: Add mte helpers for sve scalar + int loads 5f0a8f9 target/arm: Use mte_check1 for sve LD1R
0b652b7 target/arm: Use mte_checkN for sve unpredicated stores d24b05b target/arm: Use mte_checkN for sve unpredicated loads e9ff3e1 target/arm: Add helper_mte_check_zva
396d638 target/arm: Implement helper_mte_checkN
137dce2 target/arm: Implement helper_mte_check1
16927bf target/arm: Add gen_mte_checkN
84f03dd target/arm: Add gen_mte_check1
cb2f1f3 target/arm: Move regime_tcr to internals.h
1983d92 target/arm: Move regime_el to internals.h
1faf997 target/arm: Implement the access tag cache flushes 0c1ab5a target/arm: Implement the LDGM, STGM, STZGM instructions f748125 target/arm: Simplify DC_ZVA
d5f7750 target/arm: Restrict the values of DCZID.BS under TCG 8988c38 target/arm: Implement the STGP instruction
6571a20 target/arm: Implement LDG, STG, ST2G instructions b68fe26 target/arm: Add helper_probe_access
5443ae8 target/arm: Define arm_cpu_do_unaligned_access for user-only bada4a1 target/arm: Implement the SUBP instruction
8e841fa target/arm: Implement the GMI instruction
8d1f1bd target/arm: Implement the ADDG, SUBG instructions ecd3b81 target/arm: Implement the IRG instruction
afca8f1 target/arm: Add MTE bits to tb_flags
0f5b5bc target/arm: Add MTE system registersa67e1280 target/arm: Add DISAS_UPDATE_NOCHAIN
b7d57c4 target/arm: Rename DISAS_UPDATE to DISAS_UPDATE_EXIT e60cd5e target/arm: Add support for MTE to HCR_EL2 and SCR_EL3 ea0858f target/arm: Add support for MTE to SCTLR_ELx 1eb3cd5 target/arm: Improve masking of SCR RES0 bits 5199961 target/arm: Add isar tests for mte
=== OUTPUT BEGIN ===
1/42 Checking commit 5199961fd247 (target/arm: Add isar tests for mte)
2/42 Checking commit 1eb3cd586775 (target/arm: Improve masking of SCR RES0 bits) 3/42 Checking commit ea0858fbc855 (target/arm: Add support for MTE to SCTLR_ELx) 4/42 Checking commit e60cd5e319ed (target/arm: Add support for MTE to HCR_EL2 and SCR_EL3) 5/42 Checking commit b7d57c4df890 (target/arm: Rename DISAS_UPDATE to DISAS_UPDATE_EXIT) 6/42 Checking commit a67e12801405 (target/arm: Add DISAS_UPDATE_NOCHAIN) 7/42 Checking commit 0f5b5bc435d8 (target/arm: Add MTE system registers) 8/42 Checking commit afca8f129b24 (target/arm: Add MTE bits to tb_flags)
ERROR: trailing whitespace
#97: FILE: target/arm/helper.c:12716:
+ flags = FIELD_DP32(flags, TBFLAG_A64, TCMA, $
total: 1 errors, 0 warnings, 133 lines checked
Patch 8/42 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
9/42 Checking commit ecd3b81afa58 (target/arm: Implement the IRG instruction)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #44:
new file mode 100644
total: 0 errors, 1 warnings, 120 lines checked
Patch 9/42 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
10/42 Checking commit 8d1f1bd061b6 (target/arm: Implement the ADDG, SUBG instructions) 11/42 Checking commit 8e841fa9738c (target/arm: Implement the GMI instruction) 12/42 Checking commit bada4a1dcba2 (target/arm: Implement the SUBP instruction) 13/42 Checking commit 5443ae828687 (target/arm: Define arm_cpu_do_unaligned_access for user-only) 14/42 Checking commit b68fe26dc8cc (target/arm: Add helper_probe_access)
15/42 Checking commit 6571a2093448 (target/arm: Implement LDG, STG, ST2G instructions) 16/42 Checking commit 8988c38981e8 (target/arm: Implement the STGP instruction)
ERROR: suspect code indent for conditional statements (8, 13)
#63: FILE: target/arm/translate-a64.c:2782:
+ if (!s->ata) {
+ /*
total: 1 errors, 0 warnings, 60 lines checked
Patch 16/42 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
17/42 Checking commit d5f77508bc46 (target/arm: Restrict the values of DCZID.BS under TCG) 18/42 Checking commit f748125bcd28 (target/arm: Simplify DC_ZVA)
19/42 Checking commit 0c1ab5a0b13b (target/arm: Implement the LDGM, STGM, STZGM instructions) 20/42 Checking commit 1faf997ec0ad (target/arm: Implement the access tag cache flushes) 21/42 Checking commit 1983d925203c (target/arm: Move regime_el to internals.h) 22/42 Checking commit cb2f1f365808 (target/arm: Move regime_tcr to internals.h) 23/42 Checking commit 84f03dd79250 (target/arm: Add gen_mte_check1)
WARNING: line over 80 characters
#176: FILE: target/arm/translate-a64.c:2554:
+ clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), false, rn != 31, size);
WARNING: line over 80 characters
#194: FILE: target/arm/translate-a64.c:2590:
+ clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), false, rn != 31, size);
total: 0 errors, 2 warnings, 242 lines checked
Patch 23/42 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
24/42 Checking commit 16927bf546ee (target/arm: Add gen_mte_checkN)
ERROR: trailing whitespace
#51: FILE: target/arm/translate-a64.c:288:
+ * For MTE, check multiple logical sequential accesses. $
total: 1 errors, 0 warnings, 157 lines checked
Patch 24/42 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
25/42 Checking commit 137dce23357e (target/arm: Implement helper_mte_check1)
WARNING: line over 80 characters
#21: FILE: target/arm/internals.h:1322:
+uint64_t mte_check1(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra);
total: 0 errors, 1 warnings, 194 lines checked
Patch 25/42 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
26/42 Checking commit 396d638c372e (target/arm: Implement helper_mte_checkN)
WARNING: line over 80 characters
#20: FILE: target/arm/internals.h:1323:
+uint64_t mte_checkN(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra);
total: 0 errors, 1 warnings, 178 lines checked
Patch 26/42 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
27/42 Checking commit e9ff3e16cc15 (target/arm: Add helper_mte_check_zva)
28/42 Checking commit d24b05b1e447 (target/arm: Use mte_checkN for sve unpredicated loads) 29/42 Checking commit 0b652b7d7032 (target/arm: Use mte_checkN for sve unpredicated stores) 30/42 Checking commit 5f0a8f9e0498 (target/arm: Use mte_check1 for sve LD1R)
31/42 Checking commit a41c42e43d12 (target/arm: Add mte helpers for sve scalar + int loads) 32/42 Checking commit a11212facadb (target/arm: Add mte helpers for sve scalar + int stores) 33/42 Checking commit a7312b3bf65a (target/arm: Add mte helpers for sve scalar + int ff/nf loads) 34/42 Checking commit 216f1256e6d7 (target/arm: Handle TBI for sve scalar + int memory ops) 35/42 Checking commit 010fffd83232 (target/arm: Add mte helpers for sve scatter/gather memory ops) 36/42 Checking commit 226fcf6b1d07 (target/arm: Complete TBI clearing for user-only for SVE)
ERROR: code indent should never use tabs
#33: FILE: target/arm/sve_helper.c:3970:
+ (TYPEM)TLB(env, useronly_clean_ptr(addr), ra);^I \$
ERROR: spaces required around that '*' (ctx:VxV)
#42: FILE: target/arm/sve_helper.c:3978:
+ (TYPEM)*(TYPEE *)(vd + H(reg_off)), ra); \
^total: 2 errors, 0 warnings, 37 lines checked
Patch 36/42 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
37/42 Checking commit 7e09fd1a2bec (target/arm: Implement data cache set allocation tags) 38/42 Checking commit 39c912cf7764 (target/arm: Set PSTATE.TCO on exception entry) 39/42 Checking commit bce00b5ccceb (target/arm: Enable MTE)
40/42 Checking commit 0f7ab37fedd7 (target/arm: Cache the Tagged bit for a page in MemTxAttrs) 41/42 Checking commit 7e853b6dc32f (target/arm: Create tagged ram when MTE is enabled) 42/42 Checking commit 62fe2991b255 (target/arm: Add allocation tag storage for system mode)
WARNING: line over 80 characters
#82: FILE: target/arm/mte_helper.c:130:
+ /* If not normal memory, tag storage is not implemented, access unchecked. */
total: 0 errors, 1 warnings, 142 lines checked
Patch 42/42 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Quoted 1 line · On 6/2/20 7:15 PM, [email protected] wrote:
This series seems to have some coding style problems.
Hmph, some of these are real.
I'll fix for v8, with other review.
r~
Quoted 5 lines · Richard Henderson
Version 6 was back in March:
https://lists.nongnu.org/archive/html/qemu-devel/2020-03/msg03790.htmlVersion 7 is a rebase on master, which now contains all prereqs.
I'm now done with my review pass on this version of the patchset.
thanks
-- PMM