target/arm: Implement cortex-a710
v2 cover target/arm: Implement cortex-a710
This is one of the first generation Armv9 cores, and gives us something concrete to test in that area. Notably, it supports MTE.
Changes for v2:
* Check GMBS during realize.
* Fix access checks for neoverse implementation registers. Mostly just traps EL1/EL2 if EL2/EL3 enabled.
* Add make_ccsidr64 helper.
* Reduce MTE with no tag memory to MTE=1.
* Suppress FEAT_TRBE.
* Implement HPDS2 as a no-op.
* Rewrite a710 implementation registers; do try to share code with neoverse, because the traps are different. This of course solves the renaming and renumbering issues too.
r~
Richard Henderson (11):
target/arm: Reduce dcz_blocksize to uint8_t target/arm: Allow cpu to configure GM blocksize target/arm: Support more GM blocksizes
target/arm: When tag memory is not present, set MTE=1 target/arm: Introduce make_ccsidr64
target/arm: Apply access checks to neoverse-n1 special registers target/arm: Apply access checks to neoverse-v1 special registers target/arm: Implement RMR_EL3 for neoverse-v1 target/arm: Suppress FEAT_TRBE (Trace Buffer Extension) target/arm: Implement FEAT_HPDS2 as a no-op target/arm: Implement cortex-a710
docs/system/arm/emulation.rst | 1 + docs/system/arm/virt.rst | 1 + target/arm/cpregs.h | 2 + target/arm/cpu.h | 5 +- target/arm/internals.h | 6 - target/arm/tcg/translate.h | 2 + hw/arm/virt.c | 1 + target/arm/cpu.c | 28 ++- target/arm/helper.c | 15 +- target/arm/tcg/cpu32.c | 2 +- target/arm/tcg/cpu64.c | 347 ++++++++++++++++++++++++++++++--- target/arm/tcg/mte_helper.c | 90 +++++++-- target/arm/tcg/translate-a64.c | 5 +- 13 files changed, 437 insertions(+), 68 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/11 target/arm: Reduce dcz_blocksize to uint8_t
This value is only 4 bits wide.
--- target/arm/cpu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/arm/cpu.h +2 -1
@@ -1074,7 +1074,8 @@ struct ArchCPU {bool prop_lpa2;/* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */ -uint32_t dcz_blocksize; +uint8_t dcz_blocksize; +uint64_t rvbar_prop;/* Property/input signals. */ /* Configurable aspects of GIC cpu interface (which is part of the CPU) */
Signature · 1 line
2.34.1
Re: [PATCH v2 01/11] target/arm: Reduce dcz_blocksize to uint8_t
Quoted 7 lines · Richard Henderson
This value is only 4 bits wide.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
PATCH v2 2/11 target/arm: Allow cpu to configure GM blocksize
In reply to Richard HendersonPreviously we hard-coded the blocksize with GMID_EL1_BS. But the value we choose for -cpu max does not match the value that cortex-a710 uses.
Mirror the way we handle dcz_blocksize.
--- target/arm/cpu.h | 2 ++ target/arm/internals.h | 6 ----- target/arm/tcg/translate.h | 2 ++ target/arm/helper.c | 11 +++++--- target/arm/tcg/cpu64.c | 1 + target/arm/tcg/mte_helper.c | 46 ++++++++++++++++++++++------------ target/arm/tcg/translate-a64.c | 5 ++-- 7 files changed, 45 insertions(+), 28 deletions(-)
target/arm/cpu.h +2 -0
@@ -1075,6 +1075,8 @@ struct ArchCPU {/* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */ uint8_t dcz_blocksize; +/* GM blocksize, in log_2(words), ie low 4 bits of GMID_EL0 */ +uint8_t gm_blocksize;uint64_t rvbar_prop;/* Property/input signals. */
target/arm/internals.h +0 -6
@@ -1243,12 +1243,6 @@ void arm_log_exception(CPUState *cs);#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 -/* * SVE predicates are 1/8 the size of SVE vectors, and cannot use * the same simd_desc() encoding due to restrictions on size.
target/arm/tcg/translate.h +2 -0
@@ -151,6 +151,8 @@ typedef struct DisasContext {int8_t btype;/* A copy of cpu->dcz_blocksize. */ uint8_t dcz_blocksize; +/* A copy of cpu->gm_blocksize. */ +uint8_t gm_blocksize;/* True if this page is guarded. */ bool guarded_page;/* Bottom two bits of XScale c15_cpar coprocessor access control reg */
target/arm/helper.c +7 -4
@@ -7643,10 +7643,6 @@ static const ARMCPRegInfo mte_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 6, .access = PL1_RW, .accessfn = access_mte, .fieldoffset = offsetof(CPUARMState, cp15.gcr_el1) }, - { .name = "GMID_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 4, - .access = PL1_R, .accessfn = access_aa64_tid5, - .type = ARM_CP_CONST, .resetvalue = GMID_EL1_BS }, { .name = "TCO", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 4, .crm = 2, .opc2 = 7, .type = ARM_CP_NO_RAW,
@@ -9237,6 +9233,13 @@ void register_cp_regs_for_features(ARMCPU *cpu)* then define only a RAZ/WI version of PSTATE.TCO. */ if (cpu_isar_feature (aa64_mte, cpu)) { +ARMCPRegInfo gmid_reginfo = { + .name ="GMID_EL1" , .state =ARM_CP_STATE_AA64 , + .opc0 =3 , .opc1 =1 , .crn =0 , .crm =0 , .opc2 =4 , + .access =PL1_R , .accessfn = access_aa64_tid5, + .type =ARM_CP_CONST , .resetvalue = cpu->gm_blocksize, + }; +define_one_arm_cp_reg (cpu, &gmid_reginfo);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)) {
target/arm/tcg/cpu64.c +1 -0
@@ -868,6 +868,7 @@ void aarch64_max_tcg_initfn(Object *obj) cpu->ctr =0x80038003 ;/* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize =7 ;/* 512 bytes */ #endif + cpu->gm_blocksize =6 ;/* 256 bytes */ cpu->sve_vq.supported =MAKE_64BIT_MASK (0 ,ARM_MAX_VQ ); cpu->sme_vq.supported =SVE_VQ_POW2_MAP ;
target/arm/tcg/mte_helper.c +30 -16
88 lines not on this page · raw message
target/arm/tcg/translate-a64.c +3 -2
@@ -3786,7 +3786,7 @@ static bool trans_STGM(DisasContext *s, arg_ldst_tag *a)gen_helper_stgm (cpu_env, addr, tcg_rt); }else {MMUAccessType acc =MMU_DATA_STORE ; -int size =4 <<GMID_EL1_BS ; +int size =4 << s->gm_blocksize; clean_addr =clean_data_tbi (s, addr);tcg_gen_andi_i64 (clean_addr, clean_addr, -size);
@@ -3818,7 +3818,7 @@ static bool trans_LDGM(DisasContext *s, arg_ldst_tag *a)gen_helper_ldgm (tcg_rt, cpu_env, addr); }else {MMUAccessType acc =MMU_DATA_LOAD ; -int size =4 <<GMID_EL1_BS ; +int size =4 << s->gm_blocksize; clean_addr =clean_data_tbi (s, addr);tcg_gen_andi_i64 (clean_addr, clean_addr, -size);
@@ -13900,6 +13900,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->cp_regs = arm_cpu->cp_regs; dc->features = env->features; dc->dcz_blocksize = arm_cpu->dcz_blocksize; + dc->gm_blocksize = arm_cpu->gm_blocksize;#ifdef CONFIG_USER_ONLY /* In sve_probe_page, we assume TBI is enabled. */
Signature · 1 line
2.34.1
PATCH v2 3/11 target/arm: Support more GM blocksizes
In reply to Richard HendersonSupport all of the easy GM block sizes.
Use direct memory operations, since the pointers are aligned.
While BS=2 (16 bytes, 1 tag) is a legal setting, that requires an atomic store of one nibble. This is not difficult, but there is also no point in supporting it until required.
Note that cortex-a710 sets GM blocksize to match its cacheline size of 64 bytes. I expect many implementations will also match the cacheline, which makes 16 bytes very unlikely.
--- target/arm/cpu.c | 18 +++++++++--- target/arm/tcg/mte_helper.c | 56 +++++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 12 deletions(-)
target/arm/cpu.c +14 -4
@@ -2056,16 +2056,26 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) ID_PFR1, VIRTUALIZATION, 0); } +if (cpu_isar_feature (aa64_mte, cpu)) { +/* +* The architectural range of GM blocksize is 2-6, however qemu +* doesn't support blocksize of 2 (see HELPER(ldgm)). +*/ +if (tcg_enabled ()) { +assert (cpu->gm_blocksize >=3 && cpu->gm_blocksize <=6 ); + } +#ifndef CONFIG_USER_ONLY -if (cpu->tag_memory ==NULL &&cpu_isar_feature (aa64_mte, cpu)) {/* * Disable the MTE feature bits if we do not have tag-memory * provided by the machine. */ - cpu->isar.id_aa64pfr1 = -FIELD_DP64 (cpu->isar.id_aa64pfr1,ID_AA64PFR1 ,MTE ,0 ); - } +if (cpu->tag_memory ==NULL ) { + cpu->isar.id_aa64pfr1 = +FIELD_DP64 (cpu->isar.id_aa64pfr1,ID_AA64PFR1 ,MTE ,0 ); + }#endif + }if (tcg_enabled ()) {/*
target/arm/tcg/mte_helper.c +48 -8
89 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 03/11] target/arm: Support more GM blocksizes
Quoted 8 lines · Richard Henderson
Support all of the easy GM block sizes.
Use direct memory operations, since the pointers are aligned.While BS=2 (16 bytes, 1 tag) is a legal setting, that requires an atomic store of one nibble. This is not difficult, but there is also no point in supporting it until required.
Quoted 6 lines
Note that cortex-a710 sets GM blocksize to match its cacheline size of 64 bytes. I expect many implementations will also match the cacheline, which makes 16 bytes very unlikely.
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v2 4/11 target/arm: When tag memory is not present, set MTE=1
In reply to Richard HendersonWhen the cpu support MTE, but the system does not, reduce cpu support to user instructions at EL0 instead of completely disabling MTE. If we encounter a cpu implementation which does something else, we can revisit this setting.
--- target/arm/cpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
target/arm/cpu.c +4 -3
@@ -2067,12 +2067,13 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)#ifndef CONFIG_USER_ONLY /* -* Disable the MTE feature bits if we do not have tag-memory -* provided by the machine. +* If we do not have tag-memory provided by the machine, +* reduce MTE support to instructions enabled at EL0. +* This matches Cortex-A710 BROADCASTMTE input being LOW. */ if (cpu->tag_memory ==NULL ) { cpu->isar.id_aa64pfr1 = -FIELD_DP64 (cpu->isar.id_aa64pfr1,ID_AA64PFR1 ,MTE ,0 ); +FIELD_DP64 (cpu->isar.id_aa64pfr1,ID_AA64PFR1 ,MTE ,1 ); }#endif }
Signature · 1 line
2.34.1
Re: [PATCH v2 04/11] target/arm: When tag memory is not present, set MTE=1
Quoted 8 lines · Richard Henderson
When the cpu support MTE, but the system does not, reduce cpu support to user instructions at EL0 instead of completely disabling MTE. If we encounter a cpu implementation which does something else, we can revisit this setting.
Signed-off-by Richard Henderson <[email protected]>--
thanks
-- PMM
PATCH v2 5/11 target/arm: Introduce make_ccsidr64
In reply to Richard HendersonDo not hard-code the constants for Neoverse V1.
--- target/arm/tcg/cpu64.c | 48 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 16 deletions(-)
target/arm/tcg/cpu64.c +32 -16
@@ -24,9 +24,36 @@#include "qemu/module.h" #include "qapi/visitor.h" #include "hw/qdev-properties.h" +#include "qemu/units.h" #include "internals.h" #include "cpregs.h" +static uint64_t make_ccsidr64 (unsigned assoc,unsigned linesize, +unsigned cachesize) +{ +unsigned lg_linesize =ctz32 (linesize); +unsigned sets; + +/* +* The 64-bit CCSIDR_EL1 format is: +* [55:32] number of sets - 1 +* [23:3] associativity - 1 +* [2:0] log2(linesize) - 4 +* so 0 == 16 bytes, 1 == 32 bytes, 2 == 64 bytes, etc +*/ +assert (assoc !=0 ); +assert (is_power_of_2 (linesize)); +assert (lg_linesize >=4 && lg_linesize <=7 +4 ); + +/* sets * associativity * linesize == cachesize. */ + sets = cachesize / (assoc * linesize); +assert (cachesize % (assoc * linesize) ==0 ); + +return ((uint64_t )(sets -1 ) <<32 ) + | ((assoc -1 ) <<3 ) + | (lg_linesize -4 ); +} +static void aarch64_a35_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj);
@@ -651,26 +678,15 @@ static void aarch64_neoverse_v1_initfn(Object *obj)* The Neoverse-V1 r1p2 TRM lists 32-bit format CCSIDR_EL1 values, * but also says it implements CCIDX, which means they should be * 64-bit format. So we here use values which are based on the textual -* information in chapter 2 of the TRM (and on the fact that -* sets * associativity * linesize == cachesize). -* -* The 64-bit CCSIDR_EL1 format is: -* [55:32] number of sets - 1 -* [23:3] associativity - 1 -* [2:0] log2(linesize) - 4 -* so 0 == 16 bytes, 1 == 32 bytes, 2 == 64 bytes, etc -* -* L1: 4-way set associative 64-byte line size, total size 64K, -* so sets is 256. +* information in chapter 2 of the TRM: * +* L1: 4-way set associative 64-byte line size, total size 64K. * L2: 8-way set associative, 64 byte line size, either 512K or 1MB. -* We pick 1MB, so this has 2048 sets. -* * L3: No L3 (this matches the CLIDR_EL1 value). */ - cpu->ccsidr[0 ] =0x000000ff0000001aull ;/* 64KB L1 dcache */ - cpu->ccsidr[1 ] =0x000000ff0000001aull ;/* 64KB L1 icache */ - cpu->ccsidr[2 ] =0x000007ff0000003aull ;/* 1MB L2 cache */ + cpu->ccsidr[0 ] =make_ccsidr64 (4 ,64 ,64 * KiB);/* L1 dcache */ + cpu->ccsidr[1 ] = cpu->ccsidr[0 ];/* L1 icache */ + cpu->ccsidr[2 ] =make_ccsidr64 (8 ,64 ,1 * MiB);/* L2 cache */ /* From 3.2.115 SCTLR_EL3 */ cpu->reset_sctlr =0x30c50838 ;
Signature · 1 line
2.34.1
Re: [PATCH v2 05/11] target/arm: Introduce make_ccsidr64
Quoted 7 lines · Richard Henderson
Do not hard-code the constants for Neoverse V1.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/tcg/cpu64.c | 48 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 16 deletions(-)
thanks
-- PMM
PATCH v2 6/11 target/arm: Apply access checks to neoverse-n1 special registers
In reply to Richard HendersonAccess to many of the special registers is enabled or disabled by ACTLR_EL[23], which we implement as constant 0, which means that all writes outside EL3 should trap.
--- target/arm/cpregs.h | 2 ++ target/arm/helper.c | 4 ++-- target/arm/tcg/cpu64.c | 46 +++++++++++++++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 11 deletions(-)
target/arm/cpregs.h +2 -0
@@ -1077,4 +1077,6 @@ static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { }void define_cortex_a72_a57_a53_cp_reginfo (ARMCPU *cpu);#endif +CPAccessResult access_tvm_trvm (CPUARMState *,const ARMCPRegInfo *,bool ); +#endif /* TARGET_ARM_CPREGS_H */
target/arm/helper.c +2 -2
@@ -319,8 +319,8 @@ static CPAccessResult access_tpm(CPUARMState *env, const ARMCPRegInfo *ri, }/* Check for traps from EL1 due to HCR_EL2.TVM and HCR_EL2.TRVM. */ -static CPAccessResult access_tvm_trvm (CPUARMState *env,const ARMCPRegInfo *ri, -bool isread) +CPAccessResult access_tvm_trvm (CPUARMState *env,const ARMCPRegInfo *ri, +bool isread) {if (arm_current_el (env) ==1 ) {uint64_t trap = isread ?HCR_TRVM :HCR_TVM ;
target/arm/tcg/cpu64.c +37 -9
83 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 06/11] target/arm: Apply access checks to neoverse-n1 special registers
Quoted 11 lines · Richard Henderson
Access to many of the special registers is enabled or disabled by ACTLR_EL[23], which we implement as constant 0, which means that all writes outside EL3 should trap.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpregs.h | 2 ++ target/arm/helper.c | 4 ++-- target/arm/tcg/cpu64.c | 46 +++++++++++++++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 11 deletions(-)
thanks
-- PMM
PATCH v2 7/11 target/arm: Apply access checks to neoverse-v1 special registers
In reply to Richard HendersonThere is only one additional EL1 register modeled, which also needs to use access_actlr_w.
--- target/arm/tcg/cpu64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/arm/tcg/cpu64.c +2 -1
@@ -560,7 +560,8 @@ static void define_neoverse_n1_cp_reginfo(ARMCPU *cpu)static const ARMCPRegInfo neoverse_v1_cp_reginfo[] = { { .name ="CPUECTLR2_EL1" , .state =ARM_CP_STATE_AA64 , .opc0 =3 , .opc1 =0 , .crn =15 , .crm =1 , .opc2 =5 , - .access =PL1_RW , .type =ARM_CP_CONST , .resetvalue =0 }, + .access =PL1_RW , .type =ARM_CP_CONST , .resetvalue =0 , + .accessfn = access_actlr_w }, { .name ="CPUPPMCR_EL3" , .state =ARM_CP_STATE_AA64 , .opc0 =3 , .opc1 =6 , .crn =15 , .crm =2 , .opc2 =0 , .access =PL3_RW , .type =ARM_CP_CONST , .resetvalue =0 },
Signature · 1 line
2.34.1
Re: [PATCH v2 07/11] target/arm: Apply access checks to neoverse-v1 special registers
Quoted 6 lines · Richard Henderson
There is only one additional EL1 register modeled, which also needs to use
access_actlr_w.Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v2 8/11 target/arm: Implement RMR_EL3 for neoverse-v1
In reply to Richard Henderson--- target/arm/tcg/cpu64.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
target/arm/tcg/cpu64.c +13 -0
@@ -573,6 +573,18 @@ static const ARMCPRegInfo neoverse_v1_cp_reginfo[] = { .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, }; +/* +* TODO: For a write with bit 1 set, do something with arm_reset_cpu(). +* In the meantime, "the bit is strictly a request", so we are in spec +* just ignoring writes. +*/ +static const ARMCPRegInfo rmr_reginfo = { + .name ="RMR_EL3" , .state =ARM_CP_STATE_AA64 , + .opc0 =3 , .opc1 =6 , .crn =12 , .crm =0 , .opc2 =2 , + .access =PL3_RW , .type =ARM_CP_CONST , + .resetvalue =1 ,/* [31:2] RES0, [1] reset 0, [0] RES1 */ +}; +static void define_neoverse_v1_cp_reginfo (ARMCPU *cpu) {/*
@@ -581,6 +593,7 @@ static void define_neoverse_v1_cp_reginfo(ARMCPU *cpu)*/ define_arm_cp_regs (cpu, neoverse_n1_cp_reginfo);define_arm_cp_regs (cpu, neoverse_v1_cp_reginfo); +define_one_arm_cp_reg (cpu, &rmr_reginfo); }static void aarch64_neoverse_n1_initfn (Object *obj)
Signature · 1 line
2.34.1
Re: [PATCH v2 08/11] target/arm: Implement RMR_EL3 for neoverse-v1
Quoted 16 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- target/arm/tcg/cpu64.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)target/arm/tcg/cpu64.c +2
-0@@ -573,6 +573,18 @@ static const ARMCPRegInfo neoverse_v1_cp_reginfo[] = { .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, }; +/* +* TODO: For a write with bit 1 set, do something with arm_reset_cpu().
target/arm/tcg/cpu64.c static const ARMCPRegInfo neoverse_v1_cp_reginfo[] = { · line 587
Quoted 10 lines
target/arm/tcg/cpu64.c +10
-0+* In the meantime, "the bit is strictly a request", so we are in spec +* just ignoring writes. +*/ +static const ARMCPRegInfo rmr_reginfo = { + .name ="RMR_EL3" , .state =ARM_CP_STATE_AA64 , + .opc0 =3 , .opc1 =6 , .crn =12 , .crm =0 , .opc2 =2 , + .access =PL3_RW , .type =ARM_CP_CONST , + .resetvalue =1 ,/* [31:2] RES0, [1] reset 0, [0] RES1 */ +}; +
This register is architectural (but optional), not implementation-specific. There's also an RMR_EL1 and RMR_EL2 depending on which ELs are implemented. If we want to implement this we should do it in helper.c alongside RVBAR_EL1 (which has a similar "only the register for the highest EL exists" setup). But I'd be tempted to continue to ignore this, unless there's some firmware out there that really wants to see the register.
PS: you don't want arm_reset_cpu(), since we know that we are running on the exact CPU we want to reset. cpu_reset() will do. (And I don't think we can implement "reset into AArch32" currently.)
thanks
-- PMM
PATCH v2 9/11 target/arm: Suppress FEAT_TRBE (Trace Buffer Extension)
In reply to Richard HendersonLike FEAT_TRF (Self-hosted Trace Extension), suppress tracing external to the cpu, which is out of scope for QEMU.
--- target/arm/cpu.c | 3 +++ 1 file changed, 3 insertions(+)
target/arm/cpu.c +3 -0
@@ -2088,6 +2088,9 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)/* FEAT_SPE (Statistical Profiling Extension) */ cpu->isar.id_aa64dfr0 =FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,PMSVER ,0 ); +/* FEAT_TRBE (Trace Buffer Extension) */ + cpu->isar.id_aa64dfr0 = +FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,TRACEBUFFER ,0 );/* FEAT_TRF (Self-hosted Trace Extension) */ cpu->isar.id_aa64dfr0 =FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,TRACEFILT ,0 );
Signature · 1 line
2.34.1
Re: [PATCH v2 09/11] target/arm: Suppress FEAT_TRBE (Trace Buffer Extension)
Quoted 24 lines · Richard Henderson
Like
FEAT_TRF(Self-hosted Trace Extension), suppress tracing external to the cpu, which is out of scope for QEMU.Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu.c | 3 +++ 1 file changed, 3 insertions(+)target/arm/cpu.c +3
-1@@ -2088,6 +2088,9 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)/* FEAT_SPE (Statistical Profiling Extension) */ cpu->isar.id_aa64dfr0 =FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,PMSVER ,0 ); +/* FEAT_TRBE (Trace Buffer Extension) */ + cpu->isar.id_aa64dfr0 = +FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,TRACEBUFFER ,0 );/* FEAT_TRF (Self-hosted Trace Extension) */ cpu->isar.id_aa64dfr0 =FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,TRACEFILT ,0 ); --
Quoted 2 lines
2.34.1
thanks
-- PMM
PATCH v2 10/11 target/arm: Implement FEAT_HPDS2 as a no-op
In reply to Richard HendersonThis feature allows the operating system to set TCR_ELx.HWU* to allow the implementation to use the PBHA bits from the block and page descriptors for for IMPLEMENTATION DEFINED purposes. Since QEMU has no need to use these bits, we may simply ignore them.
--- docs/system/arm/emulation.rst | 1 + target/arm/tcg/cpu32.c | 2 +- target/arm/tcg/cpu64.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
docs/system/arm/emulation.rst +1 -0
@@ -40,6 +40,7 @@ the following architecture extensions: - FEAT_HAFDBS (Hardware management of the access flag and dirty bit state) - FEAT_HCX (Support for the HCRX_EL2 register) - FEAT_HPDS (Hierarchical permission disables) +- FEAT_HPDS2 (Translation table page-based hardware attributes) - FEAT_I8MM (AArch64 Int8 matrix multiplication instructions) - FEAT_IDST (ID space trap handling) - FEAT_IESB (Implicit error synchronization event)
target/arm/tcg/cpu32.c +1 -1
@@ -62,7 +62,7 @@ void aa32_max_features(ARMCPU *cpu) cpu->isar.id_mmfr3 = t; t = cpu->isar.id_mmfr4; - t =FIELD_DP32 (t,ID_MMFR4 ,HPDS ,1 );/* FEAT_AA32HPD */ + t =FIELD_DP32 (t,ID_MMFR4 ,HPDS ,2 );/* FEAT_HPDS2 */ t =FIELD_DP32 (t,ID_MMFR4 ,AC2 ,1 );/* ACTLR2, HACTLR2 */ t =FIELD_DP32 (t,ID_MMFR4 ,CNP ,1 );/* FEAT_TTCNP */ t =FIELD_DP32 (t,ID_MMFR4 ,XNX ,1 );/* FEAT_XNX */
target/arm/tcg/cpu64.c +1 -1
@@ -865,7 +865,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64MMFR1 ,HAFDBS ,2 );/* FEAT_HAFDBS */ t =FIELD_DP64 (t,ID_AA64MMFR1 ,VMIDBITS ,2 );/* FEAT_VMID16 */ t =FIELD_DP64 (t,ID_AA64MMFR1 ,VH ,1 );/* FEAT_VHE */ - t =FIELD_DP64 (t,ID_AA64MMFR1 ,HPDS ,1 );/* FEAT_HPDS */ + t =FIELD_DP64 (t,ID_AA64MMFR1 ,HPDS ,2 );/* FEAT_HPDS2 */ t =FIELD_DP64 (t,ID_AA64MMFR1 ,LO ,1 );/* FEAT_LOR */ t =FIELD_DP64 (t,ID_AA64MMFR1 ,PAN ,3 );/* FEAT_PAN3 */ t =FIELD_DP64 (t,ID_AA64MMFR1 ,XNX ,1 );/* FEAT_XNX */
Signature · 1 line
2.34.1
Re: [PATCH v2 10/11] target/arm: Implement FEAT_HPDS2 as a no-op
Quoted 9 lines · Richard Henderson
This feature allows the operating system to set TCR_ELx.HWU* to allow the implementation to use the PBHA bits from the block and page descriptors for for IMPLEMENTATION DEFINED purposes. Since QEMU has no need to use these bits, we may simply ignore them.
Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
PATCH v2 11/11 target/arm: Implement cortex-a710
In reply to Richard HendersonThe cortex-a710 is a first generation ARMv9.0-A processor.
--- docs/system/arm/virt.rst | 1 + hw/arm/virt.c | 1 + target/arm/tcg/cpu64.c | 234 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 236 insertions(+)
docs/system/arm/virt.rst +1 -0
@@ -58,6 +58,7 @@ Supported guest CPU types: - ``cortex-a57`` (64-bit) - ``cortex-a72`` (64-bit) - ``cortex-a76`` (64-bit) +- ``cortex-a710`` (64-bit) - ``a64fx`` (64-bit) - ``host`` (with KVM only) - ``neoverse-n1`` (64-bit)
hw/arm/virt.c +1 -0
@@ -211,6 +211,7 @@ static const char *valid_cpus[] = {ARM_CPU_TYPE_NAME ("cortex-a55" ),ARM_CPU_TYPE_NAME ("cortex-a72" ),ARM_CPU_TYPE_NAME ("cortex-a76" ), +ARM_CPU_TYPE_NAME ("cortex-a710" ),ARM_CPU_TYPE_NAME ("a64fx" ),ARM_CPU_TYPE_NAME ("neoverse-n1" ), ARM_CPU_TYPE_NAME("neoverse-v1"),
target/arm/tcg/cpu64.c +234 -0
246 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 20 lines · Richard Henderson
The cortex-a710 is a first generation ARMv9.0-A processor.
target/arm/tcg/cpu64.c +9
-0@@ -758,6 +758,239 @@ static void aarch64_neoverse_v1_initfn(Object *obj)aarch64_add_sve_properties (obj); } +static bool trap_tidcp (CPUARMState *env) +{ +return arm_current_el (env) <2 && (arm_hcr_el2_eff (env) &HCR_TIDCP ); +} + +static CPAccessResult access_tidcp (CPUARMState *env,const ARMCPRegInfo *r, +bool read) +{ +return trap_tidcp (env) ?CP_ACCESS_TRAP_EL2 :CP_ACCESS_OK ;
target/arm/tcg/cpu64.c static void aarch64_neoverse_v1_initfn(Object *obj) · line 779
Quoted 10 lines
target/arm/tcg/cpu64.c +10
-0+} + +static CPAccessResult access_tidcp_actlr_w (CPUARMState *env, +const ARMCPRegInfo *r,bool read) +{ +if (trap_tidcp (env)) { +return CP_ACCESS_TRAP_EL2 ; + } +return access_actlr_w (env, r, read); +}
HCR_EL2.TIDCP traps accesses to a whole IMPDEF range, not just to the registers that the implementation happens to define. We should implement this in translate.c, translate-a64.c and op_helper.c in a similar way to what we do for the aa64_ids feature, so that we correctly prioritize the trap over the UNDEF for registers in the space that don't exist, and so that we don't need to explicitly add the TICDP check to every IMPDEF register.
Since we already don't implement this correctly for the other CPUs, we don't need to gate Cortex-A710 on doing it right.
thanks
-- PMM
Peter Maydell
AppliedQuoted 4 lines · Richard Henderson
This is one of the first generation Armv9 cores, and gives us something concrete to test in that area. Notably, it supports MTE.
Quoted 12 lines
Changes for v2:
* Check GMBS during realize.
* Fix access checks for neoverse implementation registers. Mostly just traps EL1/EL2 if EL2/EL3 enabled.
* Addmake_ccsidr64helper.
* Reduce MTE with no tag memory to MTE=1.
* SuppressFEAT_TRBE.
* Implement HPDS2 as a no-op.
* Rewrite a710 implementation registers; do try to share code with neoverse, because the traps are different. This of course solves the renaming and renumbering issues too.
I've applied patches 1-7, 9 and 10 to target-arm.next.
thanks
-- PMM