arm64/cpufeature: Introduce ID_PFR2, ID_DFR1, ID_MMFR5 and other changes
v3 cover arm64/cpufeature: Introduce ID_PFR2, ID_DFR1, ID_MMFR5 and other changes
This series is primarily motivated from an adhoc list from Mark Rutland during our previous ID_ISAR6 discussion [1]. The current proposal also accommodates some more suggestions from Will and Suzuki.
This series adds missing 32 bit system registers (ID_PFR2, ID_DFR1 and ID_MMFR5), adds missing features bits on all existing system registers (32 and 64 bit) and some other miscellaneous changes. While here it also includes a patch which does macro replacement for various open bits shift encodings for various CPU ID registers. There is a slight re-order of the patches here as compared to the previous version (V1).
This series is based on arm64 tree (for-next/cpufeature). All feature bits enabled here can be referred in ARM DDI 0487F.a specification. Though I have tried to select appropriate values for each new feature being added here, there might be some inconsistencies (or mistakes). In which case, please do let me know if anything needs to change. Thank you.
[1] https://patchwork.kernel.org/patch/11287805/
Changes in V3:
- Rebased on git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git (for-next/cpufeature)
Changes in V2: (https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=270605)
- Added Suggested-by tag from Mark Rutland for all changes he had proposed
- Added comment for SpecSEI feature on why it is HIGHER_SAFE per Suzuki
- Added a patch which makes ID_AA64DFR0_DOUBLELOCK a signed feature per Suzuki
- Added ID_DFR1 and ID_MMFR5 system register definitions per Will
- Added remaining features bits for relevant 64 bit system registers per Will
- Changed commit message on [PATCH 5/7] regarding TraceFilt feature per Suzuki
- Changed ID_PFR2.CSV3 (FTR_STRICT -> FTR_NONSTRICT) as 64 bit registers per Will
- Changed ID_PFR0.CSV2 (FTR_STRICT -> FTR_NONSTRICT) as 64 bit registers per Will
- Changed some commit messages
Changes in V1: (https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=234093)
Anshuman Khandual (16):
arm64/cpufeature: Add explicit ftr_id_isar0[] for ID_ISAR0 register arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register arm64/cpufeature: Make doublelock a signed feature in ID_AA64DFR0 arm64/cpufeature: Introduce ID_PFR2 CPU register arm64/cpufeature: Introduce ID_DFR1 CPU register arm64/cpufeature: Introduce ID_MMFR5 CPU register arm64/cpufeature: Add remaining feature bits in ID_PFR0 register arm64/cpufeature: Add remaining feature bits in ID_MMFR4 register arm64/cpufeature: Add remaining feature bits in ID_AA64ISAR0 register arm64/cpufeature: Add remaining feature bits in ID_AA64PFR0 register arm64/cpufeature: Add remaining feature bits in ID_AA64PFR1 register arm64/cpufeature: Add remaining feature bits in ID_AA64MMFR0 register arm64/cpufeature: Add remaining feature bits in ID_AA64MMFR1 register arm64/cpufeature: Add remaining feature bits in ID_AA64MMFR2 register arm64/cpufeature: Add remaining feature bits in ID_AA64DFR0 register arm64/cpufeature: Replace all open bits shift encodings with macros
arch/arm64/include/asm/cpu.h | 3 + arch/arm64/include/asm/sysreg.h | 90 ++++++++++++++++++++ arch/arm64/kernel/cpufeature.c | 141 +++++++++++++++++++++++++------- arch/arm64/kernel/cpuinfo.c | 3 + arch/arm64/kvm/sys_regs.c | 6 +- 5 files changed, 211 insertions(+), 32 deletions(-)
Signature · 1 line
2.20.1
PATCH v3 1/16 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.
--- arch/arm64/include/asm/sysreg.h | 8 ++++++++ arch/arm64/kernel/cpufeature.c | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-)
arch/arm64/include/asm/sysreg.h +8 -0
@@ -762,6 +762,14 @@#define ID_ISAR4_WITHSHIFTS_SHIFT 4#define ID_ISAR4_UNPRIV_SHIFT 0 +#define ID_ISAR0_DIVIDE_SHIFT 24 +#define ID_ISAR0_DEBUG_SHIFT 20 +#define ID_ISAR0_COPROC_SHIFT 16 +#define ID_ISAR0_CMPBRANCH_SHIFT 12 +#define ID_ISAR0_BITFIELD_SHIFT 8 +#define ID_ISAR0_BITCOUNT_SHIFT 4 +#define ID_ISAR0_SWAP_SHIFT 0 +#define ID_ISAR5_RDM_SHIFT 24#define ID_ISAR5_CRC32_SHIFT 16#define ID_ISAR5_SHA2_SHIFT 12
arch/arm64/kernel/cpufeature.c +12 -2
@@ -365,6 +365,16 @@ static const struct arm64_ftr_bits ftr_dczid[] = { ARM64_FTR_END, }; +static const struct arm64_ftr_bits ftr_id_isar0[] = { +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR0_DIVIDE_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR0_DEBUG_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR0_COPROC_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR0_CMPBRANCH_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR0_BITFIELD_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR0_BITCOUNT_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR0_SWAP_SHIFT ,4 ,0 ), +ARM64_FTR_END , +};static const struct arm64_ftr_bits ftr_id_isar5[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR5_RDM_SHIFT ,4 ,0 ),
@@ -446,7 +456,7 @@ static const struct arm64_ftr_bits ftr_zcr[] = {* Common ftr bits for a 32bit register with all hidden, strict * attributes, with 4bit feature fields and a default safe value of * 0. Covers the following 32bit registers: -* id_isar[0-4], id_mmfr[1-3], id_pfr1, mvfr[0-1] +* id_isar[1-4], id_mmfr[1-3], id_pfr1, mvfr[0-1] */ static const struct arm64_ftr_bits ftr_generic_32bits[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,28 ,4 ,0 ),
@@ -492,7 +502,7 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG (SYS_ID_MMFR3_EL1 , ftr_generic_32bits),/* Op1 = 0, CRn = 0, CRm = 2 */ -ARM64_FTR_REG (SYS_ID_ISAR0_EL1 , ftr_generic_32bits), +ARM64_FTR_REG (SYS_ID_ISAR0_EL1 , ftr_id_isar0),ARM64_FTR_REG (SYS_ID_ISAR1_EL1 , ftr_generic_32bits),ARM64_FTR_REG (SYS_ID_ISAR2_EL1 , ftr_generic_32bits), ARM64_FTR_REG(SYS_ID_ISAR3_EL1, ftr_generic_32bits),
Signature · 1 line
2.20.1
PATCH v3 2/16 arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register
In reply to Anshuman KhandualID_DFR0 based TraceFilt feature should not be exposed to guests. Hence lets drop it.
--- arch/arm64/kernel/cpufeature.c | 1 - 1 file changed, 1 deletion(-)
arch/arm64/kernel/cpufeature.c +0 -1
@@ -435,7 +435,6 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = { };static const struct arm64_ftr_bits ftr_id_dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,28 ,4 ,0 ),S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,24 ,4 ,0xf ),/* PerfMon */ ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,20 ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,16 ,4 ,0 ),
Signature · 1 line
2.20.1
Will Deacon
maintainerRe: [PATCH V3 02/16] arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register
Quoted 24 lines · Anshuman Khandual
ID_DFR0based TraceFilt feature should not be exposed to guests. Hence lets drop it.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/kernel/cpufeature.c | 1 - 1 file changed, 1 deletion(-)arch/arm64/kernel/cpufeature.c +0
-0
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_pfr1[] = { · line 438
Quoted 4 lines
arch/arm64/kernel/cpufeature.c +0
-1@@ -435,7 +435,6 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = { };static const struct arm64_ftr_bits ftr_id_dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,28 ,4 ,0 ),
Hmm, this still confuses me. Is this not now FTR_NONSTRICT? Why is that ok?
Will
Re: [PATCH V3 02/16] arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register
Quoted 27 lines · Will Deacon
Quoted 26 lines · Anshuman Khandual
ID_DFR0based TraceFilt feature should not be exposed to guests. Hence lets drop it.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/kernel/cpufeature.c | 1 - 1 file changed, 1 deletion(-)arch/arm64/kernel/cpufeature.c +0
-0@@ -435,7 +435,6 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = { };
Quoted 4 lines
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_pfr1[] = { · line 438
Quoted 2 lines
arch/arm64/kernel/cpufeature.c +0
-1static const struct arm64_ftr_bits ftr_id_dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,28 ,4 ,0 ),Hmm, this still confuses me. Is this not now
FTR_NONSTRICT? Why is that ok?
Mark had mentioned about it earlier (https://patchwork.kernel.org/patch/11287805/)
Did I misinterpret the first part ? Could not figure "capping the emulated debug features" part. Probably, Mark could give some more details.
From the earlier discussion:
* ID_DFR0 fields need more thought; we should limit what we expose here. I don't think it's valid for us to expose TraceFilt, and I suspect we need to add capping for debug features we currently emulate.
Will Deacon
maintainerRe: [PATCH V3 02/16] arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register
Quoted 37 lines · Anshuman Khandual
Quoted 27 lines · Will Deacon
Quoted 26 lines · Anshuman Khandual
ID_DFR0based TraceFilt feature should not be exposed to guests. Hence lets drop it.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/kernel/cpufeature.c | 1 - 1 file changed, 1 deletion(-)arch/arm64/kernel/cpufeature.c +0
-0@@ -435,7 +435,6 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = { };Quoted 4 lines
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_pfr1[] = { · line 438
Quoted 2 lines
arch/arm64/kernel/cpufeature.c +0
-1static const struct arm64_ftr_bits ftr_id_dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,28 ,4 ,0 ),Hmm, this still confuses me. Is this not now
FTR_NONSTRICT? Why is that ok?Mark had mentioned about it earlier (https://patchwork.kernel.org/patch/11287805/)
Did I misinterpret the first part ? Could not figure "capping the emulated debug features" part. Probably, Mark could give some more details.
Quoted 5 lines
From the earlier discussion:
*
ID_DFR0fields need more thought; we should limit what we expose here. I don't think it's valid for us to expose TraceFilt, and I suspect we need to add capping for debug features we currently emulate.
Sorry, I for confused (again) by the cpufeature code :) I'm going to add the following to my comment:
arch/arm64/kernel/cpufeature.c +5 -0
@@ -53,6 +53,11 @@* arbitrary physical CPUs, but some features not present on the host are * also advertised and emulated. Look at sys_reg_descs[] for the gory * details. +* +* - If the arm64_ftr_bits[] for a register has a missing field, then this +* field is treated as STRICT RES0, including for read_sanitised_ftr_reg(). +* This is stronger than FTR_HIDDEN and can be used to hide features from +* KVM guests. */ #define pr_fmt (fmt) "CPU features: " fmt
However, I think we really want to get rid of ftr_generic_32bits[] entirely and spell out all of the register fields, even just using comments for the fields we're omitting:
@@ -425,7 +430,7 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = {
};
static const struct arm64_ftr_bits ftr_id_dfr0[] = {
- ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, 28, 4, 0),
+ /* 31:28 TraceFilt */
S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, 24, 4, 0xf), /* PerfMon */
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, 20, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, 16, 4, 0),
Longer term, I think we'll probably want to handle these within ARM64_FTR_BITS, as we may end up with features that we want to hide from KVM guests but not from the host kernel.
Will
Re: [PATCH V3 02/16] arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register
Quoted 55 lines · Will Deacon
Quoted 37 lines · Anshuman Khandual
Quoted 27 lines · Will Deacon
Quoted 26 lines · Anshuman Khandual
ID_DFR0based TraceFilt feature should not be exposed to guests. Hence lets drop it.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/kernel/cpufeature.c | 1 - 1 file changed, 1 deletion(-)arch/arm64/kernel/cpufeature.c +0
-0@@ -435,7 +435,6 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = { };Quoted 4 lines
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_pfr1[] = { · line 438
Quoted 2 lines
arch/arm64/kernel/cpufeature.c +0
-1static const struct arm64_ftr_bits ftr_id_dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,28 ,4 ,0 ),Hmm, this still confuses me. Is this not now
FTR_NONSTRICT? Why is that ok?Mark had mentioned about it earlier (https://patchwork.kernel.org/patch/11287805/)
Did I misinterpret the first part ? Could not figure "capping the emulated debug features" part. Probably, Mark could give some more details.Quoted 5 lines
From the earlier discussion:
*
ID_DFR0fields need more thought; we should limit what we expose here. I don't think it's valid for us to expose TraceFilt, and I suspect we need to add capping for debug features we currently emulate.Sorry, I for confused (again) by the cpufeature code :) I'm going to add the following to my comment:
arch/arm64/kernel/cpufeature.c +0
-0@@ -53,6 +53,11 @@* arbitrary physical CPUs, but some features not present on the host are
arch/arm64/kernel/cpufeature.c line 63
Quoted 10 lines
arch/arm64/kernel/cpufeature.c +5
-0* also advertised and emulated. Look at sys_reg_descs[] for the gory * details. +* +* - If the arm64_ftr_bits[] for a register has a missing field, then this +* field is treated as STRICT RES0, including for read_sanitised_ftr_reg(). +* This is stronger than FTR_HIDDEN and can be used to hide features from +* KVM guests. */ #define pr_fmt (fmt) "CPU features: " fmt
Wondering if you will take this comment via a separate patch/branch or should I fold it here instead.
Quoted 4 lines
However, I think we really want to get rid of ftr_generic_32bits[] entirely and spell out all of the register fields, even just using comments for the fields we're omitting:
Should we do that later or in this series itself ?
Quoted 13 lines
arch/arm64/kernel/cpufeature.c +1
-1@@ -425,7 +430,7 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = { };static const struct arm64_ftr_bits ftr_id_dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,28 ,4 ,0 ), +/* 31:28 TraceFilt */ S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,24 ,4 ,0xf ),/* PerfMon */ ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,20 ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,16 ,4 ,0 ),
Quoted 3 lines
Longer term, I think we'll probably want to handle these within
ARM64_FTR_BITS, as we may end up with features that we want to hide from KVM guests but not from the host kernel.
Sure, but for now will fold the above changes here.
PATCH v3 3/16 arm64/cpufeature: Make doublelock a signed feature in ID_AA64DFR0
In reply to Anshuman KhandualDouble lock feature can have the following possible values.
0b0000 - Double lock implemented
0b1111 - Double lock not implemented
But in case of a conflict the safe value should be 0b1111. Hence this must be a signed feature instead. Also change FTR_EXACT to FTR_LOWER_SAFE.
--- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/cpufeature.c +1 -1
@@ -338,7 +338,7 @@ static const struct arm64_ftr_bits ftr_id_mmfr0[] = { };static const struct arm64_ftr_bits ftr_id_aa64dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_EXACT ,36 ,28 ,0 ), +S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,36 ,28 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64DFR0_PMSVER_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64DFR0_CTX_CMPS_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64DFR0_WRPS_SHIFT ,4 ,0 ),
Signature · 1 line
2.20.1
Will Deacon
maintainerRe: [PATCH V3 03/16] arm64/cpufeature: Make doublelock a signed feature in ID_AA64DFR0
Quoted 26 lines · Anshuman Khandual
Double lock feature can have the following possible values.
0b0000 - Double lock implemented
0b1111 - Double lock not implementedBut in case of a conflict the safe value should be 0b1111. Hence this must be a signed feature instead. Also change
FTR_EXACTtoFTR_LOWER_SAFE.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kernel/cpufeature.c +0
-0
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_mmfr0[] = { · line 341
Quoted 5 lines
arch/arm64/kernel/cpufeature.c +1
-1@@ -338,7 +338,7 @@ static const struct arm64_ftr_bits ftr_id_mmfr0[] = { };static const struct arm64_ftr_bits ftr_id_aa64dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_EXACT ,36 ,28 ,0 ), +S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,36 ,28 ,0 ),
Wait, isn't this buggered today? Shouldn't that 28 be a 4? I think we really need to:
1. Make it impossible to describe overlapping fields, incomplete registers etc (ideally at build-time)
2. Have a macro that for 4-bit fields so you don't have to type '4' all the time
Suzuki, any ideas how we can make this a bit more robust?
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH V3 03/16] arm64/cpufeature: Make doublelock a signed feature in ID_AA64DFR0
Quoted 29 lines · Will Deacon
Quoted 28 lines · Anshuman Khandual
Double lock feature can have the following possible values.
0b0000 - Double lock implemented
0b1111 - Double lock not implementedBut in case of a conflict the safe value should be 0b1111. Hence this must be a signed feature instead. Also change
FTR_EXACTtoFTR_LOWER_SAFE.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kernel/cpufeature.c +0
-0@@ -338,7 +338,7 @@ static const struct arm64_ftr_bits ftr_id_mmfr0[] = { };
Quoted 5 lines
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_mmfr0[] = { · line 341
Quoted 3 lines
arch/arm64/kernel/cpufeature.c +1
-1static const struct arm64_ftr_bits ftr_id_aa64dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_EXACT ,36 ,28 ,0 ), +S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,36 ,28 ,0 ),Wait, isn't this buggered today? Shouldn't that 28 be a 4? I think we really
Ahh, right. Will fix it.
Quoted 4 lines
need to:
1. Make it impossible to describe overlapping fields, incomplete registers etc (ideally at build-time)
AFICS the _SHIFT defines for a given register must be placed sequentially with dummy place holders (4 bit wide) for any missing fields. In that case we could just call BUILD_BUG_ON() for any possible breakage or overlap. But wondering how and where to loop over these SHIFT values for these registers.
Another way (not build time though) will be to scan through ftr_id_xxx[], fetch individual arm64_ftr_bits (assuming there are dummy entries for non existing fields) and assert that arm6r_ftr_bits[shift, width] validates against the previous arm6r_ftr_bits[shift, width] in an increasing manner.
Either of these methods will require some more thoughts.
Quoted 3 lines
2. Have a macro that for 4-bit fields so you don't have to type '4' all the time
Except for ftr_single32[], all other arm64_ftr_bits entries have the exact same shift value (i.e 4). ARM64_FTR_WIDTH sounds good ?
Quoted 5 lines
Suzuki, any ideas how we can make this a bit more robust?
Will
PATCH v3 4/16 arm64/cpufeature: Introduce ID_PFR2 CPU register
In reply to Anshuman KhandualThis adds basic building blocks required for ID_PFR2 CPU register which provides information about the AArch32 programmers model which must be interpreted along with ID_PFR0 and ID_PFR1 CPU registers. This is added per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 11 +++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-)
arch/arm64/include/asm/cpu.h +1 -0
@@ -46,6 +46,7 @@ struct cpuinfo_arm64 {u32 reg_id_mmfr3;u32 reg_id_pfr0;u32 reg_id_pfr1; +u32 reg_id_pfr2;u32 reg_mvfr0;u32 reg_mvfr1;
arch/arm64/include/asm/sysreg.h +4 -0
@@ -153,6 +153,7 @@#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2) +#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)#define SYS_ID_AA64PFR0_EL1 sys_reg(3, 0, 0, 4, 0)#define SYS_ID_AA64PFR1_EL1 sys_reg(3, 0, 0, 4, 1)
@@ -785,6 +786,9 @@#define ID_ISAR6_DP_SHIFT 4#define ID_ISAR6_JSCVT_SHIFT 0 +#define ID_PFR2_SSBS_SHIFT 4 +#define ID_PFR2_CSV3_SHIFT 0 +#define MVFR0_FPROUND_SHIFT 28#define MVFR0_FPSHVEC_SHIFT 24#define MVFR0_FPSQRT_SHIFT 20
arch/arm64/kernel/cpufeature.c +11 -0
@@ -434,6 +434,12 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = { ARM64_FTR_END, }; +static const struct arm64_ftr_bits ftr_id_pfr2[] = { +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_PFR2_SSBS_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_PFR2_CSV3_SHIFT ,4 ,0 ), +ARM64_FTR_END , +}; +static const struct arm64_ftr_bits ftr_id_dfr0[] = {S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,24 ,4 ,0xf ),/* PerfMon */ ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,20 ,4 ,0 ),
@@ -514,6 +520,7 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG (SYS_MVFR0_EL1 , ftr_generic_32bits),ARM64_FTR_REG (SYS_MVFR1_EL1 , ftr_generic_32bits),ARM64_FTR_REG (SYS_MVFR2_EL1 , ftr_mvfr2), +ARM64_FTR_REG (SYS_ID_PFR2_EL1 , ftr_id_pfr2),/* Op1 = 0, CRn = 0, CRm = 4 */ ARM64_FTR_REG(SYS_ID_AA64PFR0_EL1, ftr_id_aa64pfr0),
@@ -720,6 +727,7 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)init_cpu_ftr_reg (SYS_ID_MMFR3_EL1 , info->reg_id_mmfr3);init_cpu_ftr_reg (SYS_ID_PFR0_EL1 , info->reg_id_pfr0);init_cpu_ftr_reg (SYS_ID_PFR1_EL1 , info->reg_id_pfr1); +init_cpu_ftr_reg (SYS_ID_PFR2_EL1 , info->reg_id_pfr2);init_cpu_ftr_reg (SYS_MVFR0_EL1 , info->reg_mvfr0);init_cpu_ftr_reg (SYS_MVFR1_EL1 , info->reg_mvfr1);init_cpu_ftr_reg (SYS_MVFR2_EL1 , info->reg_mvfr2);
@@ -853,6 +861,8 @@ static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info, info->reg_id_pfr0, boot->reg_id_pfr0); taint |=check_update_ftr_reg (SYS_ID_PFR1_EL1 , cpu, info->reg_id_pfr1, boot->reg_id_pfr1); + taint |=check_update_ftr_reg (SYS_ID_PFR2_EL1 , cpu, + info->reg_id_pfr2, boot->reg_id_pfr2); taint |=check_update_ftr_reg (SYS_MVFR0_EL1 , cpu, info->reg_mvfr0, boot->reg_mvfr0); taint |= check_update_ftr_reg(SYS_MVFR1_EL1, cpu,
@@ -980,6 +990,7 @@ static u64 __read_sysreg_by_encoding(u32 sys_id)switch (sys_id) {read_sysreg_case (SYS_ID_PFR0_EL1 );read_sysreg_case (SYS_ID_PFR1_EL1 ); +read_sysreg_case (SYS_ID_PFR2_EL1 );read_sysreg_case (SYS_ID_DFR0_EL1 );read_sysreg_case (SYS_ID_MMFR0_EL1 );read_sysreg_case (SYS_ID_MMFR1_EL1 );
arch/arm64/kernel/cpuinfo.c +1 -0
@@ -375,6 +375,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info) info->reg_id_mmfr3 =read_cpuid (ID_MMFR3_EL1 ); info->reg_id_pfr0 =read_cpuid (ID_PFR0_EL1 ); info->reg_id_pfr1 =read_cpuid (ID_PFR1_EL1 ); + info->reg_id_pfr2 =read_cpuid (ID_PFR2_EL1 ); info->reg_mvfr0 =read_cpuid (MVFR0_EL1 ); info->reg_mvfr1 =read_cpuid (MVFR1_EL1 );
arch/arm64/kvm/sys_regs.c +1 -1
@@ -1456,7 +1456,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {ID_SANITISED (MVFR1_EL1 ),ID_SANITISED (MVFR2_EL1 ),ID_UNALLOCATED (3 ,3 ), -ID_UNALLOCATED (3 ,4 ), +ID_SANITISED (ID_PFR2_EL1 ),ID_UNALLOCATED (3 ,5 ),ID_UNALLOCATED (3 ,6 ), ID_UNALLOCATED(3,7),
Signature · 1 line
2.20.1
Will Deacon
maintainerRe: [PATCH V3 04/16] arm64/cpufeature: Introduce ID_PFR2 CPU register
Quoted 43 lines · Anshuman Khandual
This adds basic building blocks required for
ID_PFR2CPU register which provides information about the AArch32 programmers model which must be interpreted along withID_PFR0andID_PFR1CPU registers. This is added per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 11 +++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-)arch/arm64/include/asm/cpu.h +1
-0@@ -46,6 +46,7 @@ struct cpuinfo_arm64 {u32 reg_id_mmfr3;u32 reg_id_pfr0;u32 reg_id_pfr1; +u32 reg_id_pfr2;u32 reg_mvfr0;u32 reg_mvfr1;arch/arm64/include/asm/sysreg.h +0
-0
arch/arm64/include/asm/sysreg.h line 156
Quoted 4 lines
arch/arm64/include/asm/sysreg.h +1
-0@@ -153,6 +153,7 @@#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2) +#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)
nit: but please group these defines by name rather than encoding.
Will
Mark Rutland
reviewerRe: [PATCH V3 04/16] arm64/cpufeature: Introduce ID_PFR2 CPU register
Quoted 37 lines · Will Deacon
Quoted 36 lines · Anshuman Khandual
This adds basic building blocks required for
ID_PFR2CPU register which provides information about the AArch32 programmers model which must be interpreted along withID_PFR0andID_PFR1CPU registers. This is added per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 11 +++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-)arch/arm64/include/asm/cpu.h +1
-0@@ -46,6 +46,7 @@ struct cpuinfo_arm64 {u32 reg_id_mmfr3;u32 reg_id_pfr0;u32 reg_id_pfr1; +u32 reg_id_pfr2;
Quoted 13 lines
arch/arm64/include/asm/sysreg.h line 156
Quoted 11 lines
arch/arm64/include/asm/cpu.h +0
-0u32 reg_mvfr0;u32 reg_mvfr1;arch/arm64/include/asm/sysreg.h +1
-0@@ -153,6 +153,7 @@#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2) +#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)nit: but please group these defines by name rather than encoding.
So far we've *always* grouped these by encoding in this file, so can we keep things that way for now? Otherwise we're inconsistent with both schemes.
Mark.
Mark Rutland
reviewerRe: [PATCH V3 04/16] arm64/cpufeature: Introduce ID_PFR2 CPU register
Quoted 52 lines · Mark Rutland
Quoted 37 lines · Will Deacon
Quoted 36 lines · Anshuman Khandual
This adds basic building blocks required for
ID_PFR2CPU register which provides information about the AArch32 programmers model which must be interpreted along withID_PFR0andID_PFR1CPU registers. This is added per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 11 +++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-)arch/arm64/include/asm/cpu.h +1
-0@@ -46,6 +46,7 @@ struct cpuinfo_arm64 {u32 reg_id_mmfr3;u32 reg_id_pfr0;u32 reg_id_pfr1; +u32 reg_id_pfr2;Quoted 13 lines
arch/arm64/include/asm/sysreg.h line 156
Quoted 11 lines
arch/arm64/include/asm/cpu.h +0
-0u32 reg_mvfr0;u32 reg_mvfr1;arch/arm64/include/asm/sysreg.h +1
-0@@ -153,6 +153,7 @@#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2) +#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)nit: but please group these defines by name rather than encoding.
Quoted 3 lines
So far we've *always* grouped these by encoding in this file, so can we keep things that way for now? Otherwise we're inconsistent with both schemes.
Unless you just meant "please put a newline before this" to avoid grouping without affecting ordering, in which case agreed!
Mark.
Will Deacon
maintainerRe: [PATCH V3 04/16] arm64/cpufeature: Introduce ID_PFR2 CPU register
In reply to Mark RutlandQuoted 52 lines · Mark Rutland
Quoted 37 lines · Will Deacon
Quoted 36 lines · Anshuman Khandual
This adds basic building blocks required for
ID_PFR2CPU register which provides information about the AArch32 programmers model which must be interpreted along withID_PFR0andID_PFR1CPU registers. This is added per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 11 +++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-)arch/arm64/include/asm/cpu.h +1
-0@@ -46,6 +46,7 @@ struct cpuinfo_arm64 {u32 reg_id_mmfr3;u32 reg_id_pfr0;u32 reg_id_pfr1; +u32 reg_id_pfr2;Quoted 13 lines
arch/arm64/include/asm/sysreg.h line 156
Quoted 11 lines
arch/arm64/include/asm/cpu.h +0
-0u32 reg_mvfr0;u32 reg_mvfr1;arch/arm64/include/asm/sysreg.h +1
-0@@ -153,6 +153,7 @@#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2) +#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)nit: but please group these defines by name rather than encoding.
Quoted 3 lines
So far we've *always* grouped these by encoding in this file, so can we keep things that way for now? Otherwise we're inconsistent with both schemes.
Hmm, but it's really hard to read sorted that way and we'll end up with duplicate definitions like we had for some of the field offsets already. The only ID register that seems to be out of place atm is MMFR4, which I can move (see below)
Will
--->8
arch/arm64/include/asm/sysreg.h +1 -1
@@ -140,6 +140,7 @@#define SYS_ID_MMFR1_EL1 sys_reg(3, 0, 0, 1, 5)#define SYS_ID_MMFR2_EL1 sys_reg(3, 0, 0, 1, 6)#define SYS_ID_MMFR3_EL1 sys_reg(3, 0, 0, 1, 7) +#define SYS_ID_MMFR4_EL1 sys_reg(3, 0, 0, 2, 6)#define SYS_ID_ISAR0_EL1 sys_reg(3, 0, 0, 2, 0)#define SYS_ID_ISAR1_EL1 sys_reg(3, 0, 0, 2, 1)
@@ -147,7 +148,6 @@#define SYS_ID_ISAR3_EL1 sys_reg(3, 0, 0, 2, 3)#define SYS_ID_ISAR4_EL1 sys_reg(3, 0, 0, 2, 4)#define SYS_ID_ISAR5_EL1 sys_reg(3, 0, 0, 2, 5) -#define SYS_ID_MMFR4_EL1 sys_reg(3, 0, 0, 2, 6)#define SYS_ID_ISAR6_EL1 sys_reg(3, 0, 0, 2, 7)#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)
Mark Rutland
reviewerRe: [PATCH V3 04/16] arm64/cpufeature: Introduce ID_PFR2 CPU register
Quoted 53 lines · Will Deacon
Quoted 52 lines · Mark Rutland
Quoted 50 lines · Will Deacon
Quoted 43 lines · Anshuman Khandual
This adds basic building blocks required for
ID_PFR2CPU register which provides information about the AArch32 programmers model which must be interpreted along withID_PFR0andID_PFR1CPU registers. This is added per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 11 +++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-)arch/arm64/include/asm/cpu.h +1
-0@@ -46,6 +46,7 @@ struct cpuinfo_arm64 {u32 reg_id_mmfr3;u32 reg_id_pfr0;u32 reg_id_pfr1; +u32 reg_id_pfr2;u32 reg_mvfr0;u32 reg_mvfr1;arch/arm64/include/asm/sysreg.h +0
-0arch/arm64/include/asm/sysreg.h line 156
Quoted 4 lines
arch/arm64/include/asm/sysreg.h +1
-0@@ -153,6 +153,7 @@#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2) +#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)nit: but please group these defines by name rather than encoding.
Quoted 6 lines
Quoted 3 lines
So far we've *always* grouped these by encoding in this file, so can we keep things that way for now? Otherwise we're inconsistent with both schemes.
Hmm, but it's really hard to read sorted that way and we'll end up with duplicate definitions like we had for some of the field offsets already.
I appreciate that, and don't disagree that the current scheme is not obvious.
I just want to ensure that we don't make things less consistent, and if we're going to change the scheme in order to make that easier, it should be a separate patch. There'll be other changes like MMFR4_EL1, and we should probably add a comment as to what the policy is either way (e.g. if we're just grouping at the top level, or if that should be sorted too).
Thanks,
Mark.
Quoted 27 lines
The only ID register that seems to be out of place atm is MMFR4, which I can move (see below)
Will
--->8
arch/arm64/include/asm/sysreg.h +1
-1@@ -140,6 +140,7 @@#define SYS_ID_MMFR1_EL1 sys_reg(3, 0, 0, 1, 5)#define SYS_ID_MMFR2_EL1 sys_reg(3, 0, 0, 1, 6)#define SYS_ID_MMFR3_EL1 sys_reg(3, 0, 0, 1, 7) +#define SYS_ID_MMFR4_EL1 sys_reg(3, 0, 0, 2, 6)#define SYS_ID_ISAR0_EL1 sys_reg(3, 0, 0, 2, 0)#define SYS_ID_ISAR1_EL1 sys_reg(3, 0, 0, 2, 1)@@ -147,7 +148,6 @@#define SYS_ID_ISAR3_EL1 sys_reg(3, 0, 0, 2, 3)#define SYS_ID_ISAR4_EL1 sys_reg(3, 0, 0, 2, 4)#define SYS_ID_ISAR5_EL1 sys_reg(3, 0, 0, 2, 5) -#define SYS_ID_MMFR4_EL1 sys_reg(3, 0, 0, 2, 6)#define SYS_ID_ISAR6_EL1 sys_reg(3, 0, 0, 2, 7)#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)
Will Deacon
maintainerRe: [PATCH V3 04/16] arm64/cpufeature: Introduce ID_PFR2 CPU register
Quoted 26 lines · Mark Rutland
Quoted 15 lines · Will Deacon
Quoted 14 lines · Mark Rutland
Quoted 12 lines · Will Deacon
arch/arm64/include/asm/sysreg.h line 156
Quoted 9 lines · Anshuman Khandual
arch/arm64/include/asm/sysreg.h +1
-0@@ -153,6 +153,7 @@#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2) +#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)nit: but please group these defines by name rather than encoding.
Quoted 6 lines
Quoted 3 lines
So far we've *always* grouped these by encoding in this file, so can we keep things that way for now? Otherwise we're inconsistent with both schemes.
Hmm, but it's really hard to read sorted that way and we'll end up with duplicate definitions like we had for some of the field offsets already.
I appreciate that, and don't disagree that the current scheme is not obvious.
Quoted 6 lines
I just want to ensure that we don't make things less consistent, and if we're going to change the scheme in order to make that easier, it should be a separate patch. There'll be other changes like
MMFR4_EL1, and we should probably add a comment as to what the policy is either way (e.g. if we're just grouping at the top level, or if that should be sorted too).
Ok, I added a comment below.
Will
--->8
commit be7ab6a6cdb0a6d7b10883094c2adf96f5d4e1e8
Author: Will Deacon <[email protected]> Date: Tue May 5 13:08:02 2020 +0100
arm64: cpufeature: Group indexed system register definitions by name
Some system registers contain an index in the name (e.g. ID_MMFR<n>_EL1) and, while this index often follows the register encoding, newer additions to the architecture are necessarily tacked on the end. Sorting these registers by encoding therefore becomes a bit of a mess.
Group the indexed system register definitions by name so that it's easier to read and will hopefully reduce the chance of us accidentally introducing duplicate definitions in the future.
arch/arm64/include/asm/sysreg.h +5 -1
@@ -105,6 +105,10 @@#define SYS_DC_CSW sys_insn(1, 0, 7, 10, 2)#define SYS_DC_CISW sys_insn(1, 0, 7, 14, 2) +/* +* System registers, organised loosely by encoding but grouped together +* where the architected name contains an index. e.g. ID_MMFR<n>_EL1. +*/ #define SYS_OSDTRRX_EL1 sys_reg(2, 0, 0, 0, 2)#define SYS_MDCCINT_EL1 sys_reg(2, 0, 0, 2, 0)#define SYS_MDSCR_EL1 sys_reg(2, 0, 0, 2, 2)
@@ -140,6 +144,7 @@#define SYS_ID_MMFR1_EL1 sys_reg(3, 0, 0, 1, 5)#define SYS_ID_MMFR2_EL1 sys_reg(3, 0, 0, 1, 6)#define SYS_ID_MMFR3_EL1 sys_reg(3, 0, 0, 1, 7) +#define SYS_ID_MMFR4_EL1 sys_reg(3, 0, 0, 2, 6)#define SYS_ID_ISAR0_EL1 sys_reg(3, 0, 0, 2, 0)#define SYS_ID_ISAR1_EL1 sys_reg(3, 0, 0, 2, 1)
@@ -147,7 +152,6 @@#define SYS_ID_ISAR3_EL1 sys_reg(3, 0, 0, 2, 3)#define SYS_ID_ISAR4_EL1 sys_reg(3, 0, 0, 2, 4)#define SYS_ID_ISAR5_EL1 sys_reg(3, 0, 0, 2, 5) -#define SYS_ID_MMFR4_EL1 sys_reg(3, 0, 0, 2, 6)#define SYS_ID_ISAR6_EL1 sys_reg(3, 0, 0, 2, 7)#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)
Re: [PATCH V3 04/16] arm64/cpufeature: Introduce ID_PFR2 CPU register
Quoted 27 lines · Will Deacon
Quoted 26 lines · Mark Rutland
Quoted 15 lines · Will Deacon
Quoted 14 lines · Mark Rutland
Quoted 12 lines · Will Deacon
arch/arm64/include/asm/sysreg.h line 156
Quoted 9 lines · Anshuman Khandual
arch/arm64/include/asm/sysreg.h +1
-0@@ -153,6 +153,7 @@#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2) +#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)nit: but please group these defines by name rather than encoding.
Quoted 6 lines
Quoted 3 lines
So far we've *always* grouped these by encoding in this file, so can we keep things that way for now? Otherwise we're inconsistent with both schemes.
Hmm, but it's really hard to read sorted that way and we'll end up with duplicate definitions like we had for some of the field offsets already.
I appreciate that, and don't disagree that the current scheme is not obvious.
Quoted 8 lines
Quoted 6 lines
I just want to ensure that we don't make things less consistent, and if we're going to change the scheme in order to make that easier, it should be a separate patch. There'll be other changes like
MMFR4_EL1, and we should probably add a comment as to what the policy is either way (e.g. if we're just grouping at the top level, or if that should be sorted too).Ok, I added a comment below.
Thanks!
Mark.
Quoted 54 lines
Will
--->8
commit
be7ab6a6cdb0a6d7b10883094c2adf96f5d4e1e8Author: Will Deacon <[email protected]> Date: Tue May 5 13:08:02 2020 +0100arm64: cpufeature: Group indexed system register definitions by name
Some system registers contain an index in the name (e.g. ID_MMFR<n>_EL1) and, while this index often follows the register encoding, newer additions to the architecture are necessarily tacked on the end. Sorting these registers by encoding therefore becomes a bit of a mess.
Group the indexed system register definitions by name so that it's easier to read and will hopefully reduce the chance of us accidentally introducing duplicate definitions in the future.
Signed-off-by Will Deacon <[email protected]>arch/arm64/include/asm/sysreg.h +5
-1@@ -105,6 +105,10 @@#define SYS_DC_CSW sys_insn(1, 0, 7, 10, 2)#define SYS_DC_CISW sys_insn(1, 0, 7, 14, 2) +/* +* System registers, organised loosely by encoding but grouped together +* where the architected name contains an index. e.g. ID_MMFR<n>_EL1. +*/ #define SYS_OSDTRRX_EL1 sys_reg(2, 0, 0, 0, 2)#define SYS_MDCCINT_EL1 sys_reg(2, 0, 0, 2, 0)#define SYS_MDSCR_EL1 sys_reg(2, 0, 0, 2, 2)@@ -140,6 +144,7 @@#define SYS_ID_MMFR1_EL1 sys_reg(3, 0, 0, 1, 5)#define SYS_ID_MMFR2_EL1 sys_reg(3, 0, 0, 1, 6)#define SYS_ID_MMFR3_EL1 sys_reg(3, 0, 0, 1, 7) +#define SYS_ID_MMFR4_EL1 sys_reg(3, 0, 0, 2, 6)#define SYS_ID_ISAR0_EL1 sys_reg(3, 0, 0, 2, 0)#define SYS_ID_ISAR1_EL1 sys_reg(3, 0, 0, 2, 1)@@ -147,7 +152,6 @@#define SYS_ID_ISAR3_EL1 sys_reg(3, 0, 0, 2, 3)#define SYS_ID_ISAR4_EL1 sys_reg(3, 0, 0, 2, 4)#define SYS_ID_ISAR5_EL1 sys_reg(3, 0, 0, 2, 5) -#define SYS_ID_MMFR4_EL1 sys_reg(3, 0, 0, 2, 6)#define SYS_ID_ISAR6_EL1 sys_reg(3, 0, 0, 2, 7)#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)
Re: [PATCH V3 04/16] arm64/cpufeature: Introduce ID_PFR2 CPU register
In reply to Will DeaconQuoted 37 lines · Will Deacon
Quoted 36 lines · Anshuman Khandual
This adds basic building blocks required for
ID_PFR2CPU register which provides information about the AArch32 programmers model which must be interpreted along withID_PFR0andID_PFR1CPU registers. This is added per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 11 +++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-)arch/arm64/include/asm/cpu.h +1
-0@@ -46,6 +46,7 @@ struct cpuinfo_arm64 {u32 reg_id_mmfr3;u32 reg_id_pfr0;u32 reg_id_pfr1; +u32 reg_id_pfr2;
Quoted 13 lines
arch/arm64/include/asm/sysreg.h line 156
Quoted 11 lines
arch/arm64/include/asm/cpu.h +0
-0u32 reg_mvfr0;u32 reg_mvfr1;arch/arm64/include/asm/sysreg.h +1
-0@@ -153,6 +153,7 @@#define SYS_MVFR0_EL1 sys_reg(3, 0, 0, 3, 0)#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2) +#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)nit: but please group these defines by name rather than encoding.
Sure, will do the same for all new register being added in the series.
PATCH v3 5/16 arm64/cpufeature: Introduce ID_DFR1 CPU register
In reply to Anshuman KhandualThis adds basic building blocks required for ID_DFR1 CPU register which provides top level information about the debug system in AArch32 state. This is added per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 3 +++ arch/arm64/kernel/cpufeature.c | 10 ++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-)
arch/arm64/include/asm/cpu.h +1 -0
@@ -33,6 +33,7 @@ struct cpuinfo_arm64 {u64 reg_id_aa64zfr0;u32 reg_id_dfr0; +u32 reg_id_dfr1;u32 reg_id_isar0;u32 reg_id_isar1;u32 reg_id_isar2;
arch/arm64/include/asm/sysreg.h +3 -0
@@ -154,6 +154,7 @@#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2)#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4) +#define SYS_ID_DFR1_EL1 sys_reg(3, 0, 0, 3, 5)#define SYS_ID_AA64PFR0_EL1 sys_reg(3, 0, 0, 4, 0)#define SYS_ID_AA64PFR1_EL1 sys_reg(3, 0, 0, 4, 1)
@@ -763,6 +764,8 @@#define ID_ISAR4_WITHSHIFTS_SHIFT 4#define ID_ISAR4_UNPRIV_SHIFT 0 +#define ID_DFR1_MTPMU_SHIFT 0 +#define ID_ISAR0_DIVIDE_SHIFT 24#define ID_ISAR0_DEBUG_SHIFT 20#define ID_ISAR0_COPROC_SHIFT 16
arch/arm64/kernel/cpufeature.c +10 -0
@@ -451,6 +451,11 @@ static const struct arm64_ftr_bits ftr_id_dfr0[] = { ARM64_FTR_END, }; +static const struct arm64_ftr_bits ftr_id_dfr1[] = { +S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_DFR1_MTPMU_SHIFT ,4 ,0 ), +ARM64_FTR_END , +}; +static const struct arm64_ftr_bits ftr_zcr[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE , ZCR_ELx_LEN_SHIFT, ZCR_ELx_LEN_SIZE,0 ),/* LEN */
@@ -521,6 +526,7 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG (SYS_MVFR1_EL1 , ftr_generic_32bits),ARM64_FTR_REG (SYS_MVFR2_EL1 , ftr_mvfr2),ARM64_FTR_REG (SYS_ID_PFR2_EL1 , ftr_id_pfr2), +ARM64_FTR_REG (SYS_ID_DFR1_EL1 , ftr_id_dfr1),/* Op1 = 0, CRn = 0, CRm = 4 */ ARM64_FTR_REG(SYS_ID_AA64PFR0_EL1, ftr_id_aa64pfr0),
@@ -714,6 +720,7 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)if (id_aa64pfr0_32bit_el0 (info->reg_id_aa64pfr0)) {init_cpu_ftr_reg (SYS_ID_DFR0_EL1 , info->reg_id_dfr0); +init_cpu_ftr_reg (SYS_ID_DFR1_EL1 , info->reg_id_dfr1);init_cpu_ftr_reg (SYS_ID_ISAR0_EL1 , info->reg_id_isar0);init_cpu_ftr_reg (SYS_ID_ISAR1_EL1 , info->reg_id_isar1);init_cpu_ftr_reg (SYS_ID_ISAR2_EL1 , info->reg_id_isar2);
@@ -829,6 +836,8 @@ static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info, taint |=check_update_ftr_reg (SYS_ID_DFR0_EL1 , cpu, info->reg_id_dfr0, boot->reg_id_dfr0); + taint |=check_update_ftr_reg (SYS_ID_DFR1_EL1 , cpu, + info->reg_id_dfr1, boot->reg_id_dfr1); taint |=check_update_ftr_reg (SYS_ID_ISAR0_EL1 , cpu, info->reg_id_isar0, boot->reg_id_isar0); taint |= check_update_ftr_reg(SYS_ID_ISAR1_EL1, cpu,
@@ -992,6 +1001,7 @@ static u64 __read_sysreg_by_encoding(u32 sys_id)read_sysreg_case (SYS_ID_PFR1_EL1 );read_sysreg_case (SYS_ID_PFR2_EL1 );read_sysreg_case (SYS_ID_DFR0_EL1 ); +read_sysreg_case (SYS_ID_DFR1_EL1 );read_sysreg_case (SYS_ID_MMFR0_EL1 );read_sysreg_case (SYS_ID_MMFR1_EL1 );read_sysreg_case (SYS_ID_MMFR2_EL1 );
arch/arm64/kernel/cpuinfo.c +1 -0
@@ -362,6 +362,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)/* Update the 32bit ID registers only if AArch32 is implemented */ if (id_aa64pfr0_32bit_el0 (info->reg_id_aa64pfr0)) { info->reg_id_dfr0 =read_cpuid (ID_DFR0_EL1 ); + info->reg_id_dfr1 =read_cpuid (ID_DFR1_EL1 ); info->reg_id_isar0 =read_cpuid (ID_ISAR0_EL1 ); info->reg_id_isar1 =read_cpuid (ID_ISAR1_EL1 ); info->reg_id_isar2 =read_cpuid (ID_ISAR2_EL1 );
arch/arm64/kvm/sys_regs.c +1 -1
@@ -1457,7 +1457,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {ID_SANITISED (MVFR2_EL1 ),ID_UNALLOCATED (3 ,3 ),ID_SANITISED (ID_PFR2_EL1 ), -ID_UNALLOCATED (3 ,5 ), +ID_SANITISED (ID_DFR1_EL1 ),ID_UNALLOCATED (3 ,6 ), ID_UNALLOCATED(3,7),
Signature · 6 lines
2.20.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Suzuki K Poulose
reviewerRe: [PATCH V3 05/16] arm64/cpufeature: Introduce ID_DFR1 CPU register
Quoted 64 lines · Anshuman Khandual
This adds basic building blocks required for
ID_DFR1CPU register which provides top level information about the debug system in AArch32 state. This is added per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Will Deacon <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 3 +++ arch/arm64/kernel/cpufeature.c | 10 ++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-)arch/arm64/include/asm/cpu.h +1
-0@@ -33,6 +33,7 @@ struct cpuinfo_arm64 {u64 reg_id_aa64zfr0;u32 reg_id_dfr0; +u32 reg_id_dfr1;u32 reg_id_isar0;u32 reg_id_isar1;u32 reg_id_isar2;arch/arm64/include/asm/sysreg.h +3
-0@@ -154,6 +154,7 @@#define SYS_MVFR1_EL1 sys_reg(3, 0, 0, 3, 1)#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2)#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4) +#define SYS_ID_DFR1_EL1 sys_reg(3, 0, 0, 3, 5)#define SYS_ID_AA64PFR0_EL1 sys_reg(3, 0, 0, 4, 0)#define SYS_ID_AA64PFR1_EL1 sys_reg(3, 0, 0, 4, 1)@@ -763,6 +764,8 @@#define ID_ISAR4_WITHSHIFTS_SHIFT 4#define ID_ISAR4_UNPRIV_SHIFT 0 +#define ID_DFR1_MTPMU_SHIFT 0 +#define ID_ISAR0_DIVIDE_SHIFT 24#define ID_ISAR0_DEBUG_SHIFT 20#define ID_ISAR0_COPROC_SHIFT 16arch/arm64/kernel/cpufeature.c +0
-0@@ -451,6 +451,11 @@ static const struct arm64_ftr_bits ftr_id_dfr0[] = { ARM64_FTR_END,
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_dfr0[] = {
Quoted 10 lines
arch/arm64/kernel/cpufeature.c +3
-1}; +static const struct arm64_ftr_bits ftr_id_dfr1[] = { +S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_DFR1_MTPMU_SHIFT ,4 ,0 ), -ID_UNALLOCATED (3 ,5 ), +ID_SANITISED (ID_DFR1_EL1 ),ID_UNALLOCATED (3 ,6 ),ID_UNALLOCATED (3 ,7 ),
IIUC, we should not expose the MTPMU to the KVM guests. Either we could drop this entire patch, or we should emulate the MTPMU to 0 in KVM.
Suzuki
PATCH v3 6/16 arm64/cpufeature: Introduce ID_MMFR5 CPU register
In reply to Anshuman KhandualThis adds basic building blocks required for ID_MMFR5 CPU register which provides information about the implemented memory model and memory management support in AArch32 state. This is added per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 3 +++ arch/arm64/kernel/cpufeature.c | 10 ++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-)
arch/arm64/include/asm/cpu.h +1 -0
@@ -45,6 +45,7 @@ struct cpuinfo_arm64 {u32 reg_id_mmfr1;u32 reg_id_mmfr2;u32 reg_id_mmfr3; +u32 reg_id_mmfr5;u32 reg_id_pfr0;u32 reg_id_pfr1;u32 reg_id_pfr2;
arch/arm64/include/asm/sysreg.h +3 -0
@@ -155,6 +155,7 @@#define SYS_MVFR2_EL1 sys_reg(3, 0, 0, 3, 2)#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)#define SYS_ID_DFR1_EL1 sys_reg(3, 0, 0, 3, 5) +#define SYS_ID_MMFR5_EL1 sys_reg(3, 0, 0, 3, 6)#define SYS_ID_AA64PFR0_EL1 sys_reg(3, 0, 0, 4, 0)#define SYS_ID_AA64PFR1_EL1 sys_reg(3, 0, 0, 4, 1)
@@ -789,6 +790,8 @@#define ID_ISAR6_DP_SHIFT 4#define ID_ISAR6_JSCVT_SHIFT 0 +#define ID_MMFR5_ETS_SHIFT 0 +#define ID_PFR2_SSBS_SHIFT 4#define ID_PFR2_CSV3_SHIFT 0
arch/arm64/kernel/cpufeature.c +10 -0
@@ -403,6 +403,11 @@ static const struct arm64_ftr_bits ftr_id_isar4[] = { ARM64_FTR_END, }; +static const struct arm64_ftr_bits ftr_id_mmfr5[] = { +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_MMFR5_ETS_SHIFT ,4 ,0 ), +ARM64_FTR_END , +}; +static const struct arm64_ftr_bits ftr_id_isar6[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR6_I8MM_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR6_BF16_SHIFT ,4 ,0 ),
@@ -527,6 +532,7 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG (SYS_MVFR2_EL1 , ftr_mvfr2),ARM64_FTR_REG (SYS_ID_PFR2_EL1 , ftr_id_pfr2),ARM64_FTR_REG (SYS_ID_DFR1_EL1 , ftr_id_dfr1), +ARM64_FTR_REG (SYS_ID_MMFR5_EL1 , ftr_id_mmfr5),/* Op1 = 0, CRn = 0, CRm = 4 */ ARM64_FTR_REG(SYS_ID_AA64PFR0_EL1, ftr_id_aa64pfr0),
@@ -732,6 +738,7 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)init_cpu_ftr_reg (SYS_ID_MMFR1_EL1 , info->reg_id_mmfr1);init_cpu_ftr_reg (SYS_ID_MMFR2_EL1 , info->reg_id_mmfr2);init_cpu_ftr_reg (SYS_ID_MMFR3_EL1 , info->reg_id_mmfr3); +init_cpu_ftr_reg (SYS_ID_MMFR5_EL1 , info->reg_id_mmfr5);init_cpu_ftr_reg (SYS_ID_PFR0_EL1 , info->reg_id_pfr0);init_cpu_ftr_reg (SYS_ID_PFR1_EL1 , info->reg_id_pfr1);init_cpu_ftr_reg (SYS_ID_PFR2_EL1 , info->reg_id_pfr2);
@@ -866,6 +873,8 @@ static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info, info->reg_id_mmfr2, boot->reg_id_mmfr2); taint |=check_update_ftr_reg (SYS_ID_MMFR3_EL1 , cpu, info->reg_id_mmfr3, boot->reg_id_mmfr3); + taint |=check_update_ftr_reg (SYS_ID_MMFR5_EL1 , cpu, + info->reg_id_mmfr5, boot->reg_id_mmfr5); taint |=check_update_ftr_reg (SYS_ID_PFR0_EL1 , cpu, info->reg_id_pfr0, boot->reg_id_pfr0); taint |= check_update_ftr_reg(SYS_ID_PFR1_EL1, cpu,
@@ -1006,6 +1015,7 @@ static u64 __read_sysreg_by_encoding(u32 sys_id)read_sysreg_case (SYS_ID_MMFR1_EL1 );read_sysreg_case (SYS_ID_MMFR2_EL1 );read_sysreg_case (SYS_ID_MMFR3_EL1 ); +read_sysreg_case (SYS_ID_MMFR5_EL1 );read_sysreg_case (SYS_ID_ISAR0_EL1 );read_sysreg_case (SYS_ID_ISAR1_EL1 );read_sysreg_case (SYS_ID_ISAR2_EL1 );
arch/arm64/kernel/cpuinfo.c +1 -0
@@ -374,6 +374,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info) info->reg_id_mmfr1 =read_cpuid (ID_MMFR1_EL1 ); info->reg_id_mmfr2 =read_cpuid (ID_MMFR2_EL1 ); info->reg_id_mmfr3 =read_cpuid (ID_MMFR3_EL1 ); + info->reg_id_mmfr5 =read_cpuid (ID_MMFR5_EL1 ); info->reg_id_pfr0 =read_cpuid (ID_PFR0_EL1 ); info->reg_id_pfr1 =read_cpuid (ID_PFR1_EL1 ); info->reg_id_pfr2 =read_cpuid (ID_PFR2_EL1 );
arch/arm64/kvm/sys_regs.c +1 -1
@@ -1458,7 +1458,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {ID_UNALLOCATED (3 ,3 ),ID_SANITISED (ID_PFR2_EL1 ),ID_SANITISED (ID_DFR1_EL1 ), -ID_UNALLOCATED (3 ,6 ), +ID_SANITISED (ID_MMFR5_EL1 ), ID_UNALLOCATED(3,7),/* AArch64 ID registers */
Signature · 1 line
2.20.1
Will Deacon
maintainerRe: [PATCH V3 06/16] arm64/cpufeature: Introduce ID_MMFR5 CPU register
Quoted 24 lines · Anshuman Khandual
This adds basic building blocks required for
ID_MMFR5CPU register which provides information about the implemented memory model and memory management support in AArch32 state. This is added per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Will Deacon <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 3 +++ arch/arm64/kernel/cpufeature.c | 10 ++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-)
[...]
Quoted 33 lines
arch/arm64/kernel/cpufeature.c +7
-0@@ -403,6 +403,11 @@ static const struct arm64_ftr_bits ftr_id_isar4[] = { ARM64_FTR_END, }; +static const struct arm64_ftr_bits ftr_id_mmfr5[] = { +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_MMFR5_ETS_SHIFT ,4 ,0 ), +ARM64_FTR_END , +}; +static const struct arm64_ftr_bits ftr_id_isar6[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR6_I8MM_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR6_BF16_SHIFT ,4 ,0 ),@@ -527,6 +532,7 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG (SYS_MVFR2_EL1 , ftr_mvfr2),ARM64_FTR_REG (SYS_ID_PFR2_EL1 , ftr_id_pfr2),ARM64_FTR_REG (SYS_ID_DFR1_EL1 , ftr_id_dfr1), +ARM64_FTR_REG (SYS_ID_MMFR5_EL1 , ftr_id_mmfr5),/* Op1 = 0, CRn = 0, CRm = 4 */ ARM64_FTR_REG(SYS_ID_AA64PFR0_EL1, ftr_id_aa64pfr0),@@ -732,6 +738,7 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)init_cpu_ftr_reg (SYS_ID_MMFR1_EL1 , info->reg_id_mmfr1);init_cpu_ftr_reg (SYS_ID_MMFR2_EL1 , info->reg_id_mmfr2);init_cpu_ftr_reg (SYS_ID_MMFR3_EL1 , info->reg_id_mmfr3); +init_cpu_ftr_reg (SYS_ID_MMFR5_EL1 , info->reg_id_mmfr5);init_cpu_ftr_reg (SYS_ID_PFR0_EL1 , info->reg_id_pfr0);init_cpu_ftr_reg (SYS_ID_PFR1_EL1 , info->reg_id_pfr1);init_cpu_ftr_reg (SYS_ID_PFR2_EL1 , info->reg_id_pfr2);
arch/arm64/kernel/cpufeature.c static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info, · line 875
Quoted 3 lines
arch/arm64/kernel/cpufeature.c +0
-0@@ -866,6 +873,8 @@ static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info, info->reg_id_mmfr2, boot->reg_id_mmfr2); taint |=check_update_ftr_reg (SYS_ID_MMFR3_EL1 , cpu, info->reg_id_mmfr3, boot->reg_id_mmfr3);
Looks like MMFR4 is missing here?
arch/arm64/kernel/cpufeature.c static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info, · line 877
Quoted 2 lines
arch/arm64/kernel/cpufeature.c +2
-0+ taint |=check_update_ftr_reg (SYS_ID_MMFR5_EL1 , cpu, + info->reg_id_mmfr5, boot->reg_id_mmfr5);
Will
Re: [PATCH V3 06/16] arm64/cpufeature: Introduce ID_MMFR5 CPU register
Quoted 50 lines · Will Deacon
Quoted 24 lines · Anshuman Khandual
This adds basic building blocks required for
ID_MMFR5CPU register which provides information about the implemented memory model and memory management support in AArch32 state. This is added per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Cc James Morse <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Will Deacon <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 3 +++ arch/arm64/kernel/cpufeature.c | 10 ++++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-)[...]
Quoted 22 lines
arch/arm64/kernel/cpufeature.c +6
-0@@ -403,6 +403,11 @@ static const struct arm64_ftr_bits ftr_id_isar4[] = { ARM64_FTR_END, }; +static const struct arm64_ftr_bits ftr_id_mmfr5[] = { +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_MMFR5_ETS_SHIFT ,4 ,0 ), +ARM64_FTR_END , +}; +static const struct arm64_ftr_bits ftr_id_isar6[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR6_I8MM_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_ISAR6_BF16_SHIFT ,4 ,0 ),@@ -527,6 +532,7 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG (SYS_MVFR2_EL1 , ftr_mvfr2),ARM64_FTR_REG (SYS_ID_PFR2_EL1 , ftr_id_pfr2),ARM64_FTR_REG (SYS_ID_DFR1_EL1 , ftr_id_dfr1), + ARM64_FTR_REG(SYS_ID_MMFR5_EL1, ftr_id_mmfr5),
Quoted 16 lines
Quoted 11 lines
arch/arm64/kernel/cpufeature.c +1
-0/* Op1 = 0, CRn = 0, CRm = 4 */ ARM64_FTR_REG(SYS_ID_AA64PFR0_EL1, ftr_id_aa64pfr0),@@ -732,6 +738,7 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)init_cpu_ftr_reg (SYS_ID_MMFR1_EL1 , info->reg_id_mmfr1);init_cpu_ftr_reg (SYS_ID_MMFR2_EL1 , info->reg_id_mmfr2);init_cpu_ftr_reg (SYS_ID_MMFR3_EL1 , info->reg_id_mmfr3); +init_cpu_ftr_reg (SYS_ID_MMFR5_EL1 , info->reg_id_mmfr5);init_cpu_ftr_reg (SYS_ID_PFR0_EL1 , info->reg_id_pfr0);init_cpu_ftr_reg (SYS_ID_PFR1_EL1 , info->reg_id_pfr1);init_cpu_ftr_reg (SYS_ID_PFR2_EL1 , info->reg_id_pfr2);arch/arm64/kernel/cpufeature.c static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info, · line 875
Quoted 3 lines
arch/arm64/kernel/cpufeature.c +0
-0@@ -866,6 +873,8 @@ static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info, info->reg_id_mmfr2, boot->reg_id_mmfr2); taint |=check_update_ftr_reg (SYS_ID_MMFR3_EL1 , cpu, info->reg_id_mmfr3, boot->reg_id_mmfr3);Looks like MMFR4 is missing here?
ID_MMFR4 is missing from cpuinfo_arm64 itself, hence from init_cpu_features() and update_cpu_features() as well. But it is defined in arm64_ftr_regs[]. I was wondering about it but left as it is (due to lack of complete context). Unless there is any other concern, will add it up in cpuinfo_arm64 and make it a part of the CPU context.
PATCH v3 7/16 arm64/cpufeature: Add remaining feature bits in ID_PFR0 register
In reply to Anshuman KhandualEnable DIT and CSV2 feature bits in ID_PFR0 register as per ARM DDI 0487F.a specification. Except RAS and AMU, all other feature bits are now enabled.
--- arch/arm64/include/asm/sysreg.h | 3 +++ arch/arm64/kernel/cpufeature.c | 2 ++ 2 files changed, 5 insertions(+)
arch/arm64/include/asm/sysreg.h +3 -0
@@ -792,6 +792,9 @@#define ID_MMFR5_ETS_SHIFT 0 +#define ID_PFR0_DIT_SHIFT 24 +#define ID_PFR0_CSV2_SHIFT 16 +#define ID_PFR2_SSBS_SHIFT 4#define ID_PFR2_CSV3_SHIFT 0
arch/arm64/kernel/cpufeature.c +2 -0
@@ -420,6 +420,8 @@ static const struct arm64_ftr_bits ftr_id_isar6[] = { };static const struct arm64_ftr_bits ftr_id_pfr0[] = { +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_PFR0_DIT_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_PFR0_CSV2_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,12 ,4 ,0 ),/* State3 */ ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,8 ,4 ,0 ),/* State2 */ ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,4 ,4 ,0 ),/* State1 */
Signature · 1 line
2.20.1
PATCH v3 8/16 arm64/cpufeature: Add remaining feature bits in ID_MMFR4 register
In reply to Anshuman KhandualEnable all remaining feature bits like EVT, CCIDX, LSM, HPDS, CnP, XNX, SpecSEI in ID_MMFR4 register per ARM DDI 0487F.a.
--- arch/arm64/include/asm/sysreg.h | 8 ++++++++ arch/arm64/kernel/cpufeature.c | 13 +++++++++++++ 2 files changed, 21 insertions(+)
arch/arm64/include/asm/sysreg.h +8 -0
@@ -790,6 +790,14 @@#define ID_ISAR6_DP_SHIFT 4#define ID_ISAR6_JSCVT_SHIFT 0 +#define ID_MMFR4_EVT_SHIFT 28 +#define ID_MMFR4_CCIDX_SHIFT 24 +#define ID_MMFR4_LSM_SHIFT 20 +#define ID_MMFR4_HPDS_SHIFT 16 +#define ID_MMFR4_CNP_SHIFT 12 +#define ID_MMFR4_XNX_SHIFT 8 +#define ID_MMFR4_SPECSEI_SHIFT 0 +#define ID_MMFR5_ETS_SHIFT 0#define ID_PFR0_DIT_SHIFT 24
arch/arm64/kernel/cpufeature.c +13 -0
@@ -387,7 +387,20 @@ static const struct arm64_ftr_bits ftr_id_isar5[] = { };static const struct arm64_ftr_bits ftr_id_mmfr4[] = { +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_MMFR4_EVT_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_MMFR4_CCIDX_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_MMFR4_LSM_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_MMFR4_HPDS_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_MMFR4_CNP_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_MMFR4_XNX_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,4 ,4 ,0 ),/* ac2 */ +/* +* SpecSEI = 1 indicates that the PE might generate an SError on an +* external abort on speculative read. It is safe to assume that an +* SError might be generated than it will not be. Hence it has been +* classified as FTR_HIGHER_SAFE. +*/ +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_HIGHER_SAFE ,ID_MMFR4_SPECSEI_SHIFT ,4 ,0 ),ARM64_FTR_END , };
Signature · 1 line
2.20.1
Will Deacon
maintainerRe: [PATCH V3 08/16] arm64/cpufeature: Add remaining feature bits in ID_MMFR4 register
Quoted 23 lines · Anshuman Khandual
Enable all remaining feature bits like EVT, CCIDX, LSM, HPDS, CnP, XNX, SpecSEI in
ID_MMFR4register per ARM DDI 0487F.a.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/sysreg.h | 8 ++++++++ arch/arm64/kernel/cpufeature.c | 13 +++++++++++++ 2 files changed, 21 insertions(+)arch/arm64/include/asm/sysreg.h +0
-0
arch/arm64/include/asm/sysreg.h line 798
Quoted 9 lines
arch/arm64/include/asm/sysreg.h +6
-0@@ -790,6 +790,14 @@#define ID_ISAR6_DP_SHIFT 4#define ID_ISAR6_JSCVT_SHIFT 0 +#define ID_MMFR4_EVT_SHIFT 28 +#define ID_MMFR4_CCIDX_SHIFT 24 +#define ID_MMFR4_LSM_SHIFT 20 +#define ID_MMFR4_HPDS_SHIFT 16 +#define ID_MMFR4_CNP_SHIFT 12 +#define ID_MMFR4_XNX_SHIFT 8
Why didn't you add ID_MMFR4_AC2_SHIFT as well?
Will
Re: [PATCH V3 08/16] arm64/cpufeature: Add remaining feature bits in ID_MMFR4 register
Quoted 27 lines · Will Deacon
Quoted 26 lines · Anshuman Khandual
Enable all remaining feature bits like EVT, CCIDX, LSM, HPDS, CnP, XNX, SpecSEI in
ID_MMFR4register per ARM DDI 0487F.a.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Mark Rutland <[email protected]>Reviewed-by Suzuki K Poulose <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/sysreg.h | 8 ++++++++ arch/arm64/kernel/cpufeature.c | 13 +++++++++++++ 2 files changed, 21 insertions(+)arch/arm64/include/asm/sysreg.h +0
-0@@ -790,6 +790,14 @@#define ID_ISAR6_DP_SHIFT 4#define ID_ISAR6_JSCVT_SHIFT 0
Quoted 8 lines
arch/arm64/include/asm/sysreg.h line 798
Quoted 6 lines
arch/arm64/include/asm/sysreg.h +6
-0+#define ID_MMFR4_EVT_SHIFT 28 +#define ID_MMFR4_CCIDX_SHIFT 24 +#define ID_MMFR4_LSM_SHIFT 20 +#define ID_MMFR4_HPDS_SHIFT 16 +#define ID_MMFR4_CNP_SHIFT 12 +#define ID_MMFR4_XNX_SHIFT 8Why didn't you add
ID_MMFR4_AC2_SHIFTas well?
ID_MMFR4_AC2_SHIFT, which will be the replacement for an existing hard coded bits shift encoding ('4') is being added via [PATCH 16/16] where we replace all existing open encodings.
PATCH v3 9/16 arm64/cpufeature: Add remaining feature bits in ID_AA64ISAR0 register
In reply to Anshuman KhandualEnable TLB features bit in ID_AA64ISAR0 register as per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/sysreg.h | 1 + arch/arm64/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+)
arch/arm64/include/asm/sysreg.h +1 -0
@@ -597,6 +597,7 @@/* id_aa64isar0 */ #define ID_AA64ISAR0_RNDR_SHIFT 60 +#define ID_AA64ISAR0_TLB_SHIFT 56#define ID_AA64ISAR0_TS_SHIFT 52#define ID_AA64ISAR0_FHM_SHIFT 48#define ID_AA64ISAR0_DP_SHIFT 44
arch/arm64/kernel/cpufeature.c +1 -0
@@ -174,6 +174,7 @@ static bool __system_matches_cap(unsigned int n);*/ static const struct arm64_ftr_bits ftr_id_aa64isar0[] = {ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR0_RNDR_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR0_TLB_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR0_TS_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR0_FHM_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR0_DP_SHIFT ,4 ,0 ),
Signature · 1 line
2.20.1
Suzuki K Poulose
reviewerRe: [PATCH V3 09/16] arm64/cpufeature: Add remaining feature bits in ID_AA64ISAR0 register
Quoted 34 lines · Anshuman Khandual
Enable TLB features bit in
ID_AA64ISAR0register as per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Will Deacon <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/sysreg.h | 1 + arch/arm64/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+)arch/arm64/include/asm/sysreg.h +1
-0@@ -597,6 +597,7 @@/* id_aa64isar0 */ #define ID_AA64ISAR0_RNDR_SHIFT 60 +#define ID_AA64ISAR0_TLB_SHIFT 56#define ID_AA64ISAR0_TS_SHIFT 52#define ID_AA64ISAR0_FHM_SHIFT 48#define ID_AA64ISAR0_DP_SHIFT 44arch/arm64/kernel/cpufeature.c +0
-0
arch/arm64/kernel/cpufeature.c static bool __system_matches_cap(unsigned int n); · line 177
Quoted 4 lines
arch/arm64/kernel/cpufeature.c +1
-0@@ -174,6 +174,7 @@ static bool __system_matches_cap(unsigned int n);*/ static const struct arm64_ftr_bits ftr_id_aa64isar0[] = {ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR0_RNDR_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR0_TLB_SHIFT ,4 ,0 ),
I don't see any reason why this should be VISIBLE to the userspace.
Suzuki
Re: [PATCH V3 09/16] arm64/cpufeature: Add remaining feature bits in ID_AA64ISAR0 register
Quoted 32 lines · Suzuki K Poulose
Quoted 31 lines · Anshuman Khandual
Enable TLB features bit in
ID_AA64ISAR0register as per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Will Deacon <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
arch/arm64/include/asm/sysreg.h| 1 + arch/arm64/kernel/cpufeature.c | 1 +2 files changed, 2 insertions(+)arch/arm64/include/asm/sysreg.h +1
-0@@ -597,6 +597,7 @@ /* id_aa64isar0 */ #define ID_AA64ISAR0_RNDR_SHIFT 60 +#define ID_AA64ISAR0_TLB_SHIFT 56 #define ID_AA64ISAR0_TS_SHIFT 52 #define ID_AA64ISAR0_FHM_SHIFT 48 #define ID_AA64ISAR0_DP_SHIFT 44arch/arm64/kernel/cpufeature.c +0
-1--- a/arch/arm64/kernel/cpufeature.c
Quoted 8 lines
arch/arm64/kernel/cpufeature.c static bool __system_matches_cap(unsigned int n); · line 177
Quoted 6 lines
+++
b/arch/arm64/kernel/cpufeature.carch/arm64/kernel/cpufeature.c +1
-0@@ -174,6 +174,7 @@ static bool __system_matches_cap(unsigned int n);*/ static const struct arm64_ftr_bits ftr_id_aa64isar0[] = { ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR0_RNDR_SHIFT, 4, 0), + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR0_TLB_SHIFT, 4, 0),I don't see any reason why this should be VISIBLE to the userspace.
Okay, will make it FTR_HIDDEN.
PATCH v3 10/16 arm64/cpufeature: Add remaining feature bits in ID_AA64PFR0 register
In reply to Anshuman KhandualEnable MPAM and SEL2 features bits in ID_AA64PFR0 register as per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/sysreg.h | 2 ++ arch/arm64/kernel/cpufeature.c | 2 ++ 2 files changed, 4 insertions(+)
arch/arm64/include/asm/sysreg.h +2 -0
@@ -641,6 +641,8 @@#define ID_AA64PFR0_CSV2_SHIFT 56#define ID_AA64PFR0_DIT_SHIFT 48#define ID_AA64PFR0_AMU_SHIFT 44 +#define ID_AA64PFR0_MPAM_SHIFT 40 +#define ID_AA64PFR0_SEL2_SHIFT 36#define ID_AA64PFR0_SVE_SHIFT 32#define ID_AA64PFR0_RAS_SHIFT 28#define ID_AA64PFR0_GIC_SHIFT 24
arch/arm64/kernel/cpufeature.c +2 -0
@@ -217,6 +217,8 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_CSV2_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_DIT_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_AMU_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_MPAM_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_SEL2_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE_IF_IS_ENABLED (CONFIG_ARM64_SVE ),FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_SVE_SHIFT ,4 ,0 ), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR0_RAS_SHIFT, 4, 0),
Signature · 1 line
2.20.1
Suzuki K Poulose
reviewerRe: [PATCH V3 10/16] arm64/cpufeature: Add remaining feature bits in ID_AA64PFR0 register
Quoted 35 lines · Anshuman Khandual
Enable MPAM and SEL2 features bits in
ID_AA64PFR0register as per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Will Deacon <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/sysreg.h | 2 ++ arch/arm64/kernel/cpufeature.c | 2 ++ 2 files changed, 4 insertions(+)arch/arm64/include/asm/sysreg.h +2
-0@@ -641,6 +641,8 @@#define ID_AA64PFR0_CSV2_SHIFT 56#define ID_AA64PFR0_DIT_SHIFT 48#define ID_AA64PFR0_AMU_SHIFT 44 +#define ID_AA64PFR0_MPAM_SHIFT 40 +#define ID_AA64PFR0_SEL2_SHIFT 36#define ID_AA64PFR0_SVE_SHIFT 32#define ID_AA64PFR0_RAS_SHIFT 28#define ID_AA64PFR0_GIC_SHIFT 24arch/arm64/kernel/cpufeature.c +0
-0
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { · line 221
Quoted 5 lines
arch/arm64/kernel/cpufeature.c +2
-0@@ -217,6 +217,8 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_CSV2_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_DIT_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_AMU_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_MPAM_SHIFT ,4 ,0 ), + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR0_SEL2_SHIFT, 4, 0),
Both of them must be hidden. And also need to check the impact of exposing this to the guests, especially MPAM.
Suzuki
Re: [PATCH V3 10/16] arm64/cpufeature: Add remaining feature bits in ID_AA64PFR0 register
Quoted 35 lines · Suzuki K Poulose
Quoted 34 lines · Anshuman Khandual
Enable MPAM and SEL2 features bits in
ID_AA64PFR0register as per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Will Deacon <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
arch/arm64/include/asm/sysreg.h| 2 ++ arch/arm64/kernel/cpufeature.c | 2 ++2 files changed, 4 insertions(+)arch/arm64/include/asm/sysreg.h +2
-0@@ -641,6 +641,8 @@ #define ID_AA64PFR0_CSV2_SHIFT 56 #define ID_AA64PFR0_DIT_SHIFT 48 #define ID_AA64PFR0_AMU_SHIFT 44 +#define ID_AA64PFR0_MPAM_SHIFT 40 +#define ID_AA64PFR0_SEL2_SHIFT 36 #define ID_AA64PFR0_SVE_SHIFT 32 #define ID_AA64PFR0_RAS_SHIFT 28 #define ID_AA64PFR0_GIC_SHIFT 24arch/arm64/kernel/cpufeature.c +0
-0
Quoted 8 lines
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { · line 221
Quoted 6 lines
arch/arm64/kernel/cpufeature.c +2
-0@@ -217,6 +217,8 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_CSV2_SHIFT, 4, 0), ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR0_DIT_SHIFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_AMU_SHIFT, 4, 0), + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR0_MPAM_SHIFT, 4, 0), + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR0_SEL2_SHIFT, 4, 0),Both of them must be hidden. And also need to check the impact of exposing this to the guests, especially MPAM.
Just trying to understand. We should make both MPAM and SEL2, FTR_HIDDEN for now, in which case they should not be visible to the userspace or guests. But we would need to check impact of their exposure to guests before they can be made visible later on. Is that correct ?
PATCH v3 11/16 arm64/cpufeature: Add remaining feature bits in ID_AA64PFR1 register
In reply to Anshuman KhandualEnable the following features bits in ID_AA64PFR1 register as per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 4 ++++ 2 files changed, 8 insertions(+)
arch/arm64/include/asm/sysreg.h +4 -0
@@ -666,7 +666,11 @@#define ID_AA64PFR0_EL0_32BIT_64BIT 0x2/* id_aa64pfr1 */ +#define ID_AA64PFR1_MPAMFRAC_SHIFT 16 +#define ID_AA64PFR1_RASFRAC_SHIFT 12 +#define ID_AA64PFR1_MTE_SHIFT 8#define ID_AA64PFR1_SSBS_SHIFT 4 +#define ID_AA64PFR1_BT_SHIFT 0#define ID_AA64PFR1_SSBS_PSTATE_NI 0#define ID_AA64PFR1_SSBS_PSTATE_ONLY 1
arch/arm64/kernel/cpufeature.c +4 -0
@@ -233,7 +233,11 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { };static const struct arm64_ftr_bits ftr_id_aa64pfr1[] = { +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR1_MPAMFRAC_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR1_RASFRAC_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR1_MTE_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR1_SSBS_SHIFT ,4 ,ID_AA64PFR1_SSBS_PSTATE_NI ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR1_BT_SHIFT ,4 ,0 ),ARM64_FTR_END , };
Signature · 1 line
2.20.1
Suzuki K Poulose
reviewerRe: [PATCH V3 11/16] arm64/cpufeature: Add remaining feature bits in ID_AA64PFR1 register
Quoted 38 lines · Anshuman Khandual
Enable the following features bits in
ID_AA64PFR1register as per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Will Deacon <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 4 ++++ 2 files changed, 8 insertions(+)arch/arm64/include/asm/sysreg.h +4
-0@@ -666,7 +666,11 @@#define ID_AA64PFR0_EL0_32BIT_64BIT 0x2/* id_aa64pfr1 */ +#define ID_AA64PFR1_MPAMFRAC_SHIFT 16 +#define ID_AA64PFR1_RASFRAC_SHIFT 12 +#define ID_AA64PFR1_MTE_SHIFT 8#define ID_AA64PFR1_SSBS_SHIFT 4 +#define ID_AA64PFR1_BT_SHIFT 0#define ID_AA64PFR1_SSBS_PSTATE_NI 0#define ID_AA64PFR1_SSBS_PSTATE_ONLY 1arch/arm64/kernel/cpufeature.c +0
-0
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { · line 237
Quoted 5 lines
arch/arm64/kernel/cpufeature.c +2
-0@@ -233,7 +233,11 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { };static const struct arm64_ftr_bits ftr_id_aa64pfr1[] = { +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR1_MPAMFRAC_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR1_RASFRAC_SHIFT ,4 ,0 ),
These should be hidden as well.
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { · line 240
Quoted 3 lines
arch/arm64/kernel/cpufeature.c +2
-0+ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR1_MTE_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR1_SSBS_SHIFT ,4 ,ID_AA64PFR1_SSBS_PSTATE_NI ), + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR1_BT_SHIFT, 4, 0),
I would say remove the MTE, BTI fields for now. As they must be VISIBLE, but with the kernel support for these merged. They will be added with their respective series.
Suzuki
Re: [PATCH V3 11/16] arm64/cpufeature: Add remaining feature bits in ID_AA64PFR1 register
Quoted 35 lines · Suzuki K Poulose
Quoted 34 lines · Anshuman Khandual
Enable the following features bits in
ID_AA64PFR1register as per ARM DDI 0487F.a specification.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Suzuki K Poulose <[email protected]>Suggested-by Will Deacon <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
arch/arm64/include/asm/sysreg.h| 4 ++++ arch/arm64/kernel/cpufeature.c | 4 ++++2 files changed, 8 insertions(+)arch/arm64/include/asm/sysreg.h +4
-0@@ -666,7 +666,11 @@ #define ID_AA64PFR0_EL0_32BIT_64BIT 0x2 /* id_aa64pfr1 */ +#define ID_AA64PFR1_MPAMFRAC_SHIFT 16 +#define ID_AA64PFR1_RASFRAC_SHIFT 12 +#define ID_AA64PFR1_MTE_SHIFT 8 #define ID_AA64PFR1_SSBS_SHIFT 4 +#define ID_AA64PFR1_BT_SHIFT 0 #define ID_AA64PFR1_SSBS_PSTATE_NI 0 #define ID_AA64PFR1_SSBS_PSTATE_ONLY 1arch/arm64/kernel/cpufeature.c +0
-1--- a/arch/arm64/kernel/cpufeature.c
Quoted 8 lines
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { · line 236
Quoted 6 lines
+++
b/arch/arm64/kernel/cpufeature.carch/arm64/kernel/cpufeature.c +2
-0@@ -233,7 +233,11 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { }; static const struct arm64_ftr_bits ftr_id_aa64pfr1[] = { + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR1_MPAMFRAC_SHIFT, 4, 0), + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR1_RASFRAC_SHIFT, 4, 0),These should be hidden as well.
Will change.
Quoted 6 lines
arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { · line 240
Quoted 4 lines
arch/arm64/kernel/cpufeature.c +2
-0+ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR1_MTE_SHIFT, 4, 0), ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR1_SSBS_SHIFT, 4, ID_AA64PFR1_SSBS_PSTATE_NI), + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR1_BT_SHIFT, 4, 0),I would say remove the MTE, BTI fields for now. As they must be VISIBLE, but with the kernel support for these merged. They will be added with their respective series.
Sure, will drop above changes from the series.
Quoted 3 lines
Suzuki
PATCH v3 12/16 arm64/cpufeature: Add remaining feature bits in ID_AA64MMFR0 register
In reply to Anshuman KhandualEnable EVC, FGT, EXS, TGRAN4_2, TGRAN64_2 and TGRAN16_2 features bits in ID_AA64MMFR0 register as per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/sysreg.h | 13 +++++++++++++ arch/arm64/kernel/cpufeature.c | 7 +++++++ 2 files changed, 20 insertions(+)
arch/arm64/include/asm/sysreg.h +13 -0
@@ -699,6 +699,12 @@#define ID_AA64ZFR0_SVEVER_SVE2 0x1/* id_aa64mmfr0 */ +#define ID_AA64MMFR0_ECV_SHIFT 60 +#define ID_AA64MMFR0_FGT_SHIFT 56 +#define ID_AA64MMFR0_EXS_SHIFT 44 +#define ID_AA64MMFR0_TGRAN4_2_SHIFT 40 +#define ID_AA64MMFR0_TGRAN64_2_SHIFT 36 +#define ID_AA64MMFR0_TGRAN16_2_SHIFT 32#define ID_AA64MMFR0_TGRAN4_SHIFT 28#define ID_AA64MMFR0_TGRAN64_SHIFT 24#define ID_AA64MMFR0_TGRAN16_SHIFT 20
@@ -840,6 +846,13 @@#define ID_PFR1_SECURITY_SHIFT 4#define ID_PFR1_PROGMOD_SHIFT 0 +#define ID_AA64MMFR0_TGRAN4_2_NI 0x1 +#define ID_AA64MMFR0_TGRAN4_2_SUPPORTED 0x2 +#define ID_AA64MMFR0_TGRAN64_2_NI 0x1 +#define ID_AA64MMFR0_TGRAN64_2_SUPPORTED 0x2 +#define ID_AA64MMFR0_TGRAN16_2_NI 0x1 +#define ID_AA64MMFR0_TGRAN16_2_SUPPORTED 0x2 +#if defined(CONFIG_ARM64_4K_PAGES )#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN4_SHIFT#define ID_AA64MMFR0_TGRAN_SUPPORTED ID_AA64MMFR0_TGRAN4_SUPPORTED
arch/arm64/kernel/cpufeature.c +7 -0
@@ -264,6 +264,10 @@ static const struct arm64_ftr_bits ftr_id_aa64zfr0[] = { };static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = { + +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR0_ECV_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR0_FGT_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR0_EXS_SHIFT ,4 ,0 ),/* * We already refuse to boot CPUs that don't support our configured * page size, so we can only detect mismatches for a page size other
@@ -271,6 +275,9 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = {* exist in the wild so, even though we don't like it, we'll have to go * along with it and treat them as non-strict. */ +S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR0_TGRAN4_2_SHIFT ,4 ,ID_AA64MMFR0_TGRAN4_2_NI ), +S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR0_TGRAN64_2_SHIFT ,4 ,ID_AA64MMFR0_TGRAN64_2_NI ), +S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR0_TGRAN16_2_SHIFT ,4 ,ID_AA64MMFR0_TGRAN16_2_NI ),S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR0_TGRAN4_SHIFT ,4 ,ID_AA64MMFR0_TGRAN4_NI ),S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR0_TGRAN64_SHIFT ,4 ,ID_AA64MMFR0_TGRAN64_NI ), ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN16_SHIFT, 4, ID_AA64MMFR0_TGRAN16_NI),
Signature · 1 line
2.20.1
PATCH v3 13/16 arm64/cpufeature: Add remaining feature bits in ID_AA64MMFR1 register
In reply to Anshuman KhandualEnable ETS, TWED, XNX and SPECSEI features bits in ID_AA64MMFR1 register as per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/sysreg.h | 4 ++++ arch/arm64/kernel/cpufeature.c | 4 ++++ 2 files changed, 8 insertions(+)
arch/arm64/include/asm/sysreg.h +4 -0
@@ -730,6 +730,10 @@#endif /* id_aa64mmfr1 */ +#define ID_AA64MMFR1_ETS_SHIFT 36 +#define ID_AA64MMFR1_TWED_SHIFT 32 +#define ID_AA64MMFR1_XNX_SHIFT 28 +#define ID_AA64MMFR1_SPECSEI_SHIFT 24#define ID_AA64MMFR1_PAN_SHIFT 20#define ID_AA64MMFR1_LOR_SHIFT 16#define ID_AA64MMFR1_HPD_SHIFT 12
arch/arm64/kernel/cpufeature.c +4 -0
@@ -296,6 +296,10 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = { };static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = { +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_ETS_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_TWED_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_XNX_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_SPECSEI_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_PAN_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_LOR_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_HPD_SHIFT ,4 ,0 ),
Signature · 1 line
2.20.1
PATCH v3 14/16 arm64/cpufeature: Add remaining feature bits in ID_AA64MMFR2 register
In reply to Anshuman KhandualEnable EVT, BBM, TTL, IDS, ST, NV and CCIDX features bits in ID_AA64MMFR2 register as per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/sysreg.h | 7 +++++++ arch/arm64/kernel/cpufeature.c | 7 +++++++ 2 files changed, 14 insertions(+)
arch/arm64/include/asm/sysreg.h +7 -0
@@ -746,8 +746,15 @@/* id_aa64mmfr2 */ #define ID_AA64MMFR2_E0PD_SHIFT 60 +#define ID_AA64MMFR2_EVT_SHIFT 56 +#define ID_AA64MMFR2_BBM_SHIFT 52 +#define ID_AA64MMFR2_TTL_SHIFT 48#define ID_AA64MMFR2_FWB_SHIFT 40 +#define ID_AA64MMFR2_IDS_SHIFT 36#define ID_AA64MMFR2_AT_SHIFT 32 +#define ID_AA64MMFR2_ST_SHIFT 28 +#define ID_AA64MMFR2_NV_SHIFT 24 +#define ID_AA64MMFR2_CCIDX_SHIFT 20#define ID_AA64MMFR2_LVA_SHIFT 16#define ID_AA64MMFR2_IESB_SHIFT 12#define ID_AA64MMFR2_LSM_SHIFT 8
arch/arm64/kernel/cpufeature.c +7 -0
@@ -311,8 +311,15 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = {static const struct arm64_ftr_bits ftr_id_aa64mmfr2[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_E0PD_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_EVT_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_BBM_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_TTL_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_FWB_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_IDS_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_AT_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_ST_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_NV_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_CCIDX_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_LVA_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_IESB_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR2_LSM_SHIFT ,4 ,0 ),
Signature · 1 line
2.20.1
PATCH v3 15/16 arm64/cpufeature: Add remaining feature bits in ID_AA64DFR0 register
In reply to Anshuman KhandualEnable MTPMU and TRACEFILT features bits in ID_AA64DFR0 register as per ARM DDI 0487F.a specification.
--- arch/arm64/include/asm/sysreg.h | 2 ++ arch/arm64/kernel/cpufeature.c | 2 ++ 2 files changed, 4 insertions(+)
arch/arm64/include/asm/sysreg.h +2 -0
@@ -762,6 +762,8 @@#define ID_AA64MMFR2_CNP_SHIFT 0/* id_aa64dfr0 */ +#define ID_AA64DFR0_MTPMU_SHIFT 48 +#define ID_AA64DFR0_TRACEFILT_SHIFT 40#define ID_AA64DFR0_PMSVER_SHIFT 32#define ID_AA64DFR0_CTX_CMPS_SHIFT 28#define ID_AA64DFR0_WRPS_SHIFT 20
arch/arm64/kernel/cpufeature.c +2 -0
@@ -363,6 +363,8 @@ static const struct arm64_ftr_bits ftr_id_mmfr0[] = { };static const struct arm64_ftr_bits ftr_id_aa64dfr0[] = { +S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64DFR0_MTPMU_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64DFR0_TRACEFILT_SHIFT ,4 ,0 ),S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,36 ,28 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64DFR0_PMSVER_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64DFR0_CTX_CMPS_SHIFT ,4 ,0 ),
Signature · 1 line
2.20.1
PATCH v3 16/16 arm64/cpufeature: Replace all open bits shift encodings with macros
In reply to Anshuman KhandualThere are many open bits shift encodings for various CPU ID registers that are scattered across cpufeature. This replaces them with register specific sensible macro definitions. This should not have any functional change.
--- arch/arm64/include/asm/sysreg.h | 28 +++++++++++++++++ arch/arm64/kernel/cpufeature.c | 53 +++++++++++++++++---------------- 2 files changed, 55 insertions(+), 26 deletions(-)
arch/arm64/include/asm/sysreg.h +28 -0
@@ -764,6 +764,7 @@/* id_aa64dfr0 */ #define ID_AA64DFR0_MTPMU_SHIFT 48#define ID_AA64DFR0_TRACEFILT_SHIFT 40 +#define ID_AA64DFR0_DOUBLELOCK_SHIFT 36#define ID_AA64DFR0_PMSVER_SHIFT 32#define ID_AA64DFR0_CTX_CMPS_SHIFT 28#define ID_AA64DFR0_WRPS_SHIFT 20
@@ -816,18 +817,40 @@#define ID_ISAR6_DP_SHIFT 4#define ID_ISAR6_JSCVT_SHIFT 0 +#define ID_MMFR0_INNERSHR_SHIFT 28 +#define ID_MMFR0_FCSE_SHIFT 24 +#define ID_MMFR0_AUXREG_SHIFT 20 +#define ID_MMFR0_TCM_SHIFT 16 +#define ID_MMFR0_SHARELVL_SHIFT 12 +#define ID_MMFR0_OUTERSHR_SHIFT 8 +#define ID_MMFR0_PMSA_SHIFT 4 +#define ID_MMFR0_VMSA_SHIFT 0 +#define ID_MMFR4_EVT_SHIFT 28#define ID_MMFR4_CCIDX_SHIFT 24#define ID_MMFR4_LSM_SHIFT 20#define ID_MMFR4_HPDS_SHIFT 16#define ID_MMFR4_CNP_SHIFT 12#define ID_MMFR4_XNX_SHIFT 8 +#define ID_MMFR4_AC2_SHIFT 4#define ID_MMFR4_SPECSEI_SHIFT 0#define ID_MMFR5_ETS_SHIFT 0#define ID_PFR0_DIT_SHIFT 24#define ID_PFR0_CSV2_SHIFT 16 +#define ID_PFR0_STATE3_SHIFT 12 +#define ID_PFR0_STATE2_SHIFT 8 +#define ID_PFR0_STATE1_SHIFT 4 +#define ID_PFR0_STATE0_SHIFT 0 + +#define ID_DFR0_PERFMON_SHIFT 24 +#define ID_DFR0_MPROFDBG_SHIFT 20 +#define ID_DFR0_MMAPTRC_SHIFT 16 +#define ID_DFR0_COPTRC_SHIFT 12 +#define ID_DFR0_MMAPDBG_SHIFT 8 +#define ID_DFR0_COPSDBG_SHIFT 4 +#define ID_DFR0_COPDBG_SHIFT 0#define ID_PFR2_SSBS_SHIFT 4#define ID_PFR2_CSV3_SHIFT 0
@@ -877,6 +900,11 @@#define ID_AA64MMFR0_TGRAN_SUPPORTED ID_AA64MMFR0_TGRAN64_SUPPORTED#endif +#define MVFR2_FPMISC_SHIFT 4 +#define MVFR2_SIMDMISC_SHIFT 0 + +#define DCZID_DZP_SHIFT 4 +#define DCZID_BS_SHIFT 0/* * The ZCR_ELx_LEN_* definitions intentionally include bits [8:4] which
arch/arm64/kernel/cpufeature.c +27 -26
99 lines not on this page · raw message
Signature · 1 line
2.20.1