mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-24 02:55:43 +00:00
target/arm: Define an aa32_pmu_8_1 isar feature test function
Instead of open-coding a check on the ID_DFR0 PerfMon ID register field, create a standardly-named isar_feature for "does AArch32 have a v8.1 PMUv3" and use it. This entails moving the id_dfr0 field into the ARMISARegisters struct. Backports commit a617953855b65a602d36364b9643f7e5bc31288e from qemu
This commit is contained in:
parent
fd537585d7
commit
e64143966a
|
@ -943,7 +943,7 @@ static int arm_cpu_realizefn(struct uc_struct *uc, DeviceState *dev, Error **err
|
||||||
arm_register_el_change_hook(cpu, &pmu_post_el_change, 0);
|
arm_register_el_change_hook(cpu, &pmu_post_el_change, 0);
|
||||||
} else {
|
} else {
|
||||||
cpu->id_aa64dfr0 = FIELD_DP64(cpu->id_aa64dfr0, ID_AA64DFR0, PMUVER, 0);
|
cpu->id_aa64dfr0 = FIELD_DP64(cpu->id_aa64dfr0, ID_AA64DFR0, PMUVER, 0);
|
||||||
cpu->id_dfr0 = FIELD_DP32(cpu->id_dfr0, ID_DFR0, PERFMON, 0);
|
cpu->isar.id_dfr0 = FIELD_DP32(cpu->isar.id_dfr0, ID_DFR0, PERFMON, 0);
|
||||||
cpu->pmceid0 = 0;
|
cpu->pmceid0 = 0;
|
||||||
cpu->pmceid1 = 0;
|
cpu->pmceid1 = 0;
|
||||||
}
|
}
|
||||||
|
@ -1180,7 +1180,7 @@ static void arm1136_r2_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00050078;
|
cpu->reset_sctlr = 0x00050078;
|
||||||
cpu->id_pfr0 = 0x111;
|
cpu->id_pfr0 = 0x111;
|
||||||
cpu->id_pfr1 = 0x1;
|
cpu->id_pfr1 = 0x1;
|
||||||
cpu->id_dfr0 = 0x2;
|
cpu->isar.id_dfr0 = 0x2;
|
||||||
cpu->id_afr0 = 0x3;
|
cpu->id_afr0 = 0x3;
|
||||||
cpu->id_mmfr0 = 0x01130003;
|
cpu->id_mmfr0 = 0x01130003;
|
||||||
cpu->id_mmfr1 = 0x10030302;
|
cpu->id_mmfr1 = 0x10030302;
|
||||||
|
@ -1212,7 +1212,7 @@ static void arm1136_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00050078;
|
cpu->reset_sctlr = 0x00050078;
|
||||||
cpu->id_pfr0 = 0x111;
|
cpu->id_pfr0 = 0x111;
|
||||||
cpu->id_pfr1 = 0x1;
|
cpu->id_pfr1 = 0x1;
|
||||||
cpu->id_dfr0 = 0x2;
|
cpu->isar.id_dfr0 = 0x2;
|
||||||
cpu->id_afr0 = 0x3;
|
cpu->id_afr0 = 0x3;
|
||||||
cpu->id_mmfr0 = 0x01130003;
|
cpu->id_mmfr0 = 0x01130003;
|
||||||
cpu->id_mmfr1 = 0x10030302;
|
cpu->id_mmfr1 = 0x10030302;
|
||||||
|
@ -1245,7 +1245,7 @@ static void arm1176_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00050078;
|
cpu->reset_sctlr = 0x00050078;
|
||||||
cpu->id_pfr0 = 0x111;
|
cpu->id_pfr0 = 0x111;
|
||||||
cpu->id_pfr1 = 0x11;
|
cpu->id_pfr1 = 0x11;
|
||||||
cpu->id_dfr0 = 0x33;
|
cpu->isar.id_dfr0 = 0x33;
|
||||||
cpu->id_afr0 = 0;
|
cpu->id_afr0 = 0;
|
||||||
cpu->id_mmfr0 = 0x01130003;
|
cpu->id_mmfr0 = 0x01130003;
|
||||||
cpu->id_mmfr1 = 0x10030302;
|
cpu->id_mmfr1 = 0x10030302;
|
||||||
|
@ -1275,7 +1275,7 @@ static void arm11mpcore_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->ctr = 0x1d192992; /* 32K icache 32K dcache */
|
cpu->ctr = 0x1d192992; /* 32K icache 32K dcache */
|
||||||
cpu->id_pfr0 = 0x111;
|
cpu->id_pfr0 = 0x111;
|
||||||
cpu->id_pfr1 = 0x1;
|
cpu->id_pfr1 = 0x1;
|
||||||
cpu->id_dfr0 = 0;
|
cpu->isar.id_dfr0 = 0;
|
||||||
cpu->id_afr0 = 0x2;
|
cpu->id_afr0 = 0x2;
|
||||||
cpu->id_mmfr0 = 0x01100103;
|
cpu->id_mmfr0 = 0x01100103;
|
||||||
cpu->id_mmfr1 = 0x10020302;
|
cpu->id_mmfr1 = 0x10020302;
|
||||||
|
@ -1307,7 +1307,7 @@ static void cortex_m3_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->pmsav7_dregion = 8;
|
cpu->pmsav7_dregion = 8;
|
||||||
cpu->id_pfr0 = 0x00000030;
|
cpu->id_pfr0 = 0x00000030;
|
||||||
cpu->id_pfr1 = 0x00000200;
|
cpu->id_pfr1 = 0x00000200;
|
||||||
cpu->id_dfr0 = 0x00100000;
|
cpu->isar.id_dfr0 = 0x00100000;
|
||||||
cpu->id_afr0 = 0x00000000;
|
cpu->id_afr0 = 0x00000000;
|
||||||
cpu->id_mmfr0 = 0x00000030;
|
cpu->id_mmfr0 = 0x00000030;
|
||||||
cpu->id_mmfr1 = 0x00000000;
|
cpu->id_mmfr1 = 0x00000000;
|
||||||
|
@ -1338,7 +1338,7 @@ static void cortex_m4_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->isar.mvfr2 = 0x00000000;
|
cpu->isar.mvfr2 = 0x00000000;
|
||||||
cpu->id_pfr0 = 0x00000030;
|
cpu->id_pfr0 = 0x00000030;
|
||||||
cpu->id_pfr1 = 0x00000200;
|
cpu->id_pfr1 = 0x00000200;
|
||||||
cpu->id_dfr0 = 0x00100000;
|
cpu->isar.id_dfr0 = 0x00100000;
|
||||||
cpu->id_afr0 = 0x00000000;
|
cpu->id_afr0 = 0x00000000;
|
||||||
cpu->id_mmfr0 = 0x00000030;
|
cpu->id_mmfr0 = 0x00000030;
|
||||||
cpu->id_mmfr1 = 0x00000000;
|
cpu->id_mmfr1 = 0x00000000;
|
||||||
|
@ -1369,7 +1369,7 @@ static void cortex_m7_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->isar.mvfr2 = 0x00000040;
|
cpu->isar.mvfr2 = 0x00000040;
|
||||||
cpu->id_pfr0 = 0x00000030;
|
cpu->id_pfr0 = 0x00000030;
|
||||||
cpu->id_pfr1 = 0x00000200;
|
cpu->id_pfr1 = 0x00000200;
|
||||||
cpu->id_dfr0 = 0x00100000;
|
cpu->isar.id_dfr0 = 0x00100000;
|
||||||
cpu->id_afr0 = 0x00000000;
|
cpu->id_afr0 = 0x00000000;
|
||||||
cpu->id_mmfr0 = 0x00100030;
|
cpu->id_mmfr0 = 0x00100030;
|
||||||
cpu->id_mmfr1 = 0x00000000;
|
cpu->id_mmfr1 = 0x00000000;
|
||||||
|
@ -1403,7 +1403,7 @@ static void cortex_m33_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->isar.mvfr2 = 0x00000040;
|
cpu->isar.mvfr2 = 0x00000040;
|
||||||
cpu->id_pfr0 = 0x00000030;
|
cpu->id_pfr0 = 0x00000030;
|
||||||
cpu->id_pfr1 = 0x00000210;
|
cpu->id_pfr1 = 0x00000210;
|
||||||
cpu->id_dfr0 = 0x00200000;
|
cpu->isar.id_dfr0 = 0x00200000;
|
||||||
cpu->id_afr0 = 0x00000000;
|
cpu->id_afr0 = 0x00000000;
|
||||||
cpu->id_mmfr0 = 0x00101F40;
|
cpu->id_mmfr0 = 0x00101F40;
|
||||||
cpu->id_mmfr1 = 0x00000000;
|
cpu->id_mmfr1 = 0x00000000;
|
||||||
|
@ -1453,7 +1453,7 @@ static void cortex_r5_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->midr = 0x411fc153; /* r1p3 */
|
cpu->midr = 0x411fc153; /* r1p3 */
|
||||||
cpu->id_pfr0 = 0x0131;
|
cpu->id_pfr0 = 0x0131;
|
||||||
cpu->id_pfr1 = 0x001;
|
cpu->id_pfr1 = 0x001;
|
||||||
cpu->id_dfr0 = 0x010400;
|
cpu->isar.id_dfr0 = 0x010400;
|
||||||
cpu->id_afr0 = 0x0;
|
cpu->id_afr0 = 0x0;
|
||||||
cpu->id_mmfr0 = 0x0210030;
|
cpu->id_mmfr0 = 0x0210030;
|
||||||
cpu->id_mmfr1 = 0x00000000;
|
cpu->id_mmfr1 = 0x00000000;
|
||||||
|
@ -1508,7 +1508,7 @@ static void cortex_a8_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00c50078;
|
cpu->reset_sctlr = 0x00c50078;
|
||||||
cpu->id_pfr0 = 0x1031;
|
cpu->id_pfr0 = 0x1031;
|
||||||
cpu->id_pfr1 = 0x11;
|
cpu->id_pfr1 = 0x11;
|
||||||
cpu->id_dfr0 = 0x400;
|
cpu->isar.id_dfr0 = 0x400;
|
||||||
cpu->id_afr0 = 0;
|
cpu->id_afr0 = 0;
|
||||||
cpu->id_mmfr0 = 0x31100003;
|
cpu->id_mmfr0 = 0x31100003;
|
||||||
cpu->id_mmfr1 = 0x20000000;
|
cpu->id_mmfr1 = 0x20000000;
|
||||||
|
@ -1581,7 +1581,7 @@ static void cortex_a9_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00c50078;
|
cpu->reset_sctlr = 0x00c50078;
|
||||||
cpu->id_pfr0 = 0x1031;
|
cpu->id_pfr0 = 0x1031;
|
||||||
cpu->id_pfr1 = 0x11;
|
cpu->id_pfr1 = 0x11;
|
||||||
cpu->id_dfr0 = 0x000;
|
cpu->isar.id_dfr0 = 0x000;
|
||||||
cpu->id_afr0 = 0;
|
cpu->id_afr0 = 0;
|
||||||
cpu->id_mmfr0 = 0x00100103;
|
cpu->id_mmfr0 = 0x00100103;
|
||||||
cpu->id_mmfr1 = 0x20000000;
|
cpu->id_mmfr1 = 0x20000000;
|
||||||
|
@ -1644,7 +1644,7 @@ static void cortex_a7_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00c50078;
|
cpu->reset_sctlr = 0x00c50078;
|
||||||
cpu->id_pfr0 = 0x00001131;
|
cpu->id_pfr0 = 0x00001131;
|
||||||
cpu->id_pfr1 = 0x00011011;
|
cpu->id_pfr1 = 0x00011011;
|
||||||
cpu->id_dfr0 = 0x02010555;
|
cpu->isar.id_dfr0 = 0x02010555;
|
||||||
cpu->id_afr0 = 0x00000000;
|
cpu->id_afr0 = 0x00000000;
|
||||||
cpu->id_mmfr0 = 0x10101105;
|
cpu->id_mmfr0 = 0x10101105;
|
||||||
cpu->id_mmfr1 = 0x40000000;
|
cpu->id_mmfr1 = 0x40000000;
|
||||||
|
@ -1690,7 +1690,7 @@ static void cortex_a15_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00c50078;
|
cpu->reset_sctlr = 0x00c50078;
|
||||||
cpu->id_pfr0 = 0x00001131;
|
cpu->id_pfr0 = 0x00001131;
|
||||||
cpu->id_pfr1 = 0x00011011;
|
cpu->id_pfr1 = 0x00011011;
|
||||||
cpu->id_dfr0 = 0x02010555;
|
cpu->isar.id_dfr0 = 0x02010555;
|
||||||
cpu->id_afr0 = 0x00000000;
|
cpu->id_afr0 = 0x00000000;
|
||||||
cpu->id_mmfr0 = 0x10201105;
|
cpu->id_mmfr0 = 0x10201105;
|
||||||
cpu->id_mmfr1 = 0x20000000;
|
cpu->id_mmfr1 = 0x20000000;
|
||||||
|
|
|
@ -832,6 +832,7 @@ struct ARMCPU {
|
||||||
uint32_t mvfr0;
|
uint32_t mvfr0;
|
||||||
uint32_t mvfr1;
|
uint32_t mvfr1;
|
||||||
uint32_t mvfr2;
|
uint32_t mvfr2;
|
||||||
|
uint32_t id_dfr0;
|
||||||
uint64_t id_aa64isar0;
|
uint64_t id_aa64isar0;
|
||||||
uint64_t id_aa64isar1;
|
uint64_t id_aa64isar1;
|
||||||
uint64_t id_aa64pfr0;
|
uint64_t id_aa64pfr0;
|
||||||
|
@ -847,7 +848,6 @@ struct ARMCPU {
|
||||||
uint32_t reset_sctlr;
|
uint32_t reset_sctlr;
|
||||||
uint32_t id_pfr0;
|
uint32_t id_pfr0;
|
||||||
uint32_t id_pfr1;
|
uint32_t id_pfr1;
|
||||||
uint32_t id_dfr0;
|
|
||||||
uint64_t pmceid0;
|
uint64_t pmceid0;
|
||||||
uint64_t pmceid1;
|
uint64_t pmceid1;
|
||||||
uint32_t id_afr0;
|
uint32_t id_afr0;
|
||||||
|
@ -3373,6 +3373,13 @@ static inline bool isar_feature_aa32_ats1e1(const ARMISARegisters *id)
|
||||||
return FIELD_EX64(id->mvfr0, ID_MMFR3, PAN) >= 2;
|
return FIELD_EX64(id->mvfr0, ID_MMFR3, PAN) >= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool isar_feature_aa32_pmu_8_1(const ARMISARegisters *id)
|
||||||
|
{
|
||||||
|
/* 0xf means "non-standard IMPDEF PMU" */
|
||||||
|
return FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) >= 4 &&
|
||||||
|
FIELD_EX32(id->id_dfr0, ID_DFR0, PERFMON) != 0xf;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 64-bit feature tests via id registers.
|
* 64-bit feature tests via id registers.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -116,7 +116,7 @@ static void aarch64_a57_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00c50838;
|
cpu->reset_sctlr = 0x00c50838;
|
||||||
cpu->id_pfr0 = 0x00000131;
|
cpu->id_pfr0 = 0x00000131;
|
||||||
cpu->id_pfr1 = 0x00011011;
|
cpu->id_pfr1 = 0x00011011;
|
||||||
cpu->id_dfr0 = 0x03010066;
|
cpu->isar.id_dfr0 = 0x03010066;
|
||||||
cpu->id_afr0 = 0x00000000;
|
cpu->id_afr0 = 0x00000000;
|
||||||
cpu->id_mmfr0 = 0x10101105;
|
cpu->id_mmfr0 = 0x10101105;
|
||||||
cpu->id_mmfr1 = 0x40000000;
|
cpu->id_mmfr1 = 0x40000000;
|
||||||
|
@ -167,7 +167,7 @@ static void aarch64_a53_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00c50838;
|
cpu->reset_sctlr = 0x00c50838;
|
||||||
cpu->id_pfr0 = 0x00000131;
|
cpu->id_pfr0 = 0x00000131;
|
||||||
cpu->id_pfr1 = 0x00011011;
|
cpu->id_pfr1 = 0x00011011;
|
||||||
cpu->id_dfr0 = 0x03010066;
|
cpu->isar.id_dfr0 = 0x03010066;
|
||||||
cpu->id_afr0 = 0x00000000;
|
cpu->id_afr0 = 0x00000000;
|
||||||
cpu->id_mmfr0 = 0x10101105;
|
cpu->id_mmfr0 = 0x10101105;
|
||||||
cpu->id_mmfr1 = 0x40000000;
|
cpu->id_mmfr1 = 0x40000000;
|
||||||
|
@ -217,7 +217,7 @@ static void aarch64_a72_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->reset_sctlr = 0x00c50838;
|
cpu->reset_sctlr = 0x00c50838;
|
||||||
cpu->id_pfr0 = 0x00000131;
|
cpu->id_pfr0 = 0x00000131;
|
||||||
cpu->id_pfr1 = 0x00011011;
|
cpu->id_pfr1 = 0x00011011;
|
||||||
cpu->id_dfr0 = 0x03010066;
|
cpu->isar.id_dfr0 = 0x03010066;
|
||||||
cpu->id_afr0 = 0x00000000;
|
cpu->id_afr0 = 0x00000000;
|
||||||
cpu->id_mmfr0 = 0x10201105;
|
cpu->id_mmfr0 = 0x10201105;
|
||||||
cpu->id_mmfr1 = 0x40000000;
|
cpu->id_mmfr1 = 0x40000000;
|
||||||
|
|
|
@ -6161,8 +6161,7 @@ static void define_pmu_regs(ARMCPU *cpu)
|
||||||
g_free(pmevtyper_name);
|
g_free(pmevtyper_name);
|
||||||
g_free(pmevtyper_el0_name);
|
g_free(pmevtyper_el0_name);
|
||||||
}
|
}
|
||||||
if (FIELD_EX32(cpu->id_dfr0, ID_DFR0, PERFMON) >= 4 &&
|
if (cpu_isar_feature(aa32_pmu_8_1, cpu)) {
|
||||||
FIELD_EX32(cpu->id_dfr0, ID_DFR0, PERFMON) != 0xf) {
|
|
||||||
ARMCPRegInfo v81_pmu_regs[] = {
|
ARMCPRegInfo v81_pmu_regs[] = {
|
||||||
{ .name = "PMCEID2", .state = ARM_CP_STATE_AA32,
|
{ .name = "PMCEID2", .state = ARM_CP_STATE_AA32,
|
||||||
.cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 4,
|
.cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 4,
|
||||||
|
@ -6641,7 +6640,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2,
|
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2,
|
||||||
.access = PL1_R, .type = ARM_CP_CONST,
|
.access = PL1_R, .type = ARM_CP_CONST,
|
||||||
.accessfn = access_aa32_tid3,
|
.accessfn = access_aa32_tid3,
|
||||||
.resetvalue = cpu->id_dfr0 },
|
.resetvalue = cpu->isar.id_dfr0 },
|
||||||
{ .name = "ID_AFR0", .state = ARM_CP_STATE_BOTH,
|
{ .name = "ID_AFR0", .state = ARM_CP_STATE_BOTH,
|
||||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 3,
|
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 3,
|
||||||
.access = PL1_R, .type = ARM_CP_CONST,
|
.access = PL1_R, .type = ARM_CP_CONST,
|
||||||
|
|
Loading…
Reference in a new issue