target/arm: Rely on id regs instead of features
v4 cover target/arm: Rely on id regs instead of features
This edition moves some of the system registers into a substructure, which is then shared with "normal" runtime and the translators. This is seen as a better solution than letting the entire translator have access to the main ARMCPU structure.
Also after rebasing on mainline, there was a new cortex-m33 failure caused by v8m implying v7ve implying arm_div.
r~
Richard Henderson (8):
target/arm: Move some system registers into a substructure target/arm: V8M should not imply V7VE
target/arm: Convert v8 extensions from feature bits to isar tests target/arm: Convert division from feature bits to isar0 tests target/arm: Convert jazelle from feature bit to isar1 test target/arm: Convert t32ee from feature bit to isar3 test target/arm: Convert sve from feature bit to aa64pfr0 test target/arm: Convert v8.2-fp16 from feature bit to aa64pfr0 test
target/arm/cpu.h | 220 +++++++++++++++++++++++++++----- target/arm/translate.h | 7 ++ hw/intc/armv7m_nvic.c | 12 +- linux-user/aarch64/signal.c | 4 +- linux-user/elfload.c | 60 +++++---- linux-user/syscall.c | 10 +- target/arm/cpu.c | 242 +++++++++++++++++++----------------- target/arm/cpu64.c | 148 ++++++++++++---------- target/arm/helper.c | 41 +++--- target/arm/machine.c | 6 +- target/arm/translate-a64.c | 145 +++++++++++---------- target/arm/translate.c | 48 ++++--- 12 files changed, 570 insertions(+), 373 deletions(-)
Signature · 1 line
2.17.2
PATCH v4 1/8 target/arm: Move some system registers into a substructure
Create struct ARMISARegisters, to be accessed during translation.
--- target/arm/cpu.h | 32 ++++---- hw/intc/armv7m_nvic.c | 12 +-- target/arm/cpu.c | 178 +++++++++++++++++++++--------------------- target/arm/cpu64.c | 70 ++++++++--------- target/arm/helper.c | 28 +++---- 5 files changed, 162 insertions(+), 158 deletions(-)
target/arm/cpu.h +18 -14
@@ -788,13 +788,28 @@ struct ARMCPU {* ARMv7AR ARM Architecture Reference Manual. A reset_ prefix * is used for reset values of non-constant registers; no reset_ * prefix means a constant register. +* Some of these registers are split out into a substructure that +* is shared with the translators to control the ISA. */ +struct ARMISARegisters { +uint32_t id_isar0; +uint32_t id_isar1; +uint32_t id_isar2; +uint32_t id_isar3; +uint32_t id_isar4; +uint32_t id_isar5; +uint32_t id_isar6; +uint32_t mvfr0; +uint32_t mvfr1; +uint32_t mvfr2; +uint64_t id_aa64isar0; +uint64_t id_aa64isar1; +uint64_t id_aa64pfr0; +uint64_t id_aa64pfr1; + } isar;uint32_t midr;uint32_t revidr;uint32_t reset_fpsid; -uint32_t mvfr0; -uint32_t mvfr1; -uint32_t mvfr2;uint32_t ctr;uint32_t reset_sctlr;uint32_t id_pfr0;
@@ -808,21 +823,10 @@ struct ARMCPU {uint32_t id_mmfr2;uint32_t id_mmfr3;uint32_t id_mmfr4; -uint32_t id_isar0; -uint32_t id_isar1; -uint32_t id_isar2; -uint32_t id_isar3; -uint32_t id_isar4; -uint32_t id_isar5; -uint32_t id_isar6; -uint64_t id_aa64pfr0; -uint64_t id_aa64pfr1;uint64_t id_aa64dfr0;uint64_t id_aa64dfr1;uint64_t id_aa64afr0;uint64_t id_aa64afr1; -uint64_t id_aa64isar0; -uint64_t id_aa64isar1;uint64_t id_aa64mmfr0;uint64_t id_aa64mmfr1;uint32_t dbgdidr;
hw/intc/armv7m_nvic.c +6 -6
@@ -1055,17 +1055,17 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)case 0xd5c :/* MMFR3. */ return cpu->id_mmfr3;case 0xd60 :/* ISAR0. */ -return cpu->id_isar0; +return cpu->isar.id_isar0;case 0xd64 :/* ISAR1. */ -return cpu->id_isar1; +return cpu->isar.id_isar1;case 0xd68 :/* ISAR2. */ -return cpu->id_isar2; +return cpu->isar.id_isar2;case 0xd6c :/* ISAR3. */ -return cpu->id_isar3; +return cpu->isar.id_isar3;case 0xd70 :/* ISAR4. */ -return cpu->id_isar4; +return cpu->isar.id_isar4;case 0xd74 :/* ISAR5. */ -return cpu->id_isar5; +return cpu->isar.id_isar5;case 0xd78 :/* CLIDR */ return cpu->clidr;case 0xd7c :/* CTR */
target/arm/cpu.c +89 -89
316 lines not on this page · raw message
target/arm/cpu64.c +35 -35
113 lines not on this page · raw message
target/arm/helper.c +14 -14
@@ -4873,7 +4873,7 @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)static uint64_t id_aa64pfr0_read (CPUARMState *env,const ARMCPRegInfo *ri) {ARMCPU *cpu =arm_env_get_cpu (env); -uint64_t pfr0 = cpu->id_aa64pfr0; +uint64_t pfr0 = cpu->isar.id_aa64pfr0;if (env->gicv3state) { pfr0 |=1 <<24 ;
@@ -4940,27 +4940,27 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "ID_ISAR0", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar0 }, + .resetvalue = cpu->isar.id_isar0 }, { .name = "ID_ISAR1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar1 }, + .resetvalue = cpu->isar.id_isar1 }, { .name = "ID_ISAR2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar2 }, + .resetvalue = cpu->isar.id_isar2 }, { .name = "ID_ISAR3", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 3, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar3 }, + .resetvalue = cpu->isar.id_isar3 }, { .name = "ID_ISAR4", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 4, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar4 }, + .resetvalue = cpu->isar.id_isar4 }, { .name = "ID_ISAR5", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 5, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar5 }, + .resetvalue = cpu->isar.id_isar5 }, { .name = "ID_MMFR4", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6, .access = PL1_R, .type = ARM_CP_CONST,
@@ -4968,7 +4968,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "ID_ISAR6", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar6 }, + .resetvalue = cpu->isar.id_isar6 }, REGINFO_SENTINEL };define_arm_cp_regs (cpu, v6_idregs);
@@ -5039,7 +5039,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "ID_AA64PFR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_aa64pfr1}, + .resetvalue = cpu->isar.id_aa64pfr1}, { .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST,
@@ -5100,11 +5100,11 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_aa64isar0 }, + .resetvalue = cpu->isar.id_aa64isar0 }, { .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_aa64isar1 }, + .resetvalue = cpu->isar.id_aa64isar1 }, { .name = "ID_AA64ISAR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST,
@@ -5164,15 +5164,15 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "MVFR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->mvfr0 }, + .resetvalue = cpu->isar.mvfr0 }, { .name = "MVFR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->mvfr1 }, + .resetvalue = cpu->isar.mvfr1 }, { .name = "MVFR2_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->mvfr2 }, + .resetvalue = cpu->isar.mvfr2 }, { .name = "MVFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 3, .access = PL1_R, .type = ARM_CP_CONST,
Signature · 1 line
2.17.2
Re: [Qemu-devel] [PATCH v4 1/8] target/arm: Move some system registers into a substructure
Hi Richard,
Quoted 28 lines · Richard Henderson
Create struct ARMISARegisters, to be accessed during translation.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu.h | 32 ++++---- hw/intc/armv7m_nvic.c | 12 +-- target/arm/cpu.c | 178 +++++++++++++++++++++--------------------- target/arm/cpu64.c | 70 ++++++++--------- target/arm/helper.c | 28 +++---- 5 files changed, 162 insertions(+), 158 deletions(-)target/arm/cpu.h +8
-0@@ -788,13 +788,28 @@ struct ARMCPU {* ARMv7AR ARM Architecture Reference Manual. A reset_ prefix * is used for reset values of non-constant registers; no reset_ * prefix means a constant register. +* Some of these registers are split out into a substructure that +* is shared with the translators to control the ISA. */ +struct ARMISARegisters { +uint32_t id_isar0; +uint32_t id_isar1; +uint32_t id_isar2; +uint32_t id_isar3; +uint32_t id_isar4;
target/arm/cpu.h struct ARMCPU { · line 809
Quoted 10 lines
target/arm/cpu.h +10
-0+uint32_t id_isar5; +uint32_t id_isar6; +uint32_t mvfr0; +uint32_t mvfr1; +uint32_t mvfr2; +uint64_t id_aa64isar0; +uint64_t id_aa64isar1; +uint64_t id_aa64pfr0; +uint64_t id_aa64pfr1; + } isar;
I understand and agree with the change, however I find the 'isar' name confusing. Sadly unnamed structure is not useful here.
I can't think of a better name, eventually 'isa', so:
Quoted 624 lines
target/arm/cpu.h +0
-14uint32_t midr;uint32_t revidr;uint32_t reset_fpsid; -uint32_t mvfr0; -uint32_t mvfr1; -uint32_t mvfr2;uint32_t ctr;uint32_t reset_sctlr;uint32_t id_pfr0;@@ -808,21 +823,10 @@ struct ARMCPU {uint32_t id_mmfr2;uint32_t id_mmfr3;uint32_t id_mmfr4; -uint32_t id_isar0; -uint32_t id_isar1; -uint32_t id_isar2; -uint32_t id_isar3; -uint32_t id_isar4; -uint32_t id_isar5; -uint32_t id_isar6; -uint64_t id_aa64pfr0; -uint64_t id_aa64pfr1;uint64_t id_aa64dfr0;uint64_t id_aa64dfr1;uint64_t id_aa64afr0;uint64_t id_aa64afr1; -uint64_t id_aa64isar0; -uint64_t id_aa64isar1;uint64_t id_aa64mmfr0;uint64_t id_aa64mmfr1;uint32_t dbgdidr;hw/intc/armv7m_nvic.c +6
-6@@ -1055,17 +1055,17 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)case 0xd5c :/* MMFR3. */ return cpu->id_mmfr3;case 0xd60 :/* ISAR0. */ -return cpu->id_isar0; +return cpu->isar.id_isar0;case 0xd64 :/* ISAR1. */ -return cpu->id_isar1; +return cpu->isar.id_isar1;case 0xd68 :/* ISAR2. */ -return cpu->id_isar2; +return cpu->isar.id_isar2;case 0xd6c :/* ISAR3. */ -return cpu->id_isar3; +return cpu->isar.id_isar3;case 0xd70 :/* ISAR4. */ -return cpu->id_isar4; +return cpu->isar.id_isar4;case 0xd74 :/* ISAR5. */ -return cpu->id_isar5; +return cpu->isar.id_isar5;case 0xd78 :/* CLIDR */ return cpu->clidr;case 0xd7c :/* CTR */ target/arm/cpu.c +89
-89@@ -144,9 +144,9 @@ static void arm_cpu_reset(CPUState *s)g_hash_table_foreach (cpu->cp_regs, cp_reg_check_reset, cpu); env->vfp.xregs[ARM_VFP_FPSID ] = cpu->reset_fpsid; - env->vfp.xregs[ARM_VFP_MVFR0 ] = cpu->mvfr0; - env->vfp.xregs[ARM_VFP_MVFR1 ] = cpu->mvfr1; - env->vfp.xregs[ARM_VFP_MVFR2 ] = cpu->mvfr2; + env->vfp.xregs[ARM_VFP_MVFR0 ] = cpu->isar.mvfr0; + env->vfp.xregs[ARM_VFP_MVFR1 ] = cpu->isar.mvfr1; + env->vfp.xregs[ARM_VFP_MVFR2 ] = cpu->isar.mvfr2; cpu->power_state = cpu->start_powered_off ?PSCI_OFF :PSCI_ON ; s->halted = cpu->start_powered_off;@@ -938,7 +938,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* registers as well. These are id_pfr1[7:4] and id_aa64pfr0[15:12]. */ cpu->id_pfr1 &= ~0xf0 ; - cpu->id_aa64pfr0 &= ~0xf000 ; + cpu->isar.id_aa64pfr0 &= ~0xf000 ; }if (!cpu->has_el2) {@@ -955,7 +955,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* registers if we don't have EL2. These are id_pfr1[15:12] and * id_aa64pfr0_el1[11:8]. */ - cpu->id_aa64pfr0 &= ~0xf00 ; + cpu->isar.id_aa64pfr0 &= ~0xf00 ; cpu->id_pfr1 &= ~0xf000 ; }@@ -1151,8 +1151,8 @@ static void arm1136_r2_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_CACHE_BLOCK_OPS ); cpu->midr =0x4107b362 ; cpu->reset_fpsid =0x410120b4 ; - cpu->mvfr0 =0x11111111 ; - cpu->mvfr1 =0x00000000 ; + cpu->isar.mvfr0 =0x11111111 ; + cpu->isar.mvfr1 =0x00000000 ; cpu->ctr =0x1dd20d2 ; cpu->reset_sctlr =0x00050078 ; cpu->id_pfr0 =0x111 ;@@ -1162,11 +1162,11 @@ static void arm1136_r2_initfn(Object *obj) cpu->id_mmfr0 =0x01130003 ; cpu->id_mmfr1 =0x10030302 ; cpu->id_mmfr2 =0x01222110 ; - cpu->id_isar0 =0x00140011 ; - cpu->id_isar1 =0x12002111 ; - cpu->id_isar2 =0x11231111 ; - cpu->id_isar3 =0x01102131 ; - cpu->id_isar4 =0x141 ; + cpu->isar.id_isar0 =0x00140011 ; + cpu->isar.id_isar1 =0x12002111 ; + cpu->isar.id_isar2 =0x11231111 ; + cpu->isar.id_isar3 =0x01102131 ; + cpu->isar.id_isar4 =0x141 ; cpu->reset_auxcr =7 ; }@@ -1183,8 +1183,8 @@ static void arm1136_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_CACHE_BLOCK_OPS ); cpu->midr =0x4117b363 ; cpu->reset_fpsid =0x410120b4 ; - cpu->mvfr0 =0x11111111 ; - cpu->mvfr1 =0x00000000 ; + cpu->isar.mvfr0 =0x11111111 ; + cpu->isar.mvfr1 =0x00000000 ; cpu->ctr =0x1dd20d2 ; cpu->reset_sctlr =0x00050078 ; cpu->id_pfr0 =0x111 ;@@ -1194,11 +1194,11 @@ static void arm1136_initfn(Object *obj) cpu->id_mmfr0 =0x01130003 ; cpu->id_mmfr1 =0x10030302 ; cpu->id_mmfr2 =0x01222110 ; - cpu->id_isar0 =0x00140011 ; - cpu->id_isar1 =0x12002111 ; - cpu->id_isar2 =0x11231111 ; - cpu->id_isar3 =0x01102131 ; - cpu->id_isar4 =0x141 ; + cpu->isar.id_isar0 =0x00140011 ; + cpu->isar.id_isar1 =0x12002111 ; + cpu->isar.id_isar2 =0x11231111 ; + cpu->isar.id_isar3 =0x01102131 ; + cpu->isar.id_isar4 =0x141 ; cpu->reset_auxcr =7 ; }@@ -1216,8 +1216,8 @@ static void arm1176_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 ); cpu->midr =0x410fb767 ; cpu->reset_fpsid =0x410120b5 ; - cpu->mvfr0 =0x11111111 ; - cpu->mvfr1 =0x00000000 ; + cpu->isar.mvfr0 =0x11111111 ; + cpu->isar.mvfr1 =0x00000000 ; cpu->ctr =0x1dd20d2 ; cpu->reset_sctlr =0x00050078 ; cpu->id_pfr0 =0x111 ;@@ -1227,11 +1227,11 @@ static void arm1176_initfn(Object *obj) cpu->id_mmfr0 =0x01130003 ; cpu->id_mmfr1 =0x10030302 ; cpu->id_mmfr2 =0x01222100 ; - cpu->id_isar0 =0x0140011 ; - cpu->id_isar1 =0x12002111 ; - cpu->id_isar2 =0x11231121 ; - cpu->id_isar3 =0x01102131 ; - cpu->id_isar4 =0x01141 ; + cpu->isar.id_isar0 =0x0140011 ; + cpu->isar.id_isar1 =0x12002111 ; + cpu->isar.id_isar2 =0x11231121 ; + cpu->isar.id_isar3 =0x01102131 ; + cpu->isar.id_isar4 =0x01141 ; cpu->reset_auxcr =7 ; }@@ -1247,8 +1247,8 @@ static void arm11mpcore_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS ); cpu->midr =0x410fb022 ; cpu->reset_fpsid =0x410120b4 ; - cpu->mvfr0 =0x11111111 ; - cpu->mvfr1 =0x00000000 ; + cpu->isar.mvfr0 =0x11111111 ; + cpu->isar.mvfr1 =0x00000000 ; cpu->ctr =0x1d192992 ;/* 32K icache 32K dcache */ cpu->id_pfr0 =0x111 ; cpu->id_pfr1 =0x1 ;@@ -1257,11 +1257,11 @@ static void arm11mpcore_initfn(Object *obj) cpu->id_mmfr0 =0x01100103 ; cpu->id_mmfr1 =0x10020302 ; cpu->id_mmfr2 =0x01222000 ; - cpu->id_isar0 =0x00100011 ; - cpu->id_isar1 =0x12002111 ; - cpu->id_isar2 =0x11221011 ; - cpu->id_isar3 =0x01102131 ; - cpu->id_isar4 =0x141 ; + cpu->isar.id_isar0 =0x00100011 ; + cpu->isar.id_isar1 =0x12002111 ; + cpu->isar.id_isar2 =0x11221011 ; + cpu->isar.id_isar3 =0x01102131 ; + cpu->isar.id_isar4 =0x141 ; cpu->reset_auxcr =1 ; }@@ -1290,13 +1290,13 @@ static void cortex_m3_initfn(Object *obj) cpu->id_mmfr1 =0x00000000 ; cpu->id_mmfr2 =0x00000000 ; cpu->id_mmfr3 =0x00000000 ; - cpu->id_isar0 =0x01141110 ; - cpu->id_isar1 =0x02111000 ; - cpu->id_isar2 =0x21112231 ; - cpu->id_isar3 =0x01111110 ; - cpu->id_isar4 =0x01310102 ; - cpu->id_isar5 =0x00000000 ; - cpu->id_isar6 =0x00000000 ; + cpu->isar.id_isar0 =0x01141110 ; + cpu->isar.id_isar1 =0x02111000 ; + cpu->isar.id_isar2 =0x21112231 ; + cpu->isar.id_isar3 =0x01111110 ; + cpu->isar.id_isar4 =0x01310102 ; + cpu->isar.id_isar5 =0x00000000 ; + cpu->isar.id_isar6 =0x00000000 ; }static void cortex_m4_initfn (Object *obj)@@ -1317,13 +1317,13 @@ static void cortex_m4_initfn(Object *obj) cpu->id_mmfr1 =0x00000000 ; cpu->id_mmfr2 =0x00000000 ; cpu->id_mmfr3 =0x00000000 ; - cpu->id_isar0 =0x01141110 ; - cpu->id_isar1 =0x02111000 ; - cpu->id_isar2 =0x21112231 ; - cpu->id_isar3 =0x01111110 ; - cpu->id_isar4 =0x01310102 ; - cpu->id_isar5 =0x00000000 ; - cpu->id_isar6 =0x00000000 ; + cpu->isar.id_isar0 =0x01141110 ; + cpu->isar.id_isar1 =0x02111000 ; + cpu->isar.id_isar2 =0x21112231 ; + cpu->isar.id_isar3 =0x01111110 ; + cpu->isar.id_isar4 =0x01310102 ; + cpu->isar.id_isar5 =0x00000000 ; + cpu->isar.id_isar6 =0x00000000 ; }static void cortex_m33_initfn (Object *obj)@@ -1346,13 +1346,13 @@ static void cortex_m33_initfn(Object *obj) cpu->id_mmfr1 =0x00000000 ; cpu->id_mmfr2 =0x01000000 ; cpu->id_mmfr3 =0x00000000 ; - cpu->id_isar0 =0x01101110 ; - cpu->id_isar1 =0x02212000 ; - cpu->id_isar2 =0x20232232 ; - cpu->id_isar3 =0x01111131 ; - cpu->id_isar4 =0x01310132 ; - cpu->id_isar5 =0x00000000 ; - cpu->id_isar6 =0x00000000 ; + cpu->isar.id_isar0 =0x01101110 ; + cpu->isar.id_isar1 =0x02212000 ; + cpu->isar.id_isar2 =0x20232232 ; + cpu->isar.id_isar3 =0x01111131 ; + cpu->isar.id_isar4 =0x01310132 ; + cpu->isar.id_isar5 =0x00000000 ; + cpu->isar.id_isar6 =0x00000000 ; cpu->clidr =0x00000000 ; cpu->ctr =0x8000c000 ; }@@ -1397,13 +1397,13 @@ static void cortex_r5_initfn(Object *obj) cpu->id_mmfr1 =0x00000000 ; cpu->id_mmfr2 =0x01200000 ; cpu->id_mmfr3 =0x0211 ; - cpu->id_isar0 =0x02101111 ; - cpu->id_isar1 =0x13112111 ; - cpu->id_isar2 =0x21232141 ; - cpu->id_isar3 =0x01112131 ; - cpu->id_isar4 =0x0010142 ; - cpu->id_isar5 =0x0 ; - cpu->id_isar6 =0x0 ; + cpu->isar.id_isar0 =0x02101111 ; + cpu->isar.id_isar1 =0x13112111 ; + cpu->isar.id_isar2 =0x21232141 ; + cpu->isar.id_isar3 =0x01112131 ; + cpu->isar.id_isar4 =0x0010142 ; + cpu->isar.id_isar5 =0x0 ; + cpu->isar.id_isar6 =0x0 ; cpu->mp_is_up = true; cpu->pmsav7_dregion =16 ;define_arm_cp_regs (cpu, cortexr5_cp_reginfo);@@ -1438,8 +1438,8 @@ static void cortex_a8_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 ); cpu->midr =0x410fc080 ; cpu->reset_fpsid =0x410330c0 ; - cpu->mvfr0 =0x11110222 ; - cpu->mvfr1 =0x00011111 ; + cpu->isar.mvfr0 =0x11110222 ; + cpu->isar.mvfr1 =0x00011111 ; cpu->ctr =0x82048004 ; cpu->reset_sctlr =0x00c50078 ; cpu->id_pfr0 =0x1031 ;@@ -1450,11 +1450,11 @@ static void cortex_a8_initfn(Object *obj) cpu->id_mmfr1 =0x20000000 ; cpu->id_mmfr2 =0x01202000 ; cpu->id_mmfr3 =0x11 ; - cpu->id_isar0 =0x00101111 ; - cpu->id_isar1 =0x12112111 ; - cpu->id_isar2 =0x21232031 ; - cpu->id_isar3 =0x11112131 ; - cpu->id_isar4 =0x00111142 ; + cpu->isar.id_isar0 =0x00101111 ; + cpu->isar.id_isar1 =0x12112111 ; + cpu->isar.id_isar2 =0x21232031 ; + cpu->isar.id_isar3 =0x11112131 ; + cpu->isar.id_isar4 =0x00111142 ; cpu->dbgdidr =0x15141000 ; cpu->clidr = (1 <<27 ) | (2 <<24 ) |3 ; cpu->ccsidr[0 ] =0xe007e01a ;/* 16k L1 dcache. */ @@ -1512,8 +1512,8 @@ static void cortex_a9_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_CBAR ); cpu->midr =0x410fc090 ; cpu->reset_fpsid =0x41033090 ; - cpu->mvfr0 =0x11110222 ; - cpu->mvfr1 =0x01111111 ; + cpu->isar.mvfr0 =0x11110222 ; + cpu->isar.mvfr1 =0x01111111 ; cpu->ctr =0x80038003 ; cpu->reset_sctlr =0x00c50078 ; cpu->id_pfr0 =0x1031 ;@@ -1524,11 +1524,11 @@ static void cortex_a9_initfn(Object *obj) cpu->id_mmfr1 =0x20000000 ; cpu->id_mmfr2 =0x01230000 ; cpu->id_mmfr3 =0x00002111 ; - cpu->id_isar0 =0x00101111 ; - cpu->id_isar1 =0x13112111 ; - cpu->id_isar2 =0x21232041 ; - cpu->id_isar3 =0x11112131 ; - cpu->id_isar4 =0x00111142 ; + cpu->isar.id_isar0 =0x00101111 ; + cpu->isar.id_isar1 =0x13112111 ; + cpu->isar.id_isar2 =0x21232041 ; + cpu->isar.id_isar3 =0x11112131 ; + cpu->isar.id_isar4 =0x00111142 ; cpu->dbgdidr =0x35141000 ; cpu->clidr = (1 <<27 ) | (1 <<24 ) |3 ; cpu->ccsidr[0 ] =0xe00fe019 ;/* 16k L1 dcache. */ @@ -1573,8 +1573,8 @@ static void cortex_a7_initfn(Object *obj) cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A7 ; cpu->midr =0x410fc075 ; cpu->reset_fpsid =0x41023075 ; - cpu->mvfr0 =0x10110222 ; - cpu->mvfr1 =0x11111111 ; + cpu->isar.mvfr0 =0x10110222 ; + cpu->isar.mvfr1 =0x11111111 ; cpu->ctr =0x84448003 ; cpu->reset_sctlr =0x00c50078 ; cpu->id_pfr0 =0x00001131 ;@@ -1590,11 +1590,11 @@ static void cortex_a7_initfn(Object *obj)/* a7_mpcore_r0p5_trm, page 4-4 gives 0x01101110; but * table 4-41 gives 0x02101110, which includes the arm div insns. */ - cpu->id_isar0 =0x02101110 ; - cpu->id_isar1 =0x13112111 ; - cpu->id_isar2 =0x21232041 ; - cpu->id_isar3 =0x11112131 ; - cpu->id_isar4 =0x10011142 ; + cpu->isar.id_isar0 =0x02101110 ; + cpu->isar.id_isar1 =0x13112111 ; + cpu->isar.id_isar2 =0x21232041 ; + cpu->isar.id_isar3 =0x11112131 ; + cpu->isar.id_isar4 =0x10011142 ; cpu->dbgdidr =0x3515f005 ; cpu->clidr =0x0a200023 ; cpu->ccsidr[0 ] =0x701fe00a ;/* 32K L1 dcache */ @@ -1619,8 +1619,8 @@ static void cortex_a15_initfn(Object *obj) cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A15 ; cpu->midr =0x412fc0f1 ; cpu->reset_fpsid =0x410430f0 ; - cpu->mvfr0 =0x10110222 ; - cpu->mvfr1 =0x11111111 ; + cpu->isar.mvfr0 =0x10110222 ; + cpu->isar.mvfr1 =0x11111111 ; cpu->ctr =0x8444c004 ; cpu->reset_sctlr =0x00c50078 ; cpu->id_pfr0 =0x00001131 ;@@ -1633,11 +1633,11 @@ static void cortex_a15_initfn(Object *obj) cpu->id_mmfr1 =0x20000000 ; cpu->id_mmfr2 =0x01240000 ; cpu->id_mmfr3 =0x02102211 ; - cpu->id_isar0 =0x02101110 ; - cpu->id_isar1 =0x13112111 ; - cpu->id_isar2 =0x21232041 ; - cpu->id_isar3 =0x11112131 ; - cpu->id_isar4 =0x10011142 ; + cpu->isar.id_isar0 =0x02101110 ; + cpu->isar.id_isar1 =0x13112111 ; + cpu->isar.id_isar2 =0x21232041 ; + cpu->isar.id_isar3 =0x11112131 ; + cpu->isar.id_isar4 =0x10011142 ; cpu->dbgdidr =0x3515f021 ; cpu->clidr =0x0a200023 ; cpu->ccsidr[0 ] =0x701fe00a ;/* 32K L1 dcache */ target/arm/cpu64.c +35
-35@@ -121,9 +121,9 @@ static void aarch64_a57_initfn(Object *obj) cpu->midr =0x411fd070 ; cpu->revidr =0x00000000 ; cpu->reset_fpsid =0x41034070 ; - cpu->mvfr0 =0x10110222 ; - cpu->mvfr1 =0x12111111 ; - cpu->mvfr2 =0x00000043 ; + cpu->isar.mvfr0 =0x10110222 ; + cpu->isar.mvfr1 =0x12111111 ; + cpu->isar.mvfr2 =0x00000043 ; cpu->ctr =0x8444c004 ; cpu->reset_sctlr =0x00c50838 ; cpu->id_pfr0 =0x00000131 ;@@ -134,18 +134,18 @@ static void aarch64_a57_initfn(Object *obj) cpu->id_mmfr1 =0x40000000 ; cpu->id_mmfr2 =0x01260000 ; cpu->id_mmfr3 =0x02102211 ; - cpu->id_isar0 =0x02101110 ; - cpu->id_isar1 =0x13112111 ; - cpu->id_isar2 =0x21232042 ; - cpu->id_isar3 =0x01112131 ; - cpu->id_isar4 =0x00011142 ; - cpu->id_isar5 =0x00011121 ; - cpu->id_isar6 =0 ; - cpu->id_aa64pfr0 =0x00002222 ; + cpu->isar.id_isar0 =0x02101110 ; + cpu->isar.id_isar1 =0x13112111 ; + cpu->isar.id_isar2 =0x21232042 ; + cpu->isar.id_isar3 =0x01112131 ; + cpu->isar.id_isar4 =0x00011142 ; + cpu->isar.id_isar5 =0x00011121 ; + cpu->isar.id_isar6 =0 ; + cpu->isar.id_aa64pfr0 =0x00002222 ; cpu->id_aa64dfr0 =0x10305106 ; cpu->pmceid0 =0x00000000 ; cpu->pmceid1 =0x00000000 ; - cpu->id_aa64isar0 =0x00011120 ; + cpu->isar.id_aa64isar0 =0x00011120 ; cpu->id_aa64mmfr0 =0x00001124 ; cpu->dbgdidr =0x3516d000 ; cpu->clidr =0x0a200023 ;@@ -182,9 +182,9 @@ static void aarch64_a53_initfn(Object *obj) cpu->midr =0x410fd034 ; cpu->revidr =0x00000000 ; cpu->reset_fpsid =0x41034070 ; - cpu->mvfr0 =0x10110222 ; - cpu->mvfr1 =0x12111111 ; - cpu->mvfr2 =0x00000043 ; + cpu->isar.mvfr0 =0x10110222 ; + cpu->isar.mvfr1 =0x12111111 ; + cpu->isar.mvfr2 =0x00000043 ; cpu->ctr =0x84448004 ;/* L1Ip = VIPT */ cpu->reset_sctlr =0x00c50838 ; cpu->id_pfr0 =0x00000131 ;@@ -195,16 +195,16 @@ static void aarch64_a53_initfn(Object *obj) cpu->id_mmfr1 =0x40000000 ; cpu->id_mmfr2 =0x01260000 ; cpu->id_mmfr3 =0x02102211 ; - cpu->id_isar0 =0x02101110 ; - cpu->id_isar1 =0x13112111 ; - cpu->id_isar2 =0x21232042 ; - cpu->id_isar3 =0x01112131 ; - cpu->id_isar4 =0x00011142 ; - cpu->id_isar5 =0x00011121 ; - cpu->id_isar6 =0 ; - cpu->id_aa64pfr0 =0x00002222 ; + cpu->isar.id_isar0 =0x02101110 ; + cpu->isar.id_isar1 =0x13112111 ; + cpu->isar.id_isar2 =0x21232042 ; + cpu->isar.id_isar3 =0x01112131 ; + cpu->isar.id_isar4 =0x00011142 ; + cpu->isar.id_isar5 =0x00011121 ; + cpu->isar.id_isar6 =0 ; + cpu->isar.id_aa64pfr0 =0x00002222 ; cpu->id_aa64dfr0 =0x10305106 ; - cpu->id_aa64isar0 =0x00011120 ; + cpu->isar.id_aa64isar0 =0x00011120 ; cpu->id_aa64mmfr0 =0x00001122 ;/* 40 bit physical addr */ cpu->dbgdidr =0x3516d000 ; cpu->clidr =0x0a200023 ;@@ -240,9 +240,9 @@ static void aarch64_a72_initfn(Object *obj) cpu->midr =0x410fd083 ; cpu->revidr =0x00000000 ; cpu->reset_fpsid =0x41034080 ; - cpu->mvfr0 =0x10110222 ; - cpu->mvfr1 =0x12111111 ; - cpu->mvfr2 =0x00000043 ; + cpu->isar.mvfr0 =0x10110222 ; + cpu->isar.mvfr1 =0x12111111 ; + cpu->isar.mvfr2 =0x00000043 ; cpu->ctr =0x8444c004 ; cpu->reset_sctlr =0x00c50838 ; cpu->id_pfr0 =0x00000131 ;@@ -253,17 +253,17 @@ static void aarch64_a72_initfn(Object *obj) cpu->id_mmfr1 =0x40000000 ; cpu->id_mmfr2 =0x01260000 ; cpu->id_mmfr3 =0x02102211 ; - cpu->id_isar0 =0x02101110 ; - cpu->id_isar1 =0x13112111 ; - cpu->id_isar2 =0x21232042 ; - cpu->id_isar3 =0x01112131 ; - cpu->id_isar4 =0x00011142 ; - cpu->id_isar5 =0x00011121 ; - cpu->id_aa64pfr0 =0x00002222 ; + cpu->isar.id_isar0 =0x02101110 ; + cpu->isar.id_isar1 =0x13112111 ; + cpu->isar.id_isar2 =0x21232042 ; + cpu->isar.id_isar3 =0x01112131 ; + cpu->isar.id_isar4 =0x00011142 ; + cpu->isar.id_isar5 =0x00011121 ; + cpu->isar.id_aa64pfr0 =0x00002222 ; cpu->id_aa64dfr0 =0x10305106 ; cpu->pmceid0 =0x00000000 ; cpu->pmceid1 =0x00000000 ; - cpu->id_aa64isar0 =0x00011120 ; + cpu->isar.id_aa64isar0 =0x00011120 ; cpu->id_aa64mmfr0 =0x00001124 ; cpu->dbgdidr =0x3516d000 ; cpu->clidr =0x0a200023 ;target/arm/helper.c +14
-14@@ -4873,7 +4873,7 @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)static uint64_t id_aa64pfr0_read (CPUARMState *env,const ARMCPRegInfo *ri) {ARMCPU *cpu =arm_env_get_cpu (env); -uint64_t pfr0 = cpu->id_aa64pfr0; +uint64_t pfr0 = cpu->isar.id_aa64pfr0;if (env->gicv3state) { pfr0 |=1 <<24 ;@@ -4940,27 +4940,27 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "ID_ISAR0", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar0 }, + .resetvalue = cpu->isar.id_isar0 }, { .name = "ID_ISAR1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar1 }, + .resetvalue = cpu->isar.id_isar1 }, { .name = "ID_ISAR2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar2 }, + .resetvalue = cpu->isar.id_isar2 }, { .name = "ID_ISAR3", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 3, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar3 }, + .resetvalue = cpu->isar.id_isar3 }, { .name = "ID_ISAR4", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 4, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar4 }, + .resetvalue = cpu->isar.id_isar4 }, { .name = "ID_ISAR5", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 5, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar5 }, + .resetvalue = cpu->isar.id_isar5 }, { .name = "ID_MMFR4", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6, .access = PL1_R, .type = ARM_CP_CONST,@@ -4968,7 +4968,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "ID_ISAR6", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_isar6 }, + .resetvalue = cpu->isar.id_isar6 }, REGINFO_SENTINEL };define_arm_cp_regs (cpu, v6_idregs);@@ -5039,7 +5039,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "ID_AA64PFR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_aa64pfr1}, + .resetvalue = cpu->isar.id_aa64pfr1}, { .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST,@@ -5100,11 +5100,11 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_aa64isar0 }, + .resetvalue = cpu->isar.id_aa64isar0 }, { .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->id_aa64isar1 }, + .resetvalue = cpu->isar.id_aa64isar1 }, { .name = "ID_AA64ISAR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST,@@ -5164,15 +5164,15 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "MVFR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->mvfr0 }, + .resetvalue = cpu->isar.mvfr0 }, { .name = "MVFR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->mvfr1 }, + .resetvalue = cpu->isar.mvfr1 }, { .name = "MVFR2_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST, - .resetvalue = cpu->mvfr2 }, + .resetvalue = cpu->isar.mvfr2 }, { .name = "MVFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 3, .access = PL1_R, .type = ARM_CP_CONST,
Re: [Qemu-devel] [PATCH v4 1/8] target/arm: Move some system registers into a substructure
Quoted 36 lines · Philippe Mathieu-Daudé
Hi Richard,
Quoted 33 lines · Richard Henderson
Create struct ARMISARegisters, to be accessed during translation.
Signed-off-by Richard Henderson <[email protected]>--- target/arm/cpu.h | 32 ++++---- hw/intc/armv7m_nvic.c | 12 +-- target/arm/cpu.c | 178 +++++++++++++++++++++--------------------- target/arm/cpu64.c | 70 ++++++++--------- target/arm/helper.c | 28 +++---- 5 files changed, 162 insertions(+), 158 deletions(-)target/arm/cpu.h +13
-0@@ -788,13 +788,28 @@ struct ARMCPU {* ARMv7AR ARM Architecture Reference Manual. A reset_ prefix * is used for reset values of non-constant registers; no reset_ * prefix means a constant register. +* Some of these registers are split out into a substructure that +* is shared with the translators to control the ISA. */ +struct ARMISARegisters { +uint32_t id_isar0; +uint32_t id_isar1; +uint32_t id_isar2; +uint32_t id_isar3; +uint32_t id_isar4; +uint32_t id_isar5; +uint32_t id_isar6; +uint32_t mvfr0; +uint32_t mvfr1; +uint32_t mvfr2;
Quoted 8 lines
target/arm/cpu.h struct ARMCPU { · line 809
Quoted 5 lines
target/arm/cpu.h +5
-0+uint64_t id_aa64isar0; +uint64_t id_aa64isar1; +uint64_t id_aa64pfr0; +uint64_t id_aa64pfr1; + } isar;I understand and agree with the change, however I find the 'isar' name confusing. Sadly unnamed structure is not useful here.
I assume the naming of these registers has some history within ARM, but I find the distribution of fields between "ISA Registers" and "Processor Feature Registers" and "Media & VFP Feature Registers" confusing, since they all have much the same function.
I struggled with the naming myself, but couldn't find anything better than "ISA Registers" myself. Which they all are, really, despite the other two names.
r~
PATCH v4 2/8 target/arm: V8M should not imply V7VE
In reply to Richard HendersonInstantiating mps2-an505 (cortex-m33) will fail make check when V7VE asserts that ID_ISAR0.Divide includes ARM division. It is also wrong to include ARM_FEATURE_LPAE.
--- target/arm/cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
target/arm/cpu.c +5 -1
@@ -814,7 +814,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)/* Some features automatically imply others: */ if (arm_feature (env,ARM_FEATURE_V8 )) { -set_feature (env,ARM_FEATURE_V7VE ); +if (arm_feature (env,ARM_FEATURE_M )) { +set_feature (env,ARM_FEATURE_V7 ); + }else { +set_feature (env,ARM_FEATURE_V7VE ); + } }if (arm_feature (env,ARM_FEATURE_V7VE )) {/* v7 Virtualization Extensions. In real hardware this implies
Signature · 1 line
2.17.2
PATCH v4 3/8 target/arm: Convert v8 extensions from feature bits to isar tests
In reply to Richard HendersonMost of the v8 extensions are self-contained within the ISAR registers and are not implied by other feature bits, which makes them the easiest to convert.
--- target/arm/cpu.h | 131 +++++++++++++++++++++++++++++++++---- target/arm/translate.h | 7 ++ linux-user/elfload.c | 46 ++++++++----- target/arm/cpu.c | 27 +++++--- target/arm/cpu64.c | 57 +++++++++------- target/arm/translate-a64.c | 101 ++++++++++++++-------------- target/arm/translate.c | 36 +++++----- 7 files changed, 273 insertions(+), 132 deletions(-)
target/arm/cpu.h +119 -12
@@ -669,6 +669,8 @@ typedef enum ARMPSCIState { PSCI_ON_PENDING = 2 } ARMPSCIState; +typedef struct ARMISARegisters ARMISARegisters ; +/** * ARMCPU: * @env: #CPUARMState
@@ -1577,30 +1579,18 @@ enum arm_features {ARM_FEATURE_LPAE ,/* has Large Physical Address Extension */ ARM_FEATURE_V8 ,ARM_FEATURE_AARCH64 ,/* supports 64 bit mode */ -ARM_FEATURE_V8_AES ,/* implements AES part of v8 Crypto Extensions */ ARM_FEATURE_CBAR ,/* has cp15 CBAR */ ARM_FEATURE_CRC ,/* ARMv8 CRC instructions */ ARM_FEATURE_CBAR_RO ,/* has cp15 CBAR and it is read-only */ ARM_FEATURE_EL2 ,/* has EL2 Virtualization support */ ARM_FEATURE_EL3 ,/* has EL3 Secure monitor support */ -ARM_FEATURE_V8_SHA1 ,/* implements SHA1 part of v8 Crypto Extensions */ -ARM_FEATURE_V8_SHA256 ,/* implements SHA256 part of v8 Crypto Extensions */ -ARM_FEATURE_V8_PMULL ,/* implements PMULL part of v8 Crypto Extensions */ ARM_FEATURE_THUMB_DSP ,/* DSP insns supported in the Thumb encodings */ ARM_FEATURE_PMU ,/* has PMU support */ ARM_FEATURE_VBAR ,/* has cp15 VBAR */ ARM_FEATURE_M_SECURITY ,/* M profile Security Extension */ ARM_FEATURE_JAZELLE ,/* has (trivial) Jazelle implementation */ ARM_FEATURE_SVE ,/* has Scalable Vector Extension */ -ARM_FEATURE_V8_SHA512 ,/* implements SHA512 part of v8 Crypto Extensions */ -ARM_FEATURE_V8_SHA3 ,/* implements SHA3 part of v8 Crypto Extensions */ -ARM_FEATURE_V8_SM3 ,/* implements SM3 part of v8 Crypto Extensions */ -ARM_FEATURE_V8_SM4 ,/* implements SM4 part of v8 Crypto Extensions */ -ARM_FEATURE_V8_ATOMICS ,/* ARMv8.1-Atomics feature */ -ARM_FEATURE_V8_RDM ,/* implements v8.1 simd round multiply */ -ARM_FEATURE_V8_DOTPROD ,/* implements v8.2 simd dot product */ ARM_FEATURE_V8_FP16 ,/* implements v8.2 half-precision float */ -ARM_FEATURE_V8_FCMA ,/* has complex number part of v8.3 extensions. */ ARM_FEATURE_M_MAIN, /* M profile Main Extension */ };
@@ -3152,4 +3142,121 @@ static inline uint64_t *aa64_vfp_qreg(CPUARMState *env, unsigned regno)/* Shared between translate-sve.c and sve_helper.c. */ extern const uint64_t pred_esz_masks[4 ]; +/* +* 32-bit feature tests via id registers. +*/ +static inline bool isar_feature_aa32_aes (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,AES ) !=0 ; +} + +static inline bool isar_feature_aa32_pmull (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,AES ) >1 ; +} + +static inline bool isar_feature_aa32_sha1 (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,SHA1 ) !=0 ; +} + +static inline bool isar_feature_aa32_sha2 (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,SHA2 ) !=0 ; +} + +static inline bool isar_feature_aa32_crc32 (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,CRC32 ) !=0 ; +} + +static inline bool isar_feature_aa32_rdm (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,RDM ) !=0 ; +} + +static inline bool isar_feature_aa32_vcma (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,VCMA ) !=0 ; +} + +static inline bool isar_feature_aa32_dp (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar6,ID_ISAR6 ,DP ) !=0 ; +} + +/* +* 64-bit feature tests via id registers. +*/ +static inline bool isar_feature_aa64_aes (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,AES ) !=0 ; +} + +static inline bool isar_feature_aa64_pmull (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,AES ) >1 ; +} + +static inline bool isar_feature_aa64_sha1 (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SHA1 ) !=0 ; +} + +static inline bool isar_feature_aa64_sha256 (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SHA2 ) !=0 ; +} + +static inline bool isar_feature_aa64_sha512 (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SHA2 ) >1 ; +} + +static inline bool isar_feature_aa64_crc32 (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,CRC32 ) !=0 ; +} + +static inline bool isar_feature_aa64_atomics (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,ATOMIC ) !=0 ; +} + +static inline bool isar_feature_aa64_rdm (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,RDM ) !=0 ; +} + +static inline bool isar_feature_aa64_sha3 (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SHA3 ) !=0 ; +} + +static inline bool isar_feature_aa64_sm3 (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SM3 ) !=0 ; +} + +static inline bool isar_feature_aa64_sm4 (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SM4 ) !=0 ; +} + +static inline bool isar_feature_aa64_dp (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,DP ) !=0 ; +} + +static inline bool isar_feature_aa64_fcma (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,FCMA ) !=0 ; +} + +/* +* Forward to the above feature tests given an ARMCPU pointer. +*/ +#define cpu_isar_feature (name, cpu) \ + ({ ARMCPU *cpu_ = (cpu); isar_feature_##name(&cpu_->isar); }) +#endif
target/arm/translate.h +7 -0
@@ -7,6 +7,7 @@/* internal defines */ typedef struct DisasContext { DisasContextBase base; + const ARMISARegisters *isar; target_ulong pc; target_ulong page_start;
@@ -190,4 +191,10 @@ static inline TCGv_i32 get_ahp_flag(void) return ret; } +/* +* Forward to the isar_feature_* tests given a DisasContext pointer. +*/ +#define dc_isar_feature (name, ctx) \ + ({ DisasContext *ctx_ = (ctx); isar_feature_##name(ctx_->isar); }) +#endif /* TARGET_ARM_TRANSLATE_H */
linux-user/elfload.c +28 -18
72 lines not on this page · raw message
target/arm/cpu.c +18 -9
@@ -1834,17 +1834,26 @@ static void arm_max_initfn(Object *obj)cortex_a15_initfn (obj);#ifdef CONFIG_USER_ONLY /* We don't set these in system emulation mode for the moment, -* since we don't correctly set the ID registers to advertise them, +* since we don't correctly set (all of) the ID registers to +* advertise them. */ set_feature (&cpu->env,ARM_FEATURE_V8 ); -set_feature (&cpu->env,ARM_FEATURE_V8_AES ); -set_feature (&cpu->env,ARM_FEATURE_V8_SHA1 ); -set_feature (&cpu->env,ARM_FEATURE_V8_SHA256 ); -set_feature (&cpu->env,ARM_FEATURE_V8_PMULL ); -set_feature (&cpu->env,ARM_FEATURE_CRC ); -set_feature (&cpu->env,ARM_FEATURE_V8_RDM ); -set_feature (&cpu->env,ARM_FEATURE_V8_DOTPROD ); -set_feature (&cpu->env,ARM_FEATURE_V8_FCMA ); + { +uint32_t t; + + t = cpu->isar.id_isar5; + t =FIELD_DP32 (t,ID_ISAR5 ,AES ,2 ); + t =FIELD_DP32 (t,ID_ISAR5 ,SHA1 ,1 ); + t =FIELD_DP32 (t,ID_ISAR5 ,SHA2 ,1 ); + t =FIELD_DP32 (t,ID_ISAR5 ,CRC32 ,1 ); + t =FIELD_DP32 (t,ID_ISAR5 ,RDM ,1 ); + t =FIELD_DP32 (t,ID_ISAR5 ,VCMA ,1 ); + cpu->isar.id_isar5 = t; + + t = cpu->isar.id_isar6; + t =FIELD_DP32 (t,ID_ISAR6 ,DP ,1 ); + cpu->isar.id_isar6 = t; + }#endif } }
target/arm/cpu64.c +34 -23
89 lines not on this page · raw message
target/arm/translate-a64.c +50 -51
360 lines not on this page · raw message
target/arm/translate.c +17 -19
@@ -5689,7 +5689,7 @@ static const uint8_t neon_2rm_sizes[] = {static int do_v81_helper (DisasContext *s,gen_helper_gvec_3_ptr *fn,int q,int rd,int rn,int rm) { -if (arm_dc_feature (s,ARM_FEATURE_V8_RDM )) { +if (dc_isar_feature (aa32_rdm, s)) {int opr_sz = (1 + q) *8 ; tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), vfp_reg_offset(1, rn),
@@ -5763,7 +5763,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)return 1 ; }if (!u) {/* SHA-1 */ -if (!arm_dc_feature (s,ARM_FEATURE_V8_SHA1 )) { +if (!dc_isar_feature (aa32_sha1, s)) {return 1 ; } ptr1 =vfp_reg_ptr (true, rd);
@@ -5773,7 +5773,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)gen_helper_crypto_sha1_3reg (ptr1, ptr2, ptr3, tmp4);tcg_temp_free_i32 (tmp4); }else {/* SHA-256 */ -if (!arm_dc_feature (s,ARM_FEATURE_V8_SHA256 ) || size ==3 ) { +if (!dc_isar_feature (aa32_sha2, s) || size ==3 ) {return 1 ; } ptr1 =vfp_reg_ptr (true, rd);
@@ -6768,7 +6768,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)if (op ==14 && size ==2 ) {TCGv_i64 tcg_rn, tcg_rm, tcg_rd; -if (!arm_dc_feature (s,ARM_FEATURE_V8_PMULL )) { +if (!dc_isar_feature (aa32_pmull, s)) {return 1 ; } tcg_rn =tcg_temp_new_i64 ();
@@ -7085,7 +7085,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) {NeonGenThreeOpEnvFn *fn; -if (!arm_dc_feature (s,ARM_FEATURE_V8_RDM )) { +if (!dc_isar_feature (aa32_rdm, s)) {return 1 ; }if (u && ((rd | rn) &1 )) {
@@ -7359,8 +7359,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)break ; }case NEON_2RM_AESE :case NEON_2RM_AESMC : -if (!arm_dc_feature (s,ARM_FEATURE_V8_AES ) - || ((rm | rd) &1 )) { +if (!dc_isar_feature (aa32_aes, s) || ((rm | rd) &1 )) {return 1 ; } ptr1 =vfp_reg_ptr (true, rd);
@@ -7381,8 +7380,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)tcg_temp_free_i32 (tmp3);break ;case NEON_2RM_SHA1H : -if (!arm_dc_feature (s,ARM_FEATURE_V8_SHA1 ) - || ((rm | rd) &1 )) { +if (!dc_isar_feature (aa32_sha1, s) || ((rm | rd) &1 )) {return 1 ; } ptr1 =vfp_reg_ptr (true, rd);
@@ -7399,10 +7397,10 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) }/* bit 6 (q): set -> SHA256SU0, cleared -> SHA1SU1 */ if (q) { -if (!arm_dc_feature (s,ARM_FEATURE_V8_SHA256 )) { +if (!dc_isar_feature (aa32_sha2, s)) {return 1 ; } - }else if (!arm_dc_feature (s,ARM_FEATURE_V8_SHA1 )) { + }else if (!dc_isar_feature (aa32_sha1, s)) {return 1 ; } ptr1 =vfp_reg_ptr (true, rd);
@@ -7813,7 +7811,7 @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)/* VCMLA -- 1111 110R R.1S .... .... 1000 ...0 .... */ int size =extract32 (insn,20 ,1 ); data =extract32 (insn,23 ,2 );/* rot */ -if (!arm_dc_feature (s,ARM_FEATURE_V8_FCMA ) +if (!dc_isar_feature (aa32_vcma, s) || (!size && !arm_dc_feature (s,ARM_FEATURE_V8_FP16 ))) {return 1 ; }
@@ -7822,7 +7820,7 @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)/* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */ int size =extract32 (insn,20 ,1 ); data =extract32 (insn,24 ,1 );/* rot */ -if (!arm_dc_feature (s,ARM_FEATURE_V8_FCMA ) +if (!dc_isar_feature (aa32_vcma, s) || (!size && !arm_dc_feature (s,ARM_FEATURE_V8_FP16 ))) {return 1 ; }
@@ -7830,7 +7828,7 @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) }else if ((insn &0xfeb00f00 ) ==0xfc200d00 ) {/* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */ bool u =extract32 (insn,4 ,1 ); -if (!arm_dc_feature (s,ARM_FEATURE_V8_DOTPROD )) { +if (!dc_isar_feature (aa32_dp, s)) {return 1 ; } fn_gvec = u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b;
@@ -7892,7 +7890,7 @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn)int size =extract32 (insn,23 ,1 );int index; -if (!arm_dc_feature (s,ARM_FEATURE_V8_FCMA )) { +if (!dc_isar_feature (aa32_vcma, s)) {return 1 ; }if (size ==0 ) {
@@ -7913,7 +7911,7 @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) }else if ((insn &0xffb00f00 ) ==0xfe200d00 ) {/* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */ int u =extract32 (insn,4 ,1 ); -if (!arm_dc_feature (s,ARM_FEATURE_V8_DOTPROD )) { +if (!dc_isar_feature (aa32_dp, s)) {return 1 ; } fn_gvec = u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b;
@@ -8889,8 +8887,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)* op1 == 3 is UNPREDICTABLE but handle as UNDEFINED. * Bits 8, 10 and 11 should be zero. */ -if (!arm_dc_feature (s,ARM_FEATURE_CRC ) || op1 ==0x3 || - (c &0xd ) !=0 ) { +if (!dc_isar_feature (aa32_crc32, s) || op1 ==0x3 || (c &0xd ) !=0 ) { goto illegal_op; }
@@ -10785,7 +10782,7 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)case 0x28 :case 0x29 :case 0x2a : -if (!arm_dc_feature (s,ARM_FEATURE_CRC )) { +if (!dc_isar_feature (aa32_crc32, s)) { goto illegal_op; }break ;
@@ -12586,6 +12583,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)CPUARMState *env = cs->env_ptr;ARMCPU *cpu =arm_env_get_cpu (env); + dc->isar = &cpu->isar; dc->pc = dc->base.pc_first; dc->condjmp =0 ;
Signature · 1 line
2.17.2
PATCH v4 4/8 target/arm: Convert division from feature bits to isar0 tests
In reply to Richard HendersonBoth arm and thumb2 division are controlled by the same ISAR field, which takes care of the arm implies thumb case. Having M imply thumb2 division was wrong for cortex-m0, which is v6m and does not have thumb2 at all, much less thumb2 division.
--- target/arm/cpu.h | 12 ++++++++++-- linux-user/elfload.c | 4 ++-- target/arm/cpu.c | 10 +--------- target/arm/translate.c | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-)
target/arm/cpu.h +10 -2
@@ -1556,7 +1556,6 @@ enum arm_features {ARM_FEATURE_VFP3 ,ARM_FEATURE_VFP_FP16 ,ARM_FEATURE_NEON , -ARM_FEATURE_THUMB_DIV ,/* divide supported in Thumb encoding */ ARM_FEATURE_M ,/* Microcontroller profile. */ ARM_FEATURE_OMAPCP ,/* OMAP specific CP15 ops handling. */ ARM_FEATURE_THUMB2EE,
@@ -1566,7 +1565,6 @@ enum arm_features {ARM_FEATURE_V5 ,ARM_FEATURE_STRONGARM ,ARM_FEATURE_VAPA ,/* cp15 VA to PA lookups */ -ARM_FEATURE_ARM_DIV ,/* divide supported in ARM encoding */ ARM_FEATURE_VFP4 ,/* VFPv4 (implies that NEON is v2) */ ARM_FEATURE_GENERIC_TIMER , ARM_FEATURE_MVFR, /* Media and VFP Feature Registers 0 and 1 */
@@ -3145,6 +3143,16 @@ extern const uint64_t pred_esz_masks[4];/* * 32-bit feature tests via id registers. */ +static inline bool isar_feature_thumb_div (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar0,ID_ISAR0 ,DIVIDE ) !=0 ; +} + +static inline bool isar_feature_arm_div (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar0,ID_ISAR0 ,DIVIDE ) >1 ; +} +static inline bool isar_feature_aa32_aes (const ARMISARegisters *id) {return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,AES ) !=0 ;
linux-user/elfload.c +2 -2
@@ -471,8 +471,8 @@ static uint32_t get_elf_hwcap(void)GET_FEATURE (ARM_FEATURE_VFP3 , ARM_HWCAP_ARM_VFPv3);GET_FEATURE (ARM_FEATURE_V6K ,ARM_HWCAP_ARM_TLS );GET_FEATURE (ARM_FEATURE_VFP4 , ARM_HWCAP_ARM_VFPv4); -GET_FEATURE (ARM_FEATURE_ARM_DIV ,ARM_HWCAP_ARM_IDIVA ); -GET_FEATURE (ARM_FEATURE_THUMB_DIV ,ARM_HWCAP_ARM_IDIVT ); +GET_FEATURE_ID (arm_div,ARM_HWCAP_ARM_IDIVA ); +GET_FEATURE_ID (thumb_div,ARM_HWCAP_ARM_IDIVT );/* All QEMU's VFPv3 CPUs have 32 registers, see VFP_DREG in translate.c. * Note that the ARM_HWCAP_ARM_VFPv3D16 bit is always the inverse of * ARM_HWCAP_ARM_VFPD32 (and so always clear for QEMU); it is unrelated
target/arm/cpu.c +1 -9
@@ -829,7 +829,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* Presence of EL2 itself is ARM_FEATURE_EL2, and of the * Security Extensions is ARM_FEATURE_EL3. */ -set_feature (env,ARM_FEATURE_ARM_DIV ); +assert (cpu_isar_feature (arm_div, cpu));set_feature (env,ARM_FEATURE_LPAE );set_feature (env,ARM_FEATURE_V7 ); }
@@ -862,12 +862,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)if (arm_feature (env,ARM_FEATURE_V5 )) {set_feature (env,ARM_FEATURE_V4T ); } -if (arm_feature (env,ARM_FEATURE_M )) { -set_feature (env,ARM_FEATURE_THUMB_DIV ); - } -if (arm_feature (env,ARM_FEATURE_ARM_DIV )) { -set_feature (env,ARM_FEATURE_THUMB_DIV ); - }if (arm_feature (env,ARM_FEATURE_VFP4 )) {set_feature (env,ARM_FEATURE_VFP3 );set_feature (env,ARM_FEATURE_VFP_FP16 );
@@ -1388,8 +1382,6 @@ static void cortex_r5_initfn(Object *obj)ARMCPU *cpu =ARM_CPU (obj);set_feature (&cpu->env,ARM_FEATURE_V7 ); -set_feature (&cpu->env,ARM_FEATURE_THUMB_DIV ); -set_feature (&cpu->env,ARM_FEATURE_ARM_DIV );set_feature (&cpu->env,ARM_FEATURE_V7MP );set_feature (&cpu->env,ARM_FEATURE_PMSA ); cpu->midr =0x411fc153 ;/* r1p3 */
target/arm/translate.c +2 -2
@@ -9755,7 +9755,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)case 1 :case 3 :/* SDIV, UDIV */ -if (!arm_dc_feature (s,ARM_FEATURE_ARM_DIV )) { +if (!dc_isar_feature (arm_div, s)) { goto illegal_op; }if (((insn >>5 ) &7 ) || (rd !=15 )) {
@@ -10963,7 +10963,7 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) tmp2 =load_reg (s, rm);if ((op &0x50 ) ==0x10 ) {/* sdiv, udiv */ -if (!arm_dc_feature (s,ARM_FEATURE_THUMB_DIV )) { +if (!dc_isar_feature (thumb_div, s)) { goto illegal_op; }if (op &0x20 )
Signature · 1 line
2.17.2
PATCH v4 5/8 target/arm: Convert jazelle from feature bit to isar1 test
In reply to Richard HendersonHaving V6 alone imply jazelle was wrong for cortex-m0. Change to an assertion for V6 & !M.
This was harmless, because the only place we tested ARM_FEATURE_JAZELLE was for 'bxj' in disas_arm(), which is unreachable for M-profile cores.
--- target/arm/cpu.h | 6 +++++- target/arm/cpu.c | 17 ++++++++++++++--- target/arm/translate.c | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-)
target/arm/cpu.h +5 -1
@@ -1586,7 +1586,6 @@ enum arm_features {ARM_FEATURE_PMU ,/* has PMU support */ ARM_FEATURE_VBAR ,/* has cp15 VBAR */ ARM_FEATURE_M_SECURITY ,/* M profile Security Extension */ -ARM_FEATURE_JAZELLE ,/* has (trivial) Jazelle implementation */ ARM_FEATURE_SVE ,/* has Scalable Vector Extension */ ARM_FEATURE_V8_FP16 ,/* implements v8.2 half-precision float */ ARM_FEATURE_M_MAIN, /* M profile Main Extension */
@@ -3153,6 +3152,11 @@ static inline bool isar_feature_arm_div(const ARMISARegisters *id)return FIELD_EX32 (id->id_isar0,ID_ISAR0 ,DIVIDE ) >1 ; } +static inline bool isar_feature_jazelle (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar1,ID_ISAR1 ,JAZELLE ) !=0 ; +} +static inline bool isar_feature_aa32_aes (const ARMISARegisters *id) {return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,AES ) !=0 ;
target/arm/cpu.c +14 -3
@@ -854,8 +854,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) }if (arm_feature (env,ARM_FEATURE_V6 )) {set_feature (env,ARM_FEATURE_V5 ); -set_feature (env,ARM_FEATURE_JAZELLE );if (!arm_feature (env,ARM_FEATURE_M )) { +assert (cpu_isar_feature (jazelle, cpu));set_feature (env,ARM_FEATURE_AUXCR ); } }
@@ -1082,11 +1082,16 @@ static void arm926_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_VFP );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_CACHE_TEST_CLEAN ); -set_feature (&cpu->env,ARM_FEATURE_JAZELLE ); cpu->midr =0x41069265 ; cpu->reset_fpsid =0x41011090 ; cpu->ctr =0x1dd20d2 ; cpu->reset_sctlr =0x00090078 ; + +/* +* ARMv5 does not have the ID_ISAR registers, but we can still +* set the field to indicate Jazelle support within QEMU. +*/ + cpu->isar.id_isar1 =FIELD_DP32 (cpu->isar.id_isar1,ID_ISAR1 ,JAZELLE ,1 ); }static void arm946_initfn (Object *obj)
@@ -1112,12 +1117,18 @@ static void arm1026_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_AUXCR );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_CACHE_TEST_CLEAN ); -set_feature (&cpu->env,ARM_FEATURE_JAZELLE ); cpu->midr =0x4106a262 ; cpu->reset_fpsid =0x410110a0 ; cpu->ctr =0x1dd20d2 ; cpu->reset_sctlr =0x00090078 ; cpu->reset_auxcr =1 ; + +/* +* ARMv5 does not have the ID_ISAR registers, but we can still +* set the field to indicate Jazelle support within QEMU. +*/ + cpu->isar.id_isar1 =FIELD_DP32 (cpu->isar.id_isar1,ID_ISAR1 ,JAZELLE ,1 ); + {/* The 1026 had an IFAR at c6,c0,0,1 rather than the ARMv6 c6,c0,0,2 */ ARMCPRegInfo ifar = {
target/arm/translate.c +1 -1
@@ -42,7 +42,7 @@#define ENABLE_ARCH_5 arm_dc_feature(s, ARM_FEATURE_V5)/* currently all emulated v5 cores are also v5TE, so don't bother */ #define ENABLE_ARCH_5TE arm_dc_feature(s, ARM_FEATURE_V5) -#define ENABLE_ARCH_5J arm_dc_feature(s, ARM_FEATURE_JAZELLE) +#define ENABLE_ARCH_5J dc_isar_feature(jazelle, s)#define ENABLE_ARCH_6 arm_dc_feature(s, ARM_FEATURE_V6)#define ENABLE_ARCH_6K arm_dc_feature(s, ARM_FEATURE_V6K)#define ENABLE_ARCH_6T2 arm_dc_feature(s, ARM_FEATURE_THUMB2)
Signature · 1 line
2.17.2
PATCH v4 6/8 target/arm: Convert t32ee from feature bit to isar3 test
In reply to Richard Henderson--- target/arm/cpu.h | 6 +++++- linux-user/elfload.c | 2 +- target/arm/cpu.c | 4 ---- target/arm/helper.c | 2 +- target/arm/machine.c | 3 +-- 5 files changed, 8 insertions(+), 9 deletions(-)
target/arm/cpu.h +5 -1
@@ -1558,7 +1558,6 @@ enum arm_features {ARM_FEATURE_NEON ,ARM_FEATURE_M ,/* Microcontroller profile. */ ARM_FEATURE_OMAPCP ,/* OMAP specific CP15 ops handling. */ -ARM_FEATURE_THUMB2EE ,ARM_FEATURE_V7MP ,/* v7 Multiprocessing Extensions */ ARM_FEATURE_V7VE ,/* v7 Virtualization Extensions (non-EL2 parts) */ ARM_FEATURE_V4T,
@@ -3157,6 +3156,11 @@ static inline bool isar_feature_jazelle(const ARMISARegisters *id)return FIELD_EX32 (id->id_isar1,ID_ISAR1 ,JAZELLE ) !=0 ; } +static inline bool isar_feature_t32ee (const ARMISARegisters *id) +{ +return FIELD_EX32 (id->id_isar3,ID_ISAR3 ,T32EE ) !=0 ; +} +static inline bool isar_feature_aa32_aes (const ARMISARegisters *id) {return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,AES ) !=0 ;
linux-user/elfload.c +1 -1
@@ -466,7 +466,7 @@ static uint32_t get_elf_hwcap(void)GET_FEATURE (ARM_FEATURE_V5 ,ARM_HWCAP_ARM_EDSP );GET_FEATURE (ARM_FEATURE_VFP ,ARM_HWCAP_ARM_VFP );GET_FEATURE (ARM_FEATURE_IWMMXT ,ARM_HWCAP_ARM_IWMMXT ); -GET_FEATURE (ARM_FEATURE_THUMB2EE ,ARM_HWCAP_ARM_THUMBEE ); +GET_FEATURE_ID (t32ee,ARM_HWCAP_ARM_THUMBEE );GET_FEATURE (ARM_FEATURE_NEON ,ARM_HWCAP_ARM_NEON );GET_FEATURE (ARM_FEATURE_VFP3 , ARM_HWCAP_ARM_VFPv3);GET_FEATURE (ARM_FEATURE_V6K ,ARM_HWCAP_ARM_TLS );
target/arm/cpu.c +0 -4
@@ -1440,7 +1440,6 @@ static void cortex_a8_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V7 );set_feature (&cpu->env,ARM_FEATURE_VFP3 );set_feature (&cpu->env,ARM_FEATURE_NEON ); -set_feature (&cpu->env,ARM_FEATURE_THUMB2EE );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_EL3 ); cpu->midr =0x410fc080 ;
@@ -1509,7 +1508,6 @@ static void cortex_a9_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_VFP3 );set_feature (&cpu->env,ARM_FEATURE_VFP_FP16 );set_feature (&cpu->env,ARM_FEATURE_NEON ); -set_feature (&cpu->env,ARM_FEATURE_THUMB2EE );set_feature (&cpu->env,ARM_FEATURE_EL3 );/* Note that A9 supports the MP extensions even for * A9UP and single-core A9MP (which are both different
@@ -1572,7 +1570,6 @@ static void cortex_a7_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V7VE );set_feature (&cpu->env,ARM_FEATURE_VFP4 );set_feature (&cpu->env,ARM_FEATURE_NEON ); -set_feature (&cpu->env,ARM_FEATURE_THUMB2EE );set_feature (&cpu->env,ARM_FEATURE_GENERIC_TIMER );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_CBAR_RO );
@@ -1618,7 +1615,6 @@ static void cortex_a15_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V7VE );set_feature (&cpu->env,ARM_FEATURE_VFP4 );set_feature (&cpu->env,ARM_FEATURE_NEON ); -set_feature (&cpu->env,ARM_FEATURE_THUMB2EE );set_feature (&cpu->env,ARM_FEATURE_GENERIC_TIMER );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_CBAR_RO );
target/arm/helper.c +1 -1
@@ -5359,7 +5359,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)define_arm_cp_regs (cpu, vmsa_pmsa_cp_reginfo);define_arm_cp_regs (cpu, vmsa_cp_reginfo); } -if (arm_feature (env,ARM_FEATURE_THUMB2EE )) { +if (cpu_isar_feature (t32ee, cpu)) {define_arm_cp_regs (cpu, t2ee_cp_reginfo); }if (arm_feature (env,ARM_FEATURE_GENERIC_TIMER )) {
target/arm/machine.c +1 -2
@@ -301,9 +301,8 @@ static const VMStateDescription vmstate_m = {static bool thumb2ee_needed (void *opaque) {ARMCPU *cpu = opaque; -CPUARMState *env = &cpu->env; -return arm_feature (env,ARM_FEATURE_THUMB2EE ); +return cpu_isar_feature (t32ee, cpu); }static const VMStateDescription vmstate_thumb2ee = {
Signature · 1 line
2.17.2
PATCH v4 7/8 target/arm: Convert sve from feature bit to aa64pfr0 test
In reply to Richard Henderson--- target/arm/cpu.h | 16 +++++++++++++++- linux-user/aarch64/signal.c | 4 ++-- linux-user/elfload.c | 2 +- linux-user/syscall.c | 10 ++++++---- target/arm/cpu64.c | 5 ++++- target/arm/helper.c | 9 ++++++--- target/arm/machine.c | 3 +-- target/arm/translate-a64.c | 4 ++-- 8 files changed, 37 insertions(+), 16 deletions(-)
target/arm/cpu.h +15 -1
@@ -1537,6 +1537,16 @@ FIELD(ID_AA64ISAR1, FRINTTS, 32, 4) FIELD(ID_AA64ISAR1, SB, 36, 4) FIELD(ID_AA64ISAR1, SPECRES, 40, 4) +FIELD(ID_AA64PFR0, EL0, 0, 4) +FIELD(ID_AA64PFR0, EL1, 4, 4) +FIELD(ID_AA64PFR0, EL2, 8, 4) +FIELD(ID_AA64PFR0, EL3, 12, 4) +FIELD(ID_AA64PFR0, FP, 16, 4) +FIELD(ID_AA64PFR0, ADVSIMD, 20, 4) +FIELD(ID_AA64PFR0, GIC, 24, 4) +FIELD(ID_AA64PFR0, RAS, 28, 4) +FIELD(ID_AA64PFR0, SVE, 32, 4) +QEMU_BUILD_BUG_ON (ARRAY_SIZE (((ARMCPU *)0 )->ccsidr) <=R_V7M_CSSELR_INDEX_MASK );/* If adding a feature bit which corresponds to a Linux ELF
@@ -1585,7 +1595,6 @@ enum arm_features {ARM_FEATURE_PMU ,/* has PMU support */ ARM_FEATURE_VBAR ,/* has cp15 VBAR */ ARM_FEATURE_M_SECURITY ,/* M profile Security Extension */ -ARM_FEATURE_SVE ,/* has Scalable Vector Extension */ ARM_FEATURE_V8_FP16 ,/* implements v8.2 half-precision float */ ARM_FEATURE_M_MAIN, /* M profile Main Extension */ };
@@ -3269,6 +3278,11 @@ static inline bool isar_feature_aa64_fcma(const ARMISARegisters *id)return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,FCMA ) !=0 ; } +static inline bool isar_feature_aa64_sve (const ARMISARegisters *id) +{ +return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,SVE ) !=0 ; +} +/* * Forward to the above feature tests given an ARMCPU pointer. */
linux-user/aarch64/signal.c +2 -2
@@ -314,7 +314,7 @@ static int target_restore_sigframe(CPUARMState *env,break ;case TARGET_SVE_MAGIC : -if (arm_feature (env,ARM_FEATURE_SVE )) { +if (cpu_isar_feature (aa64_sve,arm_env_get_cpu (env))) { vq = (env->vfp.zcr_el[1 ] &0xf ) +1 ; sve_size =QEMU_ALIGN_UP (TARGET_SVE_SIG_CONTEXT_SIZE (vq),16 );if (!sve && size == sve_size) {
@@ -433,7 +433,7 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, &layout);/* SVE state needs saving only if it exists. */ -if (arm_feature (env,ARM_FEATURE_SVE )) { +if (cpu_isar_feature (aa64_sve,arm_env_get_cpu (env))) { vq = (env->vfp.zcr_el[1 ] &0xf ) +1 ; sve_size =QEMU_ALIGN_UP (TARGET_SVE_SIG_CONTEXT_SIZE (vq),16 ); sve_ofs =alloc_sigframe_space (sve_size, &layout);
linux-user/elfload.c +1 -1
@@ -593,7 +593,7 @@ static uint32_t get_elf_hwcap(void)GET_FEATURE_ID (aa64_rdm,ARM_HWCAP_A64_ASIMDRDM );GET_FEATURE_ID (aa64_dp,ARM_HWCAP_A64_ASIMDDP );GET_FEATURE_ID (aa64_fcma,ARM_HWCAP_A64_FCMA ); -GET_FEATURE (ARM_FEATURE_SVE ,ARM_HWCAP_A64_SVE ); +GET_FEATURE_ID (aa64_sve,ARM_HWCAP_A64_SVE );#undef GET_FEATURE#undef GET_FEATURE_ID
linux-user/syscall.c +6 -4
@@ -9356,7 +9356,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,* even though the current architectural maximum is VQ=16. */ ret = -TARGET_EINVAL ; -if (arm_feature (cpu_env,ARM_FEATURE_SVE ) +if (cpu_isar_feature (aa64_sve,arm_env_get_cpu (cpu_env)) && arg2 >=0 && arg2 <=512 *16 && !(arg2 &15 )) {CPUARMState *env = cpu_env;ARMCPU *cpu =arm_env_get_cpu (env);
@@ -9375,9 +9375,11 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,return ret;case TARGET_PR_SVE_GET_VL : ret = -TARGET_EINVAL ; -if (arm_feature (cpu_env,ARM_FEATURE_SVE )) { -CPUARMState *env = cpu_env; - ret = ((env->vfp.zcr_el[1 ] &0xf ) +1 ) *16 ; + { +ARMCPU *cpu =arm_env_get_cpu (cpu_env); +if (cpu_isar_feature (aa64_sve, cpu)) { + ret = ((cpu->env.vfp.zcr_el[1 ] &0xf ) +1 ) *16 ; + } }return ret;#endif /* AARCH64 */
target/arm/cpu64.c +4 -1
@@ -318,6 +318,10 @@ static void aarch64_max_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64ISAR1 ,FCMA ,1 ); cpu->isar.id_aa64isar1 = t; + t = cpu->isar.id_aa64pfr0; + t =FIELD_DP64 (t,ID_AA64PFR0 ,SVE ,1 ); + cpu->isar.id_aa64pfr0 = t; +/* Replicate the same data to the 32-bit id registers. */ u = cpu->isar.id_isar5; u =FIELD_DP32 (u,ID_ISAR5 ,AES ,2 );/* AES + PMULL */
@@ -340,7 +344,6 @@ static void aarch64_max_initfn(Object *obj)* present in either. */ set_feature (&cpu->env,ARM_FEATURE_V8_FP16 ); -set_feature (&cpu->env,ARM_FEATURE_SVE );/* For usermode -cpu max we can use a larger and more efficient DCZ * blocksize since we don't have to follow what the hardware does. */
target/arm/helper.c +6 -3
@@ -5618,7 +5618,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)define_one_arm_cp_reg (cpu, &sctlr); } -if (arm_feature (env,ARM_FEATURE_SVE )) { +if (cpu_isar_feature (aa64_sve, cpu)) {define_one_arm_cp_reg (cpu, &zcr_el1_reginfo);if (arm_feature (env,ARM_FEATURE_EL2 )) {define_one_arm_cp_reg (cpu, &zcr_el2_reginfo);
@@ -12671,13 +12671,15 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,uint32_t flags;if (is_a64 (env)) { +ARMCPU *cpu =arm_env_get_cpu (env); + *pc = env->pc; flags =ARM_TBFLAG_AARCH64_STATE_MASK ;/* Get control bits for tagged addresses */ flags |= (arm_regime_tbi0 (env, mmu_idx) <<ARM_TBFLAG_TBI0_SHIFT ); flags |= (arm_regime_tbi1 (env, mmu_idx) <<ARM_TBFLAG_TBI1_SHIFT ); -if (arm_feature (env,ARM_FEATURE_SVE )) { +if (cpu_isar_feature (aa64_sve, cpu)) {int sve_el =sve_exception_el (env, current_el);uint32_t zcr_len;
@@ -12801,11 +12803,12 @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq)void aarch64_sve_change_el (CPUARMState *env,int old_el,int new_el,bool el0_a64) { +ARMCPU *cpu =arm_env_get_cpu (env);int old_len, new_len;bool old_a64, new_a64;/* Nothing to do if no SVE. */ -if (!arm_feature (env,ARM_FEATURE_SVE )) { +if (!cpu_isar_feature (aa64_sve, cpu)) {return ; }
target/arm/machine.c +1 -2
@@ -131,9 +131,8 @@ static const VMStateDescription vmstate_iwmmxt = {static bool sve_needed (void *opaque) {ARMCPU *cpu = opaque; -CPUARMState *env = &cpu->env; -return arm_feature (env,ARM_FEATURE_SVE ); +return cpu_isar_feature (aa64_sve, cpu); }/* The first two words of each Zreg is stored in VFP state. */
target/arm/translate-a64.c +2 -2
@@ -173,7 +173,7 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,cpu_fprintf (f," FPCR=%08x FPSR=%08x\n" ,vfp_get_fpcr (env),vfp_get_fpsr (env)); -if (arm_feature (env,ARM_FEATURE_SVE ) &&sve_exception_el (env, el) ==0 ) { +if (cpu_isar_feature (aa64_sve, cpu) &&sve_exception_el (env, el) ==0 ) {int j, zcr_len =sve_zcr_len_for_el (env, el);for (i =0 ; i <=FFR_PRED_NUM ; i++) {
@@ -13790,7 +13790,7 @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s)unallocated_encoding (s);break ;case 0x2 : -if (!arm_dc_feature (s,ARM_FEATURE_SVE ) || !disas_sve (s, insn)) { +if (!dc_isar_feature (aa64_sve, s) || !disas_sve (s, insn)) {unallocated_encoding (s); }break ;
Signature · 1 line
2.17.2
PATCH v4 8/8 target/arm: Convert v8.2-fp16 from feature bit to aa64pfr0 test
In reply to Richard Henderson--- target/arm/cpu.h | 17 +++++++++++++++- linux-user/elfload.c | 6 +----- target/arm/cpu64.c | 16 ++++++++------- target/arm/helper.c | 2 +- target/arm/translate-a64.c | 40 +++++++++++++++++++------------------- target/arm/translate.c | 6 +++--- 6 files changed, 50 insertions(+), 37 deletions(-)
target/arm/cpu.h +16 -1
@@ -1595,7 +1595,6 @@ enum arm_features {ARM_FEATURE_PMU ,/* has PMU support */ ARM_FEATURE_VBAR ,/* has cp15 VBAR */ ARM_FEATURE_M_SECURITY ,/* M profile Security Extension */ -ARM_FEATURE_V8_FP16 ,/* implements v8.2 half-precision float */ ARM_FEATURE_M_MAIN, /* M profile Main Extension */ };
@@ -3210,6 +3209,16 @@ static inline bool isar_feature_aa32_dp(const ARMISARegisters *id)return FIELD_EX32 (id->id_isar6,ID_ISAR6 ,DP ) !=0 ; } +static inline bool isar_feature_aa32_fp16_arith (const ARMISARegisters *id) +{ +/* +* This is a placeholder for use by VCMA until the rest of +* the ARMv8.2-FP16 extension is implemented for aa32 mode. +* At which point we can properly set and check MVFR1.FPHP. +*/ +return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,FP ) ==1 ; +} +/* * 64-bit feature tests via id registers. */
@@ -3278,6 +3287,12 @@ static inline bool isar_feature_aa64_fcma(const ARMISARegisters *id)return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,FCMA ) !=0 ; } +static inline bool isar_feature_aa64_fp16 (const ARMISARegisters *id) +{ +/* We always set the AdvSIMD and FP fields identically wrt FP16. */ +return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,FP ) ==1 ; +} +static inline bool isar_feature_aa64_sve (const ARMISARegisters *id) {return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,SVE ) !=0 ;
linux-user/elfload.c +1 -5
@@ -573,8 +573,6 @@ static uint32_t get_elf_hwcap(void) hwcaps |=ARM_HWCAP_A64_ASIMD ;/* probe for the extra features */ -#define GET_FEATURE (feat, hwcap) \ - do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0)#define GET_FEATURE_ID (feat, hwcap) \ do { if (cpu_isar_feature(feat, cpu)) { hwcaps |= hwcap; } } while (0)
@@ -587,15 +585,13 @@ static uint32_t get_elf_hwcap(void)GET_FEATURE_ID (aa64_sha3,ARM_HWCAP_A64_SHA3 );GET_FEATURE_ID (aa64_sm3,ARM_HWCAP_A64_SM3 );GET_FEATURE_ID (aa64_sm4,ARM_HWCAP_A64_SM4 ); -GET_FEATURE (ARM_FEATURE_V8_FP16 , -ARM_HWCAP_A64_FPHP |ARM_HWCAP_A64_ASIMDHP ); +GET_FEATURE_ID (aa64_fp16,ARM_HWCAP_A64_FPHP |ARM_HWCAP_A64_ASIMDHP );GET_FEATURE_ID (aa64_atomics,ARM_HWCAP_A64_ATOMICS );GET_FEATURE_ID (aa64_rdm,ARM_HWCAP_A64_ASIMDRDM );GET_FEATURE_ID (aa64_dp,ARM_HWCAP_A64_ASIMDDP );GET_FEATURE_ID (aa64_fcma,ARM_HWCAP_A64_FCMA );GET_FEATURE_ID (aa64_sve,ARM_HWCAP_A64_SVE ); -#undef GET_FEATURE#undef GET_FEATURE_IDreturn hwcaps;
target/arm/cpu64.c +9 -7
@@ -320,6 +320,8 @@ static void aarch64_max_initfn(Object *obj) t = cpu->isar.id_aa64pfr0; t =FIELD_DP64 (t,ID_AA64PFR0 ,SVE ,1 ); + t =FIELD_DP64 (t,ID_AA64PFR0 ,FP ,1 ); + t =FIELD_DP64 (t,ID_AA64PFR0 ,ADVSIMD ,1 ); cpu->isar.id_aa64pfr0 = t;/* Replicate the same data to the 32-bit id registers. */
@@ -336,14 +338,14 @@ static void aarch64_max_initfn(Object *obj) u =FIELD_DP32 (u,ID_ISAR6 ,DP ,1 ); cpu->isar.id_isar6 = u; -#ifdef CONFIG_USER_ONLY -/* We don't set these in system emulation mode for the moment, -* since we don't correctly set the ID registers to advertise them, -* and in some cases they're only available in AArch64 and not AArch32, -* whereas the architecture requires them to be present in both if -* present in either. +/* +* FIXME: We do not yet support ARMv8.2-fp16 for AArch32 yet, +* so do not set MVFR1.FPHP. Strictly speaking this is not legal, +* but it is also not legal to enable SVE without support for FP16, +* and enabling SVE in system mode is more useful in the short term. */ -set_feature (&cpu->env,ARM_FEATURE_V8_FP16 ); + +#ifdef CONFIG_USER_ONLY /* For usermode -cpu max we can use a larger and more efficient DCZ * blocksize since we don't have to follow what the hardware does. */
target/arm/helper.c +1 -1
@@ -11612,7 +11612,7 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)uint32_t changed;/* When ARMv8.2-FP16 is not supported, FZ16 is RES0. */ -if (!arm_feature (env,ARM_FEATURE_V8_FP16 )) { +if (!cpu_isar_feature (aa64_fp16,arm_env_get_cpu (env))) { val &= ~FPCR_FZ16 ; }
target/arm/translate-a64.c +20 -20
@@ -4805,7 +4805,7 @@ static void disas_fp_compare(DisasContext *s, uint32_t insn)break ;case 3 : size =MO_16 ; -if (arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (dc_isar_feature (aa64_fp16, s)) {break ; }/* fallthru */
@@ -4856,7 +4856,7 @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)break ;case 3 : size =MO_16 ; -if (arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (dc_isar_feature (aa64_fp16, s)) {break ; }/* fallthru */
@@ -4922,7 +4922,7 @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)break ;case 3 : sz =MO_16 ; -if (arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (dc_isar_feature (aa64_fp16, s)) {break ; }/* fallthru */
@@ -5255,7 +5255,7 @@ static void disas_fp_1src(DisasContext *s, uint32_t insn)handle_fp_1src_double (s, opcode, rd, rn);break ;case 3 : -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s);return ; }
@@ -5470,7 +5470,7 @@ static void disas_fp_2src(DisasContext *s, uint32_t insn)handle_fp_2src_double (s, opcode, rd, rn, rm);break ;case 3 : -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s);return ; }
@@ -5628,7 +5628,7 @@ static void disas_fp_3src(DisasContext *s, uint32_t insn)handle_fp_3src_double (s, o0, o1, rd, rn, rm, ra);break ;case 3 : -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s);return ; }
@@ -5698,7 +5698,7 @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)break ;case 3 : sz =MO_16 ; -if (arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (dc_isar_feature (aa64_fp16, s)) {break ; }/* fallthru */
@@ -5923,7 +5923,7 @@ static void disas_fp_fixed_conv(DisasContext *s, uint32_t insn)case 1 :/* float64 */ break ;case 3 :/* float16 */ -if (arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (dc_isar_feature (aa64_fp16, s)) {break ; }/* fallthru */
@@ -6053,7 +6053,7 @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)break ;case 0x6 :/* 16-bit float, 32-bit int */ case 0xe :/* 16-bit float, 64-bit int */ -if (arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (dc_isar_feature (aa64_fp16, s)) {break ; }/* fallthru */
@@ -6080,7 +6080,7 @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)case 1 :/* float64 */ break ;case 3 :/* float16 */ -if (arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (dc_isar_feature (aa64_fp16, s)) {break ; }/* fallthru */
@@ -6517,7 +6517,7 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn)*/ is_min =extract32 (size,1 ,1 ); is_fp = true; -if (!is_u &&arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!is_u &&dc_isar_feature (aa64_fp16, s)) { size =1 ; }else if (!is_u || !is_q ||extract32 (size,0 ,1 )) {unallocated_encoding (s);
@@ -6913,7 +6913,7 @@ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn)if (o2 !=0 || ((cmode ==0xf ) && is_neg && !is_q)) {/* Check for FMOV (vector, immediate) - half-precision */ -if (!(arm_dc_feature (s,ARM_FEATURE_V8_FP16 ) && o2 && cmode ==0xf )) { +if (!(dc_isar_feature (aa64_fp16, s) && o2 && cmode ==0xf )) {unallocated_encoding (s);return ; }
@@ -7080,7 +7080,7 @@ static void disas_simd_scalar_pairwise(DisasContext *s, uint32_t insn)case 0x2f :/* FMINP */ /* FP op, size[0] is 32 or 64 bit*/ if (!u) { -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s);return ; }else {
@@ -7725,7 +7725,7 @@ static void handle_simd_shift_intfp_conv(DisasContext *s, bool is_scalar, size =MO_32 ; }else if (immh &2 ) { size =MO_16 ; -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s);return ; }
@@ -7770,7 +7770,7 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, size =MO_32 ; }else if (immh &0x2 ) { size =MO_16 ; -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s);return ; }
@@ -8534,7 +8534,7 @@ static void disas_simd_scalar_three_reg_same_fp16(DisasContext *s,return ; } -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s); }
@@ -11215,7 +11215,7 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn)TCGv_ptr fpst;bool pairwise = false; -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s);return ; }
@@ -11430,7 +11430,7 @@ static void disas_simd_three_reg_same_extra(DisasContext *s, uint32_t insn)case 0x1c :/* FCADD, #90 */ case 0x1e :/* FCADD, #270 */ if (size ==0 - || (size ==1 && !arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) + || (size ==1 && !dc_isar_feature (aa64_fp16, s)) || (size ==3 && !is_q)) {unallocated_encoding (s);return ;
@@ -12310,7 +12310,7 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn)bool need_fpst = true;int rmode; -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s);return ; }
@@ -12727,7 +12727,7 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) }break ; } -if (is_fp16 && !arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (is_fp16 && !dc_isar_feature (aa64_fp16, s)) {unallocated_encoding (s);return ; }
target/arm/translate.c +3 -3
@@ -7812,7 +7812,7 @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)int size =extract32 (insn,20 ,1 ); data =extract32 (insn,23 ,2 );/* rot */ if (!dc_isar_feature (aa32_vcma, s) - || (!size && !arm_dc_feature (s,ARM_FEATURE_V8_FP16 ))) { + || (!size && !dc_isar_feature (aa32_fp16_arith, s))) {return 1 ; } fn_gvec_ptr = size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah;
@@ -7821,7 +7821,7 @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)int size =extract32 (insn,20 ,1 ); data =extract32 (insn,24 ,1 );/* rot */ if (!dc_isar_feature (aa32_vcma, s) - || (!size && !arm_dc_feature (s,ARM_FEATURE_V8_FP16 ))) { + || (!size && !dc_isar_feature (aa32_fp16_arith, s))) {return 1 ; } fn_gvec_ptr = size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh;
@@ -7894,7 +7894,7 @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn)return 1 ; }if (size ==0 ) { -if (!arm_dc_feature (s,ARM_FEATURE_V8_FP16 )) { +if (!dc_isar_feature (aa32_fp16_arith, s)) {return 1 ; }/* For fp16, rm is just Vm, and index is M. */
Signature · 1 line
2.17.2
Peter Maydell
AppliedQuoted 8 lines · Richard Henderson
This edition moves some of the system registers into a substructure, which is then shared with "normal" runtime and the translators. This is seen as a better solution than letting the entire translator have access to the main ARMCPU structure.
Also after rebasing on mainline, there was a new cortex-m33 failure caused by v8m implying v7ve implying
arm_div.
Applied to target-arm.next, thanks.
-- PMM