kvm/arm: Introduce a customizable aarch64 KVM host model
Subsystems (3)
v10 cover kvm/arm: Introduce a customizable aarch64 KVM host model
This series enhances the current host KVM model with capability to set writable ID reg fields.
Since v6.7 kernel, KVM/arm allows the userspace to overwrite the values of a subset of ID regs. The list of writable fields continues to grow. The feature ID range is defined as the AArch64 System register space with op0==3, op1=={0, 1, 3}, CRn==0, CRm=={0-7}, op2=={0-7}.
The end goal is to get more flexibility when migrating guests between different host hardware. This series is a prerequisite for aarch64 named vcpu models.
QEMU retrieves the writable ID fields from KVM UAPI and match them against a generated description of ID regs and their named fields that stem from AARCHMRS Registers.json file. Current description is based on latest 2026-03 edition. The content of the generated files was compared against kernel linux/arch/arm64/tools/sysreg file. It is not straightforward to have unit tests for python scripts as there are many cases for field extraction.
For each writable named field a uint64 property is created following the "SYSREG_<REG>_<FIELD>" naming convention. REG and FIELD names are those described in ARM ARM Reference manual.
SYSREG properties are applied at the end of the initialization chain, after legacy composite options (sve, pauth, ...). They do not substitute to them because legacy options do more than just changing the value of ID registers. They may also interact with KVM to init the vcpu with specific features or set some VM capabilities. SYSREG properties just affect the corresponding ID register field. Some checks are performed to make sure their value is not inconsistent with legacy composite options.
The list of SYSREG properties can be retrieved through the qmp monitor using query-cpu-model-expansion. They return the current value for the corresponding field. The qmp command also allows to test setting new values. In static mode, they are tested at qemu level only, against field length, arch enum values if any and consistency with legacy composite options. With full expansion, the values are tested against KVM using a scratch vcpu initialized with the right legacy composite property values.
Connie & Eric
This series can be found at:
https://github.com/eauger/qemu/tree/arm-cpu-model-v10
History:
--------
v9 -> v10:
addressed all Khushit's comments/suggestions. Here is the list of main changes.
- MIDR, REVIDIR, MPIDR storage move (this may be sent as a separate prerequisite series)
- rebase on demux register handler that has just landed
- update the json extractor accordingly
- Generate conditional enum values
- reorganize script patches to have the generated header in the same patch which is much easier to maintain
- New macro to encode arch enum value and ValueRanges which gives a much more compact header. Also enabled to remove check-patch error
- Put a maximum of code in cpu64.c instead of kvm.c to pave the way for other acceleration support. Also changed the consistency check handling by skipping potential new props that are known to collide with legacy composite options
- add writable_only param to pave the way for exposing all fields as props
- fixes in the qmp expansion code
Cornelia Huck (3):
target/arm/kvm: Retrieve writable ID reg map
arm-qmp-cmds: introspection for ID register props arm/cpu-features: Document ID reg properties
Eric Auger (22):
target/arm: Move REVIDR into isar.idregs[] storage target/arm: Move MIDR into isar.idregs[] storage target/arm: Enforce MPIDR into isar.idregs[] storage target/arm/cpu-sysregs.h.inc: Update with automatic generation arm/cpu: Add infra to handle generated ID register definitions target/arm/cpu-idregs.h.inc: Generate with script target/arm/cpu-idregs.h.inc: Generate enum values target/arm/cpu-idregs.h.inc: Generate reserved fields hw/arm/virt: Make sure virt_get_caches() keeps on reading CLIDR_EL1 as
0
arm/kvm: Initialize isar.idregs[] with all writable host ID regs target/arm/cpu64: Add properties for writable IDReg fields target/arm/kvm: Implement SYSREG property setter and getter target/arm/kvm: Let kvm_arm_init_cpreg_list propagate an error handle target/arm/kvm: Pass an Error handle to kvm_arch_init_vcpu target/arm/kvm: Introduce kvm_arm_override_idreg_field helper target/arm/cpu64: Introduce arm_cpu_apply_sysreg_props target/arm/kvm: Apply SYSREG props
target/arm/kvm: Add consistency checking for SYSREG props target/arm/cpu64: Add helper to test SYSREG props against a scratch
vcpu
target/arm/kvm: Add an error handle to
kvm_arm_create_scratch_host_vcpu
target/arm/kvm: Introduce kvm_arm_vcpu_prepare_init_features helper target/arm/kvm: Introduce kvm_arm_create_init_scratch_vcpu()
Shaju Abraham (1):
target/arm/cpu_idregs: Generate tables for Arm64 ID registers and
fields
docs/system/arm/cpu-features.rst | 111 +- include/system/kvm.h | 2 +- target/arm/cpu-idregs.h | 76 + target/arm/cpu.h | 12 +- target/arm/kvm_arm.h | 26 +- target/arm/cpu-idregs.h.inc | 1549 +++++++++++++++++ target/arm/cpu-sysregs.h.inc | 13 + accel/kvm/kvm-all.c | 15 +- hw/arm/virt.c | 11 + hw/intc/armv7m_nvic.c | 4 +- target/arm/arm-qmp-cmds.c | 130 +- target/arm/cpu-idregs.c | 93 + target/arm/cpu-max.c | 4 +- target/arm/cpu.c | 24 +- target/arm/cpu64.c | 330 +++- target/arm/helper.c | 29 +- target/arm/hvf/hvf.c | 6 +- target/arm/kvm-stub.c | 17 + target/arm/kvm.c | 277 ++- target/arm/tcg/cpu-v7m.c | 18 +- target/arm/tcg/cpu32.c | 37 +- target/arm/tcg/cpu64.c | 42 +- target/arm/whpx/whpx-all.c | 6 +- target/i386/kvm/kvm.c | 22 +- target/loongarch/kvm/kvm.c | 27 +- target/ppc/kvm.c | 6 +- target/riscv/kvm/kvm-cpu.c | 3 +- target/s390x/kvm/kvm.c | 2 +- scripts/aarch64_sysreg_helpers.py | 118 ++ .../update-aarch64-cpu-sysreg-properties.py | 331 ++++ scripts/update-aarch64-cpu-sysregs-header.py | 59 + target/arm/meson.build | 1 + target/arm/trace-events | 9 + 33 files changed, 3232 insertions(+), 178 deletions(-) create mode 100644 target/arm/cpu-idregs.h create mode 100644 target/arm/cpu-idregs.h.inc create mode 100644 target/arm/cpu-idregs.c create mode 100644 scripts/aarch64_sysreg_helpers.py create mode 100644 scripts/update-aarch64-cpu-sysreg-properties.py create mode 100755 scripts/update-aarch64-cpu-sysregs-header.py
Signature · 1 line
2.53.0
PATCH v10 1/26 target/arm: Move REVIDR into isar.idregs[] storage
Move REVIDR into the isar.idregs[] array as other ID registers. This will allow to overwrite it as others.
--- target/arm/cpu.h | 1 - target/arm/cpu-sysregs.h.inc | 1 + hw/intc/armv7m_nvic.c | 2 +- target/arm/cpu-max.c | 2 +- target/arm/cpu64.c | 2 +- target/arm/helper.c | 2 +- target/arm/tcg/cpu-v7m.c | 4 ++-- target/arm/tcg/cpu32.c | 4 ++-- target/arm/tcg/cpu64.c | 20 ++++++++++---------- 9 files changed, 19 insertions(+), 19 deletions(-)
target/arm/cpu.h +0 -1
@@ -1124,7 +1124,6 @@ struct ArchCPU {uint64_t idregs[NUM_ID_IDX ]; } isar;uint64_t midr; -uint32_t revidr;uint32_t reset_fpsid;uint64_t ctr;uint32_t reset_sctlr;
target/arm/cpu-sysregs.h.inc +1 -0
@@ -44,3 +44,4 @@ DEF(ID_PFR2_EL1, 3, 0, 0, 3, 4) 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(REVIDR_EL1, 3, 0, 0, 0, 6)
hw/intc/armv7m_nvic.c +1 -1
@@ -1051,7 +1051,7 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)if (!arm_feature (&cpu->env,ARM_FEATURE_V8_1M )) { goto bad_offset; } -return cpu->revidr; +return GET_IDREG (isar,REVIDR );case 0xd00 :/* CPUID Base. */ return cpu->midr;case 0xd04 :/* Interrupt Control State (ICSR) */
target/arm/cpu-max.c +1 -1
@@ -37,7 +37,7 @@ void aarch64_aa32_a57_init(ARMCPU *cpu, bool aarch64_enabled) cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A57 ; } cpu->midr =0x411fd070 ; - cpu->revidr =0x00000000 ; +SET_IDREG (isar,REVIDR ,0 ); cpu->reset_fpsid =0x41034070 ; cpu->isar.mvfr0 =0x10110222 ; cpu->isar.mvfr1 =0x12111111 ;
target/arm/cpu64.c +1 -1
@@ -717,7 +717,7 @@ static void aarch64_a53_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_PMU ); cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A53 ; cpu->midr =0x410fd034 ; - cpu->revidr =0x00000100 ; +SET_IDREG (isar,REVIDR ,0x00000100 ); cpu->reset_fpsid =0x41034070 ; cpu->isar.mvfr0 =0x10110222 ; cpu->isar.mvfr1 =0x12111111 ;
target/arm/helper.c +1 -1
@@ -7415,7 +7415,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .accessfn = access_tid1, .fgt = FGT_REVIDR_EL1, - .type = ARM_CP_CONST, .resetvalue = cpu->revidr }, + .type = ARM_CP_CONST, .resetvalue = GET_IDREG(&cpu->isar, REVIDR) }, };ARMCPRegInfo id_v8_midr_alias_cp_reginfo = { .name ="MIDR" , .type =ARM_CP_ALIAS |ARM_CP_CONST |ARM_CP_NO_GDB ,
target/arm/tcg/cpu-v7m.c +2 -2
@@ -211,7 +211,7 @@ static void cortex_m55_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_M_SECURITY );set_feature (&cpu->env,ARM_FEATURE_THUMB_DSP ); cpu->midr =0x410fd221 ;/* r0p1 */ - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 ); cpu->pmsav7_dregion =16 ; cpu->sau_sregion =8 ;/* These are the MVFR* values for the FPU + full MVE configuration */
@@ -249,7 +249,7 @@ static void cortex_m85_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_M_SECURITY );set_feature (&cpu->env,ARM_FEATURE_THUMB_DSP ); cpu->midr =0x411fd231 ;/* r1p1 */ - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 ); cpu->pmsav7_dregion =16 ; cpu->sau_sregion =8 ;/* These are the MVFR* values for the FPU + full MVE configuration */
target/arm/tcg/cpu32.c +2 -2
@@ -456,7 +456,7 @@ static void cortex_a15_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_PMU );/* r4p0 cpu, not requiring expensive tlb flush errata */ cpu->midr =0x414fc0f0 ; - cpu->revidr =0x0 ; +SET_IDREG (isar,REVIDR ,0 ); cpu->reset_fpsid =0x410430f0 ; cpu->isar.mvfr0 =0x10110222 ; cpu->isar.mvfr1 =0x11111111 ;
@@ -647,7 +647,7 @@ static void cortex_r52_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_CBAR_RO );set_feature (&cpu->env,ARM_FEATURE_AUXCR ); cpu->midr =0x411fd133 ;/* r1p3 */ - cpu->revidr =0x00000000 ; +SET_IDREG (isar,REVIDR ,0 ); cpu->reset_fpsid =0x41034023 ; cpu->isar.mvfr0 =0x10110222 ; cpu->isar.mvfr1 =0x12111111 ;
target/arm/tcg/cpu64.c +10 -10
@@ -48,7 +48,7 @@ static void aarch64_a35_initfn(Object *obj)/* From B2.2 AArch64 identification registers. */ cpu->midr =0x411fd040 ; - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 ); cpu->ctr =0x84448004 ;SET_IDREG (isar,ID_PFR0 ,0x00000131 );SET_IDREG (isar,ID_PFR1 ,0x00011011 );
@@ -248,7 +248,7 @@ static void aarch64_a55_initfn(Object *obj)SET_IDREG (isar,ID_PFR1 ,0x00011011 );SET_IDREG (isar,ID_PFR2 ,0x00000011 ); cpu->midr =0x412FD050 ;/* r2p0 */ - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 );/* From B2.23 CCSIDR_EL1 */ /* 32KB L1 dcache */
@@ -292,7 +292,7 @@ static void aarch64_a72_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); cpu->midr =0x410fd083 ; - cpu->revidr =0x00000000 ; +SET_IDREG (isar,REVIDR ,0 ); cpu->reset_fpsid =0x41034080 ; cpu->isar.mvfr0 =0x10110222 ; cpu->isar.mvfr1 =0x12111111 ;
@@ -383,7 +383,7 @@ static void aarch64_a76_initfn(Object *obj)SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_PFR2 ,0x00000011 ); cpu->midr =0x414fd0b1 ;/* r4p1 */ - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 );/* From B2.18 CCSIDR_EL1 */ /* 64KB L1 dcache */
@@ -456,7 +456,7 @@ static void aarch64_a78ae_initfn(Object *obj)SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_PFR2 ,0x00000011 ); cpu->midr =0x410fd423 ;/* r0p3 */ - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 );/* From 3.2.33 CCSIDR_EL1 */ /* 64KB L1 dcache */
@@ -501,7 +501,7 @@ static void aarch64_a64fx_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); cpu->midr =0x461f0010 ; - cpu->revidr =0x00000000 ; +SET_IDREG (isar,REVIDR ,0 ); cpu->ctr =0x86668006 ; cpu->reset_sctlr =0x30000180 ;SET_IDREG (isar,ID_AA64PFR0 ,0x0000000101111111 );/* No RAS Extensions */
@@ -707,7 +707,7 @@ static void aarch64_neoverse_n1_initfn(Object *obj)SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_PFR2 ,0x00000011 ); cpu->midr =0x414fd0c1 ;/* r4p1 */ - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 );/* From B2.23 CCSIDR_EL1 */ /* 64KB L1 dcache */
@@ -787,7 +787,7 @@ static void aarch64_neoverse_v1_initfn(Object *obj)SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_PFR2 ,0x00000011 ); cpu->midr =0x411FD402 ;/* r1p2 */ - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 );/* * The Neoverse-V1 r1p2 TRM lists 32-bit format CCSIDR_EL1 values,
@@ -984,7 +984,7 @@ static void aarch64_a710_initfn(Object *obj)/* Ordered by Section B.4: AArch64 registers */ cpu->midr =0x412FD471 ;/* r2p1 */ - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 );SET_IDREG (isar,ID_PFR0 ,0x21110131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_DFR0 ,0x16011099 );
@@ -1087,7 +1087,7 @@ static void aarch64_neoverse_n2_initfn(Object *obj)/* Ordered by Section B.5: AArch64 ID registers */ cpu->midr =0x410FD493 ;/* r0p3 */ - cpu->revidr =0 ; +SET_IDREG (isar,REVIDR ,0 );SET_IDREG (isar,ID_PFR0 ,0x21110131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_DFR0 ,0x16011099 );
Signature · 1 line
2.53.0
Re: [PATCH v10 01/26] target/arm: Move REVIDR into isar.idregs[] storage
Quoted 6 lines · Eric Auger
Move REVIDR into the isar.idregs[] array as other ID registers. This will allow to overwrite it as others.
Signed-off-by Eric Auger <[email protected]>---
thanks
-- PMM
PATCH v10 2/26 target/arm: Move MIDR into isar.idregs[] storage
In reply to Eric AugerMove MIDR into the isar.idregs[] array as other ID registers. This will allow to overwrite it as others.
--- target/arm/cpu.h | 1 - target/arm/cpu-sysregs.h.inc | 1 + hw/intc/armv7m_nvic.c | 2 +- target/arm/cpu-max.c | 2 +- target/arm/cpu.c | 2 +- target/arm/cpu64.c | 2 +- target/arm/helper.c | 13 +++++++------ target/arm/hvf/hvf.c | 4 ++-- target/arm/tcg/cpu-v7m.c | 14 +++++++------- target/arm/tcg/cpu32.c | 33 +++++++++++++++++---------------- target/arm/tcg/cpu64.c | 22 +++++++++++----------- target/arm/whpx/whpx-all.c | 4 ++-- 12 files changed, 51 insertions(+), 49 deletions(-)
target/arm/cpu.h +0 -1
@@ -1123,7 +1123,6 @@ struct ArchCPU {uint64_t reset_pmcr_el0;uint64_t idregs[NUM_ID_IDX ]; } isar; -uint64_t midr;uint32_t reset_fpsid;uint64_t ctr;uint32_t reset_sctlr;
target/arm/cpu-sysregs.h.inc +1 -0
@@ -41,6 +41,7 @@ DEF(ID_MMFR5_EL1, 3, 0, 0, 3, 6) DEF(ID_PFR0_EL1, 3, 0, 0, 1, 0) DEF(ID_PFR1_EL1, 3, 0, 0, 1, 1) DEF(ID_PFR2_EL1, 3, 0, 0, 3, 4) +DEF(MIDR_EL1, 3, 0, 0, 0, 0) DEF(MVFR0_EL1, 3, 0, 0, 3, 0) DEF(MVFR1_EL1, 3, 0, 0, 3, 1) DEF(MVFR2_EL1, 3, 0, 0, 3, 2)
hw/intc/armv7m_nvic.c +1 -1
@@ -1053,7 +1053,7 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) }return GET_IDREG (isar,REVIDR );case 0xd00 :/* CPUID Base. */ -return cpu->midr; +return GET_IDREG (isar,MIDR );case 0xd04 :/* Interrupt Control State (ICSR) */ /* VECTACTIVE */ val = cpu->env.v7m.exception;
target/arm/cpu-max.c +1 -1
@@ -36,7 +36,7 @@ void aarch64_aa32_a57_init(ARMCPU *cpu, bool aarch64_enabled)if (kvm_enabled ()) { cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A57 ; } - cpu->midr =0x411fd070 ; +SET_IDREG (isar,MIDR ,0x411fd070 );SET_IDREG (isar,REVIDR ,0 ); cpu->reset_fpsid =0x41034070 ; cpu->isar.mvfr0 =0x10110222 ;
target/arm/cpu.c +1 -1
@@ -2501,7 +2501,7 @@ static ObjectClass *arm_cpu_class_by_name(const char *cpu_model) }static const Property arm_cpu_properties[] = { -DEFINE_PROP_UINT64 ("midr" ,ARMCPU , midr,0 ), +DEFINE_PROP_UINT64 ("midr" ,ARMCPU , isar.idregs[MIDR_EL1_IDX ],0 ),DEFINE_PROP_UINT64 ("mp-affinity" ,ARMCPU , mp_affinity,ARM64_AFFINITY_INVALID ),DEFINE_PROP_INT32 ("node-id" ,ARMCPU , node_id,CPU_UNSET_NUMA_NODE_ID ),
target/arm/cpu64.c +1 -1
@@ -716,7 +716,7 @@ static void aarch64_a53_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A53 ; - cpu->midr =0x410fd034 ; +SET_IDREG (isar,MIDR ,0x410fd034 );SET_IDREG (isar,REVIDR ,0x00000100 ); cpu->reset_fpsid =0x41034070 ; cpu->isar.mvfr0 =0x10110222 ;
target/arm/helper.c +7 -6
@@ -7153,12 +7153,12 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "VPIDR", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0, .access = PL2_RW, .accessfn = access_el3_aa32ns, - .resetvalue = cpu->midr, + .resetvalue = GET_IDREG(&cpu->isar, MIDR), .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_C_NZ, .fieldoffset = offsetoflow32(CPUARMState, cp15.vpidr_el2) }, { .name = "VPIDR_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0, - .access = PL2_RW, .resetvalue = cpu->midr, + .access = PL2_RW, .resetvalue = GET_IDREG(&cpu->isar, MIDR), .type = ARM_CP_EL3_NO_EL2_C_NZ, .nv2_redirect_offset = 0x88, .fieldoffset = offsetof(CPUARMState, cp15.vpidr_el2) },
@@ -7377,7 +7377,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)*/ { .name = "MIDR", .cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = CP_ANY, - .access = PL1_R, .resetvalue = cpu->midr, + .access = PL1_R, .resetvalue = GET_IDREG(&cpu->isar, MIDR), .writefn = arm_cp_write_ignore, .raw_writefn = raw_write, .readfn = midr_read, .fieldoffset = offsetof(CPUARMState, cp15.c0_cpuid),
@@ -7402,14 +7402,15 @@ void register_cp_regs_for_features(ARMCPU *cpu)ARMCPRegInfo id_v8_midr_cp_reginfo[] = { { .name ="MIDR_EL1" , .state =ARM_CP_STATE_BOTH , .opc0 =3 , .opc1 =0 , .crn =0 , .crm =0 , .opc2 =0 , - .access =PL1_R , .type =ARM_CP_NO_RAW , .resetvalue = cpu->midr, + .access =PL1_R , .type =ARM_CP_NO_RAW , + .resetvalue =GET_IDREG (&cpu->isar,MIDR ), .fgt =FGT_MIDR_EL1 , .fieldoffset = offsetof(CPUARMState, cp15.c0_cpuid), .readfn = midr_read },/* crn = 0 op1 = 0 crm = 0 op2 = 7 : AArch32 aliases of MIDR */ { .name ="MIDR" , .type =ARM_CP_ALIAS |ARM_CP_CONST , .cp =15 , .crn =0 , .crm =0 , .opc1 =0 , .opc2 =7 , - .access =PL1_R , .resetvalue = cpu->midr }, + .access =PL1_R , .resetvalue =GET_IDREG (&cpu->isar,MIDR ) }, { .name ="REVIDR_EL1" , .state =ARM_CP_STATE_BOTH , .opc0 =3 , .opc1 =0 , .crn =0 , .crm =0 , .opc2 =6 , .access =PL1_R ,
@@ -7420,7 +7421,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)ARMCPRegInfo id_v8_midr_alias_cp_reginfo = { .name ="MIDR" , .type =ARM_CP_ALIAS |ARM_CP_CONST |ARM_CP_NO_GDB , .cp =15 , .crn =0 , .crm =0 , .opc1 =0 , .opc2 =4 , - .access =PL1_R , .resetvalue = cpu->midr + .access =PL1_R , .resetvalue =GET_IDREG (&cpu->isar,MIDR ) };ARMCPRegInfo id_cp_reginfo[] = {/* These are common to v8 and pre-v8 */
target/arm/hvf/hvf.c +2 -2
@@ -1295,7 +1295,7 @@ void hvf_arm_set_cpu_features_from_host(ARMCPU *cpu) cpu->dtb_compatible = arm_host_cpu_features.dtb_compatible; cpu->isar = arm_host_cpu_features.isar; cpu->env.features = arm_host_cpu_features.features; - cpu->midr = arm_host_cpu_features.midr; +SET_IDREG (&cpu->isar,MIDR , arm_host_cpu_features.midr); cpu->reset_sctlr = arm_host_cpu_features.reset_sctlr; cpu->sme_vq.supported = arm_host_cpu_features.sme_vq_supported; }
@@ -1472,7 +1472,7 @@ int hvf_arch_init_vcpu(CPUState *cpu)/* Set CP_NO_RAW system registers on init */ ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_MIDR_EL1 , - arm_cpu->midr); +GET_IDREG (&arm_cpu->isar,MIDR ));assert_hvf_ok (ret); ret = hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_MPIDR_EL1,
target/arm/tcg/cpu-v7m.c +7 -7
@@ -49,7 +49,7 @@ static void cortex_m0_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V6 );set_feature (&cpu->env,ARM_FEATURE_M ); - cpu->midr =0x410cc200 ; +SET_IDREG (isar,MIDR ,0x410cc200 );/* * These ID register values are not guest visible, because
@@ -83,7 +83,7 @@ static void cortex_m3_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V7 );set_feature (&cpu->env,ARM_FEATURE_M );set_feature (&cpu->env,ARM_FEATURE_M_MAIN ); - cpu->midr =0x410fc231 ; +SET_IDREG (isar,MIDR ,0x410fc231 ); cpu->pmsav7_dregion =8 ;SET_IDREG (isar,ID_PFR0 ,0x00000030 );SET_IDREG (isar,ID_PFR1 ,0x00000200 );
@@ -111,7 +111,7 @@ static void cortex_m4_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_M );set_feature (&cpu->env,ARM_FEATURE_M_MAIN );set_feature (&cpu->env,ARM_FEATURE_THUMB_DSP ); - cpu->midr =0x410fc240 ;/* r0p0 */ +SET_IDREG (isar,MIDR ,0x410fc240 );/* r0p0 */ cpu->pmsav7_dregion =8 ; cpu->isar.mvfr0 =0x10110021 ; cpu->isar.mvfr1 =0x11000011 ;
@@ -142,7 +142,7 @@ static void cortex_m7_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_M );set_feature (&cpu->env,ARM_FEATURE_M_MAIN );set_feature (&cpu->env,ARM_FEATURE_THUMB_DSP ); - cpu->midr =0x411fc272 ;/* r1p2 */ +SET_IDREG (isar,MIDR ,0x411fc272 );/* r1p2 */ cpu->pmsav7_dregion =8 ; cpu->isar.mvfr0 =0x10110221 ; cpu->isar.mvfr1 =0x12000011 ;
@@ -174,7 +174,7 @@ static void cortex_m33_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_M_MAIN );set_feature (&cpu->env,ARM_FEATURE_M_SECURITY );set_feature (&cpu->env,ARM_FEATURE_THUMB_DSP ); - cpu->midr =0x410fd213 ;/* r0p3 */ +SET_IDREG (isar,MIDR ,0x410fd213 );/* r0p3 */ cpu->pmsav7_dregion =16 ; cpu->sau_sregion =8 ; cpu->isar.mvfr0 =0x10110021 ;
@@ -210,7 +210,7 @@ static void cortex_m55_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_M_MAIN );set_feature (&cpu->env,ARM_FEATURE_M_SECURITY );set_feature (&cpu->env,ARM_FEATURE_THUMB_DSP ); - cpu->midr =0x410fd221 ;/* r0p1 */ +SET_IDREG (isar,MIDR ,0x410fd221 );/* r0p1 */ SET_IDREG (isar,REVIDR ,0 ); cpu->pmsav7_dregion =16 ; cpu->sau_sregion =8 ;
@@ -248,7 +248,7 @@ static void cortex_m85_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_M_MAIN );set_feature (&cpu->env,ARM_FEATURE_M_SECURITY );set_feature (&cpu->env,ARM_FEATURE_THUMB_DSP ); - cpu->midr =0x411fd231 ;/* r1p1 */ +SET_IDREG (isar,MIDR ,0x411fd231 );/* r1p1 */ SET_IDREG (isar,REVIDR ,0 ); cpu->pmsav7_dregion =16 ; cpu->sau_sregion =8 ;
target/arm/tcg/cpu32.c +17 -16
@@ -27,7 +27,8 @@ static void arm926_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V5 );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_CACHE_TEST_CLEAN ); - cpu->midr =0x41069265 ; +SET_IDREG (&cpu->isar,MIDR ,0x41069265 ); + cpu->reset_fpsid =0x41011090 ; cpu->ctr =0x1dd20d2 ; cpu->reset_sctlr =0x00050078 ;
@@ -54,7 +55,7 @@ static void arm946_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V5 );set_feature (&cpu->env,ARM_FEATURE_PMSA );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS ); - cpu->midr =0x41059461 ; +SET_IDREG (&cpu->isar,MIDR ,0x41059461 ); cpu->ctr =0x0f004006 ; cpu->reset_sctlr =0x00000078 ; }
@@ -68,7 +69,7 @@ static void arm1026_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_AUXCR );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_CACHE_TEST_CLEAN ); - cpu->midr =0x4106a262 ; +SET_IDREG (&cpu->isar,MIDR ,0x4106a262 ); cpu->reset_fpsid =0x410110a0 ; cpu->ctr =0x1dd20d2 ; cpu->reset_sctlr =0x00050078 ;
@@ -117,7 +118,7 @@ static void arm1136_r2_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_CACHE_DIRTY_REG );set_feature (&cpu->env,ARM_FEATURE_CACHE_BLOCK_OPS ); - cpu->midr =0x4107b362 ; +SET_IDREG (isar,MIDR ,0x4107b362 ); cpu->reset_fpsid =0x410120b4 ; cpu->isar.mvfr0 =0x11111111 ; cpu->isar.mvfr1 =0x00000000 ;
@@ -149,7 +150,7 @@ static void arm1136_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_CACHE_DIRTY_REG );set_feature (&cpu->env,ARM_FEATURE_CACHE_BLOCK_OPS ); - cpu->midr =0x4117b363 ; +SET_IDREG (isar,MIDR ,0x4117b363 ); cpu->reset_fpsid =0x410120b4 ; cpu->isar.mvfr0 =0x11111111 ; cpu->isar.mvfr1 =0x00000000 ;
@@ -182,7 +183,7 @@ static void arm1176_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_CACHE_DIRTY_REG );set_feature (&cpu->env,ARM_FEATURE_CACHE_BLOCK_OPS );set_feature (&cpu->env,ARM_FEATURE_EL3 ); - cpu->midr =0x410fb767 ; +SET_IDREG (isar,MIDR ,0x410fb767 ); cpu->reset_fpsid =0x410120b5 ; cpu->isar.mvfr0 =0x11111111 ; cpu->isar.mvfr1 =0x00000000 ;
@@ -213,7 +214,7 @@ static void arm11mpcore_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_VAPA );set_feature (&cpu->env,ARM_FEATURE_MPIDR );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS ); - cpu->midr =0x410fb022 ; +SET_IDREG (isar,MIDR ,0x410fb022 ); cpu->reset_fpsid =0x410120b4 ; cpu->isar.mvfr0 =0x11111111 ; cpu->isar.mvfr1 =0x00000000 ;
@@ -257,7 +258,7 @@ static void cortex_a8_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); - cpu->midr =0x410fc080 ; +SET_IDREG (isar,MIDR ,0x410fc080 ); cpu->reset_fpsid =0x410330c0 ; cpu->isar.mvfr0 =0x11110222 ; cpu->isar.mvfr1 =0x00011111 ;
@@ -335,7 +336,7 @@ static void cortex_a9_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V7MP );set_feature (&cpu->env,ARM_FEATURE_CBAR );set_feature (&cpu->env,ARM_FEATURE_D32DIS ); - cpu->midr =0x410fc090 ; +SET_IDREG (isar,MIDR ,0x410fc090 ); cpu->reset_fpsid =0x41033090 ; cpu->isar.mvfr0 =0x11110222 ; cpu->isar.mvfr1 =0x01111111 ;
@@ -403,7 +404,7 @@ static void cortex_a7_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU );set_feature (&cpu->env,ARM_FEATURE_D32DIS ); - cpu->midr =0x410fc075 ; +SET_IDREG (isar,MIDR ,0x410fc075 ); cpu->reset_fpsid =0x41023075 ; cpu->isar.mvfr0 =0x10110222 ; cpu->isar.mvfr1 =0x11111111 ;
@@ -455,7 +456,7 @@ static void cortex_a15_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU );/* r4p0 cpu, not requiring expensive tlb flush errata */ - cpu->midr =0x414fc0f0 ; +SET_IDREG (isar,MIDR ,0x414fc0f0 );SET_IDREG (isar,REVIDR ,0 ); cpu->reset_fpsid =0x410430f0 ; cpu->isar.mvfr0 =0x10110222 ;
@@ -505,7 +506,7 @@ static void cortex_r5_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V7MP );set_feature (&cpu->env,ARM_FEATURE_PMSA );set_feature (&cpu->env,ARM_FEATURE_PMU ); - cpu->midr =0x411fc153 ;/* r1p3 */ +SET_IDREG (isar,MIDR ,0x411fc153 );/* r1p3 */ SET_IDREG (isar,ID_PFR0 ,0x0131 );SET_IDREG (isar,ID_PFR1 ,0x001 );SET_IDREG (isar,ID_DFR0 ,0x010400 );
@@ -646,7 +647,7 @@ static void cortex_r52_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_BACKCOMPAT_CNTFRQ );set_feature (&cpu->env,ARM_FEATURE_CBAR_RO );set_feature (&cpu->env,ARM_FEATURE_AUXCR ); - cpu->midr =0x411fd133 ;/* r1p3 */ +SET_IDREG (isar,MIDR ,0x411fd133 );/* r1p3 */ SET_IDREG (isar,REVIDR ,0 ); cpu->reset_fpsid =0x41034023 ; cpu->isar.mvfr0 =0x10110222 ;
@@ -694,7 +695,7 @@ static void ti925t_initfn(Object *obj)ARMCPU *cpu =ARM_CPU (obj);set_feature (&cpu->env,ARM_FEATURE_V4T );set_feature (&cpu->env,ARM_FEATURE_OMAPCP ); - cpu->midr =ARM_CPUID_TI925T ; +SET_IDREG (&cpu->isar,MIDR ,ARM_CPUID_TI925T ); cpu->ctr =0x5109149 ; cpu->reset_sctlr =0x00000070 ; }
@@ -706,7 +707,7 @@ static void sa1100_initfn(Object *obj) cpu->dtb_compatible ="intel,sa1100" ;set_feature (&cpu->env,ARM_FEATURE_STRONGARM );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS ); - cpu->midr =0x4401A11B ; +SET_IDREG (&cpu->isar,MIDR ,0x4401A11B ); cpu->reset_sctlr =0x00000070 ; }
@@ -715,7 +716,7 @@ static void sa1110_initfn(Object *obj)ARMCPU *cpu =ARM_CPU (obj);set_feature (&cpu->env,ARM_FEATURE_STRONGARM );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS ); - cpu->midr =0x6901B119 ; +SET_IDREG (&cpu->isar,MIDR ,0x6901B119 ); cpu->reset_sctlr =0x00000070 ; }
target/arm/tcg/cpu64.c +11 -11
@@ -47,7 +47,7 @@ static void aarch64_a35_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_PMU );/* From B2.2 AArch64 identification registers. */ - cpu->midr =0x411fd040 ; +SET_IDREG (isar,MIDR ,0x411fd040 );SET_IDREG (isar,REVIDR ,0 ); cpu->ctr =0x84448004 ;SET_IDREG (isar,ID_PFR0 ,0x00000131 );
@@ -247,7 +247,7 @@ static void aarch64_a55_initfn(Object *obj)SET_IDREG (isar,ID_PFR0 ,0x10010131 );SET_IDREG (isar,ID_PFR1 ,0x00011011 );SET_IDREG (isar,ID_PFR2 ,0x00000011 ); - cpu->midr =0x412FD050 ;/* r2p0 */ +SET_IDREG (isar,MIDR ,0x412FD050 );/* r2p0 */ SET_IDREG (isar,REVIDR ,0 );/* From B2.23 CCSIDR_EL1 */
@@ -291,7 +291,7 @@ static void aarch64_a72_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL2 );set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); - cpu->midr =0x410fd083 ; +SET_IDREG (isar,MIDR ,0x410fd083 );SET_IDREG (isar,REVIDR ,0 ); cpu->reset_fpsid =0x41034080 ; cpu->isar.mvfr0 =0x10110222 ;
@@ -382,7 +382,7 @@ static void aarch64_a76_initfn(Object *obj)SET_IDREG (isar,ID_PFR0 ,0x10010131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_PFR2 ,0x00000011 ); - cpu->midr =0x414fd0b1 ;/* r4p1 */ +SET_IDREG (isar,MIDR ,0x414fd0b1 );/* r4p1 */ SET_IDREG (isar,REVIDR ,0 );/* From B2.18 CCSIDR_EL1 */
@@ -455,7 +455,7 @@ static void aarch64_a78ae_initfn(Object *obj)SET_IDREG (isar,ID_PFR0 ,0x10010131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_PFR2 ,0x00000011 ); - cpu->midr =0x410fd423 ;/* r0p3 */ +SET_IDREG (isar,MIDR ,0x410fd423 );/* r0p3 */ SET_IDREG (isar,REVIDR ,0 );/* From 3.2.33 CCSIDR_EL1 */
@@ -500,7 +500,7 @@ static void aarch64_a64fx_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL2 );set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); - cpu->midr =0x461f0010 ; +SET_IDREG (isar,MIDR ,0x461f0010 );SET_IDREG (isar,REVIDR ,0 ); cpu->ctr =0x86668006 ; cpu->reset_sctlr =0x30000180 ;
@@ -706,7 +706,7 @@ static void aarch64_neoverse_n1_initfn(Object *obj)SET_IDREG (isar,ID_PFR0 ,0x10010131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_PFR2 ,0x00000011 ); - cpu->midr =0x414fd0c1 ;/* r4p1 */ +SET_IDREG (isar,MIDR ,0x414fd0c1 );/* r4p1 */ SET_IDREG (isar,REVIDR ,0 );/* From B2.23 CCSIDR_EL1 */
@@ -786,7 +786,7 @@ static void aarch64_neoverse_v1_initfn(Object *obj)SET_IDREG (isar,ID_PFR0 ,0x21110131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */ SET_IDREG (isar,ID_PFR2 ,0x00000011 ); - cpu->midr =0x411FD402 ;/* r1p2 */ +SET_IDREG (isar,MIDR ,0x411FD402 );/* r1p2 */ SET_IDREG (isar,REVIDR ,0 );/*
@@ -983,7 +983,7 @@ static void aarch64_a710_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_PMU );/* Ordered by Section B.4: AArch64 registers */ - cpu->midr =0x412FD471 ;/* r2p1 */ +SET_IDREG (isar,MIDR ,0x412FD471 );/* r2p1 */ SET_IDREG (isar,REVIDR ,0 );SET_IDREG (isar,ID_PFR0 ,0x21110131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */
@@ -1086,7 +1086,7 @@ static void aarch64_neoverse_n2_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_PMU );/* Ordered by Section B.5: AArch64 ID registers */ - cpu->midr =0x410FD493 ;/* r0p3 */ +SET_IDREG (isar,MIDR ,0x410FD493 );/* r0p3 */ SET_IDREG (isar,REVIDR ,0 );SET_IDREG (isar,ID_PFR0 ,0x21110131 );SET_IDREG (isar,ID_PFR1 ,0x00010000 );/* GIC filled in later */
@@ -1214,7 +1214,7 @@ void aarch64_max_v8_tcg_initfn(Object *obj) t =FIELD_DP64 (t,MIDR_EL1 ,PARTNUM ,'Q' ); t =FIELD_DP64 (t,MIDR_EL1 ,VARIANT ,0 ); t =FIELD_DP64 (t,MIDR_EL1 ,REVISION ,0 ); - cpu->midr = t; +SET_IDREG (isar,MIDR , t);/* * We're going to set FEAT_S2FWB, which mandates that CLIDR_EL1.{LoUU,LoUIS}
target/arm/whpx/whpx-all.c +2 -2
@@ -775,7 +775,7 @@ void whpx_arm_set_cpu_features_from_host(ARMCPU *cpu) cpu->dtb_compatible = arm_host_cpu_features.dtb_compatible; cpu->isar = arm_host_cpu_features.isar; cpu->env.features = arm_host_cpu_features.features; - cpu->midr = arm_host_cpu_features.midr; +SET_IDREG (&cpu->isar,MIDR , arm_host_cpu_features.midr); cpu->reset_sctlr = arm_host_cpu_features.reset_sctlr; }
@@ -836,7 +836,7 @@ int whpx_init_vcpu(CPUState *cpu)assert (write_cpustate_to_list (arm_cpu, false));/* Set CP_NO_RAW system registers on init */ - val.Reg64 = arm_cpu->midr; + val.Reg64 =GET_IDREG (&arm_cpu->isar,MIDR );whpx_set_reg (cpu, WHvArm64RegisterMidrEl1, val);
Signature · 1 line
2.53.0
Re: [PATCH v10 02/26] target/arm: Move MIDR into isar.idregs[] storage
Quoted 5 lines · Eric Auger
Move MIDR into the isar.idregs[] array as other ID registers. This will allow to overwrite it as others.
Signed-off-by Eric Auger <[email protected]>
thanks
-- PMM
PATCH v10 3/26 target/arm: Enforce MPIDR into isar.idregs[] storage
In reply to Eric AugerAt the moment MPIDR_EL1 has no real storage. Instead cpu mp_affinity field stores the Aff0-Aff2 bits only and the ID register is reconstructed when needed. There is also an mp-affinity property used for TCG only.
Keep the mp-affinity property and its associated storage while making sure the MPIDR_EL1 full register is stored in cpu->isar.idregs[] as other ID registers.
--- target/arm/cpu.h | 8 +++++++- target/arm/cpu-sysregs.h.inc | 1 + target/arm/cpu.c | 17 +++++++++++++++++ target/arm/helper.c | 14 +------------- target/arm/hvf/hvf.c | 2 +- target/arm/kvm.c | 1 + target/arm/whpx/whpx-all.c | 2 +- 7 files changed, 29 insertions(+), 16 deletions(-)
target/arm/cpu.h +7 -1
@@ -1128,7 +1128,13 @@ struct ArchCPU {uint32_t reset_sctlr;uint64_t pmceid0;uint64_t pmceid1; -uint64_t mp_affinity;/* MP ID without feature bits */ +/* +* MP ID without feature bits, ie. Aff0..Aff3 only +* used to store the corresponding property value for TCG vcpus. +* The MPIDR_EL1 value (affinity + feature bits) is stored in a +* consistent manner in isar.idregs[MPIDR_EL1_IDX]. +*/ +uint64_t mp_affinity;uint64_t reset_cbar;uint32_t reset_auxcr;bool reset_hivecs;
target/arm/cpu-sysregs.h.inc +1 -0
@@ -42,6 +42,7 @@ DEF(ID_PFR0_EL1, 3, 0, 0, 1, 0) DEF(ID_PFR1_EL1, 3, 0, 0, 1, 1) DEF(ID_PFR2_EL1, 3, 0, 0, 3, 4) DEF(MIDR_EL1, 3, 0, 0, 0, 0) +DEF(MPIDR_EL1, 3, 0, 0, 0, 5) DEF(MVFR0_EL1, 3, 0, 0, 3, 0) DEF(MVFR1_EL1, 3, 0, 0, 3, 1) DEF(MVFR2_EL1, 3, 0, 0, 3, 2)
target/arm/cpu.c +17 -0
@@ -2174,6 +2174,23 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) ARM_DEFAULT_CPUS_PER_CLUSTER); } +/* Consistently update MPIDR_EL1 in isar.idregs[] by adding feature bits */ + { +uint64_t mpidr = cpu->mp_affinity; + +if (arm_feature (env,ARM_FEATURE_V7MP )) { + mpidr |= (1U <<31 ); +/* +* Uniprocessor (non-coherent) cores that still implement the MP +* extensions set U (bit 30), e.g. Cortex-R5. +*/ +if (cpu->mp_is_up) { + mpidr |= (1u <<30 ); + } + } +SET_IDREG (&cpu->isar,MPIDR , mpidr); + } +if (cpu->reset_hivecs) { cpu->reset_sctlr |= (1 <<13 ); }
target/arm/helper.c +1 -13
@@ -3176,20 +3176,8 @@ static uint64_t midr_read(CPUARMState *env, const ARMCPRegInfo *ri)static uint64_t mpidr_read_val (CPUARMState *env) {ARMCPU *cpu =env_archcpu (env); -uint64_t mpidr = cpu->mp_affinity; -if (arm_feature (env,ARM_FEATURE_V7MP )) { - mpidr |= (1U <<31 ); -/* -* Cores which are uniprocessor (non-coherent) -* but still implement the MP extensions set -* bit 30. (For instance, Cortex-R5). -*/ -if (cpu->mp_is_up) { - mpidr |= (1u <<30 ); - } - } -return mpidr; +return GET_IDREG (&cpu->isar,MPIDR ); }static uint64_t mpidr_read (CPUARMState *env,const ARMCPRegInfo *ri)
target/arm/hvf/hvf.c +1 -1
@@ -1476,7 +1476,7 @@ int hvf_arch_init_vcpu(CPUState *cpu)assert_hvf_ok (ret); ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_MPIDR_EL1 , - arm_cpu->mp_affinity); +GET_IDREG (&arm_cpu->isar,MPIDR ));assert_hvf_ok (ret); pfr =GET_IDREG (&arm_cpu->isar,ID_AA64PFR0 );
target/arm/kvm.c +1 -0
@@ -2096,6 +2096,7 @@ int kvm_arch_init_vcpu(CPUState *cs)if (ret) {return ret; } +SET_IDREG (&cpu->isar,MPIDR , mpidr); cpu->mp_affinity = mpidr &ARM64_AFFINITY_MASK ;return kvm_arm_init_cpreg_list (cpu);
target/arm/whpx/whpx-all.c +1 -1
@@ -842,7 +842,7 @@ int whpx_init_vcpu(CPUState *cpu)clean_whv_register_value (&val); - val.Reg64 =deposit64 (arm_cpu->mp_affinity,31 ,1 ,1 /* RES1 */ ); + val.Reg64 =GET_IDREG (&arm_cpu->isar,MPIDR );whpx_set_reg (cpu, WHvArm64RegisterMpidrEl1, val);clamp_id_aa64mmfr0_parange_to_ipa_size (&arm_cpu->isar);
Signature · 1 line
2.53.0
Re: [PATCH v10 03/26] target/arm: Enforce MPIDR into isar.idregs[] storage
Quoted 11 lines · Eric Auger
At the moment
MPIDR_EL1has no real storage. Instead cpump_affinityfield stores the Aff0-Aff2 bits only and the ID register is reconstructed when needed. There is also an mp-affinity property used for TCG only.Keep the mp-affinity property and its associated storage while making sure the
MPIDR_EL1full register is stored in cpu->isar.idregs[] as other ID registers.Signed-off-by Eric Auger <[email protected]>
thanks
-- PMM
PATCH v10 4/26 target/arm/cpu-sysregs.h.inc: Update with automatic generation
In reply to Eric AugerIntroduce scripts/update-aarch64-cpu-sysregs-header.py that takes as input the Registers.json file delivered in the AARCHMRS Features Model downloadable from the Arm Developer A-Profile Architecture Exploration Tools page:
https://developer.arm.com/Architectures/A-Profile%20Architecture#Downloads
and outputs the list of ID regs in target/arm/cpu-sysregs.h.inc under the form of DEF(<name>, <op0>, <op1>, <crn>, <crm>, <op2>) or DEF_MUX(<name>, <op0>, <op1>, <crn>, <crm>, <op2>, <length>)
We only care about IDregs with opcodes satisfying:
op0 = 3, op1 = {0,1,3}, crn = 0, crm within [0, 7], op2 within [0, 7]
As we plan to reuse get_opcode() and extract_idregs_from_registers_json() functions in another script, put them in a separate module.
Update target/arm/cpu-sysregs.h.inc with the script.
---
v9 -> v10:
- squashed 3 patches: main script, module and generated file
- improve the comment related to skipped registers. Move is_demux in the loop. Fix indent.
- sort by reg name inside the helper
- add support for DEMUX register
--- target/arm/cpu-sysregs.h.inc | 10 ++ scripts/aarch64_sysreg_helpers.py | 118 +++++++++++++++++++ scripts/update-aarch64-cpu-sysregs-header.py | 59 ++++++++++ 3 files changed, 187 insertions(+) create mode 100644 scripts/aarch64_sysreg_helpers.py create mode 100755 scripts/update-aarch64-cpu-sysregs-header.py
target/arm/cpu-sysregs.h.inc +10 -0
@@ -1,12 +1,21 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* This file is autogenerated by scripts/update-aarch64-cpu-sysregs-header.py */ +/* DEF(<name>, <op0>, <op1>, <crn>, <crm>, <op2>) */ +/* DEF_MUX(<name>, <op0>, <op1>, <crn>, <crm>, <op2>, <length>) */ + +DEF(AIDR_EL1, 3, 1, 0, 0, 7) +DEF_MUX(CCSIDR2_EL1, 3, 1, 0, 0, 2, 16) DEF_MUX(CCSIDR_EL1, 3, 1, 0, 0, 0, 16) DEF(CLIDR_EL1, 3, 1, 0, 0, 1) DEF(CTR_EL0, 3, 3, 0, 0, 1) DEF(DCZID_EL0, 3, 3, 0, 0, 7) +DEF(GMID_EL1, 3, 1, 0, 0, 4) DEF(ID_AA64AFR0_EL1, 3, 0, 0, 5, 4) DEF(ID_AA64AFR1_EL1, 3, 0, 0, 5, 5) 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_AA64FPFR0_EL1, 3, 0, 0, 4, 7) DEF(ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0) DEF(ID_AA64ISAR1_EL1, 3, 0, 0, 6, 1)
@@ -47,3 +56,4 @@ 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(REVIDR_EL1, 3, 0, 0, 0, 6) +DEF(SMIDR_EL1, 3, 1, 0, 0, 6)
scripts/aarch64_sysreg_helpers.py new file +118 -0
118 lines not on this page · raw message
scripts/update-aarch64-cpu-sysregs-header.py new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v10 5/26 arm/cpu: Add infra to handle generated ID register definitions
In reply to Eric AugerIntroduce an infrastructure to store the definition of all ID regs:
This include their name, index array of named fields and enum values if any.
---
v9 -> v10:
- commit description and comment slight rewording
- store RangeValues instead of Values
v7 -> v8:
- remove typedef struct ArmIdRegArchVal
v5 -> v6:
- add ArmIdRegArchVal
--- target/arm/cpu-idregs.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 target/arm/cpu-idregs.h
target/arm/cpu-idregs.h new file +41 -0
@@ -0,0 +1,41 @@ +/* +* ID registers and their field definition +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef TARGET_ARM_CPU_IDREGS_H +#define TARGET_ARM_CPU_IDREGS_H + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "cpu.h" +#include "cpu-sysregs.h" + +typedef struct ARM64SysRegArchValueRange { +uint64_t lo; +uint64_t hi; +}ARM64SysRegArchValueRange ; + +typedef struct ARM64SysRegField { +const char *name;/* name of the field, for instance CTR_EL0_IDC */ +ARMIDRegisterIdx index;/* parent register, e.g. CTR_EL0_IDX */ +int shift;/* lsb of the field in the register */ +int length;/* highest bit number */ +const ARM64SysRegArchValueRange *arch_value_ranges; +uint32_t arch_value_ranges_count; +}ARM64SysRegField ; + +typedef struct ARM64SysReg { +const char *name;/* name of the sysreg, for instance CTR_EL0 */ +ARMIDRegisterIdx index;/* register index, e.g. CTR_EL0_IDX */ +struct ARM64SysRegField *fields; +uint32_t fields_count; +uint64_t writable_mask; +}ARM64SysReg ; + +/* +* List of exposed ID regs (automatically populated from AARCHMRS Registers.json) +*/ +extern ARM64SysReg arm64_id_regs[NUM_ID_IDX ]; + +#endif
Signature · 1 line
2.53.0
PATCH v10 6/26 target/arm/cpu-idregs.h.inc: Generate with script
In reply to Eric AugerIntroduce a script that takes as input the Registers.json file delivered in the AARCHMRS Features Model downloadable from the Arm Developer A-Profile Architecture Exploration Tools page:
https://developer.arm.com/Architectures/A-Profile%20Architecture#Downloads
and automates the generation of system register properties definitions.
generates target/arm/cpu-idregs.h.inc containing definitions for feature ID registers. Current generation is based on AARCHMRS_OPENSOURCE_A_profile_FAT-2026-03.
We only care about IDregs with opcodes satisfying:
op0 = 3, op1 = {0,1,3}, crn = 0, crm within [0, 7], op2 within [0, 7]
Generate ID reg definitions with the scripts/update-aarch64-cpu-sysreg-properties.py based on AARCHMRS_OPENSOURCE_A_profile_FAT-2026-03 Registers.json
Each register and fields are described with this pattern:
IDREG_START(REG)IDREG_FIELD(REG, FIELD, SHIFT, LENGTH)
...IDREG_END(REG)
---
v9 -> v10:
- squashed the script and the generated header.
- improved comments
- some minor code rework like sorting inside the helper
v5 -> v6
- add ident
--- target/arm/cpu-idregs.h.inc | 617 ++++++++++++++++++ .../update-aarch64-cpu-sysreg-properties.py | 165 +++++ 2 files changed, 782 insertions(+) create mode 100644 target/arm/cpu-idregs.h.inc create mode 100644 scripts/update-aarch64-cpu-sysreg-properties.py
target/arm/cpu-idregs.h.inc new file +617 -0
@@ -0,0 +1,617 @@ +/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ + +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* IDREG_START(REG) */ +/* IDREG_FIELD(REG, FIELD, SHIFT, LENGTH) */ +/* ... */ +/* IDREG_END(REG) */ + +IDREG_START(AIDR_EL1) +IDREG_END(AIDR_EL1) + +IDREG_START(CCSIDR2_EL1) + IDREG_FIELD(CCSIDR2_EL1, NumSets, 0, 24) +IDREG_END(CCSIDR2_EL1) + +IDREG_START(CCSIDR_EL1) + IDREG_FIELD(CCSIDR_EL1, NumSets, 32, 24) + IDREG_FIELD(CCSIDR_EL1, Associativity, 3, 21) + IDREG_FIELD(CCSIDR_EL1, LineSize, 0, 3) +IDREG_END(CCSIDR_EL1) + +IDREG_START(CLIDR_EL1) + IDREG_FIELD(CLIDR_EL1, Ttype7, 45, 2) + IDREG_FIELD(CLIDR_EL1, Ttype6, 43, 2) + IDREG_FIELD(CLIDR_EL1, Ttype5, 41, 2) + IDREG_FIELD(CLIDR_EL1, Ttype4, 39, 2) + IDREG_FIELD(CLIDR_EL1, Ttype3, 37, 2) + IDREG_FIELD(CLIDR_EL1, Ttype2, 35, 2) + IDREG_FIELD(CLIDR_EL1, Ttype1, 33, 2) + IDREG_FIELD(CLIDR_EL1, ICB, 30, 3) + IDREG_FIELD(CLIDR_EL1, LoUU, 27, 3) + IDREG_FIELD(CLIDR_EL1, LoC, 24, 3) + IDREG_FIELD(CLIDR_EL1, LoUIS, 21, 3) + IDREG_FIELD(CLIDR_EL1, Ctype7, 18, 3) + IDREG_FIELD(CLIDR_EL1, Ctype6, 15, 3) + IDREG_FIELD(CLIDR_EL1, Ctype5, 12, 3) + IDREG_FIELD(CLIDR_EL1, Ctype4, 9, 3) + IDREG_FIELD(CLIDR_EL1, Ctype3, 6, 3) + IDREG_FIELD(CLIDR_EL1, Ctype2, 3, 3) + IDREG_FIELD(CLIDR_EL1, Ctype1, 0, 3) +IDREG_END(CLIDR_EL1) + +IDREG_START(CTR_EL0) + IDREG_FIELD(CTR_EL0, TminLine, 32, 6) + IDREG_FIELD(CTR_EL0, DIC, 29, 1) + IDREG_FIELD(CTR_EL0, IDC, 28, 1) + IDREG_FIELD(CTR_EL0, CWG, 24, 4) + IDREG_FIELD(CTR_EL0, ERG, 20, 4) + IDREG_FIELD(CTR_EL0, DminLine, 16, 4) + IDREG_FIELD(CTR_EL0, L1Ip, 14, 2) + IDREG_FIELD(CTR_EL0, IminLine, 0, 4) +IDREG_END(CTR_EL0) + +IDREG_START(DCZID_EL0) + IDREG_FIELD(DCZID_EL0, TBS, 5, 4) + IDREG_FIELD(DCZID_EL0, DZP, 4, 1) + IDREG_FIELD(DCZID_EL0, BS, 0, 4) +IDREG_END(DCZID_EL0) + +IDREG_START(GMID_EL1) + IDREG_FIELD(GMID_EL1, BS, 0, 4) +IDREG_END(GMID_EL1) + +IDREG_START(ID_AA64AFR0_EL1) +IDREG_END(ID_AA64AFR0_EL1) + +IDREG_START(ID_AA64AFR1_EL1) +IDREG_END(ID_AA64AFR1_EL1) + +IDREG_START(ID_AA64DFR0_EL1) + IDREG_FIELD(ID_AA64DFR0_EL1, HPMN0, 60, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, ExtTrcBuff, 56, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, BRBE, 52, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, MTPMU, 48, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, TraceBuffer, 44, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, TraceFilt, 40, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, DoubleLock, 36, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, PMSVer, 32, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, CTX_CMPs, 28, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, WRPs, 20, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, PMSS, 16, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, BRPs, 12, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, PMUVer, 8, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, TraceVer, 4, 4) + IDREG_FIELD(ID_AA64DFR0_EL1, DebugVer, 0, 4) +IDREG_END(ID_AA64DFR0_EL1) + +IDREG_START(ID_AA64DFR1_EL1) + IDREG_FIELD(ID_AA64DFR1_EL1, ABL_CMPs, 56, 8) + IDREG_FIELD(ID_AA64DFR1_EL1, DPFZS, 52, 4) + IDREG_FIELD(ID_AA64DFR1_EL1, EBEP, 48, 4) + IDREG_FIELD(ID_AA64DFR1_EL1, ITE, 44, 4) + IDREG_FIELD(ID_AA64DFR1_EL1, ABLE, 40, 4) + IDREG_FIELD(ID_AA64DFR1_EL1, PMICNTR, 36, 4) + IDREG_FIELD(ID_AA64DFR1_EL1, SPMU, 32, 4) + IDREG_FIELD(ID_AA64DFR1_EL1, CTX_CMPs, 24, 8) + IDREG_FIELD(ID_AA64DFR1_EL1, WRPs, 16, 8) + IDREG_FIELD(ID_AA64DFR1_EL1, BRPs, 8, 8) + IDREG_FIELD(ID_AA64DFR1_EL1, SYSPMUID, 0, 8) +IDREG_END(ID_AA64DFR1_EL1) + +IDREG_START(ID_AA64DFR2_EL1) + IDREG_FIELD(ID_AA64DFR2_EL1, TRBE_EXC, 24, 4) + IDREG_FIELD(ID_AA64DFR2_EL1, SPE_nVM, 20, 4) + IDREG_FIELD(ID_AA64DFR2_EL1, SPE_EXC, 16, 4) + IDREG_FIELD(ID_AA64DFR2_EL1, BWE, 4, 4) + IDREG_FIELD(ID_AA64DFR2_EL1, STEP, 0, 4) +IDREG_END(ID_AA64DFR2_EL1) + +IDREG_START(ID_AA64FPFR0_EL1) + IDREG_FIELD(ID_AA64FPFR0_EL1, F8CVT, 31, 1) + IDREG_FIELD(ID_AA64FPFR0_EL1, F8FMA, 30, 1) + IDREG_FIELD(ID_AA64FPFR0_EL1, F8DP4, 29, 1) + IDREG_FIELD(ID_AA64FPFR0_EL1, F8DP2, 28, 1) + IDREG_FIELD(ID_AA64FPFR0_EL1, F8MM8, 27, 1) + IDREG_FIELD(ID_AA64FPFR0_EL1, F8MM4, 26, 1) + IDREG_FIELD(ID_AA64FPFR0_EL1, F16MM2, 15, 1) + IDREG_FIELD(ID_AA64FPFR0_EL1, F8E4M3, 1, 1) + IDREG_FIELD(ID_AA64FPFR0_EL1, F8E5M2, 0, 1) +IDREG_END(ID_AA64FPFR0_EL1) + +IDREG_START(ID_AA64ISAR0_EL1) + IDREG_FIELD(ID_AA64ISAR0_EL1, RNDR, 60, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, TLB, 56, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, TS, 52, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, FHM, 48, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, DP, 44, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, SM4, 40, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, SM3, 36, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, SHA3, 32, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, RDM, 28, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, Atomic, 20, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, CRC32, 16, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, SHA2, 12, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, SHA1, 8, 4) + IDREG_FIELD(ID_AA64ISAR0_EL1, AES, 4, 4) +IDREG_END(ID_AA64ISAR0_EL1) + +IDREG_START(ID_AA64ISAR1_EL1) + IDREG_FIELD(ID_AA64ISAR1_EL1, LS64, 60, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, XS, 56, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, I8MM, 52, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, DGH, 48, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, BF16, 44, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, SPECRES, 40, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, SB, 36, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, FRINTTS, 32, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, GPI, 28, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, GPA, 24, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, LRCPC, 20, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, FCMA, 16, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, JSCVT, 12, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, API, 8, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, APA, 4, 4) + IDREG_FIELD(ID_AA64ISAR1_EL1, DPB, 0, 4) +IDREG_END(ID_AA64ISAR1_EL1) + +IDREG_START(ID_AA64ISAR2_EL1) + IDREG_FIELD(ID_AA64ISAR2_EL1, ATS1A, 60, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, LUT, 56, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, CSSC, 52, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, RPRFM, 48, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, PCDPHINT, 44, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, PRFMSLC, 40, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, SYSINSTR_128, 36, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, SYSREG_128, 32, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, CLRBHB, 28, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, PAC_frac, 24, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, BC, 20, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, MOPS, 16, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, APA3, 12, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, GPA3, 8, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, RPRES, 4, 4) + IDREG_FIELD(ID_AA64ISAR2_EL1, WFxT, 0, 4) +IDREG_END(ID_AA64ISAR2_EL1) + +IDREG_START(ID_AA64ISAR3_EL1) + IDREG_FIELD(ID_AA64ISAR3_EL1, LSCP, 44, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, LSCSHINT, 40, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, MTETC, 36, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, PAC_frac2, 32, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, FPRCVT, 28, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, LSUI, 24, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, OCCMO, 20, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, LSFE, 16, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, PACM, 12, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, TLBIW, 8, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, FAMINMAX, 4, 4) + IDREG_FIELD(ID_AA64ISAR3_EL1, CPA, 0, 4) +IDREG_END(ID_AA64ISAR3_EL1) + +IDREG_START(ID_AA64MMFR0_EL1) + IDREG_FIELD(ID_AA64MMFR0_EL1, ECV, 60, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, FGT, 56, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, ExS, 44, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, TGran4_2, 40, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, TGran64_2, 36, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, TGran16_2, 32, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, TGran4, 28, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, TGran64, 24, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, TGran16, 20, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, BigEndEL0, 16, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, SNSMem, 12, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, BigEnd, 8, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, ASIDBits, 4, 4) + IDREG_FIELD(ID_AA64MMFR0_EL1, PARange, 0, 4) +IDREG_END(ID_AA64MMFR0_EL1) + +IDREG_START(ID_AA64MMFR1_EL1) + IDREG_FIELD(ID_AA64MMFR1_EL1, ECBHB, 60, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, CMOW, 56, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, TIDCP1, 52, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, nTLBPA, 48, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, AFP, 44, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, HCX, 40, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, ETS, 36, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, TWED, 32, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, XNX, 28, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, SpecSEI, 24, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, PAN, 20, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, LO, 16, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, HPDS, 12, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, VH, 8, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, VMIDBits, 4, 4) + IDREG_FIELD(ID_AA64MMFR1_EL1, HAFDBS, 0, 4) +IDREG_END(ID_AA64MMFR1_EL1) + +IDREG_START(ID_AA64MMFR2_EL1) + IDREG_FIELD(ID_AA64MMFR2_EL1, E0PD, 60, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, EVT, 56, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, BBM, 52, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, TTL, 48, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, FWB, 40, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, IDS, 36, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, AT, 32, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, ST, 28, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, NV, 24, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, CCIDX, 20, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, VARange, 16, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, IESB, 12, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, LSM, 8, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, UAO, 4, 4) + IDREG_FIELD(ID_AA64MMFR2_EL1, CnP, 0, 4) +IDREG_END(ID_AA64MMFR2_EL1) + +IDREG_START(ID_AA64MMFR3_EL1) + IDREG_FIELD(ID_AA64MMFR3_EL1, Spec_FPACC, 60, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, ADERR, 56, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, SDERR, 52, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, ANERR, 44, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, SNERR, 40, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, D128_2, 36, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, D128, 32, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, MEC, 28, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, AIE, 24, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, S2POE, 20, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, S1POE, 16, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, S2PIE, 12, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, S1PIE, 8, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, SCTLRX, 4, 4) + IDREG_FIELD(ID_AA64MMFR3_EL1, TCRX, 0, 4) +IDREG_END(ID_AA64MMFR3_EL1) + +IDREG_START(ID_AA64MMFR4_EL1) + IDREG_FIELD(ID_AA64MMFR4_EL1, MTEFGT, 60, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, SCRX, 56, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, TEV, 52, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, TPS, 48, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, SRMASK, 44, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, TLBID, 40, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, E3DSE, 36, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, EAESR, 32, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, RMEGDI, 28, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, E2H0, 24, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, NV_frac, 20, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, FGWTE3, 16, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, HACDBS, 12, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, ASID2, 8, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, EIESB, 4, 4) + IDREG_FIELD(ID_AA64MMFR4_EL1, PoPS, 0, 4) +IDREG_END(ID_AA64MMFR4_EL1) + +IDREG_START(ID_AA64PFR0_EL1) + IDREG_FIELD(ID_AA64PFR0_EL1, CSV3, 60, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, CSV2, 56, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, RME, 52, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, DIT, 48, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, AMU, 44, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, MPAM, 40, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, SEL2, 36, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, SVE, 32, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, RAS, 28, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, GIC, 24, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, AdvSIMD, 20, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, FP, 16, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, EL3, 12, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, EL2, 8, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, EL1, 4, 4) + IDREG_FIELD(ID_AA64PFR0_EL1, EL0, 0, 4) +IDREG_END(ID_AA64PFR0_EL1) + +IDREG_START(ID_AA64PFR1_EL1) + IDREG_FIELD(ID_AA64PFR1_EL1, PFAR, 60, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, DF2, 56, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, MTEX, 52, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, THE, 48, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, GCS, 44, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, MTE_frac, 40, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, NMI, 36, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, CSV2_frac, 32, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, RNDR_trap, 28, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, SME, 24, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, MPAM_frac, 16, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, RAS_frac, 12, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, MTE, 8, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, SSBS, 4, 4) + IDREG_FIELD(ID_AA64PFR1_EL1, BT, 0, 4) +IDREG_END(ID_AA64PFR1_EL1) + +IDREG_START(ID_AA64PFR2_EL1) + IDREG_FIELD(ID_AA64PFR2_EL1, VMTETCL, 44, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, VMTETC, 40, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, VMTE, 36, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, FPMR, 32, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, MPAM2, 28, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, FGDT, 24, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, MTEEIRG, 20, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, UINJ, 16, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, GCIE, 12, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, MTEFAR, 8, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, MTESTOREONLY, 4, 4) + IDREG_FIELD(ID_AA64PFR2_EL1, MTEPERM, 0, 4) +IDREG_END(ID_AA64PFR2_EL1) + +IDREG_START(ID_AA64SMFR0_EL1) + IDREG_FIELD(ID_AA64SMFR0_EL1, FA64, 63, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, LUT6, 61, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, LUTv2, 60, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, SMEver, 56, 4) + IDREG_FIELD(ID_AA64SMFR0_EL1, I16I64, 52, 4) + IDREG_FIELD(ID_AA64SMFR0_EL1, F64F64, 48, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, I16I32, 44, 4) + IDREG_FIELD(ID_AA64SMFR0_EL1, B16B16, 43, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, F16F16, 42, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, F8F16, 41, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, F8F32, 40, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, I8I32, 36, 4) + IDREG_FIELD(ID_AA64SMFR0_EL1, F16F32, 35, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, B16F32, 34, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, BI32I32, 33, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, F32F32, 32, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, SF8FMA, 30, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, SF8DP4, 29, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, SF8DP2, 28, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, SBitPerm, 25, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, AES, 24, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, SFEXPA, 23, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, STMOP, 16, 1) + IDREG_FIELD(ID_AA64SMFR0_EL1, SMOP4, 0, 1) +IDREG_END(ID_AA64SMFR0_EL1) + +IDREG_START(ID_AA64ZFR0_EL1) + IDREG_FIELD(ID_AA64ZFR0_EL1, F64MM, 56, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, F32MM, 52, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, F16MM, 48, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, I8MM, 44, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, SM4, 40, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, SHA3, 32, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, B16B16, 24, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, BF16, 20, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, BitPerm, 16, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, EltPerm, 12, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, AES, 4, 4) + IDREG_FIELD(ID_AA64ZFR0_EL1, SVEver, 0, 4) +IDREG_END(ID_AA64ZFR0_EL1) + +IDREG_START(ID_AFR0_EL1) +IDREG_END(ID_AFR0_EL1) + +IDREG_START(ID_DFR0_EL1) + IDREG_FIELD(ID_DFR0_EL1, TraceFilt, 28, 4) + IDREG_FIELD(ID_DFR0_EL1, PerfMon, 24, 4) + IDREG_FIELD(ID_DFR0_EL1, MProfDbg, 20, 4) + IDREG_FIELD(ID_DFR0_EL1, MMapTrc, 16, 4) + IDREG_FIELD(ID_DFR0_EL1, CopTrc, 12, 4) + IDREG_FIELD(ID_DFR0_EL1, MMapDbg, 8, 4) + IDREG_FIELD(ID_DFR0_EL1, CopSDbg, 4, 4) + IDREG_FIELD(ID_DFR0_EL1, CopDbg, 0, 4) +IDREG_END(ID_DFR0_EL1) + +IDREG_START(ID_DFR1_EL1) + IDREG_FIELD(ID_DFR1_EL1, HPMN0, 4, 4) + IDREG_FIELD(ID_DFR1_EL1, MTPMU, 0, 4) +IDREG_END(ID_DFR1_EL1) + +IDREG_START(ID_ISAR0_EL1) + IDREG_FIELD(ID_ISAR0_EL1, Divide, 24, 4) + IDREG_FIELD(ID_ISAR0_EL1, Debug, 20, 4) + IDREG_FIELD(ID_ISAR0_EL1, Coproc, 16, 4) + IDREG_FIELD(ID_ISAR0_EL1, CmpBranch, 12, 4) + IDREG_FIELD(ID_ISAR0_EL1, BitField, 8, 4) + IDREG_FIELD(ID_ISAR0_EL1, BitCount, 4, 4) + IDREG_FIELD(ID_ISAR0_EL1, Swap, 0, 4) +IDREG_END(ID_ISAR0_EL1) + +IDREG_START(ID_ISAR1_EL1) + IDREG_FIELD(ID_ISAR1_EL1, Jazelle, 28, 4) + IDREG_FIELD(ID_ISAR1_EL1, Interwork, 24, 4) + IDREG_FIELD(ID_ISAR1_EL1, Immediate, 20, 4) + IDREG_FIELD(ID_ISAR1_EL1, IfThen, 16, 4) + IDREG_FIELD(ID_ISAR1_EL1, Extend, 12, 4) + IDREG_FIELD(ID_ISAR1_EL1, Except_AR, 8, 4) + IDREG_FIELD(ID_ISAR1_EL1, Except, 4, 4) + IDREG_FIELD(ID_ISAR1_EL1, Endian, 0, 4) +IDREG_END(ID_ISAR1_EL1) + +IDREG_START(ID_ISAR2_EL1) + IDREG_FIELD(ID_ISAR2_EL1, Reversal, 28, 4) + IDREG_FIELD(ID_ISAR2_EL1, PSR_AR, 24, 4) + IDREG_FIELD(ID_ISAR2_EL1, MultU, 20, 4) + IDREG_FIELD(ID_ISAR2_EL1, MultS, 16, 4) + IDREG_FIELD(ID_ISAR2_EL1, Mult, 12, 4) + IDREG_FIELD(ID_ISAR2_EL1, MultiAccessInt, 8, 4) + IDREG_FIELD(ID_ISAR2_EL1, MemHint, 4, 4) + IDREG_FIELD(ID_ISAR2_EL1, LoadStore, 0, 4) +IDREG_END(ID_ISAR2_EL1) + +IDREG_START(ID_ISAR3_EL1) + IDREG_FIELD(ID_ISAR3_EL1, T32EE, 28, 4) + IDREG_FIELD(ID_ISAR3_EL1, TrueNOP, 24, 4) + IDREG_FIELD(ID_ISAR3_EL1, T32Copy, 20, 4) + IDREG_FIELD(ID_ISAR3_EL1, TabBranch, 16, 4) + IDREG_FIELD(ID_ISAR3_EL1, SynchPrim, 12, 4) + IDREG_FIELD(ID_ISAR3_EL1, SVC, 8, 4) + IDREG_FIELD(ID_ISAR3_EL1, SIMD, 4, 4) + IDREG_FIELD(ID_ISAR3_EL1, Saturate, 0, 4) +IDREG_END(ID_ISAR3_EL1) + +IDREG_START(ID_ISAR4_EL1) + IDREG_FIELD(ID_ISAR4_EL1, SWP_frac, 28, 4) + IDREG_FIELD(ID_ISAR4_EL1, PSR_M, 24, 4) + IDREG_FIELD(ID_ISAR4_EL1, SynchPrim_frac, 20, 4) + IDREG_FIELD(ID_ISAR4_EL1, Barrier, 16, 4) + IDREG_FIELD(ID_ISAR4_EL1, SMC, 12, 4) + IDREG_FIELD(ID_ISAR4_EL1, Writeback, 8, 4) + IDREG_FIELD(ID_ISAR4_EL1, WithShifts, 4, 4) + IDREG_FIELD(ID_ISAR4_EL1, Unpriv, 0, 4) +IDREG_END(ID_ISAR4_EL1) + +IDREG_START(ID_ISAR5_EL1) + IDREG_FIELD(ID_ISAR5_EL1, VCMA, 28, 4) + IDREG_FIELD(ID_ISAR5_EL1, RDM, 24, 4) + IDREG_FIELD(ID_ISAR5_EL1, CRC32, 16, 4) + IDREG_FIELD(ID_ISAR5_EL1, SHA2, 12, 4) + IDREG_FIELD(ID_ISAR5_EL1, SHA1, 8, 4) + IDREG_FIELD(ID_ISAR5_EL1, AES, 4, 4) + IDREG_FIELD(ID_ISAR5_EL1, SEVL, 0, 4) +IDREG_END(ID_ISAR5_EL1) + +IDREG_START(ID_ISAR6_EL1) + IDREG_FIELD(ID_ISAR6_EL1, CLRBHB, 28, 4) + IDREG_FIELD(ID_ISAR6_EL1, I8MM, 24, 4) + IDREG_FIELD(ID_ISAR6_EL1, BF16, 20, 4) + IDREG_FIELD(ID_ISAR6_EL1, SPECRES, 16, 4) + IDREG_FIELD(ID_ISAR6_EL1, SB, 12, 4) + IDREG_FIELD(ID_ISAR6_EL1, FHM, 8, 4) + IDREG_FIELD(ID_ISAR6_EL1, DP, 4, 4) + IDREG_FIELD(ID_ISAR6_EL1, JSCVT, 0, 4) +IDREG_END(ID_ISAR6_EL1) + +IDREG_START(ID_MMFR0_EL1) + IDREG_FIELD(ID_MMFR0_EL1, InnerShr, 28, 4) + IDREG_FIELD(ID_MMFR0_EL1, FCSE, 24, 4) + IDREG_FIELD(ID_MMFR0_EL1, AuxReg, 20, 4) + IDREG_FIELD(ID_MMFR0_EL1, TCM, 16, 4) + IDREG_FIELD(ID_MMFR0_EL1, ShareLvl, 12, 4) + IDREG_FIELD(ID_MMFR0_EL1, OuterShr, 8, 4) + IDREG_FIELD(ID_MMFR0_EL1, PMSA, 4, 4) + IDREG_FIELD(ID_MMFR0_EL1, VMSA, 0, 4) +IDREG_END(ID_MMFR0_EL1) + +IDREG_START(ID_MMFR1_EL1) + IDREG_FIELD(ID_MMFR1_EL1, BPred, 28, 4) + IDREG_FIELD(ID_MMFR1_EL1, L1TstCln, 24, 4) + IDREG_FIELD(ID_MMFR1_EL1, L1Uni, 20, 4) + IDREG_FIELD(ID_MMFR1_EL1, L1Hvd, 16, 4) + IDREG_FIELD(ID_MMFR1_EL1, L1UniSW, 12, 4) + IDREG_FIELD(ID_MMFR1_EL1, L1HvdSW, 8, 4) + IDREG_FIELD(ID_MMFR1_EL1, L1UniVA, 4, 4) + IDREG_FIELD(ID_MMFR1_EL1, L1HvdVA, 0, 4) +IDREG_END(ID_MMFR1_EL1) + +IDREG_START(ID_MMFR2_EL1) + IDREG_FIELD(ID_MMFR2_EL1, HWAccFlg, 28, 4) + IDREG_FIELD(ID_MMFR2_EL1, WFIStall, 24, 4) + IDREG_FIELD(ID_MMFR2_EL1, MemBarr, 20, 4) + IDREG_FIELD(ID_MMFR2_EL1, UniTLB, 16, 4) + IDREG_FIELD(ID_MMFR2_EL1, HvdTLB, 12, 4) + IDREG_FIELD(ID_MMFR2_EL1, L1HvdRng, 8, 4) + IDREG_FIELD(ID_MMFR2_EL1, L1HvdBG, 4, 4) + IDREG_FIELD(ID_MMFR2_EL1, L1HvdFG, 0, 4) +IDREG_END(ID_MMFR2_EL1) + +IDREG_START(ID_MMFR3_EL1) + IDREG_FIELD(ID_MMFR3_EL1, Supersec, 28, 4) + IDREG_FIELD(ID_MMFR3_EL1, CMemSz, 24, 4) + IDREG_FIELD(ID_MMFR3_EL1, CohWalk, 20, 4) + IDREG_FIELD(ID_MMFR3_EL1, PAN, 16, 4) + IDREG_FIELD(ID_MMFR3_EL1, MaintBcst, 12, 4) + IDREG_FIELD(ID_MMFR3_EL1, BPMaint, 8, 4) + IDREG_FIELD(ID_MMFR3_EL1, CMaintSW, 4, 4) + IDREG_FIELD(ID_MMFR3_EL1, CMaintVA, 0, 4) +IDREG_END(ID_MMFR3_EL1) + +IDREG_START(ID_MMFR4_EL1) + IDREG_FIELD(ID_MMFR4_EL1, EVT, 28, 4) + IDREG_FIELD(ID_MMFR4_EL1, CCIDX, 24, 4) + IDREG_FIELD(ID_MMFR4_EL1, LSM, 20, 4) + IDREG_FIELD(ID_MMFR4_EL1, HPDS, 16, 4) + IDREG_FIELD(ID_MMFR4_EL1, CnP, 12, 4) + IDREG_FIELD(ID_MMFR4_EL1, XNX, 8, 4) + IDREG_FIELD(ID_MMFR4_EL1, AC2, 4, 4) + IDREG_FIELD(ID_MMFR4_EL1, SpecSEI, 0, 4) +IDREG_END(ID_MMFR4_EL1) + +IDREG_START(ID_MMFR5_EL1) + IDREG_FIELD(ID_MMFR5_EL1, nTLBPA, 4, 4) + IDREG_FIELD(ID_MMFR5_EL1, ETS, 0, 4) +IDREG_END(ID_MMFR5_EL1) + +IDREG_START(ID_PFR0_EL1) + IDREG_FIELD(ID_PFR0_EL1, RAS, 28, 4) + IDREG_FIELD(ID_PFR0_EL1, DIT, 24, 4) + IDREG_FIELD(ID_PFR0_EL1, AMU, 20, 4) + IDREG_FIELD(ID_PFR0_EL1, CSV2, 16, 4) + IDREG_FIELD(ID_PFR0_EL1, State3, 12, 4) + IDREG_FIELD(ID_PFR0_EL1, State2, 8, 4) + IDREG_FIELD(ID_PFR0_EL1, State1, 4, 4) + IDREG_FIELD(ID_PFR0_EL1, State0, 0, 4) +IDREG_END(ID_PFR0_EL1) + +IDREG_START(ID_PFR1_EL1) + IDREG_FIELD(ID_PFR1_EL1, GIC, 28, 4) + IDREG_FIELD(ID_PFR1_EL1, Virt_frac, 24, 4) + IDREG_FIELD(ID_PFR1_EL1, Sec_frac, 20, 4) + IDREG_FIELD(ID_PFR1_EL1, GenTimer, 16, 4) + IDREG_FIELD(ID_PFR1_EL1, Virtualization, 12, 4) + IDREG_FIELD(ID_PFR1_EL1, MProgMod, 8, 4) + IDREG_FIELD(ID_PFR1_EL1, Security, 4, 4) + IDREG_FIELD(ID_PFR1_EL1, ProgMod, 0, 4) +IDREG_END(ID_PFR1_EL1) + +IDREG_START(ID_PFR2_EL1) + IDREG_FIELD(ID_PFR2_EL1, RAS_frac, 8, 4) + IDREG_FIELD(ID_PFR2_EL1, SSBS, 4, 4) + IDREG_FIELD(ID_PFR2_EL1, CSV3, 0, 4) +IDREG_END(ID_PFR2_EL1) + +IDREG_START(MIDR_EL1) + IDREG_FIELD(MIDR_EL1, Implementer, 24, 8) + IDREG_FIELD(MIDR_EL1, Variant, 20, 4) + IDREG_FIELD(MIDR_EL1, Architecture, 16, 4) + IDREG_FIELD(MIDR_EL1, PartNum, 4, 12) + IDREG_FIELD(MIDR_EL1, Revision, 0, 4) +IDREG_END(MIDR_EL1) + +IDREG_START(MPIDR_EL1) + IDREG_FIELD(MPIDR_EL1, Aff3, 32, 8) + IDREG_FIELD(MPIDR_EL1, U, 30, 1) + IDREG_FIELD(MPIDR_EL1, MT, 24, 1) + IDREG_FIELD(MPIDR_EL1, Aff2, 16, 8) + IDREG_FIELD(MPIDR_EL1, Aff1, 8, 8) + IDREG_FIELD(MPIDR_EL1, Aff0, 0, 8) +IDREG_END(MPIDR_EL1) + +IDREG_START(MVFR0_EL1) + IDREG_FIELD(MVFR0_EL1, FPRound, 28, 4) + IDREG_FIELD(MVFR0_EL1, FPShVec, 24, 4) + IDREG_FIELD(MVFR0_EL1, FPSqrt, 20, 4) + IDREG_FIELD(MVFR0_EL1, FPDivide, 16, 4) + IDREG_FIELD(MVFR0_EL1, FPTrap, 12, 4) + IDREG_FIELD(MVFR0_EL1, FPDP, 8, 4) + IDREG_FIELD(MVFR0_EL1, FPSP, 4, 4) + IDREG_FIELD(MVFR0_EL1, SIMDReg, 0, 4) +IDREG_END(MVFR0_EL1) + +IDREG_START(MVFR1_EL1) + IDREG_FIELD(MVFR1_EL1, SIMDFMAC, 28, 4) + IDREG_FIELD(MVFR1_EL1, FPHP, 24, 4) + IDREG_FIELD(MVFR1_EL1, SIMDHP, 20, 4) + IDREG_FIELD(MVFR1_EL1, SIMDSP, 16, 4) + IDREG_FIELD(MVFR1_EL1, SIMDInt, 12, 4) + IDREG_FIELD(MVFR1_EL1, SIMDLS, 8, 4) + IDREG_FIELD(MVFR1_EL1, FPDNaN, 4, 4) + IDREG_FIELD(MVFR1_EL1, FPFtZ, 0, 4) +IDREG_END(MVFR1_EL1) + +IDREG_START(MVFR2_EL1) + IDREG_FIELD(MVFR2_EL1, FPMisc, 4, 4) + IDREG_FIELD(MVFR2_EL1, SIMDMisc, 0, 4) +IDREG_END(MVFR2_EL1) + +IDREG_START(REVIDR_EL1) +IDREG_END(REVIDR_EL1) + +IDREG_START(SMIDR_EL1) + IDREG_FIELD(SMIDR_EL1, NSMC, 56, 4) + IDREG_FIELD(SMIDR_EL1, HIP, 52, 4) + IDREG_FIELD(SMIDR_EL1, Affinity2, 32, 20) + IDREG_FIELD(SMIDR_EL1, Implementer, 24, 8) + IDREG_FIELD(SMIDR_EL1, Revision, 16, 8) + IDREG_FIELD(SMIDR_EL1, SMPS, 15, 1) + IDREG_FIELD(SMIDR_EL1, SH, 13, 2) + IDREG_FIELD(SMIDR_EL1, Affinity, 0, 12) +IDREG_END(SMIDR_EL1) +
scripts/update-aarch64-cpu-sysreg-properties.py new file +165 -0
165 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v10 7/26 target/arm/cpu-idregs.h.inc: Generate enum values
In reply to Eric AugerModify the python script so that enum values are also extracted from Registers.json.
Single Values and ValueRange are wrapped as
IDREG_FIELD_ENUM(REG, FIELD, SHIFT, LENGTH,
IDREG_ARCH_VALUE_RANGE(LO, HI), ...).
Consecutive values are merged.
Using ranges even for single values produces a more compact header, which generally have at least 2 values and brings the benefice to have direct compact support for ValueRange.
--- target/arm/cpu-idregs.h.inc | 1685 +++++++++++++---- .../update-aarch64-cpu-sysreg-properties.py | 125 +- 2 files changed, 1395 insertions(+), 415 deletions(-)
target/arm/cpu-idregs.h.inc +1276 -409
@@ -4,7 +4,9 @@ /* IDREG_START(REG) */ /* IDREG_FIELD(REG, FIELD, SHIFT, LENGTH) */ -/* ... */ +/* or for fields with enum / ValueRange constraints */ +/* IDREG_FIELD_ENUM(REG, FIELD, SHIFT, LENGTH, */ +/* IDREG_ARCH_VALUE_RANGE(LO, HI), ...) */ /* IDREG_END(REG) */ IDREG_START(AIDR_EL1)
@@ -28,7 +30,9 @@ IDREG_START(CLIDR_EL1) IDREG_FIELD(CLIDR_EL1, Ttype3, 37, 2) IDREG_FIELD(CLIDR_EL1, Ttype2, 35, 2) IDREG_FIELD(CLIDR_EL1, Ttype1, 33, 2) - IDREG_FIELD(CLIDR_EL1, ICB, 30, 3) + IDREG_FIELD_ENUM(CLIDR_EL1, ICB, 30, 3, + IDREG_ARCH_VALUE_RANGE(0, 7) + ) IDREG_FIELD(CLIDR_EL1, LoUU, 27, 3) IDREG_FIELD(CLIDR_EL1, LoC, 24, 3) IDREG_FIELD(CLIDR_EL1, LoUIS, 21, 3)
@@ -43,18 +47,26 @@ IDREG_END(CLIDR_EL1) IDREG_START(CTR_EL0) IDREG_FIELD(CTR_EL0, TminLine, 32, 6) - IDREG_FIELD(CTR_EL0, DIC, 29, 1) - IDREG_FIELD(CTR_EL0, IDC, 28, 1) + IDREG_FIELD_ENUM(CTR_EL0, DIC, 29, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(CTR_EL0, IDC, 28, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_FIELD(CTR_EL0, CWG, 24, 4) IDREG_FIELD(CTR_EL0, ERG, 20, 4) IDREG_FIELD(CTR_EL0, DminLine, 16, 4) - IDREG_FIELD(CTR_EL0, L1Ip, 14, 2) + IDREG_FIELD_ENUM(CTR_EL0, L1Ip, 14, 2, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) IDREG_FIELD(CTR_EL0, IminLine, 0, 4) IDREG_END(CTR_EL0) IDREG_START(DCZID_EL0) IDREG_FIELD(DCZID_EL0, TBS, 5, 4) - IDREG_FIELD(DCZID_EL0, DZP, 4, 1) + IDREG_FIELD_ENUM(DCZID_EL0, DZP, 4, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_FIELD(DCZID_EL0, BS, 0, 4) IDREG_END(DCZID_EL0)
@@ -69,549 +81,1404 @@ IDREG_START(ID_AA64AFR1_EL1) IDREG_END(ID_AA64AFR1_EL1) IDREG_START(ID_AA64DFR0_EL1) - IDREG_FIELD(ID_AA64DFR0_EL1, HPMN0, 60, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, ExtTrcBuff, 56, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, BRBE, 52, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, MTPMU, 48, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, TraceBuffer, 44, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, TraceFilt, 40, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, DoubleLock, 36, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, PMSVer, 32, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, CTX_CMPs, 28, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, WRPs, 20, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, PMSS, 16, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, BRPs, 12, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, PMUVer, 8, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, TraceVer, 4, 4) - IDREG_FIELD(ID_AA64DFR0_EL1, DebugVer, 0, 4) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, HPMN0, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, ExtTrcBuff, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, BRBE, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, MTPMU, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, TraceBuffer, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, TraceFilt, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, DoubleLock, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, PMSVer, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 6) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, CTX_CMPs, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 15) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, WRPs, 20, 4, + IDREG_ARCH_VALUE_RANGE(1, 15) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, PMSS, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, BRPs, 12, 4, + IDREG_ARCH_VALUE_RANGE(1, 15) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, PMUVer, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(4, 9), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, TraceVer, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, DebugVer, 0, 4, + IDREG_ARCH_VALUE_RANGE(6, 11) + ) IDREG_END(ID_AA64DFR0_EL1) IDREG_START(ID_AA64DFR1_EL1) - IDREG_FIELD(ID_AA64DFR1_EL1, ABL_CMPs, 56, 8) - IDREG_FIELD(ID_AA64DFR1_EL1, DPFZS, 52, 4) - IDREG_FIELD(ID_AA64DFR1_EL1, EBEP, 48, 4) - IDREG_FIELD(ID_AA64DFR1_EL1, ITE, 44, 4) - IDREG_FIELD(ID_AA64DFR1_EL1, ABLE, 40, 4) - IDREG_FIELD(ID_AA64DFR1_EL1, PMICNTR, 36, 4) - IDREG_FIELD(ID_AA64DFR1_EL1, SPMU, 32, 4) - IDREG_FIELD(ID_AA64DFR1_EL1, CTX_CMPs, 24, 8) - IDREG_FIELD(ID_AA64DFR1_EL1, WRPs, 16, 8) - IDREG_FIELD(ID_AA64DFR1_EL1, BRPs, 8, 8) - IDREG_FIELD(ID_AA64DFR1_EL1, SYSPMUID, 0, 8) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, ABL_CMPs, 56, 8, + IDREG_ARCH_VALUE_RANGE(0, 63) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, DPFZS, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, EBEP, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, ITE, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, ABLE, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, PMICNTR, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, SPMU, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, CTX_CMPs, 24, 8, + IDREG_ARCH_VALUE_RANGE(0, 63) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, WRPs, 16, 8, + IDREG_ARCH_VALUE_RANGE(0, 63) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, BRPs, 8, 8, + IDREG_ARCH_VALUE_RANGE(0, 63) + ) + IDREG_FIELD_ENUM(ID_AA64DFR1_EL1, SYSPMUID, 0, 8, + IDREG_ARCH_VALUE_RANGE(0, 31) + ) IDREG_END(ID_AA64DFR1_EL1) IDREG_START(ID_AA64DFR2_EL1) - IDREG_FIELD(ID_AA64DFR2_EL1, TRBE_EXC, 24, 4) - IDREG_FIELD(ID_AA64DFR2_EL1, SPE_nVM, 20, 4) - IDREG_FIELD(ID_AA64DFR2_EL1, SPE_EXC, 16, 4) - IDREG_FIELD(ID_AA64DFR2_EL1, BWE, 4, 4) - IDREG_FIELD(ID_AA64DFR2_EL1, STEP, 0, 4) + IDREG_FIELD_ENUM(ID_AA64DFR2_EL1, TRBE_EXC, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR2_EL1, SPE_nVM, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR2_EL1, SPE_EXC, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64DFR2_EL1, BWE, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64DFR2_EL1, STEP, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_AA64DFR2_EL1) IDREG_START(ID_AA64FPFR0_EL1) - IDREG_FIELD(ID_AA64FPFR0_EL1, F8CVT, 31, 1) - IDREG_FIELD(ID_AA64FPFR0_EL1, F8FMA, 30, 1) - IDREG_FIELD(ID_AA64FPFR0_EL1, F8DP4, 29, 1) - IDREG_FIELD(ID_AA64FPFR0_EL1, F8DP2, 28, 1) - IDREG_FIELD(ID_AA64FPFR0_EL1, F8MM8, 27, 1) - IDREG_FIELD(ID_AA64FPFR0_EL1, F8MM4, 26, 1) - IDREG_FIELD(ID_AA64FPFR0_EL1, F16MM2, 15, 1) - IDREG_FIELD(ID_AA64FPFR0_EL1, F8E4M3, 1, 1) - IDREG_FIELD(ID_AA64FPFR0_EL1, F8E5M2, 0, 1) + IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8CVT, 31, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8FMA, 30, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8DP4, 29, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8DP2, 28, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8MM8, 27, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8MM4, 26, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F16MM2, 15, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8E4M3, 1, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8E5M2, 0, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_AA64FPFR0_EL1) IDREG_START(ID_AA64ISAR0_EL1) - IDREG_FIELD(ID_AA64ISAR0_EL1, RNDR, 60, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, TLB, 56, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, TS, 52, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, FHM, 48, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, DP, 44, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, SM4, 40, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, SM3, 36, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, SHA3, 32, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, RDM, 28, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, Atomic, 20, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, CRC32, 16, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, SHA2, 12, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, SHA1, 8, 4) - IDREG_FIELD(ID_AA64ISAR0_EL1, AES, 4, 4) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, RNDR, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, TLB, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, TS, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, FHM, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, DP, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, SM4, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, SM3, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, SHA3, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, RDM, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, Atomic, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(2, 3) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, CRC32, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, SHA2, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, SHA1, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, AES, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) IDREG_END(ID_AA64ISAR0_EL1) IDREG_START(ID_AA64ISAR1_EL1) - IDREG_FIELD(ID_AA64ISAR1_EL1, LS64, 60, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, XS, 56, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, I8MM, 52, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, DGH, 48, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, BF16, 44, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, SPECRES, 40, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, SB, 36, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, FRINTTS, 32, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, GPI, 28, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, GPA, 24, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, LRCPC, 20, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, FCMA, 16, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, JSCVT, 12, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, API, 8, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, APA, 4, 4) - IDREG_FIELD(ID_AA64ISAR1_EL1, DPB, 0, 4) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, LS64, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 4) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, XS, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, I8MM, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, DGH, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, BF16, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, SPECRES, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, SB, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, FRINTTS, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, GPI, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, GPA, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, LRCPC, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, FCMA, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, JSCVT, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, API, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 6) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, APA, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 6) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR1_EL1, DPB, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) IDREG_END(ID_AA64ISAR1_EL1) IDREG_START(ID_AA64ISAR2_EL1) - IDREG_FIELD(ID_AA64ISAR2_EL1, ATS1A, 60, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, LUT, 56, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, CSSC, 52, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, RPRFM, 48, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, PCDPHINT, 44, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, PRFMSLC, 40, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, SYSINSTR_128, 36, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, SYSREG_128, 32, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, CLRBHB, 28, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, PAC_frac, 24, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, BC, 20, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, MOPS, 16, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, APA3, 12, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, GPA3, 8, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, RPRES, 4, 4) - IDREG_FIELD(ID_AA64ISAR2_EL1, WFxT, 0, 4) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, ATS1A, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, LUT, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, CSSC, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, RPRFM, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, PCDPHINT, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, PRFMSLC, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, SYSINSTR_128, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, SYSREG_128, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, CLRBHB, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, PAC_frac, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, BC, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, MOPS, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, APA3, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 6) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, GPA3, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, RPRES, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR2_EL1, WFxT, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(2, 2) + ) IDREG_END(ID_AA64ISAR2_EL1) IDREG_START(ID_AA64ISAR3_EL1) - IDREG_FIELD(ID_AA64ISAR3_EL1, LSCP, 44, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, LSCSHINT, 40, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, MTETC, 36, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, PAC_frac2, 32, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, FPRCVT, 28, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, LSUI, 24, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, OCCMO, 20, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, LSFE, 16, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, PACM, 12, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, TLBIW, 8, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, FAMINMAX, 4, 4) - IDREG_FIELD(ID_AA64ISAR3_EL1, CPA, 0, 4) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, LSCP, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, LSCSHINT, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, MTETC, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, PAC_frac2, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, FPRCVT, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, LSUI, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, OCCMO, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, LSFE, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, PACM, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, TLBIW, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, FAMINMAX, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, CPA, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) IDREG_END(ID_AA64ISAR3_EL1) IDREG_START(ID_AA64MMFR0_EL1) - IDREG_FIELD(ID_AA64MMFR0_EL1, ECV, 60, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, FGT, 56, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, ExS, 44, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, TGran4_2, 40, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, TGran64_2, 36, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, TGran16_2, 32, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, TGran4, 28, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, TGran64, 24, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, TGran16, 20, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, BigEndEL0, 16, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, SNSMem, 12, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, BigEnd, 8, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, ASIDBits, 4, 4) - IDREG_FIELD(ID_AA64MMFR0_EL1, PARange, 0, 4) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, ECV, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, FGT, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, ExS, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, TGran4_2, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, TGran64_2, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, TGran16_2, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, TGran4, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, TGran64, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, TGran16, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, BigEndEL0, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, SNSMem, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, BigEnd, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, ASIDBits, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(2, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, PARange, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 7) + ) IDREG_END(ID_AA64MMFR0_EL1) IDREG_START(ID_AA64MMFR1_EL1) - IDREG_FIELD(ID_AA64MMFR1_EL1, ECBHB, 60, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, CMOW, 56, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, TIDCP1, 52, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, nTLBPA, 48, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, AFP, 44, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, HCX, 40, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, ETS, 36, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, TWED, 32, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, XNX, 28, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, SpecSEI, 24, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, PAN, 20, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, LO, 16, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, HPDS, 12, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, VH, 8, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, VMIDBits, 4, 4) - IDREG_FIELD(ID_AA64MMFR1_EL1, HAFDBS, 0, 4) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, ECBHB, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, CMOW, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, TIDCP1, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, nTLBPA, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, AFP, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, HCX, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, ETS, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, TWED, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, XNX, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, SpecSEI, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, PAN, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, LO, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, HPDS, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, VH, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, VMIDBits, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(2, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR1_EL1, HAFDBS, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 4) + ) IDREG_END(ID_AA64MMFR1_EL1) IDREG_START(ID_AA64MMFR2_EL1) - IDREG_FIELD(ID_AA64MMFR2_EL1, E0PD, 60, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, EVT, 56, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, BBM, 52, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, TTL, 48, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, FWB, 40, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, IDS, 36, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, AT, 32, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, ST, 28, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, NV, 24, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, CCIDX, 20, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, VARange, 16, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, IESB, 12, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, LSM, 8, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, UAO, 4, 4) - IDREG_FIELD(ID_AA64MMFR2_EL1, CnP, 0, 4) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, E0PD, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, EVT, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, BBM, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, TTL, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, FWB, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, IDS, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, AT, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, ST, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, NV, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, CCIDX, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, VARange, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, IESB, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, LSM, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, UAO, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, CnP, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_AA64MMFR2_EL1) IDREG_START(ID_AA64MMFR3_EL1) - IDREG_FIELD(ID_AA64MMFR3_EL1, Spec_FPACC, 60, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, ADERR, 56, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, SDERR, 52, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, ANERR, 44, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, SNERR, 40, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, D128_2, 36, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, D128, 32, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, MEC, 28, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, AIE, 24, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, S2POE, 20, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, S1POE, 16, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, S2PIE, 12, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, S1PIE, 8, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, SCTLRX, 4, 4) - IDREG_FIELD(ID_AA64MMFR3_EL1, TCRX, 0, 4) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, Spec_FPACC, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, ADERR, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, SDERR, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, ANERR, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, SNERR, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, D128_2, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, D128, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, MEC, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, AIE, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, S2POE, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, S1POE, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, S2PIE, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, S1PIE, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, SCTLRX, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, TCRX, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_AA64MMFR3_EL1) IDREG_START(ID_AA64MMFR4_EL1) - IDREG_FIELD(ID_AA64MMFR4_EL1, MTEFGT, 60, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, SCRX, 56, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, TEV, 52, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, TPS, 48, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, SRMASK, 44, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, TLBID, 40, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, E3DSE, 36, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, EAESR, 32, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, RMEGDI, 28, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, E2H0, 24, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, NV_frac, 20, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, FGWTE3, 16, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, HACDBS, 12, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, ASID2, 8, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, EIESB, 4, 4) - IDREG_FIELD(ID_AA64MMFR4_EL1, PoPS, 0, 4) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, MTEFGT, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, SCRX, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, TEV, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, TPS, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, SRMASK, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, TLBID, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, E3DSE, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, EAESR, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, RMEGDI, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, E2H0, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(14, 15) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, NV_frac, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, FGWTE3, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, HACDBS, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, ASID2, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, EIESB, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 3), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64MMFR4_EL1, PoPS, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_AA64MMFR4_EL1) IDREG_START(ID_AA64PFR0_EL1) - IDREG_FIELD(ID_AA64PFR0_EL1, CSV3, 60, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, CSV2, 56, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, RME, 52, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, DIT, 48, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, AMU, 44, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, MPAM, 40, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, SEL2, 36, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, SVE, 32, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, RAS, 28, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, GIC, 24, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, AdvSIMD, 20, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, FP, 16, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, EL3, 12, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, EL2, 8, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, EL1, 4, 4) - IDREG_FIELD(ID_AA64PFR0_EL1, EL0, 0, 4) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, CSV3, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, CSV2, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, RME, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, DIT, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, AMU, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, MPAM, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, SEL2, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, SVE, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, RAS, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, GIC, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(3, 3) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, AdvSIMD, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, FP, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, EL3, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, EL2, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, EL1, 4, 4, + IDREG_ARCH_VALUE_RANGE(1, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR0_EL1, EL0, 0, 4, + IDREG_ARCH_VALUE_RANGE(1, 2) + ) IDREG_END(ID_AA64PFR0_EL1) IDREG_START(ID_AA64PFR1_EL1) - IDREG_FIELD(ID_AA64PFR1_EL1, PFAR, 60, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, DF2, 56, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, MTEX, 52, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, THE, 48, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, GCS, 44, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, MTE_frac, 40, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, NMI, 36, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, CSV2_frac, 32, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, RNDR_trap, 28, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, SME, 24, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, MPAM_frac, 16, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, RAS_frac, 12, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, MTE, 8, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, SSBS, 4, 4) - IDREG_FIELD(ID_AA64PFR1_EL1, BT, 0, 4) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, PFAR, 60, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, DF2, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, MTEX, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, THE, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, GCS, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, MTE_frac, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, NMI, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, CSV2_frac, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, RNDR_trap, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, SME, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, MPAM_frac, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, RAS_frac, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, MTE, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, SSBS, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, BT, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) IDREG_END(ID_AA64PFR1_EL1) IDREG_START(ID_AA64PFR2_EL1) - IDREG_FIELD(ID_AA64PFR2_EL1, VMTETCL, 44, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, VMTETC, 40, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, VMTE, 36, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, FPMR, 32, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, MPAM2, 28, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, FGDT, 24, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, MTEEIRG, 20, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, UINJ, 16, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, GCIE, 12, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, MTEFAR, 8, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, MTESTOREONLY, 4, 4) - IDREG_FIELD(ID_AA64PFR2_EL1, MTEPERM, 0, 4) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, VMTETCL, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, VMTETC, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, VMTE, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, FPMR, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, MPAM2, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, FGDT, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, MTEEIRG, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, UINJ, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, GCIE, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, MTEFAR, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, MTESTOREONLY, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, MTEPERM, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_AA64PFR2_EL1) IDREG_START(ID_AA64SMFR0_EL1) - IDREG_FIELD(ID_AA64SMFR0_EL1, FA64, 63, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, LUT6, 61, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, LUTv2, 60, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, SMEver, 56, 4) - IDREG_FIELD(ID_AA64SMFR0_EL1, I16I64, 52, 4) - IDREG_FIELD(ID_AA64SMFR0_EL1, F64F64, 48, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, I16I32, 44, 4) - IDREG_FIELD(ID_AA64SMFR0_EL1, B16B16, 43, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, F16F16, 42, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, F8F16, 41, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, F8F32, 40, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, I8I32, 36, 4) - IDREG_FIELD(ID_AA64SMFR0_EL1, F16F32, 35, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, B16F32, 34, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, BI32I32, 33, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, F32F32, 32, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, SF8FMA, 30, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, SF8DP4, 29, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, SF8DP2, 28, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, SBitPerm, 25, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, AES, 24, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, SFEXPA, 23, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, STMOP, 16, 1) - IDREG_FIELD(ID_AA64SMFR0_EL1, SMOP4, 0, 1) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, FA64, 63, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, LUT6, 61, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, LUTv2, 60, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SMEver, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 4) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, I16I64, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, F64F64, 48, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, I16I32, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(5, 5) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, B16B16, 43, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, F16F16, 42, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, F8F16, 41, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, F8F32, 40, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, I8I32, 36, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, F16F32, 35, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, B16F32, 34, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, BI32I32, 33, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, F32F32, 32, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SF8FMA, 30, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SF8DP4, 29, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SF8DP2, 28, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SBitPerm, 25, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, AES, 24, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SFEXPA, 23, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, STMOP, 16, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SMOP4, 0, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_AA64SMFR0_EL1) IDREG_START(ID_AA64ZFR0_EL1) - IDREG_FIELD(ID_AA64ZFR0_EL1, F64MM, 56, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, F32MM, 52, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, F16MM, 48, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, I8MM, 44, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, SM4, 40, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, SHA3, 32, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, B16B16, 24, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, BF16, 20, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, BitPerm, 16, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, EltPerm, 12, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, AES, 4, 4) - IDREG_FIELD(ID_AA64ZFR0_EL1, SVEver, 0, 4) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, F64MM, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, F32MM, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, F16MM, 48, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, I8MM, 44, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, SM4, 40, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, SHA3, 32, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, B16B16, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, BF16, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, BitPerm, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, EltPerm, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, AES, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, SVEver, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 4) + ) IDREG_END(ID_AA64ZFR0_EL1) IDREG_START(ID_AFR0_EL1) IDREG_END(ID_AFR0_EL1) IDREG_START(ID_DFR0_EL1) - IDREG_FIELD(ID_DFR0_EL1, TraceFilt, 28, 4) - IDREG_FIELD(ID_DFR0_EL1, PerfMon, 24, 4) - IDREG_FIELD(ID_DFR0_EL1, MProfDbg, 20, 4) - IDREG_FIELD(ID_DFR0_EL1, MMapTrc, 16, 4) - IDREG_FIELD(ID_DFR0_EL1, CopTrc, 12, 4) - IDREG_FIELD(ID_DFR0_EL1, MMapDbg, 8, 4) + IDREG_FIELD_ENUM(ID_DFR0_EL1, TraceFilt, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_DFR0_EL1, PerfMon, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 9), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_DFR0_EL1, MProfDbg, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_DFR0_EL1, MMapTrc, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_DFR0_EL1, CopTrc, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_DFR0_EL1, MMapDbg, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(4, 5) + ) IDREG_FIELD(ID_DFR0_EL1, CopSDbg, 4, 4) - IDREG_FIELD(ID_DFR0_EL1, CopDbg, 0, 4) + IDREG_FIELD_ENUM(ID_DFR0_EL1, CopDbg, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(2, 11) + ) IDREG_END(ID_DFR0_EL1) IDREG_START(ID_DFR1_EL1) - IDREG_FIELD(ID_DFR1_EL1, HPMN0, 4, 4) - IDREG_FIELD(ID_DFR1_EL1, MTPMU, 0, 4) + IDREG_FIELD_ENUM(ID_DFR1_EL1, HPMN0, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_DFR1_EL1, MTPMU, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) IDREG_END(ID_DFR1_EL1) IDREG_START(ID_ISAR0_EL1) - IDREG_FIELD(ID_ISAR0_EL1, Divide, 24, 4) - IDREG_FIELD(ID_ISAR0_EL1, Debug, 20, 4) - IDREG_FIELD(ID_ISAR0_EL1, Coproc, 16, 4) - IDREG_FIELD(ID_ISAR0_EL1, CmpBranch, 12, 4) - IDREG_FIELD(ID_ISAR0_EL1, BitField, 8, 4) - IDREG_FIELD(ID_ISAR0_EL1, BitCount, 4, 4) - IDREG_FIELD(ID_ISAR0_EL1, Swap, 0, 4) + IDREG_FIELD_ENUM(ID_ISAR0_EL1, Divide, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_ISAR0_EL1, Debug, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR0_EL1, Coproc, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 4) + ) + IDREG_FIELD_ENUM(ID_ISAR0_EL1, CmpBranch, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR0_EL1, BitField, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR0_EL1, BitCount, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR0_EL1, Swap, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_ISAR0_EL1) IDREG_START(ID_ISAR1_EL1) - IDREG_FIELD(ID_ISAR1_EL1, Jazelle, 28, 4) - IDREG_FIELD(ID_ISAR1_EL1, Interwork, 24, 4) - IDREG_FIELD(ID_ISAR1_EL1, Immediate, 20, 4) - IDREG_FIELD(ID_ISAR1_EL1, IfThen, 16, 4) - IDREG_FIELD(ID_ISAR1_EL1, Extend, 12, 4) - IDREG_FIELD(ID_ISAR1_EL1, Except_AR, 8, 4) - IDREG_FIELD(ID_ISAR1_EL1, Except, 4, 4) - IDREG_FIELD(ID_ISAR1_EL1, Endian, 0, 4) + IDREG_FIELD_ENUM(ID_ISAR1_EL1, Jazelle, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR1_EL1, Interwork, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_ISAR1_EL1, Immediate, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR1_EL1, IfThen, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR1_EL1, Extend, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_ISAR1_EL1, Except_AR, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR1_EL1, Except, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR1_EL1, Endian, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_ISAR1_EL1) IDREG_START(ID_ISAR2_EL1) - IDREG_FIELD(ID_ISAR2_EL1, Reversal, 28, 4) - IDREG_FIELD(ID_ISAR2_EL1, PSR_AR, 24, 4) - IDREG_FIELD(ID_ISAR2_EL1, MultU, 20, 4) - IDREG_FIELD(ID_ISAR2_EL1, MultS, 16, 4) - IDREG_FIELD(ID_ISAR2_EL1, Mult, 12, 4) - IDREG_FIELD(ID_ISAR2_EL1, MultiAccessInt, 8, 4) - IDREG_FIELD(ID_ISAR2_EL1, MemHint, 4, 4) - IDREG_FIELD(ID_ISAR2_EL1, LoadStore, 0, 4) + IDREG_FIELD_ENUM(ID_ISAR2_EL1, Reversal, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_ISAR2_EL1, PSR_AR, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR2_EL1, MultU, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_ISAR2_EL1, MultS, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_ISAR2_EL1, Mult, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_ISAR2_EL1, MultiAccessInt, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_ISAR2_EL1, MemHint, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 4) + ) + IDREG_FIELD_ENUM(ID_ISAR2_EL1, LoadStore, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) IDREG_END(ID_ISAR2_EL1) IDREG_START(ID_ISAR3_EL1) - IDREG_FIELD(ID_ISAR3_EL1, T32EE, 28, 4) - IDREG_FIELD(ID_ISAR3_EL1, TrueNOP, 24, 4) - IDREG_FIELD(ID_ISAR3_EL1, T32Copy, 20, 4) - IDREG_FIELD(ID_ISAR3_EL1, TabBranch, 16, 4) - IDREG_FIELD(ID_ISAR3_EL1, SynchPrim, 12, 4) - IDREG_FIELD(ID_ISAR3_EL1, SVC, 8, 4) - IDREG_FIELD(ID_ISAR3_EL1, SIMD, 4, 4) - IDREG_FIELD(ID_ISAR3_EL1, Saturate, 0, 4) + IDREG_FIELD_ENUM(ID_ISAR3_EL1, T32EE, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR3_EL1, TrueNOP, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR3_EL1, T32Copy, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR3_EL1, TabBranch, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR3_EL1, SynchPrim, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_ISAR3_EL1, SVC, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR3_EL1, SIMD, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(3, 3) + ) + IDREG_FIELD_ENUM(ID_ISAR3_EL1, Saturate, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_ISAR3_EL1) IDREG_START(ID_ISAR4_EL1) - IDREG_FIELD(ID_ISAR4_EL1, SWP_frac, 28, 4) - IDREG_FIELD(ID_ISAR4_EL1, PSR_M, 24, 4) - IDREG_FIELD(ID_ISAR4_EL1, SynchPrim_frac, 20, 4) - IDREG_FIELD(ID_ISAR4_EL1, Barrier, 16, 4) - IDREG_FIELD(ID_ISAR4_EL1, SMC, 12, 4) - IDREG_FIELD(ID_ISAR4_EL1, Writeback, 8, 4) - IDREG_FIELD(ID_ISAR4_EL1, WithShifts, 4, 4) - IDREG_FIELD(ID_ISAR4_EL1, Unpriv, 0, 4) + IDREG_FIELD_ENUM(ID_ISAR4_EL1, SWP_frac, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR4_EL1, PSR_M, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR4_EL1, SynchPrim_frac, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(3, 3) + ) + IDREG_FIELD_ENUM(ID_ISAR4_EL1, Barrier, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR4_EL1, SMC, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR4_EL1, Writeback, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR4_EL1, WithShifts, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(3, 4) + ) + IDREG_FIELD_ENUM(ID_ISAR4_EL1, Unpriv, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) IDREG_END(ID_ISAR4_EL1) IDREG_START(ID_ISAR5_EL1) - IDREG_FIELD(ID_ISAR5_EL1, VCMA, 28, 4) - IDREG_FIELD(ID_ISAR5_EL1, RDM, 24, 4) - IDREG_FIELD(ID_ISAR5_EL1, CRC32, 16, 4) - IDREG_FIELD(ID_ISAR5_EL1, SHA2, 12, 4) - IDREG_FIELD(ID_ISAR5_EL1, SHA1, 8, 4) - IDREG_FIELD(ID_ISAR5_EL1, AES, 4, 4) - IDREG_FIELD(ID_ISAR5_EL1, SEVL, 0, 4) + IDREG_FIELD_ENUM(ID_ISAR5_EL1, VCMA, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR5_EL1, RDM, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR5_EL1, CRC32, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR5_EL1, SHA2, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR5_EL1, SHA1, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR5_EL1, AES, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_ISAR5_EL1, SEVL, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_ISAR5_EL1) IDREG_START(ID_ISAR6_EL1) - IDREG_FIELD(ID_ISAR6_EL1, CLRBHB, 28, 4) - IDREG_FIELD(ID_ISAR6_EL1, I8MM, 24, 4) - IDREG_FIELD(ID_ISAR6_EL1, BF16, 20, 4) - IDREG_FIELD(ID_ISAR6_EL1, SPECRES, 16, 4) - IDREG_FIELD(ID_ISAR6_EL1, SB, 12, 4) - IDREG_FIELD(ID_ISAR6_EL1, FHM, 8, 4) - IDREG_FIELD(ID_ISAR6_EL1, DP, 4, 4) - IDREG_FIELD(ID_ISAR6_EL1, JSCVT, 0, 4) + IDREG_FIELD_ENUM(ID_ISAR6_EL1, CLRBHB, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR6_EL1, I8MM, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR6_EL1, BF16, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR6_EL1, SPECRES, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_ISAR6_EL1, SB, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR6_EL1, FHM, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR6_EL1, DP, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_ISAR6_EL1, JSCVT, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_ISAR6_EL1) IDREG_START(ID_MMFR0_EL1) - IDREG_FIELD(ID_MMFR0_EL1, InnerShr, 28, 4) - IDREG_FIELD(ID_MMFR0_EL1, FCSE, 24, 4) - IDREG_FIELD(ID_MMFR0_EL1, AuxReg, 20, 4) - IDREG_FIELD(ID_MMFR0_EL1, TCM, 16, 4) - IDREG_FIELD(ID_MMFR0_EL1, ShareLvl, 12, 4) - IDREG_FIELD(ID_MMFR0_EL1, OuterShr, 8, 4) - IDREG_FIELD(ID_MMFR0_EL1, PMSA, 4, 4) - IDREG_FIELD(ID_MMFR0_EL1, VMSA, 0, 4) + IDREG_FIELD_ENUM(ID_MMFR0_EL1, InnerShr, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_MMFR0_EL1, FCSE, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR0_EL1, AuxReg, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR0_EL1, TCM, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_MMFR0_EL1, ShareLvl, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR0_EL1, OuterShr, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_MMFR0_EL1, PMSA, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_MMFR0_EL1, VMSA, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 5) + ) IDREG_END(ID_MMFR0_EL1) IDREG_START(ID_MMFR1_EL1) - IDREG_FIELD(ID_MMFR1_EL1, BPred, 28, 4) - IDREG_FIELD(ID_MMFR1_EL1, L1TstCln, 24, 4) - IDREG_FIELD(ID_MMFR1_EL1, L1Uni, 20, 4) - IDREG_FIELD(ID_MMFR1_EL1, L1Hvd, 16, 4) - IDREG_FIELD(ID_MMFR1_EL1, L1UniSW, 12, 4) - IDREG_FIELD(ID_MMFR1_EL1, L1HvdSW, 8, 4) - IDREG_FIELD(ID_MMFR1_EL1, L1UniVA, 4, 4) - IDREG_FIELD(ID_MMFR1_EL1, L1HvdVA, 0, 4) + IDREG_FIELD_ENUM(ID_MMFR1_EL1, BPred, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 4) + ) + IDREG_FIELD_ENUM(ID_MMFR1_EL1, L1TstCln, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR1_EL1, L1Uni, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR1_EL1, L1Hvd, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_MMFR1_EL1, L1UniSW, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_MMFR1_EL1, L1HvdSW, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_MMFR1_EL1, L1UniVA, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR1_EL1, L1HvdVA, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) IDREG_END(ID_MMFR1_EL1) IDREG_START(ID_MMFR2_EL1) - IDREG_FIELD(ID_MMFR2_EL1, HWAccFlg, 28, 4) - IDREG_FIELD(ID_MMFR2_EL1, WFIStall, 24, 4) - IDREG_FIELD(ID_MMFR2_EL1, MemBarr, 20, 4) - IDREG_FIELD(ID_MMFR2_EL1, UniTLB, 16, 4) + IDREG_FIELD_ENUM(ID_MMFR2_EL1, HWAccFlg, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR2_EL1, WFIStall, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR2_EL1, MemBarr, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR2_EL1, UniTLB, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 6) + ) IDREG_FIELD(ID_MMFR2_EL1, HvdTLB, 12, 4) - IDREG_FIELD(ID_MMFR2_EL1, L1HvdRng, 8, 4) - IDREG_FIELD(ID_MMFR2_EL1, L1HvdBG, 4, 4) - IDREG_FIELD(ID_MMFR2_EL1, L1HvdFG, 0, 4) + IDREG_FIELD_ENUM(ID_MMFR2_EL1, L1HvdRng, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR2_EL1, L1HvdBG, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR2_EL1, L1HvdFG, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_MMFR2_EL1) IDREG_START(ID_MMFR3_EL1) - IDREG_FIELD(ID_MMFR3_EL1, Supersec, 28, 4) - IDREG_FIELD(ID_MMFR3_EL1, CMemSz, 24, 4) - IDREG_FIELD(ID_MMFR3_EL1, CohWalk, 20, 4) - IDREG_FIELD(ID_MMFR3_EL1, PAN, 16, 4) - IDREG_FIELD(ID_MMFR3_EL1, MaintBcst, 12, 4) - IDREG_FIELD(ID_MMFR3_EL1, BPMaint, 8, 4) - IDREG_FIELD(ID_MMFR3_EL1, CMaintSW, 4, 4) - IDREG_FIELD(ID_MMFR3_EL1, CMaintVA, 0, 4) + IDREG_FIELD_ENUM(ID_MMFR3_EL1, Supersec, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) + IDREG_FIELD_ENUM(ID_MMFR3_EL1, CMemSz, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR3_EL1, CohWalk, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR3_EL1, PAN, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR3_EL1, MaintBcst, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR3_EL1, BPMaint, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR3_EL1, CMaintSW, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR3_EL1, CMaintVA, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_MMFR3_EL1) IDREG_START(ID_MMFR4_EL1) - IDREG_FIELD(ID_MMFR4_EL1, EVT, 28, 4) - IDREG_FIELD(ID_MMFR4_EL1, CCIDX, 24, 4) - IDREG_FIELD(ID_MMFR4_EL1, LSM, 20, 4) - IDREG_FIELD(ID_MMFR4_EL1, HPDS, 16, 4) - IDREG_FIELD(ID_MMFR4_EL1, CnP, 12, 4) - IDREG_FIELD(ID_MMFR4_EL1, XNX, 8, 4) - IDREG_FIELD(ID_MMFR4_EL1, AC2, 4, 4) - IDREG_FIELD(ID_MMFR4_EL1, SpecSEI, 0, 4) + IDREG_FIELD_ENUM(ID_MMFR4_EL1, EVT, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR4_EL1, CCIDX, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR4_EL1, LSM, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR4_EL1, HPDS, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_MMFR4_EL1, CnP, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR4_EL1, XNX, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR4_EL1, AC2, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR4_EL1, SpecSEI, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_MMFR4_EL1) IDREG_START(ID_MMFR5_EL1) - IDREG_FIELD(ID_MMFR5_EL1, nTLBPA, 4, 4) - IDREG_FIELD(ID_MMFR5_EL1, ETS, 0, 4) + IDREG_FIELD_ENUM(ID_MMFR5_EL1, nTLBPA, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_MMFR5_EL1, ETS, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) IDREG_END(ID_MMFR5_EL1) IDREG_START(ID_PFR0_EL1) - IDREG_FIELD(ID_PFR0_EL1, RAS, 28, 4) - IDREG_FIELD(ID_PFR0_EL1, DIT, 24, 4) - IDREG_FIELD(ID_PFR0_EL1, AMU, 20, 4) - IDREG_FIELD(ID_PFR0_EL1, CSV2, 16, 4) - IDREG_FIELD(ID_PFR0_EL1, State3, 12, 4) - IDREG_FIELD(ID_PFR0_EL1, State2, 8, 4) - IDREG_FIELD(ID_PFR0_EL1, State1, 4, 4) - IDREG_FIELD(ID_PFR0_EL1, State0, 0, 4) + IDREG_FIELD_ENUM(ID_PFR0_EL1, RAS, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(ID_PFR0_EL1, DIT, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_PFR0_EL1, AMU, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_PFR0_EL1, CSV2, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_PFR0_EL1, State3, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_PFR0_EL1, State2, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_PFR0_EL1, State1, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(3, 3) + ) + IDREG_FIELD_ENUM(ID_PFR0_EL1, State0, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_PFR0_EL1) IDREG_START(ID_PFR1_EL1) - IDREG_FIELD(ID_PFR1_EL1, GIC, 28, 4) - IDREG_FIELD(ID_PFR1_EL1, Virt_frac, 24, 4) - IDREG_FIELD(ID_PFR1_EL1, Sec_frac, 20, 4) - IDREG_FIELD(ID_PFR1_EL1, GenTimer, 16, 4) - IDREG_FIELD(ID_PFR1_EL1, Virtualization, 12, 4) - IDREG_FIELD(ID_PFR1_EL1, MProgMod, 8, 4) - IDREG_FIELD(ID_PFR1_EL1, Security, 4, 4) - IDREG_FIELD(ID_PFR1_EL1, ProgMod, 0, 4) + IDREG_FIELD_ENUM(ID_PFR1_EL1, GIC, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1), + IDREG_ARCH_VALUE_RANGE(3, 3) + ) + IDREG_FIELD_ENUM(ID_PFR1_EL1, Virt_frac, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_PFR1_EL1, Sec_frac, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_PFR1_EL1, GenTimer, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_PFR1_EL1, Virtualization, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_PFR1_EL1, MProgMod, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(2, 2) + ) + IDREG_FIELD_ENUM(ID_PFR1_EL1, Security, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(ID_PFR1_EL1, ProgMod, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_PFR1_EL1) IDREG_START(ID_PFR2_EL1) - IDREG_FIELD(ID_PFR2_EL1, RAS_frac, 8, 4) - IDREG_FIELD(ID_PFR2_EL1, SSBS, 4, 4) - IDREG_FIELD(ID_PFR2_EL1, CSV3, 0, 4) + IDREG_FIELD_ENUM(ID_PFR2_EL1, RAS_frac, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_PFR2_EL1, SSBS, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(ID_PFR2_EL1, CSV3, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(ID_PFR2_EL1) IDREG_START(MIDR_EL1) - IDREG_FIELD(MIDR_EL1, Implementer, 24, 8) + IDREG_FIELD_ENUM(MIDR_EL1, Implementer, 24, 8, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(65, 68), + IDREG_ARCH_VALUE_RANGE(70, 70), + IDREG_ARCH_VALUE_RANGE(73, 73), + IDREG_ARCH_VALUE_RANGE(77, 78), + IDREG_ARCH_VALUE_RANGE(80, 81), + IDREG_ARCH_VALUE_RANGE(86, 86), + IDREG_ARCH_VALUE_RANGE(105, 105), + IDREG_ARCH_VALUE_RANGE(192, 192) + ) IDREG_FIELD(MIDR_EL1, Variant, 20, 4) - IDREG_FIELD(MIDR_EL1, Architecture, 16, 4) + IDREG_FIELD_ENUM(MIDR_EL1, Architecture, 16, 4, + IDREG_ARCH_VALUE_RANGE(1, 7), + IDREG_ARCH_VALUE_RANGE(15, 15) + ) IDREG_FIELD(MIDR_EL1, PartNum, 4, 12) IDREG_FIELD(MIDR_EL1, Revision, 0, 4) IDREG_END(MIDR_EL1) IDREG_START(MPIDR_EL1) IDREG_FIELD(MPIDR_EL1, Aff3, 32, 8) - IDREG_FIELD(MPIDR_EL1, U, 30, 1) - IDREG_FIELD(MPIDR_EL1, MT, 24, 1) + IDREG_FIELD_ENUM(MPIDR_EL1, U, 30, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MPIDR_EL1, MT, 24, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_FIELD(MPIDR_EL1, Aff2, 16, 8) IDREG_FIELD(MPIDR_EL1, Aff1, 8, 8) IDREG_FIELD(MPIDR_EL1, Aff0, 0, 8) IDREG_END(MPIDR_EL1) IDREG_START(MVFR0_EL1) - IDREG_FIELD(MVFR0_EL1, FPRound, 28, 4) - IDREG_FIELD(MVFR0_EL1, FPShVec, 24, 4) - IDREG_FIELD(MVFR0_EL1, FPSqrt, 20, 4) - IDREG_FIELD(MVFR0_EL1, FPDivide, 16, 4) - IDREG_FIELD(MVFR0_EL1, FPTrap, 12, 4) - IDREG_FIELD(MVFR0_EL1, FPDP, 8, 4) - IDREG_FIELD(MVFR0_EL1, FPSP, 4, 4) - IDREG_FIELD(MVFR0_EL1, SIMDReg, 0, 4) + IDREG_FIELD_ENUM(MVFR0_EL1, FPRound, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR0_EL1, FPShVec, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR0_EL1, FPSqrt, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR0_EL1, FPDivide, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR0_EL1, FPTrap, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR0_EL1, FPDP, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(MVFR0_EL1, FPSP, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(MVFR0_EL1, SIMDReg, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) IDREG_END(MVFR0_EL1) IDREG_START(MVFR1_EL1) - IDREG_FIELD(MVFR1_EL1, SIMDFMAC, 28, 4) - IDREG_FIELD(MVFR1_EL1, FPHP, 24, 4) - IDREG_FIELD(MVFR1_EL1, SIMDHP, 20, 4) - IDREG_FIELD(MVFR1_EL1, SIMDSP, 16, 4) - IDREG_FIELD(MVFR1_EL1, SIMDInt, 12, 4) - IDREG_FIELD(MVFR1_EL1, SIMDLS, 8, 4) - IDREG_FIELD(MVFR1_EL1, FPDNaN, 4, 4) - IDREG_FIELD(MVFR1_EL1, FPFtZ, 0, 4) + IDREG_FIELD_ENUM(MVFR1_EL1, SIMDFMAC, 28, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR1_EL1, FPHP, 24, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) + IDREG_FIELD_ENUM(MVFR1_EL1, SIMDHP, 20, 4, + IDREG_ARCH_VALUE_RANGE(0, 2) + ) + IDREG_FIELD_ENUM(MVFR1_EL1, SIMDSP, 16, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR1_EL1, SIMDInt, 12, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR1_EL1, SIMDLS, 8, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR1_EL1, FPDNaN, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(MVFR1_EL1, FPFtZ, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) IDREG_END(MVFR1_EL1) IDREG_START(MVFR2_EL1) - IDREG_FIELD(MVFR2_EL1, FPMisc, 4, 4) - IDREG_FIELD(MVFR2_EL1, SIMDMisc, 0, 4) + IDREG_FIELD_ENUM(MVFR2_EL1, FPMisc, 4, 4, + IDREG_ARCH_VALUE_RANGE(0, 4) + ) + IDREG_FIELD_ENUM(MVFR2_EL1, SIMDMisc, 0, 4, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) IDREG_END(MVFR2_EL1) IDREG_START(REVIDR_EL1) IDREG_END(REVIDR_EL1) IDREG_START(SMIDR_EL1) - IDREG_FIELD(SMIDR_EL1, NSMC, 56, 4) - IDREG_FIELD(SMIDR_EL1, HIP, 52, 4) + IDREG_FIELD_ENUM(SMIDR_EL1, NSMC, 56, 4, + IDREG_ARCH_VALUE_RANGE(0, 15) + ) + IDREG_FIELD_ENUM(SMIDR_EL1, HIP, 52, 4, + IDREG_ARCH_VALUE_RANGE(0, 15) + ) IDREG_FIELD(SMIDR_EL1, Affinity2, 32, 20) - IDREG_FIELD(SMIDR_EL1, Implementer, 24, 8) + IDREG_FIELD_ENUM(SMIDR_EL1, Implementer, 24, 8, + IDREG_ARCH_VALUE_RANGE(0, 0), + IDREG_ARCH_VALUE_RANGE(65, 68), + IDREG_ARCH_VALUE_RANGE(70, 70), + IDREG_ARCH_VALUE_RANGE(73, 73), + IDREG_ARCH_VALUE_RANGE(77, 78), + IDREG_ARCH_VALUE_RANGE(80, 81), + IDREG_ARCH_VALUE_RANGE(86, 86), + IDREG_ARCH_VALUE_RANGE(105, 105), + IDREG_ARCH_VALUE_RANGE(192, 192) + ) IDREG_FIELD(SMIDR_EL1, Revision, 16, 8) - IDREG_FIELD(SMIDR_EL1, SMPS, 15, 1) - IDREG_FIELD(SMIDR_EL1, SH, 13, 2) + IDREG_FIELD_ENUM(SMIDR_EL1, SMPS, 15, 1, + IDREG_ARCH_VALUE_RANGE(0, 1) + ) + IDREG_FIELD_ENUM(SMIDR_EL1, SH, 13, 2, + IDREG_ARCH_VALUE_RANGE(0, 3) + ) IDREG_FIELD(SMIDR_EL1, Affinity, 0, 12) IDREG_END(SMIDR_EL1)
scripts/update-aarch64-cpu-sysreg-properties.py +119 -6
155 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v10 8/26 target/arm/cpu-idregs.h.inc: Generate reserved fields
In reply to Eric AugerExtract reserved fields: RES0, RES1, RAZ, ...
The extra complexity comes from the fact several reserved fields may exist in the register, as opposed to named fields.
---
v7 -> v8:
- fix WithShifts issue
--- target/arm/cpu-idregs.h.inc | 65 ++++++++++++++ .../update-aarch64-cpu-sysreg-properties.py | 85 +++++++++++++++---- 2 files changed, 134 insertions(+), 16 deletions(-)
target/arm/cpu-idregs.h.inc +65 -0
@@ -13,16 +13,20 @@ IDREG_START(AIDR_EL1) IDREG_END(AIDR_EL1) IDREG_START(CCSIDR2_EL1) + IDREG_FIELD(CCSIDR2_EL1, RES0, 24, 40) IDREG_FIELD(CCSIDR2_EL1, NumSets, 0, 24) IDREG_END(CCSIDR2_EL1) IDREG_START(CCSIDR_EL1) + IDREG_FIELD(CCSIDR_EL1, RES0, 56, 8) IDREG_FIELD(CCSIDR_EL1, NumSets, 32, 24) + IDREG_FIELD(CCSIDR_EL1, RES0, 24, 8) IDREG_FIELD(CCSIDR_EL1, Associativity, 3, 21) IDREG_FIELD(CCSIDR_EL1, LineSize, 0, 3) IDREG_END(CCSIDR_EL1) IDREG_START(CLIDR_EL1) + IDREG_FIELD(CLIDR_EL1, RES0, 47, 17) IDREG_FIELD(CLIDR_EL1, Ttype7, 45, 2) IDREG_FIELD(CLIDR_EL1, Ttype6, 43, 2) IDREG_FIELD(CLIDR_EL1, Ttype5, 41, 2)
@@ -46,7 +50,10 @@ IDREG_START(CLIDR_EL1) IDREG_END(CLIDR_EL1) IDREG_START(CTR_EL0) + IDREG_FIELD(CTR_EL0, RES0, 38, 26) IDREG_FIELD(CTR_EL0, TminLine, 32, 6) + IDREG_FIELD(CTR_EL0, RES1, 31, 1) + IDREG_FIELD(CTR_EL0, RES0, 30, 1) IDREG_FIELD_ENUM(CTR_EL0, DIC, 29, 1, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -59,10 +66,12 @@ IDREG_START(CTR_EL0) IDREG_FIELD_ENUM(CTR_EL0, L1Ip, 14, 2, IDREG_ARCH_VALUE_RANGE(0, 3) ) + IDREG_FIELD(CTR_EL0, RES0, 4, 10) IDREG_FIELD(CTR_EL0, IminLine, 0, 4) IDREG_END(CTR_EL0) IDREG_START(DCZID_EL0) + IDREG_FIELD(DCZID_EL0, RES0, 9, 55) IDREG_FIELD(DCZID_EL0, TBS, 5, 4) IDREG_FIELD_ENUM(DCZID_EL0, DZP, 4, 1, IDREG_ARCH_VALUE_RANGE(0, 1)
@@ -71,13 +80,16 @@ IDREG_START(DCZID_EL0) IDREG_END(DCZID_EL0) IDREG_START(GMID_EL1) + IDREG_FIELD(GMID_EL1, RES0, 4, 60) IDREG_FIELD(GMID_EL1, BS, 0, 4) IDREG_END(GMID_EL1) IDREG_START(ID_AA64AFR0_EL1) + IDREG_FIELD(ID_AA64AFR0_EL1, RES0, 32, 32) IDREG_END(ID_AA64AFR0_EL1) IDREG_START(ID_AA64AFR1_EL1) + IDREG_FIELD(ID_AA64AFR1_EL1, RES0, 0, 64) IDREG_END(ID_AA64AFR1_EL1) IDREG_START(ID_AA64DFR0_EL1)
@@ -110,6 +122,7 @@ IDREG_START(ID_AA64DFR0_EL1) IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, CTX_CMPs, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 15) ) + IDREG_FIELD(ID_AA64DFR0_EL1, RES0, 24, 4) IDREG_FIELD_ENUM(ID_AA64DFR0_EL1, WRPs, 20, 4, IDREG_ARCH_VALUE_RANGE(1, 15) )
@@ -169,6 +182,7 @@ IDREG_START(ID_AA64DFR1_EL1) IDREG_END(ID_AA64DFR1_EL1) IDREG_START(ID_AA64DFR2_EL1) + IDREG_FIELD(ID_AA64DFR2_EL1, RES0, 28, 36) IDREG_FIELD_ENUM(ID_AA64DFR2_EL1, TRBE_EXC, 24, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -178,6 +192,7 @@ IDREG_START(ID_AA64DFR2_EL1) IDREG_FIELD_ENUM(ID_AA64DFR2_EL1, SPE_EXC, 16, 4, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64DFR2_EL1, RES0, 8, 8) IDREG_FIELD_ENUM(ID_AA64DFR2_EL1, BWE, 4, 4, IDREG_ARCH_VALUE_RANGE(0, 2) )
@@ -187,6 +202,7 @@ IDREG_START(ID_AA64DFR2_EL1) IDREG_END(ID_AA64DFR2_EL1) IDREG_START(ID_AA64FPFR0_EL1) + IDREG_FIELD(ID_AA64FPFR0_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8CVT, 31, 1, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -205,9 +221,12 @@ IDREG_START(ID_AA64FPFR0_EL1) IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8MM4, 26, 1, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64FPFR0_EL1, RES0, 16, 10) IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F16MM2, 15, 1, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64FPFR0_EL1, RES0, 8, 7) + IDREG_FIELD(ID_AA64FPFR0_EL1, RAZ, 2, 6) IDREG_FIELD_ENUM(ID_AA64FPFR0_EL1, F8E4M3, 1, 1, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -244,6 +263,7 @@ IDREG_START(ID_AA64ISAR0_EL1) IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, RDM, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64ISAR0_EL1, RES0, 24, 4) IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, Atomic, 20, 4, IDREG_ARCH_VALUE_RANGE(0, 0), IDREG_ARCH_VALUE_RANGE(2, 3)
@@ -260,6 +280,7 @@ IDREG_START(ID_AA64ISAR0_EL1) IDREG_FIELD_ENUM(ID_AA64ISAR0_EL1, AES, 4, 4, IDREG_ARCH_VALUE_RANGE(0, 2) ) + IDREG_FIELD(ID_AA64ISAR0_EL1, RES0, 0, 4) IDREG_END(ID_AA64ISAR0_EL1) IDREG_START(ID_AA64ISAR1_EL1)
@@ -366,6 +387,7 @@ IDREG_START(ID_AA64ISAR2_EL1) IDREG_END(ID_AA64ISAR2_EL1) IDREG_START(ID_AA64ISAR3_EL1) + IDREG_FIELD(ID_AA64ISAR3_EL1, RES0, 48, 16) IDREG_FIELD_ENUM(ID_AA64ISAR3_EL1, LSCP, 44, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -411,6 +433,7 @@ IDREG_START(ID_AA64MMFR0_EL1) IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, FGT, 56, 4, IDREG_ARCH_VALUE_RANGE(0, 2) ) + IDREG_FIELD(ID_AA64MMFR0_EL1, RES0, 48, 8) IDREG_FIELD_ENUM(ID_AA64MMFR0_EL1, ExS, 44, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -517,6 +540,7 @@ IDREG_START(ID_AA64MMFR2_EL1) IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, TTL, 48, 4, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64MMFR2_EL1, RES0, 44, 4) IDREG_FIELD_ENUM(ID_AA64MMFR2_EL1, FWB, 40, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -562,6 +586,7 @@ IDREG_START(ID_AA64MMFR3_EL1) IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, SDERR, 52, 4, IDREG_ARCH_VALUE_RANGE(0, 3) ) + IDREG_FIELD(ID_AA64MMFR3_EL1, RES0, 48, 4) IDREG_FIELD_ENUM(ID_AA64MMFR3_EL1, ANERR, 44, 4, IDREG_ARCH_VALUE_RANGE(0, 3) )
@@ -739,6 +764,7 @@ IDREG_START(ID_AA64PFR1_EL1) IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, SME, 24, 4, IDREG_ARCH_VALUE_RANGE(0, 2) ) + IDREG_FIELD(ID_AA64PFR1_EL1, RES0, 20, 4) IDREG_FIELD_ENUM(ID_AA64PFR1_EL1, MPAM_frac, 16, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -757,6 +783,7 @@ IDREG_START(ID_AA64PFR1_EL1) IDREG_END(ID_AA64PFR1_EL1) IDREG_START(ID_AA64PFR2_EL1) + IDREG_FIELD(ID_AA64PFR2_EL1, RES0, 48, 16) IDREG_FIELD_ENUM(ID_AA64PFR2_EL1, VMTETCL, 44, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -799,6 +826,7 @@ IDREG_START(ID_AA64SMFR0_EL1) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, FA64, 63, 1, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64SMFR0_EL1, RES0, 62, 1) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, LUT6, 61, 1, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -812,6 +840,7 @@ IDREG_START(ID_AA64SMFR0_EL1) IDREG_ARCH_VALUE_RANGE(0, 0), IDREG_ARCH_VALUE_RANGE(15, 15) ) + IDREG_FIELD(ID_AA64SMFR0_EL1, RES0, 49, 3) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, F64F64, 48, 1, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -847,6 +876,7 @@ IDREG_START(ID_AA64SMFR0_EL1) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, F32F32, 32, 1, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64SMFR0_EL1, RES0, 31, 1) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SF8FMA, 30, 1, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -856,6 +886,7 @@ IDREG_START(ID_AA64SMFR0_EL1) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SF8DP2, 28, 1, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64SMFR0_EL1, RES0, 26, 2) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SBitPerm, 25, 1, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -865,15 +896,18 @@ IDREG_START(ID_AA64SMFR0_EL1) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SFEXPA, 23, 1, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64SMFR0_EL1, RES0, 17, 6) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, STMOP, 16, 1, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64SMFR0_EL1, RES0, 1, 15) IDREG_FIELD_ENUM(ID_AA64SMFR0_EL1, SMOP4, 0, 1, IDREG_ARCH_VALUE_RANGE(0, 1) ) IDREG_END(ID_AA64SMFR0_EL1) IDREG_START(ID_AA64ZFR0_EL1) + IDREG_FIELD(ID_AA64ZFR0_EL1, RES0, 60, 4) IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, F64MM, 56, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -889,9 +923,11 @@ IDREG_START(ID_AA64ZFR0_EL1) IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, SM4, 40, 4, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64ZFR0_EL1, RES0, 36, 4) IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, SHA3, 32, 4, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64ZFR0_EL1, RES0, 28, 4) IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, B16B16, 24, 4, IDREG_ARCH_VALUE_RANGE(0, 3) )
@@ -904,6 +940,7 @@ IDREG_START(ID_AA64ZFR0_EL1) IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, EltPerm, 12, 4, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_AA64ZFR0_EL1, RES0, 8, 4) IDREG_FIELD_ENUM(ID_AA64ZFR0_EL1, AES, 4, 4, IDREG_ARCH_VALUE_RANGE(0, 3) )
@@ -913,9 +950,11 @@ IDREG_START(ID_AA64ZFR0_EL1) IDREG_END(ID_AA64ZFR0_EL1) IDREG_START(ID_AFR0_EL1) + IDREG_FIELD(ID_AFR0_EL1, RES0, 0, 64) IDREG_END(ID_AFR0_EL1) IDREG_START(ID_DFR0_EL1) + IDREG_FIELD(ID_DFR0_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_DFR0_EL1, TraceFilt, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -944,6 +983,7 @@ IDREG_START(ID_DFR0_EL1) IDREG_END(ID_DFR0_EL1) IDREG_START(ID_DFR1_EL1) + IDREG_FIELD(ID_DFR1_EL1, RES0, 8, 56) IDREG_FIELD_ENUM(ID_DFR1_EL1, HPMN0, 4, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -954,6 +994,7 @@ IDREG_START(ID_DFR1_EL1) IDREG_END(ID_DFR1_EL1) IDREG_START(ID_ISAR0_EL1) + IDREG_FIELD(ID_ISAR0_EL1, RES0, 28, 36) IDREG_FIELD_ENUM(ID_ISAR0_EL1, Divide, 24, 4, IDREG_ARCH_VALUE_RANGE(0, 2) )
@@ -978,6 +1019,7 @@ IDREG_START(ID_ISAR0_EL1) IDREG_END(ID_ISAR0_EL1) IDREG_START(ID_ISAR1_EL1) + IDREG_FIELD(ID_ISAR1_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_ISAR1_EL1, Jazelle, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1005,6 +1047,7 @@ IDREG_START(ID_ISAR1_EL1) IDREG_END(ID_ISAR1_EL1) IDREG_START(ID_ISAR2_EL1) + IDREG_FIELD(ID_ISAR2_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_ISAR2_EL1, Reversal, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 2) )
@@ -1032,6 +1075,7 @@ IDREG_START(ID_ISAR2_EL1) IDREG_END(ID_ISAR2_EL1) IDREG_START(ID_ISAR3_EL1) + IDREG_FIELD(ID_ISAR3_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_ISAR3_EL1, T32EE, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1060,6 +1104,7 @@ IDREG_START(ID_ISAR3_EL1) IDREG_END(ID_ISAR3_EL1) IDREG_START(ID_ISAR4_EL1) + IDREG_FIELD(ID_ISAR4_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_ISAR4_EL1, SWP_frac, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1089,12 +1134,14 @@ IDREG_START(ID_ISAR4_EL1) IDREG_END(ID_ISAR4_EL1) IDREG_START(ID_ISAR5_EL1) + IDREG_FIELD(ID_ISAR5_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_ISAR5_EL1, VCMA, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) ) IDREG_FIELD_ENUM(ID_ISAR5_EL1, RDM, 24, 4, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(ID_ISAR5_EL1, RES0, 20, 4) IDREG_FIELD_ENUM(ID_ISAR5_EL1, CRC32, 16, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1113,6 +1160,7 @@ IDREG_START(ID_ISAR5_EL1) IDREG_END(ID_ISAR5_EL1) IDREG_START(ID_ISAR6_EL1) + IDREG_FIELD(ID_ISAR6_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_ISAR6_EL1, CLRBHB, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1140,6 +1188,7 @@ IDREG_START(ID_ISAR6_EL1) IDREG_END(ID_ISAR6_EL1) IDREG_START(ID_MMFR0_EL1) + IDREG_FIELD(ID_MMFR0_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_MMFR0_EL1, InnerShr, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1), IDREG_ARCH_VALUE_RANGE(15, 15)
@@ -1169,6 +1218,7 @@ IDREG_START(ID_MMFR0_EL1) IDREG_END(ID_MMFR0_EL1) IDREG_START(ID_MMFR1_EL1) + IDREG_FIELD(ID_MMFR1_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_MMFR1_EL1, BPred, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 4) )
@@ -1196,6 +1246,7 @@ IDREG_START(ID_MMFR1_EL1) IDREG_END(ID_MMFR1_EL1) IDREG_START(ID_MMFR2_EL1) + IDREG_FIELD(ID_MMFR2_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_MMFR2_EL1, HWAccFlg, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1221,6 +1272,7 @@ IDREG_START(ID_MMFR2_EL1) IDREG_END(ID_MMFR2_EL1) IDREG_START(ID_MMFR3_EL1) + IDREG_FIELD(ID_MMFR3_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_MMFR3_EL1, Supersec, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 0), IDREG_ARCH_VALUE_RANGE(15, 15)
@@ -1249,6 +1301,7 @@ IDREG_START(ID_MMFR3_EL1) IDREG_END(ID_MMFR3_EL1) IDREG_START(ID_MMFR4_EL1) + IDREG_FIELD(ID_MMFR4_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_MMFR4_EL1, EVT, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 2) )
@@ -1276,6 +1329,7 @@ IDREG_START(ID_MMFR4_EL1) IDREG_END(ID_MMFR4_EL1) IDREG_START(ID_MMFR5_EL1) + IDREG_FIELD(ID_MMFR5_EL1, RES0, 8, 56) IDREG_FIELD_ENUM(ID_MMFR5_EL1, nTLBPA, 4, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1285,6 +1339,7 @@ IDREG_START(ID_MMFR5_EL1) IDREG_END(ID_MMFR5_EL1) IDREG_START(ID_PFR0_EL1) + IDREG_FIELD(ID_PFR0_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_PFR0_EL1, RAS, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 3) )
@@ -1313,6 +1368,7 @@ IDREG_START(ID_PFR0_EL1) IDREG_END(ID_PFR0_EL1) IDREG_START(ID_PFR1_EL1) + IDREG_FIELD(ID_PFR1_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(ID_PFR1_EL1, GIC, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1), IDREG_ARCH_VALUE_RANGE(3, 3)
@@ -1342,6 +1398,7 @@ IDREG_START(ID_PFR1_EL1) IDREG_END(ID_PFR1_EL1) IDREG_START(ID_PFR2_EL1) + IDREG_FIELD(ID_PFR2_EL1, RES0, 12, 52) IDREG_FIELD_ENUM(ID_PFR2_EL1, RAS_frac, 8, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1375,10 +1432,13 @@ IDREG_START(MIDR_EL1) IDREG_END(MIDR_EL1) IDREG_START(MPIDR_EL1) + IDREG_FIELD(MPIDR_EL1, RES0, 40, 24) IDREG_FIELD(MPIDR_EL1, Aff3, 32, 8) + IDREG_FIELD(MPIDR_EL1, RES1, 31, 1) IDREG_FIELD_ENUM(MPIDR_EL1, U, 30, 1, IDREG_ARCH_VALUE_RANGE(0, 1) ) + IDREG_FIELD(MPIDR_EL1, RES0, 25, 5) IDREG_FIELD_ENUM(MPIDR_EL1, MT, 24, 1, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1388,6 +1448,7 @@ IDREG_START(MPIDR_EL1) IDREG_END(MPIDR_EL1) IDREG_START(MVFR0_EL1) + IDREG_FIELD(MVFR0_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(MVFR0_EL1, FPRound, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1415,6 +1476,7 @@ IDREG_START(MVFR0_EL1) IDREG_END(MVFR0_EL1) IDREG_START(MVFR1_EL1) + IDREG_FIELD(MVFR1_EL1, RES0, 32, 32) IDREG_FIELD_ENUM(MVFR1_EL1, SIMDFMAC, 28, 4, IDREG_ARCH_VALUE_RANGE(0, 1) )
@@ -1442,6 +1504,7 @@ IDREG_START(MVFR1_EL1) IDREG_END(MVFR1_EL1) IDREG_START(MVFR2_EL1) + IDREG_FIELD(MVFR2_EL1, RES0, 8, 56) IDREG_FIELD_ENUM(MVFR2_EL1, FPMisc, 4, 4, IDREG_ARCH_VALUE_RANGE(0, 4) )
@@ -1454,6 +1517,7 @@ IDREG_START(REVIDR_EL1) IDREG_END(REVIDR_EL1) IDREG_START(SMIDR_EL1) + IDREG_FIELD(SMIDR_EL1, RES0, 60, 4) IDREG_FIELD_ENUM(SMIDR_EL1, NSMC, 56, 4, IDREG_ARCH_VALUE_RANGE(0, 15) )
@@ -1479,6 +1543,7 @@ IDREG_START(SMIDR_EL1) IDREG_FIELD_ENUM(SMIDR_EL1, SH, 13, 2, IDREG_ARCH_VALUE_RANGE(0, 3) ) + IDREG_FIELD(SMIDR_EL1, RES0, 12, 1) IDREG_FIELD(SMIDR_EL1, Affinity, 0, 12) IDREG_END(SMIDR_EL1)
scripts/update-aarch64-cpu-sysreg-properties.py +69 -16
128 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v10 9/26 target/arm/cpu_idregs: Generate tables for Arm64 ID registers and fields
In reply to Eric AugerFrom: Shaju Abraham <[email protected]>
Include cpu-idregs.h.inc multiple times with different definitions for the X-macros. This will generate tables for all Arm64 ID registers and their fields. Additionally, initialize the tables with all architecturally defined values. These tables will be consumed by the property layer in future patches.
---
v9 -> v10
- fix tabs
- initialize writable_mask
- Use ValueRange instead of Value
v7 -> v8
Adaptation after removal of struct ArmIdRegArchVal
v5 -> v6
- restored support of enum values
--- target/arm/cpu-idregs.c | 93 +++++++++++++++++++++++++++++++++++++++++ target/arm/meson.build | 1 + 2 files changed, 94 insertions(+) create mode 100644 target/arm/cpu-idregs.c
target/arm/cpu-idregs.c new file +93 -0
@@ -0,0 +1,93 @@ +/* +* ARM ID register field table. +* +* Builds the per-id-register field descriptor arrays and the global +* arm_idregs[] table. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "qapi/error.h" +#include "cpu.h" +#include "cpu-idregs.h" + +/* +* Generate an array of architecturally defined value ranges for each field +* that has enum / ValueRange constraints. +*/ + +#define IDREG_ARCH_VALUE_RANGE (_lo, _hi) { .lo = (_lo), .hi = (_hi) } + +#define IDREG_START (reg) +#define IDREG_END (reg) +#define IDREG_FIELD (reg, field, shift, length) +#define IDREG_FIELD_ENUM (reg, field, shift, length, ...) \ + static const ARM64SysRegArchValueRange reg##_##field##_arch_value_ranges[] = { \ + __VA_ARGS__ \ + }; + +#include "cpu-idregs.h.inc" + +#undef IDREG_START +#undef IDREG_END +#undef IDREG_FIELD +#undef IDREG_FIELD_ENUM +#undef IDREG_ARCH_VALUE_RANGE + +/* generate an array of per-register ArmIdRegField[] descriptors */ + +#define IDREG_START (reg) \ + static ARM64SysRegField reg##_fields[] = { + +#define IDREG_END (reg) \ + }; + +#define IDREG_ARCH_VALUE_RANGE (_lo, _hi) + +#define IDREG_FIELD_ENUM (reg, field, _shift, _length, ...) \ + { \ + .name = #field, \ + .index = reg##_IDX, \ + .shift = (_shift), \ + .length = (_length), \ + .arch_value_ranges = reg##_##field##_arch_value_ranges, \ + .arch_value_ranges_count = \ + ARRAY_SIZE(reg##_##field##_arch_value_ranges), \ + }, + +#define IDREG_FIELD (reg, field, _shift, _length) \ + { \ + .name = #field, \ + .index = reg##_IDX, \ + .shift = (_shift), \ + .length = (_length), \ + }, + +#include "cpu-idregs.h.inc" + +#undef IDREG_START +#undef IDREG_END +#undef IDREG_FIELD +#undef IDREG_FIELD_ENUM +#undef IDREG_ARCH_VALUE_RANGE + +/* generate an array of top level ID registers */ + +#define IDREG_END (reg) +#define IDREG_FIELD (reg, field, shift, length) +#define IDREG_FIELD_ENUM (reg, field, shift, length, ...) +#define IDREG_ARCH_VALUE_RANGE (_lo, _hi) + +#define IDREG_START (reg) \ + [reg##_IDX] = { \ + .name = #reg, \ + .index = reg##_IDX, \ + .fields = reg##_fields, \ + .fields_count = ARRAY_SIZE(reg##_fields), \ + .writable_mask = 0ULL, \ + }, + +ARM64SysReg arm64_id_regs[NUM_ID_IDX ] = { +#include "cpu-idregs.h.inc" +};
target/arm/meson.build +1 -0
@@ -30,6 +30,7 @@ arm_common_user_system_ss.add(when: 'TARGET_AARCH64', if_true: files( arm_common_system_ss.add(files( 'arm-qmp-cmds.c', + 'cpu-idregs.c', )) arm_system_ss.add(when: 'CONFIG_KVM', if_true: files('hyp_gdbstub.c', 'kvm.c')) arm_system_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c'))
Signature · 1 line
2.53.0
PATCH v10 10/26 target/arm/kvm: Retrieve writable ID reg map
In reply to Eric AugerFrom: Cornelia Huck <[email protected]>
Add a helper to retrieve the writable id reg bitmask.
then retrieve the writable_mask array and dispatch it in the writable_map field of arm64_id_regs[] elements.
---
v9 -> v10:
- removed if (idx < 0 || idx > ARRAY_SIZE(arm64_id_regs)) check
- commit description cleanup
v7 -> v8
- added kvm_enabled()
v5 -> v6
- use arm64_id_regs[].writable_map
- squashed 2 commits (helper + user)
- removed stub
--- target/arm/kvm.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
target/arm/kvm.c +55 -0
@@ -28,6 +28,7 @@#include "kvm_arm.h" #include "cpu.h" #include "cpu-sysregs.h" +#include "cpu-idregs.h" #include "trace.h" #include "internals.h" #include "hw/pci/pci.h"
@@ -51,6 +52,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {static bool cap_has_mp_state;static bool cap_has_inject_serror_esr;static bool cap_has_inject_ext_dabt; +static bool writable_map_dispatched;/** * ARMHostCPUFeatures: information about the host CPU (identified
@@ -312,6 +314,21 @@ static uint32_t kvm_arm_sve_get_vls(int fd)return vls[0 ] &MAKE_64BIT_MASK (0 ,ARM_MAX_VQ ); } +static int kvm_feature_idx_to_idregs_idx (int kidx) +{ +int op1, crm, op2; +ARMSysRegs sysreg; + + op1 = kidx /64 ; +if (op1 ==2 ) { + op1 =3 ; + } + crm = (kidx %64 ) /8 ; + op2 = kidx %8 ; + sysreg =ENCODE_ID_REG (3 , op1,0 , crm, op2); +return get_sysreg_idx (sysreg); +} +static void kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf) {/* Identify the feature bits corresponding to the host CPU, and
@@ -523,9 +540,47 @@ static void kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ahcf->features = features; } +static int kvm_arm_get_writable_id_regs (uint64_t *idregmap) +{ +int cap_writable_id_regs; +struct reg_mask_range range = { + .range =KVM_ARM_FEATURE_ID_RANGE , + .reserved = {0 }, + .addr = (uint64_t )idregmap, + }; + + cap_writable_id_regs = +kvm_check_extension (kvm_state,KVM_CAP_ARM_SUPPORTED_REG_MASK_RANGES ); + +if (!cap_writable_id_regs || + !(cap_writable_id_regs & (1 <<KVM_ARM_FEATURE_ID_RANGE ))) { +return -ENOSYS ; + } + +return kvm_vm_ioctl (kvm_state,KVM_ARM_GET_REG_WRITABLE_MASKS , &range); +} +void kvm_arm_set_cpu_features_from_host (ARMCPU *cpu) {CPUARMState *env = &cpu->env; +uint64_t *writable_map; + + writable_map =g_new (uint64_t,KVM_ARM_FEATURE_ID_RANGE_SIZE ); + +if (kvm_enabled () && !writable_map_dispatched && + !kvm_arm_get_writable_id_regs (writable_map)) { +for (int i =0 ; i <KVM_ARM_FEATURE_ID_RANGE_SIZE ; i++) { +uint64_t mask = writable_map[i]; + +if (mask) { +int idx =kvm_feature_idx_to_idregs_idx (i); + + arm64_id_regs[idx].writable_mask = mask; + } + } + writable_map_dispatched = true; + } +g_free (writable_map);if (!arm_host_cpu_features.dtb_compatible) {kvm_arm_get_host_cpu_features (&arm_host_cpu_features);
Signature · 1 line
2.53.0
PATCH v10 11/26 hw/arm/virt: Make sure virt_get_caches() keeps on reading CLIDR_EL1 as 0
In reply to Eric AugerIn KVM mode, virt_get_caches() currently gets a zero value for the CLIDR_EL1 register. This is due to the fact CLIDR is never read from host. This is a bug.
Soon we will initialize all writable isar.idreg[] from host and this includes CLIDR_EL1. However we cannot directly fix the initialization, first because it would change the way the guest is exposed caches in DT/ACPI descriptions and because some host values would be rejected by the current QEMU code, expecially in the case host has a unified L1 cache which is currently not supported and triggers the following
errod: "Unified type is not implemented at level 1" error.
So this issue will be fixed separately.
---
v9 -> v10
- add a comment explaining why we oveeride the clidr value
--- hw/arm/virt.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
hw/arm/virt.c +11 -0
@@ -338,6 +338,17 @@ unsigned int virt_get_caches(const VirtMachineState *vms, CPUCoreCaches *caches)ARMISARegisters *isar = &armcpu->isar;uint32_t clidr =GET_IDREG (isar,CLIDR ); +/* +* Commit f669de70011 ("hw/arm/virt: add cache hierarchy to device tree") +* read the CLIDR value from the isar array but in KVM mode, this index +* was never initialized from host. Now we want to initialize all ID +* registers * from host and until this gets fixed, we need to override +* clidr to 0 to keep the compatibility. +*/ +if (kvm_enabled ()) { + clidr =0 ; + } +for (int cache_level =1 ; cache_level <=CLIDR_CTYPE_MAX_CACHE_LEVEL ; cache_level++) { uint8_t ctype =
Signature · 1 line
2.53.0
PATCH v10 12/26 arm/kvm: Initialize isar.idregs[] with all writable host ID regs
In reply to Eric Augerkvm_arm_get_host_cpu_features() already retrieves the values of some host id registers to analyze the available vcpu features.
Eventually we want to be able to allow the user to change the value of writable ID reg fields. So we need to store the initial value of all writable ID regs into isar.idregs[].
Introduce a new get_host_cpu_idregs() helper that populates isar.idregs[] and call it from kvm_arm_get_host_cpu_features.
This patch has no impact on cpreg values. isar.idregs[] is only used as a temporary storage for register values to be updated in place later. Also it does not handle the writeback of isar.idregs[] into cpreg value list after user update. This will be handled separately.
Note the host values are retrieved from the scratch vcpu initialized with all the available capabilities exposed by KVM, independently on the final vcpu features made by the user through the legacy composite options such as sve, pauth, virtualization, ...
At the moment, the only caller sets writable to true. Named vcpu models will use the writable=false mode. Note this will require some extra handling for ID regs that cannot be read from KVM.
---
v9 -> v10:
- get rid of spurious kvm_arm_writable_idregs_to_cpreg_list trace point
- add a writable parameter to get_host_cpu_idregs
- some code cleanup
v8 -> v9:
- improve the commit msg. Only initialize in this patch and move the write back to cpreg value list in a different patch.
- Do not hack CLIDR here. The correct way to fix that temporarily is to do that in the machine instead.
v7 -> v8
- fix indent and added Khushit's R-b
v6 -> v7
- remove vcpu from prototypes (Khushit)
v5 -> v6
- do not check writable_map anymore
--- target/arm/kvm.c | 44 ++++++++++++++++++++++++++++++++++++++++- target/arm/trace-events | 1 + 2 files changed, 44 insertions(+), 1 deletion(-)
target/arm/kvm.c +43 -1
@@ -43,6 +43,7 @@#include "hw/acpi/ghes.h" #include "target/arm/gtimer.h" #include "migration/blocker.h" +#include "cpu-idregs.h" const KVMCapabilityInfo kvm_arch_required_capabilities[] = {KVM_CAP_INFO (DEVICE_CTRL ),
@@ -329,7 +330,45 @@ static int kvm_feature_idx_to_idregs_idx(int kidx)return get_sysreg_idx (sysreg); } -static void kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf) +/* +* get_host_cpu_idregs: Read all the ID register values from KVM +* vcpu fd and populate @ahcf->isar.idregs[] with those values +* +* Need to be called once the writable mask has been populated +* if @writable is set +* +* @fd: vcpu fd +* @ahcf: ARMHostCPUFeatures whose @ahcf->isar.idregs[] will be +* populated +* @writable: if set, only writable ID regs are read +*/ +static int get_host_cpu_idregs (int fd,ARMHostCPUFeatures *ahcf,bool writable) +{ +for (int i =0 ; i <NUM_ID_IDX ; i++) { +ARM64SysReg *sysregdesc = &arm64_id_regs[i]; +ARMSysRegs sysreg = id_register_sysreg[i]; +uint64_t *reg; +int ret; + +if (writable && !sysregdesc->writable_mask) { +continue ; + } + + reg = &ahcf->isar.idregs[i]; + ret =read_sys_reg64 (fd, reg,idregs_sysreg_to_kvm_reg (sysreg)); +if (ret) { +error_report ("%s error reading value of host %s register (%m)" , + __func__, sysregdesc->name); + +return ret; + } +trace_get_host_cpu_idregs (sysregdesc->name, *reg); + } +return 0 ; +} + +static void +kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf) {/* Identify the feature bits corresponding to the host CPU, and * fill out the ARMHostCPUClass fields accordingly. To do this
@@ -415,6 +454,9 @@ static void kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)SET_IDREG (&ahcf->isar,ID_AA64PFR0 ,0x00000011 );/* EL1&0, AArch64 only */ err =0 ; }else { +/* Make sure all writable ID reg values are initialized */ + err |=get_host_cpu_idregs (fd, ahcf, true); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64PFR1_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64PFR2_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64SMFR0_EL1_IDX );
target/arm/trace-events +1 -0
@@ -13,6 +13,7 @@ arm_gt_update_irq(int timer, int irqstate) "gt_update_irq: timer %d irqstate %d" # kvm.c kvm_arm_fixup_msi_route(uint64_t iova, uint64_t gpa) "MSI iova = 0x%"PRIx64" is translated into 0x%"PRIx64 +get_host_cpu_idregs(const char *name, uint64_t value) "scratch vcpu host value for %s is 0x%"PRIx64 # cpu.c arm_cpu_reset(uint64_t mp_aff) "cpu %" PRIu64
Signature · 1 line
2.53.0
Re: [PATCH v10 12/26] arm/kvm: Initialize isar.idregs[] with all writable host ID regs
Quoted 95 lines · Eric Auger
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
kvm_arm_get_host_cpu_features()already retrieves the values of some host id registers to analyze the available vcpu features.Eventually we want to be able to allow the user to change the value of writable ID reg fields. So we need to store the initial value of all writable ID regs into isar.idregs[].
Introduce a new
get_host_cpu_idregs()helper that populates isar.idregs[] and call it fromkvm_arm_get_host_cpu_features.This patch has no impact on cpreg values. isar.idregs[] is only used as a temporary storage for register values to be updated in place later. Also it does not handle the writeback of isar.idregs[] into cpreg value list after user update. This will be handled separately.
Note the host values are retrieved from the scratch vcpu initialized with all the available capabilities exposed by KVM, independently on the final vcpu features made by the user through the legacy composite options such as sve, pauth, virtualization, ...
At the moment, the only caller sets writable to true. Named vcpu models will use the writable=false mode. Note this will require some extra handling for ID regs that cannot be read from KVM.
Signed-off-by Eric Auger <[email protected]>Signed-off-by Cornelia Huck <[email protected]>---
v9 -> v10:
- get rid of spuriouskvm_arm_writable_idregs_to_cpreg_listtrace point
- add a writable parameter toget_host_cpu_idregs
- some code cleanupv8 -> v9:
- improve the commit msg. Only initialize in this patch and move the write back to cpreg value list in a different patch.
- Do not hack CLIDR here. The correct way to fix that temporarily is to do that in the machine instead.v7 -> v8
- fix indent and added Khushit's R-bv6 -> v7
- remove vcpu from prototypes (Khushit)v5 -> v6
- do not checkwritable_mapanymore
---target/arm/kvm.c| 44 ++++++++++++++++++++++++++++++++++++++++-
target/arm/trace-events | 1 +2 files changed, 44 insertions(+), 1 deletion(-)target/arm/kvm.c +18
-1@@ -43,6 +43,7 @@#include "hw/acpi/ghes.h" #include "target/arm/gtimer.h" #include "migration/blocker.h" +#include "cpu-idregs.h" const KVMCapabilityInfo kvm_arch_required_capabilities[] = {KVM_CAP_INFO (DEVICE_CTRL ),@@ -329,7 +330,45 @@ static int kvm_feature_idx_to_idregs_idx(int kidx)return get_sysreg_idx (sysreg); } -static void kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf) +/* +* get_host_cpu_idregs: Read all the ID register values from KVM +* vcpu fd and populate @ahcf->isar.idregs[] with those values +* +* Need to be called once the writable mask has been populated +* if @writable is set +* +* @fd: vcpu fd +* @ahcf: ARMHostCPUFeatures whose @ahcf->isar.idregs[] will be +* populated +* @writable: if set, only writable ID regs are read +*/ +static int get_host_cpu_idregs (int fd,ARMHostCPUFeatures *ahcf,bool writable) +{ +for (int i =0 ; i <NUM_ID_IDX ; i++) { +ARM64SysReg *sysregdesc = &arm64_id_regs[i]; +ARMSysRegs sysreg = id_register_sysreg[i];
target/arm/kvm.c static int kvm_feature_idx_to_idregs_idx(int kidx) · line 359
Quoted 10 lines
target/arm/kvm.c +10
-0+uint64_t *reg; +int ret; + +if (writable && !sysregdesc->writable_mask) { +continue ; + } + + reg = &ahcf->isar.idregs[i]; + ret =read_sys_reg64 (fd, reg,idregs_sysreg_to_kvm_reg (sysreg)); +if (ret) {
Hi Eric,
We should ignore ENOENT errors here.
Also, When we read the full register set, we need to take care of some special cases, like I do in (target/arm/kvm: handle special ID registers when reading from KVM) (I can handle this in my series if you like).
Anyway, for now, using a local commit for the first point.
Thanks,
Khushit
Quoted 40 lines
target/arm/kvm.c +15
-0+error_report ("%s error reading value of host %s register (%m)" , + __func__, sysregdesc->name); + +return ret; + } +trace_get_host_cpu_idregs (sysregdesc->name, *reg); + } +return 0 ; +} + +static void +kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf) {/* Identify the feature bits corresponding to the host CPU, and * fill out the ARMHostCPUClass fields accordingly. To do this @@ -415,6 +454,9 @@ static void kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)SET_IDREG (&ahcf->isar,ID_AA64PFR0 ,0x00000011 );/* EL1&0, AArch64 only */ err =0 ; }else { +/* Make sure all writable ID reg values are initialized */ + err |=get_host_cpu_idregs (fd, ahcf, true); + err |=get_host_cpu_reg (fd, ahcf,ID_AA64PFR1_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64PFR2_EL1_IDX ); err |=get_host_cpu_reg (fd, ahcf,ID_AA64SMFR0_EL1_IDX );target/arm/trace-events +0
-0@@ -13,6 +13,7 @@ arm_gt_update_irq(int timer, int irqstate) "gt_update_irq: timer %d irqstate %d" # kvm.c
kvm_arm_fixup_msi_route(uint64_t iova, uint64_t gpa)"MSI iova = 0x%"PRIx64" is translated into 0x%"PRIx64 +get_host_cpu_idregs(const char *name,uint64_tvalue) "scratch vcpu host value for %s is 0x%"PRIx64# cpu.c arm_cpu_reset(uint64_t mp_aff) "cpu %" PRIu64Signature · 1 line
2.53.0
PATCH v10 13/26 target/arm/cpu64: Add properties for writable IDReg fields
In reply to Eric AugerFor KVM vcpu models, we add properties for all writable ID reg fields. This relies on the idreg writable mask retrieved from KVM, which is matched aginst the register description found in target/arm/cpu-idregs.h.inc.
The code is prepared to extend this capability to all ID register fields independently on their writability. This will be needed for named vcpu models which may want to relax some values to the host supported one.
REVIDR_EL1 and AIDR_EL1 are writable but they do not expose any field. So they will need to be handled separately.
The setter and getter are not yet implemented and currently return an error.
Note in the future, other acceleration types may benefit from those properties.
---
v9 -> v10
- instead of parsing the writable mask, scroll through the fields but still do some sanity checks. Add the writable param
- move the code to cpu64.c Do not pass any ARM64SysReg handle anymore. Rename the functions
v7 -> v8
- scratch the '!' in the error_setg
- addapt to the removal of struct ArmIdRegArchVal
v5 -> v6
- for enum values, check against value value when setting the prop
- do not check writable_map flag anymore
v4 -> v5:
- free prop_name
- check cpu->writable_map as a preamble in kvm_arm_expose_idreg_properties
--- target/arm/cpu64.c | 113 ++++++++++++++++++++++++++++++++++++++++ target/arm/trace-events | 6 +++ 2 files changed, 119 insertions(+)
target/arm/cpu64.c +113 -0
@@ -37,6 +37,8 @@#include "hw/core/qdev-properties.h" #include "internals.h" #include "cpu-features.h" +#include "cpu-idregs.h" +#include "trace.h" /* convert between <register>_IDX and SYS_<register> */ #define DEF (NAME ,OP0 ,OP1 ,CRN ,CRM ,OP2 ) \
@@ -798,6 +800,116 @@ static void kvm_arm_set_cpreg_mig_tolerances(ARMCPU *cpu)arm_register_cpreg_mig_tolerance (cpu,KVM_REG_ARM_FW_FEAT_BMAP_REG (3 ),UINT64_MAX ,0 , ToleranceOnlySrcTestValue); } + +static void set_sysreg_prop (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +error_setg (errp,"%s setter not yet implemented" , name); +} + +static void get_sysreg_prop (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +error_setg (errp,"%s getter not yet implemented" , name); +} + +/** +* aarch64_add_idreg_properties: Add SYSREG_<REG>_<FIELD> properties +* for named fields of an ID register +* +* @obj: CPU object +* @reg: Description of the sysreg +* @writable_only: if set, add a property only for writable fields, +* otherwise, add properties unconditionnally +* +* Independently on @writable_only, always check the consistency between +* writable_mask and register fields description: if a field is writable +* make sure all its bits are writable. Also make sure only named fields +* are writable. +*/ +static int +aarch64_add_one_idreg_properties (Object *obj,ARM64SysReg *reg, +bool writable_only) +{ +uint64_t map = reg->writable_mask; +int nb_sysreg_props =0 ; + +for (int i =0 ; i < reg->fields_count; i++) { +ARM64SysRegField *field = ®->fields[i]; +int lower = field->shift; +int length = field->length; +int upper = lower + length -1 ; +uint64_t field_writable_mask =extract64 (map, lower, length); +uint64_t field_mask =MAKE_64BIT_MASK (lower, length); +char *prop_name; + +/* skip reserved fields, but still account them in writable_mask */ +if (g_str_equal (field->name,"RES0" ) || +g_str_equal (field->name,"RES1" ) || +g_str_equal (field->name,"RAZ" )) { + map &= ~field_mask; +continue ; + } + +if (field_writable_mask && + field_writable_mask !=MAKE_64BIT_MASK (0 , length)) { +/* only a part of the field is writable, this should never happen */ +error_report ("field %s is not fully writable! (0x%" PRIx64")" , + field->name, field_writable_mask); + } + map = map & ~field_mask; + +if (writable_only && !field_writable_mask) { +continue ; + } + + prop_name =g_strdup_printf ("SYSREG_%s_%s" , reg->name, field->name); +object_property_add (obj, prop_name,"uint64" , + get_sysreg_prop, set_sysreg_prop,NULL , field); +trace_add_idreg_property (prop_name, lower, upper, field_writable_mask); +g_free (prop_name); + nb_sysreg_props++; + } +if (map) { +error_report ("%s has writable bits which do not match " +"any named field! (0x%" PRIx64")" , reg->name, map); + } +trace_nb_sysreg_props (reg->name, nb_sysreg_props); +return 0 ; +} + + +/** +* aarch64_add_idreg_properties: +* +* Add SYSREG_<REG>_<FIELD> properties for every IDReg fields +* +* @cpu: cpu the properties are attached to +* @writable_only: if set, properties are added only if the field is +* writable. Otherwise, added unconditionnally +*/ +static void aarch64_add_idreg_properties (Object *obj,bool writable_only) +{ +for (int i =0 ; i <NUM_ID_IDX ; i++) { +ARM64SysReg *sysregdesc = &arm64_id_regs[i]; + +if (writable_only && !sysregdesc->writable_mask) { +continue ; + } +/* +* special case REVIDR_EL1 and AIDR_EL1 which are writable but +* do not expose named fields. They will need to be handled +* separately +*/ +if (!strcmp (sysregdesc->name,"REVIDR_EL1" ) || + !strcmp (sysregdesc->name,"AIDR_EL1" )) { +continue ; + } +aarch64_add_one_idreg_properties (obj, sysregdesc, true); + } +}#endif void aarch64_host_initfn (Object *obj)
@@ -815,6 +927,7 @@ void aarch64_host_initfn(Object *obj)kvm_arm_set_cpreg_mig_tolerances (cpu);kvm_arm_set_cpu_features_from_host (cpu);aarch64_add_sve_properties (obj); +aarch64_add_idreg_properties (obj, true);#elif defined(CONFIG_HVF )hvf_arm_set_cpu_features_from_host (cpu);#elif defined(CONFIG_WHPX )
target/arm/trace-events +6 -0
@@ -19,6 +19,12 @@ get_host_cpu_idregs(const char *name, uint64_t value) "scratch vcpu host value f arm_cpu_reset(uint64_t mp_aff) "cpu %" PRIu64 arm_emulate_firmware_reset(uint64_t mp_aff, unsigned target_el) "cpu %" PRIu64 " @EL%u" +# cpu64.c +add_idreg_property(const char* name, int lower, int upper, bool writable) "%s [%d:%d] writable=%d" +get_sysreg_prop(const char *name, uint64_t value) "%s 0x%"PRIx64 +set_sysreg_prop(const char *name, uint64_t old, uint64_t mask, uint64_t field_value, uint64_t new) "%s old reg value=0x%"PRIx64" mask=0x%"PRIx64" new field value=0x%"PRIx64" new reg value=0x%"PRIx64 +nb_sysreg_props(const char *name, int count) "%s: %d SYSREG properties" + # arm-powerctl.c arm_powerctl_set_cpu_on(uint64_t mp_aff, unsigned target_el, const char *mode, uint64_t entry, uint64_t context_id) "cpu %" PRIu64 " (EL %u, %s) @ 0x%" PRIx64 " with R0 = 0x%" PRIx64 arm_powerctl_set_cpu_on_and_reset(uint64_t mp_aff) "cpu %" PRIu64
Signature · 1 line
2.53.0
Re: [PATCH v10 13/26] target/arm/cpu64: Add properties for writable IDReg fields
Quoted 168 lines · Eric Auger
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
For KVM vcpu models, we add properties for all writable ID reg fields. This relies on the idreg writable mask retrieved from KVM, which is matched aginst the register description found in target/arm/cpu-idregs.h.inc.
The code is prepared to extend this capability to all ID register fields independently on their writability. This will be needed for named vcpu models which may want to relax some values to the host supported one.
REVIDR_EL1andAIDR_EL1are writable but they do not expose any field. So they will need to be handled separately.The setter and getter are not yet implemented and currently return an error.
Note in the future, other acceleration types may benefit from those properties.
Signed-off-by Eric Auger <[email protected]>---
v9 -> v10
- instead of parsing the writable mask, scroll through the fields but still do some sanity checks. Add the writable param
- move the code tocpu64.cDo not pass any ARM64SysReg handle anymore. Rename the functionsv7 -> v8
- scratch the '!' in theerror_setg
- addapt to the removal of struct ArmIdRegArchValv5 -> v6
- for enum values, check against value value when setting the prop
- do not checkwritable_mapflag anymorev4 -> v5:
- freeprop_name
- checkcpu->writable_mapas a preamble inkvm_arm_expose_idreg_properties
---target/arm/cpu64.c| 113 ++++++++++++++++++++++++++++++++++++++++
target/arm/trace-events | 6 +++2 files changed, 119 insertions(+)target/arm/cpu64.c +100
-0@@ -37,6 +37,8 @@#include "hw/core/qdev-properties.h" #include "internals.h" #include "cpu-features.h" +#include "cpu-idregs.h" +#include "trace.h" /* convert between <register>_IDX and SYS_<register> */ #define DEF (NAME ,OP0 ,OP1 ,CRN ,CRM ,OP2 ) \@@ -798,6 +800,116 @@ static void kvm_arm_set_cpreg_mig_tolerances(ARMCPU *cpu)arm_register_cpreg_mig_tolerance (cpu,KVM_REG_ARM_FW_FEAT_BMAP_REG (3 ),UINT64_MAX ,0 , ToleranceOnlySrcTestValue); } + +static void set_sysreg_prop (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +error_setg (errp,"%s setter not yet implemented" , name); +} + +static void get_sysreg_prop (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +error_setg (errp,"%s getter not yet implemented" , name); +} + +/** +* aarch64_add_idreg_properties: Add SYSREG_<REG>_<FIELD> properties +* for named fields of an ID register +* +* @obj: CPU object +* @reg: Description of the sysreg +* @writable_only: if set, add a property only for writable fields, +* otherwise, add properties unconditionnally +* +* Independently on @writable_only, always check the consistency between +* writable_mask and register fields description: if a field is writable +* make sure all its bits are writable. Also make sure only named fields +* are writable. +*/ +static int +aarch64_add_one_idreg_properties (Object *obj,ARM64SysReg *reg, +bool writable_only) +{ +uint64_t map = reg->writable_mask; +int nb_sysreg_props =0 ; + +for (int i =0 ; i < reg->fields_count; i++) { +ARM64SysRegField *field = ®->fields[i]; +int lower = field->shift; +int length = field->length; +int upper = lower + length -1 ; +uint64_t field_writable_mask =extract64 (map, lower, length); +uint64_t field_mask =MAKE_64BIT_MASK (lower, length); +char *prop_name; + +/* skip reserved fields, but still account them in writable_mask */ +if (g_str_equal (field->name,"RES0" ) || +g_str_equal (field->name,"RES1" ) || +g_str_equal (field->name,"RAZ" )) { + map &= ~field_mask; +continue ; + } + +if (field_writable_mask && + field_writable_mask !=MAKE_64BIT_MASK (0 , length)) { +/* only a part of the field is writable, this should never happen */ +error_report ("field %s is not fully writable! (0x%" PRIx64")" , + field->name, field_writable_mask); + } + map = map & ~field_mask; + +if (writable_only && !field_writable_mask) { +continue ; + } + + prop_name =g_strdup_printf ("SYSREG_%s_%s" , reg->name, field->name); +object_property_add (obj, prop_name,"uint64" , + get_sysreg_prop, set_sysreg_prop,NULL , field); +trace_add_idreg_property (prop_name, lower, upper, field_writable_mask); +g_free (prop_name); + nb_sysreg_props++; + } +if (map) { +error_report ("%s has writable bits which do not match " +"any named field! (0x%" PRIx64")" , reg->name, map); + } +trace_nb_sysreg_props (reg->name, nb_sysreg_props); +return 0 ; +} + + +/** +* aarch64_add_idreg_properties: +* +* Add SYSREG_<REG>_<FIELD> properties for every IDReg fields +* +* @cpu: cpu the properties are attached to +* @writable_only: if set, properties are added only if the field is +* writable. Otherwise, added unconditionnally +*/ +static void aarch64_add_idreg_properties (Object *obj,bool writable_only) +{ +for (int i =0 ; i <NUM_ID_IDX ; i++) { +ARM64SysReg *sysregdesc = &arm64_id_regs[i]; + +if (writable_only && !sysregdesc->writable_mask) { +continue ; + }
target/arm/cpu64.c static void kvm_arm_set_cpreg_mig_tolerances(ARMCPU *cpu) · line 910
Quoted 10 lines
target/arm/cpu64.c +10
-0+/* +* special case REVIDR_EL1 and AIDR_EL1 which are writable but +* do not expose named fields. They will need to be handled +* separately +*/ +if (!strcmp (sysregdesc->name,"REVIDR_EL1" ) || + !strcmp (sysregdesc->name,"AIDR_EL1" )) { +continue ; + } +aarch64_add_one_idreg_properties (obj, sysregdesc, true);
Hi Eric,
I suppose you mean writable_only here?
Using a local commit to fix this for now.
Thanks,
Khushit
Quoted 33 lines
target/arm/cpu64.c +3
-0+ } +}#endif void aarch64_host_initfn (Object *obj)@@ -815,6 +927,7 @@ void aarch64_host_initfn(Object *obj)kvm_arm_set_cpreg_mig_tolerances (cpu);kvm_arm_set_cpu_features_from_host (cpu);aarch64_add_sve_properties (obj); +aarch64_add_idreg_properties (obj, true);#elif defined(CONFIG_HVF )hvf_arm_set_cpu_features_from_host (cpu);#elif defined(CONFIG_WHPX )target/arm/trace-events +0
-0@@ -19,6 +19,12 @@ get_host_cpu_idregs(const char *name, uint64_t value) "scratch vcpu host value f
arm_cpu_reset(uint64_t mp_aff)"cpu %" PRIu64arm_emulate_firmware_reset(uint64_t mp_aff, unsigned target_el)"cpu %" PRIu64 " @EL%u"target/arm/trace-events +6
-0+# cpu64.c +add_idreg_property(const char* name, int lower, int upper, bool writable) "%s [%d:%d] writable=%d" +get_sysreg_prop(const char *name, uint64_t value) "%s 0x%"PRIx64 +set_sysreg_prop(const char *name, uint64_t old, uint64_t mask, uint64_t field_value, uint64_t new) "%s old reg value=0x%"PRIx64" mask=0x%"PRIx64" new field value=0x%"PRIx64" new reg value=0x%"PRIx64 +nb_sysreg_props(const char *name, int count) "%s: %d SYSREG properties" +# arm-powerctl.c arm_powerctl_set_cpu_on(uint64_t mp_aff, unsigned target_el, const char *mode, uint64_t entry, uint64_t context_id) "cpu %" PRIu64 " (EL %u, %s) @ 0x%" PRIx64 " with R0 = 0x%" PRIx64 arm_powerctl_set_cpu_on_and_reset(uint64_t mp_aff) "cpu %" PRIu64Signature · 1 line
2.53.0
PATCH v10 14/26 target/arm/kvm: Implement SYSREG property setter and getter
In reply to Eric AugerWhen the setter is called, the final vcpu is not created yet.
Applying the override on vcpu.isar initialized with the max scratch vcpu would not be correct because the final vcpu may have some features turned off (for instance virtualization) while the scratch vcpu features all available ones. So we need to postpone the actual override until the final vcpu has been initialized.
Set values are recorded in a hash table and will be applied to the guest in a subsequent patch. At this point the only checks that can be done on the input value are checking against field length and arch enum value if any.
With regards to the getter, if the sysreg prop was set, we return the set value, otherwise, we return the value in cpu->isar.idregs[].
---
v9 -> v10:
- renamed MAKE_IDREG_KEY into IDREG_FIELD_KEY
- rebase on new implementation in cpu64.c
--- target/arm/cpu.h | 2 ++ target/arm/cpu.c | 5 ++-- target/arm/cpu64.c | 65 ++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 68 insertions(+), 4 deletions(-)
target/arm/cpu.h +2 -0
@@ -968,6 +968,8 @@ struct ArchCPU {uint64_t *cpreg_vmstate_values;int32_t cpreg_vmstate_array_len; +GHashTable *sysreg_props; +DynamicGDBFeatureInfo dyn_sysreg_feature;DynamicGDBFeatureInfo dyn_svereg_feature;DynamicGDBFeatureInfo dyn_smereg_feature;
target/arm/cpu.c +3 -2
@@ -1238,8 +1238,8 @@ static void arm_cpu_initfn(Object *obj) {ARMCPU *cpu =ARM_CPU (obj); - cpu->cp_regs =g_hash_table_new_full (g_direct_hash, g_direct_equal, -NULL , g_free); + cpu->cp_regs =g_hash_table_new (g_direct_hash, g_direct_equal); + cpu->sysreg_props =g_hash_table_new (g_direct_hash, g_direct_equal);QLIST_INIT (&cpu->pre_el_change_hooks);QLIST_INIT (&cpu->el_change_hooks);
@@ -1739,6 +1739,7 @@ static void arm_cpu_finalizefn(Object *obj)ARMCPRegMigTolerance *t, *n;g_hash_table_destroy (cpu->cp_regs); +g_hash_table_destroy (cpu->sysreg_props); QLIST_FOREACH_SAFE(hook, &cpu->pre_el_change_hooks, node, next) {QLIST_REMOVE (hook, node);
target/arm/cpu64.c +63 -2
81 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v10 15/26 target/arm/kvm: Let kvm_arm_init_cpreg_list propagate an error handle
In reply to Eric AugerSubsequent patch will add an error handle to kvm_arch_init_vcpu(). So all errors must come with an error handle.
kvm_arm_init_cpreg_list does not propogate any, add this capability.
--- target/arm/kvm.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
target/arm/kvm.c +11 -5
@@ -962,6 +962,7 @@ static bool kvm_arm_reg_syncs_via_cpreg_list(uint64_t regidx)/** * kvm_arm_init_cpreg_list: * @cpu: ARMCPU +* @errp: pointer to Error* for error reporting * * Initialize the ARMCPU cpreg list according to the kernel's * definition of what CPU registers it knows about (and throw away
@@ -969,22 +970,27 @@ static bool kvm_arm_reg_syncs_via_cpreg_list(uint64_t regidx)* * Returns: 0 if success, else < 0 error code */ -static int kvm_arm_init_cpreg_list (ARMCPU *cpu) +static int kvm_arm_init_cpreg_list (ARMCPU *cpu,Error **errp) {struct kvm_reg_list rl; -struct kvm_reg_list *rlp; +struct kvm_reg_list *rlp =NULL ;int i, ret, arraylen;CPUState *cs =CPU (cpu); rl.n =0 ; ret =kvm_vcpu_ioctl (cs,KVM_GET_REG_LIST , &rl);if (ret != -E2BIG ) { +if (ret <0 ) { +error_setg_errno (errp, -ret, +"failed to get KVM register list size" ); + }return ret; } rlp =g_malloc (sizeof (struct kvm_reg_list ) + rl.n *sizeof (uint64_t )); rlp->n = rl.n; ret =kvm_vcpu_ioctl (cs,KVM_GET_REG_LIST , rlp);if (ret) { +error_setg_errno (errp, -ret,"failed to get KVM register list" ); goto out; }/* Sort the list we get back from the kernel, since cpreg_tuples
@@ -1001,7 +1007,7 @@ static int kvm_arm_init_cpreg_list(ARMCPU *cpu)case KVM_REG_SIZE_U64 :break ;default : -fprintf (stderr,"Can't handle size of register in kernel list\n" ); +error_setg (errp,"Can't handle size of register in kernel list" ); ret = -EINVAL ; goto out; }
@@ -1027,7 +1033,7 @@ static int kvm_arm_init_cpreg_list(ARMCPU *cpu)/* Shouldn't happen unless kernel is inconsistent about * what registers exist. */ -fprintf (stderr,"Initial read of kernel register state failed\n" ); +error_setg (errp,"Initial read of kernel register state failed" ); ret = -EINVAL ; goto out; }
@@ -2196,7 +2202,7 @@ int kvm_arch_init_vcpu(CPUState *cs)SET_IDREG (&cpu->isar,MPIDR , mpidr); cpu->mp_affinity = mpidr &ARM64_AFFINITY_MASK ; -return kvm_arm_init_cpreg_list (cpu); +return kvm_arm_init_cpreg_list (cpu, errp); }int kvm_arch_destroy_vcpu (CPUState *cs)
Signature · 1 line
2.53.0
PATCH v10 16/26 target/arm/kvm: Pass an Error handle to kvm_arch_init_vcpu
In reply to Eric AugerThe 2 callers of kvm_arch_init_vcpu(), namely kvm_rebind_vcpus() and kvm_init_vcpu() are passed an Error handle. So it is a pity not using it in kvm_arch_init_vcpu(). Also some functions called within kvm_arch_init_vcpu() could get benefit from it, especially on ARM. This will happen in subsequent patches.
--- include/system/kvm.h | 2 +- accel/kvm/kvm-all.c | 15 +++++++-------- target/arm/kvm.c | 14 +++++++++----- target/i386/kvm/kvm.c | 22 ++++++++++++---------- target/loongarch/kvm/kvm.c | 27 +++++++++------------------ target/ppc/kvm.c | 6 +++--- target/riscv/kvm/kvm-cpu.c | 3 ++- target/s390x/kvm/kvm.c | 2 +- 8 files changed, 44 insertions(+), 47 deletions(-)
include/system/kvm.h +1 -1
@@ -358,7 +358,7 @@ int kvm_arch_get_default_type(MachineState *ms);int kvm_arch_init (MachineState *ms,KVMState *s);int kvm_arch_pre_create_vcpu (CPUState *cpu,Error **errp); -int kvm_arch_init_vcpu (CPUState *cpu); +int kvm_arch_init_vcpu (CPUState *cpu,Error **errp);int kvm_arch_destroy_vcpu (CPUState *cpu);#ifdef TARGET_KVM_HAVE_RESET_PARKED_VCPU
accel/kvm/kvm-all.c +7 -8
@@ -493,11 +493,11 @@ static int kvm_rebind_vcpus(Error **errp) } } - ret =kvm_arch_init_vcpu (cpu); + ret =kvm_arch_init_vcpu (cpu, errp);if (ret <0 ) { -error_setg_errno (errp, -ret, -"kvm_init_vcpu: kvm_arch_init_vcpu failed (%lu)" , - vcpu_id); +error_prepend (errp, +"kvm_init_vcpu: kvm_arch_init_vcpu failed (%lu)" , + vcpu_id); }close (cpu->kvm_vcpu_stats_fd);
@@ -740,11 +740,10 @@ int kvm_init_vcpu(CPUState *cpu, Error **errp) } } - ret =kvm_arch_init_vcpu (cpu); + ret =kvm_arch_init_vcpu (cpu, errp);if (ret <0 ) { -error_setg_errno (errp, -ret, -"kvm_init_vcpu: kvm_arch_init_vcpu failed (%lu)" , -kvm_arch_vcpu_id (cpu)); +error_prepend (errp,"kvm_init_vcpu: kvm_arch_init_vcpu failed (%lu)" , +kvm_arch_vcpu_id (cpu)); } cpu->kvm_vcpu_stats_fd =kvm_vcpu_ioctl (cpu,KVM_GET_STATS_FD ,NULL );
target/arm/kvm.c +9 -5
@@ -2105,7 +2105,7 @@ int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp)return 0 ; } -int kvm_arch_init_vcpu (CPUState *cs) +int kvm_arch_init_vcpu (CPUState *cs,Error **errp) {int ret;uint64_t mpidr;
@@ -2114,7 +2114,7 @@ int kvm_arch_init_vcpu(CPUState *cs)uint64_t psciver;if (cpu->kvm_target ==QEMU_KVM_ARM_TARGET_NONE ) { -error_report ("KVM is not supported for this guest CPU type" ); +error_setg (errp,"KVM is not supported for this guest CPU type" );return -EINVAL ; }
@@ -2153,16 +2153,19 @@ int kvm_arch_init_vcpu(CPUState *cs)/* Do KVM_ARM_VCPU_INIT ioctl */ ret =kvm_arm_vcpu_init (cpu);if (ret) { +error_setg (errp,"failed kvm_arm_vcpu_init (%d)" , ret);return ret; }if (cpu_isar_feature (aa64_sve, cpu)) { ret =kvm_arm_sve_set_vls (cpu);if (ret) { +error_setg (errp,"failed kvm_arm_sve_set_vls (%d)" , ret);return ret; } ret =kvm_arm_vcpu_finalize (cpu,KVM_ARM_VCPU_SVE );if (ret) { +error_setg (errp,"failed kvm_arm_vcpu_finalize (%d)" , ret);return ret; } }
@@ -2171,11 +2174,11 @@ int kvm_arch_init_vcpu(CPUState *cs) psciver = cpu->psci_version; ret =kvm_set_one_reg (cs,KVM_REG_ARM_PSCI_VERSION , &psciver);if (ret) { -error_report ("KVM in this kernel does not support PSCI version %d.%d" , +error_setg (errp,"KVM in this kernel does not support PSCI version %d.%d" , (int )PSCI_VERSION_MAJOR (psciver), (int )PSCI_VERSION_MINOR (psciver)); -error_printf ("Consider setting the kvm-psci-version property on the " -"migration source.\n" ); +error_append_hint (errp,"Consider setting the kvm-psci-version property " +"on the migration source.\n" );return ret; } }
@@ -2197,6 +2200,7 @@ int kvm_arch_init_vcpu(CPUState *cs)*/ ret =kvm_get_one_reg (cs,ARM64_SYS_REG (ARM_CPU_ID_MPIDR ), &mpidr);if (ret) { +error_setg (errp,"failed retrieving PMIDR value" );return ret; }SET_IDREG (&cpu->isar,MPIDR , mpidr);
target/i386/kvm/kvm.c +12 -10
@@ -2218,7 +2218,7 @@ static void kvm_init_pmu_info(struct kvm_cpuid2 *cpuid, X86CPU *cpu) } } -int kvm_arch_init_vcpu (CPUState *cs) +int kvm_arch_init_vcpu (CPUState *cs,Error **errp) {struct {struct kvm_cpuid2 cpuid;
@@ -2240,12 +2240,12 @@ int kvm_arch_init_vcpu(CPUState *cs)int kvm_base =KVM_CPUID_SIGNATURE ;int max_nested_state_len;int r; -Error *local_err =NULL ;if (current_machine->cgs) { r =x86_confidential_guest_check_features (X86_CONFIDENTIAL_GUEST (current_machine->cgs), cs);if (r <0 ) { +error_setg (errp,"failed x86_confidential_guest_check_features (%d)" , r);return r; } }
@@ -2258,6 +2258,7 @@ int kvm_arch_init_vcpu(CPUState *cs) r =kvm_arch_set_tsc_khz (cs);if (r <0 ) { +error_setg (errp,"failed setting tsc_khz (%d)" , r);return r; }
@@ -2285,14 +2286,14 @@ int kvm_arch_init_vcpu(CPUState *cs)* can still proceed and check/expand Hyper-V enlightenments here so legacy * behavior is preserved. */ -if (!kvm_hyperv_expand_features (cpu, &local_err)) { -error_report_err (local_err); +if (!kvm_hyperv_expand_features (cpu, errp)) {return -ENOSYS ; }if (hyperv_enabled (cpu)) { r =hyperv_init_vcpu (cpu);if (r) { +error_setg (errp,"failed hyperv_init_vcpu (%d)" , r);return r; }
@@ -2371,6 +2372,7 @@ int kvm_arch_init_vcpu(CPUState *cs) r =kvm_xen_init_vcpu (cs);if (r) { +error_setg (errp,"failed kvm_xen_init_vcpu (%d)" , r);return r; }
@@ -2419,12 +2421,12 @@ int kvm_arch_init_vcpu(CPUState *cs) ret =kvm_get_mce_cap_supported (cs->kvm_state, &mcg_cap, &banks);if (ret <0 ) { -fprintf (stderr,"kvm_get_mce_cap_supported: %s" ,strerror (-ret)); +error_setg (errp,"kvm_get_mce_cap_supported: %s" ,strerror (-ret));return ret; }if (banks < (env->mcg_cap &MCG_CAP_BANKS_MASK )) { -error_report ("kvm: Unsupported MCE bank count (QEMU = %d, KVM = %d)" , +error_setg (errp,"kvm: Unsupported MCE bank count (QEMU = %d, KVM = %d)" , (int )(env->mcg_cap &MCG_CAP_BANKS_MASK ), banks);return -ENOTSUP ; }
@@ -2432,7 +2434,7 @@ int kvm_arch_init_vcpu(CPUState *cs) unsupported_caps = env->mcg_cap & ~(mcg_cap |MCG_CAP_BANKS_MASK );if (unsupported_caps) {if (unsupported_caps &MCG_LMCE_P ) { -error_report ("kvm: LMCE not supported" ); +error_setg (errp,"kvm: LMCE not supported" );return -ENOTSUP ; } warn_report("Unsupported MCG_CAP bits: 0x%" PRIx64,
@@ -2442,7 +2444,7 @@ int kvm_arch_init_vcpu(CPUState *cs) env->mcg_cap &= mcg_cap |MCG_CAP_BANKS_MASK ; ret =kvm_vcpu_ioctl (cs,KVM_X86_SETUP_MCE , &env->mcg_cap);if (ret <0 ) { -fprintf (stderr,"KVM_X86_SETUP_MCE: %s" ,strerror (-ret)); +error_setg (errp,"KVM_X86_SETUP_MCE: %s" ,strerror (-ret));return ret; } }
@@ -2470,9 +2472,8 @@ int kvm_arch_init_vcpu(CPUState *cs)error_setg (&invtsc_mig_blocker,"State blocked by non-migratable CPU device" " (invtsc flag)" ); - r =migrate_add_blocker (&invtsc_mig_blocker, &local_err); + r =migrate_add_blocker (&invtsc_mig_blocker, errp);if (r <0 ) { -error_report_err (local_err);return r; } }
@@ -2501,6 +2502,7 @@ int kvm_arch_init_vcpu(CPUState *cs) cpuid_data.cpuid.padding =0 ; r =kvm_vcpu_ioctl (cs,KVM_SET_CPUID2 , &cpuid_data);if (r) { +error_setg (errp,"KVM_SET_CPUID2 failed (%m)" ); goto fail; }kvm_init_xsave (env);
target/loongarch/kvm/kvm.c +9 -18
@@ -1299,11 +1299,10 @@ int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp)return 0 ; } -int kvm_arch_init_vcpu (CPUState *cs) +int kvm_arch_init_vcpu (CPUState *cs,Error **errp) {uint64_t val;int ret; -Error *local_err =NULL ;LoongArchCPU *cpu =LOONGARCH_CPU (cs); cpu->vmsentry = qemu_add_vm_change_state_handler(
@@ -1313,51 +1312,43 @@ int kvm_arch_init_vcpu(CPUState *cs) brk_insn = val; } - ret =kvm_cpu_check_lsx (cs, &local_err); + ret =kvm_cpu_check_lsx (cs, errp);if (ret <0 ) { -error_report_err (local_err);return ret; } - ret =kvm_cpu_check_lasx (cs, &local_err); + ret =kvm_cpu_check_lasx (cs, errp);if (ret <0 ) { -error_report_err (local_err);return ret; } - ret =kvm_cpu_check_lbt (cs, &local_err); + ret =kvm_cpu_check_lbt (cs, errp);if (ret <0 ) { -error_report_err (local_err);return ret; } - ret =kvm_cpu_check_pmu (cs, &local_err); + ret =kvm_cpu_check_pmu (cs, errp);if (ret <0 ) { -error_report_err (local_err);return ret; } - ret =kvm_cpu_check_pv_features (cs, &local_err); + ret =kvm_cpu_check_pv_features (cs, errp);if (ret <0 ) { -error_report_err (local_err);return ret; } - ret =kvm_cpu_check_ptw (cs, &local_err); + ret =kvm_cpu_check_ptw (cs, errp);if (ret <0 ) { -error_report_err (local_err);return ret; } - ret =kvm_cpu_check_msgint (cs, &local_err); + ret =kvm_cpu_check_msgint (cs, errp);if (ret <0 ) { -error_report_err (local_err);return ret; } - ret =kvm_cpu_check_misc_v1_1 (cs, &local_err); + ret =kvm_cpu_check_misc_v1_1 (cs, errp);if (ret <0 ) { -error_report_err (local_err);return ret; }
target/ppc/kvm.c +3 -3
@@ -484,7 +484,7 @@ int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp)return 0 ; } -int kvm_arch_init_vcpu (CPUState *cs) +int kvm_arch_init_vcpu (CPUState *cs,Error **errp) {PowerPCCPU *cpu =POWERPC_CPU (cs);CPUPPCState *cenv = &cpu->env;
@@ -494,8 +494,8 @@ int kvm_arch_init_vcpu(CPUState *cs) ret =kvm_arch_sync_sregs (cpu);if (ret) {if (ret == -EINVAL ) { -error_report ("Register sync failed... If you're using kvm-hv.ko," -" only \"-cpu host\" is possible" ); +error_setg (errp,"Register sync failed... If you're using kvm-hv.ko," +" only \"-cpu host\" is possible" ); }return ret; }
target/riscv/kvm/kvm-cpu.c +2 -1
@@ -1544,7 +1544,7 @@ int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp)return 0 ; } -int kvm_arch_init_vcpu (CPUState *cs) +int kvm_arch_init_vcpu (CPUState *cs,Error **errp) {int ret =0 ;RISCVCPU *cpu =RISCV_CPU (cs);
@@ -1554,6 +1554,7 @@ int kvm_arch_init_vcpu(CPUState *cs)if (!object_dynamic_cast (OBJECT (cpu),TYPE_RISCV_CPU_HOST )) { ret =kvm_vcpu_set_machine_ids (cpu, cs);if (ret !=0 ) { +error_setg (errp,"failed setting machine id (%d)" , ret);return ret; } }
target/s390x/kvm/kvm.c +1 -1
@@ -403,7 +403,7 @@ int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp)return 0 ; } -int kvm_arch_init_vcpu (CPUState *cs) +int kvm_arch_init_vcpu (CPUState *cs,Error **errp) {unsigned int max_cpus =MACHINE (qdev_get_machine ())->smp.max_cpus;S390CPU *cpu =S390_CPU (cs);
Signature · 1 line
2.53.0
PATCH v10 17/26 target/arm/kvm: Introduce kvm_arm_override_idreg_field helper
In reply to Eric AugerIntroduce kvm_arm_override_idreg_field() helper that allows to read an ID register value from a vcpu fd, override a given field value and reinject the new register value in the guest vcpu.
The helper is not used yet, hence the G_GNUC_UNUSED marker. It will be used in subsequent patch to apply a new field value set through SYSREG property.
--- target/arm/kvm.c | 48 ++++++++++++++++++++++++++++++++++++++++- target/arm/trace-events | 1 + 2 files changed, 48 insertions(+), 1 deletion(-)
target/arm/kvm.c +47 -1
@@ -1247,6 +1247,50 @@ bool kvm_arm_cpu_post_load(ARMCPU *cpu)return true; } +static int G_GNUC_UNUSED +kvm_arm_override_idreg_field (int fd,ARM64SysRegField *field, +uint64_t newfv,Error **errp) +{ +uint64_t current, currentfv, value; +struct kvm_one_reg kvm_reg; +int index = field->index; +int length = field->length; +int lower = field->shift; +ARM64SysReg *reg; +uint64_t kvm_idx; +int ret; + + reg = &arm64_id_regs[index]; + + kvm_idx =idregs_sysreg_to_kvm_reg (id_register_sysreg[index]); + + ret =read_sys_reg64 (fd, ¤t, kvm_idx); +if (ret) { +error_setg (errp,"failed to read %s current value" , reg->name); +return ret; + } + currentfv =extract64 (current, lower, length); + +if (currentfv != newfv) { + value =deposit64 (current, lower, length, newfv); + kvm_reg.id = kvm_idx; + kvm_reg.addr = (uintptr_t )&value; + + ret =ioctl (fd,KVM_SET_ONE_REG , &kvm_reg); +if (ret) { +error_setg (errp, +"ID register field %s.%s: fail to apply new value=0x%" + PRIx64" (current is 0x%" PRIx64"): %m" , + reg->name, field->name, newfv, currentfv); + +return ret; + } + } +trace_kvm_arm_override_idreg_field (reg->name, field->name, + currentfv, newfv); +return 0 ; +} +void kvm_arm_reset_vcpu (ARMCPU *cpu) {int ret;
@@ -1259,6 +1303,7 @@ void kvm_arm_reset_vcpu(ARMCPU *cpu)fprintf (stderr,"kvm_arm_vcpu_init failed: %s\n" ,strerror (-ret));abort (); } +if (!write_kvmstate_to_list (cpu)) {fprintf (stderr,"write_kvmstate_to_list failed\n" );abort ();
@@ -2204,7 +2249,8 @@ int kvm_arch_init_vcpu(CPUState *cs, Error **errp)return ret; }SET_IDREG (&cpu->isar,MPIDR , mpidr); - cpu->mp_affinity = mpidr &ARM64_AFFINITY_MASK ; + + cpu->mp_affinity =GET_IDREG (&cpu->isar,MPIDR ) &ARM64_AFFINITY_MASK ;return kvm_arm_init_cpreg_list (cpu, errp); }
target/arm/trace-events +1 -0
@@ -14,6 +14,7 @@ arm_gt_update_irq(int timer, int irqstate) "gt_update_irq: timer %d irqstate %d" # kvm.c kvm_arm_fixup_msi_route(uint64_t iova, uint64_t gpa) "MSI iova = 0x%"PRIx64" is translated into 0x%"PRIx64 get_host_cpu_idregs(const char *name, uint64_t value) "scratch vcpu host value for %s is 0x%"PRIx64 +kvm_arm_override_idreg_field(const char *reg_name, const char *field_name, uint64_t currentfv, uint64_t newfv) "%s.%s current=0x%"PRIx64" new=0x%"PRIx64 # cpu.c arm_cpu_reset(uint64_t mp_aff) "cpu %" PRIu64
Signature · 1 line
2.53.0
PATCH v10 18/26 target/arm/cpu64: Introduce arm_cpu_apply_sysreg_props
In reply to Eric AugerThis helper walks through all stored SYSREG field values and apply them on the vcpu. It uses an accelerator specific callback to apply the field value on the vcpu. If the value is successfully applied, the cpu->isar.idregs[] value is updated accordingly.
--- target/arm/cpu-idregs.h | 18 +++++++++++++ target/arm/cpu64.c | 57 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+)
target/arm/cpu-idregs.h +18 -0
@@ -38,4 +38,22 @@ typedef struct ARM64SysReg {*/ extern ARM64SysReg arm64_id_regs[NUM_ID_IDX ]; +/* accelerator specific callback used to apply a new field value on a vcpu */ +typedef int (*ARMSysregPropApplyFn )(ARMCPU *cpu,ARM64SysRegField *field, +uint64_t newfv,Error **errp); + +/** +* arm_cpu_apply_sysreg_props: +* +* Apply all SYSREG prop values +* @cpu: vcpu on which the values are applied +* @accel_apply_fn: acceleration specific callback used to override +* a single field value +* @errp: error handle +* +* return 0 on sucess or negative value with errp set on failure +*/ +int arm_cpu_apply_sysreg_props (ARMCPU *cpu,ARMSysregPropApplyFn accel_apply_fn, +Error **errp); +#endif
target/arm/cpu64.c +57 -0
63 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v10 19/26 target/arm/kvm: Apply SYSREG props
In reply to Eric AugerNow the infrastructure is in place let's trigger the SYSREG prop update in the KVM code. This is done in both kvm_arch_init_vcpu() and kvm_arm_reset_vcpu() after the final vcpu has been initialized with the proper kvm init settings and before kvmstate is synced back to the cpreg list.
---
v9 -> v10
- use ValueRange
--- target/arm/cpu64.c | 9 +++++---- target/arm/kvm.c | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 5 deletions(-)
target/arm/cpu64.c +5 -4
@@ -883,10 +883,11 @@ static void set_sysreg_prop(Object *obj, Visitor *v,return ; } -if (field->arch_vals) { -/* this field has some enum values */ -for (int i =0 ; i < field->arch_vals_count; i++) { -if (value == field->arch_vals[i]) { +if (field->arch_value_ranges) { +for (uint32_t i =0 ; i < field->arch_value_ranges_count; i++) { +const ARM64SysRegArchValueRange *r = &field->arch_value_ranges[i]; + +if (value >= r->lo && value <= r->hi) { goto valid; } }
target/arm/kvm.c +19 -1
@@ -1247,7 +1247,7 @@ bool kvm_arm_cpu_post_load(ARMCPU *cpu)return true; } -static int G_GNUC_UNUSED +static int kvm_arm_override_idreg_field (int fd,ARM64SysRegField *field,uint64_t newfv,Error **errp) {
@@ -1291,6 +1291,17 @@ kvm_arm_override_idreg_field(int fd, ARM64SysRegField *field,return 0 ; } +static int kvm_arm_apply_one_sysreg_prop (ARMCPU *cpu,ARM64SysRegField *field, +uint64_t newfv,Error **errp) +{ +return kvm_arm_override_idreg_field (CPU (cpu)->kvm_fd, field, newfv, errp); +} + +static int kvm_arm_apply_sysreg_props (ARMCPU *cpu,Error **errp) +{ +return arm_cpu_apply_sysreg_props (cpu, kvm_arm_apply_one_sysreg_prop, errp); +} +void kvm_arm_reset_vcpu (ARMCPU *cpu) {int ret;
@@ -1304,6 +1315,8 @@ void kvm_arm_reset_vcpu(ARMCPU *cpu)abort (); } +kvm_arm_apply_sysreg_props (cpu, &error_abort); +if (!write_kvmstate_to_list (cpu)) {fprintf (stderr,"write_kvmstate_to_list failed\n" );abort ();
@@ -2250,6 +2263,11 @@ int kvm_arch_init_vcpu(CPUState *cs, Error **errp) }SET_IDREG (&cpu->isar,MPIDR , mpidr); + ret =kvm_arm_apply_sysreg_props (cpu, errp); +if (ret) { +return ret; + } + cpu->mp_affinity =GET_IDREG (&cpu->isar,MPIDR ) &ARM64_AFFINITY_MASK ;return kvm_arm_init_cpreg_list (cpu, errp);
Signature · 1 line
2.53.0
PATCH v10 20/26 target/arm/kvm: Add consistency checking for SYSREG props
In reply to Eric AugerSince legacy composite options (such as SVE, virtualization, ...) and new SYSREG props coexist, add some basic consistency checks.
Those checks are performed in kvm_arch_init_vcpu() before applying the SYSREG props at the end of the initialization chain.
Some ID reg fields corresponding to legacy composite option scope are not (yet) writable (EL3, MTE, SVE, ...). As such they are not supposed to be exposed through SYSREG properties. However in the hypothesis they would become writable, and thus would be exposed and attempted to be set, we need to reject any setting because no consistency check is implemented yet.
The function is exported because it will be used on the qmp expansion path too.
---
v9 -> v10
- improve commit description
- fix return in !arm_feature(&cpu->env, ARM_FEATURE_AARCH64) block
- removed cpu_isar_feature(aa64_sve, cpu) && value == 0 check
--- target/arm/cpu-idregs.h | 17 ++++++++ target/arm/cpu64.c | 94 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+)
target/arm/cpu-idregs.h +17 -0
@@ -56,4 +56,21 @@ typedef int (*ARMSysregPropApplyFn)(ARMCPU *cpu, ARM64SysRegField *field,int arm_cpu_apply_sysreg_props (ARMCPU *cpu,ARMSysregPropApplyFn accel_apply_fn,Error **errp); +/** +* arm_cpu_validate_sysreg_prop: +* +* accelerator agnostic validation of a field value (especially regarding +* the consistency with legacy composite options such as virtualization, pmu, +* sve ...) +* +* @cpu: vcpu the field value is validated against +* @field: field the value is applied to +* @value: field value to be validated +* @errp: error handle set if validation fails +* +* returns true if validation succeeds +*/ +bool arm_cpu_validate_sysreg_prop (ARMCPU *cpu,ARM64SysRegField *field, +uint64_t value,Error **errp); +#endif
target/arm/cpu64.c +94 -0
118 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v10 21/26 target/arm/cpu64: Add helper to test SYSREG props against a scratch vcpu
In reply to Eric AugerAdd kvm_idreg_write_scratch_vcpu helper that will be used by qmp_query_cpu_model_expansion code to test SYSREG settings against a scratch vcpu. Indeed when the expansion code is called the actual vcpu has not been initialized so we use a scratch vcpu. This latter has been initialized with features taken from legacy compositive options (EL2, SVE, ...). So the trial is very close to the final setup.
--- target/arm/kvm_arm.h | 4 ++++ target/arm/kvm-stub.c | 7 +++++++ target/arm/kvm.c | 21 +++++++++++++++++++++ target/arm/trace-events | 1 + 4 files changed, 33 insertions(+)
target/arm/kvm_arm.h +4 -0
@@ -14,6 +14,7 @@#include "qapi/qapi-types-misc-arm.h" #include "system/kvm.h" #include "target/arm/cpu-qom.h" +#include "cpu-idregs.h" #define KVM_ARM_VGIC_V2 (1 << 0)#define KVM_ARM_VGIC_V3 (1 << 1)
@@ -240,4 +241,7 @@ void arm_gic_cap_kvm_probe(GICCapability *v2, GICCapability *v3);*/ char *kvm_print_register_name (uint64_t regidx); +bool kvm_idreg_write_scratch_vcpu (ARMCPU *cpu,int cpufd, +ARM64SysRegField *field,uint64_t newfv, +Error **errp);#endif
target/arm/kvm-stub.c +7 -0
@@ -119,3 +119,10 @@ char *kvm_print_register_name(uint64_t regidx) {g_assert_not_reached (); } + +bool kvm_idreg_write_scratch_vcpu (ARMCPU *cpu,int cpufd, +ARM64SysRegField *field,uint64_t newfv, +Error **errp) +{ +g_assert_not_reached (); +}
target/arm/kvm.c +21 -0
@@ -1297,6 +1297,27 @@ static int kvm_arm_apply_one_sysreg_prop(ARMCPU *cpu, ARM64SysRegField *field,return kvm_arm_override_idreg_field (CPU (cpu)->kvm_fd, field, newfv, errp); } +bool kvm_idreg_write_scratch_vcpu (ARMCPU *cpu,int cpufd, +ARM64SysRegField *field,uint64_t newfv, +Error **errp) +{ +int ret; + +if (!arm_cpu_validate_sysreg_prop (cpu, field, newfv, errp)) { +return false; + } + + ret =kvm_arm_override_idreg_field (cpufd, field, newfv, errp); +if (ret) { +return false; + } + + cpu->isar.idregs[field->index] = +deposit64 (cpu->isar.idregs[field->index], + field->shift, field->length, newfv); +return true; +} +static int kvm_arm_apply_sysreg_props (ARMCPU *cpu,Error **errp) {return arm_cpu_apply_sysreg_props (cpu, kvm_arm_apply_one_sysreg_prop, errp);
target/arm/trace-events +1 -0
@@ -15,6 +15,7 @@ arm_gt_update_irq(int timer, int irqstate) "gt_update_irq: timer %d irqstate %d" kvm_arm_fixup_msi_route(uint64_t iova, uint64_t gpa) "MSI iova = 0x%"PRIx64" is translated into 0x%"PRIx64 get_host_cpu_idregs(const char *name, uint64_t value) "scratch vcpu host value for %s is 0x%"PRIx64 kvm_arm_override_idreg_field(const char *reg_name, const char *field_name, uint64_t currentfv, uint64_t newfv) "%s.%s current=0x%"PRIx64" new=0x%"PRIx64 +kvm_arm_idreg_write_scratch_vcpu(const char *name, uint64_t oldfv, uint64_t newfv, uint64_t actualfv) "successful dry-run for %s old=0x%"PRIx64" new=0x%"PRIx64" actual=0x%"PRIx64 # cpu.c arm_cpu_reset(uint64_t mp_aff) "cpu %" PRIu64
Signature · 1 line
2.53.0
PATCH v10 22/26 target/arm/kvm: Add an error handle to kvm_arm_create_scratch_host_vcpu
In reply to Eric AugerThis allows to report a precise error message if any error occurs.
--- target/arm/kvm_arm.h | 3 ++- target/arm/kvm.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-)
target/arm/kvm_arm.h +2 -1
@@ -106,6 +106,7 @@ struct kvm_vcpu_init;* @init: filled in with the necessary values for creating a host * vcpu. If NULL is provided, will not init the vCPU (though the cpufd * will still be set up). +* @errp: Error handle * * Create a scratch vcpu in its own VM of the type preferred by the host * kernel (as would be used for '-cpu host'), for purposes of probing it
@@ -115,7 +116,7 @@ struct kvm_vcpu_init;* false on failure (and fdarray and init are not valid). */ bool kvm_arm_create_scratch_host_vcpu (int *fdarray, -struct kvm_vcpu_init *init); +struct kvm_vcpu_init *init,Error **errp);/** * kvm_arm_destroy_scratch_host_vcpu:
target/arm/kvm.c +12 -3
@@ -107,13 +107,14 @@ static int kvm_arm_vcpu_finalize(ARMCPU *cpu, int feature) }bool kvm_arm_create_scratch_host_vcpu (int *fdarray, -struct kvm_vcpu_init *init) +struct kvm_vcpu_init *init,Error **errp) {int ret =0 , kvmfd =-1 , vmfd =-1 , cpufd =-1 ;int max_vm_pa_size; kvmfd =qemu_open_old ("/dev/kvm" ,O_RDWR );if (kvmfd <0 ) { +error_setg (errp,"Failed opening /dev/kvm" ); goto err; } max_vm_pa_size =ioctl (kvmfd,KVM_CHECK_EXTENSION ,KVM_CAP_ARM_VM_IPA_SIZE );
@@ -124,6 +125,7 @@ bool kvm_arm_create_scratch_host_vcpu(int *fdarray, vmfd =ioctl (kvmfd,KVM_CREATE_VM , max_vm_pa_size); }while (vmfd ==-1 && errno ==EINTR );if (vmfd <0 ) { +error_setg (errp,"Failed creating the scratch VM" ); goto err; }
@@ -143,6 +145,7 @@ bool kvm_arm_create_scratch_host_vcpu(int *fdarray, cpufd =ioctl (vmfd,KVM_CREATE_VCPU ,0 );if (cpufd <0 ) { +error_setg (errp,"Failed creating the scratch VCPU" ); goto err; }
@@ -156,12 +159,14 @@ bool kvm_arm_create_scratch_host_vcpu(int *fdarray, ret =ioctl (vmfd,KVM_ARM_PREFERRED_TARGET , &preferred);if (ret <0 ) { +error_setg (errp,"Failed getting the preferred target" ); goto err; } init->target = preferred.target; } ret =ioctl (cpufd,KVM_ARM_VCPU_INIT , init);if (ret <0 ) { +error_setg (errp,"Failed the init of the scratch vcpu" ); goto err; }
@@ -380,6 +385,7 @@ kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)bool el2_supported;bool pmu_supported = false;uint64_t features =0 ; +Error *local_err =NULL ;int err; ahcf->target =QEMU_KVM_ARM_TARGET_NONE ;
@@ -427,7 +433,8 @@ kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) features |=1ULL <<ARM_FEATURE_PMU ; } -if (!kvm_arm_create_scratch_host_vcpu (fdarray, &init)) { +if (!kvm_arm_create_scratch_host_vcpu (fdarray, &init, &local_err)) { +error_report_err (local_err);return ; }
@@ -2838,8 +2845,10 @@ void arm_cpu_kvm_set_irq(void *arm_cpu, int irq, int level)void arm_gic_cap_kvm_probe (GICCapability *v2,GICCapability *v3) {int fdarray[3 ]; +Error *err =NULL ; -if (!kvm_arm_create_scratch_host_vcpu (fdarray,NULL )) { +if (!kvm_arm_create_scratch_host_vcpu (fdarray,NULL , &err)) { +error_report_err (err);return ; }
Signature · 1 line
2.53.0
PATCH v10 23/26 target/arm/kvm: Introduce kvm_arm_vcpu_prepare_init_features helper
In reply to Eric AugerFactorize the code that initializes the kvm init features from the cpu settings in a helper. Use it kvm_arch_init_vcpu(). Soon it will be used by another function.
The only change in the code relates to the check of kvm_state. The future caller won't have the VM created when calling the helper and for this caller it is OK ignoring PSCI version setting.
--- target/arm/kvm.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-)
target/arm/kvm.c +22 -14
@@ -2191,27 +2191,18 @@ int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp)return 0 ; } -int kvm_arch_init_vcpu (CPUState *cs,Error **errp) +/* Determine init features for this CPU */ +static void kvm_arm_vcpu_prepare_init_features (ARMCPU *cpu) { -int ret; -uint64_t mpidr; -ARMCPU *cpu =ARM_CPU (cs); +CPUState *cs =CPU (cpu);CPUARMState *env = &cpu->env; -uint64_t psciver; -if (cpu->kvm_target ==QEMU_KVM_ARM_TARGET_NONE ) { -error_setg (errp,"KVM is not supported for this guest CPU type" ); -return -EINVAL ; - } - -qemu_add_vm_change_state_handler (kvm_arm_vm_state_change, cpu); - -/* Determine init features for this CPU */ memset (cpu->kvm_init_features,0 ,sizeof (cpu->kvm_init_features)); +if (cs->start_powered_off) { cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_POWER_OFF ; } -if (cpu->psci_version !=QEMU_PSCI_VERSION_0_1 && +if (cpu->psci_version !=QEMU_PSCI_VERSION_0_1 && cs->kvm_state &&kvm_check_extension (cs->kvm_state,KVM_CAP_ARM_PSCI_0_2 )) {/* * Versions >= v0.2 are backward compatible with v0.2
@@ -2235,6 +2226,23 @@ int kvm_arch_init_vcpu(CPUState *cs, Error **errp)if (cpu->has_el2 &&kvm_arm_el2_supported ()) { cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_HAS_EL2 ; } +} + +int kvm_arch_init_vcpu (CPUState *cs,Error **errp) +{ +int ret; +uint64_t mpidr; +ARMCPU *cpu =ARM_CPU (cs); +uint64_t psciver; + +if (cpu->kvm_target ==QEMU_KVM_ARM_TARGET_NONE ) { +error_setg (errp,"KVM is not supported for this guest CPU type" ); +return -EINVAL ; + } + +qemu_add_vm_change_state_handler (kvm_arm_vm_state_change, cpu); + +kvm_arm_vcpu_prepare_init_features (cpu);/* Do KVM_ARM_VCPU_INIT ioctl */ ret =kvm_arm_vcpu_init (cpu);
Signature · 1 line
2.53.0
PATCH v10 24/26 target/arm/kvm: Introduce kvm_arm_create_init_scratch_vcpu()
In reply to Eric AugerIntroduce kvm_arm_create_init_scratch_vcpu() that allows to create and initialize a scratch vcpu from cpu settings. We want to use this in arm-qmp-cmds code as well as kvm_arm_destroy_scratch_host_vcpu so export them.
---
v9 -> v10:
- pass the fdarray as a param
--- target/arm/kvm_arm.h | 19 ++++++++++++++++++- target/arm/kvm-stub.c | 10 ++++++++++ target/arm/kvm.c | 13 +++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-)
target/arm/kvm_arm.h +18 -1
@@ -118,11 +118,28 @@ struct kvm_vcpu_init;bool kvm_arm_create_scratch_host_vcpu (int *fdarray,struct kvm_vcpu_init *init,Error **errp); +/** +* kvm_arm_create_init_scratch_vcpu: +* @cpu: ARMCPU whose kvm init features to inherit +* @fdarray: array of fds filled as by kvm_arm_create_scratch_host_vcpu +* +* Create and initialize a scratch vcpu inheriting the features set +* on @cpu. +* +* Return the vcpu fd on success or -1 on failure with a corresponding +* Error handle. On success, @fdarray is populated and must be torn down +* with kvm_arm_destroy_scratch_host_vcpu(). +*/ +int kvm_arm_create_init_scratch_vcpu (ARMCPU *cpu,int *fdarray,Error **errp); + +/** * kvm_arm_destroy_scratch_host_vcpu: * @fdarray: array of fds as set up by kvm_arm_create_scratch_host_vcpu +* or kvm_arm_create_init_scratch_vcpu * -* Tear down the scratch vcpu created by kvm_arm_create_scratch_host_vcpu. +* Tear down the scratch vcpu created by kvm_arm_create_scratch_host_vcpu +* or kvm_arm_create_init_scratch_vcpu. */ void kvm_arm_destroy_scratch_host_vcpu (int *fdarray);
target/arm/kvm-stub.c +10 -0
@@ -126,3 +126,13 @@ bool kvm_idreg_write_scratch_vcpu(ARMCPU *cpu, int cpufd, {g_assert_not_reached (); } + +int kvm_arm_create_init_scratch_vcpu (ARMCPU *cpu,int *fdarray,Error **errp) +{ +g_assert_not_reached (); +} + +void kvm_arm_destroy_scratch_host_vcpu (int *fdarray) +{ +g_assert_not_reached (); +}
target/arm/kvm.c +13 -0
@@ -2228,6 +2228,19 @@ static void kvm_arm_vcpu_prepare_init_features(ARMCPU *cpu) } } +int kvm_arm_create_init_scratch_vcpu (ARMCPU *cpu,int *fdarray,Error **errp) +{ +struct kvm_vcpu_init init = {.target = cpu->kvm_target, }; + +kvm_arm_vcpu_prepare_init_features (cpu); +memcpy (init.features, cpu->kvm_init_features,sizeof (init.features)); + +if (!kvm_arm_create_scratch_host_vcpu (fdarray, &init, errp)) { +return -1 ; + } +return fdarray[2 ]; +} +int kvm_arch_init_vcpu (CPUState *cs,Error **errp) {int ret;
Signature · 1 line
2.53.0
PATCH v10 25/26 arm-qmp-cmds: introspection for ID register props
In reply to Eric AugerFrom: Cornelia Huck <[email protected]>
Enhance the current host model query-cpu-model-expansion with the capability to return SYSREG_* options and also test possible values.
If no SYSREG prop is set, query-cpu-model-expansion returns the default host values for all SYSREG properties. They are extracted from a scratch vcpu featuring all the KVM advertised capabilities.
Here is a qmp-shell example:
(QEMU) query-cpu-model-expansion type=full model={"name":"host"} {"return": {"model": {"name": "host", "props": {"SYSREG_ID_AA64PFR0_EL1_EL3": 1, "SYSREG_ID_AA64ISAR2_EL1_CLRBHB": 0, "SYSREG_CTR_EL0_L1Ip": 3, "SYSREG_MIDR_EL1_PartNum": 3407, "SYSREG_CTR_EL0_DminLine": 4, "SYSREG_ID_AA64MMFR0_EL1_PARange": 5, "SYSREG_ID_AA64MMFR1_EL1_ECBHB": 0 ../..
It becomes also possible to test new SYSREG property values.
With Full expansion of the host model, the SYSREG props are tested against a scratch vcpu. With static expansion, no check is performed against KVM but only against qemu code (the value does not exceed the field size and if the field is associated to enum values, the set value belongs to the list of arch enum values.
Examples
(QEMU) query-cpu-model-expansion type=full model={"name":"host","props":{"SYSREG_ID_AA64ISAR0_EL1_DP":0x13}} {"error": {"class": "GenericError", "desc": "idreg SYSREG_ID_AA64ISAR0_EL1_DP set value (0x13) exceeds length of field (4)!"}}
(QEMU) query-cpu-model-expansion type=full model={"name":"host","props":{"SYSREG_ID_AA64ISAR0_EL1_DP":0x2}} {"error": {"class": "GenericError", "desc": "idreg SYSREG_ID_AA64ISAR0_EL1_DP set value (0x2) does not match any arch valid enum value!"}}
---
v9 -> v10:
- use new proto for kvm_arm_create_init_scratch_vcpu, rework error path and fix visit_type_uint64 call
v8 -> v9:
- fix the leak reported by Khushit
- implement static mode for host
v7 -> v8:
- do not check if the prop exists (this is checked elsewhere with a different error message)
- clarify that examples given in the commit msg are based on qmp-shell
v5 -> v6:
- add the write capability
--- target/arm/arm-qmp-cmds.c | 130 ++++++++++++++++++++++++++++++++++---- 1 file changed, 118 insertions(+), 12 deletions(-)
target/arm/arm-qmp-cmds.c +118 -12
@@ -21,6 +21,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/target-info.h" #include "hw/core/boards.h" #include "kvm_arm.h"
@@ -30,6 +31,7 @@#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-misc-arm.h" #include "qobject/qdict.h" +#include "qobject/qnum.h" #include "qom/qom-qobject.h" #include "cpu.h"
@@ -83,15 +85,24 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, CpuModelInfo *model, Error **errp) { +bool use_scratch_vcpu =kvm_enabled () && type ==CPU_MODEL_EXPANSION_TYPE_FULL ;CpuModelExpansionInfo *expansion_info; +ObjectPropertyIterator iter;const QDict *qdict_in; +ObjectProperty *idregprop;QDict *qdict_out;ObjectClass *oc;Object *obj; +Visitor *visitor =NULL ; +Error *err =NULL ; +bool scratch_created = false;const char *name; +int fdarray[3 ]; +int fd =-1 ;int i; -if (type !=CPU_MODEL_EXPANSION_TYPE_FULL ) { +/* we support static expansion for host model only */ +if (type !=CPU_MODEL_EXPANSION_TYPE_FULL &&strcmp (model->name,"host" )) {error_setg (errp,"The requested expansion type is not supported" );return NULL ; }
@@ -134,9 +145,6 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, obj =object_new (object_class_get_name (oc));if (model->props) { -Visitor *visitor; -Error *err =NULL ; - visitor =qobject_input_visitor_new (model->props);if (!visit_start_struct (visitor,"model.props" ,NULL ,0 , errp)) {visit_free (visitor);
@@ -146,6 +154,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, qdict_in =qobject_to (QDict, model->props); i =0 ; + +/* Test legacy composite option settings */ while ((name = cpu_model_advertised_features[i++]) !=NULL ) {if (qdict_get (qdict_in, name)) {if (!object_property_set (obj, name, visitor, &err)) {
@@ -154,19 +164,89 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, } } -if (!err) { -visit_check_struct (visitor, &err); - }if (!err) {arm_cpu_finalize_features (ARM_CPU (obj), &err); } +if (err) { + goto bail_out; + } + +/** +* Test SYSREG option settings +* In full mode, build a scratch vcpu that reflects composite legacy +* options +*/ +if (use_scratch_vcpu) { +Error *local_err =NULL ; +bool has_virt =object_property_get_bool (OBJECT (current_machine), +"virtualization" , + &local_err); + +if (local_err) { +error_free (local_err);/* the machine property does not exist */ + }else { +if (!has_virt &&object_property_find (obj,"has_el2" )) { +object_property_set_bool (obj,"has_el2" , false,NULL ); + } + } + fd =kvm_arm_create_init_scratch_vcpu (ARM_CPU (obj), fdarray, errp); +if (fd <0 ) { + goto bail_out; + } + scratch_created = true; + } + + qdict_in =qobject_to (QDict, model->props); +for (const QDictEntry *entry =qdict_first (qdict_in); + entry !=NULL ; entry =qdict_next (qdict_in, entry)) { +const char *key =qdict_entry_key (entry); +QObject *val_obj =qdict_entry_value (entry); +ObjectProperty *prop; +Visitor *v; +uint64_t val; + +if (!g_str_has_prefix (key,"SYSREG_" )) { +continue ; + } + + prop =object_property_find (obj, key); + +/* consume the prop to avoid unexpected parameter */ +if (!visit_type_uint64 (visitor, key, &val, errp)) { + goto bail_out; + } + + v =qobject_input_visitor_new (val_obj); + +if (!object_property_set (obj, key, v, errp)) { +visit_free (v); + goto bail_out; + } + +if (use_scratch_vcpu && prop) { +ARM64SysRegField *field = (ARM64SysRegField *)prop->opaque; + +if (!kvm_idreg_write_scratch_vcpu (ARM_CPU (obj), fd, + field, val, errp)) { +visit_free (v); + goto bail_out; + } + } +visit_free (v); + } + +visit_check_struct (visitor, &err); +if (err) { + goto bail_out; + } + +if (scratch_created) { +kvm_arm_destroy_scratch_host_vcpu (fdarray); + scratch_created = false; + }visit_end_struct (visitor,NULL );visit_free (visitor); -if (err) { -object_unref (obj); -error_propagate (errp, err); -return NULL ; - } + visitor =NULL ; }else {arm_cpu_finalize_features (ARM_CPU (obj), &error_abort); }
@@ -190,6 +270,18 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, } } +object_property_iter_init (&iter, obj); + +while ((idregprop =object_property_iter_next (&iter))) { +QObject *value; + +if (!g_str_has_prefix (idregprop->name,"SYSREG_" )) { +continue ; + } + value =object_property_get_qobject (obj, idregprop->name, &error_abort); +qdict_put_obj (qdict_out, idregprop->name, value); + } +if (!qdict_size (qdict_out)) {qobject_unref (qdict_out); }else {
@@ -199,6 +291,20 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,object_unref (obj);return expansion_info; + +bail_out: +if (scratch_created) { +kvm_arm_destroy_scratch_host_vcpu (fdarray); + } +if (visitor) { +visit_end_struct (visitor,NULL ); +visit_free (visitor); + } +if (err) { +error_propagate (errp, err); + } +object_unref (obj); +return NULL ; }static void arm_cpu_add_definition (gpointer data,gpointer user_data)
Signature · 1 line
2.53.0
PATCH v10 26/26 arm/cpu-features: Document ID reg properties
In reply to Eric AugerFrom: Cornelia Huck <[email protected]>
Add some documentation for how individual ID registers can be configured with the host cpu model.
---
9 -> 10:
- document the fact some props may be willingly hidden because they conflict with legacy composite options
- mention max model too
--- docs/system/arm/cpu-features.rst | 111 ++++++++++++++++++++++++++++--- 1 file changed, 102 insertions(+), 9 deletions(-)
docs/system/arm/cpu-features.rst +102 -9
@@ -2,8 +2,11 @@ Arm CPU Features ================ CPU features are optional features that a CPU of supporting type may -choose to implement or not. In QEMU, optional CPU features have -corresponding boolean CPU proprieties that, when enabled, indicate +choose to implement or not. QEMU provides two different mechanisms +to configure those features: + +1. For most CPU models, optional CPU features may have +corresponding boolean CPU properties that, when enabled, indicate that the feature is implemented, and, conversely, when disabled, indicate that it is not implemented. An example of an Arm CPU feature is the Performance Monitoring Unit (PMU). CPU types such as the
@@ -31,6 +34,34 @@ running guests in AArch32. CPU features that are inherently specific to KVM are prefixed with "kvm-" and are described in "KVM VCPU Features". +2. Additionally, the ``host`` and ``max`` CPU models on KVM allow +overwriting a subset of the ID register fields. Not all ID register +fields are writable: this depends on the host. For those which are +writable, and for those only, these models expose +``SYSREG_<IDREG>_<FIELD>`` properties. IDREG and FIELD names are those +used in the ARM Architecture Reference Manual. QEMU may still omit some +writable fields that conflict with legacy composite options (for example +EL3/secure, MTE, SVE, or pauth). + +Values set with those properties override the initial values retrieved +from the vCPU after legacy composite property settings (``sve``, +``pauth``, ...) have been applied, whether at machine level or at vCPU +level. + +``SYSREG_<IDREG>_<FIELD>`` properties are applied at the end of the chain +and do not substitute for legacy composite options. In other words, if +you want to use pauth, you still need to set ``pauth=on``. Indeed legacy +options do more than exposing a different value for ID registers. They +may also interact with KVM to prepare the vCPU for this feature (for +instance at vCPU init time). Whereas ``SYSREG_<IDREG>_<FIELD>`` properties +only change the final value of the ID register. Inconsistent settings +between legacy composite options (at machine level or CPU level) which +impact the vCPU and low-level ``SYSREG_<IDREG>_<FIELD>`` properties are +rejected. ``SYSREG_<IDREG>_<FIELD>`` properties are essentially used to +tune the ``host``/``max`` vCPU model so that it allows migration between +different hardware. + + CPU Feature Probing ===================
@@ -126,13 +157,21 @@ A note about CPU models and KVM Named CPU models generally do not work with KVM. There are a few cases that do work, e.g. using the named CPU model ``cortex-a57`` with KVM on a -seattle host, but mostly if KVM is enabled the ``host`` CPU type must be -used. This means the guest is provided all the same CPU features as the -host CPU type has. And, for this reason, the ``host`` CPU type should -enable all CPU features that the host has by default. Indeed it's even -a bit strange to allow disabling CPU features that the host has when using -the ``host`` CPU type, but in the absence of CPU models it's the best we can -do if we want to launch guests without all the host's CPU features enabled. +seattle host, but mostly if KVM is enabled, the ``host`` CPU model must be +used. + +Using the ``host`` type means the guest is provided all the same CPU +features as the host CPU type has. And, for this reason, the ``host`` +CPU type should enable all CPU features that the host has by default. + +In case some features need to be tuned for the guest, and the host kernel +supports it, the ``host`` and ``max`` models can be instructed to change +individual ID register field values. This is especially useful for +migration purposes. +However, this interface will not allow configuring an arbitrary set of +features; the ID registers must describe a subset of the host's features, +and all differences to the host's configuration must actually be supported +by the kernel to be deconfigured. Enabling KVM also affects the ``query-cpu-model-expansion`` QMP command. The affect is not only limited to specific features, as pointed out in example
@@ -169,6 +208,15 @@ disabling many SVE vector lengths would be quite verbose, the ``sve<N>`` CPU properties have special semantics (see "SVE CPU Property Parsing Semantics"). +Additionally, if supported by KVM on the host kernel, the ``host`` and +``max`` CPU models may be configured via individual ID register field +properties, for example:: + + $ qemu-system-aarch64 -M virt -cpu host,SYSREG_ID_AA64ISAR0_EL1_DP=0x0 + +This forces ID_AA64ISAR0_EL1 DP field to 0. The same property syntax works +with ``-cpu max``. + KVM VCPU Features =================
@@ -495,3 +543,48 @@ Legal values for ``S`` are 30, 34, 36, and 39; the default is 30. As with ``x-rme``, the ``x-l0gptsz`` property may be renamed or removed in some future QEMU release. + +Configuring CPU features via ID register fields +=============================================== + +Note that this is currently only supported under KVM, and with the +``host`` or ``max`` CPU models. + +Querying available ID register fields +------------------------------------- + +QEMU will create properties for ID register fields that are reported as +being writable by the kernel, known to the QEMU instance, and not omitted +because they conflict with legacy composite options. Therefore, the same +QEMU binary may expose different properties when run under a different +kernel. + +To find out the available ID register field properties, use the +``query-cpu-model-expansion`` QMP command:: + + (QEMU) query-cpu-model-expansion type=full model={"name":"host"} + {"return": { + "model": {"name": "host", "props": { + "SYSREG_ID_AA64PFR0_EL1_EL2": 1, "SYSREG_ID_AA64ISAR2_EL1_CLRBHB": 0, + "SYSREG_CTR_EL0_L1Ip": 3, "SYSREG_CTR_EL0_DminLine": 4, + "SYSREG_ID_AA64MMFR0_EL1_BIGEND": 1, "SYSREG_ID_AA64MMFR1_EL1_ECBHB": 0, + "SYSREG_ID_AA64MMFR2_EL1_CnP": 1, "SYSREG_ID_DFR0_EL1_PerfMon": 4, + "SYSREG_ID_AA64PFR0_EL1_DIT": 0, "SYSREG_ID_AA64MMFR1_EL1_HAFDBS": 2, + "SYSREG_ID_AA64ISAR0_EL1_FHM": 0, "SYSREG_ID_AA64ISAR2_EL1_CSSC": 0, + "SYSREG_ID_AA64ISAR0_EL1_DP": 1, (...) + }}}} + +If a certain field in an ID register does not show up in this list, it is +either not writable with the specific host kernel, unknown to this QEMU +build, or intentionally not exposed because it overlaps a legacy composite +option. + +A note on compatibility +----------------------- + +A common use case for providing a defined set of ID register values is +to be able to present a fixed set of features to a guest, often referred +to as "stable guest ABI". This may take the form of ironing out differences +between two similar CPUs with the intention of being able to migrate +between machines with those CPUs, or providing the same CPU across Linux +kernel updates on the host.
Signature · 1 line
2.53.0
Quoted 52 lines · Eric Auger
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
This series enhances the current host KVM model with capability to set writable ID reg fields.
Since v6.7 kernel, KVM/arm allows the userspace to overwrite the values of a subset of ID regs. The list of writable fields continues to grow. The feature ID range is defined as the AArch64 System register space with op0==3, op1=={0, 1, 3}, CRn==0, CRm=={0-7}, op2=={0-7}.
The end goal is to get more flexibility when migrating guests between different host hardware. This series is a prerequisite for aarch64 named vcpu models.
QEMU retrieves the writable ID fields from KVM UAPI and match them against a generated description of ID regs and their named fields that stem from AARCHMRS Registers.json file. Current description is based on latest 2026-03 edition. The content of the generated files was compared against kernel linux/arch/arm64/tools/sysreg file. It is not straightforward to have unit tests for python scripts as there are many cases for field extraction.
For each writable named field a uint64 property is created following the "SYSREG_<REG>_<FIELD>" naming convention. REG and FIELD names are those described in ARM ARM Reference manual.
SYSREG properties are applied at the end of the initialization chain, after legacy composite options (sve, pauth, ...). They do not substitute to them because legacy options do more than just changing the value of ID registers. They may also interact with KVM to init the vcpu with specific features or set some VM capabilities. SYSREG properties just affect the corresponding ID register field. Some checks are performed to make sure their value is not inconsistent with legacy composite options.
The list of SYSREG properties can be retrieved through the qmp monitor using query-cpu-model-expansion. They return the current value for the corresponding field. The qmp command also allows to test setting new values. In static mode, they are tested at qemu level only, against field length, arch enum values if any and consistency with legacy composite options. With full expansion, the values are tested against KVM using a scratch vcpu initialized with the right legacy composite property values.
Quoted 2 lines
Connie & Eric
Hi Eric,
Thanks for the quick respin!
I tried to build the series but it fails with:
FAILED: libqemu-aarch64_be-linux-user.a.p/linux-user_syscall.c.o
cc -Ilibqemu-aarch64_be-linux-user.a.p -I. -I.. -Itarget/arm -I../target/arm -I../common-user/host/aarch64 -I../linux-user/include/host/aarch64 -I../linux-user/include -Ilinux-user -I../linux-user -Ilinux-user/aarch64 -I../linux-user/aarch64 -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-6 -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero -fzero-call-used-regs=used-gpr -fstack-protector-strong -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wformat-overflow=2 -Wformat-security -Wformat-y2k -Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls -Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings -Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value -isystem /home/ahv/qemu-upstream/linux-headers -isystem linux-headers -iquote . -iquote /home/ahv/qemu-upstream -iquote /home/ahv/qemu-upstream/include -iquote /home/ahv/qemu-upstream/host/include/aarch64 -iquote /home/ahv/qemu-upstream/host/include/generic -iquote /home/ahv/qemu-upstream/tcg/aarch64 -pthread -fPIE -DWITH_GZFILEOP -isystem../linux-headers -isystemlinux-headers -DCOMPILING_PER_TARGET '-DCONFIG_TARGET="aarch64_be-linux-user-config-target.h"' -MD -MQ libqemu-aarch64_be-linux-user.a.p/linux-user_syscall.c.o -MF libqemu-aarch64_be-linux-user.a.p/linux-user_syscall.c.o.d -o libqemu-aarch64_be-linux-user.a.p/linux-user_syscall.c.o -c ../linux-user/syscall.c In file included from /home/ahv/qemu-upstream/include/fpu/softfloat-types.h:83,
from /home/ahv/qemu-upstream/include/qemu/cpu-float.h:4,
from ../target/arm/cpu.h:24,
from ../linux-user/qemu.h:4,
from ../linux-user/syscall.c:133:../linux-user/aarch64/../arm/target_proc.h: In function ‘open_cpuinfo’:../linux-user/aarch64/../arm/target_proc.h:28:30: error: ‘ARMCPU’ {aka ‘struct ArchCPU’} has no member named ‘midr’
28 | midr_rev = FIELD_EX32(cpu->midr, MIDR_EL1, REVISION);
| ^~/home/ahv/qemu-upstream/include/hw/core/registerfields.h:56:16: note: in definition of macro ‘FIELD_EX32’
56 | extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
| ^~~~~~~../linux-user/aarch64/../arm/target_proc.h:29:31: error: ‘ARMCPU’ {aka ‘struct ArchCPU’} has no member named ‘midr’
29 | midr_part = FIELD_EX32(cpu->midr, MIDR_EL1, PARTNUM);
| ^~/home/ahv/qemu-upstream/include/hw/core/registerfields.h:56:16: note: in definition of macro ‘FIELD_EX32’
56 | extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
| ^~~~~~~../linux-user/aarch64/../arm/target_proc.h:30:30: error: ‘ARMCPU’ {aka ‘struct ArchCPU’} has no member named ‘midr’
30 | midr_var = FIELD_EX32(cpu->midr, MIDR_EL1, VARIANT);
| ^~/home/ahv/qemu-upstream/include/hw/core/registerfields.h:56:16: note: in definition of macro ‘FIELD_EX32’
56 | extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
| ^~~~~~~../linux-user/aarch64/../arm/target_proc.h:31:31: error: ‘ARMCPU’ {aka ‘struct ArchCPU’} has no member named ‘midr’
31 | midr_impl = FIELD_EX32(cpu->midr, MIDR_EL1, IMPLEMENTER);
| ^~/home/ahv/qemu-upstream/include/hw/core/registerfields.h:56:16: note: in definition of macro ‘FIELD_EX32’
56 | extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
| ^~~~~~~(Seems like you missed the midr change ../linux-user/aarch64/../arm/target_proc.h)
I will use a local change to bypass this for now.
Thanks,
Khushit
Quoted 108 lines
History:
--------
v9 -> v10:
addressed all Khushit's comments/suggestions. Here is the list of main changes.- MIDR, REVIDIR, MPIDR storage move (this may be sent as a separate prerequisite series)
- rebase on demux register handler that has just landed
- update the json extractor accordingly
- Generate conditional enum values
- reorganize script patches to have the generated header in the same patch which is much easier to maintain
- New macro to encode arch enum value and ValueRanges which gives a much more compact header. Also enabled to remove check-patch error
- Put a maximum of code incpu64.cinstead ofkvm.cto pave the way for other acceleration support. Also changed the consistency check handling by skipping potential new props that are known to collide with legacy composite options
- addwritable_onlyparam to pave the way for exposing all fields as props
- fixes in the qmp expansion codeCornelia Huck (3):
target/arm/kvm: Retrieve writable ID reg map
arm-qmp-cmds: introspection for ID register props arm/cpu-features: Document ID reg propertiesEric Auger (22):
target/arm: Move REVIDR into isar.idregs[] storage target/arm: Move MIDR into isar.idregs[] storage target/arm: Enforce MPIDR into isar.idregs[] storage target/arm/cpu-sysregs.h.inc: Update with automatic generation arm/cpu: Add infra to handle generated ID register definitions target/arm/cpu-idregs.h.inc: Generate with script target/arm/cpu-idregs.h.inc: Generate enum values target/arm/cpu-idregs.h.inc: Generate reserved fields hw/arm/virt: Make surevirt_get_caches()keeps on readingCLIDR_EL1as
0
arm/kvm: Initialize isar.idregs[] with all writable host ID regs target/arm/cpu64: Add properties for writable IDReg fields target/arm/kvm: Implement SYSREG property setter and getter target/arm/kvm: Letkvm_arm_init_cpreg_listpropagate an error handle target/arm/kvm: Pass an Error handle tokvm_arch_init_vcputarget/arm/kvm: Introducekvm_arm_override_idreg_fieldhelper target/arm/cpu64: Introducearm_cpu_apply_sysreg_propstarget/arm/kvm: Apply SYSREG props
target/arm/kvm: Add consistency checking for SYSREG props target/arm/cpu64: Add helper to test SYSREG props against a scratch
vcpu
target/arm/kvm: Add an error handle to
kvm_arm_create_scratch_host_vcpu
target/arm/kvm: Introducekvm_arm_vcpu_prepare_init_featureshelper target/arm/kvm: Introducekvm_arm_create_init_scratch_vcpu()Shaju Abraham (1):
target/arm/cpu_idregs: Generate tables for Arm64 ID registers and
fieldsdocs/system/arm/cpu-features.rst | 111 +- include/system/kvm.h | 2 +- target/arm/cpu-idregs.h | 76 + target/arm/cpu.h | 12 +- target/arm/kvm_arm.h | 26 +- target/arm/cpu-idregs.h.inc | 1549 +++++++++++++++++ target/arm/cpu-sysregs.h.inc | 13 + accel/kvm/kvm-all.c | 15 +- hw/arm/virt.c | 11 + hw/intc/armv7m_nvic.c | 4 +- target/arm/arm-qmp-cmds.c | 130 +- target/arm/cpu-idregs.c | 93 + target/arm/cpu-max.c | 4 +- target/arm/cpu.c | 24 +- target/arm/cpu64.c | 330 +++- target/arm/helper.c | 29 +- target/arm/hvf/hvf.c | 6 +- target/arm/kvm-stub.c | 17 + target/arm/kvm.c | 277 ++- target/arm/tcg/cpu-v7m.c | 18 +- target/arm/tcg/cpu32.c | 37 +- target/arm/tcg/cpu64.c | 42 +- target/arm/whpx/whpx-all.c | 6 +- target/i386/kvm/kvm.c | 22 +- target/loongarch/kvm/kvm.c | 27 +- target/ppc/kvm.c | 6 +- target/riscv/kvm/kvm-cpu.c | 3 +- target/s390x/kvm/kvm.c | 2 +- scripts/aarch64_sysreg_helpers.py | 118 ++ .../update-aarch64-cpu-sysreg-properties.py | 331 ++++ scripts/update-aarch64-cpu-sysregs-header.py | 59 + target/arm/meson.build | 1 + target/arm/trace-events | 9 + 33 files changed, 3232 insertions(+), 178 deletions(-)create mode 100644
target/arm/cpu-idregs.h
create mode 100644 target/arm/cpu-idregs.h.inc
create mode 100644target/arm/cpu-idregs.c
create mode 100644scripts/aarch64_sysreg_helpers.pycreate mode 100644scripts/update-aarch64-cpu-sysreg-properties.pycreate mode 100755scripts/update-aarch64-cpu-sysregs-header.pySignature · 1 line
2.53.0
Hi Khushit,
Quoted 88 lines · Khushit Shah
Quoted 51 lines · Eric Auger
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
This series enhances the current host KVM model with capability to set writable ID reg fields.
Since v6.7 kernel, KVM/arm allows the userspace to overwrite the values of a subset of ID regs. The list of writable fields continues to grow. The feature ID range is defined as the AArch64 System register space with op0==3, op1=={0, 1, 3}, CRn==0, CRm=={0-7}, op2=={0-7}.
The end goal is to get more flexibility when migrating guests between different host hardware. This series is a prerequisite for aarch64 named vcpu models.
QEMU retrieves the writable ID fields from KVM UAPI and match them against a generated description of ID regs and their named fields that stem from AARCHMRS Registers.json file. Current description is based on latest 2026-03 edition. The content of the generated files was compared against kernel linux/arch/arm64/tools/sysreg file. It is not straightforward to have unit tests for python scripts as there are many cases for field extraction.
For each writable named field a uint64 property is created following the "SYSREG_<REG>_<FIELD>" naming convention. REG and FIELD names are those described in ARM ARM Reference manual.
SYSREG properties are applied at the end of the initialization chain, after legacy composite options (sve, pauth, ...). They do not substitute to them because legacy options do more than just changing the value of ID registers. They may also interact with KVM to init the vcpu with specific features or set some VM capabilities. SYSREG properties just affect the corresponding ID register field. Some checks are performed to make sure their value is not inconsistent with legacy composite options.
The list of SYSREG properties can be retrieved through the qmp monitor using query-cpu-model-expansion. They return the current value for the corresponding field. The qmp command also allows to test setting new values. In static mode, they are tested at qemu level only, against field length, arch enum values if any and consistency with legacy composite options. With full expansion, the values are tested against KVM using a scratch vcpu initialized with the right legacy composite property values.
Quoted 2 lines
Connie & Eric
Hi Eric,
Thanks for the quick respin!
I tried to build the series but it fails with:
FAILED:libqemu-aarch64_be-linux-user.a.p/linux-user_syscall.c.o
cc -Ilibqemu-aarch64_be-linux-user.a.p -I. -I.. -Itarget/arm -I../target/arm -I../common-user/host/aarch64 -I../linux-user/include/host/aarch64 -I../linux-user/include -Ilinux-user -I../linux-user -Ilinux-user/aarch64 -I../linux-user/aarch64 -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-6 -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero -fzero-call-used-regs=used-gpr -fstack-protector-strong -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wformat-overflow=2 -Wformat-security -Wformat-y2k -Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls -Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings -Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value -isystem/home/ahv/qemu-upstream/linux-headers-isystem linux-headers -iquote . -iquote/home/ahv/qemu-upstream-iquote/home/ahv/qemu-upstream/include-iquote/home/ahv/qemu-upstream/host/include/aarch64-iquote/home/ahv/qemu-upstream/host/include/generic-iquote/home/ahv/qemu-upstream/tcg/aarch64-pthread -fPIE -DWITH_GZFILEOP -isystem../linux-headers -isystemlinux-headers -DCOMPILING_PER_TARGET '-DCONFIG_TARGET="aarch64_be-linux-user-config-target.h"' -MD -MQlibqemu-aarch64_be-linux-user.a.p/linux-user_syscall.c.o-MF libqemu-aarch64_be-linux-user.a.p/linux-user_syscall.c.o.d -olibqemu-aarch64_be-linux-user.a.p/linux-user_syscall.c.o-c../linux-user/syscall.cIn file included from/home/ahv/qemu-upstream/include/fpu/softfloat-types.h:83,from /home/ahv/qemu-upstream/include/qemu/cpu-float.h:4, from ../target/arm/cpu.h:24, from ../linux-user/qemu.h:4, from ../linux-user/syscall.c:133:
../linux-user/aarch64/../arm/target_proc.h: In function ‘open_cpuinfo’:../linux-user/aarch64/../arm/target_proc.h:28:30: error: ‘ARMCPU’ {aka ‘struct ArchCPU’} has no member named ‘midr’
28 |midr_rev=FIELD_EX32(cpu->midr, MIDR_EL1, REVISION);
| ^~/home/ahv/qemu-upstream/include/hw/core/registerfields.h:56:16: note: in definition of macro ‘FIELD_EX32’56 | extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ | ^~~~~~~
../linux-user/aarch64/../arm/target_proc.h:29:31: error: ‘ARMCPU’ {aka ‘struct ArchCPU’} has no member named ‘midr’
29 |midr_part=FIELD_EX32(cpu->midr, MIDR_EL1, PARTNUM);
| ^~/home/ahv/qemu-upstream/include/hw/core/registerfields.h:56:16: note: in definition of macro ‘FIELD_EX32’56 | extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ | ^~~~~~~
../linux-user/aarch64/../arm/target_proc.h:30:30: error: ‘ARMCPU’ {aka ‘struct ArchCPU’} has no member named ‘midr’
30 |midr_var=FIELD_EX32(cpu->midr, MIDR_EL1, VARIANT);
| ^~/home/ahv/qemu-upstream/include/hw/core/registerfields.h:56:16: note: in definition of macro ‘FIELD_EX32’56 | extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ | ^~~~~~~
../linux-user/aarch64/../arm/target_proc.h:31:31: error: ‘ARMCPU’ {aka ‘struct ArchCPU’} has no member named ‘midr’
31 |midr_impl=FIELD_EX32(cpu->midr, MIDR_EL1, IMPLEMENTER);
| ^~/home/ahv/qemu-upstream/include/hw/core/registerfields.h:56:16: note: in definition of macro ‘FIELD_EX32’
Quoted 6 lines
56 | extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ | ^~~~~~~(Seems like you missed the midr change
../linux-user/aarch64/../arm/target_proc.h)I will use a local change to bypass this for now.
thanks for the report. I missed that occurence. Will fix that asap
Eric
Quoted 112 lines
Thanks,
KhushitQuoted 108 lines
History:
--------
v9 -> v10:
addressed all Khushit's comments/suggestions. Here is the list of main changes.- MIDR, REVIDIR, MPIDR storage move (this may be sent as a separate prerequisite series)
- rebase on demux register handler that has just landed
- update the json extractor accordingly
- Generate conditional enum values
- reorganize script patches to have the generated header in the same patch which is much easier to maintain
- New macro to encode arch enum value and ValueRanges which gives a much more compact header. Also enabled to remove check-patch error
- Put a maximum of code incpu64.cinstead ofkvm.cto pave the way for other acceleration support. Also changed the consistency check handling by skipping potential new props that are known to collide with legacy composite options
- addwritable_onlyparam to pave the way for exposing all fields as props
- fixes in the qmp expansion codeCornelia Huck (3):
target/arm/kvm: Retrieve writable ID reg map
arm-qmp-cmds: introspection for ID register props arm/cpu-features: Document ID reg propertiesEric Auger (22):
target/arm: Move REVIDR into isar.idregs[] storage target/arm: Move MIDR into isar.idregs[] storage target/arm: Enforce MPIDR into isar.idregs[] storage target/arm/cpu-sysregs.h.inc: Update with automatic generation arm/cpu: Add infra to handle generated ID register definitions target/arm/cpu-idregs.h.inc: Generate with script target/arm/cpu-idregs.h.inc: Generate enum values target/arm/cpu-idregs.h.inc: Generate reserved fields hw/arm/virt: Make surevirt_get_caches()keeps on readingCLIDR_EL1as
0
arm/kvm: Initialize isar.idregs[] with all writable host ID regs target/arm/cpu64: Add properties for writable IDReg fields target/arm/kvm: Implement SYSREG property setter and getter target/arm/kvm: Letkvm_arm_init_cpreg_listpropagate an error handle target/arm/kvm: Pass an Error handle tokvm_arch_init_vcputarget/arm/kvm: Introducekvm_arm_override_idreg_fieldhelper target/arm/cpu64: Introducearm_cpu_apply_sysreg_propstarget/arm/kvm: Apply SYSREG props
target/arm/kvm: Add consistency checking for SYSREG props target/arm/cpu64: Add helper to test SYSREG props against a scratch
vcpu
target/arm/kvm: Add an error handle to
kvm_arm_create_scratch_host_vcpu
target/arm/kvm: Introducekvm_arm_vcpu_prepare_init_featureshelper target/arm/kvm: Introducekvm_arm_create_init_scratch_vcpu()Shaju Abraham (1):
target/arm/cpu_idregs: Generate tables for Arm64 ID registers and
fieldsdocs/system/arm/cpu-features.rst | 111 +- include/system/kvm.h | 2 +- target/arm/cpu-idregs.h | 76 + target/arm/cpu.h | 12 +- target/arm/kvm_arm.h | 26 +- target/arm/cpu-idregs.h.inc | 1549 +++++++++++++++++ target/arm/cpu-sysregs.h.inc | 13 + accel/kvm/kvm-all.c | 15 +- hw/arm/virt.c | 11 + hw/intc/armv7m_nvic.c | 4 +- target/arm/arm-qmp-cmds.c | 130 +- target/arm/cpu-idregs.c | 93 + target/arm/cpu-max.c | 4 +- target/arm/cpu.c | 24 +- target/arm/cpu64.c | 330 +++- target/arm/helper.c | 29 +- target/arm/hvf/hvf.c | 6 +- target/arm/kvm-stub.c | 17 + target/arm/kvm.c | 277 ++- target/arm/tcg/cpu-v7m.c | 18 +- target/arm/tcg/cpu32.c | 37 +- target/arm/tcg/cpu64.c | 42 +- target/arm/whpx/whpx-all.c | 6 +- target/i386/kvm/kvm.c | 22 +- target/loongarch/kvm/kvm.c | 27 +- target/ppc/kvm.c | 6 +- target/riscv/kvm/kvm-cpu.c | 3 +- target/s390x/kvm/kvm.c | 2 +- scripts/aarch64_sysreg_helpers.py | 118 ++ .../update-aarch64-cpu-sysreg-properties.py | 331 ++++ scripts/update-aarch64-cpu-sysregs-header.py | 59 + target/arm/meson.build | 1 + target/arm/trace-events | 9 + 33 files changed, 3232 insertions(+), 178 deletions(-)create mode 100644
target/arm/cpu-idregs.h
create mode 100644 target/arm/cpu-idregs.h.inc
create mode 100644target/arm/cpu-idregs.c
create mode 100644scripts/aarch64_sysreg_helpers.pycreate mode 100644scripts/update-aarch64-cpu-sysreg-properties.pycreate mode 100755scripts/update-aarch64-cpu-sysregs-header.pySignature · 1 line
2.53.0
Quoted 4 lines · Eric Auger
This series enhances the current host KVM model with capability to set writable ID reg fields.
Quoted 8 lines
Since v6.7 kernel, KVM/arm allows the userspace to overwrite the values of a subset of ID regs. The list of writable fields continues to grow. The feature ID range is defined as the AArch64 System register space with op0==3, op1=={0, 1, 3}, CRn==0, CRm=={0-7}, op2=={0-7}.
The end goal is to get more flexibility when migrating guests between different host hardware. This series is a prerequisite for aarch64 named vcpu models.
To help me with review prioritization -- are you hoping this will land for 11.2, or are you expecting it to be 12.0 material? (Given the softfreeze date is rapidly approaching, it feels to me like 12.0 is where it's going to be.)
thanks
-- PMM
Hi Peter,
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Eric Auger
This series enhances the current host KVM model with capability to set writable ID reg fields.
Since v6.7 kernel, KVM/arm allows the userspace to overwrite the values of a subset of ID regs. The list of writable fields continues to grow. The feature ID range is defined as the AArch64 System register space with op0==3, op1=={0, 1, 3}, CRn==0, CRm=={0-7}, op2=={0-7}.
Quoted 7 lines
Quoted 3 lines
The end goal is to get more flexibility when migrating guests between different host hardware. This series is a prerequisite for aarch64 named vcpu models.
To help me with review prioritization -- are you hoping this will land for 11.2, or are you expecting it to be 12.0 material? (Given the softfreeze date is rapidly approaching, it feels to me like 12.0 is where it's going to be.)
for the whole series I think this is too late for 11.2. What would be nice to get in 10.2 is some prerequisite patches like those you reviewed plus [PATCH v10 16/26] target/arm/kvm: Pass an Error handle to kvm_arch_init_vcpu which are rather independent. I will prepare a separate reduced series containing those + fixing the oversight of one midr conversion.
Thanks
Eric
Quoted 4 lines
thanks
-- PMM