target-arm: Implement FPEXC32_EL2 system register
PATCH 1/1 target-arm: Implement FPEXC32_EL2 system register
The AArch64 FPEXC32_EL2 system register is visible at EL2 and EL3, and allows those exception levels to read and write the FPEXC register for a lower exception level that is using AArch32.
---
ARM Trusted Firmware expects this to exist (as does your average hypervisor, I expect).
target-arm/helper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
target-arm/helper.c +16 -0
@@ -2890,6 +2890,17 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,tlb_flush (CPU (cpu),1 ); } +static CPAccessResult fpexc32_access (CPUARMState *env,const ARMCPRegInfo *ri) +{ +if ((env->cp15.cptr_el[2 ] &CPTR_TFP ) &&arm_current_el (env) ==2 ) { +return CP_ACCESS_TRAP_EL2 ; + } +if (env->cp15.cptr_el[3 ] &CPTR_TFP ) { +return CP_ACCESS_TRAP_EL3 ; + } +return CP_ACCESS_OK ; +} +static const ARMCPRegInfo v8_cp_reginfo[] = {/* Minimal set of EL0-visible registers. This will need to be expanded * significantly for system emulation of AArch64 CPUs.
@@ -3150,6 +3161,11 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0, .type = ARM_CP_NO_RAW, .access = PL1_RW, .readfn = spsel_read, .writefn = spsel_write }, + { .name = "FPEXC32_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 3, .opc2 = 0, + .type = ARM_CP_ALIAS, + .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]), + .access = PL2_RW, .accessfn = fpexc32_access }, REGINFO_SENTINEL };
Signature · 1 line
1.9.1
Oops, got the qemu-arm email address wrong...
Quoted 47 lines · Peter Maydell
The AArch64
FPEXC32_EL2system register is visible at EL2 and EL3, and allows those exception levels to read and write the FPEXC register for a lower exception level that is using AArch32.Signed-off-by Peter Maydell <[email protected]>---
ARM Trusted Firmware expects this to exist (as does your average hypervisor, I expect).target-arm/helper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)target-arm/helper.c +16
-1@@ -2890,6 +2890,17 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,tlb_flush (CPU (cpu),1 ); } +static CPAccessResult fpexc32_access (CPUARMState *env,const ARMCPRegInfo *ri) +{ +if ((env->cp15.cptr_el[2 ] &CPTR_TFP ) &&arm_current_el (env) ==2 ) { +return CP_ACCESS_TRAP_EL2 ; + } +if (env->cp15.cptr_el[3 ] &CPTR_TFP ) { +return CP_ACCESS_TRAP_EL3 ; + } +return CP_ACCESS_OK ; +} +static const ARMCPRegInfo v8_cp_reginfo[] = {/* Minimal set of EL0-visible registers. This will need to be expanded * significantly for system emulation of AArch64 CPUs. @@ -3150,6 +3161,11 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0, .type = ARM_CP_NO_RAW, .access = PL1_RW, .readfn = spsel_read, .writefn = spsel_write }, + { .name = "FPEXC32_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 3, .opc2 = 0, + .type = ARM_CP_ALIAS, + .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]), + .access = PL2_RW, .accessfn = fpexc32_access }, REGINFO_SENTINEL }; --
Quoted 2 lines
1.9.1
thanks
-- PMM
Edgar E. Iglesias
Reviewed-byQuoted 1 line · Peter Maydell
Oops, got the qemu-arm email address wrong...
Replied to the wrong email before...
Quoted 54 lines · Peter Maydell
Quoted 47 lines
The AArch64
FPEXC32_EL2system register is visible at EL2 and EL3, and allows those exception levels to read and write the FPEXC register for a lower exception level that is using AArch32.Signed-off-by Peter Maydell <[email protected]>---
ARM Trusted Firmware expects this to exist (as does your average hypervisor, I expect).target-arm/helper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)target-arm/helper.c +16
-1@@ -2890,6 +2890,17 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,tlb_flush (CPU (cpu),1 ); } +static CPAccessResult fpexc32_access (CPUARMState *env,const ARMCPRegInfo *ri) +{ +if ((env->cp15.cptr_el[2 ] &CPTR_TFP ) &&arm_current_el (env) ==2 ) { +return CP_ACCESS_TRAP_EL2 ; + } +if (env->cp15.cptr_el[3 ] &CPTR_TFP ) { +return CP_ACCESS_TRAP_EL3 ; + } +return CP_ACCESS_OK ; +} +static const ARMCPRegInfo v8_cp_reginfo[] = {/* Minimal set of EL0-visible registers. This will need to be expanded * significantly for system emulation of AArch64 CPUs. @@ -3150,6 +3161,11 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0, .type = ARM_CP_NO_RAW, .access = PL1_RW, .readfn = spsel_read, .writefn = spsel_write }, + { .name = "FPEXC32_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 3, .opc2 = 0, + .type = ARM_CP_ALIAS, + .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]), + .access = PL2_RW, .accessfn = fpexc32_access }, REGINFO_SENTINEL }; --Quoted 2 lines
1.9.1
thanks
-- PMM
Sergey Fedorov
Reviewed-byQuoted 8 lines · Peter Maydell
Oops, got the qemu-arm email address wrong...
Quoted 5 lines · Peter Maydell
The AArch64
FPEXC32_EL2system register is visible at EL2 and EL3, and allows those exception levels to read and write the FPEXC register for a lower exception level that is using AArch32.Signed-off-by Peter Maydell <[email protected]>
Quoted 47 lines
Quoted 42 lines
---
ARM Trusted Firmware expects this to exist (as does your average hypervisor, I expect).target-arm/helper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)target-arm/helper.c +16
-1@@ -2890,6 +2890,17 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,tlb_flush (CPU (cpu),1 ); } +static CPAccessResult fpexc32_access (CPUARMState *env,const ARMCPRegInfo *ri) +{ +if ((env->cp15.cptr_el[2 ] &CPTR_TFP ) &&arm_current_el (env) ==2 ) { +return CP_ACCESS_TRAP_EL2 ; + } +if (env->cp15.cptr_el[3 ] &CPTR_TFP ) { +return CP_ACCESS_TRAP_EL3 ; + } +return CP_ACCESS_OK ; +} +static const ARMCPRegInfo v8_cp_reginfo[] = {/* Minimal set of EL0-visible registers. This will need to be expanded * significantly for system emulation of AArch64 CPUs. @@ -3150,6 +3161,11 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0, .type = ARM_CP_NO_RAW, .access = PL1_RW, .readfn = spsel_read, .writefn = spsel_write }, + { .name = "FPEXC32_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 3, .opc2 = 0, + .type = ARM_CP_ALIAS, + .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]), + .access = PL2_RW, .accessfn = fpexc32_access }, REGINFO_SENTINEL }; --Quoted 2 lines
1.9.1
thanks
-- PMM
Quoted 5 lines · Peter Maydell
The AArch64
FPEXC32_EL2system register is visible at EL2 and EL3, and allows those exception levels to read and write the FPEXC register for a lower exception level that is using AArch32.Signed-off-by Peter Maydell <[email protected]>
Quoted 44 lines
---
ARM Trusted Firmware expects this to exist (as does your average hypervisor, I expect).target-arm/helper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)target-arm/helper.c +16
-0@@ -2890,6 +2890,17 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,tlb_flush (CPU (cpu),1 ); } +static CPAccessResult fpexc32_access (CPUARMState *env,const ARMCPRegInfo *ri) +{ +if ((env->cp15.cptr_el[2 ] &CPTR_TFP ) &&arm_current_el (env) ==2 ) { +return CP_ACCESS_TRAP_EL2 ; + } +if (env->cp15.cptr_el[3 ] &CPTR_TFP ) { +return CP_ACCESS_TRAP_EL3 ; + } +return CP_ACCESS_OK ; +} +static const ARMCPRegInfo v8_cp_reginfo[] = {/* Minimal set of EL0-visible registers. This will need to be expanded * significantly for system emulation of AArch64 CPUs. @@ -3150,6 +3161,11 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0, .type = ARM_CP_NO_RAW, .access = PL1_RW, .readfn = spsel_read, .writefn = spsel_write }, + { .name = "FPEXC32_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 3, .opc2 = 0, + .type = ARM_CP_ALIAS, + .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]), + .access = PL2_RW, .accessfn = fpexc32_access }, REGINFO_SENTINEL };Signature · 1 line
1.9.1