mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-02 11:11:00 +00:00
target/arm: Convert sve from feature bit to aa64pfr0 test
Backports commit cd208a1c3923bc097ec55c5b207d79294ab0e719 from qemu
This commit is contained in:
parent
03e2d64aed
commit
0286f9525d
|
@ -1488,6 +1488,16 @@ FIELD(ID_AA64ISAR1, FRINTTS, 32, 4)
|
|||
FIELD(ID_AA64ISAR1, SB, 36, 4)
|
||||
FIELD(ID_AA64ISAR1, SPECRES, 40, 4)
|
||||
|
||||
FIELD(ID_AA64PFR0, EL0, 0, 4)
|
||||
FIELD(ID_AA64PFR0, EL1, 4, 4)
|
||||
FIELD(ID_AA64PFR0, EL2, 8, 4)
|
||||
FIELD(ID_AA64PFR0, EL3, 12, 4)
|
||||
FIELD(ID_AA64PFR0, FP, 16, 4)
|
||||
FIELD(ID_AA64PFR0, ADVSIMD, 20, 4)
|
||||
FIELD(ID_AA64PFR0, GIC, 24, 4)
|
||||
FIELD(ID_AA64PFR0, RAS, 28, 4)
|
||||
FIELD(ID_AA64PFR0, SVE, 32, 4)
|
||||
|
||||
QEMU_BUILD_BUG_ON(ARRAY_SIZE(((ARMCPU *)0)->ccsidr) <= R_V7M_CSSELR_INDEX_MASK);
|
||||
|
||||
/* If adding a feature bit which corresponds to a Linux ELF
|
||||
|
@ -1537,7 +1547,6 @@ enum arm_features {
|
|||
ARM_FEATURE_PMU, /* has PMU support */
|
||||
ARM_FEATURE_VBAR, /* has cp15 VBAR */
|
||||
ARM_FEATURE_M_SECURITY, /* M profile Security Extension */
|
||||
ARM_FEATURE_SVE, /* has Scalable Vector Extension */
|
||||
ARM_FEATURE_V8_FP16, /* implements v8.2 half-precision float */
|
||||
ARM_FEATURE_M_MAIN, /* M profile Main Extension */
|
||||
};
|
||||
|
@ -3210,6 +3219,11 @@ static inline bool isar_feature_aa64_fcma(const ARMISARegisters *id)
|
|||
return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FCMA) != 0;
|
||||
}
|
||||
|
||||
static inline bool isar_feature_aa64_sve(const ARMISARegisters *id)
|
||||
{
|
||||
return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Forward to the above feature tests given an ARMCPU pointer.
|
||||
*/
|
||||
|
|
|
@ -263,6 +263,10 @@ static void aarch64_max_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
|||
t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1);
|
||||
cpu->isar.id_aa64isar1 = t;
|
||||
|
||||
t = cpu->isar.id_aa64pfr0;
|
||||
t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
|
||||
cpu->isar.id_aa64pfr0 = t;
|
||||
|
||||
/* Replicate the same data to the 32-bit id registers. */
|
||||
u = cpu->isar.id_isar5;
|
||||
u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */
|
||||
|
@ -285,7 +289,6 @@ static void aarch64_max_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
|||
* present in either.
|
||||
*/
|
||||
set_feature(&cpu->env, ARM_FEATURE_V8_FP16);
|
||||
set_feature(&cpu->env, ARM_FEATURE_SVE);
|
||||
/* For usermode -cpu max we can use a larger and more efficient DCZ
|
||||
* blocksize since we don't have to follow what the hardware does.
|
||||
*/
|
||||
|
|
|
@ -4841,7 +4841,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
|||
define_one_arm_cp_reg(cpu, &sctlr);
|
||||
}
|
||||
|
||||
if (arm_feature(env, ARM_FEATURE_SVE)) {
|
||||
if (cpu_isar_feature(aa64_sve, cpu)) {
|
||||
define_one_arm_cp_reg(cpu, &zcr_el1_reginfo);
|
||||
if (arm_feature(env, ARM_FEATURE_EL2)) {
|
||||
define_one_arm_cp_reg(cpu, &zcr_el2_reginfo);
|
||||
|
@ -11899,13 +11899,15 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
|
|||
uint32_t flags;
|
||||
|
||||
if (is_a64(env)) {
|
||||
ARMCPU *cpu = arm_env_get_cpu(env);
|
||||
|
||||
*pc = env->pc;
|
||||
flags = ARM_TBFLAG_AARCH64_STATE_MASK;
|
||||
/* Get control bits for tagged addresses */
|
||||
flags |= (arm_regime_tbi0(env, mmu_idx) << ARM_TBFLAG_TBI0_SHIFT);
|
||||
flags |= (arm_regime_tbi1(env, mmu_idx) << ARM_TBFLAG_TBI1_SHIFT);
|
||||
|
||||
if (arm_feature(env, ARM_FEATURE_SVE)) {
|
||||
if (cpu_isar_feature(aa64_sve, cpu)) {
|
||||
int sve_el = sve_exception_el(env, current_el);
|
||||
uint32_t zcr_len;
|
||||
|
||||
|
@ -12029,11 +12031,12 @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq)
|
|||
void aarch64_sve_change_el(CPUARMState *env, int old_el,
|
||||
int new_el, bool el0_a64)
|
||||
{
|
||||
ARMCPU *cpu = arm_env_get_cpu(env);
|
||||
int old_len, new_len;
|
||||
bool old_a64, new_a64;
|
||||
|
||||
/* Nothing to do if no SVE. */
|
||||
if (!arm_feature(env, ARM_FEATURE_SVE)) {
|
||||
if (!cpu_isar_feature(aa64_sve, cpu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
|
|||
cpu_fprintf(f, " FPCR=%08x FPSR=%08x\n",
|
||||
vfp_get_fpcr(env), vfp_get_fpsr(env));
|
||||
|
||||
if (arm_feature(env, ARM_FEATURE_SVE) && sve_exception_el(env, el) == 0) {
|
||||
if (cpu_isar_feature(aa64_sve, cpu) && sve_exception_el(env, el) == 0) {
|
||||
int j, zcr_len = sve_zcr_len_for_el(env, el);
|
||||
|
||||
for (i = 0; i <= FFR_PRED_NUM; i++) {
|
||||
|
@ -13983,7 +13983,7 @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s)
|
|||
unallocated_encoding(s);
|
||||
break;
|
||||
case 0x2:
|
||||
if (!arm_dc_feature(s, ARM_FEATURE_SVE) || !disas_sve(s, insn)) {
|
||||
if (!dc_isar_feature(aa64_sve, s) || !disas_sve(s, insn)) {
|
||||
unallocated_encoding(s);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue