mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-24 02:25:32 +00:00
target/arm: Add _aa64_ and _any_ versions of pmu_8_1 isar checks
Add the 64-bit version of the "is this a v8.1 PMUv3?" ID register check function, and the _any_ version that checks for either AArch32 or AArch64 support. We'll use this in a later commit. We don't (yet) do any isar_feature checks on ID_AA64DFR1_EL1, but we move id_aa64dfr1 into the ARMISARegisters struct with id_aa64dfr0, for consistency. Backports commit 2a609df87d9b886fd38a190a754dbc241ff707e8 from qemu
This commit is contained in:
parent
e64143966a
commit
afc28d9b2c
|
@ -942,7 +942,8 @@ static int arm_cpu_realizefn(struct uc_struct *uc, DeviceState *dev, Error **err
|
||||||
arm_register_pre_el_change_hook(cpu, &pmu_pre_el_change, 0);
|
arm_register_pre_el_change_hook(cpu, &pmu_pre_el_change, 0);
|
||||||
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->isar.id_aa64dfr0 =
|
||||||
|
FIELD_DP64(cpu->isar.id_aa64dfr0, ID_AA64DFR0, PMUVER, 0);
|
||||||
cpu->isar.id_dfr0 = FIELD_DP32(cpu->isar.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;
|
||||||
|
|
|
@ -840,6 +840,8 @@ struct ARMCPU {
|
||||||
uint64_t id_aa64mmfr0;
|
uint64_t id_aa64mmfr0;
|
||||||
uint64_t id_aa64mmfr1;
|
uint64_t id_aa64mmfr1;
|
||||||
uint64_t id_aa64mmfr2;
|
uint64_t id_aa64mmfr2;
|
||||||
|
uint64_t id_aa64dfr0;
|
||||||
|
uint64_t id_aa64dfr1;
|
||||||
} isar;
|
} isar;
|
||||||
uint32_t midr;
|
uint32_t midr;
|
||||||
uint32_t revidr;
|
uint32_t revidr;
|
||||||
|
@ -856,8 +858,6 @@ struct ARMCPU {
|
||||||
uint32_t id_mmfr2;
|
uint32_t id_mmfr2;
|
||||||
uint32_t id_mmfr3;
|
uint32_t id_mmfr3;
|
||||||
uint32_t id_mmfr4;
|
uint32_t id_mmfr4;
|
||||||
uint64_t id_aa64dfr0;
|
|
||||||
uint64_t id_aa64dfr1;
|
|
||||||
uint64_t id_aa64afr0;
|
uint64_t id_aa64afr0;
|
||||||
uint64_t id_aa64afr1;
|
uint64_t id_aa64afr1;
|
||||||
uint32_t dbgdidr;
|
uint32_t dbgdidr;
|
||||||
|
@ -3559,6 +3559,12 @@ static inline bool isar_feature_aa64_bti(const ARMISARegisters *id)
|
||||||
return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0;
|
return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, BT) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool isar_feature_aa64_pmu_8_1(const ARMISARegisters *id)
|
||||||
|
{
|
||||||
|
return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 4 &&
|
||||||
|
FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Feature tests for "does this exist in either 32-bit or 64-bit?"
|
* Feature tests for "does this exist in either 32-bit or 64-bit?"
|
||||||
*/
|
*/
|
||||||
|
@ -3572,6 +3578,11 @@ static inline bool isar_feature_any_predinv(const ARMISARegisters *id)
|
||||||
return isar_feature_aa64_predinv(id) || isar_feature_aa32_predinv(id);
|
return isar_feature_aa64_predinv(id) || isar_feature_aa32_predinv(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool isar_feature_any_pmu_8_1(const ARMISARegisters *id)
|
||||||
|
{
|
||||||
|
return isar_feature_aa64_pmu_8_1(id) || isar_feature_aa32_pmu_8_1(id);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Forward to the above feature tests given an ARMCPU pointer.
|
* Forward to the above feature tests given an ARMCPU pointer.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -130,7 +130,7 @@ static void aarch64_a57_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->isar.id_isar5 = 0x00011121;
|
cpu->isar.id_isar5 = 0x00011121;
|
||||||
cpu->isar.id_isar6 = 0;
|
cpu->isar.id_isar6 = 0;
|
||||||
cpu->isar.id_aa64pfr0 = 0x00002222;
|
cpu->isar.id_aa64pfr0 = 0x00002222;
|
||||||
cpu->id_aa64dfr0 = 0x10305106;
|
cpu->isar.id_aa64dfr0 = 0x10305106;
|
||||||
cpu->isar.id_aa64isar0 = 0x00011120;
|
cpu->isar.id_aa64isar0 = 0x00011120;
|
||||||
cpu->isar.id_aa64mmfr0 = 0x00001124;
|
cpu->isar.id_aa64mmfr0 = 0x00001124;
|
||||||
cpu->dbgdidr = 0x3516d000;
|
cpu->dbgdidr = 0x3516d000;
|
||||||
|
@ -181,7 +181,7 @@ static void aarch64_a53_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->isar.id_isar5 = 0x00011121;
|
cpu->isar.id_isar5 = 0x00011121;
|
||||||
cpu->isar.id_isar6 = 0;
|
cpu->isar.id_isar6 = 0;
|
||||||
cpu->isar.id_aa64pfr0 = 0x00002222;
|
cpu->isar.id_aa64pfr0 = 0x00002222;
|
||||||
cpu->id_aa64dfr0 = 0x10305106;
|
cpu->isar.id_aa64dfr0 = 0x10305106;
|
||||||
cpu->isar.id_aa64isar0 = 0x00011120;
|
cpu->isar.id_aa64isar0 = 0x00011120;
|
||||||
cpu->isar.id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */
|
cpu->isar.id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */
|
||||||
cpu->dbgdidr = 0x3516d000;
|
cpu->dbgdidr = 0x3516d000;
|
||||||
|
@ -230,7 +230,7 @@ static void aarch64_a72_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
cpu->isar.id_isar4 = 0x00011142;
|
cpu->isar.id_isar4 = 0x00011142;
|
||||||
cpu->isar.id_isar5 = 0x00011121;
|
cpu->isar.id_isar5 = 0x00011121;
|
||||||
cpu->isar.id_aa64pfr0 = 0x00002222;
|
cpu->isar.id_aa64pfr0 = 0x00002222;
|
||||||
cpu->id_aa64dfr0 = 0x10305106;
|
cpu->isar.id_aa64dfr0 = 0x10305106;
|
||||||
cpu->isar.id_aa64isar0 = 0x00011120;
|
cpu->isar.id_aa64isar0 = 0x00011120;
|
||||||
cpu->isar.id_aa64mmfr0 = 0x00001124;
|
cpu->isar.id_aa64mmfr0 = 0x00001124;
|
||||||
cpu->dbgdidr = 0x3516d000;
|
cpu->dbgdidr = 0x3516d000;
|
||||||
|
|
|
@ -6046,9 +6046,10 @@ static void define_debug_regs(ARMCPU *cpu)
|
||||||
* check that if they both exist then they agree.
|
* check that if they both exist then they agree.
|
||||||
*/
|
*/
|
||||||
if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
|
if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
|
||||||
assert(FIELD_EX64(cpu->id_aa64dfr0, ID_AA64DFR0, BRPS) == brps);
|
assert(FIELD_EX64(cpu->isar.id_aa64dfr0, ID_AA64DFR0, BRPS) == brps);
|
||||||
assert(FIELD_EX64(cpu->id_aa64dfr0, ID_AA64DFR0, WRPS) == wrps);
|
assert(FIELD_EX64(cpu->isar.id_aa64dfr0, ID_AA64DFR0, WRPS) == wrps);
|
||||||
assert(FIELD_EX64(cpu->id_aa64dfr0, ID_AA64DFR0, CTX_CMPS) == ctx_cmps);
|
assert(FIELD_EX64(cpu->isar.id_aa64dfr0, ID_AA64DFR0, CTX_CMPS)
|
||||||
|
== ctx_cmps);
|
||||||
}
|
}
|
||||||
|
|
||||||
define_one_arm_cp_reg(cpu, &dbgdidr);
|
define_one_arm_cp_reg(cpu, &dbgdidr);
|
||||||
|
@ -6795,12 +6796,12 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||||
.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,
|
||||||
.accessfn = access_aa64_tid3,
|
.accessfn = access_aa64_tid3,
|
||||||
.resetvalue = cpu->id_aa64dfr0 },
|
.resetvalue = cpu->isar.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,
|
||||||
.accessfn = access_aa64_tid3,
|
.accessfn = access_aa64_tid3,
|
||||||
.resetvalue = cpu->id_aa64dfr1 },
|
.resetvalue = cpu->isar.id_aa64dfr1 },
|
||||||
{ .name = "ID_AA64DFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
{ .name = "ID_AA64DFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
|
||||||
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 2,
|
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 2,
|
||||||
.access = PL1_R, .type = ARM_CP_CONST,
|
.access = PL1_R, .type = ARM_CP_CONST,
|
||||||
|
|
Loading…
Reference in a new issue