@@ -226,6 +226,10 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = {
226226};
227227
228228static const struct arm64_ftr_bits ftr_id_aa64isar2 [] = {
229+ ARM64_FTR_BITS (FTR_VISIBLE_IF_IS_ENABLED (CONFIG_ARM64_PTR_AUTH ),
230+ FTR_STRICT , FTR_EXACT , ID_AA64ISAR2_APA3_SHIFT , 4 , 0 ),
231+ ARM64_FTR_BITS (FTR_VISIBLE_IF_IS_ENABLED (CONFIG_ARM64_PTR_AUTH ),
232+ FTR_STRICT , FTR_LOWER_SAFE , ID_AA64ISAR2_GPA3_SHIFT , 4 , 0 ),
229233 ARM64_FTR_BITS (FTR_VISIBLE , FTR_NONSTRICT , FTR_LOWER_SAFE , ID_AA64ISAR2_RPRES_SHIFT , 4 , 0 ),
230234 ARM64_FTR_END ,
231235};
@@ -596,6 +600,7 @@ static const struct arm64_ftr_bits ftr_raz[] = {
596600struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override ;
597601struct arm64_ftr_override __ro_after_init id_aa64pfr1_override ;
598602struct arm64_ftr_override __ro_after_init id_aa64isar1_override ;
603+ struct arm64_ftr_override __ro_after_init id_aa64isar2_override ;
599604
600605static const struct __ftr_reg_entry {
601606 u32 sys_id ;
@@ -644,6 +649,8 @@ static const struct __ftr_reg_entry {
644649 ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR1_EL1 , ftr_id_aa64isar1 ,
645650 & id_aa64isar1_override ),
646651 ARM64_FTR_REG (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2 ),
652+ ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2 ,
653+ & id_aa64isar2_override ),
647654
648655 /* Op1 = 0, CRn = 0, CRm = 7 */
649656 ARM64_FTR_REG (SYS_ID_AA64MMFR0_EL1 , ftr_id_aa64mmfr0 ),
@@ -1821,21 +1828,27 @@ static bool has_address_auth_cpucap(const struct arm64_cpu_capabilities *entry,
18211828 /* Now check for the secondary CPUs with SCOPE_LOCAL_CPU scope */
18221829 sec_val = cpuid_feature_extract_field (__read_sysreg_by_encoding (entry -> sys_reg ),
18231830 entry -> field_pos , entry -> sign );
1824- return sec_val == boot_val ;
1831+ return ( sec_val >= entry -> min_field_value ) && ( sec_val == boot_val ) ;
18251832}
18261833
18271834static bool has_address_auth_metacap (const struct arm64_cpu_capabilities * entry ,
18281835 int scope )
18291836{
1830- return has_address_auth_cpucap (cpu_hwcaps_ptrs [ARM64_HAS_ADDRESS_AUTH_ARCH ], scope ) ||
1831- has_address_auth_cpucap (cpu_hwcaps_ptrs [ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope );
1837+ bool api = has_address_auth_cpucap (cpu_hwcaps_ptrs [ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope );
1838+ bool apa = has_address_auth_cpucap (cpu_hwcaps_ptrs [ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5 ], scope );
1839+ bool apa3 = has_address_auth_cpucap (cpu_hwcaps_ptrs [ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3 ], scope );
1840+
1841+ return apa || apa3 || api ;
18321842}
18331843
18341844static bool has_generic_auth (const struct arm64_cpu_capabilities * entry ,
18351845 int __unused )
18361846{
1837- return __system_matches_cap (ARM64_HAS_GENERIC_AUTH_ARCH ) ||
1838- __system_matches_cap (ARM64_HAS_GENERIC_AUTH_IMP_DEF );
1847+ bool gpi = __system_matches_cap (ARM64_HAS_GENERIC_AUTH_IMP_DEF );
1848+ bool gpa = __system_matches_cap (ARM64_HAS_GENERIC_AUTH_ARCH_QARMA5 );
1849+ bool gpa3 = __system_matches_cap (ARM64_HAS_GENERIC_AUTH_ARCH_QARMA3 );
1850+
1851+ return gpa || gpa3 || gpi ;
18391852}
18401853#endif /* CONFIG_ARM64_PTR_AUTH */
18411854
@@ -2221,15 +2234,25 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
22212234 },
22222235#ifdef CONFIG_ARM64_PTR_AUTH
22232236 {
2224- .desc = "Address authentication (architected algorithm)" ,
2225- .capability = ARM64_HAS_ADDRESS_AUTH_ARCH ,
2237+ .desc = "Address authentication (architected QARMA5 algorithm)" ,
2238+ .capability = ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5 ,
22262239 .type = ARM64_CPUCAP_BOOT_CPU_FEATURE ,
22272240 .sys_reg = SYS_ID_AA64ISAR1_EL1 ,
22282241 .sign = FTR_UNSIGNED ,
22292242 .field_pos = ID_AA64ISAR1_APA_SHIFT ,
22302243 .min_field_value = ID_AA64ISAR1_APA_ARCHITECTED ,
22312244 .matches = has_address_auth_cpucap ,
22322245 },
2246+ {
2247+ .desc = "Address authentication (architected QARMA3 algorithm)" ,
2248+ .capability = ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3 ,
2249+ .type = ARM64_CPUCAP_BOOT_CPU_FEATURE ,
2250+ .sys_reg = SYS_ID_AA64ISAR2_EL1 ,
2251+ .sign = FTR_UNSIGNED ,
2252+ .field_pos = ID_AA64ISAR2_APA3_SHIFT ,
2253+ .min_field_value = ID_AA64ISAR2_APA3_ARCHITECTED ,
2254+ .matches = has_address_auth_cpucap ,
2255+ },
22332256 {
22342257 .desc = "Address authentication (IMP DEF algorithm)" ,
22352258 .capability = ARM64_HAS_ADDRESS_AUTH_IMP_DEF ,
@@ -2246,15 +2269,25 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
22462269 .matches = has_address_auth_metacap ,
22472270 },
22482271 {
2249- .desc = "Generic authentication (architected algorithm)" ,
2250- .capability = ARM64_HAS_GENERIC_AUTH_ARCH ,
2272+ .desc = "Generic authentication (architected QARMA5 algorithm)" ,
2273+ .capability = ARM64_HAS_GENERIC_AUTH_ARCH_QARMA5 ,
22512274 .type = ARM64_CPUCAP_SYSTEM_FEATURE ,
22522275 .sys_reg = SYS_ID_AA64ISAR1_EL1 ,
22532276 .sign = FTR_UNSIGNED ,
22542277 .field_pos = ID_AA64ISAR1_GPA_SHIFT ,
22552278 .min_field_value = ID_AA64ISAR1_GPA_ARCHITECTED ,
22562279 .matches = has_cpuid_feature ,
22572280 },
2281+ {
2282+ .desc = "Generic authentication (architected QARMA3 algorithm)" ,
2283+ .capability = ARM64_HAS_GENERIC_AUTH_ARCH_QARMA3 ,
2284+ .type = ARM64_CPUCAP_SYSTEM_FEATURE ,
2285+ .sys_reg = SYS_ID_AA64ISAR2_EL1 ,
2286+ .sign = FTR_UNSIGNED ,
2287+ .field_pos = ID_AA64ISAR2_GPA3_SHIFT ,
2288+ .min_field_value = ID_AA64ISAR2_GPA3_ARCHITECTED ,
2289+ .matches = has_cpuid_feature ,
2290+ },
22582291 {
22592292 .desc = "Generic authentication (IMP DEF algorithm)" ,
22602293 .capability = ARM64_HAS_GENERIC_AUTH_IMP_DEF ,
@@ -2402,6 +2435,10 @@ static const struct arm64_cpu_capabilities ptr_auth_hwcap_addr_matches[] = {
24022435 HWCAP_CPUID_MATCH (SYS_ID_AA64ISAR1_EL1 , ID_AA64ISAR1_APA_SHIFT ,
24032436 FTR_UNSIGNED , ID_AA64ISAR1_APA_ARCHITECTED )
24042437 },
2438+ {
2439+ HWCAP_CPUID_MATCH (SYS_ID_AA64ISAR2_EL1 , ID_AA64ISAR2_APA3_SHIFT ,
2440+ FTR_UNSIGNED , ID_AA64ISAR2_APA3_ARCHITECTED )
2441+ },
24052442 {
24062443 HWCAP_CPUID_MATCH (SYS_ID_AA64ISAR1_EL1 , ID_AA64ISAR1_API_SHIFT ,
24072444 FTR_UNSIGNED , ID_AA64ISAR1_API_IMP_DEF )
@@ -2414,6 +2451,10 @@ static const struct arm64_cpu_capabilities ptr_auth_hwcap_gen_matches[] = {
24142451 HWCAP_CPUID_MATCH (SYS_ID_AA64ISAR1_EL1 , ID_AA64ISAR1_GPA_SHIFT ,
24152452 FTR_UNSIGNED , ID_AA64ISAR1_GPA_ARCHITECTED )
24162453 },
2454+ {
2455+ HWCAP_CPUID_MATCH (SYS_ID_AA64ISAR2_EL1 , ID_AA64ISAR2_GPA3_SHIFT ,
2456+ FTR_UNSIGNED , ID_AA64ISAR2_GPA3_ARCHITECTED )
2457+ },
24172458 {
24182459 HWCAP_CPUID_MATCH (SYS_ID_AA64ISAR1_EL1 , ID_AA64ISAR1_GPI_SHIFT ,
24192460 FTR_UNSIGNED , ID_AA64ISAR1_GPI_IMP_DEF )
0 commit comments