Skip to content

Commit 95b54c3

Browse files
Fuad TabbaMarc Zyngier
authored andcommitted
KVM: arm64: Add feature register flag definitions
Add feature register flag definitions to clarify which features might be supported. Consolidate the various ID_AA64PFR0_ELx flags for all ELs. No functional change intended. Signed-off-by: Fuad Tabba <[email protected]> Acked-by: Will Deacon <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cd49622 commit 95b54c3

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

arch/arm64/include/asm/cpufeature.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,14 @@ static inline bool id_aa64pfr0_32bit_el1(u64 pfr0)
602602
{
603603
u32 val = cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_EL1_SHIFT);
604604

605-
return val == ID_AA64PFR0_EL1_32BIT_64BIT;
605+
return val == ID_AA64PFR0_ELx_32BIT_64BIT;
606606
}
607607

608608
static inline bool id_aa64pfr0_32bit_el0(u64 pfr0)
609609
{
610610
u32 val = cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_EL0_SHIFT);
611611

612-
return val == ID_AA64PFR0_EL0_32BIT_64BIT;
612+
return val == ID_AA64PFR0_ELx_32BIT_64BIT;
613613
}
614614

615615
static inline bool id_aa64pfr0_sve(u64 pfr0)

arch/arm64/include/asm/sysreg.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,14 +784,13 @@
784784
#define ID_AA64PFR0_AMU 0x1
785785
#define ID_AA64PFR0_SVE 0x1
786786
#define ID_AA64PFR0_RAS_V1 0x1
787+
#define ID_AA64PFR0_RAS_V1P1 0x2
787788
#define ID_AA64PFR0_FP_NI 0xf
788789
#define ID_AA64PFR0_FP_SUPPORTED 0x0
789790
#define ID_AA64PFR0_ASIMD_NI 0xf
790791
#define ID_AA64PFR0_ASIMD_SUPPORTED 0x0
791-
#define ID_AA64PFR0_EL1_64BIT_ONLY 0x1
792-
#define ID_AA64PFR0_EL1_32BIT_64BIT 0x2
793-
#define ID_AA64PFR0_EL0_64BIT_ONLY 0x1
794-
#define ID_AA64PFR0_EL0_32BIT_64BIT 0x2
792+
#define ID_AA64PFR0_ELx_64BIT_ONLY 0x1
793+
#define ID_AA64PFR0_ELx_32BIT_64BIT 0x2
795794

796795
/* id_aa64pfr1 */
797796
#define ID_AA64PFR1_MPAMFRAC_SHIFT 16
@@ -847,12 +846,16 @@
847846
#define ID_AA64MMFR0_ASID_SHIFT 4
848847
#define ID_AA64MMFR0_PARANGE_SHIFT 0
849848

849+
#define ID_AA64MMFR0_ASID_8 0x0
850+
#define ID_AA64MMFR0_ASID_16 0x2
851+
850852
#define ID_AA64MMFR0_TGRAN4_NI 0xf
851853
#define ID_AA64MMFR0_TGRAN4_SUPPORTED 0x0
852854
#define ID_AA64MMFR0_TGRAN64_NI 0xf
853855
#define ID_AA64MMFR0_TGRAN64_SUPPORTED 0x0
854856
#define ID_AA64MMFR0_TGRAN16_NI 0x0
855857
#define ID_AA64MMFR0_TGRAN16_SUPPORTED 0x1
858+
#define ID_AA64MMFR0_PARANGE_40 0x2
856859
#define ID_AA64MMFR0_PARANGE_48 0x5
857860
#define ID_AA64MMFR0_PARANGE_52 0x6
858861

@@ -900,6 +903,7 @@
900903
#define ID_AA64MMFR2_CNP_SHIFT 0
901904

902905
/* id_aa64dfr0 */
906+
#define ID_AA64DFR0_MTPMU_SHIFT 48
903907
#define ID_AA64DFR0_TRBE_SHIFT 44
904908
#define ID_AA64DFR0_TRACE_FILT_SHIFT 40
905909
#define ID_AA64DFR0_DOUBLELOCK_SHIFT 36

arch/arm64/kernel/cpufeature.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = {
239239
S_ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR0_FP_SHIFT, 4, ID_AA64PFR0_FP_NI),
240240
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL3_SHIFT, 4, 0),
241241
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL2_SHIFT, 4, 0),
242-
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL1_SHIFT, 4, ID_AA64PFR0_EL1_64BIT_ONLY),
243-
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL0_SHIFT, 4, ID_AA64PFR0_EL0_64BIT_ONLY),
242+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL1_SHIFT, 4, ID_AA64PFR0_ELx_64BIT_ONLY),
243+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL0_SHIFT, 4, ID_AA64PFR0_ELx_64BIT_ONLY),
244244
ARM64_FTR_END,
245245
};
246246

@@ -1956,7 +1956,7 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
19561956
.sys_reg = SYS_ID_AA64PFR0_EL1,
19571957
.sign = FTR_UNSIGNED,
19581958
.field_pos = ID_AA64PFR0_EL0_SHIFT,
1959-
.min_field_value = ID_AA64PFR0_EL0_32BIT_64BIT,
1959+
.min_field_value = ID_AA64PFR0_ELx_32BIT_64BIT,
19601960
},
19611961
#ifdef CONFIG_KVM
19621962
{
@@ -1967,7 +1967,7 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
19671967
.sys_reg = SYS_ID_AA64PFR0_EL1,
19681968
.sign = FTR_UNSIGNED,
19691969
.field_pos = ID_AA64PFR0_EL1_SHIFT,
1970-
.min_field_value = ID_AA64PFR0_EL1_32BIT_64BIT,
1970+
.min_field_value = ID_AA64PFR0_ELx_32BIT_64BIT,
19711971
},
19721972
{
19731973
.desc = "Protected KVM",

0 commit comments

Comments
 (0)