Skip to content

Commit 08cefa9

Browse files
committed
sparc64: Future proof Niagara cpu detection.
Recognize T4 and T5 chips. Treating them both as "T2 plus other stuff" should be extremely safe and make sure distributions will work when those chips actually ship to customers. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1a8e0da commit 08cefa9

6 files changed

Lines changed: 53 additions & 8 deletions

File tree

‎arch/sparc/include/asm/spitfire.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#define SUN4V_CHIP_NIAGARA1 0x01
4444
#define SUN4V_CHIP_NIAGARA2 0x02
4545
#define SUN4V_CHIP_NIAGARA3 0x03
46+
#define SUN4V_CHIP_NIAGARA4 0x04
47+
#define SUN4V_CHIP_NIAGARA5 0x05
4648
#define SUN4V_CHIP_UNKNOWN 0xff
4749

4850
#ifndef __ASSEMBLY__

‎arch/sparc/include/asm/xor_64.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ static struct xor_block_template xor_block_niagara = {
6666
((tlb_type == hypervisor && \
6767
(sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
6868
sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \
69-
sun4v_chip_type == SUN4V_CHIP_NIAGARA3)) ? \
69+
sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || \
70+
sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || \
71+
sun4v_chip_type == SUN4V_CHIP_NIAGARA5)) ? \
7072
&xor_block_niagara : \
7173
&xor_block_VIS)

‎arch/sparc/kernel/cpu.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,18 @@ static void __init sun4v_cpu_probe(void)
481481
sparc_pmu_type = "niagara3";
482482
break;
483483

484+
case SUN4V_CHIP_NIAGARA4:
485+
sparc_cpu_type = "UltraSparc T4 (Niagara4)";
486+
sparc_fpu_type = "UltraSparc T4 integrated FPU";
487+
sparc_pmu_type = "niagara4";
488+
break;
489+
490+
case SUN4V_CHIP_NIAGARA5:
491+
sparc_cpu_type = "UltraSparc T5 (Niagara5)";
492+
sparc_fpu_type = "UltraSparc T5 integrated FPU";
493+
sparc_pmu_type = "niagara5";
494+
break;
495+
484496
default:
485497
printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
486498
prom_cpu_compatible);

‎arch/sparc/kernel/cpumap.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)
325325
case SUN4V_CHIP_NIAGARA1:
326326
case SUN4V_CHIP_NIAGARA2:
327327
case SUN4V_CHIP_NIAGARA3:
328+
case SUN4V_CHIP_NIAGARA4:
329+
case SUN4V_CHIP_NIAGARA5:
328330
rover_inc_table = niagara_iterate_method;
329331
break;
330332
default:

‎arch/sparc/kernel/head_64.S‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ prom_sun4v_name:
133133
prom_niagara_prefix:
134134
.asciz "SUNW,UltraSPARC-T"
135135
prom_sparc_prefix:
136-
.asciz "SPARC-T"
136+
.asciz "SPARC-"
137137
.align 4
138138
prom_root_compatible:
139139
.skip 64
@@ -396,7 +396,7 @@ sun4v_chip_type:
396396
or %g1, %lo(prom_cpu_compatible), %g1
397397
sethi %hi(prom_sparc_prefix), %g7
398398
or %g7, %lo(prom_sparc_prefix), %g7
399-
mov 7, %g3
399+
mov 6, %g3
400400
90: ldub [%g7], %g2
401401
ldub [%g1], %g4
402402
cmp %g2, %g4
@@ -408,10 +408,23 @@ sun4v_chip_type:
408408

409409
sethi %hi(prom_cpu_compatible), %g1
410410
or %g1, %lo(prom_cpu_compatible), %g1
411-
ldub [%g1 + 7], %g2
411+
ldub [%g1 + 6], %g2
412+
cmp %g2, 'T'
413+
be,pt %xcc, 70f
414+
cmp %g2, 'M'
415+
bne,pn %xcc, 4f
416+
nop
417+
418+
70: ldub [%g1 + 7], %g2
412419
cmp %g2, '3'
413420
be,pt %xcc, 5f
414421
mov SUN4V_CHIP_NIAGARA3, %g4
422+
cmp %g2, '4'
423+
be,pt %xcc, 5f
424+
mov SUN4V_CHIP_NIAGARA4, %g4
425+
cmp %g2, '5'
426+
be,pt %xcc, 5f
427+
mov SUN4V_CHIP_NIAGARA5, %g4
415428
ba,pt %xcc, 4f
416429
nop
417430

@@ -543,6 +556,12 @@ niagara_tlb_fixup:
543556
be,pt %xcc, niagara2_patch
544557
nop
545558
cmp %g1, SUN4V_CHIP_NIAGARA3
559+
be,pt %xcc, niagara2_patch
560+
nop
561+
cmp %g1, SUN4V_CHIP_NIAGARA4
562+
be,pt %xcc, niagara2_patch
563+
nop
564+
cmp %g1, SUN4V_CHIP_NIAGARA5
546565
be,pt %xcc, niagara2_patch
547566
nop
548567

‎arch/sparc/kernel/setup_64.c‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,14 @@ static void __init init_sparc64_elf_hwcap(void)
425425
else if (tlb_type == hypervisor) {
426426
if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
427427
sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
428-
sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
428+
sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
429+
sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
430+
sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
429431
cap |= HWCAP_SPARC_BLKINIT;
430432
if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
431-
sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
433+
sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
434+
sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
435+
sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
432436
cap |= HWCAP_SPARC_N2;
433437
}
434438

@@ -452,11 +456,15 @@ static void __init init_sparc64_elf_hwcap(void)
452456
if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1)
453457
cap |= AV_SPARC_ASI_BLK_INIT;
454458
if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
455-
sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
459+
sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
460+
sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
461+
sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
456462
cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
457463
AV_SPARC_ASI_BLK_INIT |
458464
AV_SPARC_POPC);
459-
if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3)
465+
if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
466+
sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
467+
sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
460468
cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
461469
AV_SPARC_FMAF);
462470
}

0 commit comments

Comments
 (0)