[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/18] target/arm: Make isar_feature_aa32_fp16_arith() handle M-pr
From: |
Peter Maydell |
Subject: |
[PULL 05/18] target/arm: Make isar_feature_aa32_fp16_arith() handle M-profile |
Date: |
Thu, 1 Oct 2020 15:47:46 +0100 |
The M-profile definition of the MVFR1 ID register differs slightly
from the A-profile one, and in particular the check for "does the CPU
support fp16 arithmetic" is not the same.
We don't currently implement any M-profile CPUs with fp16 arithmetic,
so this is not yet a visible bug, but correcting the logic now
disarms this beartrap for when we eventually do.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200910173855.4068-6-peter.maydell@linaro.org
---
target/arm/cpu.h | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index a36edd2dc3d..e4549a8cc0c 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -1799,6 +1799,15 @@ FIELD(ID_MMFR4, LSM, 20, 4)
FIELD(ID_MMFR4, CCIDX, 24, 4)
FIELD(ID_MMFR4, EVT, 28, 4)
+FIELD(ID_PFR1, PROGMOD, 0, 4)
+FIELD(ID_PFR1, SECURITY, 4, 4)
+FIELD(ID_PFR1, MPROGMOD, 8, 4)
+FIELD(ID_PFR1, VIRTUALIZATION, 12, 4)
+FIELD(ID_PFR1, GENTIMER, 16, 4)
+FIELD(ID_PFR1, SEC_FRAC, 20, 4)
+FIELD(ID_PFR1, VIRT_FRAC, 24, 4)
+FIELD(ID_PFR1, GIC, 28, 4)
+
FIELD(ID_AA64ISAR0, AES, 4, 4)
FIELD(ID_AA64ISAR0, SHA1, 8, 4)
FIELD(ID_AA64ISAR0, SHA2, 12, 4)
@@ -1916,10 +1925,12 @@ FIELD(MVFR0, FPROUND, 28, 4)
FIELD(MVFR1, FPFTZ, 0, 4)
FIELD(MVFR1, FPDNAN, 4, 4)
-FIELD(MVFR1, SIMDLS, 8, 4)
-FIELD(MVFR1, SIMDINT, 12, 4)
-FIELD(MVFR1, SIMDSP, 16, 4)
-FIELD(MVFR1, SIMDHP, 20, 4)
+FIELD(MVFR1, SIMDLS, 8, 4) /* A-profile only */
+FIELD(MVFR1, SIMDINT, 12, 4) /* A-profile only */
+FIELD(MVFR1, SIMDSP, 16, 4) /* A-profile only */
+FIELD(MVFR1, SIMDHP, 20, 4) /* A-profile only */
+FIELD(MVFR1, MVE, 8, 4) /* M-profile only */
+FIELD(MVFR1, FP16, 20, 4) /* M-profile only */
FIELD(MVFR1, FPHP, 24, 4)
FIELD(MVFR1, SIMDFMAC, 28, 4)
@@ -3522,9 +3533,19 @@ static inline bool isar_feature_aa32_predinv(const
ARMISARegisters *id)
return FIELD_EX32(id->id_isar6, ID_ISAR6, SPECRES) != 0;
}
+static inline bool isar_feature_aa32_mprofile(const ARMISARegisters *id)
+{
+ return FIELD_EX32(id->id_pfr1, ID_PFR1, MPROGMOD) != 0;
+}
+
static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id)
{
- return FIELD_EX32(id->mvfr1, MVFR1, FPHP) >= 3;
+ /* Sadly this is encoded differently for A-profile and M-profile */
+ if (isar_feature_aa32_mprofile(id)) {
+ return FIELD_EX32(id->mvfr1, MVFR1, FP16) > 0;
+ } else {
+ return FIELD_EX32(id->mvfr1, MVFR1, FPHP) >= 3;
+ }
}
static inline bool isar_feature_aa32_vfp_simd(const ARMISARegisters *id)
--
2.20.1
- [PULL 00/18] target-arm queue, Peter Maydell, 2020/10/01
- [PULL 01/18] target/arm: Replace ARM_FEATURE_PXN with ID_MMFR0.VMSA check, Peter Maydell, 2020/10/01
- [PULL 02/18] target/arm: Move id_pfr0, id_pfr1 into ARMISARegisters, Peter Maydell, 2020/10/01
- [PULL 04/18] target/arm: Add ID register values for Cortex-M0, Peter Maydell, 2020/10/01
- [PULL 03/18] hw/intc/armv7m_nvic: Only show ID register values for Main Extension CPUs, Peter Maydell, 2020/10/01
- [PULL 06/18] target/arm: Fix sve ldr/str, Peter Maydell, 2020/10/01
- [PULL 05/18] target/arm: Make isar_feature_aa32_fp16_arith() handle M-profile,
Peter Maydell <=
- [PULL 07/18] target/arm: Fix SVE splice, Peter Maydell, 2020/10/01
- [PULL 08/18] hw/arm/raspi: Define various blocks base addresses, Peter Maydell, 2020/10/01
- [PULL 09/18] hw/arm/bcm2835: Add more unimplemented peripherals, Peter Maydell, 2020/10/01
- [PULL 10/18] hw/arm/raspi: Remove ignore_memory_transaction_failures on the raspi2, Peter Maydell, 2020/10/01
- [PULL 11/18] hw/arm/raspi: Display the board revision in the machine description, Peter Maydell, 2020/10/01
- [PULL 13/18] hw/arm/raspi: Move arm_boot_info structure to RaspiMachineState, Peter Maydell, 2020/10/01
- [PULL 12/18] hw/arm/raspi: Load the firmware on the first core, Peter Maydell, 2020/10/01
- [PULL 15/18] hw/arm/raspi: Use more specific machine names, Peter Maydell, 2020/10/01
- [PULL 14/18] hw/arm/raspi: Avoid using TypeInfo::class_data pointer, Peter Maydell, 2020/10/01
- [PULL 17/18] hw/arm/raspi: Use RaspiProcessorId to set the firmware load address, Peter Maydell, 2020/10/01