mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
target/arm: Define the FEAT_FGT registers
Define the system registers which are provided by the FEAT_FGT fine-grained trap architectural feature: HFGRTR_EL2, HFGWTR_EL2, HDFGRTR_EL2, HDFGWTR_EL2, HFGITR_EL2 All these registers are a set of bit fields, where each bit is set for a trap and clear to not trap on a particular system register access. The R and W register pairs are for system registers, allowing trapping to be done separately for reads and writes; the I register is for system instructions where trapping is on instruction execution. The data storage in the CPU state struct is arranged as a set of arrays rather than separate fields so that when we're looking up the bits for a system register access we can just index into the array rather than having to use a switch to select a named struct member. The later FEAT_FGT2 will add extra elements to these arrays. The field definitions for the new registers are in cpregs.h because in practice the code that needs them is code that also needs the cpregs information; cpu.h is included in a lot more files. We're also going to add some FGT-specific definitions to cpregs.h in the next commit. We do not implement HAFGRTR_EL2, because we don't implement FEAT_AMUv1. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Fuad Tabba <tabba@google.com> Message-id: 20230130182459.3309057-9-peter.maydell@linaro.org Message-id: 20230127175507.2895013-9-peter.maydell@linaro.org
This commit is contained in:
parent
034bb45ac1
commit
15126d9ce2
3 changed files with 340 additions and 0 deletions
|
@ -1869,6 +1869,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
|
|||
if (cpu_isar_feature(aa64_hcx, cpu)) {
|
||||
valid_mask |= SCR_HXEN;
|
||||
}
|
||||
if (cpu_isar_feature(aa64_fgt, cpu)) {
|
||||
valid_mask |= SCR_FGTEN;
|
||||
}
|
||||
} else {
|
||||
valid_mask &= ~(SCR_RW | SCR_ST);
|
||||
if (cpu_isar_feature(aa32_ras, cpu)) {
|
||||
|
@ -7546,6 +7549,39 @@ static const ARMCPRegInfo scxtnum_reginfo[] = {
|
|||
.access = PL3_RW,
|
||||
.fieldoffset = offsetof(CPUARMState, scxtnum_el[3]) },
|
||||
};
|
||||
|
||||
static CPAccessResult access_fgt(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
{
|
||||
if (arm_current_el(env) == 2 &&
|
||||
arm_feature(env, ARM_FEATURE_EL3) && !(env->cp15.scr_el3 & SCR_FGTEN)) {
|
||||
return CP_ACCESS_TRAP_EL3;
|
||||
}
|
||||
return CP_ACCESS_OK;
|
||||
}
|
||||
|
||||
static const ARMCPRegInfo fgt_reginfo[] = {
|
||||
{ .name = "HFGRTR_EL2", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 4,
|
||||
.access = PL2_RW, .accessfn = access_fgt,
|
||||
.fieldoffset = offsetof(CPUARMState, cp15.fgt_read[FGTREG_HFGRTR]) },
|
||||
{ .name = "HFGWTR_EL2", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 5,
|
||||
.access = PL2_RW, .accessfn = access_fgt,
|
||||
.fieldoffset = offsetof(CPUARMState, cp15.fgt_write[FGTREG_HFGWTR]) },
|
||||
{ .name = "HDFGRTR_EL2", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 4, .crn = 3, .crm = 1, .opc2 = 4,
|
||||
.access = PL2_RW, .accessfn = access_fgt,
|
||||
.fieldoffset = offsetof(CPUARMState, cp15.fgt_read[FGTREG_HDFGRTR]) },
|
||||
{ .name = "HDFGWTR_EL2", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 4, .crn = 3, .crm = 1, .opc2 = 5,
|
||||
.access = PL2_RW, .accessfn = access_fgt,
|
||||
.fieldoffset = offsetof(CPUARMState, cp15.fgt_write[FGTREG_HDFGWTR]) },
|
||||
{ .name = "HFGITR_EL2", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 6,
|
||||
.access = PL2_RW, .accessfn = access_fgt,
|
||||
.fieldoffset = offsetof(CPUARMState, cp15.fgt_exec[FGTREG_HFGITR]) },
|
||||
};
|
||||
#endif /* TARGET_AARCH64 */
|
||||
|
||||
static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
|
@ -8933,6 +8969,10 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
|||
if (cpu_isar_feature(aa64_scxtnum, cpu)) {
|
||||
define_arm_cp_regs(cpu, scxtnum_reginfo);
|
||||
}
|
||||
|
||||
if (cpu_isar_feature(aa64_fgt, cpu)) {
|
||||
define_arm_cp_regs(cpu, fgt_reginfo);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cpu_isar_feature(any_predinv, cpu)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue