|
@@ -975,6 +975,17 @@ static uint64_t pmccntr_read(CPUARMState *env, const ARMCPRegInfo *ri)
|
|
return total_ticks - env->cp15.c15_ccnt;
|
|
return total_ticks - env->cp15.c15_ccnt;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void pmselr_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|
|
|
+ uint64_t value)
|
|
|
|
+{
|
|
|
|
+ /* The value of PMSELR.SEL affects the behavior of PMXEVTYPER and
|
|
|
|
+ * PMXEVCNTR. We allow [0..31] to be written to PMSELR here; in the
|
|
|
|
+ * meanwhile, we check PMSELR.SEL when PMXEVTYPER and PMXEVCNTR are
|
|
|
|
+ * accessed.
|
|
|
|
+ */
|
|
|
|
+ env->cp15.c9_pmselr = value & 0x1f;
|
|
|
|
+}
|
|
|
|
+
|
|
static void pmccntr_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|
static void pmccntr_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|
uint64_t value)
|
|
uint64_t value)
|
|
{
|
|
{
|
|
@@ -1043,7 +1054,25 @@ static void pmovsr_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|
static void pmxevtyper_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|
static void pmxevtyper_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|
uint64_t value)
|
|
uint64_t value)
|
|
{
|
|
{
|
|
- env->cp15.c9_pmxevtyper = value & 0xff;
|
|
|
|
|
|
+ /* Attempts to access PMXEVTYPER are CONSTRAINED UNPREDICTABLE when
|
|
|
|
+ * PMSELR value is equal to or greater than the number of implemented
|
|
|
|
+ * counters, but not equal to 0x1f. We opt to behave as a RAZ/WI.
|
|
|
|
+ */
|
|
|
|
+ if (env->cp15.c9_pmselr == 0x1f) {
|
|
|
|
+ pmccfiltr_write(env, ri, value);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static uint64_t pmxevtyper_read(CPUARMState *env, const ARMCPRegInfo *ri)
|
|
|
|
+{
|
|
|
|
+ /* We opt to behave as a RAZ/WI when attempts to access PMXEVTYPER
|
|
|
|
+ * are CONSTRAINED UNPREDICTABLE. See comments in pmxevtyper_write().
|
|
|
|
+ */
|
|
|
|
+ if (env->cp15.c9_pmselr == 0x1f) {
|
|
|
|
+ return env->cp15.pmccfiltr_el0;
|
|
|
|
+ } else {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
static void pmuserenr_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|
static void pmuserenr_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|
@@ -1194,13 +1223,17 @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
|
|
/* Unimplemented so WI. */
|
|
/* Unimplemented so WI. */
|
|
{ .name = "PMSWINC", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 4,
|
|
{ .name = "PMSWINC", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 4,
|
|
.access = PL0_W, .accessfn = pmreg_access, .type = ARM_CP_NOP },
|
|
.access = PL0_W, .accessfn = pmreg_access, .type = ARM_CP_NOP },
|
|
- /* Since we don't implement any events, writing to PMSELR is UNPREDICTABLE.
|
|
|
|
- * We choose to RAZ/WI.
|
|
|
|
- */
|
|
|
|
- { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5,
|
|
|
|
- .access = PL0_RW, .type = ARM_CP_CONST, .resetvalue = 0,
|
|
|
|
- .accessfn = pmreg_access },
|
|
|
|
#ifndef CONFIG_USER_ONLY
|
|
#ifndef CONFIG_USER_ONLY
|
|
|
|
+ { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5,
|
|
|
|
+ .access = PL0_RW, .type = ARM_CP_ALIAS,
|
|
|
|
+ .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmselr),
|
|
|
|
+ .accessfn = pmreg_access, .writefn = pmselr_write,
|
|
|
|
+ .raw_writefn = raw_write},
|
|
|
|
+ { .name = "PMSELR_EL0", .state = ARM_CP_STATE_AA64,
|
|
|
|
+ .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 5,
|
|
|
|
+ .access = PL0_RW, .accessfn = pmreg_access,
|
|
|
|
+ .fieldoffset = offsetof(CPUARMState, cp15.c9_pmselr),
|
|
|
|
+ .writefn = pmselr_write, .raw_writefn = raw_write, },
|
|
{ .name = "PMCCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 0,
|
|
{ .name = "PMCCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 0,
|
|
.access = PL0_RW, .resetvalue = 0, .type = ARM_CP_IO,
|
|
.access = PL0_RW, .resetvalue = 0, .type = ARM_CP_IO,
|
|
.readfn = pmccntr_read, .writefn = pmccntr_write32,
|
|
.readfn = pmccntr_read, .writefn = pmccntr_write32,
|
|
@@ -1219,10 +1252,12 @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
|
|
.fieldoffset = offsetof(CPUARMState, cp15.pmccfiltr_el0),
|
|
.fieldoffset = offsetof(CPUARMState, cp15.pmccfiltr_el0),
|
|
.resetvalue = 0, },
|
|
.resetvalue = 0, },
|
|
{ .name = "PMXEVTYPER", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 1,
|
|
{ .name = "PMXEVTYPER", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 1,
|
|
- .access = PL0_RW,
|
|
|
|
- .fieldoffset = offsetof(CPUARMState, cp15.c9_pmxevtyper),
|
|
|
|
- .accessfn = pmreg_access, .writefn = pmxevtyper_write,
|
|
|
|
- .raw_writefn = raw_write },
|
|
|
|
|
|
+ .access = PL0_RW, .type = ARM_CP_NO_RAW, .accessfn = pmreg_access,
|
|
|
|
+ .writefn = pmxevtyper_write, .readfn = pmxevtyper_read },
|
|
|
|
+ { .name = "PMXEVTYPER_EL0", .state = ARM_CP_STATE_AA64,
|
|
|
|
+ .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 1,
|
|
|
|
+ .access = PL0_RW, .type = ARM_CP_NO_RAW, .accessfn = pmreg_access,
|
|
|
|
+ .writefn = pmxevtyper_write, .readfn = pmxevtyper_read },
|
|
/* Unimplemented, RAZ/WI. */
|
|
/* Unimplemented, RAZ/WI. */
|
|
{ .name = "PMXEVCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 2,
|
|
{ .name = "PMXEVCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 2,
|
|
.access = PL0_RW, .type = ARM_CP_CONST, .resetvalue = 0,
|
|
.access = PL0_RW, .type = ARM_CP_CONST, .resetvalue = 0,
|
|
@@ -1240,9 +1275,17 @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
|
|
.writefn = pmuserenr_write, .raw_writefn = raw_write },
|
|
.writefn = pmuserenr_write, .raw_writefn = raw_write },
|
|
{ .name = "PMINTENSET", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 1,
|
|
{ .name = "PMINTENSET", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 1,
|
|
.access = PL1_RW, .accessfn = access_tpm,
|
|
.access = PL1_RW, .accessfn = access_tpm,
|
|
- .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
|
|
|
|
|
|
+ .type = ARM_CP_ALIAS,
|
|
|
|
+ .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pminten),
|
|
.resetvalue = 0,
|
|
.resetvalue = 0,
|
|
.writefn = pmintenset_write, .raw_writefn = raw_write },
|
|
.writefn = pmintenset_write, .raw_writefn = raw_write },
|
|
|
|
+ { .name = "PMINTENSET_EL1", .state = ARM_CP_STATE_AA64,
|
|
|
|
+ .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 1,
|
|
|
|
+ .access = PL1_RW, .accessfn = access_tpm,
|
|
|
|
+ .type = ARM_CP_IO,
|
|
|
|
+ .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
|
|
|
|
+ .writefn = pmintenset_write, .raw_writefn = raw_write,
|
|
|
|
+ .resetvalue = 0x0 },
|
|
{ .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2,
|
|
{ .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2,
|
|
.access = PL1_RW, .accessfn = access_tpm, .type = ARM_CP_ALIAS,
|
|
.access = PL1_RW, .accessfn = access_tpm, .type = ARM_CP_ALIAS,
|
|
.fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
|
|
.fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
|
|
@@ -4590,12 +4633,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
|
{ .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64,
|
|
{ .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64,
|
|
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0,
|
|
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0,
|
|
.access = PL1_R, .type = ARM_CP_CONST,
|
|
.access = PL1_R, .type = ARM_CP_CONST,
|
|
- /* We mask out the PMUVer field, because we don't currently
|
|
|
|
- * implement the PMU. Not advertising it prevents the guest
|
|
|
|
- * from trying to use it and getting UNDEFs on registers we
|
|
|
|
- * don't implement.
|
|
|
|
- */
|
|
|
|
- .resetvalue = cpu->id_aa64dfr0 & ~0xf00 },
|
|
|
|
|
|
+ .resetvalue = cpu->id_aa64dfr0 },
|
|
{ .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64,
|
|
{ .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64,
|
|
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1,
|
|
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1,
|
|
.access = PL1_R, .type = ARM_CP_CONST,
|
|
.access = PL1_R, .type = ARM_CP_CONST,
|