Skip to content

Commit 2a5bc6c

Browse files
Anshuman Khandualwilldeacon
authored andcommitted
arm64/cpufeature: Add explicit ftr_id_isar0[] for ID_ISAR0 register
ID_ISAR0[31..28] bits are RES0 in ARMv8, Reserved/UNK in ARMv7. Currently these bits get exposed through generic_id_ftr32[] which is not desirable. Hence define an explicit ftr_id_isar0[] array for ID_ISAR0 register where those bits can be hidden. Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Suzuki K Poulose <[email protected]> Cc: [email protected] Cc: [email protected] Suggested-by: Mark Rutland <[email protected]> Signed-off-by: Anshuman Khandual <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent f73531f commit 2a5bc6c

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

arch/arm64/include/asm/sysreg.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,14 @@
766766
#define ID_ISAR4_WITHSHIFTS_SHIFT 4
767767
#define ID_ISAR4_UNPRIV_SHIFT 0
768768

769+
#define ID_ISAR0_DIVIDE_SHIFT 24
770+
#define ID_ISAR0_DEBUG_SHIFT 20
771+
#define ID_ISAR0_COPROC_SHIFT 16
772+
#define ID_ISAR0_CMPBRANCH_SHIFT 12
773+
#define ID_ISAR0_BITFIELD_SHIFT 8
774+
#define ID_ISAR0_BITCOUNT_SHIFT 4
775+
#define ID_ISAR0_SWAP_SHIFT 0
776+
769777
#define ID_ISAR5_RDM_SHIFT 24
770778
#define ID_ISAR5_CRC32_SHIFT 16
771779
#define ID_ISAR5_SHA2_SHIFT 12

arch/arm64/kernel/cpufeature.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,16 @@ static const struct arm64_ftr_bits ftr_dczid[] = {
370370
ARM64_FTR_END,
371371
};
372372

373+
static const struct arm64_ftr_bits ftr_id_isar0[] = {
374+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR0_DIVIDE_SHIFT, 4, 0),
375+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR0_DEBUG_SHIFT, 4, 0),
376+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR0_COPROC_SHIFT, 4, 0),
377+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR0_CMPBRANCH_SHIFT, 4, 0),
378+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR0_BITFIELD_SHIFT, 4, 0),
379+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR0_BITCOUNT_SHIFT, 4, 0),
380+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR0_SWAP_SHIFT, 4, 0),
381+
ARM64_FTR_END,
382+
};
373383

374384
static const struct arm64_ftr_bits ftr_id_isar5[] = {
375385
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_RDM_SHIFT, 4, 0),
@@ -451,7 +461,7 @@ static const struct arm64_ftr_bits ftr_zcr[] = {
451461
* Common ftr bits for a 32bit register with all hidden, strict
452462
* attributes, with 4bit feature fields and a default safe value of
453463
* 0. Covers the following 32bit registers:
454-
* id_isar[0-4], id_mmfr[1-3], id_pfr1, mvfr[0-1]
464+
* id_isar[1-4], id_mmfr[1-3], id_pfr1, mvfr[0-1]
455465
*/
456466
static const struct arm64_ftr_bits ftr_generic_32bits[] = {
457467
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, 28, 4, 0),
@@ -497,7 +507,7 @@ static const struct __ftr_reg_entry {
497507
ARM64_FTR_REG(SYS_ID_MMFR3_EL1, ftr_generic_32bits),
498508

499509
/* Op1 = 0, CRn = 0, CRm = 2 */
500-
ARM64_FTR_REG(SYS_ID_ISAR0_EL1, ftr_generic_32bits),
510+
ARM64_FTR_REG(SYS_ID_ISAR0_EL1, ftr_id_isar0),
501511
ARM64_FTR_REG(SYS_ID_ISAR1_EL1, ftr_generic_32bits),
502512
ARM64_FTR_REG(SYS_ID_ISAR2_EL1, ftr_generic_32bits),
503513
ARM64_FTR_REG(SYS_ID_ISAR3_EL1, ftr_generic_32bits),

0 commit comments

Comments
 (0)