[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 04/81] target/arm: Add ID_AA64ZFR0 fields and isar_feature_aa6
From: |
Richard Henderson |
Subject: |
[PATCH v3 04/81] target/arm: Add ID_AA64ZFR0 fields and isar_feature_aa64_sve2 |
Date: |
Fri, 18 Sep 2020 11:36:34 -0700 |
Will be used for SVE2 isa subset enablement.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
v2: Do not read zfr0 from kvm unless sve is available.
---
target/arm/cpu.h | 16 ++++++++++++++++
target/arm/helper.c | 3 +--
target/arm/kvm64.c | 11 +++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 6036f61d60..6f80a85fd0 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -920,6 +920,7 @@ struct ARMCPU {
uint64_t id_aa64mmfr2;
uint64_t id_aa64dfr0;
uint64_t id_aa64dfr1;
+ uint64_t id_aa64zfr0;
} isar;
uint64_t midr;
uint32_t revidr;
@@ -1880,6 +1881,16 @@ FIELD(ID_AA64DFR0, PMSVER, 32, 4)
FIELD(ID_AA64DFR0, DOUBLELOCK, 36, 4)
FIELD(ID_AA64DFR0, TRACEFILT, 40, 4)
+FIELD(ID_AA64ZFR0, SVEVER, 0, 4)
+FIELD(ID_AA64ZFR0, AES, 4, 4)
+FIELD(ID_AA64ZFR0, BITPERM, 16, 4)
+FIELD(ID_AA64ZFR0, BFLOAT16, 20, 4)
+FIELD(ID_AA64ZFR0, SHA3, 32, 4)
+FIELD(ID_AA64ZFR0, SM4, 40, 4)
+FIELD(ID_AA64ZFR0, I8MM, 44, 4)
+FIELD(ID_AA64ZFR0, F32MM, 52, 4)
+FIELD(ID_AA64ZFR0, F64MM, 56, 4)
+
FIELD(ID_DFR0, COPDBG, 0, 4)
FIELD(ID_DFR0, COPSDBG, 4, 4)
FIELD(ID_DFR0, MMAPDBG, 8, 4)
@@ -3886,6 +3897,11 @@ static inline bool isar_feature_aa64_tts2uxn(const
ARMISARegisters *id)
return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0;
}
+static inline bool isar_feature_aa64_sve2(const ARMISARegisters *id)
+{
+ return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SVEVER) != 0;
+}
+
/*
* Feature tests for "does this exist in either 32-bit or 64-bit?"
*/
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 88bd9dd35d..c0b84f9b99 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -7414,8 +7414,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 4,
.access = PL1_R, .type = ARM_CP_CONST,
.accessfn = access_aa64_tid3,
- /* At present, only SVEver == 0 is defined anyway. */
- .resetvalue = 0 },
+ .resetvalue = cpu->isar.id_aa64zfr0 },
{ .name = "ID_AA64PFR5_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 5,
.access = PL1_R, .type = ARM_CP_CONST,
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 987b35e33f..904d97bdd6 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -548,6 +548,17 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures
*ahcf)
err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr2,
ARM64_SYS_REG(3, 0, 0, 7, 2));
+ /*
+ * Before v5.1, KVM did not support SVE and did not expose
+ * ID_AA64ZFR0_EL1 even as RAZ. Afterward, KVM still does
+ * not expose the register to "user" requests like this
+ * unless the host supports SVE.
+ */
+ if (isar_feature_aa64_sve(&ahcf->isar)) {
+ err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
+ ARM64_SYS_REG(3, 0, 0, 4, 4));
+ }
+
/*
* Note that if AArch32 support is not present in the host,
* the AArch32 sysregs are present to be read, but will
--
2.25.1
- [PATCH v3 00/81] target/arm: Implement SVE2, Richard Henderson, 2020/09/18
- [PATCH v3 01/81] target/arm: Fix sve_uzp_p vs odd vector lengths, Richard Henderson, 2020/09/18
- [PATCH v3 02/81] target/arm: Fix sve_zip_p vs odd vector lengths, Richard Henderson, 2020/09/18
- [PATCH v3 03/81] target/arm: Fix sve_punpk_p vs odd vector lengths, Richard Henderson, 2020/09/18
- [PATCH v3 04/81] target/arm: Add ID_AA64ZFR0 fields and isar_feature_aa64_sve2,
Richard Henderson <=
- [PATCH v3 06/81] target/arm: Implement SVE2 integer pairwise add and accumulate long, Richard Henderson, 2020/09/18
- [PATCH v3 05/81] target/arm: Implement SVE2 Integer Multiply - Unpredicated, Richard Henderson, 2020/09/18
- [PATCH v3 07/81] target/arm: Implement SVE2 integer unary operations (predicated), Richard Henderson, 2020/09/18
- [PATCH v3 08/81] target/arm: Split out saturating/rounding shifts from neon, Richard Henderson, 2020/09/18
- [PATCH v3 11/81] target/arm: Implement SVE2 integer pairwise arithmetic, Richard Henderson, 2020/09/18
- [PATCH v3 09/81] target/arm: Implement SVE2 saturating/rounding bitwise shift left (predicated), Richard Henderson, 2020/09/18
- [PATCH v3 10/81] target/arm: Implement SVE2 integer halving add/subtract (predicated), Richard Henderson, 2020/09/18
- [PATCH v3 13/81] target/arm: Implement SVE2 integer add/subtract long, Richard Henderson, 2020/09/18
- [PATCH v3 14/81] target/arm: Implement SVE2 integer add/subtract interleaved long, Richard Henderson, 2020/09/18
- [PATCH v3 12/81] target/arm: Implement SVE2 saturating add/subtract (predicated), Richard Henderson, 2020/09/18