sparc64: recognize and support sparc M8 cpu type
PATCH 1/3 sparc64: recognize and support sparc M8 cpu type
Recognize SPARC-M8 cpu type, hardware caps and cpu distribution map.
--- arch/sparc/include/asm/spitfire.h | 1 + arch/sparc/kernel/cpu.c | 6 ++++++ arch/sparc/kernel/cpumap.c | 1 + arch/sparc/kernel/head_64.S | 6 ++++++ arch/sparc/kernel/setup_64.c | 15 +++++++++++++-- arch/sparc/mm/init_64.c | 2 ++ 6 files changed, 29 insertions(+), 2 deletions(-)
arch/sparc/include/asm/spitfire.h +1 -0
@@ -47,6 +47,7 @@#define SUN4V_CHIP_NIAGARA5 0x05#define SUN4V_CHIP_SPARC_M6 0x06#define SUN4V_CHIP_SPARC_M7 0x07 +#define SUN4V_CHIP_SPARC_M8 0x08#define SUN4V_CHIP_SPARC64X 0x8a#define SUN4V_CHIP_SPARC_SN 0x8b#define SUN4V_CHIP_UNKNOWN 0xff
arch/sparc/kernel/cpu.c +6 -0
@@ -506,6 +506,12 @@ static void __init sun4v_cpu_probe(void) sparc_pmu_type ="sparc-m7" ;break ; +case SUN4V_CHIP_SPARC_M8 : + sparc_cpu_type ="SPARC-M8" ; + sparc_fpu_type ="SPARC-M8 integrated FPU" ; + sparc_pmu_type ="sparc-m8" ; +break ; +case SUN4V_CHIP_SPARC_SN : sparc_cpu_type ="SPARC-SN" ; sparc_fpu_type ="SPARC-SN integrated FPU" ;
arch/sparc/kernel/cpumap.c +1 -0
@@ -328,6 +328,7 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)case SUN4V_CHIP_NIAGARA5 :case SUN4V_CHIP_SPARC_M6 :case SUN4V_CHIP_SPARC_M7 : +case SUN4V_CHIP_SPARC_M8 :case SUN4V_CHIP_SPARC_SN :case SUN4V_CHIP_SPARC64X : rover_inc_table = niagara_iterate_method;
arch/sparc/kernel/head_64.S +6 -0
@@ -439,6 +439,9 @@ EXPORT_SYMBOL(sun4v_chip_type) cmp %g2, '7' be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4 + cmp %g2, '8' + be,pt %xcc, 5f + mov SUN4V_CHIP_SPARC_M8, %g4 cmp %g2, 'N' be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_SN, %g4
@@ -602,6 +605,9 @@ niagara_tlb_fixup: cmp %g1, SUN4V_CHIP_SPARC_M7 be,pt %xcc, niagara4_patch nop + cmp %g1, SUN4V_CHIP_SPARC_M8 + be,pt %xcc, niagara4_patch + nop cmp %g1, SUN4V_CHIP_SPARC_SN be,pt %xcc, niagara4_patch nop
arch/sparc/kernel/setup_64.c +13 -2
@@ -288,10 +288,17 @@ static void __init sun4v_patch(void)sun4v_patch_2insn_range (&__sun4v_2insn_patch, &__sun4v_2insn_patch_end); -if (sun4v_chip_type =SUN4V_CHIP_SPARC_M7 || - sun4v_chip_type =SUN4V_CHIP_SPARC_SN ) + +switch (sun4v_chip_type) { +case SUN4V_CHIP_SPARC_M7 : +case SUN4V_CHIP_SPARC_M8 : +case SUN4V_CHIP_SPARC_SN :sun_m7_patch_2insn_range (&__sun_m7_2insn_patch, &__sun_m7_2insn_patch_end); +break ; +default : +break ; + }sun4v_hvapi_init (); }
@@ -529,6 +536,7 @@ static void __init init_sparc64_elf_hwcap(void) sun4v_chip_type =SUN4V_CHIP_NIAGARA5 || sun4v_chip_type =SUN4V_CHIP_SPARC_M6 || sun4v_chip_type =SUN4V_CHIP_SPARC_M7 || + sun4v_chip_type =SUN4V_CHIP_SPARC_M8 || sun4v_chip_type =SUN4V_CHIP_SPARC_SN || sun4v_chip_type = SUN4V_CHIP_SPARC64X) cap |= HWCAP_SPARC_BLKINIT;
@@ -538,6 +546,7 @@ static void __init init_sparc64_elf_hwcap(void) sun4v_chip_type =SUN4V_CHIP_NIAGARA5 || sun4v_chip_type =SUN4V_CHIP_SPARC_M6 || sun4v_chip_type =SUN4V_CHIP_SPARC_M7 || + sun4v_chip_type =SUN4V_CHIP_SPARC_M8 || sun4v_chip_type =SUN4V_CHIP_SPARC_SN || sun4v_chip_type = SUN4V_CHIP_SPARC64X) cap |= HWCAP_SPARC_N2;
@@ -568,6 +577,7 @@ static void __init init_sparc64_elf_hwcap(void) sun4v_chip_type =SUN4V_CHIP_NIAGARA5 || sun4v_chip_type =SUN4V_CHIP_SPARC_M6 || sun4v_chip_type =SUN4V_CHIP_SPARC_M7 || + sun4v_chip_type =SUN4V_CHIP_SPARC_M8 || sun4v_chip_type =SUN4V_CHIP_SPARC_SN || sun4v_chip_type = SUN4V_CHIP_SPARC64X) cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
@@ -578,6 +588,7 @@ static void __init init_sparc64_elf_hwcap(void) sun4v_chip_type =SUN4V_CHIP_NIAGARA5 || sun4v_chip_type =SUN4V_CHIP_SPARC_M6 || sun4v_chip_type =SUN4V_CHIP_SPARC_M7 || + sun4v_chip_type =SUN4V_CHIP_SPARC_M8 || sun4v_chip_type =SUN4V_CHIP_SPARC_SN || sun4v_chip_type = SUN4V_CHIP_SPARC64X) cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
arch/sparc/mm/init_64.c +2 -0
@@ -2138,6 +2138,7 @@ static void __init sun4v_linear_pte_xor_finalize(void)*/ switch (sun4v_chip_type) {case SUN4V_CHIP_SPARC_M7 : +case SUN4V_CHIP_SPARC_M8 :case SUN4V_CHIP_SPARC_SN : pagecv_flag =0x00 ;break ;
@@ -2290,6 +2291,7 @@ void __init paging_init(void)*/ switch (sun4v_chip_type) {case SUN4V_CHIP_SPARC_M7 : +case SUN4V_CHIP_SPARC_M8 :case SUN4V_CHIP_SPARC_SN : page_cache4v_flag = _PAGE_CP_4V;break ;
Signature · 1 line
1.9.1
Hi Allen.
Quoted 60 lines · Allen Pais
Recognize SPARC-M8 cpu type, hardware caps and cpu distribution map.
Signed-off-by Allen Pais <[email protected]>Signed-off-by David Aldridge <[email protected]>--- arch/sparc/include/asm/spitfire.h | 1 + arch/sparc/kernel/cpu.c | 6 ++++++ arch/sparc/kernel/cpumap.c | 1 + arch/sparc/kernel/head_64.S | 6 ++++++ arch/sparc/kernel/setup_64.c | 15 +++++++++++++-- arch/sparc/mm/init_64.c | 2 ++ 6 files changed, 29 insertions(+), 2 deletions(-)arch/sparc/include/asm/spitfire.h +1
-0@@ -47,6 +47,7 @@#define SUN4V_CHIP_NIAGARA5 0x05#define SUN4V_CHIP_SPARC_M6 0x06#define SUN4V_CHIP_SPARC_M7 0x07 +#define SUN4V_CHIP_SPARC_M8 0x08#define SUN4V_CHIP_SPARC64X 0x8a#define SUN4V_CHIP_SPARC_SN 0x8b#define SUN4V_CHIP_UNKNOWN 0xffarch/sparc/kernel/cpu.c +6
-0@@ -506,6 +506,12 @@ static void __init sun4v_cpu_probe(void) sparc_pmu_type ="sparc-m7" ;break ; +case SUN4V_CHIP_SPARC_M8 : + sparc_cpu_type ="SPARC-M8" ; + sparc_fpu_type ="SPARC-M8 integrated FPU" ; + sparc_pmu_type ="sparc-m8" ; +break ; +case SUN4V_CHIP_SPARC_SN : sparc_cpu_type ="SPARC-SN" ; sparc_fpu_type ="SPARC-SN integrated FPU" ;arch/sparc/kernel/cpumap.c +1
-0@@ -328,6 +328,7 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)case SUN4V_CHIP_NIAGARA5 :case SUN4V_CHIP_SPARC_M6 :case SUN4V_CHIP_SPARC_M7 : +case SUN4V_CHIP_SPARC_M8 :case SUN4V_CHIP_SPARC_SN :case SUN4V_CHIP_SPARC64X : rover_inc_table = niagara_iterate_method;arch/sparc/kernel/head_64.S +0
-0
arch/sparc/kernel/head_64.S EXPORT_SYMBOL(sun4v_chip_type) · line 444
Quoted 6 lines
arch/sparc/kernel/head_64.S +3
-0@@ -439,6 +439,9 @@ EXPORT_SYMBOL(sun4v_chip_type) cmp %g2, '7' be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4 + cmp %g2, '8' + be,pt %xcc, 5f + mov SUN4V_CHIP_SPARC_M8, %g4
Could we use this opportunity to create properly named constants for '7', '8', 'N' etc, rather than harcoding these in some assembler files.
(Obviously in a separate patch).
Sam
Quoted 16 lines
arch/sparc/kernel/head_64.S EXPORT_SYMBOL(sun4v_chip_type) · line 444
Quoted 11 lines
index 41a4073..afcd4ca 100644
arch/sparc/kernel/head_64.S +3
-0@@ -439,6 +439,9 @@ EXPORT_SYMBOL(sun4v_chip_type) cmp %g2, '7' be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4 + cmp %g2, '8' + be,pt %xcc, 5f + mov SUN4V_CHIP_SPARC_M8, %g4Could we use this opportunity to create properly named constants for '7', '8', 'N' etc, rather than harcoding these in some assembler files.
(Obviously in a separate patch).
Sure. Will send out V2 with the changes.
- Allen
Hi Sam,
Quoted 5 lines
Quoted 5 lines
+++
b/arch/sparc/kernel/head_64.S(quoted diff) +0
-0@@ -439,6 +439,9 @@ EXPORT_SYMBOL(sun4v_chip_type) cmp %g2, '7' be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4
Quoted 8 lines
Review EXPORT_SYMBOL(sun4v_chip_type) · line 444
Quoted 3 lines
(quoted diff) +3
-0+ cmp %g2, '8' + be,pt %xcc, 5f + mov SUN4V_CHIP_SPARC_M8, %g4Could we use this opportunity to create properly named constants for '7', '8', 'N' etc, rather than harcoding these in some assembler files.
(Obviously in a separate patch).
Would this work?
(quoted diff) +0 -0
b/arch/sparc/include/asm/spitfire.h
index ba3a655..c23b24e 100644
arch/sparc/include/asm/spitfire.h +11 -0
@@ -52,6 +52,17 @@#define SUN4V_CHIP_SPARC_SN 0x8b#define SUN4V_CHIP_UNKNOWN 0xff +/* CPU Constants */ +#define NIAGARA1 1 +#define NIAGARA2 2 +#define NIAGARA3 3 +#define NIAGARA4 4 +#define NIAGARA5 5 +#define M6 6 +#define M7 7 +#define M8 8 +#define SONOMA1 ('N') +#ifndef __ASSEMBLY__ enum ultra_tlb_layout {
arch/sparc/kernel/head_64.S +9 -9
@@ -424,25 +424,25 @@ EXPORT_SYMBOL(sun4v_chip_type) nop 70: ldub [%g1 + 7], %g2 - cmp %g2, '3' + cmp %g2, NIAGARA3 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA3, %g4 - cmp %g2, '4' + cmp %g2, NIAGARA4 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA4, %g4 - cmp %g2, '5' + cmp %g2, NIAGARA5 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA5, %g4 - cmp %g2, '6' + cmp %g2, M6 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M6, %g4 - cmp %g2, '7' + cmp %g2, M7 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4 - cmp %g2, '8' + cmp %g2, M8 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M8, %g4 - cmp %g2, 'N' + cmp %g2, SONOMA1 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_SN, %g4 ba,pt %xcc, 49f
@@ -451,10 +451,10 @@ EXPORT_SYMBOL(sun4v_chip_type) 91: sethi %hi(prom_cpu_compatible), %g1 or %g1, %lo(prom_cpu_compatible), %g1 ldub [%g1 + 17], %g2 - cmp %g2, '1' + cmp %g2, NIAGARA1 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA1, %g4 - cmp %g2, '2' + cmp %g2, NIAGARA2 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA2, %g4
- Allen
Hi Allen,
Quoted 27 lines · Allen
Hi Sam,
Quoted 5 lines
Quoted 5 lines
+++
b/arch/sparc/kernel/head_64.Sarch/sparc/kernel/head_64.S +0
-0@@ -439,6 +439,9 @@ EXPORT_SYMBOL(sun4v_chip_type) cmp %g2, '7' be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4Quoted 8 lines
arch/sparc/kernel/head_64.S EXPORT_SYMBOL(sun4v_chip_type) · line 444
Quoted 3 lines
arch/sparc/kernel/head_64.S +3
-0+ cmp %g2, '8' + be,pt %xcc, 5f + mov SUN4V_CHIP_SPARC_M8, %g4Could we use this opportunity to create properly named constants for '7', '8', 'N' etc, rather than harcoding these in some assembler files.
(Obviously in a separate patch).Would this work?
arch/sparc/include/asm/spitfire.h +0
-0@@ -52,6 +52,17 @@#define SUN4V_CHIP_SPARC_SN 0x8b#define SUN4V_CHIP_UNKNOWN 0xff
arch/sparc/include/asm/spitfire.h line 63
Quoted 10 lines
arch/sparc/include/asm/spitfire.h +9
-0+/* CPU Constants */ +#define NIAGARA1 1 +#define NIAGARA2 2 +#define NIAGARA3 3 +#define NIAGARA4 4 +#define NIAGARA5 5 +#define M6 6 +#define M7 7 +#define M8 8
All of the above were character constants in the original.
Regards
Richard
Quoted 60 lines
arch/sparc/include/asm/spitfire.h +2
-0+#define SONOMA1 ('N') +#ifndef __ASSEMBLY__ enum ultra_tlb_layout {arch/sparc/kernel/head_64.S +9
-10@@ -424,25 +424,25 @@ EXPORT_SYMBOL(sun4v_chip_type) nop 70: ldub [%g1 + 7], %g2 - cmp %g2, '3' + cmp %g2, NIAGARA3 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA3, %g4 - cmp %g2, '4' + cmp %g2, NIAGARA4 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA4, %g4 - cmp %g2, '5' + cmp %g2, NIAGARA5 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA5, %g4 - cmp %g2, '6' + cmp %g2, M6 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M6, %g4 - cmp %g2, '7' + cmp %g2, M7 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4 - cmp %g2, '8' + cmp %g2, M8 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M8, %g4 - cmp %g2, 'N' + cmp %g2, SONOMA1 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_SN, %g4 ba,pt %xcc, 49f@@ -451,10 +451,10 @@ EXPORT_SYMBOL(sun4v_chip_type) 91: sethi %hi(prom_cpu_compatible), %g1 or %g1, %lo(prom_cpu_compatible), %g1 ldub [%g1 + 17], %g2 - cmp %g2, '1' + cmp %g2, NIAGARA1 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA1, %g4 - cmp %g2, '2' + cmp %g2, NIAGARA2 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA2, %g4 - AllenSignature · 3 lines
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Richard,
Quoted 11 lines
Review
Quoted 9 lines
(quoted diff) +9
-0+/* CPU Constants */ +#define NIAGARA1 1 +#define NIAGARA2 2 +#define NIAGARA3 3 +#define NIAGARA4 4 +#define NIAGARA5 5 +#define M6 6 +#define M7 7 +#define M8 8All of the above were character constants in the original.
Yep. It was just a rough diff for RFC. If the thought is fine, I'll
clean and send out a patch.
- Allen
Quoted 17 lines · Allen
Hi Sam,
Quoted 5 lines
Quoted 5 lines
+++
b/arch/sparc/kernel/head_64.Sarch/sparc/kernel/head_64.S +0
-0@@ -439,6 +439,9 @@ EXPORT_SYMBOL(sun4v_chip_type) cmp %g2, '7' be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4Quoted 8 lines
arch/sparc/kernel/head_64.S EXPORT_SYMBOL(sun4v_chip_type) · line 444
Quoted 3 lines
arch/sparc/kernel/head_64.S +3
-0+ cmp %g2, '8' + be,pt %xcc, 5f + mov SUN4V_CHIP_SPARC_M8, %g4Could we use this opportunity to create properly named constants for '7', '8', 'N' etc, rather than harcoding these in some assembler files.
(Obviously in a separate patch).
Quoted 1 line
Would this work?
It is way better than the hardcoded values. If the vales have any sort of name in the sparc specs the values shall be prefixed with this. Otherwise something likeCPU_ID_xxx
And maybe add an intro comment like this:
/* following CPU_ID_xxx constants are used to identify the
* CPU type in the setup phase (see xxx.S)
*/
(As character constants, but that part is obvious).
Sam
David Miller
maintainerFrom: Allen <[email protected]>
Date: Fri, 21 Jul 2017 14:51:59 +0530
Quoted 17 lines
Hi Sam,
Quoted 5 lines
Quoted 5 lines
+++
b/arch/sparc/kernel/head_64.Sarch/sparc/kernel/head_64.S +0
-0@@ -439,6 +439,9 @@ EXPORT_SYMBOL(sun4v_chip_type) cmp %g2, '7' be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4Quoted 8 lines
arch/sparc/kernel/head_64.S EXPORT_SYMBOL(sun4v_chip_type) · line 444
Quoted 3 lines
arch/sparc/kernel/head_64.S +3
-0+ cmp %g2, '8' + be,pt %xcc, 5f + mov SUN4V_CHIP_SPARC_M8, %g4Could we use this opportunity to create properly named constants for '7', '8', 'N' etc, rather than harcoding these in some assembler files.
(Obviously in a separate patch).
Quoted 1 line
Would this work?
That won't even boot.
You're changing an ASCII character '?' value into a raw constant.
Sam/David,
Quoted 7 lines
It is way better than the hardcoded values. If the vales have any sort of name in the sparc specs the values shall be prefixed with this. Otherwise something like
CPU_ID_xxx
Quoted 5 lines
And maybe add an intro comment like this:
/* followingCPU_ID_xxxconstants are used to identify the
* CPU type in the setup phase (seexxx.S)
*/
Here's a quick diff. Let me know if this looks good to you guys. I'll send out the patch. I have tested this on a T4.
(quoted diff) +0 -0
b/arch/sparc/include/asm/spitfire.h
index 1d8321c..1b1286d 100644
arch/sparc/include/asm/spitfire.h +15 -0
@@ -47,10 +47,26 @@ +/* +* The following CPU_ID_xxx constants are used +* to identify the CPU type in the setup phase +* (see head_64.S) +*/ +#define CPU_ID_NIAGARA1 ('1') +#define CPU_ID_NIAGARA2 ('2') +#define CPU_ID_NIAGARA3 ('3') +#define CPU_ID_NIAGARA4 ('4') +#define CPU_ID_NIAGARA5 ('5') +#define CPU_ID_M6 ('6') +#define CPU_ID_M7 ('7') +#define CPU_ID_M8 ('8') +#define CPU_ID_SONOMA1 ('N') +
arch/sparc/kernel/head_64.S +7 -7
@@ -424,22 +424,25 @@ EXPORT_SYMBOL(sun4v_chip_type) nop 70: ldub [%g1 + 7], %g2 - cmp %g2, '3' + cmp %g2, CPU_ID_NIAGARA3 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA3, %g4 - cmp %g2, '4' + cmp %g2, CPU_ID_NIAGARA4 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA4, %g4 - cmp %g2, '5' + cmp %g2, CPU_ID_NIAGARA5 be,pt %xcc, 5f mov SUN4V_CHIP_NIAGARA5, %g4 - cmp %g2, '6' + cmp %g2, CPU_ID_M6 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M6, %g4 - cmp %g2, '7' + cmp %g2, CPU_ID_M7 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M7, %g4 - cmp %g2, '8' + cmp %g2, CPU_ID_M8 be,pt %xcc, 5f mov SUN4V_CHIP_SPARC_M8, %g4 - cmp %g2, 'N' + cmp %g2, CPU_ID_SONOMA1
be,pt %xcc, 5f
mov SUN4V_CHIP_SPARC_SN, %g4
ba,pt %xcc, 49fQuoted 8 lines · Allen
Sam/David,
Quoted 7 lines
It is way better than the hardcoded values. If the vales have any sort of name in the sparc specs the values shall be prefixed with this. Otherwise something like
CPU_ID_xxx
Quoted 8 lines
Quoted 5 lines
And maybe add an intro comment like this:
/* followingCPU_ID_xxxconstants are used to identify the
* CPU type in the setup phase (seexxx.S)
*/Here's a quick diff. Let me know if this looks good to you guys. I'll send out the patch. I have tested this on a T4.
From: Allen <[email protected]>
Date: Sat, 22 Jul 2017 14:26:25 +0530
Quoted 8 lines
Sam/David,
Quoted 7 lines
It is way better than the hardcoded values. If the vales have any sort of name in the sparc specs the values shall be prefixed with this. Otherwise something like
CPU_ID_xxx
Quoted 8 lines
Quoted 5 lines
And maybe add an intro comment like this:
/* followingCPU_ID_xxxconstants are used to identify the
* CPU type in the setup phase (seexxx.S)
*/Here's a quick diff. Let me know if this looks good to you guys. I'll send out the patch. I have tested this on a T4.