arm: rework id register storage
v7 cover arm: rework id register storage
Some small fixes, including fixing up/adding SPDX identifiers, keeping the series bisectable, and updating MAINTAINERS (please check if that's ok.)
Also available at
https://gitlab.com/cohuck/qemu/-/commits/arm-rework-idreg-storage-v7
<v6 cover letter>
Just some small changes:
- fixed up some botched conversions noted by Eric (thanks!)
- rebased to current master
- new patch with a small cleanup suggested by Eric
<v5 cover letter>
Just a quick respin to fix a missed conversion in hvf.c.
<v4 cover letter>
Next iteration of the id register patches; only small changes.
Changed from v3:
- added R-bs (thanks!)
- added missing SPDX header
- merged patch introducing accessors for kvm to the first user
- skip over sysregs outside of the id register range when generating register definitions again
Also available at
https://gitlab.com/cohuck/qemu/-/commits/arm-rework-idreg-storage-v4
<v3 cover letter>
Yet another update of the id register series, less changes this time around.
Changed from v2:
- changed generation of the various register defines via the "DEF" magic suggested by Richard
- some kvm-only code moved to kvm.c; some code potentially useful to non-kvm code stayed out of there (the cpu model code will make use of it, and that one should be extendable outside of kvm -- a revised version of those patches is still in the works, but I'll be off for a few days and rather wanted to get this one out first)
Also available at
https://gitlab.com/cohuck/qemu/-/commits/arm-rework-idreg-storage-v3
<v2 cover letter>
Changed from v1:
- Noticed that we missed the hvf code. Converted, compiled, but not tested as I'm lacking an environment for testing.
- Hopefully incorporated most of the suggested changes -- if I missed something, it was unintentional unless mentioned below.
- fixed repeated inclusion of definitions
- hopefully made macros more robust
- removed distinction between reading 32/64 values, which was mostly adding churn for little value
- postponed generating property definitions to the cpu model patches, where they are actually used
- juggled hunks and moved them to the right patches
- fixed some typos
- rebased to a more recent code base
NOT changed from v1:
- definitions are still generated from the Linux sysregs file
- I still think updating the generated files on demand (so that we can double check the result) is the right thing to do
- I'm open to changing the source of the definitions from the sysregs file to the JSON definitions published by Arm; however, I first wanted to get the code using it right -- we can switch out the code generating the file to use a different source easily later on, and I'd also like to steal parts of the script from Linux once integrated (which I think hasn't happened yet?)
<v1 cover letter>
[Note: I've kept the cc list from the last round of cpu model patches; so if you're confused as to why you're cc:ed here, take it as a heads-up that a new cpu model series will come along soon]
This patch series contains patches extracted from the larger cpu model series (RFC v2 last posted at
https://lore.kernel.org/qemu-devel/[email protected]/)
and aims at providing a base upon which we can continue with building support for cpu models, but which is hopefully already an improvement on its own.
Main changes from the patches in that series include:
- post-pone the changes to handle KVM writable ID registers for cpu models (I have a series including that on top of this one)
- change how we store the list of ID registers, and access them basically, use an enum for indexing, and an enum doing encodings in a pattern similar to cpregs
- move some hunks to different patches
- update the scripts to generate the register descriptions, and run them against a recent Linux sysregs file
What I've kept:
- generating the register descriptions from the Linux sysregs file I think that file is still our best bet to generate the descriptions easily, and updating the definitions is a manual step that can be checked for unintended changes
- most of the hard work that Eric had been doing; all new bugs in there are my own :)
</v1 cover letter>
</v2 cover letter>
</v3 cover letter>
</v4 cover letter>
</v5 cover letter>
</v6 cover letter>
Cornelia Huck (2):
arm/cpu: switch to a generated cpu-sysregs.h.inc arm/kvm: use fd instead of fdarray[2]
Eric Auger (12):
arm/cpu: Add sysreg definitions in cpu-sysregs.h arm/cpu: Store aa64isar0/aa64zfr0 into the idregs arrays arm/cpu: Store aa64isar1/2 into the idregs array arm/cpu: Store aa64pfr0/1 into the idregs array arm/cpu: Store aa64mmfr0-3 into the idregs array arm/cpu: Store aa64dfr0/1 into the idregs array arm/cpu: Store aa64smfr0 into the idregs array arm/cpu: Store id_isar0-7 into the idregs array arm/cpu: Store id_pfr0/1/2 into the idregs array arm/cpu: Store id_dfr0/1 into the idregs array arm/cpu: Store id_mmfr0-5 into the idregs array arm/cpu: Add sysreg generation scripts
MAINTAINERS | 1 + hw/intc/armv7m_nvic.c | 27 +- scripts/gen-cpu-sysregs-header.awk | 35 ++ scripts/update-aarch64-sysreg-code.sh | 26 ++ target/arm/cpu-features.h | 317 +++++++++--------- target/arm/cpu-sysregs.h | 42 +++ target/arm/cpu-sysregs.h.inc | 52 +++ target/arm/cpu.c | 111 +++---- target/arm/cpu.h | 80 +++-- target/arm/cpu64.c | 128 +++---- target/arm/helper.c | 68 ++-- target/arm/hvf/hvf.c | 39 ++- target/arm/internals.h | 6 +- target/arm/kvm.c | 139 ++++---- target/arm/ptw.c | 6 +- target/arm/tcg/cpu-v7m.c | 174 +++++----- target/arm/tcg/cpu32.c | 320 +++++++++--------- target/arm/tcg/cpu64.c | 459 +++++++++++++------------- 18 files changed, 1105 insertions(+), 925 deletions(-) create mode 100755 scripts/gen-cpu-sysregs-header.awk create mode 100755 scripts/update-aarch64-sysreg-code.sh create mode 100644 target/arm/cpu-sysregs.h create mode 100644 target/arm/cpu-sysregs.h.inc
Signature · 1 line
2.49.0
PATCH v7 1/14 arm/cpu: Add sysreg definitions in cpu-sysregs.h
From: Eric Auger <[email protected]>
This new header contains macros that define aarch64 registers. In a subsequent patch, this will be replaced by a more exhaustive version that will be generated from linux arch/arm64/tools/sysreg file. Those macros are sufficient to migrate the storage of those ID regs from named fields in isar struct to an array cell.
[CH: reworked to use different structures]
[CH: moved accessors from the patches first using them to here,
dropped interaction with writable registers, which will happen later]
--- target/arm/cpu-sysregs.h | 42 +++++++++++++++++++++++++++++++ target/arm/cpu-sysregs.h.inc | 35 ++++++++++++++++++++++++++ target/arm/cpu.h | 49 ++++++++++++++++++++++++++++++++++++ target/arm/cpu64.c | 22 ++++++++++++++++ 4 files changed, 148 insertions(+) create mode 100644 target/arm/cpu-sysregs.h create mode 100644 target/arm/cpu-sysregs.h.inc
target/arm/cpu-sysregs.h new file +42 -0
@@ -0,0 +1,42 @@ +/* +* Definitions for Arm ID system registers +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef ARM_CPU_SYSREGS_H +#define ARM_CPU_SYSREGS_H + +/* +* Following is similar to the coprocessor regs encodings, but with an argument +* ordering that matches the ARM ARM. We also reuse the various CP_REG_ defines +* that actually are the same as the equivalent KVM_REG_ values. +*/ +#define ENCODE_ID_REG (op0, op1, crn, crm, op2) \ + (((op0) << CP_REG_ARM64_SYSREG_OP0_SHIFT) | \ + ((op1) << CP_REG_ARM64_SYSREG_OP1_SHIFT) | \ + ((crn) << CP_REG_ARM64_SYSREG_CRN_SHIFT) | \ + ((crm) << CP_REG_ARM64_SYSREG_CRM_SHIFT) | \ + ((op2) << CP_REG_ARM64_SYSREG_OP2_SHIFT)) + +#define DEF (NAME ,OP0 ,OP1 ,CRN ,CRM ,OP2 ) NAME##_IDX, + +typedef enum ARMIDRegisterIdx { +#include "cpu-sysregs.h.inc" + NUM_ID_IDX, +}ARMIDRegisterIdx ; + +#undef DEF +#define DEF (NAME ,OP0 ,OP1 ,CRN ,CRM ,OP2 ) \ + SYS_##NAME = ENCODE_ID_REG(OP0, OP1, CRN, CRM, OP2), + +typedef enum ARMSysRegs { +#include "cpu-sysregs.h.inc" +}ARMSysRegs ; + +#undef DEF + +extern const uint32_t id_register_sysreg[NUM_ID_IDX ]; + +int get_sysreg_idx (ARMSysRegs sysreg); + +#endif /* ARM_CPU_SYSREGS_H */
target/arm/cpu-sysregs.h.inc new file +35 -0
@@ -0,0 +1,35 @@ +DEF(ID_AA64PFR0_EL1, 3, 0, 0, 4, 0) +DEF(ID_AA64PFR1_EL1, 3, 0, 0, 4, 1) +DEF(ID_AA64SMFR0_EL1, 3, 0, 0, 4, 5) +DEF(ID_AA64DFR0_EL1, 3, 0, 0, 5, 0) +DEF(ID_AA64DFR1_EL1, 3, 0, 0, 5, 1) +DEF(ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0) +DEF(ID_AA64ISAR1_EL1, 3, 0, 0, 6, 1) +DEF(ID_AA64ISAR2_EL1, 3, 0, 0, 6, 2) +DEF(ID_AA64MMFR0_EL1, 3, 0, 0, 7, 0) +DEF(ID_AA64MMFR1_EL1, 3, 0, 0, 7, 1) +DEF(ID_AA64MMFR2_EL1, 3, 0, 0, 7, 2) +DEF(ID_AA64MMFR3_EL1, 3, 0, 0, 7, 3) +DEF(ID_PFR0_EL1, 3, 0, 0, 1, 0) +DEF(ID_PFR1_EL1, 3, 0, 0, 1, 1) +DEF(ID_DFR0_EL1, 3, 0, 0, 1, 2) +DEF(ID_MMFR0_EL1, 3, 0, 0, 1, 4) +DEF(ID_MMFR1_EL1, 3, 0, 0, 1, 5) +DEF(ID_MMFR2_EL1, 3, 0, 0, 1, 6) +DEF(ID_MMFR3_EL1, 3, 0, 0, 1, 7) +DEF(ID_ISAR0_EL1, 3, 0, 0, 2, 0) +DEF(ID_ISAR1_EL1, 3, 0, 0, 2, 1) +DEF(ID_ISAR2_EL1, 3, 0, 0, 2, 2) +DEF(ID_ISAR3_EL1, 3, 0, 0, 2, 3) +DEF(ID_ISAR4_EL1, 3, 0, 0, 2, 4) +DEF(ID_ISAR5_EL1, 3, 0, 0, 2, 5) +DEF(ID_MMFR4_EL1, 3, 0, 0, 2, 6) +DEF(ID_ISAR6_EL1, 3, 0, 0, 2, 7) +DEF(MVFR0_EL1, 3, 0, 0, 3, 0) +DEF(MVFR1_EL1, 3, 0, 0, 3, 1) +DEF(MVFR2_EL1, 3, 0, 0, 3, 2) +DEF(ID_PFR2_EL1, 3, 0, 0, 3, 4) +DEF(ID_DFR1_EL1, 3, 0, 0, 3, 5) +DEF(ID_MMFR5_EL1, 3, 0, 0, 3, 6) +DEF(ID_AA64ZFR0_EL1, 3, 0, 0, 4, 4) +DEF(CTR_EL0, 3, 3, 0, 0, 1)
target/arm/cpu.h +49 -0
67 lines not on this page · raw message
target/arm/cpu64.c +22 -0
@@ -36,6 +36,28 @@#include "cpu-features.h" #include "cpregs.h" +/* convert between <register>_IDX and SYS_<register> */ +#define DEF (NAME ,OP0 ,OP1 ,CRN ,CRM ,OP2 ) \ + [NAME##_IDX] = SYS_##NAME, + +const uint32_t id_register_sysreg[NUM_ID_IDX ] = { +#include "cpu-sysregs.h.inc" +}; + +#undef DEF +#define DEF (NAME ,OP0 ,OP1 ,CRN ,CRM ,OP2 ) \ + case SYS_##NAME: return NAME##_IDX; + +int get_sysreg_idx (ARMSysRegs sysreg) +{ +switch (sysreg) { +#include "cpu-sysregs.h.inc" + } +g_assert_not_reached (); +} + +#undef DEF +void arm_cpu_sve_finalize (ARMCPU *cpu,Error **errp) {/*
Signature · 1 line
2.49.0
PATCH v7 2/14 arm/cpu: Store aa64isar0/aa64zfr0 into the idregs arrays
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
Also add kvm accessors for storing host features into idregs.
--- target/arm/cpu-features.h | 57 ++++++++++++++++++++------------------- target/arm/cpu.c | 11 ++++---- target/arm/cpu.h | 2 -- target/arm/cpu64.c | 8 +++--- target/arm/helper.c | 6 +++-- target/arm/hvf/hvf.c | 3 ++- target/arm/kvm.c | 30 ++++++++++++++++++--- target/arm/tcg/cpu64.c | 44 ++++++++++++++++++------------ 8 files changed, 98 insertions(+), 63 deletions(-)
target/arm/cpu-features.h +29 -28
@@ -22,6 +22,7 @@#include "hw/registerfields.h" #include "qemu/host-utils.h" +#include "cpu-sysregs.h" /* * Naming convention for isar_feature functions:
@@ -376,92 +377,92 @@ static inline bool isar_feature_aa32_doublelock(const ARMISARegisters *id)*/ static inline bool isar_feature_aa64_aes (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,AES ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,AES ) !=0 ; }static inline bool isar_feature_aa64_pmull (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,AES ) >1 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,AES ) >1 ; }static inline bool isar_feature_aa64_sha1 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SHA1 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,SHA1 ) !=0 ; }static inline bool isar_feature_aa64_sha256 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SHA2 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,SHA2 ) !=0 ; }static inline bool isar_feature_aa64_sha512 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SHA2 ) >1 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,SHA2 ) >1 ; }static inline bool isar_feature_aa64_crc32 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,CRC32 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,CRC32 ) !=0 ; }static inline bool isar_feature_aa64_atomics (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,ATOMIC ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,ATOMIC ) !=0 ; }static inline bool isar_feature_aa64_rdm (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,RDM ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,RDM ) !=0 ; }static inline bool isar_feature_aa64_sha3 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SHA3 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,SHA3 ) !=0 ; }static inline bool isar_feature_aa64_sm3 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SM3 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,SM3 ) !=0 ; }static inline bool isar_feature_aa64_sm4 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,SM4 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,SM4 ) !=0 ; }static inline bool isar_feature_aa64_dp (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,DP ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,DP ) !=0 ; }static inline bool isar_feature_aa64_fhm (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,FHM ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,FHM ) !=0 ; }static inline bool isar_feature_aa64_condm_4 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,TS ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,TS ) !=0 ; }static inline bool isar_feature_aa64_condm_5 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,TS ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,TS ) >=2 ; }static inline bool isar_feature_aa64_rndr (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,RNDR ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,RNDR ) !=0 ; }static inline bool isar_feature_aa64_tlbirange (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,TLB ) ==2 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,TLB ) ==2 ; }static inline bool isar_feature_aa64_tlbios (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar0,ID_AA64ISAR0 ,TLB ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,TLB ) !=0 ; }static inline bool isar_feature_aa64_jscvt (const ARMISARegisters *id)
@@ -927,52 +928,52 @@ static inline bool isar_feature_aa64_doublelock(const ARMISARegisters *id)static inline bool isar_feature_aa64_sve2 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,SVEVER ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,SVEVER ) !=0 ; }static inline bool isar_feature_aa64_sve2_aes (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,AES ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,AES ) !=0 ; }static inline bool isar_feature_aa64_sve2_pmull128 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,AES ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,AES ) >=2 ; }static inline bool isar_feature_aa64_sve2_bitperm (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,BITPERM ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,BITPERM ) !=0 ; }static inline bool isar_feature_aa64_sve_bf16 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,BFLOAT16 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,BFLOAT16 ) !=0 ; }static inline bool isar_feature_aa64_sve2_sha3 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,SHA3 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,SHA3 ) !=0 ; }static inline bool isar_feature_aa64_sve2_sm4 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,SM4 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,SM4 ) !=0 ; }static inline bool isar_feature_aa64_sve_i8mm (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,I8MM ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,I8MM ) !=0 ; }static inline bool isar_feature_aa64_sve_f32mm (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,F32MM ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,F32MM ) !=0 ; }static inline bool isar_feature_aa64_sve_f64mm (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64zfr0,ID_AA64ZFR0 ,F64MM ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ZFR0 ,F64MM ) !=0 ; }static inline bool isar_feature_aa64_sme_f64f64 (const ARMISARegisters *id)
target/arm/cpu.c +5 -6
@@ -1969,6 +1969,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) {CPUState *cs =CPU (dev);ARMCPU *cpu =ARM_CPU (dev); +ARMISARegisters *isar = &cpu->isar;ARMCPUClass *acc =ARM_CPU_GET_CLASS (dev);CPUARMState *env = &cpu->env;Error *local_err =NULL ;
@@ -2174,7 +2175,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)unset_feature (env,ARM_FEATURE_NEON ); - t = cpu->isar.id_aa64isar0; + t =GET_IDREG (isar,ID_AA64ISAR0 ); t =FIELD_DP64 (t,ID_AA64ISAR0 ,AES ,0 ); t =FIELD_DP64 (t,ID_AA64ISAR0 ,SHA1 ,0 ); t =FIELD_DP64 (t,ID_AA64ISAR0 ,SHA2 ,0 );
@@ -2182,7 +2183,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) t =FIELD_DP64 (t,ID_AA64ISAR0 ,SM3 ,0 ); t =FIELD_DP64 (t,ID_AA64ISAR0 ,SM4 ,0 ); t =FIELD_DP64 (t,ID_AA64ISAR0 ,DP ,0 ); - cpu->isar.id_aa64isar0 = t; +SET_IDREG (isar,ID_AA64ISAR0 , t); t = cpu->isar.id_aa64isar1; t =FIELD_DP64 (t,ID_AA64ISAR1 ,FCMA ,0 );
@@ -2224,12 +2225,10 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) }if (!cpu->has_neon && !cpu->has_vfp) { -uint64_t t; +unit64_t t;uint32_t u; - t = cpu->isar.id_aa64isar0; - t =FIELD_DP64 (t,ID_AA64ISAR0 ,FHM ,0 ); - cpu->isar.id_aa64isar0 = t; +FIELD_DP64_IDREG (isar,ID_AA64ISAR0 ,FHM ,0 ); t = cpu->isar.id_aa64isar1; t =FIELD_DP64 (t,ID_AA64ISAR1 ,FRINTTS ,0 );
target/arm/cpu.h +0 -2
@@ -1074,7 +1074,6 @@ struct ArchCPU {uint32_t dbgdidr;uint32_t dbgdevid;uint32_t dbgdevid1; -uint64_t id_aa64isar0;uint64_t id_aa64isar1;uint64_t id_aa64isar2;uint64_t id_aa64pfr0;
@@ -1085,7 +1084,6 @@ struct ArchCPU {uint64_t id_aa64mmfr3;uint64_t id_aa64dfr0;uint64_t id_aa64dfr1; -uint64_t id_aa64zfr0;uint64_t id_aa64smfr0;uint64_t reset_pmcr_el0;uint64_t idregs[NUM_ID_IDX ];
target/arm/cpu64.c +5 -3
@@ -136,7 +136,7 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)* SVE is disabled and so are all vector lengths. Good. * Disable all SVE extensions as well. */ - cpu->isar.id_aa64zfr0 =0 ; +SET_IDREG (&cpu->isar,ID_AA64ZFR0 ,0 );return ; }
@@ -639,6 +639,7 @@ void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp)static void aarch64_a57_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj); +ARMISARegisters *isar = &cpu->isar; cpu->dtb_compatible ="arm,cortex-a57" ;set_feature (&cpu->env,ARM_FEATURE_V8 );
@@ -676,7 +677,7 @@ static void aarch64_a57_initfn(Object *obj) cpu->isar.id_isar6 =0 ; cpu->isar.id_aa64pfr0 =0x00002222 ; cpu->isar.id_aa64dfr0 =0x10305106 ; - cpu->isar.id_aa64isar0 =0x00011120 ; +SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 ); cpu->isar.id_aa64mmfr0 =0x00001124 ; cpu->isar.dbgdidr =0x3516d000 ; cpu->isar.dbgdevid =0x01110f13 ;
@@ -700,6 +701,7 @@ static void aarch64_a57_initfn(Object *obj)static void aarch64_a53_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj); +ARMISARegisters *isar = &cpu->isar; cpu->dtb_compatible ="arm,cortex-a53" ;set_feature (&cpu->env,ARM_FEATURE_V8 );
@@ -737,7 +739,7 @@ static void aarch64_a53_initfn(Object *obj) cpu->isar.id_isar6 =0 ; cpu->isar.id_aa64pfr0 =0x00002222 ; cpu->isar.id_aa64dfr0 =0x10305106 ; - cpu->isar.id_aa64isar0 =0x00011120 ; +SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 ); cpu->isar.id_aa64mmfr0 =0x00001122 ;/* 40 bit physical addr */ cpu->isar.dbgdidr =0x3516d000 ; cpu->isar.dbgdevid =0x00110f13 ;
target/arm/helper.c +4 -2
@@ -7754,6 +7754,8 @@ void register_cp_regs_for_features(ARMCPU *cpu) {/* Register all the coprocessor registers based on feature bits */ CPUARMState *env = &cpu->env; +ARMISARegisters *isar = &cpu->isar; +if (arm_feature (env,ARM_FEATURE_M )) {/* M profile has no coprocessor registers */ return ;
@@ -7943,7 +7945,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, - .resetvalue = cpu->isar.id_aa64zfr0 }, + .resetvalue = GET_IDREG(isar, ID_AA64ZFR0)}, { .name = "ID_AA64SMFR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 5, .access = PL1_R, .type = ARM_CP_CONST,
@@ -8003,7 +8005,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64isar0 }, + .resetvalue = GET_IDREG(isar, ID_AA64ISAR0)}, { .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST,
target/arm/hvf/hvf.c +2 -1
@@ -19,6 +19,7 @@#include "system/hw_accel.h" #include "hvf_arm.h" #include "cpregs.h" +#include "cpu-sysregs.h" #include <mach/mach_time.h>
@@ -866,7 +867,7 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) { HV_SYS_REG_ID_AA64PFR1_EL1, &host_isar.id_aa64pfr1 }, { HV_SYS_REG_ID_AA64DFR0_EL1, &host_isar.id_aa64dfr0 }, { HV_SYS_REG_ID_AA64DFR1_EL1, &host_isar.id_aa64dfr1 }, - { HV_SYS_REG_ID_AA64ISAR0_EL1, &host_isar.id_aa64isar0 }, + { HV_SYS_REG_ID_AA64ISAR0_EL1, &host_isar.idregs[ID_AA64ISAR0_EL1_IDX] }, { HV_SYS_REG_ID_AA64ISAR1_EL1, &host_isar.id_aa64isar1 },/* Add ID_AA64ISAR2_EL1 here when HVF supports it */ { HV_SYS_REG_ID_AA64MMFR0_EL1, &host_isar.id_aa64mmfr0 },
target/arm/kvm.c +26 -4
@@ -26,6 +26,7 @@#include "system/kvm_int.h" #include "kvm_arm.h" #include "cpu.h" +#include "cpu-sysregs.h" #include "trace.h" #include "internals.h" #include "hw/pci/pci.h"
@@ -218,6 +219,28 @@ static bool kvm_arm_pauth_supported(void) kvm_check_extension(kvm_state, KVM_CAP_ARM_PTRAUTH_GENERIC)); } + +static uint64_t idregs_sysreg_to_kvm_reg (ARMSysRegs sysreg) +{ +return ARM64_SYS_REG ((sysreg &CP_REG_ARM64_SYSREG_OP0_MASK ) >>CP_REG_ARM64_SYSREG_OP0_SHIFT , + (sysreg &CP_REG_ARM64_SYSREG_OP1_MASK ) >>CP_REG_ARM64_SYSREG_OP1_SHIFT , + (sysreg &CP_REG_ARM64_SYSREG_CRN_MASK ) >>CP_REG_ARM64_SYSREG_CRN_SHIFT , + (sysreg &CP_REG_ARM64_SYSREG_CRM_MASK ) >>CP_REG_ARM64_SYSREG_CRM_SHIFT , + (sysreg &CP_REG_ARM64_SYSREG_OP2_MASK ) >>CP_REG_ARM64_SYSREG_OP2_SHIFT ); +} + +/* read a sysreg value and store it in the idregs */ +static int get_host_cpu_reg (int fd,ARMHostCPUFeatures *ahcf,ARMIDRegisterIdx index) +{ +uint64_t *reg; +int ret; + + reg = &ahcf->isar.idregs[index]; + ret =read_sys_reg64 (fd, reg, +idregs_sysreg_to_kvm_reg (id_register_sysreg[index])); +return ret; +} +static bool kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf) {/* Identify the feature bits corresponding to the host CPU, and
@@ -267,6 +290,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ahcf->target = init.target; ahcf->dtb_compatible ="arm,arm-v8" ; +int fd = fdarray[2 ]; err =read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64pfr0,ARM64_SYS_REG (3 ,0 ,0 ,4 ,0 ));
@@ -298,8 +322,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ARM64_SYS_REG(3, 0, 0, 5, 0)); err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64dfr1,ARM64_SYS_REG (3 ,0 ,0 ,5 ,1 )); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64isar0, -ARM64_SYS_REG (3 ,0 ,0 ,6 ,0 )); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR0_EL1_IDX ); err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64isar1,ARM64_SYS_REG (3 ,0 ,0 ,6 ,1 )); err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64isar2,
@@ -408,8 +431,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)* enabled SVE support, which resulted in an error rather than RAZ. * So only read the register if we set KVM_ARM_VCPU_SVE above. */ - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64zfr0, -ARM64_SYS_REG (3 ,0 ,0 ,4 ,4 )); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64ZFR0_EL1_IDX ); } }
target/arm/tcg/cpu64.c +27 -17
197 lines not on this page · raw message
Signature · 1 line
2.49.0
Re: [PATCH v7 02/14] arm/cpu: Store aa64isar0/aa64zfr0 into the idregs arrays
Quoted 12 lines · Cornelia Huck
From: Eric Auger <[email protected]>
Also add kvm accessors for storing host features into idregs.
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Sebastian Ott <[email protected]>Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>if (!cpu->has_neon && !cpu->has_vfp) {
target/arm/cpu.c static void arm_cpu_realizefn(DeviceState *dev, Error **errp) · line 2228
Quoted 2 lines
target/arm/cpu.c +1
-1-uint64_t t; +unit64_t t;
This doesn't compile :-)
-- PMM
Re: [PATCH v7 02/14] arm/cpu: Store aa64isar0/aa64zfr0 into the idregs arrays
Quoted 12 lines · Peter Maydell
Quoted 9 lines · Cornelia Huck
From: Eric Auger <[email protected]>
Also add kvm accessors for storing host features into idregs.
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Sebastian Ott <[email protected]>Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>
Quoted 7 lines
target/arm/cpu.c static void arm_cpu_realizefn(DeviceState *dev, Error **errp) · line 2228
Quoted 3 lines
if (!cpu->has_neon && !cpu->has_vfp) {target/arm/cpu.c +1
-1-uint64_t t; +unit64_t t;This doesn't compile :-)
-- PMM
Hum... weird that my compile didn't hit it.
Re: [PATCH v7 02/14] arm/cpu: Store aa64isar0/aa64zfr0 into the idregs arrays
Quoted 15 lines · Cornelia Huck
Quoted 12 lines · Peter Maydell
Quoted 9 lines · Cornelia Huck
From: Eric Auger <[email protected]>
Also add kvm accessors for storing host features into idregs.
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Sebastian Ott <[email protected]>Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>
Quoted 7 lines
Quoted 5 lines
target/arm/cpu.c static void arm_cpu_realizefn(DeviceState *dev, Error **errp) · line 2228
Quoted 3 lines
if (!cpu->has_neon && !cpu->has_vfp) {target/arm/cpu.c +1
-1-uint64_t t; +unit64_t t;This doesn't compile :-)
Hum... weird that my compile didn't hit it.
Patch 3 changes it back to uint64_t, so unless you do a test build after each patch you won't see it.
-- PMM
PATCH v7 3/14 arm/cpu: Store aa64isar1/2 into the idregs array
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
--- target/arm/cpu-features.h | 44 +++++++++++++++++++-------------------- target/arm/cpu.c | 13 ++++-------- target/arm/cpu.h | 2 -- target/arm/cpu64.c | 9 ++++---- target/arm/helper.c | 4 ++-- target/arm/hvf/hvf.c | 2 +- target/arm/kvm.c | 6 ++---- target/arm/tcg/cpu64.c | 24 ++++++++++----------- 8 files changed, 48 insertions(+), 56 deletions(-)
target/arm/cpu-features.h +22 -22
@@ -467,17 +467,17 @@ static inline bool isar_feature_aa64_tlbios(const ARMISARegisters *id)static inline bool isar_feature_aa64_jscvt (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,JSCVT ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,JSCVT ) !=0 ; }static inline bool isar_feature_aa64_fcma (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,FCMA ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,FCMA ) !=0 ; }static inline bool isar_feature_aa64_xs (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,XS ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,XS ) !=0 ; }/*
@@ -501,9 +501,9 @@ isar_feature_pauth_feature(const ARMISARegisters *id)* Architecturally, only one of {APA,API,APA3} may be active (non-zero) * and the other two must be zero. Thus we may avoid conditionals. */ -return (FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,APA ) | -FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,API ) | -FIELD_EX64 (id->id_aa64isar2,ID_AA64ISAR2 ,APA3 )); +return (FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,APA ) | +FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,API ) | +FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,APA3 )); }static inline bool isar_feature_aa64_pauth (const ARMISARegisters *id)
@@ -521,7 +521,7 @@ static inline bool isar_feature_aa64_pauth_qarma5(const ARMISARegisters *id)* Return true if pauth is enabled with the architected QARMA5 algorithm. * QEMU will always enable or disable both APA and GPA. */ -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,APA ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,APA ) !=0 ; }static inline bool isar_feature_aa64_pauth_qarma3 (const ARMISARegisters *id)
@@ -530,77 +530,77 @@ static inline bool isar_feature_aa64_pauth_qarma3(const ARMISARegisters *id)* Return true if pauth is enabled with the architected QARMA3 algorithm. * QEMU will always enable or disable both APA3 and GPA3. */ -return FIELD_EX64 (id->id_aa64isar2,ID_AA64ISAR2 ,APA3 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,APA3 ) !=0 ; }static inline bool isar_feature_aa64_sb (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,SB ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,SB ) !=0 ; }static inline bool isar_feature_aa64_predinv (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,SPECRES ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,SPECRES ) !=0 ; }static inline bool isar_feature_aa64_frint (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,FRINTTS ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,FRINTTS ) !=0 ; }static inline bool isar_feature_aa64_dcpop (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,DPB ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,DPB ) !=0 ; }static inline bool isar_feature_aa64_dcpodp (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,DPB ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,DPB ) >=2 ; }static inline bool isar_feature_aa64_bf16 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,BF16 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,BF16 ) !=0 ; }static inline bool isar_feature_aa64_ebf16 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,BF16 ) >1 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,BF16 ) >1 ; }static inline bool isar_feature_aa64_rcpc_8_3 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,LRCPC ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,LRCPC ) !=0 ; }static inline bool isar_feature_aa64_rcpc_8_4 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,LRCPC ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,LRCPC ) >=2 ; }static inline bool isar_feature_aa64_i8mm (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar1,ID_AA64ISAR1 ,I8MM ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR1 ,I8MM ) !=0 ; }static inline bool isar_feature_aa64_wfxt (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar2,ID_AA64ISAR2 ,WFXT ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,WFXT ) >=2 ; }static inline bool isar_feature_aa64_hbc (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar2,ID_AA64ISAR2 ,BC ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,BC ) !=0 ; }static inline bool isar_feature_aa64_mops (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar2,ID_AA64ISAR2 ,MOPS ); +return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,MOPS ); }static inline bool isar_feature_aa64_rpres (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64isar2,ID_AA64ISAR2 ,RPRES ); +return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,RPRES ); }static inline bool isar_feature_aa64_fp_simd (const ARMISARegisters *id)
target/arm/cpu.c +4 -9
@@ -2130,9 +2130,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)uint64_t t;uint32_t u; - t = cpu->isar.id_aa64isar1; - t =FIELD_DP64 (t,ID_AA64ISAR1 ,JSCVT ,0 ); - cpu->isar.id_aa64isar1 = t; +FIELD_DP64_IDREG (isar,ID_AA64ISAR1 ,JSCVT ,0 ); t = cpu->isar.id_aa64pfr0; t =FIELD_DP64 (t,ID_AA64PFR0 ,FP ,0xf );
@@ -2185,11 +2183,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) t =FIELD_DP64 (t,ID_AA64ISAR0 ,DP ,0 );SET_IDREG (isar,ID_AA64ISAR0 , t); - t = cpu->isar.id_aa64isar1; + t =GET_IDREG (isar,ID_AA64ISAR1 ); t =FIELD_DP64 (t,ID_AA64ISAR1 ,FCMA ,0 ); t =FIELD_DP64 (t,ID_AA64ISAR1 ,BF16 ,0 ); t =FIELD_DP64 (t,ID_AA64ISAR1 ,I8MM ,0 ); - cpu->isar.id_aa64isar1 = t; +SET_IDREG (isar,ID_AA64ISAR1 , t); t = cpu->isar.id_aa64pfr0; t =FIELD_DP64 (t,ID_AA64PFR0 ,ADVSIMD ,0xf );
@@ -2225,14 +2223,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) }if (!cpu->has_neon && !cpu->has_vfp) { -unit64_t t;uint32_t u;FIELD_DP64_IDREG (isar,ID_AA64ISAR0 ,FHM ,0 ); - t = cpu->isar.id_aa64isar1; - t =FIELD_DP64 (t,ID_AA64ISAR1 ,FRINTTS ,0 ); - cpu->isar.id_aa64isar1 = t; +FIELD_DP64_IDREG (isar,ID_AA64ISAR1 ,FRINTTS ,0 ); u = cpu->isar.mvfr0; u =FIELD_DP32 (u,MVFR0 ,SIMDREG ,0 );
target/arm/cpu.h +0 -2
@@ -1074,8 +1074,6 @@ struct ArchCPU {uint32_t dbgdidr;uint32_t dbgdevid;uint32_t dbgdevid1; -uint64_t id_aa64isar1; -uint64_t id_aa64isar2;uint64_t id_aa64pfr0;uint64_t id_aa64pfr1;uint64_t id_aa64mmfr0;
target/arm/cpu64.c +5 -4
@@ -502,6 +502,7 @@ void aarch64_add_sme_properties(Object *obj)void arm_cpu_pauth_finalize (ARMCPU *cpu,Error **errp) {ARMPauthFeature features =cpu_isar_feature (pauth_feature, cpu); +ARMISARegisters *isar = &cpu->isar;uint64_t isar1, isar2;/*
@@ -512,13 +513,13 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)* * Begin by disabling all fields. */ - isar1 = cpu->isar.id_aa64isar1; + isar1 =GET_IDREG (isar,ID_AA64ISAR1 ); isar1 =FIELD_DP64 (isar1,ID_AA64ISAR1 ,APA ,0 ); isar1 =FIELD_DP64 (isar1,ID_AA64ISAR1 ,GPA ,0 ); isar1 =FIELD_DP64 (isar1,ID_AA64ISAR1 ,API ,0 ); isar1 =FIELD_DP64 (isar1,ID_AA64ISAR1 ,GPI ,0 ); - isar2 = cpu->isar.id_aa64isar2; + isar2 =GET_IDREG (isar,ID_AA64ISAR2 ); isar2 =FIELD_DP64 (isar2,ID_AA64ISAR2 ,APA3 ,0 ); isar2 =FIELD_DP64 (isar2,ID_AA64ISAR2 ,GPA3 ,0 );
@@ -580,8 +581,8 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) } } - cpu->isar.id_aa64isar1 = isar1; - cpu->isar.id_aa64isar2 = isar2; +SET_IDREG (isar,ID_AA64ISAR1 , isar1); +SET_IDREG (isar,ID_AA64ISAR2 , isar2); } static const Property arm_cpu_pauth_property =
target/arm/helper.c +2 -2
@@ -8010,12 +8010,12 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64isar1 }, + .resetvalue = GET_IDREG(isar, ID_AA64ISAR1)}, { .name = "ID_AA64ISAR2_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64isar2 }, + .resetvalue = GET_IDREG(isar, ID_AA64ISAR2)}, { .name = "ID_AA64ISAR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 3, .access = PL1_R, .type = ARM_CP_CONST,
target/arm/hvf/hvf.c +1 -1
@@ -868,7 +868,7 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) { HV_SYS_REG_ID_AA64DFR0_EL1, &host_isar.id_aa64dfr0 }, { HV_SYS_REG_ID_AA64DFR1_EL1, &host_isar.id_aa64dfr1 }, { HV_SYS_REG_ID_AA64ISAR0_EL1, &host_isar.idregs[ID_AA64ISAR0_EL1_IDX] }, - { HV_SYS_REG_ID_AA64ISAR1_EL1, &host_isar.id_aa64isar1 }, + { HV_SYS_REG_ID_AA64ISAR1_EL1, &host_isar.idregs[ID_AA64ISAR1_EL1_IDX] },/* Add ID_AA64ISAR2_EL1 here when HVF supports it */ { HV_SYS_REG_ID_AA64MMFR0_EL1, &host_isar.id_aa64mmfr0 }, { HV_SYS_REG_ID_AA64MMFR1_EL1, &host_isar.id_aa64mmfr1 },
target/arm/kvm.c +2 -4
@@ -323,10 +323,8 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64dfr1,ARM64_SYS_REG (3 ,0 ,0 ,5 ,1 )); err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR0_EL1_IDX ); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64isar1, -ARM64_SYS_REG (3 ,0 ,0 ,6 ,1 )); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64isar2, -ARM64_SYS_REG (3 ,0 ,0 ,6 ,2 )); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR1_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR2_EL1_IDX ); err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64mmfr0,ARM64_SYS_REG (3 ,0 ,0 ,7 ,0 )); err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr1,
target/arm/tcg/cpu64.c +12 -12
@@ -68,7 +68,7 @@ static void aarch64_a35_initfn(Object *obj) cpu->isar.id_aa64dfr0 =0x10305106 ; cpu->isar.id_aa64dfr1 =0 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 ); - cpu->isar.id_aa64isar1 =0 ; +SET_IDREG (isar,ID_AA64ISAR1 ,0 ); cpu->isar.id_aa64mmfr0 =0x00101122 ; cpu->isar.id_aa64mmfr1 =0 ; cpu->clidr =0x0a200023 ;
@@ -224,7 +224,7 @@ static void aarch64_a55_initfn(Object *obj) cpu->dcz_blocksize =4 ;/* 64 bytes */ cpu->isar.id_aa64dfr0 =0x0000000010305408ull ;SET_IDREG (isar,ID_AA64ISAR0 ,0x0000100010211120ull ); - cpu->isar.id_aa64isar1 =0x0000000000100001ull ; +SET_IDREG (isar,ID_AA64ISAR1 ,0x0000000000100001ull ); cpu->isar.id_aa64mmfr0 =0x0000000000101122ull ; cpu->isar.id_aa64mmfr1 =0x0000000010212122ull ; cpu->isar.id_aa64mmfr2 =0x0000000000001011ull ;
@@ -357,7 +357,7 @@ static void aarch64_a76_initfn(Object *obj) cpu->dcz_blocksize =4 ; cpu->isar.id_aa64dfr0 =0x0000000010305408ull ;SET_IDREG (isar,ID_AA64ISAR0 ,0x0000100010211120ull ); - cpu->isar.id_aa64isar1 =0x0000000000100001ull ; +SET_IDREG (isar,ID_AA64ISAR1 ,0x0000000000100001ull ); cpu->isar.id_aa64mmfr0 =0x0000000000101122ull ; cpu->isar.id_aa64mmfr1 =0x0000000010212122ull ; cpu->isar.id_aa64mmfr2 =0x0000000000001011ull ;
@@ -437,7 +437,7 @@ static void aarch64_a64fx_initfn(Object *obj) cpu->isar.id_aa64mmfr1 =0x0000000011212100 ; cpu->isar.id_aa64mmfr2 =0x0000000000001011 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x0000000010211120 ); - cpu->isar.id_aa64isar1 =0x0000000000010001 ; +SET_IDREG (isar,ID_AA64ISAR1 ,0x0000000000010001 );SET_IDREG (isar,ID_AA64ZFR0 ,0x0000000000000000 ); cpu->clidr =0x0000000080000023 ;/* 64KB L1 dcache */
@@ -605,7 +605,7 @@ static void aarch64_neoverse_n1_initfn(Object *obj) cpu->dcz_blocksize =4 ; cpu->isar.id_aa64dfr0 =0x0000000110305408ull ;SET_IDREG (isar,ID_AA64ISAR0 ,0x0000100010211120ull ); - cpu->isar.id_aa64isar1 =0x0000000000100001ull ; +SET_IDREG (isar,ID_AA64ISAR1 ,0x0000000000100001ull ); cpu->isar.id_aa64mmfr0 =0x0000000000101125ull ; cpu->isar.id_aa64mmfr1 =0x0000000010212122ull ; cpu->isar.id_aa64mmfr2 =0x0000000000001011ull ;
@@ -684,7 +684,7 @@ static void aarch64_neoverse_v1_initfn(Object *obj) cpu->isar.id_aa64dfr0 =0x000001f210305519ull ; cpu->isar.id_aa64dfr1 =0x00000000 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x1011111110212120ull );/* with FEAT_RNG */ - cpu->isar.id_aa64isar1 =0x0011100001211032ull ; +SET_IDREG (isar,ID_AA64ISAR1 ,0x0011000001211032ull ); cpu->isar.id_aa64mmfr0 =0x0000000000101125ull ; cpu->isar.id_aa64mmfr1 =0x0000000010212122ull ; cpu->isar.id_aa64mmfr2 =0x0220011102101011ull ;
@@ -933,7 +933,7 @@ static void aarch64_a710_initfn(Object *obj) cpu->id_aa64afr0 =0 ; cpu->id_aa64afr1 =0 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x0221111110212120ull );/* with Crypto */ - cpu->isar.id_aa64isar1 =0x0010111101211052ull ; +SET_IDREG (isar,ID_AA64ISAR1 ,0x0010111101211052ull ); cpu->isar.id_aa64mmfr0 =0x0000022200101122ull ; cpu->isar.id_aa64mmfr1 =0x0000000010212122ull ; cpu->isar.id_aa64mmfr2 =0x1221011110101011ull ;
@@ -1035,7 +1035,7 @@ static void aarch64_neoverse_n2_initfn(Object *obj) cpu->id_aa64afr0 =0 ; cpu->id_aa64afr1 =0 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x1221111110212120ull );/* with Crypto and FEAT_RNG */ - cpu->isar.id_aa64isar1 =0x0011111101211052ull ; +SET_IDREG (isar,ID_AA64ISAR1 ,0x0011111101211052ull ); cpu->isar.id_aa64mmfr0 =0x0000022200101125ull ; cpu->isar.id_aa64mmfr1 =0x0000000010212122ull ; cpu->isar.id_aa64mmfr2 =0x1221011112101011ull ;
@@ -1160,7 +1160,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64ISAR0 ,RNDR ,1 );/* FEAT_RNG */ SET_IDREG (isar,ID_AA64ISAR0 , t); - t = cpu->isar.id_aa64isar1; + t =GET_IDREG (isar,ID_AA64ISAR1 ); t =FIELD_DP64 (t,ID_AA64ISAR1 ,DPB ,2 );/* FEAT_DPB2 */ t =FIELD_DP64 (t,ID_AA64ISAR1 ,APA , PauthFeat_FPACCOMBINED); t =FIELD_DP64 (t,ID_AA64ISAR1 ,API ,1 );
@@ -1174,14 +1174,14 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64ISAR1 ,DGH ,1 );/* FEAT_DGH */ t =FIELD_DP64 (t,ID_AA64ISAR1 ,I8MM ,1 );/* FEAT_I8MM */ t =FIELD_DP64 (t,ID_AA64ISAR1 ,XS ,1 );/* FEAT_XS */ - cpu->isar.id_aa64isar1 = t; +SET_IDREG (isar,ID_AA64ISAR1 , t); - t = cpu->isar.id_aa64isar2; + t =GET_IDREG (isar,ID_AA64ISAR2 ); t =FIELD_DP64 (t,ID_AA64ISAR2 ,RPRES ,1 );/* FEAT_RPRES */ t =FIELD_DP64 (t,ID_AA64ISAR2 ,MOPS ,1 );/* FEAT_MOPS */ t =FIELD_DP64 (t,ID_AA64ISAR2 ,BC ,1 );/* FEAT_HBC */ t =FIELD_DP64 (t,ID_AA64ISAR2 ,WFXT ,2 );/* FEAT_WFxT */ - cpu->isar.id_aa64isar2 = t; +SET_IDREG (isar,ID_AA64ISAR2 , t); t = cpu->isar.id_aa64pfr0; t =FIELD_DP64 (t,ID_AA64PFR0 ,FP ,1 );/* FEAT_FP16 */
Signature · 1 line
2.49.0
PATCH v7 4/14 arm/cpu: Store aa64pfr0/1 into the idregs array
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
--- target/arm/cpu-features.h | 40 ++++++++++++++++----------------- target/arm/cpu.c | 29 ++++++++---------------- target/arm/cpu.h | 2 -- target/arm/cpu64.c | 14 ++++-------- target/arm/helper.c | 6 ++--- target/arm/hvf/hvf.c | 9 ++++---- target/arm/kvm.c | 18 +++++++-------- target/arm/tcg/cpu64.c | 47 ++++++++++++++++++--------------------- 8 files changed, 71 insertions(+), 94 deletions(-)
target/arm/cpu-features.h +20 -20
@@ -606,68 +606,68 @@ static inline bool isar_feature_aa64_rpres(const ARMISARegisters *id)static inline bool isar_feature_aa64_fp_simd (const ARMISARegisters *id) {/* We always set the AdvSIMD and FP fields identically. */ -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,FP ) !=0xf ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,FP ) !=0xf ; }static inline bool isar_feature_aa64_fp16 (const ARMISARegisters *id) {/* We always set the AdvSIMD and FP fields identically wrt FP16. */ -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,FP ) ==1 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,FP ) ==1 ; }static inline bool isar_feature_aa64_aa32 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,EL0 ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,EL0 ) >=2 ; }static inline bool isar_feature_aa64_aa32_el1 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,EL1 ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,EL1 ) >=2 ; }static inline bool isar_feature_aa64_aa32_el2 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,EL2 ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,EL2 ) >=2 ; }static inline bool isar_feature_aa64_ras (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,RAS ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,RAS ) !=0 ; }static inline bool isar_feature_aa64_doublefault (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,RAS ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,RAS ) >=2 ; }static inline bool isar_feature_aa64_sve (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,SVE ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,SVE ) !=0 ; }static inline bool isar_feature_aa64_sel2 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,SEL2 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,SEL2 ) !=0 ; }static inline bool isar_feature_aa64_rme (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,RME ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,RME ) !=0 ; }static inline bool isar_feature_aa64_dit (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,DIT ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR0 ,DIT ) !=0 ; }static inline bool isar_feature_aa64_scxtnum (const ARMISARegisters *id) { -int key =FIELD_EX64 (id->id_aa64pfr0,ID_AA64PFR0 ,CSV2 ); +int key =FIELD_EX64_IDREG (id,ID_AA64PFR0 ,CSV2 );if (key >=2 ) {return true;/* FEAT_CSV2_2 */ }if (key ==1 ) { - key =FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,CSV2_FRAC ); + key =FIELD_EX64_IDREG (id,ID_AA64PFR1 ,CSV2_FRAC );return key >=2 ;/* FEAT_CSV2_1p2 */ }return false;
@@ -675,37 +675,37 @@ static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id)static inline bool isar_feature_aa64_ssbs (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,SSBS ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,SSBS ) !=0 ; }static inline bool isar_feature_aa64_bti (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,BT ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,BT ) !=0 ; }static inline bool isar_feature_aa64_mte_insn_reg (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,MTE ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,MTE ) !=0 ; }static inline bool isar_feature_aa64_mte (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,MTE ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,MTE ) >=2 ; }static inline bool isar_feature_aa64_mte3 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,MTE ) >=3 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,MTE ) >=3 ; }static inline bool isar_feature_aa64_sme (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,SME ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,SME ) !=0 ; }static inline bool isar_feature_aa64_nmi (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64pfr1,ID_AA64PFR1 ,NMI ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,NMI ) !=0 ; }static inline bool isar_feature_aa64_tgran4_lpa2 (const ARMISARegisters *id)
target/arm/cpu.c +9 -20
@@ -2127,14 +2127,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) }if (!cpu->has_vfp) { -uint64_t t;uint32_t u;FIELD_DP64_IDREG (isar,ID_AA64ISAR1 ,JSCVT ,0 ); - t = cpu->isar.id_aa64pfr0; - t =FIELD_DP64 (t,ID_AA64PFR0 ,FP ,0xf ); - cpu->isar.id_aa64pfr0 = t; +FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,FP ,0xf ); u = cpu->isar.id_isar6; u =FIELD_DP32 (u,ID_ISAR6 ,JSCVT ,0 );
@@ -2189,9 +2186,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) t =FIELD_DP64 (t,ID_AA64ISAR1 ,I8MM ,0 );SET_IDREG (isar,ID_AA64ISAR1 , t); - t = cpu->isar.id_aa64pfr0; - t =FIELD_DP64 (t,ID_AA64PFR0 ,ADVSIMD ,0xf ); - cpu->isar.id_aa64pfr0 = t; +FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,ADVSIMD ,0xf ); u = cpu->isar.id_isar5; u =FIELD_DP32 (u,ID_ISAR5 ,AES ,0 );
@@ -2333,12 +2328,10 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)*/ cpu->isar.id_pfr1 =FIELD_DP32 (cpu->isar.id_pfr1,ID_PFR1 ,SECURITY ,0 ); cpu->isar.id_dfr0 =FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,COPSDBG ,0 ); - cpu->isar.id_aa64pfr0 =FIELD_DP64 (cpu->isar.id_aa64pfr0, -ID_AA64PFR0 ,EL3 ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,EL3 ,0 );/* Disable the realm management extension, which requires EL3. */ - cpu->isar.id_aa64pfr0 =FIELD_DP64 (cpu->isar.id_aa64pfr0, -ID_AA64PFR0 ,RME ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,RME ,0 ); }if (!cpu->has_el2) {
@@ -2373,8 +2366,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* Disable the hypervisor feature bits in the processor feature * registers if we don't have EL2. */ - cpu->isar.id_aa64pfr0 =FIELD_DP64 (cpu->isar.id_aa64pfr0, -ID_AA64PFR0 ,EL2 ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,EL2 ,0 ); cpu->isar.id_pfr1 =FIELD_DP32 (cpu->isar.id_pfr1,ID_PFR1 ,VIRTUALIZATION ,0 ); }
@@ -2395,8 +2387,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* This matches Cortex-A710 BROADCASTMTE input being LOW. */ if (tcg_enabled () && cpu->tag_memory ==NULL ) { - cpu->isar.id_aa64pfr1 = -FIELD_DP64 (cpu->isar.id_aa64pfr1,ID_AA64PFR1 ,MTE ,1 ); +FIELD_DP64_IDREG (isar,ID_AA64PFR1 ,MTE ,1 ); }/*
@@ -2404,7 +2395,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* enabled on the guest (i.e mte=off), clear guest's MTE bits." */ if (kvm_enabled () && !cpu->kvm_mte) { -FIELD_DP64 (cpu->isar.id_aa64pfr1,ID_AA64PFR1 ,MTE ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64PFR1 ,MTE ,0 ); }#endif }
@@ -2443,13 +2434,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) cpu->isar.id_dfr0 =FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,MMAPTRC ,0 );/* FEAT_AMU (Activity Monitors Extension) */ - cpu->isar.id_aa64pfr0 = -FIELD_DP64 (cpu->isar.id_aa64pfr0,ID_AA64PFR0 ,AMU ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,AMU ,0 ); cpu->isar.id_pfr0 =FIELD_DP32 (cpu->isar.id_pfr0,ID_PFR0 ,AMU ,0 );/* FEAT_MPAM (Memory Partitioning and Monitoring Extension) */ - cpu->isar.id_aa64pfr0 = -FIELD_DP64 (cpu->isar.id_aa64pfr0,ID_AA64PFR0 ,MPAM ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,MPAM ,0 ); }/* MPU can be configured out of a PMSA CPU either by setting has-mpu
target/arm/cpu.h +0 -2
@@ -1074,8 +1074,6 @@ struct ArchCPU {uint32_t dbgdidr;uint32_t dbgdevid;uint32_t dbgdevid1; -uint64_t id_aa64pfr0; -uint64_t id_aa64pfr1;uint64_t id_aa64mmfr0;uint64_t id_aa64mmfr1;uint64_t id_aa64mmfr2;
target/arm/cpu64.c +4 -10
@@ -310,16 +310,13 @@ static bool cpu_arm_get_sve(Object *obj, Error **errp)static void cpu_arm_set_sve (Object *obj,bool value,Error **errp) {ARMCPU *cpu =ARM_CPU (obj); -uint64_t t;if (value &&kvm_enabled () && !kvm_arm_sve_supported ()) {error_setg (errp,"'sve' feature not supported by KVM on this host" );return ; } - t = cpu->isar.id_aa64pfr0; - t =FIELD_DP64 (t,ID_AA64PFR0 ,SVE , value); - cpu->isar.id_aa64pfr0 = t; +FIELD_DP64_IDREG (&cpu->isar,ID_AA64PFR0 ,SVE , value); }void arm_cpu_sme_finalize (ARMCPU *cpu,Error **errp)
@@ -370,11 +367,8 @@ static bool cpu_arm_get_sme(Object *obj, Error **errp)static void cpu_arm_set_sme (Object *obj,bool value,Error **errp) {ARMCPU *cpu =ARM_CPU (obj); -uint64_t t; - t = cpu->isar.id_aa64pfr1; - t =FIELD_DP64 (t,ID_AA64PFR1 ,SME , value); - cpu->isar.id_aa64pfr1 = t; +FIELD_DP64_IDREG (&cpu->isar,ID_AA64PFR1 ,SME , value); }static bool cpu_arm_get_sme_fa64 (Object *obj,Error **errp)
@@ -676,7 +670,7 @@ static void aarch64_a57_initfn(Object *obj) cpu->isar.id_isar4 =0x00011142 ; cpu->isar.id_isar5 =0x00011121 ; cpu->isar.id_isar6 =0 ; - cpu->isar.id_aa64pfr0 =0x00002222 ; +SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 ); cpu->isar.id_aa64dfr0 =0x10305106 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 ); cpu->isar.id_aa64mmfr0 =0x00001124 ;
@@ -738,7 +732,7 @@ static void aarch64_a53_initfn(Object *obj) cpu->isar.id_isar4 =0x00011142 ; cpu->isar.id_isar5 =0x00011121 ; cpu->isar.id_isar6 =0 ; - cpu->isar.id_aa64pfr0 =0x00002222 ; +SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 ); cpu->isar.id_aa64dfr0 =0x10305106 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 ); cpu->isar.id_aa64mmfr0 =0x00001122 ;/* 40 bit physical addr */
target/arm/helper.c +3 -3
@@ -6944,7 +6944,7 @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)static uint64_t id_aa64pfr0_read (CPUARMState *env,const ARMCPRegInfo *ri) {ARMCPU *cpu =env_archcpu (env); -uint64_t pfr0 = cpu->isar.id_aa64pfr0; +uint64_t pfr0 =GET_IDREG (&cpu->isar,ID_AA64PFR0 );if (env->gicv3state) { pfr0 |=1 <<24 ;
@@ -7918,7 +7918,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, #ifdef CONFIG_USER_ONLY .type =ARM_CP_CONST , - .resetvalue = cpu->isar.id_aa64pfr0 + .resetvalue = GET_IDREG(isar, ID_AA64PFR0) #else .type =ARM_CP_NO_RAW , .accessfn = access_aa64_tid3,
@@ -7930,7 +7930,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64pfr1}, + .resetvalue = GET_IDREG(isar, ID_AA64PFR1)}, { .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST,
target/arm/hvf/hvf.c +5 -4
@@ -863,8 +863,8 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)int reg;uint64_t *val; } regs[] = { - { HV_SYS_REG_ID_AA64PFR0_EL1, &host_isar.id_aa64pfr0 }, - { HV_SYS_REG_ID_AA64PFR1_EL1, &host_isar.id_aa64pfr1 }, + { HV_SYS_REG_ID_AA64PFR0_EL1, &host_isar.idregs[ID_AA64PFR0_EL1_IDX] }, + { HV_SYS_REG_ID_AA64PFR1_EL1, &host_isar.idregs[ID_AA64PFR1_EL1_IDX] }, { HV_SYS_REG_ID_AA64DFR0_EL1, &host_isar.id_aa64dfr0 }, { HV_SYS_REG_ID_AA64DFR1_EL1, &host_isar.id_aa64dfr1 }, { HV_SYS_REG_ID_AA64ISAR0_EL1, &host_isar.idregs[ID_AA64ISAR0_EL1_IDX] },
@@ -911,7 +911,8 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)* - fix any assumptions we made that SME implies SVE (since * on the M4 there is SME but not SVE) */ - host_isar.id_aa64pfr1 &= ~R_ID_AA64PFR1_SME_MASK ; +SET_IDREG (&host_isar,ID_AA64PFR1 , +GET_IDREG (&host_isar,ID_AA64PFR1 ) & ~R_ID_AA64PFR1_SME_MASK ); ahcf->isar = host_isar;
@@ -928,7 +929,7 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ahcf->reset_sctlr |=0x00800000 ;/* Make sure we don't advertise AArch32 support for EL0/EL1 */ -if ((host_isar.id_aa64pfr0 &0xff ) !=0x11 ) { +if ((GET_IDREG (&host_isar,ID_AA64PFR0 ) &0xff ) !=0x11 ) {return false; }
target/arm/kvm.c +8 -10
@@ -292,8 +292,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ahcf->dtb_compatible ="arm,arm-v8" ;int fd = fdarray[2 ]; - err =read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64pfr0, -ARM64_SYS_REG (3 ,0 ,0 ,4 ,0 )); + err =get_host_cpu_reg (fd, ahcf,ID_AA64PFR0_EL1_IDX );if (unlikely (err <0 )) {/* * Before v4.15, the kernel only exposed a limited number of system
@@ -311,11 +310,10 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)* ??? Either of these sounds like too much effort just * to work around running a modern host kernel. */ - ahcf->isar.id_aa64pfr0 =0x00000011 ;/* EL1&0, AArch64 only */ +SET_IDREG (&ahcf->isar,ID_AA64PFR0 ,0x00000011 );/* EL1&0, AArch64 only */ err =0 ; }else { - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64pfr1, -ARM64_SYS_REG (3 ,0 ,0 ,4 ,1 )); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64PFR1_EL1_IDX ); err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64smfr0,ARM64_SYS_REG (3 ,0 ,0 ,4 ,5 )); err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64dfr0,
@@ -395,14 +393,14 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)* arch/arm64/kvm/sys_regs.c:trap_dbgidr() does. * We only do this if the CPU supports AArch32 at EL1. */ -if (FIELD_EX32 (ahcf->isar.id_aa64pfr0,ID_AA64PFR0 ,EL1 ) >=2 ) { -int wrps =FIELD_EX64 (ahcf->isar.id_aa64dfr0,ID_AA64DFR0 ,WRPS ); -int brps =FIELD_EX64 (ahcf->isar.id_aa64dfr0,ID_AA64DFR0 ,BRPS ); +if (FIELD_EX32_IDREG (&ahcf->isar,ID_AA64PFR0 ,EL1 ) >=2 ) { +int wrps =FIELD_EX64 (&ahcf->isar.id_aa64dfr0,ID_AA64DFR0 ,WRPS ); +int brps =FIELD_EX64 (&ahcf->isar.id_aa64dfr0,ID_AA64DFR0 ,BRPS );int ctx_cmps = -FIELD_EX64 (ahcf->isar.id_aa64dfr0,ID_AA64DFR0 ,CTX_CMPS ); +FIELD_EX64 (&ahcf->isar.id_aa64dfr0,ID_AA64DFR0 ,CTX_CMPS );int version =6 ;/* ARMv8 debug architecture */ bool has_el3 = - !!FIELD_EX32 (ahcf->isar.id_aa64pfr0,ID_AA64PFR0 ,EL3 ); + !!FIELD_EX32_IDREG (&ahcf->isar,ID_AA64PFR0 ,EL3 );uint32_t dbgdidr =0 ; dbgdidr =FIELD_DP32 (dbgdidr,DBGDIDR ,WRPS , wrps);
target/arm/tcg/cpu64.c +22 -25
127 lines not on this page · raw message
Signature · 1 line
2.49.0
PATCH v7 5/14 arm/cpu: Store aa64mmfr0-3 into the idregs array
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
--- target/arm/cpu-features.h | 74 +++++++++++++++++++-------------------- target/arm/cpu.h | 4 --- target/arm/cpu64.c | 8 ++--- target/arm/helper.c | 8 ++--- target/arm/hvf/hvf.c | 21 ++++++----- target/arm/kvm.c | 12 +++---- target/arm/ptw.c | 6 ++-- target/arm/tcg/cpu64.c | 64 ++++++++++++++++----------------- 8 files changed, 95 insertions(+), 102 deletions(-)
target/arm/cpu-features.h +37 -37
@@ -710,192 +710,192 @@ static inline bool isar_feature_aa64_nmi(const ARMISARegisters *id)static inline bool isar_feature_aa64_tgran4_lpa2 (const ARMISARegisters *id) { -return FIELD_SEX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN4 ) >=1 ; +return FIELD_SEX64_IDREG (id,ID_AA64MMFR0 ,TGRAN4 ) >=1 ; }static inline bool isar_feature_aa64_tgran4_2_lpa2 (const ARMISARegisters *id) { -unsigned t =FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN4_2 ); +unsigned t =FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,TGRAN4_2 );return t >=3 || (t ==0 &&isar_feature_aa64_tgran4_lpa2 (id)); }static inline bool isar_feature_aa64_tgran16_lpa2 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN16 ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,TGRAN16 ) >=2 ; }static inline bool isar_feature_aa64_tgran16_2_lpa2 (const ARMISARegisters *id) { -unsigned t =FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN16_2 ); +unsigned t =FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,TGRAN16_2 );return t >=3 || (t ==0 &&isar_feature_aa64_tgran16_lpa2 (id)); }static inline bool isar_feature_aa64_tgran4 (const ARMISARegisters *id) { -return FIELD_SEX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN4 ) >=0 ; +return FIELD_SEX64_IDREG (id,ID_AA64MMFR0 ,TGRAN4 ) >=0 ; }static inline bool isar_feature_aa64_tgran16 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN16 ) >=1 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,TGRAN16 ) >=1 ; }static inline bool isar_feature_aa64_tgran64 (const ARMISARegisters *id) { -return FIELD_SEX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN64 ) >=0 ; +return FIELD_SEX64_IDREG (id,ID_AA64MMFR0 ,TGRAN64 ) >=0 ; }static inline bool isar_feature_aa64_tgran4_2 (const ARMISARegisters *id) { -unsigned t =FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN4_2 ); +unsigned t =FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,TGRAN4_2 );return t >=2 || (t ==0 &&isar_feature_aa64_tgran4 (id)); }static inline bool isar_feature_aa64_tgran16_2 (const ARMISARegisters *id) { -unsigned t =FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN16_2 ); +unsigned t =FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,TGRAN16_2 );return t >=2 || (t ==0 &&isar_feature_aa64_tgran16 (id)); }static inline bool isar_feature_aa64_tgran64_2 (const ARMISARegisters *id) { -unsigned t =FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,TGRAN64_2 ); +unsigned t =FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,TGRAN64_2 );return t >=2 || (t ==0 &&isar_feature_aa64_tgran64 (id)); }static inline bool isar_feature_aa64_fgt (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,FGT ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,FGT ) !=0 ; }static inline bool isar_feature_aa64_ecv_traps (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,ECV ) >0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,ECV ) >0 ; }static inline bool isar_feature_aa64_ecv (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr0,ID_AA64MMFR0 ,ECV ) >1 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR0 ,ECV ) >1 ; }static inline bool isar_feature_aa64_vh (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,VH ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,VH ) !=0 ; }static inline bool isar_feature_aa64_lor (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,LO ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,LO ) !=0 ; }static inline bool isar_feature_aa64_pan (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,PAN ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,PAN ) !=0 ; }static inline bool isar_feature_aa64_ats1e1 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,PAN ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,PAN ) >=2 ; }static inline bool isar_feature_aa64_pan3 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,PAN ) >=3 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,PAN ) >=3 ; }static inline bool isar_feature_aa64_hcx (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,HCX ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,HCX ) !=0 ; }static inline bool isar_feature_aa64_afp (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,AFP ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,AFP ) !=0 ; }static inline bool isar_feature_aa64_tidcp1 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,TIDCP1 ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,TIDCP1 ) !=0 ; }static inline bool isar_feature_aa64_cmow (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,CMOW ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,CMOW ) !=0 ; }static inline bool isar_feature_aa64_hafs (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,HAFDBS ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,HAFDBS ) !=0 ; }static inline bool isar_feature_aa64_hdbs (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,HAFDBS ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,HAFDBS ) >=2 ; }static inline bool isar_feature_aa64_tts2uxn (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr1,ID_AA64MMFR1 ,XNX ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR1 ,XNX ) !=0 ; }static inline bool isar_feature_aa64_uao (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,UAO ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,UAO ) !=0 ; }static inline bool isar_feature_aa64_st (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,ST ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,ST ) !=0 ; }static inline bool isar_feature_aa64_lse2 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,AT ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,AT ) !=0 ; }static inline bool isar_feature_aa64_fwb (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,FWB ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,FWB ) !=0 ; }static inline bool isar_feature_aa64_ids (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,IDS ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,IDS ) !=0 ; }static inline bool isar_feature_aa64_half_evt (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,EVT ) >=1 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,EVT ) >=1 ; }static inline bool isar_feature_aa64_evt (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,EVT ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,EVT ) >=2 ; }static inline bool isar_feature_aa64_ccidx (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,CCIDX ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,CCIDX ) !=0 ; }static inline bool isar_feature_aa64_lva (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,VARANGE ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,VARANGE ) !=0 ; }static inline bool isar_feature_aa64_e0pd (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,E0PD ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,E0PD ) !=0 ; }static inline bool isar_feature_aa64_nv (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,NV ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,NV ) !=0 ; }static inline bool isar_feature_aa64_nv2 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64mmfr2,ID_AA64MMFR2 ,NV ) >=2 ; +return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,NV ) >=2 ; }static inline bool isar_feature_aa64_pmuv3p1 (const ARMISARegisters *id)
target/arm/cpu.h +0 -4
@@ -1074,10 +1074,6 @@ struct ArchCPU {uint32_t dbgdidr;uint32_t dbgdevid;uint32_t dbgdevid1; -uint64_t id_aa64mmfr0; -uint64_t id_aa64mmfr1; -uint64_t id_aa64mmfr2; -uint64_t id_aa64mmfr3;uint64_t id_aa64dfr0;uint64_t id_aa64dfr1;uint64_t id_aa64smfr0;
target/arm/cpu64.c +4 -4
@@ -623,12 +623,12 @@ void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp)return ; } - t = cpu->isar.id_aa64mmfr0; + t =GET_IDREG (&cpu->isar,ID_AA64MMFR0 ); t =FIELD_DP64 (t,ID_AA64MMFR0 ,TGRAN16 ,2 );/* 16k pages w/ LPA2 */ t =FIELD_DP64 (t,ID_AA64MMFR0 ,TGRAN4 ,1 );/* 4k pages w/ LPA2 */ t =FIELD_DP64 (t,ID_AA64MMFR0 ,TGRAN16_2 ,3 );/* 16k stage2 w/ LPA2 */ t =FIELD_DP64 (t,ID_AA64MMFR0 ,TGRAN4_2 ,3 );/* 4k stage2 w/ LPA2 */ - cpu->isar.id_aa64mmfr0 = t; +SET_IDREG (&cpu->isar,ID_AA64MMFR0 , t); }static void aarch64_a57_initfn (Object *obj)
@@ -673,7 +673,7 @@ static void aarch64_a57_initfn(Object *obj)SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 ); cpu->isar.id_aa64dfr0 =0x10305106 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 ); - cpu->isar.id_aa64mmfr0 =0x00001124 ; +SET_IDREG (isar,ID_AA64MMFR0 ,0x00001124 ); cpu->isar.dbgdidr =0x3516d000 ; cpu->isar.dbgdevid =0x01110f13 ; cpu->isar.dbgdevid1 =0x2 ;
@@ -735,7 +735,7 @@ static void aarch64_a53_initfn(Object *obj)SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 ); cpu->isar.id_aa64dfr0 =0x10305106 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 ); - cpu->isar.id_aa64mmfr0 =0x00001122 ;/* 40 bit physical addr */ +SET_IDREG (isar,ID_AA64MMFR0 ,0x00001122 );/* 40 bit physical addr */ cpu->isar.dbgdidr =0x3516d000 ; cpu->isar.dbgdevid =0x00110f13 ; cpu->isar.dbgdevid1 =0x1 ;
target/arm/helper.c +4 -4
@@ -8045,22 +8045,22 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64mmfr0 }, + .resetvalue = GET_IDREG(isar, ID_AA64MMFR0)}, { .name = "ID_AA64MMFR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64mmfr1 }, + .resetvalue = GET_IDREG(isar, ID_AA64MMFR1) }, { .name = "ID_AA64MMFR2_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64mmfr2 }, + .resetvalue = GET_IDREG(isar, ID_AA64MMFR2) }, { .name = "ID_AA64MMFR3_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 3, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64mmfr3 }, + .resetvalue = GET_IDREG(isar, ID_AA64MMFR3) }, { .name = "ID_AA64MMFR4_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 4, .access = PL1_R, .type = ARM_CP_CONST,
target/arm/hvf/hvf.c +12 -9
@@ -846,14 +846,17 @@ static uint64_t hvf_get_reg(CPUState *cpu, int rt)return val; } -static void clamp_id_aa64mmfr0_parange_to_ipa_size (uint64_t *id_aa64mmfr0) +static void clamp_id_aa64mmfr0_parange_to_ipa_size (ARMISARegisters *isar) {uint32_t ipa_size = chosen_ipa_bit_size ? chosen_ipa_bit_size :hvf_arm_get_max_ipa_bit_size (); +uint64_t id_aa64mmfr0;/* Clamp down the PARange to the IPA size the kernel supports. */ uint8_t index =round_down_to_parange_index (ipa_size); - *id_aa64mmfr0 = (*id_aa64mmfr0 & ~R_ID_AA64MMFR0_PARANGE_MASK ) | index; + id_aa64mmfr0 =GET_IDREG (isar,ID_AA64MMFR0 ); + id_aa64mmfr0 = (id_aa64mmfr0 & ~R_ID_AA64MMFR0_PARANGE_MASK ) | index; +SET_IDREG (isar,ID_AA64MMFR0 , id_aa64mmfr0); }static bool hvf_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf)
@@ -870,9 +873,9 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) { HV_SYS_REG_ID_AA64ISAR0_EL1, &host_isar.idregs[ID_AA64ISAR0_EL1_IDX] }, { HV_SYS_REG_ID_AA64ISAR1_EL1, &host_isar.idregs[ID_AA64ISAR1_EL1_IDX] },/* Add ID_AA64ISAR2_EL1 here when HVF supports it */ - { HV_SYS_REG_ID_AA64MMFR0_EL1, &host_isar.id_aa64mmfr0 }, - { HV_SYS_REG_ID_AA64MMFR1_EL1, &host_isar.id_aa64mmfr1 }, - { HV_SYS_REG_ID_AA64MMFR2_EL1, &host_isar.id_aa64mmfr2 }, + { HV_SYS_REG_ID_AA64MMFR0_EL1, &host_isar.idregs[ID_AA64MMFR0_EL1_IDX] }, + { HV_SYS_REG_ID_AA64MMFR1_EL1, &host_isar.idregs[ID_AA64MMFR1_EL1_IDX] }, + { HV_SYS_REG_ID_AA64MMFR2_EL1, &host_isar.idregs[ID_AA64MMFR2_EL1_IDX] }, /* Add ID_AA64MMFR3_EL1 here when HVF supports it */ };hv_vcpu_t fd;
@@ -899,7 +902,7 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) r |=hv_vcpu_get_sys_reg (fd,HV_SYS_REG_MIDR_EL1 , &ahcf->midr); r |=hv_vcpu_destroy (fd); -clamp_id_aa64mmfr0_parange_to_ipa_size (&host_isar.id_aa64mmfr0); +clamp_id_aa64mmfr0_parange_to_ipa_size (&host_isar);/* * Disable SME, which is not properly handled by QEMU hvf yet.
@@ -1067,12 +1070,12 @@ int hvf_arch_init_vcpu(CPUState *cpu)/* We're limited to underlying hardware caps, override internal versions */ ret =hv_vcpu_get_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64MMFR0_EL1 , - &arm_cpu->isar.id_aa64mmfr0); + &arm_cpu->isar.idregs[ID_AA64MMFR0_EL1_IDX ]);assert_hvf_ok (ret); -clamp_id_aa64mmfr0_parange_to_ipa_size (&arm_cpu->isar.id_aa64mmfr0); +clamp_id_aa64mmfr0_parange_to_ipa_size (&arm_cpu->isar); ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64MMFR0_EL1 , - arm_cpu->isar.id_aa64mmfr0); + arm_cpu->isar.idregs[ID_AA64MMFR0_EL1_IDX ]);assert_hvf_ok (ret);return 0 ;
target/arm/kvm.c +4 -8
@@ -323,14 +323,10 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR0_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR1_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR2_EL1_IDX ); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64mmfr0, -ARM64_SYS_REG (3 ,0 ,0 ,7 ,0 )); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64mmfr1, -ARM64_SYS_REG (3 ,0 ,0 ,7 ,1 )); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64mmfr2, -ARM64_SYS_REG (3 ,0 ,0 ,7 ,2 )); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64mmfr3, -ARM64_SYS_REG (3 ,0 ,0 ,7 ,3 )); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64MMFR0_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64MMFR1_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64MMFR2_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64MMFR3_EL1_IDX );/* * Note that if AArch32 support is not present in the host,
target/arm/ptw.c +3 -3
@@ -122,7 +122,7 @@ unsigned int arm_pamax(ARMCPU *cpu) {if (arm_feature (&cpu->env,ARM_FEATURE_AARCH64 )) {unsigned int parange = -FIELD_EX64 (cpu->isar.id_aa64mmfr0,ID_AA64MMFR0 ,PARANGE ); +FIELD_EX64_IDREG (&cpu->isar,ID_AA64MMFR0 ,PARANGE );/* * id_aa64mmfr0 is a read-only register so values outside of the
@@ -332,7 +332,7 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress,* physical address size is invalid. */ pps =FIELD_EX64 (gpccr,GPCCR ,PPS ); -if (pps >FIELD_EX64 (cpu->isar.id_aa64mmfr0,ID_AA64MMFR0 ,PARANGE )) { +if (pps >FIELD_EX64_IDREG (&cpu->isar,ID_AA64MMFR0 ,PARANGE )) { goto fault_walk; } pps = pamax_map[pps];
@@ -1703,7 +1703,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,* ID_AA64MMFR0 is a read-only register so values outside of the * supported mappings can be considered an implementation error. */ - ps =FIELD_EX64 (cpu->isar.id_aa64mmfr0,ID_AA64MMFR0 ,PARANGE ); + ps =FIELD_EX64_IDREG (&cpu->isar,ID_AA64MMFR0 ,PARANGE ); ps =MIN (ps, param.ps);assert (ps <ARRAY_SIZE (pamax_map)); outputsize = pamax_map[ps];
target/arm/tcg/cpu64.c +31 -33
145 lines not on this page · raw message
Signature · 1 line
2.49.0
PATCH v7 6/14 arm/cpu: Store aa64dfr0/1 into the idregs array
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
--- target/arm/cpu-features.h | 16 ++++++++-------- target/arm/cpu.c | 15 +++++---------- target/arm/cpu.h | 2 -- target/arm/cpu64.c | 4 ++-- target/arm/helper.c | 4 ++-- target/arm/hvf/hvf.c | 4 ++-- target/arm/internals.h | 6 +++--- target/arm/kvm.c | 12 +++++------- target/arm/tcg/cpu64.c | 32 ++++++++++++++++---------------- 9 files changed, 43 insertions(+), 52 deletions(-)
target/arm/cpu-features.h +8 -8
@@ -900,30 +900,30 @@ static inline bool isar_feature_aa64_nv2(const ARMISARegisters *id)static inline bool isar_feature_aa64_pmuv3p1 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64dfr0,ID_AA64DFR0 ,PMUVER ) >=4 && -FIELD_EX64 (id->id_aa64dfr0,ID_AA64DFR0 ,PMUVER ) !=0xf ; +return FIELD_EX64_IDREG (id,ID_AA64DFR0 ,PMUVER ) >=4 && +FIELD_EX64_IDREG (id,ID_AA64DFR0 ,PMUVER ) !=0xf ; }static inline bool isar_feature_aa64_pmuv3p4 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64dfr0,ID_AA64DFR0 ,PMUVER ) >=5 && -FIELD_EX64 (id->id_aa64dfr0,ID_AA64DFR0 ,PMUVER ) !=0xf ; +return FIELD_EX64_IDREG (id,ID_AA64DFR0 ,PMUVER ) >=5 && +FIELD_EX64_IDREG (id,ID_AA64DFR0 ,PMUVER ) !=0xf ; }static inline bool isar_feature_aa64_pmuv3p5 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64dfr0,ID_AA64DFR0 ,PMUVER ) >=6 && -FIELD_EX64 (id->id_aa64dfr0,ID_AA64DFR0 ,PMUVER ) !=0xf ; +return FIELD_EX64_IDREG (id,ID_AA64DFR0 ,PMUVER ) >=6 && +FIELD_EX64_IDREG (id,ID_AA64DFR0 ,PMUVER ) !=0xf ; }static inline bool isar_feature_aa64_debugv8p2 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64dfr0,ID_AA64DFR0 ,DEBUGVER ) >=8 ; +return FIELD_EX64_IDREG (id,ID_AA64DFR0 ,DEBUGVER ) >=8 ; }static inline bool isar_feature_aa64_doublelock (const ARMISARegisters *id) { -return FIELD_SEX64 (id->id_aa64dfr0,ID_AA64DFR0 ,DOUBLELOCK ) >=0 ; +return FIELD_SEX64_IDREG (id,ID_AA64DFR0 ,DOUBLELOCK ) >=0 ; }static inline bool isar_feature_aa64_sve2 (const ARMISARegisters *id)
target/arm/cpu.c +5 -10
@@ -2354,8 +2354,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) cpu);#endif }else { - cpu->isar.id_aa64dfr0 = -FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,PMUVER ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64DFR0 ,PMUVER ,0 ); cpu->isar.id_dfr0 =FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,PERFMON ,0 ); cpu->pmceid0 =0 ; cpu->pmceid1 =0 ;
@@ -2415,19 +2414,15 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* try to access the non-existent system registers for them. */ /* FEAT_SPE (Statistical Profiling Extension) */ - cpu->isar.id_aa64dfr0 = -FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,PMSVER ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64DFR0 ,PMSVER ,0 );/* FEAT_TRBE (Trace Buffer Extension) */ - cpu->isar.id_aa64dfr0 = -FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,TRACEBUFFER ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64DFR0 ,TRACEBUFFER ,0 );/* FEAT_TRF (Self-hosted Trace Extension) */ - cpu->isar.id_aa64dfr0 = -FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,TRACEFILT ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64DFR0 ,TRACEFILT ,0 ); cpu->isar.id_dfr0 =FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,TRACEFILT ,0 );/* Trace Macrocell system register access */ - cpu->isar.id_aa64dfr0 = -FIELD_DP64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,TRACEVER ,0 ); +FIELD_DP64_IDREG (isar,ID_AA64DFR0 ,TRACEVER ,0 ); cpu->isar.id_dfr0 =FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,COPTRC ,0 );/* Memory mapped trace */
target/arm/cpu.h +0 -2
@@ -1074,8 +1074,6 @@ struct ArchCPU {uint32_t dbgdidr;uint32_t dbgdevid;uint32_t dbgdevid1; -uint64_t id_aa64dfr0; -uint64_t id_aa64dfr1;uint64_t id_aa64smfr0;uint64_t reset_pmcr_el0;uint64_t idregs[NUM_ID_IDX ];
target/arm/cpu64.c +2 -2
@@ -671,7 +671,7 @@ static void aarch64_a57_initfn(Object *obj) cpu->isar.id_isar5 =0x00011121 ; cpu->isar.id_isar6 =0 ;SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 ); - cpu->isar.id_aa64dfr0 =0x10305106 ; +SET_IDREG (isar,ID_AA64DFR0 ,0x10305106 );SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 );SET_IDREG (isar,ID_AA64MMFR0 ,0x00001124 ); cpu->isar.dbgdidr =0x3516d000 ;
@@ -733,7 +733,7 @@ static void aarch64_a53_initfn(Object *obj) cpu->isar.id_isar5 =0x00011121 ; cpu->isar.id_isar6 =0 ;SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 ); - cpu->isar.id_aa64dfr0 =0x10305106 ; +SET_IDREG (isar,ID_AA64DFR0 ,0x10305106 );SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 );SET_IDREG (isar,ID_AA64MMFR0 ,0x00001122 );/* 40 bit physical addr */ cpu->isar.dbgdidr =0x3516d000 ;
target/arm/helper.c +2 -2
@@ -7965,12 +7965,12 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64dfr0 }, + .resetvalue = GET_IDREG(isar, ID_AA64DFR0) }, { .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64dfr1 }, + .resetvalue = GET_IDREG(isar, ID_AA64DFR1) }, { .name = "ID_AA64DFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST,
target/arm/hvf/hvf.c +2 -2
@@ -868,8 +868,8 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) } regs[] = { { HV_SYS_REG_ID_AA64PFR0_EL1, &host_isar.idregs[ID_AA64PFR0_EL1_IDX] }, { HV_SYS_REG_ID_AA64PFR1_EL1, &host_isar.idregs[ID_AA64PFR1_EL1_IDX] }, - { HV_SYS_REG_ID_AA64DFR0_EL1, &host_isar.id_aa64dfr0 }, - { HV_SYS_REG_ID_AA64DFR1_EL1, &host_isar.id_aa64dfr1 }, + { HV_SYS_REG_ID_AA64DFR0_EL1, &host_isar.idregs[ID_AA64DFR0_EL1_IDX] }, + { HV_SYS_REG_ID_AA64DFR1_EL1, &host_isar.idregs[ID_AA64DFR1_EL1_IDX] }, { HV_SYS_REG_ID_AA64ISAR0_EL1, &host_isar.idregs[ID_AA64ISAR0_EL1_IDX] }, { HV_SYS_REG_ID_AA64ISAR1_EL1, &host_isar.idregs[ID_AA64ISAR1_EL1_IDX] }, /* Add ID_AA64ISAR2_EL1 here when HVF supports it */
target/arm/internals.h +3 -3
@@ -1176,7 +1176,7 @@ static inline bool regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx)static inline int arm_num_brps (ARMCPU *cpu) {if (arm_feature (&cpu->env,ARM_FEATURE_AARCH64 )) { -return FIELD_EX64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,BRPS ) +1 ; +return FIELD_EX64_IDREG (&cpu->isar,ID_AA64DFR0 ,BRPS ) +1 ; }else {return FIELD_EX32 (cpu->isar.dbgdidr,DBGDIDR ,BRPS ) +1 ; }
@@ -1190,7 +1190,7 @@ static inline int arm_num_brps(ARMCPU *cpu)static inline int arm_num_wrps (ARMCPU *cpu) {if (arm_feature (&cpu->env,ARM_FEATURE_AARCH64 )) { -return FIELD_EX64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,WRPS ) +1 ; +return FIELD_EX64_IDREG (&cpu->isar,ID_AA64DFR0 ,WRPS ) +1 ; }else {return FIELD_EX32 (cpu->isar.dbgdidr,DBGDIDR ,WRPS ) +1 ; }
@@ -1204,7 +1204,7 @@ static inline int arm_num_wrps(ARMCPU *cpu)static inline int arm_num_ctx_cmps (ARMCPU *cpu) {if (arm_feature (&cpu->env,ARM_FEATURE_AARCH64 )) { -return FIELD_EX64 (cpu->isar.id_aa64dfr0,ID_AA64DFR0 ,CTX_CMPS ) +1 ; +return FIELD_EX64_IDREG (&cpu->isar,ID_AA64DFR0 ,CTX_CMPS ) +1 ; }else {return FIELD_EX32 (cpu->isar.dbgdidr,DBGDIDR ,CTX_CMPS ) +1 ; }
target/arm/kvm.c +5 -7
@@ -316,10 +316,8 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) err |=get_host_cpu_reg (fd, ahcf,ID_AA64PFR1_EL1_IDX ); err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64smfr0,ARM64_SYS_REG (3 ,0 ,0 ,4 ,5 )); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64dfr0, -ARM64_SYS_REG (3 ,0 ,0 ,5 ,0 )); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64dfr1, -ARM64_SYS_REG (3 ,0 ,0 ,5 ,1 )); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64DFR0_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64DFR1_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR0_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR1_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR2_EL1_IDX );
@@ -390,10 +388,10 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)* We only do this if the CPU supports AArch32 at EL1. */ if (FIELD_EX32_IDREG (&ahcf->isar,ID_AA64PFR0 ,EL1 ) >=2 ) { -int wrps =FIELD_EX64 (&ahcf->isar.id_aa64dfr0,ID_AA64DFR0 ,WRPS ); -int brps =FIELD_EX64 (&ahcf->isar.id_aa64dfr0,ID_AA64DFR0 ,BRPS ); +int wrps =FIELD_EX64_IDREG (&ahcf->isar,ID_AA64DFR0 ,WRPS ); +int brps =FIELD_EX64_IDREG (&ahcf->isar,ID_AA64DFR0 ,BRPS );int ctx_cmps = -FIELD_EX64 (&ahcf->isar.id_aa64dfr0,ID_AA64DFR0 ,CTX_CMPS ); +FIELD_EX64_IDREG (&ahcf->isar,ID_AA64DFR0 ,CTX_CMPS );int version =6 ;/* ARMv8 debug architecture */ bool has_el3 = !!FIELD_EX32_IDREG (&ahcf->isar,ID_AA64PFR0 ,EL3 );
target/arm/tcg/cpu64.c +16 -16
@@ -65,8 +65,8 @@ static void aarch64_a35_initfn(Object *obj) cpu->isar.id_isar5 =0x00011121 ;SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 );SET_IDREG (isar,ID_AA64PFR1 ,0 ); - cpu->isar.id_aa64dfr0 =0x10305106 ; - cpu->isar.id_aa64dfr1 =0 ; +SET_IDREG (isar,ID_AA64DFR0 ,0x10305106 ); +SET_IDREG (isar,ID_AA64DFR1 ,0 );SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 );SET_IDREG (isar,ID_AA64ISAR1 ,0 );SET_IDREG (isar,ID_AA64MMFR0 ,0x00101122 );
@@ -219,7 +219,7 @@ static void aarch64_a55_initfn(Object *obj) cpu->clidr =0x82000023 ; cpu->ctr =0x84448004 ;/* L1Ip = VIPT */ cpu->dcz_blocksize =4 ;/* 64 bytes */ - cpu->isar.id_aa64dfr0 =0x0000000010305408ull ; +SET_IDREG (isar,ID_AA64DFR0 ,0x0000000010305408ull );SET_IDREG (isar,ID_AA64ISAR0 ,0x0000100010211120ull );SET_IDREG (isar,ID_AA64ISAR1 ,0x0000000000100001ull );SET_IDREG (isar,ID_AA64MMFR0 ,0x0000000000101122ull );
@@ -310,7 +310,7 @@ static void aarch64_a72_initfn(Object *obj) cpu->isar.id_isar4 =0x00011142 ; cpu->isar.id_isar5 =0x00011121 ;SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 ); - cpu->isar.id_aa64dfr0 =0x10305106 ; +SET_IDREG (isar,ID_AA64DFR0 ,0x10305106 );SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 );SET_IDREG (isar,ID_AA64MMFR0 ,0x00001124 ); cpu->isar.dbgdidr =0x3516d000 ;
@@ -352,7 +352,7 @@ static void aarch64_a76_initfn(Object *obj) cpu->clidr =0x82000023 ; cpu->ctr =0x8444C004 ; cpu->dcz_blocksize =4 ; - cpu->isar.id_aa64dfr0 =0x0000000010305408ull ; +SET_IDREG (isar,ID_AA64DFR0 ,0x0000000010305408ull ),SET_IDREG (isar,ID_AA64ISAR0 ,0x0000100010211120ull );SET_IDREG (isar,ID_AA64ISAR1 ,0x0000000000100001ull );SET_IDREG (isar,ID_AA64MMFR0 ,0x0000000000101122ull );
@@ -426,8 +426,8 @@ static void aarch64_a64fx_initfn(Object *obj) cpu->reset_sctlr =0x30000180 ;SET_IDREG (isar,ID_AA64PFR0 ,0x0000000101111111 );/* No RAS Extensions */ SET_IDREG (isar,ID_AA64PFR1 ,0x0000000000000000 ); - cpu->isar.id_aa64dfr0 =0x0000000010305408 ; - cpu->isar.id_aa64dfr1 =0x0000000000000000 ; +SET_IDREG (isar,ID_AA64DFR0 ,0x0000000010305408 ), +SET_IDREG (isar,ID_AA64DFR1 ,0x0000000000000000 ), cpu->id_aa64afr0 =0x0000000000000000 ; cpu->id_aa64afr1 =0x0000000000000000 ;SET_IDREG (isar,ID_AA64MMFR0 ,0x0000000000001122 );
@@ -600,7 +600,7 @@ static void aarch64_neoverse_n1_initfn(Object *obj) cpu->clidr =0x82000023 ; cpu->ctr =0x8444c004 ; cpu->dcz_blocksize =4 ; - cpu->isar.id_aa64dfr0 =0x0000000110305408ull ; +SET_IDREG (isar,ID_AA64DFR0 ,0x0000000110305408ull );SET_IDREG (isar,ID_AA64ISAR0 ,0x0000100010211120ull );SET_IDREG (isar,ID_AA64ISAR1 ,0x0000000000100001ull );SET_IDREG (isar,ID_AA64MMFR0 ,0x0000000000101125ull );
@@ -678,8 +678,8 @@ static void aarch64_neoverse_v1_initfn(Object *obj) cpu->dcz_blocksize =4 ; cpu->id_aa64afr0 =0x00000000 ; cpu->id_aa64afr1 =0x00000000 ; - cpu->isar.id_aa64dfr0 =0x000001f210305519ull ; - cpu->isar.id_aa64dfr1 =0x00000000 ; +SET_IDREG (isar,ID_AA64DFR0 ,0x000001f210305519ull ), +SET_IDREG (isar,ID_AA64DFR1 ,0x00000000 ),SET_IDREG (isar,ID_AA64ISAR0 ,0x1011111110212120ull );/* with FEAT_RNG */ SET_IDREG (isar,ID_AA64ISAR1 ,0x0011000001211032ull );SET_IDREG (isar,ID_AA64MMFR0 ,0x0000000000101125ull );
@@ -925,8 +925,8 @@ static void aarch64_a710_initfn(Object *obj)SET_IDREG (isar,ID_AA64PFR0 ,0x1201111120111112ull );/* GIC filled in later */ SET_IDREG (isar,ID_AA64PFR1 ,0x0000000000000221ull );SET_IDREG (isar,ID_AA64ZFR0 ,0x0000110100110021ull );/* with Crypto */ - cpu->isar.id_aa64dfr0 =0x000011f010305619ull ; - cpu->isar.id_aa64dfr1 =0 ; +SET_IDREG (isar,ID_AA64DFR0 ,0x000011f010305619ull ); +SET_IDREG (isar,ID_AA64DFR1 ,0 ); cpu->id_aa64afr0 =0 ; cpu->id_aa64afr1 =0 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x0221111110212120ull );/* with Crypto */
@@ -1027,8 +1027,8 @@ static void aarch64_neoverse_n2_initfn(Object *obj)SET_IDREG (isar,ID_AA64PFR0 ,0x1201111120111112ull );/* GIC filled in later */ SET_IDREG (isar,ID_AA64PFR1 ,0x0000000000000221ull );SET_IDREG (isar,ID_AA64ZFR0 ,0x0000110100110021ull );/* with Crypto */ - cpu->isar.id_aa64dfr0 =0x000011f210305619ull ; - cpu->isar.id_aa64dfr1 =0 ; +SET_IDREG (isar,ID_AA64DFR0 ,0x000011f210305619ull ); +SET_IDREG (isar,ID_AA64DFR1 ,0 ); cpu->id_aa64afr0 =0 ; cpu->id_aa64afr1 =0 ;SET_IDREG (isar,ID_AA64ISAR0 ,0x1221111110212120ull );/* with Crypto and FEAT_RNG */
@@ -1261,11 +1261,11 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64ZFR0 ,F64MM ,1 );/* FEAT_F64MM */ SET_IDREG (isar,ID_AA64ZFR0 , t); - t = cpu->isar.id_aa64dfr0; + t =GET_IDREG (isar,ID_AA64DFR0 ); t =FIELD_DP64 (t,ID_AA64DFR0 ,DEBUGVER ,10 );/* FEAT_Debugv8p8 */ t =FIELD_DP64 (t,ID_AA64DFR0 ,PMUVER ,6 );/* FEAT_PMUv3p5 */ t =FIELD_DP64 (t,ID_AA64DFR0 ,HPMN0 ,1 );/* FEAT_HPMN0 */ - cpu->isar.id_aa64dfr0 = t; +SET_IDREG (isar,ID_AA64DFR0 , t); t = cpu->isar.id_aa64smfr0; t =FIELD_DP64 (t,ID_AA64SMFR0 ,F32F32 ,1 );/* FEAT_SME */
Signature · 1 line
2.49.0
PATCH v7 7/14 arm/cpu: Store aa64smfr0 into the idregs array
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
--- target/arm/cpu-features.h | 6 +++--- target/arm/cpu.h | 1 - target/arm/cpu64.c | 7 ++----- target/arm/helper.c | 2 +- target/arm/kvm.c | 3 +-- target/arm/tcg/cpu64.c | 4 ++-- 6 files changed, 9 insertions(+), 14 deletions(-)
target/arm/cpu-features.h +3 -3
@@ -978,17 +978,17 @@ static inline bool isar_feature_aa64_sve_f64mm(const ARMISARegisters *id)static inline bool isar_feature_aa64_sme_f64f64 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64smfr0,ID_AA64SMFR0 ,F64F64 ); +return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,F64F64 ); }static inline bool isar_feature_aa64_sme_i16i64 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64smfr0,ID_AA64SMFR0 ,I16I64 ) ==0xf ; +return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,I16I64 ) ==0xf ; }static inline bool isar_feature_aa64_sme_fa64 (const ARMISARegisters *id) { -return FIELD_EX64 (id->id_aa64smfr0,ID_AA64SMFR0 ,FA64 ); +return FIELD_EX64_IDREG (id,ID_AA64SMFR0 ,FA64 ); }/*
target/arm/cpu.h +0 -1
@@ -1074,7 +1074,6 @@ struct ArchCPU {uint32_t dbgdidr;uint32_t dbgdevid;uint32_t dbgdevid1; -uint64_t id_aa64smfr0;uint64_t reset_pmcr_el0;uint64_t idregs[NUM_ID_IDX ]; } isar;
target/arm/cpu64.c +2 -5
@@ -328,7 +328,7 @@ void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp)if (vq_map ==0 ) {if (!cpu_isar_feature (aa64_sme, cpu)) { - cpu->isar.id_aa64smfr0 =0 ; +SET_IDREG (&cpu->isar,ID_AA64SMFR0 ,0 );return ; }
@@ -381,11 +381,8 @@ static bool cpu_arm_get_sme_fa64(Object *obj, Error **errp)static void cpu_arm_set_sme_fa64 (Object *obj,bool value,Error **errp) {ARMCPU *cpu =ARM_CPU (obj); -uint64_t t; - t = cpu->isar.id_aa64smfr0; - t =FIELD_DP64 (t,ID_AA64SMFR0 ,FA64 , value); - cpu->isar.id_aa64smfr0 = t; +FIELD_DP64_IDREG (&cpu->isar,ID_AA64SMFR0 ,FA64 , value); }#ifdef CONFIG_USER_ONLY
target/arm/helper.c +1 -1
@@ -7950,7 +7950,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 5, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_aa64smfr0 }, + .resetvalue = GET_IDREG(isar, ID_AA64SMFR0)}, { .name = "ID_AA64PFR6_EL1_RESERVED", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 6, .access = PL1_R, .type = ARM_CP_CONST,
target/arm/kvm.c +1 -2
@@ -314,8 +314,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) err =0 ; }else { err |=get_host_cpu_reg (fd, ahcf,ID_AA64PFR1_EL1_IDX ); - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.id_aa64smfr0, -ARM64_SYS_REG (3 ,0 ,0 ,4 ,5 )); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64SMFR0_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64DFR0_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64DFR1_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64ISAR0_EL1_IDX );
target/arm/tcg/cpu64.c +2 -2
@@ -1267,7 +1267,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64DFR0 ,HPMN0 ,1 );/* FEAT_HPMN0 */ SET_IDREG (isar,ID_AA64DFR0 , t); - t = cpu->isar.id_aa64smfr0; + t =GET_IDREG (isar,ID_AA64SMFR0 ); t =FIELD_DP64 (t,ID_AA64SMFR0 ,F32F32 ,1 );/* FEAT_SME */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,B16F32 ,1 );/* FEAT_SME */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,F16F32 ,1 );/* FEAT_SME */
@@ -1275,7 +1275,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64SMFR0 ,F64F64 ,1 );/* FEAT_SME_F64F64 */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,I16I64 ,0xf );/* FEAT_SME_I16I64 */ t =FIELD_DP64 (t,ID_AA64SMFR0 ,FA64 ,1 );/* FEAT_SME_FA64 */ - cpu->isar.id_aa64smfr0 = t; +SET_IDREG (isar,ID_AA64SMFR0 , t);/* Replicate the same data to the 32-bit id registers. */ aa32_max_features (cpu);
Signature · 1 line
2.49.0
PATCH v7 8/14 arm/cpu: Store id_isar0-7 into the idregs array
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
--- hw/intc/armv7m_nvic.c | 12 ++-- target/arm/cpu-features.h | 36 +++++----- target/arm/cpu.c | 24 +++---- target/arm/cpu.h | 7 -- target/arm/cpu64.c | 28 ++++---- target/arm/helper.c | 14 ++-- target/arm/kvm.c | 21 ++---- target/arm/tcg/cpu-v7m.c | 90 +++++++++++++----------- target/arm/tcg/cpu32.c | 144 +++++++++++++++++++++----------------- target/arm/tcg/cpu64.c | 108 ++++++++++++++-------------- 10 files changed, 243 insertions(+), 241 deletions(-)
hw/intc/armv7m_nvic.c +6 -6
@@ -1303,32 +1303,32 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_isar0; +return GET_IDREG (&cpu->isar,ID_ISAR0 );case 0xd64 :/* ISAR1. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_isar1; +return GET_IDREG (&cpu->isar,ID_ISAR1 );case 0xd68 :/* ISAR2. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_isar2; +return GET_IDREG (&cpu->isar,ID_ISAR2 );case 0xd6c :/* ISAR3. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_isar3; +return GET_IDREG (&cpu->isar,ID_ISAR3 );case 0xd70 :/* ISAR4. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_isar4; +return GET_IDREG (&cpu->isar,ID_ISAR4 );case 0xd74 :/* ISAR5. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_isar5; +return GET_IDREG (&cpu->isar,ID_ISAR5 );case 0xd78 :/* CLIDR */ return cpu->clidr;case 0xd7c :/* CTR */
target/arm/cpu-features.h +18 -18
@@ -45,93 +45,93 @@*/ static inline bool isar_feature_aa32_thumb_div (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar0,ID_ISAR0 ,DIVIDE ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR0 ,DIVIDE ) !=0 ; }static inline bool isar_feature_aa32_arm_div (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar0,ID_ISAR0 ,DIVIDE ) >1 ; +return FIELD_EX32_IDREG (id,ID_ISAR0 ,DIVIDE ) >1 ; }static inline bool isar_feature_aa32_lob (const ARMISARegisters *id) {/* (M-profile) low-overhead loops and branch future */ -return FIELD_EX32 (id->id_isar0,ID_ISAR0 ,CMPBRANCH ) >=3 ; +return FIELD_EX32_IDREG (id,ID_ISAR0 ,CMPBRANCH ) >=3 ; }static inline bool isar_feature_aa32_jazelle (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar1,ID_ISAR1 ,JAZELLE ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR1 ,JAZELLE ) !=0 ; }static inline bool isar_feature_aa32_aes (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,AES ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR5 ,AES ) !=0 ; }static inline bool isar_feature_aa32_pmull (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,AES ) >1 ; +return FIELD_EX32_IDREG (id,ID_ISAR5 ,AES ) >1 ; }static inline bool isar_feature_aa32_sha1 (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,SHA1 ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR5 ,SHA1 ) !=0 ; }static inline bool isar_feature_aa32_sha2 (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,SHA2 ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR5 ,SHA2 ) !=0 ; }static inline bool isar_feature_aa32_crc32 (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,CRC32 ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR5 ,CRC32 ) !=0 ; }static inline bool isar_feature_aa32_rdm (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,RDM ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR5 ,RDM ) !=0 ; }static inline bool isar_feature_aa32_vcma (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar5,ID_ISAR5 ,VCMA ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR5 ,VCMA ) !=0 ; }static inline bool isar_feature_aa32_jscvt (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar6,ID_ISAR6 ,JSCVT ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR6 ,JSCVT ) !=0 ; }static inline bool isar_feature_aa32_dp (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar6,ID_ISAR6 ,DP ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR6 ,DP ) !=0 ; }static inline bool isar_feature_aa32_fhm (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar6,ID_ISAR6 ,FHM ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR6 ,FHM ) !=0 ; }static inline bool isar_feature_aa32_sb (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar6,ID_ISAR6 ,SB ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR6 ,SB ) !=0 ; }static inline bool isar_feature_aa32_predinv (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar6,ID_ISAR6 ,SPECRES ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR6 ,SPECRES ) !=0 ; }static inline bool isar_feature_aa32_bf16 (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar6,ID_ISAR6 ,BF16 ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR6 ,BF16 ) !=0 ; }static inline bool isar_feature_aa32_i8mm (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_isar6,ID_ISAR6 ,I8MM ) !=0 ; +return FIELD_EX32_IDREG (id,ID_ISAR6 ,I8MM ) !=0 ; }static inline bool isar_feature_aa32_ras (const ARMISARegisters *id)
target/arm/cpu.c +11 -13
@@ -2133,10 +2133,10 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,FP ,0xf ); - u = cpu->isar.id_isar6; + u =GET_IDREG (isar,ID_ISAR6 ); u =FIELD_DP32 (u,ID_ISAR6 ,JSCVT ,0 ); u =FIELD_DP32 (u,ID_ISAR6 ,BF16 ,0 ); - cpu->isar.id_isar6 = u; +SET_IDREG (isar,ID_ISAR6 , u); u = cpu->isar.mvfr0; u =FIELD_DP32 (u,MVFR0 ,FPSP ,0 );
@@ -2188,20 +2188,20 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,ADVSIMD ,0xf ); - u = cpu->isar.id_isar5; + u =GET_IDREG (isar,ID_ISAR5 ); u =FIELD_DP32 (u,ID_ISAR5 ,AES ,0 ); u =FIELD_DP32 (u,ID_ISAR5 ,SHA1 ,0 ); u =FIELD_DP32 (u,ID_ISAR5 ,SHA2 ,0 ); u =FIELD_DP32 (u,ID_ISAR5 ,RDM ,0 ); u =FIELD_DP32 (u,ID_ISAR5 ,VCMA ,0 ); - cpu->isar.id_isar5 = u; +SET_IDREG (isar,ID_ISAR5 , u); - u = cpu->isar.id_isar6; + u =GET_IDREG (isar,ID_ISAR6 ); u =FIELD_DP32 (u,ID_ISAR6 ,DP ,0 ); u =FIELD_DP32 (u,ID_ISAR6 ,FHM ,0 ); u =FIELD_DP32 (u,ID_ISAR6 ,BF16 ,0 ); u =FIELD_DP32 (u,ID_ISAR6 ,I8MM ,0 ); - cpu->isar.id_isar6 = u; +SET_IDREG (isar,ID_ISAR6 , u);if (!arm_feature (env,ARM_FEATURE_M )) { u = cpu->isar.mvfr1;
@@ -2239,19 +2239,17 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)unset_feature (env,ARM_FEATURE_THUMB_DSP ); - u = cpu->isar.id_isar1; - u =FIELD_DP32 (u,ID_ISAR1 ,EXTEND ,1 ); - cpu->isar.id_isar1 = u; +FIELD_DP32_IDREG (isar,ID_ISAR1 ,EXTEND ,1 ); - u = cpu->isar.id_isar2; + u =GET_IDREG (isar,ID_ISAR2 ); u =FIELD_DP32 (u,ID_ISAR2 ,MULTU ,1 ); u =FIELD_DP32 (u,ID_ISAR2 ,MULTS ,1 ); - cpu->isar.id_isar2 = u; +SET_IDREG (isar,ID_ISAR2 , u); - u = cpu->isar.id_isar3; + u =GET_IDREG (isar,ID_ISAR3 ); u =FIELD_DP32 (u,ID_ISAR3 ,SIMD ,1 ); u =FIELD_DP32 (u,ID_ISAR3 ,SATURATE ,0 ); - cpu->isar.id_isar3 = u; +SET_IDREG (isar,ID_ISAR3 , u); }
target/arm/cpu.h +0 -7
@@ -1050,13 +1050,6 @@ struct ArchCPU {* field by reading the value from the KVM vCPU. */ struct ARMISARegisters { -uint32_t id_isar0; -uint32_t id_isar1; -uint32_t id_isar2; -uint32_t id_isar3; -uint32_t id_isar4; -uint32_t id_isar5; -uint32_t id_isar6;uint32_t id_mmfr0;uint32_t id_mmfr1;uint32_t id_mmfr2;
target/arm/cpu64.c +14 -14
@@ -660,13 +660,13 @@ static void aarch64_a57_initfn(Object *obj) cpu->isar.id_mmfr1 =0x40000000 ; cpu->isar.id_mmfr2 =0x01260000 ; cpu->isar.id_mmfr3 =0x02102211 ; - cpu->isar.id_isar0 =0x02101110 ; - cpu->isar.id_isar1 =0x13112111 ; - cpu->isar.id_isar2 =0x21232042 ; - cpu->isar.id_isar3 =0x01112131 ; - cpu->isar.id_isar4 =0x00011142 ; - cpu->isar.id_isar5 =0x00011121 ; - cpu->isar.id_isar6 =0 ; +SET_IDREG (isar,ID_ISAR0 ,0x02101110 ); +SET_IDREG (isar,ID_ISAR1 ,0x13112111 ); +SET_IDREG (isar,ID_ISAR2 ,0x21232042 ); +SET_IDREG (isar,ID_ISAR3 ,0x01112131 ); +SET_IDREG (isar,ID_ISAR4 ,0x00011142 ); +SET_IDREG (isar,ID_ISAR5 ,0x00011121 ); +SET_IDREG (isar,ID_ISAR6 ,0 );SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 );SET_IDREG (isar,ID_AA64DFR0 ,0x10305106 );SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 );
@@ -722,13 +722,13 @@ static void aarch64_a53_initfn(Object *obj) cpu->isar.id_mmfr1 =0x40000000 ; cpu->isar.id_mmfr2 =0x01260000 ; cpu->isar.id_mmfr3 =0x02102211 ; - cpu->isar.id_isar0 =0x02101110 ; - cpu->isar.id_isar1 =0x13112111 ; - cpu->isar.id_isar2 =0x21232042 ; - cpu->isar.id_isar3 =0x01112131 ; - cpu->isar.id_isar4 =0x00011142 ; - cpu->isar.id_isar5 =0x00011121 ; - cpu->isar.id_isar6 =0 ; +SET_IDREG (isar,ID_ISAR0 ,0x02101110 ); +SET_IDREG (isar,ID_ISAR1 ,0x13112111 ); +SET_IDREG (isar,ID_ISAR2 ,0x21232042 ); +SET_IDREG (isar,ID_ISAR3 ,0x01112131 ); +SET_IDREG (isar,ID_ISAR4 ,0x00011142 ); +SET_IDREG (isar,ID_ISAR5 ,0x00011121 ); +SET_IDREG (isar,ID_ISAR6 ,0 );SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 );SET_IDREG (isar,ID_AA64DFR0 ,0x10305106 );SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 );
target/arm/helper.c +7 -7
@@ -7832,32 +7832,32 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_isar0 }, + .resetvalue = GET_IDREG(isar, ID_ISAR0)}, { .name = "ID_ISAR1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_isar1 }, + .resetvalue = GET_IDREG(isar, ID_ISAR1)}, { .name = "ID_ISAR2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_isar2 }, + .resetvalue = GET_IDREG(isar, ID_ISAR2)}, { .name = "ID_ISAR3", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 3, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_isar3 }, + .resetvalue = GET_IDREG(isar, ID_ISAR3) }, { .name = "ID_ISAR4", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 4, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_isar4 }, + .resetvalue = GET_IDREG(isar, ID_ISAR4) }, { .name = "ID_ISAR5", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 5, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_isar5 }, + .resetvalue = GET_IDREG(isar, ID_ISAR5) }, { .name = "ID_MMFR4", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6, .access = PL1_R, .type = ARM_CP_CONST,
@@ -7867,7 +7867,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_isar6 }, + .resetvalue = GET_IDREG(isar, ID_ISAR6) }, };define_arm_cp_regs (cpu, v6_idregs);define_arm_cp_regs (cpu, v6_cp_reginfo);
target/arm/kvm.c +7 -14
@@ -346,22 +346,15 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ARM64_SYS_REG(3, 0, 0, 1, 6)); err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr3,ARM64_SYS_REG (3 ,0 ,0 ,1 ,7 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_isar0, -ARM64_SYS_REG (3 ,0 ,0 ,2 ,0 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_isar1, -ARM64_SYS_REG (3 ,0 ,0 ,2 ,1 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_isar2, -ARM64_SYS_REG (3 ,0 ,0 ,2 ,2 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_isar3, -ARM64_SYS_REG (3 ,0 ,0 ,2 ,3 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_isar4, -ARM64_SYS_REG (3 ,0 ,0 ,2 ,4 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_isar5, -ARM64_SYS_REG (3 ,0 ,0 ,2 ,5 )); + err |=get_host_cpu_reg (fd, ahcf,ID_ISAR0_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_ISAR1_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_ISAR2_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_ISAR3_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_ISAR4_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_ISAR5_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_ISAR6_EL1_IDX ); err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr4,ARM64_SYS_REG (3 ,0 ,0 ,2 ,6 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_isar6, -ARM64_SYS_REG (3 ,0 ,0 ,2 ,7 )); err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.mvfr0,ARM64_SYS_REG (3 ,0 ,0 ,3 ,0 ));
target/arm/tcg/cpu-v7m.c +48 -42
158 lines not on this page · raw message
target/arm/tcg/cpu32.c +78 -66
309 lines not on this page · raw message
target/arm/tcg/cpu64.c +54 -54
158 lines not on this page · raw message
Signature · 1 line
2.49.0
Re: [PATCH v7 08/14] arm/cpu: Store id_isar0-7 into the idregs array
Quoted 7 lines · Cornelia Huck
From: Eric Auger <[email protected]>
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Sebastian Ott <[email protected]>Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>
Quoted 12 lines
--- hw/intc/armv7m_nvic.c | 12 ++-- target/arm/cpu-features.h | 36 +++++----- target/arm/cpu.c | 24 +++---- target/arm/cpu.h | 7 -- target/arm/cpu64.c | 28 ++++---- target/arm/helper.c | 14 ++-- target/arm/kvm.c | 21 ++---- target/arm/tcg/cpu-v7m.c | 90 +++++++++++++----------- target/arm/tcg/cpu32.c | 144 +++++++++++++++++++++----------------- target/arm/tcg/cpu64.c | 108 ++++++++++++++-------------- 10 files changed, 243 insertions(+), 241 deletions(-)
This doesn't compile:
../../target/arm/tcg/cpu-v7m.c:70:5: error: incompatible pointer types initializing 'ARMISARe
gisters *' (aka 'struct ARMISARegisters *') with an expression of type 'uint64_t *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]
70 | SET_IDREG(idregs, ID_ISAR0, 0x01141110);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~../../target/arm/cpu.h:875:26: note: expanded from macro 'SET_IDREG'
875 | ARMISARegisters *i_ = (ISAR);
\
| ^ ~~~~~~../../target/arm/tcg/cpu-v7m.c:71:5: error: incompatible pointer types initializing 'ARMISARegisters *' (aka 'struct ARMISARegisters *') with an expression of type 'uint64_t *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]
71 | SET_IDREG(idregs, ID_ISAR1, 0x02111000);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~../../target/arm/cpu.h:875:26: note: expanded from macro 'SET_IDREG'
875 | ARMISARegisters *i_ = (ISAR);
\
| ^ ~~~~~~
(and more similar errors until the compiler gives up).
-- PMM
Re: [PATCH v7 08/14] arm/cpu: Store id_isar0-7 into the idregs array
Quoted 38 lines · Peter Maydell
Quoted 7 lines · Cornelia Huck
From: Eric Auger <[email protected]>
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Sebastian Ott <[email protected]>Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>Quoted 12 lines
--- hw/intc/armv7m_nvic.c | 12 ++-- target/arm/cpu-features.h | 36 +++++----- target/arm/cpu.c | 24 +++---- target/arm/cpu.h | 7 -- target/arm/cpu64.c | 28 ++++---- target/arm/helper.c | 14 ++-- target/arm/kvm.c | 21 ++---- target/arm/tcg/cpu-v7m.c | 90 +++++++++++++----------- target/arm/tcg/cpu32.c | 144 +++++++++++++++++++++----------------- target/arm/tcg/cpu64.c | 108 ++++++++++++++-------------- 10 files changed, 243 insertions(+), 241 deletions(-)This doesn't compile:
../../target/arm/tcg/cpu-v7m.c:70:5: error: incompatible pointer types initializing 'ARMISARe
gisters *' (aka 'struct ARMISARegisters *') with an expression of type 'uint64_t*' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]70 | SET_IDREG(idregs, ID_ISAR0, 0x01141110); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../target/arm/cpu.h:875:26: note: expanded from macro 'SET_IDREG'
875 | ARMISARegisters *i_ = (ISAR);
\
| ^ ~~~~~~../../target/arm/tcg/cpu-v7m.c:71:5: error: incompatible pointer types initializing 'ARMISARegisters *' (aka 'struct ARMISARegisters *') with an expression of type 'uint64_t*' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]
Quoted 8 lines
71 | SET_IDREG(idregs, ID_ISAR1, 0x02111000); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../target/arm/cpu.h:875:26: note: expanded from macro 'SET_IDREG'
875 | ARMISARegisters *i_ = (ISAR);
\
| ^ ~~~~~~(and more similar errors until the compiler gives up).
What configs/compiler are you using? I obviously would have fixed that if I had hit it...
Re: [PATCH v7 08/14] arm/cpu: Store id_isar0-7 into the idregs array
Quoted 48 lines · Cornelia Huck
Quoted 45 lines · Peter Maydell
Quoted 7 lines · Cornelia Huck
From: Eric Auger <[email protected]>
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Sebastian Ott <[email protected]>Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>Quoted 12 lines
--- hw/intc/armv7m_nvic.c | 12 ++-- target/arm/cpu-features.h | 36 +++++----- target/arm/cpu.c | 24 +++---- target/arm/cpu.h | 7 -- target/arm/cpu64.c | 28 ++++---- target/arm/helper.c | 14 ++-- target/arm/kvm.c | 21 ++---- target/arm/tcg/cpu-v7m.c | 90 +++++++++++++----------- target/arm/tcg/cpu32.c | 144 +++++++++++++++++++++----------------- target/arm/tcg/cpu64.c | 108 ++++++++++++++-------------- 10 files changed, 243 insertions(+), 241 deletions(-)This doesn't compile:
../../target/arm/tcg/cpu-v7m.c:70:5: error: incompatible pointer types initializing 'ARMISARe
gisters *' (aka 'struct ARMISARegisters *') with an expression of type 'uint64_t*' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]70 | SET_IDREG(idregs, ID_ISAR0, 0x01141110); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../target/arm/cpu.h:875:26: note: expanded from macro 'SET_IDREG'
875 | ARMISARegisters *i_ = (ISAR);
\
| ^ ~~~~~~../../target/arm/tcg/cpu-v7m.c:71:5: error: incompatible pointer types initializing 'ARMISARegisters *' (aka 'struct ARMISARegisters *') with an expression of type 'uint64_t*' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]71 | SET_IDREG(idregs, ID_ISAR1, 0x02111000); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../target/arm/cpu.h:875:26: note: expanded from macro 'SET_IDREG'
875 | ARMISARegisters *i_ = (ISAR);
\
| ^ ~~~~~~
Quoted 4 lines
Quoted 1 line
(and more similar errors until the compiler gives up).
What configs/compiler are you using? I obviously would have fixed that if I had hit it...
This is clang 18.1.3 (1ubuntu1) on x86-64 Linux, configured with
'../../configure' '--cc=clang' '--cxx=clang++' '--enable-ubsan' '--target-list=arm-softmmu,arm-linux-user,aarch64-softmmu,aarch64-linux-user'
Whatever the problem is, it goes away on a later patch, so probably it's just that some fragment in a later patch needs to move into this one.
thanks
-- PMM
Re: [PATCH v7 08/14] arm/cpu: Store id_isar0-7 into the idregs array
Quoted 54 lines · Peter Maydell
Quoted 48 lines · Cornelia Huck
Quoted 45 lines · Peter Maydell
Quoted 7 lines · Cornelia Huck
From: Eric Auger <[email protected]>
Reviewed-by Richard Henderson <[email protected]>Reviewed-by Sebastian Ott <[email protected]>Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>Quoted 12 lines
--- hw/intc/armv7m_nvic.c | 12 ++-- target/arm/cpu-features.h | 36 +++++----- target/arm/cpu.c | 24 +++---- target/arm/cpu.h | 7 -- target/arm/cpu64.c | 28 ++++---- target/arm/helper.c | 14 ++-- target/arm/kvm.c | 21 ++---- target/arm/tcg/cpu-v7m.c | 90 +++++++++++++----------- target/arm/tcg/cpu32.c | 144 +++++++++++++++++++++----------------- target/arm/tcg/cpu64.c | 108 ++++++++++++++-------------- 10 files changed, 243 insertions(+), 241 deletions(-)This doesn't compile:
../../target/arm/tcg/cpu-v7m.c:70:5: error: incompatible pointer types initializing 'ARMISARe
gisters *' (aka 'struct ARMISARegisters *') with an expression of type 'uint64_t*' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]70 | SET_IDREG(idregs, ID_ISAR0, 0x01141110); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../target/arm/cpu.h:875:26: note: expanded from macro 'SET_IDREG'
875 | ARMISARegisters *i_ = (ISAR);
\
| ^ ~~~~~~../../target/arm/tcg/cpu-v7m.c:71:5: error: incompatible pointer types initializing 'ARMISARegisters *' (aka 'struct ARMISARegisters *') with an expression of type 'uint64_t*' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]71 | SET_IDREG(idregs, ID_ISAR1, 0x02111000); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../target/arm/cpu.h:875:26: note: expanded from macro 'SET_IDREG'
875 | ARMISARegisters *i_ = (ISAR);
\
| ^ ~~~~~~Quoted 4 lines
Quoted 1 line
(and more similar errors until the compiler gives up).
What configs/compiler are you using? I obviously would have fixed that if I had hit it...
Quoted 8 lines
This is clang 18.1.3 (1ubuntu1) on x86-64 Linux, configured with
'../../configure' '--cc=clang' '--cxx=clang++' '--enable-ubsan' '--target-list=arm-softmmu,arm-linux-user,aarch64-softmmu,aarch64-linux-user'
Whatever the problem is, it goes away on a later patch, so probably it's just that some fragment in a later patch needs to move into this one.
Ok, I should do more automated builds after every patch, because I forget to do that too often. (I usually build with gcc.)
PATCH v7 9/14 arm/cpu: Store id_pfr0/1/2 into the idregs array
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
--- hw/intc/armv7m_nvic.c | 5 +- target/arm/cpu-features.h | 10 ++-- target/arm/cpu.c | 8 +-- target/arm/cpu.h | 3 - target/arm/cpu64.c | 8 +-- target/arm/helper.c | 8 +-- target/arm/kvm.c | 9 +-- target/arm/tcg/cpu-v7m.c | 120 +++++++++++++++++++------------------- target/arm/tcg/cpu32.c | 52 ++++++++--------- target/arm/tcg/cpu64.c | 44 +++++++------- 10 files changed, 130 insertions(+), 137 deletions(-)
hw/intc/armv7m_nvic.c +3 -2
@@ -988,6 +988,7 @@ static void nvic_nmi_trigger(void *opaque, int n, int level)static uint32_t nvic_readl (NVICState *s,uint32_t offset,MemTxAttrs attrs) {ARMCPU *cpu = s->cpu; +ARMISARegisters *isar = &cpu->isar;uint32_t val;switch (offset) {
@@ -1263,12 +1264,12 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_pfr0; +return GET_IDREG (isar,ID_PFR0 );case 0xd44 :/* PFR1. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_pfr1; +return GET_IDREG (isar,ID_PFR1 );case 0xd48 :/* DFR0. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset;
target/arm/cpu-features.h +5 -5
@@ -136,12 +136,12 @@ static inline bool isar_feature_aa32_i8mm(const ARMISARegisters *id)static inline bool isar_feature_aa32_ras (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_pfr0,ID_PFR0 ,RAS ) !=0 ; +return FIELD_EX32_IDREG (id,ID_PFR0 ,RAS ) !=0 ; }static inline bool isar_feature_aa32_mprofile (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_pfr1,ID_PFR1 ,MPROGMOD ) !=0 ; +return FIELD_EX32_IDREG (id,ID_PFR1 ,MPROGMOD ) !=0 ; }static inline bool isar_feature_aa32_m_sec_state (const ARMISARegisters *id)
@@ -150,7 +150,7 @@ static inline bool isar_feature_aa32_m_sec_state(const ARMISARegisters *id)* Return true if M-profile state handling insns * (VSCCLRM, CLRM, FPCTX access insns) are implemented */ -return FIELD_EX32 (id->id_pfr1,ID_PFR1 ,SECURITY ) >=3 ; +return FIELD_EX32_IDREG (id,ID_PFR1 ,SECURITY ) >=3 ; }static inline bool isar_feature_aa32_fp16_arith (const ARMISARegisters *id)
@@ -349,12 +349,12 @@ static inline bool isar_feature_aa32_evt(const ARMISARegisters *id)static inline bool isar_feature_aa32_dit (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_pfr0,ID_PFR0 ,DIT ) !=0 ; +return FIELD_EX32_IDREG (id,ID_PFR0 ,DIT ) !=0 ; }static inline bool isar_feature_aa32_ssbs (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_pfr2,ID_PFR2 ,SSBS ) !=0 ; +return FIELD_EX32_IDREG (id,ID_PFR2 ,SSBS ) !=0 ; }static inline bool isar_feature_aa32_debugv7p1 (const ARMISARegisters *id)
target/arm/cpu.c +3 -5
@@ -2324,7 +2324,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* Disable the security extension feature bits in the processor * feature registers as well. */ - cpu->isar.id_pfr1 =FIELD_DP32 (cpu->isar.id_pfr1,ID_PFR1 ,SECURITY ,0 ); +FIELD_DP32_IDREG (isar,ID_PFR1 ,SECURITY ,0 ); cpu->isar.id_dfr0 =FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,COPSDBG ,0 );FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,EL3 ,0 );
@@ -2364,8 +2364,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* registers if we don't have EL2. */ FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,EL2 ,0 ); - cpu->isar.id_pfr1 =FIELD_DP32 (cpu->isar.id_pfr1, -ID_PFR1 ,VIRTUALIZATION ,0 ); +FIELD_DP32_IDREG (isar,ID_PFR1 ,VIRTUALIZATION ,0 ); }if (cpu_isar_feature (aa64_mte, cpu)) {
@@ -2428,8 +2427,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,MMAPTRC ,0 );/* FEAT_AMU (Activity Monitors Extension) */ FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,AMU ,0 ); - cpu->isar.id_pfr0 = -FIELD_DP32 (cpu->isar.id_pfr0,ID_PFR0 ,AMU ,0 ); +FIELD_DP32_IDREG (isar,ID_PFR0 ,AMU ,0 );/* FEAT_MPAM (Memory Partitioning and Monitoring Extension) */ FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,MPAM ,0 ); }
target/arm/cpu.h +0 -3
@@ -1056,9 +1056,6 @@ struct ArchCPU {uint32_t id_mmfr3;uint32_t id_mmfr4;uint32_t id_mmfr5; -uint32_t id_pfr0; -uint32_t id_pfr1; -uint32_t id_pfr2;uint32_t mvfr0;uint32_t mvfr1;uint32_t mvfr2;
target/arm/cpu64.c +4 -4
@@ -652,8 +652,8 @@ static void aarch64_a57_initfn(Object *obj) cpu->isar.mvfr2 =0x00000043 ; cpu->ctr =0x8444c004 ; cpu->reset_sctlr =0x00c50838 ; - cpu->isar.id_pfr0 =0x00000131 ; - cpu->isar.id_pfr1 =0x00011011 ; +SET_IDREG (isar,ID_PFR0 ,0x00000131 ); +SET_IDREG (isar,ID_PFR1 ,0x00011011 ); cpu->isar.id_dfr0 =0x03010066 ; cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x10101105 ;
@@ -714,8 +714,8 @@ static void aarch64_a53_initfn(Object *obj) cpu->isar.mvfr2 =0x00000043 ; cpu->ctr =0x84448004 ;/* L1Ip = VIPT */ cpu->reset_sctlr =0x00c50838 ; - cpu->isar.id_pfr0 =0x00000131 ; - cpu->isar.id_pfr1 =0x00011011 ; +SET_IDREG (isar,ID_PFR0 ,0x00000131 ); +SET_IDREG (isar,ID_PFR1 ,0x00011011 ); cpu->isar.id_dfr0 =0x03010066 ; cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x10101105 ;
target/arm/helper.c +4 -4
@@ -6933,7 +6933,7 @@ static void define_pmu_regs(ARMCPU *cpu)static uint64_t id_pfr1_read (CPUARMState *env,const ARMCPRegInfo *ri) {ARMCPU *cpu =env_archcpu (env); -uint64_t pfr1 = cpu->isar.id_pfr1; +uint64_t pfr1 =GET_IDREG (&cpu->isar,ID_PFR1 );if (env->gicv3state) { pfr1 |=1 <<28 ;
@@ -7779,7 +7779,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_pfr0 }, + .resetvalue = GET_IDREG(isar, ID_PFR0)},/* * ID_PFR1 is not a plain ARM_CP_CONST because we don't know * the value of the GIC field until after we define these regs.
@@ -7790,7 +7790,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .accessfn = access_aa32_tid3, #ifdef CONFIG_USER_ONLY .type =ARM_CP_CONST , - .resetvalue = cpu->isar.id_pfr1, + .resetvalue = GET_IDREG(isar, ID_PFR1), #else .type =ARM_CP_NO_RAW , .accessfn = access_aa32_tid3,
@@ -8132,7 +8132,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 4, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_pfr2 }, + .resetvalue = GET_IDREG(isar, ID_PFR2)}, { .name = "ID_DFR1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 5, .access = PL1_R, .type = ARM_CP_CONST,
target/arm/kvm.c +3 -6
@@ -332,10 +332,8 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)* than skipping the reads and leaving 0, as we must avoid * considering the values in every case. */ - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_pfr0, -ARM64_SYS_REG (3 ,0 ,0 ,1 ,0 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_pfr1, -ARM64_SYS_REG (3 ,0 ,0 ,1 ,1 )); + err |=get_host_cpu_reg (fd, ahcf,ID_PFR0_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_PFR1_EL1_IDX ); err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_dfr0,ARM64_SYS_REG (3 ,0 ,0 ,1 ,2 )); err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_mmfr0,
@@ -362,8 +360,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ARM64_SYS_REG(3, 0, 0, 3, 1)); err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.mvfr2,ARM64_SYS_REG (3 ,0 ,0 ,3 ,2 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_pfr2, -ARM64_SYS_REG (3 ,0 ,0 ,3 ,4 )); + err |=get_host_cpu_reg (fd, ahcf,ID_PFR2_EL1_IDX ); err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_dfr1,ARM64_SYS_REG (3 ,0 ,0 ,3 ,5 )); err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_mmfr5,
target/arm/tcg/cpu-v7m.c +60 -60
223 lines not on this page · raw message
target/arm/tcg/cpu32.c +26 -26
130 lines not on this page · raw message
target/arm/tcg/cpu64.c +22 -22
104 lines not on this page · raw message
Signature · 1 line
2.49.0
PATCH v7 10/14 arm/cpu: Store id_dfr0/1 into the idregs array
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
--- hw/intc/armv7m_nvic.c | 2 +- target/arm/cpu-features.h | 16 ++++++++-------- target/arm/cpu.c | 13 +++++-------- target/arm/cpu.h | 2 -- target/arm/cpu64.c | 4 ++-- target/arm/helper.c | 4 ++-- target/arm/kvm.c | 6 ++---- target/arm/tcg/cpu-v7m.c | 12 ++++++------ target/arm/tcg/cpu32.c | 30 ++++++++++++++---------------- target/arm/tcg/cpu64.c | 16 ++++++++-------- 10 files changed, 48 insertions(+), 57 deletions(-)
hw/intc/armv7m_nvic.c +1 -1
@@ -1274,7 +1274,7 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_dfr0; +return GET_IDREG (isar,ID_DFR0 );case 0xd4c :/* AFR0. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset;
target/arm/cpu-features.h +8 -8
@@ -299,22 +299,22 @@ static inline bool isar_feature_aa32_ats1e1(const ARMISARegisters *id)static inline bool isar_feature_aa32_pmuv3p1 (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 ; +return FIELD_EX32_IDREG (id,ID_DFR0 ,PERFMON ) >=4 && +FIELD_EX32_IDREG (id,ID_DFR0 ,PERFMON ) !=0xf ; }static inline bool isar_feature_aa32_pmuv3p4 (const ARMISARegisters *id) {/* 0xf means "non-standard IMPDEF PMU" */ -return FIELD_EX32 (id->id_dfr0,ID_DFR0 ,PERFMON ) >=5 && -FIELD_EX32 (id->id_dfr0,ID_DFR0 ,PERFMON ) !=0xf ; +return FIELD_EX32_IDREG (id,ID_DFR0 ,PERFMON ) >=5 && +FIELD_EX32_IDREG (id,ID_DFR0 ,PERFMON ) !=0xf ; }static inline bool isar_feature_aa32_pmuv3p5 (const ARMISARegisters *id) {/* 0xf means "non-standard IMPDEF PMU" */ -return FIELD_EX32 (id->id_dfr0,ID_DFR0 ,PERFMON ) >=6 && -FIELD_EX32 (id->id_dfr0,ID_DFR0 ,PERFMON ) !=0xf ; +return FIELD_EX32_IDREG (id,ID_DFR0 ,PERFMON ) >=6 && +FIELD_EX32_IDREG (id,ID_DFR0 ,PERFMON ) !=0xf ; }static inline bool isar_feature_aa32_hpd (const ARMISARegisters *id)
@@ -359,12 +359,12 @@ static inline bool isar_feature_aa32_ssbs(const ARMISARegisters *id)static inline bool isar_feature_aa32_debugv7p1 (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_dfr0,ID_DFR0 ,COPDBG ) >=5 ; +return FIELD_EX32_IDREG (id,ID_DFR0 ,COPDBG ) >=5 ; }static inline bool isar_feature_aa32_debugv8p2 (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_dfr0,ID_DFR0 ,COPDBG ) >=8 ; +return FIELD_EX32_IDREG (id,ID_DFR0 ,COPDBG ) >=8 ; }static inline bool isar_feature_aa32_doublelock (const ARMISARegisters *id)
target/arm/cpu.c +5 -8
@@ -2325,7 +2325,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)* feature registers as well. */ FIELD_DP32_IDREG (isar,ID_PFR1 ,SECURITY ,0 ); - cpu->isar.id_dfr0 =FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,COPSDBG ,0 ); +FIELD_DP32_IDREG (isar,ID_DFR0 ,COPSDBG ,0 );FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,EL3 ,0 );/* Disable the realm management extension, which requires EL3. */
@@ -2353,7 +2353,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)#endif }else {FIELD_DP64_IDREG (isar,ID_AA64DFR0 ,PMUVER ,0 ); - cpu->isar.id_dfr0 =FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,PERFMON ,0 ); +FIELD_DP32_IDREG (isar,ID_DFR0 ,PERFMON ,0 ); cpu->pmceid0 =0 ; cpu->pmceid1 =0 ; }
@@ -2416,15 +2416,12 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)FIELD_DP64_IDREG (isar,ID_AA64DFR0 ,TRACEBUFFER ,0 );/* FEAT_TRF (Self-hosted Trace Extension) */ FIELD_DP64_IDREG (isar,ID_AA64DFR0 ,TRACEFILT ,0 ); - cpu->isar.id_dfr0 = -FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,TRACEFILT ,0 ); +FIELD_DP32_IDREG (isar,ID_DFR0 ,TRACEFILT ,0 );/* Trace Macrocell system register access */ FIELD_DP64_IDREG (isar,ID_AA64DFR0 ,TRACEVER ,0 ); - cpu->isar.id_dfr0 = -FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,COPTRC ,0 ); +FIELD_DP32_IDREG (isar,ID_DFR0 ,COPTRC ,0 );/* Memory mapped trace */ - cpu->isar.id_dfr0 = -FIELD_DP32 (cpu->isar.id_dfr0,ID_DFR0 ,MMAPTRC ,0 ); +FIELD_DP32_IDREG (isar,ID_DFR0 ,MMAPTRC ,0 );/* FEAT_AMU (Activity Monitors Extension) */ FIELD_DP64_IDREG (isar,ID_AA64PFR0 ,AMU ,0 );FIELD_DP32_IDREG (isar,ID_PFR0 ,AMU ,0 );
target/arm/cpu.h +0 -2
@@ -1059,8 +1059,6 @@ struct ArchCPU {uint32_t mvfr0;uint32_t mvfr1;uint32_t mvfr2; -uint32_t id_dfr0; -uint32_t id_dfr1;uint32_t dbgdidr;uint32_t dbgdevid;uint32_t dbgdevid1;
target/arm/cpu64.c +2 -2
@@ -654,7 +654,7 @@ static void aarch64_a57_initfn(Object *obj) cpu->reset_sctlr =0x00c50838 ;SET_IDREG (isar,ID_PFR0 ,0x00000131 );SET_IDREG (isar,ID_PFR1 ,0x00011011 ); - cpu->isar.id_dfr0 =0x03010066 ; +SET_IDREG (isar,ID_DFR0 ,0x03010066 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x10101105 ; cpu->isar.id_mmfr1 =0x40000000 ;
@@ -716,7 +716,7 @@ static void aarch64_a53_initfn(Object *obj) cpu->reset_sctlr =0x00c50838 ;SET_IDREG (isar,ID_PFR0 ,0x00000131 );SET_IDREG (isar,ID_PFR1 ,0x00011011 ); - cpu->isar.id_dfr0 =0x03010066 ; +SET_IDREG (isar,ID_DFR0 ,0x03010066 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x10101105 ; cpu->isar.id_mmfr1 =0x40000000 ;
target/arm/helper.c +2 -2
@@ -7802,7 +7802,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_dfr0 }, + .resetvalue = GET_IDREG(isar, ID_DFR0)}, { .name = "ID_AFR0", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 3, .access = PL1_R, .type = ARM_CP_CONST,
@@ -8137,7 +8137,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 5, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_dfr1 }, + .resetvalue = GET_IDREG(isar, ID_DFR1)}, { .name = "ID_MMFR5", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 6, .access = PL1_R, .type = ARM_CP_CONST,
target/arm/kvm.c +2 -4
@@ -334,8 +334,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)*/ err |=get_host_cpu_reg (fd, ahcf,ID_PFR0_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_PFR1_EL1_IDX ); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_dfr0, -ARM64_SYS_REG (3 ,0 ,0 ,1 ,2 )); + err |=get_host_cpu_reg (fd, ahcf,ID_DFR0_EL1_IDX ); err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr0,ARM64_SYS_REG (3 ,0 ,0 ,1 ,4 )); err |= read_sys_reg32(fdarray[2], &ahcf->isar.id_mmfr1,
@@ -361,8 +360,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.mvfr2,ARM64_SYS_REG (3 ,0 ,0 ,3 ,2 )); err |=get_host_cpu_reg (fd, ahcf,ID_PFR2_EL1_IDX ); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_dfr1, -ARM64_SYS_REG (3 ,0 ,0 ,3 ,5 )); + err |=get_host_cpu_reg (fd, ahcf,ID_DFR1_EL1_IDX ); err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr5,ARM64_SYS_REG (3 ,0 ,0 ,3 ,6 ));
target/arm/tcg/cpu-v7m.c +6 -6
@@ -61,7 +61,7 @@ static void cortex_m0_initfn(Object *obj)*/ SET_IDREG (isar,ID_PFR0 ,0x00000030 );SET_IDREG (isar,ID_PFR1 ,0x00000200 ); - cpu->isar.id_dfr0 =0x00100000 ; +SET_IDREG (isar,ID_DFR0 ,0x00100000 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x00000030 ; cpu->isar.id_mmfr1 =0x00000000 ;
@@ -87,7 +87,7 @@ static void cortex_m3_initfn(Object *obj) cpu->pmsav7_dregion =8 ;SET_IDREG (isar,ID_PFR0 ,0x00000030 );SET_IDREG (isar,ID_PFR1 ,0x00000200 ); - cpu->isar.id_dfr0 =0x00100000 ; +SET_IDREG (isar,ID_DFR0 ,0x00100000 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x00000030 ; cpu->isar.id_mmfr1 =0x00000000 ;
@@ -118,7 +118,7 @@ static void cortex_m4_initfn(Object *obj) cpu->isar.mvfr2 =0x00000000 ;SET_IDREG (isar,ID_PFR0 ,0x00000030 );SET_IDREG (isar,ID_PFR1 ,0x00000200 ); - cpu->isar.id_dfr0 =0x00100000 ; +SET_IDREG (isar,ID_DFR0 ,0x00100000 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x00000030 ; cpu->isar.id_mmfr1 =0x00000000 ;
@@ -149,7 +149,7 @@ static void cortex_m7_initfn(Object *obj) cpu->isar.mvfr2 =0x00000040 ;SET_IDREG (isar,ID_PFR0 ,0x00000030 );SET_IDREG (isar,ID_PFR1 ,0x00000200 ); - cpu->isar.id_dfr0 =0x00100000 ; +SET_IDREG (isar,ID_DFR0 ,0x00100000 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x00100030 ; cpu->isar.id_mmfr1 =0x00000000 ;
@@ -182,7 +182,7 @@ static void cortex_m33_initfn(Object *obj) cpu->isar.mvfr2 =0x00000040 ;SET_IDREG (isar,ID_PFR0 ,0x00000030 );SET_IDREG (isar,ID_PFR1 ,0x00000210 ); - cpu->isar.id_dfr0 =0x00200000 ; +SET_IDREG (isar,ID_DFR0 ,0x00200000 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x00101F40 ; cpu->isar.id_mmfr1 =0x00000000 ;
@@ -220,7 +220,7 @@ static void cortex_m55_initfn(Object *obj) cpu->isar.mvfr2 =0x00000040 ;SET_IDREG (isar,ID_PFR0 ,0x20000030 );SET_IDREG (isar,ID_PFR1 ,0x00000230 ); - cpu->isar.id_dfr0 =0x10200000 ; +SET_IDREG (isar,ID_DFR0 ,0x10200000 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x00111040 ; cpu->isar.id_mmfr1 =0x00000000 ;
target/arm/tcg/cpu32.c +14 -16
@@ -82,11 +82,11 @@ void aa32_max_features(ARMCPU *cpu) t =FIELD_DP32 (t,ID_PFR2 ,SSBS ,1 );/* FEAT_SSBS */ SET_IDREG (isar,ID_PFR2 , t); - t = cpu->isar.id_dfr0; + t =GET_IDREG (isar,ID_DFR0 ); t =FIELD_DP32 (t,ID_DFR0 ,COPDBG ,10 );/* FEAT_Debugv8p8 */ t =FIELD_DP32 (t,ID_DFR0 ,COPSDBG ,10 );/* FEAT_Debugv8p8 */ t =FIELD_DP32 (t,ID_DFR0 ,PERFMON ,6 );/* FEAT_PMUv3p5 */ - cpu->isar.id_dfr0 = t; +SET_IDREG (isar,ID_DFR0 , t);/* Debug ID registers. */
@@ -116,9 +116,7 @@ void aa32_max_features(ARMCPU *cpu) t =FIELD_DP32 (t,DBGDEVID1 ,PCSROFFSET ,2 ); cpu->isar.dbgdevid1 = t; - t = cpu->isar.id_dfr1; - t =FIELD_DP32 (t,ID_DFR1 ,HPMN0 ,1 );/* FEAT_HPMN0 */ - cpu->isar.id_dfr1 = t; +FIELD_DP32_IDREG (isar,ID_DFR1 ,HPMN0 ,1 );/* FEAT_HPMN0 */ }/* CPU models. These are not needed for the AArch64 linux-user build. */
@@ -230,7 +228,7 @@ static void arm1136_r2_initfn(Object *obj) cpu->reset_sctlr =0x00050078 ;SET_IDREG (isar,ID_PFR0 ,0x111 );SET_IDREG (isar,ID_PFR1 ,0x1 ); - cpu->isar.id_dfr0 =0x2 ; +SET_IDREG (isar,ID_DFR0 ,0x2 ); cpu->id_afr0 =0x3 ; cpu->isar.id_mmfr0 =0x01130003 ; cpu->isar.id_mmfr1 =0x10030302 ;
@@ -262,7 +260,7 @@ static void arm1136_initfn(Object *obj) cpu->reset_sctlr =0x00050078 ;SET_IDREG (isar,ID_PFR0 ,0x111 );SET_IDREG (isar,ID_PFR1 ,0x1 ); - cpu->isar.id_dfr0 =0x2 ; +SET_IDREG (isar,ID_DFR0 ,0x2 ); cpu->id_afr0 =0x3 ; cpu->isar.id_mmfr0 =0x01130003 ; cpu->isar.id_mmfr1 =0x10030302 ;
@@ -295,7 +293,7 @@ static void arm1176_initfn(Object *obj) cpu->reset_sctlr =0x00050078 ;SET_IDREG (isar,ID_PFR0 ,0x111 );SET_IDREG (isar,ID_PFR1 ,0x11 ); - cpu->isar.id_dfr0 =0x33 ; +SET_IDREG (isar,ID_DFR0 ,0x33 ); cpu->id_afr0 =0 ; cpu->isar.id_mmfr0 =0x01130003 ; cpu->isar.id_mmfr1 =0x10030302 ;
@@ -325,7 +323,7 @@ static void arm11mpcore_initfn(Object *obj) cpu->ctr =0x1d192992 ;/* 32K icache 32K dcache */ SET_IDREG (isar,ID_PFR0 ,0x111 );SET_IDREG (isar,ID_PFR1 ,0x1 ); - cpu->isar.id_dfr0 =0 ; +SET_IDREG (isar,ID_DFR0 ,0 ); cpu->id_afr0 =0x2 ; cpu->isar.id_mmfr0 =0x01100103 ; cpu->isar.id_mmfr1 =0x10020302 ;
@@ -365,7 +363,7 @@ static void cortex_a8_initfn(Object *obj) cpu->reset_sctlr =0x00c50078 ;SET_IDREG (isar,ID_PFR0 ,0x1031 );SET_IDREG (isar,ID_PFR1 ,0x11 ); - cpu->isar.id_dfr0 =0x400 ; +SET_IDREG (isar,ID_DFR0 ,0x400 ); cpu->id_afr0 =0 ; cpu->isar.id_mmfr0 =0x31100003 ; cpu->isar.id_mmfr1 =0x20000000 ;
@@ -441,7 +439,7 @@ static void cortex_a9_initfn(Object *obj) cpu->reset_sctlr =0x00c50078 ;SET_IDREG (isar,ID_PFR0 ,0x1031 );SET_IDREG (isar,ID_PFR1 ,0x11 ); - cpu->isar.id_dfr0 =0x000 ; +SET_IDREG (isar,ID_DFR0 ,0x000 ); cpu->id_afr0 =0 ; cpu->isar.id_mmfr0 =0x00100103 ; cpu->isar.id_mmfr1 =0x20000000 ;
@@ -507,7 +505,7 @@ static void cortex_a7_initfn(Object *obj) cpu->reset_sctlr =0x00c50078 ;SET_IDREG (isar,ID_PFR0 ,0x00001131 );SET_IDREG (isar,ID_PFR1 ,0x00011011 ); - cpu->isar.id_dfr0 =0x02010555 ; +SET_IDREG (isar,ID_DFR0 ,0x02010555 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x10101105 ; cpu->isar.id_mmfr1 =0x40000000 ;
@@ -559,7 +557,7 @@ static void cortex_a15_initfn(Object *obj) cpu->reset_sctlr =0x00c50078 ;SET_IDREG (isar,ID_PFR0 ,0x00001131 );SET_IDREG (isar,ID_PFR1 ,0x00011011 ); - cpu->isar.id_dfr0 =0x02010555 ; +SET_IDREG (isar,ID_DFR0 ,0x02010555 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x10201105 ; cpu->isar.id_mmfr1 =0x20000000 ;
@@ -603,7 +601,7 @@ static void cortex_r5_initfn(Object *obj) cpu->midr =0x411fc153 ;/* r1p3 */ SET_IDREG (isar,ID_PFR0 ,0x0131 );SET_IDREG (isar,ID_PFR1 ,0x001 ); - cpu->isar.id_dfr0 =0x010400 ; +SET_IDREG (isar,ID_DFR0 ,0x010400 ); cpu->id_afr0 =0x0 ; cpu->isar.id_mmfr0 =0x0210030 ; cpu->isar.id_mmfr1 =0x00000000 ;
@@ -750,7 +748,7 @@ static void cortex_r52_initfn(Object *obj) cpu->reset_sctlr =0x30c50838 ;SET_IDREG (isar,ID_PFR0 ,0x00000131 );SET_IDREG (isar,ID_PFR1 ,0x10111001 ); - cpu->isar.id_dfr0 =0x03010006 ; +SET_IDREG (isar,ID_DFR0 ,0x03010006 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x00211040 ; cpu->isar.id_mmfr1 =0x40000000 ;
@@ -982,7 +980,7 @@ static void arm_max_initfn(Object *obj) cpu->reset_sctlr =0x00c50838 ;SET_IDREG (isar,ID_PFR0 ,0x00000131 );SET_IDREG (isar,ID_PFR1 ,0x00011011 ); - cpu->isar.id_dfr0 =0x03010066 ; +SET_IDREG (isar,ID_DFR0 ,0x03010066 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x10101105 ; cpu->isar.id_mmfr1 =0x40000000 ;
target/arm/tcg/cpu64.c +8 -8
@@ -51,7 +51,7 @@ static void aarch64_a35_initfn(Object *obj) cpu->ctr =0x84448004 ;SET_IDREG (isar,ID_PFR0 ,0x00000131 );SET_IDREG (isar,ID_PFR1 ,0x00011011 ); - cpu->isar.id_dfr0 =0x03010066 ; +SET_IDREG (isar,ID_DFR0 ,0x03010066 ); cpu->id_afr0 =0 ; cpu->isar.id_mmfr0 =0x10201105 ; cpu->isar.id_mmfr1 =0x40000000 ;
@@ -228,7 +228,7 @@ static void aarch64_a55_initfn(Object *obj)SET_IDREG (isar,ID_AA64PFR0 ,0x0000000010112222ull );SET_IDREG (isar,ID_AA64PFR1 ,0x0000000000000010ull ); cpu->id_afr0 =0x00000000 ; - cpu->isar.id_dfr0 =0x04010088 ; +SET_IDREG (isar,ID_DFR0 ,0x04010088 );SET_IDREG (isar,ID_ISAR0 ,0x02101110 );SET_IDREG (isar,ID_ISAR1 ,0x13112111 );SET_IDREG (isar,ID_ISAR2 ,0x21232042 );
@@ -297,7 +297,7 @@ static void aarch64_a72_initfn(Object *obj) cpu->reset_sctlr =0x00c50838 ;SET_IDREG (isar,ID_PFR0 ,0x00000131 );SET_IDREG (isar,ID_PFR1 ,0x00011011 ); - cpu->isar.id_dfr0 =0x03010066 ; +SET_IDREG (isar,ID_DFR0 ,0x03010066 ); cpu->id_afr0 =0x00000000 ; cpu->isar.id_mmfr0 =0x10201105 ; cpu->isar.id_mmfr1 =0x40000000 ;
@@ -361,7 +361,7 @@ static void aarch64_a76_initfn(Object *obj)SET_IDREG (isar,ID_AA64PFR0 ,0x1100000010111112ull );/* GIC filled in later */ SET_IDREG (isar,ID_AA64PFR1 ,0x0000000000000010ull ); cpu->id_afr0 =0x00000000 ; - cpu->isar.id_dfr0 =0x04010088 ; +SET_IDREG (isar,ID_DFR0 ,0x04010088 );SET_IDREG (isar,ID_ISAR0 ,0x02101110 );SET_IDREG (isar,ID_ISAR1 ,0x13112111 );SET_IDREG (isar,ID_ISAR2 ,0x21232042 );
@@ -609,7 +609,7 @@ static void aarch64_neoverse_n1_initfn(Object *obj)SET_IDREG (isar,ID_AA64PFR0 ,0x1100000010111112ull );/* GIC filled in later */ SET_IDREG (isar,ID_AA64PFR1 ,0x0000000000000020ull ); cpu->id_afr0 =0x00000000 ; - cpu->isar.id_dfr0 =0x04010088 ; +SET_IDREG (isar,ID_DFR0 ,0x04010088 );SET_IDREG (isar,ID_ISAR0 ,0x02101110 );SET_IDREG (isar,ID_ISAR1 ,0x13112111 );SET_IDREG (isar,ID_ISAR2 ,0x21232042 );
@@ -688,7 +688,7 @@ static void aarch64_neoverse_v1_initfn(Object *obj)SET_IDREG (isar,ID_AA64PFR0 ,0x1101110120111112ull );/* GIC filled in later */ SET_IDREG (isar,ID_AA64PFR1 ,0x0000000000000020ull ); cpu->id_afr0 =0x00000000 ; - cpu->isar.id_dfr0 =0x15011099 ; +SET_IDREG (isar,ID_DFR0 ,0x15011099 );SET_IDREG (isar,ID_ISAR0 ,0x02101110 );SET_IDREG (isar,ID_ISAR1 ,0x13112111 );SET_IDREG (isar,ID_ISAR2 ,0x21232042 );
@@ -904,7 +904,7 @@ static void aarch64_a710_initfn(Object *obj) cpu->revidr =0 ;SET_IDREG (isar,ID_PFR0 ,0x21110131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ - cpu->isar.id_dfr0 =0x16011099 ; +SET_IDREG (isar,ID_DFR0 ,0x16011099 ); cpu->id_afr0 =0 ; cpu->isar.id_mmfr0 =0x10201105 ; cpu->isar.id_mmfr1 =0x40000000 ;
@@ -1006,7 +1006,7 @@ static void aarch64_neoverse_n2_initfn(Object *obj) cpu->revidr =0 ;SET_IDREG (isar,ID_PFR0 ,0x21110131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ - cpu->isar.id_dfr0 =0x16011099 ; +SET_IDREG (isar,ID_DFR0 ,0x16011099 ); cpu->id_afr0 =0 ; cpu->isar.id_mmfr0 =0x10201105 ; cpu->isar.id_mmfr1 =0x40000000 ;
Signature · 1 line
2.49.0
PATCH v7 11/14 arm/cpu: Store id_mmfr0-5 into the idregs array
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
--- hw/intc/armv7m_nvic.c | 8 ++-- target/arm/cpu-features.h | 18 ++++---- target/arm/cpu.h | 6 --- target/arm/cpu64.c | 16 +++---- target/arm/helper.c | 12 ++--- target/arm/kvm.c | 18 +++----- target/arm/tcg/cpu-v7m.c | 48 ++++++++++---------- target/arm/tcg/cpu32.c | 94 +++++++++++++++++++-------------------- target/arm/tcg/cpu64.c | 76 +++++++++++++++---------------- 9 files changed, 140 insertions(+), 156 deletions(-)
hw/intc/armv7m_nvic.c +4 -4
@@ -1284,22 +1284,22 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_mmfr0; +return GET_IDREG (isar,ID_MMFR0 );case 0xd54 :/* MMFR1. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_mmfr1; +return GET_IDREG (isar,ID_MMFR1 );case 0xd58 :/* MMFR2. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_mmfr2; +return GET_IDREG (isar,ID_MMFR2 );case 0xd5c :/* MMFR3. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset; } -return cpu->isar.id_mmfr3; +return GET_IDREG (isar,ID_MMFR3 );case 0xd60 :/* ISAR0. */ if (!arm_feature (&cpu->env,ARM_FEATURE_M_MAIN )) { goto bad_offset;
target/arm/cpu-features.h +9 -9
@@ -283,17 +283,17 @@ static inline bool isar_feature_aa32_vminmaxnm(const ARMISARegisters *id)static inline bool isar_feature_aa32_pxn (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_mmfr0,ID_MMFR0 ,VMSA ) >=4 ; +return FIELD_EX32_IDREG (id,ID_MMFR0 ,VMSA ) >=4 ; }static inline bool isar_feature_aa32_pan (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_mmfr3,ID_MMFR3 ,PAN ) !=0 ; +return FIELD_EX32_IDREG (id,ID_MMFR3 ,PAN ) !=0 ; }static inline bool isar_feature_aa32_ats1e1 (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_mmfr3,ID_MMFR3 ,PAN ) >=2 ; +return FIELD_EX32_IDREG (id,ID_MMFR3 ,PAN ) >=2 ; }static inline bool isar_feature_aa32_pmuv3p1 (const ARMISARegisters *id)
@@ -319,32 +319,32 @@ static inline bool isar_feature_aa32_pmuv3p5(const ARMISARegisters *id)static inline bool isar_feature_aa32_hpd (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_mmfr4,ID_MMFR4 ,HPDS ) !=0 ; +return FIELD_EX32_IDREG (id,ID_MMFR4 ,HPDS ) !=0 ; }static inline bool isar_feature_aa32_ac2 (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_mmfr4,ID_MMFR4 ,AC2 ) !=0 ; +return FIELD_EX32_IDREG (id,ID_MMFR4 ,AC2 ) !=0 ; }static inline bool isar_feature_aa32_ccidx (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_mmfr4,ID_MMFR4 ,CCIDX ) !=0 ; +return FIELD_EX32_IDREG (id,ID_MMFR4 ,CCIDX ) !=0 ; }static inline bool isar_feature_aa32_tts2uxn (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_mmfr4,ID_MMFR4 ,XNX ) !=0 ; +return FIELD_EX32_IDREG (id,ID_MMFR4 ,XNX ) !=0 ; }static inline bool isar_feature_aa32_half_evt (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_mmfr4,ID_MMFR4 ,EVT ) >=1 ; +return FIELD_EX32_IDREG (id,ID_MMFR4 ,EVT ) >=1 ; }static inline bool isar_feature_aa32_evt (const ARMISARegisters *id) { -return FIELD_EX32 (id->id_mmfr4,ID_MMFR4 ,EVT ) >=2 ; +return FIELD_EX32_IDREG (id,ID_MMFR4 ,EVT ) >=2 ; }static inline bool isar_feature_aa32_dit (const ARMISARegisters *id)
target/arm/cpu.h +0 -6
@@ -1050,12 +1050,6 @@ struct ArchCPU {* field by reading the value from the KVM vCPU. */ struct ARMISARegisters { -uint32_t id_mmfr0; -uint32_t id_mmfr1; -uint32_t id_mmfr2; -uint32_t id_mmfr3; -uint32_t id_mmfr4; -uint32_t id_mmfr5;uint32_t mvfr0;uint32_t mvfr1;uint32_t mvfr2;
target/arm/cpu64.c +8 -8
@@ -656,10 +656,10 @@ static void aarch64_a57_initfn(Object *obj)SET_IDREG (isar,ID_PFR1 ,0x00011011 );SET_IDREG (isar,ID_DFR0 ,0x03010066 ); cpu->id_afr0 =0x00000000 ; - cpu->isar.id_mmfr0 =0x10101105 ; - cpu->isar.id_mmfr1 =0x40000000 ; - cpu->isar.id_mmfr2 =0x01260000 ; - cpu->isar.id_mmfr3 =0x02102211 ; +SET_IDREG (isar,ID_MMFR0 ,0x10101105 ); +SET_IDREG (isar,ID_MMFR1 ,0x40000000 ); +SET_IDREG (isar,ID_MMFR2 ,0x01260000 ); +SET_IDREG (isar,ID_MMFR3 ,0x02102211 );SET_IDREG (isar,ID_ISAR0 ,0x02101110 );SET_IDREG (isar,ID_ISAR1 ,0x13112111 );SET_IDREG (isar,ID_ISAR2 ,0x21232042 );
@@ -718,10 +718,10 @@ static void aarch64_a53_initfn(Object *obj)SET_IDREG (isar,ID_PFR1 ,0x00011011 );SET_IDREG (isar,ID_DFR0 ,0x03010066 ); cpu->id_afr0 =0x00000000 ; - cpu->isar.id_mmfr0 =0x10101105 ; - cpu->isar.id_mmfr1 =0x40000000 ; - cpu->isar.id_mmfr2 =0x01260000 ; - cpu->isar.id_mmfr3 =0x02102211 ; +SET_IDREG (isar,ID_MMFR0 ,0x10101105 ); +SET_IDREG (isar,ID_MMFR1 ,0x40000000 ); +SET_IDREG (isar,ID_MMFR2 ,0x01260000 ); +SET_IDREG (isar,ID_MMFR3 ,0x02102211 );SET_IDREG (isar,ID_ISAR0 ,0x02101110 );SET_IDREG (isar,ID_ISAR1 ,0x13112111 );SET_IDREG (isar,ID_ISAR2 ,0x21232042 );
target/arm/helper.c +6 -6
@@ -7812,22 +7812,22 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 4, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_mmfr0 }, + .resetvalue = GET_IDREG(isar, ID_MMFR0)}, { .name = "ID_MMFR1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 5, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_mmfr1 }, + .resetvalue = GET_IDREG(isar, ID_MMFR1)}, { .name = "ID_MMFR2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 6, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_mmfr2 }, + .resetvalue = GET_IDREG(isar, ID_MMFR2)}, { .name = "ID_MMFR3", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 7, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_mmfr3 }, + .resetvalue = GET_IDREG(isar, ID_MMFR3)}, { .name = "ID_ISAR0", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST,
@@ -7862,7 +7862,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 6, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, - .resetvalue = cpu->isar.id_mmfr4 }, + .resetvalue = GET_IDREG(isar, ID_MMFR4)}, { .name = "ID_ISAR6", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 7, .access = PL1_R, .type = ARM_CP_CONST,
@@ -8142,7 +8142,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 6, .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa64_tid3, - .resetvalue = cpu->isar.id_mmfr5 }, + .resetvalue = GET_IDREG(isar, ID_MMFR5)}, { .name = "RES_0_C0_C3_7", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 3, .opc2 = 7, .access = PL1_R, .type = ARM_CP_CONST,
target/arm/kvm.c +6 -12
@@ -335,14 +335,10 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) err |=get_host_cpu_reg (fd, ahcf,ID_PFR0_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_PFR1_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_DFR0_EL1_IDX ); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr0, -ARM64_SYS_REG (3 ,0 ,0 ,1 ,4 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr1, -ARM64_SYS_REG (3 ,0 ,0 ,1 ,5 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr2, -ARM64_SYS_REG (3 ,0 ,0 ,1 ,6 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr3, -ARM64_SYS_REG (3 ,0 ,0 ,1 ,7 )); + err |=get_host_cpu_reg (fd, ahcf,ID_MMFR0_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_MMFR1_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_MMFR2_EL1_IDX ); + err |=get_host_cpu_reg (fd, ahcf,ID_MMFR3_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_ISAR0_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_ISAR1_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_ISAR2_EL1_IDX );
@@ -350,8 +346,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) err |=get_host_cpu_reg (fd, ahcf,ID_ISAR4_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_ISAR5_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_ISAR6_EL1_IDX ); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr4, -ARM64_SYS_REG (3 ,0 ,0 ,2 ,6 )); + err |=get_host_cpu_reg (fd, ahcf,ID_MMFR4_EL1_IDX ); err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.mvfr0,ARM64_SYS_REG (3 ,0 ,0 ,3 ,0 ));
@@ -361,8 +356,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ARM64_SYS_REG(3, 0, 0, 3, 2)); err |=get_host_cpu_reg (fd, ahcf,ID_PFR2_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_DFR1_EL1_IDX ); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.id_mmfr5, -ARM64_SYS_REG (3 ,0 ,0 ,3 ,6 )); + err |=get_host_cpu_reg (fd, ahcf,ID_MMFR5_EL1_IDX );/* * DBGDIDR is a bit complicated because the kernel doesn't
target/arm/tcg/cpu-v7m.c +24 -24
84 lines not on this page · raw message
target/arm/tcg/cpu32.c +45 -49
173 lines not on this page · raw message
target/arm/tcg/cpu64.c +38 -38
136 lines not on this page · raw message
Signature · 1 line
2.49.0
PATCH v7 12/14 arm/cpu: Add sysreg generation scripts
In reply to Cornelia HuckFrom: Eric Auger <[email protected]>
Introduce scripts that automate the generation of system register definitions from a given linux source tree arch/arm64/tools/sysreg.
Invocation of
./update-aarch64-sysreg-code.sh $PATH_TO_LINUX_SOURCE_TREE in scripts directory generates target/arm/cpu-sysregs.h.inc containing defines for all system registers.
[CH: update to handle current kernel sysregs structure, and to emit
the re-worked register structures; cpu properties will be added later]
--- MAINTAINERS | 1 + scripts/gen-cpu-sysregs-header.awk | 35 +++++++++++++++++++++++++++ scripts/update-aarch64-sysreg-code.sh | 26 ++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100755 scripts/gen-cpu-sysregs-header.awk create mode 100755 scripts/update-aarch64-sysreg-code.sh
MAINTAINERS +1 -0
@@ -441,6 +441,7 @@ M: Peter Maydell <[email protected]> L: [email protected] S: Maintained F: target/arm/kvm.c +F: scripts/*-sysreg* MIPS KVM CPUs M: Huacai Chen <[email protected]>
scripts/gen-cpu-sysregs-header.awk new file +35 -0
@@ -0,0 +1,35 @@ +#!/bin/awk -f +# SPDX-License-Identifier: GPL-2.0-or-later +# gen-cpu-sysregs-header.awk: arm64 sysreg header include generator +# +# Usage: awk -f gen-cpu-sysregs-header.awk $LINUX_PATH/arch/arm64/tools/sysreg + +BEGIN { + print "" +} END { + print "" +} + +# skip blank lines and comment lines +/^$/ { next } +/^[\t ]*#/ { next } + +/^Sysreg\t/ || /^Sysreg /{ + + reg = $2 + op0 = $3 + op1 = $4 + crn = $5 + crm = $6 + op2 = $7 + + if (op0 == 3 && (op1>=0 && op1<=3) && crn==0 && (crm>=0 && crm<=7) && (op2>=0 && op2<=7)) { + print "DEF("reg", "op0", "op1", "crn", "crm", "op2")" + } + next +} + +{ + /* skip all other lines */ + next +}
scripts/update-aarch64-sysreg-code.sh new file +26 -0
@@ -0,0 +1,26 @@ +#!/bin/sh -e +# +# SPDX-License-Identifier: GPL-2.0-or-later +# Update target/arm/cpu-sysregs.h +# from a linux source tree (arch/arm64/tools/sysreg) +# +# Copyright Red Hat, Inc. 2024 +# +# Authors: +# Eric Auger <[email protected]> +# + +linux="$1" +output="$PWD" + +if [ -z "$linux" ] || ! [ -d "$linux" ]; then + cat << EOF +usage: update-aarch64-sysreg-code.sh LINUX_PATH + +LINUX_PATH Linux kernel directory to obtain the headers from +EOF + exit 1 +fi + +awk -f gen-cpu-sysregs-header.awk \ + $linux/arch/arm64/tools/sysreg > ../target/arm/cpu-sysregs.h.inc
Signature · 1 line
2.49.0
Re: [PATCH v7 12/14] arm/cpu: Add sysreg generation scripts
scripts/gen-cpu-sysregs-header.awk
Quoted 24 lines · Cornelia Huck
From: Eric Auger <[email protected]>
Introduce scripts that automate the generation of system register definitions from a given linux source tree
arch/arm64/tools/sysreg.Invocation of
./update-aarch64-sysreg-code.sh $PATH_TO_LINUX_SOURCE_TREE in scripts directory generates target/arm/cpu-sysregs.h.inc containing defines for all system registers.[CH: update to handle current kernel sysregs structure, and to emit
the re-worked register structures; cpu properties will be added later]Reviewed-by Sebastian Ott <[email protected]>Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>---
scripts/gen-cpu-sysregs-header.awk new file +0
-0
This should probably have 'arm' in the filename somewhere, unless it's really architecture-agnostic, which I don't think it is.
scripts/gen-cpu-sysregs-header.awk line 1
Quoted 2 lines
scripts/gen-cpu-sysregs-header.awk new file +1
-0@@ -0,0 +1,35 @@ +#!/bin/awk -f
Does this really need to be in awk? Our standard scripting language is python. This isn't run at build time so there's no "extra dependency" issue, but we currently use awk only minimally and almost always for trivial stuff.
Quoted 24 lines
scripts/gen-cpu-sysregs-header.awk new file +24
-0+# SPDX-License-Identifier: GPL-2.0-or-later +# gen-cpu-sysregs-header.awk: arm64 sysreg header include generator +# +# Usage: awk -f gen-cpu-sysregs-header.awk $LINUX_PATH/arch/arm64/tools/sysreg + +BEGIN { + print "" +} END { + print "" +} + +# skip blank lines and comment lines +/^$/ { next } +/^[\t ]*#/ { next } + +/^Sysreg\t/ || /^Sysreg /{ + + reg = $2 + op0 = $3 + op1 = $4 + crn = $5 + crm = $6 + op2 = $7 +
scripts/gen-cpu-sysregs-header.awk line 35
Quoted 10 lines
scripts/gen-cpu-sysregs-header.awk new file +10
-0+ if (op0 == 3 && (op1>=0 && op1<=3) && crn==0 && (crm>=0 && crm<=7) && (op2>=0 && op2<=7)) { + print "DEF("reg", "op0", "op1", "crn", "crm", "op2")" + } + next +} + +{ + /* skip all other lines */ + next +}
Generated source files should have a comment at the top noting that they're autogenerated and how to regenerate them, please.
Quoted 10 lines
scripts/update-aarch64-sysreg-code.sh new file +4
-0@@ -0,0 +1,26 @@ +#!/bin/sh -e +# +# SPDX-License-Identifier: GPL-2.0-or-later +# Update target/arm/cpu-sysregs.h
scripts/update-aarch64-sysreg-code.sh line 14
Quoted 10 lines
scripts/update-aarch64-sysreg-code.sh new file +10
-0+# from a linux source tree (arch/arm64/tools/sysreg) +# +# Copyright Red Hat, Inc. 2024 +# +# Authors: +# Eric Auger <[email protected]> +# + +linux="$1" +output="$PWD"
We seem to set this but then not use it.
scripts/update-aarch64-sysreg-code.sh line 26
Quoted 12 lines
scripts/update-aarch64-sysreg-code.sh new file +12
-0+ +if [ -z "$linux" ] || ! [ -d "$linux" ]; then + cat << EOF +usage: update-aarch64-sysreg-code.sh LINUX_PATH + +LINUX_PATH Linux kernel directory to obtain the headers from +EOF + exit 1 +fi + +awk -f gen-cpu-sysregs-header.awk \ + $linux/arch/arm64/tools/sysreg > ../target/arm/cpu-sysregs.h.inc
This looks like it is assuming that the user runs the script from within the scripts/ directory ?
Following the same command line conventions as our existing scripts/update-linux-headers.sh is probably the least surprising thing.
thanks
-- PMM
Re: [PATCH v7 12/14] arm/cpu: Add sysreg generation scripts
Quoted 20 lines · Peter Maydell
Quoted 18 lines · Cornelia Huck
From: Eric Auger <[email protected]>
Introduce scripts that automate the generation of system register definitions from a given linux source tree
arch/arm64/tools/sysreg.Invocation of
./update-aarch64-sysreg-code.sh $PATH_TO_LINUX_SOURCE_TREE in scripts directory generates target/arm/cpu-sysregs.h.inc containing defines for all system registers.[CH: update to handle current kernel sysregs structure, and to emit
the re-worked register structures; cpu properties will be added later]Reviewed-by Sebastian Ott <[email protected]>Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>---
Quoted 8 lines
scripts/gen-cpu-sysregs-header.awk
Quoted 5 lines
scripts/gen-cpu-sysregs-header.awk new file +0
-0This should probably have 'arm' in the filename somewhere, unless it's really architecture-agnostic, which I don't think it is.
Nod.
Quoted 8 lines
scripts/gen-cpu-sysregs-header.awk line 1
Quoted 3 lines
scripts/gen-cpu-sysregs-header.awk new file +1
-0@@ -0,0 +1,35 @@ +#!/bin/awk -fDoes this really need to be in awk? Our standard scripting language is python. This isn't run at build time so there's no "extra dependency" issue, but we currently use awk only minimally and almost always for trivial stuff.
Much of this originally was inspired by the equivalent tooling in Linux that creates definitions from the same sysreg file. (There's another, more complicated awk script in the cpu model series that creates definitions for the individual fields.) I can try to rewrite that in python, but I think awk is actually not a bad tool to use here.
Quoted 31 lines
Quoted 31 lines
scripts/gen-cpu-sysregs-header.awk new file +30
-0+# SPDX-License-Identifier: GPL-2.0-or-later +# gen-cpu-sysregs-header.awk: arm64 sysreg header include generator +# +# Usage: awk -f gen-cpu-sysregs-header.awk $LINUX_PATH/arch/arm64/tools/sysreg + +BEGIN { + print "" +} END { + print "" +} + +# skip blank lines and comment lines +/^$/ { next } +/^[\t ]*#/ { next } + +/^Sysreg\t/ || /^Sysreg /{ + + reg = $2 + op0 = $3 + op1 = $4 + crn = $5 + crm = $6 + op2 = $7 + + if (op0 == 3 && (op1>=0 && op1<=3) && crn==0 && (crm>=0 && crm<=7) && (op2>=0 && op2<=7)) { + print "DEF("reg", "op0", "op1", "crn", "crm", "op2")" + } + next +} +
Quoted 8 lines
scripts/gen-cpu-sysregs-header.awk line 35
Quoted 4 lines
scripts/gen-cpu-sysregs-header.awk new file +4
-0+{ + /* skip all other lines */ + next +}Generated source files should have a comment at the top noting that they're autogenerated and how to regenerate them, please.
ok
Quoted 15 lines
Quoted 15 lines
scripts/update-aarch64-sysreg-code.sh new file +8
-0@@ -0,0 +1,26 @@ +#!/bin/sh -e +# +# SPDX-License-Identifier: GPL-2.0-or-later +# Update target/arm/cpu-sysregs.h +# from a linux source tree (arch/arm64/tools/sysreg) +# +# Copyright Red Hat, Inc. 2024 +#
Quoted 8 lines
scripts/update-aarch64-sysreg-code.sh line 14
Quoted 6 lines
scripts/update-aarch64-sysreg-code.sh new file +6
-0+# Authors: +# Eric Auger <[email protected]> +# + +linux="$1" +output="$PWD"We seem to set this but then not use it.
ok
Quoted 17 lines
scripts/update-aarch64-sysreg-code.sh line 26
Quoted 13 lines
scripts/update-aarch64-sysreg-code.sh new file +12
-0+ +if [ -z "$linux" ] || ! [ -d "$linux" ]; then + cat << EOF +usage: update-aarch64-sysreg-code.sh LINUX_PATH + +LINUX_PATH Linux kernel directory to obtain the headers from +EOF + exit 1 +fi + +awk -f gen-cpu-sysregs-header.awk \ + $linux/arch/arm64/tools/sysreg > ../target/arm/cpu-sysregs.h.incThis looks like it is assuming that the user runs the script from within the
scripts/directory ?
Quoted 3 lines
Following the same command line conventions as our existing
scripts/update-linux-headers.shis probably the least surprising thing.
Ok, will do.
PATCH v7 13/14 arm/cpu: switch to a generated cpu-sysregs.h.inc
In reply to Cornelia HuckGenerated against Linux 6.14-rc1.
--- target/arm/cpu-sysregs.h.inc | 43 +++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 13 deletions(-)
target/arm/cpu-sysregs.h.inc +30 -13
@@ -1,18 +1,8 @@ -DEF(ID_AA64PFR0_EL1, 3, 0, 0, 4, 0) -DEF(ID_AA64PFR1_EL1, 3, 0, 0, 4, 1) -DEF(ID_AA64SMFR0_EL1, 3, 0, 0, 4, 5) -DEF(ID_AA64DFR0_EL1, 3, 0, 0, 5, 0) -DEF(ID_AA64DFR1_EL1, 3, 0, 0, 5, 1) -DEF(ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0) -DEF(ID_AA64ISAR1_EL1, 3, 0, 0, 6, 1) -DEF(ID_AA64ISAR2_EL1, 3, 0, 0, 6, 2) -DEF(ID_AA64MMFR0_EL1, 3, 0, 0, 7, 0) -DEF(ID_AA64MMFR1_EL1, 3, 0, 0, 7, 1) -DEF(ID_AA64MMFR2_EL1, 3, 0, 0, 7, 2) -DEF(ID_AA64MMFR3_EL1, 3, 0, 0, 7, 3) + DEF(ID_PFR0_EL1, 3, 0, 0, 1, 0) DEF(ID_PFR1_EL1, 3, 0, 0, 1, 1) DEF(ID_DFR0_EL1, 3, 0, 0, 1, 2) +DEF(ID_AFR0_EL1, 3, 0, 0, 1, 3) DEF(ID_MMFR0_EL1, 3, 0, 0, 1, 4) DEF(ID_MMFR1_EL1, 3, 0, 0, 1, 5) DEF(ID_MMFR2_EL1, 3, 0, 0, 1, 6)
@@ -23,13 +13,40 @@ DEF(ID_ISAR2_EL1, 3, 0, 0, 2, 2) DEF(ID_ISAR3_EL1, 3, 0, 0, 2, 3) DEF(ID_ISAR4_EL1, 3, 0, 0, 2, 4) DEF(ID_ISAR5_EL1, 3, 0, 0, 2, 5) -DEF(ID_MMFR4_EL1, 3, 0, 0, 2, 6) DEF(ID_ISAR6_EL1, 3, 0, 0, 2, 7) +DEF(ID_MMFR4_EL1, 3, 0, 0, 2, 6) DEF(MVFR0_EL1, 3, 0, 0, 3, 0) DEF(MVFR1_EL1, 3, 0, 0, 3, 1) DEF(MVFR2_EL1, 3, 0, 0, 3, 2) DEF(ID_PFR2_EL1, 3, 0, 0, 3, 4) DEF(ID_DFR1_EL1, 3, 0, 0, 3, 5) DEF(ID_MMFR5_EL1, 3, 0, 0, 3, 6) +DEF(ID_AA64PFR0_EL1, 3, 0, 0, 4, 0) +DEF(ID_AA64PFR1_EL1, 3, 0, 0, 4, 1) +DEF(ID_AA64PFR2_EL1, 3, 0, 0, 4, 2) DEF(ID_AA64ZFR0_EL1, 3, 0, 0, 4, 4) +DEF(ID_AA64SMFR0_EL1, 3, 0, 0, 4, 5) +DEF(ID_AA64FPFR0_EL1, 3, 0, 0, 4, 7) +DEF(ID_AA64DFR0_EL1, 3, 0, 0, 5, 0) +DEF(ID_AA64DFR1_EL1, 3, 0, 0, 5, 1) +DEF(ID_AA64DFR2_EL1, 3, 0, 0, 5, 2) +DEF(ID_AA64AFR0_EL1, 3, 0, 0, 5, 4) +DEF(ID_AA64AFR1_EL1, 3, 0, 0, 5, 5) +DEF(ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0) +DEF(ID_AA64ISAR1_EL1, 3, 0, 0, 6, 1) +DEF(ID_AA64ISAR2_EL1, 3, 0, 0, 6, 2) +DEF(ID_AA64ISAR3_EL1, 3, 0, 0, 6, 3) +DEF(ID_AA64MMFR0_EL1, 3, 0, 0, 7, 0) +DEF(ID_AA64MMFR1_EL1, 3, 0, 0, 7, 1) +DEF(ID_AA64MMFR2_EL1, 3, 0, 0, 7, 2) +DEF(ID_AA64MMFR3_EL1, 3, 0, 0, 7, 3) +DEF(ID_AA64MMFR4_EL1, 3, 0, 0, 7, 4) +DEF(CCSIDR_EL1, 3, 1, 0, 0, 0) +DEF(CLIDR_EL1, 3, 1, 0, 0, 1) +DEF(CCSIDR2_EL1, 3, 1, 0, 0, 2) +DEF(GMID_EL1, 3, 1, 0, 0, 4) +DEF(SMIDR_EL1, 3, 1, 0, 0, 6) +DEF(CSSELR_EL1, 3, 2, 0, 0, 0) DEF(CTR_EL0, 3, 3, 0, 0, 1) +DEF(DCZID_EL0, 3, 3, 0, 0, 7) +
Signature · 1 line
2.49.0
Re: [PATCH v7 13/14] arm/cpu: switch to a generated cpu-sysregs.h.inc
Quoted 7 lines · Cornelia Huck
Generated against Linux 6.14-rc1.
Reviewed-by Sebastian Ott <[email protected]>Reviewed-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>---
Does it make sense to include all these extra registers? Some of them are not simple ID registers at all, for example ID_CCSIDR_EL1 is an array of registers, not a single value (in QEMU, stored in cpu->ccsidr[]), and CSSELR_EL1 is not an ID register at all, it's a normal read/write sysreg.
tahnks
-- PMM
Re: [PATCH v7 13/14] arm/cpu: switch to a generated cpu-sysregs.h.inc
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Cornelia Huck
Generated against Linux 6.14-rc1.
Reviewed-by Sebastian Ott <[email protected]>Reviewed-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>---
Quoted 6 lines
Does it make sense to include all these extra registers? Some of them are not simple ID registers at all, for example
ID_CCSIDR_EL1is an array of registers, not a single value (in QEMU, stored in cpu->ccsidr[]), andCSSELR_EL1is not an ID register at all, it's a normal read/write sysreg.
Oops, I think the generator needs to check for op1=={0,1,3} instead of including op1==2...
[Another issue that came up in recent discussions for the cpu model series is that recent kernels have made {MIDR,REVIDR,AIDR}_EL1 writable, but even though they are in the range the kernel reports writable registers in, the source sysreg file does not include them. I've changed the script to add them manually so far, but not sure if that is the best solution here.]
PATCH v7 14/14 arm/kvm: use fd instead of fdarray[2]
In reply to Cornelia HuckWe have fd, so might as well neaten things up.
--- target/arm/kvm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
target/arm/kvm.c +4 -4
@@ -348,11 +348,11 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) err |=get_host_cpu_reg (fd, ahcf,ID_ISAR6_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_MMFR4_EL1_IDX ); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.mvfr0, + err |=read_sys_reg32 (fd, &ahcf->isar.mvfr0,ARM64_SYS_REG (3 ,0 ,0 ,3 ,0 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.mvfr1, + err |=read_sys_reg32 (fd, &ahcf->isar.mvfr1,ARM64_SYS_REG (3 ,0 ,0 ,3 ,1 )); - err |=read_sys_reg32 (fdarray[2 ], &ahcf->isar.mvfr2, + err |=read_sys_reg32 (fd, &ahcf->isar.mvfr2,ARM64_SYS_REG (3 ,0 ,0 ,3 ,2 )); err |=get_host_cpu_reg (fd, ahcf,ID_PFR2_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_DFR1_EL1_IDX );
@@ -390,7 +390,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)if (pmu_supported) {/* PMCR_EL0 is only accessible if the vCPU has feature PMU_V3 */ - err |=read_sys_reg64 (fdarray[2 ], &ahcf->isar.reset_pmcr_el0, + err |=read_sys_reg64 (fd, &ahcf->isar.reset_pmcr_el0,ARM64_SYS_REG (3 ,3 ,9 ,12 ,0 )); }
Signature · 1 line
2.49.0
Friendly ping... anything else that needs to happen here?
Quoted 154 lines · Cornelia Huck
Some small fixes, including fixing up/adding SPDX identifiers, keeping the series bisectable, and updating
MAINTAINERS(please check if that's ok.)Also available at
https://gitlab.com/cohuck/qemu/-/commits/arm-rework-idreg-storage-v7<v6 cover letter>
Just some small changes:
- fixed up some botched conversions noted by Eric (thanks!)
- rebased to current master
- new patch with a small cleanup suggested by Eric<v5 cover letter>
Just a quick respin to fix a missed conversion inhvf.c.<v4 cover letter>
Next iteration of the id register patches; only small changes.Changed from v3:
- added R-bs (thanks!)
- added missing SPDX header
- merged patch introducing accessors for kvm to the first user
- skip over sysregs outside of the id register range when generating register definitions againAlso available at
https://gitlab.com/cohuck/qemu/-/commits/arm-rework-idreg-storage-v4<v3 cover letter>
Yet another update of the id register series, less changes this time around.Changed from v2:
- changed generation of the various register defines via the "DEF" magic suggested by Richard
- some kvm-only code moved tokvm.c; some code potentially useful to non-kvm code stayed out of there (the cpu model code will make use of it, and that one should be extendable outside of kvm -- a revised version of those patches is still in the works, but I'll be off for a few days and rather wanted to get this one out first)Also available at
https://gitlab.com/cohuck/qemu/-/commits/arm-rework-idreg-storage-v3<v2 cover letter>
Changed from v1:
- Noticed that we missed the hvf code. Converted, compiled, but not tested as I'm lacking an environment for testing.
- Hopefully incorporated most of the suggested changes -- if I missed something, it was unintentional unless mentioned below.
- fixed repeated inclusion of definitions
- hopefully made macros more robust
- removed distinction between reading 32/64 values, which was mostly adding churn for little value
- postponed generating property definitions to the cpu model patches, where they are actually used
- juggled hunks and moved them to the right patches
- fixed some typos
- rebased to a more recent code baseNOT changed from v1:
- definitions are still generated from the Linux sysregs file
- I still think updating the generated files on demand (so that we can double check the result) is the right thing to do
- I'm open to changing the source of the definitions from the sysregs file to the JSON definitions published by Arm; however, I first wanted to get the code using it right -- we can switch out the code generating the file to use a different source easily later on, and I'd also like to steal parts of the script from Linux once integrated (which I think hasn't happened yet?)<v1 cover letter>
[Note: I've kept the cc list from the last round of cpu model patches; so if you're confused as to why you're cc:ed here, take it as a heads-up that a new cpu model series will come along soon]
This patch series contains patches extracted from the larger cpu model series (RFC v2 last posted at
https://lore.kernel.org/qemu-devel/[email protected]/)
and aims at providing a base upon which we can continue with building support for cpu models, but which is hopefully already an improvement on its own.Main changes from the patches in that series include:
- post-pone the changes to handle KVM writable ID registers for cpu models (I have a series including that on top of this one)
- change how we store the list of ID registers, and access them basically, use an enum for indexing, and an enum doing encodings in a pattern similar to cpregs
- move some hunks to different patches
- update the scripts to generate the register descriptions, and run them against a recent Linux sysregs fileWhat I've kept:
- generating the register descriptions from the Linux sysregs file I think that file is still our best bet to generate the descriptions easily, and updating the definitions is a manual step that can be checked for unintended changes
- most of the hard work that Eric had been doing; all new bugs in there are my own :)</v1 cover letter>
</v2 cover letter>
</v3 cover letter>
</v4 cover letter>
</v5 cover letter>
</v6 cover letter>Cornelia Huck (2):
arm/cpu: switch to a generated cpu-sysregs.h.inc arm/kvm: use fd instead of fdarray[2]Eric Auger (12):
arm/cpu: Add sysreg definitions incpu-sysregs.harm/cpu: Store aa64isar0/aa64zfr0 into the idregs arrays arm/cpu: Store aa64isar1/2 into the idregs array arm/cpu: Store aa64pfr0/1 into the idregs array arm/cpu: Store aa64mmfr0-3 into the idregs array arm/cpu: Store aa64dfr0/1 into the idregs array arm/cpu: Store aa64smfr0 into the idregs array arm/cpu: Store id_isar0-7 into the idregs array arm/cpu: Store id_pfr0/1/2 into the idregs array arm/cpu: Store id_dfr0/1 into the idregs array arm/cpu: Store id_mmfr0-5 into the idregs array arm/cpu: Add sysreg generation scriptsMAINTAINERS | 1 + hw/intc/armv7m_nvic.c | 27 +- scripts/gen-cpu-sysregs-header.awk | 35 ++ scripts/update-aarch64-sysreg-code.sh | 26 ++ target/arm/cpu-features.h | 317 +++++++++--------- target/arm/cpu-sysregs.h | 42 +++ target/arm/cpu-sysregs.h.inc | 52 +++ target/arm/cpu.c | 111 +++---- target/arm/cpu.h | 80 +++-- target/arm/cpu64.c | 128 +++---- target/arm/helper.c | 68 ++-- target/arm/hvf/hvf.c | 39 ++- target/arm/internals.h | 6 +- target/arm/kvm.c | 139 ++++---- target/arm/ptw.c | 6 +- target/arm/tcg/cpu-v7m.c | 174 +++++----- target/arm/tcg/cpu32.c | 320 +++++++++--------- target/arm/tcg/cpu64.c | 459 +++++++++++++------------- 18 files changed, 1105 insertions(+), 925 deletions(-) create mode 100755 scripts/gen-cpu-sysregs-header.awk create mode 100755 scripts/update-aarch64-sysreg-code.sh create mode 100644 target/arm/cpu-sysregs.h create mode 100644 target/arm/cpu-sysregs.h.incSignature · 1 line
2.49.0
Quoted 2 lines · Cornelia Huck
Friendly ping... anything else that needs to happen here?
Sorry I've neglected this for so long. I'm OK with the general idea, but I've commented in a couple of places about compile failures and other things. You'll also find it needs a rebase, there's a trivial conflict in an early patch.
thanks
-- PMM